/* Daftar — layout: one phone column (max 640px), sticky title bar, floating tab bar, bottom sheets for forms.
   Look: a wallet. The chrome is quiet graphite; the colour lives on the cards. Documents are ID-1 size cards
   (85.6 × 54 mm, ratio 1.586) stacked like a wallet; loans are bank cards; the monthly summary is a black card. */
:root {
  --bg: #EDEFF2;
  --surface: #FFFFFF;
  --surface-2: #E3E6EB;
  --ink: #111418;
  --muted: #5D6470;
  --line: #D9DDE3;
  --accent: #111418;
  --accent-ink: #FFFFFF;
  --accent-soft: #DFE3E9;
  --gold: #B88A3B;
  --gold-soft: #F3E9D6;
  --bad: #B3261E; --bad-soft: #F8E1DE;
  --warn: #8A5300; --warn-soft: #FAECD2;
  --ok: #1D6B3B; --ok-soft: #DFF0E4;
  --info: #2D5371; --info-soft: #E1EAF2;
  --scrim: rgba(8, 10, 14, .45);
  --shadow: 0 12px 40px rgba(10, 14, 22, .18);
  --bar: rgba(255, 255, 255, .86);
  /* card inks — the same in both themes, cards are physical objects */
  --identity-a: #12755A; --identity-b: #073A2B;
  --education-a: #2A4DB3; --education-b: #13245A;
  --work-a: #962B4E; --work-b: #4B1024;
  --finance-a: #34363D; --finance-b: #0E0F12;
  --insurance-a: #0F8590; --insurance-b: #063F46;
  --vehicle-a: #6253BF; --vehicle-b: #2C2465;
  --property-a: #AE6130; --property-b: #592A10;
  --other-a: #66717F; --other-b: #2D343C;
  --display: ui-rounded, "SF Pro Rounded", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --r: 16px;
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #090A0C; --surface: #15171B; --surface-2: #1E2126; --ink: #F1F2F4; --muted: #959CA7; --line: #272B31;
    --accent: #F1F2F4; --accent-ink: #0B0C0E; --accent-soft: #262A30; --gold: #D9B26A; --gold-soft: #2A2416;
    --bad: #FF9C92; --bad-soft: #3A1A17; --warn: #F2C574; --warn-soft: #33270F; --ok: #8BD3A4; --ok-soft: #142D1D;
    --info: #9CC3DA; --info-soft: #14262F; --scrim: rgba(0, 0, 0, .65); --shadow: 0 12px 40px rgba(0, 0, 0, .6); --bar: rgba(24, 26, 30, .86);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #090A0C; --surface: #15171B; --surface-2: #1E2126; --ink: #F1F2F4; --muted: #959CA7; --line: #272B31;
  --accent: #F1F2F4; --accent-ink: #0B0C0E; --accent-soft: #262A30; --gold: #D9B26A; --gold-soft: #2A2416;
  --bad: #FF9C92; --bad-soft: #3A1A17; --warn: #F2C574; --warn-soft: #33270F; --ok: #8BD3A4; --ok-soft: #142D1D;
  --info: #9CC3DA; --info-soft: #14262F; --scrim: rgba(0, 0, 0, .65); --shadow: 0 12px 40px rgba(0, 0, 0, .6); --bar: rgba(24, 26, 30, .86);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
[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 var(--sans); -webkit-tap-highlight-color: transparent; overscroll-behavior-y: none; }
body.sheet-open { overflow: hidden; }
h1, h2, h3 { margin: 0; text-wrap: balance; }
h1, h2 { font-family: var(--display); font-weight: 700; letter-spacing: -.015em; }
p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.ic { width: 22px; height: 22px; flex: none; }
.ic.inline { width: 1.05em; height: 1.05em; vertical-align: -.16em; }
.muted { color: var(--muted); }
.quiet { color: var(--muted); font-size: .94rem; }
.nowrap { white-space: nowrap; }
.mono { font-family: var(--mono); letter-spacing: .02em; }
.num, .big-num, .t-val, table, .bc-amt b, .wc-num { font-variant-numeric: tabular-nums; }
.pos { color: var(--ok); }
.err { color: var(--bad); font-size: .92rem; min-height: 1.2em; }
.boot { padding: 40vh 16px 0; text-align: center; color: var(--muted); }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .45em; min-height: 44px; padding: 0 18px; border-radius: 14px; border: 1px solid transparent; background: var(--surface-2); font-weight: 650; text-decoration: none; transition: transform .08s, opacity .15s; }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .4; cursor: default; transform: none; }
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.ghost { background: var(--surface); border-color: var(--line); }
.btn.danger { background: var(--bad); color: #fff; }
.btn.danger-ghost { background: transparent; color: var(--bad); border-color: var(--bad-soft); }
.btn.big { width: 100%; min-height: 54px; font-size: 1.02rem; border-radius: 16px; }
.btn.sm { min-height: 36px; padding: 0 13px; font-size: .9rem; border-radius: 999px; }
.icon-btn { display: inline-grid; place-items: center; width: 44px; height: 44px; border: 0; background: transparent; border-radius: 12px; color: var(--muted); }
.icon-btn:active { background: var(--surface-2); }
.link-btn { border: 0; background: none; color: var(--ink); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--gold); font-weight: 600; padding: 10px 0; text-align: left; }

/* ---------- gate screens ---------- */
#app.gate-mode { min-height: 100vh; display: grid; place-items: start center; padding-inline: 20px; }
.gate { width: 100%; max-width: 420px; padding-block: calc(var(--sat) + 8vh) calc(var(--sab) + 32px); display: grid; gap: 18px; }
.gate.wide { max-width: 480px; }
.gate h1 { font-size: 2.1rem; line-height: 1.1; }
.gate .lead { color: var(--muted); font-size: 1.02rem; }
.gate-mark { justify-self: start; margin-left: -10px; }
.mark .m1 { fill: var(--identity-a); }
.mark .m2 { fill: var(--education-a); }
.mark .m3 { fill: var(--finance-b); stroke: rgba(255, 255, 255, .14); stroke-width: 1; }
.mark .m-chip { fill: #D9B26A; }
.mark .m-line { stroke: rgba(255, 255, 255, .55); stroke-width: 3; stroke-linecap: round; fill: none; }
.stack { display: grid; gap: 14px; }
.stack-row { display: flex; flex-wrap: wrap; gap: 10px; }
.fine { color: var(--muted); font-size: .86rem; }
.steps { margin: 0; padding-left: 1.3em; display: grid; gap: 10px; }
.steps li::marker { font-family: var(--display); font-weight: 800; color: var(--gold); }
.ticks { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; font-size: .94rem; }
.ticks li { position: relative; padding-left: 22px; }
.ticks li::before { content: ""; position: absolute; left: 3px; top: .5em; width: 9px; height: 5px; border-left: 2px solid var(--gold); border-bottom: 2px solid var(--gold); transform: rotate(-45deg); }
.check { display: flex; gap: 10px; align-items: center; font-weight: 600; }
.check input { width: 22px; height: 22px; accent-color: var(--gold); }
.reckey { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; padding: 16px; border-radius: var(--r); background: var(--gold-soft); border: 1px dashed var(--gold); }
.reckey span { font: 600 1.05rem/1.6 var(--mono); text-align: center; letter-spacing: .08em; color: var(--ink); }

/* ---------- fields ---------- */
.field { display: grid; gap: 6px; min-width: 0; }
.field > span { font-size: .84rem; font-weight: 600; color: var(--muted); }
.field em { font-style: normal; font-weight: 400; opacity: .8; }
.field small { color: var(--muted); font-size: .8rem; }
input:not([type=checkbox]):not([type=file]), select, textarea {
  width: 100%; min-height: 48px; padding: 11px 13px; border-radius: 13px; border: 1px solid var(--line); background: var(--surface);
  font-size: 16px; -webkit-appearance: none; 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% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 32px; }
textarea { resize: vertical; min-height: 84px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-soft); }
input[type=date], input[type=month] { min-width: 0; display: block; }
input[type=search] { background: var(--surface); border-color: var(--line); border-radius: 999px; padding-inline: 18px; }
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 50px; }
.pw-wrap .icon-btn { position: absolute; right: 2px; top: 2px; }
.meter { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; height: 4px; }
.meter i { border-radius: 2px; background: var(--line); }
.meter i.on.s1 { background: var(--bad); }
.meter i.on.s2 { background: var(--warn); }
.meter i.on.s3, .meter i.on.s4 { background: var(--ok); }

/* ---------- app shell ---------- */
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 8px; padding: calc(var(--sat) + 10px) 10px 8px 18px; background: color-mix(in srgb, var(--bg) 86%, transparent); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); }
.topbar h1 { flex: 1; font-size: 1.75rem; }
.tb-actions { display: flex; gap: 6px; }
.view { max-width: 640px; margin: 0 auto; padding: 6px 16px calc(var(--sab) + 120px); display: grid; gap: 22px; }
.tabbar { position: fixed; z-index: 20; left: 12px; right: 12px; bottom: calc(var(--sab) + 10px); max-width: 520px; margin: 0 auto; display: grid; grid-template-columns: repeat(5, 1fr); padding: 6px; border-radius: 26px; background: var(--bar); -webkit-backdrop-filter: blur(18px) saturate(1.4); backdrop-filter: blur(18px) saturate(1.4); border: 1px solid var(--line); box-shadow: var(--shadow); }
.tabbar button { display: grid; justify-items: center; gap: 2px; padding: 7px 0 5px; border: 0; background: none; color: var(--muted); font-size: .66rem; font-weight: 650; border-radius: 20px; }
.tabbar button.on { color: var(--ink); background: var(--surface-2); }
.hello { color: var(--muted); font-weight: 600; margin-bottom: -12px; }

/* ---------- blocks, lists ---------- */
.block { display: grid; gap: 12px; min-width: 0; }
.block-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.block h2 { font-size: 1.25rem; }
.block h3, .attach h3 { font-size: .76rem; text-transform: uppercase; letter-spacing: .09em; color: var(--muted); font-family: var(--sans); }
.list { list-style: none; margin: 0; padding: 0; display: grid; background: var(--surface); border-radius: var(--r); border: 1px solid var(--line); overflow: hidden; }
.list > li + li { border-top: 1px solid var(--line); }
.list.cards { background: none; border: 0; gap: 8px; }
.list.cards > li + li { border-top: 0; }
.row { width: 100%; display: flex; align-items: center; gap: 12px; padding: 13px 14px; border: 0; background: none; text-align: left; }
.row.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); }
.row:active { background: var(--surface-2); }
.row-main { flex: 1; min-width: 0; display: grid; gap: 2px; }
.row-main b { font-weight: 650; overflow-wrap: anywhere; }
.row-main small { color: var(--muted); font-size: .85rem; overflow-wrap: anywhere; }
.row-side { display: grid; justify-items: end; gap: 3px; text-align: right; }
.row-side small { color: var(--muted); font-size: .8rem; }
.chip { display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: .78rem; font-weight: 650; white-space: nowrap; background: var(--surface-2); color: var(--muted); }
.chip.ok { background: var(--ok-soft); color: var(--ok); }
.chip.warn { background: var(--warn-soft); color: var(--warn); }
.chip.bad { background: var(--bad-soft); color: var(--bad); }
.chip.info { background: var(--info-soft); color: var(--info); }
.banner { display: flex; gap: 12px; align-items: center; padding: 13px 14px; border-radius: var(--r); font-size: .92rem; }
.banner.warn { background: var(--warn-soft); color: var(--ink); border: 1px solid color-mix(in srgb, var(--warn) 28%, transparent); }
.banner > div { flex: 1; min-width: 0; }
.banner .btn { background: var(--accent); color: var(--accent-ink); }
.empty { display: grid; gap: 12px; justify-items: start; padding: 20px; border-radius: var(--r); border: 1px dashed var(--line); color: var(--muted); }
.empty-hero { display: grid; gap: 12px; justify-items: start; padding: 22px 20px; border-radius: 20px; background: var(--surface); border: 1px solid var(--line); }
.empty-hero h2 { font-size: 1.35rem; }
.empty-hero p { color: var(--muted); }
.calm { display: flex; gap: 10px; align-items: center; width: 100%; padding: 15px 16px; border: 0; border-radius: var(--r); background: var(--ok-soft); color: var(--ok); font-weight: 650; text-align: left; }
.footnote { text-align: center; color: var(--muted); font-size: .8rem; }

/* ---------- the wallet: stacked ID-1 cards ---------- */
.wallet { display: grid; width: 100%; max-width: 460px; margin: 0 auto; }
.wcard {
  --a: var(--other-a); --b: var(--other-b);
  position: relative; display: grid; grid-template-rows: auto 1fr auto auto; align-items: end; gap: 4px;
  width: 100%; aspect-ratio: 1.586; padding: 15px 18px 16px; border: 0; border-radius: 18px; overflow: hidden;
  color: #fff; text-align: left; isolation: isolate;
  background: radial-gradient(120% 90% at 100% 0%, rgba(255, 255, 255, .2), transparent 55%), linear-gradient(140deg, var(--a), var(--b));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .18), 0 -6px 18px rgba(0, 0, 0, .16), 0 2px 6px rgba(0, 0, 0, .12);
  transition: transform .18s cubic-bezier(.2, .8, .2, 1);
}
.wcard::after { content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: repeating-radial-gradient(circle at 115% 125%, rgba(255, 255, 255, .07) 0 1px, transparent 1px 9px); }
.wcard::before { content: ""; position: absolute; left: 18px; top: 76px; width: 40px; height: 30px; border-radius: 6px;
  background: linear-gradient(135deg, #E9CB8A, #B58937); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .18); opacity: .95; }
.wallet .wcard + .wcard { margin-top: calc(-63.05% + 68px); }
button.wcard:active { transform: translateY(-8px); }
.wallet.single { max-width: 420px; }
.wallet.single .wcard { box-shadow: 0 14px 30px rgba(0, 0, 0, .22); }
.c-identity { --a: var(--identity-a); --b: var(--identity-b); }
.c-education { --a: var(--education-a); --b: var(--education-b); }
.c-work { --a: var(--work-a); --b: var(--work-b); }
.c-finance { --a: var(--finance-a); --b: var(--finance-b); }
.c-insurance { --a: var(--insurance-a); --b: var(--insurance-b); }
.c-vehicle { --a: var(--vehicle-a); --b: var(--vehicle-b); }
.c-property { --a: var(--property-a); --b: var(--property-b); }
.c-other { --a: var(--other-a); --b: var(--other-b); }
.wc-head { align-self: start; display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; min-width: 0; }
.wc-id { display: grid; min-width: 0; }
.wc-cat { font-size: .64rem; font-weight: 700; text-transform: uppercase; letter-spacing: .12em; opacity: .75; }
.wc-title { font-family: var(--display); font-size: 1.12rem; font-weight: 700; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wc-chip { flex: none; margin-top: 2px; padding: 4px 10px; border-radius: 999px; font-size: .72rem; font-weight: 700; background: rgba(255, 255, 255, .2); color: #fff; -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.wc-chip.warn { background: #F6C453; color: #3B2700; }
.wc-chip.bad { background: #FF6B5E; color: #fff; }
.wc-emblem { position: absolute; right: -14px; bottom: -18px; z-index: -1; opacity: .13; }
.wc-emblem .ic { width: 132px; height: 132px; stroke-width: 1.3; }
.wc-num { font-size: 1.04rem; letter-spacing: .14em; opacity: .95; min-height: 1.4em; }
.wc-foot { display: flex; align-items: flex-end; gap: 20px; font-size: .86rem; font-weight: 600; min-width: 0; }
.wc-foot > span { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wc-foot small { display: block; font-size: .58rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; opacity: .68; }
.wc-att { margin-left: auto; display: inline-flex; gap: 4px; align-items: center; opacity: .85; }
.wallet.ghost { max-width: 190px; margin: 0 0 4px; }
.wallet.ghost .wcard { border-radius: 10px; padding: 0; }
.wallet.ghost .wcard::before { left: 12px; top: 26px; width: 20px; height: 15px; border-radius: 3px; }
.wallet.ghost .wcard + .wcard { margin-top: calc(-63.05% + 24px); }

/* ---------- documents ---------- */
.toolbar { display: flex; gap: 8px; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; margin-inline: -16px; padding-inline: 16px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
#dbody { display: grid; gap: 16px; min-width: 0; }
.pill { flex: none; display: inline-flex; align-items: center; gap: 6px; padding: 7px 13px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); font-size: .86rem; font-weight: 650; color: var(--muted); }
.pill i { font-style: normal; opacity: .65; }
.pill.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.dot { width: 9px; height: 9px; border-radius: 50%; background: linear-gradient(140deg, var(--a), var(--b)); }

/* ---------- home: black summary card ---------- */
.money-card { display: grid; gap: 6px; padding: 18px 18px 8px; border-radius: 22px; color: #fff;
  background: radial-gradient(90% 120% at 100% 0%, rgba(217, 178, 106, .22), transparent 60%), linear-gradient(150deg, #23262C, #0C0D10);
  box-shadow: 0 14px 30px rgba(0, 0, 0, .2); border: 1px solid rgba(255, 255, 255, .06); }
.mc-top { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.mc-brand { font-size: .72rem; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; color: #D9B26A; }
.mc-month { font-size: .84rem; opacity: .7; }
.mc-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.mc-grid button { display: grid; gap: 4px; align-content: start; padding: 12px 0; border: 0; background: none; color: inherit; text-align: left; min-width: 0; }
.mc-grid button:nth-child(odd) { padding-right: 12px; }
.mc-grid button:nth-child(even) { padding-left: 12px; border-left: 1px solid rgba(255, 255, 255, .1); }
.mc-grid button:nth-child(n+3) { border-top: 1px solid rgba(255, 255, 255, .1); }
.money-card .t-label { color: rgba(255, 255, 255, .58); }
.money-card .t-val small, .money-card .dim { color: rgba(255, 255, 255, .55); font-weight: 500; }
.t-label { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; }
.t-val { font-size: 1.12rem; font-weight: 700; line-height: 1.3; overflow-wrap: anywhere; }
.t-val small { display: block; font-size: .78rem; font-weight: 500; color: var(--muted); }
.lender-dot { flex: none; width: 34px; height: 22px; border-radius: 5px; background: linear-gradient(140deg, var(--a), var(--b)); }
.quick { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.qa { display: grid; justify-items: center; gap: 6px; padding: 14px 4px 12px; border-radius: var(--r); border: 1px solid var(--line); background: var(--surface); font-size: .76rem; font-weight: 650; color: var(--ink); }

/* ---------- loans: bank cards ---------- */
.bcards { display: grid; gap: 12px; }
.lc-0 { --a: #3A3C44; --b: #0E0F12; }
.lc-1 { --a: var(--education-a); --b: var(--education-b); }
.lc-2 { --a: var(--identity-a); --b: var(--identity-b); }
.lc-3 { --a: var(--work-a); --b: var(--work-b); }
.bcard { position: relative; display: grid; gap: 12px; width: 100%; padding: 18px; border: 0; border-radius: 20px; color: #fff; text-align: left; overflow: hidden; isolation: isolate;
  background: radial-gradient(110% 90% at 100% 0%, rgba(255, 255, 255, .18), transparent 55%), linear-gradient(140deg, var(--a), var(--b));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .16), 0 10px 24px rgba(0, 0, 0, .18); }
.bcard::after { content: ""; position: absolute; inset: 0; z-index: -1; background: repeating-radial-gradient(circle at 115% 130%, rgba(255, 255, 255, .06) 0 1px, transparent 1px 10px); }
.bcard:active { transform: scale(.985); }
.bcard.closed { filter: saturate(.3); opacity: .75; }
.bc-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.bc-name { display: grid; min-width: 0; }
.bc-name b { font-family: var(--display); font-size: 1.12rem; overflow-wrap: anywhere; }
.bc-name small { opacity: .72; font-size: .84rem; }
.bc-status { flex: none; padding: 4px 10px; border-radius: 999px; background: rgba(255, 255, 255, .18); font-size: .74rem; font-weight: 700; }
.bc-amt { display: grid; }
.bc-amt small { font-size: .62rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; opacity: .65; }
.bc-amt b { font-size: 1.75rem; font-weight: 750; letter-spacing: -.01em; overflow-wrap: anywhere; }
.bc-meta { display: flex; justify-content: space-between; gap: 10px; font-size: .84rem; opacity: .85; }
.progress { display: block; height: 7px; border-radius: 4px; background: var(--surface-2); overflow: hidden; }
.progress i { display: block; height: 100%; width: 0; border-radius: 4px; background: linear-gradient(90deg, var(--ink), var(--gold)); }
.progress.light { background: rgba(255, 255, 255, .2); }
.progress.light i { background: linear-gradient(90deg, #fff, #E9CB8A); }

/* ---------- money ---------- */
.seg { display: grid; grid-template-columns: 1fr 1fr; padding: 4px; border-radius: 999px; background: var(--surface-2); }
.seg button { border: 0; background: none; padding: 9px; border-radius: 999px; font-weight: 650; color: var(--muted); }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 4px rgba(0, 0, 0, .12); }
#mv { display: grid; gap: 14px; }
.summary { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; padding: 16px 18px; border-radius: 20px; color: #fff;
  background: radial-gradient(90% 120% at 100% 0%, rgba(217, 178, 106, .2), transparent 60%), linear-gradient(150deg, #23262C, #0C0D10); }
.summary > div { display: grid; gap: 4px; min-width: 0; }
.summary .t-label { color: rgba(255, 255, 255, .58); }
.summary .big-num.pos { color: #8BD3A4; }
.big-num { font-size: 1.32rem; font-weight: 750; line-height: 1.25; overflow-wrap: anywhere; }
.big-num.sm { font-size: 1.1rem; }
.big-num small { display: block; font-size: .8rem; font-weight: 500; color: var(--muted); }
.monthnav { display: flex; align-items: center; justify-content: space-between; }
.monthnav b { font-family: var(--display); font-size: 1.15rem; }
.bars { display: grid; gap: 9px; padding: 14px 16px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--line); }
.bar-row { display: grid; grid-template-columns: minmax(0, 7.5em) 1fr auto; gap: 10px; align-items: center; font-size: .86rem; }
.bar-row > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar { height: 8px; border-radius: 4px; background: var(--surface-2); overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: var(--gold); border-radius: 4px; }
.day { font-size: .74rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-family: var(--sans); margin-bottom: -6px; }

/* ---------- loan detail ---------- */
.loan-hero { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.loan-hero > div { display: grid; gap: 4px; }

/* ---------- sheets ---------- */
.scrim { position: fixed; inset: 0; background: var(--scrim); z-index: 40; animation: fade .18s ease; }
.sheet { position: fixed; z-index: 41; left: 0; right: 0; bottom: 0; max-height: calc(100% - var(--sat) - 20px); overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain;
  margin: 0 auto; max-width: 560px; background: var(--bg); border-radius: 24px 24px 0 0; padding: 8px 18px calc(var(--sab) + 18px); display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; box-shadow: var(--shadow); animation: rise .26s cubic-bezier(.2, .8, .2, 1); }
.sheet.wide { max-width: 640px; }
.sheet > *, .sched, .form, .grid > * { min-width: 0; }
.grabber { justify-self: center; width: 38px; height: 5px; border-radius: 3px; background: var(--line); }
.sheet h2 { font-size: 1.4rem; }
.sheet-head { display: flex; align-items: start; justify-content: space-between; gap: 8px; }
.sheet-head > div { min-width: 0; }
.sheet-head h2 { overflow-wrap: anywhere; }
.sheet-foot { position: sticky; bottom: calc(-1 * (var(--sab) + 18px)); display: flex; justify-content: space-between; gap: 10px; padding: 12px 0 calc(var(--sab) + 18px); margin-bottom: calc(-1 * (var(--sab) + 18px)); background: var(--bg); border-top: 1px solid var(--line); }
.sheet-foot .btn { flex: 1; }
.form { display: grid; gap: 16px; }
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 12px; }
.grid .field { grid-column: span 2; }
.grid .field.half { grid-column: span 1; }
.calc { font-size: .85rem; color: var(--gold); font-weight: 600; grid-column: span 2; }
.attach { display: grid; gap: 10px; }
.att-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.att-list li { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 4px 4px 4px 12px; border-radius: 13px; background: var(--surface); border: 1px solid var(--line); min-width: 0; }
.att-list li > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att-list li.new { border-style: dashed; border-color: var(--gold); }
.att-list small { color: var(--muted); }
.att-open { flex: 1; display: flex; align-items: center; gap: 8px; min-height: 44px; border: 0; background: none; text-align: left; min-width: 0; }
.att-open span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att-add { justify-self: start; cursor: pointer; }

/* detail */
.kvs { margin: 0; display: grid; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); }
.kv { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 11px 14px; min-height: 46px; }
.kv + .kv { border-top: 1px solid var(--line); }
.kv dt { color: var(--muted); font-size: .9rem; flex: none; }
.kv dd { margin: 0; text-align: right; font-weight: 650; min-width: 0; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.kv.block { display: grid; justify-content: stretch; }
.kv.block dd { text-align: left; font-weight: 400; white-space: pre-wrap; }
.kv.total { background: var(--surface-2); }
.kv.strong dd { font-size: 1.15rem; color: var(--ink); }
.secret { display: flex; align-items: center; justify-content: flex-end; }
.secret .icon-btn { width: 38px; height: 38px; }
.expiry { display: grid; gap: 2px; padding: 12px 14px; border-radius: var(--r); background: var(--surface-2); }
.expiry.ok { background: var(--ok-soft); } .expiry.ok b { color: var(--ok); }
.expiry.warn { background: var(--warn-soft); } .expiry.warn b { color: var(--warn); }
.expiry.bad { background: var(--bad-soft); } .expiry.bad b { color: var(--bad); }
.expiry span { font-size: .88rem; color: var(--ink); }
.sched summary { cursor: pointer; font-weight: 650; padding: 6px 0; }
.table-wrap { overflow-x: auto; border-radius: var(--r); border: 1px solid var(--line); background: var(--surface); margin-top: 8px; }
table { border-collapse: collapse; width: 100%; font-size: .82rem; }
th, td { padding: 8px 10px; text-align: right; white-space: nowrap; }
th:first-child, td:first-child, th:nth-child(2), td:nth-child(2) { text-align: left; }
th { position: sticky; top: 0; background: var(--surface-2); color: var(--muted); font-weight: 650; }
tr + tr td { border-top: 1px solid var(--line); }
tr.paid td { color: var(--muted); }
tr.next td { background: var(--gold-soft); font-weight: 700; }

/* confirm, viewer, toast */
.confirm-layer { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 20px; }
.confirm-layer .scrim { z-index: 0; }
.confirm { position: relative; z-index: 1; width: 100%; max-width: 360px; background: var(--surface); border-radius: 22px; padding: 20px; display: grid; gap: 10px; box-shadow: var(--shadow); }
.confirm h3 { font-family: var(--display); font-size: 1.2rem; }
.confirm p { color: var(--muted); font-size: .94rem; }
.row-actions { display: flex; gap: 10px; margin-top: 6px; }
.row-actions .btn { flex: 1; }
.viewer { position: fixed; inset: 0; z-index: 50; background: #08090B; color: #EEF0F3; display: grid; grid-template-rows: auto 1fr; }
.viewer-bar { display: flex; align-items: center; gap: 8px; padding: calc(var(--sat) + 6px) 8px 6px 16px; }
.viewer-bar span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 650; }
.viewer-bar .icon-btn { color: #EEF0F3; }
.viewer-bar .btn { background: rgba(255, 255, 255, .12); color: #EEF0F3; }
.viewer-body { overflow: auto; display: grid; place-items: center; padding: 8px 8px calc(var(--sab) + 8px); gap: 8px; }
.viewer-body img { max-width: 100%; height: auto; border-radius: 8px; background: #fff; }
.viewer-body iframe { width: 100%; height: 100%; min-height: 70vh; border: 0; background: #fff; border-radius: 8px; }
.viewer-body .fine { color: #A6ADB7; }
#toast { position: fixed; z-index: 70; left: 50%; transform: translateX(-50%); bottom: calc(var(--sab) + 96px); max-width: calc(100% - 32px); padding: 11px 18px; border-radius: 999px; background: var(--ink); color: var(--bg); font-size: .92rem; font-weight: 650; box-shadow: var(--shadow); animation: rise .2s ease; }

/* settings */
.set { padding: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 20px; gap: 14px; }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.set-row > div { min-width: 0; display: grid; gap: 2px; }
.set-row small { color: var(--muted); font-size: .82rem; }
.set-row select { width: auto; min-width: 9.5em; flex: none; }
.danger-zone h2 { color: var(--bad); }

#privacy-cover { display: none; position: fixed; inset: 0; z-index: 100; background: var(--bg); }
body.privacy #privacy-cover { display: block; }

@keyframes rise { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
@media (max-width: 380px) {
  .set-row { flex-wrap: wrap; }
  .set-row select { width: 100%; }
  .quick { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .wcard { padding: 13px 15px 14px; }
  .wcard::before { top: 70px; }
}
@media (min-width: 700px) {
  .sheet { bottom: auto; top: 50%; transform: translateY(-50%); border-radius: 24px; animation: fade .2s ease; max-height: 86vh; }
  .grabber { display: none; }
}
