/* RouxWorth demo. Colours, spacing and type copied from the app's styles.css. */
:root {
  color-scheme: light;
  --bg: #fbf9f4; --surface: #ffffff; --border: #e3e6e1; --text: #17231d; --muted: #5d6b63;
  --brand: #153f30; --brand-2: #6d957b; --nav-active-bg: #e9f1ec; --good: #1f7a4d; --bad: #b3261e;
  --income: #1f7a4d; --expense: #c0612b; --surface-2: #f4f6f3; --fill: #f1f3ef; --track: #cfd6d0;
  --pill-good: #dcefe3; --pill-bad: #f8dedb; --pill-soft: #eef0ec; --shadow: rgba(20, 35, 28, 0.16);
  --t1: #1f7a4d; --t2: #2f6f9f; --t3: #c0612b; --t4: #6b7d72; --t5: #a8456a; --t6: #8a6a1f; --t7: #6a4fa3; --t8: #b0486f;
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; font-size: 16px; line-height: 1.5;
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #0b0f0d; --surface: #131a16; --border: #24302a; --text: #e9f1ec; --muted: #a3b5aa;
    --brand: #e9f1ec; --brand-2: #8fb89d; --nav-active-bg: #1c2a22; --good: #6fcf97; --bad: #f2a29c;
    --income: #6fcf97; --expense: #f0a46e; --surface-2: #18211c; --fill: #1b241f; --track: #34423a;
    --pill-good: #1c3a2a; --pill-bad: #3d2220; --pill-soft: #1f2a24; --shadow: rgba(0, 0, 0, 0.55);
    --t1: #6fcf97; --t2: #7db7e0; --t3: #f0a46e; --t4: #a3b5aa; --t5: #e58fb0; --t6: #d9b75f; --t7: #b7a2ee; --t8: #e58fb0;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); }
a { color: var(--brand); }
h1, h2, h3 { margin: 0; line-height: 1.2; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1rem; }
h3 { font-size: 0.8rem; margin: 18px 0 8px; color: var(--muted); font-weight: 600; letter-spacing: 0.01em; }
p { margin: 0 0 10px; }
.muted { color: var(--muted); }
.small { font-size: 0.82rem; }
.strong { font-weight: 600; }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.pos { color: var(--income); }
.neg { color: var(--expense); }
.muted-inline { color: var(--muted); font-size: 0.85em; margin-left: 4px; }
.fine { color: var(--muted); font-size: 0.82rem; margin: 10px 0 0; }
.fine.top { margin: 0 0 14px; }

/* page chrome around the window */
.site-top { max-width: 1240px; margin: 0 auto; padding: 16px 20px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand-link { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--brand); font-weight: 700; font-size: 1.2rem; letter-spacing: -0.01em; }
.brand-link img { border-radius: 8px; display: block; }
.invite-link { text-decoration: none; background: var(--brand); color: var(--bg); font-weight: 600; padding: 10px 18px; border-radius: 10px; }
.stage { max-width: 1240px; margin: 0 auto; padding: 0 20px 28px; }
.foot { text-align: center; color: var(--muted); font-size: 0.85rem; margin: 14px 0 0; }

/* the window */
.window { border: 1px solid var(--border); border-radius: 14px; background: var(--surface); box-shadow: 0 18px 50px var(--shadow); overflow: hidden; }
.chrome { display: flex; align-items: center; gap: 14px; padding: 10px 14px; background: var(--surface-2); border-bottom: 1px solid var(--border); }
.dots { display: flex; gap: 6px; }
.dots i { width: 11px; height: 11px; border-radius: 50%; background: var(--track); display: block; }
.addr { flex: 1; max-width: 360px; margin: 0 auto; text-align: center; font-size: 0.8rem; color: var(--muted); background: var(--bg); border: 1px solid var(--border); border-radius: 999px; padding: 2px 12px; }
.banner { margin: 0; padding: 7px 14px; text-align: center; font-size: 0.85rem; font-weight: 600; color: var(--brand); background: var(--nav-active-bg); border-bottom: 1px solid var(--border); }
.win-body { display: grid; grid-template-columns: 216px 1fr; height: min(76vh, 780px); min-height: 480px; }
.sidebar { display: flex; flex-direction: column; gap: 2px; padding: 14px 10px; border-right: 1px solid var(--border); overflow-y: auto; background: var(--surface); }
.nav-link { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: var(--muted); text-decoration: none; font-weight: 500; }
.nav-link:hover { background: var(--nav-active-bg); color: var(--text); }
.nav-link.active { background: var(--nav-active-bg); color: var(--brand); }
.nav-link:focus-visible, .more-link:focus-visible { outline: 2px solid var(--brand-2); outline-offset: 2px; }
.nav-link .short, .nav-more { display: none; }
.ic { width: 18px; height: 18px; flex: none; }
.screen { overflow-y: auto; padding: 22px 26px 30px; background: var(--bg); outline: none; }

/* page pieces */
.page-header { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.page-header .sub { color: var(--muted); margin: 2px 0 0; }
.ctl { display: flex; align-items: center; gap: 8px; font-size: 0.9rem; }
.select, .btn, .field { display: inline-block; border: 1px solid var(--border); background: var(--surface); border-radius: 10px; padding: 6px 12px; font-weight: 500; cursor: default; }
.select::after { content: ""; display: inline-block; width: 6px; height: 6px; margin: 0 2px 2px 10px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); }
.field { color: var(--muted); min-width: 160px; font-weight: 400; }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.cols > div, .card, .tile { min-width: 0; }
.cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.budget-cols { grid-template-columns: minmax(0, 1.9fr) minmax(0, 1fr); }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 16px 18px; margin-bottom: 14px; }
.card-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 12px; margin-bottom: 10px; }
.card-head .note { color: var(--muted); font-size: 0.88rem; }
.card-head .ci { vertical-align: middle; }
.summary { position: sticky; top: 0; }
.big { font-size: 1.7rem; font-weight: 700; }
.bigline { margin-bottom: 8px; }
.tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 12px 16px; }
.tile-label { color: var(--muted); font-size: 0.82rem; }
.tile-value { font-size: 1.4rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.tile-note { color: var(--muted); font-size: 0.8rem; }
.row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--border); }
.card-head + .row, .card-head + .brow, .card-head + .catbar { border-top: 0; }
.row-left { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.row-mid { flex: none; }
.row-right { text-align: right; font-variant-numeric: tabular-nums; }
.row-right .pill { margin-left: 6px; }
.row .date { width: 48px; flex: none; }
.brow { padding: 8px 0; border-top: 1px solid var(--border); }
.brow .row, .catbar .row { border-top: 0; padding: 0 0 6px; }
.catbar { padding: 6px 0; }
.ci { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 8px; flex: none; margin-right: 8px; }
.row-left .ci, .brow .ci { margin-right: 0; }
.ci .ic { width: 16px; height: 16px; }
.ci.t1 { color: var(--t1); background: color-mix(in srgb, var(--t1) 16%, transparent); }
.ci.t2 { color: var(--t2); background: color-mix(in srgb, var(--t2) 16%, transparent); }
.ci.t3 { color: var(--t3); background: color-mix(in srgb, var(--t3) 16%, transparent); }
.ci.t4 { color: var(--t4); background: color-mix(in srgb, var(--t4) 16%, transparent); }
.ci.t5 { color: var(--t5); background: color-mix(in srgb, var(--t5) 16%, transparent); }
.ci.t6 { color: var(--t6); background: color-mix(in srgb, var(--t6) 16%, transparent); }
.ci.t7 { color: var(--t7); background: color-mix(in srgb, var(--t7) 16%, transparent); }
.ci.t8 { color: var(--t8); background: color-mix(in srgb, var(--t8) 16%, transparent); }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 8px; }
.dot.t1 { background: var(--t1); } .dot.t2 { background: var(--t2); } .dot.t3 { background: var(--t3); } .dot.t4 { background: var(--t4); }
.dot.t5 { background: var(--t5); } .dot.t6 { background: var(--t6); } .dot.t7 { background: var(--t7); } .dot.t8 { background: var(--t8); }
.pill { display: inline-block; padding: 1px 9px; border-radius: 999px; font-size: 0.76rem; font-weight: 600; background: var(--pill-soft); color: var(--muted); white-space: nowrap; }
.pill.good { background: var(--pill-good); color: var(--good); }
.pill.bad { background: var(--pill-bad); color: var(--bad); }
.bar { display: block; width: 100%; height: 7px; border-radius: 99px; overflow: hidden; }
.bar .track { fill: var(--track); opacity: 0.55; }
.bar .fill.ok { fill: var(--brand-2); }
.bar .fill.inc { fill: var(--income); }
.bar .fill.out { fill: var(--expense); }
.bar .fill.over { fill: var(--expense); }
.bar .tick { fill: var(--text); }
.range { display: flex; justify-content: flex-end; gap: 4px; margin-bottom: 4px; font-size: 0.8rem; color: var(--muted); }
.range span { padding: 2px 9px; border-radius: 8px; }
.range .on { background: var(--nav-active-bg); color: var(--brand); font-weight: 600; }
.subtabs { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 16px; border-bottom: 1px solid var(--border); }
.subtabs span { padding: 6px 12px; color: var(--muted); font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; cursor: default; }
.subtabs .on { color: var(--brand); border-bottom-color: var(--brand); }
.plain { margin: 0; padding-left: 18px; }

/* tables */
.tw { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
th { text-align: left; color: var(--muted); font-weight: 500; font-size: 0.8rem; padding: 6px 8px; border-bottom: 1px solid var(--border); white-space: nowrap; }
td { padding: 8px; border-bottom: 1px solid var(--border); vertical-align: middle; }
th.r, td.r { text-align: right; }
td .ci { margin-right: 8px; vertical-align: middle; }
tr.total td { font-weight: 700; }
tbody tr:last-child td { border-bottom: 0; }

/* charts */
.chart { display: block; width: 100%; height: auto; }
.chart .grid { stroke: var(--border); stroke-width: 1; }
.chart .axis { fill: var(--muted); font-size: 11px; }
.chart .line { fill: none; stroke: var(--brand); stroke-width: 2.2; stroke-linejoin: round; }
.chart .area { fill: var(--brand-2); opacity: 0.18; }
.chart .mark { fill: var(--expense); stroke: var(--surface); stroke-width: 2; }
.bar-in { fill: var(--income); } .bar-out { fill: var(--expense); }
.legend { color: var(--muted); font-size: 0.82rem; margin: 6px 0 0; }
.key { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin: 0 6px 0 10px; vertical-align: middle; }
.legend .key:first-child { margin-left: 0; }
.key.in, .key.s1 { background: var(--income); } .key.out, .key.s2 { background: var(--expense); }
.alloc { display: flex; align-items: center; gap: 22px; }
.donut { width: 130px; height: 130px; flex: none; }
.donut .seg.s1 { stroke: var(--income); } .donut .seg.s2 { stroke: var(--expense); }
.alloc-list { list-style: none; margin: 0; padding: 0; }
.alloc-list li { margin: 4px 0; }
.alloc-list .key { margin-left: 0; }

/* phone menu list */
.more { display: grid; gap: 8px; }
.more-link { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); color: var(--text); text-decoration: none; font-weight: 600; }
.more-link .end { margin-left: auto; color: var(--muted); }
.notice { padding: 16px; color: var(--muted); }

@media (max-width: 1020px) {
  .cols, .budget-cols { grid-template-columns: 1fr; }
  .summary { position: static; }
}
/* Phones: the window frame goes away and the menu becomes the bottom bar, as in the app. */
@media (max-width: 720px) {
  .site-top, .stage { padding-left: 14px; padding-right: 14px; }
  .window { border: 0; border-radius: 0; box-shadow: none; background: transparent; }
  .chrome { display: none; }
  .banner { border-radius: 10px; border: 1px solid var(--border); margin-bottom: 12px; }
  .win-body { display: block; height: auto; min-height: 0; padding-bottom: 72px; }
  .screen { overflow: visible; padding: 4px 0 20px; background: transparent; }
  .sidebar { position: fixed; inset: auto 0 0 0; z-index: 10; flex-direction: row; justify-content: space-around; gap: 0; border-right: 0; border-top: 1px solid var(--border); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); overflow: visible; }
  .nav-link { flex-direction: column; gap: 2px; padding: 6px 2px; font-size: 0.66rem; flex: 1; min-width: 0; align-items: center; justify-content: center; text-align: center; }
  .nav-link .long { display: none; }
  .nav-link .short { display: block; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
  .nav-link.desktop-only { display: none; }
  .nav-more { display: flex; }
  .nav-link { font-size: 0.62rem; padding: 6px 0; }
  .nav-link .short { overflow: visible; text-overflow: clip; }
  .tiles { grid-template-columns: 1fr; }
  .card { padding: 14px; }
  .row { flex-wrap: wrap; row-gap: 4px; }
  .row-left { flex: 1 1 150px; }
  .row-right, .row-right.num { margin-left: auto; white-space: normal; }
  .row-right .pill { margin-left: 0; margin-top: 2px; }
  .tile-value { font-size: 1.25rem; }
  .subs th:nth-child(5), .subs td:nth-child(5), .subs th:nth-child(2), .subs td:nth-child(2) { display: none; }
  .txns th:nth-child(4), .txns td:nth-child(4), .txns td .ci { display: none; }
  td, th { padding: 8px 5px; }
  h1 { font-size: 1.4rem; }
  .alloc { flex-direction: column; align-items: flex-start; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; } }
