/* DKODA Merch — the distro portal's design system (src/views/portal.html in
   the distro project), dark by default. Tokens first; components follow the
   same names as the portal so the two apps stay visually one family. */

/* ---------- Tokens ------------------------------------------------------ */
:root, :root[data-theme="dark"] {
  --page: #000000; --surface: #121212; --fill: #1f1f1f; --fill-hover: #262626; --fill-strong: #303030;
  --line: #2a2a2a; --track: #3a3a3a; --text: #f5f5f5; --muted: #a8a8a8;
  --accent: #ffffff; --accent-line: #ffffff; --accent-ink: #ffffff; --on-accent: #121212; --accent-soft: rgba(255, 255, 255, .1);
  --red: #ff8a80; --red-bg: #3a1714; --green: #7ddc97; --green-bg: #12301c; --amber: #f2c46d; --amber-bg: #3a2c10;
  --tooltip-bg: #f5f5f5; --tooltip-text: #121212; --logo-filter: invert(1);
  --s1: #3987e5; --s2: #d95926;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --page: #f2f2f2; --surface: #ffffff; --fill: #f3f3f3; --fill-hover: #ebebeb; --fill-strong: #e1e1e1;
  --line: #e4e4e4; --track: #d6d6d6; --text: #121212; --muted: #5c5c5c;
  --accent: #121212; --accent-line: #121212; --accent-ink: #121212; --on-accent: #ffffff; --accent-soft: rgba(18, 18, 18, .08);
  --red: #b42318; --red-bg: #fdecea; --green: #1d6b35; --green-bg: #e4f4e8; --amber: #8a5a00; --amber-bg: #fdf1d8;
  --tooltip-bg: #121212; --tooltip-text: #ffffff; --logo-filter: none;
  --s1: #2a78d6; --s2: #eb6834;
  color-scheme: light;
}

/* ---------- Base -------------------------------------------------------- */
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--page); color: var(--text);
  font-family: "Figtree", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 16px; line-height: 1.45; -webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; color: inherit; }
a { color: var(--accent-ink); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--accent-ink); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }
.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.nowrap { white-space: nowrap; }
.center { text-align: center !important; }
.muted { color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
svg.ic { width: 24px; height: 24px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
svg.ic.flip { transform: rotate(180deg); }

/* ---------- Top bar ----------------------------------------------------- */
.topbar { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 16px; height: 72px; padding: 0 20px 0 16px; }
.brand { display: flex; align-items: center; gap: 8px; }
.wordmark { position: relative; display: block; padding-bottom: 8px; margin-top: 8px; }
.wordmark:hover { text-decoration: none; }
.wordmark img { height: 30px; display: block; filter: var(--logo-filter); }
.beta-tag { position: absolute; right: -16px; bottom: -8px; background: var(--text); color: var(--surface); border: 2px solid var(--page); border-radius: 999px;
  padding: 1px 7px; font-size: 10px; font-weight: 800; letter-spacing: .06em; line-height: 1.3; pointer-events: none; }
.search {
  justify-self: center; width: min(440px, 100%); display: flex; align-items: center; gap: 10px; margin: 0;
  height: 48px; padding: 0 18px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); color: var(--muted);
}
.search input { border: 0; outline: 0; background: none; width: 100%; color: var(--text); font-size: 16px; }
.search input::placeholder { color: var(--muted); }
.search input:disabled { cursor: not-allowed; }
.search:focus-within { border-color: var(--accent-ink); }
.top-actions { display: flex; align-items: center; gap: 6px; }
.icon-btn {
  width: 44px; height: 44px; border-radius: 999px; border: 0; background: none; color: var(--text);
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer; position: relative;
}
.icon-btn:hover { background: var(--fill-hover); }
.icon-btn:disabled { cursor: default; background: none; }
/* Dark shows a sun (switch to light), light shows a moon. */
.theme-sun { display: inline-flex; }
.theme-moon { display: none; }
:root[data-theme="light"] .theme-sun { display: none; }
:root[data-theme="light"] .theme-moon { display: inline-flex; }
.me {
  width: 40px; height: 40px; border-radius: 999px; border: 0; cursor: pointer; margin-left: 6px;
  background: var(--text); color: var(--surface); font-weight: 800; font-size: 17px;
}
.rail-toggle { display: none; }
.pop-wrap { position: relative; }
.menu {
  position: absolute; right: 0; top: 52px; width: 300px; z-index: 30; padding: 8px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 12px 32px rgba(0, 0, 0, .3);
}
.menu form { margin: 0; }
.menu-item { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px; border-radius: 10px; color: var(--text); font-weight: 600; }
.menu-item:hover { background: var(--fill); text-decoration: none; }
.menu-item svg.ic { width: 20px; height: 20px; color: var(--muted); }
.menu-btn { width: 100%; text-align: left; border: 0; background: none; cursor: pointer; }
.menu-sep { height: 1px; background: var(--line); margin: 6px 0; }
.account-head { display: flex; align-items: center; gap: 12px; padding: 10px; }
.account-head small { color: var(--muted); display: block; font-size: 13px; }

/* ---------- Shell ------------------------------------------------------- */
.shell { display: grid; grid-template-columns: 76px minmax(0, 1fr); gap: 12px; padding: 0 16px 16px; align-items: start; }
.rail { position: sticky; top: 12px; display: flex; flex-direction: column; gap: 12px; max-height: calc(100vh - 100px); }
.rail-card { background: var(--surface); border-radius: 14px; padding: 10px 0; display: flex; flex-direction: column; align-items: center; gap: 2px; flex-shrink: 0; }
.rail-avatars { flex: 0 1 auto; min-height: 0; overflow-y: auto; gap: 8px; padding: 12px 0; scrollbar-width: none; }
.rail-avatars::-webkit-scrollbar { display: none; }
.rail-btn {
  width: 52px; height: 46px; border-radius: 12px; border: 0; background: none; color: var(--muted);
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer; position: relative; flex-shrink: 0;
}
.rail-btn:hover { background: var(--fill); color: var(--text); text-decoration: none; }
.rail-btn[aria-current="page"] { color: var(--text); background: var(--fill); }
.rail-btn[aria-current="page"] svg { stroke-width: 2.6; }
.rail-avatar { display: inline-flex; border-radius: 999px; flex-shrink: 0; }
.rail-avatar:hover { text-decoration: none; opacity: .85; }
.rail-avatar.active .avatar { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--accent-line); }
.tip {
  position: fixed; z-index: 70; pointer-events: none; opacity: 0; transition: opacity .1s; left: 0; top: 0;
  background: var(--tooltip-bg); color: var(--tooltip-text); font-size: 13px; font-weight: 600;
  padding: 6px 10px; border-radius: 8px; max-width: 300px;
}
.tip.show { opacity: 1; }
.rail-scrim { display: none; }

.avatar {
  width: 44px; height: 44px; border-radius: 999px; overflow: hidden; position: relative; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center; font-weight: 800; font-size: 15px;
  background: var(--fill-strong); color: #fff;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar.sm { width: 30px; height: 30px; font-size: 12px; }
.avatar.md { width: 40px; height: 40px; font-size: 15px; }
.avatar.xl { width: 96px; height: 96px; font-size: 34px; }
.av-0 { background: #5b4bd1; } .av-1 { background: #1d7f5a; } .av-2 { background: #b4442a; }
.av-3 { background: #8a6d12; } .av-4 { background: #2a6fbf; } .av-5 { background: #a0336b; }

.panel { background: var(--surface); border-radius: 18px; padding: 44px 48px 48px; min-width: 0; min-height: calc(100vh - 88px); }

/* ---------- Header ------------------------------------------------------ */
h1 { font-size: 48px; font-weight: 800; letter-spacing: -.035em; line-height: 1.05; margin: 0 0 22px; }
.tabs { display: flex; gap: 32px; margin-bottom: 40px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs-spacer { height: 18px; }
.tab { padding: 0 0 10px; font-size: 17px; font-weight: 700; color: var(--muted); position: relative; white-space: nowrap; flex-shrink: 0; }
.tab:hover { color: var(--text); text-decoration: none; }
.tab[aria-current="page"] { color: var(--text); }
.tab[aria-current="page"]::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 3px; border-radius: 3px; background: var(--accent-line); }

.headline-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 24px; }
.headline { font-size: 28px; font-weight: 800; letter-spacing: -.02em; line-height: 1.2; margin: 0 0 8px; }
.subline { font-size: 17px; margin: 0; max-width: 760px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.subline strong { font-weight: 800; }
.link-out { display: inline-flex; align-items: center; gap: 6px; font-weight: 800; font-size: 17px; white-space: nowrap; margin-top: 6px; }
.link-out svg { width: 20px; height: 20px; }

.insights { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-top: 28px; }
.insight { background: var(--fill); border-radius: 12px; padding: 22px 22px 22px 24px; min-height: 152px; display: flex; align-items: center; justify-content: space-between; gap: 16px; font-size: 17px; line-height: 1.45; }
.insight p { margin: 0; }
.insight strong { font-weight: 800; }
.insight .visual { flex-shrink: 0; width: 80px; display: flex; justify-content: center; }
.big-num { font-size: 34px; font-weight: 800; color: var(--accent-ink); letter-spacing: -.02em; }
.mini-donut { width: 66px; height: 66px; transform: rotate(-90deg); }
.mini-donut circle { fill: none; stroke-width: 5; }
.donut-track { stroke: var(--track); }
.donut-fill { stroke: var(--accent-line); stroke-linecap: butt; }

/* ---------- Stats bar --------------------------------------------------- */
.stats-bar { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px 24px; flex-wrap: wrap; margin: 52px 0 8px; }
.stats-label { font-size: 16px; font-weight: 700; color: var(--muted); margin: 0 0 4px; display: flex; align-items: center; gap: 10px; }
.stats-title { font-size: 30px; font-weight: 800; letter-spacing: -.02em; line-height: 1.15; margin: 0; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.info-btn { width: 32px; height: 32px; border-radius: 999px; color: var(--muted); cursor: help; display: inline-flex; align-items: center; justify-content: center; }
.info-btn:hover { color: var(--text); }
.info-btn svg { width: 26px; height: 26px; }
.controls { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.vdiv { width: 1px; height: 28px; background: var(--line); }
.round-btn { width: 44px; height: 44px; border-radius: 999px; border: 2px solid var(--muted); background: none; color: var(--muted); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.round-btn:hover { color: var(--text); border-color: var(--text); }
.round-btn svg { width: 20px; height: 20px; }
.pill-select {
  display: inline-flex; align-items: center; gap: 10px; height: 44px; border-radius: 999px; border: 0; cursor: pointer;
  background: var(--fill); padding: 0 16px 0 18px; font-size: 16px; font-weight: 600; color: var(--text); white-space: nowrap;
}
.pill-select:hover { background: var(--fill-hover); }
.pill-select svg { width: 16px; height: 16px; stroke-width: 2.4; }
button:disabled { cursor: default; }
.round-btn:disabled { opacity: .55; }
.round-btn:disabled:hover { color: var(--muted); border-color: var(--muted); }
.pill-select:disabled:hover { background: var(--fill); }

/* ---------- Buttons, chips, inputs -------------------------------------- */
.pill-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 44px; padding: 0 22px; border-radius: 999px; border: 0; cursor: pointer; font-weight: 700; font-size: 15px; background: var(--text); color: var(--surface); white-space: nowrap; }
.pill-btn:hover { opacity: .88; text-decoration: none; }
.chip { display: inline-block; font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 999px; background: var(--fill-strong); color: var(--muted); white-space: nowrap; letter-spacing: 0; vertical-align: middle; }
.chip.warn { background: var(--red-bg); color: var(--red); }
.chip.ok { background: var(--green-bg); color: var(--green); }
.chip.demo { background: var(--amber-bg); color: var(--amber); }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 700; color: var(--muted); }
.text-input { height: 48px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); padding: 0 14px; font-size: 16px; color: var(--text); min-width: 0; width: 100%; }
.text-input:focus { outline: 0; border-color: var(--accent-ink); }
.note { color: var(--muted); font-size: 14px; margin: 0; }
.error { background: var(--red-bg); color: var(--red); border-radius: 10px; padding: 10px 14px; font-weight: 600; font-size: 15px; }
.success { background: var(--green-bg); color: var(--green); border-radius: 10px; padding: 10px 14px; font-weight: 600; font-size: 15px; }

/* ---------- Tiles ------------------------------------------------------- */
.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-top: 28px; }
.tile { border: 1px solid var(--line); background: var(--fill); border-radius: 10px; padding: 20px 22px 18px; min-height: 132px; display: flex; flex-direction: column; gap: 8px; }
.tile-label { font-size: 16px; font-weight: 700; color: var(--muted); }
.tile-value { font-size: 34px; font-weight: 800; letter-spacing: -.025em; line-height: 1; font-variant-numeric: tabular-nums; margin-top: auto; }
.tile-sub { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }

/* ---------- Charts ------------------------------------------------------ */
.chart-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-top: 48px; flex-wrap: wrap; }
.chart-title { font-size: 20px; font-weight: 800; margin: 0; letter-spacing: -.01em; display: flex; align-items: center; gap: 10px; }
.chart-sub { color: var(--muted); font-size: 15px; font-weight: 600; }
.legend { display: inline-flex; align-items: center; gap: 8px; }
.swatch { display: inline-block; width: 12px; height: 12px; border-radius: 3px; flex-shrink: 0; }
.swatch.s1 { background: var(--s1); } .swatch.s2 { background: var(--s2); margin-left: 8px; }
.chart-wrap { position: relative; height: 280px; margin-top: 16px; }
.chart-wrap svg { display: block; width: 100%; height: 100%; overflow: visible; }
.gridline { stroke: var(--line); stroke-width: 1; }
.axis { fill: var(--muted); font-size: 12px; font-weight: 600; }
.area { fill: var(--accent-soft); }
.line { fill: none; stroke: var(--accent-line); stroke-width: 2; }
.dot { fill: var(--surface); stroke: var(--accent-line); stroke-width: 2.5; }
.dot.on { fill: var(--accent-line); }
.bar-s1 { fill: var(--s1); } .bar-s2 { fill: var(--s2); }
.bar-group:hover rect { opacity: .85; }
.tooltip { position: absolute; left: 0; top: 0; pointer-events: none; transform: translate(-50%, calc(-100% - 14px)); background: var(--tooltip-bg); color: var(--tooltip-text); border-radius: 8px; padding: 8px 12px; font-size: 13px; font-weight: 600; white-space: nowrap; opacity: 0; transition: opacity .12s; }
.tooltip.show { opacity: 1; }
.tooltip strong { display: block; font-size: 15px; font-weight: 800; font-variant-numeric: tabular-nums; }

/* ---------- Tables ------------------------------------------------------ */
.section-title { font-size: 24px; font-weight: 800; letter-spacing: -.02em; margin: 0 0 14px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
* + .section-title { margin-top: 44px; }
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; position: relative; }
table.data { width: 100%; border-collapse: collapse; font-size: 15px; }
table.data th { text-align: left; font-size: 14px; font-weight: 700; color: var(--muted); padding: 12px 16px; border-bottom: 1px solid var(--line); white-space: nowrap; vertical-align: bottom; }
table.data th.num { text-align: right; }
table.data td { padding: 14px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.data tbody tr:hover td { background: var(--fill); }
table.data td:first-child, table.data th:first-child { padding-left: 8px; }
table.data .first, td.first { font-weight: 700; }
table.matrix td { padding-top: 10px; padding-bottom: 10px; }
.tick { color: var(--green); font-size: 12px; }
.stack { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.stack small { font-size: 12px; }
.who { display: inline-flex; align-items: center; gap: 12px; white-space: nowrap; }
.share { display: inline-flex; align-items: center; gap: 10px; justify-content: flex-end; }
.share-bar { width: 120px; height: 8px; flex-shrink: 0; }
.share-track { fill: var(--fill-strong); }
.share-fill { fill: var(--accent); }

/* ---------- Empty states and cards -------------------------------------- */
.empty-card { background: var(--fill); border-radius: 14px; padding: 44px 32px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.empty-card svg { width: 44px; height: 44px; color: var(--muted); stroke-width: 1.6; }
.empty-card h3 { margin: 0; font-size: 20px; font-weight: 800; }
.empty-card p { margin: 0; color: var(--muted); max-width: 520px; }
.report-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.report-card { background: var(--fill); border: 1px solid var(--line); border-radius: 12px; padding: 22px; display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.report-card svg { color: var(--muted); }
.report-card h3 { margin: 6px 0 0; font-size: 18px; font-weight: 800; }
.report-card p { margin: 0 0 6px; color: var(--muted); font-size: 15px; flex: 1; }

.roster { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.roster-card { background: var(--fill); border: 1px solid var(--line); border-radius: 12px; padding: 26px 18px 20px; display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; color: var(--text); }
.roster-card:hover { background: var(--fill-hover); text-decoration: none; }
.roster-name { font-size: 19px; font-weight: 800; margin-top: 6px; }
.roster-meta { color: var(--muted); font-size: 14px; }

.back-link { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-weight: 700; margin: -14px 0 14px; }
.back-link svg { width: 18px; height: 18px; }
.artist-hero { position: relative; display: flex; align-items: flex-end; min-height: 240px; margin: 0 0 28px; padding: 28px 32px; border-radius: 16px; overflow: hidden; background: #222; color: #fff; isolation: isolate; }
.artist-hero .hero-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center 30%; z-index: -2; }
.artist-hero::after { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(to top, rgba(0, 0, 0, .65), rgba(0, 0, 0, 0) 65%); }
.hero-text { display: flex; align-items: center; gap: 14px; }
.artist-hero h1 { margin: 0; font-size: 64px; }

/* ---------- Account ----------------------------------------------------- */
.account-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 40px; align-items: start; }
.facts { margin: 0; display: grid; gap: 1px; background: var(--line); border-radius: 12px; overflow: hidden; }
.facts div { background: var(--fill); padding: 16px 20px; display: flex; justify-content: space-between; gap: 16px; }
.facts dt { color: var(--muted); font-weight: 700; }
.facts dd { margin: 0; font-weight: 600; text-align: right; }
.form-card { display: flex; flex-direction: column; gap: 14px; }
.form-card .section-title { margin: 0; }
.form-actions { display: flex; gap: 12px; }

/* ---------- Sign in ----------------------------------------------------- */
.login-page { min-height: 100vh; min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; }
.login-card { background: var(--surface); border-radius: 18px; padding: 40px 32px 32px; width: min(400px, 100%); }
.login-card form { display: flex; flex-direction: column; gap: 6px; }
.login-card .field { margin-top: 8px; }
.login-card .pill-btn { width: 100%; height: 48px; margin-top: 16px; font-size: 16px; }
.login-card h1 { font-size: 28px; text-align: center; margin: 0 0 22px; }
.login-card .error { margin-bottom: 12px; }
.logo-wrap { position: relative; display: table; margin: 0 auto 34px; }
.logo-wrap .logo { display: block; height: 36px; width: auto; filter: var(--logo-filter); }
.logo-wrap .beta-tag { right: -20px; bottom: -17px; font-size: 11px; padding: 1px 8px; border-color: var(--surface); }
.help { margin: 18px 0 0; text-align: center; font-size: 14px; color: var(--muted); }
.help a { color: var(--muted); }

/* ---------- Responsive -------------------------------------------------- */
@media (max-width: 1100px) {
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .insights, .report-grid { grid-template-columns: minmax(0, 1fr); }
  .account-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 760px) {
  .topbar { grid-template-columns: auto 1fr auto; height: auto; padding: 12px 12px 8px; row-gap: 10px; }
  .search { grid-column: 1 / -1; grid-row: 2; justify-self: stretch; width: 100%; }
  .top-actions { grid-column: 3; grid-row: 1; justify-self: end; gap: 0; }
  .rail-toggle { display: inline-flex; }
  .shell { grid-template-columns: minmax(0, 1fr); padding: 0 8px 8px; }
  .rail { display: none; }
  body.rail-open .rail { display: flex; position: fixed; top: 0; left: 0; bottom: 0; z-index: 45; max-height: none; padding: 12px; background: var(--page); overflow-y: auto; }
  body.rail-open .rail-scrim { display: block; position: fixed; inset: 0; z-index: 44; background: rgba(0, 0, 0, .5); }
  .panel { padding: 22px 14px 28px; border-radius: 14px; }
  h1 { font-size: 32px; margin-bottom: 16px; }
  .artist-hero h1 { font-size: 40px; }
  .artist-hero { min-height: 180px; padding: 20px; }
  .headline { font-size: 24px; }
  .headline-row { flex-direction: column; gap: 8px; }
  .stats-title { font-size: 22px; }
  .tiles { gap: 8px; margin-top: 18px; }
  .tile { min-height: 0; padding: 12px 12px 10px; gap: 6px; }
  .tile-label { font-size: 13px; line-height: 1.25; }
  .tile-value { font-size: 22px; }
  .insight { min-height: 0; padding: 16px; font-size: 15px; }
  .pill-select { height: 38px; padding: 0 12px; font-size: 14px; }
  .round-btn { width: 38px; height: 38px; }
  .vdiv { display: none; }
  .section-title { font-size: 20px; }
  table.data { min-width: 640px; }
  table.data td, table.data th { padding-top: 10px; padding-bottom: 10px; }
  .table-scroll table.data th:first-child, .table-scroll table.data td:first-child { position: sticky; left: 0; z-index: 1; background: var(--surface); box-shadow: 1px 0 0 var(--line); }
}

/* ======================================================================
   Stage 2 — forms, page actions, statements, analysis
   ====================================================================== */
.page-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head h1 { margin: 0; }
.page-head .btn-row form { margin: 0; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.center-row { justify-content: center; }
.pill-btn svg.ic { width: 18px; height: 18px; }
.pill-btn.outline { background: none; color: var(--text); box-shadow: inset 0 0 0 1.5px var(--muted); }
.pill-btn.outline:hover { box-shadow: inset 0 0 0 1.5px var(--text); opacity: 1; }
.pill-btn.sm { height: 36px; padding: 0 16px; font-size: 14px; }
.section-head-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 0 0 14px; }
.section-head-row .section-title { margin: 0; }
.first-title { margin-top: 0 !important; }
.block { display: block; }
.notice { background: var(--green-bg); color: var(--green); border-radius: 10px; padding: 12px 16px; font-weight: 600; margin: 0 0 24px; }
.notice.soft { background: var(--fill); color: var(--muted); font-weight: 500; }
.notice ul, .warn-box ul { margin: 6px 0 0; padding-left: 20px; }
.warn-box { margin: 0 0 24px; }
.lede { font-size: 17px; color: var(--muted); max-width: 820px; margin: 0 0 24px; }
.lede strong { color: var(--text); }
.facts-strip { display: flex; flex-wrap: wrap; gap: 10px 24px; align-items: center; color: var(--muted); margin: -6px 0 28px; font-size: 15px; }
.facts-strip strong { color: var(--text); }
.facts-strip a { font-weight: 700; }

/* Forms */
.form-card { display: flex; flex-direction: column; gap: 18px; max-width: 720px; }
.form-card.wide { max-width: 1040px; }
.form-card .section-title { margin: 18px 0 0; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 20px; }
.form-grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.form-grid .span-2 { grid-column: span 2; }
.field-label { font-size: 14px; font-weight: 700; color: var(--muted); }
.field-hint { font-size: 13px; font-weight: 500; color: var(--muted); }
.field-error { display: block; color: var(--red); font-size: 13px; font-weight: 700; }
.has-error .text-input { border-color: var(--red); }
textarea.text-input { height: auto; padding: 12px 14px; font: inherit; resize: vertical; }
select.text-input { appearance: none; -webkit-appearance: none; padding-right: 36px;
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23a8a8a8' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right 12px center / 16px; }
.text-input.amount { text-align: right; font-variant-numeric: tabular-nums; }
.text-input.narrow { width: 90px; }
.money-field { position: relative; display: flex; align-items: center; }
.money-field .money-r { position: absolute; left: 14px; color: var(--muted); font-weight: 700; pointer-events: none; }
.money-field .text-input { padding-left: 32px; width: 100%; }
.money-field.pct .money-r { left: auto; right: 14px; }
.money-field.pct .text-input { padding-left: 14px; padding-right: 32px; }
.file-input { font-size: 14px; color: var(--muted); }
.file-input::file-selector-button { font: inherit; font-weight: 700; border: 0; border-radius: 999px; padding: 9px 16px; margin-right: 12px; background: var(--fill-strong); color: var(--text); cursor: pointer; }
.photo-row { display: flex; align-items: center; gap: 22px; }
.check { display: flex; align-items: flex-start; gap: 12px; cursor: pointer; }
.check input, .radio-card input { width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--accent); flex-shrink: 0; }
.check span, .radio-card span { display: flex; flex-direction: column; gap: 2px; }
.check small, .radio-card small { color: var(--muted); font-size: 14px; }
.radios { border: 0; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; }
.radios legend { margin-bottom: 8px; padding: 0; }
.radio-card { display: flex; gap: 12px; align-items: flex-start; background: var(--fill); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; cursor: pointer; }
.radio-card:has(input:checked) { border-color: var(--accent-line); background: var(--fill-hover); }
.form-table td, .form-table th { padding: 8px 6px; }
.form-table .text-input { height: 42px; width: 100%; min-width: 96px; }
.form-table td:first-child .text-input { min-width: 150px; }
.form-table .text-input.narrow { min-width: 72px; width: 90px; }
.form-table select.text-input { min-width: 220px; }
.form-table tbody tr:hover td { background: none; }
.row-error td { border-bottom: 0; padding-top: 0; }
.add-row { align-self: flex-start; }
.split-total { font-weight: 700; }
.split-total.bad { color: var(--red); }
.inline-form { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-top: 20px; }
.inline-form .field { min-width: 260px; }
.alloc[hidden], .manual-only[hidden], .share-only[hidden], .unit-only[hidden], .dkoda-share[hidden] { display: none !important; }
select.pill-select.native { appearance: none; -webkit-appearance: none; padding-right: 40px; border: 0;
  background: var(--fill) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23f5f5f5' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right 14px center / 16px; }
:root[data-theme="light"] select.pill-select.native { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23121212' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); }
a.round-btn:hover { text-decoration: none; }
form.stats-bar { margin-top: 52px; }

/* Lists and cards */
.badge { position: absolute; top: 4px; right: 4px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: #d6232f; color: #fff; font-size: 11px; font-weight: 700; line-height: 18px; text-align: center; }
a.icon-btn:hover { text-decoration: none; }
.cover { width: 40px; height: 40px; border-radius: 8px; background: var(--fill-strong); display: inline-flex; align-items: center; justify-content: center; color: var(--muted); flex-shrink: 0; overflow: hidden; }
.cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cover svg.ic { width: 20px; height: 20px; }
.cover.lg { width: 112px; height: 112px; border-radius: 12px; }
.cover.lg svg.ic { width: 40px; height: 40px; }
.row-link { color: var(--text); font-weight: 700; }
a.who:hover { text-decoration: none; }
a.who:hover span { text-decoration: underline; }
.report-card.linked { color: var(--text); }
.report-card.linked:hover { background: var(--fill-hover); text-decoration: none; }
.card-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; width: 100%; font-size: 14px; }
.terms { color: var(--text) !important; font-weight: 700; flex: 0 !important; }
.roster-owed { font-size: 14px; font-weight: 700; }
.hero-btn { position: absolute; top: 20px; right: 20px; background: rgba(0, 0, 0, .55); color: #fff; backdrop-filter: blur(6px); }
.low-row td { background: color-mix(in srgb, var(--red-bg) 45%, transparent); }
table.data tfoot td { font-weight: 800; border-bottom: 0; padding-top: 16px; }
table.data tr.subtotal td { font-weight: 700; border-top: 2px solid var(--line); }
table.data tr.subtle td { color: var(--muted); }
table.data tr.group-head td { font-weight: 800; color: var(--muted); font-size: 14px; padding-top: 22px; }
table.data tr.current-row td { background: var(--fill); }
table.data.small td, table.data.small th { font-size: 13px; padding: 8px 10px; }
table.wrap-heads th.num { white-space: normal; min-width: 76px; }
table.pnl td { padding-top: 10px; padding-bottom: 10px; }
table.pnl .split-row td { font-weight: 600; padding-top: 6px; }
.gridline.zero { stroke: var(--muted); }
.split-columns { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 32px; align-items: start; margin-top: 8px; }
.split-columns .report-grid { grid-template-columns: minmax(0, 1fr); }
.pool { border: 1px solid var(--line); border-radius: 14px; padding: 22px 24px; margin-bottom: 18px; background: var(--surface); }
.pool-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 8px; }
.pool-head h3 { margin: 0 0 4px; font-size: 20px; }
.pool-head h3 a { color: var(--text); }
.pool-head p { margin: 0; font-size: 14px; }
.trace { margin-top: 16px; }
.trace summary { cursor: pointer; font-weight: 700; color: var(--muted); }
.trace summary:hover { color: var(--text); }
.release-card { display: flex; gap: 20px; justify-content: space-between; align-items: center; flex-wrap: wrap; background: var(--fill); border-radius: 14px; padding: 20px 22px; margin: 28px 0; }
.release-card h3 { margin: 0 0 4px; font-size: 18px; }
.release-card p { margin: 0; }
.release-card form { margin: 0; }
.release-text { flex: 1 1 320px; }

/* Statement */
.statement-head { display: flex; justify-content: space-between; gap: 24px; flex-wrap: wrap; align-items: flex-start; margin-bottom: 24px; }
.statement-meta { display: grid; grid-template-columns: auto auto; gap: 4px 18px; margin: 0; }
.statement-meta div { display: contents; }
.statement-meta dt { color: var(--muted); font-weight: 700; }
.statement-meta dd { margin: 0; font-weight: 600; text-align: right; }
.statement-summary { max-width: 640px; margin-bottom: 32px; }

@media (max-width: 960px) {
  .split-columns { grid-template-columns: minmax(0, 1fr); }
  .form-grid.four { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .form-grid, .form-grid.four { grid-template-columns: minmax(0, 1fr); }
  .form-grid .span-2 { grid-column: auto; }
  .photo-row { flex-direction: column; align-items: flex-start; }
  .pool { padding: 16px; }
  .hero-btn { top: 12px; right: 12px; }
}
@media print {
  .topbar, .rail, .no-print, .tabs, [data-print], .notice { display: none !important; }
  body { background: #fff; color: #000; }
  .shell { display: block; padding: 0; }
  .panel { padding: 0; min-height: 0; background: #fff; }
  :root { --text: #000; --muted: #555; --line: #ccc; --surface: #fff; --fill: #f5f5f5; }
  .pool { break-inside: avoid; }
}

/* ---- Stage 3: integrations ---- */
.radio-pill { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 999px; background: var(--fill); border: 1px solid var(--line); font-weight: 600; cursor: pointer; }
.radio-pill:has(input:checked) { background: var(--fill-strong); border-color: var(--text); }
.radio-pill input { accent-color: var(--text); margin: 0; }
details.later { margin-top: 28px; }
details.later > summary { cursor: pointer; list-style: none; }
details.later > summary::before { content: '+ '; color: var(--muted); }
details.later[open] > summary::before { content: '− '; }
.plain-list { margin: 0 0 16px; padding-left: 20px; }
.plain-list li { margin: 4px 0; }
.block { display: block; }
.neg { color: var(--red); }

/* ---- Stage 4: closing checklist and reports ---- */
.checklist { list-style: none; padding: 0; margin: 24px 0; display: grid; gap: 10px; }
.check-step { background: var(--fill); border: 1px solid var(--line); border-radius: 12px; padding: 16px 20px; }
.check-step.done { opacity: .75; }
.check-step.blocked { border-color: var(--red); }
.check-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.check-num { width: 26px; height: 26px; border-radius: 50%; background: var(--fill-strong); display: inline-flex; align-items: center; justify-content: center; font-weight: 800; font-size: 13px; }
.check-step.done .check-num { background: var(--green-bg); color: var(--green); }
.check-link { margin-left: auto; font-weight: 700; }
.check-step .plain-list { margin: 10px 0 8px 38px; color: var(--muted); }
.check-step form, .check-step > p { margin-left: 38px; }
.filter-bar { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; margin: 0 0 20px; }
.filter-bar .field { min-width: 150px; margin: 0; }
.report-table td.num, .report-table th.num { white-space: nowrap; }
.table-tools { display: flex; align-items: center; gap: 12px; margin: 0 0 10px; }
.table-tools .table-filter { max-width: 280px; padding: 8px 12px; }
.error-page { background: var(--bg, #000); color: var(--text, #fff); display: grid; place-items: center; min-height: 100vh; padding: 24px; }
.error-panel { max-width: 560px; min-height: 0; }
.error-panel pre { white-space: pre-wrap; font-size: 12px; overflow: auto; }
