/* The Church Books — design system v2. Hand-written, no build step. Light + dark themes via tokens. */
@font-face { font-family: "Inter"; src: url("../fonts/inter-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Inter"; src: url("../fonts/inter-latin-500-normal.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Inter"; src: url("../fonts/inter-latin-600-normal.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Inter"; src: url("../fonts/inter-latin-700-normal.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "TCB Serif"; src: url("../fonts/source-serif-4-latin-600-normal.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "TCB Serif"; src: url("../fonts/source-serif-4-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-display: swap; }

/* ---------- Tokens ---------- */
:root {
  color-scheme: light;
  /* Brand (logo) */
  --brand: #16233f; --brand-2: #1f3157; --gold: #b07d2b; --gold-2: #c99543; --gold-soft: #f7ecd9; --gold-ink: #7a5414;
  /* Interface */
  --primary: #2453a6; --primary-2: #1c4489; --primary-soft: #e8effb; --primary-ink: #173a78;
  --ink: #111a2e; --ink-2: #2b3650; --ink-soft: #46506a; --muted: #67718a; --faint: #98a1b5;
  --bg: #f4f6fa; --surface: #ffffff; --surface-2: #f8f9fc; --surface-3: #eef1f6; --hover: #f5f7fb;
  --line: #e3e7ef; --line-strong: #cbd2df;
  --green: #11744f; --green-bg: #e4f5ed; --red: #b42318; --red-bg: #fdecea; --amber: #a15c07; --amber-bg: #fef3dc; --blue: #2453a6; --blue-bg: #e8effb; --violet: #5b3fb0; --violet-bg: #efeafc;
  --sidebar-bg: linear-gradient(180deg, #14203a 0%, #182848 100%); --sidebar-ink: #c9d2e5; --sidebar-muted: #8592ae; --sidebar-hover: rgba(255,255,255,.06); --sidebar-active: rgba(255,255,255,.10);
  --radius: 12px; --radius-sm: 8px; --radius-xs: 6px;
  --shadow-sm: 0 1px 2px rgba(17,26,46,.06);
  --shadow: 0 1px 2px rgba(17,26,46,.05), 0 2px 8px rgba(17,26,46,.05);
  --shadow-lg: 0 10px 30px rgba(17,26,46,.12), 0 2px 6px rgba(17,26,46,.06);
  --ring: 0 0 0 3px rgba(36,83,166,.25);
  --font: "Inter", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --serif: "TCB Serif", Georgia, "Times New Roman", serif;
  --mono: ui-monospace, "Cascadia Mono", Consolas, monospace;
  --sidebar: 256px;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --primary: #6f9ce8; --primary-2: #8db1ee; --primary-soft: #1c2b47; --primary-ink: #b8cff5;
  --ink: #e7ebf3; --ink-2: #ccd3e1; --ink-soft: #aab3c6; --muted: #8b94a9; --faint: #6b7489;
  --bg: #0d1424; --surface: #141d31; --surface-2: #18223a; --surface-3: #1e2a45; --hover: #1a2540;
  --line: #26324d; --line-strong: #34425f;
  --green: #4cc79a; --green-bg: #0f2e26; --red: #f28b82; --red-bg: #3a1717; --amber: #f2b55b; --amber-bg: #33260f; --blue: #8db1ee; --blue-bg: #1a2a47; --violet: #b3a1f0; --violet-bg: #251d45;
  --gold-soft: #33280f; --gold-ink: #e9c27c;
  --sidebar-bg: linear-gradient(180deg, #0a1020 0%, #0f172b 100%);
  --shadow-sm: 0 1px 2px rgba(0,0,0,.3); --shadow: 0 1px 2px rgba(0,0,0,.3), 0 2px 10px rgba(0,0,0,.25); --shadow-lg: 0 14px 40px rgba(0,0,0,.5);
  --ring: 0 0 0 3px rgba(111,156,232,.35);
}

/* ---------- Base ---------- */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 14.5px/1.55 var(--font); color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; font-feature-settings: "cv11", "ss01"; }
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-2); text-decoration: underline; text-underline-offset: 2px; }
h1, h2, h3, h4 { font-family: var(--font); font-weight: 650; color: var(--ink); line-height: 1.25; margin: 0 0 .5em; letter-spacing: -.011em; }
h1 { font-size: 1.6rem; font-weight: 700; } h2 { font-size: 1.15rem; } h3 { font-size: 1.02rem; } h4 { font-size: .95rem; }
.serif, .hero h1, .section h2, .price { font-family: var(--serif); letter-spacing: -.005em; }
p { margin: 0 0 1em; }
img { max-width: 100%; }
hr { border: 0; border-top: 1px solid var(--line); margin: 12px 0; }
::selection { background: var(--primary-soft); }
:focus-visible { outline: none; box-shadow: var(--ring); border-radius: 4px; }
.skip-link { position: absolute; left: -999px; top: 8px; background: var(--brand); color: #fff; padding: 8px 14px; border-radius: 6px; z-index: 200; }
.skip-link:focus { left: 8px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); } .small { font-size: .86rem; } .xs { font-size: .76rem; }
.mono { font-family: var(--mono); font-size: .88em; }
.num, td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.neg { color: var(--red); }
.nowrap { white-space: nowrap; } .right { text-align: right; } .center { text-align: center; }
.mt-0 { margin-top: 0 } .mt-1 { margin-top: .5rem } .mt-2 { margin-top: 1rem } .mt-3 { margin-top: 1.5rem } .mb-0 { margin-bottom: 0 } .mb-1 { margin-bottom: .5rem } .mb-2 { margin-bottom: 1rem }
.stack > * + * { margin-top: 1rem; }
.row { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; } .row.end { justify-content: flex-end; } .row.top { align-items: flex-start; }
.grow { flex: 1; }
.grid { display: grid; gap: 1rem; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } .grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1100px) { .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 900px) { .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 620px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }
@media (max-width: 980px) { .grid[style*="grid-template-columns"] { grid-template-columns: 1fr !important; } }
kbd, .kbd { display: inline-block; font: 600 .72rem/1 var(--font); padding: 3px 6px; border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 5px; background: var(--surface-2); color: var(--ink-soft); }

/* ---------- App shell ---------- */
.shell { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; }
.sidebar { background: var(--sidebar-bg); color: var(--sidebar-ink); padding: 16px 12px 24px; position: sticky; top: 0; height: 100vh; overflow-y: auto; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.15) transparent; }
.sidebar .brand { display: flex; align-items: center; gap: 10px; padding: 6px 10px 14px; color: #fff; text-decoration: none; }
.sidebar .brand img { height: 30px; width: auto; }
.org-chip { display: flex; align-items: center; gap: 10px; margin: 0 4px 6px; padding: 9px 10px; border-radius: 10px; background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.07); color: #e6ebf5; font-size: .84rem; line-height: 1.3; }
.org-chip .org-avatar { width: 30px; height: 30px; flex: none; border-radius: 8px; display: grid; place-items: center; background: linear-gradient(135deg, var(--gold), var(--gold-2)); color: #fff; font: 700 .8rem var(--font); }
.org-chip .org-avatar svg { width: 16px; height: 16px; }
.org-chip small { color: var(--sidebar-muted); display: block; font-size: .72rem; }
.nav-group { margin-top: 16px; }
.nav-group h6 { font: 600 .68rem/1 var(--font); letter-spacing: .09em; text-transform: uppercase; color: var(--sidebar-muted); margin: 0 10px 6px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 7px 10px; margin: 1px 0; border-radius: 8px; color: var(--sidebar-ink); text-decoration: none; font-size: .9rem; font-weight: 500; transition: background .12s, color .12s; }
.nav a:hover { background: var(--sidebar-hover); color: #fff; text-decoration: none; }
.nav a.active { background: var(--sidebar-active); color: #fff; box-shadow: inset 3px 0 0 var(--gold-2); }
.nav a .count { margin-left: auto; background: var(--gold); color: #fff; font: 700 .68rem/1 var(--font); padding: 3px 6px; border-radius: 99px; }
.nav svg { width: 17px; height: 17px; flex: none; opacity: .85; }
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 10px; padding: 10px 24px; background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 30; min-height: 60px; }
.topbar .search { flex: 1; max-width: 520px; position: relative; }
.topbar .search input { width: 100%; padding-left: 36px; padding-right: 64px; background: var(--surface-2); }
.topbar .search .search-icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--faint); pointer-events: none; }
.topbar .search .kbd { position: absolute; right: 9px; top: 50%; transform: translateY(-50%); }
.icon-btn { position: relative; display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-soft); cursor: pointer; }
.icon-btn:hover { background: var(--hover); color: var(--ink); }
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn .dot { position: absolute; top: 5px; right: 5px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 99px; background: var(--red); color: #fff; font: 700 .65rem/17px var(--font); text-align: center; border: 2px solid var(--surface); box-sizing: content-box; }
.menu-toggle { display: none; }
.content { padding: 26px 28px 48px; max-width: 1360px; width: 100%; }
.page-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 20px; }
.page-head h1 { margin: 0; }
.page-head .sub { color: var(--muted); margin-top: 4px; font-size: .92rem; }
.breadcrumbs { font-size: .82rem; color: var(--muted); margin-bottom: 6px; }
.breadcrumbs a { color: var(--muted); }
@media (max-width: 980px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: 284px; transform: translateX(-100%); transition: transform .2s; z-index: 60; }
  body.nav-open .sidebar { transform: none; box-shadow: 0 0 0 100vmax rgba(5,10,20,.5); }
  .menu-toggle { display: inline-grid; }
  .content { padding: 18px 16px 40px; }
  .topbar { padding: 10px 14px; }
  .topbar .search .kbd { display: none; }
}
@media (max-width: 620px) { .topbar .user-name, .topbar .org-switch { display: none; } }
.org-switch select { max-width: 220px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: linear-gradient(135deg, var(--primary), #5b7fd0); color: #fff; display: inline-grid; place-items: center; font: 600 .78rem var(--font); flex: none; }
.dropdown { position: relative; }
.dropdown > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 8px; }
.dropdown > summary::-webkit-details-marker { display: none; }
.dropdown .menu { position: absolute; right: 0; top: calc(100% + 8px); background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-lg); min-width: 230px; padding: 6px; z-index: 40; }
.dropdown .menu a, .dropdown .menu button { display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; padding: 8px 10px; border-radius: 8px; color: var(--ink); text-decoration: none; background: none; border: 0; font: inherit; cursor: pointer; }
.dropdown .menu a:hover, .dropdown .menu button:hover { background: var(--hover); }
.menu .menu-head { padding: 8px 10px 10px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.tasks-menu { width: 340px; max-width: calc(100vw - 24px); }
.tasks-menu .task { display: flex; gap: 10px; align-items: flex-start; }
.tasks-menu .task .t-icon { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; flex: none; background: var(--primary-soft); color: var(--primary); }
.tasks-menu .task .t-icon svg { width: 16px; height: 16px; }
.tasks-menu .task .t-text { font-size: .88rem; line-height: 1.35; }
.tasks-menu .task .t-text small { display: block; color: var(--muted); font-size: .76rem; }

/* ---------- Cards, stats, tables, badges ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-body { padding: 18px 20px; }
.card-head { padding: 14px 20px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.card-head h2, .card-head h3 { margin: 0; font-size: .98rem; font-weight: 650; }
.card + .card { margin-top: 1rem; }
.grid > .card + .card, .grid > * + .card { margin-top: 0; }
a.card { transition: box-shadow .15s, transform .15s, border-color .15s; }
a.card:hover { box-shadow: var(--shadow-lg); border-color: var(--line-strong); transform: translateY(-1px); text-decoration: none; }
.stat { padding: 16px 18px; position: relative; }
.stat .label { color: var(--muted); font-size: .74rem; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }
.stat .value { font: 700 1.55rem/1.2 var(--font); margin-top: 6px; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.stat .hint { font-size: .8rem; color: var(--muted); margin-top: 3px; }
.stat .stat-icon { position: absolute; top: 14px; right: 14px; width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); }
.stat .stat-icon svg { width: 18px; height: 18px; }
.stat .stat-icon.green { background: var(--green-bg); color: var(--green); } .stat .stat-icon.red { background: var(--red-bg); color: var(--red); } .stat .stat-icon.gold { background: var(--gold-soft); color: var(--gold-ink); } .stat .stat-icon.violet { background: var(--violet-bg); color: var(--violet); }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: .9rem; }
.table th, .table td { padding: 10px 14px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.table thead th { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); background: var(--surface-2); font-weight: 600; white-space: nowrap; position: sticky; top: 0; z-index: 1; }
.card > .table-wrap:first-child .table thead th:first-child { border-top-left-radius: var(--radius); }
.card > .table-wrap:first-child .table thead th:last-child { border-top-right-radius: var(--radius); }
.table tbody tr { transition: background .1s; }
.table tbody tr:hover { background: var(--hover); }
.table tbody tr:last-child td { border-bottom: 0; }
.table tr.heading td { font-weight: 650; background: var(--surface-2); color: var(--ink-2); }
.table tr.subtotal td { font-weight: 650; border-top: 1px solid var(--line-strong); }
.table tr.total td { font-weight: 700; border-top: 2px solid var(--ink-2); border-bottom: 3px double var(--ink-2); }
.table.compact th, .table.compact td { padding: 7px 12px; }
.table tfoot td { font-weight: 650; background: var(--surface-2); }
th[data-sort] { cursor: pointer; user-select: none; }
th[data-sort]:hover { color: var(--ink); }
th[data-sort]::after { content: "↕"; opacity: .35; margin-left: 4px; font-size: .9em; }
th[data-sort="asc"]::after { content: "↑"; opacity: .9; } th[data-sort="desc"]::after { content: "↓"; opacity: .9; }
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px; font-size: .72rem; font-weight: 600; background: var(--surface-3); color: var(--ink-soft); white-space: nowrap; line-height: 1.6; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .7; }
.badge.plain::before { display: none; }
.badge.green { background: var(--green-bg); color: var(--green); } .badge.red { background: var(--red-bg); color: var(--red); }
.badge.amber { background: var(--amber-bg); color: var(--amber); } .badge.blue { background: var(--blue-bg); color: var(--blue); } .badge.gold { background: var(--gold-soft); color: var(--gold-ink); } .badge.violet { background: var(--violet-bg); color: var(--violet); }
.empty { text-align: center; padding: 44px 20px; color: var(--muted); }
.empty h3 { color: var(--ink); margin-top: 6px; }
.empty svg { width: 46px; height: 46px; padding: 10px; border-radius: 14px; background: var(--surface-3); color: var(--faint); margin-bottom: 4px; }
.list-plain { list-style: none; margin: 0; padding: 0; }
.list-plain li { padding: 9px 0; border-bottom: 1px solid var(--line); }
.list-plain li:last-child { border-bottom: 0; }
dl.kv { display: grid; grid-template-columns: max-content 1fr; gap: 7px 18px; margin: 0; }
dl.kv dt { color: var(--muted); } dl.kv dd { margin: 0; }
.pagination { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 14px; align-items: center; }
.pagination a, .pagination span { padding: 6px 12px; border: 1px solid var(--line); border-radius: 8px; text-decoration: none; color: var(--ink); background: var(--surface); font-size: .85rem; }
.pagination .disabled span { color: var(--faint); }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; }
.tabs a { padding: 9px 14px; text-decoration: none; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; font-weight: 500; font-size: .9rem; }
.tabs a:hover { color: var(--ink); text-decoration: none; }
.tabs a.active { color: var(--primary); border-color: var(--primary); font-weight: 600; }
.progress { height: 8px; background: var(--surface-3); border-radius: 99px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: linear-gradient(90deg, var(--green), #2fb37f); border-radius: 99px; }

/* ---------- Charts (server-rendered SVG) ---------- */
.chart { width: 100%; height: auto; display: block; }
.chart .grid-line { stroke: var(--line); stroke-width: 1; }
.chart .axis { fill: var(--muted); font: 500 11.5px var(--font); }
.chart .bar-a { fill: var(--primary); } .chart .bar-b { fill: var(--gold-2); } .chart .bar-c { fill: var(--green); }
.chart .bar-a:hover, .chart .bar-b:hover, .chart .bar-c:hover { opacity: .8; }
.legend { display: flex; gap: 16px; font-size: .8rem; color: var(--muted); flex-wrap: wrap; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }

/* ---------- Setup checklist ---------- */
.steps { list-style: none; margin: 0; padding: 0; }
.steps li { display: flex; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.steps li:last-child { border-bottom: 0; }
.steps .tick { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; flex: none; border: 2px solid var(--line-strong); color: transparent; font-size: .8rem; font-weight: 700; }
.steps li.done .tick { background: var(--green); border-color: var(--green); color: #fff; }
.steps li.done .s-label { color: var(--muted); text-decoration: line-through; }

/* ---------- Forms & buttons ---------- */
label, .label { display: block; font-weight: 600; font-size: .84rem; margin-bottom: 6px; color: var(--ink-2); }
.field { margin-bottom: 14px; }
.field .help { font-size: .8rem; color: var(--muted); margin-top: 5px; }
.field .error, .error-text { color: var(--red); font-size: .82rem; margin-top: 5px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=datetime-local], input[type=search], input[type=url], input[type=tel], input[type=file], select, textarea {
  width: 100%; font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius-sm); padding: 8px 11px; min-height: 40px; transition: border-color .12s, box-shadow .12s;
}
select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none' stroke='%2367718a' stroke-width='1.6'%3E%3Cpath d='M1 1.5l5 5 5-5'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 11px center; padding-right: 32px; }
select[multiple] { background-image: none; padding-right: 11px; }
textarea { min-height: 92px; resize: vertical; }
input:hover, select:hover, textarea:hover { border-color: var(--faint); }
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: var(--ring); outline: none; }
input::placeholder, textarea::placeholder { color: var(--faint); }
input.money { text-align: right; font-variant-numeric: tabular-nums; }
input[type=checkbox], input[type=radio] { accent-color: var(--primary); width: 16px; height: 16px; }
.check { display: flex; gap: 9px; align-items: flex-start; font-weight: 400; font-size: .9rem; color: var(--ink); }
.check input { margin-top: 3px; flex: none; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 8px 16px; border-radius: var(--radius-sm); border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); font: 600 .87rem var(--font); text-decoration: none; cursor: pointer; min-height: 40px; white-space: nowrap; box-shadow: var(--shadow-sm); transition: background .12s, border-color .12s, box-shadow .12s, transform .05s; }
.btn:hover { background: var(--hover); color: var(--ink); text-decoration: none; border-color: var(--faint); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-2); border-color: var(--primary-2); color: #fff; }
.btn.gold { background: linear-gradient(180deg, var(--gold-2), var(--gold)); border-color: var(--gold); color: #fff; }
.btn.gold:hover { filter: brightness(1.05); color: #fff; }
.btn.danger { background: var(--surface); border-color: color-mix(in srgb, var(--red) 40%, var(--line)); color: var(--red); }
.btn.danger:hover { background: var(--red-bg); }
.btn.link { border: 0; background: none; color: var(--primary); padding: 0; min-height: 0; font-weight: 500; box-shadow: none; }
.btn.sm { padding: 4px 11px; min-height: 31px; font-size: .8rem; }
.btn svg { width: 16px; height: 16px; }
.btn[disabled], .btn.is-loading { opacity: .6; pointer-events: none; }
.btn.is-loading::after { content: ""; width: 12px; height: 12px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
form.inline { display: inline; }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; margin-top: 10px; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 16px; margin: 0 0 16px; }
legend { font-weight: 600; padding: 0 6px; font-size: .86rem; color: var(--ink-2); }
.lines-table input, .lines-table select { min-height: 36px; padding: 6px 9px; }
.lines-table td { padding: 6px; }
details > summary { cursor: pointer; color: var(--primary); }
.dropdown > summary, details.dropdown > summary { color: inherit; }

/* ---------- Alerts, banners, toasts ---------- */
.alert { padding: 12px 14px; border-radius: var(--radius-sm); margin-bottom: 14px; border: 1px solid; font-size: .9rem; }
.alert.success { background: var(--green-bg); border-color: color-mix(in srgb, var(--green) 30%, transparent); color: var(--green); }
.alert.error, .alert.danger { background: var(--red-bg); border-color: color-mix(in srgb, var(--red) 30%, transparent); color: var(--red); }
.alert.warning { background: var(--amber-bg); border-color: color-mix(in srgb, var(--amber) 30%, transparent); color: var(--amber); }
.alert.info { background: var(--blue-bg); border-color: color-mix(in srgb, var(--blue) 30%, transparent); color: var(--blue); }
.alert ul { margin: 4px 0 0 18px; padding: 0; }
.banner { padding: 9px 24px; font-size: .86rem; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.banner.support { background: #8a1c14; color: #fff; font-weight: 600; }
.banner.support .btn { background: #fff; color: #8a1c14; border-color: #fff; }
.banner.warning { background: var(--amber-bg); color: var(--amber); border-bottom: 1px solid color-mix(in srgb, var(--amber) 25%, transparent); }
.banner.danger { background: var(--red-bg); color: var(--red); border-bottom: 1px solid color-mix(in srgb, var(--red) 25%, transparent); }
.banner.info { background: var(--blue-bg); color: var(--blue); border-bottom: 1px solid color-mix(in srgb, var(--blue) 25%, transparent); }
.sandbox-tag { display: inline-block; background: var(--amber-bg); color: var(--amber); border: 1px dashed currentColor; padding: 1px 8px; border-radius: 5px; font-size: .72rem; font-weight: 700; letter-spacing: .03em; }
.toasts { position: fixed; right: 18px; bottom: 18px; z-index: 150; display: flex; flex-direction: column; gap: 10px; max-width: min(420px, calc(100vw - 36px)); }
.toast { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-lg); font-size: .9rem; animation: toast-in .2s ease-out; }
.toast .t-mark { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; flex: none; color: #fff; font: 700 .75rem var(--font); }
.toast.success .t-mark { background: var(--green); } .toast.error .t-mark { background: var(--red); }
.toast .t-close { margin-left: auto; background: none; border: 0; color: var(--muted); cursor: pointer; font-size: 1.1rem; line-height: 1; padding: 0 2px; }
.toast.hide { opacity: 0; transform: translateY(6px); transition: opacity .25s, transform .25s; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* ---------- Command palette ---------- */
.cmdk-backdrop { position: fixed; inset: 0; background: rgba(5,10,20,.45); z-index: 180; display: none; align-items: flex-start; justify-content: center; padding-top: 12vh; }
.cmdk-backdrop.open { display: flex; }
.cmdk { width: min(620px, calc(100vw - 24px)); background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-lg); overflow: hidden; }
.cmdk input { border: 0; border-bottom: 1px solid var(--line); border-radius: 0; min-height: 54px; font-size: 1rem; padding: 0 18px; box-shadow: none !important; }
.cmdk-list { max-height: 52vh; overflow-y: auto; padding: 6px; }
.cmdk-list a { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 8px; color: var(--ink); text-decoration: none; }
.cmdk-list a .c-group { margin-left: auto; color: var(--faint); font-size: .76rem; }
.cmdk-list a[hidden], [hidden] { display: none !important; }
.cmdk-list a.sel, .cmdk-list a:hover { background: var(--primary-soft); text-decoration: none; }
.cmdk-list svg { width: 16px; height: 16px; color: var(--muted); }
.cmdk-foot { display: flex; gap: 14px; padding: 9px 14px; border-top: 1px solid var(--line); color: var(--muted); font-size: .76rem; background: var(--surface-2); }

/* ---------- Auth pages ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr; background: var(--bg); }
.auth-aside { background: radial-gradient(900px 500px at 20% 0%, #24406f 0%, transparent 60%), linear-gradient(160deg, #14203a, #1b2c50); color: #dfe6f3; padding: 48px 56px; display: flex; flex-direction: column; justify-content: space-between; }
.auth-aside h2 { color: #fff; font-family: var(--serif); font-size: 2rem; line-height: 1.2; max-width: 16ch; margin-top: 40px; }
.auth-aside .checklist li::before { border-color: var(--gold-2); }
.auth-aside img { height: 38px; }
.auth-main { display: grid; place-items: center; padding: 32px 18px; }
.auth-card { width: 100%; max-width: 420px; }
.auth-card .card-body { padding: 30px; }
.auth-logo { display: none; margin: 0 auto 18px; height: 44px; }
@media (max-width: 900px) { .auth { grid-template-columns: 1fr; } .auth-aside { display: none; } .auth-logo { display: block; } }

/* ---------- Public site ---------- */
.site-header { background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 30; }
.site-header .wrap { display: flex; align-items: center; gap: 22px; height: 68px; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 22px; }
.site-header nav { display: flex; gap: 22px; margin-left: auto; align-items: center; }
.site-header nav a { color: var(--ink-2); text-decoration: none; font-weight: 500; font-size: .92rem; }
.site-header nav a:hover, .site-header nav a.active { color: var(--primary); }
.site-header nav a.btn { color: #fff; }
.site-header .logo img { height: 36px; display: block; }
.site-menu-toggle { display: none; margin-left: auto; }
@media (max-width: 900px) {
  .site-header nav { display: none; position: absolute; top: 68px; left: 0; right: 0; background: var(--surface); flex-direction: column; align-items: stretch; padding: 12px 22px 20px; border-bottom: 1px solid var(--line); gap: 4px; box-shadow: var(--shadow-lg); }
  .site-header nav a { padding: 8px 0; }
  body.nav-open .site-header nav { display: flex; }
  .site-menu-toggle { display: inline-flex; }
}
.hero { padding: 80px 0 64px; background: radial-gradient(1000px 500px at 85% -10%, color-mix(in srgb, var(--primary) 12%, transparent), transparent 60%), radial-gradient(800px 400px at 0% 0%, color-mix(in srgb, var(--gold) 10%, transparent), transparent 60%); }
.hero h1 { font-size: clamp(2.1rem, 4.6vw, 3.3rem); letter-spacing: -.02em; max-width: 17ch; font-weight: 600; line-height: 1.12; }
.hero .lede { font-size: 1.12rem; color: var(--ink-soft); max-width: 56ch; }
.hero-grid { display: grid; grid-template-columns: 1.05fr .95fr; gap: 52px; align-items: center; }
@media (max-width: 900px) { .hero-grid { grid-template-columns: 1fr; } .hero { padding: 44px 0 32px; } }
.eyebrow { font: 600 .74rem var(--font); letter-spacing: .13em; text-transform: uppercase; color: var(--gold-ink); margin-bottom: 12px; }
.section { padding: 64px 0; }
.section.alt { background: var(--surface); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.section h2 { font-size: clamp(1.55rem, 2.7vw, 2.1rem); font-weight: 600; }
.section .section-lede { color: var(--ink-soft); max-width: 62ch; margin-bottom: 1.6rem; }
.feature { padding: 22px; }
.feature .icon { width: 42px; height: 42px; border-radius: 11px; background: var(--primary-soft); color: var(--primary); display: grid; place-items: center; margin-bottom: 14px; }
.feature .icon svg { width: 22px; height: 22px; }
.feature h3 { margin-bottom: 6px; }
.feature p { color: var(--ink-soft); margin: 0; }
.how { counter-reset: how; }
.how .card { padding: 22px; position: relative; }
.how .card::before { counter-increment: how; content: counter(how); position: absolute; top: -14px; left: 22px; width: 30px; height: 30px; border-radius: 50%; background: var(--primary); color: #fff; display: grid; place-items: center; font: 700 .9rem var(--font); box-shadow: 0 0 0 4px var(--bg); }
.faq details { border-bottom: 1px solid var(--line); padding: 14px 0; }
.faq summary { font-weight: 600; color: var(--ink); list-style: none; display: flex; justify-content: space-between; gap: 12px; }
.faq summary::after { content: "+"; color: var(--muted); font-size: 1.2rem; line-height: 1; }
.faq details[open] summary::after { content: "–"; }
.faq summary::-webkit-details-marker { display: none; }
.faq details p { color: var(--ink-soft); margin: 10px 0 0; }
.checklist { list-style: none; padding: 0; margin: 0; }
.checklist li { padding: 6px 0 6px 28px; position: relative; }
.checklist li::before { content: ""; position: absolute; left: 4px; top: 12px; width: 12px; height: 7px; border-left: 2px solid var(--green); border-bottom: 2px solid var(--green); transform: rotate(-45deg); }
.price-card { max-width: 480px; margin: 0 auto; text-align: center; border: 2px solid var(--primary); }
.price { font: 600 3.6rem/1 var(--serif); color: var(--ink); }
.price small { font: 500 1rem var(--font); color: var(--muted); }
.mock { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-lg); overflow: hidden; }
.mock-bar { height: 34px; background: var(--brand); display: flex; align-items: center; gap: 6px; padding: 0 12px; }
.mock-bar i { width: 9px; height: 9px; border-radius: 50%; background: rgba(255,255,255,.3); display: block; }
.cta-band { background: linear-gradient(135deg, var(--brand), #24406f); color: #dfe6f3; border-radius: 18px; padding: 40px; display: flex; justify-content: space-between; gap: 24px; align-items: center; flex-wrap: wrap; }
.cta-band h2 { color: #fff; margin: 0 0 6px; }
.site-footer { background: #0f1830; color: #aeb8cc; padding: 44px 0 28px; margin-top: 0; }
.site-footer a { color: #dfe6f3; text-decoration: none; }
.site-footer a:hover { text-decoration: underline; color: #fff; }
.site-footer .cols { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 28px; }
@media (max-width: 760px) { .site-footer .cols { grid-template-columns: 1fr 1fr; } }
.prose { max-width: 760px; }
.prose h2 { margin-top: 1.6em; } .prose ul { padding-left: 1.2em; }
.logo-dark { display: none; }
:root[data-theme="dark"] .logo-light { display: none; } :root[data-theme="dark"] .logo-dark { display: inline-block; }

/* ---------- Lesson / rich text ---------- */
.editor-toolbar { display: flex; gap: 4px; flex-wrap: wrap; padding: 6px; border: 1px solid var(--line-strong); border-bottom: 0; border-radius: var(--radius-sm) var(--radius-sm) 0 0; background: var(--surface-2); }
.editor-toolbar button { border: 1px solid transparent; background: none; padding: 4px 9px; border-radius: 6px; cursor: pointer; font: 600 .82rem var(--font); color: var(--ink-2); }
.editor-toolbar button:hover { background: var(--surface); border-color: var(--line); }
.editor { min-height: 220px; border: 1px solid var(--line-strong); border-radius: 0 0 var(--radius-sm) var(--radius-sm); padding: 12px 14px; background: var(--surface); }
.editor:focus { outline: none; box-shadow: var(--ring); }
.rich h2, .rich h3 { margin-top: 1em; } .rich blockquote { border-left: 3px solid var(--gold); margin: 1em 0; padding: 2px 14px; color: var(--ink-soft); }
.private-box { border: 1px dashed var(--amber); background: var(--amber-bg); border-radius: var(--radius-sm); padding: 14px 16px; }
.private-box .label { color: var(--amber); }

/* ---------- Print ---------- */
@media print {
  .sidebar, .topbar, .no-print, .banner, .site-header, .site-footer, .toasts, .cmdk-backdrop { display: none !important; }
  .shell { display: block; } .content { padding: 0; max-width: none; }
  body { background: #fff; color: #000; font-size: 11pt; }
  .card { box-shadow: none; border: 0; }
  a { color: inherit; text-decoration: none; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
