/* =====================================================================
   FLUKE - Kích hoạt sản phẩm bằng mã vạch
   Ý tưởng: "bàn đo kiểm". Nền xám nhạt như mặt bàn kỹ thuật, bảng dữ liệu trắng như phiếu hiệu chuẩn,
   thanh menu màu than như vỏ máy đo. Vàng Fluke chỉ dùng ở 3 chỗ: khối logo, mục menu đang chọn,
   nút hành động chính (và viền ô đang nhập). Mọi thứ khác là mực đen / xám, đường kẻ mảnh 1px.
   Chữ: Be Vietnam Pro (giao diện), Barlow Semi Condensed (số đo, tiêu đề cột - kiểu chữ in trên mặt máy),
   JetBrains Mono (serial, mã). Phông tự lưu trong assets/fonts, không cần internet.
   Sáng / tối: <html data-theme="dark"> (nút công tắc trên thanh tiêu đề, nhớ trong trình duyệt).
   Mọi màu đều lấy từ biến bên dưới; giao diện tối chỉ đổi giá trị biến.
   ===================================================================== */
/* Phông chữ (chép từ fonts/fonts.css vào đây: khỏi tải thêm 1 file CSS nối tiếp trước khi có chữ) */
/* Phông chữ tự lưu trong project (chạy được trong mạng nội bộ, không cần Google Fonts). Giấy phép SIL OFL 1.1 - xem LICENSE-*.txt */
@font-face { font-family: 'Be Vietnam Pro'; font-style: normal; font-weight: 400; font-display: swap; src: url('fonts/be-vietnam-pro-vietnamese-400-normal.woff2') format('woff2'); 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: 'Be Vietnam Pro'; font-style: normal; font-weight: 400; font-display: swap; src: url('fonts/be-vietnam-pro-latin-400-normal.woff2') format('woff2'); 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; }
@font-face { font-family: 'Be Vietnam Pro'; font-style: normal; font-weight: 500; font-display: swap; src: url('fonts/be-vietnam-pro-vietnamese-500-normal.woff2') format('woff2'); 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: 'Be Vietnam Pro'; font-style: normal; font-weight: 500; font-display: swap; src: url('fonts/be-vietnam-pro-latin-500-normal.woff2') format('woff2'); 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; }
@font-face { font-family: 'Be Vietnam Pro'; font-style: normal; font-weight: 600; font-display: swap; src: url('fonts/be-vietnam-pro-vietnamese-600-normal.woff2') format('woff2'); 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: 'Be Vietnam Pro'; font-style: normal; font-weight: 600; font-display: swap; src: url('fonts/be-vietnam-pro-latin-600-normal.woff2') format('woff2'); 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; }
@font-face { font-family: 'Be Vietnam Pro'; font-style: normal; font-weight: 700; font-display: swap; src: url('fonts/be-vietnam-pro-vietnamese-700-normal.woff2') format('woff2'); 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: 'Be Vietnam Pro'; font-style: normal; font-weight: 700; font-display: swap; src: url('fonts/be-vietnam-pro-latin-700-normal.woff2') format('woff2'); 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; }
@font-face { font-family: 'Barlow Semi Condensed'; font-style: normal; font-weight: 500; font-display: swap; src: url('fonts/barlow-semi-condensed-vietnamese-500-normal.woff2') format('woff2'); 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: 'Barlow Semi Condensed'; font-style: normal; font-weight: 500; font-display: swap; src: url('fonts/barlow-semi-condensed-latin-500-normal.woff2') format('woff2'); 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; }
@font-face { font-family: 'Barlow Semi Condensed'; font-style: normal; font-weight: 600; font-display: swap; src: url('fonts/barlow-semi-condensed-vietnamese-600-normal.woff2') format('woff2'); 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: 'Barlow Semi Condensed'; font-style: normal; font-weight: 600; font-display: swap; src: url('fonts/barlow-semi-condensed-latin-600-normal.woff2') format('woff2'); 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; }
@font-face { font-family: 'Barlow Semi Condensed'; font-style: normal; font-weight: 700; font-display: swap; src: url('fonts/barlow-semi-condensed-vietnamese-700-normal.woff2') format('woff2'); 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: 'Barlow Semi Condensed'; font-style: normal; font-weight: 700; font-display: swap; src: url('fonts/barlow-semi-condensed-latin-700-normal.woff2') format('woff2'); 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; }
@font-face { font-family: 'JetBrains Mono'; font-style: normal; font-weight: 500; font-display: swap; src: url('fonts/jetbrains-mono-vietnamese-500-normal.woff2') format('woff2'); 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: 'JetBrains Mono'; font-style: normal; font-weight: 500; font-display: swap; src: url('fonts/jetbrains-mono-latin-500-normal.woff2') format('woff2'); 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; }
@font-face { font-family: 'JetBrains Mono'; font-style: normal; font-weight: 600; font-display: swap; src: url('fonts/jetbrains-mono-vietnamese-600-normal.woff2') format('woff2'); 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: 'JetBrains Mono'; font-style: normal; font-weight: 600; font-display: swap; src: url('fonts/jetbrains-mono-latin-600-normal.woff2') format('woff2'); 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 {
    /* Bề mặt */
    /* Độ tương phản tối đa: trắng là trắng tuyệt đối, đen là đen tuyệt đối.
       Chiều sâu tạo bằng các lớp: nền xám -> thẻ trắng (có bóng) -> vùng lõm xám nhạt. */
    --bg: #e8e8e8;             /* mặt bàn: xám trung tính để thẻ trắng nổi lên */
    --surface: #ffffff;        /* phiếu / bảng */
    --surface-2: #f5f5f5;      /* tiêu đề bảng, vùng lõm */
    --surface-3: #ececec;      /* hover */
    --line: #e0e0e0;
    --line-strong: #c4c4c4;

    /* Mực */
    --text: #000000;
    --text-2: #262626;
    --muted: #5c5c5c;
    --faint: #8f8f8f;

    /* Thanh menu (vỏ máy) */
    --rail: #000000;
    --rail-2: #1f1f1f;
    --rail-text: #e6e6e6;
    --rail-muted: #8a8a8a;

    /* Nhận diện Fluke */
    --brand: #ffc20e;
    --brand-hover: #ffcf3d;
    --brand-deep: #c99400;     /* vàng đủ đậm để làm chữ / viền trên nền trắng */
    --brand-ink: #000000;
    --brand-tint: #fff7da;

    /* Trạng thái (đủ tương phản trên nền trắng) */
    --green: #1f7a3d;   --green-tint: #e6f3ea;
    --red: #c0352b;     --red-tint: #fbebe9;
    --orange: #b35a09;  --orange-tint: #fbf0e2;
    --blue: #1f5fae;    --blue-tint: #e8f0fa;
    --sky: #1f5fae;
    --purple: #6b46c1;  --purple-tint: #f0ebfb;

    --radius: 10px;
    --radius-sm: 7px;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.08), 0 6px 16px -8px rgba(0, 0, 0, 0.14);
    --shadow-pop: 0 24px 60px -12px rgba(0, 0, 0, 0.4);
    --focus: 0 0 0 3px rgba(255, 194, 14, 0.45);

    /* Chi tiết phụ */
    --border-hover: #9e9e9e;
    --row-hover: #f7f7f7;
    --topbar-bg: rgba(255, 255, 255, 0.94);
    --pending-bar: #e2a35a;
    --on-ink: #ffffff;            /* chữ trên nền mực (chip / trang đang chọn) */
    --overlay: rgba(0, 0, 0, 0.5);
    --select-arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%235c5c5c'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
    --flash-ok: #174d29;   --flash-ok-line: #b9dcc4;
    --flash-err: #7c231c;  --flash-err-line: #efc4bf;
    --flash-warn: #6e3a07; --flash-warn-line: #ecd2b1;
    --flash-info: #1d3d66; --flash-info-line: #c6d8ef;
    --danger-line: #e7b7b2;
    --brand-line: #ecd58f;
    color-scheme: light;

    --font: 'Be Vietnam Pro', 'Segoe UI', -apple-system, BlinkMacSystemFont, Roboto, Arial, sans-serif;
    --display: 'Barlow Semi Condensed', 'Arial Narrow', 'Be Vietnam Pro', sans-serif;
    --mono: 'JetBrains Mono', ui-monospace, 'Cascadia Mono', Consolas, monospace;

    /* tên cũ vẫn được JSP / JS dùng */
    --l2: var(--surface);
    --l3: var(--surface-3);
    --inset: var(--surface-2);
}

/* ---------------------------------------------------------------------
   Giao diện tối: cùng bố cục, chỉ đổi màu. Nền than nhiều lớp, chữ sáng ngả xám,
   màu trạng thái sáng hơn để đủ tương phản trên nền tối. Vàng Fluke giữ nguyên.
   --------------------------------------------------------------------- */
:root[data-theme="dark"] {
    /* Đen tuyệt đối ở nền, các lớp nổi sáng dần lên: nền -> thẻ -> vùng lõm / hover */
    --bg: #000000;
    --surface: #141414;
    --surface-2: #1c1c1c;
    --surface-3: #262626;
    --line: #2a2a2a;
    --line-strong: #3d3d3d;

    --text: #ffffff;
    --text-2: #dcdcdc;
    --muted: #9c9c9c;
    --faint: #6e6e6e;

    --rail: #0a0a0a;
    --rail-2: #1f1f1f;
    --rail-text: #e6e6e6;
    --rail-muted: #858585;

    --brand-deep: #ffc20e;
    --brand-tint: rgba(255, 194, 14, 0.13);

    --green: #4fd283;   --green-tint: rgba(79, 210, 131, 0.14);
    --red: #ff7a6b;     --red-tint: rgba(255, 122, 107, 0.15);
    --orange: #ffaa5c;  --orange-tint: rgba(255, 170, 92, 0.15);
    --blue: #78b2ff;    --blue-tint: rgba(120, 178, 255, 0.15);
    --sky: #78b2ff;
    --purple: #bfa8ff;  --purple-tint: rgba(191, 168, 255, 0.15);

    /* Trên nền đen bóng đổ khó thấy: thêm viền sáng mảnh ở mép trên để thẻ "nổi" */
    --shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 8px 24px -10px rgba(0, 0, 0, 0.9);
    --shadow-pop: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 30px 70px -10px rgba(0, 0, 0, 0.95);

    --border-hover: #5a5a5a;
    --row-hover: #1a1a1a;
    --topbar-bg: rgba(0, 0, 0, 0.82);
    --pending-bar: #d98c43;
    --on-ink: #000000;
    --overlay: rgba(0, 0, 0, 0.7);
    --select-arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%239c9c9c'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
    --flash-ok: #b5f0cb;   --flash-ok-line: rgba(79, 210, 131, 0.4);
    --flash-err: #ffcbc4;  --flash-err-line: rgba(255, 122, 107, 0.4);
    --flash-warn: #ffdcb9; --flash-warn-line: rgba(255, 170, 92, 0.4);
    --flash-info: #cfe3ff; --flash-info-line: rgba(120, 178, 255, 0.4);
    --danger-line: rgba(255, 122, 107, 0.45);
    --brand-line: rgba(255, 194, 14, 0.5);
    color-scheme: dark;
}
html { transition: background-color .2s; }

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
    font-family: var(--font);
    font-size: 14px;
    line-height: 1.55;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
code, .mono { font-family: var(--mono); font-size: 12.5px; font-weight: 500; }
::selection { background: rgba(255, 194, 14, 0.45); }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--brand-deep); outline-offset: 2px; }

/* ---------------------------------------------------------------------
   Khung trang
   --------------------------------------------------------------------- */
.app { display: flex; min-height: 100vh; }

.sidebar {
    width: 240px; flex-shrink: 0;
    position: sticky; top: 0; height: 100vh;
    display: flex; flex-direction: column;
    background: var(--rail);
    color: var(--rail-text);
    z-index: 5;
}
.brand {
    display: flex; flex-direction: column; gap: 5px;
    padding: 20px 20px 16px;
    background: var(--brand); color: var(--brand-ink);
}
.brand:hover { text-decoration: none; }
.brand-logo { display: block; width: 118px; height: auto; }
.brand-name { font-family: var(--display); font-weight: 600; font-size: 13.5px; letter-spacing: .2px; line-height: 1.1; }

.nav { padding: 10px 10px 16px; display: flex; flex-direction: column; gap: 1px; flex: 1; overflow-y: auto; }
.nav-label { font-size: 11.5px; font-weight: 500; color: var(--rail-muted); padding: 16px 12px 6px; }
.nav a {
    position: relative;
    display: flex; align-items: center; gap: 11px;
    padding: 8px 12px; border-radius: 7px;
    color: var(--rail-text); font-size: 13.5px; font-weight: 500;
}
.nav a svg { width: 17px; height: 17px; flex-shrink: 0; color: var(--rail-muted); }
.nav a:hover { background: var(--rail-2); color: #fff; text-decoration: none; }
.nav a.active { background: var(--rail-2); color: #fff; }
.nav a.active::before { content: ""; position: absolute; left: -10px; top: 7px; bottom: 7px; width: 3px; border-radius: 0 3px 3px 0; background: var(--brand); }
.nav a.active svg { color: var(--brand); }

.me {
    margin: 0 10px 12px; padding: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    display: flex; align-items: center; gap: 10px;
}
.avatar {
    width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0;
    display: grid; place-items: center;
    font-family: var(--display); font-weight: 600; font-size: 13px;
    background: var(--brand); color: var(--brand-ink);
}
.me-name { font-weight: 600; font-size: 13px; line-height: 1.25; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-dept { font-size: 11.5px; color: var(--rail-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me form { margin: 0; }
.me .icon-btn:first-of-type { margin-left: auto; }
.icon-btn {
    width: 30px; height: 30px; border-radius: 7px; flex: none;
    display: grid; place-items: center;
    background: transparent; border: 0; color: var(--rail-muted); cursor: pointer;
}
.icon-btn:hover { color: #fff; background: var(--rail-2); }
.icon-btn svg { width: 16px; height: 16px; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
    position: sticky; top: 0; z-index: 4;
    display: flex; align-items: center; justify-content: space-between; gap: 16px;
    padding: 12px 28px;
    background: var(--topbar-bg);
    backdrop-filter: saturate(1.4) blur(10px); -webkit-backdrop-filter: saturate(1.4) blur(10px);
    border-bottom: 1px solid var(--line);
}
.crumbs { font-size: 12px; color: var(--muted); margin-bottom: 1px; }
.page-title { font-size: 20px; font-weight: 600; letter-spacing: -0.2px; line-height: 1.3; display: flex; align-items: center; gap: 12px; }
.topbar-actions { display: flex; gap: 8px; align-items: center; }
.content { padding: 20px 28px 40px; width: 100%; }

/* ---------------------------------------------------------------------
   Khối nội dung
   --------------------------------------------------------------------- */
.card {
    position: relative;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.card-pad { padding: 18px 20px; }
.card-head {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 14px 20px; border-bottom: 1px solid var(--line);
}
.card-title { font-size: 15px; font-weight: 600; color: var(--text); display: flex; align-items: center; gap: 8px; }
.card-title .dot { display: none; }
.card-sub { font-size: 12.5px; color: var(--muted); }
.card-body { padding: 18px 20px 20px; }
.card.accent { box-shadow: inset 3px 0 0 var(--accent, var(--brand)), var(--shadow); }
.well { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 14px 16px; }

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-main { grid-template-columns: minmax(0, 1fr) 360px; align-items: start; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.mt-8 { margin-top: 8px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; } .mb-16 { margin-bottom: 16px; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 12.5px; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.strong { font-weight: 600; color: var(--text); }
.num { font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------------
   Ô số liệu: như mặt đọc của máy đo
   --------------------------------------------------------------------- */
.kpi { padding: 14px 18px 14px; }
.kpi-label { font-size: 12.5px; color: var(--muted); font-weight: 500; }
.kpi-value {
    font-family: var(--display); font-weight: 600; font-size: 32px; line-height: 1.1;
    margin-top: 4px; color: var(--text); font-variant-numeric: tabular-nums; letter-spacing: -0.2px;
}
.kpi-value small { font-family: var(--font); font-size: 12.5px; font-weight: 500; color: var(--muted); margin-left: 3px; letter-spacing: 0; }
.kpi-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.kpi-bar { height: 4px; border-radius: 2px; background: var(--surface-3); margin-top: 10px; overflow: hidden; }
.kpi-bar span { display: block; height: 100%; background: var(--tone, var(--text)); }
/* Bảng kết quả nhập file: số theo màu trạng thái (trừ ô Tổng) */
.imp-kpis .kpi + .kpi .kpi-value { color: var(--tone); }
/* Ô bấm được để lọc: màu chỉ hiện ở thanh đo và khi đang chọn */
.kpi-link { text-decoration: none; color: inherit; transition: border-color .15s, box-shadow .15s; }
.kpi-link:hover { text-decoration: none; border-color: var(--line-strong); }
.kpi-link.active { border-color: var(--tone); box-shadow: inset 0 0 0 1px var(--tone), var(--shadow); }
.kpi-link .kpi-value { color: var(--tone, var(--text)); }

/* ---------------------------------------------------------------------
   Nhãn trạng thái
   --------------------------------------------------------------------- */
.pill {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 2px 9px 2px 8px; border-radius: 999px;
    font-size: 12px; font-weight: 600; line-height: 1.6; white-space: nowrap;
    color: var(--text-2); background: var(--surface-3);
}
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.tone-green  { color: var(--green);  background: var(--green-tint); }
.pill.tone-red    { color: var(--red);    background: var(--red-tint); }
.pill.tone-orange { color: var(--orange); background: var(--orange-tint); }
.pill.tone-blue, .pill.tone-sky { color: var(--blue); background: var(--blue-tint); }
.pill.tone-purple { color: var(--purple); background: var(--purple-tint); }
.pill.tone-brand  { color: var(--text); background: var(--brand-tint); }
.pill.tone-brand::before { background: var(--brand-deep); }
.pill.tone-muted  { color: var(--muted); background: var(--surface-3); }
.tone-green { color: var(--green); } .tone-red { color: var(--red); } .tone-orange { color: var(--orange); }
.tone-blue, .tone-sky { color: var(--blue); } .tone-purple { color: var(--purple); }
.tone-brand { color: var(--brand-deep); } .tone-muted { color: var(--muted); }

/* ---------------------------------------------------------------------
   Bảng
   --------------------------------------------------------------------- */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
.table th {
    position: sticky; top: 0;
    text-align: left; white-space: nowrap;
    font-family: var(--display); font-size: 13px; font-weight: 600; letter-spacing: .15px;
    color: var(--muted);
    background: var(--surface-2);
    padding: 9px 14px;
    border-bottom: 1px solid var(--line);
}
.table th.right { text-align: right; }
.table td { padding: 10px 14px; border-bottom: 1px solid var(--line); color: var(--text-2); vertical-align: middle; }
.table tbody tr:hover td { background: var(--row-hover); }
.table tbody tr:last-child td { border-bottom: none; }
.table .code { font-family: var(--mono); font-size: 13px; font-weight: 500; color: var(--text); }
.table td.strong { color: var(--text); }
.table tr.is-new td { background: var(--green-tint); }
.table tr.is-new td:first-child { box-shadow: inset 3px 0 0 var(--green); }
.table tfoot td { font-weight: 600; color: var(--text); border-top: 1px solid var(--line-strong); background: var(--surface-2); }
.table-card { overflow: hidden; }
.table-card > .card-head { border-bottom: 1px solid var(--line); }
.row-muted td { opacity: .5; }
/* Nút nhỏ trong bảng (Xem serial, Xóa...): nhẹ như link, hiện khung khi rê chuột */
.table td .btn-sm { border-color: transparent; background: transparent; box-shadow: none; color: var(--blue); font-weight: 500; }
.table td .btn-sm:hover { background: var(--blue-tint); }
.table td .btn-sm.btn-danger { color: var(--red); }
.table td .btn-sm.btn-danger:hover { background: var(--red-tint); border-color: transparent; }

.empty { text-align: center; padding: 44px 20px; color: var(--muted); }
.empty b { display: block; color: var(--text); font-size: 15px; font-weight: 600; margin-bottom: 2px; }

/* Thanh trong bảng báo cáo */
.bar { display: flex; align-items: center; gap: 10px; min-width: 160px; }
.bar-track { flex: 1; height: 8px; border-radius: 4px; background: var(--surface-3); overflow: hidden; }
.bar-track span { display: block; height: 100%; background: var(--text-2); }
.bar-track .bar-stack { display: flex; background: none; overflow: hidden; }
.bar-stack i { display: block; height: 100%; min-width: 0; }
.bar-stack i.a { background: var(--green); }
.bar-stack i.p { background: var(--pending-bar); }
.bar b { min-width: 52px; text-align: right; font-family: var(--display); font-weight: 600; font-size: 14px; font-variant-numeric: tabular-nums; color: var(--text); }
.legend { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-left: 10px; }
.legend i.lg-a { background: var(--green); }
.legend i.lg-p { background: var(--pending-bar); }

/* ---------------------------------------------------------------------
   Nút
   --------------------------------------------------------------------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 7px;
    height: 36px; padding: 0 14px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--line-strong);
    background: var(--surface);
    color: var(--text);
    font: inherit; font-weight: 500; font-size: 13.5px; line-height: 1;
    cursor: pointer; white-space: nowrap;
    box-shadow: var(--shadow);
    transition: background .12s, border-color .12s;
}
.btn:hover { background: var(--surface-2); border-color: var(--border-hover); text-decoration: none; }
.btn:active { background: var(--surface-3); }
.btn:focus-visible { outline: none; box-shadow: var(--focus); }
.btn svg { width: 16px; height: 16px; flex: none; }
.btn-sm { height: 30px; padding: 0 10px; font-size: 12.5px; }
.btn-block { width: 100%; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); font-weight: 600; }
.btn-primary:hover { background: var(--brand-hover); border-color: var(--brand-hover); }
.btn-primary:active { background: #f0b400; border-color: #f0b400; }
/* Xuất Excel: nút thường, chỉ biểu tượng màu xanh Excel */
.btn-success svg { color: var(--green); }
.btn-danger { color: var(--red); border-color: var(--danger-line); }
.btn-danger:hover { background: var(--red-tint); border-color: var(--red); }
.btn-ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-3); border-color: transparent; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }

/* ---------------------------------------------------------------------
   Form
   --------------------------------------------------------------------- */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 18px; }
.form-grid .full { grid-column: 1 / -1; }
.field label { display: block; font-size: 12.5px; font-weight: 500; color: var(--text-2); margin-bottom: 5px; }
.field label .req { color: var(--red); }
.field .hint { font-size: 12px; color: var(--muted); margin-top: 5px; }

.input, select.input, textarea.input {
    width: 100%; height: 36px; padding: 0 11px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--line-strong);
    background: var(--surface);
    color: var(--text);
    font: inherit; font-size: 13.5px;
    transition: border-color .12s, box-shadow .12s;
}
select.input { padding-right: 30px; appearance: none; -webkit-appearance: none;
    background: var(--surface) var(--select-arrow) no-repeat right 8px center / 18px; }
textarea.input { height: auto; padding: 9px 11px; resize: vertical; min-height: 84px; line-height: 1.5; }
.input::placeholder { color: var(--faint); font-family: var(--font); font-weight: 400; letter-spacing: 0; }
.input:hover { border-color: var(--border-hover); }
.input:focus { outline: none; border-color: var(--brand-deep); box-shadow: var(--focus); }
.input[readonly] { background: var(--surface-2); color: var(--text-2); }
.input.is-locked { background: var(--surface-2); color: var(--muted); cursor: not-allowed; pointer-events: none; user-select: none; }
.input.mono { font-family: var(--mono); font-size: 13px; }

.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; color: var(--text-2); font-size: 13px; }
.check input { width: 16px; height: 16px; accent-color: var(--text); }

.segmented { display: inline-flex; padding: 3px; gap: 2px; border-radius: 8px; background: var(--surface-3); flex-wrap: wrap; }
.segmented a, .segmented label { padding: 5px 12px; border-radius: 6px; cursor: pointer; font-size: 13px; font-weight: 500; color: var(--muted); }
.segmented a:hover { color: var(--text); text-decoration: none; }
.segmented a.on, .segmented input:checked + label { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.segmented input { display: none; }

.file-drop {
    display: flex; align-items: center; gap: 14px; padding: 16px 18px;
    border: 1px dashed var(--line-strong); border-radius: var(--radius);
    background: var(--surface-2); cursor: pointer;
    transition: border-color .12s, background .12s;
}
.file-drop:hover { border-color: var(--brand-deep); background: var(--brand-tint); }
.file-drop input { display: none; }
.file-drop .file-ico {
    width: 40px; height: 40px; border-radius: 8px; flex: none; display: grid; place-items: center;
    background: var(--green-tint); color: var(--green); font-family: var(--display); font-size: 12px; font-weight: 700;
}
.file-drop .file-name { font-weight: 600; font-size: 13px; }

/* ---------------------------------------------------------------------
   Thông báo
   --------------------------------------------------------------------- */
.flash {
    display: flex; gap: 10px; align-items: flex-start;
    padding: 11px 14px; margin-bottom: 16px;
    border-radius: var(--radius-sm);
    border: 1px solid; border-left-width: 3px;
    font-size: 13.5px;
    background: var(--surface);
}
.flash-ok   { color: var(--flash-ok); border-color: var(--flash-ok-line); border-left-color: var(--green); background: var(--green-tint); }
.flash-err  { color: var(--flash-err); border-color: var(--flash-err-line); border-left-color: var(--red); background: var(--red-tint); }
.flash-warn { color: var(--flash-warn); border-color: var(--flash-warn-line); border-left-color: var(--orange); background: var(--orange-tint); }
.flash-info { color: var(--flash-info); border-color: var(--flash-info-line); border-left-color: var(--blue); background: var(--blue-tint); }
.flash b { font-weight: 600; }

.kv { display: grid; grid-template-columns: 130px minmax(0, 1fr); gap: 8px 12px; font-size: 13.5px; }
.kv dt { color: var(--muted); }
.kv dd { color: var(--text); font-weight: 500; word-break: break-word; }

/* ---------------------------------------------------------------------
   Bộ lọc: 1 thanh công cụ
   --------------------------------------------------------------------- */
.filters { display: flex; gap: 10px 12px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 16px; padding: 14px 16px; }
.filters .field { min-width: 128px; }
.filters .field label { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.filters .field.grow { flex: 1; min-width: 180px; }
.filters .field.date { min-width: 0; width: 134px; }
.quick { display: flex; gap: 4px; flex-wrap: wrap; width: 100%; align-items: center; padding-top: 10px; border-top: 1px solid var(--line); }
.quick .lbl { font-size: 12px; color: var(--muted); margin-right: 6px; }
.chip { padding: 3px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 500; color: var(--text-2); border: 1px solid transparent; }
.chip:hover { background: var(--surface-3); color: var(--text); text-decoration: none; }
.chip.on { background: var(--text); color: var(--on-ink); }

/* ---------------------------------------------------------------------
   Màn hình quét
   --------------------------------------------------------------------- */
.scan-layout { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 16px; align-items: start; }
.scan-card { overflow: hidden; }
.scan-card .card-head { padding: 14px 20px; }
.scan-card .card-body { padding: 16px 20px 18px; }
.scan-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; }
.scan-fields .full { grid-column: 1 / -1; }
.scan-field label { display: flex; align-items: center; gap: 8px; margin-bottom: 5px; font-size: 12.5px; }
.scan-field label .tag { font-size: 11.5px; color: var(--faint); font-weight: 400; }
.scan-input { position: relative; }
.scan-input .input {
    height: 44px; padding: 0 48px 0 40px;
    font-family: var(--mono); font-size: 16px; font-weight: 500; letter-spacing: .2px;
}
.scan-input .input::placeholder { font-size: 14px; }
.scan-input .ico { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--faint); pointer-events: none; }
.scan-input .input:focus ~ .ico { color: var(--brand-deep); }
.scan-input .state { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); font-size: 12px; pointer-events: none; }
.scan-input .input.has-state { padding-right: 150px; }
/* Ô đang chờ súng quét: vạch vàng nhấp nháy chậm ở mép trái */
.scan-input .input:focus { animation: scanPulse 1.8s ease-in-out infinite; }
@keyframes scanPulse {
    0%, 100% { box-shadow: var(--focus); }
    50%      { box-shadow: 0 0 0 4px rgba(255, 194, 14, 0.25); }
}
.scan-input.ok .input   { border-color: var(--green); }
.scan-input.warn .input { border-color: var(--orange); }
.scan-input.bad .input  { border-color: var(--red); }
.field-msg { font-size: 12px; margin-top: 4px; min-height: 5px; line-height: 1.35; }
.field-msg.ok { color: var(--green); }
.field-msg.warn { color: var(--orange); }
.field-msg.bad { color: var(--red); }

.model-box { display: flex; align-items: center; gap: 12px; padding: 10px 14px; min-height: 44px; border-radius: var(--radius-sm); border: 1px dashed var(--line-strong); background: var(--surface-2); }
.model-box .m { font-family: var(--mono); font-size: 16px; font-weight: 600; color: var(--text); }
.model-box .d { font-size: 12px; color: var(--muted); }
.model-box.found { border-style: solid; border-color: var(--flash-ok-line); background: var(--green-tint); }

.date-row { display: flex; gap: 8px; }
.date-row .input { height: 44px; font-family: var(--mono); font-size: 15px; }

.dist-box { display: flex; align-items: center; gap: 10px; padding: 4px 12px; min-height: 44px; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--surface-2); }
.dist-box .avatar { width: 26px !important; height: 26px !important; font-size: 11px !important; }
.dist-box b { color: var(--text); font-weight: 600; font-size: 13.5px; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.scan-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); }
.btn-activate { height: 44px; padding: 0 24px; font-size: 15px; min-width: 200px; }
.btn-activate svg { width: 18px; height: 18px; }
.kbd { font-family: var(--mono); font-size: 11px; padding: 1px 5px; border-radius: 4px; border: 1px solid var(--line-strong); border-bottom-width: 2px; background: var(--surface); color: var(--muted); }

/* Tiến độ 4 trường: 4 vạch mảnh như thang đo */
.steps4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin-bottom: 16px; }
.steps4 div {
    display: flex; align-items: center; gap: 7px; padding: 8px 0 0;
    font-size: 12.5px; font-weight: 500; color: var(--faint);
    border-top: 3px solid var(--surface-3);
}
.steps4 i { font-style: normal; font-family: var(--display); font-weight: 600; font-size: 13px; width: auto; height: auto; border: 0; }
.steps4 div.done { color: var(--text-2); border-top-color: var(--green); }
.steps4 div.done i { color: var(--green); }
.steps4 div.cur { color: var(--text); border-top-color: var(--brand); }

/* Lưu thành công */
.flash-ok.big { font-size: 14.5px; padding: 12px 16px; align-items: center; }
.flash-ok.big svg { width: 22px; height: 22px; flex: none; color: var(--green); }
@keyframes popIn { from { transform: translateY(-4px); opacity: 0; } to { transform: none; opacity: 1; } }
.flash.big { animation: popIn .2s ease-out; }

.recent-list { list-style: none; }
.recent-list li { display: flex; align-items: center; gap: 12px; padding: 9px 20px; border-bottom: 1px solid var(--line); }
.recent-list li:last-child { border-bottom: 0; }
.recent-list li.is-new { background: var(--green-tint); box-shadow: inset 3px 0 0 var(--green); }
.recent-list .sn { font-family: var(--mono); font-weight: 600; font-size: 13px; color: var(--text); }
.recent-list .md { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.recent-list .tm { margin-left: auto; font-size: 12px; color: var(--muted); text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }

.label-guide { display: grid; gap: 8px; font-size: 13px; color: var(--text-2); }
.label-guide div { display: flex; gap: 10px; align-items: baseline; }
.label-guide b { font-family: var(--mono); min-width: 70px; color: var(--text); font-size: 12px; font-weight: 600; }

.btn-camera { height: 36px; }
.btn-camera svg { width: 17px; height: 17px; }
.cam-mini {
    position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
    width: 32px; height: 32px; border-radius: 6px; display: grid; place-items: center;
    border: 0; background: transparent; color: var(--muted); cursor: pointer;
}
.cam-mini:hover { background: var(--surface-3); color: var(--text); }
.cam-mini:focus-visible { outline: none; box-shadow: var(--focus); }
.cam-mini svg { width: 18px; height: 18px; }

/* ---------------------------------------------------------------------
   Quét bằng camera: lớp phủ tối (đặt trên hình camera nên giữ nền tối)
   --------------------------------------------------------------------- */
body.cam-open { overflow: hidden; }
.cam {
    --c-surface: #1c1e21; --c-raise: #26292d; --c-line: rgba(255, 255, 255, 0.12); --c-text: #f2f3f4; --c-muted: #a6abb1;
    position: fixed; inset: 0; z-index: 100;
    background: rgba(10, 11, 12, 0.88);
    display: grid; place-items: center;
    padding: max(12px, env(safe-area-inset-top, 0px)) max(12px, env(safe-area-inset-right, 0px))
             max(12px, env(safe-area-inset-bottom, 0px)) max(12px, env(safe-area-inset-left, 0px));
    color: var(--c-text);
}
.cam-panel {
    width: min(760px, 100%); max-height: 100%;
    display: flex; flex-direction: column; gap: 12px;
    background: var(--c-surface); border: 1px solid var(--c-line); border-radius: 12px;
    box-shadow: var(--shadow-pop); padding: 14px; overflow: auto;
}
.cam .btn { background: var(--c-raise); border-color: var(--c-line); color: var(--c-text); box-shadow: none; }
.cam .btn:hover { background: #31353a; }
.cam .btn-primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.cam .btn-ghost { background: transparent; border-color: transparent; }
.cam-head { display: flex; align-items: center; gap: 12px; }
.cam-step { flex: none; padding: 3px 10px; border-radius: 999px; background: var(--brand); color: var(--brand-ink); font-family: var(--display); font-size: 13px; font-weight: 600; }
.cam-title { flex: 1; min-width: 0; font-size: 16px; font-weight: 600; }
.cam-icon { flex: none; width: 38px; height: 38px; border-radius: 8px; display: grid; place-items: center; border: 1px solid var(--c-line); background: var(--c-raise); color: var(--c-text); cursor: pointer; }
.cam-icon svg { width: 20px; height: 20px; }
.cam-view { position: relative; overflow: hidden; border-radius: 8px; background: #000; aspect-ratio: 4 / 3; max-height: 62vh; width: 100%; }
.cam-view video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.cam-band { position: absolute; left: 7%; right: 7%; top: 37%; height: 26%; border-radius: 6px; box-shadow: 0 0 0 100vmax rgba(0, 0, 0, 0.55); transition: box-shadow .2s; }
.cam-band::before {
    content: attr(data-label);
    position: absolute; left: 50%; bottom: calc(100% + 10px); transform: translateX(-50%);
    padding: 2px 12px; border-radius: 999px; white-space: nowrap;
    background: var(--brand); color: var(--brand-ink); font-family: var(--display); font-size: 14px; font-weight: 600;
}
.cam-band i { position: absolute; width: 24px; height: 24px; border: 3px solid var(--brand); }
.cam-band .c1 { left: -2px; top: -2px; border-right: 0; border-bottom: 0; border-top-left-radius: 6px; }
.cam-band .c2 { right: -2px; top: -2px; border-left: 0; border-bottom: 0; border-top-right-radius: 6px; }
.cam-band .c3 { left: -2px; bottom: -2px; border-right: 0; border-top: 0; border-bottom-left-radius: 6px; }
.cam-band .c4 { right: -2px; bottom: -2px; border-left: 0; border-top: 0; border-bottom-right-radius: 6px; }
.cam-laser { position: absolute; left: 4%; right: 4%; top: 50%; height: 2px; background: #ff3b30; box-shadow: 0 0 8px 1px rgba(255, 59, 48, 0.7); animation: camLaser 1.6s ease-in-out infinite; }
@keyframes camLaser { 0%, 100% { transform: translateY(-14px); } 50% { transform: translateY(14px); } }
.cam-view.hit .cam-band { box-shadow: 0 0 0 100vmax rgba(31, 122, 61, 0.4); }
.cam-view.hit .cam-band i { border-color: #4ade80; }
.cam-view.miss .cam-band { box-shadow: 0 0 0 100vmax rgba(192, 53, 43, 0.4); }
.cam-hint { position: absolute; left: 0; right: 0; bottom: 10px; text-align: center; font-size: 12.5px; color: #fff; text-shadow: 0 1px 3px #000; }
.cam-wait { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: 24px; color: #fff; background: rgba(0, 0, 0, 0.75); font-size: 14px; line-height: 1.5; }
.cam-status { min-height: 22px; font-size: 13.5px; font-weight: 500; color: var(--c-muted); }
.cam-status.bad { color: #ff9b91; }
.cam-status.ok { color: #7ee2a0; }
.cam-got { display: flex; gap: 8px; flex-wrap: wrap; }
.cam-chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 999px; font-size: 12.5px; color: var(--c-muted); border: 1px solid var(--c-line); }
.cam-chip b { color: var(--c-text); font-family: var(--mono); font-weight: 500; }
.cam-chip svg { width: 15px; height: 15px; }
.cam-chip.cur { border-color: var(--brand); color: var(--brand); }
.cam-chip.ok { border-color: rgba(126, 226, 160, 0.5); color: #7ee2a0; }
.cam-zoom { display: flex; align-items: center; gap: 10px; font-size: 12.5px; color: var(--c-muted); }
.cam-zoom input { flex: 1; accent-color: var(--brand); }
.cam-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cam-actions .btn.on { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.cam .check { color: var(--c-muted); }
.cam .check input { accent-color: var(--brand); }
.cam-photo { cursor: pointer; }
.cam-photo-big { height: 44px; padding: 0 20px; font-size: 15px; flex: 1 1 auto; }
.cam-help { display: flex; flex-direction: column; gap: 10px; }
.cam-way { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; padding: 12px 14px; border-radius: 8px; border: 1px solid var(--c-line); background: var(--c-raise); font-size: 13px; color: var(--c-muted); line-height: 1.5; }
.cam-way b { color: var(--c-text); }
.cam-way.main { border-color: rgba(255, 194, 14, 0.6); background: rgba(255, 194, 14, 0.08); }
.cam-way .mono { overflow-wrap: anywhere; color: var(--brand); }
.cam-way summary { cursor: pointer; color: var(--c-text); }
.cam-way ol { margin: 8px 0 0 18px; display: flex; flex-direction: column; gap: 8px; }
.cam-way ol .btn { margin-left: 6px; height: 26px; padding: 0 8px; }
.cam-codes { list-style: none; display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.cam-code { width: 100%; display: flex; align-items: center; gap: 12px; text-align: left; padding: 10px 12px; border-radius: 8px; cursor: pointer; font: inherit; color: var(--c-muted); border: 1px solid var(--c-line); background: var(--c-raise); }
.cam-code .mono { flex: 1; min-width: 0; overflow-wrap: anywhere; font-size: 15px; color: var(--c-text); }
.cam-role { flex: none; min-width: 76px; text-align: center; padding: 2px 8px; border-radius: 999px; font-family: var(--display); font-size: 13px; font-weight: 600; border: 1px solid var(--c-line); color: var(--c-muted); }
.cam-code.on { border-color: var(--brand); }
.cam-code.on .cam-role { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.cam .small.muted, .cam .muted { color: var(--c-muted); }
@media (max-width: 600px) {
    .cam { padding: 0; place-items: stretch; }
    .cam-panel { width: 100%; height: 100%; border-radius: 0; border: 0;
        padding: max(10px, env(safe-area-inset-top, 0px)) max(12px, env(safe-area-inset-right, 0px))
                 max(12px, env(safe-area-inset-bottom, 0px)) max(12px, env(safe-area-inset-left, 0px)); }
    .cam-view { aspect-ratio: 3 / 4; max-height: 58vh; }
    .cam-band { left: 5%; right: 5%; top: 40%; height: 20%; }
    .cam-title { font-size: 15px; }
    .cam-actions .spacer { display: none; }
}

/* ---------------------------------------------------------------------
   Đăng nhập / trang lỗi
   --------------------------------------------------------------------- */
.center-page {
    min-height: 100vh; display: grid; place-items: center;
    padding-block: 32px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px));
    background: var(--rail);
}
.login-card { width: 100%; max-width: 400px; padding: 0; overflow: hidden; border: 0; box-shadow: var(--shadow-pop); }
.login-head { background: var(--brand); color: var(--brand-ink); padding: 28px 30px 22px; }
.login-head .brand-logo { width: 170px; }
.login-head .tagline { margin-top: 10px; font-family: var(--display); font-size: 15px; font-weight: 600; }
.login-body { padding: 24px 30px 28px; }
.login-card h1 { font-size: 19px; font-weight: 600; letter-spacing: -0.2px; margin: 0 0 4px; }
.login-body .btn-primary { height: 42px; }
.footer-note { text-align: center; color: var(--rail-muted); font-size: 12px; margin-top: 20px; }
.footer-note b { color: var(--rail-text); font-weight: 500; }

.issued { border: 1px solid var(--brand-line); background: var(--brand-tint); }
.issued-grid { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 16px 32px; }
.issued-val { font-family: var(--mono); font-size: 20px; font-weight: 600; color: var(--text); letter-spacing: .5px; margin-top: 4px; user-select: all; }

/* ---------------------------------------------------------------------
   Phân trang
   --------------------------------------------------------------------- */
.pager { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 10px 16px; border-top: 1px solid var(--line); background: var(--surface); }
.pager-info { font-size: 12.5px; color: var(--muted); }
.pager-info b { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.pager-pages { display: inline-flex; gap: 2px; }
.pg {
    min-width: 30px; height: 30px; padding: 0 8px; display: inline-grid; place-items: center;
    border-radius: 6px; font-size: 13px; font-weight: 500; font-variant-numeric: tabular-nums;
    color: var(--text-2); border: 1px solid transparent;
}
a.pg:hover { background: var(--surface-3); color: var(--text); text-decoration: none; }
.pg.current { background: var(--text); color: var(--on-ink); }
.pg.disabled { opacity: .35; }
.pg.gap { color: var(--faint); }
.pager-size select { width: auto; height: 30px; font-size: 12.5px; }

/* ---------------------------------------------------------------------
   Hộp thoại
   --------------------------------------------------------------------- */
dialog.modal { margin: auto; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--text); width: min(460px, calc(100vw - 32px)); box-shadow: var(--shadow-pop); padding: 0; }
dialog.modal::backdrop { background: var(--overlay); }
dialog.modal .card-body { padding-top: 16px; }

/* ---------------------------------------------------------------------
   Ô ngày + nút lịch
   --------------------------------------------------------------------- */
.date-wrap { position: relative; display: block; }
.date-wrap > .input { padding-right: 36px; width: 100%; }
.date-wrap .cal-btn { position: absolute; right: 3px; top: 50%; transform: translateY(-50%); width: 30px; height: 30px; display: grid; place-items: center; border: 0; border-radius: 5px; background: transparent; color: var(--muted); cursor: pointer; }
.date-wrap .cal-btn:hover, .date-wrap .cal-btn:focus-visible { color: var(--text); background: var(--surface-3); outline: none; }
.date-wrap .cal-btn svg { width: 16px; height: 16px; }
.date-wrap .date-native { position: absolute; left: 0; bottom: 0; width: 100%; height: 1px; opacity: 0; pointer-events: none; border: 0; padding: 0; }

/* Báo cáo SMS / Zalo: cột nội dung dài thì xuống dòng */
.sms-table .sms-mt { min-width: 320px; max-width: 560px; white-space: normal; line-height: 1.45; color: var(--text-2); }

/* Nhập serial từ file */
.imp-file { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.imp-data { min-height: 150px; font-size: 12.5px; line-height: 1.55; white-space: pre; overflow-x: auto; }
.imp-map { margin-top: 16px; border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; }
.imp-map > .small { padding: 10px 14px; background: var(--surface-2); border-bottom: 1px solid var(--line); margin: 0; }
.imp-map .table td, .imp-map .table th { padding: 7px 12px; }
.imp-map tr.imp-roles td { background: var(--brand-tint); }
.imp-map .imp-roles select { min-width: 170px; height: 32px; font-size: 13px; }
.imp-kpis { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); margin-bottom: 16px; }
.imp-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.imp-actions form { margin: 0; }

/* =====================================================================
   Màn hình nhỏ
   ===================================================================== */
.grid > *, .stack > *, .main, .content > * { min-width: 0; }
.menu-btn { display: none; }
.nav-backdrop { display: none; }
.topbar-title { min-width: 0; }

@media (max-width: 1180px) { .scan-layout, .grid-main { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 1100px) { .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 900px) {
    .sidebar { position: fixed; left: 0; top: 0; bottom: 0; height: 100%; width: min(280px, 86vw);
        z-index: 70; transform: translateX(-102%); transition: transform .22s cubic-bezier(.2, .8, .2, 1); }
    .sidebar.open { transform: none; box-shadow: 20px 0 60px rgba(0, 0, 0, .35); }
    .nav-backdrop { display: block; position: fixed; inset: 0; z-index: 69; background: var(--overlay); }
    .nav-backdrop[hidden] { display: none; }
    body.nav-open { overflow: hidden; }
    .nav a { padding: 10px 12px; }
    .menu-btn { display: grid; place-items: center; flex: none; width: 38px; height: 38px; border-radius: 8px;
        border: 1px solid var(--line-strong); background: var(--surface); color: var(--text); cursor: pointer; }
    .menu-btn svg { width: 20px; height: 20px; }
    .topbar { flex-wrap: wrap; gap: 10px 12px; padding: 10px 14px; justify-content: flex-start; }
    .topbar-title { flex: 1; }
    .crumbs { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .page-title { font-size: 17px; overflow-wrap: anywhere; }
    .topbar-actions { width: 100%; flex-wrap: wrap; }
    .topbar-actions:empty { display: none; }
    .topbar-actions .btn { flex: 1 1 auto; }
    .content { padding: 14px 12px 40px; }
    .card-head { flex-wrap: wrap; padding: 12px 14px; }
    .card-body, .scan-card .card-body { padding: 14px; }
    .card-pad { padding: 14px; }
    .grid-2, .grid-3, .form-grid, .scan-fields { grid-template-columns: 1fr; }
    .filters { padding: 12px; }
    .filters .field, .filters .field.grow { flex: 1 1 100%; min-width: 0; }
    .filters .field.date { flex: 1 1 40%; width: auto; }
    .filters > .btn { flex: 1 1 40%; }
    .table-wrap { -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain; }
    .table th, .table td { padding: 9px 10px; }
    .kpi { padding: 12px 14px; }
    .kpi-value { font-size: 26px; }
    .pager { padding: 10px 12px; gap: 10px; }
    .pager .spacer { display: none; }
    .pager-pages { order: 3; width: 100%; justify-content: center; flex-wrap: wrap; }
    .steps4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .btn-activate { width: 100%; }
    .scan-card .card-head .row { width: 100%; justify-content: space-between; }
    .btn-camera { flex: 1 1 auto; height: 42px; font-size: 15px; }
    .scan-input .input.has-state { padding-right: 14px; }
    .scan-input .state { position: static; transform: none; display: block; margin-top: 6px; }
    .input, select.input, textarea.input { font-size: 16px; }       /* iPhone không tự phóng to */
    .input { height: 40px; }
}
@media (max-width: 600px) {
    .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    .grid { gap: 12px; }
    .login-head { padding: 22px 20px 18px; }
    .login-body { padding: 20px 20px 24px; }
    .kv { grid-template-columns: 110px minmax(0, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
    * { animation: none !important; transition: none !important; }
}

/* ---------------------------------------------------------------------
   Công tắc sáng / tối
   --------------------------------------------------------------------- */
.theme-btn {
    flex: none; width: 36px; height: 36px; border-radius: 50%;
    display: grid; place-items: center; cursor: pointer;
    border: 1px solid var(--line-strong); background: var(--surface); color: var(--text-2);
    transition: background .15s, color .15s, border-color .15s;
}
.theme-btn:hover { color: var(--text); border-color: var(--border-hover); background: var(--surface-2); }
.theme-btn:focus-visible { outline: none; box-shadow: var(--focus); }
.theme-btn svg { width: 18px; height: 18px; transition: transform .35s cubic-bezier(.2, .8, .2, 1); }
.theme-btn .i-sun { display: none; }
:root[data-theme="dark"] .theme-btn .i-sun { display: block; color: var(--brand); }
:root[data-theme="dark"] .theme-btn .i-moon { display: none; }
.theme-btn:active svg { transform: rotate(-30deg) scale(.9); }
.topbar .theme-btn { margin-left: auto; }
.topbar-title + .theme-btn + .topbar-actions:empty { display: none; }
.center-page .theme-btn { position: fixed; top: 16px; right: 16px; background: var(--rail-2); border-color: rgba(255,255,255,.12); color: var(--rail-text); }
@media (max-width: 900px) { .topbar .theme-btn { margin-left: 0; } }

/* Menu trái tách khỏi nền bằng 1 đường mảnh (giao diện tối nền cũng đen) */
:root[data-theme="dark"] .sidebar { border-right: 1px solid var(--line); }
:root[data-theme="dark"] .topbar { border-bottom-color: var(--line); }

/* Bảng báo cáo: cột số canh phải cùng 1 kiểu chữ số; cột tỷ lệ = thanh 0-100% (phần xanh = đã kích hoạt) + số % */
.table td.num { font-family: var(--display); font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; }
.table td.num.strong { color: var(--text); }
.table th .faint { font-family: var(--font); font-weight: 400; font-size: 11.5px; }
.rate-col { width: 34%; min-width: 220px; }
.rate { display: flex; align-items: center; gap: 12px; }
.rate-track { flex: 1; height: 8px; border-radius: 4px; background: var(--surface-3); overflow: hidden; }
.rate-track span { display: block; height: 100%; min-width: 0; border-radius: 4px; background: var(--green); }
.rate b { width: 56px; text-align: right; font-family: var(--display); font-size: 15px; font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }
/* Khoảng cách giữa số và đơn vị trong ô số liệu ("5 AGENT 111 model") */
.kpi-value small { margin: 0 10px 0 4px; }
.kpi-value small:last-child { margin-right: 0; }
.table td.tone-green { color: var(--green); }
.table td.tone-orange { color: var(--orange); }
.table td.is-zero { color: var(--faint); }

/* Tự động lưu: thanh chạy dưới nút Lưu trong lúc đếm 1 giây */
.btn-activate { position: relative; overflow: hidden; }
.btn-activate.is-counting::after {
    content: ""; position: absolute; left: 0; bottom: 0; height: 3px; width: 100%;
    background: var(--brand-ink); transform-origin: left; animation: autoCount var(--auto-ms, 1000ms) linear forwards;
}
@keyframes autoCount { from { transform: scaleX(0); } to { transform: scaleX(1); } }
.flash .undo-form { margin: 0 0 0 auto; }
.flash .undo-form .btn { background: var(--surface); }

/* ---------------------------------------------------------------------
   Màn hình quét bản gọn: thông tin tự lấy gom 1 dòng, hướng dẫn thu gọn
   --------------------------------------------------------------------- */
.scan-card .card-title .pill { margin-left: 4px; }
.scan-meta { display: flex; flex-wrap: wrap; gap: 8px 28px; margin: 4px 0 0; padding: 10px 14px; border-radius: var(--radius-sm); background: var(--surface-2); }
.scan-meta > div { min-width: 0; }
.scan-meta > div.grow { flex: 1; }
.scan-meta dt { font-size: 11.5px; color: var(--muted); }
.scan-meta dd { font-size: 13.5px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.scan-meta .meta-input { border: 0; background: transparent; padding: 0; width: 11ch; font: inherit; font-family: var(--mono); font-size: 13px; font-weight: 600; color: var(--text); pointer-events: none; }
.scan-meta + .field-msg:empty { display: none; }
.today-count { font-family: var(--display); font-size: 16px; font-weight: 600; color: var(--text); }
.recent-list .tm .pill { font-size: 11px; padding: 0 7px 0 6px; }
.recent-list .tm div { margin-top: 2px; }
.card-foot { display: block; padding: 10px 20px; border-top: 1px solid var(--line); font-size: 13px; font-weight: 500; text-align: center; }
.card-foot:hover { background: var(--surface-2); text-decoration: none; }
details.guide { padding: 0; }
details.guide summary { list-style: none; cursor: pointer; padding: 13px 20px; font-size: 14px; font-weight: 600; display: flex; align-items: center; justify-content: space-between; }
details.guide summary::-webkit-details-marker { display: none; }
details.guide summary::after { content: ""; width: 8px; height: 8px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); transition: transform .15s; margin-right: 4px; }
details.guide[open] summary::after { transform: rotate(-135deg); }
details.guide[open] summary { border-bottom: 1px solid var(--line); }
details.guide > :not(summary) { margin: 12px 20px 0; }
details.guide > :last-child { margin-bottom: 16px; }
@media (max-width: 900px) { .content { padding: 14px 12px 40px; } }

/* ---------------------------------------------------------------------
   Các bước quét: 4 ô nối nhau, bước đang làm nền vàng Fluke, bước xong có dấu tích xanh
   --------------------------------------------------------------------- */
.steps { list-style: none; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; margin: 0 0 10px;
    border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; }
.steps li {
    position: relative; display: flex; align-items: center; gap: 10px; min-width: 0;
    padding: 9px 12px; cursor: pointer; background: var(--surface-2); color: var(--muted);
    transition: background .2s, color .2s;
}
.steps li + li { border-left: 1px solid var(--line); }
.steps li:hover { background: var(--surface-3); }
.steps i {
    flex: none; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center;
    font-style: normal; font-family: var(--display); font-size: 15px; font-weight: 600;
    border: 1.5px solid var(--line-strong); color: var(--muted); background: var(--surface);
}
.steps span { min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.steps b { font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.steps small { font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.steps li.done { color: var(--text-2); }
.steps li.done i { background: var(--green); border-color: var(--green); color: #fff; font-size: 0; }
.steps li.done i::before { content: ""; width: 9px; height: 5px; border-left: 2px solid #fff; border-bottom: 2px solid #fff; transform: translateY(-1px) rotate(-45deg); }
.steps li.cur { background: var(--brand); color: var(--brand-ink); }
.steps li.cur i { background: var(--brand-ink); border-color: var(--brand-ink); color: var(--brand); }
.steps li.cur small { color: rgba(0, 0, 0, 0.7); }
.step-now { font-size: 13.5px; font-weight: 500; color: var(--text); margin: 0 0 14px; min-height: 20px; }
.step-now b { font-weight: 600; }
.step-now .kbd { margin: 0 2px; }
@media (max-width: 900px) {
    .steps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .steps li:nth-child(3) { border-left: 0; }
    .steps li:nth-child(n+3) { border-top: 1px solid var(--line); }
    .steps small { display: none; }
}

/* Nhãn quyền trong danh sách tài khoản */
td .pill + .pill { margin-left: 4px; }

/* Ô ngày trên màn cảm ứng: ô lịch thật phủ trong suốt lên trên, chạm là mở lịch của máy */
.date-wrap.is-touch .date-native {
    position: absolute; inset: 0; width: 100%; height: 100%; bottom: auto;
    opacity: 0; pointer-events: auto; z-index: 2; cursor: pointer;
    font-size: 16px; -webkit-appearance: none; appearance: none; color-scheme: light dark;
}
.date-wrap.is-touch .cal-btn { pointer-events: none; }
.date-wrap.is-touch > .input { caret-color: transparent; }

/* =====================================================================
   Trang Tổng quan: lưới 12 cột. Ô số có vạch màu mép trên + biểu tượng;
   biểu đồ vẽ bằng CSS / SVG (không thư viện).
   ===================================================================== */
.dash { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 16px; align-items: stretch; }
.dash > .dash-kpi { grid-column: span 3; }
.dash-wide { grid-column: span 6; }
.dash-third { grid-column: span 3; }
.dash-full { grid-column: 1 / -1; }
.dash-stack { display: flex; flex-direction: column; gap: 16px; }
/* Các khối cùng hàng cao bằng nhau, nội dung tự giãn cho kín khối (không để khoảng trống) */
.dash-panel { display: flex; flex-direction: column; }
.dash-panel > .dash-bars { flex: 1 1 auto; min-height: 170px; height: auto; }
.dash-panel > .dash-donut { margin: auto; }
.dash-panel > .dash-list, .dash-panel > .dash-top { flex: 1; justify-content: space-between; }
.dash-panel > .dash-list { display: flex; flex-direction: column; }
.dash-stack > :last-child { flex: 1; }

.dash-kpi {
    position: relative; overflow: hidden; display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 20px 20px 18px; color: inherit; text-decoration: none; transition: border-color .15s;
}
.dash-kpi::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 3px; background: var(--tone); }
.dash-kpi:hover { text-decoration: none; border-color: var(--line-strong); }
.dash-kpi-value { font-family: var(--display); font-size: 34px; font-weight: 600; line-height: 1; color: var(--text); font-variant-numeric: tabular-nums; }
.dash-kpi-value small { font-family: var(--font); font-size: 13px; font-weight: 500; color: var(--tone); margin-left: 8px; }
.dash-kpi-label { margin-top: 6px; font-size: 13px; color: var(--muted); }
.dash-ico { flex: none; width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; color: var(--tone); background: var(--surface-2); }
.dash-ico svg { width: 22px; height: 22px; }
.dash-kpi[style*="--brand"] .dash-ico { background: var(--brand); color: var(--brand-ink); }

.dash-panel { padding: 16px 20px 18px; min-width: 0; }
.dash-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.dash-head h2 { font-size: 15px; font-weight: 600; }
.dash-head > a { white-space: nowrap; flex: none; }
.dash-figure { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.dash-figure > b { font-family: var(--display); font-size: 28px; font-weight: 600; line-height: 1; font-variant-numeric: tabular-nums; }
.dash-figure .legend i:first-child { margin-left: 0; }

/* Cột 30 ngày */
.dash-bars { display: flex; align-items: stretch; gap: 4px; height: 170px; }
.dash-bar { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.dash-bar-track { flex: 1; width: 100%; max-width: 16px; border-radius: 6px; background: var(--surface-3); display: flex; align-items: flex-end; overflow: hidden; }
.dash-bar-fill { position: relative; width: 100%; display: flex; flex-direction: column; justify-content: flex-end; border-radius: 6px; overflow: hidden; }
.dash-bar-fill i { display: block; width: 100%; }
.dash-bar-fill i.p { flex: 1; background: var(--brand); }
.dash-bar-fill i.a { flex: none; background: var(--green); }
.dash-bar span { font-size: 11px; color: var(--faint); font-variant-numeric: tabular-nums; height: 14px; }
.dash-bar span.hide { visibility: hidden; }
.dash-bar:hover .dash-bar-track { background: var(--line); }
.dash .legend i.lg-p { background: var(--brand); }

/* Đường cong 12 tháng */
.dash-line { display: block; width: 100%; height: 150px; overflow: visible; }
.dash-line line { stroke: var(--line); stroke-width: 1; stroke-dasharray: 4 4; vector-effect: non-scaling-stroke; }
.dash-line .stroke { fill: none; stroke: var(--brand); stroke-width: 3; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.dash-line .stroke2 { fill: none; stroke: var(--green); stroke-width: 2; stroke-linecap: round; stroke-dasharray: 5 4; vector-effect: non-scaling-stroke; }
.dash-legend-line { flex-basis: 100%; }
.dash-bars-zalo .dash-bar-fill i.p, .dash .legend i.lg-z { background: var(--sky); }
.dash-bars-zalo .dash-bar-track { max-width: 26px; }
/* Rê chuột / bấm trên biểu đồ tháng */
.dash-linebox { position: relative; flex: 1 1 auto; min-height: 130px; }
.dash-linebox > .dash-line { position: absolute; inset: 0; height: 100%; }
.dash-line-hits { position: absolute; inset: 0; }
.dash-line-hits a { position: absolute; top: 0; bottom: 0; display: block; color: var(--text); text-decoration: none; }
.dash-line-hits a:hover { background: linear-gradient(to right, transparent calc(50% - .5px), var(--line-strong) 0, var(--line-strong) calc(50% + .5px), transparent 0); }
.dash-line-hits a.edge-l:hover, .dash-line-hits a.edge-r:hover { background: none; }
.dash-line-hits i { position: absolute; width: 10px; height: 10px; margin: -5px 0 0 -5px; border-radius: 50%; background: var(--surface); border: 2.5px solid var(--brand); opacity: 0; transition: opacity .12s; }
.dash-line-hits a:last-child i { opacity: 1; }
.dash-line-hits a:hover i { opacity: 1; transform: scale(1.25); }
.dash-tip { position: absolute; z-index: 5; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%); min-width: 150px; padding: 8px 10px; border-radius: 8px;
    background: var(--text); color: var(--surface); font-size: 12px; line-height: 1.5; white-space: nowrap; box-shadow: var(--shadow-pop);
    pointer-events: none; opacity: 0; visibility: hidden; transition: opacity .12s; }
.dash-tip > b:first-child { display: block; margin-bottom: 2px; }
.dash-line-hits a.edge-l .dash-tip { left: 0; transform: none; }
.dash-line-hits a.edge-r .dash-tip { left: auto; right: 0; transform: none; }
.dash-line-hits a:hover .dash-tip, .dash-line-hits a:focus-visible .dash-tip { opacity: 1; visibility: visible; }
/* Vòng tỷ lệ: rê vào từng phần để xem số, bấm để mở danh sách */
.dash-donut a { cursor: pointer; }
.dash-donut circle { transition: stroke-width .12s; }
.dash-donut a:hover circle { stroke-width: 13; }
.dash-donut .seg-p:hover .track { stroke: var(--orange); opacity: .35; }
.dash-donut-text > span { display: grid; place-content: center; text-align: center; }
.dash-donut-text { pointer-events: none; }
.dash-donut-text .t-a, .dash-donut-text .t-p { display: none; }
.dash-donut:has(.seg-a:hover) .t-def, .dash-donut:has(.seg-p:hover) .t-def { display: none; }
.dash-donut:has(.seg-a:hover) .t-a, .dash-donut:has(.seg-p:hover) .t-p { display: grid; }
.dash-donut-text .t-a b { color: var(--text); }
.dash-donut-text .t-p b { color: var(--orange); }
.dash-note a { font-weight: 500; }
.dash-line circle { fill: var(--surface); stroke: var(--brand); stroke-width: 3; vector-effect: non-scaling-stroke; }
.dash-months { display: flex; justify-content: space-between; margin-top: 6px; font-size: 11px; color: var(--faint); }
.dash-months span:nth-child(even) { visibility: hidden; }

/* Vòng tròn tỷ lệ */
.dash-donut { position: relative; width: 168px; height: 168px; margin: 4px auto 0; }
.dash-donut svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.dash-donut circle, .dash-sms circle { fill: none; stroke-width: 10; }
.dash-donut .track, .dash-sms .track { stroke: var(--surface-3); }
.dash-donut .prog { stroke: var(--brand); stroke-linecap: round; }
.dash-donut-text { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.dash-donut-text b { font-family: var(--display); font-size: 30px; font-weight: 600; line-height: 1; color: var(--text); }
.dash-donut-text span { font-size: 12px; color: var(--muted); margin-top: 4px; }
.dash-donut-text > span { margin-top: 0; }
.dash-note { text-align: center; font-size: 12.5px; color: var(--muted); margin-top: 10px; }

/* Danh sách vừa quét */
.dash-list { list-style: none; }
.dash-list li { display: flex; align-items: center; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.dash-list li:last-child { border-bottom: 0; }
.dash-list .grow { flex: 1; min-width: 0; }
.dash-list .grow > div { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dash-list .right .pill { font-size: 11px; }
.dash-list .right div { margin-top: 3px; font-variant-numeric: tabular-nums; }
.dash-avatar { flex: none; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: var(--brand-tint); color: var(--text); }
.dash-avatar svg { width: 18px; height: 18px; }

/* Top AGENT / model */
.dash-top { list-style: none; display: flex; flex-direction: column; gap: 12px; }
.dash-top-row { display: flex; justify-content: space-between; gap: 10px; font-size: 13.5px; }
.dash-top-row span { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 500; }
.dash-top-row b { font-family: var(--display); font-weight: 600; font-size: 15px; font-variant-numeric: tabular-nums; }
.dash-top-bar { height: 6px; border-radius: 3px; background: var(--surface-3); margin: 5px 0 3px; overflow: hidden; }
.dash-top-bar span { display: block; height: 100%; border-radius: 3px; background: var(--brand); }

/* Thao tác nhanh (khối vàng Fluke) + ô nhỏ */
.dash-action {
    display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 20px;
    border-radius: var(--radius); background: var(--brand); color: var(--brand-ink); text-decoration: none; box-shadow: var(--shadow);
}
.dash-action:hover { text-decoration: none; background: var(--brand-hover); }
.dash-action b { display: block; font-size: 16px; font-weight: 600; }
.dash-action span:not(.dash-plus) { font-size: 12.5px; opacity: .75; }
.dash-plus { flex: none; width: 42px; height: 42px; border-radius: 10px; display: grid; place-items: center; background: rgba(0, 0, 0, .12); font-size: 26px; font-weight: 500; line-height: 1; }
.dash-mini { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 14px 18px; color: inherit; text-decoration: none; font-size: 13.5px; font-weight: 500; }
.dash-mini:hover { text-decoration: none; border-color: var(--line-strong); }
.dash-mini .grow { flex: 1; min-width: 0; font-weight: 400; }
.dash-mini-value { font-family: var(--display); font-size: 24px; font-weight: 600; line-height: 1.2; }
.dash-mini-value small { font-family: var(--font); font-size: 12.5px; color: var(--muted); font-weight: 400; }
.dash-sms svg { flex: none; width: 62px; height: 62px; transform: rotate(-90deg); }
.dash-sms .prog { stroke: var(--green); stroke-linecap: round; stroke-width: 8; }
.dash-sms .track { stroke-width: 8; }

@media (max-width: 1280px) {
    .dash > .dash-kpi { grid-column: span 6; }
    .dash-wide { grid-column: span 12; }
    .dash-third { grid-column: span 6; }
}
@media (max-width: 700px) {
    .dash { gap: 12px; }
    .dash > .dash-kpi { grid-column: span 6; padding: 14px; }
    .dash-kpi-value { font-size: 26px; }
    .dash-ico { display: none; }
    .dash-third, .dash-wide { grid-column: span 12; }
    .dash-bars, .dash-panel > .dash-bars { min-height: 130px; gap: 2px; }
}

/* Trang Hướng dẫn */
.guide-wrap { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 20px; align-items: start; }
.guide-toc { position: sticky; top: 16px; display: flex; flex-direction: column; padding: 14px 10px; }
.guide-toc-title { font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 0 10px 8px; }
.guide-toc a { padding: 7px 10px; border-radius: 8px; color: var(--text-2, var(--text)); font-size: 13.5px; text-decoration: none; }
.guide-toc a:hover { background: var(--surface-2); text-decoration: none; }
.guide-body { display: flex; flex-direction: column; gap: 16px; min-width: 0; max-width: 880px; }
.guide-sec { padding: 20px 24px; scroll-margin-top: 16px; }
.guide-sec h2 { font-size: 17px; font-weight: 600; margin-bottom: 14px; }
.guide-steps { list-style: none; counter-reset: gs; display: flex; flex-direction: column; gap: 12px; }
.guide-steps > li { counter-increment: gs; position: relative; padding-left: 40px; line-height: 1.6; }
.guide-steps > li::before { content: counter(gs); position: absolute; left: 0; top: 0; width: 26px; height: 26px; border-radius: 50%;
    display: grid; place-items: center; background: var(--brand); color: var(--brand-ink); font-weight: 700; font-size: 13px; }
.guide-steps ul { margin: 8px 0 0 18px; display: flex; flex-direction: column; gap: 6px; }
.guide-note, .guide-tip, .guide-warn { margin-top: 14px; padding: 10px 14px; border-radius: 10px; font-size: 13.5px; line-height: 1.6; border-left: 3px solid; }
.guide-note { background: var(--surface-2); border-color: var(--line-strong); }
.guide-tip { background: var(--brand-tint); border-color: var(--brand); }
.guide-warn { background: var(--red-tint); border-color: var(--red); }
.guide-faq dt { font-weight: 600; margin-top: 14px; }
.guide-faq dt:first-child { margin-top: 0; }
.guide-faq dd { margin: 4px 0 0; color: var(--text-2, var(--text)); line-height: 1.6; font-size: 14px; }
.guide-pill { display: inline-flex; align-items: center; gap: 6px; padding: 1px 8px; border-radius: 999px; font-size: 12.5px; white-space: nowrap; }
.guide-pill i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.guide-pill.ok { color: var(--green); background: color-mix(in srgb, var(--green) 12%, transparent); }
.guide-pill.off { color: var(--orange); background: color-mix(in srgb, var(--orange) 12%, transparent); }
.guide-foot { padding: 4px 4px 0; }
@media (max-width: 1000px) {
    .guide-wrap { grid-template-columns: minmax(0, 1fr); }
    .guide-toc { position: static; flex-direction: row; flex-wrap: nowrap; overflow-x: auto; padding: 8px; gap: 4px; -webkit-overflow-scrolling: touch; }
    .guide-toc-title { display: none; }
    .guide-toc a { white-space: nowrap; background: var(--surface-2); }
    .guide-sec { padding: 16px; }
}

/* Dải báo tài khoản DEMO (mọi trang) */
.demo-bar { display: flex; align-items: center; gap: 12px; margin: 0 0 16px; padding: 10px 16px; border-radius: 12px;
    background: repeating-linear-gradient(-45deg, color-mix(in srgb, var(--orange) 14%, var(--surface)) 0 14px, color-mix(in srgb, var(--orange) 8%, var(--surface)) 14px 28px);
    border: 2px solid var(--orange); font-size: 14px; color: var(--text); }
.demo-bar > b { flex: none; padding: 3px 10px; border-radius: 6px; background: var(--orange); color: #fff; font-weight: 900; letter-spacing: .08em; }

/* Ghép máy quét (màn hình Quét trên máy tính) */
.remote-box { margin: 0 0 14px; }
.remote-box > div:not([data-r=msg]) { display: none; }
.remote-box[data-state="off"] .r-off { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.remote-box[data-state="wait"] .r-wait { display: block; padding: 14px 16px; border-radius: 12px; border: 2px dashed var(--brand); background: var(--brand-tint); }
.remote-box[data-state="on"] .r-on, .remote-box[data-state="idle"] .r-on { display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
    padding: 10px 14px; border-radius: 12px; background: color-mix(in srgb, var(--green) 10%, transparent); border: 1px solid color-mix(in srgb, var(--green) 35%, transparent); font-size: 14px; }
.remote-box .r-off svg { width: 16px; height: 16px; }
.r-step { font-size: 14px; margin-bottom: 6px; }
.r-grid { display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: 16px; align-items: center; }
.r-qr { width: 170px; height: 170px; background: #fff; border-radius: 10px; padding: 6px; border: 1px solid var(--line-strong); }
.r-qr svg { display: block; }
@media (max-width: 600px) { .r-grid { grid-template-columns: minmax(0, 1fr); } .r-qr { margin: 0 auto; } }
.r-code { font-size: 44px; font-weight: 800; letter-spacing: .12em; line-height: 1.2; margin: 6px 0; color: var(--text); }
.r-actions { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.r-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 3px color-mix(in srgb, var(--green) 25%, transparent); animation: gunBlink 1.6s infinite; }
.r-on .btn { margin-left: auto; }
.r-idle { display: none; color: var(--orange); }
.remote-box[data-state="idle"] .r-idle { display: inline; }
.remote-box[data-state="idle"] .r-dot { background: var(--orange); animation: none; }

/* Trang Máy quét (ghép với máy tính) - mở trên máy kiểm kho / điện thoại: chữ to, nút to */
.rm { max-width: 560px; margin: 0 auto; }
.rm > section { display: none; }
.rm[data-state="join"] .rm-join, .rm[data-state="on"] .rm-on { display: flex; flex-direction: column; gap: 14px; }
.rm-join { padding: 22px; }
.rm-join h2 { font-size: 24px; font-weight: 800; }
.rm-code-in { font-size: 42px !important; letter-spacing: .2em; text-align: center; height: 76px; border-radius: 14px; border: 3px solid var(--brand); background: var(--surface); color: var(--text); }
.rm-big { height: 60px; font-size: 22px; font-weight: 800; border-radius: 14px; }
.rm-err { min-height: 22px; color: var(--red); font-size: 16px; font-weight: 600; }
.rm-status { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: 14px; font-size: 17px; font-weight: 700;
    background: color-mix(in srgb, var(--green) 12%, transparent); color: var(--green); }
.rm-status i { width: 12px; height: 12px; border-radius: 50%; background: currentColor; animation: gunBlink 1.6s infinite; }
.rm-status.off { background: color-mix(in srgb, var(--orange) 14%, transparent); color: var(--orange); }
.rm-scan { display: flex; flex-direction: column; gap: 6px; font-size: 16px; font-weight: 700; }
.rm-scan input { height: 64px; font-size: 26px !important; padding: 0 16px; border-radius: 14px; border: 3px solid var(--brand); background: var(--surface); color: var(--text); }
.rm-scan input:focus { outline: none; box-shadow: var(--focus); }
.rm-tools { display: flex; gap: 8px; justify-content: flex-end; margin-top: -6px; }
.rm-result { padding: 18px; border-radius: 16px; border: 2px solid var(--line-strong); background: var(--surface); display: flex; flex-direction: column; gap: 6px; min-height: 110px; }
.rm-result b { font-size: 26px; font-weight: 900; line-height: 1.15; word-break: break-all; }
.rm-result span { font-size: 18px; line-height: 1.45; }
.rm-result[data-kind="ok"] { border-color: var(--green); background: color-mix(in srgb, var(--green) 12%, var(--surface)); }
.rm-result[data-kind="ok"] b { color: var(--green); }
.rm-result[data-kind="bad"] { border-color: var(--red); background: color-mix(in srgb, var(--red) 10%, var(--surface)); }
.rm-result[data-kind="bad"] b { color: var(--red); }
.rm-result[data-kind="warn"] { border-color: var(--orange); background: color-mix(in srgb, var(--orange) 10%, var(--surface)); }
.rm-result[data-kind="warn"] b { color: var(--orange); }
.rm-result[data-kind="wait"] b { color: var(--muted); }
.rm-form { border-radius: 16px; border: 2px solid var(--line-strong); background: var(--surface); overflow: hidden; }
.rm-row { display: grid; grid-template-columns: 92px minmax(0, 1fr) 34px; align-items: center; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.rm-row:last-child { border-bottom: 0; }
.rm-row span { font-size: 15px; font-weight: 700; color: var(--muted); }
.rm-row b { font-size: 22px; font-weight: 800; word-break: break-all; color: var(--text); }
.rm-row i { font-style: normal; font-size: 24px; font-weight: 900; text-align: center; }
.rm-row[data-st="ok"] { background: color-mix(in srgb, var(--green) 9%, transparent); }
.rm-row[data-st="ok"] i { color: var(--green); }
.rm-row[data-st="bad"] { background: color-mix(in srgb, var(--red) 10%, transparent); }
.rm-row[data-st="bad"] i, .rm-row[data-st="bad"] b { color: var(--red); }
.rm-row[data-st="warn"] { background: color-mix(in srgb, var(--orange) 10%, transparent); }
.rm-row[data-st="warn"] i { color: var(--orange); }
.rm-row[data-st="wait"] i { color: var(--muted); }
.rm-hist-title { font-size: 15px; font-weight: 800; margin-bottom: -8px; }
.rm-sent summary { font-size: 14px; color: var(--muted); cursor: pointer; padding: 6px 0; }
.rm-actions { display: grid; grid-template-columns: 2fr 1fr; gap: 10px; }
.rm-hist { list-style: none; display: flex; flex-direction: column; border-top: 1px solid var(--line); }
.rm-hist li { display: flex; justify-content: space-between; gap: 10px; padding: 8px 2px; border-bottom: 1px solid var(--line); font-size: 15px; }
.rm-hist small { color: var(--muted); white-space: nowrap; }
.rm-hist b { font-size: 19px; font-weight: 800; }
.rm-hist span small { white-space: normal; font-size: 14px; }

/* Hướng dẫn bằng hình (chữ to, hình lớn: cho người lớn tuổi) */
.vg { display: flex; flex-direction: column; gap: 28px; max-width: 1500px; }
.vg-jump { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.vg-jump a { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 12px; border-radius: 16px; background: var(--surface);
    border: 2px solid var(--line-strong); color: var(--text); text-decoration: none; font-size: 20px; font-weight: 700; }
.vg-jump a:hover { border-color: var(--brand); text-decoration: none; }
.vg-jump img { width: 100%; height: 120px; object-fit: cover; object-position: left top; border-radius: 12px; border: 1px solid var(--line); }
.vg-sec { scroll-margin-top: 12px; }
.vg-title { font-size: 26px; font-weight: 800; margin-bottom: 14px; padding-left: 14px; border-left: 8px solid var(--brand); line-height: 1.2; }
.vg-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(440px, 100%), 1fr)); gap: 24px 20px; }
.vg-row-1 { grid-template-columns: minmax(0, 560px); }
.vg-row-narrow { grid-template-columns: minmax(0, 400px); }
.vg-card { position: relative; margin: 0; padding: 12px 12px 16px; border-radius: 18px; background: var(--surface); border: 2px solid var(--line);
    box-shadow: var(--shadow); display: flex; flex-direction: column; align-items: center; }
.vg-card img { width: 100%; height: auto; border-radius: 12px; background: #fbfaf6; border: 1px solid var(--line); }
.vg-card img + img { margin-top: 8px; }
.vg-num { position: absolute; top: -12px; left: -12px; width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center;
    background: var(--brand); color: var(--brand-ink); font-size: 24px; font-weight: 900; border: 3px solid var(--surface); box-shadow: var(--shadow); }
#vg-loi .vg-num { background: var(--red); color: #fff; }
.vg-card figcaption { margin-top: 12px; text-align: center; font-size: 22px; font-weight: 800; line-height: 1.25; color: var(--text); }
.vg-card figcaption small { display: block; margin-top: 4px; font-size: 17px; font-weight: 600; color: var(--muted); }
.vg-help { font-size: 18px; text-align: center; color: var(--muted); }
.vg-text { padding: 0; }
.vg-text > summary { padding: 16px 20px; font-size: 16px; font-weight: 600; cursor: pointer; }
.vg-text > .guide-body { padding: 0 16px 16px; max-width: none; }
.vg-text .guide-sec { box-shadow: none; border: 1px solid var(--line); }
@media (max-width: 640px) {
    .vg-jump { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    .vg-jump a { font-size: 17px; padding: 8px; }
    .vg-row, .vg-row-1, .vg-row-narrow { grid-template-columns: minmax(0, 1fr); gap: 22px; }
    .vg-title { font-size: 23px; }
    .vg-card figcaption { font-size: 24px; }
}

/* Đèn "Sẵn sàng nhận súng quét" (màn hình Quét) */
.gun-ready { display: flex; align-items: center; gap: 8px; margin: 8px 0 14px; padding: 0; border: 0; background: none; font: inherit; font-size: 12.5px; color: var(--green); cursor: pointer; text-align: left; }
.gun-ready i { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 3px color-mix(in srgb, var(--green) 20%, transparent); }
.gun-ready.off { color: var(--orange); }
.gun-ready.off i { background: var(--orange); box-shadow: 0 0 0 3px color-mix(in srgb, var(--orange) 22%, transparent); animation: gunBlink 1s infinite; }
@keyframes gunBlink { 50% { opacity: .3; } }
@media (pointer: coarse) { .gun-ready { display: none; } }

/* =====================================================================
   Captcha kéo mảnh ghép (trang đăng nhập)
   ===================================================================== */
.slide-cap-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; font-size: 13px; font-weight: 600; color: var(--text); }
.slide-cap-again { width: 34px; height: 30px; padding: 0; display: grid; place-items: center; }
.slide-cap-again svg { width: 16px; height: 16px; }
.slide-cap-stage { position: relative; width: 100%; aspect-ratio: 2 / 1; border-radius: 10px; overflow: hidden; background: var(--surface-3); user-select: none; -webkit-user-select: none; touch-action: none; }
.slide-cap-stage img { position: absolute; top: 0; left: 0; height: 100%; pointer-events: none; -webkit-user-drag: none; }
.slide-cap-stage img.bg { width: 100%; }
.slide-cap-stage img.pc { filter: drop-shadow(0 2px 4px rgba(0, 0, 0, .35)); }
.slide-cap-wait { position: absolute; inset: 0; display: grid; place-items: center; font-size: 13px; color: var(--muted); background: var(--surface-3); }
.slide-cap-wait[hidden] { display: none; }
.slide-cap-track { position: relative; margin-top: 10px; height: 44px; border-radius: 22px; background: var(--surface-2); border: 1px solid var(--line-strong); touch-action: none; user-select: none; -webkit-user-select: none; }
.slide-cap-track .fill { position: absolute; left: 0; top: 0; bottom: 0; width: 0; border-radius: 22px; background: var(--brand-tint); }
.slide-cap-track .hint { position: absolute; inset: 0; display: grid; place-items: center; font-size: 13px; color: var(--muted); pointer-events: none; }
.slide-cap-track .hint[hidden] { display: none; }
.slide-cap-track .knob { position: absolute; top: -1px; left: 0; width: 56px; height: 44px; border-radius: 22px; display: grid; place-items: center;
    background: var(--brand); color: var(--brand-ink); cursor: grab; box-shadow: 0 2px 6px rgba(0, 0, 0, .25); touch-action: none; }
.slide-cap-track .knob svg { width: 22px; height: 22px; }
.slide-cap-track .knob .i-ok, .slide-cap-track .knob .i-no { display: none; }
.slide-cap[data-state="ok"] .knob .i-go, .slide-cap[data-state="bad"] .knob .i-go { display: none; }
.slide-cap[data-state="ok"] .knob .i-ok, .slide-cap[data-state="bad"] .knob .i-no { display: block; }
.slide-cap-track .knob:focus-visible { outline: none; box-shadow: var(--focus); }
.slide-cap[data-state="drag"] .knob { cursor: grabbing; }
.slide-cap[data-state="load"] .knob, .slide-cap[data-state="check"] .knob, .slide-cap[data-state="blocked"] .knob { opacity: .55; cursor: default; }
.slide-cap[data-state="ok"] .knob { background: var(--green); color: #fff; }
.slide-cap[data-state="ok"] .fill { background: color-mix(in srgb, var(--green) 18%, transparent); }
.slide-cap[data-state="bad"] .knob { background: var(--red); color: #fff; }
.slide-cap-msg { min-height: 20px; margin-top: 6px; font-size: 12.5px; color: var(--muted); }
.slide-cap-msg.ok { color: var(--green); }
.slide-cap-msg.bad { color: var(--red); }
.slide-cap .shake, .slide-cap-track.shake { animation: capShake .35s; }
@keyframes capShake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
#loginBtn:disabled { opacity: .55; cursor: not-allowed; }

/* =====================================================================
   Điện thoại
   1) Vùng nội dung thu nhỏ 0.9 cho thấy được nhiều hơn.
   2) Mọi ô nhập (input / select / textarea, kể cả ô do JS tạo) có cỡ chữ hiển thị >= 16px
      để iPhone KHÔNG tự phóng to khi chạm vào. Trong vùng đã thu 0.9 thì cỡ chữ = 16 / 0.9
      (hiển thị ra đúng 16px). Đặt cuối file + !important để thắng các cỡ chữ riêng
      (.input.mono 13px, ô ngày, ô chọn số dòng, ô gán cột khi nhập file…).
   ===================================================================== */
@media (max-width: 700px) {
    .content { zoom: .9; --m-zoom: .9; }
}
@media (max-width: 900px), (pointer: coarse) {
    input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"]):not([type="hidden"]):not(.meta-input),
    select, textarea {
        font-size: calc(16px / var(--m-zoom, 1)) !important;
    }
}

/* Tài khoản DEMO: trang 10 tem test */
.demo-bar-link { margin-left: auto; flex: none; font-weight: 700; color: var(--orange); white-space: nowrap; }
.dl-head { display: flex; flex-wrap: wrap; gap: 14px 24px; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.dl-steps { display: flex; flex-wrap: wrap; gap: 10px 22px; }
.dl-steps > div { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.dl-steps > div > b { flex: none; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--brand); color: #fff; font-size: 13px; }
.dl-steps small { color: var(--muted); }
.dl-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.dl-actions form { margin: 0; }
.dl-count { font-size: 14px; color: var(--muted); }
.dl-count b { color: var(--text); font-size: 18px; }
.dl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 14px; }
.dl-tag { position: relative; background: #fff; color: #111; border: 1.5px solid #222; border-radius: 6px; padding: 10px 14px 12px; }
.dl-tag.is-done { box-shadow: 0 0 0 3px color-mix(in srgb, var(--green) 45%, transparent); }
.dl-top { display: flex; justify-content: space-between; align-items: center; border-bottom: 3px solid #f2c200; padding-bottom: 5px; }
.dl-brand { font-weight: 900; font-size: 18px; letter-spacing: .06em; font-style: italic; }
.dl-no { font-size: 11px; font-weight: 700; color: #555; }
.dl-model { font-weight: 800; font-size: 15px; margin: 6px 0 4px; }
.dl-row { display: grid; grid-template-columns: 58px 1fr; grid-template-rows: auto auto; column-gap: 8px; align-items: center; margin-top: 6px; }
.dl-lbl { grid-row: 1 / span 2; font-size: 11px; font-weight: 800; color: #333; }
.dl-bar svg { display: block; width: 100%; height: 46px; }
.dl-txt { font-size: 13px; text-align: center; letter-spacing: .06em; color: #111; }
.dl-state { margin-top: 8px; }
@media print {
    .sidebar, .topbar, .no-print, .flash { display: none !important; }
    body, .main, .content { background: #fff !important; margin: 0 !important; padding: 0 !important; zoom: 1 !important; }
    .dl-grid { grid-template-columns: repeat(2, 1fr); gap: 8mm; }
    .dl-tag { break-inside: avoid; box-shadow: none !important; }
}
