/* ============================================================
   Outreach — operations console
   Palette: #000000 · #CB2957 · #DDDDDD · #EEEEEE
   Black surfaces, one raspberry accent, white-alpha for depth.
   ============================================================ */

:root {
  --bg: #000000;
  --bg-glow: radial-gradient(75% 55% at 72% -12%, rgba(203, 41, 87, 0.10), transparent), #000000;

  --panel: #0a0a0a;
  --panel-2: #141414;
  --panel-3: #1c1c1c;

  --line: rgba(221, 221, 221, 0.14);
  --line-strong: rgba(221, 221, 221, 0.30);

  --text: #eeeeee;
  --muted: #dddddd;
  --faint: rgba(238, 238, 238, 0.45);

  --accent: #cb2957;
  --accent-bright: #e04a75;
  --accent-soft: rgba(203, 41, 87, 0.16);

  --white-soft: rgba(238, 238, 238, 0.10);
  --gray-soft: rgba(221, 221, 221, 0.06);

  --font-sans: "Avenir Next", "Segoe UI", "Helvetica Neue", system-ui, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "Cascadia Code", "JetBrains Mono", Menlo, Consolas, monospace;

  --radius: 10px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font-sans);
  background: var(--bg-glow);
  background-attachment: fixed;
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 2px;
}

::selection { background: rgba(203, 41, 87, 0.40); }

/* ---------- Shell ---------- */

.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: 232px;
  flex-shrink: 0;
  background: var(--panel);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  padding: 20px 14px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px 16px;
  flex-wrap: wrap;
  padding: 16px 28px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
  background: color-mix(in srgb, var(--panel) 82%, transparent);
  backdrop-filter: blur(6px);
}

.topbar h1 {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 18px;
  font-weight: 600;
  margin: 0;
  letter-spacing: -0.01em;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-shrink: 0;
}

.user-pill {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted);
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 14px;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.content { padding: 28px; width: 100%; }

/* ---------- Sidebar ---------- */

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 2px 8px 22px;
}

.roundel {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--accent);
  color: #ffffff;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.brand-name {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
}

.brand-name strong {
  font-size: 13px;
  letter-spacing: 0.14em;
  font-weight: 700;
}

.brand-sub {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--faint);
  letter-spacing: 0.04em;
}

.sidebar nav {
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1;
}

.nav-label {
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--faint);
  padding: 16px 12px 8px;
}

.sidebar nav a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  text-decoration: none;
  padding: 9px 12px;
  border-radius: 8px;
  font-size: 13.5px;
}

.sidebar nav a:hover { background: var(--panel-2); color: var(--text); }

.sidebar nav a.active {
  background: var(--accent);
  color: #ffffff;
}

.nav-count {
  font-family: var(--font-mono);
  font-size: 11px;
  background: var(--accent);
  color: #ffffff;
  border-radius: 999px;
  padding: 1px 8px;
  min-width: 22px;
  text-align: center;
}

.sidebar-foot { padding: 10px 8px 0; }

.env-pill {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--faint);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 12px;
}

/* ---------- Dashboard ---------- */

.decision {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
  background: linear-gradient(105deg, var(--accent-soft), var(--panel));
  border: 1px solid var(--line-strong);
  border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent);
  border-radius: var(--radius);
  padding: 24px 28px;
  margin-bottom: 20px;
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--accent-bright);
  display: flex;
  align-items: center;
  gap: 8px;
}

.eyebrow .live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
}

.decision-num {
  font-family: var(--font-mono);
  font-size: 44px;
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.02em;
  color: var(--accent);
  margin-top: 6px;
}

.decision p {
  color: var(--muted);
  margin: 4px 0 0;
  font-size: 13.5px;
}

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

.stat {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
}

.stat-value {
  font-family: var(--font-mono);
  font-size: 22px;
  font-weight: 600;
  color: var(--text);
}

.stat-label {
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--faint);
  margin-top: 2px;
}

.stat-value.is-amber { color: var(--accent); }
.stat-value.is-green { color: var(--muted); }
.stat-value.is-red { color: var(--accent-bright); }

/* ---------- Panels ---------- */

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 24px;
  overflow: hidden;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
}

.panel-head h2 {
  font-size: 13px;
  font-weight: 600;
  margin: 0;
  letter-spacing: 0.01em;
}

.panel-head .panel-note {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--faint);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

/* ---------- Tables (timetables) ---------- */

.table-wrap { overflow-x: auto; }

.table { width: 100%; border-collapse: collapse; }

.table th, .table td {
  text-align: left;
  padding: 11px 18px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

.table th {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--faint);
}

.table tbody tr { transition: background 0.12s ease; }

.table tbody tr:hover { background: var(--panel-2); }

.table tbody tr:last-child td { border-bottom: none; }

.td-right { text-align: right; }

.td-error {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--accent-bright);
}

.td-empty {
  color: var(--faint);
  text-align: center;
  padding: 30px 18px;
  font-size: 13.5px;
}

.td-empty strong { color: var(--muted); font-weight: 500; }

.link { color: var(--accent-bright); text-decoration: none; }
.link:hover { text-decoration: underline; color: #f26890; }

/* ---------- Badges (station states) ---------- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.08em;
  border-radius: 999px;
  padding: 3px 11px 3px 9px;
  border: 1px solid transparent;
}

.badge::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.badge-requested { color: var(--faint); background: transparent; border-color: var(--line); }
.badge-active { color: var(--accent-bright); background: var(--accent-soft); }
.badge-approval { color: #ffffff; background: var(--accent); }
.badge-running { color: var(--text); background: var(--white-soft); }
.badge-done { color: var(--muted); background: var(--gray-soft); }
.badge-failed { color: var(--accent-bright); background: transparent; border-color: var(--accent); }
.badge-suppressed { color: var(--faint); background: var(--gray-soft); }

/* ---------- Filters / pager ---------- */

.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }

.chip {
  text-decoration: none;
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 0.03em;
  border-radius: 8px;
  padding: 7px 14px;
  border: 1px solid var(--line);
  transition: border-color 0.12s ease, background 0.12s ease;
}

.chip-off { color: var(--muted); background: var(--panel); }
.chip-off:hover { border-color: var(--line-strong); color: var(--text); }
.chip-on { color: #ffffff; background: var(--accent); border-color: var(--accent); }

.pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 16px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--faint);
}

.hint {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.06em;
  color: var(--faint);
  text-transform: uppercase;
}

/* ---------- Buttons ---------- */

.btn {
  border: 1px solid var(--line-strong);
  background: var(--panel-2);
  color: var(--text);
  border-radius: 8px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  transition: filter 0.12s ease, transform 0.12s ease;
}

.btn:hover { filter: brightness(1.25); }

.btn:active { transform: translateY(1px); }

.btn-primary { background: var(--accent); border-color: var(--accent); color: #ffffff; font-weight: 600; }

.btn-danger { background: transparent; border-color: var(--accent); color: var(--accent-bright); font-weight: 600; }

.btn-ghost { background: transparent; color: var(--muted); }

.btn-block { width: 100%; }

/* ---------- Alerts ---------- */

.alert {
  border-radius: 8px;
  padding: 11px 16px;
  margin-bottom: 18px;
  font-size: 13px;
  border: 1px solid;
}

.alert-error { background: var(--accent-soft); color: #f26890; border-color: var(--accent); border-color: color-mix(in srgb, var(--accent) 45%, transparent); }

.alert-info { background: var(--white-soft); color: var(--text); border-color: var(--line-strong); }

/* ---------- Login ---------- */

.login-wrap {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 22px;
  background: var(--bg-glow);
  background-attachment: fixed;
}

.login-card {
  width: 360px;
  max-width: calc(100vw - 32px);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 30px 28px;
}

.login-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin-bottom: 6px;
}

.login-brand .roundel { width: 44px; height: 44px; font-size: 20px; }

.login-sub {
  color: var(--muted);
  text-align: center;
  font-size: 13.5px;
  margin: 0 0 24px;
}

.login-card label {
  display: block;
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--faint);
  margin: 14px 0 6px;
}

.login-card input {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 14px;
  font-family: var(--font-sans);
}

.login-card input:focus { outline: none; border-color: var(--accent); }

.login-card .btn { margin-top: 22px; }

.login-foot {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.08em;
  color: var(--faint);
  text-transform: uppercase;
}

/* ---------- Metro line (the state machine) ---------- */

.metro { overflow-x: auto; padding-bottom: 4px; }

.metro-line {
  display: flex;
  min-width: 760px;
  padding: 26px 20px 18px;
}

.metro-station {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.metro-station::before {
  content: "";
  position: absolute;
  top: 7px;
  left: 50%;
  right: -50%;
  height: 2px;
  background: var(--line);
}

.metro-station:last-child::before { display: none; }

.metro-dot {
  position: relative;
  z-index: 1;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--line-strong);
}

.metro-code {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  color: var(--faint);
}

/* line segments carry progress */

.metro-station.tl-done::before { background: var(--accent); }
.metro-station.tl-current::before { background: var(--line); }
.metro-station.tl-failed::before { background: var(--accent); }

.metro-station.tl-done .metro-dot { background: var(--accent); border-color: var(--accent); }

.metro-station.tl-current .metro-dot {
  background: var(--accent-bright);
  border-color: var(--accent);
}

.metro-station.tl-current .metro-code { color: var(--text); font-weight: 700; }

.metro-station.tl-failed .metro-dot { background: var(--bg); border-color: var(--accent); }
.metro-station.tl-failed .metro-code { color: var(--accent-bright); font-weight: 700; }

.metro-station.tl-done .metro-code { color: var(--muted); }

.metro-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  padding: 12px 20px 16px;
  border-top: 1px solid var(--line);
}

.metro-legend span {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  color: var(--faint);
}

.metro-legend b { color: var(--muted); font-weight: 500; }

/* ---------- Detail pages ---------- */

.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 16px;
  align-items: start;
}

.kv {
  display: grid;
  grid-template-columns: 150px 1fr;
  margin: 0;
  padding: 8px 18px 18px;
  gap: 7px 12px;
}

.kv dt {
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--faint);
  padding-top: 7px;
}

.kv dd {
  margin: 0;
  padding-top: 6px;
  word-break: break-all;
  font-size: 13px;
}

.kv dd.mono { font-family: var(--font-mono); font-size: 12px; }

.text-error { color: #f26890; }

.decision-panel { padding: 18px; }

.decision-panel p { color: var(--muted); margin: 0 0 16px; max-width: 560px; }

.decision-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------- Motion ---------- */

@media (prefers-reduced-motion: no-preference) {
  .metro-station.tl-current .metro-dot {
    animation: station-pulse 2.4s ease-out infinite;
  }

  .eyebrow .live-dot {
    animation: station-pulse-amber 2.4s ease-out infinite;
  }
}

@keyframes station-pulse {
  0% { box-shadow: 0 0 0 0 rgba(203, 41, 87, 0.5); }
  70% { box-shadow: 0 0 0 11px rgba(203, 41, 87, 0); }
  100% { box-shadow: 0 0 0 0 rgba(203, 41, 87, 0); }
}

@keyframes station-pulse-amber {
  0% { box-shadow: 0 0 0 0 rgba(203, 41, 87, 0.5); }
  70% { box-shadow: 0 0 0 9px rgba(203, 41, 87, 0); }
  100% { box-shadow: 0 0 0 0 rgba(203, 41, 87, 0); }
}

/* ---------- Small screens ---------- */

.nav-toggle {
  display: none;
}

.backdrop {
  display: none;
}

@media (max-width: 860px) {
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 264px;
    height: 100vh;
    height: 100dvh;
    z-index: 40;
    transform: translateX(-100%);
    transition: transform 0.22s ease;
    box-shadow: none;
  }

  .sidebar.open {
    transform: translateX(0);
    box-shadow: 24px 0 60px rgba(0, 0, 0, 0.6);
  }

  .backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 30;
  }

  .backdrop.open { display: block; }

  .nav-toggle {
    display: inline-flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 4px;
    width: 38px;
    height: 38px;
    flex-shrink: 0;
    background: var(--panel-2);
    border: 1px solid var(--line);
    border-radius: 8px;
    cursor: pointer;
    padding: 0;
  }

  .nav-toggle span {
    width: 16px;
    height: 2px;
    background: var(--text);
    border-radius: 2px;
    transition: transform 0.2s ease, opacity 0.2s ease;
  }

  .nav-toggle.open span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
  .nav-toggle.open span:nth-child(2) { opacity: 0; }
  .nav-toggle.open span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

  .main { width: 100%; }

  .topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    padding: 12px 16px;
    gap: 8px 12px;
  }

  .topbar h1 { font-size: 16px; }

  .topbar-right { gap: 8px; }

  .user-pill { max-width: 130px; font-size: 11px; padding: 4px 10px; }

  .content { padding: 16px; }

  .kv { grid-template-columns: 120px 1fr; }
}

@media (max-width: 480px) {
  .topbar h1 { font-size: 15px; }

  .topbar-right { gap: 6px; }

  .user-pill { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .sidebar { transition: none; }
  .nav-toggle span { transition: none; }
}
