/* Internal tools: staff outcome screen, dashboard, message outbox.
   A different register to the customer site on purpose — this is instrumentation,
   read at a glance by someone standing up in a mall, not a page to be admired.
   High contrast, tabular numbers, tap targets sized for a thumb. */

:root {
  --ground: #F4F5F7;
  --surface: #FFFFFF;
  --surface-2: #ECEEF1;
  --ink: #0D1117;
  --ink-2: #414B58;
  --ink-3: #6C7684;
  --rule: #D7DBE0;
  --rule-2: #E7EAEE;
  --action: #91268F;
  --action-ink: #FFFFFF;
  --good: #0B6B45;
  --good-bg: #E2F2EA;
  --bad: #A32217;
  --bad-bg: #FBE9E7;
  --warn: #8A5A00;
  --warn-bg: #FBF0DC;
  --idle: #4C5563;
  --idle-bg: #EDEFF2;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI Variable Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: "Cascadia Mono", Consolas, ui-monospace, Menlo, monospace;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ground: #0B0E13;
    --surface: #151A21;
    --surface-2: #1D242D;
    --ink: #E7EBF0;
    --ink-2: #B3BCC8;
    --ink-3: #7E8896;
    --rule: #2A323C;
    --rule-2: #202730;
    --action: #C86FC6;
    --action-ink: #17101A;
    --good: #4EC08C;
    --good-bg: #0E3527;
    --bad: #F0857A;
    --bad-bg: #3A1714;
    --warn: #E0B052;
    --warn-bg: #362A10;
    --idle: #97A1AF;
    --idle-bg: #222932;
  }
}

:root[data-theme="dark"] {
  --ground: #0B0E13;
  --surface: #151A21;
  --surface-2: #1D242D;
  --ink: #E7EBF0;
  --ink-2: #B3BCC8;
  --ink-3: #7E8896;
  --rule: #2A323C;
  --rule-2: #202730;
  --action: #C86FC6;
  --action-ink: #17101A;
  --good: #4EC08C;
  --good-bg: #0E3527;
  --bad: #F0857A;
  --bad-bg: #3A1714;
  --warn: #E0B052;
  --warn-bg: #362A10;
  --idle: #97A1AF;
  --idle-bg: #222932;
}

* { box-sizing: border-box; }

body {
  margin: 0; background: var(--ground); color: var(--ink);
  font-family: var(--sans); font-size: 16px; line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.shell { max-width: 78rem; margin: 0 auto; padding: 0 1.25rem 5rem; }
.shell.narrow { max-width: 34rem; }

.bar {
  position: sticky; top: 0; z-index: 10;
  background: var(--surface); border-bottom: 1px solid var(--rule);
  padding: .9rem 1.25rem; margin: 0 -1.25rem 1.25rem;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
}
.bar h1 { font-size: 1.05rem; font-weight: 700; margin: 0; letter-spacing: -.01em; }
.bar .brand { display: flex; align-items: center; gap: .7rem; }
.bar .brand img { height: 22px; width: auto; display: block; flex-shrink: 0; }
.bar .brand .divider { width: 1px; height: 24px; background: var(--rule); flex-shrink: 0; }
@media (max-width: 560px) { .bar .brand img { height: 18px; } }
.bar .sub { font: .75rem/1.3 var(--mono); color: var(--ink-3); margin: .15rem 0 0; }
.bar nav { display: flex; gap: .5rem; flex-wrap: wrap; }
.whoami { display: flex; align-items: center; gap: .6rem; font-size: .78rem; color: var(--ink-3); }
.whoami .who-name { color: var(--ink); font-weight: 600; }
.whoami .who-role { font-family: var(--mono); font-size: .68rem; letter-spacing: .06em; text-transform: uppercase; background: var(--surface-2); border: 1px solid var(--rule); border-radius: 2px; padding: .08em .4em; }
.whoami a { color: var(--action); text-decoration: none; }
@media (max-width: 720px) { .whoami { width: 100%; justify-content: flex-start; } }
.bar nav a {
  font-size: .82rem; text-decoration: none; color: var(--ink-2);
  padding: .35rem .7rem; border: 1px solid var(--rule); border-radius: 2px;
}
.bar nav a.on { background: var(--ink); color: var(--ground); border-color: var(--ink); }

h2 { font-size: 1rem; font-weight: 700; margin: 2rem 0 .85rem; letter-spacing: -.005em; }
h2:first-child { margin-top: 0; }
.hint { font-size: .82rem; color: var(--ink-3); margin: .3rem 0 0; }

/* --- KPI tiles --- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); gap: .75rem; }
.kpi { background: var(--surface); border: 1px solid var(--rule); border-radius: 3px; padding: 1.1rem; }
.kpi .label { font: 600 .68rem/1.3 var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); }
.kpi .value {
  font-family: var(--mono); font-size: 2.1rem; font-weight: 700; line-height: 1.1;
  margin: .5rem 0 .2rem; font-variant-numeric: tabular-nums; letter-spacing: -.02em;
}
.kpi .value.na { color: var(--ink-3); font-size: 1.5rem; }
.kpi .foot { font-size: .78rem; color: var(--ink-3); }
.kpi.flag { border-color: var(--warn); background: var(--warn-bg); }
.kpi.flag .value { color: var(--warn); }

/* --- tables --- */
.tablewrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--rule); border-radius: 3px; }
table { width: 100%; border-collapse: collapse; font-size: .875rem; min-width: 32rem; }
th {
  text-align: left; font: 600 .68rem/1.3 var(--mono); letter-spacing: .09em;
  text-transform: uppercase; color: var(--ink-3);
  padding: .7rem .85rem; border-bottom: 1px solid var(--rule); white-space: nowrap;
}
td { padding: .7rem .85rem; border-bottom: 1px solid var(--rule-2); vertical-align: top; color: var(--ink-2); }
td:first-child { color: var(--ink); font-weight: 600; }
tbody tr:last-child td { border-bottom: none; }
td.num, th.num { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* --- pills --- */
.pill {
  display: inline-block; font: 600 .7rem/1.5 var(--mono); letter-spacing: .04em;
  padding: .1rem .5rem; border-radius: 2px; white-space: nowrap;
}
.pill.good { background: var(--good-bg); color: var(--good); }
.pill.bad { background: var(--bad-bg); color: var(--bad); }
.pill.warn { background: var(--warn-bg); color: var(--warn); }
.pill.idle { background: var(--idle-bg); color: var(--idle); }

/* --- staff outcome screen --- */
.appt {
  background: var(--surface); border: 1px solid var(--rule); border-radius: 4px;
  padding: 1rem 1.1rem; margin-bottom: .85rem;
}
.appt.done { opacity: .62; }
.appt-head { display: flex; align-items: baseline; justify-content: space-between; gap: .75rem; margin-bottom: .2rem; }
.appt .time { font-family: var(--mono); font-size: 1.15rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.appt .who { font-size: 1.05rem; font-weight: 650; margin: .35rem 0 .1rem; }
.appt .meta { font: .78rem/1.5 var(--mono); color: var(--ink-3); }
.appt .meta a { color: var(--action); text-decoration: none; }

.taps { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; margin-top: .9rem; }
.tap {
  display: block; width: 100%; cursor: pointer; text-align: center;
  border-radius: 4px; padding: 1.05rem .75rem;
  font: 700 1rem/1.2 var(--sans); border: 2px solid;
  background: var(--surface); transition: filter .12s ease;
}
.tap:active { filter: brightness(.94); }
.tap.arrived { border-color: var(--good); color: var(--good); }
.tap.noshow { border-color: var(--bad); color: var(--bad); }
.tap.bought { border-color: var(--good); background: var(--good); color: var(--surface); }
.tap.notyet { border-color: var(--rule); color: var(--ink-2); }
.tap.wide { grid-column: 1 / -1; }

.blockers { display: flex; flex-wrap: wrap; gap: .5rem; margin: .85rem 0 0; }
.blocker {
  cursor: pointer; border: 1px solid var(--rule); background: var(--surface);
  border-radius: 2px; padding: .6rem .85rem; font: 600 .85rem/1 var(--sans); color: var(--ink-2);
}
.blocker.sel { border-color: var(--action); border-width: 2px; color: var(--action); padding: calc(.6rem - 1px) calc(.85rem - 1px); }

.sale { margin-top: .9rem; display: grid; gap: .6rem; }
.sale select, .sale input {
  width: 100%; padding: .8rem; font: 1rem var(--sans);
  border: 1px solid var(--rule); border-radius: 3px;
  background: var(--surface); color: var(--ink);
}
.hidden { display: none; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  background: var(--action); color: var(--action-ink); border: none; border-radius: 3px;
  cursor: pointer; font: 600 .95rem/1 var(--sans); padding: .85rem 1.25rem; text-decoration: none;
}
.btn.ghost { background: transparent; color: var(--ink); border: 1px solid var(--rule); }
.btn.block { width: 100%; }

.empty {
  background: var(--surface); border: 1px dashed var(--rule); border-radius: 4px;
  padding: 2rem 1.25rem; text-align: center; color: var(--ink-3); font-size: .92rem;
}

.nag {
  background: var(--warn-bg); border: 1px solid var(--warn); border-radius: 3px;
  padding: .9rem 1.1rem; margin-bottom: 1.25rem; font-size: .88rem; color: var(--ink);
}
.nag strong { color: var(--warn); }

/* --- outbox --- */
.msg { background: var(--surface); border: 1px solid var(--rule); border-radius: 3px; margin-bottom: .75rem; }
.msg-head {
  display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem;
  padding: .65rem .9rem; border-bottom: 1px solid var(--rule-2);
  font: .75rem/1.4 var(--mono); color: var(--ink-3);
}
.msg-body {
  padding: .9rem; font-size: .88rem; line-height: 1.55; white-space: pre-wrap;
  color: var(--ink); font-family: var(--sans);
}
.cost { font-family: var(--mono); font-variant-numeric: tabular-nums; }

.banner {
  background: var(--surface-2); border: 1px solid var(--rule); border-left: 3px solid var(--action);
  padding: .9rem 1.1rem; margin-bottom: 1.5rem; font-size: .88rem; color: var(--ink-2);
}
.banner strong { color: var(--ink); }

.toast {
  position: fixed; left: 50%; bottom: 1.5rem; transform: translateX(-50%);
  background: var(--ink); color: var(--ground); padding: .75rem 1.25rem;
  border-radius: 3px; font-size: .88rem; font-weight: 600; z-index: 50;
  box-shadow: 0 6px 20px -6px rgba(0,0,0,.4);
}

a { color: var(--action); }
:focus-visible { outline: 2px solid var(--action); outline-offset: 2px; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
@media (max-width: 560px) {
  .shell { padding: 0 .85rem 4rem; }
  .bar { margin: 0 -.85rem 1rem; padding: .8rem .85rem; }
  .taps { grid-template-columns: 1fr; }
  .kpi .value { font-size: 1.8rem; }
}

/* Seeded-data warning. Deliberately the loudest thing on the page: invented
   numbers that look real get quoted in meetings as if they were measurements. */
.demo-warn {
  background: var(--bad-bg);
  border: 1px solid var(--bad);
  border-left: 4px solid var(--bad);
  border-radius: 3px;
  padding: .9rem 1.1rem;
  margin-bottom: 1.25rem;
  font-size: .85rem;
  line-height: 1.55;
  color: var(--ink);
}
.demo-warn strong { color: var(--bad); }
.demo-warn code {
  font-family: var(--mono); font-size: .82em;
  background: var(--surface); border: 1px solid var(--rule);
  border-radius: 2px; padding: .05em .35em;
}

/* --- demographic breakdowns -------------------------------------------------
   Four small tables. auto-fit rather than a fixed column count, so they sit
   two-up on a laptop and stack on a phone without a media query. Each keeps
   its own horizontal scroll: six columns of figures do not fit a phone, and a
   table that overflows its own box is better than a page that scrolls sideways.
*/
.demo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(24rem, 1fr));
  gap: 1.5rem 2rem;
  margin-top: 1rem;
}
.demo-dim { min-width: 0; overflow-x: auto; }
.demo-dim h3 {
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .09em;
  color: var(--ink-3);
  margin: 0 0 .5rem;
}
.demo-dim table { min-width: 22rem; font-size: .84rem; }
.demo-dim td, .demo-dim th { padding: .45rem .55rem; }

/* --- messages and forms -----------------------------------------------------
   .saved, .error and .field were already used by several screens but had never
   been defined, so those screens were rendering them unstyled. Defining them
   here fixes those pages as well as the campaigns one.
*/
.saved, .error {
  padding: .7rem .9rem;
  border-radius: 3px;
  border-left: 3px solid;
  margin: 0 0 1.25rem;
  font-size: .9rem;
}
.saved { border-left-color: var(--good); background: var(--surface); color: var(--ink); }
.error { border-left-color: var(--bad); background: var(--surface); color: var(--ink); }

.field, .stack-form label {
  display: block;
  margin-bottom: 1rem;
}
.field > span, .stack-form label > span {
  display: block;
  font-size: .82rem;
  font-weight: 600;
  color: var(--ink-2);
  margin-bottom: .3rem;
}
.stack-form input[type="text"], .stack-form select {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

/* A form living inside a table cell: keep it on one line and stop the input
   from stretching the column. */
.inline-form { display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; }
.inline-form input[type="text"] {
  font-family: var(--mono);
  font-size: .8rem;
  min-width: 9rem;
  max-width: 13rem;
}

.notes-list { margin: .5rem 0 0; padding-left: 1.2rem; font-size: .9rem; color: var(--ink-2); }
.notes-list li { margin-bottom: .4rem; }

/* What was booked, on the staff card. It decides what gets wheeled into the
   room, so it reads before the name rather than after it. */
.appt .session {
  margin: .35rem 0 0;
  font-size: .78rem;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--brand);
}

/* The mark is the way back. Every screen has the nav too, but a logo that does
   nothing when clicked is a dead end people find by instinct first. */
.brand-home { display: inline-flex; text-decoration: none; border-radius: 3px; }
.brand-home:focus-visible { outline: 2px solid var(--brand); outline-offset: 3px; }

/* Customers: search, and one person's journey and details. */
.cust-search { display: grid; gap: .35rem; margin: 1.1rem 0 .5rem; }
.cust-search label { font-weight: 600; }
.cust-search input { width: 100%; min-height: 3rem; font-size: 1.05rem; padding: .6rem .85rem; border: 1px solid var(--rule); border-radius: 8px; background: var(--surface); color: var(--ink); }
.cust-list { display: grid; gap: .4rem; margin-top: .6rem; }
.cust-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 1rem; align-items: center; padding: .7rem .9rem; background: var(--surface); border: 1px solid var(--rule); border-radius: 8px; color: var(--ink); text-decoration: none; }
.cust-row:hover { border-color: var(--action); }
.cust-name { font-weight: 600; min-width: 0; overflow-wrap: anywhere; }
.cust-name small { display: block; font-weight: 400; font-size: .82rem; color: var(--ink-3); }
.cust-last { font-size: .82rem; color: var(--ink-3); white-space: nowrap; }
.cust-back { margin: .9rem 0 .4rem; font-size: .9rem; }
.cust-back a { color: var(--action); }
.cust-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .6rem 1rem; align-items: center; background: var(--surface); border: 1px solid var(--rule); border-radius: 10px; padding: 1rem 1.15rem; margin-bottom: .9rem; }
.cust-head h2 { margin: 0; font-size: 1.5rem; overflow-wrap: anywhere; }
.cust-head p { margin: .15rem 0 0; color: var(--ink-2); overflow-wrap: anywhere; }
.cust-track { grid-column: 1 / -1; list-style: none; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .3rem; margin: .3rem 0 0; padding: 0; font-size: .8rem; color: var(--ink-3); }
.cust-track li { border-top: 4px solid var(--rule); padding-top: .3rem; }
.cust-track li.done { border-top-color: var(--action); color: var(--ink-2); }
.cust-track li.now { font-weight: 700; color: var(--ink); }
.cust-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: .9rem; align-items: start; }
.cust-side { display: grid; gap: .9rem; min-width: 0; }
.cust-card { background: var(--surface); border: 1px solid var(--rule); border-radius: 10px; padding: 1rem 1.15rem; min-width: 0; }
.cust-card h2 { margin: 0 0 .55rem; font-size: 1rem; }
.cust-facts { display: grid; grid-template-columns: 8.5rem minmax(0, 1fr); gap: .3rem .75rem; margin: 0; font-size: .9rem; }
.cust-facts dt { color: var(--ink-3); }
.cust-facts dd { margin: 0; overflow-wrap: anywhere; }
.cust-facts code { font-family: var(--mono); font-size: .76rem; }
.cust-note { margin: .7rem 0 0; font-size: .9rem; background: var(--surface-2); border-radius: 6px; padding: .55rem .7rem; }
.cust-note b { display: block; font-size: .78rem; color: var(--ink-3); }
.cust-list-plain { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; font-size: .9rem; }
.cust-list-plain li { display: flex; justify-content: space-between; gap: .75rem; align-items: center; }
.cust-list-plain small { display: block; font-size: .78rem; color: var(--ink-3); }
.cust-journey { list-style: none; margin: .7rem 0 0; padding: 0; display: grid; gap: .55rem; }
.cust-journey li { display: grid; grid-template-columns: 5.6rem minmax(0, 1fr); gap: .75rem; align-items: start; font-size: .92rem; }
.cust-day { display: block !important; font-weight: 700; font-size: .84rem !important; color: var(--ink-2); border-bottom: 1px solid var(--rule-2); padding-bottom: .2rem; margin-top: .6rem; }
.cust-day:first-child { margin-top: 0; }
.cust-kind { font-size: .68rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--idle); background: var(--idle-bg); border-radius: 999px; padding: .22rem .5rem; justify-self: start; white-space: nowrap; }
.k-ad .cust-kind, .k-event .cust-kind { color: var(--action); background: var(--surface-2); }
.k-purchase .cust-kind, .k-warranty .cust-kind, .k-consent .cust-kind { color: var(--good); background: var(--good-bg); }
.k-callback .cust-kind { color: var(--warn); background: var(--warn-bg); }
.cust-journey b { display: block; font-weight: 600; }
.cust-journey span:not(.cust-kind) { display: block; color: var(--ink-2); }
.cust-journey small { display: block; color: var(--ink-3); font-size: .78rem; }
@media (max-width: 860px) { .cust-grid { grid-template-columns: minmax(0, 1fr); } .cust-row { grid-template-columns: minmax(0, 1fr) auto; } .cust-last { display: none; } }

/* --- App frame (redesign, 25 Nov 2026): left sidebar, page head, pill sub-tabs.
   On a phone the sidebar becomes a row across the top that scrolls sideways. --- */
.app { display: grid; grid-template-columns: 13.5rem minmax(0, 1fr); min-height: 100vh; }
.side {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  display: flex; flex-direction: column; gap: 1.1rem;
  background: var(--surface); border-right: 1px solid var(--rule); padding: 1.1rem .8rem 1rem;
}
.side .brand-home { padding: .2rem .5rem; }
.side .brand-home img { height: 24px; width: auto; display: block; }
.side-nav { display: flex; flex-direction: column; gap: .15rem; }
.side-nav a {
  display: flex; align-items: center; justify-content: space-between; gap: .5rem;
  padding: .55rem .7rem; border-radius: 8px; text-decoration: none;
  color: var(--ink-2); font-weight: 600; font-size: .92rem;
}
.side-nav a:hover { background: var(--surface-2); color: var(--ink); }
.side-nav a.on { background: var(--action); color: var(--action-ink); }
.side-nav a.side-settings { margin-top: .9rem; }
.side .whoami { margin-top: auto; flex-wrap: wrap; padding: .6rem .5rem 0; border-top: 1px solid var(--rule-2); width: auto; }
.badge {
  display: inline-flex; align-items: center; justify-content: center; min-width: 1.25rem; height: 1.25rem;
  padding: 0 .35rem; border-radius: 999px; background: var(--bad); color: #fff;
  font: 700 .68rem/1 var(--sans); font-variant-numeric: tabular-nums;
}
.side-nav a.on .badge { background: var(--action-ink); color: var(--action); }
.main { max-width: 84rem; width: 100%; margin: 0; padding: 0 1.75rem 5rem; }
.page-head { padding: 1.5rem 0 1rem; margin-bottom: 1rem; border-bottom: 1px solid var(--rule-2); }
.page-head h1 { font-size: 1.55rem; font-weight: 700; letter-spacing: -.015em; margin: 0; }
.page-head .purpose { margin: .25rem 0 0; color: var(--ink-2); font-size: .95rem; }
.subtabs {
  display: inline-flex; flex-wrap: wrap; gap: .25rem; margin-top: .9rem; padding: .25rem;
  background: var(--surface-2); border: 1px solid var(--rule); border-radius: 999px; max-width: 100%;
}
.subtabs a {
  display: inline-flex; align-items: center; gap: .4rem; padding: .42rem .95rem; border-radius: 999px;
  text-decoration: none; color: var(--ink-2); font-size: .86rem; font-weight: 600; white-space: nowrap;
}
.subtabs a:hover { color: var(--ink); background: var(--surface); }
.subtabs a.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.12); }
@media (max-width: 860px) {
  .app { display: block; }
  .side {
    position: sticky; top: 0; z-index: 20; height: auto; flex-direction: row; align-items: center;
    gap: .5rem; padding: .55rem 1rem; border-right: 0; border-bottom: 1px solid var(--rule);
    overflow-x: auto; overflow-y: hidden; -webkit-overflow-scrolling: touch;
  }
  .side .brand-home { flex-shrink: 0; padding: 0 .3rem 0 0; }
  .side .brand-home img { height: 18px; }
  .side-nav { flex-direction: row; gap: .25rem; flex-shrink: 0; }
  .side-nav a { padding: .45rem .75rem; white-space: nowrap; font-size: .86rem; }
  .side-nav a.side-settings { margin-top: 0; }
  .side .whoami { margin: 0; padding: 0 0 0 .4rem; border: 0; flex-wrap: nowrap; flex-shrink: 0; white-space: nowrap; }
  .side .whoami .who-name, .side .whoami .who-role { display: none; }
  .main { padding: 0 1rem 4rem; }
  .page-head { padding-top: 1rem; }
  .page-head h1 { font-size: 1.3rem; }
  .subtabs { display: flex; flex-wrap: nowrap; overflow-x: auto; border-radius: 12px; }
}

/* Home: stage strip */
.stage-strip { list-style: none; margin: 0 0 1.25rem; padding: 0; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: .6rem; }
.stage-strip.ad-steps { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.stage-strip li { position: relative; display: flex; }
.stage-strip > li > .stage, .ad-steps li {
  flex: 1; display: grid; gap: .1rem; align-content: start; text-decoration: none; color: var(--ink);
  background: var(--surface); border: 1px solid var(--rule); border-radius: 10px; padding: .85rem .95rem;
}
a.stage:hover { border-color: var(--action); box-shadow: 0 0 0 1px var(--action); }
.stage-label { font: 600 .7rem/1.3 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); }
.stage-n { font: 700 1.8rem/1.15 var(--mono); font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.stage-foot, .stage-rate { font-size: .78rem; color: var(--ink-3); }
.stage-rate { color: var(--action); font-weight: 600; }
.stage-strip li + li::before { content: '\2192'; position: absolute; left: -.25rem; top: 50%; transform: translate(-50%, -50%); color: var(--ink-3); font-size: .8rem; }
@media (max-width: 640px) { .stage-strip, .stage-strip.ad-steps { grid-template-columns: 1fr 1fr; } .stage-strip li + li::before { display: none; } }
@media (max-width: 1100px) { .stage-n { font-size: 1.45rem; } .stage-strip > li > .stage, .ad-steps li { padding: .7rem .75rem; } }

/* Customers: fixed lists, editable chat facts */
.list-title { display: flex; align-items: center; gap: .5rem; margin: .4rem 0 0; font-size: 1.15rem; }
.list-count { font: 700 .8rem/1 var(--mono); background: var(--surface-2); border: 1px solid var(--rule); border-radius: 999px; padding: .25rem .55rem; }
.la-facts dd { min-width: 0; }
.la-edit { margin: 0; display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; }
.la-edit select, .la-edit input[type="month"] { max-width: 100%; padding: .3rem .4rem; border: 1px solid var(--rule); border-radius: 6px; background: var(--surface); color: var(--ink); font: .86rem var(--sans); }
.la-multi label { display: inline-flex; gap: .25rem; align-items: center; font-size: .84rem; margin-right: .3rem; }
.la-lock { color: var(--action); }
.btn.small { padding: .35rem .7rem; font-size: .8rem; }

/* Connections */
.jump { display: flex; flex-wrap: wrap; gap: .4rem; margin: 0 0 1rem; }
.jump a { font-size: .84rem; color: var(--action); text-decoration: none; border: 1px solid var(--rule); border-radius: 999px; padding: .3rem .8rem; background: var(--surface); }
.conn-part { margin-top: 2rem; padding-top: .5rem; border-top: 1px solid var(--rule-2); scroll-margin-top: 4rem; }
.conn-part > h2 { font-size: 1.2rem; margin: .8rem 0 .1rem; }
.conn-purpose { margin-bottom: 1rem; }
.seq-title { font-size: 1.25rem; margin-top: .3rem; }

/* Ads */
.ad-filters { display: flex; flex-wrap: wrap; gap: .5rem .8rem; align-items: flex-end; margin: 0 0 .5rem; }
.ad-filters label { display: grid; gap: .15rem; font-size: .74rem; font-weight: 600; color: var(--ink-3); }
.ad-filters select, .ad-filters input { padding: .38rem .5rem; border: 1px solid var(--rule); border-radius: 6px; background: var(--surface); color: var(--ink); font: .86rem var(--sans); }
.ad-range { font-size: .84rem; color: var(--ink-2); margin: 0 0 1rem; }
.ad-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 22rem), 1fr)); gap: .9rem; margin-bottom: .9rem; }
.ad-card { background: var(--surface); border: 1px solid var(--rule); border-radius: 10px; padding: 1rem 1.1rem; margin-bottom: .9rem; min-width: 0; }
.ad-grid > .ad-card { margin-bottom: 0; }
.ad-card h3 { margin: 0 0 .3rem; font-size: 1rem; }
.ad-card h3 small { font: 400 .74rem var(--mono); color: var(--ink-3); margin-left: .3rem; }
.ad-card h4 { margin: 1rem 0 .4rem; font-size: .85rem; color: var(--ink-2); }
.ad-card summary { cursor: pointer; font-weight: 600; }
.ad-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .8rem; margin: .7rem 0 0; }
.ad-stats dt { font: 600 .68rem/1.3 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); }
.ad-stats dd { margin: 0; font: 700 1.35rem/1.25 var(--mono); font-variant-numeric: tabular-nums; }
.ad-stats dd + dd { font: .76rem var(--sans); }
.ad-chg.good { color: var(--good); } .ad-chg.bad { color: var(--bad); } .ad-chg.flat { color: var(--ink-3); }
.ad-steps { margin: .8rem 0 .5rem; }
.ad-bars { display: grid; gap: .35rem; margin-top: .6rem; }
.ad-bar { display: grid; grid-template-columns: minmax(0, 11rem) minmax(3rem, 1fr) auto; gap: .6rem; align-items: center; font-size: .82rem; }
.ad-bar .bl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-2); }
.ad-bar .track { height: .7rem; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.ad-bar .fill { display: block; height: 100%; background: var(--action); border-radius: 999px; }
.ad-bar .bv { font: 600 .8rem var(--mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
.ad-table { font-size: .82rem; }
.ad-table td, .ad-table th { white-space: nowrap; }
.ad-name { min-width: 14rem; max-width: 20rem; white-space: normal !important; overflow-wrap: break-word; }
.ad-name small { display: block; font: .7rem var(--mono); color: var(--ink-3); }
.ad-table td.good { color: var(--good); font-weight: 700; }
.ad-table td.bad { color: var(--bad); font-weight: 700; }
.ad-table td.na { color: var(--ink-3); font-weight: 400; }
.ad-spend { background: linear-gradient(90deg, var(--surface-2) var(--w), transparent var(--w)); }
.ad-dot { display: inline-block; width: .55rem; height: .55rem; border-radius: 50%; background: var(--idle); vertical-align: middle; }
.ad-dot.on { background: var(--good); } .ad-dot.warn { background: var(--warn); }
.ad-pick { margin: 0; }
.ad-pick select { padding: .25rem .3rem; border: 1px solid var(--rule); border-radius: 6px; background: var(--surface); color: var(--ink); font: .8rem var(--sans); max-width: 10rem; }
.ad-pick.auto select { border-style: dashed; color: var(--ink-3); }
.ad-unlab { margin: 0 0 .5rem; font-size: .86rem; }
.ad-sync { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; margin-top: .5rem; }
.ad-take { margin: .3rem 0 0; padding-left: 1.1rem; font-size: .9rem; display: grid; gap: .3rem; }
.ad-heat { font-size: .78rem; border-collapse: separate; border-spacing: 2px; }
.ad-heat th { font: 600 .78rem/1.3 var(--sans); letter-spacing: 0; text-transform: none; text-align: left; vertical-align: bottom; color: var(--ink); }
.ad-heat thead th small { display: block; font-weight: 400; color: var(--ink-3); font-size: .66rem; }
.ad-heat td.heat { text-align: center; min-width: 3.2rem; border-radius: 4px; background: color-mix(in srgb, var(--action) calc(var(--a) * 100%), var(--surface-2)); color: var(--ink); font-variant-numeric: tabular-nums; }
.ad-heat td.heat.hi { outline: 2px solid var(--good); outline-offset: -2px; font-weight: 700; }
.ad-heat tr.dim th, .ad-heat tr.dim td { opacity: .5; }
.ad-counts { display: grid; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); gap: 1rem; align-items: start; }
.ad-counts table { min-width: 0; }
.ad-hours { display: grid; grid-template-columns: repeat(24, minmax(0, 1fr)); gap: 2px; height: 9rem; align-items: end; margin-top: .6rem; }
.ad-hours .hcol { display: flex; flex-direction: column; justify-content: flex-end; height: 100%; text-align: center; }
.ad-hours .hbar { display: flex; flex-direction: column; background: var(--action); border-radius: 3px 3px 0 0; min-height: 1px; }
.ad-hours .hbad { background: var(--bad); border-radius: 3px 3px 0 0; }
.ad-hours small { font-size: .62rem; color: var(--ink-3); height: 1rem; }
.ad-svg { width: 100%; height: auto; display: block; margin-top: .5rem; }
.sv-bar { fill: var(--action); opacity: .55; }
.sv-line { stroke: var(--ink); stroke-width: 2; }
.sv-dot { fill: var(--action); fill-opacity: .7; stroke: var(--surface); }
.sv-avg { stroke: var(--ink-3); stroke-dasharray: 5 4; }
.sv-t { font: 11px var(--sans); fill: var(--ink-3); }
@media (max-width: 560px) { .ad-bar { grid-template-columns: minmax(0, 7rem) minmax(2rem, 1fr) auto; } .ad-stats dd { font-size: 1.1rem; } }

/* Long links in queued messages must wrap on a phone (25 Nov 2026). */
.msg-body { overflow-wrap: anywhere; }

/* ==========================================================================
   Clean look (25 Nov 2026, asked by En Qi: "like the old Ads dashboard").
   Warm neutral ground, serif titles and big numbers, small sentence-case
   grey labels instead of capital monospace, underline tabs, soft cards,
   calm badges. Overrides the rules above; layout is unchanged.
   ========================================================================== */
:root {
  --ground: #F8F7F4; --surface: #FFFFFF; --surface-2: #F1EFEA; --side: #F1EFEA;
  --ink: #1F1E1C; --ink-2: #4D4A45; --ink-3: #7D7A72; --rule: #E4E1DA; --rule-2: #EEEBE5;
  --action: #91268F; --action-ink: #FFFFFF; --action-soft: #F4E9F4;
  --good: #2F7A4F; --good-bg: #E7F2EA; --bad: #B4322A; --bad-bg: #FBEDEB; --warn: #97650C; --warn-bg: #FBF3E2;
  --idle: #6D6A63; --idle-bg: #F0EEE9;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, ui-serif, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI Variable Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --radius: 10px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ground: #1D1C1A; --surface: #262522; --surface-2: #2F2D2A; --side: #22211F;
    --ink: #ECEAE4; --ink-2: #C4C0B8; --ink-3: #928E86; --rule: #3A3834; --rule-2: #312F2C;
    --action: #D891D6; --action-ink: #1D1C1A; --action-soft: #3A2A3A;
    --good: #6CC191; --good-bg: #1F3328; --bad: #F08A80; --bad-bg: #3B2220; --warn: #E2B45A; --warn-bg: #3A2F18;
    --idle: #A7A39B; --idle-bg: #2F2D2A;
  }
}
:root[data-theme="dark"] {
  --ground: #1D1C1A; --surface: #262522; --surface-2: #2F2D2A; --side: #22211F;
  --ink: #ECEAE4; --ink-2: #C4C0B8; --ink-3: #928E86; --rule: #3A3834; --rule-2: #312F2C;
  --action: #D891D6; --action-ink: #1D1C1A; --action-soft: #3A2A3A;
  --good: #6CC191; --good-bg: #1F3328; --bad: #F08A80; --bad-bg: #3B2220; --warn: #E2B45A; --warn-bg: #3A2F18;
  --idle: #A7A39B; --idle-bg: #2F2D2A;
}

body { font-size: 15px; line-height: 1.55; background: var(--ground); }
h2 { font-family: var(--sans); font-size: 1.02rem; font-weight: 600; letter-spacing: 0; margin: 2.2rem 0 .8rem; }
h3 { font-weight: 600; }
.hint { color: var(--ink-3); font-size: .84rem; line-height: 1.55; }
a { color: var(--action); text-underline-offset: 2px; }

/* Sidebar */
.side { background: var(--side); border-right: 1px solid var(--rule-2); padding: 1.3rem .75rem 1rem; gap: 1.4rem; }
.side-nav a { font-weight: 500; font-size: .93rem; color: var(--ink-2); padding: .5rem .7rem; border-radius: 8px; }
.side-nav a:hover { background: color-mix(in srgb, var(--ink) 5%, transparent); color: var(--ink); }
.side-nav a.on { background: var(--surface); color: var(--ink); box-shadow: 0 0 0 1px var(--rule), 0 1px 2px rgba(0,0,0,.04); font-weight: 600; }
.side-nav a.side-settings { margin-top: 1.1rem; }
.side .whoami { border-top: 1px solid var(--rule); font-size: .8rem; gap: .35rem .6rem; }
.whoami .who-role { font-family: var(--sans); font-size: .72rem; letter-spacing: 0; text-transform: none; background: none; border: 0; padding: 0; color: var(--ink-3); }
.whoami .who-role::before { content: '· '; }

/* Badges: red = act on it, grey = worth knowing */
.badge { min-width: 1.35rem; height: 1.25rem; font: 600 .7rem/1 var(--sans); background: var(--bad-bg); color: var(--bad); border-radius: 999px; }
.badge.info { background: color-mix(in srgb, var(--ink) 8%, transparent); color: var(--ink-3); }
.side-nav a.on .badge { background: var(--bad-bg); color: var(--bad); }
.side-nav a.on .badge.info { background: color-mix(in srgb, var(--ink) 8%, transparent); color: var(--ink-3); }

/* Page head: serif title, underline tabs */
.main { padding: 0 2.25rem 5rem; max-width: 86rem; }
.page-head { padding: 1.9rem 0 0; margin-bottom: 1.6rem; border-bottom: 0; }
.page-head h1 { font-family: var(--serif); font-weight: 400; font-size: 2.05rem; letter-spacing: -.01em; line-height: 1.15; }
.page-head .purpose { color: var(--ink-3); font-size: .95rem; margin-top: .35rem; max-width: 70ch; }
.subtabs {
  display: flex; flex-wrap: nowrap; overflow-x: auto; gap: .2rem; margin-top: 1.2rem; padding: 0;
  background: none; border: 0; border-bottom: 1px solid var(--rule); border-radius: 0; scrollbar-width: thin;
}
.subtabs a { border-radius: 0; padding: .6rem .85rem; margin-bottom: -1px; border-bottom: 2px solid transparent; color: var(--ink-3); font-weight: 500; font-size: .9rem; }
.subtabs a:hover { background: none; color: var(--ink); }
.subtabs a.on { background: none; box-shadow: none; color: var(--ink); border-bottom-color: var(--action); font-weight: 600; }

/* Cards and tiles */
.kpis { gap: .9rem; }
.kpi { border: 1px solid var(--rule); border-radius: var(--radius); padding: 1rem 1.15rem; background: var(--surface); }
.kpi .label { font: 400 .82rem/1.35 var(--sans); letter-spacing: 0; text-transform: none; color: var(--ink-3); margin: 0; }
.kpi .value { font-family: var(--serif); font-weight: 400; font-size: 2rem; letter-spacing: -.01em; margin: .35rem 0 .15rem; }
.kpi .value.na { font-size: 1.6rem; }
.kpi .foot { font-size: .8rem; margin: 0; }
.kpi.flag { background: var(--surface); border-color: var(--warn); }
.ad-card, .cust-card, .cust-head, .msg-card, .appt, .msg { border-radius: var(--radius); border-color: var(--rule); }
.ad-card { padding: 1.15rem 1.25rem; }
.ad-card h3, .cust-card h2 { font-size: 1rem; font-weight: 600; }
.empty { border-radius: var(--radius); }

/* Tables */
.tablewrap { border-radius: var(--radius); border-color: var(--rule); }
table { font-size: .87rem; }
th { font: 500 .78rem/1.3 var(--sans); letter-spacing: 0; text-transform: none; color: var(--ink-3); padding: .65rem .85rem; background: var(--surface); }
td { padding: .62rem .85rem; color: var(--ink-2); border-bottom-color: var(--rule-2); }
td:first-child { font-weight: 500; }
td.num, th.num { font-family: var(--sans); font-variant-numeric: tabular-nums; }
tbody tr:hover td { background: color-mix(in srgb, var(--ink) 2.5%, transparent); }
table.mini th, table.mini td { padding: .5rem .7rem; }

/* Pills, buttons, notes, inputs */
.pill { font: 500 .73rem/1.5 var(--sans); letter-spacing: 0; padding: .08rem .55rem; border-radius: 999px; }
.btn { border-radius: 8px; font-weight: 600; font-size: .9rem; padding: .7rem 1.1rem; }
.btn.small { padding: .38rem .75rem; font-size: .8rem; }
.btn.ghost { border-color: var(--rule); background: var(--surface); }
.banner { background: var(--surface); border: 1px solid var(--rule); border-left: 3px solid var(--action); border-radius: 0 var(--radius) var(--radius) 0; color: var(--ink-2); line-height: 1.55; }
.nag { background: var(--warn-bg); border: 1px solid color-mix(in srgb, var(--warn) 35%, transparent); border-left: 3px solid var(--warn); border-radius: 0 var(--radius) var(--radius) 0; line-height: 1.55; }
.saved { border-radius: 0 var(--radius) var(--radius) 0; }
code { font-size: .85em; }
select, input[type="date"], input[type="month"], input[type="number"], input[type="search"], input[type="text"], input[type="email"], textarea {
  border-radius: 8px !important; border-color: var(--rule) !important;
}
.ad-filters label { font: 400 .78rem var(--sans); color: var(--ink-3); }
.ad-filters select, .ad-filters input { padding: .42rem .55rem; font-size: .88rem; }
.ad-range { color: var(--ink-3); }

/* Home stage strip */
.stage-strip > li > .stage, .ad-steps li { border-radius: var(--radius); border-color: var(--rule); padding: .95rem 1rem; }
.stage-label { font: 400 .82rem/1.3 var(--sans); letter-spacing: 0; text-transform: none; color: var(--ink-3); }
.stage-n { font-family: var(--serif); font-weight: 400; font-size: 2rem; letter-spacing: -.01em; }
.stage-rate { color: var(--action); font-weight: 500; }
a.stage:hover { border-color: var(--action); box-shadow: none; background: var(--action-soft); }
@media (max-width: 1100px) { .stage-n { font-size: 1.6rem; } }

/* Ads */
.ad-stats dt { font: 400 .8rem/1.3 var(--sans); letter-spacing: 0; text-transform: none; color: var(--ink-3); }
.ad-stats dd { font-family: var(--serif); font-weight: 400; font-size: 1.55rem; }
.ad-stats dd + dd { font-family: var(--sans); }
.ad-card h3 small { font: 400 .76rem var(--sans); }
.ad-bar .bv { font: 500 .8rem var(--sans); font-variant-numeric: tabular-nums; }
.ad-bar .track { height: .65rem; background: var(--surface-2); }
.ad-pick select { border-radius: 6px !important; }
.ad-pick.auto select { border-style: dotted !important; }
.ad-heat td.heat { border-radius: 4px; }
.list-count { font: 600 .78rem/1 var(--sans); background: var(--surface-2); border-color: var(--rule); }

/* Customers */
.cust-search input { border-radius: var(--radius) !important; }
.cust-row { border-radius: var(--radius); border-color: var(--rule); }
.cust-head h2 { font-family: var(--serif); font-weight: 400; font-size: 1.7rem; }
.cust-kind { font-size: .7rem; letter-spacing: 0; text-transform: none; font-weight: 600; }
.cust-track li { border-top-width: 3px; }

/* Outbox, sequences, connections */
.msg-head { font: .78rem/1.4 var(--sans); }
.appt .meta { font: .8rem/1.5 var(--sans); }
.jump a { border-color: var(--rule); }
.conn-part > h2, .seq-title, .list-title { font-family: var(--serif); font-weight: 400; font-size: 1.45rem; }

/* Signed-out pages keep the top bar */
.bar { background: var(--surface); border-bottom-color: var(--rule-2); }
.bar h1 { font-family: var(--serif); font-weight: 400; font-size: 1.25rem; }
.bar .sub { font: .8rem/1.3 var(--sans); }

@media (max-width: 860px) {
  .side { border-bottom: 1px solid var(--rule); padding: .5rem 1rem; gap: .5rem; }
  .side-nav a.side-settings { margin-top: 0; }
  .main { padding: 0 1rem 4rem; }
  .page-head { padding-top: 1.2rem; margin-bottom: 1.2rem; }
  .page-head h1 { font-size: 1.6rem; }
  .subtabs { border-radius: 0; }
}
.subtabs { overflow-y: hidden; border-bottom: 0; box-shadow: inset 0 -1px 0 var(--rule); }
.subtabs a { margin-bottom: 0; }
.stage-strip + .hint { margin: -.4rem 0 1.5rem; }
.stage-n.na { font: 500 1rem/1.6 var(--sans); color: var(--ink-3); letter-spacing: 0; }
.ad-steps li.off { border-style: dashed; background: transparent; }
