/* ==========================================================================
   EWord back-office theme (ADM-UI-13, 2026-10-08)
   Không JS, không CDN: font Be Vietnam Pro + icon + logo tự host trong /admin/assets.
   Token màu theo docs/ui_ux_screen_spec.txt §1.1.1 (mint / orange / crimson / slate / semantic).
   Quy tắc tương phản: chữ trắng chỉ trên mintStrong / orangeStrong / errorText; nền mint / orange
   nguyên bản ⇒ chữ slate900.
   ========================================================================== */

/* ---------- Font ---------- */
@font-face { font-family: "Be Vietnam Pro"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("fonts/BeVietnamPro-Regular.woff2") format("woff2"); }
@font-face { font-family: "Be Vietnam Pro"; font-style: normal; font-weight: 500; font-display: swap;
  src: url("fonts/BeVietnamPro-Medium.woff2") format("woff2"); }
@font-face { font-family: "Be Vietnam Pro"; font-style: normal; font-weight: 600; font-display: swap;
  src: url("fonts/BeVietnamPro-SemiBold.woff2") format("woff2"); }
@font-face { font-family: "Be Vietnam Pro"; font-style: normal; font-weight: 700; font-display: swap;
  src: url("fonts/BeVietnamPro-Bold.woff2") format("woff2"); }
/* Be Vietnam Pro không có tính năng tnum ⇒ bộ chữ số đều bề rộng dựng từ chính font (chỉ 0–9),
   đặt trước font chính trong bảng / ô số liệu ⇒ cột số thẳng hàng. */
@font-face { font-family: "EW Tabular Digits"; font-weight: 400; font-display: swap; unicode-range: U+0030-0039;
  src: url("fonts/EWTabularDigits-Regular.woff2") format("woff2"); }
@font-face { font-family: "EW Tabular Digits"; font-weight: 500; font-display: swap; unicode-range: U+0030-0039;
  src: url("fonts/EWTabularDigits-Medium.woff2") format("woff2"); }
@font-face { font-family: "EW Tabular Digits"; font-weight: 600; font-display: swap; unicode-range: U+0030-0039;
  src: url("fonts/EWTabularDigits-SemiBold.woff2") format("woff2"); }
@font-face { font-family: "EW Tabular Digits"; font-weight: 700; font-display: swap; unicode-range: U+0030-0039;
  src: url("fonts/EWTabularDigits-Bold.woff2") format("woff2"); }

/* ---------- Tokens ---------- */
:root {
  color-scheme: light;
  /* thương hiệu */
  --mint: #10B981; --mint-strong: #047857; --mint-strong-hover: #065F46; --mint-300: #6EE7B7; --mint-400: #34D399;
  --orange: #F97316; --orange-strong: #C2410C;
  --crimson: #EF4444; --amber: #F59E0B; --electric: #06B6D4;
  /* slate */
  --slate50: #F8FAFC; --slate100: #F1F5F9; --slate200: #E2E8F0; --slate300: #CBD5E1; --slate400: #94A3B8;
  --slate500: #64748B; --slate600: #475569; --slate700: #334155; --slate800: #1E293B; --slate900: #0F172A;

  /* bề mặt / chữ / viền (nền sáng) */
  --bg: var(--slate50);
  --surface: #FFFFFF;
  --surface-2: var(--slate50);     /* đầu bảng, ô phụ */
  --surface-3: var(--slate100);    /* hover */
  --border: var(--slate200);
  --border-strong: var(--slate300);
  --text: var(--slate900);
  --text-2: var(--slate600);
  --text-3: var(--slate500);
  --link: var(--mint-strong);
  --code-bg: var(--slate50);

  /* semantic: nền nhạt / viền / chữ / icon */
  --ok-bg: #ECFDF5; --ok-border: #A7F3D0; --ok-text: #047857; --ok-icon: var(--mint);
  --warn-bg: #FFFBEB; --warn-border: #FDE68A; --warn-text: var(--slate900); --warn-icon: #D97706; --warn-pill: #92400E;
  --err-bg: #FEF2F2; --err-border: #FECACA; --err-text: #B91C1C; --err-icon: var(--crimson); --err-solid: #DC2626;
  --info-bg: #ECFEFF; --info-border: #A5F3FC; --info-text: #0E7490; --info-icon: var(--electric);
  --hi-bg: #FFF7ED; --hi-border: #FED7AA; --hi-text: var(--orange-strong);
  --mark-bg: #FEF3C7;

  /* nút chính: mintStrong + chữ trắng */
  --primary-bg: var(--mint-strong); --primary-bg-hover: var(--mint-strong-hover); --primary-fg: #FFFFFF;
  --danger-bg: var(--err-solid); --danger-bg-hover: #B91C1C;

  /* thanh bên luôn tối (slate900) */
  --side-bg: var(--slate900); --side-border: #1E293B; --side-text: #CBD5E1; --side-muted: #64748B;

  --ring: 0 0 0 3px rgba(16, 185, 129, .28);
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .04), 0 1px 3px rgba(15, 23, 42, .06);
  --shadow-md: 0 4px 12px rgba(15, 23, 42, .08), 0 1px 3px rgba(15, 23, 42, .06);
  --radius: 12px; --radius-sm: 8px;
  --side-w: 240px; --top-h: 56px;
  --font: "Be Vietnam Pro", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-num: "EW Tabular Digits", "Be Vietnam Pro", system-ui, sans-serif;
  --font-mono: ui-monospace, "Cascadia Mono", "Cascadia Code", Consolas, "Liberation Mono", monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #0B0F19;                   /* Dark Navy */
    --surface: #0F172A;              /* slate900 */
    --surface-2: #131D33;
    --surface-3: #1E293B;            /* slate800 */
    --border: #1E293B;
    --border-strong: #334155;
    --text: #F1F5F9;
    --text-2: #CBD5E1;
    --text-3: #94A3B8;
    --link: var(--mint-400);
    --code-bg: #0B1222;

    --ok-bg: rgba(16, 185, 129, .12); --ok-border: rgba(16, 185, 129, .35); --ok-text: #6EE7B7; --ok-icon: var(--mint-400);
    --warn-bg: rgba(245, 158, 11, .12); --warn-border: rgba(245, 158, 11, .35); --warn-text: #FDE68A; --warn-icon: #FBBF24; --warn-pill: #FCD34D;
    --err-bg: rgba(239, 68, 68, .12); --err-border: rgba(239, 68, 68, .38); --err-text: #FCA5A5; --err-icon: #F87171; --err-solid: #DC2626;
    --info-bg: rgba(6, 182, 212, .12); --info-border: rgba(6, 182, 212, .35); --info-text: #67E8F9; --info-icon: #22D3EE;
    --hi-bg: rgba(249, 115, 22, .14); --hi-border: rgba(249, 115, 22, .4); --hi-text: #FDBA74;
    --mark-bg: rgba(245, 158, 11, .28);

    /* nền tối: nút chính = mint nguyên bản + chữ slate900 (onAccent 7.0:1) */
    --primary-bg: var(--mint); --primary-bg-hover: var(--mint-400); --primary-fg: var(--slate900);

    --side-bg: #080C16; --side-border: #172033;
    --ring: 0 0 0 3px rgba(52, 211, 153, .35);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
    --shadow-md: 0 6px 18px rgba(0, 0, 0, .4);
  }
}

/* ---------- Nền tảng ---------- */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh;
  font: 400 14px/1.55 var(--font); color: var(--text); background: var(--bg);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
a { color: var(--link); text-decoration: none; text-underline-offset: 2px; }
a:hover { text-decoration: underline; }
b, strong { font-weight: 600; }
h1, h2, h3 { color: var(--text); line-height: 1.3; letter-spacing: -.01em; }
h1 { font-size: 24px; font-weight: 600; margin: 0 0 8px; }
h2 { font-size: 18px; font-weight: 600; margin: 32px 0 12px; }
h3 { font-size: 15px; font-weight: 600; margin: 20px 0 8px; }
p { margin: 0 0 10px; }
ul, ol { margin: 0 0 10px; padding-left: 22px; }
li { margin: 2px 0; }
hr { border: 0; border-top: 1px solid var(--border); margin: 20px 0; }
.muted { color: var(--text-2); }
.small { font-size: 12px; }
.mono, code, kbd { font-family: var(--font-mono); font-size: .92em; }
.mono { word-break: break-all; }
a.mono, td > .mono:only-child, td.mono:first-child { word-break: normal; white-space: nowrap; }
td form.inline select { max-width: 220px; }
mark { background: var(--mark-bg); color: inherit; border-radius: 3px; padding: 0 2px; }
:focus-visible { outline: 2px solid var(--mint-strong); outline-offset: 2px; border-radius: 4px; }
@media (prefers-color-scheme: dark) { :focus-visible { outline-color: var(--mint-400); } }
::selection { background: rgba(16, 185, 129, .25); }
.ic { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round; vertical-align: -4px; }

/* ---------- Khung trang: thanh bên + thanh trên ---------- */
.sidebar {
  position: fixed; inset: 0 auto 0 0; z-index: 30; width: var(--side-w);
  display: flex; flex-direction: column;
  background: var(--side-bg); color: var(--side-text); border-right: 1px solid var(--side-border);
  overflow-y: auto; overscroll-behavior: contain;
}
.sidebar ~ .topbar, .sidebar ~ main { margin-left: var(--side-w); }
/* nền thanh bên kéo dài hết trang (cả khi chụp / in toàn trang) */
body:has(> .sidebar) { background: linear-gradient(to right, var(--side-bg) var(--side-w), var(--bg) var(--side-w)); }
.side-brand { display: flex; align-items: center; gap: 10px; padding: 20px 20px 14px; text-decoration: none; }
.side-brand:hover { text-decoration: none; }
.side-brand .logo-full { height: 38px; width: auto; display: block; }
.side-brand .logo-mark { display: none; width: 36px; height: 36px; }
.side-tag {
  font-size: 10.5px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase;
  color: var(--mint-300); background: rgba(16, 185, 129, .14); border: 1px solid rgba(16, 185, 129, .3);
  padding: 1px 7px; border-radius: 999px; line-height: 16px;
}
.side-nav { flex: 1; display: flex; flex-direction: column; gap: 18px; padding: 8px 12px 16px; }
.side-nav .grp { display: flex; flex-direction: column; gap: 2px; }
.side-nav .gl {
  font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase;
  color: var(--side-muted); padding: 0 10px 6px;
}
.nav-item {
  position: relative; display: flex; align-items: center; gap: 11px; min-height: 36px; padding: 0 10px;
  border-radius: var(--radius-sm); color: var(--side-text); font-weight: 500; font-size: 13.5px;
  text-decoration: none; transition: background-color .12s, color .12s;
}
.nav-item .ic { width: 18px; height: 18px; vertical-align: 0; color: var(--slate400); transition: color .12s; }
.nav-item:hover { background: rgba(148, 163, 184, .10); color: #F8FAFC; text-decoration: none; }
.nav-item:hover .ic { color: #E2E8F0; }
.nav-item.on { background: rgba(16, 185, 129, .14); color: #FFFFFF; font-weight: 600; }
.nav-item.on .ic { color: var(--mint-400); }
.nav-item.on::before {
  content: ""; position: absolute; left: -12px; top: 7px; bottom: 7px; width: 3px;
  border-radius: 0 3px 3px 0; background: var(--mint);
}
.nav-item:focus-visible { outline-color: var(--mint-400); }
.nav-item .lbl { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.badge {
  min-width: 22px; height: 20px; padding: 0 7px; border-radius: 999px;
  display: inline-flex; align-items: center; justify-content: center;
  font: 600 11.5px/1 var(--font-num); background: rgba(148, 163, 184, .2); color: #E2E8F0;
}
.badge.hot { background: var(--err-solid); color: #FFFFFF; }
.side-foot { padding: 10px 12px 14px; border-top: 1px solid var(--side-border); }

.topbar {
  position: sticky; top: 0; z-index: 20; height: var(--top-h);
  display: flex; align-items: center; gap: 16px; padding: 0 32px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--border);
}
.top-brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.top-brand:hover { text-decoration: none; }
.top-brand .logo img { height: 32px; width: auto; display: block; }
.crumbs { display: flex; align-items: center; gap: 6px; min-width: 0; font-size: 13.5px; color: var(--text-3); white-space: nowrap; }
.crumbs .ic { width: 14px; height: 14px; color: var(--slate400); }
.crumbs a { color: var(--text-2); }
.crumbs .crumb-cur { color: var(--text); font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.crumbs .crumb-cur.mono { font-weight: 500; font-size: 13px; word-break: normal; }
.top-user { margin-left: auto; display: flex; align-items: center; gap: 14px; min-width: 0; font-size: 13px; color: var(--text-2); }
.top-user form { margin: 0; display: inline; }
.expiry { display: inline-flex; align-items: center; gap: 6px; color: var(--text-3); white-space: nowrap; cursor: help; }
.expiry .ic { width: 15px; height: 15px; }
.me { display: inline-flex; align-items: center; gap: 8px; min-width: 0; }
.avatar {
  width: 28px; height: 28px; flex: none; border-radius: 50%; display: inline-grid; place-items: center;
  background: var(--ok-bg); color: var(--ok-text); border: 1px solid var(--ok-border); font-weight: 700; font-size: 12px;
}
.me-email { color: var(--text); font-weight: 500; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.role-chip {
  display: inline-flex; align-items: center; height: 24px; padding: 0 10px; border-radius: 999px;
  font-size: 12px; font-weight: 600; white-space: nowrap; border: 1px solid transparent;
}
.role-chip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; margin-right: 6px; background: currentColor; }
.role-ADMIN { background: var(--ok-bg); color: var(--ok-text); border-color: var(--ok-border); }
.role-MODERATOR { background: var(--hi-bg); color: var(--hi-text); border-color: var(--hi-border); }
.role-CONTENT { background: var(--info-bg); color: var(--info-text); border-color: var(--info-border); }
.role-ANALYST { background: var(--surface-3); color: var(--text-2); border-color: var(--border-strong); }

main { max-width: 1360px; padding: 28px 32px 64px; }
main > h1:first-child, main > p:first-child + h1 { margin-top: 0; }
main > h1 + .muted, main > h1 + .flashes + .muted, main > .flashes + .muted { max-width: 92ch; margin-bottom: 18px; }
main > h1 + p.mono { margin-top: -4px; }

/* ---------- Thẻ / hộp ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); padding: 20px 22px; margin-bottom: 20px; min-width: 0;
}
.card > h1:first-child, .card > h2:first-child, .card > h3:first-child { margin-top: 0; }
.card > h2:first-child {
  font-size: 15.5px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding-bottom: 12px; margin: -2px 0 14px; border-bottom: 1px solid var(--border);
}
.card > p:last-child, .card > form:last-child > p:last-child { margin-bottom: 0; }
.card h3 { font-size: 14px; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); grid-auto-flow: row dense; gap: 20px; margin-bottom: 20px; align-items: start; }
.grid > * { min-width: 0; margin-bottom: 0; }
.grid > .card { overflow-wrap: anywhere; }
.grid > .card table { overflow-wrap: normal; }
.grid > .card.wide { grid-column: 1 / -1; }
.split { display: grid; grid-template-columns: minmax(260px, 360px) minmax(0, 1fr); gap: 24px; align-items: start; }
.split > .table-wrap { margin: 0; }
@media (max-width: 1024px) { .split { grid-template-columns: 1fr; } }
.grid > .card form.inline input[type=text], .grid > .card form.inline select { width: auto; }
.grid > .card select, .grid > .card input[type=text], .grid > .card input[type=number], .grid > .card textarea { width: 100%; min-width: 0; }

/* thẻ lối tắt trang chủ */
.grid.shortcuts { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.grid.shortcuts .card { display: flex; flex-direction: column; gap: 4px; }
.grid.shortcuts .card h3 { margin: 0 0 4px; display: flex; align-items: center; gap: 10px; font-size: 15px; }
.grid.shortcuts .card h3 .ic { width: 32px; height: 32px; padding: 7px; border-radius: 9px; background: var(--ok-bg); color: var(--ok-text); }
.grid.shortcuts .card p { color: var(--text-2); flex: 1; }
.grid.shortcuts .actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }

/* ---------- Ô số liệu (trang chủ) ---------- */
.section-title { display: flex; align-items: baseline; gap: 10px; }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; margin-bottom: 8px; }
.stat {
  position: relative; display: flex; flex-direction: column; gap: 6px; padding: 16px 18px 15px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); color: var(--text); text-decoration: none;
  transition: border-color .15s, box-shadow .15s, transform .15s;
}
.stat::after {
  content: ""; position: absolute; top: 16px; right: 14px; width: 16px; height: 16px; background: var(--text-3);
  -webkit-mask: url("icons/chevron-right.svg") center / contain no-repeat; mask: url("icons/chevron-right.svg") center / contain no-repeat;
  opacity: 0; transform: translateX(-4px); transition: opacity .15s, transform .15s;
}
.stat:hover { text-decoration: none; border-color: var(--mint); box-shadow: var(--shadow-md); transform: translateY(-1px); }
.stat:hover::after { opacity: 1; transform: none; }
/* số lớn dùng chữ số tỉ lệ (đẹp hơn ở cỡ 30px); bảng / huy hiệu dùng chữ số đều bề rộng */
.stat .n { display: block; font: 700 30px/1.1 var(--font); letter-spacing: -.02em; }
.stat .l { color: var(--text-2); font-size: 13px; line-height: 1.45; }
.stat.alert { border-color: var(--err-border); background: linear-gradient(180deg, var(--err-bg), var(--surface) 85%); }
.stat.alert::before { content: ""; position: absolute; left: -1px; top: 14px; bottom: 14px; width: 3px; border-radius: 0 3px 3px 0; background: var(--crimson); }
.stat.alert .n { color: var(--err-text); }
.stat.alert:hover { border-color: var(--crimson); }
.stat.zero .n { color: var(--text-3); }

/* ---------- Bảng ---------- */
table {
  width: 100%; border-collapse: separate; border-spacing: 0; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius); font-size: 13.5px;
  font-family: var(--font-num); margin-bottom: 20px;
}
th, td { padding: 9px 12px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--border); }
th {
  position: sticky; top: var(--top-h); z-index: 2;
  background: var(--surface-2); color: var(--text-2); font-weight: 600; font-size: 12.5px; line-height: 1.35;
}
tr:first-child > th:first-child { border-top-left-radius: calc(var(--radius) - 1px); }
tr:first-child > th:last-child { border-top-right-radius: calc(var(--radius) - 1px); }
tr:last-child > td { border-bottom: 0; }
tr:last-child > td:first-child { border-bottom-left-radius: calc(var(--radius) - 1px); }
tr:last-child > td:last-child { border-bottom-right-radius: calc(var(--radius) - 1px); }
tr:has(> td):hover > td { background: var(--surface-2); }
td.num, th.num { text-align: right; white-space: nowrap; }
td > a:not(.button) { font-weight: 500; }
td[colspan].muted { text-align: center; padding: 28px 12px; color: var(--text-3); }
td .muted, td.muted { color: var(--text-2); }
.clip { max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.table-wrap { overflow-x: auto; max-width: 100%; margin-bottom: 20px; border-radius: var(--radius); }
.table-wrap > table { margin-bottom: 0; }
.table-wrap th { position: static; }
/* màn rộng: bảng không cần cuộn ngang ⇒ bỏ khung cuộn để đầu bảng dính dưới thanh trên; màn hẹp: cuộn ngang trong khung */
@media (min-width: 1201px) {
  .table-wrap { overflow: visible; }
  .table-wrap th { position: sticky; }
  /* nhật ký: nhiều cột JSON ⇒ luôn cuộn trong khung */
  .table-wrap:has(> table.audit) { overflow-x: auto; }
  .table-wrap:has(> table.audit) th { position: static; }
}
.card table { table-layout: auto; }
.card > table:last-child, .card > .table-wrap:last-child { margin-bottom: 0; }
/* bảng lồng (trong ô / details) gọn hơn */
td table, details table { font-size: 12.5px; margin: 8px 0 0; }
td table th, details table th { position: static; }
tr.overdue > td { background: var(--err-bg); }
tr.overdue > td:first-child { box-shadow: inset 3px 0 0 var(--crimson); }
tr.overdue:hover > td { background: color-mix(in srgb, var(--err-bg) 70%, var(--surface-2)); }
tr.disabled > td { color: var(--text-3); background: var(--surface-2); }
tr.disabled > td > *:not(form) { opacity: .7; }
table.audit td.obj { min-width: 170px; }
table.audit td.obj .mono { font-size: 12px; word-break: break-all; }
table.audit summary { overflow-wrap: anywhere; }
table.audit td:nth-child(7), table.audit td:nth-child(8) { max-width: 260px; overflow-wrap: anywhere; }
td > details.json { min-width: 180px; }
table.audit td.obj a.mono { white-space: normal; word-break: break-all; }
table.hits { width: auto; min-width: 320px; }
table.snap-cmp th:first-child { width: 120px; }
table.snap-cmp tr > th { position: static; }
table.snap-cmp tr.changed > td { background: var(--mark-bg); font-weight: 600; }
table.queue td:nth-child(2) { white-space: nowrap; }
table.words td:nth-child(2) { white-space: nowrap; }
table.words td:first-child .muted { font-size: 11.5px; letter-spacing: .02em; }
table.words td:nth-child(3) .tag { margin: 0 2px 3px 0; }
table.events td { font-size: 12.5px; }
table.events td:nth-child(4) { min-width: 120px; }
table.events pre { margin: 0; padding: 4px 8px; }
.chg { background: var(--mark-bg); padding: 0 3px; border-radius: 3px; }

/* ---------- Nhãn / pill ---------- */
.tag, .pill {
  display: inline-flex; align-items: center; gap: 5px; max-width: 100%;
  padding: 1px 9px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface-3); color: var(--text-2);
  font: 500 12px/18px var(--font); white-space: nowrap; vertical-align: 1px;
}
.tag.ok { background: var(--ok-bg); color: var(--ok-text); border-color: var(--ok-border); }
.tag.warn { background: var(--warn-bg); color: var(--warn-pill); border-color: var(--warn-border); }
.tag.banned, .tag.danger { background: var(--err-bg); color: var(--err-text); border-color: var(--err-border); }
.tag.high { background: var(--hi-bg); color: var(--hi-text); border-color: var(--hi-border); font-weight: 600; }
.tag.overdue { background: var(--err-solid); color: #FFFFFF; border-color: transparent; font-weight: 600; letter-spacing: .02em; }
.tag.off { background: transparent; color: var(--text-3); border-style: dashed; }
.tag.suggest { background: var(--mint); color: var(--slate900); border-color: transparent; font-weight: 600; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .85; }
.pill.st-OPEN { background: var(--info-bg); color: var(--info-text); border-color: var(--info-border); }
.pill.st-IN_PROGRESS { background: var(--warn-bg); color: var(--warn-pill); border-color: var(--warn-border); }
.pill.st-ACTIONED { background: var(--ok-bg); color: var(--ok-text); border-color: var(--ok-border); }
.pill.st-DISMISSED { background: var(--surface-3); color: var(--text-3); }

/* ---------- Nút ---------- */
button, .button {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 36px; padding: 0 14px; border-radius: var(--radius-sm); border: 1px solid transparent;
  background: var(--primary-bg); color: var(--primary-fg);
  font: 600 13.5px/1 var(--font); white-space: nowrap; cursor: pointer; text-decoration: none;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .08); transition: background-color .12s, border-color .12s, box-shadow .12s, color .12s;
  vertical-align: middle;
}
button:hover, .button:hover { background: var(--primary-bg-hover); text-decoration: none; }
button:active, .button:active { transform: translateY(.5px); }
button:focus-visible, .button:focus-visible { outline: none; box-shadow: var(--ring); }
button .ic, .button .ic { width: 16px; height: 16px; }
button.secondary, .button.secondary {
  background: var(--surface); color: var(--text); border-color: var(--border-strong);
}
button.secondary:hover, .button.secondary:hover { background: var(--surface-3); border-color: var(--slate400); }
button.danger, .button.danger { background: var(--danger-bg); color: #FFFFFF; }
button.danger:hover, .button.danger:hover { background: var(--danger-bg-hover); }
button.ghost, .button.ghost { background: transparent; color: var(--text-2); box-shadow: none; }
button.ghost:hover, .button.ghost:hover { background: var(--surface-3); color: var(--text); }
button.sm, .button.sm, td button, td .button, form.inline button { height: 30px; padding: 0 10px; font-size: 12.5px; border-radius: 7px; }
button:disabled, .button[aria-disabled=true] { opacity: .5; cursor: not-allowed; transform: none; }

/* ---------- Form ---------- */
form { margin: 0; }
label { display: block; font-weight: 500; font-size: 13px; color: var(--text); margin: 14px 0 6px; }
label:has(> input[type=checkbox]), label:has(> input[type=radio]) {
  display: flex; align-items: center; gap: 8px; font-weight: 400; cursor: pointer;
}
label .muted { font-weight: 400; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=search], select, textarea {
  font: 400 14px/1.4 var(--font); color: var(--text); background: var(--surface);
  height: 36px; padding: 0 10px; min-width: 160px; max-width: 100%;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  transition: border-color .12s, box-shadow .12s;
}
input:hover, select:hover, textarea:hover { border-color: var(--slate400); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--mint-strong); box-shadow: var(--ring); }
input::placeholder, textarea::placeholder { color: var(--text-3); }
input[type=date] { font-family: var(--font-num); }
select {
  appearance: none; -webkit-appearance: none; padding-right: 32px; cursor: pointer;
  background: var(--surface) url("icons/chevron-down.svg") no-repeat right 10px center / 16px 16px;
}
textarea { display: block; width: 100%; height: auto; min-height: 96px; padding: 9px 11px; line-height: 1.5; resize: vertical; }
textarea[name=terms], textarea#value, textarea.mono { font-family: var(--font-mono); font-size: 13px; }
input.readonly, textarea.readonly, .readonly { background: var(--surface-2); color: var(--text-2); }
input[type=checkbox], input[type=radio] { width: 16px; height: 16px; margin: 0; accent-color: var(--mint-strong); flex: none; cursor: pointer; }
fieldset { border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 16px 16px; margin: 0 0 16px; }
legend { padding: 0 6px; font-weight: 600; font-size: 13px; }
.help { color: var(--text-3); font-size: 12.5px; margin: 4px 0 0; }
.field-error { color: var(--err-text); font-size: 12.5px; margin: 4px 0 0; }
form p:has(> button) { margin-top: 16px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
form.inline { display: inline-flex; gap: 6px; align-items: center; flex-wrap: wrap; margin: 0; }
form.inline label { margin: 0; }
form.inline input[type=text], form.inline input[type=password], form.inline select { height: 30px; min-width: 120px; font-size: 13px; }
td form:not(.inline) input[type=text], td form:not(.inline) select { width: 100%; min-width: 0; margin-bottom: 6px; }
select { max-width: 100%; }
select[name=sense_no] { max-width: 300px; }

/* thanh lọc */
.filters {
  display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 14px; padding: 14px 16px; margin: 0 0 18px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm);
}
.filters > div { display: flex; flex-direction: column; min-width: 0; }
.filters label { margin: 0 0 5px; font-weight: 500; font-size: 12px; color: var(--text-2); }
.filters label:has(> input[type=checkbox]) { height: 36px; margin: 0; font-size: 13px; color: var(--text); }
.filters input[type=text] { min-width: 200px; }
.filters select { max-width: 280px; }
.filters > a { align-self: flex-end; line-height: 36px; font-size: 13px; }
.filters .sort { align-self: flex-end; line-height: 36px; font-size: 13px; color: var(--text-2); }
.filters .sort a.on { font-weight: 700; color: var(--text); text-decoration: none; }
.card .filters { box-shadow: none; background: var(--surface-2); }

/* ---------- Thông báo ---------- */
.flash {
  position: relative; display: block; padding: 11px 14px 11px 42px; margin: 0 0 16px;
  border: 1px solid var(--info-border); border-radius: 10px; background: var(--info-bg); color: var(--info-text);
  font-size: 13.5px; line-height: 1.5;
}
.flash::before {
  content: ""; position: absolute; left: 14px; top: 12px; width: 18px; height: 18px; background: var(--info-icon);
  -webkit-mask: url("icons/info.svg") center / contain no-repeat; mask: url("icons/info.svg") center / contain no-repeat;
}
.flash.success { background: var(--ok-bg); border-color: var(--ok-border); color: var(--ok-text); }
.flash.success::before { background: var(--ok-icon); -webkit-mask-image: url("icons/check-circle.svg"); mask-image: url("icons/check-circle.svg"); }
.flash.warning { background: var(--warn-bg); border-color: var(--warn-border); color: var(--warn-text); }
.flash.warning::before { background: var(--warn-icon); -webkit-mask-image: url("icons/alert-triangle.svg"); mask-image: url("icons/alert-triangle.svg"); }
.flash.error { background: var(--err-bg); border-color: var(--err-border); color: var(--err-text); }
.flash.error::before { background: var(--err-icon); -webkit-mask-image: url("icons/x-circle.svg"); mask-image: url("icons/x-circle.svg"); }
.flashes { display: contents; }

/* ---------- Trạng thái rỗng / phân trang ---------- */
.empty {
  display: flex; align-items: center; gap: 10px; padding: 16px 18px; margin: 0 0 16px;
  color: var(--text-2); background: var(--surface); border: 1px dashed var(--border-strong); border-radius: var(--radius);
}
.empty::before {
  content: ""; width: 20px; height: 20px; flex: none; background: var(--text-3);
  -webkit-mask: url("icons/inbox.svg") center / contain no-repeat; mask: url("icons/inbox.svg") center / contain no-repeat;
}
.pager { display: flex; gap: 10px; align-items: center; margin: 4px 0 20px; flex-wrap: wrap; }
.pager:not(:has(*)) { display: none; }
.pager a {
  display: inline-flex; align-items: center; height: 32px; padding: 0 12px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); font-weight: 500; font-size: 13px;
}
.pager a:hover { background: var(--surface-3); text-decoration: none; }
.pager .muted { font-size: 13px; }

/* ---------- details / code ---------- */
details { margin: 8px 0; }
details > summary {
  cursor: pointer; list-style: none; display: block;
  color: var(--text-2); font-weight: 500; font-size: 13px; border-radius: 6px; padding: 2px 0;
}
details > summary::-webkit-details-marker { display: none; }
details > summary::before {
  content: ""; display: inline-block; vertical-align: -2px; margin-right: 6px; width: 14px; height: 14px; background: currentColor; transition: transform .15s;
  -webkit-mask: url("icons/chevron-right.svg") center / contain no-repeat; mask: url("icons/chevron-right.svg") center / contain no-repeat;
}
details[open] > summary::before { transform: rotate(90deg); }
details > summary:hover { color: var(--text); }
pre {
  white-space: pre-wrap; word-break: break-all; margin: 8px 0 0; padding: 10px 12px;
  font: 12px/1.55 var(--font-mono); color: var(--text);
  background: var(--code-bg); border: 1px solid var(--border); border-radius: var(--radius-sm);
}
details pre { max-height: 360px; overflow: auto; }
details.json { margin: 0; }
details.json > summary { font-family: var(--font-mono); font-size: 11.5px; font-weight: 400; overflow-wrap: anywhere; }
details.json pre { max-height: 220px; }
.card > details:not(.json) { border-top: 1px solid var(--border); padding-top: 10px; margin-top: 14px; }

/* ---------- Danh sách / mô tả ---------- */
ul.plain { margin: 4px 0 10px; padding-left: 20px; }
ul.examples li { margin: 6px 0; }
ul.examples .vi { color: var(--text-2); }
ul.names { columns: 3 220px; margin: 6px 0 12px; padding-left: 20px; }
ul.names li { break-inside: avoid; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 8px 18px; margin: 0 0 16px; padding: 14px 16px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.kv dt { color: var(--text-2); }
.kv dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }
.cfg-group h2 { margin-top: 28px; scroll-margin-top: calc(var(--top-h) + 12px); }
.cfg-key { font-size: 11.5px; color: var(--text-3); margin-top: 2px; }
.cfg-nav { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 8px; }
.cfg-nav a { display: inline-flex; align-items: center; height: 28px; padding: 0 12px; border-radius: 999px;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text-2); font-size: 12.5px; font-weight: 500; }
.cfg-nav a:hover { border-color: var(--mint); color: var(--text); text-decoration: none; }
.cfg-nav a.on { background: var(--ok-bg); border-color: var(--ok-border); color: var(--ok-text); font-weight: 600; }
.form-card { max-width: 760px; }
form.rollback { margin-top: 20px; padding-top: 6px; border-top: 1px solid var(--border); }
form.rollback input[type=text] { width: 360px; }
.form-card input[type=text], .form-card input[type=email], .form-card input[type=password] { width: 100%; max-width: 520px; }
.back-link { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 500; color: var(--text-2); margin: 0 0 10px; }
.back-link .ic { width: 16px; height: 16px; }

/* ---------- Trang hồ sơ moderation / người chơi ---------- */
.card.suggested { border: 1.5px solid var(--mint); box-shadow: 0 0 0 4px rgba(16, 185, 129, .12), var(--shadow-sm); }
.card.action { display: flex; flex-direction: column; }
.card.action > p:last-child { margin-top: auto; padding-top: 12px; }
.who .mono { font-size: 11.5px; }
.who + .who { margin-left: 2px; }
.meta-line { color: var(--text-2); }
.notice { color: var(--text-2); font-size: 13px; display: flex; gap: 8px; align-items: flex-start; }
.notice .ic { width: 16px; height: 16px; margin-top: 2px; color: var(--text-3); }

/* xem trước từ cấm (ADM-UI-10) */
.preview-box { border: 1.5px solid var(--mint); box-shadow: 0 0 0 4px rgba(16, 185, 129, .10), var(--shadow-sm); }
.preview-box h3 { font-size: 14.5px; margin: 18px 0 6px; }
.preview-box .big { font: 700 22px/1 var(--font-num); }
.preview-box .bad { color: var(--err-text); }

/* trang xác nhận (vùng nguy hiểm) */
.confirm-box { max-width: 760px; border-color: var(--err-border); box-shadow: 0 0 0 4px rgba(239, 68, 68, .08), var(--shadow-sm); position: relative; overflow: hidden; padding-top: 26px; }
.confirm-box::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 4px; background: var(--err-solid); }
.confirm-box > h1 { display: flex; align-items: center; gap: 10px; font-size: 20px; }
.confirm-box > h1::before {
  content: ""; width: 26px; height: 26px; flex: none; background: var(--err-icon);
  -webkit-mask: url("icons/alert-triangle.svg") center / contain no-repeat; mask: url("icons/alert-triangle.svg") center / contain no-repeat;
}
.zone-label { display: inline-block; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--err-text); margin-bottom: 6px; }

/* trang lỗi / 403 */
.error-card { max-width: 640px; text-align: left; }
.error-card .err-icon { display: inline-grid; place-items: center; width: 48px; height: 48px; border-radius: 12px; background: var(--err-bg); color: var(--err-icon); border: 1px solid var(--err-border); margin-bottom: 14px; }
.error-card .err-icon .ic { width: 24px; height: 24px; }
a .ic { width: 15px; height: 15px; vertical-align: -3px; }

/* ---------- Đăng nhập / 2FA ---------- */
body.auth {
  display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px 48px;
  background:
    radial-gradient(520px 340px at 8% 6%, rgba(16, 185, 129, .16), transparent 70%),
    radial-gradient(420px 300px at 96% 92%, rgba(249, 115, 22, .12), transparent 70%),
    radial-gradient(260px 200px at 88% 10%, rgba(16, 185, 129, .08), transparent 70%),
    var(--bg);
}
main.login { width: 100%; max-width: 440px; padding: 0; margin: 0; }
main.login.wide { max-width: 560px; }
.auth-logo { display: flex; justify-content: center; margin: 0 0 22px; }
.auth-logo img { height: 52px; width: auto; display: block; }
main.login .card { padding: 30px 32px 26px; box-shadow: var(--shadow-md); border-radius: 16px; }
main.login h1 { font-size: 21px; margin-bottom: 6px; }
main.login .sub { color: var(--text-2); margin-bottom: 18px; }
main.login input[type=text], main.login input[type=email], main.login input[type=password] { width: 100%; height: 40px; }
main.login form p:has(> button) button { width: 100%; height: 40px; }
main.login ol { padding-left: 20px; }
main.login ol > li { margin: 0 0 14px; padding-left: 4px; }
main.login ol > li::marker { color: var(--mint-strong); font-weight: 700; }
.auth-foot { text-align: center; color: var(--text-3); font-size: 12px; margin-top: 18px; }
.qr-box { display: block; width: fit-content; margin: 12px 0 4px; padding: 12px; background: #FFFFFF; border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-sm); }
.qr-box svg { display: block; width: 200px; height: 200px; }
.mono.secret {
  font-size: 17px; letter-spacing: 1.5px; user-select: all; word-break: break-all;
  background: var(--surface-2); border: 1px dashed var(--border-strong); padding: 10px 12px; border-radius: var(--radius-sm); margin-top: 8px;
}
.codes {
  list-style: none; padding: 0; margin: 16px 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px;
  font: 600 16px/1 var(--font-mono); letter-spacing: 1px;
}
.codes li { margin: 0; padding: 11px 14px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); text-align: center; }

/* ---------- Phân tích /admin/analytics (BE-ANA-01) ----------
   Biểu đồ SVG dựng ở server (không JS). Màu chuỗi: bảng phân loại đã kiểm bằng validate_palette (dataviz):
   sáng trên #FFFFFF — CVD kề nhau ≥ 9,1, thường ≥ 22,9; tối trên #0F172A — CVD ≥ 8,4, thường ≥ 19,8, đều ≥ 3:1.
   Slot 3–4 sáng < 3:1 ⇒ luôn có chú giải + bảng số (details). Màu theo THỰC THỂ (vd iOS luôn slot 1), không theo hạng.
   Chữ luôn dùng token chữ, không mang màu chuỗi. */
:root {
  --viz-1: #2a78d6; --viz-2: #eb6834; --viz-3: #1baf7a; --viz-4: #eda100; --viz-0: #94A3B8;
  --viz-grid: var(--slate100); --viz-axis: var(--slate300); --viz-band: rgba(16, 185, 129, .12);
  --viz-ref: var(--slate500); --viz-xh: var(--slate400);
}
@media (prefers-color-scheme: dark) {
  :root {
    --viz-1: #3987e5; --viz-2: #d95926; --viz-3: #199e70; --viz-4: #c98500; --viz-0: #64748B;
    --viz-grid: #1A2438; --viz-axis: #334155; --viz-band: rgba(52, 211, 153, .13);
    --viz-ref: var(--slate400); --viz-xh: var(--slate500);
  }
}
.f0 { fill: var(--viz-0); } .f1 { fill: var(--viz-1); } .f2 { fill: var(--viz-2); } .f3 { fill: var(--viz-3); } .f4 { fill: var(--viz-4); }
.s0 { stroke: var(--viz-0); } .s1 { stroke: var(--viz-1); } .s2 { stroke: var(--viz-2); } .s3 { stroke: var(--viz-3); } .s4 { stroke: var(--viz-4); }

.ana-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 4px 0 10px; }
.ana-bar .grow { flex: 1; }
.seg { display: inline-flex; padding: 3px; gap: 2px; background: var(--surface-3); border: 1px solid var(--border); border-radius: 10px; }
.seg a { padding: 6px 14px; border-radius: 7px; color: var(--text-2); font-weight: 500; font-size: 13px; }
.seg a:hover { text-decoration: none; color: var(--text); background: var(--surface-2); }
.seg a.on { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: var(--shadow-sm); }
.ana-fresh { max-width: 120ch; margin-bottom: 14px; }
.ana-toc { display: flex; flex-wrap: wrap; gap: 4px 16px; padding: 10px 0 2px; border-top: 1px solid var(--border); font-size: 13px; }
.ana-toc a { color: var(--text-2); font-weight: 500; }
.ana h2 { scroll-margin-top: calc(var(--top-h) + 12px); }
.ana-sec { scroll-margin-top: calc(var(--top-h) + 12px); }
.ana-sec-h { display: flex; align-items: baseline; gap: 14px; margin: 34px 0 12px; }
.ana-sec-h h2 { margin: 0; }
.ana-sec-h a .ic { width: 14px; height: 14px; vertical-align: -2px; }

.ana-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; margin-bottom: 18px; }
.ana-tiles.small-tiles { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.kpi { display: flex; flex-direction: column; gap: 4px; padding: 14px 16px 10px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); min-width: 0; }
.kpi-l { color: var(--text-2); font-size: 12.5px; font-weight: 500; line-height: 1.35; cursor: help; }
.kpi-v { font: 600 26px/1.15 var(--font); letter-spacing: -.02em; color: var(--text); }
.kpi-m { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; min-height: 20px; font-size: 12px; }
.kpi-d { color: var(--text-2); font-family: var(--font-num); }
.kpi-d.up { color: var(--ok-text); } .kpi-d.down { color: var(--err-text); } .kpi-d.none { color: var(--text-3); }
.kpi-s { margin-top: 2px; min-height: 28px; }
.vz-spark { display: block; overflow: visible; }
.vz-spark-line { fill: none; stroke: var(--viz-0); stroke-width: 1.5; vector-effect: non-scaling-stroke; stroke-linejoin: round; stroke-linecap: round; }
.vz-spark-dot { stroke: var(--viz-1); stroke-width: 6; stroke-linecap: round; vector-effect: non-scaling-stroke; }
/* trạng thái ngưỡng: chấm + chữ (không chỉ màu) */
.st { display: inline-flex; align-items: center; gap: 5px; font-weight: 600; font-size: 11.5px; padding: 1px 8px 1px 6px; border-radius: 999px; border: 1px solid; }
.st::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.st-GOOD { color: var(--ok-text); background: var(--ok-bg); border-color: var(--ok-border); }
.st-WARN { color: var(--warn-pill); background: var(--warn-bg); border-color: var(--warn-border); }
.st-BAD { color: var(--err-text); background: var(--err-bg); border-color: var(--err-border); }

.ana-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 500px), 1fr)); gap: 18px; margin-bottom: 18px; }
.ana-chart { margin: 0; padding: 16px 18px 12px; }
.ana-chart figcaption { display: flex; flex-direction: column; gap: 2px; margin-bottom: 8px; }
.ana-chart .ct { font-weight: 600; font-size: 14.5px; color: var(--text); }
.ana-chart .cs { color: var(--text-2); font-size: 12.5px; }
.vz-legend { list-style: none; display: flex; flex-wrap: wrap; gap: 4px 14px; padding: 0; margin: 0 0 8px; font-size: 12.5px; color: var(--text-2); }
.vz-legend li { display: inline-flex; align-items: center; gap: 6px; margin: 0; }
.vz-key { flex: none; overflow: visible; }
.vz-key line { stroke-width: 2.5; stroke-linecap: round; }
.vz { display: grid; grid-template-columns: 56px minmax(0, 1fr) 112px; grid-template-rows: auto 20px; }
.vz.vz-h { grid-template-rows: auto; }
.vz svg { display: block; overflow: visible; }
.vz text { font: 400 11.5px/1 var(--font-num); fill: var(--text-3); }
.vz .vz-y text { text-anchor: end; }
.vz .vz-end text { fill: var(--text-2); font-weight: 500; }
.vz .vz-end text.vz-reflab { fill: var(--text-3); font-weight: 400; }
.vz-h .vz-y text { fill: var(--text-2); }
.vz-grid { stroke: var(--viz-grid); stroke-width: 1; vector-effect: non-scaling-stroke; }
.vz-plot { border-bottom: 1px solid var(--viz-axis); }
.vz-h .vz-plot { border-bottom: 0; border-left: 1px solid var(--viz-axis); }
.vz-line { fill: none; stroke-width: 2; vector-effect: non-scaling-stroke; stroke-linejoin: round; stroke-linecap: round; }
.vz-line.dash, .vz-key line.dash { stroke-dasharray: 7 4; }
.vz-dot { stroke-width: 8; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.vz-ring { stroke: var(--surface); stroke-width: 12; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.vz-ref { stroke: var(--viz-ref); stroke-width: 1; stroke-dasharray: 4 4; vector-effect: non-scaling-stroke; fill: none; }
.vz-band { fill: var(--viz-band); }
.vz-hit rect { fill: transparent; }
.vz-hit .vz-xh { stroke: var(--viz-xh); stroke-width: 1; vector-effect: non-scaling-stroke; opacity: 0; }
.vz-hit:hover .vz-xh { opacity: 1; }
.vz-plot path:hover, .vz-plot rect:hover { opacity: .85; }
.vz-empty { margin: 28px 0; text-align: center; color: var(--text-3); }
.vz-note { margin: 6px 0 0; font-size: 12px; color: var(--text-3); }
.ana-chart details { margin-top: 8px; }
.ana-chart summary { cursor: pointer; font-size: 12.5px; color: var(--text-2); font-weight: 500; }
.ana-chart details .table-wrap { max-height: 300px; overflow: auto; }
table.num-table td:not(:first-child), table.num-table th:not(:first-child) { text-align: right; white-space: nowrap; }
.cohort { padding: 14px 16px; }
.cohort table { margin-bottom: 0; }
td.hm-GOOD { background: var(--ok-bg); color: var(--ok-text); }
td.hm-WARN { background: var(--warn-bg); color: var(--warn-pill); }
td.hm-BAD { background: var(--err-bg); color: var(--err-text); }
.hm-mark { font-weight: 700; }
.ana-empty h2, .ana-backfill h2 { display: flex; align-items: center; gap: 8px; }
.ana-backfill { margin-top: 34px; }
.ana-backfill form.inline { display: flex; align-items: end; gap: 12px; flex-wrap: wrap; }
.ana-backfill label { margin: 0; }
@media print { .vz-hit { display: none; } }
@media (forced-colors: active) { .vz-line, .vz-dot { stroke: CanvasText; } .f1, .f2, .f3, .f4, .f0 { fill: CanvasText; } }

/* ---------- Đáp ứng: ≤ 1200 / ≤ 1024 (dải icon) / ≤ 720 (thanh ngang) ---------- */
@media (max-width: 1200px) {
  .xl-only { display: none; }
  main { padding: 24px 24px 56px; }
  .topbar { padding: 0 24px; }
}
@media (max-width: 1024px) {
  :root { --side-w: 68px; }
  .side-brand { justify-content: center; padding: 16px 0 12px; }
  .side-brand .logo-full, .side-brand .side-tag { display: none; }
  .side-brand .logo-mark { display: block; }
  .side-nav { padding: 6px 10px 12px; gap: 10px; }
  .side-nav .gl { display: none; }
  .side-nav .grp + .grp { border-top: 1px solid var(--side-border); padding-top: 10px; }
  .nav-item { justify-content: center; padding: 0; min-height: 40px; }
  .nav-item .lbl { display: none; }
  .nav-item .ic { width: 20px; height: 20px; }
  .nav-item.on::before { left: -10px; }
  .nav-item .badge { position: absolute; top: 3px; right: 2px; min-width: 18px; height: 16px; padding: 0 4px; font-size: 10px; }
  .side-foot { padding: 8px 10px 12px; }
  .me-email { max-width: 160px; }
  .grid { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
}
@media (max-width: 860px) {
  .me-email, .expiry > span { display: none; }
}
@media (max-width: 720px) {
  .sidebar { position: sticky; top: 0; inset: auto; width: 100%; height: auto; flex-direction: row; align-items: center; overflow-x: auto; overflow-y: hidden; border-right: 0; border-bottom: 1px solid var(--side-border); }
  .sidebar ~ .topbar, .sidebar ~ main { margin-left: 0; }
  body:has(> .sidebar) { background: var(--bg); }
  .side-brand { padding: 8px 10px; }
  .side-nav { flex-direction: row; padding: 6px; gap: 4px; }
  .side-nav .grp { flex-direction: row; gap: 2px; }
  .side-nav .grp + .grp { border-top: 0; padding-top: 0; border-left: 1px solid var(--side-border); padding-left: 4px; }
  .nav-item { width: 40px; }
  .nav-item.on::before { left: 8px; right: 8px; top: auto; bottom: -6px; width: auto; height: 3px; border-radius: 3px 3px 0 0; }
  .side-foot { border-top: 0; padding: 6px; }
  .topbar { position: static; padding: 0 16px; }
  main { padding: 20px 16px 48px; }
  th { top: 0; }
  .filters input[type=text] { min-width: 0; }
}

/* ---------- In (mã khôi phục) ---------- */
@media print {
  :root { --bg: #FFFFFF; --surface: #FFFFFF; --text: #000000; }
  .sidebar, .topbar, .no-print, .flash, .flashes { display: none !important; }
  .sidebar ~ main { margin-left: 0; }
  body { background: #FFFFFF; color: #000000; }
  main { padding: 0; max-width: none; }
  .card { border: 0; box-shadow: none; padding: 0; }
  .codes { font-size: 18px; }
  .codes li { border: 1px solid #000000; background: #FFFFFF; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}
