/* FRAME Budget Tracker — black + white + FRAME gold, same palette as the billboard app. */
:root {
  --black: #0d0d0d;
  --ink: #1a1a1a;
  --panel: #ffffff;
  --bg: #f4f5f7;
  --line: #e3e6ea;
  --muted: #6b7280;
  --gold: #fec919;          /* accent + fills only, never text on white */
  --gold-hover: #e5b100;
  --go: #1f8a4c; --go-bg: #d6f0df;
  --warn: #9a6b00; --warn-bg: #fdeecb;
  --no: #b4232a; --no-bg: #fbdce0;
  /* Chart series (validated pair: CVD-separated, inside the lightness band). */
  --s-before: #2f5fa8;
  --s-added: #d19a00;
  --s-pace: #1a1a1a;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: var(--ink); background: var(--bg); font-size: 14px; line-height: 1.45;
}

/* ── top bar + tabs ──────────────────────────────────────────────────────── */
.topbar {
  background: var(--black); color: #fff; display: flex; align-items: center;
  justify-content: space-between; padding: 0 22px; height: 58px; position: sticky; top: 0; z-index: 30;
}
.brand { display: flex; align-items: center; gap: 12px; }
.mark { height: 30px; display: block; }
.divider { color: #555; font-weight: 300; }
.product { font-weight: 600; font-size: 15px; color: #e8e8e8; }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.who-chip { color: #9aa0a6; font-size: 12.5px; font-weight: 600; }
.who-chip b { color: var(--gold); }
.top-btn {
  background: #1a1a1a; color: #fff; border: 1px solid #3a3a3a; border-radius: 6px;
  font: inherit; font-size: 12px; font-weight: 600; padding: 5px 10px; cursor: pointer;
}
.top-btn:hover { border-color: var(--gold); color: var(--gold); }
.tabs { display: flex; gap: 2px; background: var(--ink); padding: 0 14px; position: sticky; top: 58px; z-index: 29; overflow-x: auto; }
.tab {
  background: none; border: none; color: #b9bcc0; font: inherit; font-size: 13.5px; font-weight: 600;
  padding: 11px 16px; cursor: pointer; border-bottom: 3px solid transparent; white-space: nowrap;
}
.tab:hover { color: #fff; }
.tab.active { color: #fff; border-bottom-color: var(--gold); }

/* ── layout ──────────────────────────────────────────────────────────────── */
main { max-width: 1180px; margin: 0 auto; padding: 22px 16px 60px; }
.view { display: none; }
.view.active { display: block; }
.view-head { margin-bottom: 16px; }
.view-head h1 { font-size: 22px; margin: 0 0 6px; font-weight: 800; letter-spacing: -.2px; }
.lede { color: #4b5563; font-size: 13.5px; margin: 0; max-width: 78ch; }
.row-between { display: flex; justify-content: space-between; align-items: flex-end; gap: 14px; flex-wrap: wrap; }
.row-end { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }
.pad { padding: 12px 14px; align-items: center; }
.controls { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.ctl { display: flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; color: #4b5563; }
.ctl-sep { flex: 1; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.loading { color: var(--muted); padding: 30px; text-align: center; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; overflow-x: auto; }
.notice { background: var(--warn-bg); color: #5c4000; border-radius: 8px; padding: 10px 12px; font-size: 13px; }
.problems { background: var(--no-bg); color: #6d1419; border-radius: 8px; padding: 10px 12px; font-size: 13px; margin-bottom: 10px; }
.problems ul { margin: 4px 0 0; padding-left: 18px; }

input, select, textarea {
  font: inherit; font-size: 13.5px; border: 1px solid #cfd4da; border-radius: 6px; padding: 6px 8px;
  background: #fff; color: var(--ink);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--gold); outline-offset: 0; border-color: var(--ink); }
textarea { width: 100%; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12.5px; }
.btn {
  background: #fff; color: var(--ink); border: 1px solid #cfd4da; border-radius: 6px; font: inherit;
  font-size: 13px; font-weight: 600; padding: 7px 12px; cursor: pointer; text-decoration: none; display: inline-block;
}
.btn:hover { border-color: var(--ink); }
.btn-gold { background: var(--gold); border-color: var(--gold); color: var(--black); }
.btn-gold:hover { background: var(--gold-hover); border-color: var(--gold-hover); }
.btn:disabled { opacity: .5; cursor: default; }
.file-btn input { display: none; }
.paste-box { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 12px; margin-bottom: 12px; }

/* ── entry grids ─────────────────────────────────────────────────────────── */
.grid { width: 100%; border-collapse: collapse; }
.grid th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted);
  padding: 10px 14px; border-bottom: 1px solid var(--line); background: #fafbfc; }
.grid td { padding: 7px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.grid tfoot td { font-weight: 700; border-bottom: none; }
.grid .num { text-align: right; }
.grid input.money { width: 160px; text-align: right; }
.grid input.name { width: 200px; }
.grid input.note { width: 100%; min-width: 180px; }
.grid tr.changed td { background: #fffaf0; }
.grid tr.unknown td:first-child::after { content: "not in the budget"; margin-left: 8px; font-size: 11px;
  font-weight: 700; color: var(--warn); background: var(--warn-bg); padding: 1px 6px; border-radius: 10px; }
.x-btn { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 16px; }
.x-btn:hover { color: var(--no); }
.total { font-weight: 700; margin-right: 12px; }
.history { margin-top: 14px; font-size: 13px; }
.history summary { cursor: pointer; font-weight: 600; color: #4b5563; }
.history table { margin-top: 8px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; }

/* ── login ───────────────────────────────────────────────────────────────── */
.login-overlay { position: fixed; inset: 0; background: rgba(13,13,13,.92); display: flex; align-items: center;
  justify-content: center; z-index: 100; padding: 16px; }
.login-card { background: #fff; border-radius: 12px; padding: 26px; width: 100%; max-width: 360px; }
.login-card .mark { height: 40px; margin-bottom: 14px; }
.login-card h2 { margin: 0 0 6px; font-size: 18px; }
.login-card p { margin: 0 0 14px; color: #4b5563; font-size: 13px; }
.login-card label { display: block; font-size: 12px; font-weight: 600; color: #4b5563; margin-bottom: 10px; }
.login-card input { width: 100%; margin-top: 4px; }
.login-card .err { color: var(--no); font-size: 12.5px; min-height: 18px; margin-bottom: 6px; }
.login-card .btn { width: 100%; }

.toast { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff;
  padding: 10px 16px; border-radius: 8px; font-size: 13px; opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 120; }
.toast.show { opacity: 1; }
.toast.bad { background: var(--no); }

/* ── the deck: 16:9 slides, sized from their own width ───────────────────── */
#deck { display: flex; flex-direction: column; gap: 18px; }
.slide {
  container-type: inline-size; width: 100%; aspect-ratio: 16 / 9; background: #fff; position: relative;
  border-radius: 6px; box-shadow: 0 1px 3px rgba(0,0,0,.08); overflow: hidden; border-top: 1cqw solid var(--gold);
}
.slide-in { position: absolute; inset: 4.5cqw 4.5cqw 3cqw; display: flex; flex-direction: column; }
.slide h2 { font-size: 2.6cqw; margin: 0; font-weight: 800; letter-spacing: -.02em; }
.slide .sub { font-size: 1.15cqw; color: var(--muted); margin: .4cqw 0 2cqw; }
.slide .foot { position: absolute; right: 4.5cqw; bottom: 1.8cqw; font-size: .9cqw; font-weight: 700; color: var(--muted); letter-spacing: .05em; }
.slide.cover { background: var(--black); color: #fff; border-top: none; }
.cover .slide-in { justify-content: center; }
.cover .mark { height: 6cqw; width: auto; align-self: flex-start; margin-bottom: 4cqw; }
.cover .rule { width: 9cqw; height: .8cqw; background: var(--gold); margin-bottom: 2cqw; }
.cover h2 { font-size: 5.4cqw; }
.cover .when { font-size: 2.2cqw; color: #d1d5db; margin-top: .6cqw; }
.cover .headline { font-size: 1.8cqw; font-weight: 700; color: var(--gold); margin-top: 5cqw; }

.tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.6cqw; }
.tile { background: var(--bg); border-radius: .6cqw; padding: 1.4cqw 1.6cqw; }
.tile .k { font-size: .95cqw; font-weight: 700; color: var(--muted); letter-spacing: .05em; text-transform: uppercase; }
.tile .v { font-size: 2.9cqw; font-weight: 800; margin: .3cqw 0; letter-spacing: -.02em; }
.tile .s { font-size: 1.05cqw; color: var(--muted); }
.tile .s.go { color: var(--go); font-weight: 700; }
.tile .s.no { color: var(--no); font-weight: 700; }

.bar-title { font-size: 1.3cqw; font-weight: 700; margin: 3cqw 0 1cqw; }
.track { position: relative; height: 3.4cqw; background: var(--line); border-radius: .4cqw; display: flex; gap: 2px; overflow: visible; }
.seg { height: 100%; }
.seg.before { background: var(--s-before); border-radius: .4cqw 0 0 .4cqw; }
.seg.added { background: var(--s-added); }
.pace-tick { position: absolute; top: -.7cqw; bottom: -.7cqw; width: 2px; background: var(--s-pace); }
.legend { display: flex; flex-wrap: wrap; gap: .6cqw 2cqw; font-size: 1.05cqw; color: #4b5563; margin-top: 1.2cqw; }
.legend i { display: inline-block; width: 1cqw; height: 1cqw; border-radius: 2px; vertical-align: -.1cqw; margin-right: .5cqw; }
.legend i.tick { width: 2px; }
.callout { font-size: 1.35cqw; font-weight: 700; margin-top: 2cqw; }

.deck-table { width: 100%; border-collapse: collapse; font-size: 1.15cqw; }
.deck-table th { background: var(--black); color: #fff; text-align: right; padding: .7cqw .9cqw; font-weight: 600; }
.deck-table td { text-align: right; padding: .65cqw .9cqw; border-bottom: 1px solid var(--line); }
.deck-table th:first-child, .deck-table td:first-child { text-align: left; }
.deck-table tr.total td { font-weight: 800; background: var(--bg); border-bottom: none; }
.deck-table .added { font-weight: 700; }
.deck-table .go { color: var(--go); }
.deck-table .no { color: var(--no); }
.deck-table .flag { font-size: .85cqw; font-weight: 700; color: var(--warn); margin-left: .5cqw; }

.mbars { display: flex; flex-direction: column; gap: 1.2cqw; margin-top: .4cqw; }
.mbar { display: grid; grid-template-columns: 14cqw 1fr 13cqw; align-items: center; gap: 1.2cqw; font-size: 1.15cqw; }
.mbar .name { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mbar .track { height: 1.8cqw; }
.mbar .val { font-weight: 700; }
.mbar .val span { color: var(--muted); font-weight: 500; }

.trend { width: 100%; flex: 1; min-height: 0; }
.trend text { font-family: inherit; }
.notes { font-size: 1.5cqw; line-height: 1.5; margin: 0; padding-left: 2cqw; }
.notes li { margin-bottom: .6cqw; }
.empty-slide { color: var(--muted); font-size: 1.4cqw; margin-top: 2cqw; }
.tip { position: fixed; pointer-events: none; background: var(--ink); color: #fff; font-size: 12px; padding: 6px 9px;
  border-radius: 6px; z-index: 200; display: none; white-space: nowrap; }

@media (max-width: 720px) {
  .grid input.money { width: 110px; }
  .grid input.name { width: 130px; }
}

/* ── print: one slide per landscape page, nothing else ───────────────────── */
@media print {
  @page { size: 13.333in 7.5in; margin: 0; }
  body { background: #fff; }
  .topbar, .tabs, .view-head, .toast, .view:not(#view-deck) { display: none !important; }
  main { max-width: none; padding: 0; margin: 0; }
  #view-deck { display: block !important; }
  #deck { gap: 0; }
  .slide { width: 13.333in; height: 7.5in; aspect-ratio: auto; border-radius: 0; box-shadow: none;
    break-after: page; page-break-after: always; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .slide:last-child { break-after: auto; page-break-after: auto; }
}
