:root {
  color-scheme: light;
  /* Ivory & Ink: the daytime look. Midnight navy ink on warm ivory, champagne as the second colour. */
  --page: #f5efe3;
  --surface: #fdfaf4;
  --surface-2: #ece5d6;
  --ink: #101b3a;
  --ink-2: #4a5270;
  --muted: #828aa3;
  --grid: #e3dccb;
  --axis: #c9c1ad;
  --border: rgba(16, 27, 58, 0.12);
  --accent: #101b3a;
  --accent-ink: #f5efe3;
  --series-1: #2c4284;
  --series-2: #b08a45;
  --brand-2: #9a7430;
  --good: #0ca30c;
  --good-text: #17663a;
  --warning: #fab219;
  --critical: #c23b3b;
  --critical-bg: #f9e4e1;
  --warning-bg: #fbf0d3;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 27, 58, 0.04), 0 4px 16px rgba(16, 27, 58, 0.05);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
}
/* Midnight & Silver: the night-time look. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --page: #0b1330;
    --surface: #121c41;
    --surface-2: #1b2752;
    --ink: #eef0f6;
    --ink-2: #b9c2d6;
    --muted: #8590ad;
    --grid: #22305e;
    --axis: #2e3d70;
    --border: rgba(238, 240, 246, 0.12);
    --accent: #c3cbdd;
    --accent-ink: #0b1330;
    --series-1: #9fb0de;
    --series-2: #cfab66;
    --brand-2: #b9c2d6;
    --good-text: #6fd08f;
    --critical-bg: #3b1a26;
    --warning-bg: #3a2f17;
    --shadow: none;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0b1330;
  --surface: #121c41;
  --surface-2: #1b2752;
  --ink: #eef0f6;
  --ink-2: #b9c2d6;
  --muted: #8590ad;
  --grid: #22305e;
  --axis: #2e3d70;
  --border: rgba(238, 240, 246, 0.12);
  --accent: #c3cbdd;
  --accent-ink: #0b1330;
  --series-1: #9fb0de;
  --series-2: #cfab66;
  --brand-2: #b9c2d6;
  --good-text: #6fd08f;
  --critical-bg: #3b1a26;
  --warning-bg: #3a2f17;
  --shadow: none;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--page); color: var(--ink); }
body { font-size: 15px; line-height: 1.4; -webkit-font-smoothing: antialiased; min-height: 100dvh; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }
.num, td.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.ink2 { color: var(--ink-2); }
.pos { color: var(--good-text); }
.hidden { display: none !important; }

/* ---------- Layout ---------- */
.app { display: grid; grid-template-columns: 220px minmax(0, 1fr); min-height: 100dvh; }
.sidebar { position: sticky; top: 0; height: 100dvh; padding: 20px 12px; border-right: 1px solid var(--border); background: var(--surface); }
.brand { display: flex; align-items: center; gap: 12px; padding: 4px 10px 20px; font-family: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif; font-weight: 600; font-size: 13px; letter-spacing: .12em; text-transform: uppercase; line-height: 1.15; white-space: nowrap; }
.brand img, .brand svg { width: 40px; height: 44px; flex: none; }
a { color: var(--series-1); }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; color: var(--ink-2); text-decoration: none; font-weight: 500; }
.nav a svg { width: 20px; height: 20px; flex: none; }
.nav a:hover { background: var(--surface-2); }
.nav a[aria-current="page"] { background: var(--surface-2); color: var(--ink); }
main { padding: 20px 28px 40px; max-width: 1100px; width: 100%; min-width: 0; zoom: var(--zoom, 1); }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.topbar h1 { font-size: 24px; margin: 0; letter-spacing: -0.01em; }
.topbar .actions { display: flex; gap: 6px; }
.iconbtn { position: relative; display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); cursor: pointer; }
.iconbtn svg { width: 20px; height: 20px; }
.badge { position: absolute; top: -4px; right: -4px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--critical); color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center; }

@media (max-width: 760px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; inset: auto 0 0 0; height: auto; padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); border-right: 0; border-top: 1px solid var(--border); z-index: 20; }
  .brand { display: none; }
  .nav { flex-direction: row; justify-content: space-around; }
  .nav a { flex-direction: column; gap: 2px; font-size: 11px; padding: 6px 4px; flex: 1; }
  .nav a.desktop-only { display: none; }
  main { padding: 14px 16px calc(90px + env(safe-area-inset-bottom)); }
  .topbar h1 { font-size: 22px; }
}

/* ---------- Cards ---------- */
.grid { display: grid; gap: 14px; }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 900px) { .grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid.cols-3 { grid-template-columns: 1fr; } }
@media (max-width: 760px) { .grid.cols-2 { grid-template-columns: 1fr; } }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); min-width: 0; }
.card h2 { font-size: 15px; margin: 0 0 12px; display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.card h2 a, .card h2 .link { font-size: 13px; font-weight: 500; text-decoration: none; }
.stat .label { color: var(--ink-2); font-size: 13px; }
.stat .value { font-size: 22px; font-weight: 650; margin-top: 4px; letter-spacing: -0.01em; }
.stat .sub { color: var(--muted); font-size: 12px; margin-top: 2px; }
.hero { padding: 20px; background: var(--hero-bg, var(--surface)); color: var(--hero-ink, inherit); }
.hero .label { font-size: 14px; color: var(--hero-ink-2, var(--ink-2)); }
.hero .value { font-size: 40px; font-weight: 700; letter-spacing: -0.02em; margin: 4px 0; }
.hero .sub { color: var(--hero-ink-2, var(--ink-2)); }
.section { margin-top: 14px; }

.alert { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--border); margin-bottom: 14px; }
.alert svg { flex: none; width: 20px; height: 20px; margin-top: 1px; }
.alert.critical { background: var(--critical-bg); }
.alert.critical svg { color: var(--critical); }
.alert.warning { background: var(--warning-bg); }
.alert.warning svg { color: #b07a00; }
.alert strong { display: block; }

/* ---------- Lists ---------- */
.list { list-style: none; margin: 0; padding: 0; }
.row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--border); }
.list .row:first-child { border-top: 0; }
.row .main { flex: 1; min-width: 0; }
.row .title { font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .meta { color: var(--muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .amt { font-weight: 600; text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.row.clickable { cursor: pointer; }
.row.clickable:hover { background: var(--surface-2); margin: 0 -10px; padding: 10px; border-radius: 10px; }
.avatar { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--surface-2); color: var(--ink-2); font-weight: 700; font-size: 13px; flex: none; }
.pill { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px; font-size: 12px; background: var(--surface-2); color: var(--ink-2); white-space: nowrap; }
.pill.critical { background: var(--critical-bg); color: var(--critical); }
.pill.warning { background: var(--warning-bg); color: #8a5f00; }
:root[data-theme="dark"] .pill.warning { color: var(--warning); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .pill.warning { color: var(--warning); } }
.date-head { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; padding: 14px 0 4px; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px 6px; border-top: 1px solid var(--border); font-size: 14px; }
th { color: var(--muted); font-weight: 500; font-size: 12.5px; border-top: 0; }
td.num, th.num { text-align: right; white-space: nowrap; }

/* ---------- Controls ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 14px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); cursor: pointer; font-weight: 550; white-space: nowrap; }
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.btn.primary:hover { filter: brightness(1.05); }
.btn.danger { color: var(--critical); }
.btn.small { padding: 5px 10px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: default; }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; align-items: center; }
.toolbar input[type="search"] { flex: 1 1 200px; }
input, select, textarea { padding: 9px 11px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); min-width: 0; }
input:focus, select:focus, textarea:focus, .btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.seg { display: inline-flex; padding: 3px; border-radius: 10px; background: var(--surface-2); gap: 2px; flex-wrap: wrap; }
.seg button { border: 0; background: transparent; padding: 6px 12px; border-radius: 8px; cursor: pointer; color: var(--ink-2); font-weight: 550; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
label.field { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--ink-2); }
.form { display: grid; gap: 12px; }
.form .two { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
.toolbar select { max-width: 100%; flex: 1 1 140px; }
.check { display: flex; align-items: center; gap: 8px; font-size: 14px; }

dialog { border: 1px solid var(--border); border-radius: 16px; background: var(--surface); color: var(--ink); padding: 20px; width: min(460px, calc(100vw - 32px)); box-shadow: 0 20px 60px rgba(0,0,0,.25); }
dialog::backdrop { background: rgba(0, 0, 0, .35); }
dialog h3 { margin: 0 0 14px; }
dialog .buttons { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }

.toast { position: fixed; left: 50%; bottom: calc(90px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--ink); color: var(--page); padding: 10px 16px; border-radius: 10px; font-size: 14px; z-index: 50; max-width: calc(100vw - 32px); }
.empty { text-align: center; padding: 30px 10px; color: var(--muted); }

/* ---------- Charts ---------- */
.chart { position: relative; width: 100%; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .gridline { stroke: var(--grid); stroke-width: 1; }
.chart .baseline { stroke: var(--axis); stroke-width: 1; }
.chart .tick { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart .label { fill: var(--ink-2); font-size: 12px; }
.chart .value-label { fill: var(--ink-2); font-size: 12px; font-variant-numeric: tabular-nums; }
.chart .s1 { fill: var(--series-1); }
.chart .s2 { fill: var(--series-2); }
.chart .line { fill: none; stroke: var(--series-1); stroke-width: 2; }
.chart .area { fill: var(--series-1); opacity: .08; }
.chart .buffer { stroke: var(--critical); stroke-width: 1; stroke-dasharray: 4 4; }
.chart .crosshair { stroke: var(--axis); stroke-width: 1; }
.chart .dot { fill: var(--series-1); stroke: var(--surface); stroke-width: 2; }
.chart .event { fill: var(--surface); stroke: var(--ink-2); stroke-width: 1.5; }
.chart .hit { fill: transparent; cursor: default; }
.chart .bar:hover, .chart .hit:hover + .bar { opacity: .85; }
.tooltip { position: absolute; pointer-events: none; background: var(--surface); border: 1px solid var(--border); box-shadow: 0 6px 24px rgba(0,0,0,.12); border-radius: 10px; padding: 8px 10px; font-size: 12.5px; min-width: 140px; z-index: 5; }
.tooltip .t { font-weight: 600; margin-bottom: 4px; }
.tooltip .r { display: flex; justify-content: space-between; gap: 12px; font-variant-numeric: tabular-nums; }
.tooltip .sw { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 6px; }
.legend { display: flex; gap: 14px; font-size: 12.5px; color: var(--ink-2); margin-bottom: 8px; flex-wrap: wrap; }
.legend .sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.catbar { display: grid; grid-template-columns: minmax(90px, 140px) 1fr auto; align-items: center; gap: 10px; padding: 5px 0; font-size: 14px; }
.catbar .track { height: 10px; border-radius: 0 4px 4px 0; background: transparent; position: relative; }
.catbar .fill { height: 100%; background: var(--series-1); border-radius: 0 4px 4px 0; min-width: 2px; }
.catbar .amt { font-variant-numeric: tabular-nums; color: var(--ink-2); text-align: right; min-width: 84px; }
.catbar .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.progress { height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; margin-top: 8px; }
.progress > div { height: 100%; background: var(--series-1); }

.login { min-height: 100dvh; display: grid; place-items: center; padding: 16px; }
.login .card { width: min(360px, 100%); }

.btn svg { width: 16px; height: 16px; }
.row .side { display: flex; align-items: center; gap: 8px; }
@media (max-width: 600px) {
  .row.bill { flex-wrap: wrap; }
  .row.bill .side { width: 100%; padding-left: 48px; }
  .row.bill .side .amt { margin-left: auto; }
  .row .title { white-space: normal; }
}
@media (max-width: 600px) {
  .row.bill .side { padding-left: 0; gap: 6px; }
  th, td { padding: 7px 3px; font-size: 13px; }
}
@media (max-width: 600px) { .row .bal { display: none; } }

/* ---------- Overview layout (12 columns; each section has its own width) ---------- */
.dash { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 14px; }
.w { grid-column: span var(--span, 6); min-width: 0; display: flex; flex-direction: column; position: relative; }
.w > .card { flex: 1; }
@media (max-width: 760px) { .w { grid-column: span 12; min-height: 0 !important; } .w.sm { grid-column: span 6; } }
.dash.arranging .w { cursor: grab; outline: 2px dashed var(--border); outline-offset: 3px; border-radius: var(--radius); }
.dash.arranging .w.dragging { opacity: .4; }
.dash.arranging .w.drop { outline: 2px solid var(--accent); }
.dash.arranging .w.is-hidden > .card { opacity: .35; }
.w-tools { display: flex; align-items: center; gap: 4px; padding: 0 2px 6px; font-size: 12px; flex-wrap: wrap; }
.w-name { flex: 1; min-width: 0; font-weight: 600; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.w-tools button { border: 1px solid var(--border); background: var(--surface); border-radius: 7px; min-width: 26px; height: 26px; padding: 0 7px; cursor: pointer; font-size: 13px; }
.w-tools button:hover { background: var(--surface-2); }
.w-grip { position: absolute; right: -4px; bottom: -4px; width: 22px; height: 22px; cursor: nwse-resize; touch-action: none; border-right: 4px solid var(--accent); border-bottom: 4px solid var(--accent); border-radius: 0 0 8px 0; }
@media (max-width: 760px) { .w-grip, .w-tools [data-act="narrower"], .w-tools [data-act="wider"] { display: none; } }

/* ---------- Flippable credit cards ---------- */
:root { --c1: var(--series-1); --c2: #eb6834; --c3: #12a594; --c4: #a855e8; --c5: #dca100; }
.ccs { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 16px; }
.cc { perspective: 1200px; border: 0; padding: 0; background: none; cursor: pointer; width: 100%; max-width: 360px; aspect-ratio: 1.586; justify-self: center; text-align: left; color: #fff; }
.cc-in { display: block; position: relative; width: 100%; height: 100%; transition: transform .6s cubic-bezier(.2, .8, .2, 1); transform-style: preserve-3d; }
.cc[aria-pressed="true"] .cc-in { transform: rotateY(180deg); }
.cc-face { position: absolute; inset: 0; border-radius: 16px; padding: 7%; display: flex; flex-direction: column; justify-content: space-between; overflow: hidden; backface-visibility: hidden; -webkit-backface-visibility: hidden; box-shadow: 0 12px 26px -14px rgba(0, 0, 0, .55); }
.cc-fa { background: linear-gradient(135deg, var(--cc-a, var(--accent)), color-mix(in srgb, var(--cc-a, var(--accent)) 55%, #000)); }
.cc-fb { background: linear-gradient(135deg, var(--cc-b, var(--series-2)), color-mix(in srgb, var(--cc-b, var(--series-2)) 55%, #000)); }
.cc-face::after { content: ""; position: absolute; width: 70%; aspect-ratio: 1; right: -22%; top: -42%; border-radius: 50%; background: rgba(255, 255, 255, .13); }
.cc-face > * { position: relative; z-index: 1; }
.cc-back { transform: rotateY(180deg); }
.cc-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.cc-s { font-size: 12px; opacity: .9; display: block; }
.cc-row.cc-s { display: flex; }
.cc-chip { width: 38px; height: 28px; border-radius: 6px; background: linear-gradient(135deg, #f3d98b, #b98a2a); }
.cc-pan { font-family: ui-monospace, Menlo, monospace; font-size: 16px; letter-spacing: .08em; }
.cc-amt { display: block; font-size: 24px; font-weight: 700; }
.cc-meter { display: block; margin-top: 6px; height: 8px; border-radius: 99px; background: rgba(255, 255, 255, .28); overflow: hidden; }
.cc-meter > span { display: block; height: 100%; background: #fff; border-radius: 99px; }
.cc:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; border-radius: 16px; }
.cc-hint { font-size: 12.5px; margin: 10px 0 0; }
@media (prefers-reduced-motion: reduce) { .cc-in { transition: none; } }

.rainbow .catbar:nth-child(5n+1) .fill { background: var(--c1); }
.rainbow .catbar:nth-child(5n+2) .fill { background: var(--c2); }
.rainbow .catbar:nth-child(5n+3) .fill { background: var(--c3); }
.rainbow .catbar:nth-child(5n+4) .fill { background: var(--c4); }
.rainbow .catbar:nth-child(5n+5) .fill { background: var(--c5); }

/* ---------- Customize panel ---------- */
.cz { position: fixed; top: 0; right: 0; bottom: 0; width: 300px; z-index: 30; background: var(--surface); color: var(--ink); border-left: 1px solid var(--border); box-shadow: -10px 0 40px rgba(0, 0, 0, .12); display: flex; flex-direction: column; }
.cz header { display: flex; align-items: center; gap: 8px; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.cz header .muted { flex: 1; font-size: 12px; }
.cz-body { padding: 4px 16px 24px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; }
.cz h4 { margin: 14px 0 2px; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.cz-presets { display: flex; flex-wrap: wrap; gap: 6px; }
.cz-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 14px; }
.cz-row input[type="color"] { width: 44px; height: 30px; padding: 2px; cursor: pointer; }
.cz-col { display: flex; flex-direction: column; gap: 4px; font-size: 14px; }
.cz-col input { padding: 0; accent-color: var(--accent); }
.cz-hint { font-size: 12.5px; margin: 0; }
.customizing .app { padding-right: 300px; }
.iconbtn { color: inherit; }
@media (max-width: 760px) {
  .cz { top: auto; left: 0; width: auto; height: 46dvh; border-left: 0; border-top: 1px solid var(--border); border-radius: 16px 16px 0 0; z-index: 40; }
  .customizing .app { padding-right: 0; padding-bottom: 46dvh; }
}

/* ---------- Assets ---------- */
.neg { color: var(--critical); }
.tscroll { overflow-x: auto; }
.tscroll table { min-width: 520px; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: var(--surface-2); }
.allocbar { display: flex; height: 14px; border-radius: 7px; overflow: hidden; gap: 2px; margin-bottom: 10px; }
.allocbar span { display: block; min-width: 3px; }
.sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 8px; vertical-align: -1px; }
.card h2 .btn { font-weight: 550; }

/* ---------- Card designs ---------- */
.cc-wrap { display: flex; flex-direction: column; align-items: center; gap: 10px; min-width: 0; }
.cc-face strong { display: block; font-size: 15px; line-height: 1.2; }
.cc-foot { align-items: flex-end; }
.cc-holder { font-size: 13px; letter-spacing: .08em; text-transform: uppercase; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.cc-net { font-weight: 800; font-style: italic; font-size: 17px; letter-spacing: .02em; flex: none; }
.cc-preview { cursor: default; margin: 0 auto; max-width: 320px; }
.cc-meter > span { background: currentColor; }
.cc-photo { background-size: cover; background-position: center; color: #fff; }
.cc-photo::after { display: none; }
.cc-photo .cc-holder { text-shadow: 0 1px 3px rgba(0, 0, 0, .7); }

/* Bank name as a wordmark, or its logo, with the card's product name beneath. */
.cc-brand { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.cc-wm { font-size: 18px; font-weight: 700; line-height: 1; }
.cc-wm.wm-heavy { font-weight: 800; letter-spacing: -.01em; }
.cc-wm.wm-spaced { font-size: 13px; letter-spacing: .14em; }
.cc-wm.wm-italic { font-style: italic; font-weight: 800; }
.cc-prod { font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; opacity: .92; }
.cc-logo { max-height: 30px; max-width: 120px; object-fit: contain; object-position: left center; align-self: flex-start; }
/* Finishes */
.cc-face::before { content: ""; position: absolute; inset: 0; pointer-events: none; }
.cc-face[data-finish="plain"]::after { display: none; }
.cc-face[data-finish="wave"]::after { width: 150%; aspect-ratio: auto; height: 120%; right: -62%; top: auto; bottom: -72%; background: rgba(255, 255, 255, .13); transform: rotate(-16deg); }
.cc-face[data-finish="wave"]::before { background: radial-gradient(120% 90% at 0% 0%, rgba(255, 255, 255, .16), transparent 55%); }
.cc-face[data-finish="metal"]::after, .cc-face[data-finish="split"]::after { inset: 0; width: auto; aspect-ratio: auto; border-radius: 0; }
.cc-face[data-finish="metal"]::after { background: repeating-linear-gradient(100deg, rgba(255, 255, 255, .055) 0 1px, transparent 1px 3px), linear-gradient(115deg, transparent 30%, rgba(255, 255, 255, .18) 48%, transparent 64%); }
.cc-face[data-finish="split"]::after { background: linear-gradient(118deg, transparent 60%, rgba(255, 255, 255, .2) 60%); }
.cc-face[data-finish^="frame"] { padding: 10%; }
.cc-face[data-finish^="frame"]::after { inset: 5%; width: auto; aspect-ratio: auto; border-radius: 9px; background: none; border: 1.5px solid currentColor; opacity: .45; }
.cc-face[data-finish="frame-metal"]::before { background: repeating-linear-gradient(100deg, rgba(255, 255, 255, .09) 0 1px, transparent 1px 3px), linear-gradient(115deg, transparent 30%, rgba(255, 255, 255, .35) 48%, transparent 64%); }

/* ---------- Budgets ---------- */
.budgets { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px 24px; }
.budget-top { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; font-variant-numeric: tabular-nums; }
.budget .progress { height: 8px; border-radius: 4px; }
.budget-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; max-height: 52vh; overflow-y: auto; padding-right: 4px; }

/* ---------- Chat assistant ---------- */
.chat { position: fixed; right: 16px; bottom: 16px; width: min(400px, calc(100vw - 32px)); max-height: min(640px, calc(100dvh - 32px)); z-index: 35; display: flex; flex-direction: column; background: var(--surface); color: var(--ink); border: 1px solid var(--border); border-radius: 16px; box-shadow: 0 20px 60px rgba(0, 0, 0, .25); }
.chat header { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.chat-log { flex: 1; min-height: 160px; overflow-y: auto; padding: 12px 16px; display: flex; flex-direction: column; gap: 8px; }
.chat-msg { max-width: 88%; padding: 8px 12px; border-radius: 14px; line-height: 1.45; overflow-wrap: anywhere; }
.chat-msg.user { align-self: flex-end; background: var(--accent); color: var(--accent-ink); border-bottom-right-radius: 4px; }
.chat-msg.assistant { align-self: flex-start; background: var(--surface-2); border-bottom-left-radius: 4px; }
.chat-chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 16px 10px; }
.chat-chips .btn { white-space: normal; text-align: left; }
.chat form { display: flex; gap: 8px; padding: 0 16px 10px; }
.chat form input { flex: 1; }
.chat-note { font-size: 11.5px; margin: 0; padding: 0 16px 12px; }
@media (max-width: 760px) { .chat { right: 8px; left: 8px; width: auto; bottom: calc(76px + env(safe-area-inset-bottom)); max-height: calc(100dvh - 110px); } }

a.btn { text-decoration: none; color: inherit; }
a.btn.primary { color: var(--accent-ink); }

/* ---------- Logo on phones (the sidebar name is hidden there) ---------- */
.title-wrap { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-m { display: none; }
.brand-m svg { width: 30px; height: 34px; display: block; }
@media (max-width: 760px) { .brand-m { display: block; flex: none; } }

/* ---------- Ticker lookup ---------- */
.sym-list { position: absolute; left: 0; right: 0; top: 100%; z-index: 5; margin-top: 4px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 10px 30px rgba(0, 0, 0, .18); max-height: 260px; overflow-y: auto; }
.sym-list button { display: grid; grid-template-columns: 84px 1fr; column-gap: 10px; width: 100%; text-align: left; padding: 8px 10px; border: 0; border-top: 1px solid var(--border); background: none; cursor: pointer; color: var(--ink); font-size: 14px; }
.sym-list button:first-child { border-top: 0; }
.sym-list button:hover, .sym-list button:focus-visible { background: var(--surface-2); outline: none; }
.sym-list button strong { grid-row: span 2; align-self: center; }
.sym-list button .muted { font-size: 12px; }

/* ---------- Currency switch in the top bar ---------- */
.cur-switch { height: 40px; padding: 0 8px; border-radius: 12px; font-weight: 600; font-size: 13px; cursor: pointer; }
@media (max-width: 760px) { .topbar .actions { gap: 4px; } .cur-switch { padding: 0 4px; } .topbar .iconbtn { width: 36px; height: 36px; } .cur-switch { height: 36px; } }
