/* TLG Finance – giao diện */
:root {
  color-scheme: light;
  --bg: #f4f3ef;
  --surface: #ffffff;
  --surface-2: #f8f7f4;
  --surface-3: #eeede8;
  --border: #e2e0d9;
  --text: #1b1b19;
  --text-2: #55534e;
  --text-3: #85837c;
  --brand: #2f4a66;
  --brand-2: #3f6189;
  --brand-ink: #ffffff;
  --accent: #eb6834;
  --income: #2a78d6;
  --expense: #eb6834;
  --good: #0f8a0f;
  --bad: #c23434;
  --warn: #b87a00;
  --good-bg: #e7f4e7;
  --bad-bg: #fbeaea;
  --warn-bg: #fdf4e0;
  --info-bg: #e8f0fb;
  --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --s4: #eda100;
  --s5: #e87ba4; --s6: #008300; --s7: #6250d6; --s8: #e34948;
  --grid: #ebe9e3;
  --shadow: 0 1px 2px rgba(0,0,0,.05), 0 4px 16px rgba(0,0,0,.05);
  --radius: 14px;
  --radius-sm: 9px;
  --nav-h: 64px;
  --font: "Be Vietnam Pro", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #121211; --surface: #1c1c1b; --surface-2: #232321; --surface-3: #2c2c2a;
    --border: #353532; --text: #f0efec; --text-2: #c3c2b7; --text-3: #8f8e86;
    --brand: #8fb1d8; --brand-2: #a9c4e4; --brand-ink: #10202f; --accent: #ef7a4a;
    --income: #3987e5; --expense: #d95926;
    --good: #3cc23c; --bad: #ff7b7b; --warn: #f0b429;
    --good-bg: #183018; --bad-bg: #3a1c1c; --warn-bg: #3a2f14; --info-bg: #1a2a40;
    --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500;
    --s5: #d55181; --s6: #008300; --s7: #9085e9; --s8: #e66767;
    --grid: #2c2c2a;
    --shadow: 0 1px 2px rgba(0,0,0,.4);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #121211; --surface: #1c1c1b; --surface-2: #232321; --surface-3: #2c2c2a;
  --border: #353532; --text: #f0efec; --text-2: #c3c2b7; --text-3: #8f8e86;
  --brand: #8fb1d8; --brand-2: #a9c4e4; --brand-ink: #10202f; --accent: #ef7a4a;
  --income: #3987e5; --expense: #d95926;
  --good: #3cc23c; --bad: #ff7b7b; --warn: #f0b429;
  --good-bg: #183018; --bad-bg: #3a1c1c; --warn-bg: #3a2f14; --info-bg: #1a2a40;
  --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500;
  --s5: #d55181; --s6: #008300; --s7: #9085e9; --s8: #e66767;
  --grid: #2c2c2a;
  --shadow: 0 1px 2px rgba(0,0,0,.4);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg); color: var(--text); font-family: var(--font);
  font-size: 15px; line-height: 1.45; -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--brand-2); }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; }
h1 { font-size: 22px; font-weight: 700; }
h2 { font-size: 17px; font-weight: 700; }
h3 { font-size: 15px; font-weight: 650; }
.num, .amt { font-variant-numeric: tabular-nums; }
.amt { white-space: nowrap; }
.muted { color: var(--text-2); }
.faint { color: var(--text-3); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }
.good { color: var(--good); }
.bad { color: var(--bad); }
.inc { color: var(--income); }
.exp { color: var(--expense); }
.right { text-align: right; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.hidden { display: none !important; }
.row { display: flex; align-items: center; gap: 8px; }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.grow { flex: 1 1 auto; min-width: 0; }
.stack > * + * { margin-top: 12px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- Khung ứng dụng ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: 236px; flex: 0 0 236px; background: var(--surface); border-right: 1px solid var(--border);
  position: sticky; top: 0; height: 100vh; overflow-y: auto; padding: 18px 12px; display: none;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; }
.brand-logo {
  width: 38px; height: 38px; border-radius: 11px; background: var(--brand); color: var(--brand-ink);
  display: grid; place-items: center; font-weight: 800; font-size: 13px; letter-spacing: .5px;
}
.brand-name { font-weight: 750; font-size: 15px; }
.brand-sub { font-size: 12px; color: var(--text-3); }
.nav a {
  display: flex; align-items: center; gap: 11px; padding: 9px 11px; border-radius: 10px; color: var(--text-2);
  text-decoration: none; font-weight: 550; margin-bottom: 2px;
}
.nav a:hover { background: var(--surface-2); }
.nav a.active { background: var(--brand); color: var(--brand-ink); }
.nav .ico { width: 22px; text-align: center; font-size: 17px; }
.nav-sep { height: 1px; background: var(--border); margin: 10px 6px; }
.sidebar .add-btn { width: 100%; margin: 0 0 14px; }

.main { flex: 1 1 auto; min-width: 0; padding: 14px 16px calc(var(--nav-h) + 28px); }
.page { max-width: 1440px; margin: 0 auto; }
.topbar { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; min-height: 40px; }
.topbar h1 { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 520px) { .topbar { flex-wrap: wrap; } .topbar h1 { flex: 1 1 calc(100% - 30px); } }
.sync-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--text-3); display: inline-block; }
.sync-dot.ok { background: var(--good); }
.sync-dot.busy { background: var(--warn); }
.sync-dot.err { background: var(--bad); }

.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; height: calc(var(--nav-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--surface); border-top: 1px solid var(--border); display: flex; z-index: 40;
}
.bottom-nav a, .bottom-nav button {
  flex: 1 1 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  font-size: 11px; color: var(--text-3); text-decoration: none; background: none; border: 0; padding: 0; cursor: pointer;
}
.bottom-nav .ico { font-size: 20px; line-height: 1; }
.bottom-nav a.active { color: var(--brand-2); font-weight: 650; }
.bottom-nav .fab-slot { position: relative; }
.bottom-nav .fab, .fab {
  width: 56px; height: 56px; border-radius: 50%; background: var(--accent); color: #fff; border: 0;
  font-size: 30px; line-height: 1; box-shadow: 0 6px 18px rgba(235,104,52,.45); cursor: pointer;
  display: grid; place-items: center; margin-top: -22px;
}

@media (min-width: 900px) {
  .sidebar { display: block; }
  .bottom-nav { display: none; }
  .main { padding: 22px 28px 40px; }
  .mobile-only { display: none !important; }
}
@media (max-width: 899px) { .desktop-only { display: none !important; } }

/* ---------- Thẻ, lưới ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.card + .card { margin-top: 14px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.card-head .sub { font-size: 13px; color: var(--text-3); }
.grid { display: grid; gap: 14px; }
.grid > * { min-width: 0; }
.grid > .card + .card { margin-top: 0; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 899px) { .g3, .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g2.collapse { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 520px) { .g2.collapse-sm, .g3.collapse-sm { grid-template-columns: minmax(0, 1fr); } }
.section-gap { margin-top: 14px; }

.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 13px 14px; box-shadow: var(--shadow); min-width: 0; }
.kpi .lbl { font-size: 12.5px; color: var(--text-2); display: flex; align-items: center; gap: 6px; }
.kpi .val { font-size: 21px; font-weight: 750; margin-top: 3px; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi .meta { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.kpi.hero { background: var(--brand); color: var(--brand-ink); border-color: transparent; }
.kpi.hero .lbl, .kpi.hero .meta { color: inherit; opacity: .82; }
.dot { width: 9px; height: 9px; border-radius: 3px; display: inline-block; flex: 0 0 auto; }

.pill { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--surface-3); color: var(--text-2); white-space: nowrap; }
.pill.good { background: var(--good-bg); color: var(--good); }
.pill.bad { background: var(--bad-bg); color: var(--bad); }
.pill.warn { background: var(--warn-bg); color: var(--warn); }
.pill.info { background: var(--info-bg); color: var(--brand-2); }

/* Bảng tóm tắt kiểu Excel: TỔNG / ĐỜI SỐNG / ĐẦU TƯ */
.verdict { border-radius: var(--radius); padding: 14px; border: 1px solid var(--border); background: var(--surface); }
.verdict .title { font-size: 12px; font-weight: 700; letter-spacing: .6px; color: var(--text-3); text-transform: uppercase; }
.verdict .big { font-size: 22px; font-weight: 800; margin: 4px 0 2px; font-variant-numeric: tabular-nums; }
.verdict .msg { font-size: 13.5px; font-weight: 650; }
.verdict.ok { background: var(--good-bg); border-color: transparent; }
.verdict.ok .msg { color: var(--good); }
.verdict.no { background: var(--bad-bg); border-color: transparent; }
.verdict.no .msg { color: var(--bad); }
.verdict .line { font-size: 12.5px; color: var(--text-2); }

/* ---------- Nút, ô nhập ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 14px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--surface); cursor: pointer; font-weight: 600; font-size: 14px;
  text-decoration: none; color: var(--text); white-space: nowrap; min-height: 40px;
}
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--brand); color: var(--brand-ink); border-color: transparent; }
.btn.primary:hover { background: var(--brand-2); }
.btn.accent { background: var(--accent); color: #fff; border-color: transparent; }
.btn.danger { color: var(--bad); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.sm { padding: 5px 10px; min-height: 32px; font-size: 13px; border-radius: 8px; }
.btn.icon { width: 40px; padding: 0; }
.btn.sm.icon { width: 32px; }
.btn:disabled { opacity: .5; cursor: default; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }

label.fld { display: block; margin-bottom: 12px; }
label.fld > span { display: block; font-size: 13px; color: var(--text-2); margin-bottom: 5px; font-weight: 550; }
.inp, select.inp, textarea.inp {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface);
  min-height: 42px; outline: none;
}
.inp:focus { border-color: var(--brand-2); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-2) 22%, transparent); }
.inp.sm { min-height: 34px; padding: 6px 9px; font-size: 14px; }
.inp.num { text-align: right; font-variant-numeric: tabular-nums; }
textarea.inp { min-height: 120px; resize: vertical; }
.check { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--brand-2); }

.seg { display: inline-flex; background: var(--surface-3); border-radius: 11px; padding: 3px; gap: 2px; max-width: 100%; overflow-x: auto; }
.seg button { border: 0; background: transparent; padding: 7px 13px; border-radius: 9px; cursor: pointer; font-weight: 600; font-size: 14px; color: var(--text-2); white-space: nowrap; }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.seg.full { display: flex; width: 100%; }
@media (max-width: 520px) { .seg button { padding: 7px 10px; font-size: 13.5px; } }
.seg.full button { flex: 1 1 0; }
.seg button.on.exp { color: var(--expense); }
.seg button.on.inc { color: var(--income); }

.chips { display: flex; flex-wrap: wrap; gap: 7px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 7px 11px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface); cursor: pointer; font-size: 13.5px; font-weight: 550; white-space: nowrap; color: var(--text);
}
.chip:hover { background: var(--surface-2); }
.chip.on { background: var(--brand); color: var(--brand-ink); border-color: transparent; }
.chip .e { font-size: 15px; }

.period-nav { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.period-nav .lbl { font-weight: 700; min-width: 120px; text-align: center; }

/* ---------- Danh sách giao dịch ---------- */
.day-head { display: flex; justify-content: space-between; font-size: 13px; color: var(--text-3); padding: 12px 4px 6px; font-weight: 600; }
.tx-list { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.tx { display: flex; align-items: center; gap: 12px; padding: 11px 14px; cursor: pointer; border-top: 1px solid var(--border); }
.tx:first-child { border-top: 0; }
.tx:hover { background: var(--surface-2); }
.tx .ic { width: 38px; height: 38px; border-radius: 11px; background: var(--surface-3); display: grid; place-items: center; font-size: 18px; flex: 0 0 auto; }
.tx .t1 { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tx .t2 { font-size: 12.5px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tx .a { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tx .tx-date { flex: 0 0 44px; text-align: center; line-height: 1.2; font-variant-numeric: tabular-nums; }
.tx .tx-date b { display: block; font-size: 13.5px; font-weight: 700; }
.tx .tx-date span { display: block; font-size: 11px; color: var(--text-3); white-space: nowrap; }
.tx .tags { display: flex; gap: 4px; flex: 0 0 auto; }
.sec-head { display: flex; justify-content: space-between; gap: 12px; font-size: 14.5px; font-weight: 700; color: var(--text); padding: 16px 4px 7px; }
.sec-head:first-child { padding-top: 6px; }
.sec-head .faint { font-weight: 500; font-size: 13px; }
@media (max-width: 640px) { .tx .tags { display: none; } }
/* Nhập từ ảnh */
.drop-zone { display: block; border: 2px dashed var(--border); border-radius: var(--radius); padding: 26px 16px; text-align: center; cursor: pointer; color: var(--text-2); }
.drop-zone .big { font-size: 34px; margin-bottom: 4px; }
.drop-zone:hover, .drop-zone.over { border-color: var(--brand-2); background: var(--info-bg); }
.scan-tbl td { vertical-align: top; }
.scan-tbl .inp.sm { min-height: 32px; }
.scan-tbl tr.off td { opacity: .45; }
.scan-thumb { width: 46px; height: 70px; object-fit: cover; object-position: top; border-radius: 6px; border: 1px solid var(--border); cursor: zoom-in; display: block; }
.scan-thumb.ph { display: grid; place-items: center; font-size: 20px; background: var(--surface-3); cursor: default; }
.scan-tbl td.stack > * + * { margin-top: 5px; }
.scan-tbl td.stack .inp, .scan-tbl td.stack select.inp { display: block; width: 100%; }
.scan-tbl .w-date { width: 150px; }
.scan-tbl .w-amt { width: 190px; }
.scan-tbl .w-cat { width: 240px; }
.scan-tbl .inp.num.exp { color: var(--expense); }
.scan-tbl .inp.num.inc { color: var(--income); }
.scan-cp { min-width: 200px; max-width: 280px; }
.scan-cp .t1 { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.scan-cp .tiny { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.scan-check { min-width: 190px; max-width: 260px; }
.scan-check .warn { color: var(--warn); }
.src-badge { font-size: 11.5px; color: var(--text-3); margin-top: 3px; }
.inp.need { border-color: var(--warn); background: var(--warn-bg); }
.spin { display: inline-block; width: 12px; height: 12px; border: 2px solid var(--border); border-top-color: var(--brand-2); border-radius: 50%; animation: spin .8s linear infinite; vertical-align: -1px; }
@keyframes spin { to { transform: rotate(360deg); } }
/* Hộp nút ＋: ai nhập + cách nhập */
.add-q { font-weight: 700; margin: 4px 0 8px; }
.add-q + .grid { margin-bottom: 14px; }
.btn.choice { min-height: 54px; font-size: 16px; justify-content: center; }
.btn.choice.big { flex-direction: column; gap: 3px; min-height: 104px; padding: 12px; }
.btn.choice.big .ico { font-size: 28px; line-height: 1; }
.btn.choice.on { border-color: var(--brand-2); background: var(--info-bg); color: var(--brand-2); font-weight: 700; box-shadow: inset 0 0 0 1px var(--brand-2); }
.btn.choice.on::before { content: '✓ '; }
.add-who.shake { animation: shake .35s; }
@keyframes shake { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
.vh { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; opacity: 0; }
.who-badge { color: var(--text-2); margin: -4px 4px 10px; }
.who-badge:empty { display: none; }
.empty { text-align: center; padding: 30px 12px; color: var(--text-3); }
.empty .big { font-size: 34px; margin-bottom: 6px; }

/* ---------- Thanh tiến độ ngân sách ---------- */
.bar { height: 8px; background: var(--surface-3); border-radius: 99px; overflow: hidden; position: relative; }
.bar > i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 99px; background: var(--brand-2); }
.bar > i.over { background: var(--bad); }
.bar > i.warn { background: var(--warn); }
.bud-row { padding: 10px 0; border-top: 1px solid var(--border); }
.bud-row:first-child { border-top: 0; }
.bud-row .top { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }

/* ---------- Bảng ---------- */
.tbl-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: var(--radius-sm); }
table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th, .tbl td { padding: 8px 10px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: middle; }
.tbl th { font-size: 12.5px; color: var(--text-2); font-weight: 650; background: var(--surface-2); white-space: nowrap; }
.tbl td.n, .tbl th.n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tbl tr.grp td { background: var(--surface-2); font-weight: 700; }
.tbl tr.tot td { font-weight: 800; border-top: 2px solid var(--border); }
.tbl tr.sub td:first-child { padding-left: 22px; }
.tbl tr.click { cursor: pointer; }
.tbl tr.click:hover td { background: var(--surface-2); }
.tbl.compact td, .tbl.compact th { padding: 6px 8px; font-size: 13px; }
.tbl .sticky { position: sticky; left: 0; background: var(--surface); z-index: 1; }
.tbl.wide-first td:first-child, .tbl.wide-first th:first-child { min-width: 220px; }
.inv-tbl td { white-space: nowrap; }
.inv-tbl td, .inv-tbl th { padding: 6px 6px; font-size: 12.5px; }
.inv-tbl td:first-child { min-width: 140px; white-space: normal; }
.inv-tbl th { white-space: normal; vertical-align: bottom; }
.page.wide { max-width: 1440px; }
@media (max-width: 520px) { .tbl.wide-first td:first-child, .tbl.wide-first th:first-child { min-width: 150px; max-width: 170px; } }
.tbl tr.grp .sticky, .tbl th.sticky { background: var(--surface-2); }
.tbl td.cell { cursor: pointer; }
.tbl td.cell:hover { background: var(--info-bg); }
.tbl td.manual { box-shadow: inset 3px 0 0 var(--accent); }
.tbl td.future { color: var(--text-3); }
.tbl td.auto-val { color: var(--text-2); }
.tbl .neg { color: var(--bad); }

/* ---------- Biểu đồ ---------- */
.chart { width: 100%; position: relative; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart text { fill: var(--text-3); font-size: 11px; font-family: var(--font); }
.chart .gridline { stroke: var(--grid); stroke-width: 1; }
.chart .axis { stroke: var(--border); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 13px; color: var(--text-2); margin-top: 8px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.tip {
  position: fixed; z-index: 100; pointer-events: none; background: var(--surface); color: var(--text); border: 1px solid var(--border);
  box-shadow: 0 6px 22px rgba(0,0,0,.18); border-radius: 10px; padding: 8px 10px; font-size: 12.5px; max-width: 260px; display: none;
}
.tip b { font-weight: 700; }
.donut-wrap { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.donut-wrap .chart { width: 180px; flex: 0 0 180px; }
.donut-wrap .legend-tbl { flex: 1 1 220px; }

/* ---------- Hộp thoại ---------- */
.modal-back { position: fixed; inset: 0; background: rgba(10,12,16,.45); z-index: 60; display: flex; align-items: flex-end; justify-content: center; animation: fade .15s; }
.modal {
  background: var(--surface); width: 100%; max-width: 560px; max-height: 92vh; overflow-y: auto; border-radius: 18px 18px 0 0;
  padding: 16px 16px calc(16px + env(safe-area-inset-bottom)); animation: up .18s ease-out;
}
.modal.wide { max-width: 1180px; }
.modal { overflow-x: hidden; }
.modal-body { min-width: 0; }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; gap: 8px; }
.modal-foot { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; flex-wrap: wrap; position: sticky; bottom: -16px; background: var(--surface); padding: 10px 0 0; }
@media (min-width: 640px) {
  .modal-back { align-items: center; }
  .modal { border-radius: 18px; padding: 20px; }
  .modal-foot { bottom: -20px; }
}
@keyframes up { from { transform: translateY(30px); opacity: .6; } to { transform: none; opacity: 1; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

.amount-box { display: flex; align-items: center; gap: 8px; }
.amount-box input { font-size: 28px; font-weight: 750; padding: 10px 12px; min-height: 58px; text-align: right; min-width: 0; flex: 1 1 auto; }
.amount-preview { font-size: 13px; color: var(--text-3); text-align: right; margin-top: 4px; min-height: 18px; }
.amount-preview.err { color: var(--bad); }
.keys { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.keys button { flex: 1 1 0; min-width: 52px; padding: 8px 0; border-radius: 9px; border: 1px solid var(--border); background: var(--surface-2); cursor: pointer; font-weight: 650; }
.qa-section { margin-top: 14px; }
.qa-section > .lbl { font-size: 13px; color: var(--text-2); margin-bottom: 7px; font-weight: 600; display: flex; justify-content: space-between; }

.toast-box { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--nav-h) + 18px); z-index: 90; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { background: #202020; color: #fff; padding: 10px 16px; border-radius: 12px; font-size: 14px; box-shadow: 0 8px 22px rgba(0,0,0,.25); pointer-events: auto; display: flex; gap: 12px; align-items: center; }
.toast button { background: none; border: 0; color: #ffb38f; font-weight: 700; cursor: pointer; }
@media (min-width: 900px) { .toast-box { bottom: 24px; } }

.insights { list-style: none; padding: 0; margin: 0; }
.insights li { display: flex; gap: 10px; padding: 8px 0; border-top: 1px solid var(--border); font-size: 14px; }
.insights li:first-child { border-top: 0; }
.insights .i { flex: 0 0 22px; text-align: center; }

.notice { border-radius: 12px; padding: 12px 14px; background: var(--info-bg); font-size: 14px; display: flex; gap: 10px; align-items: flex-start; }
.notice.warn { background: var(--warn-bg); }
.notice.bad { background: var(--bad-bg); }
.notice.good { background: var(--good-bg); }

.list-item { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid var(--border); }
.list-item:first-child { border-top: 0; }
@media (max-width: 520px) { .list-item .rec-edit { display: none; } }

.status { font-size: 12px; font-weight: 650; padding: 2px 8px; border-radius: 99px; white-space: nowrap; }
.status.s-not { background: var(--surface-3); color: var(--text-2); }
.status.s-doing { background: var(--info-bg); color: var(--brand-2); }
.status.s-blocked { background: var(--bad-bg); color: var(--bad); }
.status.s-done { background: var(--good-bg); color: var(--good); }

/* ---------- In / PDF ---------- */
.print-only { display: none; }
@media print {
  body { background: #fff; color: #000; font-size: 12px; }
  .sidebar, .bottom-nav, .no-print, .toast-box, .topbar .btn { display: none !important; }
  .main { padding: 0; }
  .card, .kpi, .verdict { box-shadow: none; break-inside: avoid; border-color: #ccc; }
  .print-only { display: block; }
  .tbl-wrap { overflow: visible; }
}
