/* =====================================================================
   api-bank/assets/ui.css — HỆ THỐNG GIAO DIỆN DÙNG CHUNG
   ---------------------------------------------------------------------
   Dùng cho: index.php · token.php · quan-ly-bank.php · lib/user-log.php

   PHONG CÁCH: kính mờ (glassmorphism) trên nền aurora chuyển động rất chậm,
   sáng/tối đặt cùng bảng màu, bo góc mềm, chữ Inter + JetBrains Mono.

   CÁCH DÙNG:
     Trang nạp lib/ui.php rồi gọi ab_ui_head() — trang đó KHÔNG cần khai
     báo <link> hay <script> nữa. Mọi class định nghĩa ở đây dùng được
     ngay, kể cả các fragment nạp bằng AJAX.

   QUY ƯỚC:
     - Biến màu mới dùng tiền tố --ink/--mut/--glass...
     - Cuối file có một lớp TÊN CŨ (--tx, --muted, --bg, --panel...)
       trỏ về tên mới, để CSS riêng của từng trang không phải sửa gì.
   ===================================================================== */

/* =====================================================================
   1. TOKENS
   ===================================================================== */
*, *::before, *::after { box-sizing: border-box }

:root {
  color-scheme: light;

  /* --- Bảng màu sáng --- */
  --ink:        #0b1220;
  --ink-2:      #475569;
  --muted:      #5a6a80;   /* >= 4.5:1 trên nền trắng — WCAG AA cho chữ nhỏ */
  --soft:       #64738a;

  --page:       #f3f6fb;
  --line:       rgba(15, 23, 42, .14);
  --line-2:     rgba(15, 23, 42, .24);

  /* Kính mờ. --tile dày hơn để logo ngân hàng (nét chữ tối) luôn nổi.
     Ba lớp kính đều DƯỠ hơn bản cũ (.72/.50): nền aurora lọt qua kính mờ
     làm chữ nhạt đi, nhất là trên máy nhỏ. */
  --glass:      rgba(255, 255, 255, .96);
  --glass-2:    rgba(255, 255, 255, .92);
  --glass-3:    rgba(255, 255, 255, .99);
  --glass-line: rgba(15, 23, 42, .13);
  --glass-hi:   rgba(255, 255, 255, .92);   /* vệt sáng trên mép trên */
  --tile:       rgba(255, 255, 255, .96);   /* ô vuông đặt logo */
  --blur:       16px;

  /* Nền đặc cho menu/mặt phẳng phủ lên nội dung — không dùng kính mờ. */
  --surface:    #ffffff;
  --surface-2:  #f1f5f9;

  /* --- Nhãn thương hiệu --- */
  --blue-700: #1d4ed8;  --blue-600: #2563eb;  --blue-500: #3b82f6;
  --blue-100: #bfdbfe;  --blue-50:  #eff6ff;
  --sky-700:  #0369a1;  --sky-600:  #0284c7;  --sky-500: #0ea5e9;  --sky-400: #38bdf8;
  --violet-500: #818cf8;

  --brand:        var(--blue-600);
  --brand-deep:   var(--blue-700);
  --brand-soft:   var(--blue-50);
  --brand-line:   var(--blue-100);

  --ok:      #047857;  --ok-soft:   #ecfdf5;  --ok-line:   #a7f3d0;  --ok-chip:   #047857;
  --warn:    #a16207;  --warn-soft: #fffbeb;  --warn-line: #fde68a;  --warn-ink:  #92400e;
  --err:     #dc2626;  --err-soft:  #fef2f2;  --err-line:  #fecaca;
  --danger:  var(--err); --dangersoft: var(--err-soft); --dangerline: var(--err-line);
  --dangerline2: var(--err-line); --dangerchip: #b91c1c;

  /* --- Quầng sáng aurora --- */
  --a1: rgba(59, 130, 246, .20);
  --a2: rgba(56, 189, 248, .18);
  --a3: rgba(129, 140, 248, .14);
  --head-bg: rgba(255, 255, 255, .94);
  --mark-from: #1d4ed8;
  --mark-to:   #0369a1;
  --mark-ink:  #ffffff;
  --bar-fade:  #93c5fd;

  /* --- Đổ bóng --- */
  --sh-1: 0 1px 2px rgba(15, 23, 42, .05);
  --sh-2: 0 4px 12px -4px rgba(15, 23, 42, .09), 0 18px 40px -26px rgba(15, 23, 42, .35);
  --sh-glass: 0 1px 0 var(--glass-hi) inset, 0 10px 30px -18px rgba(15, 23, 42, .35);

  /* --- Bo góc / khoảng cách / cỡ chữ --- */
  --r-sm: 8px; --r: 12px; --r-lg: 16px; --r-xl: 22px; --r-pill: 999px;
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 22px; --s6: 32px; --s7: 46px;
  --fs-xs: 11.5px; --fs-sm: 13px; --fs-md: 14px; --fs-lg: 16px;
  --fs-xl: 19px;  --fs-2xl: 26px; --fs-3xl: clamp(32px, 4.6vw, 52px);

  --ease: cubic-bezier(.22, .61, .36, 1);
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --sans: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;

  /* ---------------------------------------------------------------
     TÊN CŨ — giữ cho CSS riêng của từng trang khỏi phải sửa.
     Xoá khối này khi đã dọn hết chỗ dùng tên cũ.
     --------------------------------------------------------------- */
  --bg: var(--page);
  --panel: var(--glass);
  --panel2: var(--glass-2);
  --panel3: var(--glass-3);
  --tx: var(--ink);
  --tx2: var(--ink-2);
  --mut: var(--muted);
  --muted: var(--muted);
  --brand2: var(--brand-deep);
  --brandsoft: var(--brand-soft);
  --brandline: var(--brand-line);
  --headerbg: var(--head-bg);
  --sh1: var(--sh-1);
  --sh2: var(--sh-2);
  --mono-font: var(--mono);
}

[data-theme="dark"] {
  color-scheme: dark;

  --ink:   #e9edf5;
  --ink-2: #aab5c6;
  --muted: #909cb0;
  --soft:  #838f9f;

  --page:  #070a12;
  --line:  rgba(255, 255, 255, .10);
  --line-2: rgba(255, 255, 255, .18);

  --glass:      rgba(20, 25, 36, .88);
  --glass-2:    rgba(28, 34, 47, .74);
  --glass-3:    rgba(32, 39, 54, .96);
  --glass-line: rgba(255, 255, 255, .11);
  --glass-hi:   rgba(255, 255, 255, .17);
  --tile:       rgba(233, 238, 247, .82);

  --surface:    #151b27;
  --surface-2:  rgba(255, 255, 255, .06);

  --blue-700: #93c5fd; --blue-600: #60a5fa; --blue-500: #3b82f6;
  --blue-100: #1d3a63; --blue-50:  #12203a;
  --sky-700:  #bae6fd; --sky-600:  #7dd3fc; --sky-500: #38bdf8; --sky-400: #0ea5e9;
  --violet-500: #a5b4fc;

  --brand-soft: rgba(96, 165, 250, .14);
  --brand-line: rgba(96, 165, 250, .32);

  --ok: #34d399;  --ok-soft: rgba(52, 211, 153, .12);  --ok-line: rgba(52, 211, 153, .30);  --ok-chip: #34d399;
  --warn: #fbbf24; --warn-soft: rgba(251, 191, 36, .12); --warn-line: rgba(251, 191, 36, .30); --warn-ink: #fcd34d;
  --err: #f87171; --err-soft: rgba(248, 113, 113, .12); --err-line: rgba(248, 113, 113, .32);
  --dangerchip: #fca5a5;

  --a1: rgba(37, 99, 235, .26);
  --a2: rgba(14, 165, 233, .20);
  --a3: rgba(99, 102, 241, .18);
  --head-bg: rgba(10, 13, 20, .82);
  --mark-from: #93c5fd;
  --mark-to:   #7dd3fc;
  --mark-ink:  #08101d;
  --bar-fade:  #60a5fa;

  --sh-2: 0 4px 14px -4px rgba(0, 0, 0, .6), 0 20px 44px -26px rgba(0, 0, 0, .9);
  --sh-glass: 0 1px 0 var(--glass-hi) inset, 0 12px 34px -20px rgba(0, 0, 0, .85);
}

/* Không có backdrop-filter thì kính mờ biến thành lớp xám mờ — đục hẳn lại. */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  :root {
    --glass: rgba(255, 255, 255, .95);
    --glass-2: rgba(255, 255, 255, .9);
    --tile: rgba(255, 255, 255, .95);
  }
  [data-theme="dark"] {
    --glass: rgba(17, 22, 32, .96);
    --glass-2: rgba(23, 29, 40, .94);
    --tile: rgba(233, 238, 247, .96);
  }
}

/* =====================================================================
   2. NỀN TẦNG / BASE
   ===================================================================== */
html {
  scroll-behavior: smooth;
  scroll-padding-top: 88px;
  overflow-x: clip;   /* clip, không hidden — hidden làm hỏng position:sticky */
}

body {
  margin: 0;
  font-family: var(--sans);
  font-size: var(--fs-lg);
  line-height: 1.62;
  background: var(--page);
  color: var(--ink);
  overflow-x: clip;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color .3s var(--ease), color .3s var(--ease);
}
body.no-scroll { overflow: hidden }

/* =====================================================================
   2.1 THAO TÁC CHẠM — KHÔNG BÔI XANH, KHÔNG CHỌN NHẦM VĂN BẢN
   ---------------------------------------------------------------------
   Nhất quán cho MỌI trang (khách · quản trị · đăng nhập · lỗi) và cho cả
   hai chế độ sáng/tối, vì đặt ở đây thì mọi trang nạp assets/ui.css đều
   nhận — không phải khai báo lại ở từng trang.

   NGUYÊN NHÂN LỖI TRƯỚC ĐÂY
     1. -webkit-tap-highlight-color chưa được đặt ở đâu cả. Android Chrome
        và iOS Safari tự vẽ một lớp phủ bán trong suốt (xám/xanh) mỗi lần
        chạm <a>, <button>, <img> — đó chính là lớp phủ "như đang chọn văn
        bản" người dùng thấy. Thuộc tính này KẾ THỪA, nên đặt đúng MỘT lần
        trên <html> là phủ hết trang; khai báo lại ở từng thành phần là thừa.
     2. user-select / -webkit-touch-callout trước đây nằm sau
        body.protected-interaction — chỉ index.php và token.php có class đó.
        quan-ly-bank.php, lib/login-page.php và lib/error-page.php không có,
        nên chạm nút/icon/tab ở đó là trình duyệt bắt đầu CHỌN VĂN BẢN:
        iOS bật kính lúp + gạch chọn, Android bật chọn từ.
     3. Ở hai trang có class đó, chặn chọn cả <a> nên chữ link trong nội
        dung (FAQ, mô tả endpoint, ghi chú) cũng không sao chép được. Nay
        chỉ chặn đúng PHẦN TỬ ĐIỀU KHIỂN, còn văn bản thường thì tự do.

   GHI CHÚ KỸ THUẬT
     Dùng :where() nên độ ưu tiên bằng 0 — không cần !important ở đâu cả,
     và một class .sel-ok của riêng trang vẫn thắng được để bật lại chọn.
     touch-action: manipulation chỉ bỏ độ trễ 300ms của cú chạm kép, KHÔNG
     chặn cuộn hay vuốt — nên dải ngân hàng và thanh tab vẫn cuộn ngang
     bình thường. Không dùng touch-action: none vì sẽ hỏng vuốt trang.
   ===================================================================== */

/* Lớp phủ bấm mờ của hệ điều hành. Kế thừa từ <html> xuống mọi phần tử. */
html { -webkit-tap-highlight-color: transparent }

/* Ô nhập liệu, textarea và vùng sửa tại chỗ luôn phải chọn/copy được.
   Đặt TRƯỚC khối bên dưới và dùng bộ chọn thường (không :where) để nó luôn
   thắng: user-select kế thừa, nên nếu <input> nằm trong <label> thì rule
   label bên dưới không được làm mất khả năng bôi chữ trong ô. */
input, textarea, [contenteditable] {
  -webkit-user-select: text;
          user-select: text;
  -webkit-touch-callout: default;
}

/* Phần tử điều khiển: bấm ở đâu cũng không sinh vùng chọn, không hiện menu
   nhấn giữ của iOS, và không bị trình duyệt chờ cú chạm kép.
   Cố ý KHÔNG liệt kê mọi <a>: chỉ những cái nằm trong thanh điều hướng,
   menu và tab. Liên kết nằm trong nội dung vẫn bôi chữ và sao chép được. */
:where(
  button,
  summary,
  label,
  img,
  [role="button"],
  [role="tab"],
  [role="switch"],
  [role="menuitem"],
  .brand,
  .nav-btn,
  .nav-links,
  .nav-menu,
  .tabs,
  .tab,
  .btn,
  .theme-sw,
  .logo-strip,
  .marquee-btn,
  .logo-arrow
) {
  -webkit-user-select: none;
          user-select: none;
  -webkit-touch-callout: none;
          touch-action: manipulation;
}

/* Lưới an toàn cho trang muốn mở lại việc chọn văn bản trong vùng riêng
   (ví dụ khối JSON cần bôi để đối chiếu). Chỉ cần thêm class này.
   Không cần !important: khối điều khiển dùng :where() nên độ ưu tiên 0,
   class này (0-1-0) luôn thắng. */
.sel-ok {
  -webkit-user-select: text;
          user-select: text;
  -webkit-touch-callout: default;
}

/* ---- Chống sao chép ảnh / chặn phím tắt: chỉ trang có class này ---- */
body.protected-interaction img { -webkit-user-drag: none }

h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -.02em; line-height: 1.22 }
p { margin: 0 }
a { color: var(--brand); text-decoration: none }
code, .mono, pre { font-family: var(--mono); font-size: .88em }

:focus-visible { outline: 2.5px solid var(--blue-500); outline-offset: 3px; border-radius: 8px }
::selection { background: var(--brand-soft); color: var(--brand-deep) }

::-webkit-scrollbar { width: 10px; height: 10px }
::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 6px; border: 2px solid transparent; background-clip: padding-box }

/* =====================================================================
   3. TIỆN ÍCH BỐ CỤC
   ===================================================================== */
.wrap  { width: min(1200px, 92%); margin-inline: auto }
.wrap-narrow { width: min(880px, 92%); margin-inline: auto }
.grow  { flex: 1 }
.hidden { display: none !important }

.sr {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* Chuỗi dài / URL / mã không có khoảng trắng phải tự xuống dòng,
   nếu không sẽ kéo rộng trang và sinh thanh cuộn ngang trên di động. */
.prose, .log-body, .note p, .card p, .field-hint, .micro { overflow-wrap: anywhere }

/* Chữ nhỏ mờ — dùng cho ghi chú dưới form, dòng giải thích. */
.micro {
  font-size: var(--fs-sm); line-height: 1.6; color: var(--muted); margin: var(--s3) 0 0;
}
.micro code, .note code {
  font-size: .92em; padding: 1px 6px; border-radius: 6px;
  background: var(--glass-2); border: 1px solid var(--glass-line);
}

.eyebrow {
  display: inline-flex; align-items: center; gap: 7px;
  font-family: var(--mono); font-size: var(--fs-xs); font-weight: 600;
  letter-spacing: .14em; text-transform: uppercase; color: var(--sky-700);
}
.eyebrow::before { content: ''; width: 16px; height: 1px; background: currentColor; opacity: .6; flex-shrink: 0 }
[data-theme="dark"] .eyebrow { color: var(--sky-600) }

/* Nhãn nhỏ phía trên tiêu đề (trang quản trị) */
.kicker {
  display: inline-block; margin-bottom: var(--s2);
  font-family: var(--mono); font-size: var(--fs-xs); font-weight: 700;
  letter-spacing: .11em; text-transform: uppercase; color: var(--brand-deep);
}
[data-theme="dark"] .kicker { color: var(--sky-600) }

/* =====================================================================
   4. NỀN AURORA
   Ba vệt màu lớn, blur mạnh, trôi rất chậm phía sau mọi thứ.
   Chính là thứ làm cho kính mờ "có nghĩa" — bỏ đi thì kính chỉ còn
   một lớp xám phẳng.
   ===================================================================== */
.aurora { position: fixed; inset: 0; z-index: -2; overflow: hidden; pointer-events: none }
.aurora i { position: absolute; display: block; border-radius: 50%; filter: blur(100px); will-change: transform }
.aurora .a1 { width: 640px; height: 640px; top: -220px; left: -140px; background: var(--a1) }
.aurora .a2 { width: 560px; height: 560px; top: -120px; right: -160px; background: var(--a2) }
.aurora .a3 { width: 720px; height: 520px; top: 52%; left: 36%; background: var(--a3); opacity: .7 }
.motion-on .aurora .a1 { animation: drift1 34s ease-in-out infinite alternate }
.motion-on .aurora .a2 { animation: drift2 40s ease-in-out infinite alternate }
.motion-on .aurora .a3 { animation: drift3 46s ease-in-out infinite alternate }
@keyframes drift1 { from { transform: translate3d(0,0,0) } to { transform: translate3d(90px,70px,0) } }
@keyframes drift2 { from { transform: translate3d(0,0,0) } to { transform: translate3d(-80px,90px,0) } }
@keyframes drift3 { from { transform: translate3d(0,0,0) } to { transform: translate3d(60px,-80px,0) } }

/* Lớp phủ dịu để chữ luôn đủ tương phản trên nền đang chuyển động */
.aurora::after { content: ''; position: absolute; inset: 0; background: var(--page); opacity: .42 }
[data-theme="light"] .aurora::after { opacity: .68 }

@media (max-width: 640px) {
  .aurora .a1, .aurora .a2, .aurora .a3 { filter: blur(70px) }
}

/* =====================================================================
   5. HEADER
   ===================================================================== */
header {
  position: sticky; top: 0; z-index: 50;
  background: var(--head-bg);
  -webkit-backdrop-filter: blur(18px) saturate(180%);
          backdrop-filter: blur(18px) saturate(180%);
  border-bottom: 1px solid var(--line);
  transition: background-color .3s var(--ease), border-color .3s var(--ease);
}

.nav { display: flex; align-items: center; gap: var(--s3); min-height: 64px }

/* --- Logo ---
   Ô logo TỰ GIÃN theo tỉ lệ ảnh, không cố định vuông. Lý do: logo của
   nhiều thương hiệu là dải dài (ví dụ 1024×379 ≈ 2.7:1). Ép vào ô vuông
   40×40 thì ảnh bị thu còn ~34×13 — nhỏ đến mức không đọc được. */
.brand {
  display: flex; align-items: center; gap: 11px; min-width: 0; flex-shrink: 1;
  color: var(--ink); font-weight: 650; font-size: 15.5px; letter-spacing: -.02em;
}
.brand:hover { color: var(--ink) }
.brand-logo {
  height: 46px; min-width: 46px; max-width: 230px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: transparent; border: 0; box-shadow: none;
}
.brand-logo img {
  display: block; width: auto; height: 100%; max-width: 100%;
  object-fit: contain;
}
.brand-txt { min-width: 0 }
.brand-txt > b { display: block; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap }
.brand-txt > small {
  display: block; font-size: 12px; font-weight: 500; color: var(--muted); letter-spacing: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* Dự phòng khi máy chủ chưa có file logo: ẩn <img>, lộ ô chữ cái.
   Áp cho CẢ .brand-logo (thanh đầu) và .auth-logo (thẻ đăng nhập). */
.brand-logo .fallback,
.auth-logo .fallback { display: none }
.brand-logo.is-empty img,
.auth-logo.is-empty img { display: none }
.brand-logo.is-empty .fallback,
.auth-logo.is-empty .fallback {
  display: grid; place-items: center; width: 100%; height: 100%;
  font-family: var(--mono); font-size: 14px; font-weight: 700;
  color: var(--mark-ink);
  background: linear-gradient(140deg, var(--mark-from), var(--mark-to));
}

/* --- Liên kết điều hướng --- */
.nav-links { display: flex; align-items: center; gap: 2px; min-width: 0; flex-shrink: 1 }
.nav-links a {
  position: relative; padding: 7px 11px; border-radius: var(--r-sm);
  color: var(--muted); font-size: var(--fs-md); font-weight: 500; white-space: nowrap;
  transition: color .18s var(--ease), background-color .18s var(--ease);
}
.nav-links a:hover { color: var(--ink); background: var(--glass-2) }
/* Trạng thái đang xem — có gạch chân, không chỉ dựa vào màu */
.nav-links a[aria-current="true"] { color: var(--brand-deep); font-weight: 600 }
.nav-links a[aria-current="true"]::after {
  content: ''; position: absolute; left: 11px; right: 11px; bottom: 1px; height: 2px;
  background: currentColor; border-radius: 2px;
}
[data-theme="dark"] .nav-links a[aria-current="true"] { color: var(--sky-400) }

/* --- Nút "Mục lục" trên di động --- */
.nav-btn {
  display: none; align-items: center; gap: 6px; min-height: 32px; padding: 0 12px;
  border: 1px solid var(--glass-line); border-radius: var(--r-pill);
  background: var(--glass); color: var(--ink);
  font: inherit; font-size: var(--fs-sm); font-weight: 550; cursor: pointer;
  transition: background-color .18s var(--ease), border-color .18s var(--ease);
}
.nav-btn:hover { border-color: var(--line-2) }
.nav-btn[aria-expanded="true"] { background: var(--brand-soft); border-color: var(--brand-line); color: var(--brand-deep) }
.nav-btn svg { width: 14px; height: 14px; flex-shrink: 0; transition: transform .22s var(--ease) }
.nav-btn[aria-expanded="true"] svg { transform: rotate(180deg) }

.nav-menu[hidden] { display: none }
/* Menu phủ ngay lên nội dung trang nên dùng nền ĐẶC, không kính mờ:
   kính mờ ở đây làm nền aurora lọt qua, chữ mờ và khó đọc trên máy nhỏ. */
.nav-menu {
  position: absolute; left: 0; right: 0; top: 100%; z-index: 51;
  background: var(--surface);
  border: 1px solid var(--line); border-top: 0;
  border-radius: 0 0 var(--r-lg) var(--r-lg);
  box-shadow: 0 10px 28px -12px rgba(15, 23, 42, .30), 0 24px 48px -28px rgba(15, 23, 42, .38);
  padding: var(--s2) 0 var(--s3);
  max-height: min(72vh, 460px); overflow-y: auto; overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}
.nav-menu a {
  display: block; padding: 12px 4%; color: var(--ink-2);
  font-size: var(--fs-lg); font-weight: 550; border-left: 3px solid transparent;
  transition: background-color .16s var(--ease), color .16s var(--ease);
}
.nav-menu a:hover { background: var(--surface-2); color: var(--ink) }
.nav-menu a[aria-current="true"] {
  color: var(--brand-deep); border-left-color: var(--blue-600);
  font-weight: 650; background: var(--brand-soft);
}

/* Thanh tiến trình đọc trang */
.head-progress {
  position: fixed; top: 0; left: 0; height: 2px; width: 0; z-index: 60;
  background: linear-gradient(90deg, var(--blue-500), var(--sky-400), var(--violet-500));
  opacity: 0; transition: opacity .3s var(--ease);
}
.motion-on .head-progress { opacity: 1 }

/* --- Công tắc sáng/tối --- */
.theme-sw {
  display: inline-flex; padding: 3px; gap: 2px; flex-shrink: 0;
  border: 1px solid var(--glass-line); border-radius: var(--r-pill);
  background: var(--glass-2);
}
.theme-sw button {
  width: 30px; height: 30px; display: grid; place-items: center;
  border: none; border-radius: 50%; background: transparent;
  color: var(--soft); cursor: pointer;
  transition: color .18s var(--ease), background-color .18s var(--ease);
}
.theme-sw button:hover { color: var(--ink) }
.theme-sw button[aria-pressed="true"] { background: var(--brand-soft); color: var(--brand-deep) }
[data-theme="dark"] .theme-sw button[aria-pressed="true"] { color: var(--sky-400) }
.theme-sw svg { width: 15px; height: 15px }

/* =====================================================================
   6. NÚT
   ===================================================================== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 38px; max-width: 100%; padding: 0 16px;
  border: 1px solid var(--glass-line); border-radius: var(--r-pill);
  background: var(--glass); color: var(--ink);
  font: inherit; font-size: var(--fs-md); font-weight: 550;
  cursor: pointer; white-space: nowrap; text-decoration: none;
  box-shadow: var(--sh-1);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  transition: transform .2s var(--ease), box-shadow .2s var(--ease),
              background-color .2s var(--ease), border-color .2s var(--ease), color .2s var(--ease);
}
.btn:hover { transform: translateY(-2px); box-shadow: var(--sh-2); border-color: var(--line-2); color: var(--ink) }
.btn:active { transform: translateY(0) }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; transform: none }
.btn svg { width: 16px; height: 16px; flex-shrink: 0 }

.btn.primary {
  border-color: transparent; color: #fff;
  background: linear-gradient(135deg, var(--blue-600), var(--sky-500));
  box-shadow: 0 8px 22px -10px var(--blue-600);
}
.btn.primary:hover { box-shadow: 0 14px 30px -12px var(--blue-600); color: #fff }
[data-theme="dark"] .btn.primary { color: #08101d }

.btn.ok { border-color: var(--ok-line); background: var(--ok-soft); color: var(--ok) }
.btn.ok:hover { color: var(--ok); border-color: var(--ok) }
.btn.warn { border-color: var(--warn-line); background: var(--warn-soft); color: var(--warn) }
.btn.danger { border-color: var(--dangerline2); background: var(--err-soft); color: var(--err) }
.btn.danger:hover { border-color: var(--err); background: var(--err); color: #fff }
[data-theme="dark"] .btn.danger:hover { color: #1b0b0b }

.btn.ok-btn { border-color: transparent; background: var(--ok); color: #fff }
.btn.danger-solid { border-color: transparent; background: var(--err); color: #fff }
.btn.danger-solid:hover { background: var(--err); color: #fff }

.btn.sm   { min-height: 32px; padding: 0 12px; font-size: var(--fs-sm); border-radius: var(--r-pill) }
.btn.sm svg { width: 14px; height: 14px }
.btn.lg   { min-height: 46px; padding: 0 24px; font-size: var(--fs-lg) }
.btn.icon { width: 36px; min-height: 36px; padding: 0 }
.btn.block { width: 100% }
.btn .spin { display: none }
.btn.busy { pointer-events: none; opacity: .85 }
.motion-on .btn.busy .spin {
  display: block; width: 14px; height: 14px; flex-shrink: 0; border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, .45); border-top-color: #fff;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg) } }

form.inline { display: inline }

/* Quầng sáng chạy qua nút chính */
.btn.primary { position: relative; overflow: hidden }
.btn.primary::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(115deg, transparent 32%, rgba(255,255,255,.36) 50%, transparent 68%);
  transform: translateX(-120%); transition: transform .8s var(--ease);
}
.motion-on .btn.primary:hover::after { transform: translateX(120%) }
[data-theme="dark"] .btn.primary::after {
  background: linear-gradient(115deg, transparent 32%, rgba(255,255,255,.22) 50%, transparent 68%);
}

/* Nút tròn nhỏ: sao chép / tắt menu */
.icon-btn {
  flex-shrink: 0; width: 32px; height: 32px; display: grid; place-items: center;
  border: 1px solid var(--glass-line); border-radius: 50%;
  background: var(--glass-2); color: var(--soft); cursor: pointer; padding: 0;
  transition: background-color .18s var(--ease), color .18s var(--ease), border-color .18s var(--ease);
}
.icon-btn:hover { background: var(--brand-soft); color: var(--blue-600); border-color: var(--brand-line) }
.icon-btn.ok { color: var(--ok); border-color: var(--ok-line); background: var(--ok-soft) }
.icon-btn svg { width: 15px; height: 15px }

/* =====================================================================
   7. FORM
   ===================================================================== */
label { display: block; margin-bottom: 6px; font-size: var(--fs-sm); font-weight: 600; color: var(--ink) }
label .hint { font-weight: 400; color: var(--muted); font-size: var(--fs-xs) }

.input, textarea.input, select.input {
  display: block; width: 100%; min-width: 0;
  min-height: 44px; padding: 10px 14px;
  border: 1px solid var(--line-2); border-radius: var(--r);
  background: var(--glass-2); color: var(--ink);
  font: inherit; font-size: var(--fs-md);
  transition: border-color .18s var(--ease), box-shadow .18s var(--ease), background-color .18s var(--ease);
}
.input::placeholder { color: var(--soft) }
.input:focus, textarea.input:focus, select.input:focus {
  outline: none; border-color: var(--blue-500); background: var(--glass-3);
  box-shadow: 0 0 0 4px rgba(59, 130, 246, .18);
}
textarea.input { min-height: 84px; padding: 11px 14px; resize: vertical; line-height: 1.55 }
select.input {
  cursor: pointer; appearance: none; padding-right: 36px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2364738a' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 11px center; background-size: 15px;
}
[data-theme="dark"] select.input {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23909cb0' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
}
.input.sm { min-height: 38px; font-size: var(--fs-sm) }

.field { display: flex; flex-direction: column; gap: 7px; min-width: 0 }
.field-hint { font-size: var(--fs-xs); color: var(--muted); line-height: 1.55 }

.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s3) }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s3) }
.form-row { display: flex; gap: var(--s3); align-items: flex-end; flex-wrap: wrap }

.check { display: inline-flex; align-items: center; gap: 9px; font-size: var(--fs-md); color: var(--ink-2); cursor: pointer }
.check input { width: 17px; height: 17px; accent-color: var(--brand); cursor: pointer; flex-shrink: 0 }

/* Ô tìm kiếm — kính lúp nằm bên trong ô */
.search-wrap { position: relative; display: flex; align-items: center; min-width: 0 }
.search-wrap > svg { position: absolute; left: 13px; width: 15px; height: 15px; color: var(--soft); pointer-events: none }
.input.search {
  min-height: 40px; min-width: 0; padding-left: 36px; padding-right: 34px;
  border-radius: var(--r-pill);
}
.input.search::-webkit-search-cancel-button { display: none }
.search-clear {
  position: absolute; right: 9px; width: 22px; height: 22px;
  border: 0; border-radius: 50%; background: var(--glass-3); color: var(--muted);
  cursor: pointer; font-size: 16px; line-height: 1; display: grid; place-items: center; padding: 0;
}
.search-clear:hover { color: var(--ink); background: var(--line-2) }

/* Nút kính lúp — đè đúng chỗ kính lúp trang trí đang vẽ, nên giao diện
   không đổi nhưng GIỜ BẤM ĐƯỢC thật (submit form).
   Trước đây chỉ có <svg> trang trí với pointer-events:none — bấm vào chẳng
   làm gì, buộc người dùng phải bấm Enter trên bàn phím ảo. Trên điện thoại
   phím Enter đó CHÍNH LÀ biểu tượng kính lúp, nên nhiều người tưởng phải
   "ấn icon kính lúp mới tìm".

   Ô có class `has-go` (PHP tự thêm khi sinh nút) thì ẩn icon trang trí đi
   để không chồng hai kính lúp. Không dùng :has() — cần hỗ trợ trình duyệt
   cũ và tránh phải có hai quy tắc cho một việc. */
.search-go {
  position: absolute; left: 3px;
  display: grid; place-items: center; width: 32px; height: 32px;
  border: 0; border-radius: 50%; background: none; padding: 0;
  color: var(--soft); cursor: pointer;
  -webkit-appearance: none; appearance: none;
  transition: color .16s var(--ease), background-color .16s var(--ease);
}
.search-go svg { width: 15px; height: 15px; pointer-events: none }
.search-go:hover { color: var(--ink); background: var(--glass-2) }
.search-go:active { background: var(--line-2) }
.search-wrap.has-go > svg { display: none }
.input.search.has-go { padding-left: 40px }

/* =====================================================================
   8. KHUNG / THẺ
   ===================================================================== */
.glass, .panel, .card, .ep, .trybox {
  background: var(--glass);
  border: 1px solid var(--glass-line);
  box-shadow: var(--sh-glass);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(170%);
          backdrop-filter: blur(var(--blur)) saturate(170%);
}

.panel { border-radius: var(--r-xl); overflow: hidden }
.panel-body { padding: var(--s4) }
.panel-h {
  display: flex; align-items: flex-start; gap: var(--s3); flex-wrap: wrap;
  padding: var(--s4) var(--s4) 0;
}
.panel-h > div { flex: 1 1 220px; min-width: 0 }
.panel-h h2 { font-size: var(--fs-xl); letter-spacing: -.02em }
.panel-h p { margin-top: 5px; font-size: var(--fs-md); color: var(--ink-2); max-width: 66ch }

.panel-ico {
  display: grid; place-items: center; width: 40px; height: 40px; flex-shrink: 0;
  border-radius: 13px; color: #fff;
  background: linear-gradient(140deg, var(--blue-600), var(--sky-400));
  box-shadow: 0 8px 18px -10px var(--blue-600);
}
.panel-ico svg { width: 19px; height: 19px }
[data-theme="dark"] .panel-ico { color: #08101d }
.panel-ico.ok   { background: var(--ok);   box-shadow: none; color: #fff }
.panel-ico.warn { background: var(--warn); box-shadow: none; color: #fff }
.panel-ico.err  { background: var(--err);  box-shadow: none; color: #fff }

/* Khối nhỏ dồn sang mép phải của tiêu đề (ví dụ "IP hiện tại").
   Phải đè .panel-h > div vốn đã được cho co giãn. */
.panel-h > .panel-aside {
  flex: 0 0 auto; margin-left: auto; text-align: right;
}
.panel-aside .k {
  font-size: var(--fs-xs); font-weight: 600; letter-spacing: .04em;
  text-transform: uppercase; color: var(--muted);
}
.panel-aside .v { font-size: var(--fs-md); margin-top: 2px }

.card {
  position: relative; border-radius: var(--r-xl);
  padding: var(--s5) var(--s4) var(--s4);
  transition: transform .3s var(--ease), box-shadow .3s var(--ease), border-color .3s var(--ease);
}
.motion-on .card:hover {
  transform: translateY(-5px);
  box-shadow: 0 20px 46px -24px rgba(15, 23, 42, .45), 0 1px 0 var(--glass-hi) inset;
  border-color: var(--brand-line);
}
.card::after {
  content: attr(data-no); position: absolute; top: 14px; right: 18px;
  font-family: var(--mono); font-size: 28px; font-weight: 700; line-height: 1;
  color: var(--brand-deep); opacity: .10; pointer-events: none;
  transition: opacity .3s var(--ease), transform .3s var(--ease);
}
.motion-on .card:hover::after { opacity: .2; transform: translateY(-3px) }
.card h3 { margin-top: var(--s3); font-size: var(--fs-lg); font-weight: 650 }
.card p  { margin-top: 6px; font-size: var(--fs-md); line-height: 1.6; color: var(--ink-2) }

.feat-ico {
  display: grid; place-items: center; width: 40px; height: 40px; border-radius: 13px;
  color: #fff; background: linear-gradient(140deg, var(--blue-600), var(--sky-400));
  box-shadow: 0 8px 18px -10px var(--blue-600);
  transition: transform .3s var(--ease);
}
.feat-ico svg { width: 19px; height: 19px }
[data-theme="dark"] .feat-ico { color: #08101d }
.motion-on .card:hover .feat-ico { transform: scale(1.08) rotate(-5deg) }

/* Khối bên trong trang quản trị */
.block { margin-bottom: var(--s5) }
.block-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: var(--s3); flex-wrap: wrap; margin-bottom: var(--s3);
}
.block-head h2 { font-size: var(--fs-xl) }
.block-head p  { margin-top: 4px; font-size: var(--fs-md); color: var(--muted) }
.toolbar, .toolbar-form { display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap }
.toolbar-form .input { width: auto; min-width: 180px }

.page      { padding: var(--s5) 0 var(--s7) }
.page-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: var(--s4); flex-wrap: wrap; margin-bottom: var(--s4);
}
.page-head h1 { font-size: clamp(23px, 3vw, 30px); letter-spacing: -.03em }
.page-head .sub { margin-top: 6px; color: var(--muted); font-size: var(--fs-lg) }

/* Thẻ số liệu */
.stats { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: var(--s3); margin-bottom: var(--s5) }
.stat {
  padding: var(--s3) var(--s4); min-width: 0;
  border-radius: var(--r-lg);
  background: var(--glass); border: 1px solid var(--glass-line); box-shadow: var(--sh-glass);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
}
.stat .k { display: flex; align-items: center; gap: 7px; font-size: var(--fs-sm); font-weight: 600; color: var(--muted) }
.stat .k svg { width: 14px; height: 14px; flex-shrink: 0 }
.stat .v { margin-top: 7px; font-size: 28px; font-weight: 750; letter-spacing: -.035em; line-height: 1; font-family: var(--mono) }
.stat.ok .v     { color: var(--ok) }
.stat.warn .v   { color: var(--warn) }
.stat.danger .v { color: var(--err) }

/* Dải số liệu (landing) */
.facts {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px;
  background: var(--line); border: 1px solid var(--line);
  border-radius: var(--r-lg); overflow: hidden;
}
.fact {
  background: var(--glass); padding: 14px 18px; min-width: 0;
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
}
.fact b { display: block; font-size: var(--fs-xl); font-weight: 650; letter-spacing: -.02em; color: var(--ink); font-variant-numeric: tabular-nums }
.fact span { display: block; margin-top: 2px; font-size: var(--fs-sm); color: var(--muted) }

/* Con số liệu dạng thẻ kính (trang của bạn) */
.kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: var(--s2); margin-top: var(--s4) }
.kv > div {
  padding: 11px 13px; min-width: 0;
  background: var(--glass-2); border: 1px solid var(--glass-line); border-radius: var(--r);
}
.kv dt { font-size: var(--fs-xs); color: var(--muted); margin-bottom: 3px; letter-spacing: .04em; text-transform: uppercase; font-weight: 600 }
.kv dd { margin: 0; font-size: var(--fs-lg); font-weight: 600; overflow-wrap: anywhere }

/* Chỉ số nhỏ trên thanh đầu */
.hd-stat {
  display: inline-flex; align-items: center; gap: 8px; padding: 7px 14px;
  border: 1px solid var(--glass-line); border-radius: var(--r-pill);
  background: var(--glass-2); color: var(--muted);
  font-size: var(--fs-sm); font-weight: 550; white-space: nowrap;
}
.hd-stat b { font-family: var(--mono); font-weight: 700; color: var(--ink) }
.hd-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); flex-shrink: 0 }

/* =====================================================================
   9. TABS
   ===================================================================== */
.tabs {
  display: flex; gap: 2px; margin-top: var(--s4);
  border-bottom: 1px solid var(--line);
  overflow-x: auto; scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none }
.tab {
  padding: 11px 15px; border: none; background: none; color: var(--muted);
  font: inherit; font-size: var(--fs-lg); font-weight: 550;
  cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap;
  text-decoration: none;
  transition: color .18s var(--ease), border-color .18s var(--ease);
}
.tab:hover { color: var(--ink-2) }
.tab[aria-current="true"] { color: var(--ink); border-bottom-color: var(--brand) }
.tab .badge {
  display: inline-block; margin-left: 7px; padding: 1px 8px; border-radius: var(--r-pill);
  background: var(--glass-3); border: 1px solid var(--glass-line);
  color: var(--ink-2); font-size: var(--fs-xs); font-weight: 700; font-family: var(--mono);
}

/* =====================================================================
   10. NHÃN TRẠNG THÁI / CHIP
   ===================================================================== */
.status {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 11px;
  border-radius: var(--r-pill); border: 1px solid var(--ok-line);
  background: var(--ok-soft); color: var(--ok);
  font-size: var(--fs-xs); font-weight: 650; white-space: nowrap;
}
.status::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex-shrink: 0 }
.status.active  { border-color: var(--ok-line);   background: var(--ok-soft);   color: var(--ok) }
.status.locked  { border-color: var(--dangerline); background: var(--err-soft);  color: var(--err) }
.status.expired { border-color: var(--warn-line);  background: var(--warn-soft); color: var(--warn) }

.chip {
  display: inline-flex; align-items: center; gap: 5px; max-width: 100%;
  padding: 2px 10px; border-radius: var(--r-pill);
  border: 1px solid var(--glass-line); background: var(--glass-2); color: var(--ink-2);
  font-size: var(--fs-xs); font-weight: 600; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}
.chip b { color: var(--ink); font-weight: 650; font-family: var(--mono) }
.chip.bank {
  border-color: var(--brand-line); background: var(--brand-soft); color: var(--brand-deep);
  font-weight: 700; letter-spacing: .03em;
}
.chip.in,  .chip.dir.in  { border-color: var(--ok-line);   background: var(--ok-soft);   color: var(--ok-chip);   font-weight: 700 }
.chip.out, .chip.dir.out { border-color: var(--dangerline); background: var(--err-soft); color: var(--dangerchip); font-weight: 700 }
.chip.full { border-color: var(--warn-line); background: var(--warn-soft); color: var(--warn) }
.chip.full b { color: var(--warn) }
.chip.amount { font-family: var(--mono); font-weight: 700; color: var(--ink) }
.chip.desc   { max-width: 100%; overflow: hidden; text-overflow: ellipsis; font-weight: 500 }
.chip.ip     { font-family: var(--mono) }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin: var(--s2) 0 0 }

/* =====================================================================
   11. HỘP THÔNG BÁO
   ===================================================================== */
.alert {
  display: flex; align-items: flex-start; gap: 11px;
  padding: 13px 16px; border-radius: var(--r-lg); margin-bottom: var(--s4);
  font-size: var(--fs-md); line-height: 1.55;
}
.alert svg { width: 18px; height: 18px; flex-shrink: 0; margin-top: 2px }
.alert b { font-weight: 650 }
.alert.ok   { background: var(--ok-soft);   border: 1px solid var(--ok-line);   color: var(--ok) }
.alert.err  { background: var(--err-soft);  border: 1px solid var(--err-line);  color: var(--err) }
.alert.warn { background: var(--warn-soft); border: 1px solid var(--warn-line); color: var(--warn) }
.alert.info { background: var(--brand-soft); border: 1px solid var(--brand-line); color: var(--brand-deep) }

/* Ghi chú dạng khối (landing) */
.note {
  display: flex; gap: var(--s3); align-items: flex-start;
  padding: 13px 16px; border-radius: var(--r-lg);
  background: var(--brand-soft); border: 1px solid var(--brand-line);
  font-size: var(--fs-md); color: var(--ink-2); line-height: 1.6;
}
.note svg { width: 17px; height: 17px; flex-shrink: 0; color: var(--blue-600); margin-top: 3px }
.note b { color: var(--ink); font-weight: 600 }
.note.warn { background: var(--warn-soft); border-color: var(--warn-line) }
.note.warn svg { color: var(--warn) }
.note.ok { background: var(--ok-soft); border-color: var(--ok-line) }
.note.ok svg { color: var(--ok) }
[data-theme="dark"] .note svg { color: var(--blue-500) }

/* Dòng ghi chú nhỏ — không viền, chỉ vạch trái mảnh */
.tip {
  margin-top: var(--s4); padding: 2px 0 2px 15px; border-left: 2px solid var(--line-2);
  font-size: var(--fs-md); line-height: 1.65; color: var(--muted);
}
.hit-line {
  padding: 9px 13px; margin-bottom: var(--s3); border-radius: var(--r);
  background: var(--brand-soft); border: 1px solid var(--brand-line);
  font-size: var(--fs-sm); color: var(--ink-2);
}
.hit-line b { color: var(--ink); overflow-wrap: anywhere }

/* Khối hiện token mới */
.reveal {
  display: flex; gap: var(--s3); align-items: flex-start;
  padding: var(--s4); margin-bottom: var(--s4);
  border: 1px solid var(--ok-line); border-left: 3px solid var(--ok);
  border-radius: var(--r-lg); background: var(--ok-soft);
}
.reveal-ico {
  width: 38px; height: 38px; flex-shrink: 0; display: grid; place-items: center;
  border-radius: var(--r); background: var(--ok); color: #fff;
}
.reveal-ico svg { width: 19px; height: 19px }
.reveal-body { flex: 1; min-width: 0 }
.reveal-body h2 { font-size: var(--fs-lg) }
.reveal-body > p { margin-top: 4px; color: var(--muted); font-size: var(--fs-md) }
.reveal-meta { display: flex; gap: var(--s4); flex-wrap: wrap; margin-top: var(--s3); font-size: var(--fs-sm); color: var(--muted) }
.reveal-meta b { color: var(--ink); font-weight: 650 }

/* Ô hiển thị chuỗi token */
.tokbox {
  display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap;
  padding: 12px 14px; border-radius: var(--r);
  background: var(--glass-2); border: 1px solid var(--glass-line);
}
.tokbox code { flex: 1 1 190px; min-width: 0; font-size: var(--fs-md); font-weight: 500; overflow-wrap: anywhere; color: var(--ink) }
.reveal-val {
  display: flex; align-items: center; gap: var(--s2); margin-top: var(--s3);
  padding: 9px 11px; border-radius: var(--r);
  background: var(--glass-3); border: 1px solid var(--glass-line);
}
.reveal-val code {
  flex: 1; min-width: 0; font-size: var(--fs-md); font-weight: 500;
  word-break: break-all; user-select: all; color: var(--ink);
}

/* =====================================================================
   12. DANH SÁCH
   ===================================================================== */
.list, .feed { display: flex; flex-direction: column }

/* --- Danh sách token (trang quản trị) --- */
.tok {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--s3) var(--s4);
  align-items: center; padding: 18px 20px; position: relative;
  border-top: 1px solid var(--line);
  transition: background-color .18s var(--ease);
}
.tok:first-child { border-top: none }
.tok:hover { background: var(--glass-2) }
.tok::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: transparent; transition: background-color .18s var(--ease) }
.tok.is-locked::before  { background: var(--err) }
.tok.is-expired::before { background: var(--warn) }
.tok.is-locked .tok-value code, .tok.is-expired .tok-value code { opacity: .6 }
.tok.is-locked:hover .tok-value code, .tok.is-expired:hover .tok-value code { opacity: 1 }

.tok-line { display: flex; align-items: center; gap: 9px; flex-wrap: wrap }
.tok-id {
  display: inline-grid; place-items: center; min-width: 36px; height: 26px; padding: 0 9px;
  border-radius: 7px; background: var(--glass-3); border: 1px solid var(--glass-line);
  color: var(--ink-2); font-family: var(--mono); font-size: 12.5px; font-weight: 600;
}
.tok-label { font-size: var(--fs-lg); font-weight: 650; color: var(--ink) }
.tok-label.empty { font-style: italic; font-weight: 400; color: var(--soft) }
.tok-value { display: flex; align-items: center; gap: var(--s2); min-width: 0; margin-top: 7px }
.tok-value code { flex: 1; min-width: 0; font-size: 12.8px; color: var(--ink-2); word-break: break-all; line-height: 1.55; user-select: all }
.tok-meta { display: flex; align-items: center; gap: var(--s3); flex-wrap: wrap; margin-top: var(--s2); font-size: 12.8px; color: var(--muted) }
.tok-meta span { display: inline-flex; align-items: center; gap: 6px }
.tok-meta svg { width: 13px; height: 13px; color: var(--soft); flex-shrink: 0 }
.tok-meta b { color: var(--ink-2); font-weight: 600 }
.tok-actions {
  display: flex; align-items: center; gap: 7px; justify-self: end; flex-wrap: wrap;
  padding-left: var(--s4); border-left: 1px solid var(--line);
}

/* --- Nhật ký (trang quản trị) --- */
.msg {
  display: grid; grid-template-columns: 150px minmax(0, 1fr) auto; gap: var(--s4);
  align-items: start; padding: 17px 20px; border-top: 1px solid var(--line);
  transition: background-color .18s var(--ease);
}
.msg:first-child { border-top: none }
.msg:hover { background: var(--glass-2) }
.msg-time { font-size: 12.8px; color: var(--muted); padding-top: 2px }
.msg-time b { display: block; color: var(--ink-2); font-weight: 650; font-size: var(--fs-sm); font-family: var(--mono) }
.msg-body { min-width: 0 }
.msg-title { font-size: var(--fs-lg); font-weight: 650; color: var(--ink); word-break: break-word }
.msg-title.empty { font-style: italic; font-weight: 400; color: var(--soft) }
.msg-content {
  margin-top: 9px; padding: 11px 13px;
  border-left: 2px solid var(--brand-line); border-radius: 0 var(--r-sm) var(--r-sm) 0;
  background: var(--glass-2); font-size: var(--fs-md); line-height: 1.65; color: var(--ink-2);
  white-space: pre-wrap; word-break: break-word; overflow-wrap: anywhere;
  max-height: 300px; overflow-y: auto;
}
.msg-side { display: flex; flex-direction: column; align-items: flex-end; gap: var(--s2) }
.msg-parsed { display: flex; flex-wrap: wrap; gap: 6px; margin-top: var(--s2) }

/* Mặc định CẮT còn 2 dòng. Khi bấm "xem thêm" thì chuyển sang .is-open. */
.msg-peek {
  margin-top: 5px; font-size: var(--fs-md); line-height: 1.6; color: var(--muted);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; overflow-wrap: anywhere;
}
.msg-peek.is-open { display: block; -webkit-line-clamp: unset; overflow: visible }
.msg-more {
  display: inline-flex; align-items: center; gap: 5px; margin-top: 7px;
  border: 0; background: none; padding: 0; cursor: pointer;
  font: inherit; font-size: var(--fs-xs); font-weight: 600; color: var(--brand);
}
.msg-more svg { width: 13px; height: 13px; transition: transform .2s var(--ease) }
.msg-more[aria-expanded="true"] svg { transform: rotate(180deg) }
.msg-more[hidden] { display: none }

/* --- Lịch sử của người dùng (token.php) --- */
.log { list-style: none; margin: 0; padding: 0 }
.log li { border-top: 1px solid var(--line); padding: var(--s4) 0 }
.log li:first-child { border-top: none; padding-top: 0 }
.log-h { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; margin-bottom: 6px }
.log-t { font-size: var(--fs-xs); color: var(--muted); white-space: nowrap; font-family: var(--mono) }
.log-title { font-size: var(--fs-lg); font-weight: 600; overflow-wrap: anywhere; flex: 1 1 200px; min-width: 0 }
.log-body {
  margin: 0; font-size: var(--fs-md); color: var(--ink-2); line-height: 1.6;
  overflow-wrap: anywhere; white-space: pre-wrap;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.log-body.is-open { -webkit-line-clamp: unset; overflow: visible }
.log-more {
  display: inline-flex; align-items: center; gap: 5px; margin-top: 7px;
  border: 0; background: none; padding: 0; cursor: pointer;
  font: inherit; font-size: var(--fs-xs); font-weight: 600; color: var(--brand);
}
.log-more svg { width: 13px; height: 13px; transition: transform .2s var(--ease) }
.log-more[aria-expanded="true"] svg { transform: rotate(180deg) }
.log-more[hidden] { display: none }

/* --- Danh sách IP --- */
.iplist { list-style: none; margin: var(--s3) 0 0; padding: 0 }
.iplist li {
  display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap;
  padding: 10px 0; border-top: 1px solid var(--line);
}
.iplist li:first-child { border-top: none }
.iplist .pat { font-family: var(--mono); font-size: var(--fs-md); font-weight: 500; overflow-wrap: anywhere; flex: 1 1 160px; min-width: 0 }
.iplist .tag { font-size: var(--fs-xs); color: var(--muted) }
.iplist .off { opacity: .5 }
.iplist .off .pat { text-decoration: line-through; color: var(--muted) }
.iplist--scroll { max-height: min(42vh, 320px); overflow-y: auto; overflow-x: clip }

/* Thanh công cụ + đếm kết quả */
.logbar { display: flex; align-items: center; gap: var(--s3); flex-wrap: wrap; margin-bottom: var(--s4) }
.logsearch { flex: 1 1 240px; min-width: 0; margin: 0 }
.logcount { font-size: var(--fs-sm); color: var(--muted); white-space: nowrap }
.addrow { display: flex; gap: var(--s2); flex-wrap: wrap; margin-top: var(--s4); align-items: flex-end }
.addrow .field { flex: 1 1 200px }

/* =====================================================================
   13. PHÂN TRANG
   ===================================================================== */
.pager {
  display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap;
  margin-top: var(--s4); justify-content: center;
}
.pg-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 5px;
  min-height: 34px; padding: 0 12px; border-radius: var(--r-pill); cursor: pointer;
  font: inherit; font-size: var(--fs-sm); font-weight: 550;
  background: var(--glass); color: var(--ink-2);
  border: 1px solid var(--glass-line);
  transition: background-color .18s var(--ease), color .18s var(--ease), border-color .18s var(--ease);
}
.pg-btn svg { width: 15px; height: 15px }
.pg-btn:hover:not(:disabled):not(.on) { background: var(--glass-3); color: var(--ink); border-color: var(--line-2) }
.pg-btn:disabled { opacity: .35; cursor: default }
.pg-btn.num { min-width: 34px; padding: 0 }
.pg-btn.on { background: var(--blue-600); border-color: var(--blue-600); color: #fff; cursor: default }
[data-theme="dark"] .pg-btn.on { color: #08101d }
.pg-nums { display: flex; align-items: center; gap: 4px; flex-wrap: wrap }
.pg-gap { color: var(--soft); padding: 0 2px; font-size: var(--fs-sm) }
.pg-info { font-size: var(--fs-sm); color: var(--muted); margin-left: auto }

/* =====================================================================
   14. BẢNG
   ===================================================================== */
.tablewrap {
  border-radius: var(--r-lg); overflow: hidden;
  background: var(--glass); border: 1px solid var(--glass-line);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
}
table { width: 100%; border-collapse: collapse; font-size: var(--fs-md) }
th, td { padding: 11px 18px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top }
th {
  font-size: var(--fs-xs); font-weight: 650; letter-spacing: .1em; text-transform: uppercase;
  color: var(--muted); background: var(--glass-2); white-space: nowrap;
}
tbody tr:last-child td { border-bottom: none }
tbody tr:hover { background: var(--glass-2) }
td:first-child { font-weight: 550; color: var(--ink) }
td .desc, td.desc { color: var(--muted); font-weight: 400 }
.type {
  display: inline-block; padding: 1px 8px; border-radius: 6px;
  background: var(--glass-2); border: 1px solid var(--glass-line);
  font-family: var(--mono); font-size: var(--fs-xs); color: var(--ink-2);
}
.cellcode {
  padding: 2px 8px; border-radius: 6px;
  background: var(--brand-soft); border: 1px solid var(--brand-line);
  color: var(--brand-deep); font-family: var(--mono); font-size: var(--fs-xs);
}

/* =====================================================================
   15. KHỐI TRỐNG
   ===================================================================== */
.empty { padding: 44px 24px; text-align: center }
.empty-mark {
  width: 56px; height: 56px; margin: 0 auto var(--s3);
  display: grid; place-items: center; border-radius: var(--r-lg);
  background: var(--glass-2); border: 1px solid var(--glass-line); color: var(--soft);
}
.empty-mark svg { width: 26px; height: 26px }
.empty h3 { font-size: var(--fs-lg); color: var(--ink-2) }
.empty p { margin-top: 7px; color: var(--muted); font-size: var(--fs-md); max-width: 46ch; margin-inline: auto }
.empty--sm { padding: 26px 16px }
.empty--sm .empty-mark { width: 44px; height: 44px }
.empty--sm .empty-mark svg { width: 21px; height: 21px }
.empty--sm h3 { font-size: var(--fs-md) }
.empty--sm p { font-size: var(--fs-sm) }

/* =====================================================================
   16. BIỂU ĐỒ CỘT
   ===================================================================== */
.chart {
  display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: var(--s3);
  height: 210px; padding: var(--s4);
}
.bar { display: flex; flex-direction: column; align-items: center; gap: 10px; height: 100%; justify-content: flex-end; cursor: default }
.bar-track { width: 100%; max-width: 56px; flex: 1; display: flex; align-items: flex-end }
.bar-fill {
  width: 100%; min-height: 4px; border-radius: 8px 8px 4px 4px;
  background: linear-gradient(180deg, var(--brand), var(--bar-fade));
  transition: filter .18s var(--ease), transform .18s var(--ease);
}
.bar:hover .bar-fill { filter: brightness(1.14); transform: scaleX(1.04) }
.bar-n { font-family: var(--mono); font-size: var(--fs-sm); font-weight: 700; color: var(--ink-2); line-height: 1 }
.bar-l { font-size: var(--fs-xs); color: var(--muted); line-height: 1 }
.chart-foot {
  display: flex; align-items: center; justify-content: space-between; gap: var(--s3);
  flex-wrap: wrap; padding: var(--s3) var(--s4);
  border-top: 1px solid var(--line); font-size: var(--fs-md); color: var(--muted);
}
.chart-foot b { color: var(--ink-2); font-weight: 650; font-family: var(--mono) }

/* =====================================================================
   17. MODAL
   ===================================================================== */
.modal {
  position: fixed; inset: 0; z-index: 200;
  display: none; align-items: center; justify-content: center; padding: 16px;
}
.modal.open { display: flex }
.scrim {
  position: absolute; inset: 0; background: rgba(3, 5, 10, .68);
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  animation: fade .16s var(--ease);
}
@keyframes fade { from { opacity: 0 } to { opacity: 1 } }

.modal-card {
  position: relative; width: min(540px, 100%); max-height: calc(100vh - 40px);
  overflow-y: auto; padding: var(--s5);
  border-radius: var(--r-xl); box-shadow: var(--sh-2);
  background: var(--glass-3);
  border: 1px solid var(--glass-line);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(180%);
          backdrop-filter: blur(var(--blur)) saturate(180%);
  animation: pop .2s var(--ease);
}
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.985) } to { opacity: 1; transform: none } }
.modal-card h2 { font-size: var(--fs-xl) }
.modal-card .desc { margin-top: 8px; color: var(--muted); font-size: var(--fs-md) }
.modal-card .note {
  display: block; margin-top: var(--s3); padding: 12px 13px; border-radius: var(--r);
  background: var(--glass-2); border: 1px solid var(--glass-line);
  font-size: var(--fs-md); color: var(--ink-2); line-height: 1.6;
}
.modal-card .note b { color: var(--ink) }
.card-actions { display: flex; justify-content: flex-end; gap: var(--s2); margin-top: var(--s5); flex-wrap: wrap }
.card-actions form { display: inline }

.card-ico {
  width: 42px; height: 42px; display: grid; place-items: center;
  border-radius: var(--r); margin-bottom: var(--s3);
}
.card-ico svg { width: 21px; height: 21px }
.card-ico.danger { background: var(--err-soft);  color: var(--err) }
.card-ico.warn   { background: var(--warn-soft); color: var(--warn) }
.card-ico.brand  { background: var(--brand-soft); color: var(--brand-deep) }
.card-ico.ok     { background: var(--ok-soft);   color: var(--ok) }

/* ================================================================
   17.5 THẺ ĐĂNG NHẬP
   Dùng chung cho token.php (dán token) và lib/login-page.php (mật khẩu
   quản trị) — hai cổng vào nên phải trông như một.
   ================================================================ */
.auth { position: relative; width: min(440px, 100%); margin: 0 auto }

.auth-card {
  border-radius: var(--r-xl); padding: var(--s5); text-align: center;
  background: var(--glass); border: 1px solid var(--glass-line);
  box-shadow: var(--sh-glass);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(170%);
          backdrop-filter: blur(var(--blur)) saturate(170%);
}

.auth-logo {
  height: 76px; min-width: 76px; max-width: 100%; margin: 0 auto var(--s4);
  display: flex; align-items: center; justify-content: center;
  background: transparent; border: 0; box-shadow: none;
}
.auth-logo img { display: block; width: auto; height: 100%; max-width: 100%; object-fit: contain }
.auth-logo.is-empty img { display: none }
.auth-logo.is-empty .fallback {
  display: grid; place-items: center; width: 100%; height: 100%;
  font-family: var(--mono); font-size: 20px; font-weight: 700;
  color: var(--mark-ink); background: linear-gradient(140deg, var(--mark-from), var(--mark-to));
}

.auth h1 { font-size: clamp(22px, 3.4vw, 27px); letter-spacing: -.03em }
.auth .lead {
  margin: var(--s2) auto 0; max-width: 44ch;
  font-size: var(--fs-md); line-height: 1.6; color: var(--ink-2);
}
.auth form { margin-top: var(--s5); text-align: left }
.auth .micro { text-align: left }
.auth-foot { margin-top: var(--s5) !important; text-align: center !important }

/* Trang chỉ có thẻ đăng nhập: canh giữa theo chiều cao màn hình */
body.auth-only { display: grid; place-items: center; min-height: 100vh; padding: 24px }
body.auth-only .auth { margin: 0 }

/* Công tắc sáng/tối đặt nổi ở góc thẻ */
.auth > .theme-sw {
  position: absolute; top: 14px; right: 14px; z-index: 2;
  background: var(--glass-3);
}

/* =====================================================================
   18. THÔNG BÁO NỔI
   ===================================================================== */
.toast-wrap {
  position: fixed; top: 78px; left: 50%; transform: translateX(-50%); z-index: 70;
  display: flex; flex-direction: column; align-items: center; gap: var(--s2);
  width: min(430px, 92%); pointer-events: none;
}
.toast {
  display: flex; align-items: flex-start; gap: 11px; width: 100%;
  padding: 13px 16px; border-radius: var(--r-lg);
  border: 1px solid var(--glass-line); background: var(--glass-3); box-shadow: var(--sh-2);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(180%);
          backdrop-filter: blur(var(--blur)) saturate(180%);
  font-size: var(--fs-md); line-height: 1.45; color: var(--ink);
}
.toast .tico { width: 18px; height: 18px; flex-shrink: 0; margin-top: 1px }
.toast b { display: block; font-weight: 650 }
.toast small { display: block; margin-top: 2px; font-size: var(--fs-xs); color: var(--muted) }
.toast.info { border-color: var(--brand-line) } .toast.info .tico { color: var(--brand) }
.toast.ok   { border-color: var(--ok-line) }     .toast.ok .tico   { color: var(--ok) }
.toast.warn { border-color: var(--warn-line) }   .toast.warn .tico { color: var(--warn) }
.toast.err  { border-color: var(--err-line) }    .toast.err .tico  { color: var(--err) }
.toast.out { opacity: 0; transform: translateY(-10px); transition: opacity .28s var(--ease), transform .28s var(--ease) }
.motion-on .toast { animation: toastIn .34s var(--ease) }
@keyframes toastIn { from { opacity: 0; transform: translateY(-14px) } to { opacity: 1; transform: none } }

/* =====================================================================
   19. CODE
   ===================================================================== */
.codebox {
  border: 1px solid var(--glass-line); border-radius: var(--r-lg); overflow: hidden;
  background: #0b1220; box-shadow: var(--sh-2);
}
.codebox-top {
  display: flex; align-items: center; gap: var(--s3); padding: 6px 9px 6px 15px;
  border-bottom: 1px solid rgba(255, 255, 255, .07); background: rgba(255, 255, 255, .03);
}
.codebox-top > span {
  font-family: var(--mono); font-size: 10.5px; letter-spacing: .08em;
  text-transform: uppercase; color: #94a3b8;
}
.codebox-top button {
  margin-left: auto; border: none; background: transparent; color: #94a3b8; font: inherit;
  font-size: var(--fs-xs); font-weight: 600; letter-spacing: .06em; cursor: pointer;
  padding: 4px 6px; border-radius: 6px;
  transition: color .16s var(--ease), background-color .16s var(--ease);
}
.codebox-top button:hover { color: #e2e8f0; background: rgba(255, 255, 255, .08) }
pre { margin: 0; padding: 15px 17px; overflow-x: auto; font-family: var(--mono); font-size: 12.6px; line-height: 1.65; color: #dbe3ee }
pre .k { color: #7dd3fc } pre .s { color: #86efac }
pre .n { color: #fcd34d } pre .b { color: #c4b5fd }

.urlbox {
  display: flex; align-items: center; gap: 10px; padding: 10px 10px 10px 15px;
  border-radius: var(--r); background: var(--glass-2); border: 1px solid var(--glass-line);
}
.urlbox code { flex: 1; min-width: 0; font-size: 12.8px; line-height: 1.5; color: var(--brand-deep); word-break: break-all }

/* Nút sao chép tròn cạnh ô URL */
.copy {
  flex-shrink: 0; width: 31px; height: 31px; display: grid; place-items: center;
  border: 1px solid transparent; border-radius: 8px; background: transparent;
  color: var(--soft); cursor: pointer; padding: 0;
  transition: background-color .18s var(--ease), color .18s var(--ease), border-color .18s var(--ease);
}
.copy:hover { background: var(--brand-soft); color: var(--blue-600); border-color: var(--brand-line) }
.copy.ok { color: var(--ok); background: var(--ok-soft) }
.copy svg { width: 15px; height: 15px }

.label {
  display: flex; align-items: center; justify-content: space-between; gap: var(--s3);
  margin-bottom: 9px;
}
.label > span {
  font-size: var(--fs-xs); font-weight: 650; letter-spacing: .11em;
  text-transform: uppercase; color: var(--muted);
}
.label button {
  border: none; background: transparent; color: var(--blue-600); font: inherit;
  font-size: var(--fs-xs); font-weight: 650; letter-spacing: .09em; cursor: pointer;
  padding: 4px 5px; border-radius: 6px;
  transition: color .18s var(--ease);
}
.label button:hover { color: var(--blue-700); text-decoration: underline }

.linkbtn {
  border: 0; background: none; padding: 0; cursor: pointer;
  font: inherit; font-size: var(--fs-sm); font-weight: 550; color: var(--brand);
  border-bottom: 1px solid var(--brand-line); line-height: 1.5;
}
.linkbtn:hover { color: var(--blue-700); border-bottom-color: currentColor }

/* Khối <details> mở rộng (FAQ, chi tiết) */
details.raw { margin-top: var(--s2) }
details.raw summary {
  cursor: pointer; font-size: var(--fs-xs); color: var(--muted); list-style: none;
  display: inline-flex; align-items: center; gap: 6px;
}
details.raw summary::-webkit-details-marker { display: none }
details.raw summary::before { content: '▸'; font-size: 10px; transition: transform .15s var(--ease) }
details.raw[open] summary::before { transform: rotate(90deg) }
details.raw pre {
  margin: 9px 0 0; padding: 11px 13px; border-radius: var(--r);
  background: var(--glass-2); border: 1px solid var(--glass-line);
  font-size: 12.5px; line-height: 1.65; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--ink-2);
}

@keyframes pop-s { 0% { transform: scale(1) } 45% { transform: scale(.86) } 100% { transform: scale(1) } }
.motion-on .copy.ok, .motion-on .icon-btn.ok svg { animation: pop-s .3s var(--ease) }

/* =====================================================================
   20. LỘ DIỆN KHI CUỘN
   ===================================================================== */
.motion-on .rv { opacity: 0; transform: translateY(14px); transition: opacity .5s var(--ease), transform .5s var(--ease) }
.motion-on .rv.in { opacity: 1; transform: none }

/* =====================================================================
   21. CHÂN TRANG
   ===================================================================== */
footer { border-top: 1px solid var(--line); padding: var(--s5) 0; margin-top: var(--s6) }
.foot {
  display: flex; align-items: center; justify-content: space-between; gap: var(--s4);
  flex-wrap: wrap; font-size: var(--fs-sm); color: var(--muted);
}

/* =====================================================================
   22. RESPONSIVE
   ===================================================================== */
@media (max-width: 1040px) {
  .nav-links { display: none }
  .nav-btn { display: inline-flex }
}
@media (max-width: 1080px) { .stats { grid-template-columns: repeat(3, minmax(0, 1fr)) } }
@media (max-width: 980px) {
  .facts { grid-template-columns: repeat(2, minmax(0, 1fr)) }
}
@media (max-width: 860px) {
  .msg { grid-template-columns: minmax(0, 1fr); gap: 10px }
  .msg-time { display: flex; align-items: baseline; gap: 10px }
  .msg-time b { display: inline }
  .msg-side { flex-direction: row; align-items: center }
  .grid3 { grid-template-columns: repeat(2, minmax(0, 1fr)) }
}
@media (max-width: 720px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)) }
  .tok { grid-template-columns: minmax(0, 1fr); padding: 16px }
  .tok-actions { justify-self: start; width: 100%; padding-left: 0; border-left: none; border-top: 1px solid var(--line); padding-top: 12px }
  .grid2, .grid3 { grid-template-columns: minmax(0, 1fr) }
  .brand-txt > small { display: none }
  .hd-stat { display: none }
  .toast-wrap { top: 70px }
  .card-actions .btn { flex: 1 }
  .pg-info { margin-left: 0; width: 100%; text-align: center }
  .pg-btn > span { display: none }
  .pg-btn.num > span { display: inline }
  .logbar { flex-direction: column; align-items: stretch; gap: var(--s2) }
  .search-wrap { flex: 1 1 100% }
  .addrow .field { flex: 1 1 100% }
}

/* Bảng thành thẻ xếp dọc — không còn thanh cuộn ngang nào */
@media (max-width: 700px) {
  .tablewrap { border: none; background: transparent; overflow: visible }
  table, tbody, tr, td { display: block; width: 100% }
  thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap }
  tbody tr {
    background: var(--glass); border: 1px solid var(--glass-line);
    border-radius: var(--r-lg); padding: 13px 15px; margin-bottom: var(--s2); overflow: hidden;
    -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  }
  tbody tr:last-child { margin-bottom: 0 }
  tbody tr:hover { background: var(--glass) }
  td {
    border: none; padding: 3px 0; display: grid;
    grid-template-columns: 76px minmax(0, 1fr); gap: 11px; align-items: baseline;
  }
  td::before {
    content: attr(data-l); font-size: var(--fs-xs); font-weight: 650;
    letter-spacing: .08em; text-transform: uppercase; color: var(--muted);
  }
  td:first-child { font-weight: 650; font-size: var(--fs-lg); padding: 0 0 6px; display: block }
  td:first-child::before { content: none }
}

@media (max-width: 480px) {
  .stats { grid-template-columns: minmax(0, 1fr) }
  .modal-card { padding: var(--s4) }
}

/* Màn hình rất nhỏ: thanh đầu phải xếp vừa trong —
   nút menu và công tắc sáng/tối không được có lại. */
@media (max-width: 420px) {
  .nav { gap: var(--s2) }
  .nav-btn { padding: 0 11px; font-size: var(--fs-sm) }
  .theme-sw { padding: 2px }
  .theme-sw button { width: 27px; height: 27px }
  .brand { gap: 8px; font-size: 14.5px }
  .brand-logo { width: auto; height: 38px; min-width: 38px }
}

/* =====================================================================
   23. TẮT TOÀN BỘ HIỆU ỨNG KHI NGƯỜI DÙNG YÊU CẦU GIẢM CHUYỂN ĐỘNG
   ===================================================================== */
@media (prefers-reduced-motion: reduce) {
  /* class "motion-on" không được bật nên nội dung hiện ngay;
     keyframes vẫn bị vô hiệu hoá cho chắc chắn. */
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
  html { scroll-behavior: auto }
  .motion-on .rv { opacity: 1; transform: none }
  .aurora i { animation: none }
  .btn:hover, .motion-on .card:hover, .motion-on .btn.primary:hover::after { transform: none }
}