/* Foundation's dashboard (towers.app/foundation/app): the team's view of every experiment, on fdn.css's tokens. A quiet
   sidebar on sand beside the open page on paper. Surfaces are told apart by tone steps, never borders; numbers are set
   large in tabular figures; a status is a small coloured dot and a word. Green is what's running, the amber is money
   that came in, dusk navy draws the funnel. Every text colour passes WCAG AA on its ground. */
.dash { background: var(--paper); --side: 264px; --pad: clamp(20px, 3.6vw, 56px); }
.dash .btn.sm { height: 36px; padding: 0 16px; font-size: 14.5px; }
.loading { color: var(--ink-3); padding: 40px var(--pad); }

/* ---------- the shell ---------- */
.shell { display: grid; grid-template-columns: var(--side) minmax(0, 1fr); min-height: 100svh; background: var(--sand); }
.side { position: sticky; top: 0; height: 100svh; overflow: auto; background: var(--sand); display: flex; flex-direction: column; gap: 22px; padding: 22px 12px 18px; }
.side .brand { padding: 4px 10px; }
.rail { display: grid; gap: 2px; align-content: start; }
.rail h2 { margin: 0 10px 6px; font: 600 13.5px/1.3 var(--text); letter-spacing: 0; color: var(--ink-3); }
.rail a { display: grid; gap: 2px; padding: 9px 10px; border-radius: 12px; text-decoration: none; color: var(--ink); transition: background-color 120ms ease; }
.rail a:hover { background: var(--sand-2); }
.rail a[aria-current] { background: var(--card); }
.rail .t { display: flex; align-items: center; gap: 10px; min-width: 0; }
.rail .nm { font-weight: 600; font-size: 15.5px; letter-spacing: -0.01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rail .t .st { margin-left: auto; font-size: 13px; }
.rail .l { font-size: 13.5px; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rail .gap { height: 14px; }
.rail a.act .nm { font-weight: 500; color: var(--ink-2); }
.rail a.act:hover .nm, .rail a.act[aria-current] .nm { color: var(--ink); }
.rail .plus, .rail .c { margin-left: auto; font-size: 14px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.rail .plus { font-size: 20px; line-height: 1; width: 16px; text-align: center; }
.me { margin-top: auto; display: grid; gap: 4px; padding: 10px; font-size: 13.5px; color: var(--ink-3); min-width: 0; }
.who { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.out { justify-self: start; padding: 4px 0; border: 0; background: none; font: 500 14px/1.3 var(--text); color: var(--ink); cursor: pointer; text-decoration: underline; text-underline-offset: 0.2em; }
.gated .shell { grid-template-columns: minmax(0, 1fr); }
.gated .side { display: none; }

/* ---------- a status: a small coloured dot and a word ---------- */
.st { display: inline-flex; align-items: center; gap: 7px; font-size: 14px; font-weight: 500; color: var(--ink-2); white-space: nowrap; }
.st i { width: 8px; height: 8px; border-radius: 50%; background: #9c9286; flex: none; }
.st.live i, .st.running i, .st.kept i { background: #2f9a5c; }
.st.waiting i, .st.next i { background: #d98a2b; }
.st.cut i, .st.stopped i { background: #c0533b; }
.st.live, .st.running, .st.kept { color: var(--ok); }

/* ---------- the open page ---------- */
.dmain { min-width: 0; padding: 40px var(--pad) 96px; background: var(--paper); }
.dmain > * { max-width: 1240px; }
.proj { display: grid; gap: 44px; min-width: 0; }
.ph { display: grid; gap: 14px; }
.ph .top { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.ph h1 { font-size: clamp(34px, 3.4vw, 48px); letter-spacing: -0.035em; line-height: 1; }
.ph .top .st { font-size: 15px; }
.ph .count { font: 600 22px/1 var(--display); color: var(--ink-3); font-variant-numeric: tabular-nums; }
.ph .line { font-size: 18px; line-height: 1.55; color: var(--ink-2); max-width: 46em; }
.facts { margin: 4px 0 0; display: flex; flex-wrap: wrap; gap: 10px 36px; }
.facts div { display: grid; gap: 2px; min-width: 0; }
.facts dt { font-size: 13px; color: var(--ink-3); }
.facts dd { margin: 0; font-size: 15.5px; font-weight: 500; color: var(--ink); }
.links { display: flex; flex-wrap: wrap; gap: 6px 22px; }
.links a { display: inline-flex; gap: 4px; font-size: 15px; font-weight: 500; color: var(--ink); text-decoration: underline; text-decoration-color: rgba(27, 25, 22, 0.3); text-underline-offset: 0.22em; }
.links a:hover { text-decoration-color: currentColor; }
.links a span { color: var(--ink-3); text-decoration: none; }
.now { margin-top: -20px; background: var(--paper-2); border-radius: 18px; padding: 16px 20px; display: grid; gap: 4px; }
.now p { font-size: 16.5px; line-height: 1.5; color: var(--ink); }
.now small { font-size: 13.5px; color: var(--ink-3); }

/* the numbers */
.tiles { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; }
.tile { background: var(--paper-2); border-radius: 18px; padding: 18px 18px 16px; display: grid; gap: 6px; align-content: start; min-width: 0; }
.tile span { font-size: 13.5px; font-weight: 500; color: var(--ink-2); }
.tile b { font: 600 clamp(28px, 2.5vw, 38px)/1.05 var(--display); letter-spacing: -0.03em; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile small { font-size: 13px; line-height: 1.4; color: var(--ink-3); }
.tile.good { background: #f8dcb6; }
.tile.good small, .tile.good span { color: #5a4630; }
.tile .meter { height: 4px; border-radius: 2px; background: var(--sand-2); overflow: hidden; margin-top: 4px; }
.tile .meter i { display: block; height: 100%; background: var(--dusk); border-radius: 2px; }

.blk { display: grid; gap: 16px; min-width: 0; }
.blk > h2 { display: flex; align-items: baseline; gap: 10px; font-size: 24px; letter-spacing: -0.025em; line-height: 1.1; }
.blk > h2 .c { font: 500 15px/1 var(--text); color: var(--ink-3); letter-spacing: 0; }
.empty { margin: 0; padding: 18px 20px; border-radius: 16px; background: var(--paper-2); color: var(--ink-2); font-size: 15.5px; }
.dmain > .empty { margin-top: 8px; }

/* rounds */
.stages { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 8px; }
.stg { background: var(--paper-2); border-radius: 18px; padding: 18px 20px; display: grid; gap: 10px; align-content: start; }
.stg.running { background: var(--sand); }
.stg.done, .stg.skipped { background: #f2ebe0; }
.stg .h { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.stg .h b { font: 600 18px/1.2 var(--display); letter-spacing: -0.02em; }
.stg .h span { font-size: 15px; font-weight: 500; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.stg .when { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 13.5px; color: var(--ink-3); }
.stg .when .st { font-size: 13.5px; }
.stg p { font-size: 15px; line-height: 1.5; color: var(--ink-2); }
.stg .res { color: var(--ink); font-weight: 500; }

/* the funnel: a bar per step, paid in amber */
.fn { display: grid; gap: 6px; }
.fn .r { display: grid; grid-template-columns: minmax(120px, 210px) minmax(0, 1fr) 72px 56px; gap: 16px; align-items: center; font-size: 15px; }
.fn .r span { color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fn .r .b { height: 28px; border-radius: 8px; background: var(--paper-2); overflow: hidden; }
.fn .r .b i { display: block; height: 100%; min-width: 3px; border-radius: 8px; background: var(--dusk); }
.fn .r.paid span { color: var(--ink); font-weight: 600; }
.fn .r.paid .b i { background: var(--amber); }
.fn .r em { font: 600 17px/1 var(--text); font-style: normal; text-align: right; font-variant-numeric: tabular-nums; }
.fn .r small { font-size: 13.5px; color: var(--ink-3); text-align: right; font-variant-numeric: tabular-nums; }

/* tables: a tone for the header, a tone step every other row, the header sticks, the ad's name stays in view */
.tw { overflow: auto; max-height: calc(100svh - 96px); border-radius: 18px; background: var(--card); overscroll-behavior-x: contain; }
.dash table { border-collapse: separate; border-spacing: 0; width: max-content; min-width: 100%; font-size: 14.5px; line-height: 1.45; }
.dash th, .dash td { text-align: left; padding: 12px 14px; vertical-align: top; }
.dash th { position: sticky; top: 0; z-index: 2; background: var(--sand); color: var(--ink-2); font-weight: 600; font-size: 13px; white-space: nowrap; }
.dash tbody tr:nth-child(even) td { background: #f7f2ea; }
.dash tbody tr:nth-child(odd) td { background: var(--card); }
.dash tbody tr:hover td { background: var(--paper-2); }
.dash th.n, .dash td.n { text-align: right; }
.dash td.n { white-space: nowrap; font-variant-numeric: tabular-nums; font-weight: 500; }
.dash td.n:empty::after { content: '—'; color: var(--ink-3); }
.dash th.name, .dash td.name { position: sticky; left: 0; z-index: 1; min-width: 280px; max-width: 380px; }
.dash th.name { z-index: 3; }
.dash td.name b { font-weight: 600; color: var(--ink); }
.dash td a { color: var(--ink); overflow-wrap: anywhere; }
.dash td .hook { color: var(--ink-2); font-size: 13.5px; margin-top: 2px; unicode-bidi: plaintext; }
.dash td .verdict { color: var(--ink); font-style: italic; }
.dash td .fmt { color: var(--ink-3); font-size: 13px; margin-top: 2px; }
.dash td.chan { white-space: nowrap; font-weight: 500; color: var(--ink-2); }
.dash td.way { white-space: nowrap; }
.dash td.stc { white-space: nowrap; }
.dash td.stc .st { font-size: 13.5px; }
.dash td.dim { white-space: nowrap; color: var(--ink-2); font-size: 13.5px; }
.dash .wl td.app { min-width: 240px; max-width: 420px; }
.dash .wl td.name { min-width: 220px; }

/* tracking: ✓ on, ✕ missing, ? not checked */
.trk { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 8px; }
.tg { background: var(--paper-2); border-radius: 18px; padding: 18px 20px; display: grid; gap: 12px; align-content: start; }
.tg h3 { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; font-size: 18px; letter-spacing: -0.02em; }
.tg h3 .sum { font: 500 13.5px/1 var(--text); letter-spacing: 0; color: var(--ink-3); }
.ti { display: grid; grid-template-columns: 24px minmax(0, 1fr); gap: 12px; font-size: 15px; line-height: 1.45; color: var(--ink); }
.ti i { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font: 700 12px/1 var(--text); font-style: normal; margin-top: 0; }
.ti.ok i { background: #2f9a5c; color: #fff; }
.ti.no i { background: #c0533b; color: #fff; }
.ti.un i { background: var(--sand-2); color: var(--ink-2); }
.ti.no span { color: var(--ink); }
.ti small { display: block; margin-top: 2px; font-size: 13.5px; color: var(--ink-3); }
.ti.no small { color: var(--bad); }

/* what we were given, the prompt back */
.src { background: var(--paper-2); border-radius: 18px; padding: 18px 20px; display: grid; gap: 10px; font-size: 15px; line-height: 1.5; color: var(--ink-2); min-width: 0; }
.src a { color: var(--ink); overflow-wrap: anywhere; }
.src b { color: var(--ink); font-weight: 600; }
.src .fmt { color: var(--ink-3); font-size: 13.5px; }
.src pre { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; font: 13.5px/1.6 var(--mono); color: var(--ink); background: var(--card); border-radius: 12px; padding: 14px 16px; max-height: 260px; overflow: auto; }
.src img { max-width: 280px; border-radius: 12px; }

/* notes, newest first */
.notes { display: grid; gap: 14px; }
.notes div { display: grid; grid-template-columns: 76px minmax(0, 1fr); gap: 16px; font-size: 15.5px; line-height: 1.55; }
.notes time { font-size: 13.5px; font-weight: 500; color: var(--ink-3); padding-top: 2px; font-variant-numeric: tabular-nums; }
.notes p { color: var(--ink); }

/* a new project */
.intake { display: grid; gap: 16px; max-width: 720px; }
.intake h1 { font-size: clamp(34px, 3.4vw, 48px); letter-spacing: -0.035em; }
.intake p { font-size: 17px; line-height: 1.55; color: var(--ink-2); }
.intake .box { max-width: none; margin-top: 8px; }
.intake .box textarea { min-height: 110px; }
.intake .err { color: var(--bad); font-size: 15px; }
.intake .err:empty { display: none; }

/* signing in */
.gate { max-width: 460px; margin: min(14vh, 120px) auto 0; padding: 36px 32px 32px; border-radius: 28px; background: var(--sand); display: grid; gap: 14px; }
.gate .brand { margin-bottom: 18px; }
.gate h1 { font-size: 34px; letter-spacing: -0.03em; line-height: 1.04; }
.gate p { font-size: 16.5px; line-height: 1.5; color: var(--ink-2); }
.gate .g { min-height: 44px; margin-top: 6px; }
.gate .err { color: var(--bad); font-size: 15px; }
.gate .err:empty { display: none; }
.gate .fine { font-size: 15px; }
.gate a { color: var(--ink); }
.gated .dmain { padding-top: 24px; }
.gated .dmain > * { max-width: 460px; }

@media (max-width: 1240px) { .tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

/* ---------- a phone: the sidebar becomes a strip along the top ---------- */
@media (max-width: 899px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side { position: relative; height: auto; overflow: visible; gap: 10px; padding: 12px 0 12px; }
  .side .brand { padding: 4px var(--pad); }
  .rail { display: flex; gap: 6px; overflow-x: auto; padding: 0 var(--pad); scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  .rail::-webkit-scrollbar { display: none; }
  .rail h2, .rail .gap, .rail .l { display: none; }
  .rail a { flex: none; padding: 8px 12px; border-radius: 12px; }
  .rail .nm { font-size: 14.5px; }
  .rail .t .st { font-size: 0; gap: 0; }
  .me { position: absolute; top: 12px; right: var(--pad); margin: 0; padding: 4px 0; }
  .me .who { display: none; }
  .dmain { padding: 24px var(--pad) 72px; }
  .proj { gap: 36px; }
  .ph .line { font-size: 17px; }
  .facts { gap: 10px 24px; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tile { padding: 14px 16px; }
  .tile b { font-size: 28px; }
  .fn .r { grid-template-columns: minmax(0, 1fr) 56px 48px; gap: 4px 10px; font-size: 14.5px; }
  .fn .r .b { grid-column: 1 / -1; grid-row: 2; height: 22px; }
  .fn .r em { font-size: 16px; }
  .dash th.name, .dash td.name { min-width: 190px; max-width: 220px; }
  .trk { grid-template-columns: minmax(0, 1fr); }
  .notes div { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .gate { margin-top: 32px; padding: 30px 22px 24px; }
}
