/* ============================================================================
 * PLASMA — the Mundus OS design system.  "Sala Operativa" edition.
 *
 * This is an operations console, not a marketing site. It reads like an
 * instrument panel: framed panels on deep ink, a monospace machine-voice for
 * every piece of telemetry (ids, stages, credits, clocks), and one signature
 * element — IL BINARIO, the rail a request rides from draft to settled.
 *
 * Three ideas hold the whole OS together:
 *   1. Frames, not floating cards. A 1px accent-tinted hairline on a flat
 *      near-black surface — depth comes from value and line, never from a
 *      drop-shadow or a blurred gradient blob.
 *   2. Two voices. Sans for prose the human reads; MONO, uppercase, tracked,
 *      for everything the machine reports. A single serif accent signs the
 *      wordmark and nothing else.
 *   3. State you can read across the room. LED chips, lit rail stations, a
 *      live pulse that means "this is actually running right now".
 *
 * No build step, no framework, no web-font download: one stylesheet, system
 * font stacks, works offline. Brand anchors kept: ink #12101f, purple #7367f0.
 * ========================================================================== */

:root {
  /* -- ink & surfaces: a five-step value ramp, violet-cool ------------------ */
  --ink:        #0a0912;   /* deepest — page floor, rail troughs, sidebar back */
  --bg:         #100d1d;   /* the world (brand anchor #12101f, a touch deeper) */
  --panel:      #16122a;   /* a framed panel */
  --panel-2:    #1d1840;   /* raised inside a panel: inputs, chips, meters      */
  --panel-3:    #262051;   /* hover / pressed                                   */
  --line:       #2c2758;   /* the hairline you see                             */
  --line-soft:  #201b3c;   /* an internal divider, barely there               */

  /* -- purple: the one accent (brand) -------------------------------------- */
  --purple:      #7367f0;
  --purple-soft: #9d94f7;
  --purple-deep: #574bd0;
  --purple-dim:  rgba(115, 103, 240, 0.15);
  --purple-line: rgba(115, 103, 240, 0.45);
  --purple-glow: rgba(115, 103, 240, 0.40);

  /* -- text: four weights of light ----------------------------------------- */
  --text:  #ece9ff;
  --muted: #a8a2d0;
  --faint: #6f6a94;
  --dim:   #48446c;

  /* -- state: green go, amber wait, rose stop ------------------------------- */
  --ok:        #37d3a1;
  --ok-line:   rgba(55, 211, 161, 0.45);
  --ok-dim:    rgba(55, 211, 161, 0.13);
  --warn:      #ffb43e;
  --warn-line: rgba(255, 180, 62, 0.45);
  --warn-dim:  rgba(255, 180, 62, 0.13);
  --danger:      #ff6479;
  --danger-line: rgba(255, 100, 121, 0.45);
  --danger-dim:  rgba(255, 100, 121, 0.12);

  /* -- type ---------------------------------------------------------------- */
  --sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "JetBrains Mono", "SF Mono", "Cascadia Code", "Roboto Mono", Menlo, monospace;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;

  /* -- geometry: tighter than the last pass. This is instrumentation. ------ */
  --radius:    10px;
  --radius-sm: 7px;
  --radius-xs: 5px;
  --gap: 16px;

  /* -- motion: measured. Nothing bounces on an ops console. ---------------- */
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --fast: 120ms;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  color: var(--text);
  font-family: var(--sans);
  font-size: 14.5px;
  line-height: 1.55;
  min-height: 100vh;
  /* The world: deep ink, one restrained wash of purple from the top-left
   * where the console "powers on", and a hairline instrument grid you feel
   * more than see. No blob. */
  background-color: var(--bg);
  background-image:
    radial-gradient(900px 520px at 12% -8%, rgba(115, 103, 240, 0.13), transparent 60%),
    linear-gradient(var(--line-soft) 1px, transparent 1px),
    linear-gradient(90deg, var(--line-soft) 1px, transparent 1px);
  background-size: auto, 46px 46px, 46px 46px;
  background-position: 0 0, -1px -1px, -1px -1px;
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* The grid must whisper, not shout: fade it out except near the top. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(180deg, transparent, var(--bg) 78%);
  z-index: 0;
}

a { color: var(--purple-soft); text-decoration: none; transition: color var(--fast) var(--ease); }
a:hover { color: var(--text); }

h1, h2, h3 { margin: 0; font-weight: 640; letter-spacing: -0.017em; line-height: 1.2; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1rem; letter-spacing: -0.01em; }
h3 { font-size: 0.9rem; }
p { margin: 0 0 0.7em; }
strong { font-weight: 620; }

/* -- the machine voice: a shared utility. Mono, small, uppercase, tracked. -- */
.kicker,
.card > header .kicker {
  font-family: var(--mono);
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.17em;
  text-transform: uppercase;
  color: var(--faint);
  display: block;
}

.mono  { font-family: var(--mono); font-size: 0.82rem; font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.right { margin-left: auto; text-align: right; }
.num   { font-family: var(--mono); font-variant-numeric: tabular-nums; }

/* ============================================================================
 * LAYOUT — the shell
 * ========================================================================== */

.shell { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; position: relative; z-index: 1; }

.sidebar {
  background: var(--ink);
  border-right: 1px solid var(--line);
  padding: 20px 12px;
  display: flex;
  flex-direction: column;
  gap: 22px;
  position: sticky;
  top: 0;
  height: 100vh;
}

/* -- brand: the { } mark and the wordmark ------------------------------- */
.brand { display: flex; align-items: center; gap: 11px; padding: 4px 8px 0; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 9px;
  border: 1px solid var(--purple-line);
  background: linear-gradient(150deg, var(--purple-dim), transparent);
  display: grid; place-items: center;
  font-family: var(--mono); font-weight: 700; font-size: 1rem;
  color: var(--purple-soft);
  letter-spacing: -0.05em;
  flex: none;
}
.brand-name {
  font-family: var(--serif); font-style: italic; font-weight: 600;
  font-size: 1.12rem; letter-spacing: -0.01em; color: var(--text); line-height: 1.1;
}
.brand-sub {
  font-family: var(--mono); font-size: 0.62rem; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--faint); margin-top: 2px;
}

/* -- nav: destinations as a stacked channel list ------------------------- */
.nav { display: flex; flex-direction: column; gap: 1px; }
.nav a {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 11px 9px 13px;
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-size: 0.87rem; font-weight: 500;
  position: relative;
  transition: background var(--fast) var(--ease), color var(--fast) var(--ease);
}
.nav a:hover { background: var(--panel); color: var(--text); }
.nav a.active {
  background: linear-gradient(90deg, var(--purple-dim), transparent 90%);
  color: #fff;
}
/* the rail tick: a lit bar on the left of the active destination */
.nav a.active::before {
  content: ""; position: absolute; left: 0; top: 8px; bottom: 8px;
  width: 3px; border-radius: 0 3px 3px 0;
  background: var(--purple);
  box-shadow: 0 0 10px var(--purple-glow);
}
.nav a.pending { color: var(--dim); }
.nav a.pending:hover { color: var(--faint); }
.nav .icon { width: 18px; text-align: center; opacity: 0.85; font-size: 0.92rem; }
.nav .soon {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 0.55rem; letter-spacing: 0.1em;
  color: var(--faint);
  border: 1px solid var(--line); border-radius: 4px; padding: 1px 5px;
}

.sidebar-foot {
  margin-top: auto;
  font-family: var(--mono); font-size: 0.68rem; letter-spacing: 0.04em;
  color: var(--faint); padding: 12px 10px 4px;
  border-top: 1px solid var(--line-soft);
  text-transform: uppercase;
}
.sidebar-foot strong {
  color: var(--muted); display: block; font-weight: 600;
  font-family: var(--sans); font-size: 0.8rem; letter-spacing: 0; text-transform: none;
  margin-bottom: 1px;
}

.main { display: flex; flex-direction: column; min-width: 0; }

/* -- topbar: a thin status strip ---------------------------------------- */
.topbar {
  display: flex; align-items: center; gap: 18px;
  padding: 16px 30px;
  border-bottom: 1px solid var(--line);
  background: rgba(10, 9, 18, 0.82);
  position: sticky; top: 0;
  backdrop-filter: blur(6px);
  z-index: 5;
}
.topbar h1 { font-size: 1.32rem; }
.topbar .spacer { flex: 1; }
.topbar .who {
  text-align: right; font-size: 0.8rem; line-height: 1.35; color: var(--muted);
}
.topbar .who span {
  color: var(--faint); display: block;
  font-family: var(--mono); font-size: 0.66rem; letter-spacing: 0.06em; text-transform: uppercase;
}

.content {
  padding: 26px 30px 72px;
  display: flex; flex-direction: column; gap: var(--gap);
  max-width: 1520px; width: 100%;
}
.page-head { display: flex; align-items: flex-end; gap: 14px; flex-wrap: wrap; }
.page-head .lede { color: var(--muted); font-size: 0.88rem; }

/* ============================================================================
 * PANELS  (.card)  — frames, not floaters
 * ========================================================================== */

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
  position: relative;
}
.card > header {
  display: flex; align-items: baseline; gap: 10px;
  margin: -2px 0 15px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line-soft);
}
.card > header h2 { color: var(--text); }
.card > header .count {
  font-family: var(--mono); font-size: 0.74rem; color: var(--faint);
  font-variant-numeric: tabular-nums;
}
.card > header .more {
  margin-left: auto; align-self: center;
  font-family: var(--mono); font-size: 0.68rem; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--muted);
}
.card > header .more + .more { margin-left: 14px; }

.grid { display: grid; gap: var(--gap); }
.grid.kpis { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.grid.split { grid-template-columns: 1.4fr 1fr; align-items: start; }
.grid.thirds { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 1080px) { .grid.split, .grid.thirds { grid-template-columns: 1fr; } }

/* ============================================================================
 * KPI — instrument readouts.  Structure kept: .label then .value (tests).
 * ========================================================================== */

.kpi { display: flex; flex-direction: column; gap: 3px; overflow: hidden; }
.kpi .label {
  font-family: var(--mono); color: var(--faint);
  font-size: 0.64rem; text-transform: uppercase; letter-spacing: 0.14em; font-weight: 600;
}
.kpi .value {
  font-size: 2.15rem; font-weight: 680; line-height: 1.05; margin-top: 4px;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}
.kpi .hint { color: var(--faint); font-size: 0.76rem; margin-top: 2px; }
/* a thin baseline meter under every readout — the instrument's "on" line */
.kpi::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 2px;
  background: linear-gradient(90deg, var(--purple), transparent 70%);
  opacity: 0.5;
}
.kpi.alert .value { color: var(--warn); }
.kpi.alert::after { background: linear-gradient(90deg, var(--warn), transparent 70%); }
.kpi.money .value { color: var(--purple-soft); }
.kpi.good .value  { color: var(--ok); }
.kpi.good::after  { background: linear-gradient(90deg, var(--ok), transparent 70%); }

/* ============================================================================
 * CHIPS — LED status. Squarer, mono, a lit dot. State classes kept 1:1.
 * ========================================================================== */

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 9px; border-radius: var(--radius-xs);
  font-family: var(--mono);
  font-size: 0.68rem; font-weight: 600; letter-spacing: 0.03em;
  border: 1px solid var(--line); background: var(--panel-2); color: var(--muted);
  white-space: nowrap; text-transform: uppercase;
}
.chip::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%;
  background: currentColor; flex: none;
  box-shadow: 0 0 6px currentColor;
}
.chip.draft     { color: var(--faint); }
.chip.triaged   { color: var(--purple-soft); border-color: var(--purple-line); }
.chip.priced    { color: var(--warn); border-color: var(--warn-line); background: var(--warn-dim); }
.chip.funded    { color: var(--purple-soft); border-color: var(--purple-line); background: var(--purple-dim); }
.chip.executing,
.chip.running   { color: var(--ok); border-color: var(--ok-line); background: var(--ok-dim); }
.chip.executing::before,
.chip.running::before { animation: led-pulse 1.6s var(--ease) infinite; }
.chip.queued    { color: var(--muted); }
.chip.review    { color: var(--warn); border-color: var(--warn-line); }
.chip.proved    { color: var(--ok); border-color: var(--ok-line); background: var(--ok-dim); }
.chip.settled   { color: var(--ok); }
.chip.blocked   { color: var(--danger); border-color: var(--danger-line); background: var(--danger-dim); }
.chip.failed,
.chip.rejected,
.chip.cancelled { color: var(--danger); border-color: var(--danger-line); }
.chip.warn      { color: var(--warn); border-color: var(--warn-line); background: var(--warn-dim); }
.chip.plain { text-transform: none; color: var(--muted); background: var(--panel-2); }
.chip.plain::before { content: none; }

@keyframes led-pulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 6px currentColor; }
  50%      { opacity: 0.4; box-shadow: 0 0 2px currentColor; }
}

/* ============================================================================
 * IL BINARIO — the signature. A literal rail the requests ride.
 *
 * Real state, not decoration: each station shows how many requests sit at that
 * stage. Lit where there is work, dim where there is none, and the EXECUTING
 * station pulses when the line is actually moving.
 * ========================================================================== */

.binario-panel > header { border-bottom: none; margin-bottom: 6px; }

.binario {
  list-style: none; margin: 0; padding: 26px 6px 8px;
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
  position: relative;
}
/* the rail itself: one continuous line threaded behind the stations */
.binario::before {
  content: ""; position: absolute;
  left: 7%; right: 7%; top: 40px; height: 2px;
  background: var(--line);
  border-radius: 2px;
}
.station {
  display: flex; flex-direction: column; align-items: center; gap: 9px;
  position: relative; text-align: center; padding: 0 2px;
}
.station .count {
  font-family: var(--mono); font-variant-numeric: tabular-nums;
  font-size: 1.5rem; font-weight: 680; line-height: 1; color: var(--dim);
  letter-spacing: -0.02em;
  transition: color var(--fast) var(--ease);
}
.station .dot {
  width: 15px; height: 15px; border-radius: 50%;
  background: var(--bg); border: 2px solid var(--line);
  position: relative; z-index: 1;
  transition: all var(--fast) var(--ease);
}
.station .name {
  font-family: var(--mono); font-size: 0.6rem; letter-spacing: 0.09em;
  text-transform: uppercase; color: var(--faint); white-space: nowrap;
}
/* a station holding work: lit */
.station.lit .count { color: var(--text); }
.station.lit .dot {
  background: var(--purple); border-color: var(--purple-soft);
  box-shadow: 0 0 0 4px var(--purple-dim), 0 0 12px var(--purple-glow);
}
.station.lit .name { color: var(--muted); }
/* the money gate: funded is where credit is committed — mark it amber */
.station.funded.lit .dot { background: var(--warn); border-color: var(--warn); box-shadow: 0 0 0 4px var(--warn-dim), 0 0 12px var(--warn-line); }
/* the line is moving */
.station.executing.lit .dot {
  background: var(--ok); border-color: var(--ok);
  box-shadow: 0 0 0 4px var(--ok-dim), 0 0 14px var(--ok-line);
  animation: station-pulse 1.8s var(--ease) infinite;
}
.station.settled.lit .dot { background: var(--ok); border-color: var(--ok); box-shadow: 0 0 0 4px var(--ok-dim); }

@keyframes station-pulse {
  0%, 100% { box-shadow: 0 0 0 4px var(--ok-dim), 0 0 14px var(--ok-line); }
  50%      { box-shadow: 0 0 0 7px var(--ok-dim), 0 0 20px var(--ok-line); }
}

/* the siding: blocked / rejected sit off the happy path */
.siding {
  display: flex; gap: 10px; flex-wrap: wrap; align-items: center;
  margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line-soft);
}
.siding .lead {
  font-family: var(--mono); font-size: 0.62rem; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--faint);
}

/* ============================================================================
 * ROWS — the workhorse list
 * ========================================================================== */

.rows { display: flex; flex-direction: column; }
.row {
  display: flex; align-items: center; gap: 13px;
  padding: 12px 6px;
  border-top: 1px solid var(--line-soft);
}
.rows > .row:first-child { border-top: none; }
.row .grow { flex: 1; min-width: 0; }
.row .title { font-weight: 560; display: block; letter-spacing: -0.005em; }
.row .title a { color: var(--text); }
.row .title a:hover { color: var(--purple-soft); }
.row .meta {
  color: var(--faint); font-size: 0.76rem; font-family: var(--mono);
  letter-spacing: 0.01em;
}
.row .reason { color: var(--warn); font-size: 0.79rem; margin-top: 2px; }
.row.clickable { border-radius: var(--radius-xs); transition: background var(--fast) var(--ease); }
.row.clickable:hover { background: var(--panel-2); }

/* a live row: a pulsing rail down its left edge while work runs */
.row.live { padding-left: 14px; }
.row.live::before {
  content: ""; position: absolute; left: 0; top: 8px; bottom: 8px;
  width: 3px; border-radius: 3px; background: var(--ok);
  box-shadow: 0 0 8px var(--ok-line);
  animation: led-pulse 1.6s var(--ease) infinite;
}
.rows { position: relative; }
.row { position: relative; }

.empty {
  color: var(--faint); font-size: 0.85rem; padding: 18px 4px;
  border: 1px dashed var(--line-soft); border-radius: var(--radius-sm);
  text-align: center; margin: 4px 0;
}
.credits {
  font-family: var(--mono); font-size: 0.83rem; color: var(--purple-soft);
  font-variant-numeric: tabular-nums;
}

/* ============================================================================
 * BUTTONS
 * ========================================================================== */

.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 15px; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: var(--panel-2); color: var(--text);
  font: inherit; font-size: 0.83rem; font-weight: 560; cursor: pointer;
  transition: border-color var(--fast) var(--ease), background var(--fast) var(--ease), transform var(--fast) var(--ease);
}
.btn:hover { border-color: var(--purple); background: var(--panel-3); }
.btn:active { transform: translateY(1px); }
.btn.primary {
  background: linear-gradient(150deg, var(--purple), var(--purple-deep));
  border-color: transparent; color: #fff;
  box-shadow: 0 1px 0 rgba(255,255,255,0.12) inset, 0 6px 16px -8px var(--purple-glow);
}
.btn.primary:hover { filter: brightness(1.08); border-color: transparent; }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--danger); }
.btn.danger:hover { border-color: var(--danger); background: var(--danger-dim); }
.btn.small { padding: 5px 10px; font-size: 0.74rem; }
.btn[disabled] { opacity: 0.4; cursor: not-allowed; }
.btn[disabled]:hover { border-color: var(--line); background: var(--panel-2); }

.actions { display: flex; gap: 9px; flex-wrap: wrap; align-items: center; }
.actions form { display: inline; }

.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.filters a { color: var(--muted); border-radius: var(--radius-xs); }
.filters a.on .chip { border-color: var(--purple); color: #fff; background: var(--purple-dim); }
.filters a:hover .chip { border-color: var(--purple-line); }

/* ============================================================================
 * SUBNAV — the Partner Console tab rail (was unstyled)
 * ========================================================================== */

.subnav {
  display: flex; gap: 2px; flex-wrap: wrap;
  padding: 4px; margin-bottom: 4px;
  background: var(--ink); border: 1px solid var(--line);
  border-radius: var(--radius-sm); width: fit-content;
}
.subnav a {
  padding: 7px 15px; border-radius: var(--radius-xs);
  font-family: var(--mono); font-size: 0.72rem; font-weight: 560;
  letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--muted);
  transition: background var(--fast) var(--ease), color var(--fast) var(--ease);
}
.subnav a:hover { background: var(--panel); color: var(--text); }
.subnav a.active {
  background: var(--purple-dim); color: #fff;
  box-shadow: inset 0 0 0 1px var(--purple-line);
}

/* ============================================================================
 * TABLE — ops ledger.  (.table was undefined; the books & console needed it.)
 * ========================================================================== */

.table {
  width: 100%; border-collapse: collapse;
  font-size: 0.85rem;
}
.table thead th {
  font-family: var(--mono); font-size: 0.62rem; font-weight: 600;
  letter-spacing: 0.11em; text-transform: uppercase; color: var(--faint);
  text-align: left; padding: 0 12px 10px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.table tbody td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line-soft);
  color: var(--text); vertical-align: middle;
}
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover td { background: var(--panel-2); }
.table td .meta {
  display: block; font-family: var(--mono); font-size: 0.7rem; color: var(--faint);
}
/* numbers align right and read as mono telemetry */
.table th:not(:first-child),
.table td:not(:first-child) { text-align: right; font-variant-numeric: tabular-nums; }
.table td:not(:first-child):not(:has(*)) { font-family: var(--mono); }
.table tbody tr:last-child td strong { color: var(--text); }
.table-wrap { overflow-x: auto; margin: 2px -4px -4px; padding: 0 4px 4px; }

/* ============================================================================
 * FORMS
 * ========================================================================== */

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 15px; }
.field label { font-family: var(--mono); font-size: 0.68rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.field label .faint { text-transform: none; letter-spacing: 0; font-size: 0.85em; }
input[type="text"], input[type="email"], input[type="password"], input[type="number"], textarea, select {
  background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius-sm);
  color: var(--text); padding: 10px 12px; font: inherit; width: 100%;
  transition: border-color var(--fast) var(--ease), box-shadow var(--fast) var(--ease);
}
input::placeholder, textarea::placeholder { color: var(--dim); }
input:focus, textarea:focus, select:focus {
  outline: none; border-color: var(--purple); box-shadow: 0 0 0 3px var(--purple-dim);
}
.inline-form { display: flex; gap: 8px; align-items: center; }
.inline-form input[type="text"] { width: auto; flex: 1; min-width: 160px; }

/* ============================================================================
 * FLASHES  (structure kept: .flash.<category>)
 * ========================================================================== */

.flashes { display: flex; flex-direction: column; gap: 8px; }
.flash {
  border: 1px solid var(--line); border-left-width: 3px;
  border-radius: var(--radius-sm); padding: 11px 15px; font-size: 0.86rem;
  background: var(--panel);
}
.flash.ok    { border-left-color: var(--ok); background: var(--ok-dim); }
.flash.error { border-left-color: var(--danger); background: var(--danger-dim); }
.flash.info  { border-left-color: var(--purple); background: var(--purple-dim); }

/* ============================================================================
 * LOGIN — the way in.  A single lit panel on the dark floor.
 * ========================================================================== */

.login-page { display: grid; place-items: center; min-height: 100vh; padding: 24px; position: relative; z-index: 1; }
.login-card {
  width: min(400px, 100%);
  border-color: var(--line);
  box-shadow: 0 30px 80px -40px #000, 0 0 0 1px var(--line);
}
.login-card > .brand { justify-content: center; margin-bottom: 18px; padding: 0; }
.login-card h1 { text-align: center; font-size: 1.2rem; margin-bottom: 5px; }
.login-card .lede { text-align: center; color: var(--muted); font-size: 0.85rem; margin-bottom: 22px; }
.login-card .btn { width: 100%; justify-content: center; margin-top: 4px; }

/* ============================================================================
 * TIMELINE — the event outbox, read top-down
 * ========================================================================== */

.timeline { display: flex; flex-direction: column; position: relative; padding-left: 6px; }
.timeline .ev {
  display: flex; gap: 11px; padding: 8px 0 8px 16px;
  border-left: 1px solid var(--line); position: relative;
}
.timeline .ev::before {
  content: ""; position: absolute; left: -4px; top: 14px;
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--panel-3); border: 1px solid var(--line);
}
.timeline .ev:first-child::before { background: var(--purple); border-color: var(--purple-soft); box-shadow: 0 0 8px var(--purple-glow); }
.timeline .ev .name { font-family: var(--mono); font-size: 0.78rem; color: var(--purple-soft); }
.timeline .ev .when { margin-left: auto; color: var(--faint); font-size: 0.72rem; font-family: var(--mono); white-space: nowrap; }

/* ============================================================================
 * DEFINITION LIST — a spec sheet
 * ========================================================================== */

.definition { display: grid; grid-template-columns: 150px 1fr; gap: 9px 16px; font-size: 0.86rem; margin: 0; }
.definition dt { font-family: var(--mono); font-size: 0.68rem; letter-spacing: 0.05em; text-transform: uppercase; color: var(--faint); padding-top: 2px; }
.definition dd { margin: 0; color: var(--text); }

.placeholder-note {
  border: 1px dashed var(--line); border-radius: var(--radius);
  padding: 40px 26px; text-align: center; color: var(--muted); background: var(--panel);
}
.placeholder-note .big { font-size: 2rem; display: block; margin-bottom: 10px; }

/* ============================================================================
 * CLIENT HOME — the customer's shell.  Warmer, simpler, brand-first.
 *
 * Same tokens, same primitives, but the grid recedes and the panels breathe:
 * a business owner is not an operator, and the page should feel like a calm
 * status board, not a cockpit.
 * ========================================================================== */

body.client {
  /* softer world: drop the instrument grid, keep one gentle purple wash */
  background-image: radial-gradient(1000px 560px at 82% -12%, rgba(115, 103, 240, 0.14), transparent 62%);
  background-color: var(--bg);
}
body.client::before { display: none; }

.client-shell { max-width: 1120px; margin: 0 auto; padding: 0 24px; min-height: 100vh;
                display: flex; flex-direction: column; position: relative; z-index: 1; }

.client-top {
  display: flex; align-items: center; gap: 16px;
  padding: 26px 4px 20px; border-bottom: 1px solid var(--line);
}
.client-top .spacer { flex: 1; }
.client-top .who { text-align: right; font-size: 0.82rem; line-height: 1.35; color: var(--muted); }
.client-top .who span { color: var(--faint); display: block; font-family: var(--mono); font-size: 0.66rem; letter-spacing: 0.05em; }
.client-top .brand-name { font-family: var(--sans); font-style: normal; font-weight: 660; font-size: 1.1rem; }
.client-top .brand-sub { font-family: var(--sans); font-size: 0.74rem; letter-spacing: 0; text-transform: none; color: var(--faint); }
.brand-logo { height: 36px; max-width: 200px; object-fit: contain; }

.client-content { padding: 26px 0 44px; display: flex; flex-direction: column; gap: var(--gap); }
.client-foot { padding: 20px 4px 30px; border-top: 1px solid var(--line-soft); text-align: center; }
.client-foot .faint { font-family: var(--mono); font-size: 0.66rem; letter-spacing: 0.08em; text-transform: uppercase; }

/* the client home leans on softer, larger panels */
.client-content .card { padding: 20px 22px; }
.client-content .kpi .value { font-size: 2rem; }

.ask textarea { resize: vertical; min-height: 100px; }

.feed { display: flex; flex-direction: column; gap: 12px; }
.proof {
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 14px 16px; background: var(--panel-2);
  border-left: 3px solid var(--ok);
}
.proof-head { display: flex; align-items: center; gap: 10px; }
.proof-head .title { font-weight: 580; }
.proof .meta { color: var(--faint); font-size: 0.77rem; margin-top: 3px; font-family: var(--mono); }
.proof-list { list-style: none; margin: 12px 0 0; padding: 12px 0 0; border-top: 1px solid var(--line-soft);
              display: flex; flex-direction: column; gap: 8px; font-size: 0.83rem; }
.proof-list li { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.proof-list .mono { color: var(--muted); word-break: break-all; }

/* ============================================================================
 * ONBOARDING WIZARD
 * ========================================================================== */

.wizard-steps { list-style: none; display: flex; gap: 8px; padding: 0; margin: 0 0 8px; flex-wrap: wrap; }
.wizard-steps li {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 14px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  color: var(--faint); font-size: 0.8rem; background: var(--panel);
  font-family: var(--mono); letter-spacing: 0.03em;
}
.wizard-steps .num {
  width: 21px; height: 21px; border-radius: 5px; display: grid; place-items: center;
  background: var(--panel-2); color: var(--muted); font-size: 0.72rem; font-weight: 700;
}
.wizard-steps li.done { color: var(--muted); }
.wizard-steps li.done .num { background: var(--ok-dim); color: var(--ok); }
.wizard-steps li.on { color: var(--text); border-color: var(--purple-line); background: var(--purple-dim); }
.wizard-steps li.on .num { background: var(--purple); color: #fff; }

.presets { display: flex; flex-direction: column; gap: 9px; margin-bottom: 16px; }
.preset {
  display: flex; flex-direction: column; gap: 3px; position: relative;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 12px 15px; cursor: pointer; background: var(--panel-2);
  transition: border-color var(--fast) var(--ease), background var(--fast) var(--ease);
}
.preset:hover { border-color: var(--purple-line); }
.preset:has(input:checked) { border-color: var(--purple); background: var(--purple-dim); }
.preset input { position: absolute; opacity: 0; pointer-events: none; }
.preset-head { display: flex; align-items: center; gap: 9px; }
.preset-head strong { font-weight: 600; }

.inline-check { display: flex; align-items: center; gap: 9px; font-size: 0.86rem; color: var(--muted); margin-bottom: 16px; }
.inline-check input { width: auto; }

.invite-link {
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--ink); padding: 12px 14px; margin-bottom: 14px;
  word-break: break-all; user-select: all; color: var(--purple-soft);
  font-family: var(--mono); font-size: 0.8rem;
}

/* ============================================================================
 * MARKETING CALENDAR  (.week / .piece kept — tests assert on them)
 * ========================================================================== */

.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; }
.week .day {
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 10px 11px; min-height: 116px; background: var(--panel-2);
  display: flex; flex-direction: column; gap: 8px;
}
.week .day.today { border-color: var(--purple-line); background: var(--purple-dim); }
.week .day-label { font-family: var(--mono); font-size: 0.66rem; color: var(--faint); text-transform: uppercase; letter-spacing: 0.08em; }
.week .day.today .day-label { color: var(--purple-soft); }
.week .piece { border-left: 2px solid var(--purple); padding-left: 8px; }
.week .piece-title { font-size: 0.8rem; font-weight: 550; line-height: 1.3; }
@media (max-width: 900px) { .week { grid-template-columns: repeat(2, 1fr); } }

/* lowercase content-status chips */
.chip.draft, .chip.review, .chip.approved, .chip.scheduled, .chip.published, .chip.failed { text-transform: uppercase; }
.chip.approved  { color: var(--ok); border-color: var(--ok-line); }
.chip.scheduled { color: var(--purple-soft); border-color: var(--purple-line); }
.chip.published { color: var(--ok); background: var(--ok-dim); border-color: var(--ok-line); }

/* ============================================================================
 * RESPONSIVE — collapse the shell to a top rail on small screens
 * ========================================================================== */

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar {
    position: static; height: auto; flex-direction: row; align-items: center;
    gap: 4px; overflow-x: auto; padding: 12px;
    border-right: none; border-bottom: 1px solid var(--line);
  }
  .brand { padding: 0 8px 0 4px; flex: none; }
  .brand-sub, .sidebar-foot { display: none; }
  .nav { flex-direction: row; gap: 2px; }
  .nav a { padding: 8px 10px; white-space: nowrap; }
  .nav a .soon { display: none; }
  .nav a.active::before { top: auto; bottom: 0; left: 8px; right: 8px; width: auto; height: 3px; border-radius: 3px 3px 0 0; }
  .content, .topbar { padding-left: 18px; padding-right: 18px; }
  .binario { grid-auto-flow: row; grid-template-columns: repeat(2, 1fr); grid-auto-columns: auto; gap: 20px 10px; padding-top: 8px; }
  .binario::before { display: none; }
  .station { flex-direction: row; justify-content: flex-start; gap: 12px; text-align: left; }
}

@media (max-width: 520px) {
  .topbar { flex-wrap: wrap; gap: 10px; }
  .topbar .who { text-align: left; }
  .binario { grid-template-columns: 1fr; }
  .client-top { flex-wrap: wrap; }
  .client-top .who { text-align: left; }
  .definition { grid-template-columns: 1fr; gap: 2px 0; }
  .definition dd { margin-bottom: 8px; }
}

/* ============================================================================
 * MOTION — respect the people who asked for less of it
 * ========================================================================== */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}
