/* Drive — giao diện CHO ĐIỆN THOẠI. Cột đơn tối đa 480px, thanh tab dưới, ngăn kéo từ dưới lên, vùng chạm >= 44px, tôn trọng tai thỏ / thanh home (safe-area).
   Màu qua biến; chế độ tối theo hệ điều hành hoặc người dùng chọn. Màu biểu đồ dùng bảng đã qua validate_palette (sáng + tối). */
:root {
  color-scheme: light;
  --bg: #f1f2ef; --card: #ffffff; --card-2: #f4f5f2; --ink: #101311; --ink-2: #4b514d; --muted: #858b86; --line: #e5e7e2; --grid: #ecede8;
  --accent: #2a78d6; --accent-ink: #ffffff; --accent-soft: #e5effc; --accent-2: #1a56b0;
  --hero-a: #184f9f; --hero-b: #2f86e6; --hero-ink: #ffffff;
  --good: #0a7a0a; --warn: #9a5f00; --bad: #c42b2b; --good-bg: #e3f4e3; --warn-bg: #fff2d6; --bad-bg: #fde7e7;
  --k-fuel: #2a78d6; --k-service: #eb6834; --k-charge: #1baf7a; --k-tire: #eda100; --k-insurance: #e87ba4; --k-expense: #008300;
  --shadow: 0 1px 2px rgba(16,19,17,.05), 0 6px 20px rgba(16,19,17,.06); --shadow-up: 0 -8px 30px rgba(16,19,17,.10);
  --r: 18px; --tab-h: 62px;
  --sat: env(safe-area-inset-top, 0px); --sab: env(safe-area-inset-bottom, 0px);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0b0c0c; --card: #161817; --card-2: #1e211f; --ink: #f1f2ee; --ink-2: #c4c7c0; --muted: #8f958e; --line: #2a2d2a; --grid: #252825;
    --accent: #3987e5; --accent-ink: #08101a; --accent-soft: #14263c; --accent-2: #5aa0ee;
    --hero-a: #0f2d57; --hero-b: #1c4f8f; --hero-ink: #ffffff;
    --good: #55c755; --warn: #f0b429; --bad: #f28b8b; --good-bg: #15301a; --warn-bg: #382d0f; --bad-bg: #3a1c1c;
    --k-fuel: #3987e5; --k-service: #d95926; --k-charge: #199e70; --k-tire: #c98500; --k-insurance: #d55181; --k-expense: #008300;
    --shadow: none; --shadow-up: 0 -8px 30px rgba(0,0,0,.5);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b0c0c; --card: #161817; --card-2: #1e211f; --ink: #f1f2ee; --ink-2: #c4c7c0; --muted: #8f958e; --line: #2a2d2a; --grid: #252825;
  --accent: #3987e5; --accent-ink: #08101a; --accent-soft: #14263c; --accent-2: #5aa0ee;
  --hero-a: #0f2d57; --hero-b: #1c4f8f; --hero-ink: #ffffff;
  --good: #55c755; --warn: #f0b429; --bad: #f28b8b; --good-bg: #15301a; --warn-bg: #382d0f; --bad-bg: #3a1c1c;
  --k-fuel: #3987e5; --k-service: #d95926; --k-charge: #199e70; --k-tire: #c98500; --k-insurance: #d55181; --k-expense: #008300;
  --shadow: none; --shadow-up: 0 -8px 30px rgba(0,0,0,.5);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; background: var(--bg); }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; min-height: 100dvh; overscroll-behavior-y: none; touch-action: manipulation; }
@media (min-width: 520px) { html { background: #dfe1dc; } body { background: #dfe1dc; } :root[data-theme="dark"] body, :root[data-theme="dark"] html { background: #000; } }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); text-decoration: none; }
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { line-height: 1.2; letter-spacing: -0.01em; }
.muted { color: var(--muted); } .small { font-size: .85rem; } .ink2 { color: var(--ink-2); } .num { font-variant-numeric: tabular-nums; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 8px; }
.ico { width: 22px; height: 22px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }

/* ----- khung ----- */
#app { max-width: 480px; margin: 0 auto; min-height: 100dvh; background: var(--bg); position: relative; }
@media (min-width: 520px) { #app { box-shadow: 0 0 60px rgba(0,0,0,.18); } }
#main { padding-bottom: calc(var(--tab-h) + var(--sab) + 34px); }
#main.subpage { padding-bottom: calc(var(--sab) + 110px); }
.pad { padding: 0 14px; }
.stack > * + * { margin-top: 14px; }

/* Đầu trang có chữ trắng trên nền xanh */
.hd { background: linear-gradient(165deg, var(--hero-a), var(--hero-b)); color: var(--hero-ink); padding: calc(var(--sat) + 12px) 14px 44px; position: relative; }
.hd.short { padding-bottom: 22px; }
.hd-row { display: flex; align-items: center; gap: 10px; }
.vpill { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; background: rgba(255,255,255,.14); border: 0; border-radius: 16px; padding: 7px 12px 7px 8px; color: inherit; text-align: left; min-height: 52px; }
.vpill:active { background: rgba(255,255,255,.22); }
.vpill .t { flex: 1; min-width: 0; }
.vpill .n { font-weight: 700; font-size: 1.05rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vpill .s { font-size: .82rem; opacity: .85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vav { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; color: #fff; flex: none; box-shadow: inset 0 0 0 2px rgba(255,255,255,.35); }
.hbtn { width: 44px; height: 44px; border-radius: 50%; border: 0; display: grid; place-items: center; background: rgba(255,255,255,.14); color: inherit; flex: none; }
.hbtn:active { background: rgba(255,255,255,.26); }
.hd h1 { font-size: 1.35rem; margin: 14px 2px 0; }
.hd .sub { opacity: .85; font-size: .9rem; margin: 2px 2px 0; }
.searchbar { margin-top: 10px; }
.searchbar input { width: 100%; border: 0; border-radius: 14px; padding: 12px 14px; background: rgba(255,255,255,.95); color: #111; min-height: 46px; }
.lift { margin-top: -30px; position: relative; z-index: 2; }

/* Đầu trang con (biểu mẫu, quản lý) */
.sub-hd { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 6px; padding: calc(var(--sat) + 8px) 8px 8px; background: color-mix(in srgb, var(--bg) 90%, transparent); backdrop-filter: blur(14px); border-bottom: 1px solid var(--line); }
.sub-hd h1 { flex: 1; font-size: 1.15rem; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ibtn { width: 44px; height: 44px; border-radius: 50%; border: 0; background: none; display: grid; place-items: center; color: var(--ink); }
.ibtn:active { background: var(--card-2); }
.ibtn.bad { color: var(--bad); }

/* Thanh tab dưới + nút ghi nhanh */
.tabbar { position: fixed; left: 50%; transform: translateX(-50%); bottom: 0; width: 100%; max-width: 480px; z-index: 40; background: color-mix(in srgb, var(--card) 94%, transparent); backdrop-filter: blur(16px); border-top: 1px solid var(--line); box-shadow: var(--shadow-up);
  display: grid; grid-template-columns: 1fr 1fr 76px 1fr 1fr; height: calc(var(--tab-h) + var(--sab)); padding-bottom: var(--sab); }
.tab { border: 0; background: none; color: var(--muted); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: .72rem; font-weight: 600; position: relative; text-decoration: none; }
.tab.on { color: var(--accent); }
.tab .ico { width: 24px; height: 24px; }
.tab .dot { position: absolute; top: 7px; left: calc(50% + 8px); min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px; background: var(--bad); color: #fff; font-size: .66rem; display: grid; place-items: center; font-weight: 700; }
.fab { position: absolute; left: 50%; top: -22px; transform: translateX(-50%); width: 62px; height: 62px; border-radius: 50%; border: 4px solid var(--bg); background: linear-gradient(160deg, var(--hero-b), var(--hero-a)); color: #fff; display: grid; place-items: center; box-shadow: 0 8px 20px rgba(24,79,159,.45); }
.fab .ico { width: 28px; height: 28px; stroke-width: 2.4; }
.fab:active { transform: translateX(-50%) scale(.94); }

/* ----- thẻ, nút, nhập liệu ----- */
.card { background: var(--card); border-radius: var(--r); padding: 16px; box-shadow: var(--shadow); min-width: 0; }
.card.flat { box-shadow: none; border: 1px solid var(--line); }
.card + .card { margin-top: 14px; }
.card-title { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.card-title h2 { flex: 1; font-size: 1.02rem; }
.card-title .ico { color: var(--accent); width: 20px; height: 20px; }
.sec { font-size: .78rem; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-weight: 700; margin: 22px 4px 8px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 12px 18px; border-radius: 14px; border: 1px solid var(--line); background: var(--card); font-weight: 700; min-height: 48px; color: var(--ink); text-decoration: none; }
.btn:active { background: var(--card-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:active { filter: brightness(.92); background: var(--accent); }
.btn.danger { color: var(--bad); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.small { min-height: 38px; padding: 7px 14px; font-size: .9rem; border-radius: 12px; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .55; }
.field { display: block; margin-bottom: 14px; }
.field > .l { display: flex; align-items: baseline; gap: 6px; font-size: .82rem; color: var(--ink-2); margin-bottom: 6px; font-weight: 700; }
.field > .l em { font-style: normal; font-weight: 400; color: var(--muted); }
.field .auto { margin-left: auto; font-size: .68rem; color: var(--accent); font-weight: 700; }
input:not([type=checkbox]):not([type=radio]):not([type=hidden]), select, textarea {
  width: 100%; padding: 12px 14px; border: 1.5px solid var(--line); background: var(--card); border-radius: 14px; min-height: 50px; font-size: 1rem; appearance: none; -webkit-appearance: none; }
select { background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 20px) 55%, calc(100% - 15px) 55%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 36px; }
input:not([type=checkbox]):focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
textarea { resize: vertical; min-height: 76px; }
input.auto-filled { background: var(--accent-soft); border-color: transparent; }
.row { display: grid; gap: 0 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips.scroll { flex-wrap: nowrap; overflow-x: auto; margin: 0 -14px; padding: 2px 14px; scrollbar-width: none; }
.chips.scroll::-webkit-scrollbar { display: none; }
.chip { border: 1.5px solid var(--line); background: var(--card); border-radius: 999px; padding: 8px 14px; font-size: .92rem; display: inline-flex; align-items: center; gap: 6px; color: var(--ink); min-height: 40px; white-space: nowrap; flex: none; }
.chip.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); font-weight: 700; }
.sw { width: 10px; height: 10px; border-radius: 3px; display: inline-block; flex: none; }
.seg { display: flex; background: var(--card-2); border-radius: 13px; padding: 3px; gap: 2px; }
.seg button { flex: 1; border: 0; background: none; padding: 9px 6px; border-radius: 10px; color: var(--ink-2); font-weight: 600; font-size: .9rem; min-height: 40px; }
.seg button.on { background: var(--card); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.12); font-weight: 700; }
.tag { display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 999px; font-size: .76rem; font-weight: 700; background: var(--card-2); color: var(--ink-2); white-space: nowrap; }
.tag.warn { background: var(--warn-bg); color: var(--warn); } .tag.bad { background: var(--bad-bg); color: var(--bad); } .tag.good { background: var(--good-bg); color: var(--good); }
.error { background: var(--bad-bg); color: var(--bad); border-radius: 12px; padding: 11px 13px; margin: 10px 0; font-size: .92rem; }
.notice { background: var(--card-2); border-radius: 12px; padding: 11px 13px; font-size: .92rem; color: var(--ink-2); }
.empty { text-align: center; padding: 36px 16px; color: var(--ink-2); }
.empty .ico { width: 44px; height: 44px; color: var(--muted); margin-bottom: 10px; }
.empty h2 { margin-bottom: 6px; color: var(--ink); }
.empty .btn { margin-top: 14px; }
.switch { position: relative; width: 52px; height: 32px; flex: none; }
.switch input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; min-height: 0; margin: 0; padding: 0; border: 0; z-index: 2; }
.switch i { position: absolute; inset: 0; border-radius: 999px; background: var(--line); transition: background .15s; }
.switch i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.3); transition: transform .15s; }
.switch input:checked + i { background: var(--accent); } .switch input:checked + i::after { transform: translateX(20px); }
.setrow { display: flex; align-items: center; gap: 12px; padding: 12px 2px; min-height: 56px; color: inherit; text-decoration: none; border-bottom: 1px solid var(--line); width: 100%; background: none; border-left: 0; border-right: 0; border-top: 0; text-align: left; }
.setrow:last-child { border-bottom: 0; }
.setrow .b { flex: 1; min-width: 0; } .setrow .t { font-weight: 600; } .setrow .d { font-size: .84rem; color: var(--muted); }
.setrow > .ico:first-child { color: var(--accent); }

/* ----- thẻ nhắc việc (cuộn ngang) ----- */
.rems { display: flex; gap: 10px; overflow-x: auto; scroll-snap-type: x mandatory; margin: 0 -14px; padding: 4px 14px 8px; scrollbar-width: none; }
.rems::-webkit-scrollbar { display: none; }
.rem { flex: 0 0 74%; max-width: 290px; scroll-snap-align: start; background: var(--card); border-radius: 16px; padding: 13px 14px; box-shadow: var(--shadow); border-left: 5px solid var(--accent); color: inherit; text-decoration: none; display: block; }
.rem.soon { border-left-color: var(--k-tire); } .rem.overdue { border-left-color: var(--bad); } .rem.nodata { border-left-color: var(--muted); }
.rem .h { display: flex; align-items: center; gap: 9px; }
.rem .bub { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; color: #fff; flex: none; }
.rem .bub .ico { width: 18px; height: 18px; stroke-width: 2.2; }
.rem .ttl { font-weight: 700; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rem .v { margin-top: 8px; font-weight: 700; font-size: 1.05rem; font-variant-numeric: tabular-nums; }
.rem .w { font-size: .84rem; margin-top: 2px; font-weight: 600; }
.w.good, .good { color: var(--good); } .w.warn, .warnc { color: var(--warn); } .w.bad, .badc { color: var(--bad); }
.pbar { height: 6px; border-radius: 999px; background: var(--card-2); overflow: hidden; margin-top: 9px; }
.pbar > i { display: block; height: 100%; border-radius: 999px; background: var(--accent); }
.pbar.soon > i { background: var(--k-tire); } .pbar.overdue > i { background: var(--bad); }

/* ----- thẻ xe: đồng hồ xăng + dự báo + ngân sách ----- */
.herocard { padding: 16px; }
.hero-top { display: flex; align-items: center; gap: 16px; }
.gauge { position: relative; width: 112px; height: 112px; flex: none; }
.gauge svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.gauge .c { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.gauge .p { font-size: 1.45rem; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; }
.gauge .u { font-size: .62rem; color: var(--muted); font-weight: 600; margin-top: 3px; line-height: 1.15; }
.hero-info { flex: 1; min-width: 0; }
.hero-info .k { font-size: .78rem; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.hero-info .big { font-size: 1.85rem; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1.1; margin: 2px 0; }
.hero-info .big small { font-size: .95rem; color: var(--ink-2); font-weight: 600; }
.hero-info .w { font-size: .9rem; font-weight: 700; }
.hero-sep { border: 0; border-top: 1px solid var(--line); margin: 14px 0; }
.budget .top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.budget .bamt { font-size: 1.25rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.budget .meter { height: 10px; border-radius: 999px; background: var(--card-2); overflow: hidden; margin: 8px 0 6px; position: relative; }
.budget .meter > i { display: block; height: 100%; border-radius: 999px; background: var(--good); }
.budget .meter > i.warn { background: var(--k-tire); } .budget .meter > i.bad { background: var(--bad); }
.budget .meter > b { position: absolute; top: -2px; bottom: -2px; width: 3px; background: var(--ink); opacity: .55; border-radius: 2px; }
.minis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 14px; }
.mini { background: var(--card-2); border-radius: 12px; padding: 9px 10px; min-width: 0; }
.mini .k { font-size: .7rem; color: var(--muted); font-weight: 700; }
.mini .v { font-weight: 800; font-size: 1rem; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini .v small { font-weight: 600; color: var(--ink-2); font-size: .7rem; }

/* ----- lịch sử kiểu đường đi ----- */
.tl { position: relative; padding-left: 0; }
.tl::before { content: ""; position: absolute; left: 19px; top: 0; bottom: 0; width: 4px; border-radius: 2px; background: repeating-linear-gradient(to bottom, var(--line) 0 10px, transparent 10px 18px); }
.mcard { position: relative; margin: 18px 0 6px 46px; background: var(--card-2); border-radius: 16px; padding: 12px 14px; }
.mcard .m { font-size: .74rem; letter-spacing: .08em; font-weight: 800; color: var(--muted); text-transform: uppercase; }
.mcard .tt { font-weight: 800; font-size: 1.1rem; font-variant-numeric: tabular-nums; margin: 2px 0; }
.mcard .tt small { color: var(--ink-2); font-weight: 600; font-size: .85rem; }
.mcard .cmp { font-size: .86rem; margin-top: 4px; display: flex; gap: 6px; align-items: flex-start; }
.item { position: relative; display: flex; gap: 12px; align-items: center; padding: 9px 0; color: inherit; text-decoration: none; min-height: 64px; }
.item + .item { border-top: 1px solid var(--line); margin-left: 46px; padding-left: 0; }
.item .bubble { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; color: #fff; flex: none; position: relative; z-index: 1; box-shadow: 0 0 0 4px var(--bg); }
.item .bubble .ico { width: 20px; height: 20px; stroke-width: 2.1; }
.tl .item { margin-left: 0; border-top: 0; padding-left: 0; }
.tl .item > .body, .tl .item > .amt { }
.tl .item .sep { position: absolute; left: 52px; right: 0; bottom: 0; border-bottom: 1px solid var(--line); }
.tl .item.last .sep { display: none; }
.body { flex: 1; min-width: 0; }
.ttl { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.sub { font-size: .84rem; color: var(--muted); display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sub b { color: var(--ink-2); font-weight: 700; }
.amt { text-align: right; font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }
.amt small { display: block; font-weight: 500; color: var(--muted); font-size: .78rem; }
.list { background: var(--card); border-radius: var(--r); padding: 4px 14px; box-shadow: var(--shadow); }
.list .item { border-top: 1px solid var(--line); margin-left: 0; }
.list .item:first-child { border-top: 0; }
.list .item .bubble { box-shadow: none; }

/* ----- báo cáo ----- */
.period { display: flex; align-items: center; gap: 4px; margin: 12px 0 4px; }
.period .lbl { flex: 1; text-align: center; font-weight: 800; font-size: 1.05rem; }
.tabs2 { display: flex; gap: 6px; overflow-x: auto; margin: 12px -14px 0; padding: 0 14px; scrollbar-width: none; }
.tabs2::-webkit-scrollbar { display: none; }
.tabs2 button { flex: none; border: 0; background: var(--card); border-radius: 999px; padding: 10px 16px; font-weight: 700; color: var(--ink-2); min-height: 42px; box-shadow: var(--shadow); }
.tabs2 button.on { background: var(--accent); color: var(--accent-ink); }
.total-card .big { font-size: 2.2rem; font-weight: 800; letter-spacing: -.03em; font-variant-numeric: tabular-nums; line-height: 1.05; }
.delta { font-size: .84rem; font-weight: 700; white-space: nowrap; }
.delta.up { color: var(--bad); } .delta.down { color: var(--good); } .delta.flat { color: var(--muted); }
.metrics { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.metric { background: var(--card); border-radius: 16px; padding: 14px; box-shadow: var(--shadow); min-width: 0; }
.metric .hd2 { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: .9rem; color: var(--ink-2); }
.metric .ibub { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; color: #fff; flex: none; }
.metric .ibub .ico { width: 17px; height: 17px; stroke-width: 2.2; }
.metric .v { font-size: 1.45rem; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -.02em; margin: 8px 0 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.metric .v small { font-size: .8rem; font-weight: 700; color: var(--ink-2); }
.metric .foot { display: flex; justify-content: space-between; gap: 6px; border-top: 1px solid var(--line); margin-top: 9px; padding-top: 8px; font-size: .76rem; color: var(--muted); }
.metric .foot b { display: block; color: var(--ink); font-size: .86rem; font-variant-numeric: tabular-nums; }
.metric .foot .r { text-align: right; }
.hi { color: var(--bad); } .lo { color: var(--good); }
.kv { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 8px 14px; font-size: .95rem; margin: 0; }
.kv dt { color: var(--ink-2); white-space: nowrap; } .kv dd { margin: 0; font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; }
.bars { display: grid; gap: 12px; }
.bar { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; align-items: center; font-size: .92rem; }
.bar .track { grid-column: 1 / -1; height: 9px; background: var(--card-2); border-radius: 999px; overflow: hidden; }
.bar .track i { display: block; height: 100%; border-radius: 999px; }
.bar .nm { display: flex; align-items: center; gap: 8px; min-width: 0; font-weight: 600; } .bar .nm span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar .val { font-weight: 800; font-variant-numeric: tabular-nums; text-align: right; }
.bar .val small { color: var(--muted); font-weight: 600; margin-left: 4px; }
.insight { display: flex; gap: 12px; align-items: flex-start; padding: 11px 0; border-top: 1px solid var(--line); }
.insight:first-child { border-top: 0; padding-top: 0; } .insight:last-child { padding-bottom: 0; }
.insight .e { width: 34px; height: 34px; border-radius: 10px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; flex: none; }
.insight .e.good { background: var(--good-bg); color: var(--good); } .insight .e.bad { background: var(--bad-bg); color: var(--bad); } .insight .e.warn { background: var(--warn-bg); color: var(--warn); }
.insight p { font-size: .94rem; } .insight p b { font-variant-numeric: tabular-nums; }
.recs { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.rec { background: var(--card-2); border-radius: 14px; padding: 11px 12px; }
.rec .k { font-size: .72rem; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.rec .v { font-size: 1.2rem; font-weight: 800; font-variant-numeric: tabular-nums; } .rec .d { font-size: .78rem; color: var(--muted); }

/* ----- biểu đồ ----- */
.chart { position: relative; width: 100%; min-height: 160px; }
.chart svg { display: block; overflow: visible; }
.chart text { font: 11px system-ui, sans-serif; fill: var(--muted); }
.chart .grid { stroke: var(--grid); stroke-width: 1; } .chart .axis { stroke: var(--line); stroke-width: 1; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: .84rem; color: var(--ink-2); margin: 0 0 8px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.tip { position: absolute; pointer-events: none; z-index: 5; background: var(--card); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 6px 22px rgba(0,0,0,.2); padding: 9px 11px; font-size: .82rem; min-width: 140px; max-width: 230px; opacity: 0; transition: opacity .08s; }
.tip.on { opacity: 1; } .tip b { display: block; margin-bottom: 4px; }
.tip .r { display: flex; align-items: center; gap: 6px; justify-content: space-between; } .tip .r span:first-child { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-2); }
.table-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; font-size: .86rem; font-variant-numeric: tabular-nums; }
table.t th, table.t td { padding: 8px 8px; text-align: right; border-bottom: 1px solid var(--line); white-space: nowrap; } table.t th:first-child, table.t td:first-child { text-align: left; }
table.t th { color: var(--muted); font-weight: 700; font-size: .76rem; }

/* ----- ngăn kéo từ dưới lên, hộp thoại, thông báo ----- */
.sheet-back { position: fixed; inset: 0; z-index: 60; background: rgba(0,0,0,.45); animation: fade .18s ease-out; display: flex; align-items: flex-end; justify-content: center; }
.sheet { width: 100%; max-width: 480px; max-height: 92dvh; overflow-y: auto; background: var(--bg); border-radius: 24px 24px 0 0; padding: 8px 16px calc(var(--sab) + 18px); animation: up .22s cubic-bezier(.2,.8,.2,1); overscroll-behavior: contain; }
.sheet .grab { width: 40px; height: 5px; border-radius: 3px; background: var(--line); margin: 4px auto 12px; }
.sheet h2 { font-size: 1.15rem; margin: 0 2px 12px; }
.kinds { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.kindbtn { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 16px 6px; border-radius: 18px; border: 0; background: var(--card); box-shadow: var(--shadow); font-weight: 700; font-size: .9rem; color: var(--ink); min-height: 96px; }
.kindbtn:active { transform: scale(.96); }
.kindbtn .bubble { width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; color: #fff; }
.kindbtn .bubble .ico { width: 23px; height: 23px; stroke-width: 2.1; }
.vrow { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 16px; background: var(--card); width: 100%; border: 2px solid transparent; text-align: left; margin-bottom: 8px; color: var(--ink); }
.vrow.on { border-color: var(--accent); }
.vrow .t { flex: 1; min-width: 0; } .vrow .n { font-weight: 700; } .vrow .s { font-size: .84rem; color: var(--muted); }
dialog { border: 0; border-radius: 22px; padding: 22px; width: min(400px, 92vw); background: var(--card); color: var(--ink); box-shadow: 0 20px 60px rgba(0,0,0,.4); }
dialog::backdrop { background: rgba(0,0,0,.5); }
dialog h3 { margin-bottom: 8px; font-size: 1.15rem; } dialog p { margin: 0 0 18px; color: var(--ink-2); }
dialog .actions { display: flex; gap: 10px; } dialog .actions .btn { flex: 1; }
#toasts { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--tab-h) + var(--sab) + 28px); z-index: 80; display: grid; gap: 8px; width: min(92vw, 440px); pointer-events: none; }
.toast { background: var(--ink); color: var(--bg); border-radius: 14px; padding: 12px 16px; font-size: .95rem; font-weight: 600; box-shadow: 0 8px 28px rgba(0,0,0,.3); animation: pop .2s ease-out; }
.toast.err { background: var(--bad); color: #fff; }
@keyframes pop { from { opacity: 0; transform: translateY(8px); } } @keyframes fade { from { opacity: 0; } } @keyframes up { from { transform: translateY(100%); } }
.loading { text-align: center; padding: 80px 0; color: var(--muted); }
.spin { display: inline-block; width: 26px; height: 26px; border: 3px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: rot .8s linear infinite; vertical-align: middle; }
@keyframes rot { to { transform: rotate(360deg); } }
.skel { background: linear-gradient(90deg, var(--card-2), var(--card), var(--card-2)); background-size: 200% 100%; animation: sh 1.2s infinite; border-radius: 14px; }
@keyframes sh { to { background-position: -200% 0; } }

/* ----- biểu mẫu ghi ----- */
.savebar { position: fixed; left: 50%; transform: translateX(-50%); bottom: 0; width: 100%; max-width: 480px; z-index: 35; padding: 10px 14px calc(var(--sab) + 12px); background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(14px); border-top: 1px solid var(--line); display: flex; gap: 10px; }
.savebar .btn { flex: 1; min-height: 54px; font-size: 1.05rem; }
.moneybox { text-align: center; padding: 20px 16px 16px; }
.moneybox .l { font-size: .8rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); display: flex; justify-content: center; gap: 8px; }
.moneybox .inp { position: relative; margin-top: 4px; }
.moneybox input { border: 0 !important; background: transparent !important; text-align: center; font-size: 2.6rem !important; font-weight: 800 !important; letter-spacing: -.03em; width: 100%; min-height: 64px !important; padding: 0 30px !important; font-variant-numeric: tabular-nums; box-shadow: none !important; min-width: 0; }
.moneybox input.auto-filled { color: var(--accent); }
.moneybox .cur { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); font-size: 1.5rem; font-weight: 700; color: var(--muted); pointer-events: none; }
.preview { background: var(--accent-soft); border-radius: 14px; padding: 12px 14px; font-size: .92rem; }
.preview b { font-variant-numeric: tabular-nums; } .preview .hint { color: var(--ink-2); }
.fld-card { background: var(--card); border-radius: var(--r); padding: 4px 14px; box-shadow: var(--shadow); }
.fld-row { display: flex; align-items: center; gap: 12px; padding: 8px 0; min-height: 58px; border-bottom: 1px solid var(--line); }
.fld-row:last-child { border-bottom: 0; }
.fld-row > .ico { color: var(--accent); }
.fld-row .l { display: block; font-size: .74rem; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.fld-row .grow { flex: 1; min-width: 0; }
.fld-row input { display: block; width: 100%; border: 0; background: transparent; padding: 2px 0; min-height: 30px; font-weight: 700; box-shadow: none !important; border-radius: 0; }
.fld-row input.auto-filled { background: transparent; color: var(--accent); }
.fld-row .side { font-size: .8rem; font-weight: 700; color: var(--accent); white-space: nowrap; }
.catgrid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.catgrid .chip { justify-content: center; text-align: center; white-space: normal; padding: 10px; border-radius: 14px; }
.done { text-align: center; }
.done .tick { width: 76px; height: 76px; border-radius: 50%; background: var(--good-bg); color: var(--good); display: grid; place-items: center; margin: 22px auto 12px; animation: tick .5s cubic-bezier(.2,1.4,.4,1); }
.done .tick .ico { width: 38px; height: 38px; stroke-width: 2.6; }
@keyframes tick { from { transform: scale(.3); opacity: 0; } }
.done h1 { font-size: 1.9rem; letter-spacing: -.02em; } .done .cmp { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 12px; }
.drop { display: block; border: 2px dashed var(--line); border-radius: 18px; padding: 26px 14px; text-align: center; cursor: pointer; color: var(--ink-2); }
.drop:active { border-color: var(--accent); }
.hero { text-align: center; padding: 40px 6px 10px; }
.hero h1 { font-size: 2rem; letter-spacing: -.03em; margin-bottom: 12px; } .hero p { color: var(--ink-2); margin-bottom: 22px; }
.hero .cta { display: grid; gap: 10px; }
.feat { display: grid; gap: 12px; margin-top: 26px; }
.feat .card { display: flex; gap: 14px; align-items: flex-start; } .feat .ico { width: 28px; height: 28px; color: var(--accent); margin-top: 2px; } .feat h3 { margin-bottom: 3px; } .feat p { font-size: .92rem; color: var(--ink-2); }
.guest-hd { background: linear-gradient(165deg, var(--hero-a), var(--hero-b)); color: #fff; padding: calc(var(--sat) + 40px) 22px 60px; text-align: center; border-radius: 0 0 34px 34px; }
.guest-hd .logo { width: 72px; height: 72px; border-radius: 20px; margin: 0 auto 14px; box-shadow: 0 10px 30px rgba(0,0,0,.25); display: block; }
.guest-hd h1 { font-size: 1.9rem; letter-spacing: -.03em; margin-bottom: 8px; } .guest-hd p { opacity: .9; }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
