/* 1LAB Robots Admin — giao diện theo phong cách Filament (Laravel), màu thương hiệu 1LAB (cam #fd6c04). Không cần build. */
/* Phông Inter (OFL-1.1, xem fonts/OFL-Inter.txt) lưu ngay trên máy chủ — không gửi IP người dùng sang bên thứ ba */
@font-face { font-family: "Inter"; font-style: normal; font-display: swap; font-weight: 100 900;
  src: url(fonts/inter-vietnamese-wght-normal.woff2) format("woff2-variations");
  unicode-range: U+0102-0103,U+0110-0111,U+0128-0129,U+0168-0169,U+01A0-01A1,U+01AF-01B0,U+0300-0301,U+0303-0304,U+0308-0309,U+0323,U+0329,U+1EA0-1EF9,U+20AB; }
@font-face { font-family: "Inter"; font-style: normal; font-display: swap; font-weight: 100 900;
  src: url(fonts/inter-latin-ext-wght-normal.woff2) format("woff2-variations");
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: "Inter"; font-style: normal; font-display: swap; font-weight: 100 900;
  src: url(fonts/inter-latin-wght-normal.woff2) format("woff2-variations");
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
:root {
  color-scheme: light;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --bg: #fafafa;
  --surface: #ffffff;
  --surface-2: #f4f4f5;
  --surface-hover: #fafafa;
  --ring: rgba(9, 9, 11, 0.06);
  --border: #e4e4e7;
  --text: #18181b;
  --text-2: #52525b;
  --muted: #71717a;
  --faint: #a1a1aa;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.08);

  --primary-50: #fff5ed; --primary-100: #ffe7d4; --primary-400: #fe9a4f; --primary-500: #fd6c04; --primary-600: #d35800; --primary-700: #a84500;
  --primary-text: #c24e00;
  --logo: url(1lab-logo.svg);

  /* Badge mềm: nền / chữ */
  --b-gray-bg: #f4f4f5;   --b-gray: #52525b;
  --b-primary-bg: #fff5ed; --b-primary: #a84500;
  --b-success-bg: #f0fdf4; --b-success: #15803d;
  --b-warning-bg: #fffbeb; --b-warning: #b45309;
  --b-danger-bg: #fef2f2;  --b-danger: #b91c1c;
  --b-info-bg: #eff6ff;    --b-info: #1d4ed8;
  --success: #16a34a; --danger: #dc2626; --warning: #d97706;

  /* Biểu đồ (đã kiểm tra bằng validate_palette.js trên nền #ffffff / #18181b) */
  --series-1: #2a78d6; --series-2: #eb6834; --series-3: #1baf7a;
  --status-good: #0ca30c; --status-warning: #fab219; --status-serious: #ec835a; --status-critical: #d03b3b; --status-neutral: #a1a1aa;
  --chart-grid: #ececee; --chart-axis: #d4d4d8; --chart-muted: #898781;
  --spark: #c4c4cc;
  --input-bg: #ffffff; --input-ring: #d4d4d8;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #09090b; --surface: #18181b; --surface-2: #27272a; --surface-hover: #1f1f23;
    --ring: rgba(255, 255, 255, 0.1); --border: #27272a;
    --text: #fafafa; --text-2: #d4d4d8; --muted: #a1a1aa; --faint: #71717a;
    --shadow: none; --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.5);
    --primary-text: #fe9a4f; --logo: url(1lab-logo-light.svg);
    --b-gray-bg: rgba(161,161,170,.12); --b-gray: #d4d4d8;
    --b-primary-bg: rgba(253,108,4,.14); --b-primary: #fdba8c;
    --b-success-bg: rgba(34,197,94,.12); --b-success: #4ade80;
    --b-warning-bg: rgba(245,158,11,.12); --b-warning: #fbbf24;
    --b-danger-bg: rgba(239,68,68,.12);  --b-danger: #f87171;
    --b-info-bg: rgba(59,130,246,.12);   --b-info: #93c5fd;
    --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70;
    --chart-grid: #27272a; --chart-axis: #3f3f46; --spark: #52525b;
    --input-bg: rgba(255,255,255,.05); --input-ring: rgba(255,255,255,.14);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #09090b; --surface: #18181b; --surface-2: #27272a; --surface-hover: #1f1f23;
  --ring: rgba(255, 255, 255, 0.1); --border: #27272a;
  --text: #fafafa; --text-2: #d4d4d8; --muted: #a1a1aa; --faint: #71717a;
  --shadow: none; --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.5);
  --primary-text: #fe9a4f; --logo: url(1lab-logo-light.svg);
  --b-gray-bg: rgba(161,161,170,.12); --b-gray: #d4d4d8;
  --b-primary-bg: rgba(253,108,4,.14); --b-primary: #fdba8c;
  --b-success-bg: rgba(34,197,94,.12); --b-success: #4ade80;
  --b-warning-bg: rgba(245,158,11,.12); --b-warning: #fbbf24;
  --b-danger-bg: rgba(239,68,68,.12);  --b-danger: #f87171;
  --b-info-bg: rgba(59,130,246,.12);   --b-info: #93c5fd;
  --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70;
  --chart-grid: #27272a; --chart-axis: #3f3f46; --spark: #52525b;
    --input-bg: rgba(255,255,255,.05); --input-ring: rgba(255,255,255,.14);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 14px/1.5 var(--font); background: var(--bg); color: var(--text); -webkit-font-smoothing: antialiased; }
.hidden { display: none !important; }
a { color: var(--primary-text); text-decoration: none; }
a:hover { text-decoration: underline; }
svg.i { width: 20px; height: 20px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
svg.i.sm { width: 16px; height: 16px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; }
.muted { color: var(--muted); }
.num { font-variant-numeric: tabular-nums; }

/* ---------- Nút ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: 600 14px/1 var(--font); padding: 9px 14px;
  border-radius: 8px; border: 0; cursor: pointer; white-space: nowrap; transition: background .15s, box-shadow .15s; }
.btn:focus-visible { outline: 2px solid var(--primary-500); outline-offset: 2px; }
.btn-primary { background: var(--primary-600); color: #fff; box-shadow: var(--shadow); }
.btn-primary:hover { background: var(--primary-500); }
.btn-gray { background: var(--surface); color: var(--text); box-shadow: var(--shadow), inset 0 0 0 1px var(--border); }
.btn-gray:hover { background: var(--surface-hover); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { filter: brightness(1.08); }
.btn-sm { padding: 6px 10px; font-size: 13px; border-radius: 7px; }
.btn-link { background: none; border: 0; color: var(--primary-text); font: 600 13px var(--font); cursor: pointer; padding: 0; display: inline-flex; gap: 4px; align-items: center; }
.btn-link.danger { color: var(--danger); }
.btn[disabled] { opacity: .6; cursor: default; }
.icon-btn { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 8px; border: 0; background: none; color: var(--muted); cursor: pointer; }
.icon-btn:hover { background: var(--surface-2); color: var(--text); }

/* ---------- Ô nhập ---------- */
.input, select.input, textarea.input { width: 100%; font: 14px/1.4 var(--font); color: var(--text); background: var(--input-bg);
  border: 0; border-radius: 8px; padding: 8px 12px; box-shadow: var(--shadow), inset 0 0 0 1px var(--input-ring); transition: box-shadow .15s; }
select.input option { background: var(--surface); color: var(--text); }
.input:focus { outline: none; box-shadow: inset 0 0 0 2px var(--primary-600); }
textarea.input { min-height: 90px; resize: vertical; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label { font-weight: 500; font-size: 14px; color: var(--text); }
.field .req { color: var(--danger); }
.field .hint { font-size: 12.5px; color: var(--muted); }
.check { display: flex; align-items: center; gap: 10px; font-weight: 500; cursor: pointer; }
.toggle { appearance: none; width: 44px; height: 24px; border-radius: 999px; background: var(--surface-2); position: relative; cursor: pointer;
  box-shadow: inset 0 0 0 1px var(--border); transition: background .15s; flex: none; margin: 0; }
.toggle::after { content: ""; position: absolute; top: 2px; left: 2px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .15s; }
.toggle:checked { background: var(--primary-600); box-shadow: none; }
.toggle:checked::after { transform: translateX(20px); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px 16px; }
.form-grid .full { grid-column: 1 / -1; }
.search { position: relative; }
.search svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--faint); pointer-events: none; }
.search .input { padding-left: 36px; }

/* ---------- Đăng nhập ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.auth-card { width: min(420px, 100%); background: var(--surface); border-radius: 16px; box-shadow: var(--shadow), 0 0 0 1px var(--ring); padding: 40px 32px; }
.auth-card .logo { display: flex; justify-content: center; margin-bottom: 18px; }
.wordmark { display: inline-block; aspect-ratio: 453 / 104; background: var(--logo) no-repeat center / contain; }
.auth-card .logo .wordmark { height: 40px; }
.auth-card h1 { text-align: center; font-size: 24px; font-weight: 700; margin: 0 0 4px; letter-spacing: -0.02em; }
.auth-card p.sub { text-align: center; color: var(--muted); margin: 0 0 24px; }
.auth-card form { display: flex; flex-direction: column; gap: 18px; }
.alert { border-radius: 8px; padding: 10px 12px; font-size: 13.5px; background: var(--b-danger-bg); color: var(--b-danger); }

/* ---------- Khung ---------- */
.layout { display: flex; min-height: 100vh; }
.sidebar { width: 256px; flex: none; background: var(--surface); box-shadow: 0 0 0 1px var(--ring); display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; z-index: 30; }
.brand { height: 64px; display: flex; align-items: center; gap: 10px; padding: 0 24px; font-weight: 700; font-size: 18px; letter-spacing: -0.02em; }
.brand .wordmark { height: 22px; }
.brand span { color: var(--muted); font-weight: 600; }
.nav { flex: 1; overflow-y: auto; padding: 8px 16px 24px; display: flex; flex-direction: column; gap: 22px; }
.nav-group-label { font-size: 12.5px; font-weight: 600; color: var(--muted); padding: 0 8px 6px; }
.nav-items { display: flex; flex-direction: column; gap: 2px; }
.nav a { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: 8px; color: var(--text-2); font-weight: 500; text-decoration: none; }
.nav a svg { color: var(--faint); }
.nav a:hover { background: var(--surface-2); color: var(--text); }
.nav a.active { background: var(--surface-2); color: var(--primary-text); }
.nav a.active svg { color: var(--primary-text); }
.nav a .count { margin-left: auto; font-size: 12px; font-weight: 600; padding: 0 8px; border-radius: 999px; background: var(--b-primary-bg); color: var(--b-primary); }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { height: 64px; display: flex; align-items: center; gap: 8px; padding: 0 24px; background: var(--surface); box-shadow: 0 0 0 1px var(--ring);
  position: sticky; top: 0; z-index: 20; }
.topbar .spacer { flex: 1; }
.menu-btn { display: none; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--primary-600); color: #fff; display: grid; place-items: center; font-weight: 600; font-size: 13px; border: 0; cursor: pointer; }
.dropdown { position: relative; }
.dropdown-panel { position: absolute; right: 0; top: calc(100% + 8px); min-width: 240px; background: var(--surface); border-radius: 12px;
  box-shadow: var(--shadow-lg), 0 0 0 1px var(--ring); padding: 6px; z-index: 40; }
.dropdown-head { padding: 10px 12px; border-bottom: 1px solid var(--border); margin-bottom: 6px; }
.dropdown-head b { display: block; }
.dropdown-head small { color: var(--muted); }
.dropdown-item { display: flex; width: 100%; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; border: 0; background: none;
  font: 500 14px var(--font); color: var(--text-2); cursor: pointer; text-align: left; }
.dropdown-item:hover { background: var(--surface-2); color: var(--text); }
.content { padding: 32px; max-width: 1440px; width: 100%; margin: 0 auto; }

/* ---------- Đầu trang ---------- */
.page-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 28px; }
.breadcrumbs { display: flex; align-items: center; gap: 6px; font-size: 13.5px; color: var(--muted); margin-bottom: 6px; font-weight: 500; }
.breadcrumbs a { color: var(--muted); }
.page-header h1 { font-size: 28px; line-height: 1.2; font-weight: 700; letter-spacing: -0.025em; margin: 0; }
.page-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------- Thẻ ---------- */
.card { background: var(--surface); border-radius: 12px; box-shadow: var(--shadow), 0 0 0 1px var(--ring); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 24px; border-bottom: 1px solid var(--border); }
.card-head h2, .card-head h3 { font-size: 16px; font-weight: 600; margin: 0; }
.card-head .desc { font-size: 13px; color: var(--muted); margin-top: 2px; }
.card-body { padding: 24px; }
.section + .section { margin-top: 24px; }

/* ---------- Bảng ---------- */
.table-toolbar { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.table-toolbar .grow { flex: 1; }
.table-toolbar select.input { width: auto; min-width: 150px; }
.table-toolbar .search { width: min(320px, 100%); }
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; font-size: 13px; font-weight: 600; color: var(--text-2); padding: 12px 16px; background: var(--surface-hover); white-space: nowrap; border-bottom: 1px solid var(--border); }
.tbl td { padding: 14px 16px; border-bottom: 1px solid var(--border); white-space: nowrap; vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl td.wrap { white-space: normal; min-width: 220px; }
.tbl tbody tr.clickable { cursor: pointer; }
.tbl tbody tr:hover td { background: var(--surface-hover); }
.tbl .sub { display: block; font-size: 12.5px; color: var(--muted); }
.tbl td.actions { text-align: right; }
.tbl td.actions .btn-link + .btn-link { margin-left: 14px; }
.table-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-top: 1px solid var(--border); color: var(--text-2); font-size: 13.5px; flex-wrap: wrap; }
.pager { display: inline-flex; border-radius: 8px; box-shadow: var(--shadow), inset 0 0 0 1px var(--border); overflow: hidden; }
.pager button { border: 0; background: var(--surface); color: var(--text-2); font: 600 13px var(--font); min-width: 36px; height: 34px; padding: 0 10px; cursor: pointer; border-left: 1px solid var(--border); }
.pager button:first-child { border-left: 0; }
.pager button:hover:not([disabled]) { background: var(--surface-hover); }
.pager button.cur { color: var(--primary-text); background: var(--surface-2); }
.pager button[disabled] { color: var(--faint); cursor: default; }
.empty { text-align: center; padding: 56px 16px; color: var(--muted); }
.empty .ico { width: 48px; height: 48px; border-radius: 50%; background: var(--surface-2); display: grid; place-items: center; margin: 0 auto 12px; color: var(--faint); }
.empty b { display: block; color: var(--text); font-size: 15px; margin-bottom: 2px; }

/* ---------- Badge ---------- */
.badge { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; line-height: 1; padding: 5px 8px; border-radius: 6px;
  background: var(--b-gray-bg); color: var(--b-gray); box-shadow: inset 0 0 0 1px color-mix(in srgb, currentColor 18%, transparent); }
.badge.primary { background: var(--b-primary-bg); color: var(--b-primary); }
.badge.success { background: var(--b-success-bg); color: var(--b-success); }
.badge.warning { background: var(--b-warning-bg); color: var(--b-warning); }
.badge.danger { background: var(--b-danger-bg); color: var(--b-danger); }
.badge.info { background: var(--b-info-bg); color: var(--b-info); }
.badge svg.i { width: 14px; height: 14px; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; background: var(--faint); }
.dot.on { background: var(--success); box-shadow: 0 0 0 3px var(--b-success-bg); }

/* ---------- Danh sách thông tin (infolist) ---------- */
.infolist { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px 24px; }
.infolist .full { grid-column: 1 / -1; }
.infolist dt { font-size: 13px; font-weight: 500; color: var(--muted); margin-bottom: 4px; }
.infolist dd { margin: 0; font-weight: 500; word-break: break-word; }
.grid-2 { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 24px; align-items: start; }
.grid-eq { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; align-items: start; }

/* ---------- Dòng thời gian ---------- */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 22px 34px; }
.timeline li::before { content: ""; position: absolute; left: 11px; top: 26px; bottom: 0; width: 2px; background: var(--border); }
.timeline li:last-child::before { display: none; }
.timeline .tl-ico { position: absolute; left: 0; top: 0; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); color: var(--muted); box-shadow: 0 0 0 4px var(--surface); }
.timeline .tl-ico svg { width: 14px; height: 14px; }
.timeline .tl-ico.primary { background: var(--b-primary-bg); color: var(--b-primary); }
.timeline .tl-ico.success { background: var(--b-success-bg); color: var(--b-success); }
.timeline .tl-title { font-weight: 500; }
.timeline .tl-note { margin-top: 6px; padding: 10px 12px; background: var(--surface-2); border-radius: 8px; white-space: pre-wrap; }
.timeline .tl-meta { font-size: 12.5px; color: var(--muted); margin-top: 2px; }

/* ---------- Modal ---------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(9, 9, 11, 0.5); z-index: 50; display: grid; place-items: start center; padding: 64px 16px; overflow-y: auto; animation: fade .15s; }
.modal { width: min(640px, 100%); background: var(--surface); border-radius: 14px; box-shadow: var(--shadow-lg), 0 0 0 1px var(--ring); animation: pop .15s; }
.modal.sm { width: min(440px, 100%); }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 20px 24px 0; }
.modal-head h2 { margin: 0; font-size: 18px; font-weight: 600; }
.modal-head .desc { color: var(--muted); margin-top: 4px; }
.modal-body { padding: 20px 24px; }
.modal-foot { display: flex; gap: 10px; justify-content: flex-end; padding: 0 24px 22px; }
.modal-icon { width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; margin: 24px auto 0; background: var(--b-danger-bg); color: var(--b-danger); }
.modal.confirm { text-align: center; }
.modal.confirm .modal-head { justify-content: center; }
.modal.confirm .modal-foot { justify-content: center; }
.modal.confirm .modal-foot .btn { flex: 1; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } }

/* ---------- Thông báo ---------- */
.toasts { position: fixed; top: 16px; right: 16px; z-index: 60; display: flex; flex-direction: column; gap: 10px; width: min(360px, calc(100vw - 32px)); }
.toast { display: flex; gap: 12px; align-items: flex-start; background: var(--surface); border-radius: 12px; padding: 14px 16px; box-shadow: var(--shadow-lg), 0 0 0 1px var(--ring); animation: pop .2s; }
.toast .t-ico { color: var(--success); }
.toast.danger .t-ico { color: var(--danger); }
.toast b { display: block; font-weight: 600; }
.toast span { color: var(--muted); font-size: 13.5px; }

/* ---------- Tổng quan: thẻ số liệu ---------- */
.filter-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.seg { display: inline-flex; padding: 3px; border-radius: 10px; background: var(--surface); box-shadow: var(--shadow), inset 0 0 0 1px var(--border); }
.seg button { border: 0; background: none; font: 600 13px var(--font); color: var(--muted); padding: 6px 12px; border-radius: 7px; cursor: pointer; }
.seg button.on { background: var(--surface-2); color: var(--text); }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 24px; margin-bottom: 24px; }
.stat { padding: 22px 24px 0; overflow: hidden; display: flex; flex-direction: column; }
.stat .label { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 500; color: var(--muted); }
.stat .value { font-size: 30px; font-weight: 700; letter-spacing: -0.02em; margin-top: 6px; line-height: 1.2; }
.stat .value small { font-size: 16px; font-weight: 600; color: var(--muted); }
.stat .delta { display: flex; align-items: center; gap: 4px; font-size: 13.5px; font-weight: 500; margin-top: 4px; color: var(--muted); }
.stat .delta.good { color: var(--b-success); }
.stat .delta.bad { color: var(--b-danger); }
.stat .spark { margin: 14px -24px 0; height: 48px; }
.charts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; margin-bottom: 24px; }
.charts .wide { grid-column: 1 / -1; }
.chart-card .card-head { border-bottom: 0; padding-bottom: 0; align-items: flex-start; }
.chart-card .card-body { padding: 16px 24px 20px; }
.chart-box { position: relative; width: 100%; }
.chart-box svg { display: block; width: 100%; overflow: visible; }
.chart-box svg:focus { outline: none; }
.chart-box svg:focus-visible { outline: 2px solid var(--primary-500); outline-offset: 4px; border-radius: 4px; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 12px; font-size: 13px; color: var(--text-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.legend i.line { width: 14px; height: 2px; border-radius: 2px; }
.chart-tip { position: absolute; pointer-events: none; background: var(--surface); border-radius: 10px; padding: 10px 12px; min-width: 150px;
  box-shadow: var(--shadow-lg), 0 0 0 1px var(--ring); font-size: 13px; z-index: 5; opacity: 0; transition: opacity .1s; }
.chart-tip.show { opacity: 1; }
.chart-tip .tt-head { color: var(--muted); font-size: 12px; margin-bottom: 6px; font-weight: 500; }
.chart-tip .tt-row { display: flex; align-items: center; gap: 8px; line-height: 1.7; }
.chart-tip .tt-row i { width: 12px; height: 2px; border-radius: 2px; display: inline-block; flex: none; }
.chart-tip .tt-row b { font-variant-numeric: tabular-nums; }
.chart-tip .tt-row span { color: var(--muted); }
.view-toggle { font: 600 12.5px var(--font); color: var(--muted); background: none; border: 0; cursor: pointer; padding: 4px 8px; border-radius: 6px; display: inline-flex; gap: 4px; align-items: center; }
.view-toggle:hover { background: var(--surface-2); color: var(--text); }
.chart-table { max-height: 300px; overflow: auto; }
.chart-table .tbl td, .chart-table .tbl th { padding: 8px 12px; }
.loading { opacity: .5; transition: opacity .2s; }
.seg-bar { display: flex; gap: 2px; height: 28px; }
.seg-bar > div { border-radius: 4px; display: flex; align-items: center; padding: 0 8px; font-size: 12px; font-weight: 600; color: #fff; min-width: 0; overflow: hidden; white-space: nowrap; cursor: default; }
.seg-bar > div:focus-visible { outline: 2px solid var(--primary-500); outline-offset: 2px; }
.mix-list { margin-top: 18px; display: flex; flex-direction: column; gap: 10px; }
.mix-list div { display: flex; align-items: center; gap: 10px; font-size: 13.5px; }
.mix-list i { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.mix-list b { margin-left: auto; font-variant-numeric: tabular-nums; }

pre.code { background: var(--surface-2); border-radius: 8px; padding: 14px; overflow: auto; max-height: 340px; margin: 0; }
.kbd-hint { font-size: 12px; color: var(--faint); }

/* ---------- Màn hình nhỏ ---------- */
@media (max-width: 1200px) { .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 1024px) {
  .sidebar { position: fixed; left: 0; top: 0; transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow-lg); }
  .sidebar.open { transform: none; }
  .menu-btn { display: inline-grid; }
  .scrim { position: fixed; inset: 0; background: rgba(9,9,11,.4); z-index: 25; }
  .grid-2, .grid-eq, .charts { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
  .content { padding: 20px 16px; }
  .topbar { padding: 0 12px; }
  .stats { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .form-grid, .infolist { grid-template-columns: minmax(0, 1fr); }
  .page-header h1 { font-size: 24px; }
  .card-head, .card-body { padding-left: 16px; padding-right: 16px; }
}

/* Bộ biểu cảm robot */
.theme-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.theme-cell { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: var(--surface); }
.theme-cell img { display: block; width: 100%; aspect-ratio: 8 / 5; object-fit: contain; }
.theme-cell-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 10px; }
.theme-cell-foot b { font-size: 13px; }
.theme-cell-foot .sub { display: block; font-size: 11.5px; color: var(--muted); }