/* Khulum. Quiet neutral workspace; the business you're working on tints it (--brand). */
:root {
  --brand: #4f46e5;
  --brand-ink: color-mix(in oklab, var(--brand) 72%, #0b1220);
  --brand-wash: color-mix(in oklab, var(--brand) 9%, #fff);
  --brand-line: color-mix(in oklab, var(--brand) 28%, #fff);
  --brand-ring: color-mix(in oklab, var(--brand) 22%, transparent);

  --canvas: #f6f7f9;
  --surface: #ffffff;
  --subtle: #f9fafb;
  --sunk: #f3f4f6;
  --ink: #101828;
  --ink-2: #344054;
  --muted: #667085;
  --faint: #98a2b3;
  --line: #eaecf0;
  --line-2: #d0d5dd;

  --good: #067647; --good-bg: #ecfdf3; --good-line: #abefc6;
  --warn: #b54708; --warn-bg: #fffaeb; --warn-line: #fedf89;
  --bad: #b42318;  --bad-bg: #fef3f2;  --bad-line: #fecdca;
  --info: #175cd3; --info-bg: #eff8ff; --info-line: #b2ddff;
  /* older names, still used by a few pages */
  --stamp: var(--good); --stamp-deep: var(--good); --stamp-wash: var(--good-bg);
  --amber: #f79009; --amber-wash: var(--warn-bg); --amber-ink: var(--warn);
  --red: #d92d20; --red-wash: var(--bad-bg); --blue: var(--info); --blue-wash: var(--info-bg);

  --r-sm: 6px; --r: 8px; --r-lg: 12px;
  --shadow-xs: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow: 0 1px 3px rgba(16, 24, 40, .06), 0 1px 2px rgba(16, 24, 40, .04);
  --shadow-lg: 0 12px 24px -6px rgba(16, 24, 40, .14), 0 4px 8px -4px rgba(16, 24, 40, .06);
  --font: "Geist", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  --mono: "Geist Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
  --side-w: 252px;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--canvas); color: var(--ink); font: 14px/1.55 var(--font); font-feature-settings: "ss01"; -webkit-font-smoothing: antialiased; }
a { color: var(--brand-ink); text-decoration: none; text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--ink); text-decoration: underline; }
.hint a, .note a, p a, .flash a, .sub a { text-decoration: underline; }
.btn:hover, .nav a:hover, .biz-menu a:hover, .threads a:hover, .tabbar a:hover, .brand:hover, .pcard a:hover, .crumb a:hover { text-decoration: none; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 4px; }
h1, h2, h3 { margin: 0; color: var(--ink); letter-spacing: -.015em; }
h1 { font-size: 24px; font-weight: 600; line-height: 1.25; letter-spacing: -.025em; }
h2 { font-size: 15px; font-weight: 600; line-height: 1.4; }
h3 { font-size: 14px; font-weight: 600; }
p { margin: 0 0 10px; }
ul { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.mono { font-family: var(--mono); font-size: 12.5px; }
.num, .t td, .v { font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.hide, [hidden] { display: none !important; }
.show-sm { display: none; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---- Shell ---------------------------------------------------------------------------------------- */
.shell { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); min-height: 100vh; }
.side { background: var(--surface); border-right: 1px solid var(--line); padding: 14px 12px 12px; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 14px; color: var(--ink); text-decoration: none; }
.brand:hover { color: var(--ink); }
.brand-mark { width: 28px; height: 28px; border-radius: 8px; background: var(--ink); display: grid; place-items: center; flex: none; }
.brand-name { font-weight: 650; font-size: 17px; letter-spacing: -.03em; }
.env { margin-left: auto; font-size: 11px; font-weight: 500; color: var(--warn); background: var(--warn-bg); border: 1px solid var(--warn-line); border-radius: 99px; padding: 0 7px; }

/* Business switcher */
.biz { position: relative; margin: 0 0 12px; }
.biz summary, .biz.single { list-style: none; display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: var(--r-lg); border: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow-xs); cursor: pointer; }
.biz summary:hover { border-color: var(--line-2); }
.biz[open] summary { border-color: var(--brand-line); box-shadow: 0 0 0 3px var(--brand-ring); }
.biz.single { cursor: default; }
.biz summary::-webkit-details-marker { display: none; }
.biz-tile { width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; color: #fff; font-size: 12px; font-weight: 600; letter-spacing: .02em; flex: none; }
.biz-text { flex: 1; min-width: 0; display: grid; line-height: 1.3; }
.biz-name { font-weight: 600; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.biz-text small { font-size: 12px; color: var(--muted); }
.side .biz summary .biz-name, .side .biz.single .biz-name { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.biz-link { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); font-weight: 500; }
.biz-link .biz-tile { width: 26px; height: 26px; border-radius: 7px; font-size: 10.5px; }
.biz-caret { color: var(--faint); display: grid; }
.biz-menu { position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 40; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-lg); padding: 6px; }
.biz-menu .lbl { font-size: 11.5px; font-weight: 500; color: var(--muted); padding: 6px 8px 4px; }
.biz-menu a { display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: var(--r); color: var(--ink); text-decoration: none; font-size: 13.5px; font-weight: 500; }
.biz-menu a:hover { background: var(--subtle); }
.biz-menu a.on { background: var(--sunk); }
.biz-menu a .biz-tile { width: 24px; height: 24px; border-radius: 6px; font-size: 10.5px; }
.biz-menu .tick { margin-left: auto; color: var(--brand-ink); }
.biz-menu .badge { margin-left: auto; }
.biz-menu .biz-add { color: var(--muted); font-weight: 500; border-top: 1px solid var(--line); border-radius: 0 0 var(--r) var(--r); margin-top: 4px; padding-top: 9px; }
.biz-menu .biz-add:hover { color: var(--ink); }
.bizchip { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--ink-2); white-space: nowrap; font-weight: 500; }
.bizchip i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.t td .chip { white-space: normal; }

/* Navigation */
.nav { display: grid; gap: 1px; }
.nav-label { font-size: 11.5px; font-weight: 500; color: var(--faint); padding: 14px 10px 4px; letter-spacing: .01em; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 7px 10px; color: var(--ink-2); text-decoration: none; border-radius: var(--r); font-size: 13.5px; font-weight: 500; }
.nav a:hover { background: var(--subtle); color: var(--ink); }
.nav a.on { background: var(--brand-wash); color: var(--brand-ink); }
.nav a.on svg { color: var(--brand); }
.nav svg { width: 18px; height: 18px; flex: none; color: var(--faint); }
.nav a:hover svg { color: var(--muted); }
.badge { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 99px; background: var(--brand); color: #fff; font-size: 11.5px; font-weight: 600; line-height: 1; }
.nav .badge { margin-left: auto; }
.side-foot { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 12px 8px 4px; border-top: 1px solid var(--line); }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--sunk); color: var(--ink-2); display: grid; place-items: center; font-size: 12px; font-weight: 600; flex: none; border: 1px solid var(--line); }
.side-foot .who { flex: 1; min-width: 0; display: grid; line-height: 1.3; }
.side-foot .who b { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-foot .who small { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-foot form { display: inline; }
.icon-btn { width: 32px; height: 32px; display: grid; place-items: center; border-radius: var(--r); border: 0; background: none; color: var(--muted); cursor: pointer; }
.icon-btn:hover { background: var(--sunk); color: var(--ink); }

/* Top bar + page */
.main-wrap { min-width: 0; display: flex; flex-direction: column; }
/* The top bar is the business's band: its colour, darkened so white text always reads, its logo and name. */
.top { --band: color-mix(in oklab, var(--brand) 74%, #0b1220); height: 64px; display: flex; align-items: center; gap: 20px; padding: 0 28px 0 24px; background: var(--band); color: #fff; position: sticky; top: 0; z-index: 20;
  background-image: linear-gradient(90deg, rgba(255, 255, 255, .06), rgba(255, 255, 255, 0) 45%); box-shadow: inset 0 -1px 0 rgba(0, 0, 0, .12); }
.top-biz { display: flex; align-items: center; gap: 12px; color: #fff; text-decoration: none; min-width: 0; flex: 0 1 auto; }
.top-biz:hover { color: #fff; text-decoration: none; }
.top-biz span { display: grid; line-height: 1.25; min-width: 0; }
.top-biz b { font-size: 15.5px; font-weight: 600; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-biz small { font-size: 12px; color: rgba(255, 255, 255, .68); white-space: nowrap; }
.top-biz .biz-tile { width: 36px; height: 36px; border-radius: 9px; font-size: 13px; box-shadow: 0 0 0 2px rgba(255, 255, 255, .9); }
.top-logo { height: 38px; width: auto; max-width: 120px; border-radius: 9px; background: #fff; padding: 3px; display: block; object-fit: contain; }
.search { position: relative; flex: 1 1 auto; max-width: 560px; margin: 0 auto; }
.search svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--faint); pointer-events: none; }
.search input[type=search] { padding-left: 38px; height: 38px; background: var(--subtle); }
.top .search svg { color: rgba(255, 255, 255, .7); }
.top .search input[type=search] { background: rgba(255, 255, 255, .12); border-color: rgba(255, 255, 255, .18); color: #fff; box-shadow: none; }
.top .search input[type=search]::placeholder { color: rgba(255, 255, 255, .62); }
.top .search input[type=search]:focus { background: #fff; color: var(--ink); border-color: #fff; box-shadow: 0 0 0 3px rgba(255, 255, 255, .28); }
.top .search:focus-within svg { color: var(--muted); }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 14px; flex: none; }
.top-stat { display: grid; grid-template-columns: auto auto; column-gap: 8px; align-items: baseline; color: #fff; text-decoration: none; padding: 4px 4px; }
.top-stat:hover { color: #fff; text-decoration: none; }
.top-stat-k { font-size: 12px; color: rgba(255, 255, 255, .7); }
.top-stat-v { font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; }
.top-stat-v small { font-weight: 400; color: rgba(255, 255, 255, .7); font-size: 12.5px; }
.top-meter { grid-column: 1 / -1; height: 4px; border-radius: 99px; background: rgba(255, 255, 255, .2); overflow: hidden; margin-top: 5px; min-width: 150px; }
.top-meter i { display: block; height: 100%; background: #fff; border-radius: 99px; }
.top-icon { position: relative; width: 38px; height: 38px; display: grid; place-items: center; border-radius: 10px; color: #fff; background: rgba(255, 255, 255, .1); }
.top-icon:hover { background: rgba(255, 255, 255, .2); color: #fff; }
.top-icon .badge { position: absolute; top: -5px; right: -6px; background: #fff; color: var(--band); box-shadow: 0 0 0 2px var(--band); }
.btn.top-cta { background: #fff; border-color: #fff; color: var(--ink); height: 38px; box-shadow: 0 1px 2px rgba(0, 0, 0, .2); }
.btn.top-cta:hover { background: rgba(255, 255, 255, .9); color: var(--ink); }
.top-cta::before { content: "+"; font-size: 17px; font-weight: 500; line-height: 0; margin-right: 1px; }
@media (max-width: 1240px) { .top-stat { display: none; } .top-biz small { display: none; } }
.main { min-width: 0; width: 100%; max-width: 1360px; padding: 28px 32px 64px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.page-head .sub { color: var(--muted); margin-top: 4px; overflow-wrap: anywhere; font-size: 14px; }
.page-head > div:first-child { min-width: 0; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.crumb { font-size: 13px; color: var(--muted); margin-bottom: 6px; font-weight: 500; }
.crumb a { color: var(--muted); text-decoration: none; }
.crumb a:hover { color: var(--ink); }
.crumb a::after { content: "/"; margin: 0 6px 0 8px; color: var(--line-2); }
.tabbar, .topbar { display: none; }

/* ---- Cards, grids --------------------------------------------------------------------------------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-xs); padding: 20px; min-width: 0; }
.card + .card, .stack > * + * { margin-top: 16px; }
.grid > *, .split > *, .editor > *, .row > * { margin-top: 0; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 8px 12px; flex-wrap: wrap; margin-bottom: 14px; }
.card-head .small, .card-head a.small { font-weight: 500; }
.card > h2:first-child { margin-bottom: 12px; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.split { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 16px 18px; box-shadow: var(--shadow-xs); min-width: 0; }
.tile .k { font-size: 13px; color: var(--muted); font-weight: 500; }
.tile .v { font-size: 28px; font-weight: 600; line-height: 1.2; margin-top: 6px; letter-spacing: -.03em; }
.tile .d { font-size: 12.5px; color: var(--muted); margin-top: 4px; }
.empty { text-align: center; padding: 40px 16px; color: var(--muted); }
.empty h2 { margin-bottom: 6px; }
.empty .actions { justify-content: center; margin-top: 14px; }
hr.rule { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }
.sticky { position: sticky; top: 76px; }

/* ---- Warm-up staircase + meters ------------------------------------------------------------------- */
.ramp { display: flex; align-items: flex-end; gap: 3px; height: 64px; margin: 6px 0 10px; }
.ramp i { flex: 1; min-width: 3px; background: var(--sunk); border-radius: 3px 3px 1px 1px; position: relative; }
.ramp i.done { background: var(--brand); }
.ramp i.now { background: var(--brand); box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--brand-line); }
.ramp i.now::after { content: ""; position: absolute; left: 50%; bottom: -8px; width: 5px; height: 5px; margin-left: -2.5px; border-radius: 50%; background: var(--brand); }
.ramp-meta { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--muted); gap: 10px; flex-wrap: wrap; }
.ramp-meta b { color: var(--ink); font-weight: 600; }
.meter { height: 6px; background: var(--sunk); border-radius: 99px; overflow: hidden; }
.meter > span { display: block; height: 100%; background: var(--brand); border-radius: 99px; }

/* ---- Badges ---------------------------------------------------------------------------------------- */
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 1px 8px; border-radius: 99px; font-size: 12px; font-weight: 500; line-height: 20px; white-space: nowrap; border: 1px solid transparent; }
.chip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.chip.plain::before { display: none; }
.c-good { background: var(--good-bg); color: var(--good); border-color: var(--good-line); }
.c-warn { background: var(--warn-bg); color: var(--warn); border-color: var(--warn-line); }
.c-bad { background: var(--bad-bg); color: var(--bad); border-color: var(--bad-line); }
.c-info { background: var(--info-bg); color: var(--info); border-color: var(--info-line); }
.c-mute { background: var(--subtle); color: var(--ink-2); border-color: var(--line); }
.tag { display: inline-block; padding: 0 7px; border-radius: var(--r-sm); background: var(--surface); border: 1px solid var(--line-2); font-size: 12px; font-weight: 500; line-height: 20px; color: var(--ink-2); margin: 1px 3px 1px 0; text-decoration: none; }

/* ---- Buttons & forms ------------------------------------------------------------------------------ */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 36px; padding: 0 14px; border-radius: var(--r); border: 1px solid var(--line-2); background: var(--surface); color: var(--ink-2); font: 500 13.5px/1 var(--font); text-decoration: none; cursor: pointer; white-space: nowrap; box-shadow: var(--shadow-xs); transition: background .12s, border-color .12s; }
.btn:hover { background: var(--subtle); color: var(--ink); }
.btn.primary { background: var(--ink); border-color: var(--ink); color: #fff; box-shadow: 0 1px 2px rgba(16, 24, 40, .2), inset 0 1px 0 rgba(255, 255, 255, .12); }
.btn.primary:hover { background: #1d2939; border-color: #1d2939; color: #fff; }
.btn.danger { color: var(--bad); border-color: var(--bad-line); }
.btn.danger:hover { background: var(--bad-bg); }
.btn.ghost { border-color: transparent; background: transparent; box-shadow: none; }
.btn.ghost:hover { background: var(--sunk); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 13px; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
label.btn { position: relative; }
form.inline { display: inline; }
label.f { display: block; font-weight: 500; font-size: 13px; color: var(--ink-2); margin: 0 0 6px; }
.field { margin-bottom: 16px; }
.hint { font-size: 12.5px; color: var(--muted); margin-top: 6px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=url], input[type=tel], input[type=date], input[type=time], input[type=search], input[type=datetime-local], select, textarea {
  width: 100%; height: 38px; padding: 0 12px; border: 1px solid var(--line-2); border-radius: var(--r); background: #fff; color: var(--ink); font: 14px/1.4 var(--font); box-shadow: var(--shadow-xs); transition: border-color .12s, box-shadow .12s;
}
select { padding-right: 32px; appearance: none; background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%23667085' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m4 6 4 4 4-4'/%3E%3C/svg%3E") no-repeat right 10px center; }
textarea { height: auto; min-height: 120px; padding: 10px 12px; resize: vertical; line-height: 1.55; }
textarea.code, textarea.body { font: 13.5px/1.65 var(--mono); min-height: 320px; }
input::placeholder, textarea::placeholder { color: var(--faint); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-ring); }
input[type=color] { width: 44px; height: 38px; padding: 3px; border: 1px solid var(--line-2); border-radius: var(--r); background: #fff; cursor: pointer; }
input[type=file] { font: inherit; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; margin: 8px 0; color: var(--ink-2); }
.check input { margin: 2px 0 0; width: 16px; height: 16px; accent-color: var(--ink); flex: none; }
.sub-checks { margin: 4px 0 0 26px; padding-left: 12px; border-left: 2px solid var(--line); }
.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px 14px; align-items: start; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.filters input[type=search] { max-width: 300px; }
.filters select { width: auto; max-width: 220px; }
.pick { display: flex; flex-wrap: wrap; gap: 6px; }
.pick label { display: inline-flex; align-items: center; gap: 7px; height: 32px; padding: 0 11px; border: 1px solid var(--line-2); border-radius: 99px; font-size: 13px; font-weight: 500; color: var(--ink-2); cursor: pointer; background: #fff; }
.pick input { accent-color: var(--ink); margin: 0; }
.pick label:has(input:checked) { border-color: var(--ink); background: var(--ink); color: #fff; }
.pick label:has(input:checked) .muted { color: rgba(255, 255, 255, .7); }
.choice { display: grid; gap: 10px; }
.choice label { display: block; border: 1px solid var(--line-2); border-radius: var(--r-lg); padding: 12px 14px; cursor: pointer; background: #fff; }
.choice label:has(input:checked) { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-ring); }
.choice b { display: block; font-weight: 600; }
.seg { display: inline-flex; padding: 3px; gap: 2px; background: var(--sunk); border-radius: var(--r); }
.seg label { cursor: pointer; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: block; padding: 4px 10px; border-radius: 6px; font-size: 12.5px; font-weight: 500; color: var(--muted); }
.seg input:checked + span { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.seg input:focus-visible + span { outline: 2px solid var(--brand); }

/* ---- Tables --------------------------------------------------------------------------------------- */
.tbl-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); box-shadow: var(--shadow-xs); }
.card .tbl-wrap { box-shadow: none; }
table.t { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.t th { text-align: left; font-size: 12px; font-weight: 500; color: var(--muted); padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--subtle); white-space: nowrap; }
.t th.right { text-align: right; }
.t td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; color: var(--ink-2); }
.t tr:last-child td { border-bottom: 0; }
.t tbody tr:hover td { background: var(--subtle); }
.t tr.click:hover td { cursor: pointer; }
.t td.who { overflow-wrap: anywhere; min-width: 160px; color: var(--ink); }
.t td.who a { font-weight: 500; text-decoration: none; color: var(--ink); }
.t td.who a:hover { text-decoration: underline; }
.t td.who .muted { font-size: 12.5px; }
.card > .t, .card > table.t { margin: -4px -20px -20px; width: calc(100% + 40px); }
.card > .t td:first-child, .card > .t th:first-child { padding-left: 20px; }
.card > .t td:last-child, .card > .t th:last-child { padding-right: 20px; }
.card > .t tr:last-child td:first-child { border-bottom-left-radius: var(--r-lg); }
.pager { display: flex; gap: 8px; align-items: center; justify-content: flex-end; margin-top: 12px; font-size: 13px; }
.bulkbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 10px 12px; background: var(--ink); color: #fff; border-radius: var(--r-lg); margin-bottom: 12px; }
.bulkbar select, .bulkbar input { width: auto; }

/* ---- Messages ------------------------------------------------------------------------------------- */
.flash { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--r-lg); margin-bottom: 20px; border: 1px solid; font-weight: 500; font-size: 13.5px; box-shadow: var(--shadow-xs); }
.flash::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; margin-top: 6px; flex: none; }
.flash.ok { background: var(--good-bg); border-color: var(--good-line); color: var(--good); }
.flash.err { background: var(--bad-bg); border-color: var(--bad-line); color: var(--bad); }
.note { padding: 12px 14px; border-radius: var(--r); background: var(--warn-bg); border: 1px solid var(--warn-line); color: #93370d; font-size: 13.5px; }
.note.info { background: var(--info-bg); border-color: var(--info-line); color: #1849a9; }
.note.bad { background: var(--bad-bg); border-color: var(--bad-line); color: #912018; }
.note ul { margin: 6px 0 0; padding-left: 18px; }

/* ---- Inbox ---------------------------------------------------------------------------------------- */
.threads { list-style: none; margin: 0; padding: 0; }
.threads li a { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; padding: 14px 16px; text-decoration: none; color: var(--ink); border-bottom: 1px solid var(--line); }
.threads li:last-child a { border-bottom: 0; }
.threads li a:hover { background: var(--subtle); }
.threads .who { font-weight: 500; }
.threads .unread .who { font-weight: 600; }
.threads .unread .who::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--brand); margin-right: 8px; vertical-align: 2px; }
.threads .when { font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.threads .prev { grid-column: 1 / -1; color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.threads .prev b { color: var(--ink-2); font-weight: 500; }
.card > .threads:first-child { margin: -20px; }
.card > h2 + .threads, .card > .card-head + .threads { margin: 0 -20px -20px; border-top: 1px solid var(--line); }
.card[style*="padding:0"] > .threads { margin: 0; }
.threads .when b { font-weight: 600; color: var(--ink); }
.msgs { display: grid; gap: 12px; }
.msg { border: 1px solid var(--line); border-radius: var(--r-lg); padding: 14px 16px; background: var(--surface); max-width: 760px; box-shadow: var(--shadow-xs); }
.msg.out { background: var(--brand-wash); border-color: var(--brand-line); margin-left: auto; }
.msg .meta { font-size: 12.5px; color: var(--muted); margin-bottom: 8px; display: flex; gap: 10px; flex-wrap: wrap; justify-content: space-between; }
.msg .meta b { color: var(--ink); font-weight: 600; }
.msg .body { white-space: pre-wrap; overflow-wrap: anywhere; color: var(--ink-2); }
.msg details { margin-top: 8px; font-size: 13px; color: var(--muted); }
.msg details pre { white-space: pre-wrap; font: 12.5px/1.5 var(--mono); }
.reply-box textarea { min-height: 140px; }

/* ---- Timeline ------------------------------------------------------------------------------------- */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: grid; grid-template-columns: 16px 1fr; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.timeline li:last-child { border-bottom: 0; }
.timeline .dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 7px; background: var(--line-2); }
.timeline .dot.good { background: #17b26a; }
.timeline .dot.warn { background: #f79009; }
.timeline .dot.bad { background: #f04438; }
.timeline .dot.info { background: #2e90fa; }
.timeline .when { font-size: 12.5px; color: var(--muted); }
.timeline .det { color: var(--muted); white-space: pre-wrap; overflow-wrap: anywhere; }

/* ---- Pipeline ------------------------------------------------------------------------------------- */
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(232px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 8px; }
.col { background: var(--sunk); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 10px; min-height: 260px; }
.col h3 { display: flex; justify-content: space-between; font-size: 13px; font-weight: 600; margin: 2px 4px 10px; color: var(--ink-2); }
.col.over { outline: 2px dashed var(--brand); }
.pcard { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 10px 12px; margin-bottom: 8px; box-shadow: var(--shadow-xs); cursor: grab; font-size: 13px; }
.pcard:hover { border-color: var(--line-2); }
.pcard a { font-weight: 600; text-decoration: none; color: var(--ink); }
.pcard select { margin-top: 8px; font-size: 12px; height: 26px; width: auto; max-width: 100%; padding: 0 26px 0 8px; border-color: transparent; background-color: var(--subtle); box-shadow: none; color: var(--muted); background-position: right 6px center; }
.pcard select:hover { border-color: var(--line-2); color: var(--ink-2); }
.person { display: flex; gap: 10px; align-items: flex-start; }
.person > div { min-width: 0; }
.avatar.sm { width: 28px; height: 28px; font-size: 11px; border: 0; margin-top: 1px; }
.av-0 { background: #eef4ff; color: #3538cd; } .av-1 { background: #ecfdf3; color: #067647; } .av-2 { background: #fef6ee; color: #b93815; }
.av-3 { background: #fdf2fa; color: #c11574; } .av-4 { background: #f0f9ff; color: #026aa2; } .av-5 { background: #f4f3ff; color: #5925dc; }

/* ---- Campaign editor + signature designer ----------------------------------------------------------- */
.editor { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.preview-frame { width: 100%; height: 620px; border: 1px solid var(--line); border-radius: var(--r); background: #fff; display: block; }
.preview-frame.short { height: 460px; }
.mergebar { display: flex; flex-wrap: wrap; gap: 5px; margin: 0 0 8px; }
.mergebar button { font: 11.5px var(--mono); padding: 3px 7px; border: 1px solid var(--line); background: var(--subtle); color: var(--ink-2); border-radius: var(--r-sm); cursor: pointer; }
.mergebar button:hover { border-color: var(--line-2); background: #fff; }
.statline { display: flex; flex-wrap: wrap; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); overflow: hidden; box-shadow: var(--shadow-xs); }
.statline > div { flex: 1 1 130px; padding: 14px 18px; border-right: 1px solid var(--line); }
.statline > div:last-child { border-right: 0; }
.statline .k { font-size: 12.5px; color: var(--muted); font-weight: 500; }
.statline .v { font-size: 22px; font-weight: 600; line-height: 1.3; letter-spacing: -.02em; }
.statline .p { font-size: 12.5px; color: var(--muted); }
.layouts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.layout { display: grid; gap: 8px; justify-items: center; padding: 12px 8px 10px; border: 1px solid var(--line-2); border-radius: var(--r-lg); cursor: pointer; font-size: 13px; font-weight: 500; color: var(--ink-2); background: #fff; }
.layout input { position: absolute; opacity: 0; pointer-events: none; }
.layout svg { width: 100%; max-width: 110px; height: auto; }
.layout svg .a { fill: var(--line-2); } .layout svg .b { fill: var(--line-2); } .layout svg .t { fill: var(--muted); } .layout svg .l { fill: var(--line); }
.layout:has(input:checked) { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-ring); color: var(--ink); }
.layout:has(input:checked) svg .b { fill: var(--brand); } .layout:has(input:checked) svg .a { fill: var(--brand-line); }
.layout:has(input:focus-visible) { outline: 2px solid var(--brand); outline-offset: 2px; }
.color-row { display: flex; gap: 8px; align-items: center; }
.logo-row { display: flex; gap: 16px; align-items: flex-start; }
.logo-row > div:last-child { flex: 1; min-width: 0; }
.logo-box { width: 132px; height: 84px; flex: none; border: 1px dashed var(--line-2); border-radius: var(--r); display: grid; place-items: center; background: var(--subtle); padding: 8px; }
.logo-box img { max-width: 114px; max-height: 66px; width: auto; height: auto; object-fit: contain; display: block; }
.sig-link { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r); background: var(--subtle); font-size: 13.5px; color: var(--ink-2); flex-wrap: wrap; }
.tips ul { padding-left: 18px; display: grid; gap: 6px; color: var(--ink-2); }

/* ---- Checks list ---------------------------------------------------------------------------------- */
.checks { list-style: none; margin: 0; padding: 0; }
.checks li { padding: 12px 0; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: 120px 1fr; gap: 10px; }
.checks li:last-child { border-bottom: 0; }
.checks .fix { color: var(--muted); font-size: 13px; margin-top: 3px; }
pre.code { background: var(--subtle); border: 1px solid var(--line); border-radius: var(--r); padding: 12px; overflow-x: auto; font: 12.5px/1.55 var(--mono); white-space: pre-wrap; word-break: break-all; }

/* ---- Public pages (sign-up, booking, unsubscribe, login) ---------------------------------------------- */
.public { min-height: 100vh; display: grid; place-items: start center; padding: 56px 16px; background: var(--canvas); }
.public .box { width: 100%; max-width: 560px; background: var(--surface); border: 1px solid var(--line); border-top: 3px solid var(--brand); border-radius: var(--r-lg); box-shadow: var(--shadow); padding: 32px; }
.public .box.wide { max-width: 880px; }
.public h1 { font-size: 22px; margin-bottom: 8px; }
.public .org { display: flex; align-items: center; gap: 10px; font-size: 13.5px; color: var(--ink-2); margin-bottom: 20px; font-weight: 600; }
.public .org .biz-tile { width: 28px; height: 28px; border-radius: 7px; font-size: 11px; }
.public .foot { margin-top: 24px; font-size: 12.5px; color: var(--muted); }
.days { display: grid; gap: 16px; }
.day h3 { font-size: 13.5px; margin-bottom: 8px; color: var(--ink-2); }
.slots { display: flex; flex-wrap: wrap; gap: 8px; }
.slots label { position: relative; }
.slots input { position: absolute; opacity: 0; }
.slots span { display: inline-block; padding: 7px 14px; border: 1px solid var(--line-2); border-radius: var(--r); font-weight: 500; font-variant-numeric: tabular-nums; cursor: pointer; background: #fff; box-shadow: var(--shadow-xs); }
.slots span:hover { border-color: var(--brand); }
.slots input:checked + span { background: var(--brand); color: #fff; border-color: var(--brand); }
.slots input:focus-visible + span { outline: 2px solid var(--brand); outline-offset: 2px; }
.public.center { place-items: center; padding: 24px 16px 10vh; }
.public .box.narrow { max-width: 400px; border-top-width: 1px; box-shadow: var(--shadow-lg); }
.public .box.narrow h1 { margin-top: 18px; }
.app-mark { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 14.5px; }
.btn.block { width: 100%; height: 40px; margin-top: 4px; }

/* ---- Small screens: bottom tab bar instead of the side menu ---------------------------------------- */
@media (max-width: 1100px) {
  .split, .editor { grid-template-columns: 1fr; }
  .sticky { position: static; }
}
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .side, .top { display: none; }
  .main { padding: 16px 16px 96px; }
  .g3, .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g2 { grid-template-columns: 1fr; }
  h1 { font-size: 21px; }
  .page-head { margin-bottom: 18px; }
  .topbar { display: flex; align-items: center; gap: 10px; padding: 10px 16px; background: color-mix(in oklab, var(--brand) 74%, #0b1220); position: sticky; top: 0; z-index: 30; }
  .topbar .brand-mark { background: rgba(255, 255, 255, .16); }
  .topbar .biz summary, .topbar .biz.single { background: rgba(255, 255, 255, .12); border-color: rgba(255, 255, 255, .18); color: #fff; }
  .topbar .biz-caret { color: rgba(255, 255, 255, .7); }
  .topbar .biz-tile { box-shadow: 0 0 0 1.5px rgba(255, 255, 255, .85); }
  .topbar .brand { padding: 0; }
  .topbar .biz { margin: 0; flex: 1; min-width: 0; }
  .topbar .biz summary, .topbar .biz.single { padding: 5px 8px; box-shadow: none; }
  .topbar .biz-tile { width: 26px; height: 26px; font-size: 10.5px; border-radius: 7px; }
  .topbar .biz-text small { display: none; }
  .tabbar { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; bottom: 0; left: 0; right: 0; background: rgba(255, 255, 255, .96); backdrop-filter: blur(8px); border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); z-index: 30; }
  .tabbar a { display: grid; justify-items: center; gap: 2px; color: var(--muted); text-decoration: none; font-size: 11px; font-weight: 500; padding: 4px 0; position: relative; }
  .tabbar a.on { color: var(--brand-ink); }
  .tabbar svg { width: 22px; height: 22px; }
  .tabbar .badge { position: absolute; top: 0; left: 56%; min-width: 18px; height: 18px; font-size: 10.5px; }
  .preview-frame { height: 480px; }
  .checks li { grid-template-columns: 1fr; gap: 2px; }
  .t .hide-sm { display: none; }
  .show-sm { display: inline-flex; }
  .filters input[type=search] { max-width: none; flex: 1 1 100%; }
  .filters select { flex: 1 1 140px; max-width: none; }
  .layouts { grid-template-columns: repeat(3, minmax(90px, 1fr)); }
  .logo-row { flex-direction: column; }
}
@media (max-width: 520px) { .g3, .g4 { grid-template-columns: 1fr 1fr; } .public .box { padding: 22px; } .tile .v { font-size: 24px; } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
