/* ==========================================================================
   phamquynhtanvu — Sổ Mua Sắm & Ngân Sách (Trường Đại học Phan Châu Trinh)
   Shared stylesheet for every mockup screen. Plain CSS, no remote assets.

   Identity (docs/phamquynhtanvu/PRODUCT.md):
   - Navy from the customer's dashboard and the PCTU ribbon carries structure
     and primary actions.
   - Gold (logo laurel) = attention: the step waiting for a signature,
     "sắp hết", "chờ lâu", missing documents.
   - Crimson (logo) = danger only: negative numbers, over budget, rejected.
   - Signed names are written in "blue ballpoint ink" (--ink-blue), the way
     Vietnamese paper documents are signed.
   - Screen documents are numbered sheets; print forms use Times New Roman,
     exactly like the school's Excel sheets.
   Fonts are system stacks on purpose (no CDN): Segoe UI for UI, Sitka /
   Cambria for display titles, Times New Roman for printed forms.
   ========================================================================== */

/* -------------------------------------------------------------------------
   1. Tokens
   ------------------------------------------------------------------------- */
:root {
  color-scheme: light;

  /* Navy (hue 257–262) */
  --navy-950: oklch(0.205 0.045 262); /* #0b172c */
  --navy-900: oklch(0.255 0.062 261); /* #112240  header */
  --navy-850: oklch(0.29 0.072 260);  /* #152a4f */
  --navy-800: oklch(0.33 0.085 259);  /* #183460  primary */
  --navy-700: oklch(0.41 0.1 258);    /* #254a80 */
  --navy-600: oklch(0.49 0.105 257);  /* #37619b  links, focus */
  --navy-500: oklch(0.58 0.09 256);   /* #567caf */
  --navy-400: oklch(0.68 0.07 256);   /* #7c9ac3 */
  --navy-300: oklch(0.78 0.05 256);   /* #a3b9d8 */
  --navy-200: oklch(0.87 0.03 257);   /* #c8d5e8 */
  --navy-100: oklch(0.925 0.02 257);  /* #dee7f4 */
  --navy-50:  oklch(0.965 0.01 257);  /* #eff4fa */

  /* Gold (attention) */
  --gold-700: oklch(0.47 0.095 72);   /* #7b510d  text */
  --gold-600: oklch(0.53 0.105 76);   /* #8e6212 */
  --gold-500: oklch(0.77 0.14 82);    /* #e0aa38  fills, rule */
  --gold-300: oklch(0.86 0.1 88);     /* #ecce83 */
  --gold-100: oklch(0.945 0.045 92);  /* #f7edcb */
  --gold-50:  oklch(0.975 0.022 94);  /* #fbf7e7 */

  /* Crimson (danger only) */
  --red-700: oklch(0.45 0.155 25);    /* #992225 */
  --red-600: oklch(0.52 0.18 26);     /* #ba2b2b */
  --red-200: oklch(0.86 0.06 22);
  --red-100: oklch(0.93 0.035 22);    /* #ffdfdd */
  --red-50:  oklch(0.968 0.016 20);   /* #fff0f0 */

  /* Green (done) */
  --green-700: oklch(0.46 0.1 155);   /* #1b683e */
  --green-200: oklch(0.87 0.06 155);
  --green-100: oklch(0.935 0.04 155); /* #d6f2de */
  --green-50:  oklch(0.97 0.02 155);  /* #ebf9ef */

  /* Blue ballpoint ink — signed names */
  --ink-blue: oklch(0.43 0.16 264);   /* #2047a6 */

  /* Neutrals, tinted toward navy */
  --ink:   oklch(0.23 0.025 262);     /* #161d29 */
  --ink-2: oklch(0.37 0.022 262);     /* #39404c */
  --ink-3: oklch(0.49 0.018 262);     /* #5b616b  ≥ 5.4:1 on every surface */
  --line:  oklch(0.905 0.008 262);    /* #dde0e5 */
  --line-2: oklch(0.83 0.012 262);    /* #c3c7cf */
  --line-input: oklch(0.63 0.016 262);/* ≥ 3:1 on white (form borders) */
  --bg: oklch(0.972 0.005 262);       /* #f4f6f9  workspace */
  --surface: #ffffff;
  --surface-2: oklch(0.984 0.004 262);/* #f8fafd  table heads */
  --surface-3: oklch(0.952 0.007 262);/* #eceff4  sunk */
  --row-hover: oklch(0.982 0.008 257);

  /* Semantic */
  --primary: var(--navy-800);
  --primary-hover: var(--navy-700);
  --primary-press: var(--navy-900);
  --link: var(--navy-600);
  --focus: var(--navy-600);
  --focus-on-dark: var(--gold-500);

  /* Charts (red–green colour-blind safe: navy + gold + hatching) */
  --c-actual: var(--navy-700);
  --c-plan: var(--gold-500);
  --c-commit: var(--navy-400);
  --c-second: var(--navy-300);
  --c-remain: var(--surface-3);
  --c-over: var(--red-600);
  --c-grid: oklch(0.92 0.006 262);

  /* Type */
  --font-ui: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", "Noto Sans", Arial, sans-serif;
  --font-display: "Sitka Heading", "Sitka Text", Cambria, Georgia, "Noto Serif", "Times New Roman", serif;
  --font-doc: "Times New Roman", Times, "Liberation Serif", "Noto Serif", serif;
  --font-mono: Consolas, "Cascadia Mono", "SF Mono", Menlo, ui-monospace, monospace;

  --text-2xs: 0.75rem;     /* 12   meta, legend */
  --text-xs: 0.8125rem;    /* 13   labels, table heads */
  --text-sm: 0.875rem;     /* 14   tables, secondary */
  --text-md: 0.9375rem;    /* 15   UI body (desktop) */
  --text-lg: 1.0625rem;    /* 17   section titles */
  --text-xl: 1.25rem;      /* 20 */
  --text-2xl: 1.625rem;    /* 26   page titles (display) */
  --text-3xl: 2rem;        /* 32   figures */
  --text-4xl: 2.5rem;      /* 40   dashboard equation */

  /* Space (4px base) */
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px; --sp-5: 20px;
  --sp-6: 24px; --sp-8: 32px; --sp-10: 40px; --sp-12: 48px; --sp-16: 64px;

  /* Radius */
  --r-1: 2px;   /* stamps, flags */
  --r-2: 4px;   /* controls */
  --r-3: 8px;   /* panels, sheets */
  --r-4: 12px;  /* dialogs, bottom sheets */

  /* Elevation */
  --shadow-1: 0 1px 2px oklch(0.25 0.06 261 / 0.06), 0 1px 1px oklch(0.25 0.06 261 / 0.04);
  --shadow-sheet: 0 1px 0 oklch(0.25 0.06 261 / 0.03), 0 3px 10px oklch(0.25 0.06 261 / 0.06);
  --shadow-2: 0 10px 28px oklch(0.25 0.06 261 / 0.15), 0 2px 6px oklch(0.25 0.06 261 / 0.08);
  --shadow-3: 0 24px 64px oklch(0.2 0.05 262 / 0.3), 0 4px 12px oklch(0.2 0.05 262 / 0.12);

  /* Layers */
  --z-sticky: 10; --z-header: 30; --z-dropdown: 40; --z-drawer: 60;
  --z-backdrop: 70; --z-dialog: 80; --z-toast: 90; --z-tooltip: 100;

  /* Motion */
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --dur-1: 120ms; --dur-2: 180ms; --dur-3: 240ms;

  /* Layout */
  --hd-h: 56px;
  --rule-h: 2px;
  --sb-w: 264px;
  --page-pad: 32px;
  --sticky-top: calc(var(--hd-h) + var(--rule-h));
}

/* -------------------------------------------------------------------------
   2. Base
   ------------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-ui);
  font-size: var(--text-md);
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
  font-kerning: normal;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { margin: 0; line-height: 1.25; font-weight: 600; text-wrap: balance; }
h1 { font-family: var(--font-display); font-size: var(--text-2xl); letter-spacing: -0.005em; font-weight: 600; }
h2 { font-size: var(--text-lg); }
h3 { font-size: var(--text-md); }
p { margin: 0; text-wrap: pretty; }
ul, ol { margin: 0; padding: 0; }
a { color: var(--link); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { color: var(--navy-800); }
small { font-size: var(--text-xs); }
hr { border: 0; border-top: 1px solid var(--line); margin: var(--sp-4) 0; }
button { font: inherit; color: inherit; }
img, svg { display: block; }
table { font-variant-numeric: tabular-nums; }
abbr[title] { text-decoration: none; }
[hidden] { display: none !important; }

:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: var(--r-1); }
.on-dark :focus-visible, .hd :focus-visible, .ph-top :focus-visible { outline-color: var(--focus-on-dark); }

.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip { position: absolute; left: 12px; top: -48px; z-index: var(--z-tooltip); padding: 8px 14px; background: var(--surface); color: var(--navy-800); font-weight: 600; border-radius: var(--r-2); box-shadow: var(--shadow-2); text-decoration: none; transition: top var(--dur-2) var(--ease-out); }
.skip:focus { top: 10px; }

/* -------------------------------------------------------------------------
   3. Utilities
   ------------------------------------------------------------------------- */
.row { display: flex; align-items: center; gap: var(--sp-2); }
.row-3 { display: flex; align-items: center; gap: var(--sp-3); }
.row-wrap { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); }
.between { justify-content: space-between; }
.end { justify-content: flex-end; }
.grow { flex: 1 1 auto; min-width: 0; }
.stack > * + * { margin-top: var(--sp-3); }
.stack-4 > * + * { margin-top: var(--sp-4); }
.stack-6 > * + * { margin-top: var(--sp-6); }
.stack-8 > * + * { margin-top: var(--sp-8); }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-4); }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--sp-4); }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--sp-4); }
.mt-2 { margin-top: var(--sp-2); } .mt-3 { margin-top: var(--sp-3); } .mt-4 { margin-top: var(--sp-4); }
.mt-6 { margin-top: var(--sp-6); } .mt-8 { margin-top: var(--sp-8); }
.mb-0 { margin-bottom: 0 !important; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tnum { font-variant-numeric: tabular-nums; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.muted { color: var(--ink-3); }
.ink-2 { color: var(--ink-2); }
.strong, b, strong { font-weight: 600; }
.neg { color: var(--red-700); }
.code { font-variant-numeric: tabular-nums; letter-spacing: 0.01em; color: var(--ink-2); white-space: nowrap; }
.mono { font-family: var(--font-mono); font-size: 0.92em; }
.cur { font-size: 0.86em; color: var(--ink-3); font-weight: 500; }
.t-xs { font-size: var(--text-xs); } .t-sm { font-size: var(--text-sm); } .t-2xs { font-size: var(--text-2xs); }
.bil { display: block; font-size: var(--text-2xs); color: var(--ink-3); font-style: italic; font-weight: 400; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* -------------------------------------------------------------------------
   4. Icons
   ------------------------------------------------------------------------- */
.i { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; display: inline-block; vertical-align: -3px; }
.i-sm { width: 15px; height: 15px; vertical-align: -2px; }
.i-xs { width: 13px; height: 13px; vertical-align: -1px; }
.i-lg { width: 22px; height: 22px; }
.i-xl { width: 28px; height: 28px; }
.i-2xl { width: 40px; height: 40px; stroke-width: 1.5; }

/* -------------------------------------------------------------------------
   5. Buttons
   ------------------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 38px; padding: 0 16px;
  font-family: var(--font-ui); font-size: var(--text-md); font-weight: 600; line-height: 1;
  color: var(--ink); background: var(--surface);
  border: 1px solid var(--line-input); border-radius: var(--r-2);
  cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background-color var(--dur-1) var(--ease-out), border-color var(--dur-1) var(--ease-out), color var(--dur-1) var(--ease-out), box-shadow var(--dur-1) var(--ease-out);
}
.btn:hover { background: var(--surface-2); border-color: var(--ink-3); color: var(--ink); }
.btn:active { background: var(--surface-3); transform: translateY(1px); }
.btn[disabled], .btn.is-disabled, .btn[aria-disabled="true"] { opacity: 0.45; cursor: not-allowed; transform: none; }
.btn .i { margin-left: -2px; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); color: #fff; }
.btn-primary:active { background: var(--primary-press); border-color: var(--primary-press); }
.btn-danger { color: var(--red-700); border-color: var(--red-200); background: var(--surface); }
.btn-danger:hover { background: var(--red-50); border-color: var(--red-700); color: var(--red-700); }
.btn-danger-solid { background: var(--red-600); border-color: var(--red-600); color: #fff; }
.btn-danger-solid:hover { background: var(--red-700); border-color: var(--red-700); color: #fff; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--surface-3); border-color: transparent; }
.btn-quiet { background: var(--surface-3); border-color: transparent; color: var(--ink); }
.btn-quiet:hover { background: var(--line); border-color: transparent; }
.btn-link { background: none; border: 0; padding: 0; min-height: 0; color: var(--link); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.btn-link:hover { background: none; color: var(--navy-800); }
.btn-sm { min-height: 32px; padding: 0 12px; font-size: var(--text-sm); gap: 6px; }
.btn-lg { min-height: 46px; padding: 0 20px; font-size: 1rem; }
.btn-xl { min-height: 52px; padding: 0 22px; font-size: 1.0625rem; }
.btn-block { width: 100%; }
.btn-icon { width: 38px; padding: 0; }
.btn-icon .i { margin: 0; }
.btn-sm.btn-icon { width: 32px; }
.btn-group { display: inline-flex; }
.btn-group .btn { border-radius: 0; }
.btn-group .btn + .btn { margin-left: -1px; }
.btn-group .btn:first-child { border-radius: var(--r-2) 0 0 var(--r-2); }
.btn-group .btn:last-child { border-radius: 0 var(--r-2) var(--r-2) 0; }
.btn.is-loading { position: relative; color: transparent !important; pointer-events: none; }
.btn.is-loading::after { content: ""; position: absolute; width: 16px; height: 16px; border: 2px solid currentColor; border-color: #fff #fff transparent transparent; border-radius: 50%; animation: spin 0.7s linear infinite; }
.btn:not(.btn-primary):not(.btn-danger-solid).is-loading::after { border-color: var(--ink-3) var(--ink-3) transparent transparent; }
@keyframes spin { to { transform: rotate(360deg); } }
.kbd { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 5px; font: 600 11px/1 var(--font-ui); color: var(--navy-200); border: 1px solid var(--navy-700); border-radius: var(--r-1); }

/* -------------------------------------------------------------------------
   6. Forms
   ------------------------------------------------------------------------- */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .label { font-size: var(--text-xs); font-weight: 600; color: var(--ink-2); }
.label .opt { font-weight: 400; color: var(--ink-3); }
.req::after { content: " *"; color: var(--ink-2); }
.input, .select, .textarea {
  width: 100%; min-height: 40px; padding: 8px 12px;
  font-family: var(--font-ui); font-size: var(--text-md); line-height: 1.4; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line-input); border-radius: var(--r-2);
  transition: border-color var(--dur-1) var(--ease-out), box-shadow var(--dur-1) var(--ease-out);
}
.input::placeholder, .textarea::placeholder, .grid-cell-input::placeholder { color: var(--ink-3); opacity: 1; }
.textarea { min-height: 84px; resize: vertical; }
.select { appearance: none; padding-right: 34px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2339404c' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 11px center; }
.input:hover, .select:hover, .textarea:hover { border-color: var(--ink-2); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--navy-600); box-shadow: 0 0 0 3px var(--navy-100); }
.input[readonly], .input:disabled, .select:disabled, .textarea[readonly] { background: var(--surface-3); color: var(--ink-2); border-color: var(--line-2); cursor: default; }
.input.num { text-align: right; font-variant-numeric: tabular-nums; }
.input.is-invalid, .select.is-invalid, .textarea.is-invalid { border-color: var(--red-700); box-shadow: 0 0 0 3px var(--red-100); }
.input.is-warn { border-color: var(--gold-600); box-shadow: 0 0 0 3px var(--gold-100); }
.hint { font-size: var(--text-xs); color: var(--ink-3); }
.err { display: flex; gap: 6px; align-items: flex-start; font-size: var(--text-xs); font-weight: 600; color: var(--red-700); }
.err .i { width: 15px; height: 15px; margin-top: 1px; }
.warn-text { display: flex; gap: 6px; align-items: flex-start; font-size: var(--text-xs); font-weight: 600; color: var(--gold-700); }
.warn-text .i { width: 15px; height: 15px; margin-top: 1px; }
.affix { display: flex; align-items: stretch; }
.affix .input { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.affix-r { display: inline-flex; align-items: center; padding: 0 12px; border: 1px solid var(--line-input); border-left: 0; border-radius: 0 var(--r-2) var(--r-2) 0; background: var(--surface-3); color: var(--ink-2); font-size: var(--text-sm); font-weight: 600; white-space: nowrap; }
.search { position: relative; }
.search > .i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--ink-3); pointer-events: none; }
.search .input { padding-left: 38px; }
.pw { position: relative; }
.pw .input { padding-right: 48px; }
.pw-toggle { position: absolute; top: 0; right: 0; bottom: 0; width: 46px; display: grid; place-items: center; border: 0; background: none; color: var(--ink-3); cursor: pointer; border-radius: 0 var(--r-2) var(--r-2) 0; }
.pw-toggle:hover { color: var(--navy-700); }
.date { position: relative; display: inline-block; vertical-align: top; }
.field .date, .form-grid .date { display: block; }
.date .input { padding-right: 40px; font-variant-numeric: tabular-nums; }
.date > .i { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: var(--ink-3); pointer-events: none; }
.check, .radio { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: var(--text-md); line-height: 1.35; }
.check input, .radio input { width: 18px; height: 18px; margin: 0; accent-color: var(--navy-800); flex: none; }
.check-row { display: flex; flex-wrap: wrap; gap: 8px 22px; }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
legend { padding: 0; }
.fs-legend { font-size: var(--text-xs); font-weight: 600; color: var(--ink-2); margin-bottom: 8px; }
.form-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 16px 20px; }
.c-3 { grid-column: span 3; } .c-4 { grid-column: span 4; } .c-5 { grid-column: span 5; } .c-6 { grid-column: span 6; }
.c-7 { grid-column: span 7; } .c-8 { grid-column: span 8; } .c-9 { grid-column: span 9; } .c-12 { grid-column: 1 / -1; }

/* Segmented control */
.seg { display: inline-flex; padding: 3px; gap: 2px; background: var(--surface-3); border-radius: var(--r-2); border: 1px solid var(--line); }
.seg label, .seg button, .seg a { position: relative; display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 0 14px; font-size: var(--text-sm); font-weight: 600; color: var(--ink-2); background: none; border: 0; border-radius: 3px; cursor: pointer; text-decoration: none; white-space: nowrap; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label:has(input:checked), .seg .is-on, .seg [aria-pressed="true"], .seg [aria-selected="true"] { background: var(--surface); color: var(--navy-800); box-shadow: var(--shadow-1), 0 0 0 1px var(--line); }
.seg label:has(input:focus-visible) { outline: 2px solid var(--focus); outline-offset: 1px; }

/* Choice tiles (YCTT purpose grid mirrors the form's 3 × 3 boxes) */
.tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.tile { position: relative; display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 8px 12px; background: var(--surface); border: 1px solid var(--line-input); border-radius: var(--r-2); cursor: pointer; line-height: 1.25; }
.tile input { position: absolute; opacity: 0; }
.tile .box { width: 18px; height: 18px; flex: none; border: 1.5px solid var(--line-input); border-radius: 50%; display: grid; place-items: center; background: #fff; }
.tile strong { display: block; font-size: var(--text-sm); }
.tile small { display: block; font-size: var(--text-2xs); color: var(--ink-3); font-style: italic; }
.tile:hover { border-color: var(--ink-2); }
.tile:has(input:checked) { border-color: var(--navy-700); background: var(--navy-50); box-shadow: inset 0 0 0 1px var(--navy-700); }
.tile:has(input:checked) .box { border-color: var(--navy-800); background: var(--navy-800); box-shadow: inset 0 0 0 3px #fff; }
.tile:has(input:focus-visible) { outline: 2px solid var(--focus); outline-offset: 2px; }

/* File drop */
.drop { display: flex; align-items: center; gap: 14px; padding: 16px 18px; border: 1.5px dashed var(--line-input); border-radius: var(--r-3); background: var(--surface-2); color: var(--ink-2); }
.drop .i { color: var(--navy-600); }
.drop strong { color: var(--ink); }
.drop .hint { margin-top: 2px; }

/* -------------------------------------------------------------------------
   7. Shell — desktop (header + sidebar)
   ------------------------------------------------------------------------- */
.app { min-height: 100vh; }
.hd {
  position: sticky; top: 0; z-index: var(--z-header);
  display: flex; align-items: center; gap: var(--sp-5);
  height: var(--hd-h); padding-right: var(--sp-5);
  background: var(--navy-900); color: #fff;
  border-bottom: var(--rule-h) solid var(--gold-500);
  box-sizing: content-box;
}
.hd-brand { display: flex; align-items: center; gap: 10px; width: var(--sb-w); flex: none; height: 100%; padding: 0 16px; color: #fff; text-decoration: none; }
.hd-brand:hover { color: #fff; }
.crest { width: 34px; height: 34px; flex: none; }
.hd-brand strong { display: block; font-family: var(--font-display); font-size: 0.96875rem; font-weight: 600; letter-spacing: 0; line-height: 1.15; white-space: nowrap; }
.hd-brand small { display: block; font-size: 11.5px; color: var(--navy-200); line-height: 1.3; letter-spacing: 0.01em; }
.hd-menu { display: none; width: 44px; height: 44px; margin-left: 6px; border: 0; background: none; color: #fff; border-radius: var(--r-2); cursor: pointer; place-items: center; }
.hd-search { position: relative; flex: 0 1 400px; }
.hd-search .i { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--navy-300); pointer-events: none; }
.hd-search input { width: 100%; height: 36px; padding: 0 44px 0 36px; font: inherit; font-size: var(--text-sm); color: #fff; background: var(--navy-850); border: 1px solid var(--navy-700); border-radius: var(--r-2); }
.hd-search input::placeholder { color: var(--navy-300); }
.hd-search input:focus { outline: none; border-color: var(--gold-500); background: var(--navy-950); }
.hd-search .kbd { position: absolute; right: 9px; top: 50%; transform: translateY(-50%); }
.hd-right { margin-left: auto; display: flex; align-items: center; gap: var(--sp-3); }
.hd-year { display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 12px; font-size: var(--text-sm); color: var(--navy-100); background: transparent; border: 1px solid var(--navy-700); border-radius: var(--r-2); cursor: pointer; }
.hd-year b { color: #fff; font-weight: 600; }
.hd-year .dot { width: 7px; height: 7px; border-radius: 50%; background: oklch(0.78 0.13 155); }
.hd-year:hover { border-color: var(--navy-400); }
.hd-new { display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 13px; font-size: var(--text-sm); font-weight: 600; color: var(--navy-950); background: #fff; border: 0; border-radius: var(--r-2); cursor: pointer; text-decoration: none; }
.hd-new:hover { background: var(--navy-100); color: var(--navy-950); }
.hd-user { display: flex; align-items: center; gap: 10px; padding: 4px 6px 4px 4px; border-radius: var(--r-2); color: #fff; text-decoration: none; }
.hd-user:hover { background: var(--navy-850); color: #fff; }
.avatar { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; flex: none; font-size: 12.5px; font-weight: 700; letter-spacing: 0.02em; color: #fff; background: var(--navy-600); }
.hd-user .who { line-height: 1.25; }
.hd-user .who strong { display: block; font-size: 13.5px; font-weight: 600; }
.hd-user .who small { display: block; font-size: 12px; color: var(--navy-200); }
.hd-user .i { color: var(--navy-300); }

.body { display: grid; grid-template-columns: var(--sb-w) minmax(0, 1fr); align-items: start; }
.sb {
  position: sticky; top: var(--sticky-top);
  height: calc(100vh - var(--sticky-top)); overflow-y: auto;
  display: flex; flex-direction: column;
  padding: 14px 12px 16px;
  background: var(--surface); border-right: 1px solid var(--line);
}
.nav { flex: 1; }
.nav-group + .nav-group { margin-top: 14px; }
.nav-label { padding: 0 10px 5px; font-size: 12.5px; font-weight: 600; color: var(--ink-3); }
.nav a {
  display: flex; align-items: center; gap: 11px;
  min-height: 38px; padding: 0 10px; margin: 1px 0;
  font-size: 14.5px; font-weight: 500; color: var(--ink-2); text-decoration: none;
  border-radius: var(--r-2);
  transition: background-color var(--dur-1) var(--ease-out), color var(--dur-1) var(--ease-out);
}
.nav a .i { color: var(--ink-3); }
.nav a:hover { background: var(--surface-3); color: var(--ink); }
.nav a[aria-current="page"] { background: var(--navy-50); color: var(--navy-800); font-weight: 600; box-shadow: inset 0 0 0 1px var(--navy-100); }
.nav a[aria-current="page"] .i { color: var(--navy-700); }
.nav .badge { margin-left: auto; }
.badge { display: inline-grid; place-items: center; min-width: 22px; height: 20px; padding: 0 6px; font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--ink-2); background: var(--surface-3); border-radius: var(--r-1); }
.badge-due { color: #fff; background: var(--navy-800); }
.sb-foot { margin-top: 16px; padding: 12px 10px 0; border-top: 1px solid var(--line); font-size: var(--text-xs); color: var(--ink-3); line-height: 1.45; }
.sb-foot strong { color: var(--ink-2); font-weight: 600; }

.main { min-width: 0; }
.page { padding: 22px var(--page-pad) 72px; max-width: 1440px; }
.page-wide { max-width: none; }
.crumbs { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; font-size: var(--text-xs); color: var(--ink-3); }
.crumbs a { color: var(--ink-3); text-decoration: none; }
.crumbs a:hover { color: var(--navy-700); text-decoration: underline; }
.crumbs .sep { color: var(--line-2); }
.crumbs [aria-current="page"] { color: var(--ink-2); font-weight: 600; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--sp-6); margin-bottom: var(--sp-6); flex-wrap: wrap; }
.page-head .lede { margin-top: 6px; color: var(--ink-3); max-width: 72ch; }
.page-head .lede b { color: var(--ink-2); }
.page-actions { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; }
.title-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

/* -------------------------------------------------------------------------
   8. Shell — phone (390 × 844)
   ------------------------------------------------------------------------- */
body.ph { font-size: 1rem; background: var(--bg); max-width: 480px; margin: 0 auto; min-height: 100vh; position: relative; }
html:has(body.ph) { background: oklch(0.88 0.012 262); }
.ph-top {
  position: sticky; top: 0; z-index: var(--z-header);
  display: flex; align-items: center; gap: 4px;
  min-height: 56px; padding: 0 6px 0 4px;
  background: var(--navy-900); color: #fff;
  border-bottom: var(--rule-h) solid var(--gold-500);
}
.ph-top h1 { flex: 1; min-width: 0; font-family: var(--font-ui); font-size: 1.0625rem; font-weight: 600; letter-spacing: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ph-top .sub { display: block; font-size: 12px; font-weight: 400; color: var(--navy-200); line-height: 1.2; }
.ph-top .crest { width: 30px; height: 30px; margin: 0 6px 0 8px; }
.ph-icon { width: 44px; height: 44px; display: grid; place-items: center; flex: none; color: #fff; background: none; border: 0; border-radius: var(--r-2); text-decoration: none; cursor: pointer; }
.ph-icon:hover { background: var(--navy-850); color: #fff; }
.ph-icon .i { width: 22px; height: 22px; }
.ph-page { padding: 16px 16px 96px; }
.ph-page.has-act { padding-bottom: 112px; }
.ph .btn { min-height: 44px; font-size: 1rem; }
.ph .btn-sm { min-height: 44px; font-size: 0.9375rem; }
.ph .input, .ph .select, .ph .textarea { min-height: 48px; font-size: 1rem; }
.ph .field > label, .ph .label { font-size: 0.9375rem; }

.tabbar {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 0; z-index: var(--z-header);
  width: 100%; max-width: 480px;
  display: grid; grid-template-columns: repeat(var(--n, 5), 1fr); align-items: stretch;
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--surface); border-top: 1px solid var(--line-2);
}
.tabbar a { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-height: 64px; font-size: 12px; font-weight: 600; color: var(--ink-3); text-decoration: none; }
.tabbar a .i { width: 23px; height: 23px; }
.tabbar a[aria-current="page"] { color: var(--navy-800); }
.tabbar a[aria-current="page"]::before { content: ""; position: absolute; top: -1px; left: 26%; right: 26%; height: 3px; border-radius: 0 0 2px 2px; background: var(--navy-800); }
.tabbar .tab-badge { position: absolute; top: 7px; left: calc(50% + 6px); min-width: 19px; height: 19px; padding: 0 5px; display: grid; place-items: center; font-size: 11px; font-weight: 700; color: #fff; background: var(--navy-800); border-radius: 10px; box-shadow: 0 0 0 2px var(--surface); }
.tabbar .tab-new { align-self: center; justify-self: center; width: 52px; height: 52px; min-height: 0; border-radius: 50%; color: #fff; background: var(--navy-800); box-shadow: 0 6px 16px oklch(0.25 0.06 261 / 0.3); margin-top: -18px; }
.tabbar .tab-new .i { width: 26px; height: 26px; stroke-width: 2; }

.actbar {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 0; z-index: var(--z-header);
  width: 100%; max-width: 480px;
  display: grid; grid-template-columns: 1fr 1.35fr; gap: 10px;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: var(--surface); border-top: 1px solid var(--line-2);
  box-shadow: 0 -8px 20px oklch(0.25 0.06 261 / 0.08);
}
.actbar .btn { min-height: 52px; font-size: 1.0625rem; }
.actbar-note { grid-column: 1 / -1; font-size: 13px; color: var(--ink-3); text-align: center; margin: -2px 0 0; }

/* -------------------------------------------------------------------------
   9. Surfaces: panels, sheets, sections
   ------------------------------------------------------------------------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-3); }
.panel-hd { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); min-height: 54px; padding: 12px 18px; border-bottom: 1px solid var(--line); }
.panel-hd h2 { font-size: var(--text-lg); }
.panel-hd .sub { font-size: var(--text-xs); color: var(--ink-3); margin-top: 2px; }
.panel-bd { padding: 18px; }
.panel-ft { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 18px; border-top: 1px solid var(--line); background: var(--surface-2); border-radius: 0 0 var(--r-3) var(--r-3); font-size: var(--text-xs); color: var(--ink-3); }
.panel-flush > .tbl-wrap, .panel-flush > .tbl { border-radius: 0 0 var(--r-3) var(--r-3); }

/* A document rendered as a numbered sheet */
.sheet { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-3); box-shadow: var(--shadow-sheet); }
.sheet-hd { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 20px; align-items: start; padding: 22px 26px 18px; border-bottom: 1px solid var(--line); }
.doc-title { display: flex; align-items: flex-start; gap: 14px; }
.doc-title .stamp { margin-top: 5px; }
.doc-title h1, .doc-title h2.doc-h { font-family: var(--font-display); font-size: 1.5rem; font-weight: 600; line-height: 1.2; }
.doc-title .bil { font-size: var(--text-xs); margin-top: 2px; }
.doc-no { text-align: right; }
.doc-no .lbl { font-size: var(--text-2xs); color: var(--ink-3); }
.doc-no .val { display: block; font-size: 1.1875rem; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: 0.01em; color: var(--ink); }
.doc-no .val.pending { font-size: var(--text-md); font-weight: 500; color: var(--ink-3); font-style: italic; }
.doc-no .date { display: block; margin-top: 2px; font-size: var(--text-sm); color: var(--ink-2); }
.sheet-sec { padding: 18px 26px; border-bottom: 1px solid var(--line); }
.sheet-sec:last-child { border-bottom: 0; }
.sheet-sec.flush { padding: 0; }
.sec-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.sec-title h2, .sec-title h3 { font-size: var(--text-md); font-weight: 600; color: var(--ink); }
.sec-title .bil { display: inline; margin-left: 6px; }
.sheet-sec.flush .sec-title { padding: 16px 26px 0; }

/* Key–value grid (document header fields) */
.kv { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px 24px; margin: 0; }
.kv > div { min-width: 0; }
.kv dt { font-size: var(--text-xs); color: var(--ink-3); }
.kv dd { margin: 2px 0 0; font-weight: 500; color: var(--ink); overflow-wrap: anywhere; }
.kv .span-2 { grid-column: span 2; } .kv .span-4 { grid-column: 1 / -1; }
.kv dd .muted { font-weight: 400; }
.kv-list { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 8px 14px; margin: 0; font-size: var(--text-sm); }
.kv-list dt { color: var(--ink-3); }
.kv-list dd { margin: 0; font-weight: 500; }

/* Two-column document layout: sheet + decision aside */
.doc-layout { display: grid; grid-template-columns: minmax(0, 1fr) 344px; gap: 24px; align-items: start; }
.aside { position: sticky; top: calc(var(--sticky-top) + 16px); display: flex; flex-direction: column; gap: 16px; }
.aside-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-3); }
.aside-card > header { padding: 14px 16px 0; }
.aside-card > header h2 { font-size: var(--text-sm); font-weight: 600; color: var(--ink-2); }
.aside-bd { padding: 12px 16px 16px; }

/* Decision panel (who holds the document + approve/reject) */
.decide { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-3); overflow: hidden; }
.decide-state { padding: 16px 16px 14px; border-bottom: 1px solid var(--line); }
.decide-state .st { font-size: var(--text-md); }
.decide-holder { margin-top: 10px; font-size: var(--text-sm); color: var(--ink-2); }
.decide-holder strong { color: var(--ink); }
.decide-sum { display: grid; grid-template-columns: 1fr auto; align-items: baseline; gap: 6px 12px; margin: 0; padding: 14px 16px; border-bottom: 1px solid var(--line); font-size: var(--text-sm); }
.decide-sum dt { color: var(--ink-2); }
.decide-sum dd { margin: 0; text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.decide-sum .big { font-size: 1.25rem; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--ink); }
.decide-act { padding: 14px 16px 16px; display: grid; gap: 10px; background: var(--surface-2); }
.decide-act .two { display: grid; grid-template-columns: 1fr 1.3fr; gap: 10px; }
.decide.is-mine { border-color: var(--gold-300); box-shadow: 0 0 0 3px var(--gold-50); }
.decide.is-mine .decide-state { background: var(--gold-50); }

/* -------------------------------------------------------------------------
   10. Tables
   ------------------------------------------------------------------------- */
.tbl-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: separate; border-spacing: 0; font-size: var(--text-sm); }
.tbl caption { text-align: left; }
.tbl th, .tbl td { padding: 10px 12px; text-align: left; vertical-align: middle; border-bottom: 1px solid var(--line); }
.tbl thead th {
  position: sticky; top: var(--th-top, 0); z-index: 2;
  background: var(--surface-2); color: var(--ink-2);
  font-size: var(--text-xs); font-weight: 600; line-height: 1.3;
  border-bottom: 1px solid var(--line-2); white-space: nowrap;
}
.tbl thead th small { display: block; font-weight: 400; color: var(--ink-3); }
.tbl-sticky thead th { --th-top: var(--sticky-top); }
/* A sticky header sticks to the page, so its wrapper must not become a scroll container.
   List tables are sized for the 1440 office frame; narrower windows scroll them sideways instead. */
@media (min-width: 1400px) { .tbl-wrap:has(> .tbl-sticky) { overflow: visible; } }
@media (min-width: 1024px) { .tbl-wrap:has(> .lines) { overflow: visible; } }
@media (max-width: 1399px) { .tbl-sticky thead th { --th-top: 0px; } }
@media (max-width: 1023px) { .tbl-wrap > .lines thead th { top: 0; } }
.tbl thead tr.th-group th { text-align: center; border-bottom: 1px solid var(--line); background: var(--surface-3); }
.tbl tbody tr { transition: background-color var(--dur-1) var(--ease-out); }
.tbl tbody tr:hover > td { background: var(--row-hover); }
.tbl td.num, .tbl th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tbl th.center, .tbl td.center { text-align: center; }
.tbl td.chk, .tbl th.chk { width: 44px; padding-right: 0; }
.tbl td .sub { display: block; font-size: var(--text-xs); color: var(--ink-3); margin-top: 1px; }
.tbl td .sub.po-cov { display: flex; align-items: center; flex-wrap: wrap; gap: 2px 6px; margin-top: 5px; color: var(--ink-2); }
.tbl td .sub.po-cov .docno { font-size: var(--text-xs); }
.tbl td.wrap { white-space: normal; min-width: 220px; }
.tbl tr.is-selected > td, .tbl tr.is-selected > th { background: var(--navy-50); }
.tbl tr.is-over > td, .tbl tr.is-over > th { background: var(--red-50); }
.tbl tr.is-warn > td, .tbl tr.is-warn > th { background: var(--gold-50); }
.tbl tr.is-void > td { color: var(--ink-3); }
.tbl tr.is-void td .docno { text-decoration: line-through; text-decoration-color: var(--ink-3); }
.tbl tr.grp > td { background: var(--surface-3); font-weight: 600; color: var(--ink); border-bottom-color: var(--line-2); }
.tbl tr.grp:hover > td { background: var(--surface-3); }
.tbl tr.sub-total > td { font-weight: 600; background: var(--surface-2); }
.tbl tfoot td { font-weight: 700; background: var(--surface-2); border-top: 1px solid var(--ink-2); border-bottom: 0; }
.tbl tfoot tr:last-child td:first-child { border-bottom-left-radius: var(--r-3); }
.tbl tfoot tr:last-child td:last-child { border-bottom-right-radius: var(--r-3); }
.tbl-compact th, .tbl-compact td { padding: 7px 10px; }
.tbl-lines td { vertical-align: top; }
.tbl-lines .input, .tbl-lines .select { min-height: 34px; padding: 5px 9px; font-size: var(--text-sm); }
.tbl-lines td.stt { width: 40px; color: var(--ink-3); text-align: center; padding-top: 16px; }
.tbl-lines > tbody > tr > td:not(:has(input, select, button)) { padding-top: 16px; } /* first text line meets the input text line */
.tbl .row-act { display: flex; justify-content: flex-end; gap: 2px; }
.tbl a.amt { color: inherit; text-decoration: none; border-bottom: 1px dotted var(--ink-3); }
.tbl a.amt:hover { color: var(--navy-700); border-bottom-color: var(--navy-700); }
.tbl .indent { padding-left: 32px; }
.sort { display: inline-flex; align-items: center; gap: 4px; color: inherit; text-decoration: none; }
.sort .i { width: 13px; height: 13px; color: var(--navy-600); }
.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 16px; font-size: var(--text-xs); color: var(--ink-3); border-top: 1px solid var(--line); background: var(--surface-2); border-radius: 0 0 var(--r-3) var(--r-3); }
.pager .btn { min-height: 30px; }

/* -------------------------------------------------------------------------
   11. Status vocabulary
   ------------------------------------------------------------------------- */
/* Document type seal */
.stamp {
  display: inline-grid; place-items: center; flex: none;
  min-width: 36px; height: 22px; padding: 0 5px;
  font-family: var(--font-ui); font-size: 11px; font-weight: 700; letter-spacing: 0.05em; line-height: 1;
  color: var(--navy-800); background: var(--surface);
  border: 1px solid var(--navy-700); border-radius: var(--r-1);
  box-shadow: inset 0 0 0 2px var(--surface), inset 0 0 0 3px var(--navy-200);
}
.stamp-lg { min-width: 46px; height: 28px; font-size: 13px; }

/* Document number: serial emphasised */
.docno { font-variant-numeric: tabular-nums; letter-spacing: 0.01em; white-space: nowrap; color: var(--ink-2); }
.docno b { color: var(--ink); font-weight: 700; }
a.docno { color: var(--navy-700); text-decoration: none; }
a.docno b { color: var(--navy-800); }
a.docno:hover { text-decoration: underline; }
.docno.none { color: var(--ink-3); font-style: italic; }

/* Status text: glyph + words, colour never alone */
.st { display: inline-flex; align-items: center; gap: 6px; font-size: var(--text-sm); font-weight: 600; color: var(--ink-2); white-space: nowrap; }
.st .i { width: 16px; height: 16px; }
.st-draft { color: var(--ink-3); }
.st-wait { color: var(--navy-700); }
.st-buy { color: var(--navy-600); }
.st-ok { color: var(--green-700); }
.st-rej { color: var(--red-700); }
.st-void { color: var(--ink-3); }
.st-pay { color: var(--gold-700); }

/* Exception flags (only exceptions get a filled chip) */
.flag { display: inline-flex; align-items: center; gap: 4px; padding: 1px 7px; font-size: 12px; font-weight: 600; line-height: 18px; white-space: nowrap; border: 1px solid; border-radius: var(--r-1); }
.flag .i { width: 13px; height: 13px; }
.flag-over { color: var(--red-700); background: var(--red-50); border-color: var(--red-100); }
.flag-warn { color: var(--gold-700); background: var(--gold-50); border-color: var(--gold-300); }
.flag-info { color: var(--navy-700); background: var(--navy-50); border-color: var(--navy-100); }
.flag-ok { color: var(--green-700); background: var(--green-50); border-color: var(--green-100); }
.flag-muted { color: var(--ink-3); background: var(--surface-3); border-color: var(--line); }

/* Compact step tracker (lists) — the signature row in miniature */
.steps { display: inline-flex; gap: 3px; vertical-align: middle; }
.steps i { width: 13px; height: 6px; border-radius: 1px; background: var(--line-2); }
.steps i.done { background: var(--navy-700); }
.steps i.cur { background: var(--gold-500); box-shadow: 0 0 0 1px var(--gold-600); }
.steps i.rej { background: var(--red-600); }
.steps i.skip { background: var(--surface-3); box-shadow: inset 0 0 0 1px var(--line-2); }
.step-txt { display: inline-flex; align-items: center; gap: 8px; font-size: var(--text-xs); color: var(--ink-2); white-space: nowrap; }
.step-txt b { color: var(--ink); font-weight: 600; }

/* The signature row ("hàng ô ký") — mirrors the paper form */
.oky { list-style: none; display: grid; grid-template-columns: repeat(var(--n, 6), minmax(0, 1fr)); margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--r-2); overflow: hidden; }
.oky > li { position: relative; display: flex; flex-direction: column; gap: 4px; min-height: 132px; padding: 11px 13px 12px; border-right: 1px solid var(--line); }
.oky > li:last-child { border-right: 0; }
.oky-role { font-size: var(--text-xs); font-weight: 600; color: var(--ink-2); line-height: 1.3; padding-right: 22px; }
.oky-role small { display: block; font-size: 11.5px; font-weight: 400; font-style: italic; color: var(--ink-3); }
.oky-n { position: absolute; top: 10px; right: 11px; min-width: 18px; height: 18px; display: grid; place-items: center; font-size: 11px; font-weight: 700; color: var(--ink-3); border: 1px solid var(--line-2); border-radius: 50%; }
.oky-sign { margin-top: auto; font-family: var(--font-display); font-style: italic; font-size: 1.0625rem; line-height: 1.2; color: var(--ink-blue); }
.oky.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.oky.cols-3 > li { min-height: 118px; }
.oky.cols-3 > li:nth-child(3n) { border-right: 0; }
.oky.cols-3 > li:nth-child(-n+3) { border-bottom: 1px solid var(--line); }
.oky.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.oky.cols-4 > li:nth-child(4n) { border-right: 0; }
.oky.cols-4 > li:nth-child(-n+4):not(:nth-last-child(-n+4)) { border-bottom: 1px solid var(--line); }
.oky-group { display: grid; gap: 6px; }
.oky-group + .oky-group { margin-top: 14px; }
.oky-group > .lbl { font-size: var(--text-xs); font-weight: 700; color: var(--ink-2); }
.oky-meta { font-size: 12px; color: var(--ink-3); line-height: 1.35; }
.oky-line { margin-top: auto; height: 22px; border-bottom: 1px dotted var(--line-2); }
.oky-state { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; font-weight: 600; }
.oky > li.is-signed .oky-n { color: #fff; background: var(--navy-700); border-color: var(--navy-700); }
.oky > li.is-current { background: var(--gold-50); }
.oky > li.is-current::after { content: ""; position: absolute; inset: 5px; border: 1.5px dashed var(--gold-600); border-radius: 3px; pointer-events: none; }
.oky > li.is-current .oky-n { color: var(--gold-700); border-color: var(--gold-600); background: var(--surface); }
.oky > li.is-current .oky-state { color: var(--gold-700); margin-top: auto; }
.oky > li.is-rejected { background: var(--red-50); }
.oky > li.is-rejected .oky-n { color: #fff; background: var(--red-600); border-color: var(--red-600); }
.oky > li.is-rejected .oky-state { color: var(--red-700); margin-top: auto; }
.oky > li.is-skipped .oky-state, .oky > li.is-pending .oky-state { color: var(--ink-3); font-weight: 500; }
.oky > li.is-skipped { background: repeating-linear-gradient(135deg, var(--surface) 0 7px, var(--surface-2) 7px 14px); }
.oky > li.is-submit .oky-n { color: var(--navy-700); border-color: var(--navy-300); }
.oky-cap { display: flex; justify-content: space-between; gap: 12px; margin-top: 8px; font-size: 12px; color: var(--ink-3); }
.oky-wide { grid-column: 1 / -1; border-top: 1px solid var(--line); min-height: 96px !important; }

/* Document chain PR → PO → YCTT → phiếu kho */
.chain { list-style: none; display: grid; gap: 2px; margin: 0; padding: 0; }
.chain li { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 2px 10px; align-items: center; padding: 8px 0; border-bottom: 1px dashed var(--line); }
.chain li:last-child { border-bottom: 0; }
.chain .stamp { grid-row: span 2; }
.chain .chain-meta { font-size: var(--text-xs); color: var(--ink-3); }
.chain li.is-here .docno b { color: var(--ink); }
.chain-h { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.chain-h .arrow { color: var(--line-2); }
.chain-h a, .chain-h span.node { display: inline-flex; align-items: center; gap: 7px; padding: 5px 9px 5px 6px; border: 1px solid var(--line); border-radius: var(--r-2); background: var(--surface); text-decoration: none; font-size: var(--text-xs); color: var(--ink-2); }
.chain-h a:hover { border-color: var(--navy-300); background: var(--navy-50); }
.chain-h .node.is-here { border-color: var(--navy-300); box-shadow: inset 0 0 0 1px var(--navy-300); }

/* Rejection / state banners (full border + tint, never a side stripe) */
.banner { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: start; padding: 14px 16px; border: 1px solid; border-radius: var(--r-3); }
.banner > .i { margin-top: 1px; }
.banner h2, .banner strong.ttl { display: block; font-size: var(--text-md); font-weight: 700; }
.banner p { margin-top: 3px; }
.banner .meta { font-size: var(--text-xs); margin-top: 6px; opacity: 0.9; }
.banner-rej { background: var(--red-50); border-color: var(--red-200); color: var(--red-700); }
.banner-rej p { color: var(--ink); }
.banner-warn { background: var(--gold-50); border-color: var(--gold-300); color: var(--gold-700); }
.banner-warn p { color: var(--ink); }
.banner-info { background: var(--navy-50); border-color: var(--navy-100); color: var(--navy-800); }
.banner-info p { color: var(--ink-2); }
.banner-ok { background: var(--green-50); border-color: var(--green-100); color: var(--green-700); }
.banner-ok p { color: var(--ink-2); }
.banner-muted { background: var(--surface-3); border-color: var(--line-2); color: var(--ink-2); }
.note { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; font-size: var(--text-sm); border-radius: var(--r-2); background: var(--surface-3); color: var(--ink-2); }
.note .i { margin-top: 1px; color: var(--ink-3); }
.note-warn { background: var(--gold-50); color: var(--ink); box-shadow: inset 0 0 0 1px var(--gold-300); }
.note-warn .i { color: var(--gold-700); }
.note-over { background: var(--red-50); color: var(--ink); box-shadow: inset 0 0 0 1px var(--red-100); }
.note-over .i { color: var(--red-700); }
.note-info { background: var(--navy-50); color: var(--ink-2); box-shadow: inset 0 0 0 1px var(--navy-100); }
.note-info .i { color: var(--navy-600); }
.note-ok { background: var(--green-50); color: var(--ink-2); box-shadow: inset 0 0 0 1px var(--green-100); }
.note-ok .i { color: var(--green-700); }

/* -------------------------------------------------------------------------
   12. Budget: 5-number meter and figures
   ------------------------------------------------------------------------- */
.meter { position: relative; display: flex; height: 8px; background: var(--c-remain); border-radius: 2px; }
.meter > span { display: block; height: 100%; width: var(--w, 0%); }
.meter > span:first-child { border-radius: 2px 0 0 2px; }
.m-spent { background: var(--c-actual); }
.m-commit { background: repeating-linear-gradient(-45deg, var(--navy-600) 0 2px, var(--navy-200) 2px 5px); }
.m-prop { background: transparent; box-shadow: inset 0 0 0 1.5px var(--navy-400); background-image: repeating-linear-gradient(90deg, transparent 0 4px, var(--surface) 4px 6px); }
.m-over { background: var(--c-over); border-radius: 0 2px 2px 0; }
.meter-plan { position: absolute; top: -4px; bottom: -4px; left: var(--plan, 100%); width: 2px; margin-left: -1px; background: var(--ink); border-radius: 1px; }
.meter-lg { height: 12px; }
.meter-sm { height: 6px; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: var(--text-2xs); color: var(--ink-3); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.sw { width: 14px; height: 9px; border-radius: 1px; flex: none; }
.sw-spent { background: var(--c-actual); }
.sw-commit { background: repeating-linear-gradient(-45deg, var(--navy-600) 0 2px, var(--navy-200) 2px 5px); }
.sw-prop { box-shadow: inset 0 0 0 1.5px var(--navy-400); }
.sw-remain { background: var(--c-remain); box-shadow: inset 0 0 0 1px var(--line-2); }
.sw-over { background: var(--c-over); }
.sw-plan { width: 2px; height: 12px; background: var(--ink); }
.sw-gold { background: var(--c-plan); }
.sw-line-gold { width: 16px; height: 0; border-top: 2.5px solid var(--c-plan); border-radius: 0; }
.sw-line-navy { width: 16px; height: 0; border-top: 2.5px solid var(--c-actual); border-radius: 0; }
.sw-second { background: var(--c-second); }
.sw-hatch { background: repeating-linear-gradient(-45deg, var(--ink-3) 0 1.5px, var(--surface) 1.5px 4px); box-shadow: inset 0 0 0 1px var(--line-2); }

/* Five figures: kế hoạch · đang đề xuất · đã cam kết · đã chi · còn lại */
.ns5 { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: var(--r-3); background: var(--surface); }
.ns5 > div { padding: 14px 16px; border-right: 1px solid var(--line); min-width: 0; }
.ns5 > div:last-child { border-right: 0; }
.ns5 .lbl { display: flex; align-items: center; gap: 6px; font-size: var(--text-xs); color: var(--ink-3); }
.ns5 .val { display: block; margin-top: 4px; font-size: 1.25rem; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--ink); letter-spacing: -0.005em; }
.ns5 .qty { display: block; margin-top: 1px; font-size: var(--text-xs); color: var(--ink-3); font-variant-numeric: tabular-nums; }
.ns5 .is-left { background: var(--navy-50); }
.ns5 .is-left .val { color: var(--navy-800); font-weight: 700; }
.ns5 .is-left.is-over { background: var(--red-50); }
.ns5 .is-left.is-over .val { color: var(--red-700); }
.ns5 .is-info .val { color: var(--ink-2); font-weight: 500; }
.ns5-meter { padding: 0 16px 14px; grid-column: 1 / -1; border-right: 0 !important; }

/* Budget remaining inline (on a PR / PO line) */
.left { display: grid; gap: 2px; font-size: var(--text-xs); line-height: 1.35; }
.left .now { color: var(--ink-2); }
.left .after { font-weight: 600; color: var(--ink); }
.left .after.over { color: var(--red-700); }
.left .meter { margin-top: 4px; }
.lv { display: inline-flex; align-items: center; gap: 5px; font-size: var(--text-xs); font-weight: 600; white-space: nowrap; }
.lv-ok { color: var(--ink-3); font-weight: 500; }
.lv-warn { color: var(--gold-700); }
.lv-over { color: var(--red-700); }
.lv .i { width: 14px; height: 14px; }
.pct { font-variant-numeric: tabular-nums; font-weight: 600; }

/* -------------------------------------------------------------------------
   13. Tabs, filters, chips
   ------------------------------------------------------------------------- */
.tabs { display: flex; gap: 2px; box-shadow: inset 0 -1px 0 var(--line-2); overflow-x: auto; overflow-y: hidden; scrollbar-width: thin; }
.tabs a, .tabs button { position: relative; display: inline-flex; align-items: center; gap: 7px; min-height: 42px; padding: 0 14px; font-size: var(--text-md); font-weight: 600; color: var(--ink-3); text-decoration: none; background: none; border: 0; white-space: nowrap; cursor: pointer; }
.tabs a:hover, .tabs button:hover { color: var(--ink); }
.tabs [aria-selected="true"], .tabs [aria-current="page"] { color: var(--navy-800); }
.tabs [aria-selected="true"]::after, .tabs [aria-current="page"]::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: 0; height: 2px; background: var(--navy-800); border-radius: 2px 2px 0 0; }
.tabs .count { min-width: 20px; height: 19px; padding: 0 6px; display: inline-grid; place-items: center; font-size: 11.5px; font-weight: 700; color: var(--ink-2); background: var(--surface-3); border-radius: var(--r-1); font-variant-numeric: tabular-nums; }
.tabs [aria-selected="true"] .count, .tabs [aria-current="page"] .count { color: #fff; background: var(--navy-800); }
.tabs .count.attn { color: var(--gold-700); background: var(--gold-100); }

.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.toolbar .search { flex: 0 1 340px; }
.toolbar .search .input { min-height: 36px; }
.toolbar .select, .toolbar .input { min-height: 36px; width: auto; }
.toolbar .search .input { width: 100%; }
.toolbar .spacer { flex: 1; }
.filters { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
details.more-filters { position: relative; }
details.more-filters > summary { list-style: none; }
details.more-filters > summary::-webkit-details-marker { display: none; }
.filter-pop { position: absolute; z-index: var(--z-dropdown); top: calc(100% + 6px); left: 0; width: 340px; padding: 16px; background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--r-3); box-shadow: var(--shadow-2); display: grid; gap: 12px; }
.active-filters { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: var(--text-xs); color: var(--ink-3); }
.fchip { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 4px 0 9px; font-size: 12.5px; font-weight: 600; color: var(--navy-800); background: var(--navy-50); border: 1px solid var(--navy-100); border-radius: var(--r-1); }
.fchip button { width: 20px; height: 20px; display: grid; place-items: center; border: 0; background: none; color: var(--navy-700); border-radius: 2px; cursor: pointer; }
.fchip button:hover { background: var(--navy-100); }

/* Toggle chips (months, groups) — square, toggle state via aria-pressed */
.tchips { display: flex; flex-wrap: wrap; gap: 4px; }
.tchip { min-width: 40px; height: 32px; padding: 0 10px; font-size: var(--text-sm); font-weight: 600; color: var(--ink-2); background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--r-2); cursor: pointer; font-variant-numeric: tabular-nums; }
.tchip:hover { border-color: var(--ink-3); color: var(--ink); }
.tchip[aria-pressed="true"] { color: #fff; background: var(--navy-800); border-color: var(--navy-800); }
.tchip.is-future { color: var(--ink-3); background: var(--surface-2); }
.tchips-scroll { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; -webkit-mask-image: linear-gradient(90deg, #000 86%, transparent); mask-image: linear-gradient(90deg, #000 86%, transparent); }
.tchips-scroll::-webkit-scrollbar { display: none; }
.tchips-scroll .tchip { flex: none; }

/* -------------------------------------------------------------------------
   14. Overlays: dialog, drawer, bottom sheet, popover, toast
   ------------------------------------------------------------------------- */
.backdrop { position: fixed; inset: 0; z-index: var(--z-backdrop); background: oklch(0.2 0.04 262 / 0.48); }
.dlg { position: fixed; z-index: var(--z-dialog); left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(540px, calc(100vw - 32px)); max-height: calc(100vh - 48px); overflow: auto; background: var(--surface); border-radius: var(--r-4); box-shadow: var(--shadow-3); animation: dlg-in var(--dur-3) var(--ease-out); }
.dlg-wide { width: min(760px, calc(100vw - 32px)); }
.dlg-hd { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 20px 22px 6px; }
.dlg-hd h2 { font-size: 1.1875rem; font-family: var(--font-display); font-weight: 600; }
.dlg-hd .sub { margin-top: 3px; font-size: var(--text-sm); color: var(--ink-3); }
.dlg-bd { padding: 12px 22px 20px; }
.dlg-ft { display: flex; justify-content: flex-end; align-items: center; gap: 10px; padding: 14px 22px; border-top: 1px solid var(--line); background: var(--surface-2); border-radius: 0 0 var(--r-4) var(--r-4); }
.dlg-ft .grow { font-size: var(--text-xs); color: var(--ink-3); }
@keyframes dlg-in { from { opacity: 0; transform: translate(-50%, -48%) scale(0.985); } }
.drawer { position: fixed; z-index: var(--z-drawer); top: 0; right: 0; bottom: 0; width: min(600px, 100vw); display: flex; flex-direction: column; background: var(--surface); box-shadow: var(--shadow-3); animation: drawer-in var(--dur-3) var(--ease-out); }
.drawer-wide { width: min(820px, 100vw); }
.drawer-hd { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.drawer-hd h2 { font-family: var(--font-display); font-size: 1.25rem; font-weight: 600; }
.drawer-hd .sub { margin-top: 3px; font-size: var(--text-sm); color: var(--ink-3); }
.drawer-bd { flex: 1; overflow: auto; padding: 20px 22px; }
.drawer-ft { display: flex; justify-content: flex-end; align-items: center; gap: 10px; padding: 14px 22px; border-top: 1px solid var(--line); background: var(--surface-2); }
@keyframes drawer-in { from { transform: translateX(24px); opacity: 0; } }
.bsheet { position: fixed; z-index: var(--z-dialog); left: 50%; transform: translateX(-50%); bottom: 0; width: 100%; max-width: 480px; max-height: 88vh; overflow: auto; background: var(--surface); border-radius: var(--r-4) var(--r-4) 0 0; box-shadow: var(--shadow-3); padding: 8px 16px calc(16px + env(safe-area-inset-bottom)); animation: bsheet-in var(--dur-3) var(--ease-out); }
.bsheet::before { content: ""; display: block; width: 40px; height: 4px; margin: 2px auto 14px; border-radius: 2px; background: var(--line-2); }
.bsheet h2 { font-family: var(--font-display); font-size: 1.25rem; font-weight: 600; }
@keyframes bsheet-in { from { transform: translate(-50%, 24px); opacity: 0; } }
.pop { position: absolute; z-index: var(--z-dropdown); background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--r-3); box-shadow: var(--shadow-2); }
.menu { list-style: none; margin: 0; padding: 6px; min-width: 220px; }
.menu a, .menu button { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 38px; padding: 0 10px; font-size: var(--text-sm); color: var(--ink); text-decoration: none; background: none; border: 0; border-radius: var(--r-2); cursor: pointer; text-align: left; }
.menu a:hover, .menu button:hover { background: var(--surface-3); }
.menu .i { color: var(--ink-3); }
.menu hr { margin: 6px 0; }
.toast { position: fixed; z-index: var(--z-toast); left: 50%; bottom: 28px; transform: translateX(-50%); display: flex; align-items: center; gap: 12px; padding: 12px 16px; max-width: min(560px, calc(100vw - 32px)); background: var(--navy-950); color: #fff; font-weight: 500; border-radius: var(--r-2); box-shadow: var(--shadow-3); animation: toast-in var(--dur-3) var(--ease-out); }
.toast .i { color: oklch(0.8 0.12 155); }
.toast a { color: var(--gold-300); font-weight: 600; }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 10px); } }

/* -------------------------------------------------------------------------
   15. Queue — "Việc của tôi"
   ------------------------------------------------------------------------- */
.home-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 22px; }
.home-head h1 { font-size: 1.75rem; }
.home-head .lede { margin-top: 6px; color: var(--ink-2); font-size: 1rem; }
.home-head .lede b { color: var(--ink); }
.home-grid { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 28px; align-items: start; }
.q + .q { margin-top: 26px; }
.q-hd { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.q-hd h2 { display: flex; align-items: center; gap: 10px; font-size: 1.0625rem; }
.q-hd h2 .badge { font-size: 12.5px; height: 22px; min-width: 24px; }
.q-hd .src { font-size: var(--text-xs); font-weight: 500; color: var(--ink-3); }
.q-hd a { font-size: var(--text-sm); font-weight: 600; text-decoration: none; }
.q-hd a:hover { text-decoration: underline; }
.q-list { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-3); overflow: hidden; }
.q-list > li + li { border-top: 1px solid var(--line); }
.q-row { display: grid; grid-template-columns: 40px minmax(0, 1fr) 136px 84px 18px; gap: 4px 16px; align-items: center; padding: 14px 16px; color: inherit; text-decoration: none; transition: background-color var(--dur-1) var(--ease-out); }
.q-row > .stamp, .q-row > .q-ico { align-self: start; margin-top: 1px; }
.q-row:hover { background: var(--row-hover); color: inherit; }
.q-row:hover .q-chev { color: var(--navy-700); transform: translateX(2px); }
.q-main { min-width: 0; }
.q-step { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 10px; margin-top: 7px; min-width: 0; }
.q-step .step-txt { font-size: var(--text-xs); color: var(--ink-2); white-space: normal; line-height: 1.3; }
.q-step .step-txt b { color: var(--ink); }
.q-line1 { display: flex; align-items: center; gap: 4px 10px; flex-wrap: wrap; font-size: var(--text-sm); }
.q-line1 .unit { color: var(--ink-3); }
.q-sum { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin-top: 3px; font-size: var(--text-md); line-height: 1.4; color: var(--ink); }
.q-why { display: block; margin-top: 3px; font-size: var(--text-sm); color: var(--red-700); }
.q-why b { font-weight: 600; }
.q-amt { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.q-amt small { display: block; font-weight: 400; color: var(--ink-3); font-size: var(--text-2xs); }
.q-age { text-align: right; font-size: var(--text-sm); color: var(--ink-3); white-space: nowrap; font-variant-numeric: tabular-nums; }
.q-age.late { color: var(--gold-700); font-weight: 600; }
.q-chev { color: var(--line-2); transition: transform var(--dur-1) var(--ease-out), color var(--dur-1) var(--ease-out); }
.q-more { display: flex; align-items: center; justify-content: center; gap: 6px; padding: 11px; font-size: var(--text-sm); font-weight: 600; text-decoration: none; background: var(--surface-2); }
.q-empty { display: flex; align-items: center; gap: 14px; padding: 18px; background: var(--surface); border: 1px dashed var(--line-2); border-radius: var(--r-3); color: var(--ink-2); }
.q-empty .i { color: var(--navy-400); }
.q-err { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 14px 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-3); color: var(--ink-2); }

/* Budget card for a unit (side of Việc của tôi) */
.unit-budget { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-3); overflow: hidden; }
.unit-budget header { padding: 16px 18px 4px; }
.unit-budget header h2 { font-size: var(--text-md); }
.unit-budget header .sub { font-size: var(--text-xs); color: var(--ink-3); margin-top: 2px; }
.ub-left { padding: 8px 18px 4px; }
.ub-left .lbl { font-size: var(--text-xs); color: var(--ink-3); }
.ub-left .val { font-family: var(--font-display); font-size: 2rem; font-weight: 600; line-height: 1.1; color: var(--navy-800); font-variant-numeric: lining-nums tabular-nums; letter-spacing: -0.01em; }
.ub-left .val .cur { font-family: var(--font-ui); font-size: 0.95rem; color: var(--ink-3); }
.ub-meter { padding: 10px 18px 6px; }
.ub-rows { list-style: none; margin: 0; padding: 6px 18px 12px; font-size: var(--text-sm); }
.ub-rows li { display: flex; justify-content: space-between; gap: 10px; padding: 5px 0; border-bottom: 1px dashed var(--line); }
.ub-rows li:last-child { border-bottom: 0; }
.ub-rows .k { display: inline-flex; align-items: center; gap: 8px; color: var(--ink-2); }
.ub-rows .v { font-variant-numeric: tabular-nums; font-weight: 600; }
.ub-flags { display: flex; gap: 8px; flex-wrap: wrap; padding: 0 18px 14px; }
.unit-budget footer { padding: 11px 18px; border-top: 1px solid var(--line); background: var(--surface-2); }
.unit-budget footer a { font-size: var(--text-sm); font-weight: 600; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; }

.side-list { list-style: none; margin: 0; padding: 0; }
.side-list li { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: var(--text-sm); }
.side-list li:last-child { border-bottom: 0; }
.side-list .grow { min-width: 0; }
.side-list .sub { display: block; font-size: var(--text-xs); color: var(--ink-3); }

/* -------------------------------------------------------------------------
   16. Dashboard (Bảng điều hành)
   ------------------------------------------------------------------------- */
.dash-filters { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 12px 18px; align-items: center; padding: 14px 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-3); }
.dash-filters .flabel { font-size: var(--text-xs); font-weight: 600; color: var(--ink-2); }
.asof { display: flex; align-items: flex-start; gap: 8px; font-size: var(--text-sm); color: var(--ink-2); }
.asof > .i { margin-top: 2px; color: var(--ink-3); }
.asof b { color: var(--ink); }

/* Result equation: Doanh thu − Chi phí phát sinh = EBITDA */
.eq { display: grid; grid-template-columns: minmax(0, 1fr) 36px minmax(0, 1fr) 36px minmax(0, 1fr); align-items: stretch; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-3); }
.eq-term { padding: 18px 22px 16px; min-width: 0; }
.eq-term .lbl { display: flex; align-items: center; gap: 8px; font-size: var(--text-sm); font-weight: 600; color: var(--ink-2); }
.eq-term .fig { display: block; margin-top: 6px; font-family: var(--font-display); font-size: var(--text-4xl); font-weight: 600; line-height: 1.05; letter-spacing: -0.015em; font-variant-numeric: lining-nums; color: var(--ink); }
.eq-term .fig .u { font-family: var(--font-ui); font-size: 1rem; font-weight: 600; color: var(--ink-3); letter-spacing: 0; margin-left: 4px; }
.eq-term .full { display: block; margin-top: 4px; font-size: var(--text-xs); color: var(--ink-3); font-variant-numeric: tabular-nums; }
.eq-term.is-result { background: var(--surface-2); border-left: 1px solid var(--line); border-radius: 0 var(--r-3) var(--r-3) 0; }
.eq-term .fig.neg { color: var(--red-700); }
.eq-op { display: grid; place-items: center; font-family: var(--font-display); font-size: 1.875rem; font-weight: 400; color: var(--ink-3); }
.tag-manual { display: inline-flex; align-items: center; height: 19px; padding: 0 6px; font-size: 11px; font-weight: 700; color: var(--ink-2); background: var(--surface-3); border-radius: var(--r-1); letter-spacing: 0.02em; }
.info-dot { display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; color: var(--ink-3); background: none; border: 0; cursor: help; padding: 0; }
.info-dot .i { width: 15px; height: 15px; }
.info-dot:hover { color: var(--navy-700); }

/* Ledger of secondary indicators (not a card grid) */
.ledger { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-3); }
.ledger > div { padding: 14px 18px 15px; border-right: 1px solid var(--line); min-width: 0; }
.ledger > div:last-child { border-right: 0; }
.ledger .lbl { display: flex; align-items: center; gap: 6px; font-size: var(--text-xs); font-weight: 600; color: var(--ink-2); }
.ledger .fig { display: block; margin-top: 5px; font-family: var(--font-display); font-size: 1.75rem; font-weight: 600; line-height: 1.1; font-variant-numeric: lining-nums; color: var(--ink); }
.ledger .fig .u { font-family: var(--font-ui); font-size: 0.875rem; color: var(--ink-3); margin-left: 3px; }
.ledger .sub { display: block; margin-top: 3px; font-size: var(--text-xs); color: var(--ink-3); }
.ledger .meter { margin-top: 9px; }

.charts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.chart { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-3); display: flex; flex-direction: column; min-width: 0; }
.chart.span-2 { grid-column: 1 / -1; }
.chart-hd { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 14px 16px 6px 18px; }
.chart-hd h2 { font-size: var(--text-md); font-weight: 600; }
.chart-hd .sub { margin-top: 2px; font-size: var(--text-xs); color: var(--ink-3); }
.chart-hd .row { flex: none; }
.chart-bd { padding: 6px 18px 12px; }
.chart-bd svg { width: 100%; height: auto; overflow: visible; }
.chart-ft { padding: 10px 18px 14px; display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; border-top: 1px solid var(--line); }
.chart-note { font-size: var(--text-2xs); color: var(--ink-3); }
.chart-empty { display: grid; place-items: center; min-height: 200px; color: var(--ink-3); font-size: var(--text-sm); text-align: center; }
.chart-empty .i { margin: 0 auto; color: var(--navy-300); }
/* "Bảng số": every chart can show its numbers as a table (accessibility + checking) */
.chart-table { margin-left: auto; }
.chart-table > summary { list-style: none; }
.chart-table > summary::-webkit-details-marker { display: none; }
.chart-table[open] { flex: 1 1 100%; margin-left: 0; }
.chart-table[open] > summary { display: flex; width: fit-content; margin-left: auto; background: var(--surface-3); }
.chart-table .tbl-wrap { max-height: 320px; overflow: auto; border: 1px solid var(--line); border-radius: var(--r-2); }
.chart-table .tbl tfoot td { border-radius: 0 !important; }

/* SVG chart parts */
.ax { font-family: var(--font-ui); font-size: 11.5px; fill: var(--ink-3); font-variant-numeric: tabular-nums; }
.ax-strong { fill: var(--ink-2); font-weight: 600; }
.gl { stroke: var(--c-grid); stroke-width: 1; }
.gl-0 { stroke: var(--line-2); stroke-width: 1; }
.bar-a { fill: var(--c-actual); }
.bar-b { fill: var(--c-second); }
.bar-g { fill: var(--c-plan); }
.bar-r { fill: var(--c-over); }
.bar-rem { fill: var(--c-remain); stroke: var(--line-2); stroke-width: 1; }
.bar-hit:hover { opacity: 0.86; cursor: pointer; }
.ln-a { fill: none; stroke: var(--c-actual); stroke-width: 2.25; stroke-linejoin: round; stroke-linecap: round; }
.ln-g { fill: none; stroke: var(--c-plan); stroke-width: 2.25; stroke-linejoin: round; stroke-linecap: round; }
.ln-g-dash { fill: none; stroke: var(--gold-600); stroke-width: 2; stroke-dasharray: 5 4; }
.pt-a { fill: var(--surface); stroke: var(--c-actual); stroke-width: 2; }
.pt-g { fill: var(--surface); stroke: var(--c-plan); stroke-width: 2; }
.vlbl { font-family: var(--font-ui); font-size: 11px; font-weight: 600; fill: var(--ink-2); font-variant-numeric: tabular-nums; }
.vlbl-neg { fill: var(--red-700); }
.vlbl-in { fill: #fff; font-size: 10.5px; }
/* Revenue mix: one proportion strip + ranked list (reads like the budget meter) */
.mix-strip { display: flex; gap: 2px; height: 30px; margin-top: 4px; }
.mix-strip > span { width: var(--w); background: var(--c); }
.mix-strip > span:first-child { border-radius: 3px 0 0 3px; }
.mix-strip > span:last-child { border-radius: 0 3px 3px 0; }
.mix-list { list-style: none; margin: 16px 0 0; padding: 0; }
.mix-list li { display: grid; grid-template-columns: 14px minmax(0, 1fr) 96px 64px; gap: 10px; align-items: center; padding: 12px 0; border-bottom: 1px dashed var(--line); font-size: var(--text-sm); }
.mix-list li:last-child { border-bottom: 0; }
.mix-list .sw { width: 12px; height: 12px; background: var(--c); }
.mix-list .v { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.mix-list .p { text-align: right; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.mix-list .tot { font-weight: 700; border-top: 1px solid var(--ink-2); border-bottom: 0; }
.plan-tick { stroke: var(--ink); stroke-width: 2; }

/* -------------------------------------------------------------------------
   17. Wizard / import / progress
   ------------------------------------------------------------------------- */
.wizard { list-style: none; display: flex; gap: 0; margin: 0 0 22px; padding: 0; counter-reset: wz; }
.wizard li { flex: 1; display: flex; align-items: center; gap: 10px; padding: 0 16px 0 0; font-size: var(--text-sm); color: var(--ink-3); font-weight: 600; counter-increment: wz; }
.wizard li::before { content: counter(wz); width: 26px; height: 26px; display: grid; place-items: center; flex: none; border-radius: 50%; font-size: 12.5px; border: 1.5px solid var(--line-2); background: var(--surface); }
.wizard li::after { content: ""; flex: 1; height: 1.5px; background: var(--line-2); }
.wizard li:last-child::after { display: none; }
.wizard li.is-done { color: var(--ink-2); }
.wizard li.is-done::before { content: "✓"; color: #fff; background: var(--navy-700); border-color: var(--navy-700); }
.wizard li.is-current { color: var(--navy-800); }
.wizard li.is-current::before { color: var(--navy-800); border-color: var(--navy-800); box-shadow: 0 0 0 3px var(--navy-100); }
.progress { height: 10px; background: var(--surface-3); border-radius: 5px; overflow: hidden; }
.progress > span { display: block; height: 100%; width: var(--w, 0%); background: var(--navy-700); border-radius: 5px; }
.progress.is-live > span { background-image: repeating-linear-gradient(-45deg, var(--navy-700) 0 8px, var(--navy-600) 8px 16px); background-size: 200% 100%; animation: bar-move 1.2s linear infinite; }
@keyframes bar-move { to { background-position: -22.6px 0; } }
.check-list { list-style: none; margin: 0; padding: 0; }
.check-list li { display: flex; align-items: flex-start; gap: 10px; padding: 8px 0; border-bottom: 1px dashed var(--line); font-size: var(--text-sm); }
.check-list li:last-child { border-bottom: 0; }
.check-list .i { margin-top: 1px; }
.check-list .ok .i { color: var(--green-700); }
.check-list .miss .i { color: var(--gold-700); }
.check-list .miss { color: var(--ink); }
.check-list .sub { display: block; font-size: var(--text-xs); color: var(--ink-3); }
.match { display: inline-flex; align-items: center; gap: 5px; font-weight: 600; font-size: var(--text-xs); }
.match.ok { color: var(--green-700); }
.match.bad { color: var(--red-700); }

/* Attachments */
.files { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.file { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 9px 10px; border: 1px solid var(--line); border-radius: var(--r-2); background: var(--surface); }
.file .thumb { width: 40px; height: 40px; border-radius: var(--r-1); display: grid; place-items: center; font-size: 10px; font-weight: 700; letter-spacing: 0.03em; color: var(--ink-2); background: var(--surface-3); border: 1px solid var(--line); }
.file .thumb.pdf { color: var(--red-700); background: var(--red-50); border-color: var(--red-100); }
.file .thumb.img { color: var(--navy-700); background: repeating-linear-gradient(45deg, var(--navy-50) 0 5px, var(--navy-100) 5px 10px); border-color: var(--navy-100); }
.file .thumb.xls { color: var(--green-700); background: var(--green-50); border-color: var(--green-100); }
.file .name { font-size: var(--text-sm); font-weight: 600; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; text-decoration: none; }
a.name:hover { color: var(--navy-700); text-decoration: underline; }
.file .meta { font-size: var(--text-xs); color: var(--ink-3); }
.file.is-err { border-color: var(--red-200); background: var(--red-50); }
.file .kind { display: inline-flex; height: 19px; align-items: center; padding: 0 6px; margin-right: 6px; font-size: 11px; font-weight: 700; color: var(--navy-700); background: var(--navy-50); border-radius: var(--r-1); }
.file-bar { height: 4px; margin-top: 5px; background: var(--surface-3); border-radius: 2px; overflow: hidden; }
.file-bar > span { display: block; height: 100%; width: var(--w); background: var(--navy-600); }

/* History timeline */
.hist { list-style: none; margin: 0; padding: 0; }
.hist > li { position: relative; display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 10px; padding-bottom: 14px; }
.hist > li::before { content: ""; position: absolute; left: 10px; top: 20px; bottom: 0; width: 1px; background: var(--line); }
.hist > li:last-child::before { display: none; }
.hist .dot { width: 21px; height: 21px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-3); color: var(--ink-3); box-shadow: 0 0 0 3px var(--surface); }
.hist .dot .i { width: 12px; height: 12px; stroke-width: 2.4; }
.hist .dot.ok { background: var(--navy-700); color: #fff; }
.hist .dot.rej { background: var(--red-600); color: #fff; }
.hist .dot.wait { background: var(--gold-100); color: var(--gold-700); }
.hist .dot.pay { background: var(--green-700); color: #fff; }
.hist .dot.send { background: var(--navy-100); color: var(--navy-800); }
.hist .what { font-size: var(--text-sm); color: var(--ink); }
.hist .what b { font-weight: 600; }
.hist .when { font-size: var(--text-xs); color: var(--ink-3); }
.hist .quote { margin-top: 4px; padding: 6px 10px; font-size: var(--text-sm); color: var(--ink-2); background: var(--surface-2); border-radius: var(--r-2); border: 1px solid var(--line); }
.hist-attempt { margin: 4px 0 10px; font-size: var(--text-xs); font-weight: 700; color: var(--ink-3); }

/* -------------------------------------------------------------------------
   18. Empty, loading, error
   ------------------------------------------------------------------------- */
.empty { display: grid; justify-items: center; gap: 8px; padding: 48px 24px; text-align: center; color: var(--ink-2); }
.empty .i-2xl { color: var(--navy-300); }
.empty h2, .empty strong.ttl { font-size: var(--text-lg); color: var(--ink); font-weight: 600; }
.empty p { max-width: 52ch; color: var(--ink-3); }
.empty .row { margin-top: 8px; }
.sk { display: block; height: 12px; border-radius: 3px; background: linear-gradient(90deg, var(--surface-3) 0%, var(--surface-2) 50%, var(--surface-3) 100%); background-size: 200% 100%; animation: sk 1.3s linear infinite; }
@keyframes sk { to { background-position: -200% 0; } }
.state-page { min-height: calc(100vh - var(--sticky-top)); display: grid; place-items: center; padding: 40px 24px; }
.state-card { max-width: 520px; text-align: center; display: grid; justify-items: center; gap: 12px; }
.state-card .seal { width: 76px; height: 76px; display: grid; place-items: center; border-radius: 50%; color: var(--navy-700); background: var(--navy-50); box-shadow: inset 0 0 0 1px var(--navy-100), 0 0 0 8px var(--surface), 0 0 0 9px var(--line); }
.state-card h1 { font-size: 1.625rem; margin-top: 10px; }
.state-card p { color: var(--ink-3); }

/* -------------------------------------------------------------------------
   19. Auth (Đăng nhập)
   ------------------------------------------------------------------------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(420px, 44%) minmax(0, 1fr); background: var(--surface); }
.auth-brand { position: relative; display: flex; flex-direction: column; justify-content: space-between; padding: 44px 52px; color: #fff; background: var(--navy-900); overflow: hidden; }
.auth-brand::after { content: ""; position: absolute; top: 0; right: 0; bottom: 0; width: 3px; background: var(--gold-500); }
.auth-mark { display: flex; align-items: center; gap: 14px; }
.auth-mark .crest { width: 56px; height: 56px; }
.auth-mark strong { display: block; font-size: 15px; font-weight: 600; letter-spacing: 0.02em; }
.auth-mark small { display: block; font-size: 13px; color: var(--navy-200); }
.auth-title { font-family: var(--font-display); font-size: 2.625rem; font-weight: 600; line-height: 1.1; letter-spacing: -0.01em; color: #fff; }
.auth-chain { list-style: none; margin: 26px 0 0; padding: 0; display: grid; gap: 0; max-width: 360px; }
.auth-chain li { display: grid; grid-template-columns: 46px 1fr; gap: 14px; align-items: center; padding: 10px 0; border-top: 1px solid oklch(0.4 0.07 260); font-size: 14.5px; color: var(--navy-100); }
.auth-chain li:last-child { border-bottom: 1px solid oklch(0.4 0.07 260); }
.auth-chain .stamp { color: var(--gold-300); background: transparent; border-color: var(--gold-500); box-shadow: inset 0 0 0 2px var(--navy-900), inset 0 0 0 3px oklch(0.55 0.09 80); }
.auth-foot { font-size: 12.5px; color: var(--navy-200); line-height: 1.6; }
.auth-form { display: grid; place-items: center; padding: 40px 24px; }
.auth-box { width: 100%; max-width: 400px; }
.auth-box h2 { font-family: var(--font-display); font-size: 1.75rem; font-weight: 600; }
.auth-box .lede { margin-top: 6px; color: var(--ink-3); }
.auth-box form { margin-top: 28px; display: grid; gap: 18px; }
.auth-box .input { min-height: 46px; font-size: 1rem; }
.auth-box .btn-primary { min-height: 48px; font-size: 1rem; }
.auth-help { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); font-size: var(--text-sm); color: var(--ink-3); }
.auth-ph { min-height: 100vh; display: flex; flex-direction: column; background: var(--surface); }
.auth-ph-top { padding: 28px 22px 26px; color: #fff; background: var(--navy-900); border-bottom: 3px solid var(--gold-500); }
.auth-ph-top .crest { width: 48px; height: 48px; margin-bottom: 16px; }
.auth-ph-top h1 { font-size: 1.75rem; line-height: 1.15; color: #fff; }
.auth-ph-top p { margin-top: 6px; font-size: 14px; color: var(--navy-200); }
.auth-ph-body { padding: 24px 20px 32px; }
.auth-ph-body form { display: grid; gap: 18px; }
.auth-ph-body .input { min-height: 50px; font-size: 1rem; }

/* -------------------------------------------------------------------------
   20. Print — A4 forms in the school's own layout (Times New Roman)
   ------------------------------------------------------------------------- */
body.print-view { background: oklch(0.9 0.008 262); }
.print-bar { position: sticky; top: 0; z-index: var(--z-header); display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 10px 20px; background: var(--navy-900); color: #fff; border-bottom: 2px solid var(--gold-500); }
.print-bar .title { margin: 0; font-family: var(--font-ui); font-size: var(--text-md); font-weight: 600; letter-spacing: 0; }
.print-bar .title small { display: block; font-weight: 400; font-size: 12px; color: var(--navy-200); }
.print-bar .btn { min-height: 34px; }
.print-bar .btn-ghost { color: #fff; }
.print-bar .btn-ghost:hover { background: var(--navy-850); color: #fff; }
.print-bar .check { color: #fff; font-size: var(--text-sm); margin-right: 6px; }
.print-bar .check input { accent-color: var(--gold-500); }
/* Block flow + auto margins: centred when it fits, scrolls inside the stack (never clipped on the left) when it does not. */
.a4-stack { padding: 28px 16px 64px; overflow-x: auto; }
.a4 { position: relative; width: 210mm; min-height: 297mm; margin: 0 auto; padding: 12mm; background: #fff; color: #000; box-shadow: 0 2px 6px oklch(0.2 0.03 262 / 0.18), 0 12px 32px oklch(0.2 0.03 262 / 0.12); font-family: var(--font-doc); font-size: 11.5px; line-height: 1.3; }
.a4 + .a4 { margin-top: 24px; }
.a4 table { border-collapse: collapse; width: 100%; table-layout: fixed; font-variant-numeric: normal; }
.a4 td, .a4 th { border: 1px solid #000; padding: 2px 5px; vertical-align: middle; font-weight: 400; }
.a4 .nb td, .a4 td.nb, .a4 th.nb { border: 0; }
.a4 .b { font-weight: 700; }
.a4 .i-t { font-style: italic; }
.a4 .c { text-align: center; }
.a4 .r { text-align: right; }
.a4 .en { display: block; font-style: italic; font-size: 0.92em; }
.a4 .f-hd td { border: 0; padding: 1px 4px; }
.a4 .f-name { font-size: 13px; font-weight: 700; text-align: center; text-transform: uppercase; }
.a4 .f-name .en { font-style: normal; font-size: 11.5px; }
.a4 .f-addr { text-align: center; }
.a4 .f-ctl td { border: 0; padding: 1px 4px; font-size: 11px; }
.a4 .f-logo { width: 74px; height: 74px; margin: 0 auto; }
.a4 .f-title { font-size: 17px; font-weight: 700; text-align: center; line-height: 1.25; }
.a4 .f-title .en { font-style: normal; font-size: 15px; }
.a4 .tick { display: inline-block; width: 11px; height: 11px; border: 1px solid #000; border-radius: 50%; vertical-align: -1px; margin-right: 4px; position: relative; }
.a4 .tick.on::after { content: ""; position: absolute; inset: 2px; border-radius: 50%; background: #000; }
.a4 .sq { display: inline-block; width: 12px; height: 12px; border: 1px solid #000; vertical-align: -2px; position: relative; }
.a4 .sq.on::after { content: "✓"; position: absolute; left: 1px; top: -4px; font-size: 13px; font-weight: 700; }
.a4 .sig, .a4 .f-grid .sig { height: 80px; padding-bottom: 4px; vertical-align: bottom; text-align: center; }
.a4 .sig-name { display: block; font-weight: 700; }
.a4 .sig-sys { display: block; font-size: 10px; font-style: italic; }
.a4 .sig-head, .a4 .f-grid .sig-head { text-align: center; height: 34px; }
.a4 .sig-date { font-style: italic; font-size: 10.5px; text-align: left; }
.a4 .f-grid td { height: 20px; }
.a4 .f-grid th { font-weight: 700; text-align: center; font-size: 10.5px; line-height: 1.2; }
.a4 .f-grid .gap td { height: 8px; padding: 0; }
.a4 .f-fields td { border: 0; }
.a4 .money { text-align: right; white-space: nowrap; }
.a4 .f-foot { margin-top: 10px; font-size: 9.5px; font-style: italic; color: #222; border-top: 1px solid #000; padding-top: 4px; }
.watermark { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; overflow: hidden; }
.watermark span { transform: rotate(-30deg); font-family: var(--font-doc); font-size: 54px; font-weight: 700; letter-spacing: 0.06em; color: oklch(0.2 0 0 / 0.15); border: 5px solid oklch(0.2 0 0 / 0.15); padding: 6px 22px; white-space: nowrap; }

/* -------------------------------------------------------------------------
   21. Spec sheets — what a downloaded workbook looks like (route handlers)
   ------------------------------------------------------------------------- */
.xl { border: 1px solid var(--line-2); border-radius: var(--r-2); overflow: hidden; background: #fff; font-family: Calibri, "Segoe UI", Arial, sans-serif; }
.xl-bar { display: flex; align-items: center; gap: 10px; padding: 7px 12px; background: oklch(0.47 0.11 152); color: #fff; font-size: 13px; font-weight: 600; }
.xl-bar .i { color: #fff; }
.xl-scroll { overflow: auto; }
.xl table { border-collapse: collapse; font-size: 12.5px; min-width: 100%; }
.xl th.col, .xl td.rn { background: oklch(0.955 0.004 150); color: oklch(0.45 0.01 150); font-weight: 400; font-size: 11.5px; text-align: center; border: 1px solid oklch(0.86 0.005 150); padding: 2px 6px; }
.xl td.rn { width: 34px; }
.xl td { border: 1px solid oklch(0.9 0.004 150); padding: 3px 7px; height: 22px; white-space: nowrap; color: #111; }
.xl td.h { font-weight: 700; background: oklch(0.93 0.03 257); }
.xl td.t { font-weight: 700; font-size: 15px; }
.xl td.n { text-align: right; font-variant-numeric: tabular-nums; }
.xl td.tot { font-weight: 700; border-top: 2px solid #333; }
.xl td.fz { box-shadow: inset 0 -2px 0 oklch(0.55 0.02 150); }
.xl-tabs { display: flex; gap: 2px; padding: 0 8px; background: oklch(0.955 0.004 150); border-top: 1px solid oklch(0.86 0.005 150); font-size: 12px; }
.xl-tabs span { padding: 5px 14px; color: oklch(0.4 0.01 150); }
.xl-tabs span.on { background: #fff; color: oklch(0.38 0.11 152); font-weight: 700; border-bottom: 2px solid oklch(0.47 0.11 152); }
.xl td.b { font-weight: 700; }
.xl td.c { text-align: center; }
.xl td.wrap { white-space: normal; line-height: 1.3; }
.xl td.ex { color: oklch(0.48 0.01 150); font-style: italic; }
.xl td.g { background: oklch(0.965 0.006 257); }
.xl td.neg { color: var(--red-700); }
.xl td.i-c { font-style: italic; }
.xl td.sig { height: 66px; vertical-align: bottom; }
.xl td.logo { text-align: center; vertical-align: middle; }
.xl .xl-logo { display: block; width: 56px; height: 56px; margin: 0 auto; }
.spec-note { font-size: var(--text-sm); color: var(--ink-2); }
.spec-note li { margin: 4px 0 4px 18px; }

/* Route spec pages (R1–R3): the route's contract, then the file it returns */
body.spec-view { background: var(--bg); }
.spec-main { max-width: 1240px; margin: 0 auto; padding: 24px var(--page-pad) 72px; }
.spec-main > * + * { margin-top: var(--sp-6); }
.spec-lede { max-width: 80ch; color: var(--ink-2); }
.spec-cols { align-items: start; gap: var(--sp-6); }
.route { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.route li { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: baseline; gap: 1px 10px; font-size: var(--text-sm); }
.route .verb { grid-row: span 2; padding: 1px 6px; border-radius: var(--r-1); font: 700 11px/1.6 var(--font-mono); color: var(--navy-800); background: var(--navy-50); box-shadow: inset 0 0 0 1px var(--navy-100); }
.route .path { font-family: var(--font-mono); font-size: 0.9em; color: var(--ink); overflow-wrap: anywhere; }
.route .t-xs { grid-column: 2; }

/* Image / PDF viewer (attachment proxy) */
.viewer { position: fixed; inset: 0; z-index: var(--z-dialog); display: grid; grid-template-rows: auto 1fr; background: oklch(0.16 0.03 262 / 0.94); color: #fff; }
.viewer-bar { display: flex; align-items: center; gap: 12px; padding: 10px 16px; border-bottom: 1px solid oklch(0.3 0.04 262); }
.viewer-bar .btn-ghost { color: #fff; }
.viewer-bar .btn-ghost:hover { background: oklch(0.28 0.05 262); color: #fff; }
.viewer-stage { display: grid; place-items: center; padding: 24px; overflow: auto; }
.viewer-doc { width: min(560px, 90vw); aspect-ratio: 1 / 1.414; background: #fff; color: #222; box-shadow: 0 20px 60px #0008; padding: 34px 32px; font-family: var(--font-doc); font-size: 11px; }
.viewer-doc.is-photo { transform: rotate(-0.8deg); background: oklch(0.985 0.004 85); }
.viewer-doc p { margin: 3px 0; }
.viewer-doc hr { border: 0; border-top: 1px solid #999; margin: 8px 0; }
.viewer-doc table { width: 100%; border-collapse: collapse; margin: 10px 0 6px; }
.viewer-doc th, .viewer-doc td { border: 1px solid #555; padding: 3px 5px; font-size: 10.5px; font-weight: 400; height: 20px; }
.viewer-doc th { font-weight: 700; text-align: center; }
.viewer-doc .c { text-align: center; } .viewer-doc .r { text-align: right; } .viewer-doc .b { font-weight: 700; } .viewer-doc .it { font-style: italic; }
.viewer-bar .vr { width: 1px; height: 22px; background: oklch(0.36 0.04 262); }

/* -------------------------------------------------------------------------
   22. Misc components
   ------------------------------------------------------------------------- */
.dl-sum { display: grid; grid-template-columns: 1fr auto; gap: 6px 0; margin: 0; font-size: var(--text-sm); }
.dl-sum dt { color: var(--ink-2); }
.dl-sum dd { margin: 0; padding-left: 18px; text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.dl-sum .total { padding-top: 8px; border-top: 1px solid var(--ink-2); font-size: var(--text-md); font-weight: 700; color: var(--ink); }
.words { padding: 10px 12px; font-size: var(--text-sm); font-style: italic; color: var(--ink-2); background: var(--surface-2); border: 1px dashed var(--line-2); border-radius: var(--r-2); }
.words b { font-style: normal; color: var(--ink-3); font-weight: 600; margin-right: 6px; }
/* YCTT amount line: figure + words (mirrors the form's “Số tiền … VNĐ / Bằng chữ”) */
.amt-row { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 12px 24px; align-items: center; }
.amt-row .lbl { display: block; font-size: var(--text-xs); color: var(--ink-3); }
.amt-row .val { display: block; font-family: var(--font-display); font-size: 1.75rem; font-weight: 600; line-height: 1.15; font-variant-numeric: lining-nums tabular-nums; color: var(--ink); white-space: nowrap; }
.amt-row .val .cur { font-family: var(--font-ui); font-size: 0.9rem; font-weight: 600; color: var(--ink-2); }
@media (max-width: 760px) { .amt-row { grid-template-columns: minmax(0, 1fr); } }
.prog3 { display: grid; gap: 10px; }
.prog3 .pr-row { display: grid; grid-template-columns: 150px minmax(0, 1fr) 54px; gap: 12px; align-items: center; font-size: var(--text-sm); }
.prog3 .pr-row .pct { text-align: right; }
.pbar { height: 8px; background: var(--surface-3); border-radius: 2px; overflow: hidden; }
.pbar > span { display: block; height: 100%; width: var(--w, 0%); background: var(--navy-700); }
.pbar.done > span { background: var(--green-700); }
.mini3 { display: inline-grid; grid-template-columns: repeat(3, 34px); gap: 4px; vertical-align: middle; }
.mini3 > span { height: 6px; background: var(--surface-3); border-radius: 1px; overflow: hidden; }
.mini3 > span > i { display: block; height: 100%; width: var(--w, 0%); background: var(--navy-700); }
.mini3-lbl { display: block; margin-top: 3px; font-size: 11.5px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.mini3-wrap { display: grid; justify-items: end; flex: none; }
.q-ico { width: 34px; height: 34px; display: grid; place-items: center; border-radius: var(--r-2); background: var(--surface-3); color: var(--ink-2); }

/* Budget-line block (budget confirmation on a PR / PO) */
.bl { border: 1px solid var(--line); border-radius: var(--r-3); background: var(--surface); }
.bl + .bl { margin-top: 12px; }
.bl-hd { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 12px 14px 10px; }
.bl-hd strong { font-size: var(--text-md); }
.bl-hd .code { display: block; margin-top: 1px; font-size: var(--text-xs); color: var(--ink-3); white-space: normal; }
.bl-5 { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); margin: 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); background: var(--surface-2); }
.bl-5 > div { padding: 8px 12px; border-right: 1px solid var(--line); min-width: 0; }
.bl-5 > div:last-child { border-right: 0; }
.bl-5 dt { font-size: 12px; color: var(--ink-3); white-space: nowrap; }
.bl-5 dd { margin: 1px 0 0; font-weight: 600; font-variant-numeric: tabular-nums; font-size: var(--text-sm); }
.bl-5 dd small { display: block; font-weight: 400; font-size: 12px; color: var(--ink-3); }
.bl-5 .is-left { background: var(--navy-50); }
.bl-5 .is-left dd { color: var(--navy-800); }
.bl-5 .is-left.is-over { background: var(--red-50); }
.bl-5 .is-left.is-over dd { color: var(--red-700); }
.bl .tbl th, .bl .tbl td { padding: 8px 12px; }
.bl .tbl tr:last-child td { border-bottom: 0; }
.bl .tbl thead th { position: static; background: transparent; border-bottom-color: var(--line); }
.bl-meter { padding: 10px 14px 0; }
.bl-foot { padding: 8px 14px 10px; font-size: var(--text-xs); color: var(--ink-3); }
.bl.is-unassigned { border-style: dashed; border-color: var(--gold-600); background: var(--gold-50); }
.bl.is-unassigned .bl-hd { padding-bottom: 12px; align-items: center; }
.bl.is-other { border-color: var(--navy-200); }
.m-this { background: repeating-linear-gradient(90deg, var(--gold-500) 0 3px, var(--gold-300) 3px 5px); }
.sw-this { background: repeating-linear-gradient(90deg, var(--gold-500) 0 3px, var(--gold-300) 3px 5px); }

/* Two-tier line editor (PR / PO form) */
.lines { width: 100%; border-collapse: separate; border-spacing: 0; font-size: var(--text-sm); }
.lines thead th { position: sticky; top: var(--sticky-top); z-index: 2; padding: 9px 10px; text-align: left; font-size: var(--text-xs); font-weight: 600; color: var(--ink-2); background: var(--surface-2); border-bottom: 1px solid var(--line-2); white-space: nowrap; }
.lines thead th.num { text-align: right; }
.lines td { padding: 8px 10px; vertical-align: top; }
.lines .ln-main td { padding-top: 12px; }
.lines .ln-sub td { padding-top: 0; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.lines tbody.ln:last-of-type .ln-sub td { border-bottom: 0; }
.lines .stt { width: 36px; text-align: center; color: var(--ink-3); font-weight: 600; padding-top: 21px; }
.lines .input, .lines .select { min-height: 36px; padding: 6px 10px; font-size: var(--text-sm); }
.lines .num .input { text-align: right; }
.lines .total { padding-top: 21px; text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.lines .act { width: 44px; padding-top: 12px; }
.ln-item small { display: block; margin-top: 4px; font-size: 12px; color: var(--ink-3); }
.ln-strip { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 14px; padding: 8px 10px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-2); }
.ln-strip .chip { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; color: var(--ink-2); white-space: nowrap; }
.ln-strip .chip b { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.ln-strip .sep { width: 1px; height: 22px; background: var(--line-2); }
.ln-strip .bsel { flex: 1 1 280px; min-width: 240px; max-width: 380px; }
.ln-strip .bsel .select { min-height: 34px; background-color: var(--surface); }
.ln-strip .rem { display: grid; gap: 1px; font-size: 12.5px; line-height: 1.35; font-variant-numeric: tabular-nums; }
.ln-strip .rem .now { color: var(--ink-3); }
.ln-strip .rem .after { font-weight: 600; color: var(--ink); }
.ln-strip .rem .after.over { color: var(--red-700); }
.ln-strip.is-over { background: var(--red-50); border-color: var(--red-200); }
.ln-strip.is-warn { background: var(--gold-50); border-color: var(--gold-300); }
.ln-strip.is-empty { border-style: dashed; }
.ln-reason { margin-top: 8px; display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 8px 12px; align-items: start; }
.ln-reason label { padding-top: 8px; font-size: var(--text-xs); font-weight: 600; color: var(--ink-2); }
.lines tfoot td { padding: 12px 10px; border-top: 1px solid var(--ink-2); background: var(--surface-2); font-weight: 700; font-variant-numeric: tabular-nums; }
.lines tbody.ln.is-removed td { opacity: 0.5; text-decoration: line-through; }
.combo { position: relative; }
.combo-list { position: absolute; z-index: var(--z-dropdown); top: calc(100% + 4px); left: 0; width: 460px; max-height: 340px; overflow: auto; padding: 6px; margin: 0; list-style: none; background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--r-3); box-shadow: var(--shadow-2); }
.combo-list .grp { padding: 8px 10px 4px; font-size: 12px; font-weight: 700; color: var(--ink-3); }
.combo-list [role="option"] { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; padding: 8px 10px; border-radius: var(--r-2); cursor: pointer; }
.combo-list [role="option"] small { grid-column: 1 / -1; font-size: 12px; color: var(--ink-3); }
.combo-list [role="option"][aria-selected="true"], .combo-list [role="option"]:hover { background: var(--navy-50); }
.combo-list [role="option"] .r { font-size: 12px; color: var(--ink-3); white-space: nowrap; }
.combo-list .free { border-top: 1px solid var(--line); margin-top: 4px; padding-top: 10px; }

/* Form action bar (sticky bottom of long forms) */
.formbar { position: sticky; bottom: 0; z-index: var(--z-sticky); display: flex; align-items: center; gap: 10px; margin: 24px calc(-1 * var(--page-pad)) -72px; padding: 12px var(--page-pad); background: oklch(1 0 0 / 0.94); border-top: 1px solid var(--line-2); box-shadow: 0 -6px 18px oklch(0.25 0.06 261 / 0.06); }
.formbar .note { font-size: var(--text-xs); color: var(--ink-3); display: inline-flex; align-items: center; gap: 6px; }
.formbar .note.is-err { color: var(--red-700); background: var(--red-50); font-weight: 600; }
.formbar .grow { flex: 1; }
.err-sum { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px 12px; padding: 14px 16px; border: 1px solid var(--red-200); border-radius: var(--r-3); background: var(--red-50); color: var(--red-700); }
.err-sum strong { font-weight: 700; }
.err-sum ul { grid-column: 2; margin: 2px 0 0; padding-left: 18px; color: var(--ink); font-size: var(--text-sm); }
.err-sum a { color: var(--red-700); font-weight: 600; }

/* Inline “who holds it” strip on a document */
.holder { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; font-size: var(--text-sm); color: var(--ink-2); }
.holder .avatars { display: inline-flex; }
.holder .avatars .avatar { width: 26px; height: 26px; font-size: 10.5px; box-shadow: 0 0 0 2px var(--surface); }
.holder .avatars .avatar + .avatar { margin-left: -6px; }
.decide.is-mine .holder .avatars .avatar { box-shadow: 0 0 0 2px var(--gold-50); }
.req-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font-size: var(--text-sm); }
.req-list li { display: flex; gap: 8px; align-items: flex-start; }
.req-list .ok { color: var(--green-700); }
.req-list .todo { color: var(--gold-700); }
.req-list .i { margin-top: 1px; }
.matrix th.role { writing-mode: initial; text-align: center; min-width: 96px; white-space: normal; line-height: 1.25; }
.matrix td.cell { text-align: center; }
.matrix td.cell input { width: 18px; height: 18px; accent-color: var(--navy-800); }
.matrix tr.perm-grp > td { background: var(--surface-3); font-weight: 600; font-size: var(--text-xs); color: var(--ink-2); }
.cfg-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; counter-reset: cs; }
.cfg-step, .cfg-head { display: grid; grid-template-columns: 28px 32px minmax(0, 1.2fr) minmax(0, 1fr) minmax(0, 1fr) 118px 36px; gap: 12px; align-items: center; }
.cfg-step { padding: 10px 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-2); counter-increment: cs; }
.cfg-head { padding: 0 13px 2px; font-size: var(--text-xs); font-weight: 600; color: var(--ink-3); }
.cfg-step .meta { grid-column: 3 / -1; display: flex; flex-wrap: wrap; gap: 4px 18px; margin-top: -4px; font-size: var(--text-xs); color: var(--ink-3); }
.cfg-step .meta b { color: var(--ink-2); font-weight: 600; }
.cfg-step .meta .err, .cfg-step .meta .warn-text { font-size: var(--text-xs); }
.cfg-step.is-new { border-style: dashed; border-color: var(--navy-300); }
.cfg-step.ck, .cfg-head.ck { grid-template-columns: 28px 32px minmax(0, 1.35fr) minmax(0, 1fr) minmax(0, 1.15fr) 36px; }
.cfg-step .grip { color: var(--ink-3); cursor: grab; display: grid; place-items: center; }
.cfg-step .n::before { content: counter(cs); display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; font-size: 12.5px; font-weight: 700; color: #fff; background: var(--navy-700); }
.cfg-step .select, .cfg-step .input { min-height: 36px; font-size: var(--text-sm); }
.cfg-step.is-err { border-color: var(--red-200); background: var(--red-50); }
.cfg-preview { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: var(--text-sm); color: var(--ink-2); }
.cfg-preview .node { padding: 3px 9px; border-radius: var(--r-1); background: var(--navy-50); color: var(--navy-800); font-weight: 600; border: 1px solid var(--navy-100); }
.cfg-preview .arrow { color: var(--ink-3); }
.grid-cell-input { width: 100%; min-height: 34px; padding: 4px 8px; border: 1px solid transparent; border-radius: 3px; background: transparent; font: inherit; font-size: var(--text-sm); text-align: right; font-variant-numeric: tabular-nums; color: var(--ink); }
.grid-cell-input:hover { border-color: var(--line-2); background: var(--surface); }
.grid-cell-input:focus { outline: none; border-color: var(--navy-600); background: var(--surface); box-shadow: 0 0 0 2px var(--navy-100); }
.grid-cell-input.is-edited, .input.is-edited { background: var(--gold-50); border-color: var(--gold-300); }
.grid-cell-input.neg { color: var(--red-700); }
.diff { display: grid; grid-template-columns: auto minmax(0, 1fr) minmax(0, 1fr); gap: 2px 12px; font-size: var(--text-xs); }
.diff .k { color: var(--ink-3); }
.diff .old { color: var(--ink-3); text-decoration: line-through; }
.diff .old.none { text-decoration: none; }
.diff .new { color: var(--ink); font-weight: 600; }
.hl { background: var(--gold-100); padding: 0 2px; border-radius: 2px; }
.grid-cell-input.is-invalid { border-color: var(--red-700); background: var(--red-50); color: var(--red-700); }

/* Số liệu tháng — one open month in full đồng, the other months in tỷ */
.mgrid { font-size: 13px; }
.mgrid th, .mgrid td { padding: 7px 6px; }
.mgrid thead th { text-align: right; }
.mgrid thead a { color: inherit; text-decoration: none; }
.mgrid thead a:hover { color: var(--navy-800); text-decoration: underline; }
.mgrid th:first-child, .mgrid td:first-child { padding-left: 16px; text-align: left; }
.mgrid .m { width: 48px; text-align: right; font-variant-numeric: tabular-nums; color: var(--ink-2); }
.mgrid .m.off { color: var(--ink-3); }
.mgrid .open { width: 164px; text-align: right; background: var(--navy-50); }
.mgrid thead th.open { color: var(--navy-800); background: var(--navy-100); }
.mgrid .open .grid-cell-input { min-height: 30px; padding: 3px 7px; font-size: 13px; background: var(--surface); border-color: var(--line-2); }
.mgrid .open .grid-cell-input.is-edited { background: var(--gold-50); border-color: var(--gold-300); }
.mgrid .open .grid-cell-input.is-invalid { border-color: var(--red-700); background: var(--red-50); }
.mgrid .open .err { margin-top: 4px; text-align: left; font-weight: 600; }
.mgrid .yr { width: 76px; text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.mgrid tr.sub-total > td.open { background: var(--navy-100); }

/* Mục đích thanh toán — list beside its editor */
.pp-list { list-style: none; margin: 0; padding: 6px; }
.pp-list a { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 1px 10px; min-height: 44px; padding: 9px 12px; border-radius: var(--r-2); color: var(--ink); text-decoration: none; }
.pp-list a:hover { background: var(--surface-2); }
.pp-list a[aria-current="true"] { background: var(--navy-50); box-shadow: inset 0 0 0 1px var(--navy-100); }
.pp-list .nm { font-weight: 600; }
.pp-list .en { font-size: var(--text-xs); color: var(--ink-3); }
.pp-list .n { grid-row: 1 / span 2; grid-column: 2; align-self: center; font-size: var(--text-xs); color: var(--ink-3); text-align: right; }

/* -------------------------------------------------------------------------
   23. Responsive
   ------------------------------------------------------------------------- */
@media (max-width: 1279px) {
  :root { --sb-w: 232px; --page-pad: 24px; }
  .doc-layout { grid-template-columns: minmax(0, 1fr) 312px; }
  .home-grid { grid-template-columns: minmax(0, 1fr) 320px; }
  .hd-search { flex-basis: 300px; }
}
@media (max-width: 1100px) {
  .doc-layout, .home-grid { grid-template-columns: minmax(0, 1fr); }
  .aside { position: static; }
  .charts { grid-template-columns: minmax(0, 1fr); }
  .ledger { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .ledger > div:nth-child(3) { border-right: 0; }
  .ledger > div:nth-child(n+4) { border-top: 1px solid var(--line); }
}
@media (max-width: 1023px) {
  .body { grid-template-columns: minmax(0, 1fr); }
  .sb { display: none; }
  .hd-menu { display: grid; }
  .hd-brand { width: auto; padding-left: 4px; }
  .hd-user .who { display: none; }
  .kv { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ns5 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .auth { grid-template-columns: minmax(0, 1fr); }
  .auth-brand { display: none; }
}
@media (max-width: 760px) {
  :root { --page-pad: 16px; }
  body { font-size: 1rem; }
  .hd-search, .hd-year, .hd-new { display: none; }
  .hd-brand small { display: none; }
  .page-head { align-items: flex-start; }
  .q-row { grid-template-columns: 36px minmax(0, 1fr) auto; }
  .q-row .q-chev { display: none; }
  .q-age { grid-column: 3; }
  .grid-2, .grid-3, .grid-4, .kv { grid-template-columns: minmax(0, 1fr); }
  .ns5 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .eq { grid-template-columns: minmax(0, 1fr); }
  .eq-op { display: none; }
  .eq-term + .eq-term { border-top: 1px solid var(--line); }
  .eq-term.is-result { border-left: 0; border-radius: 0 0 var(--r-3) var(--r-3); }
  .ledger { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-grid > * { grid-column: 1 / -1; }
}

/* Phone-specific compositions (used inside body.ph) */
.ph .q-row { grid-template-columns: 36px minmax(0, 1fr) auto; gap: 2px 12px; padding: 14px 14px; min-height: 64px; }
.ph .q-row .q-chev { display: none; }
.ph .q-sum { white-space: normal; font-size: 0.9375rem; }
.ph .q-amt { font-size: 0.9375rem; }
.ph .home-head h1 { font-size: 1.5rem; }
.ph .oky { grid-template-columns: minmax(0, 1fr); }
.ph .oky > li { min-height: 0; flex-direction: row; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; padding: 12px 14px 12px 46px; border-right: 0; border-bottom: 1px solid var(--line); }
.ph .oky > li:last-child { border-bottom: 0; }
.ph .oky-n { left: 14px; right: auto; top: 13px; width: 22px; height: 22px; }
.ph .oky-role { flex: 1 1 100%; padding-right: 0; font-size: 0.875rem; }
.ph .oky-role small { display: inline; margin-left: 4px; }
.ph .oky-sign, .ph .oky > li .oky-state { margin-top: 2px; }
.ph .oky-line { display: none; }
.ph .oky > li.is-current::after { inset: 4px; }
.ph .ns5 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.ph .ns5 > div { border-bottom: 1px solid var(--line); }
.ph .ns5 > div:nth-child(2n) { border-right: 0; }
.ph .ns5 > .is-left { grid-column: 1 / -1; border-right: 0; }
.ph-sec { margin-top: 22px; }
.ph-sec > h2 { display: flex; align-items: baseline; gap: 8px; font-size: 0.9375rem; font-weight: 700; color: var(--ink); margin-bottom: 8px; }
.ph-sec > h2 .n { font-size: 0.8125rem; font-weight: 600; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.ph-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-3); }
.ph-card + .ph-card { margin-top: 10px; }
.ph-card-bd { padding: 14px; }
.ph-lines { list-style: none; margin: 0; padding: 0; }
.ph-lines > li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.ph-lines > li:last-child { border-bottom: 0; }
.ph-lines .nm { font-weight: 600; font-size: 0.9375rem; }
.ph-lines .q { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.ph-lines .sub { grid-column: 1 / -1; font-size: 13px; color: var(--ink-3); }
.ph-lines .bud { grid-column: 1 / -1; margin-top: 6px; }
.ph-doc-hd { padding: 16px; background: var(--surface); border-bottom: 1px solid var(--line); margin: -16px -16px 0; }
.ph-doc-hd .row { gap: 10px; }
.ph-doc-hd .num-big { font-size: 1.375rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.ph-stat { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-3); }
.ph-stat > div { padding: 12px 14px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.ph-stat > div:nth-child(2n) { border-right: 0; }
.ph-stat > div:nth-last-child(-n+2) { border-bottom: 0; }
.ph-stat .lbl { display: flex; align-items: center; gap: 5px; font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.ph-stat .fig { display: block; margin-top: 3px; font-family: var(--font-display); font-size: 1.5rem; font-weight: 600; line-height: 1.1; }
.ph-stat .fig .u { font-family: var(--font-ui); font-size: 0.8125rem; color: var(--ink-3); }
.ph-stat .fig.neg { color: var(--red-700); }
.ph-stat .sub { display: block; font-size: 12px; color: var(--ink-3); margin-top: 2px; }
.ph .chart-hd { padding: 14px 14px 4px; }
.ph .chart-bd { padding: 4px 12px 10px; }
.ph .chart-ft { padding: 10px 14px 12px; }
.ph .charts { grid-template-columns: minmax(0, 1fr); gap: 12px; }
.ph .chart .ax, .ph .chart .vlbl { font-size: 12.5px; }
.ph .d-only { display: none; }
.ph .chart-hd .btn { width: 44px; padding: 0; }
/* Phone: khoản mục accordion (ngân sách khoa) */
.km-acc > li { display: block; padding: 0; }
.km-acc summary { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; min-height: 44px; padding: 12px 14px; list-style: none; cursor: pointer; }
.km-acc summary::-webkit-details-marker { display: none; }
.km-acc summary:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.km-acc details[open] > summary { background: var(--surface-2); border-bottom: 1px solid var(--line); }
.km-lines { list-style: none; margin: 0; padding: 2px 14px 8px 26px; }
.km-lines li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 10px; padding: 10px 0; border-bottom: 1px dashed var(--line); font-size: 0.875rem; }
.km-lines li:last-child { border-bottom: 0; }
.km-lines .nm { font-weight: 600; }
.km-lines .q { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.km-lines .q.lv-warn { color: var(--gold-700); }
.km-lines .sub { grid-column: 1 / -1; font-size: 12.5px; color: var(--ink-3); }

/* -------------------------------------------------------------------------
   24. Motion preferences & print
   ------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
}
@media print {
  @page { size: A4 portrait; margin: 0; }
  body.print-view { background: #fff; }
  .print-bar, .no-print { display: none !important; }
  .a4-stack { padding: 0; overflow: visible; }
  .a4, .a4 + .a4 { box-shadow: none; margin: 0; page-break-after: always; }
  .a4:last-child { page-break-after: auto; }
  .hd, .sb, .tabbar, .actbar, .page-actions { display: none !important; }
  .body { display: block; }
}
