/* ═══════════════════════════════════════════════════════════
   Command Centre — Mission Control HUD Theme
   Dark-themed, no-scroll, single-viewport dashboard
   ═══════════════════════════════════════════════════════════ */

/* ═══ Reset & Design Tokens ═══ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* HUD palette */
  --bg-top: #0b1a2e;
  --bg-bottom: #060e1a;
  --card: rgba(16, 32, 56, 0.70);
  --card-hover: rgba(20, 40, 68, 0.80);
  --card-border: rgba(80, 200, 255, 0.14);
  --card-border-bright: rgba(80, 200, 255, 0.30);
  --card-glow: 0 0 1px rgba(80,200,255,0.1), 0 0 15px rgba(80,200,255,0.04);
  --text: #f0f6fc;
  --text-2: #b0d4f1;
  --text-secondary: #b0d4f1;
  --text-muted: #5a8aaa;
  --accent: #38bdf8;
  --accent-light: rgba(56, 189, 248, 0.12);
  --accent-glow: rgba(56, 189, 248, 0.15);
  --blue: #3b82f6;
  --blue-bg: rgba(59, 130, 246, 0.12);
  --blue-bright: #60a5fa;
  --green: #34d399;
  --green-bg: rgba(52, 211, 153, 0.12);
  --green-dim: rgba(52, 211, 153, 0.4);
  --amber: #fbbf24;
  --amber-bg: rgba(251, 191, 36, 0.12);
  --amber-dim: rgba(251, 191, 36, 0.4);
  --red: #f87171;
  --red-bg: rgba(248, 113, 113, 0.12);
  --red-dim: rgba(248, 113, 113, 0.4);
  --purple: #a78bfa;
  --purple-bg: rgba(167, 139, 250, 0.12);
  --cyan: #22d3ee;
  --pink: #ec4899;
  --gray: #4a6580;

  /* Pipeline-specific — dark adjustments */
  --pipe-green: #34d399;
  --pipe-green-dim: rgba(52, 211, 153, 0.2);
  --pipe-green-glow: rgba(52, 211, 153, 0.25);
  --pipe-blue: #3b82f6;
  --pipe-blue-dim: rgba(59, 130, 246, 0.2);
  --pipe-blue-glow: rgba(59, 130, 246, 0.3);
  --pipe-red: #f87171;
  --pipe-red-dim: rgba(248, 113, 113, 0.2);
  --pipe-orange: #fbbf24;
  --pipe-orange-dim: rgba(251, 191, 36, 0.2);
  --pipe-gray: #4a6580;
  --pipe-surface: rgba(16, 32, 56, 0.5);

  --border: rgba(80, 200, 255, 0.14);
  --border-light: rgba(80, 200, 255, 0.08);
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 2px 8px rgba(0,0,0,0.2);
  --shadow-lg: 0 8px 30px rgba(0,0,0,0.35);
}


/* ═══ Base ═══ */
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: linear-gradient(180deg, var(--bg-top) 0%, var(--bg-bottom) 100%);
  background-attachment: fixed;
  color: var(--text);
  font-size: 13px;
  line-height: 1.4;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

/* HQ overview locks viewport on desktop (no-scroll dashboard) */
@media (min-width: 960px) {
  body:has(.content) { height: 100vh; overflow: hidden; }
}

body.modal-open { overflow: hidden; }

/* Ambient light — faint glow pools */
body::before {
  content: '';
  position: fixed; inset: 0; z-index: 0;
  background:
    radial-gradient(ellipse at 35% 20%, rgba(56,189,248,0.05) 0%, transparent 45%),
    radial-gradient(ellipse at 70% 60%, rgba(56,189,248,0.03) 0%, transparent 40%);
  pointer-events: none;
}

/* Grid overlay — faint tech grid */
body::after {
  content: '';
  position: fixed; inset: 0; z-index: 0;
  background-image: radial-gradient(circle, rgba(80,200,255,0.02) 1px, transparent 1px);
  background-size: 28px 28px;
  pointer-events: none;
}


/* ═══ Nav ═══ */
.top-nav {
  position: relative; z-index: 10;
  display: flex; align-items: center;
  height: 42px; padding: 0 clamp(12px, 2vw, 24px);
  background: rgba(8, 18, 35, 0.85);
  border-bottom: 1px solid var(--card-border);
  backdrop-filter: blur(16px) saturate(1.2);
  flex-shrink: 0;
  gap: 0;
}

.nav-brand {
  display: flex; align-items: center; gap: 8px; margin-right: 20px; flex-shrink: 0;
}

.brand-icon {
  width: 26px; height: 26px; border-radius: 6px;
  background: var(--accent); color: #051525;
  box-shadow: 0 0 8px rgba(56,189,248,0.35);
  font-size: 9px; font-weight: 800; letter-spacing: 0.05em;
  display: flex; align-items: center; justify-content: center;
}

.brand-label { font-size: 12px; font-weight: 600; color: var(--text); }

.nav-links { display: flex; gap: 2px; flex: 1; }
.nav-link {
  font-size: 11px; font-weight: 500; color: var(--text-muted);
  padding: 4px 9px; border-radius: 6px;
  text-decoration: none; transition: all 0.15s;
  cursor: pointer; border: none; background: none;
  font-family: inherit;
}
.nav-link:hover { color: var(--text-2); background: rgba(255,255,255,0.04); }
.nav-link.active { color: var(--accent); background: rgba(56,189,248,0.08); font-weight: 600; }

.nav-right { display: flex; align-items: center; gap: 8px; margin-left: auto; }

.nav-status {
  display: flex; align-items: center; gap: 5px;
  font-size: 10px; color: var(--text-muted);
}

.user-chip {
  font-size: 11px; color: var(--text-2); padding: 2px 9px;
  border: 1px solid var(--card-border); border-radius: 14px;
}


/* ═══ Search — dark adapted ═══ */
.search-wrapper { position: relative; }

.search-icon {
  position: absolute; left: 11px; top: 50%; transform: translateY(-50%);
  color: var(--text-muted); pointer-events: none;
}

.search-input {
  width: 200px; padding: 6px 14px 6px 34px;
  border: 1px solid var(--card-border); border-radius: 8px;
  background: rgba(255,255,255,0.04); color: var(--text);
  font-family: inherit; font-size: 0.82rem; outline: none;
  transition: all 0.15s;
}
.search-input::placeholder { color: var(--text-muted); }
.search-input:focus {
  border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-light);
  width: 280px; background: rgba(255,255,255,0.06);
}

.search-results {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0;
  min-width: 340px; background: rgba(16, 32, 56, 0.95);
  border: 1px solid var(--card-border-bright); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); backdrop-filter: blur(20px);
  max-height: 380px; overflow-y: auto; z-index: 100; display: none;
}
.search-results.visible { display: block; }
.search-empty { padding: 20px; text-align: center; color: var(--text-muted); font-size: 0.85rem; }

.search-result-item {
  padding: 10px 14px; cursor: pointer; transition: background 0.1s;
  border-bottom: 1px solid var(--border-light);
}
.search-result-item:last-child { border-bottom: none; }
.search-result-item:hover { background: rgba(56,189,248,0.08); }
.search-result-main { display: flex; align-items: center; gap: 4px; font-size: 0.85rem; }
.search-result-project { color: var(--text-2); font-weight: 500; }
.search-result-sep { color: var(--text-muted); }
.search-result-task { color: var(--text); font-weight: 600; }
.search-result-meta { display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.search-result-date { font-size: 0.72rem; color: var(--text-muted); }


/* ═══ Refresh & Logout Buttons — dark adapted ═══ */
.btn-refresh {
  background: rgba(255,255,255,0.04); border: 1px solid var(--card-border);
  color: var(--text-muted); padding: 6px 8px; border-radius: 6px;
  cursor: pointer; display: flex; align-items: center; transition: all 0.15s;
}
.btn-refresh:hover { border-color: var(--accent); color: var(--accent); }
.btn-refresh.spinning svg { animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.user-menu {
  display: flex; align-items: center; gap: 8px;
  margin-left: 4px; padding-left: 12px;
  border-left: 1px solid var(--card-border);
}
.user-menu[hidden] { display: none; }
.user-name {
  font-size: 0.82rem; font-weight: 500; color: var(--text-2);
  white-space: nowrap; max-width: 120px; overflow: hidden; text-overflow: ellipsis;
}
.btn-logout {
  background: rgba(255,255,255,0.04); border: 1px solid var(--card-border);
  color: var(--text-muted); padding: 6px 8px; border-radius: 6px;
  cursor: pointer; display: flex; align-items: center; transition: all 0.15s;
}
.btn-logout:hover { border-color: var(--red); color: var(--red); }


/* ═══ Content Grid — Fluid HUD Layout ═══ */
.content {
  position: relative; z-index: 1;
  flex: 1; display: flex; flex-direction: column;
  gap: clamp(6px, 1vh, 10px);
  padding: clamp(6px, 1vh, 10px) clamp(8px, 1.5vw, 20px);
  min-height: 0;
}
.content.hidden { display: none; }

.top-row {
  flex: 1; display: grid;
  grid-template-columns: minmax(160px, 14vw) 1fr minmax(170px, 15vw);
  gap: clamp(6px, 1vw, 10px);
  min-height: 0;
}

.bottom-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: clamp(6px, 1vw, 10px);
  max-height: clamp(150px, 24vh, 240px);
  flex-shrink: 0;
}
.bottom-row .card-body { overflow-y: auto; scrollbar-width: thin; }


/* ═══ Detail View (legacy full panels) ═══ */
.dashboard {
  flex: 1; overflow-y: auto; max-width: 1400px;
  margin: 0 auto; width: 100%; padding: 0;
  position: relative; z-index: 1;
}
.dashboard.hidden { display: none; }

.dashboard-section {
  padding: 24px 28px;
  border-bottom: 1px solid var(--border-light);
}
.dashboard-section:last-child { border-bottom: none; }

/* Back to overview button */
.back-overview-bar {
  padding: 10px 28px;
  border-bottom: 1px solid var(--border-light);
}
.btn-back-overview {
  background: rgba(56,189,248,0.08); border: 1px solid rgba(56,189,248,0.2);
  color: var(--accent); padding: 5px 14px; border-radius: 6px;
  cursor: pointer; font-family: inherit; font-size: 11px; font-weight: 500;
  transition: all 0.15s;
}
.btn-back-overview:hover { background: rgba(56,189,248,0.15); }


/* ═══ Card Base — Glassmorphic HUD ═══ */
.card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  backdrop-filter: blur(24px) saturate(1.3);
  box-shadow: var(--card-glow);
  display: flex; flex-direction: column;
  overflow: hidden;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.card:hover {
  border-color: var(--card-border-bright);
  box-shadow: 0 0 1px rgba(80,200,255,0.15), 0 0 20px rgba(80,200,255,0.06);
}

.card-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 12px; flex-shrink: 0;
  border-bottom: 1px solid rgba(80,200,255,0.08);
}
.card-head-left { display: flex; align-items: center; gap: 6px; min-width: 0; }
.card-title { font-size: 11px; font-weight: 700; letter-spacing: 0.02em; white-space: nowrap; }
.card-sub { font-size: 10px; color: var(--text-muted); white-space: nowrap; }
.card-head-right { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.card-link {
  font-size: 10px; color: var(--text-muted); text-decoration: none;
  opacity: 0.7; transition: opacity 0.15s; cursor: pointer;
  background: none; border: none; font-family: inherit;
}
.card-link:hover { opacity: 1; color: var(--accent); }
.card-body { flex: 1; overflow: hidden; min-height: 0; }

/* Legacy card styles for detail panels */
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
}
.card-header h3 { font-size: 0.92rem; font-weight: 600; color: var(--text); }
.card-header-tag {
  font-size: 0.72rem; padding: 3px 10px; border-radius: 20px;
  background: var(--accent-light); color: var(--accent); font-weight: 500;
}


/* ═══ Pill ═══ */
.pill {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: 9px; font-weight: 700; letter-spacing: 0.04em;
  padding: 2px 7px; border-radius: 12px; white-space: nowrap;
}
.pill-green  { background: rgba(52,211,153,0.18); color: #5eead4; border: 1px solid rgba(52,211,153,0.2); }
.pill-amber  { background: rgba(251,191,36,0.18); color: #fcd34d; border: 1px solid rgba(251,191,36,0.2); }
.pill-red    { background: rgba(248,113,113,0.18); color: #fca5a5; border: 1px solid rgba(248,113,113,0.2); }
.pill-blue   { background: rgba(56,189,248,0.12); color: var(--accent); border: 1px solid rgba(56,189,248,0.15); }
.pill-muted  { background: rgba(255,255,255,0.06); color: var(--text-muted); border: 1px solid rgba(255,255,255,0.06); }


/* ═══ Heartbeat System ═══ */
.heartbeat {
  width: 5px; height: 5px; border-radius: 50%;
  flex-shrink: 0; position: relative;
}
.heartbeat::after {
  content: ''; position: absolute; inset: -3px;
  border-radius: 50%; border: 1.5px solid; border-color: inherit;
}
.hb-live { background: var(--green); border-color: var(--green); }
.hb-live::after { animation: hb-ring 2s ease-out infinite; }
.hb-recent { background: var(--accent); border-color: var(--accent); }
.hb-recent::after { animation: hb-ring 4s ease-out infinite; }
.hb-stale { background: var(--amber); border-color: var(--amber); }
.hb-stale::after { opacity: 0; }
@keyframes hb-ring {
  0%   { opacity: 0.6; transform: scale(1); }
  100% { opacity: 0; transform: scale(2.8); }
}


/* ═══ Panel Utilities ═══ */
.panel-loading {
  padding: 60px 20px; text-align: center;
  color: var(--text-muted); font-size: 0.88rem;
}
.panel-error {
  padding: 60px 20px; text-align: center;
  color: var(--red); font-size: 0.88rem;
}
.panel-empty {
  padding: 40px 20px; text-align: center;
  color: var(--text-muted); font-size: 0.88rem;
}


/* ═══ Status Badges ═══ */
.status-badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 0.72rem; font-weight: 500; padding: 2px 8px;
  border-radius: 20px; white-space: nowrap;
}
.status-in_progress { background: var(--blue-bg); color: var(--blue-bright); }
.status-complete { background: var(--green-bg); color: var(--green); }
.status-blocked { background: var(--amber-bg); color: var(--amber); }
.status-planning { background: var(--purple-bg); color: var(--purple); }


/* ════════════════════════════════════════
   PIPELINE HERO (center card)
════════════════════════════════════════ */
.pipeline-card {
  border-color: var(--card-border-bright);
  box-shadow: 0 0 2px rgba(80,200,255,0.15), 0 0 25px rgba(80,200,255,0.06), inset 0 1px 0 rgba(255,255,255,0.03);
}
.pipeline-body {
  display: flex; align-items: center; gap: clamp(12px, 2vw, 24px);
  padding: clamp(8px, 1.5vh, 16px) clamp(10px, 1.5vw, 18px);
  flex: 1; min-height: 0;
}
.pipeline-arcs {
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  width: clamp(140px, 18vw, 260px);
}
.pipeline-arcs svg { width: 100%; height: auto; display: block; }

/* Mission legend */
.mission-list {
  flex: 1; display: flex; flex-direction: column;
  gap: clamp(4px, 0.8vh, 8px);
  min-width: 0; justify-content: center;
}
.mission-row {
  display: grid;
  grid-template-columns: 8px 1fr auto auto;
  align-items: center; gap: 8px;
}
.mission-dot { width: 8px; height: 8px; border-radius: 3px; flex-shrink: 0; }
.mission-info { min-width: 0; }
.mission-name {
  font-size: clamp(10px, 0.8vw, 12px); font-weight: 500;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.mission-detail {
  font-size: 9px; color: var(--text-muted); margin-top: 1px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.mission-bar-wrap {
  height: 2px; background: rgba(255,255,255,0.06); border-radius: 1px;
  margin-top: 3px; overflow: hidden;
}
.mission-bar { height: 100%; border-radius: 1px; }
.mission-pct {
  font-size: 11px; font-weight: 600; color: var(--text-2);
  font-variant-numeric: tabular-nums; font-family: 'JetBrains Mono', monospace;
  text-align: right; min-width: 30px;
}
.mbadge {
  font-size: 8px; font-weight: 700; letter-spacing: 0.06em;
  padding: 2px 5px; border-radius: 4px; text-align: center;
  font-family: 'JetBrains Mono', monospace;
}
.mb-exec    { background: rgba(96,165,250,0.22); color: #93c5fd; border: 1px solid rgba(96,165,250,0.25); }
.mb-active  { background: rgba(56,189,248,0.15); color: #7dd3fc; border: 1px solid rgba(56,189,248,0.18); }
.mb-blocked { background: rgba(248,113,113,0.18); color: #fca5a5; border: 1px solid rgba(248,113,113,0.22); }
.mb-done    { background: rgba(52,211,153,0.18); color: #6ee7b7; border: 1px solid rgba(52,211,153,0.2); }
.mb-idle    { background: rgba(255,255,255,0.05); color: var(--text-muted); border: 1px solid rgba(255,255,255,0.06); }

/* Mission row as clickable button */
button.mission-row-btn {
  background: none; border: none; padding: 0; margin: 0;
  font: inherit; color: inherit; text-align: left;
  cursor: pointer; border-radius: 6px;
  transition: background 0.15s ease;
  width: 100%;
}
button.mission-row-btn:hover {
  background: rgba(80, 200, 255, 0.06);
}
button.mission-row-btn:focus-visible {
  outline: 1px solid rgba(80, 200, 255, 0.3);
  outline-offset: 1px;
}

/* Pipeline Mission Detail — slide-in panel content (pm-* prefix) */
.pm-loading {
  padding: 40px 20px; text-align: center;
  color: var(--text-muted); font-size: 0.85rem;
}
.pm-summary {
  padding: 12px 16px; margin-bottom: 16px;
  background: rgba(80, 200, 255, 0.04);
  border: 1px solid rgba(80, 200, 255, 0.1);
  border-radius: 8px;
}
.pm-summary-top {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 8px;
}
.pm-status {
  font-size: 0.7rem; font-weight: 700; letter-spacing: 0.06em;
  padding: 2px 8px; border-radius: 4px;
  font-family: 'JetBrains Mono', monospace; text-transform: uppercase;
}
.pm-st-exec    { background: rgba(96, 165, 250, 0.22); color: #93c5fd; }
.pm-st-active  { background: rgba(56, 189, 248, 0.15); color: #7dd3fc; }
.pm-st-blocked { background: rgba(248, 113, 113, 0.18); color: #fca5a5; }
.pm-st-done    { background: rgba(52, 211, 153, 0.18); color: #6ee7b7; }
.pm-st-idle    { background: rgba(255, 255, 255, 0.05); color: var(--text-muted); }
.pm-pct-label {
  font-size: 1.3rem; font-weight: 700; color: var(--text);
  font-family: 'JetBrains Mono', monospace;
}
.pm-progress {
  height: 4px; background: rgba(255, 255, 255, 0.06);
  border-radius: 2px; overflow: hidden; margin-bottom: 8px;
}
.pm-progress-fill {
  height: 100%; border-radius: 2px;
  background: var(--blue-bright);
  transition: width 0.5s ease;
}
.pm-stats-row {
  display: flex; gap: 12px; font-size: 0.72rem;
  color: var(--text-muted); font-family: 'JetBrains Mono', monospace;
}
.pm-section { margin-bottom: 16px; }
.pm-section-title {
  font-size: 0.7rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--text-muted);
  margin-bottom: 8px; padding-bottom: 4px;
  border-bottom: 1px solid rgba(80, 200, 255, 0.08);
}
.pm-section-count {
  font-weight: 400; opacity: 0.6;
  font-family: 'JetBrains Mono', monospace;
}
.pm-exec-card {
  padding: 10px 12px; border-radius: 6px;
  background: rgba(96, 165, 250, 0.08);
  border: 1px solid rgba(96, 165, 250, 0.15);
}
.pm-exec-item {
  font-size: 0.82rem; font-weight: 500; color: var(--text);
  margin-bottom: 4px;
}
.pm-exec-meta {
  font-size: 0.7rem; color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
}
.pm-exec-stale {
  font-size: 0.68rem; color: #fca5a5; font-weight: 600;
  margin-top: 4px;
}
.pm-blocked-list {
  display: flex; flex-direction: column; gap: 6px;
}
.pm-blocked-item {
  padding: 8px 10px; border-radius: 6px;
  background: rgba(248, 113, 113, 0.06);
  border: 1px solid rgba(248, 113, 113, 0.12);
}
.pm-blocked-name {
  font-size: 0.78rem; font-weight: 500; color: var(--text);
  margin-bottom: 2px;
}
.pm-blocked-reason {
  font-size: 0.7rem; color: #fca5a5;
}
.pm-blocked-since {
  font-size: 0.65rem; color: var(--text-muted); margin-top: 2px;
  font-family: 'JetBrains Mono', monospace;
}
.pm-phase {
  margin-bottom: 12px; padding: 8px 10px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(80, 200, 255, 0.06);
  border-radius: 6px;
}
.pm-phase:last-child { margin-bottom: 0; }
.pm-phase-header {
  display: flex; align-items: center; gap: 6px;
  margin-bottom: 6px;
}
.pm-phase-num {
  font-size: 0.68rem; font-weight: 700; color: var(--blue-bright);
  font-family: 'JetBrains Mono', monospace;
  min-width: 22px;
}
.pm-phase-name {
  flex: 1; font-size: 0.78rem; font-weight: 500; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pm-phase-badge {
  font-size: 0.6rem; font-weight: 600; letter-spacing: 0.05em;
  padding: 1px 5px; border-radius: 3px;
  font-family: 'JetBrains Mono', monospace; text-transform: uppercase;
}
.pm-ph-done    { background: rgba(52, 211, 153, 0.15); color: #6ee7b7; }
.pm-ph-active  { background: rgba(96, 165, 250, 0.18); color: #93c5fd; }
.pm-ph-blocked { background: rgba(248, 113, 113, 0.16); color: #fca5a5; }
.pm-ph-pending { background: rgba(255, 255, 255, 0.04); color: var(--text-muted); }
.pm-phase-count {
  font-size: 0.65rem; color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
}
.pm-phase-bar-wrap {
  height: 2px; background: rgba(255, 255, 255, 0.06);
  border-radius: 1px; overflow: hidden; margin-bottom: 6px;
}
.pm-phase-bar {
  height: 100%; border-radius: 1px;
  transition: width 0.4s ease;
}
.pm-phase-bar.pm-ph-done    { background: #34d399; }
.pm-phase-bar.pm-ph-active  { background: #60a5fa; }
.pm-phase-bar.pm-ph-blocked { background: #f87171; }
.pm-phase-bar.pm-ph-pending { background: rgba(255, 255, 255, 0.1); }
.pm-item-list {
  display: flex; flex-direction: column; gap: 2px;
}
.pm-item {
  display: flex; align-items: flex-start; gap: 6px;
  padding: 3px 4px; border-radius: 3px;
  font-size: 0.72rem; line-height: 1.3;
}
.pm-item-icon {
  flex-shrink: 0; width: 14px; text-align: center;
  font-size: 0.68rem; margin-top: 1px;
}
.pm-item-text {
  flex: 1; color: var(--text-2);
  word-break: break-word;
}
.pm-i-done .pm-item-icon { color: #34d399; }
.pm-i-done .pm-item-text { color: var(--text-muted); text-decoration: line-through; text-decoration-color: rgba(52,211,153,0.3); }
.pm-i-exec .pm-item-icon { color: #60a5fa; }
.pm-i-exec { background: rgba(96, 165, 250, 0.06); }
.pm-i-blocked .pm-item-icon { color: #f87171; }
.pm-i-blocked { background: rgba(248, 113, 113, 0.04); }
.pm-i-pending .pm-item-icon { color: var(--text-muted); }

/* Cockpit bar */
.cockpit-bar {
  display: flex; align-items: center; flex-wrap: wrap; gap: 4px;
  padding: 6px clamp(10px, 1.5vw, 18px); flex-shrink: 0;
  border-top: 1px solid rgba(80,200,255,0.10);
  font-size: 10px; color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
  position: relative; overflow: hidden;
}
.cockpit-bar::after {
  content: '';
  position: absolute; top: 0; left: -30%;
  width: 30%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(56,189,248,0.05), transparent);
  animation: bar-sweep 10s linear infinite;
}
@keyframes bar-sweep { 0% { left: -30%; } 100% { left: 100%; } }
.cb-sep { color: var(--gray); margin: 0 1px; }


/* ════════════════════════════════════════
   PROJECTS SIDEBAR (left)
════════════════════════════════════════ */
.proj-body { padding: 6px 8px; overflow-y: auto; flex: 1; }
.proj-chip {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 8px; border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer; transition: all 0.15s; margin-bottom: 3px;
}
.proj-chip:hover { background: rgba(255,255,255,0.03); border-color: var(--card-border); }
.proj-chip.blocked { border-color: rgba(248,113,113,0.2); background: rgba(248,113,113,0.04); }
.proj-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.proj-info { flex: 1; min-width: 0; }
.proj-name { font-size: 11px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.proj-meta { font-size: 9px; color: var(--text-muted); }
.proj-health {
  font-size: 9px; font-weight: 700; padding: 1px 4px; border-radius: 4px;
  flex-shrink: 0; font-family: 'JetBrains Mono', monospace;
}
.ph-good { background: rgba(52,211,153,0.18); color: #6ee7b7; }
.ph-risk { background: rgba(251,191,36,0.18); color: #fcd34d; }
.ph-crit { background: rgba(248,113,113,0.18); color: #fca5a5; }


/* ════════════════════════════════════════
   CALENDAR SIDEBAR (right)
════════════════════════════════════════ */
.cal-timer-compact {
  display: flex; align-items: center; justify-content: space-between;
  padding: 6px 10px;
  background: rgba(52,211,153,0.06);
  border-bottom: 1px solid rgba(52,211,153,0.1);
  font-size: 10px; flex-shrink: 0;
}
.cal-timer-info { display: flex; align-items: center; gap: 5px; color: var(--text-2); }
.cal-timer-dot {
  width: 5px; height: 5px; border-radius: 50%; background: var(--green);
  position: relative;
}
.cal-timer-dot::after {
  content: ''; position: absolute; inset: -3px; border-radius: 50%;
  border: 1.5px solid var(--green);
  animation: hb-ring 1.8s ease-out infinite;
}
.cal-timer-clock {
  font-weight: 700; font-family: 'JetBrains Mono', monospace; color: var(--green);
}
.cal-body { padding: 6px 10px; overflow-y: auto; flex: 1; }
.cal-day { padding: 5px 0; border-bottom: 1px solid rgba(255,255,255,0.03); }
.cal-day:last-child { border-bottom: none; }
.cal-day-label {
  font-size: 9px; font-weight: 700; letter-spacing: 0.06em;
  color: var(--text-muted); text-transform: uppercase; margin-bottom: 4px;
}
.cal-day-label.today { color: var(--accent); }
.cal-event { display: flex; align-items: center; gap: 6px; font-size: 11px; padding: 2px 0; }
.cal-time {
  font-size: 9px; color: var(--text-muted); width: 30px; flex-shrink: 0;
  font-family: 'JetBrains Mono', monospace;
}
.cal-title-compact { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-badge {
  font-size: 8px; font-weight: 600; padding: 1px 5px; border-radius: 4px; flex-shrink: 0;
}
.cb-action { background: rgba(56,189,248,0.12); color: var(--accent); }
.cb-risk   { background: rgba(251,191,36,0.12); color: var(--amber); }
.cb-flag   { background: rgba(248,113,113,0.12); color: var(--red); }
.cal-more { font-size: 10px; color: var(--text-muted); text-align: center; padding: 6px 0 2px; }


/* ════════════════════════════════════════
   BOTTOM CARDS — Compact widgets
════════════════════════════════════════ */

/* Security */
.sec-body { padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; }
.sec-counts { display: flex; gap: clamp(10px, 2vw, 20px); align-items: flex-end; }
.sec-count { text-align: center; }
.sec-val {
  font-size: clamp(18px, 2vw, 26px); font-weight: 700; letter-spacing: -1px; line-height: 1;
  font-family: 'JetBrains Mono', monospace;
}
.sec-val.green { color: #5eead4; text-shadow: 0 0 10px rgba(52,211,153,0.3); }
.sec-val.amber { color: #fcd34d; text-shadow: 0 0 10px rgba(251,191,36,0.3); }
.sec-val.red   { color: #fca5a5; text-shadow: 0 0 10px rgba(248,113,113,0.3); }
.sec-label { font-size: 8px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-muted); margin-top: 1px; }
.sec-pills { display: flex; flex-wrap: wrap; gap: 3px; }
.sec-pill { font-size: 9px; font-weight: 600; padding: 2px 6px; border-radius: 4px; }
.sec-pill-btn { border: 1px solid transparent; cursor: pointer; transition: all 0.15s; font-family: inherit; }
.sec-pill-btn:hover { filter: brightness(1.2); }
.sec-pill-btn.sp-pass:hover { border-color: rgba(52,211,153,0.3); background: rgba(52,211,153,0.22); }
.sec-pill-btn.sp-warn:hover { border-color: rgba(251,191,36,0.3); background: rgba(251,191,36,0.24); }
.sec-pill-btn.sp-fail:hover { border-color: rgba(248,113,113,0.3); background: rgba(248,113,113,0.24); }
.sp-pass { background: rgba(52,211,153,0.14); color: #6ee7b7; }
.sp-warn { background: rgba(251,191,36,0.16); color: #fcd34d; }
.sp-fail { background: rgba(248,113,113,0.16); color: #fca5a5; }
.sec-footer { font-size: 9px; color: var(--text-muted); margin-top: auto; }

/* Housekeeping */
.hk-compact-body { padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; }
.hk-alert {
  display: flex; align-items: center; gap: 6px;
  padding: 5px 8px; border-radius: 6px;
  background: rgba(248,113,113,0.08); border: 1px solid rgba(248,113,113,0.15);
  font-size: 10px; color: var(--red);
}
.hk-comp-row { display: flex; align-items: center; justify-content: space-between; font-size: 11px; }
.hk-comp-label { font-weight: 600; }
.hk-comp-frac { color: var(--text-muted); font-size: 10px; }
.hk-bar-wrap {
  height: 4px; background: rgba(255,255,255,0.06); border-radius: 2px;
  overflow: hidden; margin-top: 4px;
}
.hk-bar { height: 100%; border-radius: 2px; }
.hk-bar.good { background: var(--green); }
.hk-bar.mid  { background: var(--amber); }
.hk-bar.bad  { background: var(--red); }
.hk-sevs { display: flex; gap: 6px; }
.hk-sev {
  display: flex; align-items: center; gap: 4px;
  padding: 4px 8px; border-radius: 6px;
  font-size: 10px; font-weight: 600; flex: 1; justify-content: center;
}
.hk-sev.crit { background: rgba(248,113,113,0.1); color: var(--red); }
.hk-sev.warn { background: rgba(251,191,36,0.1); color: var(--amber); }
.hk-sev.info { background: rgba(56,189,248,0.08); color: var(--accent); }
.hk-sev-n { font-size: 16px; font-weight: 700; font-family: 'JetBrains Mono', monospace; }
.hk-footer { font-size: 9px; color: var(--text-muted); margin-top: auto; }

/* Clickable compact widget items */
.hk-alert-link {
  display: flex; align-items: center; gap: 6px;
  padding: 5px 8px; border-radius: 6px;
  background: rgba(248,113,113,0.08); border: 1px solid rgba(248,113,113,0.15);
  font-size: 10px; color: var(--red);
  cursor: pointer; transition: all 0.15s; text-decoration: none;
}
.hk-alert-link:hover { background: rgba(248,113,113,0.14); border-color: rgba(248,113,113,0.3); }
.hk-sev-link {
  display: flex; align-items: center; gap: 4px;
  padding: 4px 8px; border-radius: 6px;
  font-size: 10px; font-weight: 600; flex: 1; justify-content: center;
  cursor: pointer; transition: all 0.15s; border: 1px solid transparent;
}
.hk-sev-link.crit { background: rgba(248,113,113,0.1); color: var(--red); }
.hk-sev-link.warn { background: rgba(251,191,36,0.1); color: var(--amber); }
.hk-sev-link.info { background: rgba(56,189,248,0.08); color: var(--accent); }
.hk-sev-link.crit:hover { background: rgba(248,113,113,0.18); border-color: rgba(248,113,113,0.25); }
.hk-sev-link.warn:hover { background: rgba(251,191,36,0.18); border-color: rgba(251,191,36,0.25); }
.hk-sev-link.info:hover { background: rgba(56,189,248,0.14); border-color: rgba(56,189,248,0.2); }

/* Infrastructure */
.infra-body { padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; }
.infra-group {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 8px; border-radius: 6px;
  background: rgba(255,255,255,0.02); border: 1px solid rgba(255,255,255,0.03);
}
.infra-name { font-size: 11px; font-weight: 600; flex: 1; }
.infra-dots { display: flex; gap: 3px; }
.infra-dot { width: 7px; height: 7px; border-radius: 2px; }
.id-run  { background: #5eead4; box-shadow: 0 0 6px rgba(52,211,153,0.5); }
.id-down { background: #fca5a5; box-shadow: 0 0 6px rgba(248,113,113,0.5); }
.infra-count {
  font-size: 10px; font-weight: 700; font-family: 'JetBrains Mono', monospace; color: var(--green);
}
.infra-footer { font-size: 9px; color: var(--text-muted); margin-top: auto; }
.infra-group-link {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 5px 8px; border-radius: 6px; cursor: pointer;
  background: rgba(255,255,255,0.02); border: 1px solid rgba(255,255,255,0.03);
  color: inherit; font: inherit; text-align: left;
  transition: background 0.15s, border-color 0.15s;
}
.infra-group-link:hover { background: rgba(80,200,255,0.06); border-color: rgba(80,200,255,0.15); }
.infra-group-link:focus-visible { outline: 1px solid var(--accent); outline-offset: 1px; }

/* Server Health */
.srv-body { padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; }
.srv-metric {
  display: grid; grid-template-columns: 32px 1fr 52px;
  align-items: center; gap: 6px;
}
.srv-label {
  font-size: 10px; font-weight: 700; color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
}
.srv-bar-wrap {
  height: 4px; background: rgba(255,255,255,0.06); border-radius: 2px; overflow: hidden;
}
.srv-bar { height: 100%; border-radius: 2px; }
.srv-bar.ok  { background: var(--accent); }
.srv-bar.mid { background: var(--amber); }
.srv-bar.hi  { background: var(--red); }
.srv-val {
  font-size: 10px; font-weight: 500; color: var(--text-2);
  text-align: right; font-family: 'JetBrains Mono', monospace;
}
.srv-services { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 2px; }
.srv-svc { display: flex; align-items: center; gap: 4px; font-size: 10px; color: var(--text-2); }
.svc-dot { width: 5px; height: 5px; border-radius: 50%; }
.svc-ok { background: #5eead4; box-shadow: 0 0 6px rgba(52,211,153,0.5); }
.svc-down { background: var(--red); }
.srv-footer { font-size: 9px; color: var(--text-muted); margin-top: auto; }


/* ═══ Footer ═══ */
.bottom-bar {
  position: relative; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 clamp(12px, 2vw, 24px); height: 24px; flex-shrink: 0;
  border-top: 1px solid var(--card-border);
  font-size: 10px; color: var(--text-muted);
  background: rgba(8, 18, 35, 0.85);
  backdrop-filter: blur(12px);
}
.bottom-left { display: flex; align-items: center; gap: 5px; }
.bottom-right { display: flex; align-items: center; gap: 8px; }
.refresh-dot {
  width: 5px; height: 5px; border-radius: 50%; flex-shrink: 0;
}

/* Health stats in footer */
.health-stats {
  display: flex; gap: 10px; font-size: 10px;
  font-family: 'JetBrains Mono', monospace;
}
.health-stat { color: var(--text-muted); }
.health-stats.health-ok .health-stat { color: var(--text-muted); }
.health-stats.health-warn .health-stat { color: var(--amber); }
.health-sep {
  display: inline-block; width: 1px; height: 10px;
  background: var(--card-border); margin: 0 4px;
}


/* ═══ View Transition ═══ */
.view-fade-in {
  animation: viewFadeIn 0.2s ease-out;
}
@keyframes viewFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}


/* ═══ Modal — dark adapted ═══ */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.5); backdrop-filter: blur(6px);
  z-index: 200; display: none;
  align-items: flex-start; justify-content: center;
  padding: 60px 20px; overflow-y: auto;
}
.modal-overlay.visible { display: flex; }

.modal {
  background: rgba(16, 32, 56, 0.95);
  border-radius: 16px; width: 100%; max-width: 700px;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--card-border-bright);
  backdrop-filter: blur(24px);
  animation: modalIn 0.2s ease-out;
}
@keyframes modalIn {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

.modal-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
}
.modal-title-group { flex: 1; }
.modal-title { font-size: 1.1rem; font-weight: 700; color: var(--text); }
.modal-subtitle { font-size: 0.8rem; color: var(--text-muted); margin-top: 2px; display: block; }

.modal-close {
  background: none; border: none; cursor: pointer; padding: 4px; border-radius: 6px;
  color: var(--text-muted); transition: all 0.15s; margin-left: 12px;
}
.modal-close:hover { background: rgba(255,255,255,0.06); color: var(--text); }

.modal-body { padding: 20px 24px 24px; max-height: 65vh; overflow-y: auto; }

.modal-loading, .modal-error, .modal-empty {
  padding: 40px 20px; text-align: center; color: var(--text-muted); font-size: 0.88rem;
}
.modal-error { color: var(--red); }

.modal-summary {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
  padding-bottom: 16px; margin-bottom: 16px;
  border-bottom: 1px solid var(--border);
}
.modal-progress-text { font-size: 0.82rem; color: var(--text-2); font-weight: 500; }
.modal-sessions-count { font-size: 0.78rem; color: var(--text-muted); }
.modal-description { width: 100%; font-size: 0.82rem; color: var(--text-2); margin-top: 4px; }

.modal-progress-bar {
  width: 100%; height: 6px; background: rgba(255,255,255,0.06);
  border-radius: 3px; overflow: hidden; margin-top: 8px;
}
.modal-progress-fill { height: 100%; background: var(--accent); border-radius: 3px; }

.modal-session {
  padding: 14px 0;
  border-bottom: 1px solid var(--border-light);
}
.modal-session:last-child { border-bottom: none; }
.modal-session-header { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.modal-session-date { font-size: 0.8rem; font-weight: 600; color: var(--accent); }
.modal-session-focus { font-size: 0.85rem; font-weight: 600; flex: 1; }
.modal-session-meta { font-size: 0.75rem; color: var(--text-muted); }
.modal-session-context { font-size: 0.8rem; color: var(--text-2); margin-top: 8px; }

.modal-steps { margin-top: 10px; display: flex; flex-direction: column; gap: 3px; }
.modal-step {
  display: flex; align-items: flex-start; gap: 6px;
  font-size: 0.8rem; padding: 3px 0;
}
.modal-step-done { color: var(--text-muted); }
.step-icon { flex-shrink: 0; font-size: 0.72rem; margin-top: 1px; }

.modal-next-steps, .modal-decisions {
  margin-top: 10px; padding: 8px 10px;
  background: rgba(255,255,255,0.03); border-radius: 6px;
}
.modal-section-label {
  font-size: 0.68rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.04em; color: var(--text-muted); margin-bottom: 4px;
}
.modal-next-item, .modal-decision-item { font-size: 0.8rem; color: var(--text-2); padding: 2px 0; }


/* ═══ Stat Pills (detail view) ═══ */
.stat-cards {
  display: flex; gap: 10px; margin-bottom: 24px; flex-wrap: wrap;
}
.stat-card {
  border-radius: 50px; padding: 6px 16px 6px 8px;
  display: flex; align-items: center; gap: 8px;
}
.stat-card-purple { background: var(--purple-bg); border: 1px solid rgba(167,139,250,0.2); }
.stat-card-purple .stat-card-icon { color: var(--purple); background: rgba(167,139,250,0.15); }
.stat-card-blue { background: var(--blue-bg); border: 1px solid rgba(59,130,246,0.2); }
.stat-card-blue .stat-card-icon { color: var(--blue-bright); background: rgba(59,130,246,0.15); }
.stat-card-amber { background: var(--amber-bg); border: 1px solid rgba(251,191,36,0.2); }
.stat-card-amber .stat-card-icon { color: var(--amber); background: rgba(251,191,36,0.15); }
.stat-card-cyan { background: rgba(34,211,238,0.08); border: 1px solid rgba(34,211,238,0.2); }
.stat-card-cyan .stat-card-icon { color: var(--cyan); background: rgba(34,211,238,0.12); }
.stat-card-green { background: var(--green-bg); border: 1px solid rgba(52,211,153,0.2); }
.stat-card-green .stat-card-icon { color: var(--green); background: rgba(52,211,153,0.15); }
.stat-card-red { background: var(--red-bg); border: 1px solid rgba(248,113,113,0.2); }
.stat-card-red .stat-card-icon { color: var(--red); background: rgba(248,113,113,0.15); }

.stat-card-icon {
  width: 26px; height: 26px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.stat-card-icon svg { width: 14px; height: 14px; }
.stat-card-value { font-size: 0.95rem; font-weight: 700; line-height: 1; }
.stat-card-label { font-size: 0.78rem; color: var(--text-2); font-weight: 500; }

.stat-card[data-filter] { cursor: pointer; transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s; }
.stat-card[data-filter]:hover { transform: translateY(-1px); box-shadow: 0 2px 8px rgba(0,0,0,0.3); }
.stat-card-active { box-shadow: 0 0 0 2px currentColor, 0 2px 8px rgba(0,0,0,0.3); transform: translateY(-1px); }
.stat-card-active.stat-card-purple { box-shadow: 0 0 0 2px var(--purple), 0 2px 8px rgba(0,0,0,0.3); }
.stat-card-active.stat-card-blue { box-shadow: 0 0 0 2px var(--blue-bright), 0 2px 8px rgba(0,0,0,0.3); }
.stat-card-active.stat-card-amber { box-shadow: 0 0 0 2px var(--amber), 0 2px 8px rgba(0,0,0,0.3); }
.stat-card-active.stat-card-green { box-shadow: 0 0 0 2px var(--green), 0 2px 8px rgba(0,0,0,0.3); }


/* ═══ Project Cards Grid (detail view) ═══ */
.section-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px; margin-top: 8px;
}
.section-header h2 { font-size: 1rem; font-weight: 700; }
.section-count { font-size: 0.75rem; color: var(--text-muted); }

.project-cards {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px;
}
.project-card {
  background: var(--card); border: 1px solid var(--card-border);
  border-radius: var(--radius-sm); padding: 18px;
  cursor: pointer; transition: all 0.2s;
  position: relative; overflow: hidden; box-shadow: var(--shadow);
}
.project-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 4px 20px rgba(56,189,248,0.1);
}
.project-card-status {
  font-size: 0.68rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.04em; margin-bottom: 6px;
}
.project-card-status.status-in_progress { color: var(--blue-bright); }
.project-card-status.status-complete { color: var(--green); }
.project-card-status.status-blocked { color: var(--amber); }
.project-card-status.status-planning { color: var(--purple); }

.project-card-name { font-size: 1rem; font-weight: 700; margin-bottom: 12px; }
.project-card-progress {
  width: 100%; height: 6px; background: rgba(255,255,255,0.06);
  border-radius: 3px; overflow: hidden; margin-bottom: 12px;
}
.project-card-progress-fill { height: 100%; border-radius: 3px; transition: width 0.4s; }
.fill-green { background: var(--green); }
.fill-blue { background: var(--blue); }
.fill-amber { background: var(--amber); }
.fill-purple { background: var(--accent); }
.fill-red { background: var(--red); }

.project-card-meta {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 0.78rem; color: var(--text-2);
}
.project-card-pct { font-weight: 700; font-size: 0.85rem; }

.project-card-health {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border-radius: 50%;
  font-size: 0.68rem; font-weight: 700;
  position: absolute; top: 14px; right: 14px;
}
.health-healthy { background: var(--green-bg); color: var(--green); }
.health-needs_attention { background: var(--amber-bg); color: var(--amber); }
.health-at_risk { background: var(--red-bg); color: var(--red); }
.health-critical { background: var(--red-bg); color: #fca5a5; }
.health-complete { background: var(--green-bg); color: var(--green); }
.health-unknown { background: rgba(100,116,139,0.1); color: var(--text-muted); }

.project-card-tasks { display: flex; gap: 4px; margin-top: 10px; }
.task-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.task-dot-complete { background: var(--green); }
.task-dot-in_progress { background: var(--blue-bright); }
.task-dot-blocked { background: var(--amber); }
.task-dot-planning { background: var(--purple); }

/* At-Risk */
.risk-list { display: flex; flex-direction: column; gap: 10px; }
.risk-item {
  padding: 14px 16px; border-radius: var(--radius-sm);
  border: 1px solid; display: flex; align-items: flex-start;
  gap: 14px; flex-direction: column;
}
.risk-at_risk { background: var(--red-bg); border-color: rgba(248,113,113,0.2); }
.risk-critical { background: rgba(248,113,113,0.08); border-color: rgba(248,113,113,0.25); }
.risk-header { display: flex; align-items: center; gap: 10px; width: 100%; }
.risk-name { font-weight: 600; flex: 1; font-size: 0.88rem; }
.risk-signals { display: flex; flex-wrap: wrap; gap: 6px; }
.signal-tag {
  font-size: 0.7rem; padding: 2px 8px; border-radius: 4px;
  background: rgba(255,255,255,0.04); color: var(--text-2);
}

/* Activity Timeline */
.activity-timeline { display: flex; flex-direction: column; gap: 0; }
.timeline-item { display: flex; gap: 12px; padding: 8px 0; position: relative; }
.timeline-dot-wrap {
  display: flex; flex-direction: column; align-items: center; flex-shrink: 0; width: 20px;
}
.timeline-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; z-index: 1; }
.timeline-line { width: 2px; flex: 1; background: var(--card-border); margin-top: 2px; }
.timeline-item:last-child .timeline-line { display: none; }
.dot-complete { background: var(--green); }
.dot-in_progress { background: var(--blue-bright); }
.dot-blocked { background: var(--amber); }
.dot-planning { background: var(--purple); }
.timeline-content { flex: 1; min-width: 0; }
.timeline-task {
  font-size: 0.8rem; font-weight: 500; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.timeline-project { font-size: 0.7rem; color: var(--text-muted); }
.timeline-date {
  font-size: 0.68rem; color: var(--text-muted); white-space: nowrap;
  flex-shrink: 0; align-self: flex-start; margin-top: 2px;
}

/* Completed Summary */
.completed-summary {
  margin-top: 16px; padding: 12px 16px; border-radius: var(--radius-sm);
  background: var(--green-bg); border: 1px solid rgba(52,211,153,0.2);
  color: var(--green); font-size: 0.82rem; font-weight: 500; text-align: center;
}


/* ═══ Pipeline Tabs ═══ */
.pipe-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--card-border);
  padding: 0 4px;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 5;
  background: rgba(8, 18, 35, 0.92);
  backdrop-filter: blur(16px) saturate(1.2);
}

.pipe-tab {
  position: relative;
  background: none;
  border: none;
  color: var(--text-muted);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.03em;
  padding: 10px 16px;
  cursor: pointer;
  transition: color 0.15s;
}

.pipe-tab:hover {
  color: var(--text-2);
}

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

.pipe-tab.active {
  color: var(--accent);
  font-weight: 600;
}

.pipe-tab.active::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 8px;
  right: 8px;
  height: 2px;
  background: var(--accent);
  border-radius: 2px 2px 0 0;
}

.pipe-tab-panel {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

/* ── Completed Missions ── */
.pipe-completed {
  padding: 16px 0;
}

.pipe-completed-empty,
.pipe-bf-empty {
  padding: 40px 20px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}

.pipe-completed-header {
  padding: 0 4px 12px;
}

.pipe-completed-count {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

/* ── Completed Missions — Card Grid ── */
.pipe-cg {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}

.pipe-cg-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  backdrop-filter: blur(24px) saturate(1.3);
  box-shadow: var(--card-glow);
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.15s;
  text-align: left;
  color: inherit;
  font: inherit;
  width: 100%;
}

.pipe-cg-card:hover {
  border-color: var(--card-border-bright);
  box-shadow: 0 0 1px rgba(80,200,255,0.15), 0 0 20px rgba(80,200,255,0.06);
  transform: translateY(-1px);
}

.pipe-cg-card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Card header: title + status */
.cg-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.cg-card-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
  min-width: 0;
  /* Allow wrapping for long titles */
  word-break: break-word;
}

/* Status badges — shared by cards and slide panel */
.cg-status {
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 4px;
  white-space: nowrap;
  flex-shrink: 0;
}

.cg-status-done { background: var(--green-bg); color: var(--green); }
.cg-status-partial { background: var(--amber-bg); color: var(--amber); }
.cg-status-active { background: var(--blue-bg); color: var(--blue-bright); }
.cg-status-other { background: rgba(255,255,255,0.06); color: var(--text-muted); }

/* Card meta: project badge + date */
.cg-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.cg-project {
  font-size: 10px;
  font-weight: 500;
  color: var(--accent);
  background: rgba(56, 189, 248, 0.08);
  padding: 1px 7px;
  border-radius: 3px;
  border: 1px solid rgba(56, 189, 248, 0.12);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 160px;
}

.cg-date {
  font-size: 10px;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
  white-space: nowrap;
}

/* Progress bar — shared by cards and slide panel */
.cg-progress-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.cg-progress-bar {
  flex: 1;
  height: 4px;
  background: rgba(255,255,255,0.06);
  border-radius: 2px;
  overflow: hidden;
}

.cg-progress-fill {
  height: 100%;
  background: var(--green);
  border-radius: 2px;
  transition: width 0.3s ease;
}

.cg-progress-label {
  font-size: 10px;
  font-family: 'JetBrains Mono', monospace;
  color: var(--text-muted);
  min-width: 28px;
  text-align: right;
}

/* Card stats row */
.cg-card-stats {
  display: flex;
  gap: 12px;
  padding-top: 6px;
  border-top: 1px solid rgba(80,200,255,0.06);
}

.cg-stat {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.cg-stat-val {
  font-size: 12px;
  font-family: 'JetBrains Mono', monospace;
  font-variant-numeric: tabular-nums;
  color: var(--text-2);
  font-weight: 500;
}

.cg-stat-lbl {
  font-size: 9px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.cg-stat-warn .cg-stat-val { color: var(--amber); }

/* ── Mission Report (SlidePanel content) ── */
.mr-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
}

.mr-dates {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 16px;
  padding: 10px 12px;
  background: rgba(255,255,255,0.02);
  border-radius: var(--radius-sm);
  border: 1px solid rgba(80,200,255,0.06);
}

.mr-date-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.mr-date-lbl {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.mr-date-val {
  font-size: 11px;
  font-family: 'JetBrains Mono', monospace;
  color: var(--text-2);
}

.mr-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 20px;
  padding: 12px 14px;
  background: rgba(255,255,255,0.02);
  border-radius: var(--radius-sm);
  border: 1px solid rgba(80,200,255,0.06);
}

.mr-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.mr-stat-val {
  font-size: 14px;
  font-family: 'JetBrains Mono', monospace;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  font-weight: 600;
}

.mr-stat-lbl {
  font-size: 9px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.mr-stat-warn .mr-stat-val { color: var(--amber); }

.mr-section {
  margin-bottom: 18px;
}

.mr-section-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(80,200,255,0.08);
}

/* Context summary in report */
.mr-context {
  margin-bottom: 16px;
  padding: 10px 12px;
  background: rgba(255,255,255,0.02);
  border-radius: var(--radius-sm);
  border: 1px solid rgba(80,200,255,0.06);
}

.mr-context-text {
  font-size: 12px;
  color: var(--text-2);
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}

/* Phase rows in report */
.mr-phase {
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(80,200,255,0.04);
}

.mr-phase:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.mr-phase-head {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
}

.mr-phase-num {
  font-size: 10px;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 600;
  color: var(--accent);
  min-width: 20px;
}

.mr-phase-name {
  font-size: 12px;
  color: var(--text);
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mr-phase-pct {
  font-size: 11px;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 600;
  color: var(--accent);
  flex-shrink: 0;
}

/* Phase items in report */
.mr-items {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.mr-item {
  padding: 5px 8px 5px 6px;
  border-radius: 4px;
}

.mr-item-done {
  opacity: 0.7;
}

.mr-item-blocked {
  background: var(--red-bg);
}

.mr-item-row {
  display: flex;
  align-items: flex-start;
  gap: 6px;
}

.mr-item-icon {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  line-height: 1;
}

.mr-icon-done { color: var(--green); }
.mr-icon-blocked { color: var(--red); }
.mr-icon-locked { color: var(--amber); }
.mr-icon-pending { color: var(--text-muted); }

.mr-item-text {
  font-size: 11px;
  color: var(--text-2);
  line-height: 1.4;
  word-break: break-word;
}

.mr-item-done .mr-item-text {
  text-decoration: line-through;
  text-decoration-color: rgba(255,255,255,0.15);
}

.mr-item-block-reason {
  margin-top: 3px;
  margin-left: 22px;
  font-size: 10px;
  color: var(--red);
  line-height: 1.3;
}

.mr-block-label {
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

/* Cost/token summary footer */
.mr-footer {
  margin-top: 20px;
  padding: 14px;
  background: rgba(56, 189, 248, 0.04);
  border: 1px solid rgba(80,200,255,0.10);
  border-radius: var(--radius-sm);
}

.mr-footer-title {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(80,200,255,0.08);
}

.mr-footer-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}

.mr-footer-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.mr-footer-val {
  font-size: 15px;
  font-family: 'JetBrains Mono', monospace;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  font-weight: 600;
}

.mr-footer-lbl {
  font-size: 9px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.mr-footer-warn .mr-footer-val {
  color: var(--amber);
}

/* Task rows in report */
.mr-task {
  padding: 10px 12px;
  margin-bottom: 6px;
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.02);
  border-left: 3px solid var(--green-dim);
}

.mr-task-error {
  border-left-color: var(--red-dim);
}

.mr-task-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.mr-task-slug {
  font-size: 12px;
  font-weight: 500;
  color: var(--text);
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mr-task-cost {
  font-size: 11px;
  font-family: 'JetBrains Mono', monospace;
  color: var(--text-2);
  flex-shrink: 0;
}

.mr-task-meta {
  display: flex;
  gap: 10px;
  margin-top: 3px;
  font-size: 10px;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
}

.mr-task-summary {
  margin-top: 6px;
  font-size: 11px;
  color: var(--text-2);
  line-height: 1.4;
  white-space: pre-wrap;
  word-break: break-word;
}

/* ── BlockFlow Queue ── */
.pipe-blockflow {
  padding: 16px 0;
}

.pipe-bf-header {
  padding: 0 4px 12px;
}

.pipe-bf-total {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.pipe-bf-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.pipe-bfi-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  transition: background 0.15s;
}

.pipe-bfi-row:hover {
  background: rgba(255, 255, 255, 0.03);
}

.pipe-bfi-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--amber);
  opacity: 0.7;
  flex-shrink: 0;
}

.pipe-bfi-info {
  flex: 1;
  min-width: 0;
}

.pipe-bfi-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pipe-bfi-file {
  font-size: 10px;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
  margin-top: 2px;
}

.pipe-bfi-date {
  font-size: 11px;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
  flex-shrink: 0;
}

@media (max-width: 700px) {
  .pipe-cg { grid-template-columns: 1fr; }
}

/* ═══ Pipeline Panel — Detail view (legacy) ═══ */
.pipe-panel {
  display: flex; flex-direction: column; gap: 22px;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(56,189,248,0.04) 0%, transparent 55%),
    radial-gradient(ellipse at 80% 80%, rgba(52,211,153,0.02) 0%, transparent 50%);
  padding: 4px 0 8px; border-radius: var(--radius);
}
.pipe-header {
  display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px;
}
.pipe-header > div:first-child { display: flex; align-items: baseline; gap: 14px; }
.pipe-hud .pipe-title {
  font-size: 1.2rem; font-weight: 300; letter-spacing: 0.02em;
  color: var(--text); font-family: 'JetBrains Mono', monospace;
}
.pipe-hud .pipe-subtitle {
  font-size: 0.68rem; color: var(--text-muted); font-weight: 400;
  letter-spacing: 0.06em; font-family: 'JetBrains Mono', monospace;
}
.pipe-pills { display: flex; gap: 8px; }
.pipe-hud .pipe-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 12px; border-radius: 4px;
  font-size: 0.65rem; font-weight: 500; letter-spacing: 0.06em;
  font-family: 'JetBrains Mono', monospace;
}
.pipe-hud .pipe-pill-warn {
  background: rgba(248,113,113,0.08); color: var(--red);
  border: 1px solid rgba(248,113,113,0.2);
}
.pipe-hud .pipe-pill-count {
  background: rgba(255,255,255,0.04); color: var(--text-muted);
  border: 1px solid rgba(255,255,255,0.06);
}
@keyframes pipeBlink {
  0%, 100% { opacity: 0.8; }
  50% { opacity: 0.2; }
}

/* Hero Section */
.pipe-hero {
  padding: 24px 28px 20px; display: flex; flex-direction: column;
  position: relative; overflow: hidden;
}
.pipe-hud {
  background: var(--card);
  backdrop-filter: blur(20px) saturate(1.2);
  color: var(--text); border-radius: var(--radius);
  border: 1px solid var(--card-border);
  box-shadow: var(--card-glow);
}
.pipe-hud::before {
  content: ''; position: absolute; top: -30%; left: 50%; transform: translateX(-50%);
  width: 100%; height: 70%;
  background: radial-gradient(ellipse, rgba(56,189,248,0.04) 0%, transparent 65%);
  pointer-events: none;
}
.pipe-hud::after {
  content: ''; position: absolute; bottom: -20%; left: 50%; transform: translateX(-50%);
  width: 80%; height: 40%;
  background: radial-gradient(ellipse, rgba(52,211,153,0.03) 0%, transparent 70%);
  pointer-events: none;
}

.pipe-hero-body {
  display: flex; align-items: center; gap: 24px; padding: 8px 0;
  justify-content: center;
}
.pipe-hero-arcs {
  display: flex; align-items: center; justify-content: center;
  gap: 36px; flex: 1; padding: 12px 0; flex-wrap: wrap; min-width: 0;
}
.pipe-arc-unit {
  display: flex; flex-direction: column; align-items: center;
  gap: 8px; position: relative;
  transition: transform 0.4s ease, opacity 0.3s ease;
}
.pipe-arc-unit:hover { transform: scale(1.02); }
.pipe-arc-unit-primary { order: 0; }

/* Pulse ripple */
.pulse-ripple {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: 40px; height: 40px; border-radius: 50%;
  border: 2px solid var(--accent); opacity: 0.5;
  pointer-events: none; animation: pulse-expand 1.2s ease-out forwards;
}
@keyframes pulse-expand {
  0%   { width: 40px;  height: 40px;  opacity: 0.6; border-width: 2px; }
  100% { width: 180px; height: 180px; opacity: 0;   border-width: 0.5px; }
}

.pipe-hud .pipe-arc-name {
  font-size: 0.95rem; font-weight: 400; color: var(--text);
  letter-spacing: 0.04em; text-align: center;
  font-family: 'JetBrains Mono', monospace;
}
.pipe-hud .pipe-arc-task {
  font-size: 0.68rem; color: var(--text-muted); font-weight: 400;
  text-align: center; margin-bottom: 6px;
  letter-spacing: 0.03em; font-family: 'JetBrains Mono', monospace;
}
.pipe-hud .pipe-arc-items {
  font-size: 0.68rem; color: var(--text-muted); letter-spacing: 0.06em;
  margin-top: 4px; font-weight: 300;
  font-family: 'JetBrains Mono', monospace;
}

.pipe-arc-status {
  font-size: 0.68rem; font-family: 'JetBrains Mono', monospace;
  text-align: center; margin-top: 4px; max-width: 260px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  letter-spacing: 0.02em;
}
.pipe-arc-status-blocked { color: var(--red); font-weight: 500; }
.pipe-arc-status-executing { color: var(--blue-bright); font-weight: 400; }
.pipe-arc-status-idle { color: var(--text-muted); font-weight: 300; }
.pipe-arc-spec {
  display: inline-block; font-size: 0.6rem; font-weight: 600;
  padding: 1px 6px; border-radius: 3px;
  background: var(--blue-bg); color: var(--blue-bright);
  text-transform: uppercase; letter-spacing: 0.04em; margin-right: 6px;
}
.pipe-arc-dur { color: var(--text-muted); font-size: 0.62rem; margin-left: 4px; }

.pipe-arc-svg { display: block; overflow: visible; }
.pipe-arc-pct { fill: var(--text); }
.pipe-arc-pct-unit { fill: var(--text-muted); }

/* Overall Progress */
.pipe-overall { margin-top: auto; padding-top: 24px; }
.pipe-hud .pipe-overall-bar {
  width: 100%; height: 2px; background: rgba(255,255,255,0.06);
  border-radius: 1px; overflow: hidden;
}
.pipe-hud .pipe-overall-fill {
  height: 100%; border-radius: 1px;
  background: linear-gradient(90deg, var(--blue), var(--green));
  transition: width 0.7s ease;
}
.pipe-hud .pipe-overall-label {
  text-align: center; font-size: 0.68rem; color: var(--text-muted);
  font-weight: 300; margin-top: 12px; letter-spacing: 0.06em;
  font-family: 'JetBrains Mono', monospace;
}

/* Phase Widget */
.pipe-hud .pipe-phase-widget {
  width: 220px; flex-shrink: 0;
  background: rgba(16, 32, 56, 0.5);
  backdrop-filter: blur(12px);
  border: 1px solid var(--card-border); border-radius: 16px;
  padding: 14px 16px; display: flex; flex-direction: column;
  gap: 14px; box-shadow: var(--card-glow);
}
.pipe-hud .pipe-pw-name {
  font-size: 0.72rem; font-weight: 600; color: var(--text); margin-bottom: 10px;
  display: flex; align-items: center; justify-content: space-between;
  font-family: 'JetBrains Mono', monospace;
}
.pipe-hud .pipe-pw-pct { font-size: 0.62rem; font-weight: 300; color: var(--text-muted); }
.pipe-pw-row { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.pipe-hud .pipe-pw-label {
  width: 24px; flex-shrink: 0; font-size: 0.62rem; color: var(--text-muted);
  font-weight: 500; font-family: 'JetBrains Mono', monospace;
}
.pipe-hud .pipe-pw-bar-wrap {
  flex: 1; height: 3px; background: rgba(255,255,255,0.06);
  border-radius: 1.5px; overflow: hidden;
}
.pipe-hud .pipe-pw-val {
  width: 28px; text-align: right; font-size: 0.6rem; color: var(--text-muted);
  font-weight: 300; flex-shrink: 0; font-family: 'JetBrains Mono', monospace;
}
.pipe-phase-bar { height: 100%; border-radius: 1.5px; transition: width 0.4s ease; }
.pipe-hud .pipe-bar-done { background: rgba(52,211,153,0.7); }
.pipe-hud .pipe-bar-active { background: rgba(59,130,246,0.7); }
.pipe-hud .pipe-bar-blocked { background: rgba(248,113,113,0.7); }
.pipe-hud .pipe-bar-pending { background: rgba(255,255,255,0.06); }

.pipe-hud .pipe-empty {
  padding: 80px 20px; text-align: center; color: var(--text-muted);
  font-size: 0.82rem; font-weight: 300;
}
.pipe-hud .pipe-empty-sm {
  padding: 20px; text-align: center; color: var(--text-muted);
  font-size: 0.72rem; font-weight: 300;
}

/* System State Pill */
.pipe-state-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 12px; border-radius: 4px;
  font-size: 0.68rem; font-weight: 600; letter-spacing: 0.08em;
  font-variant-numeric: tabular-nums;
  font-family: 'JetBrains Mono', monospace;
}
.pipe-hud .pipe-state-running {
  background: rgba(52,211,153,0.12); color: var(--green);
  border: 1px solid rgba(52,211,153,0.25);
}
.pipe-hud .pipe-state-paused {
  background: rgba(251,191,36,0.12); color: var(--amber);
  border: 1px solid rgba(251,191,36,0.25);
}
.pipe-hud .pipe-state-idle {
  background: rgba(255,255,255,0.04); color: var(--text-muted);
  border: 1px solid rgba(255,255,255,0.06); font-weight: 400;
}
.pipe-state-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.pipe-hud .pipe-state-dot-running {
  background: var(--green); box-shadow: 0 0 6px rgba(52,211,153,0.5);
  animation: pipeBlink 2s ease-in-out infinite;
}
.pipe-hud .pipe-state-dot-paused {
  background: var(--amber); box-shadow: 0 0 6px rgba(251,191,36,0.5);
  animation: pipeBlink 1.5s ease-in-out infinite;
}
.pipe-hud .pipe-state-dot-idle { background: var(--text-muted); opacity: 0.5; }
.pipe-hud .pipe-state-stale {
  background: rgba(239,68,68,0.12); color: var(--red);
  border: 1px solid rgba(239,68,68,0.25);
}
.pipe-hud .pipe-state-dot-stale {
  background: var(--red); box-shadow: 0 0 6px rgba(239,68,68,0.5);
  animation: pipeBlink 1s ease-in-out infinite;
}
.pipe-agent-badge {
  display: inline-block; margin-left: 6px; padding: 1px 6px;
  border-radius: 3px; font-size: 0.58rem; font-weight: 600;
  letter-spacing: 0.06em; text-transform: uppercase;
  background: rgba(59,130,246,0.12); color: var(--blue);
  border: 1px solid rgba(59,130,246,0.2);
  vertical-align: middle;
}
.pipe-countdown { font-variant-numeric: tabular-nums; font-weight: 700; margin-left: 4px; }

/* Cockpit Bar (detail view) */
.pipe-cockpit-bar {
  display: flex; align-items: center; gap: 0; padding: 8px 0;
  border-bottom: 1px solid rgba(255,255,255,0.04); margin-bottom: 8px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.68rem; color: var(--text-muted); flex-wrap: wrap;
}
.pipe-cb-item { white-space: nowrap; letter-spacing: 0.02em; }
.pipe-cb-sep { margin: 0 10px; color: var(--gray); font-size: 0.5rem; }
.pipe-cb-amber { color: var(--amber); font-weight: 500; }

/* Cockpit Footer */
.pipe-hud .pipe-cockpit-footer {
  display: grid; grid-template-columns: 1fr 1fr; gap: 16px;
  padding-top: 16px; border-top: 1px solid rgba(255,255,255,0.04); margin-top: 8px;
}
.pipe-hud .pipe-cf-title {
  font-size: 0.62rem; font-weight: 500; text-transform: uppercase;
  letter-spacing: 0.12em; color: var(--text-muted); margin-bottom: 10px;
  display: flex; align-items: center; gap: 8px;
  font-family: 'JetBrains Mono', monospace;
}
.pipe-activity-feed, .pipe-blockflow-queue { min-width: 0; }
.pipe-hud .pipe-af-row {
  display: flex; align-items: flex-start; gap: 8px; padding: 3px 0;
  font-size: 0.68rem; border-bottom: 1px solid rgba(255,255,255,0.03);
  font-family: 'JetBrains Mono', monospace;
}
.pipe-af-row:last-child { border-bottom: none; }
.pipe-af-ico { flex-shrink: 0; width: 16px; text-align: center; font-size: 0.68rem; line-height: 1.4; }
.pipe-hud .pipe-af-done { color: var(--green); }
.pipe-hud .pipe-af-err { color: var(--red); }
.pipe-hud .pipe-af-rate { color: var(--amber); }
.pipe-hud .pipe-af-cycle { color: var(--blue-bright); }
.pipe-hud .pipe-af-msg {
  flex: 1; min-width: 0; color: var(--text-2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pipe-hud .pipe-af-time {
  flex-shrink: 0; font-size: 0.6rem; color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}
.pipe-hud .pipe-bf-count {
  font-size: 0.58rem; font-weight: 600; padding: 1px 6px; border-radius: 10px;
  background: var(--purple-bg); color: var(--purple);
}
.pipe-hud .pipe-bf-row {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 3px 0; font-size: 0.68rem; border-bottom: 1px solid rgba(255,255,255,0.03);
  font-family: 'JetBrains Mono', monospace;
}
.pipe-bf-row:last-child { border-bottom: none; }
.pipe-hud .pipe-bf-dot {
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--purple); opacity: 0.3; flex-shrink: 0;
}
.pipe-hud .pipe-bf-name {
  flex: 1; min-width: 0; color: var(--text-2); font-weight: 500;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pipe-hud .pipe-bf-age { flex-shrink: 0; font-size: 0.6rem; color: var(--text-muted); }


/* ═══ Calendar Panel (detail view) ═══ */
.cal-panel { display: flex; flex-direction: column; gap: 16px; }
.cal-top-bar { display: flex; align-items: center; justify-content: space-between; }
.cal-top-left { display: flex; align-items: baseline; gap: 12px; }
.cal-title { font-size: 1.3rem; font-weight: 700; letter-spacing: -0.02em; }
.cal-date { font-size: 0.82rem; color: var(--text-muted); }
.cal-top-right { display: flex; align-items: center; gap: 6px; }

.week-nav-btn {
  background: rgba(255,255,255,0.04); border: 1px solid var(--card-border);
  color: var(--text-2); padding: 7px 10px; border-radius: 8px;
  cursor: pointer; display: flex; align-items: center; transition: all 0.15s;
  font-family: inherit; font-size: 0.82rem; font-weight: 500;
}
.week-nav-btn:hover { border-color: var(--accent); color: var(--accent); }
.week-today-btn { padding: 7px 14px; }

/* Timer Bar */
.cal-timer-bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 20px;
  background: linear-gradient(135deg, rgba(52,211,153,0.08), rgba(52,211,153,0.03));
  border: 1px solid rgba(52,211,153,0.25);
  border-radius: var(--radius);
  animation: timerSlideIn 0.3s ease-out;
}
@keyframes timerSlideIn {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}
.timer-info { display: flex; align-items: center; gap: 8px; }
.timer-pulse {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--green); animation: pulse 1.5s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(52,211,153,0.4); }
  50% { opacity: 0.7; box-shadow: 0 0 0 6px rgba(52,211,153,0); }
}
.timer-project { font-weight: 600; color: var(--green); font-size: 0.88rem; }
.timer-sep { color: var(--text-muted); }
.timer-task { font-weight: 500; color: var(--text); font-size: 0.88rem; }
.timer-display {
  font-size: 1.3rem; font-weight: 800; font-variant-numeric: tabular-nums;
  color: var(--green); letter-spacing: 0.02em;
}
.timer-stop-btn {
  padding: 6px 16px; border-radius: 8px; background: var(--red);
  border: none; color: #fff; font-family: inherit;
  font-weight: 600; font-size: 0.82rem; cursor: pointer; transition: all 0.15s;
}
.timer-stop-btn:hover { background: #ef4444; transform: scale(1.05); }

/* Week Grid */
.cal-week-grid {
  display: grid; grid-template-columns: 60px repeat(5, 1fr);
  gap: 0;
}
.grid-header {
  padding: 14px 8px; text-align: center; font-size: 0.78rem;
  font-weight: 600; color: var(--text-2);
  border-bottom: 1px solid var(--card-border);
  background: rgba(16, 32, 56, 0.5);
}
.grid-header-today { color: var(--accent); background: rgba(56,189,248,0.06); }
.grid-header .header-day { font-size: 0.72rem; color: var(--text-muted); text-transform: uppercase; }
.grid-header .header-date { font-size: 1rem; font-weight: 700; margin-top: 2px; }

.grid-time {
  padding: 0 8px; font-size: 0.72rem; color: var(--text-muted);
  text-align: right; height: var(--hour-height, 48px);
  display: flex; align-items: flex-start; justify-content: flex-end;
  border-right: 1px solid var(--card-border); padding-top: 4px;
}
.grid-cell {
  height: var(--hour-height, 48px); border-bottom: 1px solid var(--border-light);
  border-right: 1px solid var(--border-light);
  position: relative; transition: background 0.1s;
}
.grid-cell:hover { background: rgba(56,189,248,0.03); }
.grid-cell-working { background: rgba(56, 189, 248, 0.025); }

.time-indicator {
  position: absolute; left: 0; right: 0; height: 2px;
  background: var(--red); z-index: 10; pointer-events: none;
}
.time-indicator::before {
  content: ''; position: absolute; left: -4px; top: -3px;
  width: 8px; height: 8px; border-radius: 50%; background: var(--red);
}

.event-block {
  position: absolute; left: 3px; right: 3px; border-radius: 6px;
  padding: 6px 8px; font-size: 0.75rem; cursor: pointer;
  overflow: hidden; transition: all 0.15s; z-index: 5; border-left: 3px solid;
}
.event-block:hover {
  transform: scale(1.02); box-shadow: 0 4px 12px rgba(0,0,0,0.3); z-index: 15;
}
.event-block-title {
  font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.event-block-time { font-size: 0.68rem; opacity: 0.7; margin-top: 1px; }
.event-block-project { font-size: 0.68rem; opacity: 0.6; margin-top: 2px; }

.cal-bottom-row {
  display: grid; grid-template-columns: 1.5fr 1fr; gap: 16px;
}
.cal-bottom-row .card { padding: 20px; }
.cal-today-item {
  display: flex; align-items: center; gap: 12px; padding: 10px 0;
  border-bottom: 1px solid var(--border-light);
}
.cal-today-item:last-child { border-bottom: none; }
.cal-today-time {
  font-size: 0.78rem; font-weight: 500; color: var(--text-2);
  font-variant-numeric: tabular-nums; width: 48px; flex-shrink: 0;
}
.cal-today-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.cal-today-info { flex: 1; min-width: 0; }
.cal-today-name { font-size: 0.85rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-today-project { font-size: 0.72rem; color: var(--text-muted); margin-top: 1px; }
.cal-today-duration { font-size: 0.72rem; color: var(--text-muted); font-variant-numeric: tabular-nums; flex-shrink: 0; }

.cal-stats {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; text-align: center;
}
.cal-stat {
  padding: 16px 4px; background: rgba(16,32,56,0.5);
  border-radius: var(--radius-sm);
}
.cal-stat-value { display: block; font-size: 1.4rem; font-weight: 800; color: var(--accent); }
.cal-stat-label {
  font-size: 0.68rem; color: var(--text-muted); text-transform: uppercase;
  letter-spacing: 0.04em; margin-top: 4px;
}
.cal-empty {
  padding: 24px 16px; text-align: center; color: var(--text-muted); font-size: 0.85rem;
}

/* Event block title row — icon + title + priority badge inline */
.event-block-row {
  display: flex; align-items: center; gap: 4px; min-width: 0;
}
.event-block-row .event-block-title { flex: 1; min-width: 0; }

/* Source icon inside event blocks */
.ev-src-icon { flex-shrink: 0; opacity: 0.85; }

/* Priority badge (single letter, inline in event block) */
.ev-priority {
  display: inline-flex; align-items: center; justify-content: center;
  width: 16px; height: 16px; border-radius: 4px;
  font-size: 0.6rem; font-weight: 700; flex-shrink: 0;
  line-height: 1; text-transform: uppercase;
}
.ev-priority-critical { background: rgba(248, 113, 113, 0.25); color: #fca5a5; }
.ev-priority-high     { background: rgba(251, 191, 36, 0.25);  color: #fcd34d; }
.ev-priority-medium   { background: rgba(59, 130, 246, 0.2);   color: #93c5fd; }
.ev-priority-low      { background: rgba(100, 116, 139, 0.2);  color: var(--text-muted); }

/* Calendar legend (source color key in top bar) */
.cal-legend {
  display: flex; align-items: center; gap: 12px;
  font-size: 0.72rem; color: var(--text-muted); margin-right: 12px;
}
.cal-legend-item {
  display: flex; align-items: center; gap: 4px; white-space: nowrap;
}
.cal-legend-dot {
  width: 8px; height: 8px; border-radius: 2px; flex-shrink: 0;
}

/* Today list — source icon next to name */
.cal-today-icon { display: inline-flex; vertical-align: middle; margin-right: 4px; }
.cal-today-name .ev-priority { margin-left: 6px; vertical-align: middle; }
.cal-today-item[role="button"] { cursor: pointer; }
.cal-today-item[role="button"]:hover { background: rgba(56, 189, 248, 0.04); }
.cal-today-item:focus-visible {
  outline: 2px solid var(--accent); outline-offset: -2px; border-radius: 6px;
}

/* ── Event Detail Panel (slide-in content) ── */
.evd-badges {
  display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px;
}
.evd-source-badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px; border-radius: 6px;
  font-size: 0.75rem; font-weight: 600;
}
.evd-priority-badge {
  display: inline-flex; align-items: center;
  padding: 4px 10px; border-radius: 6px;
  font-size: 0.75rem; font-weight: 600; text-transform: capitalize;
}
.evd-status-badge {
  display: inline-flex; align-items: center;
  padding: 4px 10px; border-radius: 6px;
  font-size: 0.75rem; font-weight: 600; text-transform: capitalize;
  background: rgba(255, 255, 255, 0.06); color: var(--text-muted);
  border: 1px solid rgba(255, 255, 255, 0.06);
}
.evd-status-scheduled    { background: rgba(59, 130, 246, 0.12); color: var(--blue-bright); border-color: rgba(59, 130, 246, 0.2); }
.evd-status-in_progress  { background: rgba(52, 211, 153, 0.12); color: var(--green); border-color: rgba(52, 211, 153, 0.2); }
.evd-status-completed    { background: rgba(100, 116, 139, 0.12); color: var(--text-muted); border-color: rgba(100, 116, 139, 0.15); }
.evd-status-deferred     { background: rgba(251, 191, 36, 0.12); color: var(--amber); border-color: rgba(251, 191, 36, 0.2); }

.evd-section {
  margin-bottom: 16px; padding-bottom: 16px;
  border-bottom: 1px solid var(--card-border);
}
.evd-section:last-of-type { border-bottom: none; }
.evd-section-title {
  font-size: 0.68rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--text-muted); margin-bottom: 10px;
}
.evd-row {
  display: flex; align-items: baseline; justify-content: space-between;
  padding: 4px 0; font-size: 0.82rem;
}
.evd-label { color: var(--text-muted); flex-shrink: 0; margin-right: 12px; }
.evd-value { color: var(--text-2); font-weight: 500; text-align: right; }

.evd-meta {
  display: flex; flex-direction: column; gap: 4px;
}
.evd-meta-row {
  display: flex; align-items: baseline; justify-content: space-between;
  padding: 3px 0; font-size: 0.78rem;
}
.evd-meta-key {
  color: var(--text-muted); font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
}
.evd-meta-val { color: var(--text-2); }

/* ── Event Detail: AP3 Guidance Section ── */
.evd-guidance-section {
  background: rgba(56, 189, 248, 0.04);
  border-radius: 8px; padding: 14px 16px; margin-bottom: 16px;
  border: 1px solid rgba(56, 189, 248, 0.1);
  border-bottom: 1px solid rgba(56, 189, 248, 0.1);
}
.evd-guidance-text {
  font-size: 0.82rem; color: var(--text-2); line-height: 1.55;
  margin-bottom: 10px;
}
.evd-risk-row {
  display: flex; align-items: center; gap: 10px;
  padding: 4px 0; font-size: 0.82rem;
}
.evd-risk-badge {
  display: inline-flex; align-items: center;
  padding: 3px 10px; border-radius: 5px;
  font-size: 0.72rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.04em;
}
.evd-risk-low {
  background: rgba(52, 211, 153, 0.12); color: var(--green);
  border: 1px solid rgba(52, 211, 153, 0.2);
}
.evd-risk-med {
  background: rgba(251, 191, 36, 0.12); color: var(--amber);
  border: 1px solid rgba(251, 191, 36, 0.2);
}
.evd-risk-high {
  background: rgba(248, 113, 113, 0.12); color: var(--red);
  border: 1px solid rgba(248, 113, 113, 0.2);
}
.evd-action-detail {
  display: flex; align-items: baseline; gap: 10px;
  padding: 6px 0 0; font-size: 0.82rem;
}
.evd-action-text {
  color: var(--text-2); font-weight: 500; line-height: 1.45;
}

/* Risk badge on day cards */
.day-ev-risk {
  display: inline-flex; align-items: center;
  padding: 2px 7px; border-radius: 4px;
  font-size: 0.65rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.03em;
}

.evd-actions {
  margin-top: 20px; padding-top: 16px;
  border-top: 1px solid var(--card-border);
}
.evd-timer-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 20px; border-radius: 8px;
  background: rgba(52, 211, 153, 0.12); border: 1px solid rgba(52, 211, 153, 0.25);
  color: var(--green); font-family: inherit;
  font-size: 0.82rem; font-weight: 600; cursor: pointer;
  transition: all 0.15s;
}
.evd-timer-btn:hover {
  background: rgba(52, 211, 153, 0.2); border-color: rgba(52, 211, 153, 0.4);
  transform: translateY(-1px);
}
.evd-timer-btn:focus-visible {
  outline: 2px solid var(--green); outline-offset: 2px;
}

/* ── Event Detail: Action Button Rows ── */
.evd-action-row {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.evd-action-row-secondary { margin-top: 8px; }

.evd-action-btn {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 7px 14px; border-radius: 8px;
  font-family: inherit; font-size: 0.78rem; font-weight: 600;
  cursor: pointer; transition: all 0.15s; border: 1px solid;
  white-space: nowrap;
}
.evd-action-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.evd-action-btn:disabled { opacity: 0.55; cursor: not-allowed; pointer-events: none; }

/* Send to AP — purple accent */
.evd-btn-dispatch {
  background: rgba(167, 139, 250, 0.1); border-color: rgba(167, 139, 250, 0.2);
  color: var(--purple);
}
.evd-btn-dispatch:hover {
  background: rgba(167, 139, 250, 0.18); border-color: rgba(167, 139, 250, 0.35);
}

/* Mark Done — green */
.evd-btn-done {
  background: rgba(52, 211, 153, 0.08); border-color: rgba(52, 211, 153, 0.18);
  color: var(--green);
}
.evd-btn-done:hover {
  background: rgba(52, 211, 153, 0.16); border-color: rgba(52, 211, 153, 0.3);
}

/* Reschedule — blue */
.evd-btn-reschedule {
  background: rgba(56, 189, 248, 0.08); border-color: rgba(56, 189, 248, 0.15);
  color: var(--accent);
}
.evd-btn-reschedule:hover {
  background: rgba(56, 189, 248, 0.16); border-color: rgba(56, 189, 248, 0.3);
}

/* Defer — subtle muted */
.evd-btn-defer {
  background: rgba(255, 255, 255, 0.04); border-color: rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
}
.evd-btn-defer:hover {
  background: rgba(255, 255, 255, 0.08); border-color: rgba(255, 255, 255, 0.14);
  color: var(--text-2);
}

/* Confirm — green solid */
.evd-btn-confirm {
  background: rgba(52, 211, 153, 0.14); border-color: rgba(52, 211, 153, 0.3);
  color: var(--green);
}
.evd-btn-confirm:hover {
  background: rgba(52, 211, 153, 0.22); border-color: rgba(52, 211, 153, 0.45);
}

/* Cancel — muted */
.evd-btn-cancel {
  background: transparent; border-color: rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
}
.evd-btn-cancel:hover {
  background: rgba(255, 255, 255, 0.04); border-color: rgba(255, 255, 255, 0.14);
}

/* Button states: loading / success / error */
.evd-btn-loading {
  opacity: 0.7; cursor: wait;
}
.evd-btn-spinner {
  display: inline-block; width: 10px; height: 10px;
  border: 2px solid currentColor; border-top-color: transparent;
  border-radius: 50%; animation: spin 0.6s linear infinite;
  flex-shrink: 0;
}
.evd-btn-success {
  background: rgba(52, 211, 153, 0.15) !important;
  border-color: rgba(52, 211, 153, 0.35) !important;
  color: var(--green) !important;
}
.evd-btn-error {
  background: rgba(248, 113, 113, 0.12) !important;
  border-color: rgba(248, 113, 113, 0.25) !important;
  color: var(--red) !important;
}

/* Reschedule date picker row */
.evd-reschedule-picker {
  display: none; align-items: center; gap: 8px;
  margin-top: 10px; padding: 10px 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--card-border);
  border-radius: 8px;
}
.evd-reschedule-picker.open { display: flex; }

.evd-date-input {
  flex: 1; min-width: 0;
  padding: 7px 10px; border-radius: 6px;
  border: 1px solid var(--card-border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text); font-family: 'JetBrains Mono', monospace;
  font-size: 0.78rem;
  color-scheme: dark;
}
.evd-date-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-light);
  outline: none;
}

/* ── Day View Card: Additional Action Buttons ── */
.day-ev-btn-dispatch {
  background: rgba(167, 139, 250, 0.08); border-color: rgba(167, 139, 250, 0.15);
  color: var(--purple);
}
.day-ev-btn-dispatch:hover {
  background: rgba(167, 139, 250, 0.16); border-color: rgba(167, 139, 250, 0.3);
}
.day-ev-btn-done {
  background: rgba(52, 211, 153, 0.06); border-color: rgba(52, 211, 153, 0.12);
  color: var(--green);
}
.day-ev-btn-done:hover {
  background: rgba(52, 211, 153, 0.14); border-color: rgba(52, 211, 153, 0.25);
}
.day-ev-btn-defer {
  background: rgba(255, 255, 255, 0.03); border-color: rgba(255, 255, 255, 0.06);
  color: var(--text-muted); padding: 5px 8px; font-size: 0.68rem;
}
.day-ev-btn-defer:hover {
  background: rgba(255, 255, 255, 0.06); border-color: rgba(255, 255, 255, 0.12);
  color: var(--text-2);
}

/* ── View Toggle (Week / Day) ── */
.cal-view-toggle {
  display: inline-flex; border-radius: 8px; overflow: hidden;
  border: 1px solid var(--card-border); margin-right: 6px;
}
.cal-view-btn {
  padding: 6px 14px; font-family: inherit; font-size: 0.78rem;
  font-weight: 600; cursor: pointer; border: none; transition: all 0.15s;
  background: rgba(255,255,255,0.03); color: var(--text-muted);
}
.cal-view-btn:first-child { border-right: 1px solid var(--card-border); }
.cal-view-btn:hover { color: var(--text-2); background: rgba(255,255,255,0.06); }
.cal-view-btn.active {
  background: rgba(56, 189, 248, 0.12); color: var(--accent);
  box-shadow: inset 0 0 0 1px rgba(56, 189, 248, 0.2);
}

/* ── Clickable day headers in week view ── */
.grid-header-clickable { cursor: pointer; transition: background 0.15s; }
.grid-header-clickable:hover { background: rgba(56, 189, 248, 0.08); }
.grid-header-clickable:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

/* ── Calendar Grid Container (shared base for week + day) ── */
.cal-grid-container {
  --hour-height: 48px;
  border: 1px solid var(--card-border); border-radius: var(--radius);
  overflow: hidden; overflow-y: auto; background: var(--card);
}

/* ── Day Grid ── */
.cal-day-grid {
  display: grid; grid-template-columns: 60px 1fr;
  gap: 0;
}
.day-grid-corner {
  padding: 14px 8px; border-bottom: 1px solid var(--card-border);
  background: rgba(16, 32, 56, 0.5);
}
.day-grid-header {
  padding: 14px 16px; border-bottom: 1px solid var(--card-border);
  background: rgba(16, 32, 56, 0.5); text-align: left;
}
.day-grid-header .header-day {
  font-size: 0.88rem; font-weight: 600; color: var(--text-2);
}
.day-grid-cell {
  min-height: var(--hour-height, 48px); border-bottom: 1px solid var(--border-light);
  position: relative;
}

/* ── Day Event Cards (larger, detailed) ── */
.day-event-card {
  position: absolute; left: 8px; right: 8px; border-radius: 10px;
  padding: 12px 16px; cursor: pointer; overflow: hidden;
  transition: all 0.15s ease; z-index: 5; border-left: 4px solid;
  background: var(--card); box-shadow: var(--shadow);
  border-top: 1px solid var(--card-border);
  border-right: 1px solid var(--card-border);
  border-bottom: 1px solid var(--card-border);
  display: flex; flex-direction: column; gap: 6px;
}
.day-event-card:hover {
  transform: translateX(2px); box-shadow: 0 6px 20px rgba(0,0,0,0.35); z-index: 15;
}

/* Card header: source badge + priority + status */
.day-ev-header {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
}
.day-ev-source {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 5px;
  font-size: 0.68rem; font-weight: 600;
}
.day-ev-status {
  font-size: 0.62rem; font-weight: 700; padding: 2px 7px;
  border-radius: 4px; text-transform: capitalize;
  background: rgba(255,255,255,0.06); color: var(--text-muted);
  border: 1px solid rgba(255,255,255,0.06);
}
.day-ev-status-scheduled    { background: rgba(59, 130, 246, 0.12); color: var(--blue-bright); border-color: rgba(59, 130, 246, 0.2); }
.day-ev-status-in_progress  { background: rgba(52, 211, 153, 0.12); color: var(--green); border-color: rgba(52, 211, 153, 0.2); }
.day-ev-status-completed    { background: rgba(100, 116, 139, 0.12); color: var(--text-muted); border-color: rgba(100, 116, 139, 0.15); }
.day-ev-status-deferred     { background: rgba(251, 191, 36, 0.12); color: var(--amber); border-color: rgba(251, 191, 36, 0.2); }

/* Card title */
.day-ev-title {
  font-size: 0.92rem; font-weight: 700; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* Card meta: project + time */
.day-ev-meta {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  font-size: 0.75rem; color: var(--text-muted);
}
.day-ev-project {
  font-weight: 600; color: var(--text-2);
}
.day-ev-project::after {
  content: '\00b7'; margin-left: 10px; color: var(--text-muted);
}
.day-ev-time {
  font-family: 'JetBrains Mono', monospace; font-size: 0.72rem;
}

/* Card description */
.day-ev-desc {
  font-size: 0.78rem; color: var(--text-2); line-height: 1.45;
  overflow: hidden; display: -webkit-box;
  -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}

/* Card action buttons */
.day-ev-actions {
  display: flex; align-items: center; gap: 6px; margin-top: 2px; flex-wrap: wrap;
}
.day-ev-btn {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 12px; border-radius: 6px;
  font-family: inherit; font-size: 0.72rem; font-weight: 600;
  cursor: pointer; transition: all 0.15s; border: 1px solid;
}
.day-ev-btn-timer {
  background: rgba(52, 211, 153, 0.1); border-color: rgba(52, 211, 153, 0.2);
  color: var(--green);
}
.day-ev-btn-timer:hover {
  background: rgba(52, 211, 153, 0.2); border-color: rgba(52, 211, 153, 0.35);
}
.day-ev-btn-detail {
  background: rgba(56, 189, 248, 0.08); border-color: rgba(56, 189, 248, 0.15);
  color: var(--accent);
}
.day-ev-btn-detail:hover {
  background: rgba(56, 189, 248, 0.16); border-color: rgba(56, 189, 248, 0.3);
}
.day-ev-btn:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}


/* ═══ Security Panel (detail view) ═══ */
.sec-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px; flex-wrap: wrap; gap: 10px;
}
.sec-header-left { display: flex; align-items: center; gap: 10px; }
.sec-header-left svg { color: var(--accent); flex-shrink: 0; }
.sec-header-title { font-size: 1rem; font-weight: 700; }
.sec-header-scan { font-size: 0.78rem; color: var(--text-muted); }

.sec-badge {
  display: inline-flex; align-items: center; padding: 5px 14px;
  border-radius: 20px; font-size: 0.72rem; font-weight: 600;
  letter-spacing: 0.04em; text-transform: uppercase; white-space: nowrap;
}
.sec-badge-green { background: var(--green-bg); color: var(--green); border: 1px solid rgba(52,211,153,0.2); }
.sec-badge-amber { background: var(--amber-bg); color: var(--amber); border: 1px solid rgba(251,191,36,0.2); }
.sec-badge-red { background: var(--red-bg); color: var(--red); border: 1px solid rgba(248,113,113,0.2); }

.sec-section-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px; margin-bottom: 20px;
}
.sec-card {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 14px 16px; border-radius: var(--radius-sm);
  border: 1px solid var(--card-border); background: var(--card);
  box-shadow: var(--shadow); transition: border-color 0.15s;
}
.sec-card-fail { border-color: rgba(248,113,113,0.3); background: var(--red-bg); }
.sec-card-warn { border-color: rgba(251,191,36,0.25); background: var(--amber-bg); }
.sec-card-pass { border-color: var(--card-border); }
.sec-card-icon { flex-shrink: 0; margin-top: 1px; }
.sec-icon-fail { color: var(--red); }
.sec-icon-warn { color: var(--amber); }
.sec-icon-pass { color: var(--green); opacity: 0.6; }
.sec-card-body { flex: 1; min-width: 0; }
.sec-card-name { font-size: 0.85rem; font-weight: 600; margin-bottom: 2px; }
.sec-card-fail .sec-card-name { color: var(--red); }
.sec-card-summary {
  font-size: 0.75rem; color: var(--text-2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.sec-infra { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
.sec-infra-row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px; border-radius: var(--radius-sm);
  border: 1px solid var(--card-border); background: var(--card); box-shadow: var(--shadow);
}
.sec-infra-row.sec-infra-bad { border-color: rgba(248,113,113,0.2); background: rgba(248,113,113,0.04); }
.sec-infra-row.sec-infra-ok { border-color: rgba(52,211,153,0.15); background: rgba(52,211,153,0.04); }
.sec-infra-icon { flex-shrink: 0; color: var(--text-muted); }
.sec-infra-bad .sec-infra-icon { color: var(--red); }
.sec-infra-ok .sec-infra-icon { color: var(--green); opacity: 0.7; }
.sec-infra-label { font-size: 0.82rem; font-weight: 600; white-space: nowrap; min-width: 120px; }
.sec-infra-detail {
  font-size: 0.78rem; color: var(--text-2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.sec-empty { padding: 60px 20px; text-align: center; }
.sec-empty-icon { color: var(--text-muted); opacity: 0.4; margin-bottom: 12px; }
.sec-empty-icon svg { width: 32px; height: 32px; }
.sec-empty-msg { font-size: 0.88rem; color: var(--text-muted); }
.sec-empty-sub { font-size: 0.75rem; color: var(--text-muted); opacity: 0.7; }

/* Clickable section cards */
.sec-card-clickable { cursor: pointer; position: relative; }
.sec-card-clickable:hover { border-color: var(--accent); }
.sec-card-arrow {
  flex-shrink: 0; font-size: 1.2rem; color: var(--text-muted);
  opacity: 0.4; align-self: center; transition: opacity 0.15s;
}
.sec-card-clickable:hover .sec-card-arrow { opacity: 0.8; color: var(--accent); }

/* Actionable items */
.sec-items-count { font-size: 0.78rem; color: var(--text-muted); }
.sec-items-summary { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.sec-items-pill {
  font-size: 0.75rem; font-weight: 600; padding: 3px 10px;
  border-radius: 20px; text-transform: uppercase; letter-spacing: 0.03em;
}
.sec-items-crit { background: var(--red-bg); color: var(--red); border: 1px solid rgba(248,113,113,0.2); }
.sec-items-warn { background: var(--amber-bg); color: var(--amber); border: 1px solid rgba(251,191,36,0.2); }
.sec-items-list { display: flex; flex-direction: column; gap: 14px; }
.sec-items-module-name {
  font-size: 0.8rem; font-weight: 600; color: var(--text-2);
  margin-bottom: 6px; padding-bottom: 4px; border-bottom: 1px solid var(--card-border);
}
.sec-item {
  display: flex; align-items: baseline; gap: 8px;
  padding: 4px 0; font-size: 0.8rem; color: var(--text-1);
}
.sec-item-sev {
  flex-shrink: 0; font-size: 0.65rem; font-weight: 700;
  padding: 1px 6px; border-radius: 4px; text-transform: uppercase;
}
.sec-item-crit .sec-item-sev { background: var(--red-bg); color: var(--red); }
.sec-item-warn .sec-item-sev { background: var(--amber-bg); color: var(--amber); }
.sec-item-desc { flex: 1; min-width: 0; }

/* Trends */
.sec-trends-date { font-size: 0.78rem; color: var(--text-muted); }
.sec-trends-table {
  width: 100%; border-collapse: collapse; font-size: 0.82rem;
}
.sec-trends-table th {
  text-align: left; padding: 6px 12px; color: var(--text-muted);
  font-weight: 500; font-size: 0.75rem; text-transform: uppercase;
  letter-spacing: 0.05em; border-bottom: 1px solid var(--card-border);
}
.sec-trends-table td {
  padding: 6px 12px; border-bottom: 1px solid rgba(255,255,255,0.04);
  color: var(--text-1);
}
.sec-trend-crit td { color: var(--red); font-weight: 600; }
.sec-trend-total td { font-weight: 700; border-top: 1px solid var(--card-border); }
.sec-trends-baseline {
  margin-top: 10px; padding: 10px 14px; font-size: 0.78rem;
  color: var(--text-2); background: rgba(255,255,255,0.02);
  border-radius: var(--radius-sm); border: 1px solid var(--card-border);
  white-space: pre-line;
}


/* ═══ Security Cockpit — detail page layout ═══ */

/* Row 1: gauge · KPI cards · alert feed */
.sec-cockpit-row1 {
  display: grid;
  grid-template-columns: 180px 1fr 280px;
  gap: 12px;
  margin-bottom: 12px;
  align-items: stretch;
}

/* Row 2: trend chart · priority findings */
.sec-cockpit-row2 {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 12px;
  margin-bottom: 12px;
}

/* ── Fleet gauge card ── */
.sec-gauge-card { min-width: 0; }
.sec-gauge-body { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 12px !important; }
.sec-gauge-svg  { display: block; }
.sec-gauge-stats { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.sec-gauge-stat  { display: flex; align-items: center; gap: 4px; }
.sec-gauge-dot   { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.sec-gauge-val   { font-size: 0.82rem; font-weight: 700; font-family: 'JetBrains Mono', monospace; line-height: 1; }
.sec-gauge-lbl   { font-size: 0.65rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }

/* ── KPI cards ── */
.sec-kpi-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  align-content: start;
}
.sec-kpi-card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  display: flex; flex-direction: column; gap: 6px;
  transition: border-color 0.15s;
}
.sec-kpi-card:hover { border-color: var(--card-border-bright); }
.sec-kpi-top   { display: flex; justify-content: space-between; align-items: center; }
.sec-kpi-label { font-size: 0.68rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; font-weight: 600; }
.sec-kpi-trend { font-size: 0.72rem; }
.sec-kpi-value { font-size: 1.5rem; font-weight: 700; font-family: 'JetBrains Mono', monospace; line-height: 1; }
.sec-kpi-bar   { height: 2px; background: rgba(80,200,255,0.08); border-radius: 2px; overflow: hidden; }
.sec-kpi-bar-fill { height: 100%; border-radius: 2px; min-width: 4px; transition: width 0.4s ease; opacity: 0.7; }

/* ── Alert feed card ── */
.sec-alert-card { min-width: 0; }
.sec-alert-body {
  display: flex; flex-direction: column; gap: 0;
  max-height: 220px; overflow-y: auto; padding: 0 !important;
}
.sec-alert-body::-webkit-scrollbar { width: 3px; }
.sec-alert-body::-webkit-scrollbar-thumb { background: rgba(80,200,255,0.2); border-radius: 3px; }
.sec-alert-row {
  display: flex; gap: 0; align-items: stretch;
  border-bottom: 1px solid rgba(80,200,255,0.06);
  transition: background 0.12s;
}
.sec-alert-row:hover { background: rgba(80,200,255,0.04); }
.sec-alert-row:last-child { border-bottom: none; }
.sec-alert-strip { width: 3px; flex-shrink: 0; border-radius: 0; }
.sec-alert-content { flex: 1; min-width: 0; padding: 7px 12px; }
.sec-alert-title { font-size: 0.75rem; color: var(--text); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sec-alert-meta  { display: flex; gap: 8px; align-items: center; margin-top: 2px; }
.sec-alert-id    { font-size: 0.65rem; font-family: 'JetBrains Mono', monospace; }
.sec-alert-host  { font-size: 0.65rem; color: var(--text-muted); }
.sec-alert-age   { font-size: 0.65rem; font-weight: 700; font-family: 'JetBrains Mono', monospace; margin-left: auto; }
.sec-alert-empty { padding: 24px; text-align: center; color: var(--text-muted); font-size: 0.82rem; }

/* ── Trend card period selector ── */
.sec-trend-card  { min-width: 0; }
.sec-period-group { display: flex; gap: 4px; }
.sec-period-btn {
  background: rgba(80,200,255,0.06);
  color: var(--text-muted);
  border: 1px solid var(--card-border);
  border-radius: 5px;
  padding: 3px 9px;
  font-size: 0.68rem; font-weight: 600; font-family: inherit;
  cursor: pointer; transition: all 0.15s;
}
.sec-period-btn:hover { border-color: var(--accent); color: var(--accent); }
.sec-period-btn.active {
  background: rgba(56,189,248,0.12);
  border-color: var(--accent);
  color: var(--accent);
}

/* ── Priority findings table ── */
.sec-findings-card { min-width: 0; }
.sec-findings-table {
  width: 100%; border-collapse: collapse; font-size: 0.78rem;
}
.sec-findings-table th {
  text-align: left; padding: 8px 12px;
  font-size: 0.65rem; color: var(--text-muted);
  font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em;
  border-bottom: 1px solid var(--card-border);
}
.sec-findings-table td {
  padding: 7px 12px; border-bottom: 1px solid rgba(80,200,255,0.04);
  color: var(--text);
  max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.sec-findings-table tr:last-child td { border-bottom: none; }

/* ── Module grid (6 per row) ── */
.sec-module-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
}
.sec-mod-card {
  position: relative;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  transition: border-color 0.15s, background 0.15s;
}
.sec-mod-clickable { cursor: pointer; }
.sec-mod-clickable:hover { border-color: var(--card-border-bright); background: var(--card-hover); }
.sec-mod-fail { border-color: rgba(248,113,113,0.25); background: rgba(248,113,113,0.04); }
.sec-mod-fail:hover { border-color: rgba(248,113,113,0.5); }
.sec-mod-warn { border-color: rgba(251,191,36,0.2); background: rgba(251,191,36,0.03); }
.sec-mod-warn:hover { border-color: rgba(251,191,36,0.45); }
.sec-mod-pass:hover { border-color: rgba(52,211,153,0.3); }
.sec-mod-accent {
  position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
}
.sec-mod-inner {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 10px 10px 13px;
}
.sec-mod-abbr {
  flex-shrink: 0;
  width: 28px; height: 28px;
  border-radius: 6px;
  border: 1px solid;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.65rem; font-weight: 700; font-family: 'JetBrains Mono', monospace;
  background: rgba(80,200,255,0.05);
}
.sec-mod-info { flex: 1; min-width: 0; }
.sec-mod-name   { font-size: 0.72rem; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sec-mod-status { font-size: 0.6rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; margin-top: 1px; }
.sec-mod-arrow  { flex-shrink: 0; font-size: 1rem; color: var(--text-muted); opacity: 0.4; transition: opacity 0.15s; }
.sec-mod-clickable:hover .sec-mod-arrow { opacity: 0.8; color: var(--accent); }

/* ── Pending banner ── */
.sec-pending-banner { border-color: rgba(251,191,36,0.3); }

/* ── Responsive: collapse to 3-col module grid on smaller screens ── */
@media (max-width: 1280px) {
  .sec-cockpit-row1 { grid-template-columns: 160px 1fr 240px; }
  .sec-cockpit-row2 { grid-template-columns: 1fr 320px; }
  .sec-module-grid  { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 960px) {
  .sec-cockpit-row1 { grid-template-columns: 1fr 1fr; }
  .sec-cockpit-row1 .sec-alert-card { grid-column: 1 / -1; }
  .sec-cockpit-row2 { grid-template-columns: 1fr; }
  .sec-module-grid  { grid-template-columns: repeat(3, 1fr); }
}

/* ═══ Housekeeping Panel (detail view) ═══ */
.hk-panel { display: flex; flex-direction: column; gap: 16px; }
.hk-sync-alert {
  background: rgba(248,113,113,0.06); border: 2px solid rgba(248,113,113,0.3);
  border-radius: var(--radius); padding: 16px 20px;
  display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-start;
}
.hk-sync-alert-icon { color: var(--red); flex-shrink: 0; margin-top: 1px; }
.hk-sync-alert-body { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.hk-sync-alert-body strong { font-size: 0.88rem; color: var(--red); }
.hk-sync-alert-body span { font-size: 0.78rem; color: var(--text-2); }
.hk-sync-alert-list {
  width: 100%; list-style: none; padding: 8px 0 0; margin: 0;
  border-top: 1px solid rgba(248,113,113,0.12);
  font-size: 0.78rem; color: var(--text-2);
}
.hk-sync-alert-list li { padding: 2px 0; }

.hk-header {
  background: var(--card); border: 1px solid var(--card-border);
  border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow);
}
.hk-header-top {
  display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px;
}
.hk-score { display: flex; align-items: baseline; gap: 4px; }
.hk-score-num { font-size: 1.4rem; font-weight: 800; }
.hk-score-sep { font-size: 1rem; color: var(--text-muted); font-weight: 300; margin: 0 2px; }
.hk-score-label { font-size: 0.82rem; color: var(--text-2); font-weight: 500; margin-left: 8px; }
.hk-rescan-btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px;
  background: rgba(255,255,255,0.04); border: 1px solid var(--card-border);
  border-radius: 8px; color: var(--text-2); font-family: inherit;
  font-size: 0.78rem; font-weight: 500; cursor: pointer; transition: all 0.15s;
}
.hk-rescan-btn:hover { border-color: var(--accent); color: var(--accent); }
.hk-rescan-btn:disabled { opacity: 0.55; cursor: not-allowed; }
.hk-rescan-spinning svg { animation: spin 0.8s linear infinite; }

.hk-progress {
  width: 100%; height: 6px; background: rgba(255,255,255,0.06);
  border-radius: 3px; overflow: hidden; margin-bottom: 12px;
}
.hk-progress-fill { height: 100%; border-radius: 3px; transition: width 0.4s ease; }
.hk-progress-green { background: var(--green); }
.hk-progress-blue { background: var(--blue); }
.hk-progress-red { background: var(--red); }

.hk-meta {
  display: flex; align-items: center; justify-content: space-between; font-size: 0.75rem;
}
.hk-scan-time { color: var(--text-muted); }
.hk-counts { display: flex; gap: 10px; }
.hk-count-critical { color: var(--red); font-weight: 600; }
.hk-count-warning { color: var(--amber); font-weight: 600; }
.hk-count-info { color: var(--text-muted); font-weight: 500; }

.hk-all-clear {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  padding: 32px 20px; background: var(--green-bg);
  border: 1px solid rgba(52,211,153,0.2); border-radius: var(--radius);
  color: var(--green); font-size: 0.92rem; font-weight: 600;
}

.hk-violations { display: flex; flex-direction: column; gap: 12px; }
.hk-severity-group {
  border: 1px solid var(--card-border); border-radius: var(--radius);
  overflow: hidden; background: var(--card); box-shadow: var(--shadow);
}
.hk-severity-header {
  display: flex; align-items: center; gap: 10px; padding: 14px 20px;
  cursor: pointer; font-size: 0.85rem; list-style: none; user-select: none;
}
.hk-severity-header::-webkit-details-marker { display: none; }
.hk-severity-header::marker { content: ''; }
.hk-severity-header::before {
  content: '\25B8'; font-size: 0.72rem; color: var(--text-muted); transition: transform 0.15s;
}
details[open] > .hk-severity-header::before { transform: rotate(90deg); }
.hk-severity-badge {
  font-size: 0.68rem; font-weight: 700; padding: 2px 8px; border-radius: 4px;
  letter-spacing: 0.04em; text-transform: uppercase;
}
.hk-badge-critical { background: var(--red-bg); color: var(--red); border: 1px solid rgba(248,113,113,0.2); }
.hk-badge-warning { background: var(--amber-bg); color: var(--amber); border: 1px solid rgba(251,191,36,0.2); }
.hk-badge-info { background: rgba(100,116,139,0.08); color: var(--text-muted); border: 1px solid rgba(100,116,139,0.15); }
.hk-severity-count { font-size: 0.78rem; color: var(--text-2); font-weight: 500; }
.hk-severity-body { padding: 0 20px 16px; display: flex; flex-direction: column; gap: 10px; }

.hk-sev-critical .hk-severity-header { border-left: 3px solid var(--red); }
.hk-sev-warning .hk-severity-header { border-left: 3px solid var(--amber); }
.hk-sev-info .hk-severity-header { border-left: 3px solid var(--text-muted); }

.hk-project {
  padding: 12px 16px; border-radius: var(--radius-sm); border: 1px solid;
}
.hk-project-critical { border-color: rgba(248,113,113,0.15); background: rgba(248,113,113,0.04); }
.hk-project-warning { border-color: rgba(251,191,36,0.12); background: rgba(251,191,36,0.03); }
.hk-project-info { border-color: var(--border-light); background: rgba(255,255,255,0.02); }
.hk-project-name { font-size: 0.82rem; font-weight: 600; margin-bottom: 8px; }
.hk-checks { list-style: none; padding: 0; }
.hk-check { font-size: 0.78rem; color: var(--text-2); padding: 3px 0; display: flex; gap: 6px; }
.hk-check-name { font-weight: 500; color: var(--text); flex-shrink: 0; }
.hk-check-msg { color: var(--text-muted); }


/* ═══ Infrastructure Panel (detail view) ═══ */
.inf-panel { display: flex; flex-direction: column; gap: 14px; }
.inf-header {
  display: flex; align-items: center; justify-content: space-between;
}
.inf-header-left { display: flex; align-items: center; gap: 10px; }
.inf-header-left svg { color: var(--accent); }
.inf-header-title { font-size: 1rem; font-weight: 700; }
.inf-header-count { font-size: 0.82rem; color: var(--text-muted); }
.inf-refreshed { font-size: 0.72rem; color: var(--text-muted); }

.inf-error {
  padding: 40px 20px; text-align: center;
}
.inf-error-icon { color: var(--amber); margin-bottom: 8px; }
.inf-error-title { font-size: 1rem; font-weight: 600; margin-bottom: 4px; }
.inf-error-msg { font-size: 0.82rem; color: var(--text-muted); }

.inf-group {
  border: 1px solid var(--card-border); border-radius: var(--radius);
  background: var(--card); box-shadow: var(--shadow); overflow: hidden;
}
.inf-group-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; cursor: pointer; list-style: none;
  user-select: none;
}
.inf-group-header::-webkit-details-marker { display: none; }
.inf-group-header::marker { content: ''; }
.inf-group-name { font-size: 0.88rem; font-weight: 600; }
.inf-group-badge {
  font-size: 0.72rem; padding: 2px 8px; border-radius: 10px;
  background: var(--green-bg); color: var(--green); font-weight: 600;
}
.inf-group-body { padding: 0 16px 16px; }

.inf-table {
  width: 100%; border-collapse: collapse; font-size: 0.78rem;
}
.inf-table thead { border-bottom: 1px solid var(--card-border); }
.inf-table th {
  text-align: left; padding: 8px 10px; font-size: 0.68rem;
  font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--text-muted);
}
.inf-table td { padding: 8px 10px; border-bottom: 1px solid var(--border-light); }
.inf-cell-name { font-weight: 500; }
.inf-cell-image { color: var(--text-muted); font-size: 0.72rem; max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inf-cell-ports { font-size: 0.72rem; color: var(--text-muted); }
.inf-cell-uptime { font-size: 0.72rem; color: var(--text-muted); }
.inf-no-ports { color: var(--text-muted); }

.inf-status {
  display: inline-block; font-size: 0.68rem; font-weight: 600;
  padding: 2px 6px; border-radius: 4px; text-transform: uppercase;
}
.inf-status-green { background: var(--green-bg); color: var(--green); }
.inf-status-amber { background: var(--amber-bg); color: var(--amber); }
.inf-status-red { background: var(--red-bg); color: var(--red); }
.inf-status-unknown { background: rgba(255,255,255,0.04); color: var(--text-muted); }

.inf-health {
  display: inline-block; font-size: 0.68rem; font-weight: 500; padding: 2px 6px; border-radius: 4px;
}
.inf-health-green { background: var(--green-bg); color: var(--green); }
.inf-health-red { background: var(--red-bg); color: var(--red); }
.inf-health-amber { background: var(--amber-bg); color: var(--amber); }
.inf-health-none { color: var(--text-muted); }


/* ═══ Login Page — dark adapted ═══ */
body.login-page {
  align-items: center; justify-content: center; padding: 24px;
}
.login-container { width: 100%; max-width: 380px; }
.login-brand {
  display: flex; align-items: center; justify-content: center;
  gap: 12px; margin-bottom: 32px;
}
.login-brand .brand-icon { width: 40px; height: 40px; border-radius: 10px; }
.brand-title { font-size: 1.25rem; font-weight: 700; letter-spacing: -0.02em; }

.login-card {
  background: var(--card); border: 1px solid var(--card-border-bright);
  border-radius: var(--radius); box-shadow: var(--shadow-lg);
  backdrop-filter: blur(24px); padding: 32px;
}
.login-heading { font-size: 1.1rem; font-weight: 600; margin-bottom: 24px; text-align: center; }

.form-group { margin-bottom: 18px; }
.form-label { display: block; font-size: 0.82rem; font-weight: 500; color: var(--text-2); margin-bottom: 6px; }
.form-input {
  width: 100%; padding: 10px 14px;
  border: 1px solid var(--card-border); border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.04); color: var(--text);
  font-family: inherit; font-size: 0.92rem; outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.form-input::placeholder { color: var(--text-muted); }
.form-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-light); }

.login-error {
  display: none; padding: 10px 14px; border-radius: var(--radius-sm);
  background: var(--red-bg); color: var(--red);
  font-size: 0.82rem; font-weight: 500; margin-bottom: 18px;
}
.login-error[aria-hidden="false"] { display: block; }

.login-btn {
  width: 100%; padding: 11px 0; border: none; border-radius: var(--radius-sm);
  background: var(--accent); color: #051525; font-family: inherit;
  font-size: 0.92rem; font-weight: 600; cursor: pointer;
  transition: background 0.15s, opacity 0.15s; margin-top: 6px;
}
.login-btn:hover { background: #60a5fa; }
.login-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.login-btn:disabled { opacity: 0.55; cursor: not-allowed; }

.login-footer { text-align: center; margin-top: 24px; font-size: 0.75rem; color: var(--text-muted); }

@media (max-width: 440px) {
  .login-card { padding: 24px 20px; }
  .login-brand { margin-bottom: 24px; }
}


/* ═══════════════════════════════════════════════════════════
   SlidePanel — right-edge drawer for drill-down detail views.
   Used by compact widget click-through on the dashboard.
   ═══════════════════════════════════════════════════════════ */

.slide-panel-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.slide-panel-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.slide-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(450px, 90vw);
  z-index: 101;
  display: flex;
  flex-direction: column;
  background: rgba(10, 22, 40, 0.97);
  border-left: 1px solid var(--card-border-bright);
  backdrop-filter: blur(24px) saturate(1.3);
  box-shadow: -8px 0 30px rgba(0, 0, 0, 0.4);
  transform: translateX(100%);
  transition: transform 0.25s ease;
}

.slide-panel.open {
  transform: translateX(0);
}

.slide-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--card-border);
  flex-shrink: 0;
}

.slide-panel-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.slide-panel-close {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  color: var(--text-muted);
  transition: all 0.15s;
  flex-shrink: 0;
  margin-left: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.slide-panel-close:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
}

.slide-panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 18px;
  min-height: 0;
}

.slide-panel-body::-webkit-scrollbar { width: 3px; }
.slide-panel-body::-webkit-scrollbar-track { background: transparent; }
.slide-panel-body::-webkit-scrollbar-thumb { background: rgba(80, 200, 255, 0.15); border-radius: 2px; }
.slide-panel-body::-webkit-scrollbar-thumb:hover { background: rgba(80, 200, 255, 0.3); }


/* ═══════════════════════════════════════════════════════════
   Project Detail Panel — content within SlidePanel for
   project drill-down from compact widget.
   ═══════════════════════════════════════════════════════════ */

/* Health score card */
.pd-health {
  padding: 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--card-border);
  background: var(--card);
  margin-bottom: 16px;
}
.pd-health-good  { border-color: rgba(52, 211, 153, 0.25); }
.pd-health-warn  { border-color: rgba(251, 191, 36, 0.25); }
.pd-health-bad   { border-color: rgba(248, 113, 113, 0.25); }

.pd-health-top {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.pd-health-score {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 800;
  font-family: 'JetBrains Mono', monospace;
  flex-shrink: 0;
  background: rgba(100, 116, 139, 0.1);
  color: var(--text-muted);
}
.pd-health-good .pd-health-score  { background: rgba(52, 211, 153, 0.15); color: var(--green); }
.pd-health-warn .pd-health-score  { background: rgba(251, 191, 36, 0.15); color: var(--amber); }
.pd-health-bad .pd-health-score   { background: rgba(248, 113, 113, 0.15); color: var(--red); }
.pd-health-neutral .pd-health-score { background: rgba(100, 116, 139, 0.1); color: var(--text-muted); }

.pd-health-info { flex: 1; }
.pd-health-level {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  text-transform: capitalize;
}
.pd-health-status {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: capitalize;
  margin-top: 2px;
}

/* Progress bar */
.pd-progress { margin-bottom: 8px; }
.pd-progress-bar {
  height: 4px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
  margin-bottom: 4px;
}
.pd-progress-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.3s ease;
}
.pd-progress-fill.fill-blue  { background: var(--blue-bright); }
.pd-progress-fill.fill-green { background: var(--green); }
.pd-progress-fill.fill-red   { background: var(--red); }

.pd-progress-label {
  font-size: 10px;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
}

/* Health stats row */
.pd-health-stats {
  display: flex;
  gap: 12px;
  font-size: 10px;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
  margin-top: 6px;
}

/* Health signals */
.pd-signals {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 8px;
}
.pd-signal {
  font-size: 9px;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-muted);
  border: 1px solid rgba(255, 255, 255, 0.06);
}
.pd-health-good .pd-signal {
  background: rgba(52, 211, 153, 0.08);
  border-color: rgba(52, 211, 153, 0.15);
  color: var(--green);
}

/* Section headers */
.pd-section {
  margin-bottom: 16px;
}
.pd-section-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.pd-section-count {
  font-size: 10px;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-light);
  padding: 1px 5px;
  border-radius: 4px;
}

/* Task list */
.pd-task-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.pd-task-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s;
}
.pd-task-row:hover {
  background: rgba(255, 255, 255, 0.03);
}
.pd-task-info {
  flex: 1;
  min-width: 0;
}
.pd-task-name {
  font-size: 12px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pd-task-blocked {
  font-size: 10px;
  color: var(--amber);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
  margin-top: 1px;
}
.pd-task-end {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.pd-task-date {
  font-size: 10px;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
}
.pd-task-status {
  font-size: 9px;
  font-weight: 600;
  padding: 1px 5px;
  border-radius: 4px;
  text-transform: capitalize;
  white-space: nowrap;
}
.pd-ts-complete    { background: rgba(52, 211, 153, 0.15); color: var(--green); }
.pd-ts-in_progress { background: rgba(59, 130, 246, 0.15); color: var(--blue-bright); }
.pd-ts-blocked     { background: rgba(251, 191, 36, 0.15); color: var(--amber); }
.pd-ts-planning    { background: rgba(167, 139, 250, 0.15); color: var(--purple); }

/* SCRATCHPAD entries in detail panel */
.pd-scratch-task {
  padding: 10px 0;
  border-bottom: 1px solid var(--card-border);
}
.pd-scratch-task:last-child { border-bottom: none; }
.pd-scratch-task-name {
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 6px;
}
.pd-scratch-entry {
  padding: 6px 0 6px 10px;
  border-left: 2px solid var(--card-border);
  margin-bottom: 6px;
}
.pd-scratch-entry:last-child { margin-bottom: 0; }
.pd-scratch-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 3px;
}
.pd-scratch-focus {
  font-size: 11px;
  font-weight: 500;
  color: var(--text);
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pd-scratch-date {
  font-size: 10px;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
}
.pd-scratch-context {
  font-size: 11px;
  color: var(--text-2);
  line-height: 1.4;
  margin-top: 3px;
}

/* Status badges (for SCRATCHPAD entries) */
.cg-status {
  font-size: 9px;
  font-weight: 600;
  padding: 1px 5px;
  border-radius: 4px;
  text-transform: capitalize;
  white-space: nowrap;
  flex-shrink: 0;
}
.cg-status-done    { background: rgba(52, 211, 153, 0.15); color: var(--green); }
.cg-status-partial { background: rgba(251, 191, 36, 0.15); color: var(--amber); }
.cg-status-other   { background: rgba(59, 130, 246, 0.15); color: var(--blue-bright); }

/* Task dots (in task list rows) */
.task-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--gray);
}
.task-dot-complete    { background: var(--green); }
.task-dot-in_progress { background: var(--blue-bright); }
.task-dot-blocked     { background: var(--amber); }
.task-dot-planning    { background: var(--purple); }

/* Activity timeline */
.pd-timeline { display: flex; flex-direction: column; }
.pd-tl-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-height: 36px;
}
.pd-tl-dot-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex-shrink: 0;
  width: 12px;
  padding-top: 4px;
}
.pd-tl-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--gray);
}
.pd-tl-dot.dot-complete    { background: var(--green); }
.pd-tl-dot.dot-in_progress { background: var(--blue-bright); }
.pd-tl-dot.dot-blocked     { background: var(--amber); }
.pd-tl-dot.dot-planning    { background: var(--purple); }

.pd-tl-line {
  width: 1px;
  flex: 1;
  background: var(--card-border);
  margin: 2px 0;
}
.pd-tl-content {
  flex: 1;
  min-width: 0;
  padding-bottom: 8px;
}
.pd-tl-focus {
  font-size: 11px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pd-tl-task {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 1px;
}
.pd-tl-date {
  font-size: 10px;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
  flex-shrink: 0;
  padding-top: 2px;
}


/* ═══ Scrollbar ═══ */
::-webkit-scrollbar { width: 3px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 2px; }


/* ═══ Standalone page stat card sizing ═══ */
.layout-content .stat-cards { gap: 14px; margin-bottom: 28px; }
.layout-content .stat-card { padding: 8px 20px 8px 10px; }
.layout-content .stat-card-value { font-size: 1.1rem; }
.layout-content .stat-card-icon { width: 30px; height: 30px; }

/* ═══ Standalone page infrastructure card styling ═══ */
.layout-content .sec-infra { gap: 10px; margin-top: 8px; }
.layout-content .sec-infra-row { padding: 14px 20px; border-radius: var(--radius); }


/* ═══════════════════════════════════════════════════════════
   MULTI-PAGE LAYOUT SHELL
   (merged from shared.css — sidebar, top bar, content area)
   ═══════════════════════════════════════════════════════════ */

body.page-shell {
  flex-direction: row;
  overflow: hidden;
  height: 100vh;
}

.layout {
  width: 100%;
  min-height: 100vh;
}

/* ═══ Sidebar ═══ */
.sidebar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: 220px;
  z-index: 50;
  display: flex;
  flex-direction: column;
  background: rgba(8, 18, 35, 0.92);
  border-right: 1px solid var(--card-border);
  backdrop-filter: blur(20px) saturate(1.2);
  transition: width 0.2s ease;
  overflow: hidden;
}

.sidebar-collapsed .sidebar { width: 56px; }

.sidebar-header { flex-shrink: 0; }

.sidebar-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 0 16px; height: 42px; flex-shrink: 0;
  border-bottom: 1px solid var(--card-border);
  overflow: hidden; white-space: nowrap;
}
.sidebar-brand .brand-icon { flex-shrink: 0; }
.sidebar-brand .brand-label { opacity: 1; transition: opacity 0.15s ease; }
.sidebar-collapsed .sidebar-brand .brand-label { opacity: 0; pointer-events: none; }

.sidebar-nav {
  flex: 1; display: flex; flex-direction: column; gap: 2px;
  padding: 8px; overflow-y: auto; overflow-x: hidden;
}

.sidebar-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: var(--radius-sm);
  color: var(--text-muted); text-decoration: none;
  font-size: 12px; font-weight: 500; white-space: nowrap;
  transition: all 0.15s; border: none; background: none;
  cursor: pointer; font-family: inherit;
}
.sidebar-item:hover { color: var(--text-2); background: rgba(255, 255, 255, 0.04); }
.sidebar-item.active { color: var(--accent); background: rgba(56, 189, 248, 0.08); font-weight: 600; }
.sidebar-item:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; color: var(--text-2); }

.sidebar-icon { width: 20px; height: 20px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.sidebar-icon svg { width: 16px; height: 16px; }
.sidebar-label { opacity: 1; transition: opacity 0.15s ease; }
.sidebar-collapsed .sidebar-label { opacity: 0; pointer-events: none; }

.sidebar-toggle {
  display: flex; align-items: center; justify-content: center;
  padding: 8px; flex-shrink: 0; background: none; border: none;
  color: var(--text-muted); cursor: pointer; transition: color 0.15s; width: 100%;
}
.sidebar-toggle:hover { color: var(--text-2); }
.sidebar-toggle svg { width: 16px; height: 16px; transition: transform 0.2s ease; }
.sidebar-collapsed .sidebar-toggle svg { transform: rotate(180deg); }

.sidebar-footer {
  padding: 8px 16px; border-top: 1px solid var(--card-border);
  flex-shrink: 0; font-size: 10px; color: var(--text-muted);
  overflow: hidden; white-space: nowrap;
}
.sidebar-collapsed .sidebar-footer { padding: 8px; text-align: center; }

.sidebar-status { display: flex; align-items: center; gap: 6px; }
.sidebar-status-text { font-size: 10px; color: var(--text-muted); transition: opacity 0.15s ease; }
.sidebar-collapsed .sidebar-status { justify-content: center; }
.sidebar-collapsed .sidebar-status-text { display: none; }


/* ═══ Main Wrapper ═══ */
.layout-main {
  margin-left: 220px; display: flex; flex-direction: column;
  flex: 1; height: 100vh; min-width: 0; transition: margin-left 0.2s ease;
}
.sidebar-collapsed .layout-main { margin-left: 56px; }

/* Override gap for multi-page top bar */
.layout-main > .top-nav { gap: 12px; }


/* ═══ Top Bar Extras ═══ */
.nav-left { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.nav-center { flex: 1; display: flex; justify-content: center; min-width: 0; }
.top-nav .nav-right { flex-shrink: 0; }

.top-bar-title { font-size: 13px; font-weight: 600; color: var(--text); white-space: nowrap; }
.top-bar-breadcrumb { font-size: 11px; color: var(--text-muted); display: flex; align-items: center; gap: 6px; }
.top-bar-breadcrumb a { color: var(--text-muted); text-decoration: none; transition: color 0.15s; }
.top-bar-breadcrumb a:hover { color: var(--accent); }
.top-bar-breadcrumb .bc-sep { font-size: 9px; color: var(--gray); }
.top-bar-right { display: flex; align-items: center; gap: 8px; margin-left: auto; }


/* ═══ Page Content ═══ */
.layout-content {
  position: relative; z-index: 1; flex: 1;
  overflow-y: auto; padding: clamp(12px, 2vw, 24px); min-height: 0;
}
.layout-content-flush { padding: 0; }
.layout-content-narrow { max-width: 1200px; margin: 0 auto; }

/* Overview HUD: no-scroll viewport within layout shell */
.overview-viewport {
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: clamp(6px, 1vh, 10px) clamp(8px, 1.5vw, 20px);
}
.overview-grid {
  flex: 1; display: flex; flex-direction: column;
  gap: clamp(6px, 1vh, 10px);
  min-height: 0;
}

/* Custom scrollbar for dark theme — content area + slide panels */
.layout-content,
.slide-panel-body {
  scrollbar-width: thin;
  scrollbar-color: rgba(80, 200, 255, 0.15) transparent;
}
.layout-content::-webkit-scrollbar,
.slide-panel-body::-webkit-scrollbar { width: 6px; }
.layout-content::-webkit-scrollbar-track,
.slide-panel-body::-webkit-scrollbar-track { background: transparent; }
.layout-content::-webkit-scrollbar-thumb,
.slide-panel-body::-webkit-scrollbar-thumb { background: rgba(80, 200, 255, 0.15); border-radius: 3px; }
.layout-content::-webkit-scrollbar-thumb:hover,
.slide-panel-body::-webkit-scrollbar-thumb:hover { background: rgba(80, 200, 255, 0.25); }


/* ═══ Page-Level Glass Cards ═══ */
.page-card {
  background: var(--card); border: 1px solid var(--card-border);
  border-radius: var(--radius); backdrop-filter: blur(24px) saturate(1.3);
  box-shadow: var(--card-glow); transition: border-color 0.2s, box-shadow 0.2s;
}
.page-card:hover {
  border-color: var(--card-border-bright);
  box-shadow: 0 0 1px rgba(80, 200, 255, 0.15), 0 0 20px rgba(80, 200, 255, 0.06);
}
.page-card-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; border-bottom: 1px solid rgba(80, 200, 255, 0.08);
}
.page-card-title { font-size: 13px; font-weight: 700; letter-spacing: 0.02em; }
.page-card-body { padding: 16px 18px; }


/* ═══ Extra Status Pills ═══ */
.pill-success  { background: rgba(52, 211, 153, 0.18); color: #5eead4; border: 1px solid rgba(52, 211, 153, 0.2); }
.pill-warning  { background: rgba(251, 191, 36, 0.18); color: #fcd34d; border: 1px solid rgba(251, 191, 36, 0.2); }
.pill-error    { background: rgba(248, 113, 113, 0.18); color: #fca5a5; border: 1px solid rgba(248, 113, 113, 0.2); }
.pill-info     { background: rgba(56, 189, 248, 0.12); color: var(--accent); border: 1px solid rgba(56, 189, 248, 0.15); }
.pill-neutral  { background: rgba(255, 255, 255, 0.06); color: var(--text-muted); border: 1px solid rgba(255, 255, 255, 0.06); }
.pill-purple   { background: rgba(167, 139, 250, 0.15); color: var(--purple); border: 1px solid rgba(167, 139, 250, 0.2); }
.pill-lg { font-size: 11px; padding: 3px 10px; border-radius: 14px; }


/* ═══ Slide-In Panel (for standalone pages — extends base) ═══ */
.slide-panel-footer {
  padding: 12px 18px; border-top: 1px solid var(--card-border);
  flex-shrink: 0; display: flex; align-items: center; gap: 8px;
}


/* ═══ Page Transitions ═══ */
.page-enter { animation: pageEnter 0.2s ease-out; }
@keyframes pageEnter {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.page-exit { animation: pageExit 0.15s ease-in forwards; }
@keyframes pageExit {
  from { opacity: 1; transform: translateY(0); }
  to   { opacity: 0; transform: translateY(-6px); }
}
.page-slide-in { animation: pageSlideIn 0.25s ease-out; }
@keyframes pageSlideIn {
  from { opacity: 0; transform: translateX(12px); }
  to   { opacity: 1; transform: translateX(0); }
}
.page-slide-back { animation: pageSlideBack 0.25s ease-out; }
@keyframes pageSlideBack {
  from { opacity: 0; transform: translateX(-12px); }
  to   { opacity: 1; transform: translateX(0); }
}

@media (prefers-reduced-motion: reduce) {
  .page-enter, .page-exit, .page-slide-in, .page-slide-back { animation: none; }
  .sidebar, .layout-main, .slide-panel, .slide-panel-overlay { transition: none; }
}


/* ═══ Standalone Page Normalization ═══ */
.layout-content .cal-title { font-size: 1rem; }
.layout-content .pipe-tab-panel { overflow-y: visible; flex: none; }
.layout-content .cal-panel { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.layout-content .cal-week-grid,
.layout-content .cal-day-grid { flex: 1; min-height: 0; }
.layout-content .cal-bottom-row { flex-shrink: 0; }

.page-section-title {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--text-muted); margin-bottom: 12px;
}


/* ═══════════════════════════════════════════════════════════
   RESPONSIVE OVERRIDES — All Breakpoints
   xl >=1600  |  lg 1100-1599  |  md 960-1099  |
   sm 700-959  |  xs 500-699  |  xxs <500
   ═══════════════════════════════════════════════════════════ */

/* ── xl: Large desktop ──────────────────────────────── */
@media (min-width: 1600px) {
  .content { max-width: 1700px; margin-left: auto; margin-right: auto; }
  .mission-name { font-size: 13px; }
  .mission-detail { font-size: 10px; }
  .sec-val { font-size: 28px; }
}

/* ── lg/md: Compact desktop (14" MacBook target) ────── */
@media (max-width: 1100px) {
  /* Phase 2: HQ overview — tighter columns */
  .top-row { grid-template-columns: minmax(140px, 12vw) 1fr minmax(150px, 13vw); }

  /* Phase 2: Pipeline ring — smaller */
  .pipeline-arcs { width: clamp(120px, 16vw, 200px); }

  /* Phase 3: Pipeline detail — tighter hero */
  .pipe-hero-body { gap: 16px; }
  .pipe-hud .pipe-phase-widget { width: 180px; }

  /* Phase 4: Project cards — tighter grid */
  .project-cards { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }
  .project-card { padding: 14px; }

  /* Phase 5: Security — tighter section grid */
  .sec-section-grid { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
}

/* ── sm: Tablet landscape / sidebar collapse ────────── */
@media (max-width: 960px) {
  /* Phase 1C: Body scrollable (already default, but override any HQ lock) */
  body:has(.content) { height: auto; overflow-y: auto; }

  /* Phase 2: HQ overview grid — 2 columns */
  .top-row {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto auto;
  }
  .pipeline-card { grid-column: 1 / -1; order: -1; }
  .pipeline-body { min-height: 240px; }
  .bottom-row { grid-template-columns: 1fr 1fr; max-height: none; height: auto; }

  /* Phase 3: Pipeline detail — stack vertically */
  .pipe-hero-body { flex-direction: column; align-items: stretch; }
  .pipe-hud .pipe-phase-widget { width: 100%; }

  /* Phase 6: Calendar bottom row */
  .cal-bottom-row { grid-template-columns: 1fr 1fr; }

  /* Sidebar: collapse by default */
  .sidebar { width: 56px; }
  .sidebar .sidebar-label,
  .sidebar .sidebar-brand .brand-label,
  .sidebar .sidebar-footer { opacity: 0; pointer-events: none; }
  .sidebar-expanded .sidebar { width: 220px; box-shadow: 4px 0 20px rgba(0, 0, 0, 0.4); }
  .sidebar-expanded .sidebar-label,
  .sidebar-expanded .sidebar-brand .brand-label,
  .sidebar-expanded .sidebar-footer { opacity: 1; pointer-events: auto; }
  .layout-main { margin-left: 56px; }
  .sidebar-expanded .layout-main { margin-left: 56px; }
}

/* ── xs: Tablet portrait / mobile sidebar drawer ────── */
@media (max-width: 700px) {
  /* Phase 2: HQ single column */
  .top-row { grid-template-columns: 1fr; }
  .pipeline-card { grid-column: 1; }
  .bottom-row { grid-template-columns: 1fr 1fr; }
  .nav-links { display: none; }
  .pipeline-body { flex-direction: column; align-items: center; }
  .pipeline-arcs { width: clamp(200px, 50vw, 280px); }
  .mission-list { width: 100%; }

  /* Phase 3: Pipeline cockpit footer */
  .pipe-hud .pipe-cockpit-footer { grid-template-columns: 1fr; }

  /* Phase 4: Slide panel full-width */
  .slide-panel { width: 100vw; }

  /* Phase 6: Calendar responsive */
  .cal-week-grid { display: flex; flex-direction: column; overflow-y: auto; }
  .cal-bottom-row { grid-template-columns: 1fr; }

  /* Sidebar: offscreen drawer */
  .sidebar { width: 220px; transform: translateX(-100%); }
  .sidebar-expanded .sidebar { transform: translateX(0); box-shadow: 4px 0 20px rgba(0, 0, 0, 0.5); }
  .sidebar .sidebar-toggle svg { transform: rotate(180deg); }
  .sidebar-expanded .sidebar-toggle svg { transform: rotate(0deg); }
  .layout-main { margin-left: 0; }
}

/* ── xxs: Phone ─────────────────────────────────────── */
@media (max-width: 500px) {
  .bottom-row { grid-template-columns: 1fr; }
  .card-head-right .pill { display: none; }
  .slide-panel { width: 100vw; }

  /* Phase 4: Project cards single column */
  .project-cards { grid-template-columns: 1fr; }
}

/* Slide panel content — housekeeping drill-down */
.sp-section { margin-bottom: 16px; }
.sp-section-title {
  font-size: 0.72rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--text-muted); margin-bottom: 8px;
}
.sp-conflict-list { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.sp-conflict-item {
  padding: 8px 12px; border-radius: 6px;
  background: rgba(248,113,113,0.06); border: 1px solid rgba(248,113,113,0.12);
  font-size: 0.78rem; color: var(--text-2);
}
.sp-conflict-project { font-weight: 600; color: var(--text); margin-right: 6px; }
.sp-conflict-path { color: var(--text-muted); font-family: 'JetBrains Mono', monospace; font-size: 0.72rem; }
.sp-project-group { margin-bottom: 12px; }
.sp-project-name {
  font-size: 0.82rem; font-weight: 600; color: var(--text); margin-bottom: 6px;
  padding-bottom: 4px; border-bottom: 1px solid var(--card-border);
}
.sp-finding-list { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.sp-finding-item {
  padding: 6px 10px; border-radius: 4px;
  background: rgba(255,255,255,0.02); border: 1px solid var(--card-border);
  font-size: 0.75rem; display: flex; flex-direction: column; gap: 2px;
}
.sp-finding-check { font-weight: 600; color: var(--text); }
.sp-finding-msg { color: var(--text-muted); }
.sp-empty { padding: 20px; text-align: center; color: var(--text-muted); font-size: 0.82rem; }
.sp-sev-badge {
  display: inline-block; font-size: 0.68rem; font-weight: 700; padding: 2px 8px;
  border-radius: 4px; letter-spacing: 0.04em; text-transform: uppercase; margin-bottom: 12px;
}
.sp-sev-badge.critical { background: var(--red-bg); color: var(--red); border: 1px solid rgba(248,113,113,0.2); }
.sp-sev-badge.warning { background: var(--amber-bg); color: var(--amber); border: 1px solid rgba(251,191,36,0.2); }
.sp-sev-badge.info { background: rgba(100,116,139,0.08); color: var(--text-muted); border: 1px solid rgba(100,116,139,0.15); }
.sp-stat-row {
  display: flex; align-items: center; gap: 8px; margin-bottom: 12px;
  font-size: 0.82rem; color: var(--text-2);
}
.sp-stat-num { font-weight: 700; font-family: 'JetBrains Mono', monospace; font-size: 1rem; }

/* Slide-panel: Security section drill-down */
.sp-sec-summary { font-size: 0.78rem; color: var(--text-2); margin-bottom: 14px; line-height: 1.5; }
.sp-finding-header { display: flex; align-items: center; gap: 6px; }
.sp-finding-res {
  display: inline-block; font-size: 0.62rem; font-weight: 700; padding: 1px 5px;
  border-radius: 3px; letter-spacing: 0.04em; text-transform: uppercase; flex-shrink: 0;
}
.sp-res-fail { background: var(--red-bg); color: var(--red); border: 1px solid rgba(248,113,113,0.2); }
.sp-res-warn { background: var(--amber-bg); color: var(--amber); border: 1px solid rgba(251,191,36,0.2); }
.sp-res-pass { background: rgba(52,211,153,0.08); color: var(--green); border: 1px solid rgba(52,211,153,0.15); }
.sp-finding-detail {
  font-size: 0.72rem; color: var(--text-muted); margin-top: 2px;
  font-family: 'JetBrains Mono', monospace; white-space: pre-wrap; word-break: break-word;
}
.sp-finding-fail { border-color: rgba(248,113,113,0.25); background: rgba(248,113,113,0.04); }
.sp-finding-warn { border-color: rgba(251,191,36,0.2); background: rgba(251,191,36,0.03); }

/* Slide-panel: Infrastructure container detail */
.sp-infra-summary {
  font-size: 0.82rem; color: var(--text-2); margin-bottom: 14px;
  display: flex; align-items: center; gap: 4px; flex-wrap: wrap;
}
.sp-infra-running { color: var(--green); font-weight: 600; }
.sp-infra-stopped { color: var(--red); font-weight: 600; }
.sp-infra-table {
  width: 100%; border-collapse: collapse; font-size: 0.75rem;
}
.sp-infra-table th {
  text-align: left; padding: 6px 8px; font-size: 0.68rem;
  color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.sp-infra-table td {
  padding: 7px 8px; border-bottom: 1px solid rgba(255,255,255,0.03);
  color: var(--text-2); vertical-align: middle;
}
.sp-infra-row-down td { background: rgba(248,113,113,0.04); }
.sp-infra-cell-name { font-weight: 600; color: var(--text); white-space: nowrap; }
.sp-infra-cell-image {
  font-family: 'JetBrains Mono', monospace; font-size: 0.68rem;
  color: var(--text-muted); max-width: 140px; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap;
}
.sp-infra-cell-ports { font-family: 'JetBrains Mono', monospace; font-size: 0.68rem; color: var(--text-muted); }
.sp-infra-cell-uptime { font-family: 'JetBrains Mono', monospace; font-size: 0.68rem; white-space: nowrap; }
.sp-infra-status {
  display: inline-block; padding: 2px 7px; border-radius: 4px;
  font-size: 0.68rem; font-weight: 600; text-transform: capitalize;
}
.sp-infra-st-green { background: rgba(52,211,153,0.14); color: #6ee7b7; }
.sp-infra-st-amber { background: rgba(251,191,36,0.16); color: #fcd34d; }
.sp-infra-st-red   { background: rgba(248,113,113,0.16); color: #fca5a5; }
.sp-infra-st-unknown { background: rgba(100,116,139,0.08); color: var(--text-muted); }
.sp-infra-health { font-size: 0.72rem; }
.sp-infra-h-green { color: #6ee7b7; }
.sp-infra-h-red   { color: #fca5a5; }
.sp-infra-h-amber { color: #fcd34d; }
.sp-infra-h-none  { color: var(--text-muted); }

/* Tablet portrait */
@media (max-width: 700px) {
  .top-row { grid-template-columns: 1fr; }
  .pipeline-card { grid-column: 1; }
  .bottom-row { grid-template-columns: 1fr 1fr; }
  .cal-bottom-row { grid-template-columns: 1fr; }
  .nav-links { display: none; }
  .pipeline-body { flex-direction: column; align-items: center; }
  .pipeline-arcs { width: clamp(200px, 50vw, 280px); }
  .mission-list { width: 100%; }
}

/* Mobile */
@media (max-width: 500px) {
  .bottom-row { grid-template-columns: 1fr; }
  .card-head-right .pill { display: none; }
  .slide-panel { width: 100vw; }
}

/* ═══ Pipeline Actions ═══ */
.pm-actions {
  display: flex; gap: 8px; padding: 16px 0 8px;
  border-top: 1px solid var(--border-light); margin-top: 12px;
}
.pipe-bf-clickable {
  cursor: pointer; transition: background 0.15s;
}
.pipe-bf-clickable:hover {
  background: rgba(56, 189, 248, 0.08);
}
