:root {
  --amber: #efb45c;
  --coral: #e07450;
  --radius: 18px;
  --top: calc(52px + env(safe-area-inset-top));
  --review: 0px;
  --tabs: calc(64px + env(safe-area-inset-bottom));
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-text-size-adjust: 100%;
}
[data-theme="dark"] {
  color-scheme: dark;
  --bg: #17120f; --surface: #221a15; --surface-2: #2d231c; --line: #3b2f26;
  --text: #f7efe7; --muted: #c5b5a5; --accent: #efb45c; --accent-text: #17120f;
  --good: #7ed6a0; --bad: #ff9a87; --changed: #f0c36b; --shadow: 0 10px 30px rgba(0, 0, 0, .35);
}
[data-theme="light"] {
  color-scheme: light;
  --bg: #fbf7f2; --surface: #ffffff; --surface-2: #f4ece3; --line: #e7dacc;
  --text: #23180f; --muted: #5c4b3d; --accent: #a65f0c; --accent-text: #ffffff;
  --good: #19774a; --bad: #b8321f; --changed: #8a5a00; --shadow: 0 10px 30px rgba(80, 50, 20, .1);
}
* { box-sizing: border-box; }
html { background: var(--bg); }
body {
  --head: calc(var(--top) + var(--review));
  margin: 0; min-height: 100dvh; background: var(--bg); color: var(--text);
  font-size: 16px; line-height: 1.45; font-variant-numeric: tabular-nums;
  padding: var(--head) 0 calc(var(--tabs) + 24px);
}
body.locked { overflow: hidden; }
a { color: inherit; }
h1, h2, h3 { line-height: 1.2; margin: 0; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--amber); outline-offset: 2px; border-radius: 8px; }
.hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; z-index: 50; background: var(--surface); padding: 8px 12px; border-radius: 10px; }
.skip:focus { left: 8px; }
.noscript { padding: 24px; }

main { max-width: 560px; margin: 0 auto; padding: 8px 16px 0; outline: none; }

/* Top bar and the sample-data note, on every screen */
.topbar {
  position: fixed; inset: 0 0 auto; z-index: 20; height: var(--top);
  padding: env(safe-area-inset-top) max(16px, env(safe-area-inset-right)) 0 max(16px, env(safe-area-inset-left));
  display: flex; align-items: center; justify-content: space-between;
  background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid color-mix(in srgb, var(--line) 60%, transparent);
}
.brand { display: flex; align-items: center; gap: 8px; text-decoration: none; font-weight: 700; letter-spacing: .2px; }
.logo { width: 28px; height: 28px; fill: none; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.sample {
  display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: var(--muted);
  border: 1px dashed var(--line); border-radius: 999px; padding: 3px 10px; white-space: nowrap;
}
.sample::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--coral); }
body.review { --review: 30px; }
.review-bar {
  position: fixed; left: 0; right: 0; top: var(--top); z-index: 19;
  background: var(--coral); color: #1b120c; font-size: 12px; font-weight: 700;
  text-align: center; padding: 6px 12px; line-height: 1.2; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}

/* Bottom tabs */
.tabs {
  position: fixed; inset: auto 0 0; z-index: 20; height: var(--tabs); padding-bottom: env(safe-area-inset-bottom);
  display: grid; grid-template-columns: repeat(3, 1fr);
  background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
}
.tabs a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; text-decoration: none; color: var(--muted); font-size: 12px; font-weight: 600; }
.tabs svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tabs a[aria-current] { color: var(--accent); }

.icon { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* Home */
.hero {
  margin: 8px 0 20px; padding: 22px 20px; border-radius: 24px; color: #1b120c;
  background: radial-gradient(120% 140% at 0% 0%, #f6c97b 0%, var(--amber) 35%, var(--coral) 100%);
  box-shadow: var(--shadow);
}
.hero-hello { margin: 0 0 4px; font-weight: 600; opacity: .8; }
.hero h1 { font-size: 28px; letter-spacing: -.3px; }
.hero-sub { margin: 8px 0 0; font-size: 15px; max-width: 34ch; }
.group-title { font-size: 13px; text-transform: uppercase; letter-spacing: .8px; color: var(--muted); margin: 26px 2px 10px; }
.highlights ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.highlights a { display: flex; gap: 12px; padding: 14px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); text-decoration: none; }
.highlights b { display: block; font-size: 13px; color: var(--muted); font-weight: 600; margin-bottom: 2px; }
.hl-icon, .card-icon, .report-icon {
  flex: none; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px;
  background: color-mix(in srgb, var(--amber) 18%, transparent); color: var(--accent);
}
.cards { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.card {
  display: flex; flex-direction: column; gap: 4px; min-height: 172px; padding: 14px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--line); text-decoration: none; transition: transform .15s ease;
}
.card:active { transform: scale(.98); }
.card-title { font-weight: 700; margin-top: 6px; line-height: 1.25; }
.card-teaser { font-size: 13px; color: var(--muted); }
.card-number { margin-top: auto; }
.card-number small { display: block; font-size: 11px; color: var(--muted); }
.card-number b { font-size: 18px; letter-spacing: -.2px; display: block; }
.card-number b small { display: inline; white-space: nowrap; margin-left: 4px; font-weight: 600; }
.card-number em { display: block; font-style: normal; font-size: 13px; font-weight: 600; color: var(--muted); }
.card-date { font-size: 12px; color: var(--muted); }
.public { color: var(--accent); }
.card.wide { margin-top: 26px; min-height: 0; }
.meter { display: block; height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; margin-top: 8px; }
.meter span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--amber), var(--coral)); }
.footnote { font-size: 12px; color: var(--muted); margin: 22px 2px 0; }
.banner { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 14px; background: var(--surface-2); font-size: 14px; margin-bottom: 8px; }
.banner span { flex: 1; }
.close { border: 0; background: none; font-size: 22px; width: 36px; height: 36px; border-radius: 50%; cursor: pointer; color: var(--muted); }

/* Report switcher */
.chips { display: flex; gap: 8px; overflow-x: auto; margin: 0 -16px; padding: 4px 16px 10px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; padding: 8px 14px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); text-decoration: none; font-size: 14px; white-space: nowrap; }
.chip.active { background: var(--accent); color: var(--accent-text); border-color: transparent; font-weight: 700; }

.report-head { display: flex; gap: 12px; align-items: flex-start; margin: 6px 0 12px; }
.report-head h1 { font-size: 24px; letter-spacing: -.2px; }
.report-period { margin: 4px 0 6px; color: var(--muted); font-size: 14px; }
.badges { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; }
.badge { font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 999px; background: var(--surface-2); color: var(--muted); }

/* The date wheel */
.wheel-wrap {
  position: sticky; top: var(--head); z-index: 10; margin: 0 -16px; padding: 6px 0 4px;
  background: color-mix(in srgb, var(--bg) 90%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
}
.wheel { position: relative; }
.wheel::after {
  content: ""; position: absolute; left: 50%; top: 2px; bottom: 2px; width: 70px; transform: translateX(-50%);
  border-radius: 16px; border: 2px solid var(--accent); pointer-events: none;
}
.wheel-scroll {
  display: flex; align-items: stretch; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none;
  padding: 4px calc(50% - 32px); position: relative; outline: none;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 18%, #000 82%, transparent); mask-image: linear-gradient(90deg, transparent, #000 18%, #000 82%, transparent);
}
.wheel-scroll::-webkit-scrollbar { display: none; }
.wheel-scroll:focus-visible { outline: none; }
.wheel:focus-within::after { box-shadow: 0 0 0 3px color-mix(in srgb, var(--amber) 40%, transparent); }
.wheel-item {
  flex: none; width: 64px; height: 58px; scroll-snap-align: center; border: 0; background: none; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; border-radius: 14px; position: relative;
  transition: color .15s;
}
.wheel-item small { font-size: 11px; color: var(--muted); }
.wheel-item b { font-size: 15px; }
.wheel-item[aria-selected="true"] b { color: var(--accent); }
.wheel-item.base::after { content: ""; position: absolute; bottom: 5px; width: 5px; height: 5px; border-radius: 50%; background: var(--coral); }
.wheel-mark { flex: none; width: 2px; margin: 8px 0; background: var(--coral); position: relative; border-radius: 2px; }
.wheel-mark span {
  position: absolute; top: -4px; left: 50%; transform: translateX(-50%); white-space: nowrap;
  font-size: 9px; font-weight: 700; color: #1b120c; background: var(--coral); padding: 0 5px; border-radius: 6px;
}
.wheel-hint { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; justify-content: center; text-align: center; margin: 2px 16px 0; font-size: 13px; color: var(--muted); min-height: 20px; }
.link-button { border: 0; background: none; color: var(--accent); font-weight: 700; cursor: pointer; padding: 4px 2px; text-decoration: underline; text-underline-offset: 3px; }

.version-note { margin: 12px 0 0; padding: 10px 12px; border-radius: 12px; background: color-mix(in srgb, var(--coral) 14%, transparent); font-size: 14px; }

/* Sections */
.block { margin-top: 14px; padding: 14px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); }
.block h2 { font-size: 15px; margin-bottom: 10px; }
.block-kpis:has(.compact) { padding: 10px 14px; }
.section-note { margin: 10px 0 0; font-size: 12px; color: var(--muted); }
.kpis { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px 12px; }
.kpis.compact { grid-template-columns: repeat(2, auto); justify-content: start; gap: 4px 28px; }
.kpi { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.kpi-label { font-size: 12px; color: var(--muted); }
.kpi .num { font-size: 22px; overflow-wrap: break-word; font-weight: 700; letter-spacing: -.3px; }
.num small, .num-vat small { font-weight: 600; font-size: 11px; margin-left: 4px; color: var(--muted); white-space: nowrap; }
.num-vat { font-size: 13px; font-weight: 600; color: var(--muted); }
.kpis.compact .num { font-size: 16px; }
.val { display: inline-flex; flex-direction: column; min-width: 0; }
.cmp { font-size: 12px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 0 6px; align-items: baseline; animation: rise .25s ease; }
.delta { font-weight: 700; }
.delta.good { color: var(--good); }
.delta.bad { color: var(--bad); }
.delta.changed { color: var(--changed); }
.delta.flat { color: var(--muted); }
@keyframes rise { from { opacity: 0; transform: translateY(3px); } }

.table { display: grid; gap: 8px; }
.row { display: block; padding: 10px 0 0; border-top: 1px solid var(--line); text-decoration: none; }
.row:first-child { border-top: 0; padding-top: 0; }
.row.link { cursor: pointer; }
.row-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.row-name { flex: 1; font-weight: 600; font-size: 15px; min-width: 0; }
.row-name small { display: block; font-weight: 400; font-size: 12px; color: var(--muted); }
.chevron { font-size: 22px; color: var(--muted); }
.cells { display: grid; gap: 6px 12px; grid-template-columns: repeat(3, 1fr); }
.cells.cols-1 { grid-template-columns: 1fr; }
.cells.cols-2 { grid-template-columns: repeat(2, 1fr); }
.cells.cols-4 { grid-template-columns: repeat(2, 1fr); }
.cells.cols-5 { grid-template-columns: repeat(3, 1fr); }
.cell { display: flex; flex-direction: column; min-width: 0; }
.cell-label { font-size: 11px; color: var(--muted); }
.cell .num { font-weight: 600; }
.rank { display: inline-flex; flex-direction: column; align-items: center; min-width: 30px; }
.place { font-weight: 800; color: var(--accent); }
.move { font-size: 11px; font-weight: 700; color: var(--muted); }
.move.new { color: #1b120c; background: var(--coral); padding: 0 6px; border-radius: 6px; }
.empty { margin: 0; color: var(--muted); font-size: 14px; }
.dropped { margin: 10px 0 0; font-size: 13px; color: var(--muted); }
.dropped b { color: var(--bad); }

.bars { display: grid; gap: 12px; }
.bar-head { display: flex; align-items: center; gap: 8px; margin-bottom: 5px; }
.bar-name { flex: 1; font-size: 14px; min-width: 0; }
.bar-head .val { align-items: flex-end; text-align: right; }
.bar-head .num { font-weight: 700; }
.bar-track { position: relative; height: 10px; border-radius: 99px; background: var(--surface-2); }
.bar { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--amber), var(--coral)); }
.bar-was { position: absolute; top: -4px; bottom: -4px; width: 3px; margin-left: -1.5px; border-radius: 2px; background: var(--text); opacity: .75; }

.columns { margin: 0; }
.columns svg { display: block; width: 100%; height: auto; overflow: visible; }
.columns .col { fill: var(--amber); opacity: .9; }
.columns .col-was { fill: none; stroke: var(--text); stroke-width: 1.6; stroke-dasharray: 4 3; opacity: .8; }
.columns .col-was-dot { fill: var(--text); opacity: .8; }
.columns .axis text { font-size: 9px; fill: var(--muted); }
.legend { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); margin-top: 6px; }
.key { display: inline-block; width: 14px; height: 8px; border-radius: 2px; }
.key.now { background: var(--amber); }
.key.was { border-top: 2px dashed var(--text); height: 0; margin-left: 8px; }

.notes { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.notes li { position: relative; padding-left: 22px; }
.notes li::before { content: ""; position: absolute; left: 4px; top: .55em; width: 8px; height: 8px; border-radius: 50%; background: var(--amber); }
.block-list.action { background: color-mix(in srgb, var(--amber) 10%, var(--surface)); }
.notes.action li::before { content: "→"; background: none; width: auto; height: auto; top: 0; left: 2px; color: var(--accent); font-weight: 800; }

/* Spending */
.crumbs { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 14px; color: var(--muted); margin: 4px 0; }
.crumbs a { color: var(--accent); font-weight: 600; text-decoration: none; }
.segments { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; padding: 4px; border-radius: 14px; background: var(--surface-2); margin: 4px 0 8px; }
.segment { border: 0; background: none; padding: 9px 4px; border-radius: 10px; font-size: 14px; white-space: nowrap; font-weight: 600; color: var(--muted); cursor: pointer; }
.segment[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 4px rgba(0, 0, 0, .15); }
.range { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 8px; }
.range label { display: flex; flex-direction: column; font-size: 12px; color: var(--muted); gap: 4px; }
.range input { font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 8px 10px; min-height: 44px; }

/* Settings */
.page-title { font-size: 26px; margin: 10px 0 4px; }
.panel { margin-top: 14px; padding: 16px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); }
.panel h2 { font-size: 17px; margin-bottom: 6px; }
.panel p { margin: 6px 0; }
.honest { font-size: 13px; color: var(--muted); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.actions:empty { display: none; }
.status { font-size: 14px; color: var(--accent); margin: 8px 0 0; }
.status:empty { display: none; }
.button {
  display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 10px 18px; border-radius: 14px; border: 0; cursor: pointer;
  background: var(--accent); color: var(--accent-text); font-weight: 700; text-decoration: none;
}
.button.secondary { background: var(--surface-2); color: var(--text); }
.button.small { min-height: 36px; padding: 6px 14px; }
.button.big { width: 100%; min-height: 54px; font-size: 17px; }

/* Lock and welcome */
.lock {
  position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; padding: max(24px, env(safe-area-inset-top)) 20px max(24px, env(safe-area-inset-bottom));
  background: radial-gradient(100% 70% at 50% 0%, color-mix(in srgb, var(--coral) 30%, var(--bg)) 0%, var(--bg) 70%);
}
.lock[hidden] { display: none; }
.lock-card { width: 100%; max-width: 400px; display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; }
.lock-card .logo { width: 72px; height: 72px; }
.lock-card h1 { font-size: 26px; letter-spacing: -.3px; }
.lock-card p { margin: 0; color: var(--muted); }
.welcome-list { text-align: left; margin: 4px 0 8px; padding: 0; list-style: none; display: grid; gap: 10px; }
.welcome-list li { padding: 12px 14px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); }

.lock-card.gate h1 { font-size: 22px; }
.lock-card .tagline { margin-top: -2px; font-size: 16px; font-style: italic; color: var(--muted); }
.lock-card .star { color: var(--coral); }
.lock-card .actions { width: 100%; justify-content: center; }

@media (min-width: 720px) {
  .cards { grid-template-columns: repeat(3, 1fr); }
  main { max-width: 760px; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
