/* Richemont admin. One stylesheet, from the Claude Design system (Sep 29, 2026).
   Sections: tokens · base · layout · top bar · page header · flash · card · stat tile + meter
   · badge · row list · data table · form field · button · filter bar · empty state
   · lead detail · content calendar · media · prose · sign in · footer · utilities */

@font-face {
  font-family: "Nunito Sans";
  src: url("/static/nunito-sans-latin.woff2") format("woff2");
  font-weight: 400 800;
  font-display: swap;
}

/* ---------- tokens ----------
   Every color is light-dark(light, dark). The OS setting (prefers-color-scheme) picks via
   color-scheme. data-theme on <html> is an optional manual override. */
:root {
  color-scheme: light dark;
  --font: "Nunito Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --fs-xs: 12px; --fs-s: 13px; --fs-m: 14px; --fs-l: 16px; --fs-xl: 20px; --fs-xxl: 26px; --fs-num: 28px;
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px;
  --r: 6px; --r-s: 4px;
  --wrap: 1240px;
  --tap: 36px;

  --bg:        light-dark(oklch(0.972 0.004 240), oklch(0.165 0.006 250));
  --surface:   light-dark(oklch(1 0 0),           oklch(0.205 0.007 250));
  --sunk:      light-dark(oklch(0.958 0.005 240), oklch(0.185 0.006 250));
  --hover:     light-dark(oklch(0.975 0.004 240), oklch(0.235 0.008 250));
  --field:     light-dark(oklch(1 0 0),           oklch(0.175 0.006 250));
  --line:      light-dark(oklch(0.905 0.006 240), oklch(0.285 0.008 250));
  --line-2:    light-dark(oklch(0.80 0.008 240),  oklch(0.39 0.01 250));
  --text:      light-dark(oklch(0.22 0.012 250),  oklch(0.94 0.005 250));
  --muted:     light-dark(oklch(0.47 0.012 250),  oklch(0.73 0.01 250));

  --bar:       light-dark(oklch(0.25 0.014 250),  oklch(0.125 0.006 250));
  --bar-text:  oklch(0.96 0.004 250);
  --bar-muted: oklch(0.78 0.01 250);
  --bar-field: light-dark(oklch(0.31 0.014 250),  oklch(0.2 0.007 250));

  --accent:      light-dark(oklch(0.46 0.085 195), oklch(0.76 0.09 195));
  --accent-hi:   light-dark(oklch(0.40 0.085 195), oklch(0.82 0.09 195));
  --accent-ink:  light-dark(oklch(1 0 0),          oklch(0.17 0.02 195));
  --accent-soft: light-dark(oklch(0.94 0.03 195),  oklch(0.28 0.04 195));

  /* status: text color + tint. Always paired with a word. */
  --good: light-dark(oklch(0.44 0.11 150), oklch(0.80 0.12 150));  --good-bg: light-dark(oklch(0.94 0.045 150), oklch(0.28 0.05 150));
  --warn: light-dark(oklch(0.46 0.10 65),  oklch(0.84 0.12 80));   --warn-bg: light-dark(oklch(0.945 0.06 85),  oklch(0.30 0.055 75));
  --bad:  light-dark(oklch(0.50 0.17 27),  oklch(0.78 0.13 25));   --bad-bg:  light-dark(oklch(0.945 0.035 25), oklch(0.30 0.07 25));
  --info: light-dark(oklch(0.47 0.12 255), oklch(0.80 0.10 255));  --info-bg: light-dark(oklch(0.945 0.03 255), oklch(0.30 0.06 255));

  --track:     light-dark(oklch(0.92 0.006 240), oklch(0.30 0.008 250));
  --fill-warn: light-dark(oklch(0.72 0.15 70),   oklch(0.78 0.14 75));
  --focus:     light-dark(oklch(0.55 0.17 255),  oklch(0.78 0.13 255));
  --shadow: 0 1px 2px light-dark(oklch(0.2 0.01 250 / 0.06), oklch(0 0 0 / 0.3));
}
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"]  { color-scheme: dark; }

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 400 var(--fs-m)/1.45 var(--font); }
h1, h2, h3, h4 { margin: 0; line-height: 1.2; text-wrap: balance; }
p { margin: 0; text-wrap: pretty; }
a { color: var(--accent); text-underline-offset: 2px; }
a:hover { color: var(--accent-hi); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 2px; }
img { max-width: 100%; display: block; }
hr { border: 0; border-top: 1px solid var(--line); margin: var(--s4) 0; }
code { font: 0.92em var(--mono); background: var(--sunk); padding: 1px 4px; border-radius: 3px; }

/* ---------- layout ---------- */
.main { max-width: var(--wrap); margin: 0 auto; padding: var(--s5) var(--s4) var(--s7); }
.grid { display: grid; gap: var(--s4); align-items: start; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.split { grid-template-columns: minmax(0, 1fr) 360px; }
.stack { display: grid; gap: var(--s4); align-content: start; }
.sec-t { font-size: var(--fs-xs); font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin: var(--s5) 0 var(--s2); }
@media (max-width: 1000px) { .g3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .split { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 760px) {
  :root { --tap: 44px; }
  .main { padding: var(--s4) var(--s3) var(--s6); }
  .g2, .g3 { grid-template-columns: minmax(0, 1fr); }
}

/* ---------- top bar ---------- */
.top { background: var(--bar); color: var(--bar-text); }
.top-in { max-width: var(--wrap); margin: 0 auto; padding: 0 var(--s4); display: flex; align-items: center; gap: var(--s5); min-height: 52px; }
.mark { color: var(--bar-text); text-decoration: none; font-weight: 800; font-size: var(--fs-l); letter-spacing: -0.01em; white-space: nowrap; }
.mark span { color: var(--bar-muted); font-weight: 600; }
.mark:hover { color: var(--bar-text); }
.nav { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; }
.nav a { display: flex; align-items: center; min-height: 34px; padding: 0 10px; border-radius: var(--r-s); color: var(--bar-muted); text-decoration: none; font-weight: 700; white-space: nowrap; }
.nav a:hover { color: var(--bar-text); background: var(--bar-field); }
.nav a[aria-current="page"] { color: var(--bar-text); background: var(--bar-field); box-shadow: inset 0 -2px 0 var(--accent); }
.top :focus-visible { outline-color: var(--bar-text); }
.search { margin-left: auto; position: relative; }
.search input { width: 240px; min-height: 34px; background: var(--bar-field); border-color: transparent; color: var(--bar-text); padding-left: 32px; }
.search input::placeholder { color: var(--bar-muted); }
.search svg { position: absolute; left: 10px; top: 50%; translate: 0 -50%; color: var(--bar-muted); pointer-events: none; }
@media (max-width: 860px) {
  .top-in { flex-wrap: wrap; gap: var(--s2) var(--s3); padding: var(--s2) var(--s3) 0; }
  .search { flex: 1; }
  .search input { width: 100%; min-height: 40px; }
  .nav { order: 3; width: calc(100% + 2 * var(--s3)); margin: 0 calc(-1 * var(--s3)); padding: 0 var(--s3) var(--s1); }
  .nav a { min-height: 44px; }
  .nav a[aria-current="page"] { box-shadow: inset 0 -3px 0 var(--accent); border-radius: 0; background: none; }
}

/* ---------- page header ---------- */
.hdr { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: var(--s3) var(--s4); margin-bottom: var(--s4); }
.hdr h1 { font-size: var(--fs-xxl); font-weight: 800; letter-spacing: -0.015em; }
.hdr .sub { color: var(--muted); margin-top: 2px; }
.crumb { font-size: var(--fs-s); color: var(--muted); margin-bottom: 4px; display: block; }
.acts { display: flex; flex-wrap: wrap; gap: var(--s2); align-items: center; }
@media (max-width: 760px) { .hdr h1 { font-size: 22px; } .hdr > .acts { width: 100%; } }

/* ---------- flash message (one line, under the title) ---------- */
.flash { display: flex; gap: var(--s2); align-items: baseline; padding: 8px 12px; margin: calc(-1 * var(--s1)) 0 var(--s4); border-radius: var(--r); border: 1px solid transparent; font-weight: 600; }
.flash b { font-weight: 800; }
.flash-ok   { background: var(--good-bg); color: var(--good); }
.flash-warn { background: var(--warn-bg); color: var(--warn); }
.flash-bad  { background: var(--bad-bg);  color: var(--bad); }

/* ---------- card ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); min-width: 0; }
.card-h { display: flex; align-items: center; justify-content: space-between; gap: var(--s2); min-height: 44px; padding: 8px var(--s4); border-bottom: 1px solid var(--line); }
.card-h h2 { font-size: var(--fs-m); font-weight: 800; }
.card-h .count { color: var(--muted); font-weight: 600; margin-left: 4px; }
.card-b { padding: var(--s4); }
.card-f { padding: 10px var(--s4); border-top: 1px solid var(--line); background: var(--sunk); border-radius: 0 0 var(--r) var(--r); }
.card-note { font-size: var(--fs-s); color: var(--muted); }

/* ---------- stat tile + meter ---------- */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--s3); margin-bottom: var(--s4); }
@media (max-width: 1000px) { .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 420px)  { .stats { gap: var(--s2); } }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: var(--s3) var(--s4); box-shadow: var(--shadow); min-width: 0; }
.stat-l { display: flex; justify-content: space-between; gap: var(--s2); font-size: var(--fs-s); font-weight: 700; color: var(--muted); }
.stat-v { font-size: var(--fs-num); font-weight: 800; letter-spacing: -0.02em; line-height: 1.15; margin-top: 2px; font-variant-numeric: tabular-nums; }
.stat-v small { font-size: var(--fs-m); font-weight: 700; color: var(--muted); letter-spacing: 0; }
.stat-v.txt { font-size: var(--fs-xl); display: flex; align-items: center; gap: var(--s2); padding: 5px 0 3px; }
.stat-n { font-size: var(--fs-s); color: var(--muted); margin-top: 6px; }
@media (max-width: 420px) { .stat { padding: var(--s3); } .stat-v { font-size: 24px; } }
.meter { height: 6px; margin-top: 10px; border-radius: 3px; background: var(--track); overflow: hidden; }
.meter > span { display: block; height: 100%; background: var(--accent); border-radius: 3px; }
.meter.warn > span { background: var(--fill-warn); }
.meter.bad > span  { background: var(--bad); }

/* ---------- badge ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 0 8px; border-radius: 999px; font-size: var(--fs-xs); font-weight: 700; line-height: 20px; white-space: nowrap; background: var(--sunk); color: var(--muted); box-shadow: inset 0 0 0 1px var(--line); vertical-align: middle; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
.b-good { background: var(--good-bg); color: var(--good); box-shadow: none; }
.b-warn { background: var(--warn-bg); color: var(--warn); box-shadow: none; }
.b-bad  { background: var(--bad-bg);  color: var(--bad);  box-shadow: none; }
.b-info { background: var(--info-bg); color: var(--info); box-shadow: none; }
.b-flat::before { display: none; }
.prio { display: inline-grid; place-items: center; min-width: 22px; height: 20px; padding: 0 4px; border-radius: var(--r-s); font-size: 11px; font-weight: 800; box-shadow: inset 0 0 0 1px var(--line-2); color: var(--text); white-space: nowrap; }
.prio-a { background: var(--text); color: var(--surface); box-shadow: none; }

/* ---------- row list ---------- */
.rows { list-style: none; margin: 0; padding: 0; }
.row { display: flex; align-items: center; gap: var(--s3); min-height: 48px; padding: 8px var(--s4); border-top: 1px solid var(--line); }
.row:first-child { border-top: 0; }
.row-m { flex: 1; min-width: 0; }
.row-t { font-weight: 700; color: var(--text); text-decoration: none; }
a.row-t:hover { color: var(--accent); text-decoration: underline; }
.row-s { font-size: var(--fs-s); color: var(--muted); margin-top: 1px; }
.row-e { display: flex; align-items: center; gap: var(--s2); flex: none; }
.row form { margin: 0; }
@media (max-width: 760px) { .row { flex-wrap: wrap; padding: 10px var(--s3); } .row-m { flex-basis: 60%; } }

/* ---------- data table ---------- */
.tbl-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.tbl th { text-align: left; font-size: var(--fs-xs); font-weight: 800; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); padding: 8px 12px; background: var(--sunk); border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover { background: var(--hover); }
.tbl th:first-child, .tbl td:first-child { padding-left: var(--s4); }
.tbl th:last-child, .tbl td:last-child { padding-right: var(--s4); }
.tbl .r { text-align: right; }
.tbl tfoot td { font-weight: 800; border-top: 1px solid var(--line-2); border-bottom: 0; }
.biz { display: flex; align-items: center; gap: var(--s3); min-width: 0; }
@media (max-width: 760px) {
  /* .stack tables become one block per row: first cell is the title, the rest are label: value */
  .tbl.stacked thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .tbl.stacked tr { display: block; padding: 10px var(--s3); border-bottom: 1px solid var(--line); }
  .tbl.stacked tbody tr:last-child { border-bottom: 0; }
  .tbl.stacked td { display: flex; justify-content: space-between; align-items: center; gap: var(--s3); padding: 3px 0 !important; border: 0; text-align: right; }
  .tbl.stacked td:first-child { text-align: left; padding-bottom: 6px !important; }
  .tbl.stacked td[data-label]::before { content: attr(data-label); color: var(--muted); font-size: var(--fs-s); text-align: left; }
  .tbl.stacked tfoot tr { border-top: 1px solid var(--line-2); }
}

/* ---------- form field ---------- */
.field { display: grid; gap: 4px; align-content: start; min-width: 0; }
.field > label, .lbl { font-size: var(--fs-s); font-weight: 700; }
.hint { font-size: var(--fs-xs); color: var(--muted); }
input, select, textarea { font: inherit; color: var(--text); background: var(--field); border: 1px solid var(--line-2); border-radius: var(--r-s); padding: 6px 10px; min-height: var(--tap); width: 100%; }
textarea { min-height: 80px; resize: vertical; line-height: 1.5; }
textarea.md { min-height: 60vh; font: 13px/1.6 var(--mono); }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--focus); outline-offset: 0; border-color: var(--focus); }
input[type="checkbox"], input[type="radio"] { width: 18px; height: 18px; min-height: 0; accent-color: var(--accent); margin: 0; }
input[type="file"] { padding: 5px; }
.field.err input, .field.err select, .field.err textarea { border-color: var(--bad); box-shadow: 0 0 0 1px var(--bad); }
.err-msg { color: var(--bad); font-size: var(--fs-s); font-weight: 700; }
.form { display: grid; gap: var(--s3); }
.fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: var(--s3); }
.inline { display: flex; flex-wrap: wrap; gap: var(--s2); align-items: flex-end; }
.inline > .field { flex: 1 1 160px; }
.chk { display: flex; align-items: center; gap: var(--s2); min-height: var(--tap); font-weight: 600; }
.code-in { font: 800 22px var(--mono); letter-spacing: 0.3em; text-align: center; }
@media (max-width: 760px) { input, select, textarea { font-size: 16px; } }

/* ---------- button ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: var(--tap); padding: 0 14px; font: inherit; font-weight: 800; border-radius: var(--r-s); border: 1px solid var(--accent); background: var(--accent); color: var(--accent-ink); text-decoration: none; cursor: pointer; white-space: nowrap; transition: background-color 0.12s, border-color 0.12s; }
.btn:hover { background: var(--accent-hi); border-color: var(--accent-hi); color: var(--accent-ink); }
.btn-q { background: var(--surface); color: var(--text); border-color: var(--line-2); }
.btn-q:hover { background: var(--sunk); border-color: var(--line-2); color: var(--text); }
.btn-d { background: var(--surface); color: var(--bad); border-color: var(--line-2); }
.btn-d:hover { background: var(--bad-bg); border-color: var(--bad); color: var(--bad); }
.btn-s { min-height: 28px; padding: 0 10px; font-size: var(--fs-s); }
.btn-full { width: 100%; }
.btn-link { background: none; border: 0; padding: 0; min-height: 0; font: inherit; color: var(--accent); text-decoration: underline; cursor: pointer; }
@media (max-width: 760px) { .btn-s { min-height: 44px; padding: 0 14px; } }

/* ---------- filter bar ---------- */
.filters { display: flex; flex-wrap: wrap; gap: var(--s3); align-items: flex-end; padding: var(--s3); margin-bottom: var(--s3); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); }
.filters .field { flex: 0 1 190px; }
.filters .acts { margin-left: auto; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; min-height: 30px; padding: 0 12px; border-radius: 999px; box-shadow: inset 0 0 0 1px var(--line-2); color: var(--text); text-decoration: none; font-size: var(--fs-s); font-weight: 700; background: var(--surface); }
.chip:hover { background: var(--sunk); color: var(--text); }
.chip[aria-current="true"] { background: var(--text); color: var(--surface); box-shadow: none; }
.chip .n { color: inherit; opacity: 0.7; margin-left: 5px; font-weight: 600; }
.tabs { display: flex; gap: var(--s4); border-bottom: 1px solid var(--line); margin-bottom: var(--s4); }
.tabs a { padding: 8px 0; min-height: var(--tap); display: flex; align-items: center; color: var(--muted); font-weight: 700; text-decoration: none; margin-bottom: -1px; border-bottom: 2px solid transparent; }
.tabs a[aria-current="page"] { color: var(--text); border-color: var(--accent); }
@media (max-width: 760px) { .filters .field { flex: 1 1 140px; } .filters .acts { width: 100%; margin: 0; } .chip { min-height: 44px; } }

/* ---------- empty state ---------- */
.empty { padding: var(--s6) var(--s4); text-align: center; color: var(--muted); }
.empty h3 { color: var(--text); font-size: var(--fs-l); font-weight: 800; margin-bottom: 4px; }
.empty .acts { justify-content: center; margin-top: var(--s4); }
.empty-s { padding: var(--s4); color: var(--muted); font-size: var(--fs-s); }

/* ---------- lead detail ---------- */
.kv { display: grid; grid-template-columns: 130px minmax(0, 1fr); gap: 7px var(--s3); margin: 0; }
.kv dt { color: var(--muted); font-size: var(--fs-s); padding-top: 1px; }
.kv dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.kv dd.long { font-weight: 400; }
@media (max-width: 420px) { .kv { grid-template-columns: 1fr; gap: 0; } .kv dd { margin-bottom: var(--s2); } }
.sched { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s2); }
.sched li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px var(--s3); align-items: center; padding: 10px var(--s3); border: 1px solid var(--line); border-radius: var(--r); }
.sched .amt { font-size: var(--fs-l); }
.totals { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s3); margin: var(--s4) 0; }
.totals div { background: var(--sunk); border-radius: var(--r); padding: 10px var(--s3); }
.totals .v { font-size: var(--fs-xl); font-weight: 800; font-variant-numeric: tabular-nums; }
.totals .owed .v { color: var(--bad); }
.log { list-style: none; margin: 0; padding: 0; }
.log li { display: grid; grid-template-columns: 70px minmax(0, 1fr); gap: var(--s3); padding: 10px 0; border-top: 1px solid var(--line); }
.log li:first-child { border-top: 0; }
.log .when { font-size: var(--fs-xs); color: var(--muted); font-weight: 700; line-height: 1.3; }
.log .kind { font-size: var(--fs-xs); font-weight: 800; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
details.more { border-top: 1px solid var(--line); }
details.more > summary { display: flex; align-items: center; gap: var(--s2); min-height: var(--tap); padding: 6px var(--s4); cursor: pointer; list-style: none; font-weight: 700; color: var(--accent); }
details.more > summary::-webkit-details-marker { display: none; }
details.more > summary::before { content: ""; width: 7px; height: 7px; border: solid currentColor; border-width: 0 2px 2px 0; rotate: -45deg; transition: rotate 0.12s; }
details.more[open] > summary::before { rotate: 45deg; }
details.more > .card-b { padding-top: 0; }
.card-b > details.more { border-top: 0; margin: 0 calc(-1 * var(--s4)); }

/* ---------- content calendar ---------- */
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.cal-dh { background: var(--sunk); padding: 6px 8px; font-size: var(--fs-xs); font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
.cal-d { background: var(--surface); min-height: 108px; padding: 6px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.cal-d.out { background: var(--sunk); }
.dn { font-size: var(--fs-xs); font-weight: 800; color: var(--muted); }
.cal-d.today .dn { color: var(--accent); }
.cal-d.today .dn::after { content: " Today"; }
.ev { display: block; padding: 3px 6px; border-radius: 3px; font-size: var(--fs-xs); line-height: 1.3; color: var(--text); background: var(--sunk); text-decoration: none; box-shadow: inset 0 0 0 1px var(--line); overflow: hidden; }
.ev:hover { color: var(--text); background: var(--hover); }
.ev b { font-weight: 800; }
.ev .st { display: block; color: var(--muted); }
.ev.late { background: var(--bad-bg); box-shadow: none; }
.ev.late .st { color: var(--bad); font-weight: 800; }
.ev.done { opacity: 0.75; }
.ch { display: inline-block; min-width: 24px; font: 700 10px/16px var(--mono); text-align: center; border-radius: 3px; background: var(--track); color: var(--text); padding: 0 3px; }
@media (max-width: 760px) {
  .cal { display: block; background: var(--surface); }
  .cal-dh, .cal-d.blank { display: none; }
  .cal-d { min-height: 0; flex-direction: row; flex-wrap: wrap; border-top: 1px solid var(--line); padding: 8px var(--s3); }
  .cal-d .dn { width: 100%; }
  .ev { flex: 1 1 100%; padding: 8px; font-size: var(--fs-s); }
}
tr.late td { background: var(--bad-bg); }
.late-t { color: var(--bad); font-weight: 800; }

/* ---------- media: image placeholders, thumbs, tiles ---------- */
.ph { display: grid; place-items: center; text-align: center; padding: var(--s2); background: repeating-linear-gradient(135deg, var(--sunk) 0 7px, var(--surface) 7px 14px); border: 1px solid var(--line); border-radius: var(--r-s); color: var(--muted); font: 11px/1.3 var(--mono); }
.thumb { width: 48px; height: 36px; flex: none; padding: 0; font-size: 0; }
.shot { aspect-ratio: 3 / 4; width: 100%; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: var(--s3); }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; display: flex; flex-direction: column; }
.tile .ph { border: 0; border-radius: 0; aspect-ratio: 4 / 3; }
.tile-b { padding: 10px var(--s3); display: grid; gap: 4px; flex: 1; align-content: start; }
.tile-t { font-weight: 800; }

/* ---------- prose (rendered Markdown) ---------- */
.prose { max-width: 70ch; font-size: 15px; line-height: 1.65; }
.prose > * + * { margin-top: 0.9em; }
.prose h1 { font-size: 24px; font-weight: 800; }
.prose h2 { font-size: 18px; font-weight: 800; margin-top: 1.8em; padding-top: 0.6em; border-top: 1px solid var(--line); }
.prose h3 { font-size: 15px; font-weight: 800; margin-top: 1.4em; }
.prose ul, .prose ol { padding-left: 1.3em; }
.prose li + li { margin-top: 0.3em; }
.prose table { border-collapse: collapse; width: 100%; font-size: 14px; }
.prose th, .prose td { border: 1px solid var(--line); padding: 6px 10px; text-align: left; }
.prose th { background: var(--sunk); }
.prose blockquote { margin-left: 0; padding-left: var(--s4); border-left: 3px solid var(--line-2); color: var(--muted); }
.toc { list-style: none; margin: 0; padding: 0; font-size: var(--fs-s); }
.toc a { display: block; padding: 4px 0; color: var(--muted); text-decoration: none; }
.toc a:hover { color: var(--text); }

/* ---------- sign in ---------- */
.auth { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: var(--s5) var(--s3); }
.auth-box { width: 100%; max-width: 380px; }
.auth-box .mark { color: var(--text); display: inline-block; margin-bottom: var(--s5); font-size: var(--fs-xl); }
.auth-box .mark span { color: var(--muted); }
.auth-box h1 { font-size: var(--fs-xl); font-weight: 800; margin-bottom: 4px; }
.auth-box .sub { color: var(--muted); margin-bottom: var(--s4); }
.auth-alt { margin-top: var(--s4); padding-top: var(--s4); border-top: 1px solid var(--line); display: grid; gap: var(--s2); font-size: var(--fs-s); }
.or { display: flex; align-items: center; gap: var(--s3); color: var(--muted); font-size: var(--fs-xs); font-weight: 700; margin: var(--s2) 0; }
.or::before, .or::after { content: ""; flex: 1; border-top: 1px solid var(--line); }

/* ---------- footer ---------- */
.foot { max-width: var(--wrap); margin: 0 auto; padding: var(--s4) var(--s4) var(--s6); border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2) var(--s4); font-size: var(--fs-s); color: var(--muted); }
.foot a { color: var(--muted); display: inline-flex; align-items: center; min-height: 32px; }
.foot a:hover { color: var(--text); }
.foot form { margin: 0; }
.foot .btn-link { color: var(--muted); text-decoration: none; min-height: 32px; }
.foot .btn-link:hover { color: var(--text); }
.foot .who { margin-left: auto; }
.foot .own::after { content: " (owner)"; font-size: var(--fs-xs); }
@media (max-width: 760px) { .foot .btn-link { min-height: 44px; } .foot { padding: var(--s4) var(--s3) var(--s6); } .foot a { min-height: 44px; } .foot .who { margin-left: 0; width: 100%; } }

/* ---------- utilities ---------- */
.muted { color: var(--muted); }
.small { font-size: var(--fs-s); }
.num, .amt { font-variant-numeric: tabular-nums; }
.amt { font-weight: 800; }
.strong { font-weight: 800; }
.nowrap { white-space: nowrap; }
.right { margin-left: auto; }
.gap-s { display: flex; flex-wrap: wrap; gap: var(--s2); align-items: center; }
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.test-mode { background: var(--warn-bg); color: var(--warn); font: 800 11px/20px var(--mono); padding: 0 6px; border-radius: 3px; text-transform: uppercase; letter-spacing: 0.04em; white-space: nowrap; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

/* ---------- app additions ----------
   Pieces the live admin needs that the design mockups don't show. Built only from the tokens above. */
.skip { position: absolute; left: var(--s3); top: -60px; z-index: 10; padding: 8px 12px; border-radius: var(--r-s); background: var(--surface); color: var(--text); font-weight: 800; box-shadow: var(--shadow); }
.skip:focus { top: var(--s2); }
.fields > .wide, .form > .wide { grid-column: 1 / -1; }
.hdr .sub a { color: inherit; }

/* ---------- content + ads ---------- */
fieldset.form { border: 0; padding: 0; margin: 0; min-width: 0; }
fieldset.form > legend.sec-t { padding: 0; margin: var(--s2) 0 var(--s2); }
.pre { white-space: pre-wrap; overflow-wrap: anywhere; }
img.preview, video.preview { display: block; max-width: 100%; max-height: 60vh; border-radius: var(--r-s); background: var(--sunk); }
.tile > img.preview, .tile > video.preview { width: 100%; max-height: none; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 0; }
.tile > .ph { border: 0; border-radius: 0; aspect-ratio: 4 / 3; }

/* ---------- plans, library, 404 ---------- */
.plan-side { grid-template-columns: 220px minmax(0, 1fr); gap: var(--s6); }
.toc a[aria-current="page"] { color: var(--text); font-weight: 800; }
.mono { font-family: var(--mono); }
@media (max-width: 760px) { .plan-side { grid-template-columns: minmax(0, 1fr); gap: var(--s4); } }

/* ---------- pipeline, lead, prospects ---------- */
.form > fieldset { border: 0; padding: 0; margin: 0; min-width: 0; display: grid; gap: var(--s3); }
.form > fieldset > legend { padding: 0; margin: 0 0 var(--s1); }
img.thumb { object-fit: cover; object-position: top; border: 1px solid var(--line); border-radius: var(--r-s); background: var(--sunk); }
img.shot { object-fit: cover; object-position: top; border: 1px solid var(--line); border-radius: var(--r-s); background: var(--sunk); }
.card-b > .flash { margin: 0; }
.log form { margin-top: var(--s1); }
