/* Live PM Dashboard — BTC high-density wallboard
   Palette locked: obsidian, Bitcoin orange, emerald / amber / red pills. */

:root {
  --bg: #0e0f12;
  --bg-elev: #12141a;
  --panel: #16181d;
  --panel-2: #1b1e25;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.14);
  --orange: #f7931a;
  --orange-dim: rgba(247, 147, 26, 0.16);
  --orange-glow: rgba(247, 147, 26, 0.28);
  --green: #22c55e;
  --green-dim: rgba(34, 197, 94, 0.16);
  --amber: #f59e0b;
  --amber-dim: rgba(245, 158, 11, 0.16);
  --red: #ef4444;
  --red-dim: rgba(239, 68, 68, 0.16);
  --white: #ffffff;
  --slate: #c9d1d9;
  --muted: rgba(255, 255, 255, 0.64);
  --dim: rgba(255, 255, 255, 0.38);
  --radius: 12px;
  --font: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
  --mono: "IBM Plex Mono", "SF Mono", ui-monospace, Menlo, monospace;
  --shadow: 0 0 0 1px var(--line), 0 8px 24px rgba(0, 0, 0, 0.28);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--white); }
html { color-scheme: dark; }
body {
  font-family: var(--font);
  font-size: 13px;
  line-height: 1.4;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: var(--orange); text-decoration: none; }
a:hover { text-decoration: underline; }

.page {
  max-width: 1440px;
  margin: 0 auto;
  padding: 14px 16px 20px;
}

/* Header */
.header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px 16px;
  margin-bottom: 10px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.mark {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--orange);
  color: #1a0f00;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 16px;
  flex: 0 0 auto;
  box-shadow: 0 0 0 3px var(--orange-dim);
}
.brand h1 {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.15;
  color: var(--white);
}
.brand .sub {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 11px;
}
.header-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  justify-content: flex-end;
}
.stamp {
  color: var(--muted);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}
.stamp strong { color: var(--white); font-weight: 600; }

/* Pills */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border-radius: 999px;
  padding: 3px 9px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--muted);
  white-space: nowrap;
  line-height: 1.3;
}
.pill::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex: 0 0 auto;
}
.pill-live, .pill-ok, .pill-open { color: var(--green); background: var(--green-dim); border-color: rgba(34,197,94,0.45); }
.pill-building, .pill-active, .pill-busy { color: var(--orange); background: var(--orange-dim); border-color: rgba(247,147,26,0.5); }
.pill-queued, .pill-waiting { color: var(--amber); background: var(--amber-dim); border-color: rgba(245,158,11,0.45); }
.pill-held, .pill-critical, .pill-high { color: var(--red); background: var(--red-dim); border-color: rgba(239,68,68,0.45); }
.pill-snapshot { color: var(--orange); background: var(--orange-dim); border-color: rgba(247,147,26,0.5); }

/* Banner */
.banner {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-left: 3px solid var(--orange);
  border-radius: var(--radius);
  padding: 8px 12px;
  margin-bottom: 10px;
  box-shadow: var(--shadow);
}
.banner-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 12px;
}
.banner .label {
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--dim);
}
.banner .mode { font-weight: 600; font-size: 13px; }
.banner .swap {
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.45;
  margin: 0;
}
.banner code,
.gate-detail code {
  font-family: var(--mono), ui-monospace, Menlo, Consolas, monospace;
  font-size: 10.5px;
  color: var(--slate);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 1px 6px;
  white-space: nowrap;
}

/* Panels */
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 13px;
  min-width: 0;
  box-shadow: var(--shadow);
}
.kicker {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 8px;
}

/* Program rail */
.rail {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 10px;
}
.program { display: flex; flex-direction: column; gap: 8px; }
.program-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}
.program-id {
  font-family: var(--mono), ui-monospace, Menlo, Consolas, monospace;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--orange);
  line-height: 1.2;
}
.program-name { color: var(--slate); font-size: 12px; font-weight: 600; }
.program-summary {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}
.phases { display: flex; flex-wrap: wrap; gap: 5px; }
.note-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.note-list li {
  color: var(--dim);
  font-size: 11px;
  line-height: 1.35;
  padding-left: 9px;
  border-left: 2px solid var(--line);
}
.program-critical { border-color: rgba(247,147,26,0.35); }
.program-held { opacity: 0.92; }

/* Mid row */
.mid {
  display: grid;
  grid-template-columns: 1.05fr 1.15fr;
  gap: 10px;
  margin-bottom: 10px;
}
.kpi-row {
  display: flex;
  align-items: flex-end;
  gap: 16px;
  margin-bottom: 8px;
}
.kpi-num {
  font-size: 48px;
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1.05;
  color: var(--white);
  font-variant-numeric: tabular-nums;
}
.kpi-num .slash { color: var(--dim); font-weight: 600; font-size: 32px; }
.kpi-num.target-ok { color: var(--green); }
.kpi-num.has-open { color: var(--red); }
.kpi-cap { color: var(--muted); font-size: 12px; padding-bottom: 4px; }
.definition {
  color: var(--muted);
  font-size: 12px;
  margin: 0 0 10px;
}
.trend-empty {
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  background: repeating-linear-gradient(
    -45deg,
    transparent,
    transparent 6px,
    rgba(255,255,255,0.02) 6px,
    rgba(255,255,255,0.02) 12px
  );
  padding: 14px 12px;
  color: var(--dim);
  font-size: 11px;
  min-height: 88px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
}
.trend-empty strong { color: var(--slate); font-weight: 600; }

/* Gates */
.gates { display: flex; flex-direction: column; gap: 8px; }
.gate {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 10px;
}
.gate-critical { border-left: 3px solid var(--red); }
.gate-high { border-left: 3px solid var(--amber); }
.gate-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 8px;
  margin-bottom: 4px;
}
.gate-title { font-weight: 600; font-size: 13px; }
.gate-id, .gate-program {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--dim);
}
.gate-detail { margin: 0; color: var(--muted); font-size: 11.5px; }

/* Fleet */
.fleet-wrap {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 10px;
  margin-bottom: 10px;
}
.bots {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.bot {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 10px;
  min-width: 0;
}
.bot-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 6px;
  margin-bottom: 4px;
}
.bot-name { font-weight: 600; font-size: 13px; }
.bot-role { color: var(--dim); font-size: 10px; text-transform: uppercase; letter-spacing: 0.06em; }
.bot-assign { margin: 4px 0 0; color: var(--muted); font-size: 11.5px; }
.bot-slots { color: var(--dim); font-size: 10px; font-family: var(--mono); }

.constraint {
  border-color: rgba(239, 68, 68, 0.35);
  background:
    linear-gradient(180deg, rgba(239,68,68,0.08), transparent 42%),
    var(--panel);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.constraint h2 { margin: 0; font-size: 15px; letter-spacing: -0.02em; }
.constraint p { margin: 0; color: var(--muted); font-size: 12px; }

.footer {
  color: var(--dim);
  font-size: 10px;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 6px 16px;
  padding: 2px 2px 0;
}
.error {
  border: 1px solid rgba(239,68,68,0.45);
  background: var(--red-dim);
  color: var(--white);
  border-radius: var(--radius);
  padding: 12px;
}

/* Responsive */
@media (max-width: 1100px) {
  .rail { grid-template-columns: repeat(2, 1fr); }
  .mid, .fleet-wrap { grid-template-columns: 1fr; }
  .bots { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .page { padding: 10px 10px 16px; }
  .rail, .bots { grid-template-columns: 1fr; }
  .kpi-num { font-size: 40px; }
  .brand h1 { font-size: 16px; }
  .header-meta { justify-content: flex-start; }
}
@media (min-width: 1280px) {
  .page { padding: 16px 20px 24px; }
  .note-list li { font-size: 11px; }
}
