/* T-Bank (brotherhood.ws). Mobile first; theme from theme.js (Light / Dark / Auto per device).
   Same system as music-app's app.css; T-Bank's accent is gold (money), the logo wears the BAM orange. */
:root, [data-theme=light] {
  --bg: #f5f4f0; --card: #fff; --ink: #1d2226; --mute: #6b7278; --line: #e2e0d8;
  --accent: #8a5a00; --accent-ink: #fff; --soft: #f7eed8; --plus: #237a46; --minus: #b3401e; --brand: #ef6c1a;
  --chart: #c08a14; --chart-fill: #f3e3bd;
}
[data-theme=dark] {
  --bg: #14181c; --card: #1d2328; --ink: #e8ecee; --mute: #98a3ab; --line: #2d363c;
  --accent: #f2b632; --accent-ink: #231800; --soft: #2e2817; --plus: #5cc48a; --minus: #f08a6a; --brand: #f37b2a;
  --chart: #f2b632; --chart-fill: #3a3018;
}
[data-size=large] body { font-size: 18px; }
[data-size=larger] body { font-size: 20px; }
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif; }
main { max-width: 680px; margin: 0 auto; padding: 8px 14px 40px; }
a { color: var(--accent); }
h1 { font-size: 22px; margin: 4px 0 10px; }
h2 { font-size: 17px; margin: 20px 0 8px; }
.muted { color: var(--mute); }
.small { font-size: 13px; }
.err { color: var(--minus); font-weight: 600; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px; margin-bottom: 12px; }
.narrow { max-width: 460px; margin: 24px auto; }
button, input, select { font: inherit; color: inherit; }
button, .btn { background: var(--accent); color: var(--accent-ink); border: 0; border-radius: 10px; padding: 9px 14px; cursor: pointer;
               font-weight: 600; text-decoration: none; display: inline-block; }
button.ghost, .btn.ghost { background: transparent; color: var(--accent); border: 1.5px solid var(--line); font-weight: 500; }
button.big { width: 100%; padding: 14px; font-size: 18px; margin-top: 6px; }
button.link { background: none; color: var(--accent); padding: 0; font-weight: 500; }
button:disabled { opacity: .5; }
input, select { background: var(--card); border: 1px solid var(--line); border-radius: 9px; padding: 9px 10px; min-width: 0; }
label.field { display: block; margin: 10px 0; font-size: 14px; color: var(--mute); }
label.field input, label.field select { display: block; width: 100%; margin-top: 4px; color: var(--ink); font-size: 16px; }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.spread { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.right { text-align: right; }
.hidden { display: none !important; }

/* brand bar */
.brand { max-width: 680px; margin: 0 auto; padding: 14px 14px 4px; display: flex; align-items: center; gap: 9px; }
.brand .logo { width: 32px; height: 32px; border-radius: 50%; background: var(--brand); color: #fff; font-weight: 800;
               display: inline-flex; align-items: center; justify-content: center; font-size: 18px; box-shadow: inset 0 0 0 3px rgba(255,255,255,.25); }
.brand .word { font-weight: 800; font-size: 20px; letter-spacing: -.01em; }
.brand .sub { color: var(--mute); font-size: 13px; margin-left: auto; }

/* sign in */
.who-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; margin: 6px 0 4px; }
.who { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 4px; border: 1.5px solid var(--line);
       border-radius: 12px; cursor: pointer; background: var(--card); }
.who input { position: absolute; opacity: 0; pointer-events: none; }
.who .av { width: 42px; height: 42px; border-radius: 50%; background: var(--soft); color: var(--accent); font-weight: 800; font-size: 19px;
           display: flex; align-items: center; justify-content: center; }
.who.parent .av { background: var(--line); color: var(--mute); }
.who:has(input:checked) { border-color: var(--accent); background: var(--soft); }
.who:has(input:checked) .av { background: var(--accent); color: var(--accent-ink); }
.who:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }

/* nav (segmented, top) */
nav.tabs { display: flex; gap: 4px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 4px; margin: 6px 0 12px;
           overflow-x: auto; scrollbar-width: none; }
nav.tabs a { flex: 1; text-align: center; padding: 7px 8px; border-radius: 9px; color: var(--mute); text-decoration: none; font-weight: 600;
             font-size: 14px; white-space: nowrap; }
nav.tabs a.on { background: var(--accent); color: var(--accent-ink); }
.crumb { display: inline-block; margin: 2px 0 6px; font-size: 14px; text-decoration: none; }

/* balance hero */
.hero { padding: 18px 16px 12px; }
.hero .label { color: var(--mute); font-size: 14px; }
.hero .bal { font-size: 42px; font-weight: 800; letter-spacing: -.02em; line-height: 1.1; margin: 2px 0 6px; font-variant-numeric: tabular-nums; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 10px; }
.stat { background: var(--soft); border-radius: 10px; padding: 8px 10px; }
.stat b { display: block; font-size: 17px; font-variant-numeric: tabular-nums; }
.stat span { font-size: 12px; color: var(--mute); }
.chart { width: 100%; height: 130px; display: block; margin-top: 12px; }
.chart .area { fill: var(--chart-fill); }
.chart .line { fill: none; stroke: var(--chart); stroke-width: 2.2; vector-effect: non-scaling-stroke; stroke-linejoin: round; }
.chart-labels { display: flex; justify-content: space-between; font-size: 12px; color: var(--mute); }

/* activity */
.tx { display: grid; grid-template-columns: 1fr auto; gap: 0 10px; padding: 10px 2px; border-top: 1px solid var(--line); }
.tx:first-child { border-top: 0; }
.tx .d { font-weight: 600; overflow-wrap: anywhere; }
.tx .when { font-size: 13px; color: var(--mute); }
.tx .amt { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.tx .run { text-align: right; font-size: 13px; color: var(--mute); font-variant-numeric: tabular-nums; }
.tx.interest .d { color: var(--accent); }
.tx.voided .d, .tx.voided .amt { text-decoration: line-through; color: var(--mute); }
.plus { color: var(--plus); }
.minus { color: var(--minus); }
.month-h { font-size: 13px; font-weight: 700; color: var(--mute); text-transform: uppercase; letter-spacing: .04em; margin: 16px 2px 2px; }
.pill { font-size: 11px; background: var(--soft); color: var(--accent); padding: 1px 7px; border-radius: 6px; margin-left: 4px; font-weight: 600; vertical-align: 1px; }
details.old { margin-top: 18px; }
details.old summary { cursor: pointer; color: var(--accent); font-weight: 600; }

/* statements */
.stmt-list a { display: grid; grid-template-columns: 1fr auto; padding: 11px 2px; border-top: 1px solid var(--line); color: var(--ink); text-decoration: none; }
.stmt-list a:first-child { border-top: 0; }
.stmt-list .int { font-size: 13px; color: var(--plus); text-align: right; }
.sum { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; font-variant-numeric: tabular-nums; }
.sum .tot { font-weight: 800; border-top: 1.5px solid var(--line); padding-top: 4px; }
.stmt-head { display: none; }

/* family (parent) */
.kids { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.kid { display: block; text-decoration: none; color: var(--ink); background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px; }
.kid .nm { font-weight: 700; }
.kid .b { font-size: 24px; font-weight: 800; font-variant-numeric: tabular-nums; }
.kid .s { font-size: 12px; color: var(--mute); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { border: 1.5px solid var(--line); background: var(--card); color: var(--ink); border-radius: 999px; padding: 6px 13px; font-weight: 600; font-size: 15px; }
.chip.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.seg { display: inline-flex; border: 1.5px solid var(--line); border-radius: 10px; overflow: hidden; }
.seg button { background: transparent; color: var(--mute); border-radius: 0; padding: 8px 14px; }
.seg button.on.in { background: var(--plus); color: #fff; }
.seg button.on.out { background: var(--minus); color: #fff; }
.seg button.on.plain { background: var(--accent); color: var(--accent-ink); }
.amount-in { font-size: 24px !important; font-weight: 700; font-variant-numeric: tabular-nums; }
.check { display: flex; gap: 8px; align-items: center; margin: 10px 0; }
.check input { width: 20px; height: 20px; }
.preview { background: var(--soft); border-radius: 10px; padding: 8px 10px; font-size: 14px; margin: 8px 0; }
.toast { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 10px 16px;
         border-radius: 10px; font-weight: 600; z-index: 20; max-width: 90vw; }
.rate-big { font-size: 30px; font-weight: 800; }
table.rates { width: 100%; border-collapse: collapse; font-size: 14px; }
table.rates td, table.rates th { text-align: left; padding: 7px 4px; border-top: 1px solid var(--line); }

@media print {
  body { background: #fff; color: #000; }
  .brand, nav.tabs, .crumb, .noprint, .toast { display: none !important; }
  .card { border: 0; padding: 0; }
  .stmt-head { display: block; margin-bottom: 12px; }
  main { max-width: none; }
}
