/* FSB Vault — "Ocean & Gold" theme. Fonts are bundled locally so the app works offline. */
@font-face { font-family: 'Sora'; font-weight: 400; font-display: swap; src: url('../fonts/sora-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'Sora'; font-weight: 600; font-display: swap; src: url('../fonts/sora-latin-600-normal.woff2') format('woff2'); }
@font-face { font-family: 'Sora'; font-weight: 700; font-display: swap; src: url('../fonts/sora-latin-700-normal.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-weight: 400; font-display: swap; src: url('../fonts/inter-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-weight: 500; font-display: swap; src: url('../fonts/inter-latin-500-normal.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-weight: 600; font-display: swap; src: url('../fonts/inter-latin-600-normal.woff2') format('woff2'); }

:root {
  --bg: #F2F7FB; --card: #FFFFFF; --ink: #0A1F33; --muted: #50657A; --line: #E1ECF5; --line2: #D6E6F2;
  --navy: #071E36; --navy2: #0B2C4D; --navy-line: #1B4C76; --ocean: #0369A1; --sky: #38BDF8; --aqua: #7DD3FC; --mist: #A9C6DE;
  --good: #15803D; --bad: #B42318; --warn: #F6C343;
  --gold: #E6B547; --gold-hi: #F5D27A; --gold-ink: #2A1A03;
  --radius: 18px; --tabs-h: 66px;
  --display: 'Sora', system-ui, sans-serif;
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); -webkit-font-smoothing: antialiased; }
body { padding-bottom: calc(var(--tabs-h) + 30px + env(safe-area-inset-bottom)); }
h1, h2, h3 { font-family: var(--display); font-weight: 600; letter-spacing: -0.1px; }

/* ---------- top bar: navy with sonar lines ---------- */
.topbar { position: sticky; top: 0; z-index: 5; color: #fff; padding: 14px 18px; padding-top: calc(14px + env(safe-area-inset-top));
  background-color: var(--navy);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='390' height='120' viewBox='0 0 390 120'%3E%3Cg fill='none' stroke-width='1'%3E%3Ccircle cx='350' cy='20' r='60' stroke='%23123F68'/%3E%3Ccircle cx='350' cy='20' r='110' stroke='%230F3860'/%3E%3Ccircle cx='350' cy='20' r='160' stroke='%230D3256'/%3E%3C/g%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right top; display: flex; align-items: center; gap: 10px; }
.topbar .brand { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.topbar .brand svg { flex: none; }
.topbar h1 { margin: 0; font-size: 1.05rem; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .sub { font-size: .72rem; letter-spacing: .12em; text-transform: uppercase; color: #8FB4D4; display: block; }
main { max-width: 720px; margin: 0 auto; padding: 14px; }

/* hero (navy band continuing the top bar, ending in a wave) */
.hero { position: relative; margin: -14px -14px 6px; padding: 8px 22px 70px; background: var(--navy); color: #fff; overflow: hidden; }
.hero::after { content: ''; position: absolute; left: 0; right: 0; bottom: -1px; height: 64px; background-repeat: no-repeat; background-size: 100% 100%;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 390 64' preserveAspectRatio='none'%3E%3Cpath d='M0 16 C 80 -6 150 40 230 14 S 340 -6 390 10 L390 64 L0 64 Z' fill='%230B3256'/%3E%3Cpath d='M0 40 C 90 24 170 62 250 40 S 350 26 390 36 L390 64 L0 64 Z' fill='%23F2F7FB'/%3E%3C/svg%3E"); }
.hero .lbl { font-size: .74rem; letter-spacing: .14em; text-transform: uppercase; color: #8FB4D4; }
.hero .big { font-family: var(--display); font-weight: 600; font-size: 2.4rem; letter-spacing: -0.5px; margin: 4px 0 6px; }
.hero .inout { display: flex; gap: 18px; font-size: .85rem; }
.hero .inout .in { color: #86EFAC; } .hero .inout .out { color: #FCA5A5; }
.hero + * { position: relative; margin-top: -40px; }

/* ---------- floating tab bar ---------- */
.tabs { position: fixed; left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom)); height: var(--tabs-h); max-width: 696px; margin: 0 auto;
  display: grid; grid-template-columns: repeat(5, 1fr); background: var(--navy); border-radius: 22px; z-index: 6; box-shadow: 0 12px 28px rgba(7,30,54,.32); }
.tabs button { background: none; border: 0; font: inherit; font-size: .68rem; color: #8FB4D4; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; cursor: pointer; }
.tabs button svg { width: 21px; height: 21px; }
.tabs button.active { color: var(--aqua); font-weight: 600; }
.tabs button[data-tab="chest"] { color: #D9B45C; }
.tabs button[data-tab="chest"].active { color: var(--gold-hi); }

/* ---------- cards, text, buttons ---------- */
.card { background: var(--card); border-radius: var(--radius); padding: 16px; margin-bottom: 12px; border: 1px solid var(--line); box-shadow: 0 6px 18px rgba(10,31,51,.05); }
h2 { font-size: 1rem; margin: 2px 0 10px; }
h3 { font-size: .92rem; margin: 12px 0 6px; }
.muted { color: var(--muted); font-size: .88rem; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--line2); border-radius: 14px; min-height: 44px; padding: 10px 16px; font: inherit; font-weight: 600; background: #fff; color: var(--ink); cursor: pointer; }
.btn svg { width: 19px; height: 19px; flex: none; }
.btn.primary { background: var(--ocean); border-color: var(--ocean); color: #fff; box-shadow: 0 8px 20px rgba(3,105,161,.25); }
.btn.danger { background: #FDECEC; border-color: #F8CFCF; color: var(--bad); }
.btn.big { width: 100%; min-height: 62px; font-family: var(--display); font-size: 1.05rem; border-radius: 18px; }
.btn.small { min-height: 34px; padding: 6px 12px; font-size: .84rem; border-radius: 10px; }
.btn.tile { flex-direction: column; min-height: 78px; font-size: .78rem; border-radius: 16px; }
.btn.tile svg { color: var(--ocean); width: 21px; height: 21px; }
.btn:disabled { opacity: .45; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row > .grow { flex: 1; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.stack > * + * { margin-top: 12px; }
label.field { display: block; font-size: .76rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
label.field input, label.field select, label.field textarea { display: block; width: 100%; margin-top: 6px; font: inherit; font-size: 1rem; font-weight: 400; letter-spacing: 0; text-transform: none; color: var(--ink);
  min-height: 48px; padding: 10px 14px; border: 1px solid var(--line2); border-radius: 12px; background: #fff; }
label.field input:focus, label.field select:focus { outline: none; border-color: var(--sky); box-shadow: 0 0 0 3px rgba(56,189,248,.22); }
label.field.check input, label.field.check select { border-color: var(--warn); box-shadow: 0 0 0 3px rgba(246,195,67,.3); }
.amount-input { font-family: var(--display) !important; font-size: 1.7rem !important; font-weight: 600 !important; }
.chip { display: inline-block; font-size: .7rem; padding: 2px 9px; border-radius: 99px; background: #E6F1F9; color: var(--muted); margin-left: 6px; vertical-align: middle; text-transform: none; letter-spacing: 0; font-weight: 600; }
.chip.low { background: #FFF4D6; color: #7A5600; }
.chip.high { background: #E3F5EA; color: var(--good); }
.kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 12px 8px; text-align: center; box-shadow: 0 6px 18px rgba(10,31,51,.05); }
.kpi .muted { font-size: .7rem; letter-spacing: .1em; text-transform: uppercase; }
.kpi b { display: block; font-family: var(--display); font-weight: 600; font-size: 1.02rem; margin-top: 3px; }
.pos { color: var(--good); } .neg { color: var(--bad); }
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: center; gap: 12px; padding: 12px 2px; border-bottom: 1px solid #EEF4F9; }
.list li:last-child { border-bottom: 0; }
.list li .grow { flex: 1; min-width: 0; }
.list li .title { font-weight: 600; font-size: .95rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list li .amt { font-family: var(--display); font-weight: 600; white-space: nowrap; }
.list li.tap { cursor: pointer; }
.dot { width: 12px; height: 12px; border-radius: 50%; flex: none; display: inline-block; }
.monthnav { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.monthnav b { font-family: var(--display); font-size: 1.15rem; font-weight: 600; }
.monthnav .btn { min-width: 44px; }
.chartbox { position: relative; height: 300px; }
.thumb { width: 100%; max-height: 220px; object-fit: contain; border-radius: 12px; background: #0A1F33; }
.progress { height: 8px; background: #E6F1F9; border-radius: 99px; overflow: hidden; }
.progress > div { height: 100%; width: 0; background: var(--sky); transition: width .2s; }
.banner { background: #FFF4D6; color: #5C4300; padding: 10px 16px; font-size: .9rem; display: flex; gap: 10px; align-items: center; justify-content: space-between; }
.banner[hidden] { display: none; }
dialog { border: 0; border-radius: 20px; padding: 0; width: min(92vw, 460px); max-height: 85vh; box-shadow: 0 30px 60px rgba(7,30,54,.3); }
dialog::backdrop { background: rgba(7, 30, 54, .55); }
#dialogForm { padding: 18px; }
#dialogForm .actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; margin-top: 16px; }
.tablewrap { overflow-x: auto; }
table.grid { border-collapse: collapse; font-size: .8rem; min-width: 100%; }
table.grid th, table.grid td { padding: 7px 8px; border-bottom: 1px solid #EEF4F9; text-align: right; white-space: nowrap; }
table.grid th { font-weight: 600; color: var(--muted); font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; }
table.grid th:first-child, table.grid td:first-child { text-align: left; position: sticky; left: 0; background: #fff; }
table.grid tr.main td { font-weight: 700; background: #F5F9FC; }
table.grid tr.main td:first-child { background: #F5F9FC; }
table.grid tr.total td { font-weight: 700; border-top: 2px solid var(--ink); }
table.grid tr.diffrow th { font-size: .75rem; font-weight: 700; border-bottom: 2px solid var(--line2); }
table.grid td.pos, table.grid th.pos { color: var(--good); } table.grid td.neg, table.grid th.neg { color: var(--bad); }
table.grid tr.shop-row td { font-size: .74rem; background: #FBFDFF; }
table.grid tr.shop-row td.shop-cell { padding-left: 34px !important; color: var(--muted); }
table.grid tr.shop-row[hidden] { display: none; }
table.grid tr.tap { cursor: pointer; }
details summary { cursor: pointer; color: var(--muted); font-size: .88rem; }
pre.raw { white-space: pre-wrap; font-size: .75rem; background: #F2F7FB; padding: 10px; border-radius: 10px; max-height: 200px; overflow: auto; }
.sub-row { padding-left: 22px !important; }
.empty { text-align: center; color: var(--muted); padding: 26px 8px; }
input[type=color] { width: 36px; height: 30px; border: 0; padding: 0; background: none; }
.sharebar { height: 6px; background: #EAF2F8; border-radius: 99px; overflow: hidden; margin-top: 6px; min-width: 60px; }
.sharebar > div { height: 100%; border-radius: 99px; }
.sharebar.thin { height: 4px; }
.icochip { width: 38px; height: 38px; border-radius: 11px; display: flex; align-items: center; justify-content: center; flex: none; font-size: .72rem; font-weight: 700; }

/* ---------- lock screen ---------- */
body.locked .tabs, body.locked main, body.locked .topbar, body.locked .banner { display: none !important; }
.lock { position: fixed; inset: 0; z-index: 50; background: #061A2F; overflow: auto; color: #E6F1FA;
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='420' height='420' viewBox='0 0 420 420'%3E%3Cg fill='none' stroke-width='1'%3E%3Ccircle cx='360' cy='40' r='60' stroke='%2311406A'/%3E%3Ccircle cx='360' cy='40' r='110' stroke='%230F3A61'/%3E%3Ccircle cx='360' cy='40' r='160' stroke='%230D3456'/%3E%3Ccircle cx='360' cy='40' r='210' stroke='%230B2E4D'/%3E%3Ccircle cx='360' cy='40' r='260' stroke='%230A2944'/%3E%3C/g%3E%3C/svg%3E"),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 390 180' preserveAspectRatio='none'%3E%3Cpath d='M0 70 C 70 40 130 100 200 70 S 330 40 390 66 L390 180 L0 180 Z' fill='%230A2A4A'/%3E%3Cpath d='M0 104 C 80 80 150 130 230 104 S 340 84 390 100 L390 180 L0 180 Z' fill='%230C3358'/%3E%3Cpath d='M0 138 C 90 120 170 158 250 138 S 350 124 390 134 L390 180 L0 180 Z' fill='%230F3E69'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right top, left bottom; background-size: auto, 100% 180px; }
.lock[hidden] { display: none; }
.lock .inner { max-width: 420px; margin: 0 auto; padding: 28px 26px 80px; }
.lock .brandrow { display: flex; align-items: center; gap: 12px; }
.lock .brandrow b { font-family: var(--display); font-size: 1.35rem; color: #fff; display: block; }
.lock .brandrow small { font-size: .68rem; letter-spacing: .16em; text-transform: uppercase; color: #8FB4D4; }
.lock h2 { font-family: var(--display); font-weight: 600; font-size: 1.9rem; line-height: 1.15; color: #fff; margin: 34px 0 8px; }
.lock p.sub { color: var(--mist); margin: 0 0 22px; font-size: .95rem; line-height: 1.5; }
.lock .box { background: rgba(9,40,68,.75); border: 1px solid #16496F; border-radius: 22px; padding: 20px; }
.lock label.field { color: #8FB4D4; }
.lock label.field input, .lock label.field select { background: #071F38; border-color: #1E5A85; color: #F0F7FC; }
.lock .btn.primary { background: var(--sky); border-color: var(--sky); color: #04233F; font-family: var(--display); box-shadow: none; }
.rules { list-style: none; padding: 0; margin: 8px 0 0; font-size: .8rem; color: var(--mist); }
.rules li::before { content: '○ '; } .rules li.ok { color: #86EFAC; } .rules li.ok::before { content: '✓ '; }
.lock .err { color: #FCA5A5; font-size: .86rem; min-height: 1.1em; margin: 4px 0; }
.lock .muted { color: var(--mist); }
.linkbtn { background: none; border: 0; color: var(--aqua); font: inherit; font-size: .9rem; cursor: pointer; padding: 10px 0; }
.langpick { display: flex; gap: 6px; justify-content: flex-end; }
.langpick button { background: transparent; border: 1px solid #1E5A85; color: var(--mist); border-radius: 10px; min-width: 44px; min-height: 36px; font: inherit; font-size: .8rem; font-weight: 600; cursor: pointer; }
.langpick button.on { background: var(--sky); border-color: var(--sky); color: #04233F; }
.lock .foot { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 26px; font-size: .78rem; color: var(--mist); }

/* ---------- treasure chest: golden page ---------- */
body.gold { background: #08121F; color: #F3E7C9; }
body.gold .topbar { background-color: #08121F; background-image: none; }
body.gold main { background: radial-gradient(circle at 50% 0%, rgba(90,64,14,.55), rgba(8,18,31,0) 60%); }
body.gold .card { background: #111B29; border-color: #2B2410; box-shadow: none; color: #F3E7C9; }
body.gold .muted { color: #C9B98F; }
body.gold .list li { border-color: #1E2836; }
body.gold .btn { background: #15110A; border-color: #5A4415; color: var(--gold-hi); }
body.gold .tabs { background: #0F1A28; border: 1px solid #22303F; box-shadow: none; }
.chest-hero { position: relative; text-align: center; padding: 6px 10px 14px; margin-bottom: 8px; }
.chest-hero svg.chest { width: 150px; height: 118px; }
.chest-hero .lbl { font-size: .74rem; letter-spacing: .16em; text-transform: uppercase; color: #C9A34E; margin-top: 4px; }
.chest-hero .total { font-family: var(--display); font-weight: 700; font-size: 2.5rem; letter-spacing: -0.5px; margin: 4px 0;
  background: linear-gradient(180deg, #FFF4C7 0%, #F2C95E 45%, #C8922A 56%, #F6D98A 100%); -webkit-background-clip: text; background-clip: text; color: transparent; }
.chest-hero .chg { font-size: .9rem; } .chest-hero .chg.up { color: #9BE7B0; } .chest-hero .chg.down { color: #FFB4A8; }
.gold-btn { background: var(--gold) !important; border-color: var(--gold) !important; color: var(--gold-ink) !important; font-family: var(--display); box-shadow: 0 10px 24px rgba(230,181,71,.22); }
.acct-ico { width: 36px; height: 36px; border-radius: 11px; display: flex; align-items: center; justify-content: center; background: #2A2110; color: var(--gold-hi); flex: none; }
.acct-ico svg { width: 18px; height: 18px; }
body.gold .sharebar { background: #1E2836; }
body.gold .amt { color: var(--gold-hi); }
.gap-ok { color: #9BE7B0; font-weight: 600; } .gap-bad { color: #F5B970; font-weight: 600; }
body:not(.gold) .gap-ok { color: var(--good); } body:not(.gold) .gap-bad { color: #B45309; }

/* v1.6 additions */
.hero .big.dim { opacity: .55; }
.langpick.light { justify-content: flex-start; flex-wrap: wrap; }
.langpick.light button { border-color: var(--line2); color: var(--ink); background: #fff; padding: 0 14px; font: inherit; }
.langpick.light button.on { background: var(--ocean); border-color: var(--ocean); color: #fff; }
.acct-ico.sm { width: 26px; height: 26px; border-radius: 8px; background: #E6F1F9; color: var(--ocean); }
.acct-ico.sm svg { width: 15px; height: 15px; }
body.gold .acct-ico.sm { background: #2A2110; color: var(--gold-hi); }
.btn.small svg { width: 16px; height: 16px; }
.foot svg { width: 15px; height: 15px; }
.lock .btn.primary svg { width: 18px; height: 18px; }
body.gold label.field input { background: #0B1420; border-color: #3A2F14; color: #F3E7C9; }
body.gold label.field { color: #C9B98F; }
.keybox { font-family: ui-monospace, 'SFMono-Regular', Menlo, monospace; font-size: 1.15rem; font-weight: 700; letter-spacing: .06em; text-align: center; background: #E6F1F9; color: var(--navy); border: 1px dashed var(--ocean); border-radius: 12px; padding: 14px 8px; user-select: all; word-break: break-all; }
.herorow { display: flex; align-items: center; gap: 10px; }
.heronav { background: rgba(255,255,255,.08); border: 1px solid #1B4C76; color: #A9C6DE; border-radius: 9px; width: 30px; height: 26px; font-size: .7rem; cursor: pointer; padding: 0; }
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 0; border: 1px solid var(--line2); border-radius: 14px; overflow: hidden; }
.seg label { position: relative; text-align: center; cursor: pointer; }
.seg input { position: absolute; opacity: 0; inset: 0; }
.seg span { display: block; padding: 11px 6px; font-weight: 600; font-size: .9rem; color: var(--muted); background: #fff; }
.seg input:checked + span { background: var(--ocean); color: #fff; }
.seg label + label span { border-left: 1px solid var(--line2); }
.seg input:focus-visible + span { outline: 2px solid var(--sky); outline-offset: -3px; }
