/* Extolly's stage: soft grey, ink and amber. Light only. Tokens match the website's globals.css. */
:root {
  color-scheme: light;
  --ink: #1f2023;
  --dim: #70727a;
  --muted: #50525a;
  --faint: #9a9ca3;
  --hair: rgba(31, 32, 35, 0.08);
  --dash: rgba(31, 32, 35, 0.16);
  --amber: #e2a416;
  --amber-soft: #fbf0cf;
  --green-bg: #e3efe3; --green-ink: #2f5c33;
  --yellow-bg: #fbf0cf; --yellow-ink: #7f5600;
  --red-bg: #fbe3e4; --red-ink: #9f2f2d;
  --age-1: #a0a2a9; --age-2: #787a81; --age-3: #4e5057; --age-4: #1f2023;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --sans: "Geist", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Geist Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
  --card: rgba(255, 255, 255, 0.76);
  --shadow: inset 0 1px 0 #fff, 0 10px 26px rgba(40, 44, 52, 0.05);
}
@font-face { font-family: "Geist"; src: url("/fonts/Geist-Variable.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "Geist Mono"; src: url("/fonts/GeistMono-Variable.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }
body {
  margin: 0; min-height: 100dvh; color: var(--ink); font: 15px/1.5 var(--sans); -webkit-font-smoothing: antialiased;
  background: radial-gradient(120% 60% at 50% 0%, #eeeff1 0%, rgba(238, 239, 241, 0) 62%), linear-gradient(180deg, #e2e3e6 0%, #d8d9dd 100%) fixed;
}
::selection { background: #f3cf6e; color: var(--ink); }
button, a, input, select, textarea { font: inherit; color: inherit; touch-action: manipulation; }
h1, h2, h3, p { margin: 0; }
a { text-decoration: none; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

/* ---------- controls ---------- */
.pill {
  display: inline-flex; flex: none; height: 40px; align-items: center; justify-content: center; gap: 8px; border: 0; cursor: pointer;
  border-radius: 999px; padding: 0 16px; font-size: 14px; font-weight: 500; white-space: nowrap;
  background: #f6f6f7; box-shadow: inset 0 1px 0 #fff, 0 6px 16px rgba(40, 44, 52, 0.12); transition: transform 200ms var(--ease), background-color 200ms;
}
.pill:hover { background: #fff; }
.pill:active { transform: scale(0.98); }
.pill:disabled { opacity: 0.55; pointer-events: none; }
.pill.dark { background: var(--ink); color: #f6f6f7; box-shadow: 0 8px 20px rgba(31, 32, 35, 0.22); }
.pill.dark:hover { background: #33353a; }
.pill.wide { width: 100%; height: 48px; font-size: 15px; }
.pill.small { height: 34px; padding: 0 13px; font-size: 13px; }
.pill.round { width: 40px; padding: 0; }
.pill.busy svg { animation: spin 0.9s linear infinite; }
.pill.danger { color: var(--red-ink); }
.linkish { background: none; border: 0; padding: 0; cursor: pointer; font-size: 13px; font-weight: 500; text-decoration: underline; text-decoration-color: rgba(31, 32, 35, 0.35); text-underline-offset: 4px; }
.tag { display: inline-flex; flex: none; height: 22px; align-items: center; gap: 5px; border-radius: 999px; padding: 0 8px; font-size: 11.5px; font-weight: 500; white-space: nowrap; }
.tag.green { background: var(--green-bg); color: var(--green-ink); }
.tag.yellow { background: var(--yellow-bg); color: var(--yellow-ink); }
.tag.red { background: var(--red-bg); color: var(--red-ink); }
.tag.plain { background: rgba(31, 32, 35, 0.07); color: #55565c; }
.tag.ink { background: var(--ink); color: #fff; }
.tag i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.field { display: block; width: 100%; height: 44px; border: 0; border-radius: 14px; padding: 0 14px; font-size: 16px; color: var(--ink); background: #fff; box-shadow: inset 0 0 0 1px rgba(31, 32, 35, 0.14); }
.field::placeholder { color: #8a8c93; }
.field:focus { outline: none; box-shadow: inset 0 0 0 1.5px rgba(31, 32, 35, 0.6); }
select.field { appearance: none; padding-right: 34px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 4.5 6 8l3.5-3.5' fill='none' stroke='%2350525a' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 13px center; cursor: pointer; }
.field.sm { height: 38px; font-size: 14px; border-radius: 12px; padding: 0 12px; }
select.field.sm { padding-right: 30px; background-position: right 11px center; }
.fld { display: grid; gap: 6px; min-width: 0; }
.fld > span { font-size: 13px; color: var(--muted); }
.seg { display: inline-grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 3px; padding: 3px; border-radius: 999px; background: rgba(31, 32, 35, 0.07); }
.seg button { height: 34px; padding: 0 14px; border: 0; border-radius: 999px; background: none; cursor: pointer; font-size: 13.5px; color: var(--muted); white-space: nowrap; }
.seg button[aria-pressed="true"] { background: var(--ink); color: #f6f6f7; font-weight: 500; }
.seg.full { display: grid; }
.switch { flex: none; width: 46px; height: 28px; border-radius: 999px; border: 0; padding: 3px; cursor: pointer; background: rgba(31, 32, 35, 0.18); transition: background-color 200ms; }
.switch::after { content: ""; display: block; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25); transition: transform 250ms var(--ease); }
.switch[aria-checked="true"] { background: var(--ink); }
.switch[aria-checked="true"]::after { transform: translateX(18px); }
.chip { flex: none; height: 36px; padding: 0 14px; border: 0; border-radius: 999px; cursor: pointer; font-size: 13.5px; color: var(--muted); background: rgba(255, 255, 255, 0.7); box-shadow: inset 0 0 0 1px var(--hair); transition: background-color 200ms, color 200ms; }
.chip:hover { background: #fff; color: var(--ink); }
.chip[aria-pressed="true"] { background: var(--ink); color: #f6f6f7; font-weight: 500; box-shadow: none; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.token { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 6px 0 12px; border-radius: 999px; background: #fff; box-shadow: inset 0 0 0 1px var(--hair); font-size: 13px; }
.token button { width: 22px; height: 22px; border: 0; border-radius: 50%; background: rgba(31, 32, 35, 0.07); cursor: pointer; display: grid; place-items: center; padding: 0; }
.glass { border: 1px solid rgba(255, 255, 255, 0.7); background: rgba(236, 237, 239, 0.78); -webkit-backdrop-filter: blur(14px) saturate(1.1); backdrop-filter: blur(14px) saturate(1.1); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85), 0 10px 30px rgba(40, 44, 52, 0.08); }

/* ---------- shell ---------- */
.logo { display: inline-flex; align-items: center; gap: 8px; font-size: 18px; font-weight: 600; letter-spacing: -0.035em; flex: none; }
.side { display: none; }
.col { min-width: 0; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 8px; padding: max(10px, env(safe-area-inset-top)) 12px 8px; }
.topbar .glassbar { flex: 1; min-width: 0; height: 52px; border-radius: 999px; display: flex; align-items: center; gap: 10px; padding: 0 6px 0 14px; }
.search-btn { flex: 1; min-width: 0; display: flex; align-items: center; gap: 9px; height: 40px; border: 0; background: none; cursor: text; color: var(--dim); font-size: 14px; text-align: left; padding: 0; overflow: hidden; white-space: nowrap; }
.search-btn kbd { margin-left: auto; font: 500 11px var(--mono); padding: 2px 6px; border-radius: 6px; background: rgba(31, 32, 35, 0.07); color: var(--muted); }
.page { padding: 14px 14px calc(96px + env(safe-area-inset-bottom, 0px)); min-width: 0; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 10px 16px; margin-bottom: 14px; }
.page-head .lead { min-width: 0; flex: 1 1 260px; }
.kicker { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 500; color: var(--muted); }
.kicker::before { content: ""; width: 0.8rem; aspect-ratio: 1; background: var(--amber); clip-path: polygon(50% 4%, 61% 36%, 96% 37%, 68% 58%, 79% 92%, 50% 71%, 21% 92%, 32% 58%, 4% 37%, 39% 36%); }
.page-title { font-size: 27px; font-weight: 500; letter-spacing: -0.035em; line-height: 1.15; margin-top: 2px; }
input.page-title { display: block; width: 100%; border: 0; background: none; padding: 0; outline: none; text-overflow: ellipsis; }
input.page-title::placeholder { color: var(--faint); }
.page-sub { font-size: 13px; color: var(--muted); margin-top: 4px; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.tabbar { position: fixed; inset: auto 0 0 0; z-index: 20; border-left: 0; border-right: 0; border-bottom: 0; padding-bottom: env(safe-area-inset-bottom, 0px); }
.tabbar div { max-width: 480px; margin: 0 auto; height: 62px; display: grid; grid-template-columns: repeat(5, 1fr); }
.tabbar a, .tabbar button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 11px; color: var(--muted); border: 0; background: none; cursor: pointer; padding: 0; }
.tabbar span { display: grid; place-items: center; width: 54px; height: 30px; border-radius: 999px; transition: background-color 200ms, color 200ms; }
.tabbar [aria-current="page"] { color: var(--ink); font-weight: 500; }
.tabbar [aria-current="page"] span { background: var(--ink); color: #fff; }

.nav { display: grid; gap: 1px; }
.nav a, .nav button { display: flex; align-items: center; gap: 10px; min-height: 38px; padding: 0 10px; border: 0; background: none; border-radius: 12px; font-size: 14px; color: var(--muted); cursor: pointer; text-align: left; width: 100%; transition: background-color 200ms, color 200ms; }
.nav a:hover, .nav button:hover { background: rgba(31, 32, 35, 0.05); color: var(--ink); }
.nav a[aria-current="page"] { background: var(--ink); color: #fff; font-weight: 500; }
.nav .count { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; display: grid; place-items: center; font-size: 11px; font-weight: 600; background: var(--amber); color: var(--ink); }
.nav-label { display: flex; align-items: center; justify-content: space-between; margin: 14px 10px 4px; font-size: 12px; color: var(--faint); }
.nav-label button { width: 24px; height: 24px; min-height: 0; padding: 0; justify-content: center; border-radius: 8px; }
.tree { margin-left: 19px; padding-left: 9px; border-left: 1px solid var(--dash); }
.tree a { min-height: 32px; font-size: 13.5px; }
.tree a span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- menus, sheets, palette ---------- */
.menu { position: fixed; z-index: 70; min-width: 220px; max-width: calc(100vw - 16px); padding: 6px; border-radius: 16px; background: #fff; border: 1px solid var(--hair); box-shadow: 0 18px 44px rgba(31, 32, 35, 0.2); }
.menu button, .menu a { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 40px; padding: 0 10px; border: 0; background: none; border-radius: 10px; cursor: pointer; font-size: 14px; text-align: left; }
.menu button:hover, .menu a:hover, .menu button:focus-visible { background: rgba(31, 32, 35, 0.06); outline: none; }
.menu button[aria-pressed="true"] { font-weight: 500; }
.menu button[aria-pressed="true"]::after { content: ""; margin-left: auto; width: 14px; height: 8px; border-left: 2px solid var(--ink); border-bottom: 2px solid var(--ink); transform: translateY(-2px) rotate(-45deg); }
.menu hr { border: 0; border-top: 1px solid var(--hair); margin: 6px 4px; }
.menu .menu-form { display: grid; gap: 8px; padding: 6px 6px 4px; }
.menu small { display: block; padding: 4px 10px; font-size: 12px; color: var(--faint); }
dialog { color: var(--ink); }
dialog.sheet { margin: auto auto 0; width: 100%; max-width: 32rem; max-height: 92dvh; overflow-y: auto; border: 0; border-radius: 28px 28px 0 0; padding: 0; background: #f1f1f3; box-shadow: 0 -20px 60px rgba(31, 32, 35, 0.25); }
dialog::backdrop { background: rgba(31, 32, 35, 0.42); }
.sheet-head { position: sticky; top: 0; z-index: 2; display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 20px 20px 12px; background: #f1f1f3; }
.sheet-head h2 { font-size: 21px; font-weight: 500; letter-spacing: -0.03em; line-height: 1.2; }
.sheet-head p { font-size: 13px; color: var(--muted); margin-top: 2px; }
.sheet-body { padding: 0 20px calc(26px + env(safe-area-inset-bottom, 0px)); display: grid; gap: 18px; }
.sheet-body h3 { font-size: 13px; font-weight: 400; color: var(--muted); margin-bottom: 6px; }
.close { flex: none; width: 40px; height: 40px; display: grid; place-items: center; border: 0; border-radius: 999px; cursor: pointer; background: #fff; box-shadow: 0 6px 16px rgba(40, 44, 52, 0.1); }
dialog.palette { margin: 9vh auto auto; width: calc(100% - 24px); max-width: 560px; border: 0; padding: 0; border-radius: 22px; background: #fff; box-shadow: 0 30px 80px rgba(31, 32, 35, 0.35); overflow: hidden; }
.palette input { display: block; width: 100%; height: 56px; border: 0; outline: none; padding: 0 20px; font-size: 16px; border-bottom: 1px solid var(--hair); }
.palette-list { max-height: min(56vh, 420px); overflow-y: auto; padding: 6px; }
.palette-list button { display: flex; align-items: center; gap: 12px; width: 100%; padding: 9px 12px; border: 0; background: none; border-radius: 12px; cursor: pointer; text-align: left; }
.palette-list button[aria-selected="true"] { background: rgba(31, 32, 35, 0.07); }
.palette-list b { font-weight: 500; font-size: 14px; }
.palette-list small { margin-left: auto; font-size: 12px; color: var(--faint); white-space: nowrap; }
.palette-none { padding: 18px; font-size: 14px; color: var(--muted); }
.toast { position: fixed; left: 50%; bottom: calc(84px + env(safe-area-inset-bottom, 0px)); z-index: 80; transform: translate(-50%, 20px); padding: 10px 16px; border-radius: 999px; background: var(--ink); color: #f6f6f7; font-size: 13.5px; box-shadow: 0 12px 30px rgba(31, 32, 35, 0.3); opacity: 0; pointer-events: none; transition: opacity 200ms, transform 300ms var(--ease); max-width: calc(100vw - 32px); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- cards and grid ---------- */
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; transition: opacity 150ms; }
.grid.stale { opacity: 0.55; }
.grid > * { grid-column: span 2; min-width: 0; }
.grid > .stat { grid-column: span 1; }
.grid > .stat.lead { grid-column: span 2; }
.card { border-radius: 20px; border: 1px solid rgba(255, 255, 255, 0.85); background: var(--card); padding: 18px 16px; box-shadow: var(--shadow); min-width: 0; }
.card.ink { background: linear-gradient(180deg, #2b2c30 0%, #1f2023 100%); border-color: transparent; color: #f6f6f7; box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), 0 18px 40px rgba(31, 32, 35, 0.25); }
.card.ink h2, .card.ink .stat-label, .card.ink .stat-note { color: #b9bac0; }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 14px; }
.card h2 { font-size: 14.5px; font-weight: 500; letter-spacing: -0.005em; color: var(--muted); }
.card .sub { margin-top: 3px; font-size: 13px; line-height: 1.45; color: var(--ink); text-wrap: pretty; }
.head-fig { flex: none; text-align: right; }
.head-fig small { display: block; font-size: 12px; color: var(--muted); }
.inset { border-radius: 16px; border: 1px solid var(--hair); background: #fff; }
.fig { font-family: var(--mono); font-weight: 500; letter-spacing: -0.045em; font-size: 24px; line-height: 1.15; white-space: nowrap; }
.fig .dim { color: var(--faint); }
.stat { padding: 14px 14px 13px; display: flex; flex-direction: column; }
.stat-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 22px; }
.stat-label { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat .fig { margin: 10px 0 8px; font-size: clamp(21px, 6vw, 26px); overflow: hidden; text-overflow: ellipsis; }
.stat.lead .fig { font-size: clamp(34px, 10vw, 40px); margin: 6px 0 6px; }
.stat-note { font-size: 12.5px; line-height: 1.4; color: var(--muted); margin-top: auto; }
button.stat { border: 1px solid rgba(255, 255, 255, 0.85); text-align: left; cursor: pointer; }
button.stat[aria-pressed="true"] { box-shadow: inset 0 0 0 2px var(--ink), var(--shadow); }
.hero { display: grid; gap: 14px; }
.hero-top { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 18px; }
.hero-fig { font-family: var(--mono); font-weight: 500; letter-spacing: -0.07em; font-size: clamp(36px, 9.5vw, 54px); line-height: 1.02; white-space: nowrap; }
.hero-fig .dim { color: var(--faint); }
.hero-line { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-top: 8px; font-size: 13px; color: var(--muted); }
.share { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 0 16px; }
.share::-webkit-scrollbar { display: none; }
.share div { display: flex; flex: 1 0 auto; align-items: center; gap: 8px; height: 38px; padding: 0 14px; border-radius: 999px; background: #fff; box-shadow: inset 0 0 0 1px var(--hair); font-size: 13px; white-space: nowrap; }
.share i { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--ink); }
.share span { color: var(--muted); }
.share b { font-family: var(--mono); font-weight: 500; letter-spacing: -0.03em; margin-left: auto; padding-left: 6px; }
.share em { font-style: normal; color: var(--faint); font-size: 12px; }

/* ---------- charts ---------- */
.chart { position: relative; width: 100%; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart text { font: 11.5px var(--sans); fill: var(--muted); font-variant-numeric: tabular-nums; }
.chart .cap { fill: var(--ink); font-weight: 500; font-family: var(--mono); font-size: 11px; letter-spacing: -0.03em; }
.chart .hit { fill: transparent; outline: none; }
.chart .hit.on, .chart .hit:focus-visible { fill: rgba(31, 32, 35, 0.05); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12.5px; color: var(--muted); margin: 0 0 8px; }
.legend i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; }
.legend i.hatch { background: repeating-linear-gradient(135deg, #b9bbc1 0 2px, #e6e6ea 2px 4px); }
.tip { position: fixed; z-index: 90; pointer-events: none; background: #fff; font-size: 12.5px; line-height: 1.5; padding: 8px 12px; border-radius: 12px; max-width: 250px; border: 1px solid var(--hair); box-shadow: 0 12px 30px rgba(31, 32, 35, 0.16); opacity: 0; transition: opacity 100ms; }
.tip.show { opacity: 1; }
.tip b { font-weight: 500; color: var(--muted); }
.tip .k { color: var(--muted); }
.tip .v { font-family: var(--mono); letter-spacing: -0.03em; }

/* ---------- tables and lists ---------- */
.scroll-x { overflow-x: auto; margin: 0 -16px; padding: 0 16px; scrollbar-width: thin; }
table.data { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.data th { font-weight: 400; font-size: 12.5px; color: var(--muted); text-align: right; padding: 0 0 8px 14px; white-space: nowrap; }
table.data th button { border: 0; background: none; padding: 0; cursor: pointer; color: inherit; font-size: inherit; display: inline-flex; align-items: center; gap: 4px; }
table.data th button[aria-sort]::after { content: ""; border: 4px solid transparent; }
table.data th button[aria-sort="descending"]::after { border-top-color: var(--ink); transform: translateY(2px); }
table.data th button[aria-sort="ascending"]::after { border-bottom-color: var(--ink); transform: translateY(-2px); }
table.data td { text-align: right; padding: 11px 0 11px 14px; border-top: 1px dashed var(--dash); white-space: nowrap; font-family: var(--mono); letter-spacing: -0.03em; font-size: 13px; }
table.data th:first-child, table.data td:first-child { text-align: left; padding-left: 0; white-space: normal; font-family: inherit; letter-spacing: 0; font-size: 13.5px; font-weight: 500; min-width: 120px; }
table.data td small { display: block; font-family: var(--sans); letter-spacing: 0; font-weight: 400; font-size: 12.5px; color: var(--muted); }
table.data tr[data-open], table.data tr[data-bill] { cursor: pointer; }
table.data tr[data-open]:hover td, table.data tr[data-bill]:hover td { background: rgba(31, 32, 35, 0.035); }
table.data tfoot td { border-top: 1px solid var(--ink); font-weight: 600; }
table.data .up { color: var(--green-ink); }
table.data .down { color: var(--red-ink); }
.bl { display: grid; gap: 2px; margin: 0 -8px; }
.bl-row { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 8px; border-radius: 12px; }
button.bl-row { cursor: pointer; transition: background-color 200ms; }
button.bl-row:hover { background: rgba(31, 32, 35, 0.04); }
.bl-top { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.bl-name { font-size: 13.5px; font-weight: 500; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bl-val { flex: none; font-family: var(--mono); letter-spacing: -0.03em; font-size: 13px; }
.bl-bar { height: 8px; margin: 6px 0 5px; border-radius: 999px; background: rgba(31, 32, 35, 0.07); }
.bl-fill { height: 100%; min-width: 8px; background: var(--ink); border-radius: 999px; }
.bl-meta { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rows { display: grid; margin: 0 -8px; }
.row { display: flex; width: 100%; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 8px; border: 0; background: none; text-align: left; border-radius: 12px; position: relative; }
.row + .row::before { content: ""; position: absolute; left: 8px; right: 8px; top: 0; border-top: 1px dashed var(--dash); }
button.row, a.row { cursor: pointer; transition: background-color 200ms; }
button.row:hover, a.row:hover { background: rgba(31, 32, 35, 0.04); }
.row-main { min-width: 0; }
.row-name { display: flex; align-items: center; gap: 6px; font-size: 13.5px; font-weight: 500; }
.row-name > span:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-name .tag { height: 20px; font-size: 11px; padding: 0 7px; }
.row-meta { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-val { flex: none; text-align: right; font-family: var(--mono); letter-spacing: -0.03em; font-size: 13px; }
.row-val small { display: block; font-family: var(--sans); letter-spacing: 0; color: var(--muted); font-size: 12.5px; }
.empty { font-size: 13.5px; color: var(--muted); padding: 4px 0; }
.chev { flex: none; color: var(--dim); }
.more { margin-top: 10px; }
.line { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; font-size: 13.5px; color: var(--muted); }
.line + .line { border-top: 1px dashed var(--dash); }
.line > span:last-child { color: var(--ink); font-family: var(--mono); letter-spacing: -0.03em; font-size: 13px; white-space: nowrap; }
.line.total { color: var(--ink); font-weight: 500; }
.rule { border: 0; border-top: 1px dashed var(--dash); margin: 16px 0 12px; }
.mini-h { font-size: 13px; color: var(--muted); margin: 0 0 4px; }
.checks { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 13.5px; font-weight: 500; }
.check svg { flex: none; margin-top: 2px; }
.check small { display: block; font-weight: 400; color: var(--muted); font-size: 12.5px; }
.mini-tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.mini-tiles .stat { padding: 12px 14px; }
.mini-tiles .stat .fig { font-size: 20px; margin: 4px 0; }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.notice { text-align: center; padding: 34px 22px; }
.notice b { display: block; font-size: 19px; font-weight: 500; letter-spacing: -0.02em; margin-bottom: 6px; }
.notice p { color: var(--muted); margin-bottom: 18px; }
.tiles-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }
a.tile-link { display: block; padding: 16px; transition: transform 300ms var(--ease), box-shadow 300ms; }
a.tile-link:hover { transform: translateY(-2px); box-shadow: inset 0 1px 0 #fff, 0 18px 36px rgba(40, 44, 52, 0.1); }
a.tile-link b { display: block; font-weight: 500; font-size: 15px; letter-spacing: -0.01em; }
a.tile-link small { display: block; margin-top: 4px; font-size: 12.5px; line-height: 1.45; color: var(--muted); }

/* ---------- builders ---------- */
.builder { display: grid; gap: 12px; }
.builder-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.builder-row > label { font-size: 13px; color: var(--muted); min-width: 64px; }
.cond { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr) minmax(0, 1fr) auto; gap: 6px; align-items: center; }
.cond .two { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.icon-x { width: 34px; height: 34px; border: 0; border-radius: 50%; background: rgba(31, 32, 35, 0.06); cursor: pointer; display: grid; place-items: center; padding: 0; flex: none; }
.icon-x:hover { background: rgba(31, 32, 35, 0.12); }
.form-error { font-size: 13.5px; line-height: 1.45; color: var(--red-ink); }

/* ---------- bill editor ---------- */
.editor { display: grid; gap: 12px; align-items: start; }
.editor .stack { display: grid; gap: 12px; }
.pick { position: relative; }
.pick-list { position: absolute; z-index: 15; left: 0; right: 0; top: calc(100% + 4px); max-height: 252px; overflow-y: auto; padding: 4px; border-radius: 14px; background: #fff; border: 1px solid var(--hair); box-shadow: 0 14px 34px rgba(31, 32, 35, 0.18); }
.pick-opt { display: flex; align-items: baseline; gap: 10px; width: 100%; text-align: left; border: 0; background: none; padding: 9px 10px; border-radius: 10px; cursor: pointer; }
.pick-opt:hover, .pick-opt:focus-visible, .pick-opt[aria-selected="true"] { background: rgba(31, 32, 35, 0.06); outline: none; }
.pick-opt b { font-weight: 500; font-size: 14px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pick-opt small { margin-left: auto; flex: none; font-size: 12.5px; color: var(--muted); }
.pick-opt.new b { font-weight: 400; }
.bill-lines { display: grid; gap: 8px; }
.bill-line { display: grid; gap: 8px; padding: 10px; border-radius: 16px; background: #fff; border: 1px solid var(--hair); }
.bill-line .field { background: #f6f6f7; box-shadow: none; }
.bill-line .field:focus { box-shadow: inset 0 0 0 1.5px rgba(31, 32, 35, 0.6); background: #fff; }
.line-nums { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.line-nums label { display: grid; gap: 3px; font-size: 11.5px; color: var(--faint); }
.line-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 22px; }
.hint { font-size: 12.5px; line-height: 1.4; color: var(--muted); }
.hint.warn { color: var(--yellow-ink); }
.line-amt { font-family: var(--mono); letter-spacing: -0.03em; font-size: 13px; white-space: nowrap; }
.setting { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.setting b { display: block; font-weight: 500; font-size: 14px; }
.setting small { display: block; font-size: 12.5px; line-height: 1.4; color: var(--muted); }
.result { padding: 16px; display: grid; gap: 8px; }
.result .tag { justify-self: start; }
.result h3 { font-size: 18px; font-weight: 500; letter-spacing: -0.02em; line-height: 1.25; color: var(--ink); margin: 0; }
.result p { font-size: 13.5px; line-height: 1.5; color: var(--muted); }
.stickybar { position: sticky; bottom: calc(70px + env(safe-area-inset-bottom, 0px)); z-index: 5; display: flex; gap: 8px; padding: 8px; border-radius: 999px; }
.stickybar .pill { flex: 1; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes sheet-up { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes pop { from { transform: scale(0.97); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: no-preference) {
  .rise > * { animation: rise 500ms var(--ease) both; animation-delay: calc(var(--n, 0) * 30ms); }
  dialog.sheet[open] { animation: sheet-up 420ms var(--ease); }
  dialog.palette[open], .menu { animation: pop 180ms var(--ease); }
}
@media (prefers-reduced-motion: reduce) { .pill.busy svg { animation: none; } }

@media (max-width: 519px) {
  table.data .wide { display: none; }
  .cond { grid-template-columns: 1fr 1fr; }
  .cond > :nth-child(3) { grid-column: 1; }
}
@media (min-width: 640px) {
  dialog.sheet { margin: auto; border-radius: 28px; }
  .line-nums { grid-template-columns: repeat(3, minmax(0, 120px)); }
}
@media (min-width: 700px) {
  .grid { gap: 14px; }
  .grid > .half { grid-column: span 1; }
  .card { padding: 20px; }
  .stat { padding: 16px; }
  .page { padding: 18px 22px calc(96px + env(safe-area-inset-bottom, 0px)); }
  .scroll-x { margin: 0 -20px; padding: 0 20px; }
  .share { flex-wrap: wrap; overflow: visible; margin: 0; padding: 0; }
}
@media (min-width: 1000px) {
  .tabbar, .only-phone { display: none !important; }
  .app { display: grid; grid-template-columns: 244px minmax(0, 1fr); gap: 4px; padding: 12px; }
  .side { display: flex; flex-direction: column; position: sticky; top: 12px; height: calc(100dvh - 24px); border-radius: 24px; padding: 18px 10px 10px; border: 1px solid rgba(255, 255, 255, 0.9); background: var(--card); box-shadow: var(--shadow); overflow: hidden; }
  .side .logo { padding: 0 10px; }
  .side-scroll { flex: 1; min-height: 0; overflow-y: auto; margin: 14px -4px 0; padding: 0 4px; scrollbar-width: thin; }
  .side-foot { display: grid; gap: 8px; padding-top: 10px; }
  .side-status { border-radius: 16px; background: rgba(31, 32, 35, 0.045); padding: 12px; display: grid; gap: 8px; font-size: 12.5px; line-height: 1.45; color: var(--muted); }
  .side-status .tag { justify-self: start; }
  .topbar { padding: 0 8px 10px 16px; position: static; }
  .topbar .glassbar { background: var(--card); -webkit-backdrop-filter: none; backdrop-filter: none; border-color: rgba(255, 255, 255, 0.9); box-shadow: var(--shadow); }
  .page { padding: 6px 8px 40px 16px; }
  .page-title { font-size: 30px; }
  .editor { grid-template-columns: minmax(0, 1.7fr) minmax(300px, 1fr); gap: 14px; }
  .stickybar { position: static; padding: 0; background: none; border: 0; box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none; }
  .toast { bottom: 28px; }
}
@media (min-width: 1280px) {
  .grid { grid-template-columns: repeat(20, minmax(0, 1fr)); }
  .grid > * { grid-column: span 20; }
  .grid > .s4, .grid > .stat.lead.s4 { grid-column: span 4; }
  .grid > .s5 { grid-column: span 5; }
  .grid > .s6 { grid-column: span 6; }
  .grid > .s7 { grid-column: span 7; }
  .grid > .s8 { grid-column: span 8; }
  .grid > .s10 { grid-column: span 10; }
  .grid > .s12 { grid-column: span 12; }
  .grid > .s13 { grid-column: span 13; }
  .grid > .s14 { grid-column: span 14; }
  .stat .fig, .stat.lead .fig { font-size: 25px; margin: 12px 0 8px; }
}
@media (min-width: 1700px) {
  .app { grid-template-columns: 264px minmax(0, 1fr); padding: 16px; }
  .grid { gap: 18px; }
  .card { padding: 24px; }
  .stat .fig, .stat.lead .fig { font-size: 29px; }
}
