/* bridge.css — Quarterdeck dark theme
 *
 * Design system for the three-panel "bridge" layout with HTMX-driven
 * partial swaps. All colours use CSS custom properties for easy theming.
 *
 * Responsive breakpoints:
 *   - Desktop (>1024px): three-panel grid
 *   - Tablet  (≤1024px): two-panel (hide right sidebar)
 *   - Mobile  (≤768px):  single panel (center only)
 */

/* ------------------------------------------------------------------ */
/* Custom Properties                                                   */
/* ------------------------------------------------------------------ */

:root {
  /* Background layers (darkest → lightest) */
  --bg-deepest:  #0a0e17;
  --bg-base:     #111827;
  --bg-surface:  #1a2035;
  --bg-elevated: #1f2a40;
  --bg-hover:    #253050;

  /* Text */
  --text-primary:   #e2e8f0;
  --text-secondary: #94a3b8;
  --text-muted:     #64748b;

  /* Accent */
  --accent-blue:   #3b82f6;
  --accent-green:  #22c55e;
  --accent-yellow: #eab308;
  --accent-red:    #ef4444;
  /* chart mark green — #22c55e fails the dark-surface lightness band (dataviz validator); dots/badges keep --accent-green */
  --chart-completed: #16a34a;

  /* Priority colours */
  --priority-high:   var(--accent-red);
  --priority-medium: var(--accent-yellow);
  --priority-low:    var(--accent-blue);

  /* Borders */
  --border-color: #1e293b;
  --border-radius: 6px;

  /* Spacing */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;

  /* Typography */
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", "Fira Code", monospace;

  /* Border radius */
  --radius-sm: 0.5rem;
  --radius-pill: 62.4375rem;

  /* Badge backgrounds (accent at 15% opacity) */
  --badge-bg-green:  rgba(34, 197, 94, 0.15);
  --badge-bg-blue:   rgba(59, 130, 246, 0.15);
  --badge-bg-yellow: rgba(234, 179, 8, 0.15);
  --badge-bg-red:    rgba(239, 68, 68, 0.15);
}


/* ------------------------------------------------------------------ */
/* Reset & Base                                                        */
/* ------------------------------------------------------------------ */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  line-height: 1.5;
  color: var(--text-primary);
  background: var(--bg-deepest);
}


/* ------------------------------------------------------------------ */
/* Bridge Layout — Three-Panel Grid                                    */
/* ------------------------------------------------------------------ */

.bridge-body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.bridge-layout {
  display: grid;
  grid-template-columns: 280px 1fr 280px;
  flex: 1;
  overflow: hidden;
}

.bridge-panel {
  padding: var(--space-md);
  overflow-y: auto;
}

.bridge-command {
  background: var(--bg-base);
  border-right: 1px solid var(--border-color);
}

.bridge-deck {
  background: var(--bg-deepest);
  padding: var(--space-lg);
}

.bridge-status {
  background: var(--bg-base);
  border-left: 1px solid var(--border-color);
}

.panel-placeholder {
  color: var(--text-muted);
  font-style: italic;
  text-align: center;
  padding: var(--space-xl);
}


/* ------------------------------------------------------------------ */
/* Navigation                                                          */
/* ------------------------------------------------------------------ */

.bridge-nav {
  display: flex;
  align-items: center;
  gap: var(--space-lg);
  padding: var(--space-sm) var(--space-lg);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
}

.nav-brand {
  font-weight: 700;
  font-size: 1.125rem;
  color: var(--accent-blue);
}

.nav-links {
  display: flex;
  gap: var(--space-md);
}

.nav-link {
  color: var(--text-secondary);
  text-decoration: none;
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--border-radius);
  transition: color 0.15s, background 0.15s;
}

.nav-link:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.nav-actions {
  margin-left: auto;
}

.nav-status {
  color: var(--accent-green);
  font-size: 0.8125rem;
}


/* ------------------------------------------------------------------ */
/* Command Bar                                                         */
/* ------------------------------------------------------------------ */

.bridge-command-bar {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-lg);
  background: var(--bg-surface);
  border-top: 1px solid var(--border-color);
}

.command-prompt {
  color: var(--accent-green);
  font-family: var(--font-mono);
  font-weight: 700;
}

.command-input {
  flex: 1;
  background: var(--bg-base);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: var(--space-xs) var(--space-sm);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 0.875rem;
}

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

.command-input:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}


/* ------------------------------------------------------------------ */
/* Kanban Board                                                        */
/* ------------------------------------------------------------------ */

.kanban-board {
  height: 100%;
  display: flex;
  flex-direction: column;
}

.kanban-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-lg);
}

.kanban-header h2 {
  font-size: 1.25rem;
  font-weight: 600;
}

/* --- Scoped-board header controls (PM slice 5) --- */
.board-scope { display: flex; align-items: center; gap: var(--space-sm); margin-left: var(--space-md); }
.board-scope-chip { font-weight: 600; color: var(--text-secondary); }
.board-scope-switch { display: inline-flex; gap: var(--space-xs); }
.board-scope-clear { color: var(--text-muted); font-size: 0.8125rem; cursor: pointer; text-decoration: none; }
.board-scope-clear:hover { color: var(--accent-blue); }

.kanban-lanes {
  display: flex;
  gap: var(--space-md);
  flex: 1;
  overflow-x: auto;
}

.kanban-lane {
  flex: 1;
  min-width: 220px;
  background: var(--bg-base);
  border-radius: var(--border-radius);
  display: flex;
  flex-direction: column;
}

.lane-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-sm) var(--space-md);
  border-bottom: 1px solid var(--border-color);
}

.lane-header h3 {
  font-size: 0.875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
}

.lane-count {
  background: var(--bg-elevated);
  color: var(--text-muted);
  font-size: 0.75rem;
  padding: 0.125rem 0.5rem;
  border-radius: 999px;
}

.lane-cards {
  padding: var(--space-sm);
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  flex: 1;
  overflow-y: auto;
}

.empty-state {
  color: var(--text-muted);
  font-style: italic;
  text-align: center;
  padding: var(--space-lg);
}


/* ------------------------------------------------------------------ */
/* Cards                                                               */
/* ------------------------------------------------------------------ */

.card {
  background: var(--bg-surface);
  border-radius: var(--border-radius);
  padding: var(--space-sm) var(--space-md);
  border-left: 3px solid var(--border-color);
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}

.card:hover {
  background: var(--bg-elevated);
  transform: translateY(-1px);
}

.card-priority-High   { border-left-color: var(--priority-high); }
.card-priority-Medium { border-left-color: var(--priority-medium); }
.card-priority-Low    { border-left-color: var(--priority-low); }

.card-title {
  font-weight: 500;
  margin-bottom: var(--space-xs);
}

.card-meta {
  display: flex;
  gap: var(--space-sm);
  font-size: 0.75rem;
  color: var(--text-muted);
}

.card-owner {
  color: var(--text-secondary);
}

.badge-High   { color: var(--priority-high); }
.badge-Medium { color: var(--priority-medium); }
.badge-Low    { color: var(--priority-low); }

.card-blocked {
  color: var(--accent-red);
  font-weight: 600;
}

.card-refined {
  font-size: 0.7rem;
  padding: 0.1rem 0.35rem;
  border-radius: 3px;
  background: var(--bg-hover);
  color: var(--text-secondary);
  border: 1px solid var(--accent-blue);
}

.card-agent-ok {
  font-size: 0.7rem;
  padding: 0.1rem 0.35rem;
  border-radius: 3px;
  background: var(--badge-bg-green);
  color: var(--accent-green);
}

.card-held-by {
  font-size: 0.7rem;
  padding: 0.1rem 0.35rem;
  border-radius: 3px;
  background: var(--badge-bg-yellow);
  color: var(--accent-yellow);
  font-family: var(--font-mono);
}


/* ------------------------------------------------------------------ */
/* Card Detail                                                         */
/* ------------------------------------------------------------------ */

.card-detail {
  max-width: 720px;
}

.card-detail-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-lg);
}

.card-detail-header h2 {
  font-size: 1.25rem;
  font-weight: 600;
}

.card-detail-meta dl {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: var(--space-sm) var(--space-md);
}

.card-detail-meta dt {
  color: var(--text-muted);
  font-size: 0.8125rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.card-detail-meta dd {
  color: var(--text-primary);
}

.card-source {
  font-family: var(--font-mono);
  color: var(--text-muted);
}

.card-detail-description {
  margin-top: var(--space-lg);
  padding-top: var(--space-lg);
  border-top: 1px solid var(--border-color);
}

.card-detail-description h3 {
  font-size: 0.9375rem;
  font-weight: 600;
  margin-bottom: var(--space-sm);
}

.card-detail-actions {
  margin-top: var(--space-xl);
  padding-top: var(--space-lg);
  border-top: 1px solid var(--border-color);
  display: flex;
  gap: var(--space-md);
  align-items: center;
}

/* Card-detail children list: the direct refinements of the open card. */
.card-children {
  margin: var(--space-md) 0;
}
.card-children-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.card-children-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-xs) var(--space-sm);
  border-left: 3px solid var(--bg-hover);
  margin-bottom: var(--space-xs);
}

.move-form {
  display: flex;
  gap: var(--space-sm);
  align-items: center;
}

/* Refine form: the captain's break-into-children trigger. Stacked column
   (label + three child_title inputs + submit) to keep the fixed inputs
   compact within card-detail-actions. */
.refine-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  margin-top: var(--space-sm);
}


/* ------------------------------------------------------------------ */
/* Card Form                                                           */
/* ------------------------------------------------------------------ */

.card-form-container {
  max-width: 560px;
}

.card-form-container h2 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: var(--space-lg);
}

.form-group {
  margin-bottom: var(--space-md);
}

.form-group label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: var(--space-xs);
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  background: var(--bg-base);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: var(--space-sm);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.875rem;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--accent-blue);
}

.form-group textarea {
  resize: vertical;
}

.form-actions {
  display: flex;
  gap: var(--space-md);
  margin-top: var(--space-lg);
}


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

.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-sm) var(--space-md);
  border: none;
  border-radius: var(--border-radius);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
}

.btn-primary {
  background: var(--accent-blue);
  color: #fff;
}

.btn-primary:hover {
  background: #2563eb;
}

.btn-secondary {
  background: var(--bg-elevated);
  color: var(--text-primary);
}

.btn-secondary:hover {
  background: var(--bg-hover);
}

.btn-danger {
  background: var(--accent-red);
  color: #fff;
}

.btn-danger:hover {
  background: #dc2626;
}


/* ------------------------------------------------------------------ */
/* HTMX Loading Indicator                                              */
/* ------------------------------------------------------------------ */

.htmx-request {
  opacity: 0.6;
  transition: opacity 0.2s ease-in;
}

.htmx-request.htmx-settling {
  opacity: 1;
}


/* ------------------------------------------------------------------ */
/* Agents Module                                                       */
/* ------------------------------------------------------------------ */

/* Roster: card grid of all agents */
.agent-roster {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: var(--space-lg);
  padding: var(--space-md);
}

.agent-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: var(--space-sm) var(--space-md);
  cursor: pointer;
  transition: background 0.15s ease;
}

.agent-card:hover {
  background: var(--bg-elevated);
}

.agent-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-xs);
}

.agent-name {
  font-weight: 600;
  color: var(--text-primary);
}

.agent-role {
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

.agent-status-badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-pill);
  text-transform: uppercase;
}

.agent-status-active {
  background: var(--badge-bg-green);
  color: var(--accent-green);
}

.agent-status-waiting {
  background: var(--bg-elevated);
  color: var(--text-secondary);
}

.agent-status-done {
  background: var(--badge-bg-blue);
  color: var(--accent-blue);
}

.agent-status-stale {
  opacity: 0.5;
}

.agent-status-stale::before {
  content: "\27F3";
  color: var(--accent-yellow);
  margin-right: var(--space-xs);
}

.agent-task-count {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: var(--space-xs);
}

.agent-error-flag {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-pill);
  background: var(--badge-bg-red);
  color: var(--accent-red);
  text-transform: uppercase;
  margin-left: var(--space-xs);
}

/* Agent Detail: split view */
.agent-detail {
  max-width: 800px;
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
  padding: var(--space-md);
}

.agent-detail-header {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.agent-detail-header .agent-name {
  font-size: 1.25rem;
}

.agent-detail-actions {
  margin-left: auto;
}

.agent-tasks-section {
  flex-grow: 1;
}

.agent-task-filters {
  display: flex;
  gap: var(--space-xs);
  margin-bottom: var(--space-md);
  border-bottom: 1px solid var(--border-color);
}

.agent-filter-tab {
  font-size: 0.8125rem;
  padding: var(--space-xs) var(--space-sm);
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  cursor: pointer;
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
}

.agent-filter-tab:hover {
  color: var(--text-secondary);
}

.agent-filter-tab.active {
  border-bottom-color: var(--accent-blue);
  color: var(--text-primary);
}

/* Activity feed */
.agent-activity-feed {
  border-top: 1px solid var(--border-color);
  padding-top: var(--space-lg);
}

.activity-entry {
  display: flex;
  gap: var(--space-sm);
  padding: var(--space-xs) 0;
}

.activity-timestamp {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
  min-width: 140px;
}

.activity-message {
  font-size: 0.9375rem;
  color: var(--text-primary);
}

.activity-entry-type-info    { color: var(--text-secondary); }
.activity-entry-type-warning { color: var(--accent-yellow); }
.activity-entry-type-error   { color: var(--accent-red); }
.activity-entry-type-result  { color: var(--accent-green); font-weight: 600; }

/* Task Detail */
.task-detail {
  max-width: 720px;
  padding: var(--space-md);
}

.task-detail-header {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
}

.task-detail-header h2 {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
}

.task-breadcrumb {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-bottom: var(--space-md);
}

.task-breadcrumb-arrow {
  color: var(--text-secondary);
}

.task-progress-log {
  list-style: none;
  padding: 0;
  margin: 0;
}

.task-log-entry {
  display: flex;
  gap: var(--space-sm);
  padding: var(--space-xs) 0;
  border-bottom: 1px solid var(--border-color);
}

.task-log-entry:last-child {
  border-bottom: none;
}

.task-log-timestamp {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
  min-width: 140px;
}

.task-log-message {
  font-size: 0.9375rem;
  color: var(--text-primary);
}

.task-log-type-info    { color: var(--text-secondary); }
.task-log-type-warning { color: var(--accent-yellow); }
.task-log-type-error   { color: var(--accent-red); }
.task-log-type-result  { color: var(--accent-green); font-weight: 600; }

.task-subtasks {
  padding-left: var(--space-lg);
  margin-top: var(--space-md);
}

/* Task Form */
.task-form-container {
  max-width: 560px;
  padding: var(--space-md);
}

/* Delegation Log */
.delegation-log {
  padding: var(--space-md);
}

.delegation-entry {
  display: grid;
  grid-template-columns: 1fr auto 1fr auto;
  gap: var(--space-sm);
  align-items: center;
  padding: var(--space-sm) 0;
  border-bottom: 1px solid var(--border-color);
}

.delegation-entry:last-child {
  border-bottom: none;
}

.delegation-from,
.delegation-to {
  font-weight: 600;
  color: var(--text-primary);
}

.delegation-arrow {
  color: var(--text-secondary);
}

.delegation-task {
  font-size: 0.9375rem;
  color: var(--text-primary);
}

.delegation-timestamp {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
}

.delegation-chain {
  color: var(--text-secondary);
  font-size: 0.8125rem;
}

/* Task status badges (mirrors card priority badge pattern) */
.task-status-badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-pill);
  text-transform: uppercase;
}

.task-status-backlog {
  background: var(--bg-elevated);
  color: var(--text-secondary);
}

.task-status-assigned {
  background: var(--badge-bg-yellow);
  color: var(--accent-yellow);
}

.task-status-in-progress {
  background: var(--badge-bg-blue);
  color: var(--accent-blue);
}

.task-status-done {
  background: var(--badge-bg-green);
  color: var(--accent-green);
}


/* ------------------------------------------------------------------ */
/* Responsive — Tablet (≤1024px): two panels                           */
/* ------------------------------------------------------------------ */

@media (max-width: 1024px) {
  .bridge-layout {
    grid-template-columns: 1fr;
  }

  .bridge-command,
  .bridge-status {
    display: none;
  }

  .kanban-lanes {
    flex-wrap: wrap;
  }

  .kanban-lane {
    min-width: 200px;
    flex: 1 1 45%;
  }
}


/* ------------------------------------------------------------------ */
/* Responsive — Mobile (≤768px): single panel                          */
/* ------------------------------------------------------------------ */

@media (max-width: 768px) {
  .bridge-nav {
    flex-wrap: wrap;
    gap: var(--space-sm);
  }

  .nav-actions {
    display: none;
  }

  .bridge-deck {
    padding: var(--space-md);
  }

  .kanban-lanes {
    flex-direction: column;
  }

  .kanban-lane {
    min-width: unset;
    flex: unset;
  }

  .card-detail-header {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-sm);
  }

  .card-detail-meta dl {
    grid-template-columns: 1fr;
  }

  .card-detail-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .move-form {
    flex-wrap: wrap;
  }
}


/* ------------------------------------------------------------------ */
/* Projects Module                                                     */
/* ------------------------------------------------------------------ */

/* Overview header: title + New Project action (mirrors kanban-header) */
.projects-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-md);
}

.projects-header h2 {
  font-size: 1.25rem;
  font-weight: 600;
}

/* Totals strip: aggregate workload numbers over non-done projects */
.projects-totals {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-md);
  margin-bottom: var(--space-sm);
}

.totals-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 90px;
  padding: var(--space-sm) var(--space-md);
  background: var(--bg-base);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
}

.totals-value {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
}

/* Alert modifier: applied when the failing-pipelines count is non-zero */
.totals-value-alert {
  color: var(--accent-red);
}

.totals-label {
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

/* GitLab sync status line under the totals strip */
.sync-status {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-bottom: var(--space-lg);
}

.sync-error {
  color: var(--accent-red);
  font-weight: 600;
}

/* Projects grid: responsive card grid, fills as many 280px+ columns as fit */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
}

/* Project card: matches the kanban card's visual weight — surface
   background, status-coloured left border, subtle hover lift */
.project-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  background: var(--bg-surface);
  border-radius: var(--border-radius);
  border-left: 3px solid var(--border-color);
  padding: var(--space-sm) var(--space-md);
  transition: background 0.15s;
}

.project-card:hover {
  background: var(--bg-elevated);
}

.project-card-status-active { border-left-color: var(--accent-green); }
.project-card-status-paused { border-left-color: var(--accent-yellow); }
.project-card-status-done   { border-left-color: var(--text-muted); opacity: 0.7; }

.project-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-sm);
}

.project-card-name {
  font-weight: 600;
  color: var(--text-primary);
  text-decoration: none;
}

.project-card-name:hover {
  color: var(--accent-blue);
}

/* Status badges (mirrors the task-status-badge pill pattern) */
.project-status-badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-pill);
  text-transform: uppercase;
}

.project-status-active {
  background: var(--badge-bg-green);
  color: var(--accent-green);
}

.project-status-paused {
  background: var(--badge-bg-yellow);
  color: var(--accent-yellow);
}

.project-status-done {
  background: var(--bg-elevated);
  color: var(--text-secondary);
}

/* Per-repo badge strip: path + MR/issue counts + pipeline dot */
.project-card-repos {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.repo-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: 0.75rem;
  color: var(--text-muted);
}

.repo-badge-path {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-secondary);
  text-decoration: none;
  overflow-wrap: anywhere;
}

a.repo-badge-path:hover {
  color: var(--accent-blue);
}

.repo-badge-count {
  white-space: nowrap;
}

.repo-badge-unsynced {
  font-style: italic;
}

/* Pipeline dot: class suffix is the GitLab status string verbatim.
   success → green, failed → red, running/pending → amber; any other status
   (canceled, skipped, manual, ...) keeps the muted base colour. */
.pipeline-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--text-muted);
  flex-shrink: 0;
}

.pipeline-dot-success { background: var(--accent-green); }
.pipeline-dot-failed  { background: var(--accent-red); }
.pipeline-dot-running,
.pipeline-dot-pending { background: var(--accent-yellow); }

.project-card-meta {
  font-size: 0.75rem;
}

.loose-end-count {
  color: var(--accent-yellow);
}

/* Intersection chips: clickable links to related projects */
.project-card-relations {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
}

.intersect-chip {
  display: inline-block;
  font-size: 0.75rem;
  padding: 0.125rem var(--space-sm);
  border-radius: var(--radius-pill);
  background: var(--badge-bg-blue);
  color: var(--accent-blue);
  text-decoration: none;
}

.intersect-chip:hover {
  background: var(--bg-hover);
}

/* Shared-repo chips render muted to distinguish computed intersections
   from explicit, captain-created relations */
.intersect-chip-shared-repo {
  background: var(--bg-elevated);
  color: var(--text-secondary);
}

/* Unlinked GitLab repos section on the overview */
.unlinked-repos {
  margin-bottom: var(--space-lg);
}

.unlinked-repos h3 {
  font-size: 0.875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  margin-bottom: var(--space-sm);
}

.unlinked-repo {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-xs) 0;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.875rem;
}

.unlinked-repo:last-child {
  border-bottom: none;
}

.unlinked-repo-path {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--text-secondary);
  text-decoration: none;
}

.unlinked-repo-path:hover {
  color: var(--accent-blue);
}

.unlinked-repo-meta {
  margin-left: auto;
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Done projects: collapsed details element */
.done-projects summary {
  cursor: pointer;
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: var(--space-sm);
}

/* Project detail view */
.project-detail {
  /* Wider than the old 800px reading column so the three facet tiles
     (Delivery / Agents / Context) sit as equal-width peers. The text-heavy
     sections below the facet grid keep a comfortable reading width via
     .project-detail-section's own cap. */
  max-width: 1200px;
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
}

/* Keep the below-facet sections (loose ends, relations) at a comfortable
   reading width even though the detail container is now wide for the facets. */
.project-detail > .project-detail-section {
  max-width: 800px;
}

.project-detail-header {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.project-detail-header h2 {
  font-size: 1.25rem;
  font-weight: 600;
}

.project-detail-header .btn {
  margin-left: auto;
}

.project-detail-description {
  color: var(--text-secondary);
}

.project-detail-section h3 {
  font-size: 0.9375rem;
  font-weight: 600;
  margin-bottom: var(--space-sm);
}

/* Collapsed edit form on the detail view */
.project-edit summary {
  cursor: pointer;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.project-edit form {
  margin-top: var(--space-md);
  max-width: 560px;
}

/* Repo list on the detail view */
.repo-item {
  background: var(--bg-base);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: var(--space-sm) var(--space-md);
  margin-bottom: var(--space-sm);
}

.repo-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-md);
}

.repo-mr-list {
  list-style: none;
  margin-top: var(--space-xs);
  padding-left: var(--space-md);
}

.repo-mr {
  font-size: 0.875rem;
  padding: 0.125rem 0;
}

.repo-mr a {
  color: var(--text-primary);
  text-decoration: none;
}

.repo-mr a:hover {
  color: var(--accent-blue);
}

.repo-mr-branch {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-left: var(--space-sm);
}

.repo-issue-list { list-style: none; margin-top: var(--space-xs); padding-left: var(--space-md); }
.repo-issue { font-size: 0.875rem; padding: 0.125rem 0; }
.repo-issue a { color: var(--text-primary); text-decoration: none; }
.repo-issue a:hover { color: var(--accent-blue); }

.repo-unsynced {
  font-size: 0.8125rem;
  font-style: italic;
  color: var(--text-muted);
  margin-top: var(--space-xs);
}

/* Inline forms on the detail view (link repo, add loose end, relate) */
.repo-link-form,
.loose-end-form,
.relation-form {
  display: flex;
  gap: var(--space-sm);
  align-items: center;
  margin-top: var(--space-sm);
}

.repo-link-form select,
.relation-form select,
.relation-form input,
.loose-end-form input {
  background: var(--bg-base);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: var(--space-xs) var(--space-sm);
  color: var(--text-primary);
  font-size: 0.875rem;
}

.repo-link-form select:focus,
.relation-form select:focus,
.relation-form input:focus,
.loose-end-form input:focus {
  outline: none;
  border-color: var(--accent-blue);
}

.repo-link-form select,
.loose-end-form input[name="title"] {
  flex: 1;
}

/* Loose end items: open ones get a Close button, done ones strike through */
.loose-end-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-xs) 0;
  border-bottom: 1px solid var(--border-color);
}

.loose-end-item:last-child {
  border-bottom: none;
}

.loose-end-title {
  color: var(--text-primary);
}

.loose-end-done .loose-end-title {
  text-decoration: line-through;
  color: var(--text-muted);
}

.loose-end-note {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.loose-end-item .btn,
.loose-end-closed {
  margin-left: auto;
}

.loose-end-closed {
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
}

/* Relation rows on the detail view */
.relation-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-xs) 0;
}

.relation-note {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.relation-item .btn {
  margin-left: auto;
}

/* Compact button modifier for inline list actions (unlink, close, remove) */
.btn-compact {
  padding: 0.125rem var(--space-sm);
  font-size: 0.75rem;
}

/* Project create form */
.project-form-container {
  max-width: 560px;
}

.project-form-container h2 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: var(--space-lg);
}

.form-prefill-note {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  margin-bottom: var(--space-md);
}

.form-prefill-note code {
  font-family: var(--font-mono);
  color: var(--accent-blue);
}


/* ------------------------------------------------------------------ */
/* Ops Module — Issues backlog + Merge Requests                        */
/* ------------------------------------------------------------------ */

/* Shared header row: title + status count (mirrors projects-header) */
.ops-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-md);
}

.ops-header h2 {
  font-size: 1.25rem;
  font-weight: 600;
}

.ops-open-count {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

/* Active / History tabs (Phase 4) */
.ops-tabs {
  display: flex;
  gap: var(--space-xs);
}

.ops-tab {
  font-size: 0.8125rem;
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-pill);
  color: var(--text-secondary);
  cursor: pointer;
}

.ops-tab:hover {
  color: var(--text-primary);
}

.ops-tab-active {
  background: var(--badge-bg-blue);
  color: var(--accent-blue);
  font-weight: 600;
}

/* Summary bar above the issue list (Phase 4) */
.ops-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-sm);
}

.ops-summary-item {
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

.ops-summary-item strong {
  color: var(--text-primary);
  font-weight: 600;
}

/* Issues panel: list of issue rows */
.ops-panel {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.issue-row {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  background: var(--bg-surface);
  border-radius: var(--border-radius);
  padding: var(--space-sm) var(--space-md);
}

.issue-kind {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
}

.issue-title {
  flex: 1;
  color: var(--text-primary);
  text-decoration: none;
}

.issue-title:hover {
  color: var(--accent-blue);
}

.issue-age {
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
}

/* Severity badges: reuse the badge-bg-* tokens, most to least urgent */
.issue-severity-badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-pill);
  text-transform: uppercase;
}

.issue-severity-critical,
.issue-severity-high {
  background: var(--badge-bg-red);
  color: var(--accent-red);
}

.issue-severity-medium {
  background: var(--badge-bg-yellow);
  color: var(--accent-yellow);
}

.issue-severity-low,
.issue-severity-info {
  background: var(--bg-elevated);
  color: var(--text-secondary);
}

/* Source badges: which producer created the issue */
.issue-source-badge {
  display: inline-block;
  font-size: 0.6875rem;
  padding: 0.125rem var(--space-sm);
  border-radius: var(--radius-pill);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  text-transform: uppercase;
}

.issue-source-self {
  background: var(--badge-bg-blue);
  color: var(--accent-blue);
}

.issue-source-eddie {
  background: var(--badge-bg-green);
  color: var(--accent-green);
}

/* Issue detail view */
.issue-detail {
  max-width: 720px;
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
}

.issue-detail-header {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.issue-detail-header h2 {
  font-size: 1.25rem;
  font-weight: 600;
}

/* Status badges (mirrors task-status-badge / project-status-badge) */
.issue-status-badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-pill);
  text-transform: uppercase;
}

.issue-status-open {
  background: var(--badge-bg-red);
  color: var(--accent-red);
}

.issue-status-acknowledged {
  background: var(--badge-bg-yellow);
  color: var(--accent-yellow);
}

.issue-status-resolved,
.issue-status-dismissed {
  background: var(--bg-elevated);
  color: var(--text-secondary);
}

.issue-detail-meta {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: var(--space-sm) var(--space-md);
}

.issue-detail-meta dt {
  color: var(--text-muted);
  font-size: 0.8125rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.issue-detail-meta dd {
  color: var(--text-primary);
}

.issue-detail-section h3 {
  font-size: 0.9375rem;
  font-weight: 600;
  margin-bottom: var(--space-sm);
}

.issue-link-list,
.issue-action-list {
  list-style: disc;
  padding-left: var(--space-lg);
}

.issue-link-list a {
  color: var(--accent-blue);
}

.issue-detail-actions {
  display: flex;
  gap: var(--space-md);
  align-items: center;
  padding-top: var(--space-lg);
  border-top: 1px solid var(--border-color);
}

/* Ask Eddie (Phase 3): investigating banner + dispatch-failure notice + the
   list-row in-flight marker. Reuses the shared accent/space tokens. */
.ask-eddie-investigating {
  color: var(--accent-yellow);
  font-size: 0.875rem;
  font-weight: 600;
}

.ask-eddie-error {
  color: var(--accent-red);
  font-size: 0.875rem;
  margin: var(--space-sm) 0 0;
}

.issue-investigating {
  color: var(--accent-yellow);
  font-size: 0.8125rem;
}

/* Merge Requests table */
.ops-mrs {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.ops-mrs th {
  text-align: left;
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  padding: var(--space-xs) var(--space-sm);
  border-bottom: 1px solid var(--border-color);
}

.ops-mrs td {
  padding: var(--space-xs) var(--space-sm);
  border-bottom: 1px solid var(--border-color);
  color: var(--text-primary);
}

.ops-mrs a {
  color: var(--text-primary);
  text-decoration: none;
}

.ops-mrs a:hover {
  color: var(--accent-blue);
}

/* Draft / conflict chips on the MRs table */
.mr-chip {
  display: inline-block;
  font-size: 0.6875rem;
  padding: 0.125rem var(--space-sm);
  border-radius: var(--radius-pill);
  margin-right: var(--space-xs);
  text-transform: uppercase;
}

.mr-chip-draft {
  background: var(--bg-elevated);
  color: var(--text-secondary);
}

.mr-chip-conflict {
  background: var(--badge-bg-red);
  color: var(--accent-red);
}

/* ============================================================================
   Bridge dashboard — the configurable tile grid (dashboard + infra modules)
   ============================================================================ */

/* Responsive tile grid. Tiles flow into as many columns as fit; each is at
   least 280px wide, matching the projects grid. */
.tile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--space-md);
}

/* A single tile. Bordered card (like .agent-card) but not clickable — the tile
   body is swapped in place by HTMX. */
.tile {
  display: flex;
  flex-direction: column;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: var(--space-md);
}

.tile-header {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  padding-bottom: var(--space-sm);
  margin-bottom: var(--space-sm);
  border-bottom: 1px solid var(--border-color);
}

.tile-body {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

/* Quiet placeholder/degraded copy inside a tile (loading, disabled, waiting). */
.tile-note {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.tile-error {
  font-size: 0.75rem;
  color: var(--accent-red);
}

.tile-link {
  font-size: 0.8125rem;
}

.tile-link a {
  color: var(--accent-blue);
  text-decoration: none;
}

.tile-link a:hover {
  text-decoration: underline;
}

/* Small stat row reused by the cluster-summary and Longhorn tiles. */
.cluster-stats {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-md);
}

.cluster-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 64px;
}

.cluster-stat-value {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
}

.cluster-stat-label {
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

/* Utilisation meter: a labelled track with a coloured fill. */
.meter-row {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.meter-head {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.meter {
  height: 8px;
  background: var(--bg-base);
  border-radius: var(--radius-pill);
  overflow: hidden;
}

.meter-fill {
  height: 100%;
  border-radius: var(--radius-pill);
  transition: width 0.3s ease;
}

/* Fill colour by health level. */
.meter-ok .meter-fill {
  background: var(--accent-green);
}

.meter-warn .meter-fill {
  background: var(--accent-yellow);
}

.meter-critical .meter-fill {
  background: var(--accent-red);
}

/* Per-node rows on the nodes tile. */
.node-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.node-row {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.node-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.node-name {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--text-primary);
}

.node-meters {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.node-meter {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.node-meter-label {
  font-size: 0.6875rem;
  color: var(--text-muted);
}

/* Health chip: readiness/status pill, coloured by ok/warn/critical (mirrors the
   .issue-severity-* / .badge-* idiom). */
.health-chip {
  display: inline-block;
  font-size: 0.6875rem;
  font-weight: 600;
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-pill);
  text-transform: uppercase;
}

.health-chip-ok {
  background: var(--badge-bg-green);
  color: var(--accent-green);
}

.health-chip-warn {
  background: var(--badge-bg-yellow);
  color: var(--accent-yellow);
}

.health-chip-critical {
  background: var(--badge-bg-red);
  color: var(--accent-red);
}

/* Text-only status colours for the Longhorn volume counts. */
.chip-text-ok {
  color: var(--accent-green);
}

.chip-text-warn {
  color: var(--accent-yellow);
}

.chip-text-critical {
  color: var(--accent-red);
}


/* ------------------------------------------------------------------ */
/* Command layer — shell (slim cluster bar + single-column deck)       */
/* ------------------------------------------------------------------ */

/* The single content column every view renders into. Replaces the old
   three-panel .bridge-layout grid: state lives in the pane, depth one click
   away — side panels earned no glance. */
.command-deck {
  flex: 1;
  padding: var(--space-lg);
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
}

/* The thin cluster bar under the top nav — the metal's health on EVERY view.
   The infra module fills it (or leaves it empty when disabled); an empty bar
   collapses to nothing. */
.cluster-bar {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: 0.3rem var(--space-lg);
  background: var(--bg-base);
  border-bottom: 1px solid var(--border-color);
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.cluster-bar:empty {
  display: none;
}

.slim-health {
  color: var(--text-primary);
  font-weight: 600;
}

.slim-metric b {
  color: var(--text-primary);
  font-weight: 600;
}

.slim-metric b.slim-ok       { color: var(--accent-green); }
.slim-metric b.slim-warn     { color: var(--accent-yellow); }
.slim-metric b.slim-critical { color: var(--accent-red); }
.slim-ok       { color: var(--accent-green); }
.slim-warn     { color: var(--accent-yellow); }
.slim-critical { color: var(--accent-red); }

/* Status dots — the two-word status vocabulary (ok/warn/critical) plus the
   agents' lifecycle states, shared by the strip, scan tiles, and facets. */
.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.status-ok       { background: var(--accent-green); }
.status-warn     { background: var(--accent-yellow); }
.status-critical { background: var(--accent-red); }
.status-waiting  { background: var(--accent-yellow); }
.status-active   { background: var(--accent-blue); }
.status-done     { background: var(--accent-green); }
.status-error    { background: var(--accent-red); }

.text-muted { color: var(--text-muted); }

/* --- Agent pulse rail (PM slice 5): a compact live strip below the scoped
   board header; reuses the .status-dot vocabulary. --- */
.agent-pulse-rail { margin-bottom: var(--space-md); }
.agent-pulse { display: flex; flex-wrap: wrap; gap: var(--space-md); }
.pulse-agent { display: inline-flex; align-items: center; gap: var(--space-xs); background: var(--bg-base); border-radius: var(--border-radius); padding: var(--space-xs) var(--space-sm); }
.pulse-agent-state { color: var(--text-secondary); font-size: 0.75rem; }
.pulse-agent-count { color: var(--text-muted); font-size: 0.75rem; }
.pulse-agent-age { color: var(--text-muted); font-size: 0.6875rem; }


/* ------------------------------------------------------------------ */
/* Command layer — Home board                                          */
/* ------------------------------------------------------------------ */

.home-board {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.home-section-head {
  display: flex;
  align-items: baseline;
  gap: var(--space-sm);
  margin-top: var(--space-md);
}

.home-section-title {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.6875rem;
  font-weight: 700;
  color: var(--text-secondary);
}

.home-section-sub {
  font-size: 0.6875rem;
  color: var(--text-muted);
}


/* ------------------------------------------------------------------ */
/* Command layer — cluster hero strip (gauges + sparkline)             */
/* ------------------------------------------------------------------ */

.cluster-strip {
  display: flex;
  align-items: center;
  gap: var(--space-lg);
  flex-wrap: wrap;
  background: linear-gradient(180deg, #141c30, var(--bg-base));
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: var(--space-md) var(--space-lg);
}

.strip-headline {
  min-width: 6.5rem;
}

.strip-kicker {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.6875rem;
  font-weight: 700;
  color: var(--text-secondary);
}

.strip-health {
  font-size: 1.25rem;
  font-weight: 700;
}

.strip-health-ok       { color: var(--accent-green); }
.strip-health-warn     { color: var(--accent-yellow); }
.strip-health-critical { color: var(--accent-red); }

.strip-sub {
  font-size: 0.6875rem;
  color: var(--text-muted);
}

.strip-gauge {
  text-align: center;
}

.strip-gauge-label {
  color: var(--text-secondary);
  font-size: 0.6875rem;
  margin-top: -4px;
}

.gauge-track {
  stroke: var(--bg-hover);
}

.gauge-value {
  font-size: 20px;
  font-weight: 700;
  fill: var(--text-primary);
}

/* Gauge arcs use the RESERVED status palette (green/amber/red by threshold);
   the soft glow is "catchy" without harming legibility (UX vision §5). */
.gauge-ok {
  stroke: var(--accent-green);
  filter: drop-shadow(0 0 5px rgba(34, 197, 94, 0.6));
}

.gauge-warn {
  stroke: var(--accent-yellow);
  filter: drop-shadow(0 0 5px rgba(234, 179, 8, 0.6));
}

.gauge-critical {
  stroke: var(--accent-red);
  filter: drop-shadow(0 0 5px rgba(239, 68, 68, 0.6));
}

.strip-stats {
  display: flex;
  gap: var(--space-sm);
}

.strip-stat {
  background: var(--bg-deepest);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: var(--space-sm) var(--space-md);
  text-align: center;
  min-width: 4.5rem;
}

.strip-stat-value {
  font-size: 1.375rem;
  font-weight: 700;
  color: var(--text-primary);
}

.strip-stat-value.strip-stat-ok  { color: var(--accent-green); }
.strip-stat-value.strip-stat-bad { color: var(--accent-red); }

.strip-stat-label {
  color: var(--text-secondary);
  font-size: 0.6875rem;
}

.strip-spark {
  flex: 1;
  min-width: 150px;
}

.strip-spark-head {
  display: flex;
  justify-content: space-between;
  color: var(--text-secondary);
  font-size: 0.6875rem;
  margin-bottom: 2px;
}

.strip-spark-window {
  color: var(--text-muted);
}

.strip-error {
  width: 100%;
  font-size: 0.6875rem;
}


/* ------------------------------------------------------------------ */
/* Command layer — needs-attention band                                */
/* ------------------------------------------------------------------ */

/* The band is one responsive grid; each module's source wrapper contributes
   its cards directly to the grid via display:contents, so cards from all
   sources flow together. An empty (quiet) source contributes nothing. */
.attention-band {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: var(--space-sm);
}

.attention-source {
  display: contents;
}

/* Quiet note: visible only while NO source has produced a card. */
.attention-quiet {
  color: var(--text-muted);
  font-size: 0.8125rem;
  font-style: italic;
  padding: var(--space-xs) 0;
}

.attention-band:has(.attention-card) .attention-quiet {
  display: none;
}

.attention-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-left: 3px solid var(--accent-yellow);
  border-radius: var(--border-radius);
  padding: var(--space-sm) var(--space-md);
  cursor: pointer;
  transition: background 0.15s;
}

.attention-card:hover {
  background: var(--bg-hover);
}

.attention-card.attention-critical {
  border-left-color: var(--accent-red);
}

.attention-card.attention-critical .attention-kicker {
  color: var(--accent-red);
}

.attention-kicker {
  font-size: 0.625rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent-yellow);
  margin-bottom: var(--space-xs);
}

.attention-body {
  color: var(--text-primary);
  font-size: 0.8125rem;
  margin-bottom: var(--space-xs);
}

.attention-foot {
  color: var(--text-muted);
  font-size: 0.6875rem;
}


/* ------------------------------------------------------------------ */
/* Command layer — project scan tiles                                  */
/* ------------------------------------------------------------------ */

.scan-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: var(--space-md);
}

.scan-tile {
  background: var(--bg-base);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: var(--space-md);
}

.scan-tile-head {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-sm);
  cursor: pointer;
}

.scan-tile-head:hover .scan-tile-name {
  color: var(--accent-blue);
}

.scan-tile-name {
  font-weight: 600;
  color: var(--text-primary);
}

.scan-tile-note {
  margin-left: auto;
  color: var(--text-muted);
  font-size: 0.6875rem;
}

.scan-tile-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-xs) var(--space-md);
  color: var(--text-secondary);
  font-size: 0.75rem;
  margin-bottom: var(--space-sm);
}

.scan-tile-stats b {
  color: var(--text-primary);
}

.scan-pipeline-failed { color: var(--accent-red); }
.scan-pipeline-ok     { color: var(--accent-green); }

.scan-tile-add {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-deepest);
  border: 1px dashed var(--border-color);
  color: var(--text-muted);
  cursor: pointer;
  min-height: 6rem;
}

.scan-tile-add:hover {
  color: var(--text-secondary);
  border-color: var(--text-muted);
}

/* Compact delivery rollup (board module fragment) inside a scan tile:
   single-hue blue marks — the dataviz-validated choice for small dark tiles. */
.meter-label {
  color: var(--text-secondary);
  font-size: 0.6875rem;
  margin-bottom: 3px;
}

.meter-track {
  height: 7px;
  background: var(--bg-hover);
  border-radius: 4px;
  overflow: hidden;
}

.meter-track .meter-fill {
  background: var(--accent-blue);
  border-radius: 4px;
}


/* ------------------------------------------------------------------ */
/* Command layer — project facet tiles (Delivery / Agents / Context)   */
/* ------------------------------------------------------------------ */

.facet-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--space-md);
  align-items: start;
  margin: var(--space-lg) 0;
}

.facet-tile {
  background: var(--bg-base);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  overflow: hidden;
}

/* Full-width tile: spans every column of the auto-fit grid. The Context
   tile sits alone on the bottom row so its repo/MR/issue lists get the
   whole deck width. */
.facet-tile--wide {
  grid-column: 1 / -1;
}

.facet-header {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  border-bottom: 1px solid var(--border-color);
  background: #131c30;
}

.facet-title {
  text-transform: uppercase;
  letter-spacing: 0.07em;
  font-size: 0.6875rem;
  font-weight: 700;
  color: var(--text-secondary);
}

.facet-header-actions {
  margin-left: auto;
  color: var(--text-muted);
  font-size: 0.6875rem;
}

.facet-header-actions a {
  color: var(--text-muted);
  text-decoration: none;
}

.facet-header-actions a:hover {
  color: var(--accent-blue);
}

.facet-body {
  padding: var(--space-sm) var(--space-md) var(--space-md);
}

.facet-group-label {
  color: var(--text-muted);
  font-size: 0.625rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: var(--space-sm) 0 var(--space-xs);
}

.facet-card {
  background: var(--bg-deepest);
  border: 1px solid var(--border-color);
  border-left: 2px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: var(--space-sm);
  margin-bottom: var(--space-xs);
  font-size: 0.75rem;
  color: var(--text-primary);
  cursor: pointer;
}

.facet-card:hover {
  background: var(--bg-hover);
}

.facet-card-High   { border-left-color: var(--priority-high); }
.facet-card-Medium { border-left-color: var(--priority-medium); }
.facet-card-Low    { border-left-color: var(--priority-low); }

.facet-card-done {
  color: var(--text-secondary);
  cursor: default;
}

.facet-card-meta {
  color: var(--text-muted);
  font-size: 0.625rem;
  margin-top: var(--space-xs);
}

.facet-check {
  color: var(--accent-green);
}

.facet-agent {
  background: var(--bg-deepest);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: var(--space-sm);
  margin-bottom: var(--space-sm);
  cursor: pointer;
}

.facet-agent:hover {
  background: var(--bg-hover);
}

.facet-agent-head {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: 0.8125rem;
  color: var(--text-primary);
  margin-bottom: var(--space-xs);
}

.facet-agent-state {
  margin-left: auto;
  color: var(--text-muted);
  font-size: 0.6875rem;
}

.facet-agent-task {
  color: var(--text-secondary);
  font-size: 0.75rem;
  padding: 2px 0;
}

.facet-agent-task-state {
  color: var(--text-muted);
  font-size: 0.625rem;
}


/* ------------------------------------------------------------------ */
/* Command layer — ⌘K command palette                                  */
/* ------------------------------------------------------------------ */

.palette-chip {
  font-size: 0.6875rem;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: 3px 8px;
  cursor: pointer;
  font-family: var(--font-sans);
  margin-right: var(--space-md);
}

.palette-chip:hover {
  color: var(--text-secondary);
  border-color: var(--text-muted);
}

.palette-overlay {
  position: fixed;
  inset: 0;
  background: rgba(4, 7, 14, 0.6);
  backdrop-filter: blur(2px);
  z-index: 100;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding-top: 15vh;
}

/* The palette starts hidden (the partial ships the [hidden] attribute, which
   palette.js toggles). A class rule with display:flex would otherwise beat the
   UA stylesheet's [hidden]{display:none}, so restate it here at equal
   specificity — without this the overlay shows on every page load. */
.palette-overlay[hidden] {
  display: none;
}

.palette-box {
  width: min(560px, 90vw);
  background: var(--bg-surface);
  border: 1px solid var(--bg-hover);
  border-radius: 10px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.55);
  overflow: hidden;
}

.palette-input {
  width: 100%;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  padding: var(--space-md);
  outline: none;
}

.palette-input::placeholder {
  color: var(--text-muted);
}

.palette-list {
  list-style: none;
  max-height: 40vh;
  overflow-y: auto;
  padding: var(--space-xs);
}

.palette-item {
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--border-radius);
  color: var(--text-secondary);
  font-size: 0.875rem;
  cursor: pointer;
}

.palette-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.palette-selected {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.palette-empty {
  padding: var(--space-sm) var(--space-md);
  color: var(--text-muted);
  font-style: italic;
  font-size: 0.8125rem;
}

/* --- Programs lens --- */
/* Status badges reuse .project-status-badge / .project-status-{active,paused,done}
   (defined above, ~line 1051) — the status vocabulary is shared with projects,
   so no new badge CSS is needed here. */

.program-section {
  margin-block: var(--space-lg);
}

.program-header {
  display: flex;
  align-items: baseline;
  gap: var(--space-sm);
  padding-bottom: var(--space-sm);
  border-bottom: 1px solid var(--border-color);
  margin-bottom: var(--space-md);
}

.program-name {
  font-weight: 600;
  color: var(--text-primary);
  text-decoration: none;
}

.program-name:hover {
  color: var(--accent-blue);
}

.program-name-unassigned {
  color: var(--text-muted);
  font-weight: 600;
}

.program-mission {
  color: var(--text-muted);
  font-style: italic;
}

.program-meta {
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.8125rem;
}

.program-member {
  position: relative;
}

.program-member .btn {
  margin-top: var(--space-xs);
}

/* ---------------------------------------------------------------------- */
/* PM — goals, check-ins & ideas                                          */
/* ---------------------------------------------------------------------- */

/* Facet segments on the project detail: Overview · PM */
.segment-strip {
  display: flex;
  gap: var(--space-xs);
  margin-bottom: var(--space-md);
  border-bottom: 1px solid var(--border-color);
}

.segment {
  padding: var(--space-xs) var(--space-md);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.875rem;
  border-bottom: 2px solid transparent;
}

.segment:hover {
  color: var(--accent-blue);
}

.segment-active {
  color: var(--text-primary);
  font-weight: 600;
  border-bottom-color: var(--accent-blue);
}

/* Health vocabulary: dot colors keyed by the Health String() values, plus
   the gray stale state ("needs check-in"). Extends the shared .status-dot
   idiom (see the command-layer shell section). */
.status-on-track       { background: var(--accent-green); }
.status-needs-attention { background: var(--accent-yellow); }
.status-at-risk        { background: var(--accent-red); }
.status-stale          { background: var(--text-muted); }

/* Health badge: the pill form of the same vocabulary (program headers,
   PM subview header). Mirrors .project-status-badge. */
.health-badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-pill);
  text-transform: uppercase;
}

.health-on-track       { background: var(--badge-bg-green);  color: var(--accent-green); }
.health-needs-attention { background: var(--badge-bg-yellow); color: var(--accent-yellow); }
.health-at-risk        { background: var(--badge-bg-red);    color: var(--accent-red); }
.health-stale          { background: var(--bg-elevated);     color: var(--text-muted); }

/* Check-in form: three radios + the mandatory why */
.checkin-form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-md);
}

.checkin-form input[type="text"] {
  flex: 1;
  min-width: 12rem;
  background: var(--bg-base);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: var(--space-xs) var(--space-sm);
  color: var(--text-primary);
}

.radio-row {
  display: flex;
  gap: var(--space-sm);
}

.radio-option {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  font-size: 0.8125rem;
  color: var(--text-secondary);
  cursor: pointer;
}

.radio-option input {
  accent-color: var(--accent-blue);
}

/* Captain's log */
.checkin-item {
  display: flex;
  align-items: baseline;
  gap: var(--space-sm);
  padding: var(--space-xs) 0;
  border-bottom: 1px solid var(--border-color);
}

.checkin-item:last-child {
  border-bottom: none;
}

.checkin-health {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.checkin-note {
  color: var(--text-primary);
}

.checkin-date {
  margin-left: auto;
  font-size: 0.75rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
  white-space: nowrap;
}

/* Goals */
.goal-item {
  padding: var(--space-sm) 0;
  border-bottom: 1px solid var(--border-color);
}

.goal-item:last-child {
  border-bottom: none;
}

.goal-head {
  display: flex;
  align-items: baseline;
  gap: var(--space-sm);
}

.goal-title {
  font-weight: 600;
  color: var(--text-primary);
}

.goal-item-achieved .goal-title {
  text-decoration: line-through;
  color: var(--text-muted);
}

.goal-item-dropped .goal-title {
  color: var(--text-muted);
}

.goal-target {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.goal-actions {
  margin-left: auto;
  display: flex;
  gap: var(--space-xs);
}

.goal-why {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin: var(--space-xs) 0 0;
}

/* Goal → task breakdown (hierarchy slice 7b): the board's goal-tasks fragment
   composed under an open goal. Quiet and indented to read as subordinate. */
.goal-tasks-panel { margin: var(--space-xs) 0 0 var(--space-md); }
.goal-tasks-head { display: flex; align-items: baseline; gap: var(--space-xs); }
.goal-tasks-count { font-family: var(--font-mono); color: var(--text-secondary); }
.goal-tasks-label { font-size: 0.75rem; color: var(--text-muted); text-transform: uppercase; }
.goal-tasks-list { list-style: none; margin: var(--space-xs) 0 0 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-xs); }
.goal-tasks-item { display: flex; align-items: baseline; gap: var(--space-sm); font-size: 0.8125rem; }
.goal-tasks-title { color: var(--text-secondary); }
.goal-tasks-lane { font-family: var(--font-mono); font-size: 0.6875rem; text-transform: uppercase; }
.goal-tasks-empty { font-size: 0.8125rem; color: var(--text-muted); margin: var(--space-xs) 0 0 var(--space-md); }
.goal-add-task { display: inline-block; margin: var(--space-xs) 0 0 var(--space-md); font-size: 0.8125rem; color: var(--accent-blue); text-decoration: none; cursor: pointer; }

.goal-form,
.measure-add form,
.goal-edit form {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  margin-top: var(--space-sm);
}

.goal-form input,
.measure-add input,
.measure-add select,
.goal-edit input {
  background: var(--bg-base);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: var(--space-xs) var(--space-sm);
  color: var(--text-primary);
}

.goal-form input[name="title"] {
  flex: 1;
  min-width: 14rem;
}

/* Measures: name · progress bar · value · update form */
.measure-row {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-xs) 0;
  font-size: 0.8125rem;
}

.measure-name {
  color: var(--text-secondary);
  min-width: 8rem;
}

.measure-track {
  flex: 1;
  max-width: 16rem;
}

/* Band colors must out-specify the existing `.meter-track .meter-fill`
   blue (the scan-tile meter rule, 0-2-0) — hence the compound selectors. */
.measure-track .meter-fill.measure-fill-ok       { background: var(--accent-green); }
.measure-track .meter-fill.measure-fill-warn     { background: var(--accent-yellow); }
.measure-track .meter-fill.measure-fill-critical { background: var(--accent-red); }

.measure-value {
  color: var(--text-muted);
  font-family: var(--font-mono);
  white-space: nowrap;
}

.measure-update-form {
  display: inline-flex;
  gap: var(--space-xs);
}

.measure-update-form input {
  width: 5rem;
  background: var(--bg-base);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: 0 var(--space-xs);
  color: var(--text-primary);
}

/* PM glance tile line on the project detail */
.pm-glance-line {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  color: var(--text-secondary);
  font-size: 0.8125rem;
}

.goal-archive {
  margin-top: var(--space-sm);
}

/* --- Program goal board cards (PM slice 5): borrow project-card visual weight;
   reuse .measure-* bars. --- */
.goal-card { background: var(--bg-surface); border-radius: var(--border-radius); border-left: 3px solid var(--border-color); padding: var(--space-sm) var(--space-md); margin-bottom: var(--space-sm); }
.goal-card-achieved { border-left-color: var(--accent-green); }
.goal-card-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-sm); }
.goal-card-title { font-weight: 600; color: var(--text-primary); text-decoration: none; }
.goal-card-title:hover { color: var(--accent-blue); }
.goal-card-project { color: var(--text-muted); font-size: 0.75rem; }
.goal-card .goal-target { color: var(--text-secondary); font-size: 0.75rem; }
.goal-card .goal-achieved { color: var(--text-muted); font-size: 0.75rem; }

/* Ideas: dashed border = not yet real work (GitHub draft-issue precedent);
   stale ideas fade (the graveyard defense); resolved ones read as record. */
.idea-item {
  border: 1px dashed var(--border-color);
  border-radius: var(--border-radius);
  padding: var(--space-sm) var(--space-md);
  margin-bottom: var(--space-sm);
}

.idea-head {
  display: flex;
  align-items: baseline;
  gap: var(--space-sm);
}

.idea-title {
  font-weight: 600;
  color: var(--text-primary);
}

.idea-body {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.idea-stale {
  opacity: 0.55;
}

/* Resolved states: idea-{{status}} classes from the template. The duplicate
   PICKER (the details element) is .idea-duplicate-picker — a different class
   from the .idea-duplicate STATUS, deliberately. */
.idea-promoted .idea-title,
.idea-declined .idea-title,
.idea-duplicate .idea-title {
  color: var(--text-muted);
}

.idea-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-sm);
  margin-top: var(--space-xs);
}

/* Breakdown: the goals an idea was broken out into (slice 7a). Indented one
   step under .idea-head to read as subordinate to the idea, not as a peer
   list. No discs — every list in this app is styled, never browser-default. */
.idea-breakdown {
  list-style: none;
  margin: var(--space-xs) 0 0 0;
  padding: 0 0 0 var(--space-md);
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.idea-breakdown-goal {
  display: flex;
  align-items: baseline;
  gap: var(--space-sm);
  font-size: 0.8125rem;
}

.idea-breakdown-title {
  color: var(--text-secondary);
}

/* The goal's status, in the .idea-status idiom: quiet, uppercase, monospace
   so a column of them aligns. */
.idea-breakdown-status {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  text-transform: uppercase;
  color: var(--text-muted);
}

.idea-promote-form,
.idea-duplicate-picker form {
  display: inline-flex;
  gap: var(--space-xs);
}

.idea-promote-form select,
.idea-duplicate-picker select {
  background: var(--bg-base);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  color: var(--text-primary);
  padding: 0 var(--space-xs);
  font-size: 0.8125rem;
}

.idea-resolution {
  display: flex;
  align-items: baseline;
  gap: var(--space-sm);
  margin-top: var(--space-xs);
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.idea-status {
  text-transform: uppercase;
  font-size: 0.6875rem;
  font-weight: 600;
}

.idea-ref,
.idea-reason {
  font-family: var(--font-mono);
  font-size: 0.75rem;
}

.idea-form {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  margin-top: var(--space-sm);
}

.idea-form input[type="text"] {
  background: var(--bg-base);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: var(--space-xs) var(--space-sm);
  color: var(--text-primary);
}

.idea-form input[name="title"] {
  flex: 1;
  min-width: 12rem;
}

/* Inbox strip on the programs lens */
.idea-inbox {
  margin-bottom: var(--space-lg);
}

.idea-inbox summary {
  cursor: pointer;
  color: var(--text-secondary);
  font-weight: 600;
  margin-bottom: var(--space-sm);
}

/* --- Board ideas column (PM slice 5): a leading kanban lane of dashed idea
   cards; reuses .kanban-lane / .lane-cards / .idea-item / .idea-stale. --- */
.kanban-lane--ideas { border: 1px dashed var(--border-color); }
.kanban-lane--ideas .idea-item { cursor: default; }

/* --- Chart fragments (board burnup / throughput / burndown, PM slice 3) ---
   Geometry comes precomputed from Go (pkg/chartsvg); these classes own ALL
   color so series stay theme-consistent. Series are dash- AND color-coded:
   scope = dashed blue, completed = solid green + soft area, ideal = dotted muted. */
.chart-frame { margin-top: var(--space-sm); }
.chart-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: var(--space-xs); }
.chart-title { color: var(--text-secondary); font-size: 0.75rem; }
.chart-legend { display: flex; gap: var(--space-md); }
.chart-legend-item { color: var(--text-secondary); font-size: 0.6875rem; display: inline-flex; align-items: center; gap: 0.35em; }
.chart-swatch { width: 10px; height: 3px; display: inline-block; border-radius: 1px; }
.chart-swatch--scope { background: var(--accent-blue); }
.chart-swatch--completed { background: var(--chart-completed); }
.chart-svg { width: 100%; height: auto; display: block; }
.chart-line { fill: none; stroke-width: 2; }
.chart-line--scope { stroke: var(--accent-blue); stroke-dasharray: 6 3; }
.chart-line--completed { stroke: var(--chart-completed); }
.chart-area--completed { fill: var(--chart-completed); opacity: 0.15; }
.chart-line--ideal { stroke: var(--text-muted); stroke-dasharray: 2 3; }
.chart-grid { stroke: var(--bg-hover); stroke-width: 1; }
.chart-axis-label { fill: var(--text-muted); font-size: 10px; font-family: var(--font-mono); }
.chart-bar { fill: var(--accent-blue); }
.chart-line--spark { stroke: var(--accent-blue); }
.chart-area--spark { fill: var(--accent-blue); opacity: 0.12; }
.chart-spark-dot { fill: var(--accent-blue); }

/* --- Issues trend fragment (PM slice 4) --- opened=blue, closed=green,
   backlog=muted; two stacked charts, no dual axis. Color lives here only. */
.chart-head--sub { margin-top: var(--space-sm); }
.chart-bar--opened { fill: var(--accent-blue); }
.chart-bar--closed { fill: var(--chart-completed); }
.chart-swatch--opened { background: var(--accent-blue); }
.chart-swatch--closed { background: var(--chart-completed); }
.chart-line--backlog { stroke: var(--text-muted); }
.chart-backlog-dot { fill: var(--text-muted); }

/* ------------------------------------------------------------------ */
/* Approval gate (slice 3) — nav count badge + queue page              */
/* ------------------------------------------------------------------ */

/* The count badge the /approvals/count fragment swaps into the nav slot.
   Rendered only when the review lane is non-empty (the fragment writes an empty
   body when quiet), so the pill never shows a zero. */
.nav-count {
  display: inline-block;
  margin-left: var(--space-xs);
  padding: 0 0.375rem;
  background: var(--accent-yellow);
  color: var(--bg-deepest);
  border-radius: var(--border-radius);
  font-size: 0.6875rem;
  font-weight: 600;
  line-height: 1.4;
}

/* The approval queue page (GET /approvals). */
.approvals {
  padding: var(--space-lg);
}

.approvals-empty {
  color: var(--text-muted);
  font-style: italic;
  padding: var(--space-md) 0;
}

/* One review-lane card awaiting the captain's decision. The yellow left border
   echoes the awaiting-approval attention card on the Home band. */
.approval-row {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  padding: var(--space-md);
  margin-bottom: var(--space-sm);
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-left: 3px solid var(--accent-yellow);
  border-radius: var(--border-radius);
}

.approval-meta {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  color: var(--text-muted);
  font-size: 0.75rem;
}

/* The lazily-composed agents-module last-run context line (muted). */
.approval-agent {
  color: var(--text-muted);
  font-size: 0.75rem;
}

.approval-actions {
  display: flex;
  align-items: flex-start;
  gap: var(--space-sm);
  margin-top: var(--space-xs);
}

/* The Reject block is a <details> holding the optional note textarea. */
.approval-actions details {
  flex: 1;
}

.approval-actions textarea {
  width: 100%;
  min-height: 3rem;
  margin: var(--space-xs) 0;
  padding: var(--space-sm);
  background: var(--bg-deepest);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  resize: vertical;
}

/* Row internals referenced by approvals.html (verify-panel gap fix): header
   line, title link, project chip slot, and the in-review age. */
.approvals-header {
  display: flex;
  align-items: baseline;
  gap: var(--space-sm);
  margin-bottom: var(--space-md);
}

.approval-main {
  display: flex;
  align-items: baseline;
  gap: var(--space-sm);
}

.approval-title {
  color: var(--text-primary);
  font-weight: 600;
  cursor: pointer;
}

.approval-title:hover {
  color: var(--accent-blue);
}

.approval-project {
  color: var(--text-secondary);
  font-size: 0.75rem;
}

.approval-age {
  color: var(--text-muted);
  font-size: 0.75rem;
}

.approval-reject {
  color: var(--text-secondary);
  font-size: 0.8125rem;
  cursor: pointer;
}

/* The agents-module last-run fragment internals (card-last-run.html): compact
   inline line; the tail is a one-line ellipsized code snippet. The status span
   reuses the existing .agent-status-badge / .status-error classes. */
.agent-last-run {
  display: inline-flex;
  align-items: baseline;
  gap: var(--space-xs);
}

.agent-last-run-name {
  color: var(--text-secondary);
}

.agent-last-run-when {
  color: var(--text-muted);
}

.agent-last-run-tail {
  display: inline-block;
  max-width: 28rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: bottom;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.75rem;
}

/* --- Auth (login / setup / passkeys) --- */
/* Standalone login+setup documents center a palette-box-style card; the
   passkeys page is a normal in-layout view reusing tile/form classes. */

.auth-body {
  display: grid;
  place-items: center;
  min-height: 100vh;
}

.auth-card {
  width: min(420px, 92vw);
  background: var(--bg-surface);
  border: 1px solid var(--bg-hover);
  border-radius: 10px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.55);
  padding: var(--space-xl);
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.auth-brand {
  font-weight: 700;
  font-size: 1.5rem;
  color: var(--accent-blue);
}

.auth-sub {
  color: var(--text-secondary);
  font-size: 0.875rem;
  margin-top: calc(-1 * var(--space-sm));
}

.auth-btn {
  width: 100%;
  padding: var(--space-sm) var(--space-md);
  font-size: 1rem;
}

/* Credential-grade control: keep a visible focus ring (the app's usual
   outline-removal convention is too thin for the sign-in button). */
.auth-btn:focus-visible {
  outline: 2px solid var(--accent-blue);
  outline-offset: 2px;
}

.auth-error {
  color: var(--accent-red);
  font-size: 0.875rem;
  margin: 0;
}

.auth-link {
  color: var(--accent-blue);
}

.auth-passkeys {
  max-width: 720px;
}

.auth-passkey-row {
  margin-bottom: var(--space-md);
  gap: var(--space-xs);
}

.auth-passkey-meta {
  font-size: 0.8125rem;
}

.auth-passkey-actions {
  margin-top: var(--space-sm);
}

.auth-inline-form {
  display: flex;
  gap: var(--space-xs);
  align-items: center;
}

.auth-inline-form input {
  background: var(--bg-base);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  color: var(--text-primary);
  padding: var(--space-xs) var(--space-sm);
  font-size: 0.8125rem;
}

.auth-danger-zone {
  margin-top: var(--space-lg);
  border-top: 1px solid var(--border-color);
  padding-top: var(--space-md);
}

/* Nav session controls: the sign-out button masquerades as a nav-link so the
   logout form doesn't disturb the bar's layout. */
.nav-logout-form {
  display: inline;
}

.nav-logout {
  background: none;
  border: none;
  cursor: pointer;
  font: inherit;
}
