/* ---------- Font (Inter, tự phục vụ – có bộ ký tự tiếng Việt). Chữ Hán/Hàn/Nhật dùng font hệ thống. ---------- */
@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"); 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"); 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"); 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; }

/* ---------- Bảng màu: xanh dương sáng, trong trẻo; tiêu đề navy ---------- */
:root {
  --bg: #f2f6fd;
  --surface: #ffffff;
  --surface-2: #f6f9ff;
  --surface-3: #edf3fd;
  --border: #e5ecf7;
  --border-strong: #d4def0;
  --text: #0e1f45;
  --text-2: #33456b;
  --muted: #6b7a99;
  --heading: #0b2a6b;
  --primary: #1f6bef;
  --primary-hover: #1658d6;
  --primary-ink: #ffffff;
  --primary-soft: #e9f1ff;
  --primary-ring: rgba(31, 107, 239, .2);
  --accent: #e5476b;
  --accent-soft: #fdecf1;
  --gold: #e59a12;
  --gold-soft: #fff4df;
  --teal: #13a8a0;
  --teal-soft: #e2f7f5;
  --violet: #7a5af8;
  --violet-soft: #f0ecff;
  --danger: #e5484d;
  --danger-soft: #fdeced;
  --warn: #c97a06;
  --warn-soft: #fff5e3;
  --warn-border: #f8d48f;
  --ok: #12a150;
  --ok-soft: #e4f8ec;
  --info: #1f6bef;
  --info-soft: #e9f1ff;
  --shadow-xs: 0 1px 2px rgba(21, 63, 140, .05);
  --shadow: 0 12px 32px -18px rgba(21, 63, 140, .28), 0 2px 6px rgba(21, 63, 140, .05);
  --shadow-lg: 0 24px 60px -20px rgba(21, 63, 140, .35), 0 6px 16px -8px rgba(21, 63, 140, .12);
  --shadow-btn: 0 8px 18px -8px rgba(31, 107, 239, .75);
  --radius: 16px;
  --radius-sm: 10px;
  --sidebar: 236px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b1222; --surface: #111a2e; --surface-2: #15203a; --surface-3: #1b2846; --border: #22314f; --border-strong: #2e4066;
    --text: #e9efff; --text-2: #c3cfe8; --muted: #8b9bbd; --heading: #e9efff; --primary: #5b95ff; --primary-hover: #7aa9ff; --primary-ink: #ffffff;
    --primary-soft: rgba(91, 149, 255, .14); --primary-ring: rgba(91, 149, 255, .3); --accent-soft: rgba(229, 71, 107, .15); --gold-soft: rgba(229, 154, 18, .15);
    --teal-soft: rgba(19, 168, 160, .15); --violet-soft: rgba(122, 90, 248, .16); --danger-soft: rgba(229, 72, 77, .15); --warn: #f2b13d;
    --warn-soft: rgba(242, 177, 61, .13); --warn-border: rgba(242, 177, 61, .4); --ok: #3fcf7f; --ok-soft: rgba(63, 207, 127, .13); --info: #6ea2ff; --info-soft: rgba(110, 162, 255, .14);
    --shadow: 0 1px 2px rgba(0, 0, 0, .4); --shadow-lg: 0 20px 40px rgba(0, 0, 0, .55); --shadow-btn: none; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0b1222; --surface: #111a2e; --surface-2: #15203a; --surface-3: #1b2846; --border: #22314f; --border-strong: #2e4066;
  --text: #e9efff; --text-2: #c3cfe8; --muted: #8b9bbd; --heading: #e9efff; --primary: #5b95ff; --primary-hover: #7aa9ff; --primary-ink: #ffffff;
  --primary-soft: rgba(91, 149, 255, .14); --primary-ring: rgba(91, 149, 255, .3); --accent-soft: rgba(229, 71, 107, .15); --gold-soft: rgba(229, 154, 18, .15);
  --teal-soft: rgba(19, 168, 160, .15); --violet-soft: rgba(122, 90, 248, .16); --danger-soft: rgba(229, 72, 77, .15); --warn: #f2b13d;
  --warn-soft: rgba(242, 177, 61, .13); --warn-border: rgba(242, 177, 61, .4); --ok: #3fcf7f; --ok-soft: rgba(63, 207, 127, .13); --info: #6ea2ff; --info-soft: rgba(110, 162, 255, .14);
  --shadow: 0 1px 2px rgba(0, 0, 0, .4); --shadow-lg: 0 20px 40px rgba(0, 0, 0, .55); --shadow-btn: none; color-scheme: dark;
}

/* ---------- Nền tảng ---------- */
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  color: var(--text); min-height: 100vh;
  background:
    radial-gradient(900px 520px at 100% -8%, color-mix(in srgb, var(--primary) 13%, transparent), transparent 62%),
    radial-gradient(700px 480px at -6% 104%, color-mix(in srgb, var(--primary) 10%, transparent), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  font: 15.5px/1.55 "Inter", system-ui, -apple-system, "Segoe UI", "Microsoft JhengHei", "Hiragino Sans", "Yu Gothic UI", "Malgun Gothic", Roboto, Arial, sans-serif;
  -webkit-font-smoothing: antialiased; -webkit-text-size-adjust: 100%;
}
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-hover); }
h1 { font-size: 28px; line-height: 1.2; margin: 0; letter-spacing: -.02em; font-weight: 750; color: var(--heading); }
h2 { font-size: 17.5px; margin: 0 0 14px; font-weight: 700; display: flex; align-items: center; gap: 8px; color: var(--heading); }
h3 { font-size: 13px; margin: 0 0 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.boot { min-height: 100vh; display: grid; place-items: center; color: var(--muted); }
.muted { color: var(--muted); }
.small { font-size: 13.5px; }
/* Mã số (SIM, hộ chiếu, visa…): cùng font, chữ số đều độ rộng – dễ đọc, dễ so cột. */
.mono { font-variant-numeric: tabular-nums slashed-zero; letter-spacing: .02em; font-weight: 550; }
.nowrap { white-space: nowrap; }
.hidden { display: none !important; }
.right { text-align: right; }

/* ---------- Khung ---------- */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar); flex: none; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column;
  padding: 18px 14px; background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: blur(14px); border-right: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 18px; letter-spacing: -.01em; padding: 2px 8px 20px; color: var(--heading); }
.brand img { width: 36px; height: 36px; border-radius: 11px; background: #fff; box-shadow: 0 4px 12px -4px rgba(21, 63, 140, .35); }
.brand small { display: inline-block; font-size: 11.5px; font-weight: 800; color: var(--primary); letter-spacing: .04em; margin-left: 4px; }
.brand .sub { display: block; font-size: 12.5px; font-weight: 600; color: var(--muted); letter-spacing: .02em; margin-top: 1px; }
.nav { display: flex; flex-direction: column; gap: 3px; }
.nav a { display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: 11px; color: var(--text-2); font-weight: 550; position: relative; transition: background .15s, color .15s; }
.nav a:hover { background: var(--primary-soft); color: var(--primary); }
.nav a.active { background: var(--primary); color: #fff; font-weight: 650; box-shadow: var(--shadow-btn); }
.nav a.active .badge { background: #fff; color: var(--primary); }
.nav svg { width: 18px; height: 18px; flex: none; }
.nav .badge { margin-left: auto; }
.nav-cta { margin: 0 0 14px; }
.nav-cta .btn { width: 100%; min-height: 42px; }
.nav-sep { height: 1px; background: var(--border); margin: 12px 6px; }
.sidebar .side-foot { margin-top: auto; padding: 14px; border-radius: 14px; background: linear-gradient(135deg, var(--primary-soft), color-mix(in srgb, var(--primary-soft) 40%, var(--surface))); font-size: 13.5px; color: var(--text-2); }
.sidebar .side-foot b { display: block; color: var(--heading); font-size: 14.5px; margin-bottom: 2px; }

.content { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.deskbar {
  height: 68px; display: flex; align-items: center; gap: 14px; padding: 0 28px; position: sticky; top: 0; z-index: 15;
  background: color-mix(in srgb, var(--surface) 80%, transparent); backdrop-filter: blur(14px); border-bottom: 1px solid var(--border);
}
.topsearch { position: relative; width: min(380px, 40vw); }
.topsearch svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); width: 17px; height: 17px; color: var(--muted); pointer-events: none; }
.topsearch input { padding-left: 40px; border-radius: 999px; background: var(--surface-2); border-color: var(--border); min-height: 40px; }
.userchip { display: flex; align-items: center; gap: 10px; padding: 4px 10px 4px 4px; border-radius: 999px; color: inherit; transition: background .15s; }
.userchip:hover { background: var(--surface-3); color: inherit; }
.userchip > div > b { display: block; font-size: 14.5px; color: var(--heading); line-height: 1.2; }
.userchip > div > span { display: block; font-size: 13px; color: var(--muted); }
.userchip svg { width: 16px; height: 16px; color: var(--muted); }
.main { flex: 1; min-width: 0; padding: 26px 28px 56px; max-width: 1560px; width: 100%; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head .sub { color: var(--muted); font-size: 15px; margin-top: 5px; }
.page-head .back { display: inline-flex; align-items: center; gap: 4px; font-size: 14px; color: var(--muted); margin-bottom: 8px; font-weight: 600; }
.page-head .back:hover { color: var(--primary); }
.page-head .back svg { width: 15px; height: 15px; }
.page-head .actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.topbar, .bottomnav { display: none; }
.lang-select { width: auto; min-height: 36px; padding: 4px 32px 4px 12px; font-size: 14px; border-radius: 999px; background-color: var(--surface-2); }

@media (max-width: 900px) {
  .sidebar, .deskbar { display: none; }
  .main { padding: 14px 14px 100px; }
  .topbar {
    display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 20; gap: 6px;
    background: color-mix(in srgb, var(--surface) 90%, transparent); backdrop-filter: blur(14px); border-bottom: 1px solid var(--border);
    padding: 8px 8px 8px 14px; padding-top: max(8px, env(safe-area-inset-top));
  }
  .topbar .brand { padding: 0; font-size: 18px; color: var(--primary); }
  .topbar .brand img { width: 32px; height: 32px; }
  .bottomnav {
    display: grid; position: fixed; bottom: 0; left: 0; right: 0; z-index: 30;
    background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(14px); border-top: 1px solid var(--border);
    padding-bottom: env(safe-area-inset-bottom); box-shadow: 0 -8px 24px -12px rgba(21, 63, 140, .25);
  }
  .bottomnav a { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 9px 2px 8px; font-size: 11.5px; font-weight: 600; color: var(--muted); position: relative; }
  .bottomnav a.active { color: var(--primary); }
  .bottomnav a.cta svg { background: var(--primary); color: #fff; border-radius: 14px; padding: 7px; width: 40px; height: 40px; margin-top: -16px; box-shadow: var(--shadow-btn); }
  .bottomnav svg { width: 22px; height: 22px; }
  .bottomnav .badge { position: absolute; top: 4px; left: 54%; }
  h1 { font-size: 22px; }
  .page-head { margin-bottom: 14px; align-items: flex-start; }
}

/* ---------- Thẻ ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px 22px; }
.card + .card { margin-top: 18px; }
.grid > .card + .card, .section-grid > .card + .card { margin-top: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.card-head h2 { margin: 0; }
.card-head a { font-size: 14px; font-weight: 600; }
.grid { display: grid; gap: 18px; }
.grid.kpi { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); align-items: start; }
.grid.three { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); align-items: start; }
.grid.chart { grid-template-columns: minmax(0, 2.2fr) minmax(280px, 1fr); align-items: stretch; }
@media (max-width: 1150px) { .grid.three, .grid.chart { grid-template-columns: 1fr; } }
@media (max-width: 560px) { .grid.two { grid-template-columns: 1fr; } .grid.kpi { grid-template-columns: 1fr 1fr; gap: 12px; } }

/* Thẻ số liệu: nhãn trên trái, biểu tượng tròn trên phải, số lớn, tăng/giảm */
.stat { padding: 18px 20px; display: flex; flex-direction: column; gap: 6px; position: relative; color: inherit; transition: transform .15s, box-shadow .15s; }
a.stat:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); color: inherit; }
.stat .top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.stat .ic { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); flex: none; }
.stat .ic svg { width: 19px; height: 19px; }
.stat .ic.gold { background: var(--gold-soft); color: var(--gold); }
.stat .ic.accent { background: var(--accent-soft); color: var(--accent); }
.stat .ic.ok, .stat .ic.teal { background: var(--teal-soft); color: var(--teal); }
.stat .ic.violet { background: var(--violet-soft); color: var(--violet); }
.stat .label { color: var(--muted); font-size: 14px; font-weight: 600; }
.stat .value { font-size: 30px; font-weight: 800; letter-spacing: -.02em; line-height: 1.15; font-variant-numeric: tabular-nums; color: var(--heading); }
.stat .foot { font-size: 13.5px; color: var(--muted); }
.delta { font-weight: 700; }
.delta.up { color: var(--ok); }
.delta.down { color: var(--danger); }
@media (max-width: 560px) { .stat { padding: 14px; } .stat .value { font-size: 23px; } .stat .ic { width: 34px; height: 34px; } }

/* ---------- Nút ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text-2); padding: 8px 16px; border-radius: var(--radius-sm); font: inherit; font-weight: 650; font-size: 15px;
  cursor: pointer; min-height: 40px; white-space: nowrap; transition: background .15s, border-color .15s, color .15s, box-shadow .15s, transform .05s;
}
.btn:hover { background: var(--primary-soft); color: var(--primary); border-color: color-mix(in srgb, var(--primary) 30%, var(--border-strong)); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 4px var(--primary-ring); }
/* Nút chính: chữ luôn trắng ở mọi trạng thái. */
.btn.primary, .btn.primary:visited { background: var(--primary); border-color: var(--primary); color: #fff; box-shadow: var(--shadow-btn); }
.btn.primary:hover, .btn.primary:focus, .btn.primary:active { background: var(--primary-hover); border-color: var(--primary-hover); color: #fff; }
.btn.soft { background: var(--primary-soft); border-color: transparent; color: var(--primary); }
.btn.soft:hover { background: color-mix(in srgb, var(--primary) 16%, var(--surface)); }
.btn.accent, .btn.accent:hover { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.danger { color: var(--danger); }
.btn.danger:hover { background: var(--danger-soft); border-color: var(--danger); color: var(--danger); }
.btn.sm { padding: 4px 12px; min-height: 32px; font-size: 14px; border-radius: 9px; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--surface-3); color: var(--text); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn svg { width: 17px; height: 17px; flex: none; }
.btn.sm svg { width: 15px; height: 15px; }
.icon-btn { border: 0; background: transparent; padding: 9px; border-radius: 12px; cursor: pointer; color: var(--text-2); display: inline-flex; position: relative; }
.icon-btn:hover { background: var(--primary-soft); color: var(--primary); }
.icon-btn:disabled { opacity: .35; cursor: not-allowed; }
.icon-btn svg { width: 20px; height: 20px; }
.icon-btn .badge { position: absolute; top: 3px; right: 2px; }
.eye { width: 32px; height: 32px; border-radius: 50%; display: inline-grid; place-items: center; color: var(--text-2); background: var(--surface-3); }
.eye:hover { background: var(--primary); color: #fff; }
.eye svg { width: 16px; height: 16px; }

/* ---------- Biểu mẫu ---------- */
label.field, div.field { display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 650; color: var(--text-2); min-width: 0; }
.field > span.lbl { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
input, select, textarea {
  font: inherit; font-size: 15.5px; color: var(--text); background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 9px 12px; min-height: 42px; width: 100%; font-weight: 500; transition: border-color .15s, box-shadow .15s, background .15s;
}
input::placeholder, textarea::placeholder { color: #9aa8c4; font-weight: 450; }
input:hover, select:hover, textarea:hover { border-color: var(--border-strong); }
input[readonly], input:disabled, select:disabled { background: var(--surface-3); color: var(--text-2); cursor: default; }
select { appearance: none; padding-right: 34px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%236b7a99'%3E%3Cpath d='M5.2 7.6a.75.75 0 011.06-.02L10 11.1l3.74-3.52a.75.75 0 111.02 1.1l-4.25 4a.75.75 0 01-1.02 0l-4.25-4a.75.75 0 01-.04-1.06z'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; background-size: 18px; }
textarea { min-height: 84px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); background: var(--surface); box-shadow: 0 0 0 4px var(--primary-ring); }
input[type="checkbox"] { width: 18px; height: 18px; min-height: 0; accent-color: var(--primary); padding: 0; flex: none; }
input[type="color"] { padding: 4px; height: 42px; }
.check { display: flex; align-items: center; gap: 9px; font-weight: 550; color: var(--text); cursor: pointer; font-size: 15px; }
.input-icon { position: relative; flex: 1; display: block; }
.input-icon svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 17px; height: 17px; color: var(--muted); pointer-events: none; }
.input-icon input { padding-left: 38px; }
@media (max-width: 900px) { input, select, textarea { font-size: 17.5px; } }

.form-section { padding-top: 18px; margin-top: 18px; border-top: 1px dashed var(--border-strong); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px 18px; }
.form-grid .full { grid-column: 1 / -1; }
.field.is-ocr input, .field.is-ocr select { border-color: var(--warn-border); background: var(--warn-soft); }
.field.is-ai-ok input, .field.is-ai-ok select { border-color: color-mix(in srgb, var(--ok) 45%, transparent); background: var(--ok-soft); }
.field.is-missing input { border-style: dashed; }
.field.is-error input, .field.is-error select { border-color: var(--danger); background: var(--danger-soft); }
.field .err { color: var(--danger); font-weight: 600; font-size: 13.5px; }
.field .hint { color: var(--muted); font-weight: 450; font-size: 13.5px; }
.suggest { font-weight: 550; font-size: 13.5px; color: var(--warn); display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.suggest button { font-size: 13px; padding: 1px 9px; min-height: 0; }
.ro-info { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 26px; padding: 12px 18px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); font-size: 15px; }
.ro-info span { color: var(--muted); }
.ro-info b { color: var(--heading); }
/* Ô tick Thực tập sinh: nằm bên phải thanh thông tin (xuống dòng trên điện thoại). */
.ro-info .intern-box { margin-left: auto; padding: 6px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); cursor: pointer; }
.ro-info .intern-box b { color: var(--heading); }
@media (max-width: 700px) { .ro-info .intern-box { margin-left: 0; } }

/* ---------- Nhãn ---------- */
.tag { display: inline-flex; align-items: center; gap: 5px; border-radius: 999px; padding: 3px 10px; font-size: 13px; font-weight: 650; background: var(--surface-3); color: var(--text-2); white-space: nowrap; line-height: 1.45; }
.tag.ocr { background: var(--warn-soft); color: var(--warn); }
.tag.req { background: var(--danger-soft); color: var(--danger); }
.tag.ok { background: var(--ok-soft); color: var(--ok); }
.tag.info { background: var(--info-soft); color: var(--info); }
.tag.gold { background: var(--gold-soft); color: var(--gold); }
.tag.violet { background: var(--violet-soft); color: var(--violet); }
.tag.dot::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.tag.off { text-decoration: line-through; }
.status-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 8px; vertical-align: 0; }
.badge { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: #f04461; color: #fff; font-size: 11.5px; font-weight: 750; display: inline-flex; align-items: center; justify-content: center; box-shadow: 0 0 0 2px var(--surface); }
.avatar { width: 36px; height: 36px; border-radius: 50%; flex: none; display: inline-grid; place-items: center; font-size: 13.5px; font-weight: 750; color: #fff; background: linear-gradient(135deg, #4f8dff, #1f6bef); }
.avatar.sm { width: 32px; height: 32px; font-size: 12.5px; }
.avatar.c1 { background: linear-gradient(135deg, #f37a96, #e5476b); }
.avatar.c2 { background: linear-gradient(135deg, #3fd1c6, #13a8a0); }
.avatar.c3 { background: linear-gradient(135deg, #ffbe4d, #e59a12); }
.avatar.c4 { background: linear-gradient(135deg, #9b85ff, #7a5af8); }
.avatar.c5 { background: linear-gradient(135deg, #5f7ba8, #33456b); }
.person { display: flex; align-items: center; gap: 10px; min-width: 0; }
.person .nm { font-weight: 650; color: var(--heading); }
.person .sub { font-size: 13.5px; color: var(--muted); }

/* ---------- Bộ lọc ---------- */
.filters { display: grid; grid-template-columns: minmax(240px, 2fr) repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; align-items: end; }
@media (max-width: 900px) { .filters { grid-template-columns: 1fr 1fr; } .filters .search { grid-column: 1 / -1; } }
.filters-toggle { display: none; }
@media (max-width: 900px) { .filters-toggle { display: inline-flex; } .filters.collapsed > :not(.search) { display: none; } }

/* ---------- Bảng ---------- */
.table-wrap { overflow-x: auto; margin: 0 -22px; }
table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 15px; }
th, td { text-align: left; padding: 13px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
th:first-child, td:first-child { padding-left: 22px; }
th:last-child, td:last-child { padding-right: 22px; }
thead th { font-size: 13.5px; color: var(--muted); font-weight: 650; white-space: nowrap; background: var(--surface-2); border-top: 1px solid var(--border); }
tbody tr:last-child td { border-bottom: 0; }
tfoot th { background: var(--surface-2); color: var(--heading); font-size: 14.5px; border-bottom: 0; border-top: 1px solid var(--border); }
tbody tr { transition: background .12s; }
tbody tr:hover { background: var(--surface-2); }
tbody tr.clickable { cursor: pointer; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.card > .table-wrap:last-child { margin-bottom: -20px; }
.card > .table-wrap:last-child tbody tr:last-child td:first-child { border-bottom-left-radius: var(--radius); }

/* Bảng Danh sách */
.dt-wrap { overflow: auto; max-height: calc(100vh - 300px); min-height: 260px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); }
.dt { font-size: 15px; }
.dt thead th { position: sticky; top: 0; z-index: 2; border-top: 0; background: var(--surface-2); box-shadow: inset 0 -1px 0 var(--border); border-bottom: 0; }
.dt th, .dt td { padding: 12px 14px; white-space: nowrap; }
.dt th:first-child, .dt td:first-child { padding-left: 16px; position: sticky; left: 0; z-index: 1; background: var(--surface); box-shadow: inset -1px 0 0 var(--border); }
.dt thead th:first-child { z-index: 3; background: var(--surface-2); }
.dt tbody tr:hover td { background: var(--primary-soft); }
.dt th.sortable { cursor: pointer; user-select: none; }
.dt th.sortable:hover { color: var(--primary); }
.dt th .arrow { display: inline-block; margin-left: 4px; opacity: .35; font-size: 11px; }
.dt th.sorted { color: var(--primary); }
.dt th.sorted .arrow { opacity: 1; }
.dt.compact th, .dt.compact td { padding-top: 7px; padding-bottom: 7px; font-size: 14px; }
.dt .files, .files { display: inline-flex; gap: 4px; }
.files span { width: 22px; height: 22px; border-radius: 7px; display: inline-grid; place-items: center; font-size: 11px; font-weight: 800; background: var(--surface-3); color: #a8b4cc; }
.files span.on { background: var(--primary-soft); color: var(--primary); }
.toolbar { display: flex; gap: 8px; align-items: center; justify-content: space-between; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar .grp { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.dropdown { position: relative; }
.dropdown .menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 40; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-lg); padding: 8px; min-width: 240px; max-height: 380px; overflow: auto; }
.dropdown .menu label { display: flex; gap: 8px; align-items: center; padding: 7px 9px; border-radius: 9px; cursor: pointer; font-size: 15px; }
.dropdown .menu label:hover { background: var(--primary-soft); }

.rec-cards { display: none; }
@media (max-width: 900px) {
  .rec-table { display: none; }
  .rec-cards { display: flex; flex-direction: column; gap: 10px; }
}
.rec-card { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 14px; display: block; color: var(--text); box-shadow: var(--shadow); }
.rec-card:hover { border-color: var(--primary); color: var(--text); }
.rec-card .top { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.rec-card .meta { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 14px; color: var(--muted); margin-top: 10px; }

.pager { display: flex; gap: 8px; align-items: center; justify-content: space-between; margin-top: 14px; flex-wrap: wrap; }

/* ---------- Biểu đồ ---------- */
.bars { display: flex; flex-direction: column; gap: 12px; }
.bar-row { display: grid; grid-template-columns: minmax(96px, 36%) 1fr 54px; align-items: center; gap: 12px; font-size: 15px; }
.bar-row .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-2); font-weight: 550; }
.bar-row .name a { color: var(--text-2); }
.bar-row .name a:hover { color: var(--primary); }
.bar-track { background: var(--surface-3); border-radius: 999px; height: 9px; overflow: hidden; }
.bar-fill { display: block; height: 100%; background: linear-gradient(90deg, #6aa2ff, var(--primary)); border-radius: 999px; min-width: 4px; }
.bar-row .n { text-align: right; font-variant-numeric: tabular-nums; font-weight: 750; color: var(--heading); }

.linechart { position: relative; }
.linechart svg { width: 100%; height: auto; display: block; overflow: visible; }
.linechart .grid-line { stroke: var(--border); stroke-dasharray: 4 4; }
.linechart .axis { fill: var(--muted); font-size: 12.5px; }
.linechart .line { fill: none; stroke: var(--primary); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.linechart .pt { fill: var(--surface); stroke: var(--primary); stroke-width: 2.5; opacity: 0; transition: opacity .12s; }
.linechart .pt.on, .linechart.few .pt { opacity: 1; }
.linechart .hit { fill: transparent; cursor: crosshair; }
.chart-tip { position: absolute; transform: translate(-50%, -120%); background: #0b2a6b; color: #fff; padding: 7px 11px; border-radius: 10px; font-size: 13px; pointer-events: none; white-space: nowrap; box-shadow: var(--shadow-lg); line-height: 1.35; }
.chart-tip.below { transform: translate(-50%, 18px); }
.chart-tip b { display: block; font-size: 14.5px; }
.donut-wrap { display: flex; flex-direction: column; align-items: center; gap: 18px; }
.donut { width: 170px; height: 170px; }
.donut .ctr { fill: var(--heading); font-size: 28px; font-weight: 800; }
.donut .ctr-sub { fill: var(--muted); font-size: 12.5px; font-weight: 600; }
.legend { width: 100%; display: flex; flex-direction: column; gap: 9px; font-size: 14.5px; }
.legend div { display: flex; align-items: center; gap: 8px; color: var(--text-2); }
.legend div b { margin-left: auto; color: var(--heading); font-variant-numeric: tabular-nums; }

/* ---------- Việc cần làm ---------- */
.todo { display: flex; gap: 12px; align-items: center; padding: 11px 6px; border-bottom: 1px solid var(--border); color: inherit; border-radius: 10px; }
.todo:last-child { border-bottom: 0; }
.todo:hover { background: var(--surface-2); color: inherit; }
.todo .ti { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; flex: none; background: var(--info-soft); color: var(--info); }
.todo .ti svg { width: 17px; height: 17px; }
.todo.warn .ti { background: var(--gold-soft); color: var(--gold); }
.todo.danger .ti { background: var(--danger-soft); color: var(--danger); }
.todo .tx { flex: 1; min-width: 0; font-weight: 600; color: var(--text); font-size: 15px; }
.todo .go { color: var(--muted); }
.todo .go svg { width: 16px; height: 16px; transform: rotate(180deg); }

/* ---------- Ô file giấy tờ (Nhập SIM) ---------- */
/* Ô giấy tờ: mỗi loại một thanh ngang, xếp từ trên xuống */
.slots { display: flex; flex-direction: column; gap: 10px; }
.slot { display: flex; align-items: center; gap: 14px; padding: 10px 12px; min-height: 68px; border: 1px dashed var(--border-strong); border-radius: 14px; background: var(--surface-2); transition: border-color .15s, box-shadow .15s, background .15s; }
.slot.has { border-style: solid; border-color: var(--border); background: var(--surface); }
.slot.drag { border-color: var(--primary); background: var(--primary-soft); box-shadow: 0 0 0 4px var(--primary-ring); }
.sthumb { width: 58px; height: 44px; border-radius: 10px; flex: none; display: grid; place-items: center; border: 0; padding: 0; background: var(--primary-soft) center / cover no-repeat; color: var(--primary); font: inherit; font-size: 12.5px; font-weight: 800; }
.sthumb svg { width: 20px; height: 20px; }
button.sthumb { cursor: zoom-in; }
button.sthumb:hover { box-shadow: 0 0 0 3px var(--primary-ring); }
.sthumb.pdf { background: var(--accent-soft); color: var(--accent); }
.sinfo { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.sname { display: flex; align-items: center; gap: 8px; font-weight: 700; color: var(--heading); font-size: 15.5px; }
.slot .st.wrap { white-space: normal; }
.slot .st { font-size: 13.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.slot .st.err { color: var(--danger); white-space: normal; }
.slot .progress { border-radius: 2px; max-width: 260px; }
.slot .acts { display: flex; align-items: center; gap: 6px; flex: none; }
.slot .acts .icon-btn { padding: 7px; }
.slot .acts .icon-btn svg { width: 17px; height: 17px; }
@media (max-width: 640px) {
  .slot { gap: 10px; padding: 8px 10px; min-height: 60px; }
  .sthumb { width: 48px; height: 40px; }
  .slot .acts { gap: 4px; }
  .slot .acts .btn { width: 40px; min-height: 40px; padding: 0; }
  .slot .acts .btn span { display: none; }
  .slot .acts .btn svg { width: 19px; height: 19px; }
}
.progress { height: 4px; background: var(--surface-3); overflow: hidden; }
.progress > div { height: 100%; background: var(--primary); }
.progress .indeterminate { width: 40%; animation: indet 1.1s ease-in-out infinite; }
@keyframes indet { from { transform: translateX(-100%); } to { transform: translateX(250%); } }

.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px; }
.thumb { border: 1px solid var(--border); border-radius: 14px; overflow: hidden; background: var(--surface); display: flex; flex-direction: column; }
.thumb .img { aspect-ratio: 4 / 3; background: var(--surface-3) center / cover no-repeat; cursor: zoom-in; border: 0; padding: 0; width: 100%; display: grid; place-items: center; color: var(--accent); font-weight: 800; }
.thumb .img svg { width: 30px; height: 30px; color: #a8b4cc; }
.thumb .body { padding: 10px 12px; display: flex; flex-direction: column; gap: 4px; font-size: 14px; }

.notice { border-radius: 12px; padding: 12px 15px; font-size: 15px; display: flex; gap: 10px; align-items: flex-start; border: 1px solid transparent; }
.notice svg { width: 18px; height: 18px; flex: none; margin-top: 1px; }
.notice.warn { background: var(--warn-soft); color: var(--warn); border-color: var(--warn-border); }
.notice.err { background: var(--danger-soft); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 25%, transparent); }
.notice.ok { background: var(--ok-soft); color: var(--ok); }
.notice.info { background: var(--info-soft); color: var(--text-2); border-color: color-mix(in srgb, var(--info) 18%, transparent); }

.sticky-actions {
  /* Nằm cố định ở cuối form (không trôi theo màn hình khi cuộn). */
  border-top: 1px solid var(--border); margin: 22px -22px -20px; padding: 14px 22px;
  display: flex; gap: 10px; justify-content: flex-end; align-items: center; flex-wrap: wrap;
}
@media (max-width: 900px) { .sticky-actions .btn { flex: 1; } .sticky-actions .spacer { display: none; } .sticky-actions .check { flex-basis: 100%; } }

/* ---------- Chi tiết ---------- */
.hero { display: flex; align-items: center; gap: 14px; }
.hero .avatar { width: 54px; height: 54px; font-size: 19.5px; border-radius: 16px; }
.hero-meta { display: flex; flex-wrap: wrap; gap: 6px 14px; color: var(--muted); font-size: 14.5px; margin-top: 6px; align-items: center; }
dl.kv { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 16px 20px; margin: 0; }
dl.kv div { min-width: 0; }
dl.kv dt { font-size: 13.5px; color: var(--muted); font-weight: 600; }
dl.kv dd { margin: 3px 0 0; font-weight: 700; font-size: 16px; overflow-wrap: anywhere; color: var(--heading); }
dd.empty { color: var(--muted); font-weight: 450; font-style: italic; }
.section-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); gap: 18px; }
.sec-title { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.sec-title .ic { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); }
.sec-title .ic svg { width: 17px; height: 17px; }
.sec-title h2 { margin: 0; }

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { padding: 0 0 16px 26px; position: relative; font-size: 15px; }
.timeline li::before { content: ""; position: absolute; left: 7px; top: 18px; bottom: 0; width: 2px; background: var(--border); }
.timeline li:last-child::before { display: none; }
.timeline li::after { content: ""; position: absolute; left: 2px; top: 5px; width: 8px; height: 8px; border-radius: 50%; background: var(--surface); border: 2.5px solid var(--primary); }
.timeline .chg { font-size: 14px; color: var(--muted); margin-top: 3px; }
.timeline .chg s { color: var(--danger); background: var(--danger-soft); padding: 0 4px; border-radius: 4px; }
.timeline .chg ins { color: var(--ok); background: var(--ok-soft); padding: 0 4px; border-radius: 4px; text-decoration: none; }

/* ---------- Tab ---------- */
.tabs { display: flex; gap: 6px; margin-bottom: 20px; flex-wrap: wrap; padding: 5px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow); width: fit-content; max-width: 100%; }
.tabs a { padding: 8px 14px; color: var(--text-2); font-weight: 650; font-size: 14.5px; white-space: nowrap; border-radius: 10px; display: inline-flex; gap: 7px; align-items: center; }
.tabs a svg { width: 16px; height: 16px; }
.tabs a:hover { color: var(--primary); background: var(--primary-soft); }
.tabs a.active { color: #fff; background: var(--primary); box-shadow: var(--shadow-btn); }
.seg { display: inline-flex; padding: 4px; background: var(--surface-3); border-radius: 12px; gap: 2px; }
.seg .btn { border: 0; background: transparent; color: var(--muted); min-height: 32px; box-shadow: none; }
.seg .btn.on { background: var(--surface); color: var(--primary); box-shadow: var(--shadow); }

/* ---------- Thông báo ---------- */
.notif { display: flex; gap: 12px; padding: 14px 22px; margin: 0 -22px; border-bottom: 1px solid var(--border); cursor: pointer; color: inherit; align-items: center; }
.notif:last-child { border-bottom: 0; }
.notif:hover { background: var(--surface-2); color: inherit; }
.notif .msg { color: var(--text-2); }
.notif.unread { background: color-mix(in srgb, var(--primary-soft) 55%, transparent); }
.notif.unread .msg { font-weight: 650; color: var(--heading); }
.notif .n-ic { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; flex: none; background: var(--primary-soft); color: var(--primary); }
.notif .n-ic.sheets { background: var(--teal-soft); color: var(--teal); }
.notif .n-ic.stock { background: var(--accent-soft); color: var(--accent); }
.notif .n-ic svg { width: 18px; height: 18px; }
.notif .dot { width: 9px; height: 9px; border-radius: 50%; background: #f04461; flex: none; }
.notif:not(.unread) .dot { background: transparent; }
@keyframes ring { 0%, 100% { transform: rotate(0); } 20% { transform: rotate(14deg); } 40% { transform: rotate(-12deg); } 60% { transform: rotate(8deg); } 80% { transform: rotate(-4deg); } }
.ringing svg { animation: ring .9s ease-in-out 2; transform-origin: 50% 10%; }

/* ---------- Hộp thoại & thông báo nổi ---------- */
.modal-back { position: fixed; inset: 0; background: rgba(11, 42, 107, .35); backdrop-filter: blur(4px); z-index: 100; display: flex; align-items: center; justify-content: center; padding: 16px; animation: fade .15s ease-out; }
.modal { background: var(--surface); border: 1px solid var(--border); border-radius: 20px; max-width: 560px; width: 100%; max-height: 90vh; overflow: auto; padding: 24px; box-shadow: var(--shadow-lg); animation: pop .2s ease-out; }
.modal h2 { font-size: 19.5px; }
.modal.wide { max-width: 1000px; }
.modal .foot {
  display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap;
  /* Luôn thấy nút Lưu/Hủy kể cả khi nội dung hộp thoại dài phải cuộn. */
  position: sticky; bottom: -24px; margin: 22px -24px -24px; padding: 14px 24px 20px; background: var(--surface); border-top: 1px solid var(--border); z-index: 2;
}
.modal img.full { max-width: 100%; display: block; margin: 0 auto; border-radius: 12px; }
.modal iframe.full, .viewer iframe { width: 100%; height: 75vh; border: 1px solid var(--border); border-radius: 12px; background: #fff; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.98); } }
/* Thông báo ở phía trên giữa màn hình: không che nút Lưu/Hủy ở cuối form. */
#toast { position: fixed; left: 50%; top: 18px; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; width: max-content; max-width: 92vw; }
#toast .t { background: #0b2a6b; color: #fff; padding: 12px 18px; border-radius: 14px; box-shadow: var(--shadow-lg); font-size: 15px; max-width: min(420px, 92vw); animation: pop .2s ease-out; }
#toast .t.err { background: #b4233c; }
@media (max-width: 900px) { #toast { top: 70px; } }

/* ---------- Đăng nhập ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); }
.auth-side {
  position: relative; overflow: hidden; padding: 44px 56px; display: flex; flex-direction: column; justify-content: space-between; color: var(--text-2);
  background: radial-gradient(600px 420px at 80% 30%, rgba(255, 255, 255, .9), transparent 70%), linear-gradient(150deg, #dbe8ff 0%, #c4d9ff 55%, #b3ceff 100%);
}
/* Bọt nước trong suốt trang trí */
.auth-side .bubble { position: absolute; border-radius: 50%; background: radial-gradient(circle at 30% 28%, rgba(255, 255, 255, .95), rgba(255, 255, 255, .25) 38%, rgba(120, 165, 255, .25) 70%, rgba(255, 255, 255, .5)); box-shadow: inset -6px -8px 18px rgba(80, 130, 230, .25), 0 10px 30px -10px rgba(40, 90, 200, .35); pointer-events: none; }
.auth-side > *:not(.bubble) { position: relative; z-index: 1; }
.auth-logo { align-self: flex-start; display: inline-flex; background: rgba(255, 255, 255, .85); border-radius: 18px; padding: 10px 14px; box-shadow: var(--shadow); backdrop-filter: blur(6px); }
.auth-logo img { height: 92px; width: auto; display: block; }
.auth-side h2 { font-size: 44px; line-height: 1.08; letter-spacing: -.03em; font-weight: 850; color: #0b2a6b; margin: 0 0 16px; display: block; max-width: 520px; }
.auth-side h2 .hl { color: var(--primary); }
.auth-side p { color: #3a4f7a; max-width: 460px; font-size: 16.5px; margin: 0; }
.auth-side ul { list-style: none; padding: 0; margin: 26px 0 0; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; max-width: 560px; }
.auth-side li { display: flex; gap: 10px; align-items: center; color: #23365f; font-size: 14.5px; font-weight: 600; background: rgba(255, 255, 255, .7); border-radius: 14px; padding: 10px 12px; backdrop-filter: blur(6px); }
.auth-side li svg { width: 34px; height: 34px; padding: 8px; border-radius: 50%; background: #fff; color: var(--primary); flex: none; box-shadow: var(--shadow-xs); }
.auth-side .copy { font-size: 13.5px; color: #4d6290; }
.auth-main { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 28px 20px; position: relative; }
.auth-main .lang-corner { position: absolute; top: 18px; right: 18px; }
.auth-box { width: 100%; max-width: 420px; background: var(--surface); border: 1px solid var(--border); border-radius: 22px; box-shadow: var(--shadow-lg); padding: 34px 32px; }
.auth-box h1 { font-size: 30px; }
.auth-box .sub { color: var(--muted); margin: 6px 0 24px; }
.auth-box form { display: flex; flex-direction: column; gap: 16px; }
.auth-box .btn.primary { min-height: 46px; font-size: 16px; border-radius: 12px; }
.auth-box .brand-full { display: none; width: 150px; height: auto; margin: 0 auto 18px; }
@media (max-width: 900px) { .auth { grid-template-columns: 1fr; } .auth-side { display: none; } .auth-box { padding: 26px 20px; } .auth-box .brand-full { display: block; } }

.stack { display: flex; flex-direction: column; gap: 14px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
pre.ocr { white-space: pre-wrap; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; font-size: 13px; max-height: 220px; overflow: auto; margin: 8px 0 0; }
details summary { cursor: pointer; font-size: 14px; color: var(--muted); font-weight: 600; }
.empty-state { text-align: center; padding: 40px 16px; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 10px; }
.empty-state .es-ic { width: 58px; height: 58px; border-radius: 50%; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); }
.empty-state .es-ic svg { width: 26px; height: 26px; }
.empty-state b { color: var(--heading); font-size: 16px; }
.skeleton { height: 110px; border-radius: var(--radius); background: linear-gradient(90deg, var(--surface-3), var(--surface), var(--surface-3)); background-size: 200% 100%; animation: shimmer 1.2s infinite linear; }
@keyframes shimmer { to { background-position: -200% 0; } }
.mod-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 8px; }
.mod-grid label { border: 1px solid var(--border); border-radius: 10px; padding: 9px 11px; background: var(--surface-2); }
.viewer img { max-width: 100%; display: block; margin: 0 auto; border-radius: 12px; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
.nowrap-table td, .nowrap-table th { white-space: nowrap; }
}
.srv-old { position: sticky; top: 0; z-index: 300; display: flex; gap: 10px; align-items: center; justify-content: center; flex-wrap: wrap; padding: 10px 16px; background: #fff4df; color: #8a5300; border-bottom: 1px solid #f8d48f; font-size: 15px; font-weight: 600; }
.srv-old svg { width: 18px; height: 18px; flex: none; }

/* ---------- Điện thoại: bảng chuyển thành thẻ, tab tự xuống dòng ---------- */
@media (max-width: 700px) {
  .tabs { width: 100%; flex-wrap: wrap; overflow: visible; gap: 4px; }
  .tabs a { padding: 7px 10px; font-size: 14px; }
  .card { padding: 16px; }
  .card-head { align-items: flex-start; }
  .table-wrap { overflow: visible; margin: 0 -16px; }
  .card > .table-wrap:last-child { margin-bottom: -16px; }
  .table-wrap table.mstack thead { display: none; }
  .table-wrap table.mstack, .table-wrap table.mstack tbody, .table-wrap table.mstack tfoot { display: block; width: 100%; }
  .table-wrap table.mstack tr { display: block; padding: 10px 16px; border-bottom: 1px solid var(--border); }
  .table-wrap table.mstack tbody tr:last-child { border-bottom: 0; }
  .table-wrap table.mstack td, .table-wrap table.mstack tfoot th { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 5px 0; border: 0; text-align: right; white-space: normal; min-height: 30px; }
  .table-wrap table.mstack td::before, .table-wrap table.mstack tfoot th::before { content: attr(data-label); color: var(--muted); font-size: 13.5px; font-weight: 600; text-align: left; flex: none; max-width: 45%; }
  .table-wrap table.mstack td:first-child { font-size: 16px; padding-top: 2px; }
  .table-wrap table.mstack td[data-label=""]::before { display: none; }
  .table-wrap table.mstack td[data-label=""] { justify-content: flex-end; flex-wrap: wrap; }
  .table-wrap table.mstack td[colspan] { display: block; text-align: center; }
  .table-wrap table.mstack td[colspan]::before { display: none; }
  .table-wrap table.mstack td > * { min-width: 0; }
  .table-wrap table.mstack .person { justify-content: flex-end; }
  .page-head .actions { width: 100%; }
}
@media (max-width: 700px) {
  .table-wrap table.mstack td { flex-wrap: wrap; justify-content: flex-end; row-gap: 6px; }
  .table-wrap table.mstack td::before { margin-right: auto; }
  .table-wrap table.mstack td .tag, .table-wrap table.mstack td .btn { flex: none; }
  .table-wrap table.mstack td[style] { max-width: none !important; }
}
@media (max-width: 700px) {
  .table-wrap table.mstack td::before, .table-wrap table.mstack tfoot th::before { font: 600 13.5px/1.4 "Inter", system-ui, sans-serif; letter-spacing: 0; text-transform: none; }
  .table-wrap table.mstack td.m-hide { display: none; }
}

/* ---------- Cửa sổ xem ảnh nổi (đối chiếu với form) ---------- */
.fviewer {
  position: fixed; z-index: 90; display: flex; flex-direction: column; background: var(--surface);
  border: 1px solid var(--border); border-radius: 16px; box-shadow: 0 18px 50px -12px rgba(11, 42, 107, .45); overflow: hidden; touch-action: none;
}
.fv-head { display: flex; align-items: center; gap: 8px; padding: 6px 6px 6px 12px; background: var(--surface-2); border-bottom: 1px solid var(--border); cursor: move; user-select: none; }
.fv-grab { color: var(--muted); display: inline-flex; }
.fv-grab svg { width: 16px; height: 16px; }
.fv-title { font-weight: 650; font-size: 14.5px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fv-tools { display: flex; gap: 2px; cursor: default; }
.fv-tools .icon-btn { width: 32px; height: 32px; font-size: 19.5px; font-weight: 700; }
.fv-tools .icon-btn svg { width: 17px; height: 17px; }
.fv-body { position: relative; flex: 1; overflow: hidden; background: #e9eef6; cursor: grab; }
.fv-body:active { cursor: grabbing; }
.fv-body img { position: absolute; left: 0; top: 0; transform-origin: 0 0; max-width: none; user-select: none; -webkit-user-drag: none; }
.fv-body iframe { width: 100%; height: 100%; border: 0; background: #fff; }
/* Che iframe PDF khi đang kéo để không mất sự kiện chuột. */
.fv-shield { display: none; position: absolute; inset: 44px 0 0; }
.fviewer.dragging .fv-shield { display: block; }
.fv-grip { position: absolute; right: 0; bottom: 0; width: 22px; height: 22px; cursor: nwse-resize; touch-action: none;
  background: linear-gradient(135deg, transparent 50%, var(--muted) 50%, var(--muted) 58%, transparent 58%, transparent 70%, var(--muted) 70%, var(--muted) 78%, transparent 78%); }
@media (max-width: 700px) { .fv-grip { width: 30px; height: 30px; } }

/* ---------- Cỡ chữ trên điện thoại: thân 16px, chữ phụ ≥ 13.5px; ô nhập 16px để iPhone không tự phóng to ---------- */
@media (max-width: 700px) {
  body { font-size: 16px; }
  input, select, textarea { font-size: 16px; }
  h1 { font-size: 24px; }
  h2 { font-size: 18px; }
  .small { font-size: 14px; }
  table { font-size: 15px; }
  .tag { font-size: 13px; }
  .btn { font-size: 15px; }
  .bottomnav a { font-size: 12px; }
  .table-wrap table.mstack td::before, .table-wrap table.mstack tfoot th::before { font-size: 14px; }
  .linechart .axis, .donut .ctr-sub { font-size: 12.5px; }
}

/* ---------- Các bước kết nối Google Sheets ---------- */
ol.steps { list-style: none; counter-reset: st; margin: 0 0 18px; padding: 0; display: grid; gap: 12px; }
ol.steps > li { counter-increment: st; position: relative; padding: 2px 0 2px 44px; display: flex; flex-direction: column; gap: 6px; min-height: 30px; }
ol.steps > li::before { content: counter(st); position: absolute; left: 0; top: 0; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-weight: 750; background: var(--primary-soft); color: var(--primary); }
ol.steps > li.done::before { content: '✓'; background: var(--ok-soft); color: var(--ok); }
ol.steps > li.wait { opacity: .6; }
.copybox { background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 7px 12px; font-size: 14px; word-break: break-all; user-select: all; }
.drive-ok { display: flex; flex-direction: column; gap: 6px; background: var(--ok-soft); border: 1px solid color-mix(in srgb, var(--ok) 25%, transparent); border-radius: 14px; padding: 14px 16px; }
.drive-ok a { display: inline-flex; align-items: center; gap: 5px; font-weight: 650; }
.drive-ok a svg { width: 15px; height: 15px; }
.danger-zone { border-color: color-mix(in srgb, var(--danger) 35%, var(--border)); }
.danger-zone .sec-title .ic { background: color-mix(in srgb, var(--danger) 12%, transparent); color: var(--danger); }

/* ---------- Kích hoạt SIM theo lịch bay ---------- */
.act-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.act-tile { display: flex; flex-direction: column; gap: 4px; border: 1px solid var(--border); border-radius: 16px; padding: 14px 16px; color: inherit; text-decoration: none; background: var(--surface-2); transition: box-shadow .15s, transform .05s; }
a.act-tile:hover { box-shadow: var(--shadow); }
.act-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-weight: 650; color: var(--text-2); }
.act-top b { font-size: 30px; line-height: 1; color: var(--heading); }
.act-tile.danger .act-top b { color: var(--danger); }
.act-tile.warn .act-top b { color: #b45309; }
.act-tile.ok .act-top b { color: var(--ok); }
.act-sub { font-size: 13.5px; color: var(--muted); text-align: right; margin-top: -2px; }
.act-bar { height: 7px; border-radius: 99px; background: var(--surface-3); overflow: hidden; margin-top: 6px; }
.act-bar span { display: block; height: 100%; background: var(--ok); border-radius: 99px; }
.act-foot { font-size: 13.5px; color: var(--text-2); }
@media (max-width: 700px) { .act-grid { grid-template-columns: 1fr; } .act-tile { flex-direction: column; } }

/* ---------- Ảnh quảng cáo (trong vùng tiêu đề Tổng quan) ----------
   Ảnh nằm riêng một hàng, giãn hết bề ngang (PC: dưới hàng tiêu đề + nút; điện thoại: giữa tiêu đề và nút). */
.dash-head { flex-wrap: wrap; align-items: center; }
.head-ad { order: 3; flex: 1 1 100%; min-width: 0; display: grid; }
.head-ad .ad-item { grid-area: 1 / 1; display: block; opacity: 0; visibility: hidden; transition: opacity .5s; }
.head-ad .ad-item.on { opacity: 1; visibility: visible; }
.head-ad img { display: block; width: 100%; height: auto; border-radius: 16px; box-shadow: var(--shadow); }
.head-ad a.ad-item img { transition: transform .2s, box-shadow .2s; }
.head-ad a.ad-item:hover img { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
@media (max-width: 900px) {
  .head-ad { order: 0; }
  .dash-head > .actions { order: 4; }
}
.ad-list { display: grid; gap: 14px; }
.ad-row { display: grid; grid-template-columns: 220px 1fr; gap: 16px; align-items: start; border: 1px solid var(--border); border-radius: 14px; padding: 12px; }
.ad-row img { width: 100%; height: auto; max-height: 140px; object-fit: contain; border-radius: 10px; background: var(--surface-2); }
.ad-fields { display: grid; gap: 10px; }
@media (max-width: 700px) { .ad-row { grid-template-columns: 1fr; } }

/* ---------- Nút Zalo CSKH (3D) ---------- */
.zalo-fab { position: fixed; right: 24px; bottom: 24px; z-index: 80; width: 64px; height: 64px; display: block; text-decoration: none; animation: zfloat 3.2s ease-in-out infinite; }
.zf-btn {
  position: relative; z-index: 2; width: 100%; height: 100%; border-radius: 50%; display: grid; place-items: center; overflow: hidden;
  background: radial-gradient(circle at 32% 26%, #7fbcff 0%, #2f86ff 34%, #0068ff 58%, #0049c2 100%);
  box-shadow:
    inset 0 -6px 10px rgba(0, 30, 110, .45),
    inset 0 5px 8px rgba(255, 255, 255, .55),
    0 4px 0 #0047b8,
    0 12px 22px -6px rgba(0, 72, 190, .65),
    0 22px 34px -14px rgba(0, 50, 140, .5);
  transition: transform .2s ease, box-shadow .2s ease;
  animation: zwiggle 6s ease-in-out infinite;
}
/* Vệt bóng kính phía trên tạo cảm giác khối cầu. */
.zf-btn::before { content: ''; position: absolute; left: 14%; top: 7%; width: 72%; height: 44%; border-radius: 50%; background: linear-gradient(180deg, rgba(255, 255, 255, .7), rgba(255, 255, 255, 0)); pointer-events: none; }
.zf-btn img { position: relative; width: 72%; height: 72%; object-fit: contain; filter: drop-shadow(0 3px 3px rgba(0, 35, 110, .45)); user-select: none; }
/* Lớp kính mỏng phủ cả biểu tượng cho cảm giác nổi khối. */
.zf-btn::after { content: ''; position: absolute; inset: 0; border-radius: 50%; background: radial-gradient(circle at 34% 22%, rgba(255, 255, 255, .38), rgba(255, 255, 255, 0) 42%); pointer-events: none; }
.zf-wave { position: absolute; inset: 0; border-radius: 50%; background: rgba(0, 104, 255, .35); z-index: 1; animation: zwave 2.4s ease-out infinite; }
.zf-wave.w2 { animation-delay: 1.2s; }
.zf-label {
  position: absolute; right: calc(100% + 12px); top: 50%; transform: translate(8px, -50%); white-space: nowrap; pointer-events: none; opacity: 0;
  background: #fff; color: #0b2a6b; font: 700 14px/1 "Inter", system-ui, sans-serif; padding: 10px 14px; border-radius: 12px;
  box-shadow: 0 10px 24px -8px rgba(11, 42, 107, .35); transition: opacity .2s, transform .2s;
}
.zf-label::after { content: ''; position: absolute; right: -6px; top: 50%; width: 12px; height: 12px; background: #fff; transform: translateY(-50%) rotate(45deg); border-radius: 2px; }
.zalo-fab:hover { animation-play-state: paused; }
.zalo-fab:hover .zf-btn { transform: translateY(-3px) scale(1.06); box-shadow: inset 0 -6px 10px rgba(0, 30, 110, .45), inset 0 5px 8px rgba(255, 255, 255, .6), 0 6px 0 #0047b8, 0 18px 28px -6px rgba(0, 72, 190, .7), 0 28px 40px -14px rgba(0, 50, 140, .55); }
.zalo-fab:active .zf-btn { transform: translateY(2px) scale(.98); box-shadow: inset 0 -4px 8px rgba(0, 30, 110, .45), inset 0 4px 6px rgba(255, 255, 255, .5), 0 1px 0 #0047b8, 0 6px 12px -6px rgba(0, 72, 190, .6); }
.zalo-fab:hover .zf-label, .zalo-fab:focus-visible .zf-label { opacity: 1; transform: translate(0, -50%); }
@keyframes zfloat { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
@keyframes zwave { 0% { transform: scale(1); opacity: .7; } 100% { transform: scale(1.75); opacity: 0; } }
@keyframes zwiggle { 0%, 86%, 100% { rotate: 0deg; } 88% { rotate: -12deg; } 90% { rotate: 10deg; } 92% { rotate: -8deg; } 94% { rotate: 6deg; } 96% { rotate: 0deg; } }
@media (max-width: 900px) { .zalo-fab { right: 14px; bottom: 90px; width: 56px; height: 56px; } .zf-label { display: none; } }
@media (prefers-reduced-motion: reduce) { .zalo-fab, .zf-btn, .zf-wave { animation: none; } }
@media print { .zalo-fab { display: none; } }
