/* Ported from Budgeting Tool.html's <style> block (lines 1-225) for visual parity
   per the "UI/visual parity pass" dev spec (2026-08-04). Class names match the
   artifact 1:1 so app.js's render functions can reuse the artifact's exact markup. */
:root{
  --green-bg:#C6EFCE; --green-text:#006100;
  --red-bg:#FFC7CE; --red-text:#9C0006;
  --highlight-bg:#e7f7ea;
  --accent:#2563eb; --accent-dark:#1d4ed8;
  --bg:#f4f5f7; --panel:#ffffff; --border:#dde1e6;
  --text:#1f2430; --muted:#6b7280;
  /* Estimated from header.appbar's current content height (nav.tabs buttons at
     14px padding + 14px font-size are the tallest child, plus the header's own
     1px border-bottom) — 2026-08-04 frozen-header spec. Not pixel-measured against
     a live render; nudge this if the grid header ends up with a visible gap under
     the nav bar, or slightly overlapping it. */
  --appbar-height:54px;
}
*{box-sizing:border-box;}
body{margin:0;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Helvetica,Arial,sans-serif;background:var(--bg);color:var(--text);}
header.appbar{background:var(--panel);border-bottom:1px solid var(--border);padding:0 16px;display:flex;align-items:center;gap:4px;flex-wrap:wrap;position:sticky;top:0;z-index:20;}
header.appbar h1{font-size:16px;font-weight:700;margin:0;padding:12px 16px 12px 0;white-space:nowrap;}
nav.tabs{display:flex;gap:2px;flex-wrap:wrap;}
nav.tabs button{background:none;border:none;padding:14px 14px;font-size:14px;cursor:pointer;color:var(--muted);border-bottom:3px solid transparent;font-family:inherit;}
nav.tabs button.active{color:var(--accent-dark);border-bottom-color:var(--accent);font-weight:600;}
nav.tabs button:hover{color:var(--accent-dark);}
.spacer{flex:1;}
.btn{background:var(--accent);color:#fff;border:none;border-radius:6px;padding:9px 14px;font-size:13px;cursor:pointer;font-weight:600;font-family:inherit;}
.btn:hover{background:var(--accent-dark);}
.btn.secondary{background:#fff;color:var(--text);border:1px solid var(--border);}
.btn.secondary:hover{background:#f0f1f3;}
.btn.danger{background:#fff;color:var(--red-text);border:1px solid var(--red-bg);}
.btn.danger:hover{background:var(--red-bg);}
.btn.small{padding:5px 9px;font-size:12px;border-radius:5px;}
.btn:disabled{opacity:.45;cursor:not-allowed;}
main{max-width:1200px;margin:0 auto;padding:20px 16px 60px;}
.panel{background:var(--panel);border:1px solid var(--border);border-radius:10px;padding:18px;margin-bottom:18px;}
.panel h2{margin:0 0 14px;font-size:16px;}
.panel h3{margin:18px 0 10px;font-size:14px;color:var(--muted);text-transform:uppercase;letter-spacing:.03em;}
.row{display:flex;gap:10px;align-items:center;flex-wrap:wrap;}
.row.between{justify-content:space-between;}
label.field{display:flex;flex-direction:column;gap:4px;font-size:12px;color:var(--muted);}
label.field input, label.field select, label.field textarea{font-size:14px;padding:7px 9px;border:1px solid var(--border);border-radius:6px;font-family:inherit;}
table{border-collapse:collapse;width:100%;font-size:13px;}
table.grid th, table.grid td{border:1px solid var(--border);padding:6px 8px;text-align:center;white-space:nowrap;}
/* top/z-index/box-shadow (2026-08-04 frozen-header spec): was top:0 with no z-index —
   correct while each grid had its own internal scroll (.scrollwrap), but now that the
   page scrolls instead (.grid-frame), top:0 pinned this directly under the sticky nav
   bar (header.appbar, z-index:20) instead of below it, hiding it during scroll. */
table.grid th{background:#f8f9fb;position:sticky;top:var(--appbar-height);z-index:5;box-shadow:0 2px 4px -2px rgba(0,0,0,.08);}
.th-label{display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;text-overflow:ellipsis;white-space:normal;word-break:normal;overflow-wrap:break-word;line-height:1.3;max-width:110px;margin:0 auto;}
table.grid th.rowhead .th-label, table.grid th.total .th-label{margin:0;}
table.grid td.rowhead, table.grid th.rowhead{text-align:left;position:sticky;left:0;background:#f8f9fb;font-weight:600;}
table.grid th.rowhead.grid-corner{background:#fff;}
/* Month-label centering (2026-08-04 grid-fit spec): scoped to this modifier, not the
   base .rowhead rule, so Tax Report's category-name rowheads stay left-aligned. */
table.grid td.rowhead.month-label, table.grid th.rowhead.month-label{text-align:center;}
table.grid td.cell{cursor:pointer;}
table.grid td.cell:hover{outline:2px solid var(--accent);outline-offset:-2px;}
table.grid td.nonzero{background:var(--highlight-bg);}
table.grid td.total, table.grid th.total{font-weight:700;background:#f0f2f5;}
/* fit-table (2026-08-04 grid-fit spec): used only by the Venture Simple grid and its
   Settings preview, never by Tax Reports. table-layout:fixed plus wrapping (instead of
   nowrap) lets the table always fit its container width with no horizontal scroll —
   a too-narrow column grows the row taller instead of overflowing. */
table.grid.fit-table{table-layout:fixed;}
table.grid.fit-table th, table.grid.fit-table td{white-space:normal;word-break:break-word;}
.scrollwrap{overflow:auto;max-height:70vh;border:1px solid var(--border);border-radius:8px;}
/* grid-frame (2026-08-04 grid-fit spec): used only by the Venture grids (Simple + Rich)
   and their Settings previews. Same border treatment as .scrollwrap, but intentionally
   has no overflow/max-height — these grids always render at full size, never scroll. */
.grid-frame{border:1px solid var(--border);border-radius:8px;}
.figure-box{padding:16px;border-radius:8px;text-align:center;flex:1;min-width:150px;}
.figure-box .label{font-size:12px;color:var(--muted);text-transform:uppercase;letter-spacing:.03em;}
.figure-box .value{font-size:24px;font-weight:700;margin-top:6px;}
.good{background:var(--green-bg);color:var(--green-text);}
.bad{background:var(--red-bg);color:var(--red-text);}
.neutral{background:#eef1f5;color:var(--text);}
.hidden{display:none !important;}
.modal-overlay{position:fixed;inset:0;background:rgba(20,22,28,.45);display:flex;align-items:flex-start;justify-content:center;padding:40px 16px;overflow:auto;z-index:100;}
.modal-overlay.hidden{display:none;}
.modal-content{background:#fff;border-radius:10px;max-width:640px;width:100%;padding:22px;box-shadow:0 20px 60px rgba(0,0,0,.25);position:relative;}
.modal-content h2{margin-top:0;}
.close-x{position:absolute;top:10px;right:14px;background:none;border:none;font-size:20px;cursor:pointer;color:var(--muted);}
.cat-grid{display:flex;flex-wrap:wrap;gap:8px;margin:6px 0 4px;}
.cat-grid button{border:1px solid var(--border);background:#fff;padding:8px 12px;border-radius:20px;font-size:13px;cursor:pointer;font-family:inherit;}
.cat-grid button.selected{background:var(--accent);color:#fff;border-color:var(--accent);}
.quickpicks{display:flex;flex-wrap:wrap;gap:6px;margin-top:4px;}
.quickpicks button{font-size:12px;padding:4px 9px;border-radius:14px;border:1px dashed var(--border);background:#fafbfc;cursor:pointer;font-family:inherit;}
.txn-line{display:flex;justify-content:space-between;align-items:center;padding:8px 10px;border-radius:5px;gap:8px;}
.txn-line:nth-child(even){background:#F7F7F9;}
.txn-text{font-size:13px;flex:1;}

.modal-title-band{background:#0C447C;margin:-22px -22px 18px -22px;padding:16px 22px;border-radius:10px 10px 0 0;position:relative;}
.modal-title-band h2{margin:0;color:#fff;font-size:16px;}
.modal-title-band .band-subtitle{color:#B5D4F4;font-size:12px;margin-top:5px;}
.close-x.on-band{color:#fff;}
.close-x.on-band:hover{color:#e6f0ff;}
.btn.on-band{background:rgba(255,255,255,.15);color:#fff;border:1px solid rgba(255,255,255,.55);}
.btn.on-band:hover{background:rgba(255,255,255,.28);}
.field-group{border-radius:8px;padding:12px;}
.fg-venture{background:#EAF1FC;}
.fg-venture label.field, .fg-venture > .field{color:#0C447C;}
.fg-category{background:#F1EEFD;}
.fg-category label.field, .fg-category > .field{color:#3C3489;}
.fg-date{background:#EEF7EC;}
.fg-date label.field, .fg-date > .field{color:#27500A;}
.fg-desc{background:#FDF3E3;}
.fg-desc label.field, .fg-desc > .field{color:#854F0B;}

.good-text{color:var(--green-text);}
.bad-text{color:var(--red-text);}
.stepper{display:flex;align-items:center;gap:10px;position:relative;z-index:45;}
.stepper-btn{width:38px;height:38px;border-radius:50%;border:1px solid var(--border);background:#fff;font-size:18px;line-height:1;cursor:pointer;display:flex;align-items:center;justify-content:center;color:var(--text);}
.stepper-btn:hover{background:#f0f1f3;border-color:var(--accent);color:var(--accent-dark);}
.stepper-value{min-width:80px;text-align:center;font-weight:700;font-size:15px;background:none;border:none;font-family:inherit;padding:0;cursor:pointer;}
.stepper-value:hover{color:var(--accent-dark);}
.signedin-badge{display:inline-block;padding:4px 10px;border-radius:14px;border:1.5px solid var(--green-text);color:var(--green-text);font-weight:600;background:#fff;}
.chip{border-radius:16px;padding:7px 14px;font-size:13px;font-weight:600;cursor:pointer;border:1.5px solid var(--border);background:#fff;color:var(--muted);font-family:inherit;}
.chip.on{color:#fff;border-color:transparent;}
.toggle-switch{display:inline-flex;border:1px solid var(--border);border-radius:20px;overflow:hidden;font-size:12px;}
.toggle-switch button{border:none;background:#fff;padding:6px 13px;cursor:pointer;color:var(--muted);font-family:inherit;}
.toggle-switch button.active{background:var(--accent);color:#fff;font-weight:600;}
.toggle-switch.mini{font-size:11px;}
.toggle-switch.mini button{padding:3px 10px;}
.cell-preview{border:1px solid var(--border);border-radius:8px;padding:12px;background:#f9fafb;margin-bottom:18px;max-width:460px;}
.cell-preview .scrollwrap{max-height:none;}
/* Tip of the Day (2026-08-05 dev spec) — modeled on .panel/.chart-card, not inline-styled. */
.tip-card{background:var(--panel);border:1px solid var(--border);border-radius:10px;padding:18px;margin-bottom:18px;}
.tip-card-header{display:flex;align-items:center;justify-content:space-between;}
.tip-card-label{font-size:11px;font-weight:700;text-transform:uppercase;letter-spacing:.04em;color:var(--muted);}
.tip-card-collapse-btn{background:none;border:1px solid var(--border);border-radius:6px;width:26px;height:26px;cursor:pointer;color:var(--muted);font-size:12px;line-height:1;}
.tip-card-collapse-btn:hover{color:var(--accent-dark);border-color:var(--accent);}
.tip-card-body{display:flex;align-items:center;gap:18px;margin-top:14px;}
.tip-card-icon{flex:0 0 auto;display:flex;align-items:center;justify-content:center;}
.tip-card-text h4{margin:0 0 4px;font-size:14px;}
.tip-card-text p{margin:0;font-size:13px;color:var(--text);line-height:1.5;}
.tip-card-actions{display:flex;justify-content:flex-end;margin-top:12px;}

.chart-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(230px,1fr));gap:16px;}
.chart-card{background:#fff;border:1px solid var(--border);border-radius:10px;padding:16px;text-align:center;}
.chart-card h3{margin:0 0 12px;font-size:14px;}
.donut-wrap{position:relative;display:inline-block;}
.donut-center{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);text-align:center;pointer-events:none;}
.donut-center .amt{font-size:15px;font-weight:700;}
.donut-center .lbl{font-size:10px;color:var(--muted);text-transform:uppercase;letter-spacing:.03em;}
.chart-legend{display:flex;flex-direction:column;gap:5px;margin-top:12px;font-size:12px;text-align:left;}
.legend-row{display:flex;align-items:center;gap:6px;justify-content:space-between;}
.legend-label{display:flex;align-items:center;gap:6px;flex:1;min-width:0;}
.legend-label span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}
.legend-swatch{width:10px;height:10px;border-radius:3px;display:inline-block;flex-shrink:0;}
.bar-row{display:flex;align-items:center;gap:8px;margin-bottom:7px;font-size:12px;}
.bar-row .bar-label{width:104px;text-align:right;flex-shrink:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}
.bar-track{flex:1;background:#f0f1f3;border-radius:4px;height:14px;overflow:hidden;}
.bar-fill{height:100%;border-radius:4px;}
.bar-value{width:68px;text-align:left;flex-shrink:0;font-weight:600;}

.rich-grid{display:grid;gap:8px;}
/* overflow/text-overflow (2026-08-04 grid-fit spec): once columns can shrink below their
   old 96px floor, a compressed cell truncates its value/name with an ellipsis instead of
   clipping mid-character. */
.rg-cell{border-radius:8px;padding:9px 10px;text-align:center;font-size:13px;white-space:nowrap;background:#fff;overflow:hidden;text-overflow:ellipsis;}
/* top/box-shadow (2026-08-04 frozen-header spec): same fix as table.grid th above —
   docks below the sticky nav bar instead of being hidden underneath it. */
.rg-header{background:transparent;color:var(--muted);text-transform:uppercase;font-size:11px;letter-spacing:.04em;font-weight:700;position:sticky;top:var(--appbar-height);z-index:3;padding:6px 8px;box-shadow:0 2px 4px -2px rgba(0,0,0,.08);}
.rg-header.rg-total{color:var(--accent-dark);font-weight:800;}
.rg-corner{left:0;z-index:4;background:#fff;}
/* text-align:center (2026-08-04 grid-fit spec): was left. Sticky/box-shadow are now
   inert since these grids no longer scroll, but left in place — harmless dead CSS, not
   worth stripping out for this spec. */
.rg-month{background:#fff;font-weight:700;text-align:center;position:sticky;left:0;z-index:2;box-shadow:2px 0 4px -2px rgba(0,0,0,.08);}
.rg-header, .rg-month{white-space:normal;word-break:normal;overflow-wrap:break-word;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;text-overflow:ellipsis;line-height:1.3;}
.rg-data{cursor:pointer;}
.rg-data:hover{outline:2px solid var(--accent);outline-offset:-2px;}
.rg-data.value{background:var(--highlight-bg);}
.rg-data.null{background:#eceef1;}
.rg-total-cell{background:#f0f2f5;font-weight:700;}

.picker-scrim{position:fixed;inset:0;z-index:40;background:transparent;}
.picker-panel{position:absolute;top:calc(100% + 8px);left:50%;transform:translateX(-50%);background:#fff;border:1px solid var(--border);border-radius:10px;box-shadow:0 12px 30px rgba(0,0,0,.15);padding:10px;z-index:50;width:max-content;}
.picker-btn{padding:7px 10px;border-radius:6px;border:1px solid var(--border);background:#fff;cursor:pointer;font-size:12.5px;font-family:inherit;}
.picker-btn:hover{border-color:var(--accent);}
.picker-btn.selected{background:var(--accent);color:#fff;border-color:var(--accent);}
.picker-grid-month{display:grid;grid-template-columns:repeat(3,1fr);gap:6px;}
.picker-grid-year{display:grid;grid-template-columns:repeat(4,1fr);gap:6px;}
.picker-year-header{display:flex;align-items:center;justify-content:space-between;gap:14px;margin-bottom:8px;}
.banner{background:#fff8e1;border-bottom:1px solid #f0dca0;color:#7a5c00;padding:9px 16px;font-size:13px;display:flex;justify-content:space-between;align-items:center;gap:10px;}
.banner button{background:none;border:none;font-size:16px;cursor:pointer;color:#7a5c00;}
.banner-inline{background:#fff8e1;border:1px solid #f0dca0;color:#7a5c00;padding:9px 12px;border-radius:6px;margin-bottom:10px;font-size:13px;}
.profile-picker-list{display:flex;flex-direction:column;gap:8px;}
.profile-picker-row{display:flex;align-items:center;gap:12px;width:100%;background:#fff;border:1px solid #dde1e6;border-radius:8px;padding:12px 16px;cursor:pointer;box-sizing:border-box;transition:border-color .12s,background .12s;}
.profile-picker-row:hover{border-color:#b7bfc9;background:#f7f8fa;}
.profile-badge{flex:none;width:34px;height:34px;border-radius:50%;display:flex;align-items:center;justify-content:center;color:#fff;font-size:12px;font-weight:700;letter-spacing:.02em;}
.profile-picker-text{display:flex;flex-direction:column;gap:1px;min-width:0;}
.profile-picker-org{font-size:14px;font-weight:600;color:var(--text);}
.profile-picker-type{font-size:12px;color:#6b7280;}
.msg{font-size:13px;padding:9px 12px;border-radius:6px;margin-bottom:10px;}
.msg.error{background:var(--red-bg);color:var(--red-text);}
.msg.info{background:#e6f0ff;color:#1d4ed8;}
.msg.success{background:var(--green-bg);color:var(--green-text);}
.archived-tag{font-size:11px;color:var(--muted);background:#eef1f5;padding:2px 6px;border-radius:4px;margin-left:6px;}
.empty-state{color:var(--muted);font-size:14px;padding:30px 0;text-align:center;}
.venture-card{border:1px solid var(--border);border-radius:8px;padding:12px 14px;margin-bottom:10px;}
.cat-row{display:flex;align-items:center;gap:10px;padding:6px 0;border-bottom:1px solid #eef0f3;font-size:13px;}
.cat-row:last-child{border-bottom:none;}
.cat-row .name{flex:1;}
.tag-list{display:flex;flex-wrap:wrap;gap:6px;}
.tag{background:#eef1f5;border-radius:14px;padding:4px 10px;font-size:12px;display:flex;align-items:center;gap:6px;}
.tag button{border:none;background:none;cursor:pointer;color:var(--muted);font-size:13px;line-height:1;}
form .stack{display:flex;flex-direction:column;gap:12px;}
hr.sep{border:none;border-top:1px solid var(--border);margin:16px 0;}
@media print{
  header.appbar, .banner, .no-print, #introOverlay{display:none !important;}
  body{background:#fff;}
  main{max-width:100%;padding:0;}
  .panel{border:none;box-shadow:none;}
}

.settings-sidebar{flex:none;width:190px;display:flex;flex-direction:column;gap:2px;}
.settings-nav-item{display:block;width:100%;text-align:left;background:none;border:none;border-radius:6px;padding:10px 12px;font-size:14px;cursor:pointer;color:var(--text);font-family:inherit;}
.settings-nav-item:hover{background:#f0f1f3;}
.settings-nav-item.active{background:var(--accent);color:#fff;font-weight:600;}
.settings-nav-item.disabled{color:var(--muted);cursor:default;opacity:.55;}

body.app-locked > header.appbar, body.app-locked > main, body.app-locked > .banner{display:none !important;}
#loginOverlay{position:fixed;inset:0;z-index:150;background:var(--bg);display:flex;align-items:center;justify-content:center;}
#loginOverlay.hidden{display:none;}
.login-card{background:#fff;border:1px solid var(--border);border-radius:10px;padding:28px 26px;width:100%;max-width:320px;box-shadow:0 12px 30px rgba(0,0,0,.1);}
.login-card h1{font-size:17px;margin:0 0 18px;text-align:center;}
.login-card label.field{margin-bottom:12px;}
.login-card .btn{width:100%;margin-top:6px;}

#introOverlay{position:fixed;inset:0;z-index:200;background:#FFFFFF;display:flex;align-items:center;justify-content:center;transition:opacity 400ms ease;cursor:pointer;}
#introOverlay.hidden{opacity:0;pointer-events:none;}
.intro-card{position:relative;width:320px;height:320px;border-radius:12px;border:1px solid var(--border);background:#fff;display:flex;align-items:center;justify-content:center;overflow:hidden;}
#introFrames{position:relative;width:260px;height:240px;}
#introFrames img{position:absolute;top:0;left:0;width:260px;height:240px;opacity:0;transition:opacity 150ms;}
#introFrames img.active{opacity:1;}
