/* ForgeMind Control Center V2 — uses design-system tokens */
@import url("/static/design-system.css");

:root {
  color-scheme: light;
  --bg: var(--fm-bg);
  --sidebar: var(--fm-surface);
  --surface: var(--fm-surface);
  --surface-2: var(--fm-surface-inset);
  --surface-3: var(--fm-paper-200);
  --line: var(--fm-border);
  --line-strong: var(--fm-border-strong);
  --text: var(--fm-fg-strong);
  --text-2: var(--fm-fg-muted);
  --muted: var(--fm-fg-subtle);
  --accent: var(--fm-sapphire-500);
  --accent-glow: var(--fm-sapphire-glow);
  --success: var(--fm-go);
  --warning: var(--fm-hold);
  --danger: var(--fm-abort);
  --info: var(--fm-info);
  --shadow: var(--fm-elev-1);
  --shadow-lg: var(--fm-elev-2);
  --glass: blur(10px) saturate(140%);
  --radius: var(--fm-r-lg);
  --z-topbar: 50;
  --z-modal: 100;
  --z-toast: 200;
}
* { box-sizing: border-box; }

html { min-height: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--fm-fg);
  background: var(--fm-bg);
  font: var(--fm-text-body)/1.5 var(--fm-font-sans);
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--fm-info);
  text-decoration: none;
  font-weight: 650;
}

a:hover { color: var(--fm-fg-strong); }

:focus-visible {
  outline: 2px solid var(--fm-focus);
  outline-offset: 3px;
}

button,
input,
select {
  font: inherit;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.app-shell {
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr);
  min-height: 100vh;
  min-width: 0;
}

.nav-dock {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: var(--fm-s-5) var(--fm-s-4);
  background: var(--fm-surface);
  border-right: 1px solid var(--fm-border);
  display: flex;
  flex-direction: column;
  gap: var(--fm-s-2);
  z-index: var(--z-topbar);
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: var(--fm-s-3);
  padding: var(--fm-s-2) var(--fm-s-2) var(--fm-s-5);
  border-bottom: 1px solid var(--fm-border);
  margin-bottom: var(--fm-s-2);
}

.brand-mark {
  width: 30px;
  height: 34px;
  flex-shrink: 0;
  color: var(--fm-fg-strong);
  display: block;
}

.brand-title {
  font-weight: 800;
  letter-spacing: 0;
  line-height: 1.1;
}

.brand-subtitle {
  color: var(--fm-fg-subtle);
  font: 600 var(--fm-text-meta)/1.2 var(--fm-font-mono);
  margin-top: 2px;
  text-transform: uppercase;
}

.nav-section-label {
  color: var(--fm-fg-subtle);
  font: 800 10px/1 var(--fm-font-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: var(--fm-s-4) var(--fm-s-2) var(--fm-s-1);
}

.nav-item {
  min-height: 36px;
  padding: var(--fm-s-2) var(--fm-s-3);
  border-radius: var(--fm-r-md);
  color: var(--fm-fg-muted);
  font-weight: 700;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: var(--fm-s-2);
}

.nav-item span {
  width: 18px;
  color: var(--fm-fg-subtle);
  font-family: var(--fm-font-mono);
  text-align: center;
}

.nav-item.active {
  background: var(--fm-sapphire-50);
  color: var(--fm-sapphire-800);
  box-shadow: inset 2px 0 0 var(--fm-sapphire-500);
}

.nav-item.active span { color: var(--fm-sapphire-600); }
.nav-item:hover:not(.active) { background: var(--fm-surface-inset); color: var(--fm-fg-strong); }
.nav-spacer { flex: 1; }

.nav-version {
  margin-top: var(--fm-s-3);
  padding: var(--fm-s-3);
  border: 1px solid var(--fm-border);
  border-radius: var(--fm-r-md);
  background: rgb(246 248 251 / 0.85);
  display: grid;
  gap: 4px;
}

.nav-version-label,
.nav-version-env {
  color: var(--fm-fg-subtle);
  font: 800 10px/1 var(--fm-font-mono);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.nav-version-value {
  color: var(--fm-fg-strong);
  font: 900 18px/1.1 var(--fm-font-mono);
}

.surface-shell {
  min-width: 0;
  min-height: 100vh;
}

.surface-main {
  min-width: 0;
}

.command-topbar {
  position: sticky;
  top: 0;
  z-index: var(--z-topbar);
  height: 64px;
  padding: 0 var(--fm-s-6);
  background: var(--fm-surface);
  backdrop-filter: var(--glass);
  border-bottom: 1px solid var(--fm-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--fm-s-4);
}

.topbar-title {
  min-width: 0;
}

.command-topbar h1 {
  font-size: 18px;
  font-weight: 800;
  margin: 0;
  line-height: 1.1;
}

.eyebrow {
  color: var(--fm-fg-subtle);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font: 800 10px/1.2 var(--fm-font-mono);
  margin-bottom: var(--fm-s-1);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: var(--fm-s-2);
  flex-wrap: wrap;
  justify-content: flex-end;
}

.language-switcher {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--fm-border);
  border-radius: var(--fm-r-md);
  overflow: hidden;
  background: var(--fm-surface);
}

.language-option {
  min-width: 34px;
  padding: 7px 9px;
  color: var(--fm-fg-muted);
  font: 850 11px/1 var(--fm-font-mono);
  text-align: center;
}

.language-option + .language-option { border-left: 1px solid var(--fm-border); }
.language-option.active { background: var(--fm-sapphire-500); color: var(--fm-paper-0); }

.content-frame {
  width: 100%;
  max-width: 1480px;
  margin: 0 auto;
  padding: var(--fm-s-6);
}

.page-stack {
  display: grid;
  gap: var(--fm-s-6);
}

.page-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: var(--fm-s-4);
  align-items: end;
  padding: var(--fm-s-5);
  border: 1px solid var(--fm-border);
  border-radius: var(--fm-r-lg);
  background: var(--fm-surface);
  box-shadow: var(--fm-elev-1);
}

.page-header h2 {
  margin: 0;
  font-size: var(--fm-text-display);
  line-height: 1.05;
  letter-spacing: 0;
}

.page-description {
  margin: var(--fm-s-2) 0 0;
  max-width: 760px;
  color: var(--fm-fg-muted);
}

.page-meta,
.section-description,
.table-meta,
.muted,
.subtle {
  color: var(--fm-fg-subtle);
}

.page-actions,
.section-actions {
  display: flex;
  gap: var(--fm-s-2);
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.section {
  display: grid;
  gap: var(--fm-s-4);
}

.section > .section-header {
  padding: var(--fm-s-4);
  border: 1px solid var(--fm-border);
  border-left: 5px solid var(--fm-sapphire-500);
  border-radius: var(--fm-r-lg);
  background: var(--fm-surface);
}

.section-title,
.section-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: var(--fm-s-4);
  margin: 0;
}

.section-title { font-size: 18px; font-weight: 800; }

.section-heading {
  margin: 0;
  font-size: var(--fm-text-h1);
  line-height: 1.2;
}

.hero,
.panel,
.bucket-card,
.table-shell,
.filter-bar,
.empty-state,
.error-state {
  background: var(--fm-surface);
  border: 1px solid var(--fm-border);
  border-radius: var(--fm-r-lg);
  box-shadow: var(--fm-elev-1);
}

.hero {
  padding: var(--fm-s-8);
}

.hero h2 {
  font-size: var(--fm-text-display);
  font-weight: 800;
  letter-spacing: 0;
  margin: 0;
  line-height: 1.05;
}

.hero p {
  font-size: 16px;
  color: var(--fm-fg-muted);
  margin: var(--fm-s-3) 0 0;
  max-width: 720px;
}

.funnel-grid,
.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--fm-s-4);
}

.bucket-card,
.metric-card {
  padding: var(--fm-s-5);
  position: relative;
  overflow: hidden;
  border-top-width: 0;
}

.metric-card-compact {
  padding: var(--fm-s-4);
}

.metric-card-compact .bucket-value {
  font-size: 24px;
  line-height: 1.15;
  max-width: 100%;
}

.operator-summary-grid {
  gap: var(--fm-s-3);
}

.request-hero-compact {
  align-items: stretch;
}

.truncate {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.break-anywhere {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.bucket-card::before,
.metric-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  background: var(--fm-info);
}

.bucket-amber::before,
.metric-warning::before { background: var(--fm-hold); }
.bucket-green::before,
.metric-success::before { background: var(--fm-go); }
.bucket-rose::before,
.metric-danger::before { background: var(--fm-abort); }
.bucket-blue::before,
.metric-info::before { background: var(--fm-sapphire-500); }
.bucket-violet::before { background: var(--fm-flux); }

.metric-info,
.metric-success,
.metric-warning,
.metric-danger,
.bucket-violet {
  background: var(--fm-surface);
}

.file-list {
  display: grid;
  gap: var(--fm-s-2);
  margin: var(--fm-s-4) 0;
}

.file-list .code {
  display: block;
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--fm-border);
  border-radius: var(--fm-r-sm);
}

.bucket-card h3 {
  font-size: var(--fm-text-meta);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--fm-fg-subtle);
  margin: 0 0 var(--fm-s-3);
}

.bucket-value {
  font-size: 34px;
  font-weight: 800;
  color: var(--fm-fg-strong);
  line-height: 1;
}

.bucket-status {
  font-size: 13px;
  font-weight: 700;
  color: var(--fm-fg-muted);
  margin-top: var(--fm-s-2);
}

.button,
.btn {
  min-height: 34px;
  padding: var(--fm-s-2) var(--fm-s-3);
  border-radius: var(--fm-r-md);
  border: 1px solid var(--fm-border-strong);
  background: var(--fm-surface);
  color: var(--fm-fg-strong);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--fm-s-2);
  font-weight: 800;
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  transition: background var(--fm-dur-1) var(--fm-ease), border-color var(--fm-dur-1) var(--fm-ease), transform var(--fm-dur-1) var(--fm-ease);
}

.button:hover,
.btn:hover {
  background: var(--fm-surface-inset);
  color: var(--fm-fg-strong);
}

.button:active,
.btn:active { transform: translateY(1px); }
.button[disabled],
.btn[disabled],
.button-disabled,
.is-disabled {
  opacity: 0.55;
  pointer-events: none;
  cursor: not-allowed;
}

.button-primary,
.btn-primary {
  background: var(--fm-sapphire-500);
  border-color: var(--fm-sapphire-500);
  color: var(--fm-paper-0);
}

.button-primary:hover,
.btn-primary:hover {
  background: var(--fm-fg-muted);
  color: var(--fm-paper-0);
}

.button-danger,
.btn-danger {
  border-color: var(--fm-abort);
  background: var(--fm-abort-soft);
  color: var(--fm-abort);
}

.button-ghost,
.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--fm-fg-muted);
}

.is-loading,
.is-processing {
  position: relative;
  color: transparent !important;
  pointer-events: none;
}

.is-loading::after,
.is-processing::after {
  content: "";
  width: 14px;
  height: 14px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  color: var(--fm-fg-muted);
  position: absolute;
  animation: spin 800ms linear infinite;
}

.is-processing {
  cursor: progress;
}

.loading-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  display: inline-block;
  animation: pulse 1s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 0.35; transform: scale(0.9); }
  50% { opacity: 1; transform: scale(1); }
}

@keyframes spin { to { transform: rotate(360deg); } }

.badge,
.status-badge {
  min-height: 22px;
  padding: 3px var(--fm-s-2);
  border-radius: 999px;
  font: 800 11px/1 var(--fm-font-mono);
  text-transform: uppercase;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid transparent;
  white-space: nowrap;
}

.badge-muted,
.badge-neutral,
.badge-unknown,
.badge-debug,
.tone-neutral {
  background: var(--fm-paper-200);
  color: var(--fm-fg-muted);
  border-color: var(--fm-border);
}

.badge-info,
.badge-running,
.badge-queued,
.tone-info {
  background: var(--fm-info-soft);
  color: var(--fm-sapphire-600);
  border-color: var(--fm-info-line);
}

.badge-success,
.badge-done,
.badge-passed,
.badge-merged,
.tone-go {
  background: var(--fm-go-soft);
  color: var(--fm-go);
  border-color: var(--fm-go-line);
}

.badge-warning,
.badge-pending,
.badge-stale,
.badge-review,
.badge-release,
.badge-awaiting_human,
.tone-hold {
  background: var(--fm-hold-soft);
  color: var(--fm-hold);
  border-color: var(--fm-hold-line);
}

.badge-danger,
.badge-failed,
.badge-failure,
.badge-error,
.badge-blocked,
.badge-denied,
.tone-abort {
  background: var(--fm-abort-soft);
  color: var(--fm-abort);
  border-color: var(--fm-abort-line);
}

.badge-running,
.badge-processing,
.badge-in_progress,
.tone-flux {
  background: var(--fm-flux-soft);
  color: var(--fm-flux);
  border-color: var(--fm-flux-line);
}

.tone-high {
  background: var(--fm-hold-soft);
  color: var(--fm-risk-high);
  border-color: var(--fm-hold-line);
}

.tone-crit {
  background: var(--fm-abort-soft);
  color: var(--fm-risk-crit);
  border-color: var(--fm-abort-line);
}

.badge-large { min-height: 28px; padding-inline: var(--fm-s-3); }

.status-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  background: var(--fm-fg-subtle);
}

.status-indicator.online {
  background: var(--fm-go);
  box-shadow: 0 0 0 3px rgb(21 128 61 / 0.12);
}

.status-indicator.offline {
  background: var(--fm-abort);
  box-shadow: 0 0 0 3px rgb(185 28 28 / 0.1);
}

.filter-bar {
  padding: var(--fm-s-4);
  display: grid;
  gap: var(--fm-s-3);
  background: var(--fm-surface);
}

.filter-grid {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) repeat(3, minmax(140px, 180px)) auto auto;
  gap: var(--fm-s-3);
  align-items: end;
}

.log-filter-grid {
  grid-template-columns: minmax(240px, 1.4fr) repeat(4, minmax(132px, 160px));
}

.filter-actions {
  display: flex;
  gap: var(--fm-s-2);
  align-items: end;
  flex-wrap: wrap;
}

.field {
  display: grid;
  gap: var(--fm-s-1);
}

.field label {
  font: 800 10px/1 var(--fm-font-mono);
  color: var(--fm-fg-subtle);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.input,
.select,
input,
select {
  min-height: 36px;
  padding: var(--fm-s-2) var(--fm-s-3);
  border: 1px solid var(--fm-border);
  border-radius: var(--fm-r-md);
  background: var(--fm-surface);
  color: var(--fm-fg-strong);
}

input::placeholder { color: var(--fm-fg-subtle); }

.filter-chips {
  display: flex;
  gap: var(--fm-s-2);
  flex-wrap: wrap;
}

.filter-chip {
  border: 1px solid var(--fm-border);
  border-radius: 999px;
  padding: var(--fm-s-1) var(--fm-s-3);
  color: var(--fm-fg-muted);
  background: var(--fm-surface);
  font-weight: 800;
  font-size: 12px;
}

.filter-chip.active {
  background: var(--fm-sapphire-500);
  color: var(--fm-paper-0);
  border-color: var(--fm-sapphire-500);
}

.table-shell {
  overflow: hidden;
  border-top: 2px solid var(--fm-sapphire-500);
}

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

.command-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 920px;
}

.command-table th {
  background: var(--fm-paper-100);
  padding: var(--fm-s-3);
  text-align: left;
  font: 800 10px/1 var(--fm-font-mono);
  text-transform: uppercase;
  color: var(--fm-fg-subtle);
  letter-spacing: 0.08em;
  border-bottom: 1px solid var(--fm-border);
}

.command-table td {
  padding: var(--fm-s-3);
  border-top: 1px solid var(--fm-border);
  vertical-align: middle;
}

.command-table tbody tr {
  transition: background var(--fm-dur-1) var(--fm-ease);
}

.command-table tbody tr:hover {
  background: rgb(239 246 255 / 0.78);
}

.table-title {
  font-weight: 800;
  color: var(--fm-fg-strong);
  line-height: 1.25;
}

.table-meta {
  margin-top: var(--fm-s-1);
  display: flex;
  gap: var(--fm-s-2);
  align-items: center;
  flex-wrap: wrap;
  font-size: var(--fm-text-meta);
}

.id-chip,
.copy-id {
  font: 800 var(--fm-text-mono)/1 var(--fm-font-mono);
  color: var(--fm-fg-strong);
  background: var(--fm-surface-inset);
  border: 1px solid var(--fm-border);
  border-radius: var(--fm-r-sm);
  padding: 5px 7px;
  display: inline-flex;
  max-width: 128px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.code,
.log-time {
  font-family: var(--fm-font-mono);
}

.logs-table {
  min-width: 1120px;
}

.pipelines-table,
.agents-table {
  min-width: 1180px;
}

.logs-table th,
.logs-table td {
  padding-block: var(--fm-s-2);
}

.log-row-error {
  box-shadow: inset 3px 0 0 var(--fm-abort);
}

.log-row-warning {
  box-shadow: inset 3px 0 0 var(--fm-hold);
}

.log-time {
  color: var(--fm-fg-subtle);
  font-size: var(--fm-text-meta);
  font-weight: 750;
}

.log-message-cell {
  min-width: 320px;
  max-width: 560px;
}

.log-message {
  margin-top: var(--fm-s-1);
  color: var(--fm-fg-muted);
  font-size: 13px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.pipeline-signal-list,
.action-stack {
  display: flex;
  gap: var(--fm-s-2);
  flex-wrap: wrap;
  align-items: center;
}

.action-stack {
  min-width: 132px;
}

.operator-card-head,
.operator-actions {
  display: flex;
  gap: var(--fm-s-3);
}

.operator-card-head {
  justify-content: space-between;
  align-items: start;
  margin-bottom: var(--fm-s-4);
}

.operator-actions {
  margin-top: var(--fm-s-6);
  flex-wrap: wrap;
}

.action-form.is-processing {
  cursor: progress;
}

.action-feedback {
  margin-top: var(--fm-s-4);
  padding: var(--fm-s-3);
  border: 1px solid var(--fm-border);
  border-left: 4px solid var(--fm-info);
  border-radius: var(--fm-r-md);
  background: var(--fm-surface-raised);
  color: var(--fm-fg-strong);
}

.action-feedback-title {
  font-weight: 800;
}

.action-feedback-detail {
  margin-top: var(--fm-s-1);
  color: var(--fm-fg-muted);
  font-size: var(--fm-text-meta);
}

.action-feedback-success { border-left-color: var(--fm-go); }
.action-feedback-warning { border-left-color: var(--fm-hold); }
.action-feedback-danger,
.action-feedback-error { border-left-color: var(--fm-abort); }

.nowrap { white-space: nowrap; }
.small { font-size: var(--fm-text-meta); }

.empty-state,
.error-state {
  padding: var(--fm-s-8);
  text-align: center;
  border-style: dashed;
  background: var(--fm-surface);
}

.state-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--fm-r-lg);
  margin: 0 auto var(--fm-s-3);
  display: grid;
  place-items: center;
  background: var(--fm-surface);
  color: var(--fm-paper-0);
  font-family: var(--fm-font-mono);
  font-weight: 800;
}

.state-title {
  font-size: 18px;
  font-weight: 800;
}

.state-description {
  color: var(--fm-fg-muted);
  max-width: 520px;
  margin: var(--fm-s-2) auto 0;
}

.state-action {
  margin-top: var(--fm-s-4);
}

.skeleton {
  border-radius: var(--fm-r-sm);
  background: var(--fm-surface);
  background-size: 200% 100%;
  animation: skeleton 1.2s ease-in-out infinite;
}

.skeleton-line {
  display: block;
  height: 12px;
  width: 100%;
}

.skeleton-line:nth-child(3n) { width: 72%; }
.skeleton-line:nth-child(4n) { width: 48%; }

.skeleton-card {
  display: grid;
  gap: var(--fm-s-3);
  padding: var(--fm-s-4);
  border: 1px solid var(--fm-border);
  border-radius: var(--fm-r-md);
  background: var(--fm-surface);
}

@keyframes skeleton { to { background-position-x: -200%; } }

.toast-region,
.toast-stack {
  position: fixed;
  right: var(--fm-s-4);
  bottom: var(--fm-s-4);
  z-index: var(--z-toast);
  display: grid;
  gap: var(--fm-s-2);
  width: min(360px, calc(100vw - 32px));
  pointer-events: none;
}

.toast-stack {
  position: static;
  width: auto;
  margin-bottom: var(--fm-s-4);
}

.toast {
  pointer-events: auto;
  background: var(--fm-surface);
  border: 1px solid var(--fm-border);
  border-left: 4px solid var(--fm-info);
  border-radius: var(--fm-r-md);
  box-shadow: var(--fm-elev-2);
  padding: var(--fm-s-3);
  color: var(--fm-fg-strong);
}

.toast-title {
  font-weight: 800;
}

.toast-detail {
  margin-top: var(--fm-s-1);
  color: var(--fm-fg-muted);
  font-size: var(--fm-text-meta);
}

.toast-success { border-left-color: var(--fm-go); }
.toast-warning { border-left-color: var(--fm-hold); }
.toast-danger,
.toast-error { border-left-color: var(--fm-abort); }
.toast-info { border-left-color: var(--fm-info); }

.attention-title {
  font-size: 18px;
  color: var(--fm-fg-strong);
  text-transform: none;
  letter-spacing: 0;
  margin: 0 0 var(--fm-s-2);
}

.attention-meta-block {
  margin-bottom: var(--fm-s-4);
}

.attention-copy {
  font-size: 13px;
  margin-bottom: var(--fm-s-6);
}

.attention-action .button {
  width: 100%;
}

.app-footer {
  margin-top: var(--fm-s-12);
  padding: var(--fm-s-6) 0;
  border-top: 1px solid var(--fm-border);
  display: flex;
  justify-content: space-between;
  gap: var(--fm-s-4);
  color: var(--fm-fg-subtle);
  font-size: var(--fm-text-meta);
}

.footer-links {
  display: flex;
  gap: var(--fm-s-4);
  flex-wrap: wrap;
}

.sitrep-page {
  align-items: stretch;
}

.sitrep-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(360px, 0.85fr);
  gap: var(--fm-s-6);
  align-items: start;
}

.sitrep-main,
.sitrep-side {
  display: grid;
  gap: var(--fm-s-6);
  min-width: 0;
}

.status-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--fm-s-4);
}

.signal-card,
.signal-row,
.activity-row,
.route-card {
  background: var(--fm-surface);
  border: 1px solid var(--fm-border);
  border-radius: var(--fm-r-lg);
  box-shadow: var(--fm-elev-1);
}

.signal-card {
  min-height: 172px;
  padding: var(--fm-s-5);
  display: flex;
  flex-direction: column;
  gap: var(--fm-s-3);
  border-top: 4px solid var(--fm-sapphire-500);
  background: var(--fm-surface);
}

.signal-card-primary {
  border-color: rgb(124 58 237 / 0.24);
  border-top-color: var(--fm-flux);
  background: var(--fm-surface);
}

.status-grid .signal-card:nth-child(2) {
  border-top-color: var(--fm-go);
  background: var(--fm-surface);
}

.status-grid .signal-card:nth-child(3) {
  border-top-color: var(--fm-hold);
  background: var(--fm-surface);
}

.status-grid .signal-card:nth-child(4) {
  border-top-color: var(--fm-abort);
  background: var(--fm-surface);
}

.signal-card-top,
.activity-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--fm-s-3);
}

.signal-label {
  font: 800 10px/1 var(--fm-font-mono);
  color: var(--fm-fg-subtle);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.signal-value {
  font-size: 26px;
  font-weight: 850;
  line-height: 1.05;
  color: var(--fm-fg-strong);
}

.signal-note,
.activity-message {
  color: var(--fm-fg-muted);
  font-size: var(--fm-text-meta);
}

.signal-link {
  margin-top: auto;
  font-size: var(--fm-text-meta);
  font-weight: 800;
}

.signal-list,
.activity-list {
  display: grid;
  gap: var(--fm-s-3);
}

.signal-row {
  padding: var(--fm-s-4);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: var(--fm-s-4);
  align-items: center;
  border-left: 4px solid var(--fm-hold);
  background: var(--fm-surface);
}

.signal-main {
  display: grid;
  gap: var(--fm-s-2);
  min-width: 0;
}

.signal-row-title {
  display: flex;
  align-items: center;
  gap: var(--fm-s-2);
  min-width: 0;
}

.signal-row-title a {
  color: var(--fm-fg-strong);
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.signal-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--fm-s-2);
  color: var(--fm-fg-subtle);
  font-size: var(--fm-text-meta);
}

.signal-meta span {
  max-width: 320px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.signal-action {
  display: grid;
  justify-items: end;
  gap: var(--fm-s-2);
}

.activity-row {
  padding: var(--fm-s-4);
  display: grid;
  gap: var(--fm-s-2);
  border-left: 4px solid var(--fm-flux);
  background: var(--fm-surface);
}

.activity-time {
  color: var(--fm-fg-subtle);
  font: 700 var(--fm-text-meta)/1 var(--fm-font-mono);
}

.activity-title {
  font-weight: 850;
  color: var(--fm-fg-strong);
}

.resolution-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--fm-s-4);
}

.resolution-card {
  display: grid;
  gap: var(--fm-s-3);
}

.resolution-form {
  display: grid;
  gap: var(--fm-s-3);
}

.resolution-note {
  min-height: 88px;
  resize: vertical;
}

.route-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--fm-s-3);
}

.route-card {
  padding: var(--fm-s-4);
  display: grid;
  gap: var(--fm-s-2);
  color: var(--fm-fg-strong);
  border-top: 4px solid var(--fm-sapphire-500);
  background: var(--fm-surface);
}

.route-grid .route-card:nth-child(2n) {
  border-top-color: var(--fm-go);
  background: var(--fm-surface);
}

.route-grid .route-card:nth-child(3n) {
  border-top-color: var(--fm-hold);
  background: var(--fm-surface);
}

.route-grid .route-card:nth-child(4n) {
  border-top-color: var(--fm-flux);
  background: var(--fm-surface);
}

.route-card:hover {
  border-color: var(--fm-border-strong);
  background: var(--fm-surface-raised);
}

.route-card span,
.route-card small {
  color: var(--fm-fg-subtle);
  font-size: var(--fm-text-meta);
}

.route-card span {
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-family: var(--fm-font-mono);
}

.route-card strong {
  font-size: 22px;
  line-height: 1;
  overflow-wrap: anywhere;
}

.board-page .page-header {
  padding: var(--fm-s-5);
  border: 1px solid var(--fm-border);
  border-radius: var(--fm-r-lg);
  background: var(--fm-surface);
}

.board-columns {
  display: grid;
  grid-template-columns: repeat(5, minmax(220px, 1fr));
  gap: var(--fm-s-4);
  align-items: start;
  overflow-x: auto;
  padding-bottom: var(--fm-s-2);
}

.board-column {
  min-width: 220px;
  background: var(--fm-paper-50);
  border: 1px solid var(--fm-border);
  border-radius: var(--fm-r-lg);
  padding: var(--fm-s-3);
  display: grid;
  gap: var(--fm-s-3);
  box-shadow: 0 12px 28px rgb(15 23 42 / 0.06);
  border-top: 5px solid var(--fm-info);
}

.board-column-needs_decision { background: var(--fm-hold-soft); border-top-color: var(--fm-hold); }
.board-column-planning { background: var(--fm-info-soft); border-top-color: var(--fm-sapphire-500); }
.board-column-execution { background: var(--fm-go-soft); border-top-color: var(--fm-go); }
.board-column-review { background: var(--fm-flux-soft); border-top-color: var(--fm-flux); }
.board-column-other { background: var(--fm-paper-50); border-top-color: var(--fm-fg-subtle); }

.board-column-needs_decision .board-column-dot { background: var(--fm-hold); }
.board-column-planning .board-column-dot { background: var(--fm-sapphire-500); }
.board-column-execution .board-column-dot { background: var(--fm-go); }
.board-column-review .board-column-dot { background: var(--fm-flux); }
.board-column-other .board-column-dot { background: var(--fm-fg-subtle); }
}

.board-column-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--fm-s-3);
}

.board-column-head h3 {
  margin: 0;
  font-size: 14px;
  line-height: 1.2;
  display: inline-flex;
  align-items: center;
  gap: var(--fm-s-2);
}

.board-column-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  display: inline-block;
}

.board-card-stack,
.history-list {
  display: grid;
  gap: var(--fm-s-3);
}

.history-list {
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
}

.board-card {
  background: var(--fm-surface);
  border: 1px solid var(--fm-border);
  border-radius: var(--fm-r-md);
  box-shadow: var(--fm-elev-1);
  padding: var(--fm-s-3);
  display: grid;
  gap: var(--fm-s-3);
  min-width: 0;
  border-left: 4px solid var(--fm-border-strong);
}

.board-column-needs_decision .board-card { border-left-color: var(--fm-hold); }
.board-column-planning .board-card { border-left-color: var(--fm-sapphire-500); }
.board-column-execution .board-card { border-left-color: var(--fm-go); }
.board-column-review .board-card { border-left-color: var(--fm-flux); }
.board-column-other .board-card { border-left-color: var(--fm-fg-subtle); }

.board-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 26px rgb(15 23 42 / 0.1);
  border-color: var(--fm-border-strong);
}

.board-card-head,
.board-card-footer,
.board-card-meta,
.board-card-line {
  display: flex;
  gap: var(--fm-s-2);
  align-items: center;
  min-width: 0;
}

.board-card-head,
.board-card-footer {
  justify-content: flex-start;
  flex-wrap: wrap;
}

.board-card-footer { justify-content: space-between; }

.board-card-phase {
  min-height: 20px;
  padding: 3px 7px;
  border-radius: 999px;
  background: var(--fm-surface-inset);
  color: var(--fm-fg-muted);
  font: 850 10px/1 var(--fm-font-mono);
  text-transform: uppercase;
}

.board-card-title {
  color: var(--fm-fg-strong);
  font-weight: 850;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.board-card-meta {
  color: var(--fm-fg-subtle);
  font-size: var(--fm-text-meta);
  flex-wrap: wrap;
}

.board-card-line {
  justify-content: space-between;
  align-items: start;
  border-top: 1px solid var(--fm-border);
  padding-top: var(--fm-s-2);
  font-size: var(--fm-text-meta);
}

.board-card-line span {
  color: var(--fm-fg-subtle);
  font-weight: 750;
}

.board-card-line strong {
  text-align: right;
  color: var(--fm-fg-muted);
  overflow-wrap: anywhere;
}

.board-empty {
  min-height: 78px;
  display: grid;
  place-items: center;
  text-align: center;
  color: var(--fm-fg-subtle);
  border: 1px dashed var(--fm-border-strong);
  border-radius: var(--fm-r-md);
  padding: var(--fm-s-3);
  background: var(--fm-surface);
}

.code-window {
  background: var(--fm-fg-strong);
  border-radius: var(--fm-r-lg);
  overflow: hidden;
  border: 1px solid var(--fm-border-strong);
}

.code-header {
  background: var(--fm-ink-800);
  padding: var(--fm-s-2) var(--fm-s-4);
  display: flex;
  justify-content: space-between;
  color: var(--fm-paper-300);
  font-size: 11px;
  font-family: var(--fm-font-mono);
}

.code-content {
  padding: var(--fm-s-4);
  color: var(--fm-paper-50);
  font-family: var(--fm-font-mono);
  font-size: var(--fm-text-mono);
  line-height: 1.6;
  margin: 0;
  overflow-x: auto;
}

pre code { background: none; padding: 0; border: none; font-size: inherit; color: inherit; }

@media (max-width: 1180px) {
  .app-shell { grid-template-columns: 1fr; }
  .sitrep-grid,
  .status-grid { grid-template-columns: 1fr; }
  .nav-dock {
    position: sticky;
    top: 0;
    height: auto;
    flex-direction: row;
    align-items: center;
    overflow-y: hidden;
    overflow-x: auto;
    border-right: 0;
    border-bottom: 1px solid var(--fm-border);
  }
  .nav-brand { border-bottom: 0; margin-bottom: 0; padding: var(--fm-s-2); }
  .nav-section-label,
  .nav-spacer { display: none; }
  .nav-item { white-space: nowrap; }
}

@media (max-width: 760px) {
  .content-frame,
  .command-topbar { padding-inline: var(--fm-s-4); }
  .command-topbar { height: auto; min-height: 64px; align-items: flex-start; padding-block: var(--fm-s-3); }
  .page-header,
  .section-header { grid-template-columns: 1fr; display: grid; align-items: start; }
  .page-actions,
  .section-actions,
  .topbar-actions { justify-content: flex-start; }
  .summary-grid,
  .funnel-grid,
  .filter-grid,
  .resolution-grid,
  .route-grid,
  .signal-row { grid-template-columns: 1fr; }
  .signal-action { justify-items: start; }
  .app-footer { flex-direction: column; }
}
