/* Layout: brand bar → summary (counts + stage distribution) → filters → pipeline board (6 stage columns) or list; card opens a detail drawer. */
:root {
  /* Brand (sampled from the Mostec AI logo gradient) */
  --s1: #0D4CF5; --s2: #2C78F5; --s3: #469DF5; --s4: #5BBAF5; --s5: #6ACFF5; --s6: #76E0F6;
  --brand-grad: linear-gradient(90deg, #0D4CF5 0%, #469DF5 40%, #73DBF5 80%, #76E0F6 100%);
  --teal: #59CBD7;
  --mist: #E1EAEC;

  /* Surfaces & text — light */
  --bg: #F2F6F8;
  --surface: #FFFFFF;
  --surface-2: #E8EFF2;
  --line: #D3DEE3;
  --ink: #0A1A33;
  --ink-2: #4B5D72;
  --ink-3: #7D8EA0;
  --accent: #0D4CF5;
  --accent-soft: #E3ECFE;
  --wordmark: #0A1A33;

  /* Status (semantic, separate from brand accent) */
  --ok: #0B8C80;
  --ok-bg: #DDF4F1;
  --stall: #D2452B;
  --stall-bg: #FCE6E1;
  --warn: #B26A00;

  --shadow: 0 1px 2px rgba(10, 26, 51, .06), 0 4px 14px rgba(10, 26, 51, .05);
  --radius: 10px;

  --f-display: "Michroma", "Eurostile", "Arial Black", sans-serif;
  --f-body: "Onest", "Segoe UI", system-ui, sans-serif;
  --f-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #060F24; --surface: #0C1A38; --surface-2: #12244A; --line: #1E3360;
    --ink: #E1EAEC; --ink-2: #A3B5C7; --ink-3: #6E83A0;
    --accent: #5BBAF5; --accent-soft: #12305E; --wordmark: #E1EAEC;
    --ok: #4FD6C6; --ok-bg: #0C3A3E; --stall: #FF8A6E; --stall-bg: #43201E; --warn: #F2B34A;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 6px 18px rgba(0,0,0,.25);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #060F24; --surface: #0C1A38; --surface-2: #12244A; --line: #1E3360;
  --ink: #E1EAEC; --ink-2: #A3B5C7; --ink-3: #6E83A0;
  --accent: #5BBAF5; --accent-soft: #12305E; --wordmark: #E1EAEC;
  --ok: #4FD6C6; --ok-bg: #0C3A3E; --stall: #FF8A6E; --stall-bg: #43201E; --warn: #F2B34A;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 6px 18px rgba(0,0,0,.25);
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { min-height: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 400 14px/1.45 var(--f-body);
  padding-inline: clamp(16px, 3vw, 36px);
  padding-block: 0 48px;
}
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.num { font-family: var(--f-mono); font-variant-numeric: tabular-nums; }

/* Brand bar */
.bar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  padding-block: 20px 18px;
  border-bottom: 1px solid var(--line);
  position: relative;
}
.bar::after { content: ""; position: absolute; left: 0; bottom: -1px; width: 180px; height: 2px; background: var(--brand-grad); }
.brand { display: flex; align-items: center; gap: 12px; }
.brand img { width: 46px; height: 46px; margin-block: -6px; }
.wordmark { font: 400 19px/1 var(--f-display); letter-spacing: .06em; color: var(--wordmark); }
.brand-sub { font-size: 12px; color: var(--teal); letter-spacing: .04em; margin-top: 4px; font-weight: 600; }
.bar-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.sample-tag {
  font-size: 11.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
  color: var(--warn); border: 1px dashed currentColor; border-radius: 999px; padding: 4px 10px;
}
.today { color: var(--ink-2); font-size: 13px; }

/* Summary */
.summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)) minmax(0, 2.2fr); gap: 14px; margin-top: 22px; }
.kpi, .dist {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px; min-width: 0;
}
.kpi { display: flex; flex-direction: column; gap: 6px; text-align: left; cursor: pointer; }
.kpi:hover { border-color: var(--accent); }
.kpi[aria-pressed="true"] { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.kpi-label { font-size: 11.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-2); font-weight: 600; display: flex; align-items: center; gap: 7px; }
.kpi-value { font: 400 30px/1.1 var(--f-display); }
.kpi-note { font-size: 12.5px; color: var(--ink-3); }
/* "Brought in" ranking: tier pills (gold top 10%, blue middle, green bottom 10%) */
.refs { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 6px; padding-top: 10px; border-top: 1px solid var(--line); }
.refs-lbl { width: 100%; font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); font-weight: 600; }
.ref {
  position: relative; overflow: hidden; isolation: isolate;
  display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px 0 3px; border-radius: 999px;
  font-size: 12.5px; font-weight: 600; letter-spacing: .01em; white-space: nowrap;
  background: var(--tier); color: var(--tier-ink); box-shadow: inset 0 1px 0 rgba(255,255,255,.35), 0 1px 2px rgba(10,26,51,.15);
  transition: transform .15s;
}
.kpi:hover .ref { transform: translateY(-1px); }
.ref .medal {
  display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; flex: none;
  font: 700 10px/1 var(--f-mono); background: rgba(255,255,255,.9); color: var(--tier-mark);
  box-shadow: 0 1px 2px rgba(0,0,0,.15);
}
.ref .ref-n {
  font: 600 10.5px/1 var(--f-mono); padding: 3px 6px; border-radius: 999px; margin-left: 1px;
  background: rgba(255,255,255,.22); color: inherit;
}
.ref.tier-gold {
  --tier: linear-gradient(135deg, #FFE7A3 0%, #F4C33A 38%, #D99A0B 72%, #F2C14E 100%);
  --tier-ink: #3A2600; --tier-mark: #B87F00;
  height: 30px; font-size: 13px; padding-right: 12px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.6), 0 0 0 1px rgba(217,154,11,.45), 0 3px 12px rgba(217,154,11,.4);
}
.ref.tier-gold .medal { width: 24px; height: 24px; font-size: 13px; background: #fff; }
.ref.tier-gold .ref-n { background: rgba(58,38,0,.12); }
/* slow shine across gold pills */
.ref.tier-gold::after {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(110deg, transparent 30%, rgba(255,255,255,.55) 45%, transparent 60%);
  transform: translateX(-120%); animation: shine 4.5s ease-in-out infinite;
}
@keyframes shine { 0%, 55% { transform: translateX(-120%); } 85%, 100% { transform: translateX(120%); } }
.ref.tier-blue { --tier: linear-gradient(135deg, #2C78F5, #0D4CF5); --tier-ink: #fff; --tier-mark: #0D4CF5; }
.ref.tier-green { --tier: linear-gradient(135deg, #3DBB72, #1F8A4C); --tier-ink: #fff; --tier-mark: #1F8A4C; }
.refs-legend { width: 100%; display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 2px; font-size: 11px; color: var(--ink-3); }
.refs-legend i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 5px; vertical-align: 0; }
@media (prefers-reduced-motion: reduce) { .ref.tier-gold::after { animation: none; display: none; } }
.kpi.stalled .kpi-value { color: var(--stall); }
.kpi.progressing .kpi-value { color: var(--ok); }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }
.dot.ok { background: var(--ok); }
.dot.stall { background: var(--stall); }

.dist h2 { margin: 0 0 12px; font-size: 11.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-2); font-weight: 600; }
.dist-bar { display: flex; height: 14px; border-radius: 999px; overflow: hidden; gap: 2px; background: var(--surface-2); }
.dist-bar span { display: block; height: 100%; min-width: 4px; }
.dist-legend { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px 14px; margin-top: 12px; font-size: 12.5px; color: var(--ink-2); }
.dist-legend div { display: flex; align-items: center; gap: 7px; min-width: 0; }
.dist-legend b { color: var(--ink); font-family: var(--f-mono); font-weight: 600; margin-left: auto; }
.dist-legend .lbl { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Toolbar */
.toolbar { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: center; margin-top: 22px; }
.search {
  flex: 1 1 220px; min-width: 0; max-width: 320px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px;
}
.search::placeholder { color: var(--ink-3); }
.seg { display: inline-flex; background: var(--surface-2); border-radius: 8px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg button {
  border: 0; background: transparent; padding: 6px 12px; border-radius: 6px; cursor: pointer; color: var(--ink-2); font-weight: 500; font-size: 13px;
  display: inline-flex; align-items: center; gap: 6px;
}
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.toolbar .spacer { flex: 1; }
.owner-filter { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.owner-filter .lbl { font-size: 12px; color: var(--ink-3); margin-right: 2px; }
.chip {
  border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 3px 10px 3px 3px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink-2);
}
.chip[aria-pressed="true"] { border-color: var(--accent); color: var(--ink); background: var(--accent-soft); }

.avatar {
  width: 22px; height: 22px; border-radius: 50%; display: inline-grid; place-items: center; flex: none;
  font: 600 10px/1 var(--f-body); color: #fff; letter-spacing: .02em;
}

/* Board */
.board-wrap { margin-top: 18px; overflow-x: auto; padding-bottom: 6px; }
.board { display: grid; grid-template-columns: repeat(6, minmax(220px, 1fr)); gap: 12px; min-width: 1360px; }
@media (max-width: 1500px) { .board { min-width: 0; grid-template-columns: repeat(6, 240px); } }
.col { background: var(--surface-2); border-radius: var(--radius); padding: 10px; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.col-head { display: flex; align-items: center; gap: 8px; padding: 4px 4px 8px; border-bottom: 2px solid var(--stage); }
.col-step { font: 400 10px/1 var(--f-display); color: var(--stage); }
.col-name { font-weight: 600; font-size: 13.5px; min-width: 0; }
.col-count { margin-left: auto; font-family: var(--f-mono); font-size: 12px; color: var(--ink-2); background: var(--surface); border-radius: 999px; padding: 1px 8px; }
.col-empty { color: var(--ink-3); font-size: 12.5px; padding: 14px 6px; text-align: center; }

.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 11px 12px;
  display: flex; flex-direction: column; gap: 9px; text-align: left; cursor: pointer; width: 100%;
  transition: border-color .15s, transform .15s;
}
.card:hover { border-color: var(--accent); transform: translateY(-1px); }
.card.is-stalled { border-color: color-mix(in srgb, var(--stall) 45%, var(--line)); }
.card-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.card-name { font-weight: 600; font-size: 14px; line-height: 1.3; min-width: 0; }
.card-sector { font-size: 12px; color: var(--ink-3); }
.card-bottom { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.card-owner { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--ink-2); min-width: 0; }
.ago { font-size: 12px; color: var(--ink-3); white-space: nowrap; }

.pill {
  display: inline-flex; align-items: center; gap: 5px; border-radius: 999px; padding: 2px 9px 2px 7px;
  font-size: 11.5px; font-weight: 600; white-space: nowrap;
}
.pill.ok { color: var(--ok); background: var(--ok-bg); }
.pill.stall { color: var(--stall); background: var(--stall-bg); }
.soon { font-size: 11.5px; color: var(--warn); font-weight: 500; }

/* List view */
.table-wrap { margin-top: 18px; overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; min-width: 760px; }
th, td { padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--line); }
th { font-size: 11.5px; letter-spacing: .07em; text-transform: uppercase; color: var(--ink-2); font-weight: 600; background: var(--surface-2); }
th button { all: unset; cursor: pointer; display: inline-flex; gap: 4px; align-items: center; }
th button:focus-visible { outline: 2px solid var(--accent); }
tbody tr { cursor: pointer; }
tbody tr:hover td { background: var(--accent-soft); }
tbody tr:last-child td { border-bottom: 0; }
.stage-tag { display: inline-flex; align-items: center; gap: 7px; }
.stage-tag i { width: 9px; height: 9px; border-radius: 2px; background: var(--stage); }

/* Drawer */
.scrim { position: fixed; inset: 0; background: rgba(4, 12, 30, .45); z-index: 10; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 11; width: min(460px, 100%);
  background: var(--surface); border-left: 1px solid var(--line); box-shadow: -10px 0 40px rgba(0,0,0,.18);
  display: flex; flex-direction: column;
  padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px);
}
.drawer-head { padding: 20px 22px 16px; border-bottom: 1px solid var(--line); position: relative; }
.drawer-head::after { content: ""; position: absolute; left: 22px; bottom: -1px; width: 90px; height: 2px; background: var(--brand-grad); }
.drawer-head h2 { margin: 0; font-size: 20px; line-height: 1.25; text-wrap: balance; padding-right: 40px; }
.drawer-head .card-sector { margin-top: 3px; font-size: 13px; }
.close { position: absolute; top: 16px; right: 16px; border: 0; background: var(--surface-2); width: 32px; height: 32px; border-radius: 8px; cursor: pointer; font-size: 18px; line-height: 1; color: var(--ink-2); }
.drawer-body { padding: 18px 22px 28px; overflow-y: auto; display: flex; flex-direction: column; gap: 22px; }
.section-label { font-size: 11.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-2); font-weight: 600; margin: 0 0 10px; }

.steps { display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; }
.step { height: 6px; border-radius: 3px; background: var(--surface-2); }
.step.done { background: var(--stage); }
.steps-labels { display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; margin-top: 7px; font-size: 10.5px; color: var(--ink-3); }
.steps-labels span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.steps-labels span.cur { color: var(--ink); font-weight: 600; }

.facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.fact { background: var(--surface-2); border-radius: 8px; padding: 10px 12px; min-width: 0; }
.fact dt { font-size: 11.5px; color: var(--ink-3); }
.fact dd { margin: 3px 0 0; font-weight: 600; display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }

.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.btn {
  border: 1px solid var(--line); background: var(--surface); padding: 8px 14px; border-radius: 8px; cursor: pointer; font-weight: 600; font-size: 13px;
}
.btn.primary { background: var(--s1); border-color: var(--s1); color: #fff; }
.btn.primary:hover { background: #0A3FD0; }
.btn:hover { border-color: var(--accent); }
select.btn { font-weight: 500; }
.note { font-size: 12px; color: var(--ink-3); }

.timeline { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.timeline li { display: grid; grid-template-columns: 14px 1fr; gap: 10px; padding-bottom: 14px; position: relative; }
.timeline li::before { content: ""; position: absolute; left: 6px; top: 14px; bottom: 0; width: 2px; background: var(--line); }
.timeline li:last-child::before { display: none; }
.timeline .mark { width: 14px; height: 14px; border-radius: 50%; border: 3px solid var(--surface); background: var(--teal); margin-top: 2px; box-shadow: 0 0 0 1px var(--line); }
.timeline .what { font-size: 13.5px; }
.timeline .meta { font-size: 12px; color: var(--ink-3); }

.viewer { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-2); }
.viewer select { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 5px 8px; color: var(--ink); }
.fact-sub { font-weight: 400; font-size: 12px; color: var(--ink-3); }
.next { background: var(--accent-soft); border-radius: 10px; padding: 14px 16px; display: flex; flex-direction: column; gap: 8px; }
.next .section-label { margin: 0; }
.next-what { font-weight: 600; font-size: 15px; }
.next-meta { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; font-size: 12.5px; color: var(--ink-2); }
.next.overdue .due { color: var(--stall); font-weight: 600; }
.waiting { border-radius: 999px; padding: 2px 9px; font-weight: 600; font-size: 11.5px; background: var(--surface); }
.waiting.us { color: var(--accent); }
.waiting.client { color: var(--warn); }
.blocker { font-size: 13px; color: var(--ink); border-top: 1px solid var(--line); padding-top: 8px; }
.blocker b { color: var(--stall); }
.checklist, .people, .team, .docs { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.checklist label { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; padding: 6px 8px; border-radius: 6px; }
.checklist label:hover { background: var(--surface-2); }
.checklist input { accent-color: var(--s1); width: 16px; height: 16px; margin: 1px 0 0; flex: none; }
.checklist input:checked + span { color: var(--ink-3); text-decoration: line-through; }
.ready { margin: 8px 0 0; font-size: 13px; color: var(--ok); font-weight: 600; }
.people li { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; }
.p-name { font-weight: 600; }
.p-role { font-size: 12.5px; color: var(--ink-2); }
.p-reach { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 6px; font-size: 12.5px; color: var(--ink-2); user-select: all; word-break: break-all; }
.team li { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.locked { background: var(--surface-2); border: 1px dashed var(--line); border-radius: 8px; padding: 12px 14px; font-size: 13px; color: var(--ink-2); }
.docs li { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 6px; background: var(--surface-2); font-size: 13.5px; }
.doc-ico { width: 12px; height: 15px; border-radius: 2px; border: 1.5px solid var(--accent); flex: none; position: relative; }
.doc-ico::after { content: ""; position: absolute; left: 2px; right: 2px; top: 4px; height: 1.5px; background: var(--accent); box-shadow: 0 3px 0 var(--accent); }

/* Main menu */
.tabs { display: flex; align-items: center; gap: 12px 20px; flex-wrap: wrap; margin-top: 14px; }
.tab-list { display: flex; gap: 4px; flex-wrap: wrap; flex: 1 1 auto; min-width: 0; }
.tab {
  border: 0; background: transparent; padding: 9px 12px; border-radius: 8px; cursor: pointer;
  color: var(--ink-2); font-weight: 600; font-size: 13.5px; display: inline-flex; align-items: center; gap: 7px; position: relative;
}
.tab:hover { background: var(--surface-2); color: var(--ink); }
.tab[aria-current="page"] { color: var(--ink); }
.tab[aria-current="page"]::after { content: ""; position: absolute; left: 12px; right: 12px; bottom: 2px; height: 2px; border-radius: 2px; background: var(--brand-grad); }
.tab .badge { font: 600 11px/1 var(--f-mono); padding: 3px 6px; border-radius: 999px; background: var(--surface-2); color: var(--ink-2); }
.tab .badge.hot { background: var(--stall-bg); color: var(--stall); }
.tab.admin { color: var(--accent); }
.tabs .search { max-width: 280px; }

.page-head { margin-top: 22px; display: flex; flex-direction: column; gap: 4px; }
.page-head h1 { margin: 0; font-size: 22px; line-height: 1.2; text-wrap: balance; }
.page-head p { margin: 0; color: var(--ink-2); max-width: 70ch; }

/* Needs attention */
.attn { margin-top: 18px; display: flex; flex-direction: column; gap: 8px; }
.attn-row {
  display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) minmax(0, 1.6fr) auto; gap: 14px; align-items: center;
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 12px 16px; text-align: left; cursor: pointer; width: 100%;
}
.attn-row:hover { border-color: var(--accent); }
.reasons { display: flex; flex-wrap: wrap; gap: 6px; }
.reason { font-size: 11.5px; font-weight: 600; border-radius: 999px; padding: 2px 9px; white-space: nowrap; }
.reason.stall { color: var(--stall); background: var(--stall-bg); }
.reason.overdue { color: var(--stall); background: transparent; box-shadow: inset 0 0 0 1px var(--stall); }
.reason.soon { color: var(--warn); box-shadow: inset 0 0 0 1px var(--warn); }
.reason.us { color: var(--accent); background: var(--accent-soft); }
.attn-next { font-size: 13px; color: var(--ink-2); min-width: 0; }
.attn-empty { background: var(--surface); border: 1px dashed var(--line); border-radius: 10px; padding: 28px; text-align: center; color: var(--ink-2); }

/* Team + admin tables */
.bar-mini { display: flex; height: 8px; width: 120px; border-radius: 999px; overflow: hidden; background: var(--surface-2); }
.bar-mini span { display: block; height: 100%; }
td .warnnum { color: var(--stall); font-weight: 600; }
.role-tag { font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); color: var(--ink-2); }
.role-tag.Admin { background: var(--accent-soft); color: var(--accent); }
.admin-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; margin-top: 18px; }
.admin-grid h2 { font-size: 15px; margin: 0 0 10px; }
.admin-grid .table-wrap { margin-top: 0; }
.admin-grid table { min-width: 0; }
.mini-select { background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 4px 6px; color: var(--ink); }
.archived-reason { font-size: 12.5px; color: var(--ink-2); }

.btn[disabled], select.btn[disabled] { opacity: .45; cursor: not-allowed; }
.perm-note { font-size: 12px; color: var(--warn); margin: 8px 0 0; }
.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); z-index: 20;
  background: var(--ink); color: var(--bg); padding: 9px 16px; border-radius: 8px; font-size: 13px; font-weight: 500; box-shadow: var(--shadow); }
.drawer-tools { display: flex; gap: 8px; margin-top: 10px; }
.btn.small { padding: 5px 10px; font-size: 12.5px; font-weight: 600; }

@media (max-width: 760px) {
  .attn-row { grid-template-columns: 1fr; gap: 8px; }
  .admin-grid { grid-template-columns: 1fr; }
}

.foot { margin-top: 26px; font-size: 12px; color: var(--ink-3); display: flex; gap: 8px 18px; flex-wrap: wrap; }

@media (max-width: 960px) {
  .summary { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .dist { grid-column: 1 / -1; }
}
@media (max-width: 560px) {
  .summary { grid-template-columns: 1fr 1fr; }
  .summary .kpi:first-child { grid-column: 1 / -1; }
  .dist-legend { grid-template-columns: 1fr 1fr; }
  .kpi-value { font-size: 24px; }
  .facts { grid-template-columns: 1fr; }
}

/* Phone layout: portrait (<600px wide) and landscape (<500px tall). Board must start near the top. */
.filter-toggle { display: none; }
@media (max-width: 600px), (max-height: 500px) {
  body { padding-block: 0 32px; }
  .bar { padding-block: 8px; gap: 8px; }
  .bar::after, .brand-sub, .today { display: none; }
  .brand { gap: 8px; }
  .brand img { width: 28px; height: 28px; margin: 0; }
  .wordmark { font-size: 14px; }
  .bar-right { gap: 8px; }
  .viewer { font-size: 12px; gap: 6px; }
  .viewer select { padding: 3px 6px; font-size: 12px; }
  .sample-tag { font-size: 10px; padding: 2px 7px; }

  .tabs {
    position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5;
    margin: 0 calc(-1 * clamp(16px, 3vw, 36px)); padding: 6px clamp(16px, 3vw, 36px);
    background: var(--bg); border-bottom: 1px solid var(--line);
    flex-wrap: nowrap; gap: 8px;
  }
  .tab-list { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .tab-list::-webkit-scrollbar { display: none; }
  .tab { padding: 7px 9px; font-size: 13px; white-space: nowrap; flex: none; }
  .tabs .search { flex: 0 1 150px; min-width: 104px; padding: 6px 10px; }

  .summary { margin-top: 10px; gap: 8px; }
  .kpi { padding: 8px 12px; gap: 2px; }
  .kpi-label { font-size: 10px; }
  .kpi-value { font-size: 20px; }
  .kpi-note, .dist, .refs-lbl, .refs-legend { display: none; }
  #kpi-all { flex-direction: row; align-items: center; gap: 12px; min-width: 0; }
  #kpi-all > .kpi-label, #kpi-all > .kpi-value { flex: none; }
  #kpi-all > .kpi-label { flex-direction: column; align-items: flex-start; }
  .refs { flex-wrap: nowrap; overflow-x: auto; margin: 0; padding: 2px 0; border: 0; min-width: 0; flex: 1; scrollbar-width: none; }
  .refs::-webkit-scrollbar { display: none; }
  .ref { flex: none; height: 24px; font-size: 12px; }
  .ref.tier-gold { height: 26px; }
  .ref .medal { width: 18px; height: 18px; }
  .ref.tier-gold .medal { width: 20px; height: 20px; font-size: 11px; }

  .page-head { margin-top: 12px; }
  .page-head h1 { font-size: 18px; }
  .page-head p { font-size: 13px; }

  .toolbar { margin-top: 10px; gap: 8px; }
  .filter-toggle { display: inline-flex; }
  .toolbar > .seg[aria-label="Status"], .toolbar > .owner-filter { display: none; }
  .toolbar.open > .seg[aria-label="Status"], .toolbar.open > .owner-filter { display: flex; width: 100%; order: 5; }
  .toolbar .spacer { display: none; }
  .board-wrap { margin-top: 10px; }
  .board { grid-template-columns: repeat(6, 216px); gap: 8px; }
  .col { padding: 8px; }
  .foot { margin-top: 18px; font-size: 11px; }
}
/* Portrait: Active tile (with pills) on its own row, progressing + stalled below */
@media (max-width: 600px) {
  .summary { grid-template-columns: 1fr 1fr; }
  .summary #kpi-all { grid-column: 1 / -1; }
}
/* Landscape: all three tiles on one row */
@media (max-height: 500px) and (min-width: 601px) {
  .summary { grid-template-columns: minmax(0, 2.6fr) minmax(0, 1fr) minmax(0, 1fr); }
  .summary #kpi-all { grid-column: auto; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* ---- Live app additions (2026-10-20): login, forms, account menu, document links ---- */
.login-wrap { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px;
  background: radial-gradient(circle at 1px 1px, color-mix(in srgb, var(--s3) 22%, transparent) 1px, transparent 0) 0 0 / 14px 14px, var(--bg); }
.login { width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); padding: 28px 24px; display: flex; flex-direction: column; gap: 14px; }
.login::before { content: ""; display: block; height: 4px; margin: -28px -24px 6px; border-radius: 14px 14px 0 0; background: var(--brand-grad); }
.login .brand { margin-bottom: 4px; }
.login h1 { font-size: 18px; margin: 0; }
.login p { margin: 0; color: var(--ink-2); font-size: 13.5px; }
.field { display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; color: var(--ink-2); font-weight: 600; }
.field input, .field select, .field textarea { font: inherit; font-weight: 400; font-size: 14px; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px; width: 100%; }
.field textarea { resize: vertical; min-height: 60px; }
.field input:focus, .field select:focus, .field textarea:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); }
.form-error { color: var(--stall); font-size: 13px; min-height: 1em; }
.btn { color: var(--ink); font-family: inherit; }
.btn.primary { color: #fff; }
.btn.block { width: 100%; padding: 11px 14px; }
.acct { position: relative; }
.acct-btn { display: inline-flex; align-items: center; gap: 7px; background: none; border: 1px solid var(--line); border-radius: 999px; padding: 3px 10px 3px 3px; cursor: pointer; color: var(--ink); font: inherit; font-size: 13px; font-weight: 600; }
.acct-menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); padding: 6px; min-width: 200px; display: flex; flex-direction: column; }
.acct-menu .who { padding: 8px 10px; font-size: 12px; color: var(--ink-3); border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.acct-menu button { text-align: left; background: none; border: 0; padding: 8px 10px; border-radius: 6px; cursor: pointer; font: inherit; font-size: 13.5px; color: var(--ink); }
.acct-menu button:hover { background: var(--surface-2); }
.log-form { display: flex; gap: 8px; flex-wrap: wrap; }
.log-form input { flex: 1 1 200px; font: inherit; font-size: 13.5px; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; min-width: 0; }
.next-form { display: grid; gap: 10px; grid-template-columns: 1fr 1fr; }
.next-form .wide { grid-column: 1 / -1; }
.docs a { color: var(--ink); text-decoration: none; display: inline-flex; align-items: center; gap: 8px; }
.docs a:hover { color: var(--accent); text-decoration: underline; }
.doc-ext { font-family: var(--f-mono); font-size: 10.5px; text-transform: uppercase; color: var(--ink-3); border: 1px solid var(--line); border-radius: 4px; padding: 0 4px; }
.modal-wrap { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; padding: 16px; background: rgba(6, 15, 36, .45); }
.modal { width: 100%; max-width: 440px; background: var(--surface); border-radius: 14px; box-shadow: var(--shadow); padding: 22px; display: flex; flex-direction: column; gap: 12px; max-height: 90vh; overflow: auto; }
.modal h2 { margin: 0; font-size: 17px; }
.modal .row { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.secret { font-family: var(--f-mono); font-size: 16px; background: var(--surface-2); border-radius: 8px; padding: 10px 12px; user-select: all; word-break: break-all; }
.loading { padding: 40px 16px; text-align: center; color: var(--ink-3); }
.status-tag { font-size: 11.5px; color: var(--warn); font-weight: 600; }
.team-pick { display: flex; flex-wrap: wrap; gap: 6px; }
.team-pick label { display: inline-flex; gap: 5px; align-items: center; font-weight: 400; font-size: 13px; color: var(--ink); border: 1px solid var(--line); border-radius: 999px; padding: 3px 9px; }
