/* ============================================================
   OTP Admin — Dark Dashboard CSS
   Font: DM Sans (body) + Syne (brand/headings)
   Theme: Dark slate, indigo accent, clean utility aesthetic
   ============================================================ */

   @import url('https://fonts.googleapis.com/css2?family=Syne:wght@600;700;800&family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;1,9..40,400&display=swap');

   /* ── CSS Variables ─────────────────────────────────────────── */
   :root {
     --bg:          #0d0f14;
     --surface:     #13161e;
     --surface2:    #1a1e2a;
     --surface3:    #222736;
     --border:      rgba(255,255,255,0.07);
     --border2:     rgba(255,255,255,0.12);
   
     --accent:      #6366f1;
     --accent-dim:  rgba(99,102,241,0.18);
     --accent-glow: rgba(99,102,241,0.35);
     --success:     #22c55e;
     --danger:      #f43f5e;
     --warning:     #f59e0b;
     --success-dim: rgba(34,197,94,0.15);
     --danger-dim:  rgba(244,63,94,0.15);
   
     --text:        #e8eaf0;
     --text-muted:  #7b82a0;
     --text-dim:    #4a5070;
   
     --sidebar-w:   230px;
     --content-max: 1280px;
     --page-pad:    clamp(20px, 4vw, 40px);
     --otp-editor-h: clamp(160px, 36vh, 560px);
     --radius:      10px;
     --radius-sm:   6px;
     --shadow:      0 4px 24px rgba(0,0,0,0.45);
     --shadow-sm:   0 2px 10px rgba(0,0,0,0.3);
   
     font-size: 15px;
   }
   
   /* ── Reset ─────────────────────────────────────────────────── */
   *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
   html { scroll-behavior: smooth; }
   
   body {
     font-family: 'DM Sans', sans-serif;
     background: var(--bg);
     color: var(--text);
     min-height: 100vh;
     -webkit-font-smoothing: antialiased;
   }
   
   a { color: inherit; text-decoration: none; }
   input, textarea, button, select { font-family: inherit; font-size: inherit; }
   
   /* ── Scrollbar ──────────────────────────────────────────────── */
   ::-webkit-scrollbar { width: 6px; height: 6px; }
   ::-webkit-scrollbar-track { background: transparent; }
   ::-webkit-scrollbar-thumb { background: var(--surface3); border-radius: 99px; }
   ::-webkit-scrollbar-thumb:hover { background: var(--accent); }
   
   /* ── Layout ─────────────────────────────────────────────────── */
   /* Sidebar fixed: không dùng grid + margin-left cùng lúc (dễ lệch / dồn nội dung) */
   .app {
     min-height: 100vh;
   }
   
   /* ── Sidebar ─────────────────────────────────────────────────── */
   .sidebar {
     position: fixed;
     top: 0; left: 0;
     width: var(--sidebar-w);
     height: 100vh;
     background: var(--surface);
     border-right: 1px solid var(--border);
     display: flex;
     flex-direction: column;
     padding: 0 0 20px;
     z-index: 100;
     overflow: hidden;
   }
   
   .sidebar::before {
     content: '';
     position: absolute;
     top: -60px; left: -40px;
     width: 220px; height: 220px;
     background: radial-gradient(circle, rgba(99,102,241,0.2) 0%, transparent 70%);
     pointer-events: none;
   }
   
   .brand {
     font-family: 'Syne', sans-serif;
     font-weight: 800;
     font-size: 1.25rem;
     letter-spacing: -0.02em;
     color: #fff;
     padding: 24px 22px 20px;
     border-bottom: 1px solid var(--border);
     position: relative;
   }
   
   .brand::after {
     content: '●';
     font-size: 8px;
     color: var(--accent);
     position: absolute;
     top: 28px;
     right: 22px;
     animation: pulse 2s infinite;
   }
   
   @keyframes pulse {
     0%, 100% { opacity: 1; }
     50% { opacity: 0.3; }
   }
   
   .menu {
     display: flex;
     flex-direction: column;
     gap: 2px;
     padding: 16px 12px;
     flex: 1;
   }
   
   .menu a {
     display: flex;
     align-items: center;
     gap: 10px;
     padding: 10px 14px;
     border-radius: var(--radius-sm);
     color: var(--text-muted);
     font-size: 0.9rem;
     font-weight: 500;
     transition: all 0.18s ease;
     position: relative;
   }
   
   .menu a:hover {
     background: var(--surface3);
     color: var(--text);
   }
   
   .menu a.active {
     background: var(--accent-dim);
     color: #fff;
     font-weight: 600;
   }
   
   .menu a.active::before {
     content: '';
     position: absolute;
     left: 0; top: 20%; bottom: 20%;
     width: 3px;
     background: var(--accent);
     border-radius: 0 3px 3px 0;
   }
   
   .sidebar-bottom {
     padding: 0 12px;
   }
   
   /* ── Main ──────────────────────────────────────────────────── */
   .main {
     margin-left: var(--sidebar-w);
     width: calc(100% - var(--sidebar-w));
     min-width: 0;
     min-height: 100vh;
     display: flex;
     flex-direction: column;
     box-sizing: border-box;
   }
   
   /* ── Topbar ────────────────────────────────────────────────── */
   .topbar {
     position: sticky;
     top: 0;
     z-index: 50;
     background: rgba(13,15,20,0.85);
     backdrop-filter: blur(12px);
     -webkit-backdrop-filter: blur(12px);
     border-bottom: 1px solid var(--border);
     padding: 16px var(--page-pad);
     display: flex;
     align-items: center;
     justify-content: space-between;
     box-sizing: border-box;
   }
   
   .page-title {
     font-family: 'Syne', sans-serif;
     font-size: 1.25rem;
     font-weight: 700;
     color: #fff;
     letter-spacing: -0.02em;
   }
   
   /* ── Grid / Content ─────────────────────────────────────────── */
   .grid {
     display: grid; 
     gap: 24px;
     padding: 28px var(--page-pad) 40px;
     align-items: start;
     width: 100%;
     max-width: var(--content-max);
     margin-left: auto;
     margin-right: auto;
     box-sizing: border-box;
     flex: 1;
   }

   /* Một cột form (đổi mật khẩu): căn giữa, không dồn trái */
   .grid--single {
     grid-template-columns: minmax(0, 1fr);
     justify-items: center;
   }

   .grid--single .card {
     width: 100%;
   }

   .card-narrow {
     max-width: 640px;
     margin-inline: auto;
     width: 100%;
   }

   /* Trang OTP: trên = 2 cột (SĐT + kết quả) chiều cao theo vh; dưới = tiến trình (log) */
   .main .otp-page {
     flex: 1;
     display: flex;
     flex-direction: column;
     min-height: 0;
     width: 100%;
     max-width: var(--content-max);
     margin-left: auto;
     margin-right: auto;
     padding: 15px var(--page-pad) 15px;
     box-sizing: border-box;
     gap: 20px;
   }

   .otp-top {
     display: grid;
     grid-template-columns: repeat(2, minmax(0, 1fr));
     gap: 24px;
     align-items: stretch;
     flex: 0 0 auto;
     min-width: 0;
   }

   .otp-card-progress {
     margin-top: auto;
     flex-shrink: 0;
   }

  

   .otp-results-grid {
     display: grid;
     grid-template-columns: repeat(2, minmax(0, 1fr));
     gap: 12px;
     align-items: stretch;
     min-height: 0;
     height: calc(100% - 48px); 
   }

   .otp-results-grid .form-group {
     margin-bottom: 0;
     display: flex;
     flex-direction: column;
     min-height: 0;
   }

   .otp-results-grid .otp-textarea-vh {
     flex: 1 1 auto;
     min-height: 140px;
     height: var(--otp-editor-h);
   }

   .otp-log-wrap {
     margin-bottom: 0;
   }

   .otp-log-box {
     height: clamp(88px, 16vh, 200px);
     min-height: 72px;
     resize: vertical;
     box-sizing: border-box;
   }

   @media (max-width: 900px) {
     .otp-top {
       grid-template-columns: 1fr;
     }

     .otp-results-grid {
       grid-template-columns: 1fr;
     }

     .otp-textarea-vh {
       height: clamp(120px, 28vh, 380px);
       max-height: 55vh;
     }
   }
   
   /* ── Card ───────────────────────────────────────────────────── */
   .card {
     background: var(--surface);
     border: 1px solid var(--border);
     border-radius: var(--radius);
     padding: 24px;
     box-shadow: var(--shadow-sm);
     transition: border-color 0.2s;
   }
   
   .card:hover {
     border-color: var(--border2);
   }
   
   .card-title {
     font-family: 'Syne', sans-serif;
     font-size: 1rem;
     font-weight: 700;
     color: #fff;
     margin-bottom: 20px;
     padding-bottom: 14px;
     border-bottom: 1px solid var(--border);
     letter-spacing: -0.01em;
   }
   
   /* ── Form ───────────────────────────────────────────────────── */
   .form-group {
     margin-bottom: 16px;
   }
   
   .form-label {
     display: block;
     font-size: 0.8rem;
     font-weight: 600;
     color: var(--text-muted);
     text-transform: uppercase;
     letter-spacing: 0.06em;
     margin-bottom: 7px;
   }
   
   .input {
     width: 100%;
     background: var(--surface2);
     border: 1px solid var(--border2);
     border-radius: var(--radius-sm);
     padding: 10px 13px;
     color: var(--text);
     outline: none;
     transition: border-color 0.18s, box-shadow 0.18s;
   }
   
   .input::placeholder { color: var(--text-dim); }
   
   .input:focus {
     border-color: var(--accent);
     box-shadow: 0 0 0 3px var(--accent-dim);
   }
   
   .textarea {
     width: 100%;
     background: var(--surface2);
     border: 1px solid var(--border2);
     border-radius: var(--radius-sm);
     padding: 10px 13px;
     color: var(--text);
     outline: none;
     resize: vertical;
     min-height: 90px;
     line-height: 1.6;
     transition: border-color 0.18s, box-shadow 0.18s;
   }
   
   .textarea::placeholder { color: var(--text-dim); }
   
   .textarea:focus {
     border-color: var(--accent);
     box-shadow: 0 0 0 3px var(--accent-dim);
   }
   
   .textarea[readonly] {
     background: var(--bg);
     border-color: var(--border);
     color: var(--text-muted);
     cursor: default;
   }
   
   .row {
     display: grid;
     grid-template-columns: 1fr 1fr;
     gap: 14px;
   }
   
   @media (max-width: 600px) {
     .row { grid-template-columns: 1fr; }
   }
   
   /* ── Buttons ────────────────────────────────────────────────── */
   .btn {
     display: inline-flex;
     align-items: center;
     justify-content: center;
     gap: 6px;
     padding: 9px 18px;
     border-radius: var(--radius-sm);
     font-size: 0.85rem;
     font-weight: 600;
     cursor: pointer;
     border: none;
     transition: all 0.18s ease;
     white-space: nowrap;
   }
   
   .btn:disabled {
     opacity: 0.45;
     cursor: not-allowed;
   }
   
   .btn-primary {
     background: var(--accent);
     color: #fff;
     box-shadow: 0 0 20px var(--accent-glow);
   }
   
   .btn-primary:hover:not(:disabled) {
     background: #7577f3;
     box-shadow: 0 0 28px var(--accent-glow);
     transform: translateY(-1px);
   }
   
   .btn-secondary {
     background: var(--surface3);
     color: var(--text-muted);
     border: 1px solid var(--border2);
   }
   
   .btn-secondary:hover:not(:disabled) {
     background: var(--surface2);
     color: var(--text);
   }
   
   .btn-danger {
     background: var(--danger-dim);
     color: var(--danger);
     border: 1px solid rgba(244,63,94,0.25);
   }
   
   .btn-danger:hover:not(:disabled) {
     background: var(--danger);
     color: #fff;
   }
   
   .btn-success {
     background: var(--success-dim);
     color: var(--success);
     border: 1px solid rgba(34,197,94,0.25);
   }
   
   .btn-success:hover:not(:disabled) {
     background: var(--success);
     color: #fff;
   }
   
   .actions {
     display: flex;
     gap: 10px;
     margin-top: 6px;
     flex-wrap: wrap;
   }
   
   /* ── Table ──────────────────────────────────────────────────── */
   .table-wrap {
     overflow-x: auto;
     border-radius: var(--radius-sm);
     border: 1px solid var(--border);
   }
   
   .table {
     width: 100%;
     border-collapse: collapse;
     font-size: 0.875rem;
   }
   
   .table thead tr {
     background: var(--surface2);
     border-bottom: 1px solid var(--border2);
   }
   
   .table th {
     padding: 11px 14px;
     text-align: left;
     font-size: 0.75rem;
     font-weight: 700;
     color: var(--text-muted);
     text-transform: uppercase;
     letter-spacing: 0.05em;
     white-space: nowrap;
   }
   
   .table td {
     padding: 12px 14px;
     border-bottom: 1px solid var(--border);
     color: var(--text);
     vertical-align: middle;
   }
   
   .table tbody tr:last-child td { border-bottom: none; }
   
   .table tbody tr {
     transition: background 0.15s;
   }
   
   .table tbody tr:hover {
     background: var(--surface2);
   }
   
   .table td .btn {
     padding: 5px 12px;
     font-size: 0.78rem;
     margin-right: 4px;
     margin-bottom: 4px;
   }
   
   /* ── Badge ──────────────────────────────────────────────────── */
   .badge {
     display: inline-flex;
     align-items: center;
     gap: 5px;
     padding: 3px 10px;
     border-radius: 99px;
     font-size: 0.75rem;
     font-weight: 600;
   }
   
   .badge::before {
     content: '';
     width: 6px; height: 6px;
     border-radius: 50%;
   }
   
   .badge-active {
     background: var(--success-dim);
     color: var(--success);
     border: 1px solid rgba(34,197,94,0.2);
   }
   
   .badge-active::before {
     background: var(--success);
     box-shadow: 0 0 6px var(--success);
     animation: pulse 2s infinite;
   }
   
   .badge-inactive {
     background: rgba(100,100,120,0.15);
     color: var(--text-dim);
     border: 1px solid var(--border);
   }
   
   .badge-inactive::before { background: var(--text-dim); }
   
   /* ── Alert ──────────────────────────────────────────────────── */
   .alert {
     margin: 16px auto 0;
     padding: 12px 16px;
     border-radius: var(--radius-sm);
     font-size: 0.875rem;
     font-weight: 500;
     border-left: 3px solid;
     animation: slideIn 0.25s ease;
     max-width: var(--content-max);
     width: calc(100% - 2 * var(--page-pad));
     box-sizing: border-box;
   }
   
   @keyframes slideIn {
     from { opacity: 0; transform: translateY(-8px); }
     to   { opacity: 1; transform: translateY(0); }
   }
   
   .alert-success {
     background: var(--success-dim);
     color: var(--success);
     border-color: var(--success);
   }
   
   .alert-error {
     background: var(--danger-dim);
     color: var(--danger);
     border-color: var(--danger);
   }
   
   /* ── Empty state ─────────────────────────────────────────────── */
   .empty {
     text-align: center;
     padding: 40px 20px;
     color: var(--text-dim);
     font-size: 0.875rem;
   }
   
   /* ── Small text ──────────────────────────────────────────────── */
   .small {
     font-size: 0.8rem;
     color: var(--text-muted);
   }
   
   /* ── Code preview / info box ─────────────────────────────────── */
   .code-preview {
     background: var(--surface2) !important;
     border: 1px solid var(--border2) !important;
     border-radius: var(--radius-sm) !important;
     padding: 10px 14px !important;
     font-size: 0.875rem;
     color: var(--text);
     line-height: 1.6;
   }

   .code-preview--muted {
     color: var(--text-muted);
   }

   .code-preview--warn {
     color: var(--danger) !important;
   }

   /* Thanh tiến trình (trang OTP) — tông tối, không dùng nền xám sáng */
   .progress-track {
     width: 100%;
     height: 14px;
     background: var(--surface3);
     border-radius: 999px;
     overflow: hidden;
     border: 1px solid var(--border);
   }
   
   /* ── Progress bar ────────────────────────────────────────────── */
   #progress-bar {
     background: linear-gradient(90deg, var(--accent), #a78bfa) !important;
     border-radius: 99px;
     box-shadow: 0 0 10px var(--accent-glow);
     transition: width 0.3s ease !important;
   }
   
   /* ── Stats row ───────────────────────────────────────────────── */
   .small span {
     color: #fff;
     font-weight: 600;
   }
   
   /* ── Login Page ──────────────────────────────────────────────── */
   .login-page {
     min-height: 100vh;
     display: flex;
     align-items: center;
     justify-content: center;
     background: var(--bg);
     padding: 24px;
     position: relative;
     overflow: hidden;
   }
   
   .login-page::before {
     content: '';
     position: absolute;
     top: -200px; left: 50%;
     transform: translateX(-50%);
     width: 700px; height: 700px;
     background: radial-gradient(circle, rgba(99,102,241,0.12) 0%, transparent 60%);
     pointer-events: none;
   }
   
   .login-card {
     background: var(--surface);
     border: 1px solid var(--border2);
     border-radius: 16px;
     padding: 40px 36px;
     width: 100%;
     max-width: 420px;
     box-shadow: 0 20px 60px rgba(0,0,0,0.5);
     position: relative;
     animation: fadeUp 0.4s ease;
   }
   
   @keyframes fadeUp {
     from { opacity: 0; transform: translateY(20px); }
     to   { opacity: 1; transform: translateY(0); }
   }
   
   .login-title {
     font-family: 'Syne', sans-serif;
     font-size: 1.8rem;
     font-weight: 800;
     color: #fff;
     letter-spacing: -0.03em;
     margin-bottom: 6px;
     text-align: center;
   }
   
   .login-subtitle {
     font-size: 0.875rem;
     color: var(--text-muted);
     text-align: center;
     margin-bottom: 28px;
   }
   
   .login-card .alert {
     margin: 0 0 16px;
     width: 100%;
     max-width: none;
   }
   
   .login-card .form-group {
     margin-bottom: 18px;
   }
   
   /* ── Responsive ──────────────────────────────────────────────── */
   @media (max-width: 768px) {
     .sidebar {
       position: static;
       width: 100%;
       height: auto;
       flex-direction: row;
       flex-wrap: wrap;
       padding: 12px;
       border-right: none;
       border-bottom: 1px solid var(--border);
     }
   
     .menu {
       flex-direction: row;
       padding: 0;
       gap: 4px;
     }
   
     .sidebar-bottom { padding: 0; }
   
     .main { margin-left: 0; width: 100%; }
   
     .grid { padding: 20px var(--page-pad) 32px; gap: 16px; grid-template-columns: 1fr; }
   
     .topbar { padding: 14px var(--page-pad); }
   
     .alert { margin-top: 12px; width: calc(100% - 2 * var(--page-pad)); }

     .main .otp-page {
       padding: 20px var(--page-pad) 24px;
     }
   }