/* ═══════════════════════════════════════════════════════════════════════════
   Finance.OS v11 — khôi phục ngôn ngữ thiết kế "Glass" của v10.6
   Token, kính mờ, gradient nền, badge, watermark, light mode giữ nguyên từ bản gốc.
   Bổ sung: responsive 1 codebase (sidebar ≥ 900px, bottom nav trên mobile).
   ═══════════════════════════════════════════════════════════════════════════ */
:root {
  --bg-deep: #050914;
  --glass-1: rgba(255, 255, 255, 0.055);
  --glass-2: rgba(255, 255, 255, 0.09);
  --glass-3: rgba(255, 255, 255, 0.13);
  --border-1: rgba(255, 255, 255, 0.09);
  --border-2: rgba(255, 255, 255, 0.17);
  --cyan: #00d4ff;
  --cyan-dim: rgba(0, 212, 255, 0.18);
  --violet: #a78bfa;
  --violet-dim: rgba(167, 139, 250, 0.18);
  --teal: #2dd4bf;
  --teal-dim: rgba(45, 212, 191, 0.18);
  --pink: #f472b6;
  --pink-dim: rgba(244, 114, 182, 0.18);
  --amber: #fbbf24;
  --amber-dim: rgba(251, 191, 36, 0.18);
  --red: #f87171;
  --red-dim: rgba(248, 113, 113, 0.18);
  --text-1: #eef2ff;
  --text-2: rgba(200, 210, 240, 0.7);
  --text-3: rgba(160, 175, 220, 0.45);
  --chart-grid: rgba(255, 255, 255, 0.05);
  --panel-solid: rgba(10, 15, 35, 0.92);
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --blur: blur(24px) saturate(180%);
  --font: 'Google Sans', 'Be Vietnam Pro', 'Segoe UI', system-ui, sans-serif;
  --font-display: 'Google Sans Display', 'Google Sans', 'Be Vietnam Pro', 'Segoe UI', sans-serif;
  color-scheme: dark;
}
html.light {
  --bg-deep: #c8dcff;
  --glass-1: rgba(255, 255, 255, 0.18);
  --glass-2: rgba(255, 255, 255, 0.28);
  --glass-3: rgba(255, 255, 255, 0.4);
  --border-1: rgba(255, 255, 255, 0.6);
  --border-2: rgba(255, 255, 255, 0.85);
  --cyan: #007aff;
  --cyan-dim: rgba(0, 122, 255, 0.14);
  --violet: #8b5cf6;
  --violet-dim: rgba(139, 92, 246, 0.14);
  --teal: #00a89f;
  --teal-dim: rgba(0, 199, 190, 0.14);
  --pink: #e91e8c;
  --pink-dim: rgba(233, 30, 140, 0.14);
  --amber: #d97706;
  --amber-dim: rgba(245, 158, 11, 0.14);
  --red: #ff3b30;
  --red-dim: rgba(255, 59, 48, 0.14);
  --text-1: rgba(6, 10, 32, 0.9);
  --text-2: rgba(6, 10, 44, 0.62);
  --text-3: rgba(6, 10, 44, 0.48);
  --chart-grid: rgba(6, 10, 44, 0.08);
  --panel-solid: rgba(220, 236, 255, 0.92);
  --blur: blur(40px) saturate(250%);
  color-scheme: light;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { background: var(--bg-deep); -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font); background: var(--bg-deep); color: var(--text-1);
  min-height: 100dvh; overflow-x: hidden; font-size: 14px; line-height: 1.45;
  -webkit-tap-highlight-color: transparent;
}
body.no-scroll { overflow: hidden; }
body::before {
  content: ''; position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(ellipse 55% 45% at 15% 15%, rgba(0, 212, 255, 0.08) 0%, transparent 65%),
    radial-gradient(ellipse 50% 55% at 85% 85%, rgba(167, 139, 250, 0.1) 0%, transparent 65%),
    radial-gradient(ellipse 35% 35% at 65% 8%, rgba(244, 114, 182, 0.06) 0%, transparent 60%),
    radial-gradient(ellipse 60% 40% at 40% 95%, rgba(45, 212, 191, 0.05) 0%, transparent 60%);
}
html.light body::before {
  background:
    radial-gradient(ellipse 75% 65% at 5% 8%, rgba(80, 150, 255, 0.9) 0%, transparent 52%),
    radial-gradient(ellipse 65% 55% at 96% 94%, rgba(170, 130, 255, 0.85) 0%, transparent 52%),
    radial-gradient(ellipse 50% 45% at 82% 6%, rgba(255, 150, 200, 0.65) 0%, transparent 48%),
    radial-gradient(ellipse 55% 50% at 18% 92%, rgba(80, 220, 200, 0.6) 0%, transparent 48%),
    radial-gradient(ellipse 70% 70% at 50% 48%, rgba(130, 170, 255, 0.45) 0%, transparent 65%);
}
button, input, select { font: inherit; color: inherit; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; border-radius: 6px; }
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-thumb { background: rgba(0, 212, 255, 0.2); border-radius: 4px; }
*, *::before, *::after { transition-property: background-color, border-color, color, box-shadow; transition-duration: 0.25s; transition-timing-function: ease; }

.mat {
  font-family: 'Material Symbols Outlined'; font-variation-settings: 'FILL' 0, 'wght' 400; font-style: normal;
  font-size: 20px; line-height: 1; vertical-align: middle; display: inline-block; letter-spacing: normal; text-transform: none; white-space: nowrap;
  width: 1em; height: 1em; overflow: hidden; flex: none; /* nếu font icon chưa tải xong thì không vỡ bố cục */
}
html:not(.icons) .mat { visibility: hidden; }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.pos { color: var(--teal); }
.neg { color: var(--pink); }
.muted { color: var(--text-3); }
.small, small { font-size: 0.82em; }
.empty { padding: 48px 16px; text-align: center; color: var(--text-3); font-style: italic; }
.sec-title { font-family: var(--font-display); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-1); }
.kpi-label { font-size: 9.5px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.09em; color: var(--text-3); }
.kpi-num { font-family: var(--font-display); font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.sub-note { font-size: 9.5px; color: var(--text-3); margin-top: 5px; }
.grad-text { background: linear-gradient(135deg, var(--cyan), var(--violet)); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.sep { height: 1px; background: var(--border-1); margin: 6px 0; }

/* ─── Card kính ──────────────────────────────────────────────────────────── */
.card {
  background: var(--glass-1); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
  border: 1px solid var(--border-1); border-radius: var(--radius-md); position: relative; overflow: hidden;
  padding: 16px 18px; min-width: 0;
  transition: transform 0.45s cubic-bezier(0.23, 1, 0.32, 1), filter 0.45s cubic-bezier(0.23, 1, 0.32, 1), box-shadow 0.45s cubic-bezier(0.23, 1, 0.32, 1), border-color 0.25s ease !important;
}
.card::before { content: ''; position: absolute; inset: 0; border-radius: inherit; background: linear-gradient(135deg, rgba(255, 255, 255, 0.07) 0%, transparent 52%); pointer-events: none; z-index: 0; }
.card > * { position: relative; z-index: 1; }
.card-shine { position: absolute !important; inset: 0; border-radius: inherit; pointer-events: none; z-index: 2 !important; opacity: 0; transition: opacity 0.35s ease; }
.card.flush { padding: 0; }
@media (hover: hover) and (pointer: fine) {
  .card.lift:hover {
    transform: scale(1.03); filter: brightness(1.1); border-color: rgba(255, 255, 255, 0.22);
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.4), 0 4px 16px rgba(0, 0, 0, 0.25), 0 0 0 1px rgba(255, 255, 255, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.15);
  }
  .card:hover .card-shine { opacity: 1; }
}
.card.is-pressed { transform: scale(0.966) translateY(2px); transition: transform 0.12s cubic-bezier(0.34, 1.56, 0.64, 1) !important; }
.card.is-releasing { transform: scale(1.02) translateY(-2px); transition: transform 0.18s cubic-bezier(0.34, 1.56, 0.64, 1) !important; }
.card-ripple {
  position: absolute !important; border-radius: 50%; pointer-events: none; z-index: 3 !important; transform: scale(0);
  background: radial-gradient(circle, rgba(255, 255, 255, 0.18) 0%, transparent 68%); animation: ripple-out 0.55s cubic-bezier(0.23, 1, 0.32, 1) forwards;
}
@keyframes ripple-out { to { transform: scale(3.5); opacity: 0; } }
html.light .card {
  background: rgba(255, 255, 255, 0.2); border: 1px solid rgba(255, 255, 255, 0.62);
  box-shadow: inset 0 1.5px 0 rgba(255, 255, 255, 0.85), 0 2px 8px rgba(60, 90, 200, 0.12), 0 8px 28px rgba(40, 70, 180, 0.14);
}
html.light .card::before { background: linear-gradient(142deg, rgba(255, 255, 255, 0.55) 0%, rgba(255, 255, 255, 0.2) 22%, rgba(255, 255, 255, 0.04) 45%, transparent 60%); }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.card-bar { padding: 11px 16px; border-bottom: 1px solid var(--border-1); background: rgba(0, 212, 255, 0.04); display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.icon-chip { width: 28px; height: 28px; border-radius: 7px; display: flex; align-items: center; justify-content: center; flex: none; }
.icon-chip .mat { font-size: 15px; }
.icon-chip.lg { width: 38px; height: 38px; border-radius: 10px; }
.icon-chip.lg .mat { font-size: 20px; }

/* ─── Badge, thanh tiến độ ──────────────────────────────────────────────── */
.badge { display: inline-flex; align-items: center; gap: 3px; padding: 2px 10px; border-radius: 99px; font-size: 10px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; white-space: nowrap; }
.bg { background: var(--teal-dim); color: var(--teal); border: 1px solid rgba(45, 212, 191, 0.3); }
.br { background: var(--red-dim); color: var(--red); border: 1px solid rgba(248, 113, 113, 0.3); }
.bb { background: var(--cyan-dim); color: var(--cyan); border: 1px solid rgba(0, 212, 255, 0.3); }
.bw { background: var(--violet-dim); color: var(--violet); border: 1px solid rgba(167, 139, 250, 0.3); }
.bm { background: var(--glass-2); color: var(--text-2); border: 1px solid var(--border-1); }
.by { background: var(--amber-dim); color: var(--amber); border: 1px solid rgba(251, 191, 36, 0.3); }
.cf, .cv { font-size: 9px; font-weight: 700; padding: 2px 9px; border-radius: 99px; text-transform: uppercase; margin-right: 7px; }
.cf { background: rgba(0, 212, 255, 0.1); color: var(--cyan); border: 1px solid rgba(0, 212, 255, 0.22); }
.cv { background: rgba(167, 139, 250, 0.1); color: var(--violet); border: 1px solid rgba(167, 139, 250, 0.22); }
.rr { font-size: 8px; color: var(--violet); margin-left: 5px; opacity: 0.8; font-weight: 700; }
.pbar { height: 4px; background: rgba(255, 255, 255, 0.07); border-radius: 99px; overflow: hidden; margin-top: 10px; }
html.light .pbar { background: rgba(0, 0, 0, 0.07); }
.pbf { height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--cyan), var(--violet)); transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1); }

/* ─── Nút & input ───────────────────────────────────────────────────────── */
.btn-primary {
  padding: 10px 22px; background: linear-gradient(135deg, rgba(0, 212, 255, 0.75), rgba(167, 139, 250, 0.65)); color: #fff; border: none;
  border-radius: var(--radius-sm); font-weight: 600; cursor: pointer; box-shadow: 0 0 24px rgba(0, 212, 255, 0.2);
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.btn-primary:hover { box-shadow: 0 4px 28px rgba(0, 212, 255, 0.3); }
html.light .btn-primary { background: linear-gradient(135deg, rgba(0, 122, 255, 0.88), rgba(139, 92, 246, 0.78)); }
.btn-primary:disabled { opacity: 0.6; cursor: progress; }
.btn-ghost { padding: 10px 18px; background: var(--glass-2); color: var(--text-2); border: 1px solid var(--border-1); border-radius: var(--radius-sm); font-weight: 500; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.btn-ghost:hover { color: var(--text-1); border-color: var(--border-2); }
.link-btn { background: none; border: 0; color: var(--cyan); cursor: pointer; padding: 6px 0; font-weight: 600; font-size: 12px; display: inline-flex; align-items: center; gap: 4px; }
.link-btn.danger { color: var(--red); }
.link-btn.amber { color: var(--amber); }
.icon-btn {
  background: var(--glass-2); border: 1px solid var(--border-1); color: var(--text-2); width: 30px; height: 30px; border-radius: 50%;
  cursor: pointer; display: inline-flex; align-items: center; justify-content: center; flex: none;
}
.icon-btn .mat { font-size: 16px; }
.icon-btn:hover { background: var(--glass-3); color: var(--text-1); }
.icon-btn.bare { background: none; border-color: transparent; width: 36px; height: 36px; border-radius: 8px; color: var(--text-3); }
.icon-btn.bare .mat { font-size: 20px; }
.finput {
  width: 100%; background: rgba(255, 255, 255, 0.05); border: 1px solid var(--border-1); color: var(--text-1);
  font-size: 13px; padding: 9px 13px; border-radius: var(--radius-sm); outline: none; min-height: 40px;
}
.finput:focus { border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.1); }
.finput option { background: #0c1228; color: #eef2ff; }
html.light .finput { background: rgba(255, 255, 255, 0.4); border-color: rgba(255, 255, 255, 0.65); }
html.light .finput option { background: #daeaff; color: rgba(6, 10, 32, 0.9); }
.field { display: flex; flex-direction: column; gap: 5px; }
.field > span, .field-label { font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-3); }
.ftoggle { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.ftoggle input { accent-color: var(--cyan); width: 16px; height: 16px; flex: none; }
.ftoggle p:first-child { font-size: 12.5px; font-weight: 600; color: var(--text-1); }
.ftoggle p + p { font-size: 10.5px; color: var(--text-2); margin-top: 2px; }
.form-error { color: var(--pink); white-space: pre-line; min-height: 16px; font-size: 11.5px; text-align: center; }

/* ─── Watermark, loading ────────────────────────────────────────────────── */
.wm { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; opacity: 0.018; }
html.light .wm { opacity: 0.012; }
.wm > div { display: flex; flex-direction: column; gap: 44px; transform: rotate(-10deg) translate(-5%, -5%); }
.wt { display: flex; white-space: nowrap; font-family: var(--font-display); font-size: 2.8rem; font-weight: 700; letter-spacing: 0.6rem; color: var(--cyan); animation: wm 30s linear infinite; }
.wt:nth-child(even) { animation-direction: reverse; }
@keyframes wm { to { transform: translateX(-50%); } }
.wm.paused .wt { animation-play-state: paused; }
.wm.off { display: none; }
@keyframes sp { to { transform: rotate(360deg); } }
.spn { width: 22px; height: 22px; border: 2px solid rgba(0, 212, 255, 0.12); border-top-color: var(--cyan); border-radius: 50%; animation: sp 0.75s linear infinite; }

/* ─── Đăng nhập ─────────────────────────────────────────────────────────── */
.login { min-height: 100dvh; display: grid; place-items: center; padding: 24px; position: relative; z-index: 1; }
.login-card { width: min(390px, 100%); display: grid; gap: 14px; padding: 28px; }
.brand { font-family: var(--font-display); font-weight: 700; font-size: 14px; letter-spacing: 0.02em; display: flex; align-items: center; gap: 9px; }
.brand b { color: var(--cyan); font-weight: 700; }
.brand-logo { width: 28px; height: 28px; border-radius: 8px; background: linear-gradient(135deg, rgba(0, 212, 255, 0.3), rgba(167, 139, 250, 0.3)); border: 1px solid rgba(0, 212, 255, 0.2); display: flex; align-items: center; justify-content: center; }
.brand-logo .mat { font-size: 15px; color: var(--cyan); }
.login-card .brand { font-size: 20px; }

/* ─── Khung: sidebar (desktop) / header + bottom nav (mobile) ───────────── */
.shell { position: relative; z-index: 10; min-height: 100dvh; }
.sidebar { display: none; }
.main { min-width: 0; }
.mhead {
  position: sticky; top: 0; z-index: 30; padding: 12px 14px; display: flex; flex-direction: column; gap: 10px;
  background: rgba(5, 9, 20, 0.65); backdrop-filter: blur(24px) saturate(180%); -webkit-backdrop-filter: blur(24px) saturate(180%); border-bottom: 1px solid var(--border-1);
}
html.light .mhead { background: rgba(210, 228, 252, 0.68); border-bottom-color: rgba(255, 255, 255, 0.65); }
.mhead-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.mhead-actions { display: flex; align-items: center; }
.period { display: flex; align-items: center; gap: 6px; flex: 1; }
.period-label { flex: 1; text-align: center; font-weight: 600; font-size: 13px; padding: 8px; border-radius: var(--radius-sm); background: rgba(255, 255, 255, 0.05); border: 1px solid var(--border-1); }
.btn-new {
  background: linear-gradient(135deg, rgba(0, 212, 255, 0.18), rgba(167, 139, 250, 0.14)); color: var(--cyan); border: 1px solid rgba(0, 212, 255, 0.25);
  border-radius: var(--radius-sm); padding: 9px 14px; display: flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; cursor: pointer; white-space: nowrap;
}
.sync-line { display: flex; justify-content: space-between; align-items: center; font-size: 10px; color: var(--text-3); }
.dhead { display: none; }
.content { padding: 12px 12px 96px; max-width: 1640px; margin: 0 auto; display: flex; flex-direction: column; gap: 12px; }

.bottom-nav {
  position: fixed; inset: auto 0 0 0; z-index: 100; display: flex; justify-content: space-around; padding-bottom: env(safe-area-inset-bottom);
  background: rgba(5, 9, 20, 0.6); backdrop-filter: blur(32px) saturate(200%); -webkit-backdrop-filter: blur(32px) saturate(200%);
  border-top: 1px solid rgba(255, 255, 255, 0.09); box-shadow: 0 -1px 0 rgba(0, 212, 255, 0.08), 0 -12px 32px rgba(0, 0, 0, 0.4);
}
html.light .bottom-nav { background: rgba(210, 228, 252, 0.72); border-top-color: rgba(255, 255, 255, 0.65); box-shadow: none; }
.bn-item { flex: 1; display: flex; flex-direction: column; align-items: center; padding: 10px 0 9px; color: var(--text-3); font-size: 10px; font-weight: 500; text-decoration: none; position: relative; }
.bn-item .mat { font-size: 22px; margin-bottom: 3px; }
.bn-item[aria-current] { color: var(--cyan); }
.bn-item[aria-current]::after { content: ''; position: absolute; top: 0; left: 50%; transform: translateX(-50%); width: 28px; height: 2px; border-radius: 0 0 4px 4px; background: var(--cyan); box-shadow: 0 0 10px rgba(0, 212, 255, 0.6); }

.nl {
  display: flex; align-items: center; gap: 9px; width: 100%; padding: 10px 13px; border-radius: var(--radius-sm); font-size: 12.5px; font-weight: 500;
  color: var(--text-2); background: none; border: 1px solid transparent; cursor: pointer; text-align: left; text-decoration: none;
}
.nl .mat { font-size: 19px; }
.nl:hover { background: var(--glass-2); color: var(--text-1); border-color: var(--border-1); }
.nl[aria-current] { background: linear-gradient(135deg, rgba(0, 212, 255, 0.14), rgba(167, 139, 250, 0.11)); color: var(--cyan); border-color: rgba(0, 212, 255, 0.22); box-shadow: 0 0 18px rgba(0, 212, 255, 0.08); }
.nl.accent { background: linear-gradient(135deg, rgba(0, 212, 255, 0.14), rgba(167, 139, 250, 0.1)); color: var(--cyan); border-color: rgba(0, 212, 255, 0.2); box-shadow: 0 0 18px rgba(0, 212, 255, 0.08); }
.nav-cap { font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-3); padding: 4px 4px 6px; }

@media (min-width: 900px) {
  .shell { display: grid; grid-template-columns: 224px 1fr; }
  .sidebar {
    display: flex; flex-direction: column; position: sticky; top: 0; height: 100dvh; overflow-y: auto; z-index: 40;
    background: rgba(5, 9, 20, 0.75); backdrop-filter: blur(32px) saturate(180%); -webkit-backdrop-filter: blur(32px) saturate(180%); border-right: 1px solid var(--border-1);
  }
  html.light .sidebar { background: rgba(255, 255, 255, 0.2); border-right-color: rgba(255, 255, 255, 0.6); }
  .side-top { padding: 18px 18px 14px; border-bottom: 1px solid var(--border-1); }
  .side-date { font-size: 10.5px; color: var(--text-3); margin-top: 6px; }
  .side-period { padding: 12px 14px 6px; }
  .side-period .period { margin-top: 6px; }
  .side-meta { padding: 6px 14px 10px; display: flex; flex-direction: column; gap: 5px; }
  .side-meta div { display: flex; justify-content: space-between; align-items: center; font-size: 10.5px; color: var(--text-3); }
  .side-nav { padding: 8px 10px; display: flex; flex-direction: column; gap: 3px; }
  .side-bottom { margin-top: auto; border-top: 1px solid var(--border-1); padding: 10px; display: flex; flex-direction: column; gap: 3px; }
  .mhead, .bottom-nav { display: none; }
  .dhead {
    display: flex; position: sticky; top: 0; z-index: 30; height: 52px; padding: 0 24px; align-items: center; justify-content: space-between;
    background: rgba(5, 9, 20, 0.65); backdrop-filter: blur(24px) saturate(180%); -webkit-backdrop-filter: blur(24px) saturate(180%); border-bottom: 1px solid var(--border-1);
  }
  html.light .dhead { background: rgba(200, 220, 255, 0.38); border-bottom-color: rgba(255, 255, 255, 0.6); }
  .dhead-title { display: flex; align-items: center; gap: 13px; font-family: var(--font-display); font-weight: 600; font-size: 14px; }
  .dhead-title i { height: 14px; width: 1px; background: var(--border-1); }
  .content { padding: 20px 22px 32px; }
}

/* ─── Lưới dashboard ────────────────────────────────────────────────────── */
.g { display: grid; gap: 12px; }
.g-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-2, .g-side, .g-3-2, .g-2-1 { grid-template-columns: minmax(0, 1fr); }
@media (min-width: 760px) {
  .g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g-2-1 { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
  .g-3-2 { grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); }
}
@media (min-width: 1100px) {
  .g-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .g-side { grid-template-columns: 240px minmax(0, 1fr); }
}
.kpi-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; gap: 8px; }
.kpi-card .kpi-num { font-size: 18px; }
@media (max-width: 560px) { .kpi-card .kpi-num { font-size: 15px; } .kpi-card { padding: 13px; } }
.pair { display: flex; align-items: center; }
.pair-item { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; }
.pair-div { width: 1px; height: 38px; background: var(--border-1); margin: 0 14px; flex: none; }
.pair .kpi-num { font-size: 16px; margin-top: 2px; }
@media (max-width: 560px) { .pair { flex-direction: column; align-items: stretch; gap: 12px; } .pair-div { width: auto; height: 1px; margin: 0; } }

.cov-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 14px; }
.cov-grid p:last-child { font-size: 18px; font-weight: 700; font-family: var(--font-display); }
@media (max-width: 560px) { .cov-grid p:last-child { font-size: 14px; } }
.cov-track { position: relative; height: 10px; background: rgba(255, 255, 255, 0.07); border-radius: 99px; overflow: hidden; margin-bottom: 7px; }
.cov-track i { position: absolute; left: 0; top: 0; height: 100%; border-radius: 99px; }
.cov-track b { position: absolute; top: 0; width: 2px; height: 100%; background: var(--cyan); }
.cov-scale { display: flex; justify-content: space-between; font-size: 8.5px; color: var(--text-3); }

.wlist { display: flex; flex-direction: column; gap: 8px; }
.wrow { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 11.5px; }
.wrow > div { display: flex; align-items: center; gap: 8px; min-width: 0; color: var(--text-2); font-weight: 500; }
.wrow i { width: 3px; height: 24px; border-radius: 2px; flex: none; }
.wrow .num { font-weight: 700; }
.pane { border-radius: 10px; padding: 10px 12px; }
.pane.over { background: rgba(244, 114, 182, 0.05); border: 1px solid rgba(244, 114, 182, 0.12); }
.pane.under { background: rgba(45, 212, 191, 0.05); border: 1px solid rgba(45, 212, 191, 0.12); }
.pane-title { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; font-size: 9.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.07em; }
.pane-title::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.chart-sm { height: 160px; }
.chart-md { height: 220px; }
.chart-lg { height: 320px; }
.burn-big { font-size: 32px; margin: 6px 0 4px; }

/* Heatmap lịch */
.cal-head, .cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal-head { margin-bottom: 7px; }
.cal-head span { text-align: center; font-size: 8.5px; font-weight: 700; color: var(--text-3); }
.cal-head span:last-child { color: var(--violet); }
.cal-cell { border-radius: 8px; position: relative; aspect-ratio: 1; min-height: 34px; border: 1px solid rgba(255, 255, 255, 0.04); cursor: default; }
.cal-cell b { position: absolute; top: 5px; left: 6px; font-size: 9px; font-weight: 600; line-height: 1; }
.cal-cell small { position: absolute; bottom: 5px; right: 5px; font-size: 8px; line-height: 1; white-space: nowrap; color: rgba(255, 255, 255, 0.65); }
.cal-cell .hol { position: absolute; top: 5px; right: 5px; width: 6px; height: 6px; border-radius: 50%; background: var(--amber); box-shadow: 0 0 5px rgba(251, 191, 36, 0.7); }
.cal-cell.future { opacity: 0.4; }
html.light .cal-cell { border-color: rgba(255, 255, 255, 0.55); background-color: rgba(255, 255, 255, 0.12); }
.hm-tip {
  display: none; position: absolute; bottom: 120%; left: 50%; transform: translateX(-50%); z-index: 20; pointer-events: none; white-space: nowrap;
  background: rgba(10, 15, 35, 0.97); border: 1px solid rgba(0, 212, 255, 0.2); border-radius: 8px; padding: 6px 10px; font-size: 10px; color: #eef2ff; box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}
.cal-cell:hover .hm-tip, .cal-cell:active .hm-tip { display: block; }
.cal-legend { display: flex; gap: 4px; align-items: center; font-size: 9px; color: var(--text-3); flex-wrap: wrap; }
.cal-legend i { width: 11px; height: 11px; border-radius: 3px; display: inline-block; }
@media (max-width: 560px) { .cal-head, .cal-grid { gap: 4px; } .cal-cell { min-height: 30px; } .cal-cell b { top: 4px; left: 5px; } .cal-cell small { font-size: 7px; bottom: 3px; right: 3px; } }

/* Bảng */
.table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.dt { width: 100%; font-size: 11.5px; border-collapse: collapse; min-width: 460px; }
.dt th { background: rgba(0, 212, 255, 0.04); color: var(--text-3); font-size: 9.5px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; padding: 9px 14px; text-align: left; white-space: nowrap; border-bottom: 1px solid rgba(255, 255, 255, 0.06); }
.dt td { padding: 8px 14px; border-top: 1px solid rgba(255, 255, 255, 0.04); white-space: nowrap; }
.dt .r { text-align: right; }
.dt tbody tr:hover { background: rgba(0, 212, 255, 0.035); }
.dt tfoot td { background: rgba(0, 212, 255, 0.04); font-weight: 700; font-size: 10.5px; }
.dt tr.over td { background: rgba(244, 114, 182, 0.05); }
html.light .dt th { color: var(--text-3); border-bottom-color: rgba(255, 255, 255, 0.4); }
html.light .dt td { border-top-color: rgba(255, 255, 255, 0.28); color: var(--text-2); }

.alert-row { display: flex; align-items: center; justify-content: space-between; padding: 7px 9px; border-radius: 8px; background: rgba(244, 114, 182, 0.07); border: 1px solid rgba(244, 114, 182, 0.12); }
.alert-row > div { display: flex; align-items: center; gap: 8px; }
.alert-row i { width: 2px; height: 24px; border-radius: 2px; background: var(--pink); }

/* ─── Modal nhập giao dịch (desktop: giữa màn hình, mobile: bottom sheet) ── */
#sheet-root { position: fixed; inset: 0; z-index: 200; }
.modal-bg { position: absolute; inset: 0; background: rgba(5, 9, 20, 0.72); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); display: flex; align-items: flex-end; justify-content: center; }
html.light .modal-bg { background: rgba(140, 175, 235, 0.4); }
.modal {
  background: var(--panel-solid); backdrop-filter: blur(40px) saturate(200%); -webkit-backdrop-filter: blur(40px) saturate(200%);
  border: 1px solid var(--border-2); border-radius: 22px 22px 0 0; width: 100%; max-height: 93dvh; overflow-y: auto; padding: 22px 18px 32px;
  box-shadow: 0 0 80px rgba(0, 212, 255, 0.07), 0 0 160px rgba(167, 139, 250, 0.05), 0 24px 64px rgba(0, 0, 0, 0.5); animation: slideUp 0.28s ease;
}
.modal::before { content: ''; display: block; width: 38px; height: 4px; border-radius: 99px; background: rgba(255, 255, 255, 0.18); margin: -8px auto 16px; }
@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } }
@media (min-width: 900px) {
  .modal-bg { align-items: center; }
  .modal { width: 600px; max-width: 96vw; max-height: 92dvh; border-radius: var(--radius-lg); padding: 28px; }
  .modal::before { display: none; }
}
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; }
.modal-head h2 { font-family: var(--font-display); font-size: 17px; font-weight: 700; color: var(--cyan); }
.modal-head p { font-size: 11px; color: var(--text-3); margin-top: 2px; }
.modal-body { display: flex; flex-direction: column; gap: 14px; }
.modal-foot { display: flex; gap: 10px; justify-content: flex-end; margin-top: 8px; }
@media (max-width: 899px) { .modal-foot .btn-ghost { flex: 1; justify-content: center; } .modal-foot .btn-primary { flex: 2; } }

.box { padding: 13px 14px; border-radius: 10px; }
.box.cyan { background: rgba(0, 212, 255, 0.05); border: 1px solid rgba(0, 212, 255, 0.18); }
.box.violet { background: rgba(167, 139, 250, 0.06); border: 1px solid rgba(167, 139, 250, 0.2); }
.box.teal { background: rgba(45, 212, 191, 0.05); border: 1px solid rgba(45, 212, 191, 0.15); }
.box-title { font-size: 9.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-3); margin-bottom: 10px; display: flex; justify-content: space-between; align-items: center; }
.box-title.violet { color: var(--violet); }
.box-title.amber { color: var(--amber); }
.quick-row, .tpl-row { display: flex; gap: 8px; }
.tpl-row .finput { flex: 1; }
.quick-errors { color: var(--pink); padding-left: 18px; font-size: 11.5px; margin-top: 8px; }
.qp-list { list-style: none; margin: 10px 0; display: flex; flex-direction: column; gap: 6px; }
.qp-list li { display: flex; justify-content: space-between; gap: 10px; font-size: 12px; padding: 6px 9px; border-radius: 8px; background: rgba(255, 255, 255, 0.04); }
.qp-list li.debt { color: var(--text-2); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.line { background: rgba(255, 255, 255, 0.04); border: 1px solid rgba(255, 255, 255, 0.08); border-radius: 10px; padding: 12px; display: flex; flex-direction: column; gap: 8px; position: relative; }
html.light .line { background: rgba(255, 255, 255, 0.3); border-color: rgba(255, 255, 255, 0.6); }
.line-top { display: flex; gap: 8px; align-items: center; }
.line-top .amount { flex: 1; font-size: 18px; font-weight: 700; color: var(--cyan); font-variant-numeric: tabular-nums; }
.line-top select { width: 128px; flex: none; }
.line-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.line-grid .note { grid-column: 1 / -1; }
.hint { font-size: 10px; font-weight: 600; min-height: 14px; }
.person { display: grid; grid-template-columns: 1.1fr 1fr 1.2fr auto; gap: 8px; align-items: center; }
@media (max-width: 560px) { .person { grid-template-columns: 1fr 1fr auto; } .person .note { grid-column: 1 / 3; grid-row: 2; } }
.other-line { display: flex; justify-content: space-between; align-items: baseline; padding: 10px 0 4px; border-top: 1px dashed var(--border-2); font-size: 12px; color: var(--text-2); }
.other-line strong { font-size: 14px; }

/* ─── Lookup & Analysis ─────────────────────────────────────────────────── */
.seg { display: flex; gap: 8px; }
.seg button { flex: 1; padding: 9px; border-radius: var(--radius-sm); font-size: 11.5px; font-weight: 600; cursor: pointer; border: 1px solid var(--border-1); background: var(--glass-1); color: var(--text-3); }
.seg button[aria-selected='true'] { border-color: rgba(167, 139, 250, 0.32); background: rgba(167, 139, 250, 0.16); color: var(--violet); }
.hist-form { display: flex; gap: 8px; margin-top: 12px; }
.hist-form:empty { display: none; }
#hist-list { display: flex; flex-direction: column; gap: 14px; }
.entry header { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 11px; flex-wrap: wrap; }
.entry header > div { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; font-size: 10.5px; }
.gid { font-size: 9px; color: var(--text-3); font-family: ui-monospace, monospace; background: rgba(255, 255, 255, 0.05); padding: 2px 8px; border-radius: 4px; user-select: all; }
.type-pill { font-size: 8.5px; font-weight: 700; padding: 2px 6px; border-radius: 99px; }
.del-btn { background: rgba(248, 113, 113, 0.09); border: 1px solid rgba(248, 113, 113, 0.22); color: var(--red); width: 26px; height: 26px; border-radius: 5px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.del-btn .mat { font-size: 14px; }

.chat-log { display: flex; flex-direction: column; gap: 10px; max-height: calc(100dvh - 330px); min-height: 240px; overflow-y: auto; padding: 4px 2px; }
.bubble { max-width: min(680px, 88%); padding: 10px 14px; border-radius: 14px; line-height: 1.55; font-size: 13px; }
.bubble.me { align-self: flex-end; background: linear-gradient(135deg, rgba(0, 212, 255, 0.75), rgba(167, 139, 250, 0.65)); color: #fff; border-bottom-right-radius: 4px; }
.bubble.ai { align-self: flex-start; background: var(--glass-2); border: 1px solid var(--border-1); border-bottom-left-radius: 4px; }
.bubble.typing { color: var(--text-3); display: flex; gap: 8px; align-items: center; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.chip { border: 1px solid rgba(251, 191, 36, 0.25); background: rgba(251, 191, 36, 0.07); color: var(--text-1); border-radius: 99px; padding: 8px 14px; cursor: pointer; font-size: 12px; text-align: left; }
.chat-form { display: flex; gap: 8px; align-items: center; margin-top: 12px; }

/* ─── Toast ─────────────────────────────────────────────────────────────── */
#toast {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(84px + env(safe-area-inset-bottom)); z-index: 300; max-width: min(92vw, 520px);
  background: var(--panel-solid); color: var(--teal); border: 1px solid rgba(45, 212, 191, 0.3); padding: 10px 16px; border-radius: var(--radius-sm);
  font-size: 12.5px; font-weight: 600; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4); backdrop-filter: blur(20px);
}
#toast[data-kind='error'] { color: var(--pink); border-color: rgba(244, 114, 182, 0.35); }
@media (min-width: 900px) { #toast { bottom: 28px; } }

footer.app-foot { border-top: 1px solid var(--border-1); padding: 13px 24px; display: none; justify-content: space-between; font-size: 10.5px; color: var(--text-3); }
@media (min-width: 900px) { footer.app-foot { display: flex; } }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
