/* KSANQN2 3.0 — Hệ thống thiết kế.
   Bố cục: iPhone trước (thanh tab đáy, sheet trượt từ dưới), máy tính ≥ 900px chuyển thanh tab thành cột trái.
   Màu: xanh A08 #19563d là màu chủ đạo, vàng #efc75e làm điểm nhấn; nền trung tính hơi ngả xanh. */
:root {
  --green: #19563d; --green-ink: #0f3a28; --green-soft: #e3efe8; --gold: #efc75e; --gold-ink: #7a5600; --gold-soft: #fbf1d3;
  --bg: #f3f5f2; --surface: #ffffff; --surface-2: #eef2ee; --line: #dde4de; --text: #17211b; --muted: #5b6a61; --faint: #63716a;
  --good: #1d7446; --good-soft: #e1f2e8; --warn: #9a5a00; --warn-soft: #fdf0d9; --bad: #b3261e; --bad-soft: #fbe5e3;
  --info: #2c5794; --info-soft: #e4ecf8; --rose: #a6405a; --rose-soft: #f8e4ea;
  --accent: var(--green); --on-accent: #ffffff; --shadow: 0 1px 2px rgba(16, 40, 28, .06), 0 8px 24px rgba(16, 40, 28, .06);
  --r: 14px; --r-sm: 10px; --tab-h: 58px; --side-w: 248px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-num: ui-rounded, -apple-system, "SF Pro Rounded", "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
  font-size: 17px;
}
:root[data-font="large"] { font-size: 19px; }
:root[data-font="xlarge"] { font-size: 21px; }
:root[data-theme="dark"] {
  --green: #237a55; --green-ink: #8fd8b3; --green-soft: #17322a; --gold: #f2cf72; --gold-ink: #f2cf72; --gold-soft: #3a3016;
  --bg: #0d1411; --surface: #151f1a; --surface-2: #1c2822; --line: #29372f; --text: #e5ece7; --muted: #a6b5ab; --faint: #93a399;
  --good: #63cf98; --good-soft: #163527; --warn: #f0b45e; --warn-soft: #3a2b12; --bad: #f2867d; --bad-soft: #3b1a18;
  --info: #93b6ee; --info-soft: #182841; --rose: #ec95ab; --rose-soft: #3a1c25;
  --accent: #237a55; --on-accent: #ffffff; --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 400 1rem/1.45 var(--font); -webkit-font-smoothing: antialiased; overflow-x: hidden; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; }
/* iOS: bỏ trễ chạm đúp, không phóng to khi chạm đúp, không hiện menu giữ lâu trên nút, không kéo dãn nền. */
html { touch-action: manipulation; overscroll-behavior-y: none; }
button, .chip, .tabbar, .quick-btn, .row { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
/* Khóa cuộn nền khi có sheet */
html.sheet-open, html.sheet-open body { overflow: hidden; overscroll-behavior: none; }
html.sheet-open body { position: fixed; left: 0; right: 0; width: 100%; }
/* Bàn phím mở: ẩn thanh tab, sheet nổi trên bàn phím */
html.kb-open .tabbar { display: none; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--gold) 80%, transparent); outline-offset: 2px; }
[hidden] { display: none !important; }
.ic { width: 1.25rem; height: 1.25rem; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ic.big { width: 2rem; height: 2rem; opacity: .5; }

/* ---------- Khởi động & che màn hình ---------- */
#boot, #cover { position: fixed; inset: 0; display: grid; place-content: center; justify-items: center; gap: 14px; background: var(--green); color: #fff; text-align: center; padding: 24px; z-index: 100; }
#boot p, #cover p { margin: 0; max-width: 30ch; font-size: .95rem; opacity: .92; }
#boot strong { font-size: 1.4rem; letter-spacing: .02em; }
#cover { z-index: 1000; }

/* ---------- Thanh trên ---------- */
.appbar { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: saturate(1.6) blur(14px); -webkit-backdrop-filter: saturate(1.6) blur(14px);
  padding: calc(env(safe-area-inset-top, 0px) + 8px) max(16px, env(safe-area-inset-right, 0px)) 6px max(16px, env(safe-area-inset-left, 0px)); border-bottom: 1px solid transparent; }
.appbar-row { display: flex; align-items: center; gap: 10px; min-height: 44px; }
.brand { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.brand img { width: 34px; height: 34px; border-radius: 50%; flex: none; }
.brand-text { display: grid; line-height: 1.15; min-width: 0; }
.brand-text strong { font-size: .95rem; letter-spacing: .04em; color: var(--green-ink); }
.brand-text span { font-size: .72rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.app-title { margin: 6px 0 12px; font-size: 1.85rem; line-height: 1.12; letter-spacing: -.02em; font-weight: 750; text-wrap: balance; }
.app-action { display: flex; gap: 6px; margin-left: auto; }
.back:not([hidden]) + .brand { display: none; }
.icon-btn { display: inline-grid; place-items: center; width: 44px; height: 44px; border: 0; border-radius: 50%; background: transparent; color: var(--green-ink); }
.icon-btn:active { background: var(--surface-2); }

/* ---------- Thanh tab ---------- */
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: grid; grid-template-columns: repeat(5, 1fr);
  padding: 4px max(6px, env(safe-area-inset-right, 0px)) calc(env(safe-area-inset-bottom, 0px) + 4px) max(6px, env(safe-area-inset-left, 0px));
  background: color-mix(in srgb, var(--surface) 90%, transparent); backdrop-filter: saturate(1.6) blur(18px); -webkit-backdrop-filter: saturate(1.6) blur(18px); border-top: 1px solid var(--line); }
.tabbar button { display: grid; justify-items: center; gap: 2px; min-height: 50px; padding: 4px 2px; border: 0; background: none; color: var(--muted); font-size: .66rem; font-weight: 600; letter-spacing: .01em; border-radius: 12px; }
.tabbar button .ic { width: 1.45rem; height: 1.45rem; }
.tabbar button span { white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 360px) { .tabbar button { font-size: .58rem; letter-spacing: -.01em; } .app-title { font-size: 1.6rem; } }
.tabbar button.on { color: var(--green); }
:root[data-theme="dark"] .tabbar button.on { color: var(--green-ink); }
.tabbar button.on .ic { stroke-width: 2.2; }
.side-brand { display: none; }

/* ---------- Khung nội dung ---------- */
main { padding: 6px max(16px, env(safe-area-inset-right, 0px)) calc(var(--tab-h) + env(safe-area-inset-bottom, 0px) + 28px) max(16px, env(safe-area-inset-left, 0px)); max-width: 980px; margin: 0 auto; outline: none; }
.view { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; animation: rise .22s ease-out both; }
@keyframes rise { from { opacity: .4; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .view, .sheet, .toast { animation: none !important; transition: none !important; } }
.hero { display: grid; gap: 2px; }
.kicker { margin: 0; font-size: .74rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.hero-line { margin: 0; color: var(--muted); font-size: .92rem; }
.note { margin: 0; color: var(--muted); font-size: .86rem; line-height: 1.45; max-width: 70ch; }
.lead { margin: 0; font-size: 1rem; line-height: 1.5; }
.footnote { text-align: center; color: var(--faint); font-size: .78rem; margin: 6px 0 0; }
.pre { white-space: pre-wrap; overflow-wrap: anywhere; margin: 0; }
.block { display: grid; gap: 10px; }
.block-title { margin: 8px 2px 0; font-size: .8rem; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }
.result-meta { margin: 0 2px; color: var(--muted); font-size: .84rem; font-variant-numeric: tabular-nums; }

/* ---------- Số liệu ---------- */
.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.stat { display: grid; align-content: start; gap: 4px; padding: 14px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--line); text-align: left; min-height: 88px; }
button.stat:active { transform: scale(.985); }
.stat strong { font: 700 1.75rem/1 var(--font-num); letter-spacing: -.02em; font-variant-numeric: tabular-nums; color: var(--text); }
.stat span { font-size: .8rem; color: var(--muted); line-height: 1.3; }
.stat.good strong { color: var(--good); } .stat.warn strong { color: var(--warn); } .stat.bad strong { color: var(--bad); } .stat.info strong { color: var(--info); } .stat.muted strong { color: var(--muted); }
.stats.small .stat { min-height: 0; padding: 10px 12px; } .stats.small .stat strong { font-size: 1.35rem; }

/* ---------- Danh sách ---------- */
.list { display: grid; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.list:empty { display: none; }
.list > * + * { border-top: 1px solid var(--line); }
.list .empty { border: 0; }
.list-head { margin: 0; font-weight: 700; padding: 10px 14px 6px; font-size: .74rem; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); background: var(--surface-2); }
.row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; align-items: center; gap: 12px; width: 100%; min-height: 58px; padding: 10px 14px; border: 0; background: transparent; text-align: left; color: inherit; }
button.row:active, .row .as-btn:active { background: var(--surface-2); }
.row-main { display: grid; gap: 3px; min-width: 0; }
.row-title { font-weight: 600; font-size: .98rem; line-height: 1.3; overflow-wrap: anywhere; }
.row-sub { color: var(--muted); font-size: .82rem; line-height: 1.35; overflow-wrap: anywhere; }
.row-meta { color: var(--muted); font-size: .8rem; text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.row-badges { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 3px; }
.row .chev { color: var(--faint); width: 1.05rem; height: 1.05rem; }
.row.bad .row-meta { color: var(--bad); font-weight: 600; }
.row.selectable { grid-template-columns: auto minmax(0, 1fr); padding: 0 0 0 4px; }
.row .as-btn { border: 0; background: none; text-align: left; padding: 10px 14px 10px 4px; min-height: 58px; width: 100%; color: inherit; }
.select-box { display: grid; place-items: center; width: 44px; height: 44px; }
.select-box input, .pick input, .check input { width: 22px; height: 22px; accent-color: var(--green); }
.list.compact .row { min-height: 48px; padding: 8px 12px; }
.list.menu .row { min-height: 62px; }
.avatar { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: var(--green-soft); color: var(--green-ink); font-size: .8rem; font-weight: 700; letter-spacing: .02em; flex: none; }
.avatar.rose { background: var(--rose-soft); color: var(--rose); } .avatar.gold { background: var(--gold-soft); color: var(--gold-ink); }
.avatar.info { background: var(--info-soft); color: var(--info); } .avatar.warn { background: var(--warn-soft); color: var(--warn); } .avatar.muted { background: var(--surface-2); color: var(--muted); } .avatar.green { background: var(--green-soft); color: var(--green-ink); }
.round-ic { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 11px; background: var(--green-soft); color: var(--green-ink); flex: none; }
.round-ic.gold { background: var(--gold-soft); color: var(--gold-ink); }
.date-chip { display: grid; place-items: center; width: 44px; height: 46px; border-radius: 11px; background: var(--gold-soft); color: var(--gold-ink); line-height: 1; flex: none; }
.date-chip b { font: 700 1.1rem var(--font-num); } .date-chip small { font-size: .62rem; font-weight: 700; text-transform: uppercase; }
.progress { display: block; width: 92px; height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; align-self: center; }
.progress span { display: block; height: 100%; background: var(--good); border-radius: 3px; }
.empty { display: grid; justify-items: center; gap: 10px; padding: 26px 16px; text-align: center; color: var(--muted); }
.empty p { margin: 0; max-width: 40ch; font-size: .92rem; }

/* ---------- Nhãn & chip ---------- */
.pill { display: inline-flex; align-items: center; min-height: 22px; padding: 2px 8px; border-radius: 999px; font-size: .72rem; font-weight: 650; line-height: 1.2; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.pill.good { background: var(--good-soft); color: var(--good); } .pill.warn { background: var(--warn-soft); color: var(--warn); } .pill.bad { background: var(--bad-soft); color: var(--bad); }
.pill.info { background: var(--info-soft); color: var(--info); } .pill.gold { background: var(--gold-soft); color: var(--gold-ink); } .pill.rose { background: var(--rose-soft); color: var(--rose); }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 1px 4px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.chips::-webkit-scrollbar { display: none; }
.chips.wrap { flex-wrap: wrap; overflow: visible; }
.chip { flex: none; min-height: 38px; padding: 6px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font-size: .86rem; font-weight: 550; white-space: nowrap; }
.chip.on { background: var(--green); border-color: var(--green); color: #fff; }
.segmented { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 3px; padding: 3px; border-radius: 12px; background: var(--surface-2); }
.segmented button { min-height: 40px; border: 0; border-radius: 9px; background: transparent; font-size: .86rem; font-weight: 600; color: var(--muted); display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 4px 6px; }
.segmented button.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }
.segmented .count { font-size: .72rem; padding: 0 6px; border-radius: 999px; background: var(--line); color: var(--muted); font-variant-numeric: tabular-nums; }

/* ---------- Tìm kiếm & thanh dính ---------- */
.sticky-tools { position: sticky; top: calc(env(safe-area-inset-top, 0px) + 58px); z-index: 10; display: grid; gap: 8px; padding: 8px 0 6px; margin: -4px 0 0; background: var(--bg); }
.search { display: flex; align-items: center; gap: 8px; padding: 0 12px; min-height: 46px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); color: var(--muted); }
.search input { flex: 1; min-width: 0; border: 0; background: transparent; outline: none; font-size: 16px; min-height: 44px; color: var(--text); -webkit-appearance: none; appearance: none; }
.search:focus-within { border-color: var(--green); box-shadow: 0 0 0 3px color-mix(in srgb, var(--green) 18%, transparent); }

/* ---------- Nút ---------- */
.btn { display: inline-flex; max-width: 100%; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 10px 16px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font-weight: 650; font-size: .92rem; text-align: center; }
.btn.primary { background: var(--green); border-color: var(--green); color: #fff; }
.btn.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.ghost { background: var(--surface); }
.btn.ghost.danger { background: var(--surface); color: var(--bad); border-color: color-mix(in srgb, var(--bad) 35%, var(--line)); }
.btn.small { min-height: 38px; padding: 6px 12px; font-size: .84rem; }
.btn.wide { width: 100%; }
.btn.icon-only { width: 44px; padding: 0; border-radius: 50%; background: var(--green); border-color: var(--green); color: #fff; }
.btn.icon-only.small { width: 36px; min-height: 36px; background: transparent; border-color: var(--line); color: var(--muted); }
.btn:disabled { opacity: .45; cursor: default; }
.btn:not(:disabled):active { transform: scale(.98); }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.btn-row.pager { justify-content: space-between; }
.mini { display: inline-grid; place-items: center; width: 36px; height: 36px; margin: -6px -6px -6px 6px; border: 0; border-radius: 10px; background: transparent; color: var(--faint); vertical-align: middle; flex: none; }
.mini .ic { width: 1.05rem; height: 1.05rem; }
.mini:active { background: var(--surface-2); color: var(--green); }

/* ---------- Thẻ & thông báo ---------- */
.card { display: grid; gap: 10px; padding: 14px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--line); }
.card h2, .card h3 { margin: 0; font-size: 1.02rem; }
.card.inset { background: var(--surface-2); border-color: transparent; padding: 12px; }
.card.good { border-color: color-mix(in srgb, var(--good) 40%, var(--line)); } .card.bad { border-color: color-mix(in srgb, var(--bad) 40%, var(--line)); }
.card p { margin: 0; }
.banner { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: start; padding: 14px; border-radius: var(--r); background: var(--info-soft); color: var(--text); }
.banner > .ic { color: var(--info); margin-top: 2px; }
.banner strong { display: block; margin-bottom: 2px; }
.banner p, .banner ul { margin: 0; font-size: .88rem; color: var(--muted); }
.banner ul { padding-left: 1.1em; display: grid; gap: 4px; }
.banner.warn { background: var(--warn-soft); } .banner.warn > .ic { color: var(--warn); }
.banner.good { background: var(--good-soft); } .banner.good > .ic { color: var(--good); }
.banner .btn { align-self: center; }
.shortcuts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.shortcut { display: flex; align-items: center; gap: 10px; min-height: 58px; padding: 12px; border-radius: var(--r); border: 1px solid var(--line); background: var(--surface); text-align: left; font-weight: 600; font-size: .9rem; }
.shortcut .ic { color: var(--green); }
.team-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.team-card { display: grid; gap: 6px; padding: 12px; border-radius: var(--r); border: 1px solid var(--line); background: var(--surface); text-align: left; }
.team-card strong { font-size: .82rem; color: var(--muted); font-weight: 650; }
.team-num { font: 700 1.6rem/1 var(--font-num); font-variant-numeric: tabular-nums; }
.team-meta { display: flex; flex-wrap: wrap; gap: 4px; }

/* ---------- Chi tiết ---------- */
.quick { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.quick-btn { display: grid; justify-items: center; gap: 4px; padding: 10px 4px; min-height: 64px; border: 0; border-radius: 12px; background: var(--green-soft); color: var(--green-ink); font-size: .74rem; font-weight: 650; text-decoration: none; text-align: center; }
.kv { margin: 0; display: grid; }
.kv-row { display: grid; grid-template-columns: minmax(0, 40%) minmax(0, 1fr); gap: 10px; padding: 9px 0; border-top: 1px solid var(--line); }
.kv-row:first-child { border-top: 0; }
.kv dt { color: var(--muted); font-size: .84rem; }
.kv dd { margin: 0; display: flex; align-items: center; justify-content: space-between; gap: 6px; font-size: .92rem; overflow-wrap: anywhere; }
.kv dd.missing { color: var(--faint); font-style: italic; }
.disclosure { border-radius: var(--r); background: var(--surface); border: 1px solid var(--line); }
.disclosure > summary { display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 10px 14px; font-weight: 650; cursor: pointer; list-style: none; }
.disclosure > summary::-webkit-details-marker { display: none; }
.disclosure > summary::after { content: ""; margin-left: auto; width: 9px; height: 9px; border-right: 2px solid var(--faint); border-bottom: 2px solid var(--faint); transform: rotate(45deg); transition: transform .15s; }
.disclosure[open] > summary::after { transform: rotate(225deg); }
.disclosure > summary .count { font-size: .76rem; padding: 1px 8px; border-radius: 999px; background: var(--surface-2); color: var(--muted); }
.disclosure-body { display: grid; gap: 10px; padding: 0 14px 14px; }
.disclosure .disclosure { background: var(--surface-2); border-color: transparent; }
.timeline { list-style: none; margin: 0; padding: 0 0 0 14px; border-left: 2px solid var(--line); display: grid; gap: 14px; }
.timeline > li { position: relative; display: grid; gap: 2px; }
.timeline > li::before { content: ""; position: absolute; left: -21px; top: 6px; width: 10px; height: 10px; border-radius: 50%; background: var(--green); border: 2px solid var(--bg); }
.timeline time { font-size: .78rem; color: var(--muted); }
.timeline ul { margin: 4px 0 0; padding-left: 1.1em; font-size: .85rem; color: var(--muted); }
.bullets { margin: 0; padding-left: 1.2em; display: grid; gap: 6px; font-size: .92rem; }
.steps { margin: 0; padding-left: 1.4em; display: grid; gap: 12px; }
.steps li::marker { font-weight: 700; color: var(--green); }
.steps p { margin: 2px 0 0; }
.legal { display: grid; gap: 6px; font-size: .92rem; overflow-wrap: anywhere; }
.legal ul { margin: 2px 0; padding-left: 1.2em; }

/* ---------- Bảng ---------- */
.table-scroll { overflow-x: auto; border-radius: var(--r); border: 1px solid var(--line); background: var(--surface); -webkit-overflow-scrolling: touch; }
.table { border-collapse: collapse; width: 100%; font-size: .84rem; font-variant-numeric: tabular-nums; }
.table th, .table td { padding: 9px 10px; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; }
.table thead th { position: sticky; top: 0; background: var(--surface-2); font-size: .74rem; color: var(--muted); font-weight: 650; }
.table th:first-child, .table td:first-child { text-align: left; position: sticky; left: 0; background: var(--surface); }
.table thead th:first-child { background: var(--surface-2); }
.table tr.on th, .table tr.on td { background: var(--green-soft); }

/* ---------- Chọn nhiều ---------- */
.selection-bar { position: sticky; top: calc(env(safe-area-inset-top, 0px) + 58px); z-index: 9; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 8px 0; background: var(--bg); font-size: .86rem; color: var(--muted); }
.selection-bar > span { flex: 1; min-width: 120px; }
.pick-list { display: grid; gap: 2px; max-height: 50vh; overflow: auto; border-radius: 12px; background: var(--surface-2); padding: 4px; }
.pick { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 6px 10px; border-radius: 10px; }
.pick:active { background: var(--surface); }
.pick span { display: grid; min-width: 0; }
.pick small { color: var(--muted); font-size: .78rem; }

/* ---------- Điểm danh ---------- */
.att-list { display: grid; gap: 8px; }
.att-row { display: grid; gap: 8px; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); }
.att-name { display: grid; } .att-name small { color: var(--muted); font-size: .78rem; }
.att-seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.att { min-height: 40px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); font-size: .84rem; font-weight: 650; color: var(--muted); }
.att.on.participated { background: var(--good); border-color: var(--good); color: #fff; }
.att.on.absent { background: var(--bad); border-color: var(--bad); color: #fff; }
.att.on.excused { background: var(--info); border-color: var(--info); color: #fff; }
:root[data-theme="dark"] .att.on { color: #0d1411; }

/* ---------- Lịch ---------- */
.cal { gap: 8px; }
.cal-head { display: flex; align-items: center; gap: 6px; }
.cal-head h2 { flex: 1; margin: 0; text-align: center; font-size: 1.05rem; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 3px; }
.cal-dow { text-align: center; font-size: .7rem; font-weight: 700; color: var(--muted); padding: 4px 0; }
.cal-day { display: grid; justify-items: center; align-content: start; gap: 0; min-height: 54px; padding: 5px 0 4px; border: 0; border-radius: 10px; background: transparent; color: var(--text); }
.cal-day .sol { font: 600 .98rem var(--font-num); } .cal-day .lun { font-size: .62rem; color: var(--faint); }
.cal-day.sun .sol { color: var(--bad); }
.cal-day.today { background: var(--gold-soft); } .cal-day.today .sol { color: var(--gold-ink); font-weight: 800; }
.cal-day.sel { background: var(--green); } .cal-day.sel .sol, .cal-day.sel .lun { color: #fff; }
.dots { display: flex; gap: 2px; height: 6px; margin-top: 2px; }
.dots i { width: 5px; height: 5px; border-radius: 50%; background: var(--info); }
.dots i.rose { background: var(--rose); } .dots i.gold { background: var(--gold); } .dots i.info { background: var(--info); }
.cal-day.sel .dots i { background: #fff; }

/* ---------- Trò chuyện tra cứu ---------- */
.chat { display: grid; gap: 10px; }
.bubble { max-width: 92%; padding: 10px 14px; border-radius: 16px; font-size: .94rem; display: grid; gap: 8px; }
.bubble.user { justify-self: end; background: var(--green); color: #fff; border-bottom-right-radius: 4px; }
.bubble.bot { justify-self: start; background: var(--surface); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.chat-hint { display: grid; gap: 8px; } .chat-hint p { margin: 0; color: var(--muted); font-size: .86rem; }
.chat-hint .chip { white-space: normal; text-align: left; }
.chat-input { position: sticky; bottom: calc(var(--tab-h) + env(safe-area-inset-bottom, 0px) + 8px); display: flex; gap: 8px; padding: 6px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); }
.chat-input input { flex: 1; min-width: 0; border: 0; background: transparent; outline: none; font-size: 16px; padding: 0 8px; }

/* ---------- Sheet ---------- */
.sheet { position: fixed; inset: auto 0 var(--kb, 0px) 0; margin: 0; width: 100%; max-width: none; max-height: calc(var(--vvh, 100dvh) - env(safe-area-inset-top, 0px) - 12px); transition: transform .2s ease; padding: 0; border: 0; border-radius: 20px 20px 0 0;
  background: var(--bg); color: var(--text); display: grid; grid-template-rows: auto minmax(0, 1fr) auto; box-shadow: 0 -10px 40px rgba(0, 0, 0, .2); animation: sheet-up .26s cubic-bezier(.2, .8, .2, 1); }
.sheet:not([open]) { display: none; }
.sheet::backdrop { background: rgba(8, 20, 14, .45); }
@keyframes sheet-up { from { transform: translateY(40px); opacity: .6; } to { transform: none; opacity: 1; } }
.sheet-head { position: relative; display: flex; align-items: flex-start; gap: 8px; padding: 18px max(16px, env(safe-area-inset-right, 0px)) 10px max(16px, env(safe-area-inset-left, 0px)); border-bottom: 1px solid var(--line); background: var(--surface); }
.grabber { position: absolute; top: 6px; left: 50%; width: 38px; height: 5px; margin-left: -19px; border-radius: 3px; background: var(--faint); opacity: .45; }
.sheet-head { touch-action: none; }
.sheet-titles { flex: 1; min-width: 0; display: grid; gap: 2px; }
.sheet-titles h2 { margin: 0; font-size: 1.25rem; line-height: 1.25; letter-spacing: -.01em; text-wrap: balance; overflow-wrap: anywhere; }
.sheet-sub { margin: 0; color: var(--muted); font-size: .86rem; }
.sheet-body { overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; padding: 14px max(16px, env(safe-area-inset-right, 0px)) 18px max(16px, env(safe-area-inset-left, 0px)); display: grid; align-content: start; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.sheet-body > *, .view > *, .disclosure-body > *, .group > * { min-width: 0; }
.sheet-foot { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; padding: 10px max(16px, env(safe-area-inset-right, 0px)) calc(env(safe-area-inset-bottom, 0px) + 10px) max(16px, env(safe-area-inset-left, 0px)); border-top: 1px solid var(--line); background: var(--surface); }
.sheet-foot .btn { flex: 1 1 auto; }
.sheet-foot .btn.primary { flex: 2 1 auto; }
.sheet.compact .sheet-body { padding-bottom: 8px; }

/* ---------- Biểu mẫu ---------- */
.form { display: grid; gap: 14px; }
.group { margin: 0; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); display: grid; gap: 12px; min-width: 0; }
.group > legend { padding: 0 6px; margin-left: -6px; font-size: .78rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.field { display: grid; gap: 5px; min-width: 0; }
.field label { font-size: .84rem; font-weight: 600; color: var(--muted); }
.field input, .field select, .field textarea, textarea, .card select { width: 100%; min-height: 46px; padding: 10px 12px; border-radius: 11px; border: 1px solid var(--line); background: var(--bg); font-size: 16px; color: var(--text); -webkit-appearance: none; appearance: none; }
.field select, .card select { background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 32px; }
.field input[type="date"] { min-height: 46px; }
textarea { resize: vertical; line-height: 1.45; }
.field input:focus, .field select:focus, textarea:focus { outline: none; border-color: var(--green); box-shadow: 0 0 0 3px color-mix(in srgb, var(--green) 20%, transparent); }
.help { margin: 0; font-size: .78rem; color: var(--muted); }
.form-error { margin: 0; padding: 10px 12px; border-radius: 10px; background: var(--bad-soft); color: var(--bad); font-weight: 600; font-size: .9rem; }
.check { display: flex; align-items: center; gap: 10px; min-height: 44px; font-size: .92rem; }
.check.boxed { padding: 10px 12px; border-radius: 12px; background: var(--warn-soft); align-items: flex-start; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.form-inline { gap: 12px; }
.step-head { display: flex; align-items: center; justify-content: space-between; }
.steps-edit { display: grid; gap: 10px; }
.steps-edit input, .steps-edit textarea { width: 100%; min-height: 42px; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); font-size: 16px; }
.preview-text { margin: 4px 0 0; padding: 12px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); }

/* ---------- Thông báo nổi ---------- */
.toast { position: fixed; left: 50%; bottom: calc(var(--tab-h) + env(safe-area-inset-bottom, 0px) + 14px); z-index: 2000; transform: translate(-50%, 20px); max-width: min(520px, calc(100vw - 32px)); padding: 12px 16px; border-radius: 14px; background: #17211b; color: #fff; font-size: .9rem; line-height: 1.4; box-shadow: 0 10px 30px rgba(0, 0, 0, .25); opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.bad { background: #8f1d16; } .toast.warn { background: #7a4800; } .toast.good { background: #145c37; }

/* ---------- Máy tính bảng / máy tính ---------- */
@media (min-width: 640px) {
  .stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .shortcuts { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .team-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .sheet { inset: 0; margin: auto; width: min(640px, calc(100vw - 48px)); max-height: min(88vh, 900px); border-radius: 20px; }
  .sheet.wide { width: min(820px, calc(100vw - 48px)); }
  .grabber { display: none; }
  .att-row { grid-template-columns: minmax(0, 1fr) minmax(260px, auto); align-items: center; }
}
@media (min-width: 900px) {
  .tabbar { top: 0; right: auto; width: var(--side-w); grid-template-columns: 1fr; align-content: start; gap: 4px; padding: calc(env(safe-area-inset-top, 0px) + 18px) 14px 18px max(14px, env(safe-area-inset-left, 0px)); border-top: 0; border-right: 1px solid var(--line); }
  .tabbar button { grid-auto-flow: column; justify-content: start; gap: 12px; min-height: 46px; padding: 0 14px; font-size: .92rem; }
  .tabbar button.on { background: var(--green-soft); }
  .side-brand { display: flex; align-items: center; gap: 10px; padding: 0 6px 18px; margin-bottom: 8px; border-bottom: 1px solid var(--line); }
  .side-brand img { border-radius: 50%; }
  .side-brand div { display: grid; } .side-brand strong { letter-spacing: .04em; color: var(--green-ink); } .side-brand span { font-size: .76rem; color: var(--muted); }
  .appbar, main { margin-left: var(--side-w); }
  .appbar .brand { display: none; }
  .appbar-row { min-height: 8px; }
  main { padding-bottom: 40px; }
  .toast, .chat-input { bottom: 24px; }
  .toast { left: calc(50% + var(--side-w) / 2); }
}
@media print { .tabbar, .appbar, .toast { display: none; } }
.qr { display: block; width: 220px; height: 220px; margin: 4px auto; border-radius: 12px; background: #fff; padding: 8px; }
.row.split { grid-template-columns: minmax(0, 1fr) auto; padding: 0 8px 0 0; gap: 4px; }
.row-hit { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 12px; min-height: 58px; padding: 10px 6px 10px 14px; border: 0; background: none; text-align: left; color: inherit; width: 100%; }
.row-hit:active { background: var(--surface-2); }
.mini.wish { width: 44px; height: 44px; margin: 0; color: var(--gold-ink); background: var(--gold-soft); border-radius: 12px; }

/* Dải gợi ý cài lên Màn hình chính (chỉ Safari iPhone chưa cài) */
.install-hint { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 12px; border-radius: var(--r); background: var(--green); color: #fff; }
.install-hint p { margin: 0; font-size: .86rem; opacity: .95; }
.install-hint strong { display: block; }
.install-hint .ic { width: 1.6rem; height: 1.6rem; }
.install-hint .btn { background: #fff; color: var(--green); border-color: #fff; }
.install-hint .x { width: 36px; height: 36px; border: 0; border-radius: 50%; background: rgba(255,255,255,.15); color: #fff; display: grid; place-items: center; }
.storage-ok { color: var(--good); font-weight: 650; } .storage-warn { color: var(--warn); font-weight: 650; }
@media (orientation: landscape) and (max-height: 500px) {
  .tabbar { padding-top: 2px; } .tabbar button { min-height: 44px; grid-auto-flow: column; gap: 6px; font-size: .74rem; }
  .app-title { font-size: 1.4rem; margin-bottom: 6px; }
  .sheet { max-height: calc(var(--vvh, 100dvh) - 8px); }
}

[tabindex="-1"]:focus { outline: none; }

/* ===================== 3.2 — Thao tác trực tiếp · Nam/Nữ · Trợ lý · Hiệu ứng ===================== */
/* Dòng có menu ⋯ (nhấn giữ 0,5 s mở cùng menu) */
.row.split .row-hit:has(> .row-main:first-child) { grid-template-columns: minmax(0, 1fr) auto; }
.row-more { width: 44px; height: 44px; margin: 0; border-radius: 12px; }
.row-more:active, .row-more:focus-visible { background: var(--surface-2); color: var(--green); }
.row.selectable { grid-template-columns: auto minmax(0, 1fr) auto; padding-right: 8px; }
.row-hit.pressing, .team-card.pressing { transform: scale(.985); transition: transform .5s ease-out; background: var(--surface-2); }
.action-list { display: grid; gap: 4px; }
.action-item { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 14px; min-height: 52px; padding: 8px 12px; border: 0; border-radius: 12px; background: transparent; color: var(--text); text-align: left; font: inherit; }
.action-item .ic { color: var(--green); width: 1.2rem; height: 1.2rem; }
.action-item span { display: grid; gap: 2px; }
.action-item b { font-weight: 600; } .action-item small { color: var(--muted); font-size: .8rem; }
.action-item:active, .action-item:focus-visible { background: var(--surface-2); }
.action-item.danger, .action-item.danger .ic { color: var(--bad); }
.action-item:disabled { opacity: .45; }
.action-sep { border: 0; border-top: 1px solid var(--line); margin: 4px 0; }
.team-wrap { position: relative; display: grid; }
.team-wrap .team-card { padding-right: 40px; }
.team-more { position: absolute; top: 4px; right: 4px; margin: 0; width: 40px; height: 40px; }
/* Hàng vừa lưu nháy viền một lần */
@keyframes flash-ring { 0% { box-shadow: inset 0 0 0 2px var(--green); } 100% { box-shadow: inset 0 0 0 2px transparent; } }
.flash { animation: flash-ring 1.2s ease-out 1; }

/* Thẻ Nam / Nữ */
.gender-card { display: grid; gap: 10px; }
.gender-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; } .gender-head .note { margin: 0; }
.gender-bar { display: flex; height: 12px; border-radius: 999px; overflow: hidden; background: var(--surface-2); }
.gender-bar .male { background: var(--info); } .gender-bar .female { background: var(--rose); }
.gender-bar span { transform-origin: left; animation: bar-in .4s ease-out both; }
@keyframes bar-in { from { transform: scaleX(0); } to { transform: none; } }
.gender-legend { display: flex; gap: 8px; flex-wrap: wrap; }
.legend { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font: inherit; font-weight: 600; }
.legend i { width: 10px; height: 10px; border-radius: 50%; } .legend.male i { background: var(--info); } .legend.female i { background: var(--rose); }

/* Nút Trợ lý nổi (trên thanh tab, trong vùng ngón cái) */
#agent-fab { position: fixed; z-index: 900; right: max(16px, env(safe-area-inset-right, 0px)); bottom: calc(var(--tab-h) + env(safe-area-inset-bottom, 0px) + 14px); display: inline-flex; align-items: center; gap: 8px; height: 52px; padding: 0 18px 0 16px; border: 0; border-radius: 999px; background: var(--green); color: #fff; font: inherit; font-weight: 650; box-shadow: 0 8px 24px rgba(15, 50, 34, .3); }
#agent-fab .ic { width: 1.3rem; height: 1.3rem; }
#agent-fab:active { transform: scale(.96); }
html.sheet-open #agent-fab, html.kb-open #agent-fab, #agent-fab[hidden] { display: none; }
main { padding-bottom: calc(var(--tab-h) + env(safe-area-inset-bottom, 0px) + 84px); }

/* Thanh Hoàn tác */
#undo-bar { position: fixed; z-index: 2100; left: 50%; bottom: calc(var(--tab-h) + env(safe-area-inset-bottom, 0px) + 14px); transform: translate(-50%, 24px); display: flex; align-items: center; gap: 10px; width: min(520px, calc(100vw - 32px)); padding: 6px 6px 6px 14px; border-radius: 14px; background: #17211b; color: #fff; box-shadow: 0 10px 30px rgba(0, 0, 0, .25); opacity: 0; pointer-events: none; transition: opacity .2s ease-in, transform .2s ease-in; font-size: .9rem; }
#undo-bar.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; transition-timing-function: ease-out; }
#undo-bar > span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#undo-bar .ic { width: 1.1rem; height: 1.1rem; flex: none; color: #8fd9b0; }
.undo-btn { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 14px; border: 0; border-radius: 10px; background: #2b3a31; color: #ffe08a; font: inherit; font-weight: 700; }
.undo-btn .ic { color: inherit !important; }

/* Trợ lý */
.agent { display: grid; gap: 10px; }
.agent-sheet .sheet-body { padding-bottom: 0; }
.chat-input.docked { position: sticky; bottom: 0; margin: 0 -4px; box-shadow: 0 -6px 18px rgba(0, 0, 0, .06); }
.agent-sheet .sheet-foot { display: none; }
.chat-input input { min-height: 44px; }
.icon-send { min-width: 48px; padding: 0 12px; }
.bubble.bad { border-color: var(--bad); background: var(--bad-soft); }
.bubble .pre { white-space: pre-line; margin: 0; }
.bubble .answer-list { margin: 0 -6px; }
.bubble .help-title { margin: 4px 0 0; font-weight: 700; font-size: .8rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.choice-list { display: grid; gap: 6px; } .btn.choice { justify-content: flex-start; text-align: left; white-space: normal; height: auto; min-height: 44px; }
.plan-card { justify-self: stretch; display: grid; gap: 10px; padding: 14px; border-radius: 16px; border: 1.5px solid var(--green); background: var(--surface); }
.plan-card.danger { border-color: var(--bad); }
.plan-card.saved { border-color: var(--good); }
.plan-card.muted { opacity: .7; border-color: var(--line); }
.plan-head { display: flex; align-items: center; gap: 8px; } .plan-head .ic { color: var(--green); flex: none; } .plan-card.danger .plan-head .ic { color: var(--bad); }
.plan-sub { margin: 0; color: var(--muted); font-size: .8rem; }
.diff { display: grid; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.diff-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); gap: 10px; padding: 8px 12px; font-size: .88rem; }
.diff-row + .diff-row { border-top: 1px solid var(--line); }
.diff-label { color: var(--muted); overflow-wrap: anywhere; }
.diff-val { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 6px; overflow-wrap: anywhere; }
.diff-val .before { color: var(--muted); } .diff-val .arrow { color: var(--faint); } .diff-val .after { color: var(--text); }
.plan-inputs { display: grid; gap: 10px; }
.plan-actions { justify-content: flex-end; }
.plan-status { margin: 0; font-size: .86rem; font-weight: 600; } .plan-status:empty { display: none; }
.plan-status.good { color: var(--good); } .plan-status.bad { color: var(--bad); }

/* Hiệu ứng: chuyển màn hình (View Transitions), danh sách so le — chỉ transform/opacity, 150–300 ms */
.appbar { view-transition-name: appbar; } .tabbar { view-transition-name: tabbar; }
::view-transition-old(root) { animation: vt-out .14s ease-in both; }
::view-transition-new(root) { animation: vt-in .22s ease-out both; }
@keyframes vt-out { to { opacity: 0; } }
@keyframes vt-in { from { opacity: 0; transform: translateY(8px); } }
.stagger > :nth-child(-n + 8) { animation: rise .24s ease-out both; }
.stagger > :nth-child(2) { animation-delay: 30ms; } .stagger > :nth-child(3) { animation-delay: 60ms; } .stagger > :nth-child(4) { animation-delay: 90ms; }
.stagger > :nth-child(5) { animation-delay: 120ms; } .stagger > :nth-child(6) { animation-delay: 150ms; } .stagger > :nth-child(7) { animation-delay: 180ms; } .stagger > :nth-child(8) { animation-delay: 210ms; }
@media (prefers-reduced-motion: reduce) {
  ::view-transition-old(root), ::view-transition-new(root) { animation: none !important; }
  .stagger > *, .flash, .gender-bar span, #undo-bar, #agent-fab, .row-hit.pressing, .team-card.pressing { animation: none !important; transition: none !important; }
}
@media (min-width: 900px) { #agent-fab, #undo-bar { bottom: 24px; } }
@supports (view-transition-name: none) { .view { animation: none; } }

/* ===================== 3.3 — Văn phòng · Xuất báo cáo ===================== */
.sec-chips { position: sticky; top: calc(env(safe-area-inset-top, 0px) + 52px); z-index: 5; padding: 6px 0; background: var(--bg); }
.office-banner { width: 100%; text-align: left; font: inherit; color: inherit; cursor: pointer; grid-template-columns: auto 1fr auto; }
.office-banner p { margin: 2px 0 0; }
.template-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.template-card { display: grid; align-content: start; gap: 6px; min-height: 104px; padding: 14px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); color: var(--text); text-align: left; font: inherit; }
.template-card .ic { color: var(--green); width: 1.4rem; height: 1.4rem; }
.template-card b { font-size: .92rem; line-height: 1.3; } .template-card small { color: var(--muted); font-size: .78rem; }
.template-card:active { background: var(--surface-2); }
.period-nav { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 8px; padding: 4px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); }
.period-nav strong { text-align: center; font-size: 1.02rem; }
.report-card { display: grid; gap: 12px; }
.card-title { margin: 6px 0 0; font-size: .82rem; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.kpi-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
@media (min-width: 640px) { .kpi-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.kpi { display: grid; gap: 3px; padding: 12px; border-radius: 12px; background: var(--surface-2); }
.kpi strong { font: 700 1.5rem/1.1 var(--font-num); font-variant-numeric: tabular-nums; }
.kpi span { font-size: .8rem; color: var(--muted); line-height: 1.3; }
.kpi .delta { font-size: .74rem; font-weight: 600; } .kpi .delta.up { color: var(--good); } .kpi .delta.down { color: var(--bad); } .kpi .delta.flat { color: var(--muted); }
.findings { margin: 0; padding-left: 1.2em; display: grid; gap: 10px; }
.findings li { line-height: 1.45; } .findings small { display: block; color: var(--muted); margin-top: 2px; }
.team-bars { display: grid; gap: 6px; }
.team-bar { display: grid; grid-template-columns: 56px 1fr 56px; align-items: center; gap: 10px; font-size: .86rem; }
.team-bar .bar { height: 10px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.team-bar .bar i { display: block; height: 100%; background: var(--green); border-radius: inherit; transform-origin: left; animation: bar-in .4s ease-out both; }
.team-bar b { text-align: right; font-variant-numeric: tabular-nums; }
.note.ok { color: var(--good); } .note.bad { color: var(--bad); }
.answer-lines { margin: 0; padding-left: 1.1em; display: grid; gap: 4px; font-size: .9rem; }
@media (prefers-reduced-motion: reduce) { .team-bar .bar i { animation: none !important; } }

/* In / Lưu PDF: chỉ in vùng #print-area */
#print-area { display: none; }
@media print {
  html.printing body > *:not(#print-area) { display: none !important; }
  html.printing #print-area { display: block; font: 14pt/1.4 "Times New Roman", Times, serif; color: #000; background: #fff; }
  html.printing body { position: static !important; background: #fff !important; }
  @page { size: A4; margin: 20mm 20mm 20mm 30mm; }
  #print-area .print-head { display: grid; grid-template-columns: 45% 55%; text-align: center; font-size: 13pt; }
  #print-area .print-head p { margin: 0; }
  #print-area h1 { font-size: 15pt; text-align: center; margin: 18pt 0 0; } #print-area h2 { font-size: 14pt; text-align: center; margin: 2pt 0 12pt; }
  #print-area h3, #print-area h4 { font-size: 14pt; margin: 8pt 0 4pt; }
  #print-area p { margin: 0 0 6pt; text-align: justify; text-indent: 1cm; }
  #print-area .print-head p, #print-area .print-sign p, #print-area .c { text-indent: 0; text-align: center; }
  #print-area table { width: 100%; border-collapse: collapse; margin: 6pt 0; font-size: 12pt; }
  #print-area th, #print-area td { border: 1px solid #000; padding: 3pt 5pt; } #print-area thead { display: table-header-group; } #print-area tr { break-inside: avoid; }
  #print-area .print-sign { display: grid; grid-template-columns: 45% 55%; margin-top: 18pt; break-inside: avoid; }
  #print-area .print-sign > div:first-child p { text-align: left; }
  #print-area .sign-space { height: 60pt; }
  #print-area .b { font-weight: 700; } #print-area .i { font-style: italic; } #print-area .u { text-decoration: underline; } #print-area .small { font-size: 11pt; }
}
/* Thông báo không chồng lên thanh Hoàn tác */
body:has(#undo-bar.show) .toast { bottom: calc(var(--tab-h) + env(safe-area-inset-bottom, 0px) + 76px); }
@media (min-width: 900px) { body:has(#undo-bar.show) .toast { bottom: 86px; } }

/* ===================== 3.4 — Đăng nhập (mã PIN) · Bảo mật ===================== */
.lock-now { margin-left: auto; color: var(--green); }
.lock-now:not([hidden]) + .app-action { margin-left: 0; }
.lock { position: fixed; inset: 0; z-index: 3000; display: grid; color: #fff; background: #061a14; overflow: hidden; font-family: var(--font); }
/* Điện thoại dọc: kéo cảnh sân bay (đài kiểm soát, nhà ga, đường băng) lên vùng giữa, phía trên bàn phím */
.lock-bg { position: absolute; left: 0; top: -31%; width: 100%; height: 115%; object-fit: cover; object-position: 30% 50%; }
.lock-shade { position: absolute; inset: 0; background: linear-gradient(180deg, rgba(3, 14, 10, .55) 0%, rgba(3, 14, 10, .08) 24%, rgba(3, 14, 10, 0) 40%, rgba(3, 14, 10, .25) 52%, rgba(3, 14, 10, .7) 70%, rgba(3, 14, 10, .9) 100%); }
.lock-inner { position: relative; display: flex; flex-direction: column; gap: 14px; width: min(440px, 100%); margin: 0 auto; min-height: 100dvh;
  padding: calc(env(safe-area-inset-top, 0px) + 18px) max(18px, env(safe-area-inset-right, 0px)) calc(env(safe-area-inset-bottom, 0px) + 14px) max(18px, env(safe-area-inset-left, 0px)); }
.lock-brand { display: flex; align-items: center; gap: 12px; }
.lock-logo { display: grid; place-items: center; width: 60px; height: 60px; border-radius: 50%; background: rgba(255, 255, 255, .95); box-shadow: 0 0 0 3px rgba(239, 199, 94, .85), 0 8px 28px rgba(0, 0, 0, .35); overflow: hidden; flex: none; }
.lock-logo img { width: 54px; height: 54px; object-fit: contain; }
.lock-brand strong { display: block; font-size: 1.32rem; letter-spacing: .08em; }
.lock-brand span { font-size: .82rem; opacity: .86; }
.lock-hello { margin-top: 2vh; text-shadow: 0 2px 14px rgba(0, 0, 0, .45); }
.lock-hello p { margin: 0; }
.lock-hello .hello { font-size: clamp(1.7rem, 7.4vw, 2.3rem); font-weight: 700; letter-spacing: -.01em; line-height: 1.15; }
.lock-hello .date { font-size: .98rem; opacity: .9; margin-top: 4px; }
.lock-hello .place { display: inline-flex; align-items: center; gap: 8px; margin-top: 10px; padding: 6px 12px 6px 10px; border-radius: 999px; background: rgba(239, 199, 94, .18); border: 1px solid rgba(239, 199, 94, .45); color: #ffe7a6; font-size: .8rem; font-weight: 600; }
.lock-hello .place .ic { width: 1rem; height: 1rem; fill: currentColor; stroke: none; }
.lock-card { margin-top: auto; padding: 14px 16px 12px; border-radius: 28px; background: rgba(8, 28, 21, .5); border: 1px solid rgba(255, 255, 255, .16);
  -webkit-backdrop-filter: blur(18px) saturate(150%); backdrop-filter: blur(18px) saturate(150%); box-shadow: 0 18px 50px rgba(0, 0, 0, .35); display: grid; gap: 10px; }
.lock-card-head { display: flex; align-items: center; justify-content: center; gap: 8px; }
.lock-card-head h1 { margin: 0; font-size: 1.1rem; font-weight: 650; letter-spacing: .01em; }
.lock-card-head .ic { color: #efc75e; width: 1.15rem; height: 1.15rem; }
.lock-foot { display: flex; align-items: center; justify-content: center; gap: 6px; margin: 2px 0 0; font-size: .74rem; opacity: .78; }
.lock-foot .ic { width: .95rem; height: .95rem; }
.lock-note { margin: 0; font-size: .86rem; opacity: .9; line-height: 1.45; text-align: center; }
.lock-form { display: grid; gap: 6px; }
.lock-form label { font-size: .8rem; opacity: .85; margin-top: 4px; }
.lock-form input { min-height: 46px; padding: 0 14px; border-radius: 12px; border: 1px solid rgba(255, 255, 255, .28); background: rgba(255, 255, 255, .1); color: #fff; font: 600 1rem/1 var(--font); letter-spacing: .06em; }
.lock-form input:focus { outline: 2px solid #efc75e; outline-offset: 1px; }
.lock .btn.primary { background: #efc75e; color: #2b2000; border-color: transparent; }
.link-btn { min-height: 44px; border: 0; background: none; color: #ffe7a6; font: 600 .9rem var(--font); }
.lock.leaving { opacity: 0; transform: scale(1.03); transition: opacity .3s ease-in, transform .3s ease-in; }

/* Bàn phím PIN */
.pin { display: grid; gap: 8px; justify-items: center; }
.pin-dots { display: flex; gap: 16px; padding: 8px 0 2px; }
.pin-dots i { width: 15px; height: 15px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, .78); transition: background-color .15s ease-out, transform .15s ease-out; }
.pin-dots i.on { background: #efc75e; border-color: #efc75e; transform: scale(1.12); }
.pin.ok .pin-dots i { background: #7fe0b4; border-color: #7fe0b4; }
.pin.busy .pin-dots i.on { animation: pin-pulse .9s ease-in-out infinite; }
.pin.busy .pin-dots i:nth-child(2) { animation-delay: .1s; } .pin.busy .pin-dots i:nth-child(3) { animation-delay: .2s; } .pin.busy .pin-dots i:nth-child(4) { animation-delay: .3s; } .pin.busy .pin-dots i:nth-child(5) { animation-delay: .4s; } .pin.busy .pin-dots i:nth-child(6) { animation-delay: .5s; }
@keyframes pin-pulse { 50% { opacity: .35; transform: scale(.85); } }
.pin-dots.shake { animation: pin-shake .32s ease-out; }
@keyframes pin-shake { 20% { transform: translateX(-10px); } 40% { transform: translateX(9px); } 60% { transform: translateX(-6px); } 80% { transform: translateX(4px); } }
.pin-msg { min-height: 1.35em; margin: 0; font-size: .86rem; text-align: center; opacity: .92; }
.pin-msg.bad { color: #ffb8aa; font-weight: 600; opacity: 1; }
.keypad { display: grid; grid-template-columns: repeat(3, 72px); gap: 10px 24px; justify-content: center; padding: 2px 0; }
.key { display: grid; place-items: center; width: 72px; height: 72px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, .2); background: rgba(255, 255, 255, .11); color: #fff; font: 500 1.85rem/1 var(--font-num, var(--font)); -webkit-tap-highlight-color: transparent; transition: transform .1s ease-out, background-color .1s ease-out; }
.key:active { transform: scale(.93); background: rgba(255, 255, 255, .3); }
.key:focus-visible { outline: 2px solid #efc75e; outline-offset: 3px; }
.key.ghost { border: 0; background: none; }
.key.ghost-key, .key.text-key { border: 0; background: none; }
.key.text-key span { font-size: .76rem; font-weight: 650; color: #ffe7a6; white-space: nowrap; }
.key .ic { width: 1.6rem; height: 1.6rem; }
.pin.disabled .keypad { opacity: .45; }
@media (max-height: 700px) { .keypad { grid-template-columns: repeat(3, 66px); gap: 8px 20px; } .key { width: 66px; height: 66px; font-size: 1.6rem; } .lock-hello { margin-top: 0; } .lock-hello .hello { font-size: 1.5rem; } }
@media (min-width: 900px), (orientation: landscape) {
  .lock-bg { top: 0; height: 100%; object-position: 50% 74%; }
  .lock-shade { background: linear-gradient(90deg, rgba(3, 14, 10, .7) 0%, rgba(3, 14, 10, .15) 45%, rgba(3, 14, 10, .35) 100%); }
}
@media (min-width: 900px) {
  .lock-inner { width: min(980px, 100%); display: grid; grid-template-columns: 1fr 420px; grid-template-rows: auto 1fr; align-items: end; column-gap: 40px; padding: 32px 40px; }
  .lock-brand { grid-column: 1; grid-row: 1; align-self: start; }
  .lock-hello { grid-column: 1; grid-row: 2; align-self: end; margin-bottom: 18px; }
  .lock-card { grid-column: 2; grid-row: 1 / 3; align-self: center; margin-top: 0; }
}
@media (prefers-reduced-motion: reduce) { .lock.leaving, .pin-dots i, .key, .pin.busy .pin-dots i.on, .pin-dots.shake { transition: none !important; animation: none !important; } }

/* Bàn phím PIN trong sheet sáng/tối */
.pin-light .pin-dots i { border-color: var(--green); }
.pin-light .pin-dots i.on { background: var(--green); border-color: var(--green); }
.pin-light .key { background: var(--surface-2); border-color: var(--line); color: var(--text); }
.pin-light .key:active { background: var(--green-soft); }
.pin-light .pin-msg.bad { color: var(--bad); }
.lead.center { text-align: center; }

/* Trình hướng dẫn & Bảo mật */
.steps-bar { display: flex; gap: 4px; margin: 0 0 6px; padding: 0; list-style: none; overflow-x: auto; scrollbar-width: none; }
.steps-bar li { flex: 1 0 auto; padding: 6px 8px; border-radius: 8px; font-size: .72rem; font-weight: 650; color: var(--muted); background: var(--surface-2); text-align: center; white-space: nowrap; }
.steps-bar li.on { background: var(--green); color: #fff; } .steps-bar li.done { color: var(--green); background: var(--green-soft); }
.wiz-hero { display: grid; justify-items: center; gap: 8px; text-align: center; padding: 8px 0; }
.wiz-hero > .ic { width: 2.6rem; height: 2.6rem; color: var(--green); }
.wiz-list { margin: 0; padding-left: 1.2em; display: grid; gap: 8px; line-height: 1.45; }
.spinner { width: 42px; height: 42px; border-radius: 50%; border: 4px solid var(--green-soft); border-top-color: var(--green); animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.recovery-code { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 4px 0; padding: 12px; border-radius: 14px; background: var(--surface-2); border: 1px dashed var(--green); user-select: all; -webkit-user-select: all; }
.recovery-code span { display: grid; justify-items: center; gap: 2px; padding: 6px 0; border-radius: 10px; background: var(--surface); }
.recovery-code small { font-size: .66rem; color: var(--muted); font-weight: 650; }
.recovery-code b { font: 700 1.15rem/1.2 ui-monospace, "SF Mono", Menlo, monospace; letter-spacing: .08em; }
.rc-check { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.rc-check label { display: grid; gap: 4px; font-size: .8rem; color: var(--muted); }
.rc-check input { min-height: 46px; text-align: center; font: 700 1.1rem ui-monospace, Menlo, monospace; letter-spacing: .12em; text-transform: uppercase; }
.security-hero { display: grid; grid-template-columns: auto 1fr; gap: 14px; align-items: center; padding: 16px; border-radius: var(--r); border: 1px solid var(--line); background: var(--surface); }
.security-hero .sec-ic { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 16px; }
.security-hero .sec-ic .ic { width: 1.6rem; height: 1.6rem; }
.security-hero.on .sec-ic { background: var(--green-soft); color: var(--green); } .security-hero.off .sec-ic { background: var(--warn-soft); color: var(--warn); }
.security-hero strong { display: block; } .security-hero p { margin: 4px 0 0; color: var(--muted); font-size: .86rem; line-height: 1.45; }
.round-ic.bad { background: var(--bad-soft); color: var(--bad); }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 3s; } }

/* ===================== 3.6 — Làm mới giao diện ===================== */
/* Thanh tiêu đề: nút tìm kiếm chung + nút "+ …" có chữ */
.search-btn { margin-left: auto; }
.lock-now { margin-left: 0; }
.app-action { margin-left: 0; }
.add-btn { min-height: 38px; padding: 6px 14px 6px 10px; gap: 4px; border-radius: 999px; background: var(--green); border-color: var(--green); color: #fff; font-size: .86rem; white-space: nowrap; }
.add-btn .ic { width: 1.05rem; height: 1.05rem; stroke-width: 2.4; }
@media (max-width: 360px) { .add-btn span { max-width: 9ch; overflow: hidden; text-overflow: ellipsis; } }

/* A1: thông báo ở trên đầu, chạm để tắt; nút Trợ lý tròn, lùi khi cuộn xuống */
.toast { top: calc(env(safe-area-inset-top, 0px) + 62px); bottom: auto; transform: translate(-50%, -16px); pointer-events: none; cursor: pointer; }
.toast.show { pointer-events: auto; }
body:has(#undo-bar.show) .toast { bottom: auto; }
@media (min-width: 900px) { .toast { top: 18px; bottom: auto; } body:has(#undo-bar.show) .toast { bottom: auto; } }
#agent-fab { width: 52px; padding: 0; justify-content: center; transition: transform .22s ease, opacity .22s ease, bottom .2s ease; }
#agent-fab .fab-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
#agent-fab .ic { width: 1.45rem; height: 1.45rem; }
#agent-fab.away { transform: translateY(calc(100% + 30px)); opacity: 0; pointer-events: none; }
body:has(#undo-bar.show) #agent-fab { bottom: calc(var(--tab-h) + env(safe-area-inset-bottom, 0px) + 80px); }
@media (min-width: 900px) { body:has(#undo-bar.show) #agent-fab { bottom: 88px; } }
html.selecting #agent-fab { display: none; }

/* B2: vuốt trái trên dòng */
.row.split { position: relative; overflow: hidden; touch-action: pan-y; --sx: 0px; }
.row.split > .row-hit, .row.split > .row-more { transform: translateX(var(--sx)); background: var(--surface); }
.row.split.swipe-anim > .row-hit, .row.split.swipe-anim > .row-more { transition: transform .2s ease-out; }
.swipe-actions { position: absolute; top: 0; right: 0; bottom: 0; display: flex; z-index: 0; }
.row.split > .row-hit, .row.split > .row-more { position: relative; z-index: 1; }
.swipe-btn { flex: 1; display: grid; place-content: center; justify-items: center; gap: 3px; min-width: 0; border: 0; background: var(--info); color: #fff; font: 600 .7rem/1.15 var(--font); padding: 4px; text-align: center; }
.swipe-btn.first { background: var(--green); }
.swipe-btn.more { background: #5b6a61; }
.swipe-btn .ic { width: 1.2rem; height: 1.2rem; }
.swipe-btn span { overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
:root[data-theme="dark"] .swipe-btn { color: #0d1411; } :root[data-theme="dark"] .swipe-btn.more { background: #93a399; }
/* Điểm danh: vuốt phải = Tham gia, vuốt trái = Vắng */
.att-row { position: relative; touch-action: pan-y; --sx: 0px; transform: translateX(var(--sx)); }
.att-row.swipe-anim { transition: transform .2s ease-out; }
.att-row .swipe-hint { position: absolute; top: 50%; transform: translateY(-50%); font-size: .78rem; font-weight: 700; opacity: 0; pointer-events: none; }
.att-row.to-right .swipe-hint { left: calc(-1 * var(--sx) + 10px); color: var(--good); opacity: .9; }
.att-row.to-left .swipe-hint { right: calc(var(--sx) + 10px); color: var(--bad); opacity: .9; }
.att-row.armed.to-right { box-shadow: inset 4px 0 0 var(--good); } .att-row.armed.to-left { box-shadow: inset -4px 0 0 var(--bad); }

/* A3: một hàng lọc */
.filter-row .chip { display: inline-flex; align-items: center; gap: 6px; }
.filter-row .filter-open .ic { width: 1rem; height: 1rem; }
.chip.removable { padding-right: 10px; }
.chip.removable .ic.x { width: .9rem; height: .9rem; stroke-width: 2.4; }
.chip.quick { color: var(--muted); }
.chip-sep { flex: none; width: 1px; align-self: stretch; margin: 6px 2px; background: var(--line); }
.filter-sheet { display: grid; gap: 14px; }
.filter-group { margin: 0; padding: 0; border: 0; display: grid; gap: 8px; min-width: 0; }
.filter-group legend { padding: 0; margin-bottom: 6px; font-size: .78rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }

/* B3: chọn nhiều */
.meta-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 40px; }
.meta-row .result-meta { flex: 1; }
.select-row { grid-template-columns: auto auto minmax(0, 1fr); padding: 6px 14px 6px 4px; cursor: pointer; }
.select-row:has(input:checked) { background: var(--green-soft); }
.bulk-bar { position: fixed; z-index: 950; left: 0; right: 0; margin: 0 auto; bottom: calc(var(--tab-h) + env(safe-area-inset-bottom, 0px) + 10px); width: min(560px, calc(100vw - 20px)); display: grid; gap: 8px; padding: 10px 12px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); box-shadow: 0 10px 30px rgba(0, 0, 0, .18); animation: rise .2s ease-out both; }
.bulk-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.bulk-actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.bulk-actions .btn { padding: 6px 8px; font-size: .8rem; }
html.selecting main { padding-bottom: calc(var(--tab-h) + env(safe-area-inset-bottom, 0px) + 150px); }
@media (min-width: 900px) { .bulk-bar { bottom: 20px; left: var(--side-w); } }

/* A4 + B4: Hôm nay */
.today-card { gap: 8px; padding: 12px; }
.today-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.today-head h2 { font-size: 1.05rem; }
.today-list { border: 0; border-radius: 12px; background: var(--surface-2); }
.today-list .row { min-height: 50px; padding: 7px 12px; gap: 10px; }
.today-list .row-sub { display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.today-list .row-title { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.today-list .round-ic { width: 34px; height: 34px; }
.today-dismiss { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; padding-right: 6px; }
.today-dismiss .mini { width: 44px; height: 44px; margin: 0; }
.round-ic.warn { background: var(--warn-soft); color: var(--warn); } .round-ic.info { background: var(--info-soft); color: var(--info); }
.round-ic.rose { background: var(--rose-soft); color: var(--rose); } .round-ic.good, .round-ic.green { background: var(--good-soft); color: var(--good); }
.today-card .btn.wide { justify-content: space-between; }
/* A2: Văn phòng không có việc tồn đọng */
.all-clear { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 12px; align-items: center; padding: 14px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--line); }
.all-clear .btn-row { grid-column: 1 / -1; }
.all-clear .round-ic { background: var(--good-soft); color: var(--good); }

/* B5: Xu hướng 6 tháng */
.trend-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (min-width: 640px) { .trend-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.trend { display: grid; gap: 4px; padding: 12px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--line); text-align: left; color: inherit; font: inherit; min-width: 0; }
.trend:active { background: var(--surface-2); }
.trend-label { font-size: .78rem; color: var(--muted); font-weight: 600; }
.trend-row { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; }
.trend-row strong { font: 700 1.3rem/1.1 var(--font-num); font-variant-numeric: tabular-nums; }
.trend .delta { font-size: .72rem; font-weight: 650; } .trend .delta.up { color: var(--good); } .trend .delta.down { color: var(--bad); } .trend .delta.flat { color: var(--muted); }
.spark { width: 100%; height: 34px; overflow: visible; }
.spark-line { fill: none; stroke: var(--green); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
:root[data-theme="dark"] .spark-line { stroke: var(--green-ink); }
.spark-dot { fill: var(--gold); stroke: var(--surface); stroke-width: 1.5; }
.trend-axis { display: flex; justify-content: space-between; font-size: .68rem; color: var(--faint); }

/* B6: hồ sơ */
.profile-hero { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 14px; align-items: center; padding: 4px 0 2px; }
.avatar-xl { width: 64px; height: 64px; font-size: 1.25rem; }
.profile-line { margin: 0 0 6px; font-weight: 600; }
.profile-timeline > li::before { background: var(--muted); }
.profile-timeline > li.t-good::before { background: var(--good); } .profile-timeline > li.t-info::before { background: var(--info); }
.profile-timeline > li.t-warn::before { background: var(--warn); } .profile-timeline > li.t-gold::before { background: var(--gold); } .profile-timeline > li.t-muted::before { background: var(--line); }
.profile-timeline strong { font-weight: 600; font-size: .92rem; }

/* B1: tìm kiếm chung */
.search-sheet .sheet-foot { display: none; }
.gs { display: grid; gap: 10px; }
.gs-results { display: grid; gap: 10px; }
.gs-group { display: grid; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.gs-group > * + * { border-top: 1px solid var(--line); }
.gs-item.active { background: var(--green-soft); box-shadow: inset 3px 0 0 var(--green); }
.gs-hint { display: grid; gap: 6px; }
@media (min-width: 640px) { .search-sheet { inset: 0; margin: 10vh auto auto; } }

/* B7: tăng tương phản */
:root[data-contrast="more"] { --muted: #3c4842; --faint: #46524b; --line: #a9b6ad; }
:root[data-contrast="more"][data-theme="dark"] { --muted: #cfdad3; --faint: #bfcbc4; --line: #4f6157; }
:root[data-contrast="more"] .chip, :root[data-contrast="more"] .btn, :root[data-contrast="more"] .card, :root[data-contrast="more"] .list, :root[data-contrast="more"] .stat { border-width: 1.5px; }

/* B8: chuyển màn hình kiểu iOS */
html[data-nav="push"]::view-transition-old(root) { animation: vt-push-out .3s cubic-bezier(.2, .8, .2, 1) both; }
html[data-nav="push"]::view-transition-new(root) { animation: vt-push-in .3s cubic-bezier(.2, .8, .2, 1) both; }
html[data-nav="pop"]::view-transition-old(root) { animation: vt-pop-out .28s cubic-bezier(.2, .8, .2, 1) both; }
html[data-nav="pop"]::view-transition-new(root) { animation: vt-pop-in .28s cubic-bezier(.2, .8, .2, 1) both; }
@keyframes vt-push-in { from { transform: translateX(100%); } }
@keyframes vt-push-out { to { transform: translateX(-30%); opacity: .6; } }
@keyframes vt-pop-in { from { transform: translateX(-30%); opacity: .6; } }
@keyframes vt-pop-out { to { transform: translateX(100%); } }
main.edge-drag { transition: none; box-shadow: -8px 0 24px rgba(0, 0, 0, .12); }
main { transition: transform .2s ease-out; }
@media (prefers-reduced-motion: reduce) {
  html[data-nav]::view-transition-old(root), html[data-nav]::view-transition-new(root) { animation: none !important; }
  main, .row.split > .row-hit, .row.split > .row-more, .att-row, #agent-fab, .bulk-bar { transition: none !important; animation: none !important; }
}
/* Nhãn thanh tab giữ cỡ cố định (như iOS) để không bị cắt khi chọn chữ Lớn / Rất lớn */
.tabbar button { font-size: 11px; }
@media (max-width: 360px) { .tabbar button { font-size: 10px; } }
@media (min-width: 900px) { .tabbar button { font-size: .92rem; } }

/* ===================== 3.7 — Đoàn viên & Đảng viên ===================== */
.dual-card { gap: 10px; }
.dual-grid { display: grid; grid-template-columns: auto minmax(0, 1fr) minmax(0, 1fr); gap: 6px; align-items: stretch; }
.dual-col { font-size: .74rem; font-weight: 700; color: var(--muted); text-align: center; align-self: end; padding-bottom: 2px; }
.dual-row { font-size: .74rem; font-weight: 700; color: var(--muted); writing-mode: vertical-rl; transform: rotate(180deg); text-align: center; align-self: center; max-height: 110px; }
.dual-cell { display: grid; align-content: center; gap: 2px; min-height: 76px; padding: 10px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2); color: var(--text); text-align: left; font: inherit; min-width: 0; }
.dual-cell strong { font: 700 1.55rem/1 var(--font-num); font-variant-numeric: tabular-nums; }
.dual-cell span { font-size: .78rem; color: var(--muted); line-height: 1.25; }
.dual-cell.both { background: var(--gold-soft); border-color: color-mix(in srgb, var(--gold) 55%, var(--line)); }
.dual-cell.both strong { color: var(--gold-ink); }
.dual-cell.party strong { color: var(--info); } .dual-cell.youth strong { color: var(--good); } .dual-cell.none strong { color: var(--muted); }
.dual-cell:active { transform: scale(.985); }
button.team-bar { width: 100%; border: 0; background: none; color: inherit; font: inherit; padding: 4px 0; min-height: 36px; text-align: left; }
.dual-team .bar i { background: var(--gold); }
.warn-note { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.dual-link { width: 100%; text-align: left; font: inherit; color: inherit; cursor: pointer; grid-template-columns: auto minmax(0, 1fr) auto; background: var(--gold-soft); }
.dual-link > .ic:first-child { color: var(--gold-ink); }

/* 3.8: cảnh báo kho trống / mất dữ liệu */
.banner.guard { margin: 0 0 12px; }
.banner.guard.bad { background: var(--bad-soft); }
.banner.guard.bad > .ic, .banner.guard.bad strong { color: var(--bad); }
.banner.guard .btn-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.kv { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; margin: 0; font-size: .92rem; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; font-weight: 600; text-align: right; }
.tips { margin: 0; padding-left: 1.1em; display: grid; gap: 6px; font-size: .92rem; }

/* 3.9: chia sẻ cho lãnh đạo, chế độ chỉ xem */
.role-pill { flex: none; padding: 3px 9px; border-radius: 999px; background: var(--warn-soft); color: var(--warn); font-size: .72rem; font-weight: 800; letter-spacing: .04em; }
.role-pill[hidden] { display: none; }
.share-steps { margin: 0 0 12px; padding: 0; list-style: none; counter-reset: s; display: grid; gap: 10px; }
.share-steps li { counter-increment: s; display: grid; grid-template-columns: 28px 1fr; column-gap: 10px; }
.share-steps li::before { content: counter(s); grid-row: 1 / span 2; width: 28px; height: 28px; border-radius: 50%; background: var(--green-soft); color: var(--green-ink); display: grid; place-items: center; font-weight: 700; font-size: .85rem; }
.share-steps li span { color: var(--muted); font-size: .9rem; }
.round-ic.good { background: var(--good-soft); color: var(--good); } .round-ic.warn { background: var(--warn-soft); color: var(--warn); }
html[data-role="viewer"] .add-btn, html[data-role="viewer"] .select-toggle, html[data-role="viewer"] .swipe-hint, html[data-role="viewer"] .swipe-actions { display: none !important; }

/* 3.10: Tổ của tôi */
.myteam-card .btn-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.myteam-card .btn-row .btn { min-height: 44px; }
.scope-btn { flex: none; margin-left: auto; margin-right: 8px; padding: 4px 11px; border-radius: 999px; border: 1px solid var(--line, #d8dfd9); background: var(--surface-2); color: var(--text); font: inherit; font-size: .8rem; font-weight: 700; min-height: 40px; }
.scope-btn[aria-pressed="true"] { background: var(--green-soft); color: var(--green-ink); border-color: transparent; }
.today-head { display: flex; align-items: center; }
.scope-row { display: flex; justify-content: flex-end; margin: 0 0 8px; }

/* ======================================================================
   3.11 — "Sổ công tác": làm mới hình thức, KHÔNG đổi dữ liệu hay logic.
   Tiêu đề chữ có chân (gợi văn bản hành chính), số vẫn chữ không chân để thẳng hàng.
   Khối phẳng, bo góc có phân cấp, nhãn nhỏ viết thường (bỏ IN HOA rải rác).
   Điểm nhấn duy nhất: thẻ "Tổ của tôi" là tấm bảng xanh đậm, số vàng.
   ====================================================================== */
:root {
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, "Times New Roman", serif;
  --bg: #eef1ec; --line: #d3dcd4; --surface-2: #e8ede7; --faint: #55645c;
  --r: 10px; --r-sm: 7px;
  --shadow: 0 1px 0 rgba(16, 40, 28, .04);
  --slab: #14402e; --slab-2: #1d5640; --star: #e8c05a; --slab-ink: #dbe8df;
  --ease: cubic-bezier(.22, .8, .24, 1);
}
:root[data-theme="dark"] { --bg: #0c1310; --line: #27352d; --surface-2: #1a251f; }

/* Chữ */
.app-title, .sheet-titles h2, .card h2, .card h3, .brand-text strong, .section > h2, .block-title { font-family: var(--serif); }
.app-title { font-weight: 700; letter-spacing: -.01em; }
.sheet-titles h2 { font-weight: 700; letter-spacing: 0; }
.brand-text strong { letter-spacing: .02em; }
.kicker, .list-head, .block-title { text-transform: none; letter-spacing: 0; font-size: .86rem; font-weight: 700; }
.block-title { font-size: 1.05rem; color: var(--text); margin-top: 12px; }
.list-head { color: var(--muted); }

/* Khối phẳng: bỏ bóng, viền mảnh */
.card, .list, .stat, .banner { box-shadow: none; }
.card, .list { border-radius: var(--r); }
.stat { border-radius: var(--r-sm); border-left: 3px solid var(--line); }
.stat.good { border-left-color: var(--good); } .stat.warn { border-left-color: var(--warn); } .stat.bad { border-left-color: var(--bad); } .stat.info { border-left-color: var(--info); }
.chip { border-radius: 999px; } .btn { border-radius: 10px; }
.banner { border-radius: var(--r-sm); }

/* Thanh tab: vạch vàng báo mục đang mở */
.tabbar button { position: relative; }
.tabbar button.on::before { content: ""; position: absolute; top: 0; left: 28%; right: 28%; height: 3px; border-radius: 0 0 3px 3px; background: var(--star); }

/* Thẻ "Tổ của tôi": tấm bảng xanh đậm — điểm nhấn duy nhất */
.myteam-card { background: var(--slab); border-color: var(--slab); color: var(--slab-ink); border-radius: 12px; padding: 16px; gap: 12px; }
.myteam-card .stats { gap: 8px; }
.myteam-card .stat { background: var(--slab-2); border: 0; border-left: 3px solid var(--star); min-height: 84px; color: #fff; }
.myteam-card .stat strong { color: var(--star); font-size: 2rem; }
.myteam-card .stat span { color: var(--slab-ink); }
.myteam-card .stat.good, .myteam-card .stat.warn, .myteam-card .stat.info { border-left-color: var(--star); }
.myteam-card .note { color: var(--slab-ink); }
.myteam-card .warn-note { color: #f6dc92; }
.myteam-card .btn.ghost { background: transparent; border-color: rgba(255, 255, 255, .4); color: #fff; }
.myteam-card .btn.primary { background: var(--star); border-color: var(--star); color: #1b2a20; }
.section:has(> .myteam-card) > h2, .section:has(.myteam-card) > h2 { font-size: 1.3rem; }

/* Chuyển động đáp lại thao tác: mở bảng, hiện thông báo */
.sheet[open] { animation: sheet-up .28s var(--ease) both; }
.sheet::backdrop { transition: background .2s; }
.toast { transition: opacity .18s ease, transform .24s var(--ease); }
.toast.show { transform: translate(-50%, 0); }
.stat, .row, .btn, .chip { transition: background-color .12s ease, transform .1s ease; }
.btn:active, .chip:active, .stat:active { transform: scale(.98); }
@media (prefers-reduced-motion: reduce) { .sheet[open], .toast, .stat, .row, .btn, .chip { animation: none !important; transition: none !important; } .btn:active, .chip:active, .stat:active { transform: none; } }
.myteam-card .btn-row { flex-wrap: nowrap; } .myteam-card .btn-row .btn { flex: 1 1 0; min-width: 0; padding-inline: 8px; font-size: .82rem; white-space: normal; line-height: 1.15; }
@media (min-width: 900px) { .tabbar button.on::before { top: 14%; bottom: 14%; left: 0; right: auto; width: 3px; height: auto; border-radius: 0 3px 3px 0; } }
/* 3.11: khối ".kv" có dòng ".kv-row" thì xếp một cột (định nghĩa .kv cũ ở trên làm lưới 2 cột, ép dòng thành cột hẹp) */
.kv:has(> .kv-row) { grid-template-columns: minmax(0, 1fr); gap: 0; font-size: inherit; }
.kv-row dd { text-align: right; font-weight: 600; justify-content: flex-end; }
.kv-row dt { overflow-wrap: anywhere; }
