/* The intranet's one shared stylesheet.
   Two tokens are the tenant's, not the design's: --brand-accent (config brand.accent) and --brand-font
   (config brand.font). /app.js sets both on :root from GET /api/tenant before the shell mounts; the
   fallbacks below are the neutral defaults a tenant that has set neither still renders with.
   Dark-only by decision (PLAN.md §8). Tokens first; components below; nothing page-specific here.
   Rules (agent-era-design): hairline panels, mono uppercase labels, tabular numerals, three type
   sizes, brand red only where a number is the story, semantic color only on data and always doubled
   by a word. No colored card edges. No motion beyond focus/hover. */

:root {
  color-scheme: dark;
  --ground: #0e0b0c;
  --ground2: #120f10;
  --panel: #1b1618;
  --panel2: #262022;
  --line: #3b3234;
  --line2: #52474a;
  --text: #f4f0ee;
  --dim: #ddd6d2;
  --mute: #b9b0ac;
  --faint: #8c827e;
  --red: var(--brand-accent, #2563eb);
  --green: #35d399;
  --amber: #f5a623;
  --cyan: #4cc4f0;
  --good: var(--green);
  --watch: var(--amber);
  --bad: var(--red);
  --unknown: var(--mute);
  --action: var(--cyan);
  --mono: ui-monospace, 'SF Mono', SFMono-Regular, Menlo, Consolas, monospace;
  --sans: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --fs-s: 13px;
  --fs-m: 16px;
  --fs-l: 32px;
  --fs-xl: 44px;
  --rail: 224px;
  --top: 60px;
  --gap: 16px;
  --pad: 22px;
  --radius: 6px;
}

* {
  box-sizing: border-box;
}
html {
  background: var(--ground);
}
body {
  margin: 0;
  background: var(--ground);
  color: var(--text);
  font: var(--fs-m)/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
  font-variant-numeric: tabular-nums;
}
a {
  color: inherit;
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}
:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
  border-radius: 2px;
}
button {
  font: inherit;
  color: inherit;
}
h1,
h2,
h3 {
  margin: 0;
  font-weight: 500;
  letter-spacing: -0.01em;
  text-wrap: balance;
}
h1 {
  font-size: 26px;
}
h2 {
  font-size: 18px;
  color: var(--text);
}
h3 {
  font-size: 16px;
  color: var(--dim);
}
p {
  margin: 0;
}
code,
.mono {
  font-family: var(--mono);
}
.skip {
  position: absolute;
  left: -999px;
  top: 8px;
  background: var(--panel2);
  padding: 6px 10px;
  z-index: 50;
}
.skip:focus {
  left: 8px;
}
[hidden] {
  display: none !important;
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition: none !important;
    animation: none !important;
  }
}

/* ---------- shell: rail + frame ---------- */
.rail {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--rail);
  background: var(--ground2);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  padding: 16px 12px;
  gap: 6px;
  z-index: 20;
}
.rail .brand {
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 6px 10px 16px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 8px;
  line-height: 1;
}
.rail .brand:hover {
  text-decoration: none;
}
.rail .brand .logo {
  height: 22px;
  width: auto;
  display: block;
}
.rail .brand .brandname {
  font-family: var(--brand-font, system-ui), system-ui, sans-serif;
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.03em;
  color: var(--text);
}
.rail .brand .brandsub {
  font: 11px var(--mono);
  color: var(--faint);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.rail a.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-radius: var(--radius);
  color: var(--dim);
  font-size: 16px;
}
.rail a.nav:hover {
  background: var(--panel);
  text-decoration: none;
  color: var(--text);
}
.rail a.nav[aria-current='page'] {
  background: var(--panel2);
  color: var(--text);
}
/* attention dot: subtle but unmistakable — a section holds something newer than you last looked (CONTRACTS §R). Hidden until shown; [hidden] above wins. */
.rail a.nav .attn-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--action);
  flex: 0 0 auto;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--action) 22%, transparent);
}
.rail .nav .count {
  font: 11px var(--mono);
  color: var(--red);
}
/* Rail bottom-left Account block (CONTRACTS §Y): a round initials avatar, the person's name, and the
   live clock line beneath it — the whole block links to /settings.html. "Legacy view" stays as a small
   secondary link below. Tokens only, to match the rail. */
.rail .foot {
  margin-top: auto;
  padding: 10px 4px 0;
  border-top: 1px solid var(--line);
  display: grid;
  gap: 6px;
}
.rail .acct {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 8px;
  border-radius: var(--radius);
  color: var(--dim);
  min-width: 0;
}
.rail .acct:hover {
  background: var(--panel);
  text-decoration: none;
  color: var(--text);
}
.rail .acct .acct-avatar {
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--panel2);
  border: 1px solid var(--line2);
  color: var(--text);
  font: 12px var(--mono);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.rail .acct .acct-meta {
  display: grid;
  gap: 1px;
  min-width: 0;
}
.rail .acct .acct-name {
  font-size: 14px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rail .acct .acct-clock {
  font: 11px var(--mono);
  color: var(--faint);
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.rail .foot-legacy {
  font: 11px var(--mono);
  color: var(--faint);
  padding: 0 8px;
  letter-spacing: 0.04em;
}
.rail .foot-legacy:hover {
  color: var(--mute);
}

/* Compact density (CONTRACTS §Y): a modestly tighter grid + panels for people who prefer more on screen. */
html.density-compact {
  --gap: 11px;
  --pad: 16px;
}
html.density-compact .panel {
  padding: 13px 15px;
}

.frame {
  margin-left: var(--rail);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.top {
  position: sticky;
  top: 0;
  z-index: 10;
  background: color-mix(in srgb, var(--ground) 92%, transparent);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--line);
  padding: 10px var(--pad);
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: var(--top);
  flex-wrap: nowrap;
}
.top h1 {
  font-size: 20px;
  font-weight: 600;
  white-space: nowrap;
  flex: 0 0 auto;
}
.top .subnav {
  display: flex;
  gap: 2px;
  flex-wrap: wrap;
  flex: 1 1 auto;
  min-width: 0;
}
.top .subnav a {
  white-space: nowrap;
}
.top .subnav a {
  padding: 7px 12px;
  border-radius: var(--radius);
  color: var(--dim);
  font-size: 15px;
}
.top .subnav a:hover {
  color: var(--text);
  background: var(--panel);
  text-decoration: none;
}
.top .subnav a[aria-current='true'] {
  color: var(--text);
  background: var(--panel2);
}
.top .right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: nowrap;
  flex: 0 0 auto;
  justify-content: flex-end;
}
.freshness {
  font: 12px var(--mono);
  color: var(--dim);
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.freshness.stale {
  color: var(--amber);
}
.freshness.dead {
  color: var(--red);
}
.needs-badge {
  font: 12px var(--mono);
  padding: 4px 10px;
  border: 1px solid var(--line2);
  border-radius: 12px;
  color: var(--dim);
  background: var(--panel);
}
.needs-badge[data-n='0'] {
  color: var(--faint);
}
.needs-badge:not([data-n='0']) {
  border-color: var(--red);
  color: var(--text);
}

/* Top-bar watch pill (CONTRACTS §0) — the AI Watcher's newest verdict, glanceable on every page. Same
   family as .ai-pill (tinted ground + matching edge + leading dot in the solid tone) but header-chip sized
   so it sits beside the freshness text and action-items badge without dwarfing them. --tone carries the
   semantic token so the base rule is written once; tones only reassign it (and color the label). */
.watch-pill {
  --tone: var(--unknown);
  display: inline-flex;
  align-items: center;
  gap: 7px;
  line-height: 1;
  white-space: nowrap;
  font: 12px var(--mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 4px 11px;
  border-radius: 999px;
  color: var(--dim);
  border: 1px solid color-mix(in srgb, var(--tone) 40%, var(--line2));
  background: color-mix(in srgb, var(--tone) 14%, var(--panel));
  transition:
    background 0.15s ease,
    border-color 0.15s ease,
    color 0.15s ease,
    opacity 0.15s ease;
}
.watch-pill > i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--tone);
  flex: 0 0 auto;
}
.watch-pill.good {
  --tone: var(--good);
  color: var(--green);
}
.watch-pill.watch {
  --tone: var(--watch);
  color: var(--amber);
}
.watch-pill.bad {
  --tone: var(--bad);
  color: var(--red);
}
.watch-pill.unknown {
  --tone: var(--unknown);
  color: var(--mute);
}
.watch-pill:hover {
  text-decoration: none;
  background: color-mix(in srgb, var(--tone) 22%, var(--panel));
  border-color: color-mix(in srgb, var(--tone) 55%, var(--line2));
}
.watch-pill.stale {
  opacity: 0.7;
} /* a quiet run: last thing we heard, dimmed — not a live promise */
.watch-pill:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
}
.watch-pill .wc {
  font: 12px var(--mono);
  color: var(--text);
  opacity: 0.85;
  text-transform: none;
}
.watch-pill .wc::before {
  content: '·';
  margin: 0 4px 0 1px;
  opacity: 0.55;
}
.btn {
  background: var(--panel);
  border: 1px solid var(--line2);
  border-radius: var(--radius);
  padding: 6px 12px;
  font-size: 14px;
  cursor: pointer;
  color: var(--text);
}
.btn:hover {
  background: var(--panel2);
  color: var(--text);
}
.btn:disabled {
  opacity: 0.5;
  cursor: default;
}
.btn.primary {
  border-color: var(--red);
  color: var(--text);
}
.btn.small {
  padding: 3px 9px;
  font-size: 13px;
}
.btn.action {
  border-color: var(--action);
  color: var(--text);
}
.btn kbd {
  font: 10px var(--mono);
  color: var(--faint);
  margin-left: 6px;
}

main.page {
  padding: var(--pad);
  display: grid;
  gap: var(--gap);
  align-content: start;
}
main.page > section[data-view] {
  display: grid;
  gap: var(--gap);
  align-content: start;
}

/* ---------- mobile: bottom bar ---------- */
@media (max-width: 900px) {
  :root {
    --rail: 0px;
    --pad: 12px;
  }
  .rail {
    inset: auto 0 0 0;
    width: auto;
    height: 58px;
    flex-direction: row;
    padding: 4px 6px;
    gap: 0;
    border-right: 0;
    border-top: 1px solid var(--line);
    overflow-x: auto;
  }
  .rail .brand,
  .rail .foot {
    display: none;
  }
  .rail a.nav {
    flex: 1 0 auto;
    justify-content: center;
    font-size: 12px;
    padding: 8px 6px;
  }
  .frame {
    margin-left: 0;
    padding-bottom: 66px;
  }
  .top {
    position: static;
    flex-wrap: wrap;
  }
  .top .subnav {
    width: 100%;
    overflow-x: auto;
    flex-wrap: nowrap;
  }
}

/* ---------- layout primitives ---------- */
.grid {
  display: grid;
  gap: var(--gap);
}
.grid.c2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.grid.c3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.grid.c4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
.grid.c6 {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}
.grid.auto {
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
}
@media (max-width: 1200px) {
  .grid.c6 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .grid.c4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 700px) {
  .grid.c2,
  .grid.c3,
  .grid.c4,
  .grid.c6 {
    grid-template-columns: 1fr 1fr;
  }
  .grid.c3.stack {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 640px) {
  .grid.c2,
  .grid.c3,
  .grid.c4,
  .grid.c6 {
    grid-template-columns: 1fr;
  }
}
.row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.row .spacer {
  flex: 1;
}
.scroll {
  overflow-x: auto;
  max-width: 100%;
}

/* ---------- panels ---------- */
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
  min-width: 0;
}
.panel > h2 {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: -2px 0 12px;
}
.panel > h2 .k {
  margin-left: auto;
}
.panel.quiet {
  background: transparent;
}
.panel.band {
  padding: 16px 18px;
}
.band-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 12px;
}
.band-head h2 {
  color: var(--text);
  font-weight: 600;
}
.band-head h2 {
  font-size: 20px;
}
.band-head .judgement {
  color: var(--dim);
  font-size: 15px;
}
.band-head a.more {
  margin-left: auto;
  font: 12px var(--mono);
  color: var(--cyan);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* ---------- labels, values, tiles ---------- */
.k {
  font: 12px var(--mono);
  color: var(--dim);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.v {
  font-size: var(--fs-l);
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.15;
}
.v.xl {
  font-size: var(--fs-xl);
}
.v.hero {
  color: var(--red);
}
.sub {
  font-size: 14px;
  color: var(--dim);
}
.v.good {
  color: var(--green);
}
.v.bad {
  color: var(--red);
}
.v.watch {
  color: var(--amber);
}
.v.action {
  color: var(--cyan);
}
.tile {
  display: grid;
  gap: 6px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  min-width: 0;
}
.tile .v {
  margin-top: 2px;
}
.tile .delta {
  font: 12px var(--mono);
  color: var(--mute);
}
a.tile:hover {
  border-color: var(--line2);
  background: var(--panel2);
  text-decoration: none;
}
a.tile {
  cursor: pointer;
}
.tile .delta.up {
  color: var(--green);
}
.tile .delta.down {
  color: var(--red);
}
.tile.hot .v {
  color: var(--red);
}
.tile a {
  display: block;
}

/* status chips — color is always doubled by the word */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font: 12px var(--mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--dim);
  padding: 2px 8px;
  border: 1px solid var(--line2);
  border-radius: 10px;
  white-space: nowrap;
}
.chip::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--unknown);
}
.chip.good::before {
  background: var(--good);
}
.chip.watch::before {
  background: var(--watch);
}
.chip.bad::before {
  background: var(--bad);
}
.chip.off::before {
  background: var(--faint);
}
.chip.on::before {
  background: var(--cyan);
}
.chip.action {
  border-color: var(--cyan);
  color: var(--cyan);
}
.chip.action::before {
  background: var(--cyan);
}
.chip.good.solid {
  border-color: var(--green);
  color: var(--green);
}
.chip.bad.solid {
  border-color: var(--red);
  color: var(--red);
}
.dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--unknown);
  vertical-align: middle;
  margin-right: 6px;
}
.dot.good {
  background: var(--good);
}
.dot.watch {
  background: var(--watch);
}
.dot.bad {
  background: var(--bad);
}
.t-good {
  color: var(--good);
}
.t-watch {
  color: var(--watch);
}
.t-bad {
  color: var(--bad);
}
.t-mute {
  color: var(--mute);
}
.t-red {
  color: var(--red);
}
.t-action {
  color: var(--cyan);
}

/* ---------- standing reads (the six-line brief format) ---------- */
.reads {
  display: grid;
  gap: 0;
  border-top: 1px solid var(--line);
}
.read {
  display: grid;
  grid-template-columns: 22px 1fr auto;
  gap: 10px;
  align-items: baseline;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  font-size: 16px;
}
.read .label {
  font-weight: 500;
}
.read .note {
  grid-column: 2 / span 2;
  color: var(--dim);
  font-size: 14px;
}
.read .val {
  font-family: var(--mono);
  font-size: 14px;
  color: var(--text);
}
.status-line {
  font-size: 15px;
  color: var(--text);
  padding: 10px 12px;
  border-left: 0;
  background: var(--panel2);
  border-radius: var(--radius);
}

/* ---------- tables ---------- */
table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
}
table.data th {
  text-align: left;
  font: 12px var(--mono);
  color: var(--dim);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 6px 8px;
  border-bottom: 1px solid var(--line2);
  white-space: nowrap;
}
table.data td {
  padding: 10px 8px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
table.data tr:last-child td {
  border-bottom: 0;
}
table.data td.n,
table.data th.n {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
table.data tr.dim td {
  color: var(--mute);
}
table.data tr:hover td {
  background: var(--panel2);
}
table.data td .sub {
  display: block;
}
table.data .bar {
  margin-top: 4px;
}

/* ---------- bars, funnels, sparklines ---------- */
.bar {
  position: relative;
  height: 10px;
  background: var(--line);
  border-radius: 5px;
  overflow: hidden;
}
.bar > i {
  position: absolute;
  inset: 0 auto 0 0;
  background: var(--dim);
  border-radius: 3px;
}
.bar.good > i {
  background: var(--good);
}
.bar.watch > i {
  background: var(--watch);
}
.bar.bad > i {
  background: var(--bad);
}
.bar.red > i {
  background: var(--red);
}
.bar.split > i.b {
  background: var(--amber);
}
.bar.split > i.c {
  background: var(--mute);
}
.bar.action > i {
  background: var(--cyan);
}
.barrow {
  display: grid;
  grid-template-columns: minmax(110px, 1fr) minmax(80px, 3fr) auto;
  gap: 12px;
  align-items: center;
  padding: 6px 0;
  font-size: 15px;
}
.barrow .n {
  font-family: var(--mono);
  font-size: 14px;
  color: var(--text);
  text-align: right;
}
.funnel {
  display: grid;
  gap: 6px;
}
.funnel .step {
  display: grid;
  grid-template-columns: 150px 1fr auto auto;
  gap: 12px;
  align-items: center;
  font-size: 15px;
}
.funnel .step .bar {
  height: 20px;
  border-radius: 3px;
}
.funnel .step .n {
  font-family: var(--mono);
  font-size: 15px;
  text-align: right;
  min-width: 56px;
  color: var(--text);
}
.funnel .step .rate {
  font: 11px var(--mono);
  color: var(--mute);
  min-width: 52px;
  text-align: right;
}
.funnel .step.gated .bar > i {
  background: repeating-linear-gradient(90deg, var(--line2) 0 4px, transparent 4px 8px);
}
svg.spark {
  display: block;
  width: 100%;
  height: 56px;
  overflow: visible;
}
svg.spark .area {
  fill: var(--dim);
  opacity: 0.16;
}
svg.spark .line {
  fill: none;
  stroke: var(--text);
  stroke-width: 2;
}
svg.spark .base {
  stroke: var(--line2);
  stroke-width: 1;
}
svg.spark .end {
  fill: var(--text);
}
svg.spark.red .line {
  stroke: var(--red);
}
svg.spark.red .area {
  fill: var(--red);
}
svg.spark.green .line {
  stroke: var(--green);
}
svg.spark.green .area {
  fill: var(--green);
}
svg.spark.blue .line {
  stroke: var(--cyan);
}
svg.spark.blue .area {
  fill: var(--cyan);
}
svg.spark .ghost {
  fill: none;
  stroke: var(--line2);
  stroke-width: 1.5;
  stroke-dasharray: 3 3;
}
svg.cols {
  display: block;
  width: 100%;
  height: 220px;
}
svg.cols rect {
  fill: var(--cyan);
}
svg.cols rect.y {
  fill: var(--line2);
}
svg.cols text {
  fill: var(--dim);
  font: 15px var(--mono);
}
svg.cols line.base {
  stroke: var(--line2);
}
svg.cols line.grid {
  stroke: var(--line);
}
/* line chart (TK.ui.line) */
svg.chart {
  display: block;
  width: 100%;
  height: 240px;
  overflow: visible;
}
svg.chart text {
  fill: var(--dim);
  font: 15px var(--mono);
}
svg.chart line.grid {
  stroke: var(--line);
}
svg.chart line.base {
  stroke: var(--line2);
}
svg.chart path.s0 {
  fill: none;
  stroke: var(--cyan);
  stroke-width: 3;
}
svg.chart path.a0 {
  fill: var(--cyan);
  opacity: 0.12;
}
svg.chart path.s1 {
  fill: none;
  stroke: var(--mute);
  stroke-width: 2.5;
  stroke-dasharray: 6 5;
}
svg.chart path.s2 {
  fill: none;
  stroke: var(--green);
  stroke-width: 2.5;
}
svg.chart path.s3 {
  fill: none;
  stroke: var(--red);
  stroke-width: 2.5;
}
svg.chart path.s4 {
  fill: none;
  stroke: var(--amber);
  stroke-width: 2.5;
}
svg.chart circle.end {
  fill: var(--text);
}
svg.chart text.endv {
  fill: var(--text);
  font-weight: 600;
  font-size: 17px;
  paint-order: stroke;
  stroke: var(--panel);
  stroke-width: 6px;
  stroke-linejoin: round;
}
.chart-legend {
  display: flex;
  gap: 16px;
  font: 12px var(--mono);
  color: var(--dim);
  margin-top: 6px;
}
.chart-legend i {
  display: inline-block;
  width: 12px;
  height: 3px;
  vertical-align: middle;
  margin-right: 6px;
  border-radius: 2px;
}
.chart-legend i.s0 {
  background: var(--cyan);
}
.chart-legend i.s1 {
  background: var(--mute);
}
.chart-legend i.s2 {
  background: var(--green);
}
.chart-legend i.s3 {
  background: var(--red);
}
.chart-legend i.s4 {
  background: var(--amber);
}
/* labeled horizontal bar chart (TK.ui.hbars) */
.hbars {
  display: grid;
  gap: 8px;
}
.hbars .hb {
  display: grid;
  grid-template-columns: minmax(150px, 1.4fr) minmax(80px, 3fr) auto;
  gap: 12px;
  align-items: center;
  font-size: 15px;
}
.hbars .hb .n {
  font: 14px var(--mono);
  color: var(--text);
  text-align: right;
  white-space: nowrap;
}
.hbars .hb > span:first-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------- lists ---------- */
.needs {
  display: grid;
  gap: 0;
}
.needs a.item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 14px;
  align-items: baseline;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.needs a.item:hover {
  text-decoration: none;
  background: var(--panel2);
  margin: 0 -8px;
  padding: 10px 8px;
}
.needs .kind {
  font: 12px var(--mono);
  color: var(--cyan);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  min-width: 96px;
}
.needs .title {
  color: var(--text);
  font-size: 16px;
}
.needs .detail {
  color: var(--dim);
  font-size: 14px;
  display: block;
}
.needs .when {
  font: 11px var(--mono);
  color: var(--faint);
  white-space: nowrap;
}
.feed {
  display: grid;
  gap: 0;
}
.feed .ev {
  display: grid;
  grid-template-columns: 90px 1fr;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
  font-size: 15px;
}
.feed .ev time {
  font: 11px var(--mono);
  color: var(--faint);
}
.kv {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 6px 18px;
  font-size: 15px;
}
.kv dt {
  color: var(--mute);
}
.kv dd {
  margin: 0;
}

/* ---------- gates, empties, skeletons ---------- */
.gate {
  border: 1px dashed var(--line2);
  border-radius: var(--radius);
  padding: 18px 20px;
  display: grid;
  gap: 8px;
  background: transparent;
}
.gate .k {
  color: var(--amber);
}
.gate h3 {
  font-size: 15px;
  font-weight: 500;
}
.gate p {
  color: var(--dim);
  font-size: 15px;
  max-width: 64ch;
}
.gate code {
  font-size: 12px;
  background: var(--panel2);
  padding: 1px 5px;
  border-radius: 3px;
}
.gate .unlocks {
  color: var(--dim);
}
.empty {
  color: var(--mute);
  font-size: 15px;
  padding: 20px 0;
  text-align: center;
}
.error {
  color: var(--amber);
  font-size: 13px;
  padding: 10px 12px;
  border: 1px solid var(--line2);
  border-radius: var(--radius);
}
.skel {
  display: grid;
  gap: 8px;
}
.skel i {
  display: block;
  height: 12px;
  background: var(--panel2);
  border-radius: 3px;
}
.skel i:nth-child(2) {
  width: 70%;
}
.skel i:nth-child(3) {
  width: 45%;
}
.note {
  font-size: 14px;
  color: var(--dim);
  max-width: 72ch;
}
.hint {
  font: 12px var(--mono);
  color: var(--mute);
  letter-spacing: 0.02em;
}

/* ---------- forms (Outreach controls, template editor, search) ---------- */
input,
select,
textarea {
  background: var(--ground2);
  border: 1px solid var(--line2);
  border-radius: var(--radius);
  color: var(--text);
  font: inherit;
  padding: 6px 8px;
}
input:focus,
select:focus,
textarea:focus {
  border-color: var(--cyan);
  outline: none;
}
label.field {
  display: grid;
  gap: 4px;
  font-size: 13px;
  color: var(--mute);
}
.toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

/* ---------- command palette ---------- */
.palette {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 100;
  display: grid;
  place-items: start center;
  padding-top: 12vh;
}
.palette .box {
  width: min(640px, 92vw);
  background: var(--panel);
  border: 1px solid var(--line2);
  border-radius: 6px;
  overflow: hidden;
}
.palette input {
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  padding: 14px 16px;
  font-size: 16px;
  background: transparent;
}
.palette ul {
  list-style: none;
  margin: 0;
  padding: 6px;
  max-height: 50vh;
  overflow: auto;
}
.palette li {
  padding: 8px 10px;
  border-radius: var(--radius);
  display: flex;
  gap: 10px;
  align-items: baseline;
  cursor: pointer;
}
.palette li[aria-selected='true'],
.palette li:hover {
  background: var(--panel2);
}
.palette li .k {
  min-width: 80px;
}
.palette li .path {
  margin-left: auto;
  font: 11px var(--mono);
  color: var(--faint);
}

/* ---------- click map (Website Analytics) ---------- */
.wire {
  display: grid;
  gap: 4px;
}
.wire .sec {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 10px 12px;
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--ground2);
  overflow: hidden;
}
.wire .sec .k {
  flex: 1;
  letter-spacing: 0.04em;
  text-transform: none;
}
.wire .sec .n {
  font: 14px var(--mono);
  color: var(--text);
}
.wire .sec .heat {
  position: absolute;
  inset: 0;
  background: var(--red);
  opacity: 0;
  pointer-events: none;
}
.wire .sec.off {
  opacity: 0.45;
}
.wire .sec .pt {
  position: absolute;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--red);
  opacity: 0.7;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

/* ---------- "new since you last looked" strip + row highlight (CONTRACTS §U) ---------- */
/* The shell inserts .attn-strip between the header and the page content on arrival, listing the Action
   Items that are new since the viewer last opened this section. Blue = action, per the shell doctrine. */
.attn-strip {
  border-bottom: 1px solid var(--line);
  border-left: 3px solid var(--action);
  background: color-mix(in srgb, var(--action) 7%, var(--ground2));
  padding: 12px var(--pad) 12px calc(var(--pad) - 3px);
  display: grid;
  gap: 8px;
}
.attn-strip-head {
  display: flex;
  align-items: center;
  gap: 12px;
}
.attn-strip-title {
  font: 12px var(--mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--action);
}
.attn-strip-x {
  margin-left: auto;
  background: transparent;
  border: 0;
  padding: 2px 6px;
  font: 12px var(--mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--mute);
  cursor: pointer;
}
.attn-strip-x:hover {
  color: var(--text);
  text-decoration: underline;
}
.attn-strip-x:focus-visible {
  outline: 2px solid var(--action);
  outline-offset: 1px;
}
.attn-strip-list {
  display: grid;
  gap: 2px;
}
.attn-strip-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 12px;
  align-items: baseline;
  padding: 6px 8px;
  border-radius: var(--radius);
  min-width: 0;
}
.attn-strip-item:hover {
  background: var(--panel2);
  text-decoration: none;
}
.attn-strip-item .asi-title {
  color: var(--text);
  font-size: 15px;
  min-width: 0;
  overflow-wrap: anywhere;
}
.attn-strip-item .asi-detail {
  grid-column: 1;
  color: var(--mute);
  font-size: 13px;
  overflow-wrap: anywhere;
}
.attn-strip-item .asi-when {
  grid-row: 1;
  grid-column: 2;
  font: 11px var(--mono);
  color: var(--faint);
  white-space: nowrap;
}
.attn-strip-note {
  font-size: 12px;
  color: var(--mute);
}

/* a row/card that is new since your last visit: soft blue outline + a "NEW" chip on its top edge. Added
   by TK.markNew() to any [data-key] that matches an item new since the last visit. `tk-new` (not `is-new`)
   so it never collides with a page's own is-new styling (e.g. a lead card whose status is 'new'). */
.tk-new {
  position: relative;
  outline: 2px solid color-mix(in srgb, var(--action) 55%, transparent);
  outline-offset: 2px;
  border-radius: var(--radius);
}
tr.tk-new .tk-new-chip {
  position: static;
  display: inline-block;
  margin-left: 8px;
  vertical-align: 2px;
  box-shadow: none;
}
.tk-new-chip {
  position: absolute;
  top: -9px;
  right: 10px;
  z-index: 3;
  font: 10px/1.6 var(--mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ground);
  background: var(--action);
  padding: 0 7px;
  border-radius: 8px;
  box-shadow: 0 0 0 2px var(--ground);
  pointer-events: none;
}

/* ---------- misc ---------- */
.pill-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.divider {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 4px 0;
}
.right {
  text-align: right;
}
.nowrap {
  white-space: nowrap;
}
.muted {
  color: var(--mute);
}
.small {
  font-size: var(--fs-s);
}
details > summary {
  cursor: pointer;
  color: var(--dim);
  font-size: 15px;
}
pre.code {
  background: var(--ground2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 12px;
  font: 12px/1.5 var(--mono);
  overflow-x: auto;
}
