/* FAI HRM — giao diện. Bố cục: thanh menu trái (máy tính) · thanh biểu tượng (iPad) · thanh tab dưới (điện thoại) */
:root {
  --bg: #F3F5F2; --surface: #FFFFFF; --surface2: #F7F8F6; --line: #E1E5DF; --line2: #EDF0EB;
  --fg: #15201C; --muted: #59645F; --faint: #8A948F;
  --brand: #0B6B5A; --brand-ink: #FFFFFF; --brand-soft: #E2F1EC; --brand-strong: #08493E;
  --ink-panel: #15201C; --ink-panel2: #22302B; --ink-text: #DCE5E1; --ink-accent: #7FD3BE; --ink-on-accent: #0D2620;
  --ok: #1E6B3E; --ok-bg: #E7F4EC; --warn: #8A5A00; --warn-bg: #FBF0D9; --bad: #B3261E; --bad-bg: #FBE7E5;
  --info: #1F4E8A; --info-bg: #E5ECF6; --violet: #5B3A85; --violet-bg: #EEE8F4;
  --paper: #FFFFFF; --paper-ink: #000000; --seal: #0B6B5A; --seal-red: #B3261E; --sig-ink: #1F3F8A;
  --shadow: 0 1px 2px rgba(21, 32, 28, .06), 0 10px 30px rgba(21, 32, 28, .08);
  --f-ui: 'Be Vietnam Pro', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --f-doc: 'Times New Roman', Tinos, 'Liberation Serif', Times, serif;
  --f-sig: 'Dancing Script', 'Segoe Script', cursive;
  --r: 12px; --r-lg: 16px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0F1513; --surface: #17201D; --surface2: #1C2724; --line: #2A3632; --line2: #222D29;
    --fg: #E6ECE9; --muted: #A3AFAA; --faint: #7D8984;
    --brand: #3FB497; --brand-ink: #062019; --brand-soft: #173A31; --brand-strong: #7FD3BE;
    --ink-panel: #0A100E; --ink-panel2: #16201C; --ink-text: #CBD6D1; --ink-accent: #7FD3BE; --ink-on-accent: #0D2620;
    --ok: #7FD39B; --ok-bg: #173323; --warn: #F0C56B; --warn-bg: #3A2D12; --bad: #F2948C; --bad-bg: #3D1B18;
    --info: #9DBDF0; --info-bg: #1A2A40; --violet: #C7AEE8; --violet-bg: #2C2238;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 30px rgba(0, 0, 0, .35);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0F1513; --surface: #17201D; --surface2: #1C2724; --line: #2A3632; --line2: #222D29;
  --fg: #E6ECE9; --muted: #A3AFAA; --faint: #7D8984;
  --brand: #3FB497; --brand-ink: #062019; --brand-soft: #173A31; --brand-strong: #7FD3BE;
  --ink-panel: #0A100E; --ink-panel2: #16201C; --ink-text: #CBD6D1; --ink-accent: #7FD3BE; --ink-on-accent: #0D2620;
  --ok: #7FD39B; --ok-bg: #173323; --warn: #F0C56B; --warn-bg: #3A2D12; --bad: #F2948C; --bad-bg: #3D1B18;
  --info: #9DBDF0; --info-bg: #1A2A40; --violet: #C7AEE8; --violet-bg: #2C2238;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 30px rgba(0, 0, 0, .35);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 14px/1.5 var(--f-ui); -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--brand); }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
h1, h2, h3 { text-wrap: balance; margin: 0; }
.num, .tnum { font-variant-numeric: tabular-nums; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ---------- Thương hiệu ---------- */
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--fg); }
.mark { width: 38px; height: 38px; border-radius: 11px; background: var(--brand); color: var(--brand-ink); display: grid; place-items: center; flex: none; }
.mark svg { width: 24px; height: 24px; }
.wordmark { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.wordmark b { font-size: 17px; font-weight: 800; letter-spacing: .02em; }
.wordmark b span { color: var(--brand); }
.wordmark small { font-size: 11px; color: var(--muted); white-space: nowrap; }

/* ---------- Khung ứng dụng ---------- */
.app { display: flex; min-height: 100%; }
.side { width: 248px; flex: none; background: var(--surface); border-right: 1px solid var(--line); padding: 20px 14px; display: flex; flex-direction: column; gap: 3px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.side .brand { padding: 0 8px 18px; }
.nav { display: flex; align-items: center; gap: 12px; padding: 0 12px; min-height: 44px; border-radius: 10px; color: var(--fg); text-decoration: none; font-weight: 500; border: 0; background: none; cursor: pointer; text-align: left; width: 100%; }
.nav:hover { background: var(--surface2); }
.nav.on { background: var(--brand-soft); color: var(--brand-strong); font-weight: 600; }
.nav svg { width: 20px; height: 20px; flex: none; }
.nav .lbl { flex: 1; }
.cnt { background: var(--bad); color: #fff; font-size: 11.5px; font-weight: 700; padding: 1px 7px; border-radius: 999px; }
.side .grow { flex: 1; }
.side .foot { margin-top: 12px; padding: 12px; border-radius: 12px; background: var(--surface2); font-size: 12px; color: var(--muted); display: flex; flex-direction: column; gap: 6px; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.top { display: flex; align-items: center; gap: 12px; padding: 14px max(16px, env(safe-area-inset-right, 0px)) 14px max(24px, env(safe-area-inset-left, 0px)); position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(8px); }
.top .brand { display: none; }
.aibar { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 0 6px 0 14px; min-height: 48px; }
.aibar svg { flex: none; color: var(--brand); }
.aibar input { flex: 1; min-width: 0; border: 0; outline: none; background: transparent; font-size: 14px; }
.aibar .btn { min-height: 36px; }
.who { display: flex; align-items: center; gap: 10px; background: none; border: 0; cursor: pointer; padding: 4px; border-radius: 12px; text-align: left; }
.who:hover { background: var(--surface2); }
.av { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 13.5px; flex: none; background: var(--brand-soft); color: var(--brand-strong); }
.av.s { width: 34px; height: 34px; font-size: 12px; }
.who .nm { display: flex; flex-direction: column; line-height: 1.25; }
.who .nm b { font-size: 14px; } .who .nm span { font-size: 12px; color: var(--muted); }
.page { padding: 8px max(16px, env(safe-area-inset-right, 0px)) 40px max(24px, env(safe-area-inset-left, 0px)); display: flex; flex-direction: column; gap: 20px; max-width: 1480px; width: 100%; }
.ph { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; }
.ph h1 { font-size: 26px; font-weight: 700; letter-spacing: -.01em; }
.ph p { margin: 2px 0 0; color: var(--muted); }
.ph .acts { display: flex; gap: 8px; flex-wrap: wrap; }
.tabbar { display: none; }

@media (max-width: 1099px) {
  .side { width: 76px; padding: 18px 10px; align-items: center; }
  .side .wordmark, .side .lbl, .side .foot { display: none; }
  .side .brand { padding: 0 0 16px; }
  .nav { justify-content: center; padding: 0; width: 52px; position: relative; }
  .nav .cnt { position: absolute; top: 2px; right: 0; font-size: 10px; padding: 0 5px; }
}
@media (max-width: 759px) {
  .side { display: none; }
  .top { padding: 10px max(16px, env(safe-area-inset-right, 0px)) 10px max(16px, env(safe-area-inset-left, 0px)); flex-wrap: wrap; }
  .top .brand { display: flex; flex: 1; }
  .aibar { order: 3; flex-basis: 100%; }
  .who .nm { display: none; }
  .page { padding: 4px max(16px, env(safe-area-inset-right, 0px)) 96px max(16px, env(safe-area-inset-left, 0px)); gap: 16px; }
  .ph h1 { font-size: 22px; }
  .tabbar { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: var(--surface); border-top: 1px solid var(--line); padding: 6px max(4px, env(safe-area-inset-right, 0px)) calc(6px + env(safe-area-inset-bottom, 0px)) max(4px, env(safe-area-inset-left, 0px)); }
  .tabbar button { background: none; border: 0; display: flex; flex-direction: column; align-items: center; gap: 2px; min-height: 50px; justify-content: center; font-size: 11px; color: var(--muted); position: relative; cursor: pointer; }
  .tabbar button.on { color: var(--brand); font-weight: 600; }
  .tabbar svg { width: 22px; height: 22px; }
  .tabbar .cnt { position: absolute; top: 2px; left: 55%; font-size: 10px; padding: 0 5px; }
}
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 25; background: var(--bg); }

/* ---------- Thành phần ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 18px; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.card h2 { font-size: 16px; font-weight: 700; }
.ch { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.dark { background: var(--ink-panel); border-color: var(--ink-panel); color: #fff; }
.dark p, .dark li { color: var(--ink-text); }
.dark .sub { background: var(--ink-panel2); border-radius: 12px; padding: 12px; display: flex; flex-direction: column; gap: 3px; }
.dark .sub b { color: #fff; font-size: 13.5px; }
.dark .sub span { color: var(--ink-text); font-size: 12.5px; }
.grid { display: grid; gap: 16px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; }
@media (max-width: 759px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; } .kpi { padding: 14px; } .kpi b { font-size: 24px; } }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 16px 18px; display: flex; flex-direction: column; gap: 4px; }
.kpi span { font-size: 13px; color: var(--muted); }
.kpi b { font-size: 28px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.2; }
.kpi b small { font-size: 15px; color: var(--muted); font-weight: 500; }
.kpi i { font-style: normal; font-size: 12px; }
.cols { display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-start; }
.cols > .c3 { flex: 3 1 520px; min-width: 0; }
.cols > .c2 { flex: 2 1 330px; min-width: 0; }
.cols > .c1 { flex: 1 1 280px; min-width: 0; }
.stack { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 0 16px; border-radius: 11px; border: 1px solid var(--line); background: var(--surface); color: var(--fg); font-weight: 600; font-size: 13.5px; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { background: var(--surface2); }
.btn.pri { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn.pri:hover { background: var(--brand-strong); border-color: var(--brand-strong); }
.btn.soft { background: var(--brand-soft); border-color: transparent; color: var(--brand-strong); }
.btn.danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 35%, var(--line)); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.lg { min-height: 52px; font-size: 15px; border-radius: 13px; }
.btn.sm { min-height: 36px; padding: 0 12px; font-size: 13px; }
.btn.blk { width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn svg { width: 18px; height: 18px; }
.ibtn { width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); display: grid; place-items: center; cursor: pointer; flex: none; position: relative; color: var(--fg); }
.ibtn .dot { position: absolute; top: 9px; right: 10px; width: 8px; height: 8px; border-radius: 50%; background: var(--bad); }

.pill { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 999px; white-space: nowrap; }
.pill.ok { color: var(--ok); background: var(--ok-bg); }
.pill.warn { color: var(--warn); background: var(--warn-bg); }
.pill.bad { color: var(--bad); background: var(--bad-bg); }
.pill.info { color: var(--info); background: var(--info-bg); }
.pill.mute { color: var(--muted); background: var(--surface2); }
.pill.brand { color: var(--brand-strong); background: var(--brand-soft); }

.list { display: flex; flex-direction: column; }
.item { display: flex; align-items: center; gap: 14px; padding: 13px 0; border-top: 1px solid var(--line2); flex-wrap: wrap; }
.item:first-child { border-top: 0; }
.item .tx { flex: 1 1 220px; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.item .tx b { font-size: 14px; }
.item .tx span { font-size: 13px; color: var(--muted); }
.item.nw { flex-wrap: nowrap; } .item.nw .tx { flex: 1 1 auto; }
.item.click { cursor: pointer; border-radius: 10px; }
.item.click:hover { background: var(--surface2); }
.empty { padding: 28px 12px; text-align: center; color: var(--muted); display: flex; flex-direction: column; gap: 8px; align-items: center; }

.fld { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.fld > span { font-size: 13px; font-weight: 600; }
.fld > span i { color: var(--bad); font-style: normal; }
.in { border: 1px solid var(--line); background: var(--surface); border-radius: 10px; padding: 0 12px; min-height: 44px; width: 100%; outline: none; }
textarea.in { padding: 10px 12px; min-height: 84px; resize: vertical; }
.in:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form .full { grid-column: 1 / -1; }
@media (max-width: 560px) { .form { grid-template-columns: minmax(0, 1fr); } }
.hint { font-size: 12px; color: var(--muted); }
.err { color: var(--bad); font-size: 13px; font-weight: 600; }
.seg { display: inline-flex; background: var(--surface2); border: 1px solid var(--line); border-radius: 11px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg button { border: 0; background: none; padding: 0 12px; min-height: 36px; border-radius: 8px; font-size: 13px; font-weight: 600; color: var(--muted); cursor: pointer; }
.seg button.on { background: var(--surface); color: var(--fg); box-shadow: 0 1px 2px rgba(0, 0, 0, .08); }

.scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
.tbl th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); padding: 10px 10px; background: var(--surface2); white-space: nowrap; }
.tbl td { padding: 10px; border-top: 1px solid var(--line2); white-space: nowrap; }
.tbl .r { text-align: right; } .tbl .c { text-align: center; }
.tbl tr.click { cursor: pointer; } .tbl tr.click:hover td { background: var(--surface2); }
.tbl .nm b { display: block; font-size: 13.5px; } .tbl .nm span { font-size: 11.5px; color: var(--muted); }
.tbl tfoot td { font-weight: 700; border-top: 2px solid var(--line); }

/* Bảng công */
.ts { border-collapse: separate; border-spacing: 3px; font-size: 12px; font-variant-numeric: tabular-nums; }
.ts th { font-size: 11px; font-weight: 600; color: var(--muted); padding: 2px 0; line-height: 1.25; text-align: center; min-width: 30px; }
.ts th.sun { color: var(--bad); }
.ts th.nmh { text-align: left; min-width: 180px; padding-left: 6px; position: sticky; left: 0; background: var(--surface); z-index: 1; }
.ts td.nmc { position: sticky; left: 0; background: var(--surface); z-index: 1; padding: 4px 6px; white-space: nowrap; }
.ts td.nmc b { display: block; font-size: 13px; } .ts td.nmc span { font-size: 11px; color: var(--muted); }
.ts td.cd { width: 30px; height: 32px; text-align: center; border-radius: 6px; font-weight: 700; cursor: default; }
.ts td.tot { padding: 0 8px; text-align: center; font-weight: 700; font-size: 13px; }
.c-X { color: var(--ok); background: var(--ok-bg); }
.c-M { color: var(--warn); background: var(--warn-bg); }
.c-P, .c-CT { color: var(--info); background: var(--info-bg); }
.c-Ô { color: var(--violet); background: var(--violet-bg); }
.c-K, .c-V, .c-KL { color: var(--bad); background: var(--bad-bg); }
.c-CN { color: var(--brand-ink); background: var(--brand); font-size: 10px; }
.c-L { color: var(--muted); background: var(--surface2); }
.c-, .c-CN\? { color: var(--faint); background: var(--surface2); }
.legend { display: flex; flex-wrap: wrap; gap: 12px; font-size: 12px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { font-style: normal; width: 24px; height: 18px; border-radius: 4px; display: inline-grid; place-items: center; font-weight: 700; font-size: 11px; }

/* Luồng duyệt */
.flow { display: flex; flex-direction: column; }
.fs { display: flex; gap: 12px; }
.fs .rail { display: flex; flex-direction: column; align-items: center; }
.fs .dotn { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 700; border: 2px solid var(--line); color: var(--muted); background: var(--surface); flex: none; }
.fs .bar { width: 2px; flex: 1; background: var(--line); min-height: 14px; }
.fs.signed .dotn { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.fs.signed .bar { background: var(--brand); }
.fs.pending .dotn { background: var(--warn-bg); border-color: var(--warn); color: var(--warn); }
.fs.rejected .dotn, .fs.returned .dotn { background: var(--bad-bg); border-color: var(--bad); color: var(--bad); }
.fs .body { padding-bottom: 14px; display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.fs .body b { font-size: 14px; } .fs .body span { font-size: 12.5px; color: var(--muted); }
.fs.pending .body span.st { color: var(--warn); font-weight: 600; }

.checks { display: flex; flex-direction: column; gap: 8px; }
.chk { display: flex; gap: 10px; font-size: 13px; line-height: 1.45; align-items: flex-start; }
.chk i { font-style: normal; width: 20px; height: 20px; border-radius: 50%; flex: none; display: grid; place-items: center; font-size: 12px; font-weight: 800; }
.chk.ok i { background: var(--ok-bg); color: var(--ok); }
.chk.warn i { background: var(--warn-bg); color: var(--warn); }
.chk.bad i { background: var(--bad-bg); color: var(--bad); }

/* Mẫu biểu */
.tpls { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.tpl { text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 14px; display: flex; gap: 12px; cursor: pointer; align-items: flex-start; }
.tpl:hover { border-color: var(--brand); }
.tpl .ic { width: 44px; height: 58px; border: 1px solid var(--line); border-radius: 4px; background: var(--paper); flex: none; padding: 7px 6px; display: flex; flex-direction: column; gap: 3px; }
.tpl .ic span { height: 2px; background: #C8CEC9; } .tpl .ic span:first-child { height: 3px; background: #333; width: 70%; align-self: center; }
.tpl .tx { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.tpl .tx b { font-size: 14px; } .tpl .tx span { font-size: 12px; color: var(--muted); }

.editor { display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-start; }
.editor > .fm { flex: 1 1 360px; min-width: 0; }
.editor > .pv { flex: 1.4 1 480px; min-width: 0; position: sticky; top: 90px; }
@media (max-width: 759px) { .editor > .pv { position: static; } }

/* Hộp thoại */
.back { position: fixed; inset: 0; background: rgba(10, 16, 14, .45); z-index: 50; display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal { background: var(--surface); border-radius: 20px; width: min(460px, 100%); max-height: calc(100% - 20px); overflow: auto; padding: 22px; display: flex; flex-direction: column; gap: 14px; box-shadow: var(--shadow); }
.modal.wide { width: min(760px, 100%); }
.modal h2 { font-size: 18px; }
@media (max-width: 759px) {
  .back { align-items: flex-end; padding: 0; }
  .modal { border-radius: 22px 22px 0 0; width: 100%; padding-bottom: calc(22px + env(safe-area-inset-bottom, 0px)); }
}
.pin { display: flex; gap: 8px; justify-content: center; }
.pin input { width: 46px; height: 54px; text-align: center; font-size: 22px; font-weight: 700; border: 1px solid var(--line); border-radius: 12px; background: var(--surface2); }
.pin input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.sigicon { width: 84px; height: 84px; border-radius: 26px; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; align-self: center; }
.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); background: var(--ink-panel); color: #fff; padding: 12px 18px; border-radius: 12px; z-index: 60; font-weight: 600; box-shadow: var(--shadow); max-width: calc(100% - 32px); }
@media (max-width: 759px) { .toast { bottom: calc(84px + env(safe-area-inset-bottom, 0px)); } }

/* Đăng nhập */
.login { min-height: 100%; display: flex; align-items: center; justify-content: center; padding: 32px max(16px, env(safe-area-inset-right, 0px)) 32px max(16px, env(safe-area-inset-left, 0px)); background: radial-gradient(1200px 500px at 0% 0%, var(--brand-soft), transparent 60%), var(--bg); }
.lbox { width: min(980px, 100%); display: flex; flex-wrap: wrap; gap: 28px; align-items: stretch; }
.lbox .intro { flex: 1 1 340px; display: flex; flex-direction: column; gap: 18px; justify-content: center; }
.lbox .intro h1 { font-size: 34px; line-height: 1.15; letter-spacing: -.02em; }
.lbox .intro p { color: var(--muted); margin: 0; font-size: 15px; max-width: 46ch; }
.lbox .panel { flex: 1 1 380px; }
.acc { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; max-height: 420px; overflow: auto; padding: 2px; }
.acc button { text-align: left; display: flex; gap: 10px; align-items: center; border: 1px solid var(--line); background: var(--surface); border-radius: 12px; padding: 10px; cursor: pointer; }
.acc button:hover { border-color: var(--brand); }
.acc .tx { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.acc .tx b { font-size: 13.5px; } .acc .tx span { font-size: 11.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bigmark { width: 60px; height: 60px; border-radius: 18px; }
.bigmark svg { width: 38px; height: 38px; }

/* Chat AI */
.chat { display: flex; flex-direction: column; gap: 10px; max-height: 52vh; overflow: auto; }
.bub { padding: 10px 14px; border-radius: 16px; font-size: 14px; line-height: 1.55; white-space: pre-wrap; max-width: 92%; }
.bub.u { align-self: flex-end; background: var(--brand); color: var(--brand-ink); border-bottom-right-radius: 4px; }
.bub.a { align-self: flex-start; background: var(--surface2); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chips button { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 0 12px; min-height: 34px; font-size: 12.5px; cursor: pointer; }

/* Chấm công nhanh */
.clock { background: var(--ink-panel); color: #fff; border-radius: 20px; padding: 18px; display: flex; flex-direction: column; gap: 14px; }
.clock .tm { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.clock .tm div { background: var(--ink-panel2); border-radius: 12px; padding: 10px 12px; display: flex; flex-direction: column; }
.clock .tm span { font-size: 11.5px; color: var(--ink-text); }
.clock .tm b { font-size: 20px; font-variant-numeric: tabular-nums; }
.clock .btn.pri { background: var(--ink-accent); border-color: var(--ink-accent); color: var(--ink-on-accent); }
.clock small { color: var(--ink-text); text-align: center; }

/* ---------- Trang A4 ---------- */
.a4wrap { width: 100%; overflow: hidden; }
.a4scale { transform-origin: top left; width: 794px; margin: 0 auto; }
.a4 { width: 794px; min-height: 1123px; background: var(--paper); color: var(--paper-ink); box-shadow: var(--shadow); position: relative; }
.a4in { width: 794px; min-height: 1123px; padding: 76px 57px 60px 113px; font: 17.33px/1.42 var(--f-doc); display: flex; flex-direction: column; }
.a4 .hd { display: flex; justify-content: space-between; gap: 12px; font-size: 16px; }
.a4 .co { display: flex; flex-direction: column; align-items: center; text-align: center; max-width: 255px; line-height: 1.3; }
.a4 .co b { font-size: 15.5px; }
.a4 .qh { display: flex; flex-direction: column; align-items: center; text-align: center; line-height: 1.3; }
.a4 .qh b { font-size: 16px; white-space: nowrap; } .a4 .qh .dl { font-size: 17.33px; }
.a4 .u { width: 70px; border-top: 1px solid currentColor; margin: 4px 0; }
.a4 .u2 { width: 200px; border-top: 1px solid currentColor; margin-top: 2px; }
.a4 .dt { text-align: right; margin: 14px 0 0; }
.a4 .ti { font-size: 20px; font-weight: 700; text-align: center; margin: 20px 0 14px; line-height: 1.35; letter-spacing: .01em; }
.a4 .kg { display: flex; gap: 8px; margin: 0 0 10px 54px; }
.a4 .kg div { display: flex; flex-direction: column; }
.a4 .bd p { margin: 0 0 3px; text-align: justify; }
.a4 .bd .two p { text-align: left; }
.a4 .bd .two { display: grid; grid-template-columns: 1.15fr 1fr; column-gap: 14px; }
.a4 .bd .ind { text-indent: 40px; margin-top: 6px; }
.a4 .bd .cks { display: flex; flex-wrap: wrap; column-gap: 20px; }
.a4 .bd .ck { white-space: nowrap; }
.a4 .dots { color: #555; letter-spacing: 1px; }
.a4 .tb { width: 100%; border-collapse: collapse; margin: 6px 0 8px; font-size: 16px; }
.a4 .tb th, .a4 .tb td { border: 1px solid #000; padding: 4px 8px; text-align: left; }
.a4 .tb th { font-weight: 700; text-align: center; }
.a4 .tb.num td:not(:first-child) { text-align: right; font-variant-numeric: tabular-nums; }
.a4 .tb .sum td { font-weight: 700; }
.a4 .sgs { display: grid; gap: 10px; margin-top: 22px; text-align: center; }
.a4 .sg { display: flex; flex-direction: column; align-items: center; gap: 3px; min-width: 0; }
.a4 .sg .t { font-size: 14.5px; line-height: 1.25; } .a4 .sg .h { font-size: 13px; }
.a4 .sg .n { font-size: 15px; }
.a4 .sg .cm { font-size: 13px; line-height: 1.3; }
.a4 .st { width: 100%; max-width: 150px; height: 98px; border-radius: 5px; display: flex; flex-direction: column; justify-content: space-between; padding: 4px 6px; text-align: left; font: 9.5px/1.3 var(--f-ui); }
.a4 .st.ok { border: 1.3px solid var(--seal); color: var(--seal); }
.a4 .st.ok.red { border-color: var(--seal-red); color: var(--seal-red); }
.a4 .st.no { border: 1.3px solid var(--seal-red); color: var(--seal-red); justify-content: center; text-align: center; }
.a4 .st.wait { border: 1.3px dashed #8A5A00; color: #8A5A00; justify-content: center; text-align: center; }
.a4 .st.none { border: 1px dashed #9AA19C; }
.a4 .st .sig { font: 600 23px/1.1 var(--f-sig); color: var(--sig-ink); text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.a4 .st .mid { text-align: center; }
.a4 .sp { flex: 1; min-height: 24px; }
.a4 .ft { display: flex; gap: 14px; align-items: center; border-top: 1px solid #000; padding-top: 10px; font-size: 13px; line-height: 1.45; }
.a4 .qr { width: 80px; height: 80px; flex: none; }
.a4 .qr svg { width: 80px; height: 80px; display: block; }
.a4 .ftx { flex: 1; display: flex; flex-direction: column; }
.a4 .pg { align-self: flex-end; font-size: 12px; }

#print-root { display: none; }
@page { size: A4 portrait; margin: 0; }
@media print {
  html, body { background: #fff !important; height: auto; }
  body > *:not(#print-root) { display: none !important; }
  #print-root { display: block; }
  #print-root .a4 { box-shadow: none; width: 210mm; min-height: 297mm; }
  #print-root .a4in { width: 210mm; min-height: 297mm; padding: 20mm 15mm 16mm 30mm; font-size: 13pt; }
  .a4 .st.ok { border-color: #0B6B5A !important; color: #0B6B5A !important; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* Phiếu lương */
.slip { display: flex; flex-direction: column; gap: 2px; }
.slip .l { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-top: 1px dashed var(--line); font-variant-numeric: tabular-nums; }
.slip .l:first-child { border-top: 0; }
.slip .l.t { font-weight: 700; font-size: 16px; border-top: 2px solid var(--line); }
.slip .l span { color: var(--muted); }
.big { font-size: 30px; font-weight: 700; color: var(--brand); font-variant-numeric: tabular-nums; }
.bar2 { height: 6px; border-radius: 3px; background: var(--line); display: flex; gap: 3px; }
.steps4 { display: grid; gap: 4px; }
.steps4 span { height: 5px; border-radius: 3px; background: var(--line); }
.steps4 span.d { background: var(--brand); } .steps4 span.p { background: var(--warn); } .steps4 span.x { background: var(--bad); }
