@import url("/static/css/ui-responsive.css");

:root {
  color-scheme: dark;

  /* Background layers */
  --bg-primary: #0b0d12;
  --bg-secondary: #11151c;
  --bg-tertiary: #171c25;
  --bg-elevated: #1d2430;
  --bg-glass: #11151c;
  --bg-glass-light: #171c25;

  /* Interactive accent */
  --accent: #6b8cff;
  --accent-hover: #88a2ff;
  --accent-dim: rgba(107, 140, 255, 0.12);
  --accent-glow: rgba(107, 140, 255, 0.2);
  --accent-glow-strong: rgba(107, 140, 255, 0.28);

  /* Text */
  --text-primary: #f2f4f8;
  --text-secondary: #a2aabb;
  --text-muted: #737d91;

  /* Borders */
  --border: #2b3240;
  --border-subtle: #242b37;
  --border-focus: #6b8cff;
  --border-glass: #242b37;

  /* Status */
  --status-ok: #22C55E;
  --status-warn: #F59E0B;
  --status-error: #EF4444;
  --status-info: #3B82F6;

  /* Shared semantic UI tokens */
  --ui-accent: var(--accent);
  --ui-accent-hover: var(--accent-hover);
  --ui-accent-soft: var(--accent-dim);
  --ui-focus: rgba(107, 140, 255, 0.34);
  --ui-success: var(--status-ok);
  --ui-success-soft: rgba(34, 197, 94, 0.08);
  --ui-warning: var(--status-warn);
  --ui-danger: var(--status-error);
  --ui-info: var(--status-info);
  --ui-surface: var(--bg-secondary);
  --ui-surface-raised: var(--bg-tertiary);
  --ui-border: var(--border-subtle);
  --ui-border-strong: var(--border);

  /* Typography */
  --font-body: 'Segoe UI Variable', 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'Cascadia Code', 'Cascadia Mono', Consolas, monospace;
  --font-size-xs: 11px;
  --font-size-sm: 12px;
  --font-size-md: 13px;
  --font-size-base: 14px;
  --font-size-lg: 16px;
  --font-size-xl: 20px;
  --font-size-2xl: 24px;
  --font-weight-regular: 400;
  --font-weight-medium: 500;
  --font-weight-semibold: 600;
  --font-weight-bold: 700;
  --line-height-tight: 1.2;
  --line-height-base: 1.45;
  --line-height-relaxed: 1.65;
  --letter-spacing-base: 0;

  /* Spacing */
  --space-0: 0;
  --space-1: 4px;
  --space-2: 6px;
  --space-3: 8px;
  --space-4: 12px;
  --space-5: 16px;
  --space-6: 20px;
  --space-7: 24px;
  --space-8: 32px;
  --space-9: 40px;
  --space-10: 48px;
  --gap-xs: 6px;
  --gap-sm: 12px;
  --gap-md: 16px;
  --gap-lg: 24px;
  --gap-xl: 48px;

  /* Transitions */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-spring: 500ms cubic-bezier(0.34, 1.56, 0.64, 1);
  --motion-duration-fast: var(--transition-fast);
  --motion-duration-base: var(--transition-base);
  --motion-duration-slow: var(--transition-slow);
  --motion-ease-standard: cubic-bezier(0.4, 0, 0.2, 1);
  --motion-ease-expressive: cubic-bezier(0.34, 1.56, 0.64, 1);

  /* Border radius */
  --border-width: 1px;
  --border-width-strong: 2px;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 8px;
  --radius-xl: 8px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.22);
  --shadow-md: 0 2px 8px rgba(0, 0, 0, 0.24);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.32);
  --shadow-glow: 0 0 20px var(--accent-dim);
  --shadow-glow-strong: 0 0 32px var(--accent-glow);
  --effect-read-only: #94a3b8;
  --effect-read-only-soft: rgba(148, 163, 184, 0.12);
  --effect-local-write: #22c55e;
  --effect-local-write-soft: rgba(34, 197, 94, 0.12);
  --effect-external: #38bdf8;
  --effect-external-soft: rgba(56, 189, 248, 0.12);
  --effect-sensitive: #f59e0b;
  --effect-sensitive-soft: rgba(245, 158, 11, 0.12);
  --effect-destructive: #ef4444;
  --effect-destructive-soft: rgba(239, 68, 68, 0.12);

  /* Layout */
  --sidebar-width: 240px;
  --sidebar-collapsed-width: 64px;
  --shell-page-gutter: 32px;
  --topbar-height: 56px;
  --content-width-narrow: 920px;
  --content-width: 1240px;
  --content-width-wide: 1560px;
  --content-width-graph: 1800px;
  --breakpoint-xs: 420px;
  --breakpoint-sm: 560px;
  --breakpoint-md: 760px;
  --breakpoint-lg: 980px;
  --breakpoint-xl: 1180px;
  --breakpoint-2xl: 1320px;
  --breakpoint-3xl: 1640px;
  --breakpoint-shell: 768px;
  --breakpoint-shell-desktop: 769px;
  --z-base: 0;
  --z-sticky: 20;
  --z-sidebar: 80;
  --z-overlay: 90;
  --z-drawer: 100;
  --z-dialog: 120;
  --z-toast: 140;
  --overlay-scrim: rgba(0, 0, 0, 0.64);
  --focus-ring: 0 0 0 3px var(--ui-focus);
  --disabled-opacity: 0.46;
  --disabled-cursor: not-allowed;
  --component-control-height-sm: 32px;
  --component-control-height-md: 38px;
  --component-control-height-lg: 44px;
  --component-card-radius: var(--radius-md);
  --component-card-padding: var(--space-5);
  --component-table-row-height: 38px;
  --component-dialog-width: 520px;
  --component-toast-width: 360px;
}

/* HLN-A minimal shared visual primitives. */
.ui-surface {
  color: var(--text-primary);
  background: var(--ui-surface);
  border: var(--border-width) solid var(--ui-border);
}

.ui-button,
.ui-button-primary,
.ui-button-secondary,
.ui-button-tertiary,
.ui-button-danger,
.ui-icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: var(--component-control-height-md);
  padding: 0 var(--space-4);
  border: var(--border-width) solid transparent;
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-semibold);
  line-height: var(--line-height-tight);
  letter-spacing: var(--letter-spacing-base);
  color: var(--text-primary);
  text-decoration: none;
  cursor: pointer;
  transition: background var(--motion-duration-fast), border-color var(--motion-duration-fast), color var(--motion-duration-fast), box-shadow var(--motion-duration-fast), transform var(--motion-duration-fast);
}

.ui-button-primary,
.ui-button[data-variant="primary"] {
  background: var(--ui-accent);
  border-color: var(--ui-accent);
  color: #fff;
}

.ui-button-secondary,
.ui-button[data-variant="secondary"] {
  background: var(--bg-tertiary);
  border-color: var(--border);
  color: var(--text-primary);
}

.ui-button-tertiary,
.ui-button[data-variant="tertiary"] {
  background: transparent;
  border-color: transparent;
  color: var(--text-secondary);
}

.ui-button-danger,
.ui-button[data-variant="danger"],
.ui-danger-action {
  background: var(--effect-destructive-soft);
  border-color: rgba(239, 68, 68, 0.42);
  color: #fecaca;
}

.ui-icon-button {
  width: var(--component-control-height-md);
  min-width: var(--component-control-height-md);
  padding: 0;
}

.ui-button:hover,
.ui-icon-button:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.ui-button:focus-visible,
.ui-icon-button:focus-visible,
.ui-field input:focus-visible,
.ui-field textarea:focus-visible,
.ui-field select:focus-visible,
.ui-dialog button:focus-visible,
.ui-dialog input:focus-visible,
.ui-dialog textarea:focus-visible,
.ui-dialog select:focus-visible {
  outline: 2px solid var(--border-focus);
  outline-offset: 2px;
  box-shadow: var(--focus-ring);
}

.ui-button[disabled],
.ui-button[aria-disabled="true"],
.ui-icon-button[disabled],
.ui-icon-button[aria-disabled="true"],
.ui-is-disabled {
  opacity: var(--disabled-opacity);
  cursor: var(--disabled-cursor);
  pointer-events: none;
  transform: none;
  box-shadow: none;
}

.ui-button[aria-busy="true"],
.ui-is-loading {
  cursor: wait;
}

.ui-badge,
.ui-status-badge,
.ui-effect-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-height: 24px;
  padding: 3px var(--space-3);
  border-radius: var(--radius-full);
  border: var(--border-width) solid var(--ui-border);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  line-height: var(--line-height-tight);
}

.ui-badge::before,
.ui-status-badge::before,
.ui-effect-badge::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: var(--radius-full);
  background: currentColor;
}

.ui-status-ok,
.ui-badge[data-tone="ok"] {
  background: var(--ui-success-soft);
  color: var(--ui-success);
}

.ui-status-warn,
.ui-badge[data-tone="warn"] {
  background: rgba(245, 158, 11, 0.12);
  color: var(--ui-warning);
}

.ui-status-error,
.ui-badge[data-tone="error"] {
  background: rgba(239, 68, 68, 0.12);
  color: var(--ui-danger);
}

.ui-status-info,
.ui-status-loading,
.ui-badge[data-tone="info"],
.ui-badge[data-tone="loading"] {
  background: rgba(59, 130, 246, 0.12);
  color: var(--ui-info);
}

.ui-effect-read-only {
  background: var(--effect-read-only-soft);
  color: var(--effect-read-only);
}

.ui-effect-local-write {
  background: var(--effect-local-write-soft);
  color: var(--effect-local-write);
}

.ui-effect-external {
  background: var(--effect-external-soft);
  color: var(--effect-external);
}

.ui-effect-sensitive {
  background: var(--effect-sensitive-soft);
  color: var(--effect-sensitive);
}

.ui-effect-destructive {
  background: var(--effect-destructive-soft);
  color: var(--effect-destructive);
}

.ui-card,
.ui-panel {
  border: var(--border-width) solid var(--ui-border);
  border-radius: var(--component-card-radius);
  background: var(--ui-surface);
  box-shadow: var(--shadow-sm);
}

.ui-card {
  padding: var(--component-card-padding);
}

.ui-card[data-interactive="true"] {
  transition: border-color var(--motion-duration-fast), box-shadow var(--motion-duration-fast), transform var(--motion-duration-fast);
}

.ui-card[data-interactive="true"]:hover {
  border-color: var(--ui-border-strong);
  box-shadow: var(--shadow-md);
}

.ui-panel-header,
.ui-panel-body,
.ui-panel-footer {
  padding: var(--component-card-padding);
}

.ui-panel-header,
.ui-panel-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
}

.ui-panel-header {
  border-bottom: var(--border-width) solid var(--ui-border);
}

.ui-panel-footer {
  border-top: var(--border-width) solid var(--ui-border);
}

.ui-field,
.ui-field-group {
  display: grid;
  gap: var(--space-2);
}

.ui-field label,
.ui-field-label {
  color: var(--text-primary);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
}

.ui-field-description,
.ui-field-help,
.ui-field-error {
  margin: 0;
  font-size: var(--font-size-sm);
  line-height: var(--line-height-base);
}

.ui-field-description,
.ui-field-help {
  color: var(--text-secondary);
}

.ui-field-error,
.ui-validation-error {
  color: #fecaca;
}

.ui-field input,
.ui-field textarea,
.ui-field select,
.ui-input,
.ui-textarea,
.ui-select {
  min-height: var(--component-control-height-md);
  width: 100%;
  padding: 0 var(--space-4);
  border: var(--border-width) solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-primary);
  color: var(--text-primary);
  font: inherit;
}

.ui-field textarea,
.ui-textarea {
  min-height: 96px;
  padding-top: var(--space-3);
  padding-bottom: var(--space-3);
  resize: vertical;
}

.ui-field input[aria-invalid="true"],
.ui-field textarea[aria-invalid="true"],
.ui-field select[aria-invalid="true"],
.ui-input[aria-invalid="true"],
.ui-textarea[aria-invalid="true"],
.ui-select[aria-invalid="true"] {
  border-color: var(--ui-danger);
  box-shadow: 0 0 0 1px rgba(239, 68, 68, 0.32);
}

.ui-table-wrap {
  width: 100%;
  overflow-x: auto;
  border: var(--border-width) solid var(--ui-border);
  border-radius: var(--radius-md);
}

.ui-table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
  font-size: var(--font-size-md);
}

.ui-table th,
.ui-table td {
  min-height: var(--component-table-row-height);
  padding: var(--space-3) var(--space-4);
  border-bottom: var(--border-width) solid var(--ui-border);
  text-align: left;
  vertical-align: top;
}

.ui-table th {
  color: var(--text-secondary);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-bold);
  text-transform: uppercase;
}

.ui-table tr:last-child td {
  border-bottom: 0;
}

.ui-dialog-backdrop,
.ui-drawer-backdrop,
.ui-popover-backdrop {
  position: fixed;
  inset: 0;
  z-index: var(--z-overlay);
  background: var(--overlay-scrim);
}

.ui-dialog-backdrop {
  z-index: var(--z-dialog);
  display: grid;
  place-items: center;
  padding: var(--space-5);
}

.ui-dialog {
  width: min(var(--component-dialog-width), calc(100vw - 32px));
  max-height: min(720px, calc(100vh - 32px));
  overflow: auto;
  border: var(--border-width) solid var(--ui-border-strong);
  border-radius: var(--radius-md);
  background: var(--bg-secondary);
  box-shadow: var(--shadow-lg);
  color: var(--text-primary);
}

.ui-dialog[aria-modal="true"] {
  z-index: var(--z-dialog);
}

.ui-dialog-header,
.ui-dialog-body,
.ui-dialog-footer {
  padding: var(--space-5);
}

.ui-dialog-footer {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-3);
  border-top: var(--border-width) solid var(--ui-border);
}

.ui-toast-region {
  position: fixed;
  right: var(--space-5);
  bottom: var(--space-5);
  z-index: var(--z-toast);
  display: grid;
  gap: var(--space-3);
  width: min(var(--component-toast-width), calc(100vw - 32px));
}

.ui-toast {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: var(--space-3);
  align-items: start;
  padding: var(--space-4);
  border: var(--border-width) solid var(--ui-border);
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  box-shadow: var(--shadow-lg);
  color: var(--text-primary);
}

.ui-loading,
.ui-empty,
.ui-error,
.ui-degraded {
  display: grid;
  gap: var(--space-3);
  align-content: start;
  padding: var(--space-5);
  border: var(--border-width) solid var(--ui-border);
  border-radius: var(--radius-md);
  background: var(--bg-secondary);
}

.ui-loading[aria-busy="true"]::before {
  content: "";
  width: 18px;
  height: 18px;
  border: 2px solid var(--ui-border-strong);
  border-top-color: var(--ui-info);
  border-radius: var(--radius-full);
  animation: ui-spin 800ms linear infinite;
}

.ui-empty {
  border-style: dashed;
  color: var(--text-secondary);
}

.ui-error {
  border-color: rgba(239, 68, 68, 0.34);
}

.ui-degraded {
  border-color: rgba(245, 158, 11, 0.34);
}

.ui-state {
  display: grid;
  gap: var(--space-3);
  align-content: start;
  padding: var(--space-4);
  border: var(--border-width) solid var(--ui-border);
  border-radius: var(--radius-md);
  background: var(--bg-secondary);
  color: var(--text-secondary);
}

.ui-state > strong {
  color: var(--text-primary);
}

.ui-state-error {
  border-color: rgba(239, 68, 68, 0.34);
}

.ui-state-warning,
.ui-state-warn {
  border-color: rgba(245, 158, 11, 0.34);
}

.ui-state-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.ui-skeleton {
  min-height: var(--component-control-height-md);
  border-radius: var(--radius-md);
  background: linear-gradient(90deg, rgba(148, 163, 184, 0.08), rgba(148, 163, 184, 0.16), rgba(148, 163, 184, 0.08));
  background-size: 220% 100%;
  animation: ui-shimmer 1.2s linear infinite;
}

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

@keyframes ui-shimmer {
  to {
    background-position-x: -220%;
  }
}

/* Persistent Conversations */
.conversation-shell {
  width: min(1480px, calc(100% - 40px));
}

.conversation-page-header {
  align-items: flex-start;
  gap: var(--gap-sm);
}

.conversation-page-header h1,
.conversation-page-header p {
  margin: 0;
}

.conversation-page-header p {
  margin-top: 4px;
  color: var(--text-secondary);
  font-size: 13px;
}

.conversation-workspace {
  display: grid;
  grid-template-columns: minmax(260px, 310px) minmax(0, 1fr);
  height: max(650px, calc(100vh - 172px));
  min-height: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-secondary);
}

.conversation-panel {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  min-width: 0;
  border-right: 1px solid var(--border);
  background: var(--bg-primary);
}

.conversation-panel-header,
.conversation-chat-header,
.conversation-runtime-bar,
.conversation-context-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--gap-sm);
}

.conversation-panel-header,
.conversation-chat-header {
  min-height: 70px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-subtle);
}

.conversation-panel-header h2,
.conversation-chat-header h2 {
  margin: 2px 0 0;
  font-size: 17px;
  letter-spacing: 0;
}

.conversation-panel-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.conversation-browser-controls {
  display: grid;
  gap: 10px;
  padding: 12px;
  border-bottom: 1px solid var(--border-subtle);
}

.conversation-search {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-secondary);
  color: var(--text-muted);
}

.conversation-search:focus-within {
  border-color: var(--ui-accent);
  box-shadow: 0 0 0 3px var(--ui-accent-soft);
}

.conversation-search input {
  min-width: 0;
  width: 100%;
  padding: 9px 0;
  border: 0;
  outline: 0;
  background: transparent;
}

.conversation-status-tabs {
  display: grid;
  grid-template-columns: 3fr 1fr;
  padding: 3px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background: var(--bg-secondary);
  transition: grid-template-columns 200ms ease;
}

.conversation-status-tabs[data-status="active"] {
  grid-template-columns: 3fr 1fr;
}

.conversation-status-tabs[data-status="archived"] {
  grid-template-columns: 1fr 3fr;
}

.conversation-status-tabs button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  justify-self: stretch;
  width: 100%;
  min-height: 31px;
  padding: 5px 8px;
  border: 0;
  border-radius: 3px;
  background: transparent;
  box-shadow: none;
  color: var(--text-secondary);
  font-size: 12px;
  text-align: center;
  transition: background 180ms ease, color 180ms ease, box-shadow 180ms ease;
}

.conversation-status-tabs button.active {
  background: color-mix(in srgb, var(--ui-accent-soft) 72%, var(--bg-elevated));
  color: var(--text-primary);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--ui-accent) 36%, transparent), 0 1px 4px rgba(0, 0, 0, 0.2);
}

.conversation-status-tabs button:focus-visible {
  outline: 2px solid var(--ui-focus);
  outline-offset: 2px;
}

.conversation-list-v2 {
  min-height: 0;
  overflow-y: auto;
  padding: 6px;
}

.conversation-list-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 32px;
  align-items: stretch;
  margin-bottom: 3px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
}

.conversation-list-item:hover,
.conversation-list-item.active {
  border-color: var(--border-subtle);
  background: var(--bg-secondary);
}

.conversation-list-item.active {
  box-shadow: inset 2px 0 0 var(--ui-accent);
}

.conversation-list-open {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 10px 9px 10px 11px;
  border: 0;
  background: transparent;
  box-shadow: none;
  color: var(--text-primary);
  text-align: left;
}

.conversation-list-open strong,
.conversation-list-open span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.conversation-list-open strong {
  font-size: 13px;
}

.conversation-list-open span {
  color: var(--text-muted);
  font-size: 11px;
}

.conversation-list-menu,
.conversation-context-add {
  position: relative;
}

.conversation-list-menu summary,
.conversation-context-add summary {
  list-style: none;
  cursor: pointer;
}

.conversation-list-menu summary::-webkit-details-marker,
.conversation-context-add summary::-webkit-details-marker {
  display: none;
}

.conversation-list-menu summary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  min-width: 36px;
  min-height: 36px;
  color: var(--text-muted);
  font-size: 11px;
  line-height: 1;
}

.conversation-list-menu-popover {
  position: absolute;
  z-index: 20;
  top: calc(100% + 4px);
  right: 0;
  display: grid;
  min-width: 180px;
  padding: 5px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  box-shadow: var(--shadow-lg);
}

.conversation-list-menu-popover button {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  padding: 8px 9px;
  border: 0;
  background: transparent;
  box-shadow: none;
  color: var(--text-secondary);
  text-align: left;
}

.conversation-list-menu-popover button:hover {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

.danger-text {
  color: var(--status-error) !important;
}

.conversation-list-empty,
.conversation-timeline-empty {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 6px;
  min-height: 150px;
  padding: 20px;
  color: var(--text-secondary);
  text-align: center;
}

.conversation-list-empty span,
.conversation-timeline-empty span {
  color: var(--text-muted);
  font-size: 12px;
}

.conversation-chat {
  min-width: 0;
  min-height: 0;
  background: var(--bg-secondary);
}

.conversation-active {
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr) auto;
  height: 100%;
  min-height: 0;
}

.conversation-empty-state {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  height: 100%;
  padding: 24px;
  color: var(--text-secondary);
  text-align: center;
}

.conversation-empty-state h2,
.conversation-empty-state p {
  margin: 0;
}

.conversation-empty-state h2 {
  color: var(--text-primary);
  font-size: 18px;
}

.conversation-empty-state p {
  max-width: 420px;
  font-size: 13px;
}

.conversation-title-block {
  min-width: 0;
}

.conversation-title-block h2 {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.conversation-runtime-bar {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-primary);
}

.conversation-runtime-bar label {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: min(420px, 58%);
}

.conversation-runtime-bar label > span {
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 700;
}

.conversation-runtime-bar select {
  min-width: 180px;
}

.conversation-agent-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.conversation-agent-meta span {
  padding: 4px 7px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 11px;
}

.conversation-context {
  padding: 9px 16px;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-primary);
}

.conversation-context-heading > span {
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.conversation-context-add > summary {
  color: var(--ui-accent);
  font-size: 12px;
}

.conversation-context-add form {
  position: absolute;
  z-index: 18;
  top: calc(100% + 8px);
  right: 0;
  display: grid;
  gap: 9px;
  width: min(330px, calc(100vw - 40px));
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  box-shadow: var(--shadow-lg);
}

.conversation-context-add form label {
  display: grid;
  gap: 4px;
  color: var(--text-secondary);
  font-size: 11px;
}

.conversation-context-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 26px;
  margin-top: 7px;
}

.conversation-context-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
  padding: 4px 5px 4px 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-secondary);
  color: var(--text-secondary);
  font-size: 11px;
}

.conversation-context-chip.state-changed {
  border-color: var(--status-warn);
}

.conversation-context-chip.state-missing {
  border-color: var(--status-error);
}

.conversation-context-chip button,
.conversation-attachment button {
  display: grid;
  place-items: center;
  width: 20px;
  min-width: 20px;
  height: 20px;
  min-height: 20px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  box-shadow: none;
  color: var(--text-muted);
}

.conversation-context-empty {
  align-self: center;
  color: var(--text-muted);
  font-size: 11px;
}

.conversation-timeline {
  min-height: 0;
  overflow-y: auto;
  padding: 20px clamp(16px, 4%, 54px);
}

.conversation-message {
  display: grid;
  gap: 7px;
  width: min(760px, 86%);
  margin: 0 0 18px;
}

.conversation-message.user {
  margin-left: auto;
}

.conversation-message-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 3px;
  color: var(--text-secondary);
  font-size: 11px;
}

.conversation-message-header time {
  color: var(--text-muted);
}

.conversation-message-body {
  padding: 11px 13px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.58;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.conversation-message.user .conversation-message-body {
  border-color: var(--ui-accent);
  background: var(--ui-accent-soft);
}

.conversation-message.status-failed .conversation-message-body {
  border-color: var(--status-error);
}

.conversation-message-files,
.conversation-draft-attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.conversation-attachment {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  max-width: 360px;
  padding: 7px 8px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background: var(--bg-primary);
}

.conversation-attachment > span {
  display: grid;
  min-width: 0;
}

.conversation-attachment strong,
.conversation-attachment small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.conversation-attachment strong {
  color: var(--text-primary);
  font-size: 11px;
}

.conversation-attachment small {
  color: var(--text-muted);
  font-size: 10px;
}

.conversation-attachment.capability-unsupported_model,
.conversation-attachment.capability-extractor_unavailable {
  border-color: var(--status-warn);
}

.conversation-tool-call {
  padding: 9px 10px;
  border: 1px solid var(--border-subtle);
  border-left: 3px solid var(--ui-accent);
  border-radius: var(--radius-sm);
  background: var(--bg-primary);
}

.conversation-tool-call.effect-external,
.conversation-tool-call.effect-destructive {
  border-left-color: var(--status-warn);
}

.conversation-tool-call summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  list-style: none;
  cursor: pointer;
  font-size: 12px;
}

.conversation-tool-details {
  display: grid;
  gap: 5px;
  margin-top: 9px;
  color: var(--text-muted);
  font-size: 10px;
}

.conversation-tool-details pre {
  max-height: 180px;
  margin: 0 0 5px;
  overflow: auto;
  padding: 8px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background: var(--bg-secondary);
  color: var(--text-secondary);
  font-size: 10px;
  white-space: pre-wrap;
}

.conversation-tool-actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
  margin-top: 9px;
}

.conversation-tool-actions button {
  min-height: 32px;
  padding: 6px 9px;
  font-size: 11px;
}

.conversation-composer-wrap {
  padding: 10px clamp(12px, 3%, 40px) 12px;
  border-top: 1px solid var(--border);
  background: var(--bg-primary);
}

.conversation-draft-attachments:not(:empty) {
  margin-bottom: 8px;
}

.conversation-composer {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) 38px;
  align-items: end;
  gap: 7px;
  padding: 7px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-secondary);
}

.conversation-composer:focus-within {
  border-color: var(--ui-accent);
  box-shadow: 0 0 0 3px var(--ui-accent-soft);
}

.conversation-composer textarea {
  width: 100%;
  max-height: 160px;
  padding: 8px 4px;
  resize: vertical;
  border: 0;
  outline: 0;
  background: transparent;
  line-height: 1.45;
}

.conversation-composer .btn-icon {
  width: 38px;
  min-width: 38px;
  min-height: 38px;
  padding: 0;
}

.conversation-composer .conversation-send {
  background: var(--ui-accent);
  color: white;
}

.conversation-status {
  min-height: 16px;
  margin: 5px 3px 0;
  color: var(--text-muted);
  font-size: 11px;
}

.conversation-status.error {
  color: var(--status-error);
}

.conversation-dialog {
  width: min(480px, calc(100% - 32px));
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  color: var(--text-primary);
  box-shadow: var(--shadow-lg);
}

.conversation-dialog::backdrop {
  background: rgba(2, 6, 23, 0.72);
}

.conversation-dialog form {
  display: grid;
  gap: 11px;
  padding: 18px;
}

.conversation-dialog h2,
.conversation-dialog p {
  margin: 0;
}

.conversation-dialog h2 {
  font-size: 17px;
}

.conversation-dialog p,
.conversation-dialog label {
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.5;
}

.conversation-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 5px;
}

.conversation-dialog .danger {
  border-color: var(--status-error);
  background: transparent;
  color: var(--status-error);
}

.conversation-page-header .conversation-mobile-only,
.conversation-panel-header .conversation-mobile-only,
.conversation-drawer-backdrop {
  display: none;
}

@media (max-width: 760px) {
  .conversation-shell {
    width: calc(100% - 20px);
  }

  .conversation-page-header .conversation-mobile-only,
  .conversation-panel-header .conversation-mobile-only {
    display: inline-flex;
  }

  .conversation-workspace {
    grid-template-columns: minmax(0, 1fr);
    height: calc(100vh - 132px);
    min-height: 560px;
  }

  .conversation-panel {
    position: fixed;
    z-index: 110;
    inset: 0 auto 0 0;
    width: min(330px, 88vw);
    transform: translateX(-105%);
    transition: transform 180ms ease;
    box-shadow: var(--shadow-lg);
  }

  .conversation-panel.open {
    transform: translateX(0);
  }

  .conversation-drawer-backdrop:not([hidden]) {
    position: fixed;
    z-index: 105;
    inset: 0;
    display: block;
    background: rgba(2, 6, 23, 0.62);
  }

  .conversation-runtime-bar {
    align-items: stretch;
    flex-direction: column;
  }

  .conversation-runtime-bar label {
    min-width: 0;
  }

  .conversation-runtime-bar select {
    min-width: 0;
    flex: 1;
  }

  .conversation-agent-meta {
    justify-content: flex-start;
  }

  .conversation-context {
    padding-inline: 12px;
  }

  .conversation-timeline {
    padding: 14px 10px;
  }

  .conversation-message {
    width: 94%;
  }

  .conversation-composer-wrap {
    padding: 8px;
  }

  .conversation-title-block h2 {
    max-width: 72vw;
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ─── Background Pattern ─────────────────────────────────── */

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background: none;
  pointer-events: none;
  z-index: 0;
}

/* ─── Shell & Layout ─────────────────────────────────────── */

.shell {
  width: min(1024px, calc(100% - 48px));
  margin: 0 auto;
  padding: var(--gap-lg) 0;
  position: relative;
  z-index: 1;
}

.shell-with-sidebar {
  padding: var(--gap-lg) 0;
  position: relative;
  z-index: 1;
  transition: margin var(--transition-base), width var(--transition-base);
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--gap-md);
  margin-top: var(--gap-md);
}

/* ─── Sidebar Navigation ─────────────────────────────────── */

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--sidebar-width);
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-right: 1px solid var(--border-glass);
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: width var(--transition-base), transform var(--transition-base);
}

html.sidebar-collapsed .sidebar {
  width: var(--sidebar-collapsed-width);
}

.sidebar-header {
  display: flex;
  align-items: center;
  gap: var(--gap-sm);
  padding: var(--gap-md) var(--gap-lg);
  height: var(--topbar-height);
  border-bottom: 1px solid var(--border-glass);
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: var(--gap-sm);
  text-decoration: none;
  color: var(--text-primary);
  min-width: 0;
}

.sidebar-logo-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--accent), var(--accent-hover));
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 14px;
  color: #052e16;
  box-shadow: var(--shadow-glow);
}

.sidebar-logo-text {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 16px;
  letter-spacing: 0;
  white-space: nowrap;
}

.sidebar-logo-text span {
  color: var(--accent);
}

.sidebar-collapse {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  min-width: 30px;
  height: 30px;
  min-height: 30px;
  margin-left: auto;
  padding: 0;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background: rgba(15, 23, 42, 0.58);
  color: var(--text-secondary);
  box-shadow: none;
}

.sidebar-collapse:hover {
  color: var(--text-primary);
  background: var(--bg-tertiary);
}

.sidebar-collapse svg {
  width: 16px;
  height: 16px;
}

.sidebar-collapse-right,
html.sidebar-collapsed .sidebar .sidebar-collapse-left {
  display: none;
}

html.sidebar-collapsed .sidebar .sidebar-collapse-right {
  display: block;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: var(--gap-sm) 0;
}

.sidebar-footer {
  padding: var(--gap-sm) var(--gap-md);
  border-top: 1px solid var(--border-glass);
}

.sidebar-logout-form button {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--status-error);
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: var(--gap-sm);
}

.sidebar-logout-form button:hover {
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.4);
}

.sidebar-logout-form button svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.sidebar-section {
  padding: var(--gap-sm) var(--gap-md) var(--gap-xs);
}

.sidebar-section-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: var(--gap-xs);
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: var(--gap-sm);
  padding: var(--gap-sm) var(--gap-md);
  margin: 2px var(--gap-xs);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: all var(--transition-fast);
  position: relative;
}

html.sidebar-collapsed .sidebar .sidebar-header {
  justify-content: center;
  padding: var(--gap-md) 0;
}

html.sidebar-collapsed .sidebar .sidebar-logo {
  display: none;
}

html.sidebar-collapsed .sidebar .sidebar-collapse {
  margin-left: 0;
}

html.sidebar-collapsed .sidebar .sidebar-section {
  padding: var(--gap-xs) 6px;
}

html.sidebar-collapsed .sidebar .sidebar-section-label,
html.sidebar-collapsed .sidebar .sidebar-link-badge,
html.sidebar-collapsed .sidebar .sidebar-link::after,
html.sidebar-collapsed .sidebar .sidebar-link span {
  display: none;
}

html.sidebar-collapsed .sidebar .sidebar-link {
  justify-content: center;
  width: 44px;
  height: 44px;
  margin: 4px auto;
  padding: 0;
  gap: 0;
  font-size: 0;
}

html.sidebar-collapsed .sidebar .sidebar-link svg {
  width: 20px;
  height: 20px;
}

html.sidebar-collapsed .sidebar .sidebar-link.active::before {
  left: 3px;
  height: 24px;
}

html.sidebar-collapsed .sidebar .sidebar-footer {
  padding: var(--gap-sm) 6px;
}

html.sidebar-collapsed .sidebar .sidebar-logout-form button {
  justify-content: center;
  width: 44px;
  height: 44px;
  margin: 0 auto;
  padding: 0;
}

html.sidebar-collapsed .sidebar .sidebar-logout-form button span {
  display: none;
}

.sidebar-link:hover {
  color: var(--text-primary);
  background: var(--bg-glass-light);
}

.sidebar-link.active {
  color: var(--accent);
  background: var(--accent-dim);
  font-weight: 600;
}

.sidebar-link.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 20px;
  background: var(--accent);
  border-radius: var(--radius-full);
}

.sidebar-link svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  opacity: 0.7;
  transition: opacity var(--transition-fast);
}

.sidebar-link:hover svg {
  opacity: 1;
}

.sidebar-link.active svg {
  opacity: 1;
}

.sidebar-link-badge {
  margin-left: auto;
  background: var(--status-error);
  color: white;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: var(--radius-full);
  min-width: 18px;
  text-align: center;
}

.sidebar-footer {
  padding: var(--gap-md);
  border-top: 1px solid var(--border-glass);
}

.sidebar-footer-status {
  display: flex;
  align-items: center;
  gap: var(--gap-sm);
  padding: var(--gap-sm);
  border-radius: var(--radius-md);
  background: var(--bg-glass-light);
  font-size: 12px;
  color: var(--text-secondary);
}

.sidebar-footer-dot {
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  background: var(--status-ok);
  box-shadow: 0 0 8px var(--accent-glow);
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* ─── Mobile Sidebar Toggle ──────────────────────────────── */

.sidebar-toggle {
  display: none;
  position: fixed;
  top: var(--gap-sm);
  left: var(--gap-sm);
  z-index: 101;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: var(--bg-glass);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-glass);
  color: var(--text-primary);
  cursor: pointer;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.sidebar-toggle:hover {
  background: var(--bg-tertiary);
}

.sidebar-toggle svg {
  width: 20px;
  height: 20px;
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  z-index: 99;
}

/* ─── Topbar ─────────────────────────────────────────────── */

.topbar {
  display: flex;
  gap: var(--gap-sm);
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  margin-bottom: var(--gap-md);
  padding-bottom: var(--gap-md);
  border-bottom: 1px solid var(--border-glass);
}

.topbar h1 {
  margin: 0;
  font-size: 22px;
  font-weight: 600;
  font-family: var(--font-mono);
  letter-spacing: 0;
  color: var(--text-primary);
}

.topbar nav {
  display: flex;
  gap: var(--gap-md);
  flex-wrap: wrap;
}

.topbar a {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: var(--radius-md);
  transition: color var(--transition-base), background var(--transition-base);
}

.topbar a:hover {
  color: var(--accent);
  background: var(--accent-dim);
}

.topbar a.active {
  color: var(--accent);
  background: var(--accent-dim);
}

/* Global assistant */
.assistant-trigger {
  align-self: center;
  margin-left: auto;
  width: 38px;
  height: 38px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  padding: 0;
  border: 1px solid color-mix(in srgb, var(--accent) 45%, var(--border-glass));
  background: color-mix(in srgb, var(--accent) 12%, var(--ui-surface));
  color: var(--accent);
}

.assistant-trigger svg,
.assistant-header-actions svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.assistant-backdrop {
  position: fixed;
  inset: 0;
  z-index: 390;
  background: rgba(2, 8, 20, 0.48);
  backdrop-filter: blur(2px);
}

.assistant-panel {
  position: fixed;
  inset: 0 0 0 auto;
  z-index: 400;
  width: min(100vw, clamp(520px, 42vw, 680px));
  max-width: 100vw;
  height: 100dvh;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto auto auto auto auto minmax(0, 1fr) auto;
  overflow: hidden;
  background: var(--bg-primary);
  border-left: 1px solid var(--border-glass);
  box-shadow: -18px 0 45px rgba(0, 0, 0, 0.28);
}

.assistant-panel > :not(.assistant-history-drawer) {
  grid-column: 1;
  width: 100%;
  min-width: 0;
}

.assistant-panel[hidden],
.assistant-backdrop[hidden] {
  display: none;
}

.assistant-panel-header,
.assistant-agent-bar,
.assistant-context-section,
.assistant-graph-change,
.assistant-composer {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-glass);
}

.assistant-agent-bar,
.assistant-context-section {
  padding-block: 10px;
}

.assistant-context-section {
  max-height: min(30dvh, 260px);
  overflow-y: auto;
  scrollbar-gutter: stable;
}

.assistant-panel-header,
.assistant-header-actions,
.assistant-section-heading,
.assistant-agent-meta,
.assistant-composer > div,
.assistant-tool-actions,
.assistant-graph-change > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.assistant-panel-header h2 {
  margin: 2px 0 0;
  font-size: 18px;
}

.assistant-heading {
  display: grid;
  min-width: 0;
}

.assistant-current-title {
  max-width: 210px;
  overflow: hidden;
  color: var(--text-secondary);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.assistant-eyebrow {
  color: var(--accent);
  font: 700 10px var(--font-mono);
  text-transform: uppercase;
}

.assistant-header-actions button,
.assistant-header-actions a {
  width: 34px;
  height: 34px;
  display: inline-grid;
  place-items: center;
  padding: 0;
  color: var(--text-secondary);
  background: transparent;
  border: 1px solid var(--border-glass);
}

.assistant-header-actions .assistant-history-toggle {
  width: auto;
  min-width: 34px;
  padding: 0 10px;
  gap: 6px;
  font-size: 11px;
}

.assistant-header-actions .assistant-history-toggle:hover,
.assistant-header-actions .assistant-fullscreen:hover,
.assistant-header-actions .assistant-close:hover {
  border-color: color-mix(in srgb, var(--accent) 58%, var(--border-glass));
  background: var(--bg-elevated);
  color: var(--text-primary);
  box-shadow: none;
  transform: none;
}

.assistant-history-drawer {
  position: absolute;
  inset: 0;
  z-index: 8;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  min-width: 0;
  background: var(--bg-primary);
  box-shadow: -10px 0 32px rgba(0, 0, 0, 0.32);
}

.assistant-history-drawer[hidden] {
  display: none;
}

.assistant-history-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 70px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-glass);
}

.assistant-history-header h2 {
  margin: 2px 0 0;
  font-size: 17px;
}

.assistant-history-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.assistant-history-actions button {
  min-height: 34px;
  padding: 6px 9px;
  font-size: 12px;
}

.assistant-history-actions .assistant-history-close {
  width: 34px;
  min-width: 34px;
  padding: 0;
  background: transparent;
  color: var(--text-secondary);
}

.assistant-history-list {
  scrollbar-gutter: stable;
}

.assistant-history-drawer .conversation-list-open {
  grid-template-rows: auto auto auto;
  width: 100%;
  justify-self: stretch;
}

.assistant-history-drawer .conversation-list-open small {
  overflow: hidden;
  color: var(--text-muted);
  font-size: 10px;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.assistant-panel .conversation-list-open:hover,
.assistant-panel .conversation-list-menu summary:hover,
.assistant-panel .conversation-list-menu-popover button:hover,
.assistant-panel .assistant-history-actions button:hover {
  background: var(--bg-elevated);
  box-shadow: none;
  transform: none;
}

.assistant-agent-bar label {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 10px;
}

.assistant-agent-bar label > span,
.assistant-section-heading > span,
.assistant-muted,
.assistant-agent-meta,
.assistant-status {
  color: var(--text-secondary);
  font-size: 12px;
}

.assistant-agent-bar select {
  width: 100%;
  min-width: 0;
}

.assistant-agent-meta {
  margin-top: 8px;
  justify-content: flex-start;
  flex-wrap: wrap;
}

.assistant-warning {
  margin: 8px 0 0;
  padding: 8px 10px;
  color: var(--ui-warning);
  background: color-mix(in srgb, var(--ui-warning) 10%, transparent);
  border-left: 2px solid var(--ui-warning);
  font-size: 12px;
}

.assistant-context-current,
.assistant-context-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 9px;
}

.assistant-context-chip,
.assistant-context-suggestion {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 28px;
  padding: 4px 8px;
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  background: var(--ui-surface);
  font-size: 11px;
}

.assistant-context-chip button {
  min-width: 20px;
  min-height: 20px;
  padding: 0;
  border: 0;
  color: var(--text-secondary);
  background: transparent;
}

.assistant-panel .assistant-context-chip button:hover {
  background: transparent;
  color: var(--text-primary);
  box-shadow: none;
  transform: none;
}

.assistant-context-suggestion.selected {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-dim);
}

.assistant-graph-change {
  background: color-mix(in srgb, var(--ui-warning) 8%, var(--ui-surface));
}

.assistant-graph-change strong {
  display: block;
  margin-bottom: 10px;
  font-size: 13px;
}

.assistant-graph-change > div {
  align-items: stretch;
  flex-wrap: wrap;
}

.assistant-graph-change button {
  flex: 1 1 120px;
  padding: 7px 9px;
  font-size: 11px;
}

.assistant-timeline {
  grid-row: 6;
  min-height: 0;
  overflow-y: auto;
  padding: 14px 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-anchor: none;
}

.assistant-proposals {
  padding: 12px 16px 0;
}

.assistant-proposals[hidden] {
  display: none;
}

.assistant-proposal {
  width: fit-content;
  max-width: 100%;
  padding: 11px;
  border: 1px solid color-mix(in srgb, var(--accent) 38%, var(--border-glass));
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--accent) 8%, var(--ui-surface));
}

.assistant-proposal-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.assistant-proposal-actions {
  margin-top: 0;
  justify-content: flex-start;
}

.assistant-proposal-actions button {
  padding: 6px 9px;
  font-size: 11px;
}

.assistant-empty {
  grid-row: 6;
  z-index: 1;
  align-self: center;
  justify-self: center;
  display: grid;
  gap: 5px;
  padding: 18px;
  color: var(--text-secondary);
  text-align: center;
}

.assistant-empty strong {
  color: var(--text-primary);
}

.assistant-empty[hidden] {
  display: none;
}

.assistant-message {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  background: var(--ui-surface);
}

.assistant-message.user {
  width: min(88%, 560px);
  align-self: flex-end;
  background: color-mix(in srgb, var(--accent) 11%, var(--ui-surface));
  border-color: color-mix(in srgb, var(--accent) 35%, var(--border-glass));
}

.assistant-message header,
.assistant-tool-call summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 11px;
}

.assistant-message time {
  color: var(--text-muted);
}

.assistant-message p {
  overflow-wrap: anywhere;
  font-size: 13px;
  line-height: 1.5;
}

.assistant-markdown {
  min-width: 0;
  margin-top: 7px;
  overflow-wrap: anywhere;
  font-size: 13px;
  line-height: 1.55;
}

.assistant-markdown > :first-child {
  margin-top: 0;
}

.assistant-markdown > :last-child {
  margin-bottom: 0;
}

.assistant-markdown p,
.assistant-markdown ul,
.assistant-markdown ol,
.assistant-markdown blockquote,
.assistant-markdown pre {
  margin: 7px 0;
}

.assistant-markdown ul,
.assistant-markdown ol {
  padding-left: 20px;
}

.assistant-markdown h1,
.assistant-markdown h2,
.assistant-markdown h3,
.assistant-markdown h4 {
  margin: 12px 0 6px;
  font-size: 14px;
}

.assistant-markdown code {
  max-width: 100%;
  padding: 1px 4px;
  border-radius: 3px;
  background: var(--bg-primary);
  font-family: var(--font-mono);
  font-size: 0.92em;
}

.assistant-markdown pre {
  max-width: 100%;
  overflow: auto;
  padding: 9px;
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  background: var(--bg-primary);
}

.assistant-markdown pre code {
  padding: 0;
  background: transparent;
  white-space: pre;
}

.markdown-table-scroll {
  width: 100%;
  max-width: 100%;
  margin: 9px 0;
  overflow-x: auto;
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--bg-primary) 78%, transparent);
}

.markdown-table-scroll table {
  width: 100%;
  min-width: 420px;
  border-collapse: collapse;
  font-size: 0.94em;
}

.markdown-table-scroll th,
.markdown-table-scroll td {
  padding: 8px 10px;
  border-right: 1px solid var(--border-glass);
  border-bottom: 1px solid var(--border-glass);
  text-align: left;
  vertical-align: top;
}

.markdown-table-scroll th:last-child,
.markdown-table-scroll td:last-child {
  border-right: 0;
}

.markdown-table-scroll tbody tr:last-child td {
  border-bottom: 0;
}

.markdown-table-scroll th {
  background: color-mix(in srgb, var(--ui-accent-soft) 45%, var(--bg-secondary));
  color: var(--text-primary);
  font-weight: 700;
}

.markdown-table-scroll .align-center { text-align: center; }
.markdown-table-scroll .align-right { text-align: right; }

.assistant-reflection,
.assistant-generating,
.assistant-tool-call.compact {
  margin-top: 9px;
  padding-top: 8px;
  border-top: 1px solid var(--border-glass);
}

.assistant-reflection {
  color: var(--text-secondary);
}

.assistant-reflection > summary {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 26px;
  list-style: none;
  cursor: pointer;
  user-select: none;
}

.assistant-reflection > summary::-webkit-details-marker {
  display: none;
}

.assistant-reflection > summary::after {
  margin-left: auto;
  color: var(--text-muted);
  content: "›";
  transform: rotate(0deg);
  transition: transform 120ms ease;
}

.assistant-reflection[open] > summary::after {
  transform: rotate(90deg);
}

.assistant-reflection-content {
  margin: 4px 0 2px 10px;
  padding-left: 12px;
  border-left: 1px solid var(--border-glass);
  font-size: 12px;
}

.assistant-activity-kind {
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.assistant-activity-kind.channel-mcp {
  color: #a78bfa;
}

.assistant-generating {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-secondary);
  font-size: 12px;
}

.assistant-activity-pulse {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 35%, transparent);
  animation: assistant-pulse 1.4s ease-out infinite;
}

@keyframes assistant-pulse {
  70% { box-shadow: 0 0 0 7px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}

.assistant-tool-call {
  margin-top: 9px;
  padding-top: 8px;
  border-top: 1px solid var(--border-glass);
}

.assistant-tool-call.compact {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 7px 10px;
}

.assistant-tool-copy {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.assistant-tool-copy strong {
  min-width: 0;
  overflow: hidden;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.assistant-tool-status {
  color: var(--text-secondary);
  font-size: 11px;
}

.assistant-tool-call.tone-success .assistant-tool-status {
  color: var(--ui-success);
}

.assistant-tool-call.tone-danger .assistant-tool-status {
  color: var(--ui-danger);
}

.assistant-tool-call.tone-approval .assistant-tool-status,
.assistant-tool-call.tone-pending .assistant-tool-status {
  color: var(--ui-warning);
}

.assistant-tool-call .assistant-tool-actions {
  grid-column: 1 / -1;
  justify-content: flex-end;
}

.assistant-tool-call .assistant-tool-actions button {
  min-height: 30px;
  padding: 5px 8px;
  font-size: 11px;
}

.assistant-composer {
  grid-row: 7;
  border-top: 1px solid var(--border-glass);
  border-bottom: 0;
}

.assistant-composer textarea {
  width: 100%;
  min-height: 64px;
  max-height: 150px;
  resize: none;
}

.assistant-composer > div {
  margin-top: 8px;
}

.assistant-status.error {
  color: var(--ui-danger);
}

@media (max-width: 760px) {
  .assistant-panel {
    width: 100vw;
    height: 100dvh;
    border-left: 0;
  }

  .assistant-backdrop {
    display: none;
  }

  .assistant-panel-header,
  .assistant-agent-bar,
  .assistant-context-section,
  .assistant-graph-change,
  .assistant-composer {
    padding-inline: 12px;
  }

  .assistant-header-actions .assistant-history-toggle {
    width: 34px;
    padding: 0;
  }

  .assistant-history-toggle span {
    display: none;
  }

  .assistant-current-title {
    max-width: min(42vw, 170px);
  }

  .assistant-agent-bar label {
    grid-template-columns: minmax(0, 1fr);
    gap: 5px;
  }

  .assistant-context-section {
    max-height: 24dvh;
  }

  .assistant-timeline {
    padding: 12px;
  }

  .assistant-message {
    max-width: 100%;
  }

  .assistant-message.user {
    width: 94%;
  }
}

.page-header {
  align-items: center;
  gap: var(--gap-md);
}

.page-heading {
  display: grid;
  gap: 4px;
  min-width: min(100%, 420px);
}

.page-kicker {
  margin: 0;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.page-description {
  margin: 0;
  max-width: 680px;
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.5;
}

.page-actions {
  align-items: center;
  justify-content: flex-end;
}

.page-actions button {
  justify-self: auto;
}

/* Page-level navigation: primary views stay close to the page heading and
   remain visually distinct from compact filters used inside panels. */
.has-page-tabs > .page-header {
  margin-bottom: 0;
  border-bottom: 0;
}

.page-tabs {
  position: relative;
  display: flex;
  align-items: stretch;
  gap: 2px;
  width: 100%;
  min-width: 0;
  margin: 0 0 var(--gap-md);
  padding: 0;
  overflow-x: auto;
  overflow-y: hidden;
  border: 0;
  border-bottom: 1px solid var(--border-subtle);
  border-radius: 0;
  background: transparent;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
  overscroll-behavior-inline: contain;
}

.page-tabs button,
.page-tabs a {
  position: relative;
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  min-width: 0;
  min-height: 50px;
  padding: 0 18px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--text-secondary);
  box-shadow: none;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 650;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transform: none;
  transition: color var(--transition-fast), background var(--transition-fast);
}

.page-tabs button::after,
.page-tabs a::after {
  position: absolute;
  right: 16px;
  bottom: -1px;
  left: 16px;
  height: 3px;
  border-radius: 3px 3px 0 0;
  background: var(--ui-accent);
  content: "";
  opacity: 0;
  transform: scaleX(0.6);
  transition: opacity var(--transition-fast), transform var(--transition-fast);
}

.page-tabs button:hover,
.page-tabs a:hover {
  border: 0;
  background: color-mix(in srgb, var(--ui-accent) 7%, transparent);
  color: var(--text-primary);
  box-shadow: none;
  transform: none;
}

.page-tabs button.active,
.page-tabs button[aria-selected="true"],
.page-tabs a.active,
.page-tabs a[aria-current="page"] {
  border: 0;
  background: color-mix(in srgb, var(--ui-accent) 9%, transparent);
  color: var(--text-primary);
  box-shadow: none;
}

.page-tabs button.active::after,
.page-tabs button[aria-selected="true"]::after,
.page-tabs a.active::after,
.page-tabs a[aria-current="page"]::after {
  opacity: 1;
  transform: scaleX(1);
}

.page-tabs button:focus-visible,
.page-tabs a:focus-visible {
  z-index: 1;
  outline: 2px solid var(--ui-accent);
  outline-offset: -3px;
}

@media (max-width: 760px) {
  .page-tabs button,
  .page-tabs a {
    min-height: 48px;
    padding-inline: 16px;
  }
}

.empty-state.is-actionable {
  min-height: 180px;
  border: 1px dashed var(--border-subtle);
  border-radius: var(--radius-md);
  background: rgba(15, 23, 42, 0.28);
}

/* ─── Glass Panels & Cards ───────────────────────────────── */

.data-panel,
.approval-panel,
.run-summary,
.node-panel {
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  background: var(--bg-glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: border-color var(--transition-base), box-shadow var(--transition-base), transform var(--transition-base);
}

.data-panel:hover,
.approval-panel:hover {
  border-color: var(--border-subtle);
  box-shadow: var(--shadow-md);
}

.data-panel header {
  padding: var(--gap-md);
  border-bottom: 1px solid var(--border-glass);
}

.data-panel h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  font-family: var(--font-mono);
  color: var(--text-primary);
}

.data-list,
.library-list,
.conversation-list,
.approval-list {
  display: grid;
}

.data-row {
  position: relative;
  display: grid;
  gap: var(--gap-xs);
  padding: var(--gap-md);
  border-bottom: 1px solid var(--border-subtle);
  transition: background var(--transition-fast);
}

.data-row:hover {
  background: var(--bg-glass-light);
}

.data-row:last-child {
  border-bottom: 0;
}

.data-row-delete {
  position: absolute;
  top: 8px;
  right: 8px;
  min-width: 28px;
  min-height: 28px;
  padding: 0;
}

.data-link {
  color: inherit;
  text-decoration: none;
}

.data-row span {
  color: var(--text-secondary);
  font-size: 13px;
  font-family: var(--font-mono);
  overflow-wrap: anywhere;
}

/* ─── Meta Grids ─────────────────────────────────────────── */

.meta-grid {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: var(--gap-xs) var(--gap-md);
  margin: 0;
}

.meta-grid dt {
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 13px;
}

.meta-grid dd {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 13px;
}

/* ─── Run Summary ────────────────────────────────────────── */

.run-summary {
  margin-bottom: var(--gap-md);
  padding: var(--gap-md);
}

.run-summary h2 {
  margin: 0 0 var(--gap-xs);
  font-family: var(--font-mono);
  font-size: 15px;
}

.run-summary p {
  margin: 0 0 var(--gap-md);
  color: var(--text-secondary);
  font-size: 14px;
}

.run-summary pre {
  margin: var(--gap-md) 0 0;
  padding: var(--gap-md);
  background: var(--bg-primary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.5;
  white-space: pre-wrap;
  color: var(--text-secondary);
}

.run-history-hero {
  display: flex;
  gap: var(--gap-md);
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--gap-md);
  padding: var(--gap-md);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: rgba(17, 24, 39, 0.86);
  box-shadow: var(--shadow-md);
}

.run-history-hero h2 {
  margin: 0 0 4px;
  font-size: 18px;
}

.run-history-hero p {
  margin: 0;
  color: var(--text-secondary);
}

.runs-shell {
  width: min(1280px, calc(100% - 48px));
}

.runs-grid {
  grid-template-columns: 380px minmax(0, 1fr);
}

.run-form {
  display: grid;
  gap: var(--gap-sm);
}

.run-form-actions {
  display: flex;
  gap: var(--gap-sm);
  align-items: end;
  justify-content: space-between;
  flex-wrap: wrap;
}

.run-form-actions label {
  display: grid;
  gap: var(--gap-xs);
  min-width: 220px;
}

.run-form-actions span {
  color: var(--text-secondary);
  font-size: 12px;
  font-family: var(--font-mono);
}

.run-row-button {
  width: 100%;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--text-primary);
  text-align: left;
  cursor: pointer;
}

.run-row-button:hover {
  background: var(--bg-elevated);
  color: var(--text-primary);
  box-shadow: none;
}

.run-row-button:active {
  transform: none;
}

.run-row-button.selected {
  background: var(--bg-elevated);
  border-left: 2px solid var(--accent);
}

.run-row-card {
  grid-template-columns: minmax(0, 1fr) auto;
  gap: var(--gap-sm);
  align-items: center;
}

.run-row-card.selected {
  background: var(--bg-elevated);
  border-left: 2px solid var(--accent);
}

.run-row-card .run-row-button {
  display: grid;
  gap: var(--gap-xs);
  min-width: 0;
  padding: 0;
}

.run-row-review {
  min-height: 32px;
  padding: 6px 10px;
  font-size: 12px;
}

.operator-inbox-shell {
  width: min(1520px, calc(100% - 48px));
}

.operator-filter-panel .panel-heading,
.operator-card > header {
  align-items: flex-start;
}

.operator-summary-message {
  margin: 4px 0 0;
  color: var(--text-secondary);
  font-size: 13px;
}

.operator-filter-chips {
  display: flex;
  gap: var(--gap-xs);
  flex-wrap: wrap;
  padding: var(--gap-sm) var(--gap-md) 0;
}

.operator-filter-chips button {
  min-height: 32px;
  padding: 6px 10px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background: var(--bg-secondary);
  color: var(--text-secondary);
  font-size: 12px;
}

.operator-filter-chips button.active,
.operator-filter-chips button:hover {
  border-color: var(--ui-accent);
  color: var(--ui-accent-hover);
  background: var(--ui-accent-soft);
}

.operator-filter-grid {
  padding: var(--gap-md);
}

.operator-card {
  border-left-color: var(--border-subtle);
}

.operator-card.severity-blocked {
  border-left-color: var(--status-error);
}

.operator-card.severity-warning {
  border-left-color: var(--status-warn);
}

.operator-card.severity-ok,
.operator-card.severity-done {
  border-left-color: var(--status-ok);
}

.operator-badge-row {
  display: flex;
  gap: var(--gap-xs);
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.operator-meta-grid {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

.operator-item-message {
  font-size: 14px;
}

.operator-actions .danger {
  border-color: #ef444459;
  color: #fecaca;
}

.operator-empty {
  padding: var(--gap-lg);
}

/* Lot 4: unified operator attention hub */
.attention-hub-shell {
  width: min(1540px, calc(100% - 48px));
}

.attention-hub-header {
  margin-bottom: 14px;
}

.attention-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.attention-metric {
  display: grid;
  min-height: 92px;
  gap: 3px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-secondary);
}

.attention-metric span {
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.attention-metric strong {
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 26px;
  line-height: 1.15;
}

.attention-metric small {
  color: var(--text-muted);
  font-size: 11px;
}

.attention-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(230px, 320px);
  gap: 10px 16px;
  align-items: end;
  margin-bottom: 10px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-secondary);
}

.attention-filter-row {
  display: flex;
  gap: 6px;
  min-width: 0;
  flex-wrap: wrap;
}

.attention-filter-row button {
  min-height: 34px;
  padding: 6px 10px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-primary);
  color: var(--text-secondary);
  font-size: 11px;
  box-shadow: none;
}

.attention-filter-row button:hover,
.attention-filter-row button.active {
  border-color: rgba(107, 140, 255, 0.58);
  background: rgba(95, 124, 247, 0.12);
  color: #b8c5ff;
  transform: none;
}

.attention-search,
.attention-advanced-grid label {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.attention-search span,
.attention-advanced-grid label span {
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
}

.attention-search input,
.attention-advanced-grid input,
.attention-advanced-grid select {
  min-width: 0;
  min-height: 34px;
}

.attention-advanced {
  grid-column: 1 / -1;
  border-top: 1px solid var(--border-subtle);
}

.attention-advanced > summary {
  width: max-content;
  padding-top: 9px;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 11px;
}

.attention-advanced-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(160px, 1fr)) auto;
  gap: 10px;
  align-items: end;
  padding-top: 10px;
}

.attention-source-health:empty {
  display: none;
}

.attention-source-health {
  display: flex;
  min-height: 34px;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 10px;
  padding: 7px 10px;
  border: 1px solid var(--border-subtle);
  border-radius: 7px;
  background: var(--bg-secondary);
  font-size: 11px;
}

.attention-source-ok {
  color: #75dc96;
}

.attention-source-warning {
  color: #f4c15d;
}

.attention-source-detail {
  color: var(--text-muted);
}

.attention-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(330px, 390px);
  gap: 12px;
  align-items: start;
}

.attention-list-surface,
.attention-inspector {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-secondary);
}

.attention-list-header,
.attention-inspector-header {
  display: flex;
  min-height: 62px;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}

.attention-list-header h2,
.attention-inspector-header h2 {
  margin: 0;
  font-size: 15px;
}

.attention-list-header-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.attention-list-header-actions .button-link {
  min-height: 30px;
  padding: 5px 8px;
  font-size: 10px;
}

.attention-list-header p {
  margin: 3px 0 0;
  color: var(--text-muted);
  font-size: 11px;
}

.attention-list {
  display: grid;
}

.attention-item {
  position: relative;
  min-width: 0;
  border-bottom: 1px solid var(--border-subtle);
}

.attention-item:last-child {
  border-bottom: 0;
}

.attention-item::before {
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: var(--text-muted);
  content: "";
}

.attention-item.tone-blocked::before {
  background: #ef6b73;
}

.attention-item.tone-warning::before {
  background: #e3ae42;
}

.attention-item.tone-ok::before {
  background: #44c875;
}

.attention-item-main {
  display: grid;
  width: 100%;
  min-width: 0;
  min-height: 104px;
  gap: 8px;
  padding: 12px 14px 11px 16px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--text-primary);
  text-align: left;
  box-shadow: none;
}

.attention-item-main:hover,
.attention-item-main:focus-visible,
.attention-item.selected .attention-item-main {
  background: var(--bg-tertiary);
  box-shadow: none;
  transform: none;
}

.attention-item.selected .attention-item-main {
  box-shadow: inset 3px 0 rgba(107, 140, 255, 0.85);
}

.attention-item-heading,
.attention-item-footer,
.attention-item-badges,
.attention-inspector-status,
.attention-inspector-actions {
  display: flex;
  gap: 7px;
  align-items: center;
  flex-wrap: wrap;
}

.attention-item-heading {
  justify-content: space-between;
}

.attention-item-identity {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.attention-item-identity small {
  color: var(--text-muted);
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
}

.attention-item-identity strong {
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attention-item-message {
  display: -webkit-box;
  overflow: hidden;
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.45;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.attention-item-footer {
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 10px;
}

.attention-item-footer span:not(:last-child)::after {
  margin-left: 7px;
  content: "·";
}

.attention-status-blocked {
  border-color: rgba(239, 107, 115, 0.45);
  background: rgba(239, 107, 115, 0.1);
  color: #ff9aa1;
}

.attention-status-warning {
  border-color: rgba(227, 174, 66, 0.45);
  background: rgba(227, 174, 66, 0.1);
  color: #f4c15d;
}

.attention-status-ok {
  border-color: rgba(68, 200, 117, 0.42);
  background: rgba(68, 200, 117, 0.1);
  color: #75dc96;
}

.attention-status-muted {
  color: var(--text-secondary);
}

.attention-load-more-wrap {
  display: flex;
  justify-content: center;
  padding: 10px;
  border-top: 1px solid var(--border-subtle);
}

.attention-load-more-wrap:has(button[hidden]) {
  display: none;
}

.attention-inspector {
  position: sticky;
  top: 12px;
  min-height: 430px;
}

.attention-inspector-header > div {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.attention-inspector-header span {
  color: var(--text-muted);
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
}

.attention-inspector-header h2 {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attention-inspector-close {
  display: none;
  width: 34px;
  min-width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid var(--border-subtle);
  background: var(--bg-primary);
  color: var(--text-secondary);
  font-size: 22px;
  line-height: 1;
}

.attention-inspector-body {
  display: grid;
  gap: 14px;
  padding: 14px;
}

.attention-inspector-empty {
  display: grid;
  min-height: 310px;
  place-content: center;
  gap: 6px;
  padding: 30px;
  color: var(--text-secondary);
  text-align: center;
}

.attention-inspector-empty p {
  max-width: 260px;
  margin: 0;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.5;
}

.attention-inspector-section,
.attention-inspector-signals {
  display: grid;
  gap: 7px;
}

.attention-inspector-section h3,
.attention-inspector-signals h3 {
  margin: 0;
  color: var(--text-muted);
  font-size: 10px;
  text-transform: uppercase;
}

.attention-inspector-section p,
.attention-inspector-signals > p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.attention-signal {
  padding: 8px 9px;
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  background: var(--bg-primary);
}

.attention-signal.blocked {
  border-color: rgba(239, 107, 115, 0.35);
  color: #ff9aa1;
}

.attention-signal.warning {
  border-color: rgba(227, 174, 66, 0.35);
  color: #f4c15d;
}

.attention-inspector-context {
  display: grid;
  margin: 0;
  border-top: 1px solid var(--border-subtle);
}

.attention-inspector-context > div {
  display: grid;
  grid-template-columns: 105px minmax(0, 1fr);
  gap: 8px;
  padding: 7px 0;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 11px;
}

.attention-inspector-context dt {
  color: var(--text-muted);
}

.attention-inspector-context dd {
  min-width: 0;
  margin: 0;
  overflow: hidden;
  color: var(--text-secondary);
  text-overflow: ellipsis;
  overflow-wrap: anywhere;
}

.attention-inspector-context.compact > div {
  grid-template-columns: 120px minmax(0, 1fr);
}

.attention-inspector-actions button,
.attention-inspector-actions .button-link {
  min-height: 34px;
  padding: 7px 10px;
  font-size: 11px;
}

.attention-inspector-actions .danger {
  border-color: rgba(239, 107, 115, 0.45);
  color: #ff9aa1;
}

.attention-skeleton {
  position: relative;
  min-height: 104px;
  overflow: hidden;
  border-bottom: 1px solid var(--border-subtle);
  background: linear-gradient(90deg, rgba(148, 163, 184, 0.035), rgba(148, 163, 184, 0.1), rgba(148, 163, 184, 0.035));
  background-size: 220% 100%;
  animation: attention-shimmer 1.5s linear infinite;
}

@keyframes attention-shimmer {
  to { background-position: -220% 0; }
}

.attention-inspector-backdrop {
  display: none;
}

@media (max-width: 1180px) {
  .attention-workspace {
    grid-template-columns: minmax(0, 1fr) minmax(300px, 340px);
  }

  .attention-toolbar {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 980px) {
  .attention-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .attention-workspace {
    grid-template-columns: 1fr;
  }

  .attention-inspector {
    position: fixed;
    z-index: 80;
    inset: 0 0 0 auto;
    width: min(470px, 94vw);
    height: 100dvh;
    max-height: none;
    overflow-y: auto;
    border-radius: 0;
    transform: translateX(105%);
    transition: transform 180ms ease;
  }

  .attention-inspector-open {
    overflow: hidden;
  }

  .attention-inspector-open .attention-inspector {
    transform: translateX(0);
  }

  .attention-inspector-close {
    display: inline-grid;
    place-items: center;
  }

  .attention-inspector-backdrop:not([hidden]) {
    position: fixed;
    z-index: 79;
    inset: 0;
    display: block;
    border: 0;
    background: rgba(3, 7, 18, 0.72);
  }
}

@media (max-width: 760px) {
  .attention-hub-shell {
    width: min(100% - 24px, 1540px);
  }

  .attention-filter-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .attention-filter-row button:first-child {
    grid-column: 1 / -1;
  }

  .attention-advanced-grid {
    grid-template-columns: 1fr;
  }

  .attention-item-heading {
    align-items: flex-start;
  }
}

@media (max-width: 420px) {
  .attention-metrics {
    grid-template-columns: 1fr 1fr;
  }

  .attention-metric {
    min-height: 82px;
    padding: 11px;
  }

  .attention-metric small {
    display: none;
  }

  .attention-item-main {
    min-height: 118px;
  }

  .attention-item-badges {
    justify-content: flex-start;
  }
}

/* ALERTS-009: Notifications page */
.notifications-shell .attention-workspace {
  display: block;
}

.notifications-toolbar {
  grid-template-columns: 1fr;
}

.notifications-filter-grid {
  display: grid;
  grid-template-columns: minmax(220px, 1.5fr) repeat(4, minmax(150px, 1fr));
  gap: 10px;
  align-items: end;
}

.notifications-filter-grid label,
.notifications-saved-views label,
.notification-decision-form label {
  display: grid;
  min-width: 0;
  gap: 4px;
}

.notifications-filter-grid label span,
.notifications-saved-views label span,
.notification-decision-form label span {
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
}

.notifications-filter-grid input,
.notifications-filter-grid select,
.notifications-saved-views select,
.notification-decision-form select,
.notification-decision-form textarea {
  width: 100%;
  min-width: 0;
  min-height: 34px;
}

.notifications-saved-views {
  display: flex;
  gap: 8px;
  align-items: end;
  flex-wrap: wrap;
  padding-top: 10px;
  border-top: 1px solid var(--border-subtle);
}

.notifications-saved-views label {
  flex: 1 1 220px;
}

.notifications-saved-views button,
.notification-actions button,
.notification-decision-form button {
  min-height: 34px;
  padding: 7px 10px;
  font-size: 11px;
}

.notifications-saved-views .danger,
.notification-actions .danger {
  border-color: rgba(239, 107, 115, 0.45);
  color: #ff9aa1;
}

.notification-confirmation-dialog.danger {
  border-color: rgba(239, 107, 115, 0.62);
}

.notification-confirmation-dialog label {
  display: grid;
  gap: 7px;
  margin-top: var(--gap-sm);
}

.notification-confirmation-dialog label span {
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
}

.notification-confirmation-dialog code {
  display: block;
  padding: 8px 10px;
  overflow-wrap: anywhere;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background: var(--bg-primary);
  color: var(--text-primary);
}

.notification-confirmation-dialog .danger {
  border-color: rgba(239, 107, 115, 0.45);
  color: #ff9aa1;
}

.notification-item {
  display: block;
}

.notification-item > summary {
  list-style: none;
  cursor: pointer;
}

.notification-item > summary::-webkit-details-marker {
  display: none;
}

.notification-item[open] .notification-summary {
  background: var(--bg-tertiary);
}

.notification-detail {
  display: grid;
  gap: 12px;
  padding: 0 14px 14px 16px;
}

.notification-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 16px;
  margin: 0;
  padding: 10px 12px;
  border: 1px solid var(--border-subtle);
  border-radius: 7px;
  background: var(--bg-primary);
}

.notification-detail-grid > div {
  display: grid;
  grid-template-columns: minmax(90px, 0.38fr) minmax(0, 1fr);
  gap: 8px;
  padding: 7px 0;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 11px;
}

.notification-detail-grid > div:nth-last-child(-n + 2) {
  border-bottom: 0;
}

.notification-detail-grid dt {
  color: var(--text-muted);
}

.notification-detail-grid dd {
  min-width: 0;
  margin: 0;
  color: var(--text-secondary);
  overflow-wrap: anywhere;
}

.notification-detail-grid .button-link {
  justify-self: start;
  align-self: center;
  min-height: 32px;
  padding: 6px 10px;
  font-size: 11px;
}

.notification-actions {
  display: flex;
  gap: 8px;
  align-items: end;
  flex-wrap: wrap;
}

.notification-decision-form {
  display: grid;
  flex: 1 1 340px;
  grid-template-columns: minmax(220px, 1fr) auto;
  gap: 8px;
  align-items: end;
}

.notification-decision-form textarea {
  resize: vertical;
}

.notification-empty {
  min-height: 240px;
}

@media (max-width: 980px) {
  .notifications-filter-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .notification-detail-grid {
    grid-template-columns: 1fr;
  }

  .notification-detail-grid > div:nth-last-child(-n + 2) {
    border-bottom: 1px solid var(--border-subtle);
  }

  .notification-detail-grid > div:last-of-type {
    border-bottom: 0;
  }
}

@media (max-width: 560px) {
  .notifications-filter-grid,
  .notification-decision-form {
    grid-template-columns: 1fr;
  }

  .notifications-saved-views {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .notifications-saved-views label {
    grid-column: 1 / -1;
  }

  .notifications-saved-views button {
    width: 100%;
  }

  .notification-detail-grid > div {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 1180px) {
  .operator-meta-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .operator-meta-grid {
    grid-template-columns: 1fr;
  }
}

.workflow-shell {
  width: min(1280px, calc(100% - 48px));
}

.workflow-grid {
  grid-template-columns: 360px minmax(0, 1fr);
  align-items: start;
}

.workflow-invoke-panel {
  grid-column: 2;
}

.workflow-row {
  width: 100%;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--text-primary);
  text-align: left;
  cursor: pointer;
}

.workflow-row:hover {
  background: var(--bg-elevated);
  color: var(--text-primary);
  box-shadow: none;
}

.workflow-row:active {
  transform: none;
}

.workflow-row.selected {
  background: var(--bg-elevated);
  border-left: 2px solid var(--accent);
}

.workflow-form-row,
.workflow-schema-grid,
.workflow-invoke-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--gap-sm);
}

.workflow-schema-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.workflow-invoke-row {
  align-items: end;
}

.workflow-result {
  min-height: 120px;
  margin: 0;
  padding: var(--gap-md);
  border-top: 1px solid var(--border);
  background: var(--bg-primary);
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.tool-shell {
  width: min(1360px, calc(100% - 48px));
}

.tool-workspace {
  display: grid;
  gap: var(--gap-md);
}

.tool-summary-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: var(--gap-sm);
}

.tool-summary-item {
  display: grid;
  gap: var(--gap-xs);
  padding: var(--gap-md);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  background: var(--bg-glass);
  backdrop-filter: blur(8px);
}

.tool-summary-item span {
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 12px;
}

.tool-summary-item strong {
  font-family: var(--font-mono);
  font-size: 20px;
}

.tool-catalog-grid {
  grid-template-columns: minmax(380px, 0.88fr) minmax(0, 1.12fr);
  align-items: start;
}

.tool-filter-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) repeat(4, minmax(0, 1fr));
  gap: var(--gap-sm);
  padding: var(--gap-md);
  border-bottom: 1px solid var(--border);
}

.tool-filter-grid label {
  display: grid;
  gap: var(--gap-xs);
}

.tool-filter-grid span {
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 12px;
}

.tool-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: var(--gap-md);
  width: 100%;
  padding: var(--gap-md);
  border: 0;
  border-bottom: 1px solid var(--border-subtle);
  border-radius: 0;
  background: transparent;
  color: var(--text-primary);
  text-align: left;
  cursor: pointer;
}

.tool-row:hover {
  background: var(--bg-elevated);
  color: var(--text-primary);
  box-shadow: none;
}

.tool-row:active {
  transform: none;
}

.tool-row.selected {
  background: var(--bg-elevated);
  border-left: 2px solid var(--accent);
}

.tool-row-main,
.tool-row-stats {
  display: grid;
  gap: var(--gap-xs);
  min-width: 0;
}

.tool-row-heading,
.tool-row-meta {
  display: flex;
  gap: var(--gap-xs);
  align-items: center;
  flex-wrap: wrap;
}

.tool-row-heading strong {
  overflow-wrap: anywhere;
}

.tool-row-meta span,
.tool-row-description,
.tool-row-stats span {
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.tool-row-stats {
  justify-items: end;
  align-content: start;
  white-space: nowrap;
}

.tool-detail-body {
  display: grid;
  gap: var(--gap-md);
  padding: var(--gap-md);
}

.tool-detail-section {
  display: grid;
  gap: var(--gap-sm);
}

.tool-detail-section p {
  margin: 0;
  color: var(--text-secondary);
  overflow-wrap: anywhere;
}

.tool-pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--gap-xs);
}

.tool-stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--gap-sm);
}

.tool-stat-grid article {
  display: grid;
  gap: var(--gap-xs);
  padding: var(--gap-sm);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-primary);
}

.tool-stat-grid span {
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 12px;
}

.tool-stat-grid strong {
  font-family: var(--font-mono);
  font-size: 18px;
}

.tool-meta-grid dd {
  overflow-wrap: anywhere;
}

.tool-chip-section {
  display: grid;
  gap: var(--gap-xs);
}

.tool-chip-section h3,
.tool-schema-grid h3 {
  margin: 0;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.tool-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--gap-xs);
}

.tool-chip-list span {
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-primary);
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 12px;
}

.tool-schema-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--gap-sm);
}

.tool-schema-grid article {
  display: grid;
  gap: var(--gap-xs);
  min-width: 0;
}

.tool-schema-grid pre {
  max-height: 420px;
  margin: 0;
  padding: var(--gap-md);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-primary);
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.5;
  overflow: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.agent-shell {
  max-width: 1480px;
}

.agent-stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--gap-md);
  margin-bottom: var(--gap-md);
}

.agent-stat-card {
  display: grid;
  gap: 2px;
  min-height: 82px;
  padding: var(--gap-md);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  background: var(--bg-glass);
}

.agent-stat-card strong {
  font-family: var(--font-mono);
  font-size: 26px;
  line-height: 1;
  color: var(--accent);
}

.agent-stat-card span {
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 12px;
}

.agent-grid {
  grid-template-columns: 340px minmax(520px, 1fr) 420px;
  align-items: start;
}

@media (max-width: 1640px) and (min-width: 769px) {
  .agent-grid {
    grid-template-columns: minmax(260px, 0.75fr) minmax(0, 1.25fr);
  }

  .agent-policy-panel {
    grid-column: 1 / -1;
  }
}

.agent-policy-panel {
  grid-column: auto;
}

.agent-list-panel,
.agent-editor-panel,
.agent-policy-panel {
  overflow: hidden;
}

.agent-list-controls {
  display: grid;
  gap: var(--gap-sm);
  padding: var(--gap-md);
  border-bottom: 1px solid var(--border-glass);
}

.agent-search {
  display: grid;
  gap: var(--gap-xs);
}

.agent-search span {
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 12px;
}

.agent-search input {
  width: 100%;
}

.agent-filter-bar {
  display: grid;
  grid-template-columns: 3fr 1fr;
  padding: 3px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background: var(--bg-secondary);
  transition: grid-template-columns 200ms ease;
}

.agent-filter-bar[data-agent-filter-state="enabled"] {
  grid-template-columns: 3fr 1fr;
}

.agent-filter-bar[data-agent-filter-state="disabled"] {
  grid-template-columns: 1fr 3fr;
}

.agent-editor-tabs {
  display: flex;
  gap: 0;
  padding: 3px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--bg-primary);
}

.agent-filter-bar button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  justify-self: stretch;
  width: 100%;
  min-height: 31px;
  padding: 5px 8px;
  border: 0;
  border-radius: 3px;
  background: transparent;
  color: var(--text-secondary);
  box-shadow: none;
  font-size: 12px;
  font-family: var(--font-mono);
  text-align: center;
  transition: background 180ms ease, color 180ms ease, box-shadow 180ms ease;
}

.agent-editor-tabs button {
  flex: 1;
  min-height: 32px;
  padding: 6px 10px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-secondary);
  box-shadow: none;
  font-size: 12px;
  font-family: var(--font-mono);
}

.agent-editor-tabs button:hover {
  color: var(--text-primary);
  background: var(--bg-elevated);
  transform: none;
}

.agent-filter-bar button.active {
  background: color-mix(in srgb, var(--ui-accent-soft) 72%, var(--bg-elevated));
  color: var(--text-primary);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--ui-accent) 36%, transparent), 0 1px 4px rgba(0, 0, 0, 0.2);
}

.agent-filter-bar button:focus-visible {
  outline: 2px solid var(--ui-focus);
  outline-offset: 2px;
}

.agent-editor-tabs button.active {
  color: #052e16;
  background: var(--accent);
  font-weight: 700;
}

.agent-editor-tabs {
  margin: var(--gap-md) var(--gap-md) 0;
}

.agent-model-config-panel {
  margin-bottom: var(--gap-md);
}

.agent-model-config-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: var(--gap-sm);
  align-items: end;
  padding: 0 var(--gap-md) var(--gap-sm);
}

.agent-model-config-form label {
  display: grid;
  gap: var(--gap-xs);
}

.agent-model-config-form label span {
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 12px;
}

.agent-row {
  grid-template-columns: minmax(0, 1fr) auto;
  width: 100%;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--text-primary);
  text-align: left;
  cursor: pointer;
}

.agent-row:hover {
  background: var(--bg-elevated);
  color: var(--text-primary);
  box-shadow: none;
}

.agent-row:active {
  transform: none;
}

.agent-row.selected {
  background: var(--bg-elevated);
  border-left: 2px solid var(--accent);
}

.agent-row strong,
.agent-row-role,
.agent-row-meta {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.agent-row-state {
  justify-self: end;
  padding: 2px 7px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  background: var(--bg-primary);
  font-size: 11px;
  text-transform: uppercase;
}

.agent-row-role,
.agent-row-meta {
  grid-column: 1 / -1;
}

.agent-form-row,
.agent-policy-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--gap-sm);
}

.agent-policy-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.agent-tab-panel {
  display: none;
  gap: var(--gap-sm);
}

.agent-tab-panel.active {
  display: grid;
}

.agent-toggle {
  align-self: end;
  min-height: 42px;
  padding: 10px 12px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--bg-primary);
}

.agent-model-resolution {
  display: flex;
  grid-column: 1 / -1;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  min-height: 34px;
  padding: 8px 10px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background: var(--bg-primary);
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 12px;
}

.agent-model-resolution small {
  flex-basis: 100%;
  color: var(--text-muted);
  overflow-wrap: anywhere;
}

.agent-model-status {
  padding: 2px 7px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  background: var(--bg-elevated);
  font-size: 11px;
  text-transform: uppercase;
}

.agent-model-status.ready {
  color: var(--ui-success);
}

.agent-model-status.offline {
  color: var(--ui-warning);
}

.agent-policy-preview {
  display: grid;
  gap: var(--gap-md);
  padding: var(--gap-md);
}

.agent-overview-card {
  padding: var(--gap-md);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--bg-primary);
}

.agent-chip-section {
  display: grid;
  gap: 8px;
  padding: var(--gap-md);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: rgba(11, 17, 32, 0.46);
}

.agent-chip-section h3 {
  margin: 0;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.agent-section-summary {
  margin: -2px 0 2px;
  color: var(--text-muted);
  font-size: 12px;
}

.agent-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.agent-chip-list span {
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  font-size: 12px;
}

.agent-tool-list {
  display: grid;
  gap: 8px;
  max-height: 420px;
  overflow: auto;
}

.agent-tool-row {
  display: grid;
  gap: 6px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
}

.agent-tool-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--gap-sm);
}

.agent-tool-name {
  overflow-wrap: anywhere;
  font-family: var(--font-mono);
  font-size: 13px;
}

.agent-tool-badges {
  display: inline-flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.agent-tool-badges span {
  padding: 3px 7px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-primary);
  color: var(--text-secondary);
  font-size: 11px;
  text-transform: uppercase;
}

.agent-tool-badges span.auto {
  color: var(--status-ok);
  border-color: var(--ui-border-strong);
}

.agent-tool-badges span.approval {
  color: var(--status-warn);
  border-color: rgba(245, 158, 11, 0.35);
}

.agent-tool-description,
.agent-tool-empty {
  margin: 0;
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.45;
}

.agent-policy-preview pre {
  min-height: 96px;
  margin: 0;
  padding: var(--gap-md);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-primary);
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.agent-reference-panel {
  display: grid;
  align-content: start;
  gap: var(--gap-sm);
  padding: var(--gap-md);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--bg-primary);
}

.agent-reference-panel h3,
.agent-reference-panel h4 {
  margin: 0;
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 12px;
}

.agent-reference-list {
  display: grid;
  gap: var(--gap-sm);
  max-height: 320px;
  overflow: auto;
}

.agent-reference-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.agent-reference-chips button {
  min-height: 26px;
  padding: 3px 7px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  box-shadow: none;
  font-family: var(--font-mono);
  font-size: 11px;
}

.agent-reference-chips button:hover {
  color: var(--text-primary);
  border-color: var(--accent);
  transform: none;
}

.graph-shell {
  width: min(1280px, calc(100% - 48px));
}

.graph-grid {
  grid-template-columns: 360px minmax(0, 1fr);
  align-items: start;
}

.graph-validation-panel {
  grid-column: 2;
}

.graph-row {
  width: 100%;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--text-primary);
  text-align: left;
  cursor: pointer;
}

.graph-row:hover {
  background: var(--bg-elevated);
  color: var(--text-primary);
  box-shadow: none;
}

.graph-row:active {
  transform: none;
}

.graph-row.selected {
  background: var(--bg-elevated);
  border-left: 2px solid var(--accent);
}

.graph-draft-form {
  margin-bottom: var(--gap-md);
  padding-bottom: var(--gap-md);
  border-bottom: 1px solid var(--border);
}

.graph-draft-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
  gap: var(--gap-sm);
  align-items: end;
}

.graph-form-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--gap-sm);
  align-items: end;
}

.graph-builder {
  display: grid;
  gap: var(--gap-sm);
  padding: var(--gap-md) 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.graph-builder-heading {
  display: flex;
  gap: var(--gap-md);
  align-items: center;
  justify-content: space-between;
}

.graph-builder-heading h3,
.graph-node-inspector h3 {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 14px;
}

.graph-builder-actions,
.graph-node-actions {
  display: flex;
  gap: var(--gap-xs);
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.graph-builder-actions button,
.graph-node-actions button {
  justify-self: auto;
}

.graph-builder-toolbar {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr) auto;
  gap: var(--gap-sm);
  align-items: end;
}

.graph-builder-toolbar label,
.graph-node-inspector label {
  display: grid;
  gap: var(--gap-xs);
}

.graph-builder-toolbar span,
.graph-node-inspector span {
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 12px;
}

.graph-canvas-error {
  min-height: 18px;
  margin: 0;
  color: var(--status-error);
  font-family: var(--font-mono);
  font-size: 12px;
}

.graph-canvas {
  position: relative;
  min-height: 320px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background:
    linear-gradient(rgba(148, 163, 184, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148, 163, 184, 0.04) 1px, transparent 1px),
    var(--bg-primary);
  background-size: 28px 28px;
}

.graph-canvas-svg,
.graph-canvas-node-layer {
  position: absolute;
  inset: 0;
}

.graph-canvas-svg {
  pointer-events: none;
}

.graph-canvas-node-layer {
  min-width: 100%;
  min-height: 100%;
}

.graph-canvas-edge {
  fill: none;
  stroke: rgba(148, 163, 184, 0.62);
  stroke-width: 2;
}

.graph-canvas-edge.conditional {
  stroke: rgba(245, 158, 11, 0.72);
  stroke-dasharray: 6 5;
}

.graph-canvas-edge.selected {
  stroke: var(--accent);
  stroke-width: 3;
  stroke-dasharray: none;
}

.graph-canvas-edge.live-active {
  stroke: var(--accent);
  stroke-width: 3;
  stroke-dasharray: 8 6;
  animation: live-edge-flow 1.2s linear infinite;
}

.graph-canvas-arrow {
  fill: rgba(148, 163, 184, 0.8);
}

.graph-canvas-edge-label {
  fill: var(--status-warn);
  font-family: var(--font-mono);
  font-size: 11px;
  text-anchor: middle;
  paint-order: stroke;
  stroke: var(--bg-primary);
  stroke-width: 4px;
  stroke-linejoin: round;
}

.graph-canvas-node {
  position: absolute;
  display: grid;
  align-content: center;
  gap: 4px;
  padding: var(--gap-sm);
  border: 1px solid var(--border);
  border-left-width: 4px;
  border-radius: var(--radius-md);
  background: var(--bg-secondary);
  color: var(--text-primary);
  text-align: left;
  box-shadow: var(--shadow-md);
  transition: all var(--transition-fast);
}

.graph-canvas-node:hover {
  background: var(--bg-elevated);
  box-shadow: 0 0 0 3px var(--accent-dim), var(--shadow-lg);
  transform: translateY(-2px);
}

.graph-canvas-node:active {
  transform: none;
}

.graph-canvas-node.selected {
  border-color: var(--ui-accent);
  box-shadow: 0 0 0 3px var(--ui-accent-soft), var(--shadow-lg);
}

.graph-canvas-node.live-queued {
  border-color: rgba(148, 163, 184, 0.72);
  box-shadow: 0 0 0 3px rgba(148, 163, 184, 0.14), var(--shadow-md);
}

.graph-canvas-node.live-running {
  border-color: rgba(59, 130, 246, 0.82);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.18), var(--shadow-lg);
  animation: live-node-pulse 1.4s ease-in-out infinite;
}

.graph-canvas-node.live-completed {
  border-color: var(--ui-border-strong);
  box-shadow: var(--shadow-md);
}

.graph-canvas-node.live-waiting {
  border-color: rgba(245, 158, 11, 0.82);
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.18), var(--shadow-lg);
}

.graph-canvas-node.live-failed {
  border-color: rgba(239, 68, 68, 0.82);
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.18), var(--shadow-lg);
}

.graph-canvas-node.live-skipped {
  opacity: 0.48;
}

@keyframes live-node-pulse {
  0%,
  100% {
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.14), var(--shadow-lg);
  }
  50% {
    box-shadow: 0 0 0 6px rgba(59, 130, 246, 0.22), var(--shadow-lg);
  }
}

@keyframes live-edge-flow {
  from {
    stroke-dashoffset: 16;
  }
  to {
    stroke-dashoffset: 0;
  }
}

.graph-canvas-node strong,
.graph-canvas-node span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.graph-canvas-node strong {
  font-family: var(--font-mono);
  font-size: 13px;
}

.graph-canvas-node span {
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 11px;
}

.graph-canvas-node .graph-node-type {
  justify-self: start;
  padding: 2px 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-primary);
  color: var(--text-secondary);
}

.graph-canvas-node-intake {
  border-left-color: var(--status-info);
}

.graph-canvas-node-agent {
  border-left-color: var(--accent);
}

.graph-canvas-node-tool,
.graph-canvas-node-workflow {
  border-left-color: var(--status-warn);
}

.graph-canvas-node-approval,
.graph-canvas-node-condition {
  border-left-color: var(--status-error);
}

.graph-canvas-node-final {
  border-left-color: #A78BFA;
}

.graph-node-inspector {
  display: grid;
  grid-template-columns: 1.15fr 1fr 1fr 1.2fr;
  gap: var(--gap-sm);
  align-items: end;
}

.graph-node-config-field {
  grid-column: 1 / span 3;
}

.graph-node-config-field textarea {
  min-height: 92px;
  font-family: var(--font-mono);
  font-size: 12px;
}

.graph-edge-editor {
  display: grid;
  grid-template-columns: minmax(280px, 0.82fr) minmax(0, 1.18fr);
  gap: var(--gap-sm);
  align-items: start;
  padding-top: var(--gap-sm);
  border-top: 1px solid var(--border-subtle);
}

.graph-edge-list-panel,
.graph-edge-form {
  display: grid;
  gap: var(--gap-sm);
  min-width: 0;
}

.graph-edge-list-panel h3 {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 14px;
}

.graph-edge-list {
  display: grid;
  max-height: 220px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-primary);
}

.graph-edge-row {
  display: grid;
  gap: 4px;
  width: 100%;
  padding: var(--gap-sm);
  border: 0;
  border-bottom: 1px solid var(--border-subtle);
  border-radius: 0;
  background: transparent;
  color: var(--text-primary);
  text-align: left;
}

.graph-edge-row:last-child {
  border-bottom: 0;
}

.graph-edge-row:hover {
  background: var(--bg-elevated);
  box-shadow: none;
}

.graph-edge-row:active {
  transform: none;
}

.graph-edge-row.selected {
  background: var(--bg-elevated);
  border-left: 2px solid var(--accent);
}

.graph-edge-row strong,
.graph-edge-row span {
  overflow-wrap: anywhere;
}

.graph-edge-row strong {
  font-family: var(--font-mono);
  font-size: 12px;
}

.graph-edge-row span {
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 11px;
}

.graph-edge-form {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.graph-edge-form label {
  display: grid;
  gap: var(--gap-xs);
}

.graph-edge-form span {
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 12px;
}

.graph-edge-actions {
  display: flex;
  gap: var(--gap-xs);
  justify-content: flex-end;
  flex-wrap: wrap;
  grid-column: 1 / -1;
}

.graph-edge-actions button {
  justify-self: auto;
}

.graph-spec-editor {
  min-height: 420px;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.5;
}

.graph-validation-list {
  display: grid;
}

.graph-validation-item {
  display: grid;
  gap: var(--gap-xs);
  padding: var(--gap-md);
  border-bottom: 1px solid var(--border-subtle);
}

.graph-validation-item:last-child {
  border-bottom: 0;
}

.graph-validation-item strong {
  font-family: var(--font-mono);
  font-size: 13px;
}

.graph-validation-item span {
  color: var(--text-secondary);
  font-size: 14px;
}

.graph-validation-item.error strong {
  color: var(--status-error);
}

.graph-validation-item.warning strong {
  color: var(--status-warn);
}

.graph-action-result {
  min-height: 120px;
  margin: 0;
  padding: var(--gap-md);
  border-top: 1px solid var(--border);
  background: var(--bg-primary);
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.run-detail {
  display: grid;
}

.run-detail-summary {
  display: grid;
  gap: var(--gap-md);
  padding: var(--gap-md);
  border-bottom: 1px solid var(--border);
}

.run-detail-summary h3 {
  margin: 0;
  font-size: 16px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.run-detail-title-row {
  display: flex;
  gap: var(--gap-sm);
  align-items: flex-start;
  justify-content: space-between;
}

.run-review-link {
  min-height: 34px;
  padding: 7px 12px;
  white-space: nowrap;
}

.run-detail-summary pre {
  margin: 0;
  padding: var(--gap-md);
  background: var(--bg-primary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.run-technical-mode {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background: rgba(11, 17, 32, 0.32);
}

.run-technical-mode summary {
  cursor: pointer;
  padding: 8px var(--gap-sm);
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 12px;
}

.run-technical-mode-body {
  display: grid;
  gap: 4px;
  padding: 0 var(--gap-sm) var(--gap-sm);
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.run-signals {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--gap-sm);
  border-top: 1px solid var(--border-subtle);
  padding-top: var(--gap-sm);
}

.run-signal {
  display: grid;
  align-content: start;
  gap: 5px;
  min-width: 0;
  padding: 0 0 0 var(--gap-sm);
  border-left: 2px solid var(--border-subtle);
}

.run-signal-label,
.run-signal-meta {
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 12px;
}

.run-signal-value {
  overflow-wrap: anywhere;
  font-family: var(--font-mono);
  font-size: 13px;
}

.run-signal-meta {
  overflow-wrap: anywhere;
}

.run-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.run-chip {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 2px 7px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background: var(--bg-primary);
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.run-chip.ok {
  color: var(--status-ok);
  border-color: rgba(34, 197, 94, 0.35);
}

.run-chip.warn {
  color: var(--status-warn);
  border-color: rgba(245, 158, 11, 0.35);
}

.run-chip.error {
  color: var(--status-error);
  border-color: rgba(239, 68, 68, 0.35);
}

.run-operations {
  display: grid;
  gap: var(--gap-md);
  padding: var(--gap-md);
  border-bottom: 1px solid var(--border);
}

.run-operation-block {
  display: grid;
  gap: var(--gap-sm);
}

.run-operation-block h3 {
  margin: 0;
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 13px;
}

.run-source-list,
.run-tool-list {
  display: grid;
  gap: var(--gap-sm);
}

.run-source-item,
.run-tool-item {
  display: grid;
  gap: var(--gap-xs);
  padding: var(--gap-sm);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: rgba(11, 17, 32, 0.44);
}

.run-source-item strong,
.run-tool-header strong {
  overflow-wrap: anywhere;
  font-family: var(--font-mono);
  font-size: 13px;
}

.run-source-item span,
.run-tool-header span {
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.run-source-item p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.run-tool-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--gap-xs);
  justify-content: space-between;
}

.run-tool-item details {
  margin-top: 2px;
}

.run-tool-item summary {
  cursor: pointer;
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 12px;
}

.run-tool-item pre {
  margin: var(--gap-xs) 0 0;
  max-height: 220px;
  overflow: auto;
  padding: var(--gap-sm);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background: var(--bg-primary);
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.5;
}

.run-approval-link {
  justify-self: start;
  color: var(--status-warn);
  font-family: var(--font-mono);
  font-size: 13px;
}

.timeline-list {
  display: grid;
}

.timeline-item {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  gap: var(--gap-sm);
  padding: var(--gap-md);
  border-bottom: 1px solid var(--border-subtle);
}

.timeline-item:last-child {
  border-bottom: 0;
}

.timeline-marker {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  color: var(--text-secondary);
  background: var(--bg-primary);
  font-family: var(--font-mono);
  font-size: 12px;
}

.timeline-body {
  display: grid;
  gap: var(--gap-xs);
  min-width: 0;
}

.timeline-heading {
  display: flex;
  gap: var(--gap-sm);
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
}

.timeline-heading strong {
  font-family: var(--font-mono);
  font-size: 14px;
}

.timeline-heading span,
.timeline-actor {
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 12px;
}

.timeline-body p {
  margin: 0;
  color: var(--text-secondary);
  overflow-wrap: anywhere;
}

.timeline-body details {
  margin-top: var(--gap-xs);
}

.timeline-body summary {
  cursor: pointer;
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 12px;
}

.timeline-body pre {
  margin: var(--gap-xs) 0 0;
  max-height: 260px;
  overflow: auto;
  padding: var(--gap-sm);
  background: var(--bg-primary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.5;
}

.timeline-error .timeline-marker {
  color: var(--status-error);
  border-color: rgba(239, 68, 68, 0.4);
}

.timeline-approval .timeline-marker {
  color: var(--status-warn);
  border-color: rgba(245, 158, 11, 0.4);
}

.timeline-tool .timeline-marker {
  color: var(--status-info);
  border-color: rgba(59, 130, 246, 0.4);
}

.timeline-model .timeline-marker {
  color: var(--accent);
  border-color: var(--ui-accent);
}

/* ─── Nodes ──────────────────────────────────────────────── */

.node-panel + .node-panel {
  margin-top: var(--gap-md);
}

.node-body {
  display: grid;
  gap: var(--gap-sm);
  padding: var(--gap-md);
}

.node-panel header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--gap-sm) var(--gap-md);
}

.node-header-actions {
  display: flex;
  gap: var(--gap-xs);
}

.node-header-actions button {
  font-size: 12px;
  padding: 4px 10px;
}

.node-header-actions button[data-action="delete"] {
  color: var(--status-error);
  border-color: var(--status-error);
}

.node-body p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 14px;
}

.node-profile {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--gap-md);
}

.node-profile div:first-child {
  display: grid;
  gap: var(--gap-xs);
}

.node-profile-meta {
  color: var(--text-secondary);
  font-size: 12px;
  font-family: var(--font-mono);
}

.discovery-row {
  gap: var(--gap-xs);
}

.discovery-actions {
  display: flex;
  gap: var(--gap-xs);
  align-items: center;
  justify-content: space-between;
}

.discovery-actions span {
  font-size: 12px;
  font-family: var(--font-mono);
  color: var(--text-secondary);
}

.discovery-backend-select {
  font-size: 12px;
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-mono);
  transition: border-color var(--transition-fast);
}

.discovery-backend-select:focus {
  outline: none;
  border-color: var(--accent);
}

/* ─── Playground ─────────────────────────────────────────── */

.playground-shell {
  width: min(1280px, calc(100% - 48px));
}

.playground-layout {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  min-height: 640px;
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--bg-glass);
  backdrop-filter: blur(12px);
}

.conversation-sidebar {
  border-right: 1px solid var(--border-glass);
  background: var(--bg-primary);
}

.sidebar-header,
.playground-toolbar {
  display: flex;
  gap: var(--gap-sm);
  align-items: center;
  padding: var(--gap-md);
  border-bottom: 1px solid var(--border-glass);
}

.sidebar-header h2 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  font-family: var(--font-mono);
  color: var(--text-primary);
}

.iconish {
  padding: 8px 10px;
}

.conversation-list {
  display: grid;
}

.conversation-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  border-bottom: 1px solid var(--border-subtle);
}

.conversation-item {
  justify-self: stretch;
  border-radius: 0;
  border: 0;
  background: transparent;
  color: var(--text-secondary);
  text-align: left;
  padding: var(--gap-sm) var(--gap-md);
  font-size: 14px;
  font-family: var(--font-mono);
  transition: color var(--transition-fast), background var(--transition-fast);
  cursor: pointer;
}

.conversation-item:hover {
  color: var(--text-primary);
  background: var(--bg-elevated);
}

.conversation-item.active {
  background: var(--bg-secondary);
  color: var(--accent);
  border-left: 2px solid var(--accent);
}

.conversation-delete {
  align-self: stretch;
  border-radius: 0;
  border: 0;
  border-left: 1px solid var(--border-subtle);
  font-size: 12px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: color var(--transition-fast), background var(--transition-fast);
}

.conversation-delete:hover {
  color: var(--status-error);
  background: rgba(239, 68, 68, 0.1);
}

.playground-main {
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  min-width: 0;
}

.playground-toolbar {
  justify-content: flex-start;
  flex-wrap: wrap;
}

.playground-toolbar label {
  display: grid;
  gap: var(--gap-xs);
}

.playground-toolbar .model-picker {
  min-width: min(360px, 100%);
}

.playground-toolbar span {
  color: var(--text-secondary);
  font-size: 12px;
  font-family: var(--font-mono);
}

.playground-switch {
  display: inline-flex !important;
  grid-auto-flow: column;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-secondary);
  cursor: pointer;
  user-select: none;
}

.playground-switch input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.switch-track {
  position: relative;
  width: 36px;
  height: 20px;
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
  background: var(--bg-primary);
  transition: border-color var(--transition-fast), background var(--transition-fast);
}

.switch-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: var(--text-muted);
  transition: transform var(--transition-fast), background var(--transition-fast);
}

.playground-switch input:checked + .switch-track {
  border-color: var(--ui-accent);
  background: var(--ui-accent-soft);
}

.playground-switch input:checked + .switch-track .switch-thumb {
  transform: translateX(16px);
  background: var(--accent);
}

.playground-switch input:focus-visible + .switch-track {
  box-shadow: 0 0 0 3px var(--accent-dim);
}

.playground-switch input:disabled + .switch-track,
.playground-switch input:disabled ~ .switch-label {
  opacity: 0.55;
}

.switch-label {
  color: var(--text-primary) !important;
  font-weight: 700;
}

.model-meta {
  display: grid;
  gap: var(--gap-xs);
  padding: var(--gap-sm) var(--gap-md);
  border-bottom: 1px solid var(--border-glass);
}

.model-meta button {
  justify-self: start;
  margin-top: var(--gap-xs);
}

.model-meta span {
  color: var(--text-secondary);
  font-size: 13px;
  font-family: var(--font-mono);
}

.model-meta em {
  font-style: normal;
  font-size: 12px;
  color: var(--text-muted);
}

.runtime-detail {
  overflow-wrap: anywhere;
  font-family: var(--font-mono);
  font-size: 13px;
}

.runtime-warning {
  color: var(--status-warn) !important;
}

.runtime-log-panel {
  border-top: 1px solid var(--border);
  padding-top: var(--gap-xs);
}

.runtime-log-panel summary {
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 13px;
  font-family: var(--font-mono);
  transition: color var(--transition-fast);
}

.runtime-log-panel summary:hover {
  color: var(--text-primary);
}

.runtime-log-panel pre {
  margin: var(--gap-xs) 0 0;
  max-height: 220px;
  overflow: auto;
  padding: var(--gap-sm);
  background: var(--bg-primary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-secondary);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* ─── Messages ───────────────────────────────────────────── */

.messages {
  min-height: 360px;
  padding: var(--gap-md);
  border: 0;
  background: transparent;
}

.playground-messages {
  min-height: 0;
  overflow-y: auto;
  border: 0;
  padding: var(--gap-md);
}

.message {
  max-width: 85%;
  margin-bottom: var(--gap-sm);
  padding: var(--gap-sm) var(--gap-md);
  border-radius: var(--radius-lg);
  font-size: 14px;
  line-height: 1.6;
  transition: transform var(--transition-fast);
  animation: messageSlideIn 300ms ease-out;
}

.message-body {
  min-width: 0;
}

.message-actions {
  display: flex;
  justify-content: flex-end;
  min-height: 26px;
  margin-top: 4px;
}

.message-edit {
  justify-self: auto;
  width: 26px;
  min-width: 26px;
  height: 26px;
  min-height: 26px;
  padding: 0;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  box-shadow: none;
}

.message-edit:hover,
.message-edit:focus-visible {
  color: var(--text-primary);
  border-color: var(--accent);
  background: var(--accent-dim);
  box-shadow: none;
}

@keyframes messageSlideIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.message.user {
  margin-left: auto;
  background: var(--ui-accent-soft);
  border: 1px solid var(--ui-accent);
  color: var(--text-primary);
  white-space: pre-wrap;
}

.message.assistant {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-glass);
  color: var(--text-primary);
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.message.assistant p {
  margin: 0 0 var(--gap-sm) 0;
}

.message.assistant p:last-child {
  margin-bottom: 0;
}

.message.assistant pre {
  background: var(--bg-primary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: var(--gap-sm) var(--gap-md);
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.5;
  margin: var(--gap-sm) 0;
}

.message.assistant code {
  background: var(--bg-primary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 2px 6px;
  font-family: var(--font-mono);
  font-size: 13px;
}

.message.assistant pre code {
  background: none;
  border: none;
  padding: 0;
}

.message.assistant ul,
.message.assistant ol {
  margin: var(--gap-xs) 0;
  padding-left: var(--gap-md);
}

.message.assistant li {
  margin-bottom: var(--gap-xs);
}

.message.assistant strong {
  font-weight: 600;
  color: var(--text-primary);
}

.message.assistant .assistant-section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: var(--gap-md) 0 var(--gap-xs);
  color: var(--text-primary);
  font-size: 14px;
}

.message.assistant .assistant-section-title::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--accent);
  flex: 0 0 auto;
}

.message.assistant .math-inline,
.message.assistant .math-display {
  font-family: "Cambria Math", "STIX Two Math", "Times New Roman", serif;
  font-size: 1.04em;
  overflow-wrap: normal;
  word-break: normal;
}

.message.assistant .math-display {
  display: block;
  width: fit-content;
  max-width: 100%;
  margin: 6px 0 var(--gap-sm);
  padding: 7px 10px;
  overflow-x: auto;
  background: var(--bg-primary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  white-space: nowrap;
}

.message.assistant .math-inline {
  display: inline;
  padding: 0 2px;
  white-space: nowrap;
  vertical-align: baseline;
}

.message.assistant .math-frac {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  margin: 0 0.12em;
  line-height: 1.05;
  vertical-align: middle;
}

.message.assistant .math-frac > span:first-child {
  display: block;
  width: 100%;
  min-width: 1.4em;
  padding: 0 0.18em 1px;
  border-bottom: 1px solid currentColor;
  text-align: center;
}

.message.assistant .math-frac > span:last-child {
  display: block;
  padding: 1px 0.18em 0;
  text-align: center;
}

.message.assistant .math-sqrt {
  display: inline-flex;
  align-items: flex-start;
  gap: 1px;
}

.message.assistant .math-sqrt > span {
  border-top: 1px solid currentColor;
  padding: 0 0.18em;
}

.message.assistant .math-op {
  font-style: normal;
}

.message.assistant h1,
.message.assistant h2,
.message.assistant h3,
.message.assistant h4 {
  margin: var(--gap-sm) 0 var(--gap-xs);
  font-weight: 600;
  font-size: 15px;
}

.message.assistant blockquote {
  border-left: 3px solid var(--accent);
  padding-left: var(--gap-sm);
  margin: var(--gap-sm) 0;
  color: var(--text-secondary);
}

.message.assistant a {
  color: var(--accent);
  text-decoration: underline;
}

.message.assistant hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: var(--gap-sm) 0;
}

.message.assistant .markdown-table-wrap {
  margin: var(--gap-sm) 0;
  overflow-x: auto;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
}

.message.assistant .markdown-table-wrap:last-child {
  margin-bottom: 0;
}

.message.assistant table {
  width: 100%;
  min-width: 520px;
  border-collapse: collapse;
  font-size: 13px;
}

.message.assistant th,
.message.assistant td {
  padding: 8px 10px;
  border-right: 1px solid var(--border-subtle);
  border-bottom: 1px solid var(--border-subtle);
  text-align: left;
  vertical-align: top;
}

.message.assistant th:last-child,
.message.assistant td:last-child {
  border-right: 0;
}

.message.assistant th {
  background: var(--bg-primary);
  color: var(--text-muted);
  font-weight: 600;
}

.message.assistant tbody tr:last-child td {
  border-bottom: 0;
}

.message.pending {
  color: var(--text-secondary);
}

.chat-empty {
  padding: 0;
}

.muted {
  margin: 0;
  padding: var(--gap-md);
  color: var(--text-secondary);
  font-size: 14px;
}

/* ─── Loading Dots ───────────────────────────────────────── */

.loading-dots {
  display: inline-flex;
  width: 24px;
  margin-left: 4px;
}

.loading-dots::after {
  content: "...";
  overflow: hidden;
  width: 0;
  animation: loading-dots 1.2s steps(4, end) infinite;
}

@keyframes loading-dots {
  to {
    width: 24px;
  }
}

/* ─── Thinking Indicator ─────────────────────────────────── */

.thinking-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-secondary);
  font-size: 13px;
  font-style: italic;
}

.thinking-dots {
  display: flex;
  gap: 4px;
}

.thinking-dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-secondary);
  animation: thinking-bounce 1.4s ease-in-out infinite;
}

.thinking-dots span:nth-child(2) {
  animation-delay: 0.2s;
}

.thinking-dots span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes thinking-bounce {
  0%, 80%, 100% {
    transform: scale(0.6);
    opacity: 0.4;
  }
  40% {
    transform: scale(1);
    opacity: 1;
  }
}

/* ─── Composer / Forms ───────────────────────────────────── */

.composer {
  display: grid;
  gap: var(--gap-sm);
  padding: var(--gap-md);
  border-top: 1px solid var(--border-glass);
  background: var(--bg-primary);
}

.composer.editing textarea {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

.composer-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--gap-sm);
  flex-wrap: wrap;
}

.composer-actions button {
  justify-self: auto;
}

textarea {
  width: 100%;
  resize: vertical;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-secondary);
  color: var(--text-primary);
  padding: var(--gap-sm) var(--gap-md);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.5;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

textarea::placeholder {
  color: var(--text-muted);
}

select,
input {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-secondary);
  color: var(--text-primary);
  padding: var(--gap-xs) var(--gap-sm);
  font-family: var(--font-body);
  font-size: 14px;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

select:focus,
input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

/* ─── Buttons ────────────────────────────────────────────── */

button {
  justify-self: end;
  border: 0;
  border-radius: var(--radius-md);
  padding: 10px 18px;
  background: var(--accent);
  color: #052e16;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}

button:hover {
  background: var(--accent-hover);
  box-shadow: var(--shadow-glow);
  transform: translateY(-1px);
}

button:active {
  transform: scale(0.98) translateY(0);
}

button.secondary {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border);
}

button.secondary:hover {
  background: var(--bg-elevated);
  border-color: var(--text-muted);
  box-shadow: none;
  transform: none;
}

.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: var(--radius-md);
  padding: 10px 18px;
  background: var(--accent);
  color: #052e16;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
}

.button-link.secondary {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border);
}

.button-link.disabled,
.button-link[aria-disabled="true"] {
  pointer-events: none;
  opacity: 0.45;
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

/* ─── Catalog / Library ──────────────────────────────────── */

.catalog-layout {
  display: grid;
  grid-template-columns: minmax(420px, 1fr) minmax(360px, 440px);
  gap: var(--gap-md);
}

.catalog-shell {
  width: min(1280px, calc(100% - 48px));
}

.models-shell {
  width: min(1360px, calc(100% - 48px));
}

.model-workspace {
  display: grid;
  gap: var(--gap-md);
  min-width: 0;
}

.models-shell .library-view,
.models-shell .library-view-grid,
.models-shell .library-list-panel,
.models-shell .library-editor-panel,
.models-shell .library-view-grid > *,
.models-shell .catalog-form,
.models-shell .catalog-form label {
  min-width: 0;
}

.models-shell input,
.models-shell select,
.models-shell textarea {
  max-width: 100%;
  min-width: 0;
}

.library-tabs {
  display: inline-flex;
  width: fit-content;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-secondary);
}

.library-tab {
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  padding: 6px 14px;
  border: 0;
  cursor: pointer;
  transition: color var(--transition-fast), background var(--transition-fast);
}

.library-tab:hover {
  color: var(--text-primary);
}

.library-tab.active {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.library-view {
  display: none;
}

.library-view.active {
  display: block;
}

.library-view-grid {
  display: grid;
  grid-template-columns: minmax(360px, 0.92fr) minmax(420px, 1.08fr);
  gap: var(--gap-md);
  align-items: start;
}

.panel-heading {
  display: flex;
  gap: var(--gap-md);
  align-items: center;
  justify-content: space-between;
}

.panel-heading h2 {
  margin-bottom: 4px;
  font-family: var(--font-mono);
  font-size: 15px;
}

.panel-meta {
  margin: 0;
  color: var(--text-secondary);
  font-size: 12px;
  font-family: var(--font-mono);
}

.library-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: var(--gap-md);
  align-items: start;
  padding: var(--gap-md);
  border-bottom: 1px solid var(--border-subtle);
  transition: background var(--transition-fast);
}

.library-row:hover {
  background: var(--bg-elevated);
}

.library-row:last-child {
  border-bottom: 0;
}

.library-row.selected {
  background: var(--bg-elevated);
  border-left: 2px solid var(--accent);
}

.library-row-copy {
  display: grid;
  gap: var(--gap-xs);
  min-width: 0;
}

.library-row-copy span {
  color: var(--text-secondary);
  font-size: 12px;
  font-family: var(--font-mono);
  overflow-wrap: anywhere;
}

.library-row-actions {
  display: flex;
  gap: var(--gap-xs);
  align-items: center;
}

.library-row-actions button {
  justify-self: auto;
}

.readonly-meta {
  padding: var(--gap-md);
  border-bottom: 1px solid var(--border);
}

.form-actions {
  display: flex;
  gap: var(--gap-xs);
  justify-content: flex-end;
}

.form-actions button {
  justify-self: auto;
}

.field-help {
  margin-top: -8px;
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.45;
  font-family: var(--font-mono);
}

.catalog-editor {
  display: grid;
  align-content: start;
  gap: var(--gap-md);
}

.library-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--gap-md);
  align-items: start;
}

.library-subpanel {
  border-top: 1px solid var(--border);
}

.catalog-form {
  display: grid;
  gap: var(--gap-sm);
  padding: var(--gap-md);
}

.catalog-form.compact {
  padding-top: var(--gap-md);
}

.catalog-form label {
  display: grid;
  gap: var(--gap-xs);
}

.catalog-form span {
  color: var(--text-secondary);
  font-size: 12px;
  font-family: var(--font-mono);
}

.catalog-form small {
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.45;
  font-family: var(--font-mono);
}

.panel-note {
  margin: 0;
  padding: 0 var(--gap-md) var(--gap-sm);
  color: var(--text-secondary);
  font-size: 12px;
  font-family: var(--font-mono);
}

.catalog-feedback {
  min-height: 20px;
  padding: 0;
}

.inspection-summary {
  padding: var(--gap-md);
  border-bottom: 1px solid var(--border);
}

.inspection-grid dd {
  overflow-wrap: anywhere;
  font-family: var(--font-mono);
  font-size: 13px;
}

/* ─── Inspection Artifacts Table ─────────────────────────── */

.inspection-artifacts {
  padding: var(--gap-md);
  border-bottom: 1px solid var(--border);
}

.inspection-artifacts h3 {
  margin: 0 0 var(--gap-sm);
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.inspection-artifacts-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-mono);
  font-size: 12px;
}

.inspection-artifacts-table th {
  text-align: left;
  color: var(--text-muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: var(--gap-xs) var(--gap-sm);
  border-bottom: 1px solid var(--border);
}

.inspection-artifacts-table td {
  padding: var(--gap-xs) var(--gap-sm);
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  overflow-wrap: anywhere;
}

.inspection-artifacts-table tr:last-child td {
  border-bottom: 0;
}

.inspection-artifacts-table tr.recommended {
  background: var(--accent-dim);
}

.inspection-artifacts-table tr.recommended td {
  color: var(--text-primary);
}

.inspection-artifacts-table .recommended-badge {
  color: var(--accent);
  font-weight: 600;
}

/* ─── Inspection Actions ─────────────────────────────────── */

.inspection-actions {
  padding: var(--gap-sm) var(--gap-md);
  display: flex;
  gap: var(--gap-sm);
  align-items: center;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--border);
}

.inspection-actions .btn-import-recommended {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border: 1px solid var(--accent);
  border-radius: var(--radius-md);
  background: var(--accent-dim);
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast);
}

.inspection-actions .btn-import-recommended:hover {
  background: var(--accent);
  color: #052e16;
}

.inspection-actions .inspection-note {
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 11px;
  font-style: italic;
}

/* ─── Status Badges ──────────────────────────────────────── */

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-family: var(--font-mono);
  font-weight: 600;
  letter-spacing: 0.02em;
}

.badge-status-ok {
  background: var(--ui-success-soft);
  color: var(--ui-success);
  border: 1px solid var(--ui-border-strong);
}

.badge-status-warn {
  background: rgba(245, 158, 11, 0.12);
  color: var(--status-warn);
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.badge-status-error {
  background: rgba(239, 68, 68, 0.12);
  color: var(--status-error);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.badge-status-info {
  background: rgba(59, 130, 246, 0.12);
  color: var(--status-info);
  border: 1px solid rgba(59, 130, 246, 0.3);
}

.badge-flag {
  background: rgba(168, 85, 247, 0.12);
  color: #A78BFA;
  border: 1px solid rgba(168, 85, 247, 0.3);
}

/* ─── Inspection Error Panel ─────────────────────────────── */

.inspection-error {
  padding: var(--gap-md);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: var(--radius-md);
  background: rgba(239, 68, 68, 0.08);
  margin: var(--gap-sm) var(--gap-md);
}

.inspection-error h3 {
  margin: 0 0 var(--gap-xs);
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--status-error);
}

.inspection-error p {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.inspection-error .error-status {
  display: inline-block;
  margin-right: 6px;
  font-weight: 700;
}

/* ─── Approval Panels ────────────────────────────────────── */

.approval-panel {
  overflow: hidden;
}

.approval-panel > header {
  display: flex;
  gap: var(--gap-sm);
  align-items: center;
  justify-content: space-between;
}

.approval-row {
  display: flex;
  gap: var(--gap-md);
  align-items: center;
  justify-content: space-between;
  padding: var(--gap-md);
  border-bottom: 1px solid var(--border-subtle);
  transition: background var(--transition-fast);
}

.approval-row:hover {
  background: var(--bg-elevated);
}

.approval-row:last-child {
  border-bottom: 0;
}

.approval-row h2 {
  margin: 0 0 var(--gap-xs);
  font-size: 15px;
  font-weight: 600;
  font-family: var(--font-mono);
}

.approval-row p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 14px;
}

.approval-run-link {
  display: inline-flex;
  margin-top: var(--gap-xs);
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 12px;
  text-decoration: none;
}

.approval-run-link:hover {
  text-decoration: underline;
}

.approval-actions {
  display: flex;
  gap: var(--gap-xs);
}

.approval-meta {
  display: flex;
  gap: var(--gap-xs);
  align-items: center;
  flex-wrap: wrap;
  margin-top: var(--gap-xs);
}

.policy-pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  background: var(--bg-primary);
  font-family: var(--font-mono);
  font-size: 12px;
}

.approval-reason {
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 12px;
}

.approval-details {
  margin-top: var(--gap-sm);
}

.approval-details summary {
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 700;
}

.approval-details pre {
  max-height: 320px;
  margin: var(--gap-xs) 0 0;
  padding: var(--gap-sm);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-primary);
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.5;
  overflow: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* ─── Modals ─────────────────────────────────────────────── */

.modal-dialog {
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-xl);
  padding: 0;
  max-width: 520px;
  width: 90%;
  background: var(--bg-glass);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  color: var(--text-primary);
  box-shadow: var(--shadow-lg);
}

.modal-dialog::backdrop {
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
}

.modal-dialog form {
  padding: var(--gap-lg);
}

.modal-dialog header {
  margin-bottom: var(--gap-md);
}

.modal-dialog header h2 {
  font-family: var(--font-mono);
  font-size: 18px;
  font-weight: 600;
}

.modal-actions {
  display: flex;
  gap: var(--gap-xs);
  justify-content: flex-end;
  margin-top: var(--gap-md);
}

/* ─── Status Badges ──────────────────────────────────────── */

.status-badge {
  display: inline-block;
  padding: 6px 14px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font-mono);
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  transition: background-color var(--transition-base), color var(--transition-base);
}

.status-badge.status-ok {
  background: var(--ui-success-soft);
  color: var(--ui-success);
  border: 1px solid var(--ui-border-strong);
}

.status-badge.status-loading {
  background: rgba(59, 130, 246, 0.12);
  color: var(--status-info);
  border: 1px solid rgba(59, 130, 246, 0.3);
}

.status-badge.status-error {
  background: rgba(239, 68, 68, 0.12);
  color: var(--status-error);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.status-ok {
  color: var(--accent);
}

.status-warn {
  color: var(--status-warn);
}

/* ─── Reconcile Status Badges ────────────────────────────── */

.status-badge.status-idle {
  background: rgba(100, 116, 139, 0.12);
  color: var(--text-muted);
  border: 1px solid rgba(100, 116, 139, 0.2);
}

.status-badge.status-warning {
  background: rgba(245, 158, 11, 0.12);
  color: var(--status-warn);
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.status-badge.status-inactive {
  background: rgba(100, 116, 139, 0.08);
  color: var(--text-muted);
  border: 1px dashed rgba(100, 116, 139, 0.25);
  font-style: italic;
}

.reconcile-error-wrapper {
  display: flex;
  align-items: center;
  gap: var(--gap-xs);
  flex-wrap: wrap;
}

.btn-retry {
  background: transparent;
  color: var(--status-warn);
  border: 1px solid rgba(245, 158, 11, 0.3);
  padding: 4px 10px;
  font-size: 12px;
  box-shadow: none;
}

.btn-retry:hover {
  background: rgba(245, 158, 11, 0.1);
  color: var(--status-warn);
  border-color: rgba(245, 158, 11, 0.5);
  box-shadow: none;
}

.btn-retry:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ─── Utilities ──────────────────────────────────────────── */

.hidden {
  display: none;
}

.toggle-row {
  display: flex !important;
  align-items: center;
  gap: var(--gap-xs);
}

.toggle-row input {
  width: auto;
}

.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;
}

/* ─── Alerts & Flash Messages ────────────────────────────── */

.alert {
  padding: var(--gap-sm) var(--gap-md);
  border-radius: var(--radius-md);
  font-size: 14px;
  line-height: 1.5;
  display: flex;
  align-items: flex-start;
  gap: var(--gap-sm);
}

.alert svg {
  flex-shrink: 0;
  margin-top: 2px;
}

.alert-warning {
  color: var(--status-warn);
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.alert-error,
.alert-danger {
  color: var(--status-error);
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.alert-success {
  color: var(--status-ok);
  background: var(--ui-success-soft);
  border: 1px solid var(--ui-border-strong);
}

.alert-info {
  color: var(--status-info);
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid rgba(59, 130, 246, 0.3);
}

.flash-messages {
  padding: var(--gap-md) var(--gap-md) 0;
}

.flash-message {
  padding: var(--gap-sm) var(--gap-md);
  border-radius: var(--radius-md);
  font-size: 14px;
  margin-bottom: var(--gap-sm);
  display: flex;
  align-items: center;
  gap: var(--gap-sm);
}

.flash-message.error {
  color: var(--status-error);
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.flash-message.success {
  color: var(--status-ok);
  background: var(--ui-success-soft);
  border: 1px solid var(--ui-border-strong);
}

/* ─── Panel Content ──────────────────────────────────────── */

.panel-content {
  padding: var(--gap-md);
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.panel-body {
  padding: var(--gap-md);
}

/* ─── Empty States ───────────────────────────────────────── */

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--gap-xl) var(--gap-md);
  text-align: center;
  color: var(--text-secondary);
}

.empty-state svg {
  margin-bottom: var(--gap-md);
  opacity: 0.4;
}

.empty-state h3 {
  margin: 0 0 var(--gap-xs);
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  font-family: var(--font-mono);
}

.empty-state p {
  margin: 0 0 var(--gap-md);
  font-size: 14px;
  max-width: 320px;
}

.empty-state button,
.empty-state a {
  margin-top: var(--gap-xs);
}

/* ─── Toast Notifications ────────────────────────────────── */

.toast {
  padding: var(--gap-sm) var(--gap-md);
  border-radius: var(--radius-md);
  font-size: 14px;
  font-family: var(--font-body);
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-glass);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: var(--gap-sm);
  min-width: 280px;
  max-width: 400px;
  animation: toast-in 300ms ease forwards;
}

.toast.success {
  border-color: rgba(34, 197, 94, 0.3);
}

.toast.success svg {
  color: var(--accent);
}

.toast.error {
  border-color: rgba(239, 68, 68, 0.3);
}

.toast.error svg {
  color: var(--status-error);
}

.toast-text {
  flex: 1;
  color: var(--text-primary);
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ─── Spinners ───────────────────────────────────────────── */

.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: var(--radius-full);
  animation: spin 0.6s linear infinite;
}

.spinner-sm {
  width: 12px;
  height: 12px;
  border-width: 1.5px;
}

.spinner-lg {
  width: 24px;
  height: 24px;
  border-width: 3px;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.loading-text {
  display: flex;
  align-items: center;
  gap: var(--gap-sm);
  color: var(--text-secondary);
  font-size: 14px;
  font-family: var(--font-mono);
}

/* ─── Icon Buttons ───────────────────────────────────────── */

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--gap-xs);
  line-height: 1;
}

.btn-icon svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.icon-only {
  padding: 8px;
  min-width: 36px;
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.icon-only svg {
  width: 16px;
  height: 16px;
}

/* ─── Skip Link ──────────────────────────────────────────── */

.skip-link {
  position: absolute;
  top: -100%;
  left: var(--gap-md);
  z-index: 10000;
  padding: var(--gap-sm) var(--gap-md);
  background: var(--accent);
  color: #052e16;
  font-weight: 600;
  border-radius: var(--radius-md);
  text-decoration: none;
  transition: top var(--transition-fast);
}

.skip-link:focus {
  top: var(--gap-md);
}

/* ─── Code / Terminal ────────────────────────────────────── */

.code-block {
  background: var(--bg-primary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: var(--gap-md);
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-secondary);
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-all;
}

.command-preview {
  background: var(--bg-primary);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: var(--gap-md);
  font-family: var(--font-mono);
  font-size: 13px;
}

/* ─── Utility Spacing ────────────────────────────────────── */

.m-0 { margin: 0; }
.mt-xs { margin-top: var(--gap-xs); }
.mt-sm { margin-top: var(--gap-sm); }
.mt-md { margin-top: var(--gap-md); }
.mb-xs { margin-bottom: var(--gap-xs); }
.mb-sm { margin-bottom: var(--gap-sm); }
.mb-md { margin-bottom: var(--gap-md); }
.p-xs { padding: var(--gap-xs); }
.p-sm { padding: var(--gap-sm); }
.p-md { padding: var(--gap-md); }
.gap-xs { gap: var(--gap-xs); }
.gap-sm { gap: var(--gap-sm); }
.gap-md { gap: var(--gap-md); }
.text-sm { font-size: 12px; }
.text-mono { font-family: var(--font-mono); }
.text-center { text-align: center; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.w-full { width: 100%; }

/* ─── Scrollbar ──────────────────────────────────────────── */

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
  background: var(--bg-tertiary);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* ═══════════════════════════════════════════════════════════
   NEW: Enhanced Overview / Cockpit
   ═══════════════════════════════════════════════════════════ */

.overview-shell {
  width: min(1280px, calc(100% - 48px));
}

/* Stat Cards - Modernized */
.overview-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--gap-md);
  margin-bottom: var(--gap-lg);
}

.stat-card {
  position: relative;
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  background: var(--bg-glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: var(--gap-lg);
  overflow: hidden;
  transition: all var(--transition-base);
  animation: cardFadeIn 400ms ease-out backwards;
}

.stat-card:nth-child(1) { animation-delay: 0ms; }
.stat-card:nth-child(2) { animation-delay: 80ms; }
.stat-card:nth-child(3) { animation-delay: 160ms; }
.stat-card:nth-child(4) { animation-delay: 240ms; }

@keyframes cardFadeIn {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent-hover));
  opacity: 0;
  transition: opacity var(--transition-base);
}

.stat-card:hover {
  border-color: var(--border-subtle);
  box-shadow: var(--shadow-md), var(--shadow-glow);
  transform: translateY(-4px);
}

.stat-card:hover::before {
  opacity: 1;
}

.stat-card-icon {
  position: absolute;
  top: var(--gap-md);
  right: var(--gap-md);
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: var(--accent-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  opacity: 0.6;
  transition: all var(--transition-fast);
}

.stat-card:hover .stat-card-icon {
  opacity: 1;
  box-shadow: var(--shadow-glow);
}

.stat-card-icon svg {
  width: 20px;
  height: 20px;
}

.stat-card .stat-value {
  display: block;
  font-size: 32px;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--text-primary);
  line-height: 1.1;
  letter-spacing: 0;
}

.stat-card .stat-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-top: var(--gap-xs);
}

.stat-card .stat-detail {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  margin-top: var(--gap-sm);
  padding-top: var(--gap-sm);
  border-top: 1px solid var(--border-glass);
}

.stat-card .stat-detail.status-ok { color: var(--status-ok); }
.stat-card .stat-detail.status-warn { color: var(--status-warn); }
.stat-card .stat-detail.status-error { color: var(--status-error); }

/* Overview Sections */
.overview-sections {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--gap-md);
}

.overview-section {
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  background: var(--bg-glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  overflow: hidden;
  animation: sectionFadeIn 500ms ease-out backwards;
}

.overview-section:nth-child(1) { animation-delay: 300ms; }
.overview-section:nth-child(2) { animation-delay: 400ms; }
.overview-section:nth-child(3) { animation-delay: 500ms; }
.overview-section:nth-child(4) { animation-delay: 600ms; }

@keyframes sectionFadeIn {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.overview-section header {
  padding: var(--gap-md);
  border-bottom: 1px solid var(--border-glass);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.overview-section header h2 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  font-family: var(--font-mono);
  color: var(--text-primary);
}

.overview-section .section-body {
  padding: var(--gap-sm);
}

.overview-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--gap-sm) var(--gap-md);
  border-radius: var(--radius-sm);
  transition: background var(--transition-fast);
}

.overview-item:hover {
  background: var(--bg-glass-light);
}

.overview-item + .overview-item {
  border-top: 1px solid var(--border-subtle);
}

.overview-item-label {
  font-size: 13px;
  color: var(--text-primary);
}

.overview-item-value {
  font-size: 12px;
  font-family: var(--font-mono);
  color: var(--text-secondary);
}

.btn-link {
  color: var(--accent);
  text-decoration: none;
  font-size: 12px;
  font-weight: 600;
  font-family: var(--font-mono);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}

.btn-link:hover {
  background: var(--accent-dim);
}

/* ═══════════════════════════════════════════════════════════
   NEW: Responsive Design
   ═══════════════════════════════════════════════════════════ */

@media (max-width: 980px) {
  .overview-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .agent-stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .models-shell .library-view-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 768px) {
  /* Show mobile toggle */
  .sidebar-toggle {
    display: flex;
  }

  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar-overlay.open {
    display: block;
  }

  .shell-with-sidebar {
    margin-left: 0;
    width: min(100% - 24px, 100%);
    padding: calc(var(--topbar-height) + var(--gap-md)) var(--gap-sm) var(--gap-lg);
  }

  .overview-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .overview-sections {
    grid-template-columns: 1fr;
  }

  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .page-header {
    align-items: stretch;
    flex-direction: column;
  }

  .page-actions {
    justify-content: flex-start;
  }

  .approval-row {
    flex-direction: column;
    align-items: stretch;
  }

  .approval-actions {
    justify-content: flex-end;
  }

  .playground-layout {
    grid-template-columns: 1fr;
  }

  .catalog-layout {
    grid-template-columns: 1fr;
  }

  .library-grid {
    grid-template-columns: 1fr;
  }

  .library-view-grid {
    grid-template-columns: 1fr;
  }

  .runs-grid {
    grid-template-columns: 1fr;
  }

  .run-history-hero,
  .run-row-card {
    align-items: stretch;
    grid-template-columns: 1fr;
  }

  .run-history-hero {
    flex-direction: column;
  }

  .run-history-hero .button-link,
  .run-row-review {
    justify-self: start;
    align-self: flex-start;
  }

  .run-signals {
    grid-template-columns: 1fr;
  }

  .agent-grid,
  .workflow-grid,
  .graph-grid,
  .tool-catalog-grid,
  .tool-summary-grid,
  .tool-filter-grid,
  .tool-stat-grid,
  .tool-schema-grid,
  .agent-model-config-form,
  .agent-form-row,
  .agent-policy-grid,
  .workflow-form-row,
  .workflow-schema-grid,
  .workflow-invoke-row,
  .graph-draft-row,
  .graph-form-row,
  .graph-builder-toolbar,
  .graph-node-inspector,
  .graph-edge-editor,
  .graph-edge-form {
    grid-template-columns: 1fr;
  }

  .graph-node-config-field,
  .graph-edge-actions {
    grid-column: auto;
  }

  .agent-policy-panel,
  .workflow-invoke-panel,
  .graph-validation-panel {
    grid-column: auto;
  }

  .library-tabs {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow-x: auto;
  }

  .library-tab {
    flex: 0 0 auto;
    text-align: center;
  }

  .models-shell .library-view-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .library-row {
    grid-template-columns: 1fr;
  }

  .library-row-actions {
    justify-content: flex-end;
  }

  .conversation-sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  .topbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .topbar nav {
    width: 100%;
    overflow-x: auto;
  }

  .catalog-import-row {
    flex-direction: column;
  }

  .settings-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .settings-row-value {
    max-width: none;
    width: 100%;
  }

  .stat-card .stat-value {
    font-size: 24px;
  }

  .stat-card-icon {
    width: 32px;
    height: 32px;
  }

  .stat-card-icon svg {
    width: 16px;
    height: 16px;
  }
}

@media (max-width: 560px) {
  .overview-grid {
    grid-template-columns: 1fr;
  }

  .agent-stat-grid {
    grid-template-columns: 1fr;
  }

  .shell,
  .shell-with-sidebar {
    width: calc(100% - 16px);
    padding-left: var(--gap-sm);
    padding-right: var(--gap-sm);
  }

  .stat-card {
    padding: var(--gap-md);
  }

  .stat-card .stat-value {
    font-size: 20px;
  }
}

/* ═══════════════════════════════════════════════════════════
   LEGACY: Navigation dropdowns (backward compatibility)
   ═══════════════════════════════════════════════════════════ */

.nav-categories {
  display: flex;
  gap: var(--gap-xs);
  flex-wrap: wrap;
  align-items: center;
}

.nav-dropdown {
  position: relative;
}

.nav-dropdown-toggle {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  font-family: var(--font-body);
  padding: 6px 12px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: color var(--transition-base), background var(--transition-base);
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

.nav-dropdown-toggle::after {
  content: '';
  display: inline-block;
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid currentColor;
  opacity: 0.6;
  transition: transform var(--transition-fast);
}

.nav-dropdown.open .nav-dropdown-toggle::after {
  transform: rotate(180deg);
}

.nav-dropdown-toggle:hover,
.nav-dropdown.open .nav-dropdown-toggle {
  color: var(--accent);
  background: var(--accent-dim);
}

.nav-dropdown-menu {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  min-width: 200px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--gap-xs) 0;
  z-index: 1000;
  box-shadow: var(--shadow-lg);
}

.nav-dropdown.open .nav-dropdown-menu {
  display: block;
  animation: dropdownFadeIn 150ms ease;
}

@keyframes dropdownFadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

.nav-dropdown-menu a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 13px;
  transition: color var(--transition-fast), background var(--transition-fast);
}

.nav-dropdown-menu a:hover {
  color: var(--accent);
  background: var(--accent-dim);
}

.nav-dropdown-menu a.active {
  color: var(--accent);
  background: var(--accent-dim);
  font-weight: 600;
}

/* ─── Settings page ────────────────────────────────────── */

.settings-shell {
  width: min(900px, calc(100% - 48px));
}

.settings-section {
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  background: var(--bg-glass);
  backdrop-filter: blur(12px);
  margin-bottom: var(--gap-md);
}

.settings-section header {
  padding: var(--gap-md);
  border-bottom: 1px solid var(--border-glass);
}

.settings-section header h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  font-family: var(--font-mono);
  color: var(--text-primary);
}

.settings-section header p {
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--text-muted);
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--gap-md);
  border-bottom: 1px solid var(--border-subtle);
  gap: var(--gap-md);
}

.settings-row:last-child {
  border-bottom: none;
}

.settings-row-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  flex-shrink: 0;
  min-width: 160px;
}

.settings-row-label small {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 400;
  margin-top: 2px;
}

.settings-row-value {
  font-size: 13px;
  font-family: var(--font-mono);
  color: var(--text-secondary);
  background: var(--bg-tertiary);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  flex: 1;
  max-width: 400px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.settings-row-value.status-ok { color: var(--status-ok); }
.settings-row-value.status-error { color: var(--status-error); }
.settings-row-value.status-warn { color: var(--status-warn); }

/* Web settings */

.web-settings-shell {
  width: min(1280px, calc(100% - 48px));
}

.web-topbar {
  align-items: flex-start;
}

.web-summary {
  margin-top: 4px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 12px;
}

.web-status-panel {
  padding: var(--gap-md);
}

.web-status-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: var(--gap-sm);
}

.web-tab-panel[hidden] {
  display: none;
}

.web-test-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--gap-md);
  align-items: start;
}

.web-status-item {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-tertiary);
  padding: 10px 12px;
  min-width: 0;
}

.web-status-item span,
.web-status-item strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.web-status-item span {
  color: var(--text-muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0;
}

.web-status-item strong {
  margin-top: 6px;
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
}

.web-status-item strong.status-ok { color: var(--status-ok); }
.web-status-item strong.status-warn { color: var(--status-warn); }
.web-status-item strong.status-error { color: var(--status-error); }

.web-workspace header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--gap-md);
}

.web-form-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--gap-md);
  padding: var(--gap-md);
}

.web-search-layout {
  display: grid;
  grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
  gap: var(--gap-md);
  padding: var(--gap-md);
}

.web-engine-panel,
.web-live-panel,
.web-markdown-layout {
  min-width: 0;
}

.web-mode-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-tertiary);
  margin-bottom: var(--gap-sm);
}

.web-mode-tabs button {
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  padding: 8px 10px;
  font: inherit;
  cursor: pointer;
}

.web-mode-tabs button.active {
  background: var(--accent-dim);
  color: var(--accent);
}

.web-engine-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: var(--gap-sm);
}

.web-engine-card {
  min-height: 58px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  padding: 9px 10px;
  text-align: left;
  cursor: pointer;
}

.web-engine-card.active {
  border-color: var(--accent);
  background: var(--accent-dim);
  color: var(--text-primary);
}

.web-engine-card strong,
.web-engine-card span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.web-engine-card strong {
  font-size: 13px;
  font-weight: 600;
}

.web-engine-card span {
  margin-top: 4px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 11px;
}

.web-inline-row,
.web-command-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: var(--gap-sm);
  margin-bottom: var(--gap-md);
}

.web-inline-row input,
.web-command-row input {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-tertiary);
  color: var(--text-primary);
  padding: 9px 10px;
  font: inherit;
}

.web-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  font-size: 12px;
  color: var(--text-muted);
}

.web-field span,
.web-toggle-field span {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
}

.web-field small,
.web-toggle-field small {
  display: block;
  margin-top: 2px;
  font-size: 11px;
  font-weight: 400;
  color: var(--text-muted);
}

.web-field input,
.web-field select,
.web-field textarea,
.web-test-row input {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-tertiary);
  color: var(--text-primary);
  padding: 9px 10px;
  font: inherit;
}

.web-field textarea {
  resize: vertical;
  min-height: 76px;
}

.web-toggle-field {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-tertiary);
  padding: 10px 12px;
}

.web-toggle-field input,
.web-engine-option input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

.web-engine-row {
  align-items: flex-start;
}

.web-engine-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.web-engine-option {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-tertiary);
  padding: 7px 10px;
  color: var(--text-secondary);
  font-size: 13px;
}

.web-test-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: var(--gap-sm);
  padding: var(--gap-md);
}

.web-test-output {
  min-height: 180px;
}

.web-markdown-layout {
  padding: var(--gap-md);
}

.web-result-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: var(--gap-sm);
}

.web-result-meta span {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  padding: 4px 8px;
  font-family: var(--font-mono);
  font-size: 12px;
}

.web-result-item {
  display: block;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  text-decoration: none;
  padding: 10px 12px;
  margin-top: 8px;
  background: var(--bg-secondary);
}

.web-result-item strong,
.web-result-item span,
.web-result-item small {
  display: block;
  overflow-wrap: anywhere;
}

.web-result-item strong {
  color: var(--text-primary);
  font-size: 13px;
}

.web-result-item span {
  margin-top: 4px;
  font-size: 12px;
}

.web-result-item small {
  margin-top: 6px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 11px;
}

.web-empty,
.web-error {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-tertiary);
  padding: var(--gap-md);
  color: var(--text-muted);
}

.web-error {
  color: var(--status-error);
}

.web-markdown-output {
  display: block;
  max-height: 420px;
  overflow: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background: var(--bg-secondary);
  color: var(--text-secondary);
  padding: var(--gap-md);
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.6;
}

.web-advanced summary {
  cursor: pointer;
  padding: var(--gap-md);
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font-mono);
}

.web-advanced[open] summary {
  border-bottom: 1px solid var(--border-glass);
}

.web-raw-config {
  margin: 0 var(--gap-md) var(--gap-md);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background: rgba(15, 23, 42, 0.45);
}

.web-test-output .web-raw-config {
  margin: var(--gap-sm) 0 0;
}

.web-raw-config summary {
  padding: var(--gap-sm) var(--gap-md);
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 12px;
  cursor: pointer;
}

.web-raw-config[open] summary {
  border-bottom: 1px solid var(--border-subtle);
}

.web-raw-config pre {
  max-height: 360px;
  margin: 0;
  overflow: auto;
  padding: var(--gap-md);
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.45;
  white-space: pre-wrap;
}

.web-apply-output {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 28px;
  margin-bottom: var(--gap-lg);
}

@media (max-width: 980px) {
  .web-form-grid,
  .web-test-row,
  .web-search-layout,
  .web-test-grid,
  .web-status-grid {
    grid-template-columns: 1fr;
  }

  .web-engine-list {
    justify-content: flex-start;
  }

  .web-engine-grid {
    grid-template-columns: 1fr;
  }
}

/* ─── Model Catalog ────────────────────────────────────── */

.catalog-shell {
  width: min(1200px, calc(100% - 48px));
}

.catalog-import-form {
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  background: var(--bg-glass);
  backdrop-filter: blur(12px);
  padding: var(--gap-md);
  margin-bottom: var(--gap-md);
}

.catalog-import-form h2 {
  margin: 0 0 var(--gap-sm);
  font-size: 15px;
  font-weight: 600;
  font-family: var(--font-mono);
}

.catalog-import-row {
  display: flex;
  gap: var(--gap-sm);
  align-items: flex-end;
}

.catalog-import-row label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--text-muted);
  flex: 1;
}

.catalog-import-row input,
.catalog-import-row select {
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 13px;
}

.catalog-import-row input:focus,
.catalog-import-row select:focus {
  outline: none;
  border-color: var(--border-focus);
}

.catalog-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.catalog-table th {
  text-align: left;
  padding: var(--gap-sm) var(--gap-md);
  border-bottom: 1px solid var(--border-glass);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  font-weight: 600;
}

.catalog-table td {
  padding: var(--gap-sm) var(--gap-md);
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-secondary);
}

.catalog-table tr:hover td {
  background: var(--bg-glass-light);
}

.catalog-table .mono {
  font-family: var(--font-mono);
  font-size: 12px;
}

/* ─── Status Badges (overview specific) ────────────────── */

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.status-badge.status-ok {
  background: var(--accent-dim);
  color: var(--status-ok);
}

.status-badge.status-warn {
  background: rgba(245, 158, 11, 0.12);
  color: var(--status-warn);
}

.status-badge.status-error {
  background: rgba(239, 68, 68, 0.12);
  color: var(--status-error);
}

.status-badge.status-info {
  background: rgba(59, 130, 246, 0.12);
  color: var(--status-info);
}

.status-badge.status-loading {
  background: var(--accent-dim);
  color: var(--accent);
}

.status-badge-icon {
  display: inline-grid;
  place-items: center;
  min-width: 14px;
  height: 14px;
  padding: 0 2px;
  border: 1px solid currentColor;
  border-radius: var(--radius-full);
  font-family: var(--font-mono);
  font-size: 8px;
  font-weight: 800;
  line-height: 1;
}

.health-indicator {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
}

.health-indicator-icon {
  display: inline-grid;
  place-items: center;
  min-width: 16px;
  height: 16px;
  padding: 0 3px;
  border: 1px solid currentColor;
  border-radius: var(--radius-full);
  font-family: var(--font-mono);
  font-size: 8px;
  font-weight: 800;
  line-height: 1;
}

.health-ok {
  color: var(--status-ok);
}

.health-warn {
  color: var(--status-warn);
}

.health-error {
  color: var(--status-error);
}

.health-loading {
  color: var(--status-info);
}

/* Project administration */
.project-admin-grid {
  display: grid;
  grid-template-columns: minmax(280px, 0.32fr) minmax(0, 1fr);
  gap: var(--gap-md);
  align-items: start;
  margin-top: var(--gap-md);
}

.project-detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(360px, 0.95fr);
  gap: var(--gap-md);
  align-items: start;
}

.project-workspace {
  display: grid;
  gap: var(--gap-md);
  min-width: 0;
}

.project-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: var(--gap-xs);
  padding: 4px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--bg-glass);
}

.project-tab-button {
  justify-self: auto;
  padding: 8px 14px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-secondary);
}

.project-tab-button:hover {
  background: var(--bg-glass-light);
  box-shadow: none;
  transform: none;
}

.project-tab-button.active {
  border-color: var(--ui-accent);
  background: var(--ui-accent-soft);
  color: var(--text-primary);
}

.project-tab-panel {
  display: none;
}

.project-tab-panel.active {
  display: block;
}

.project-tab-grid,
.project-graph-workspace {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(360px, 1.05fr);
  gap: var(--gap-md);
  align-items: start;
}

.project-column {
  display: grid;
  gap: var(--gap-md);
  align-content: start;
}

.project-row {
  width: 100%;
  text-align: left;
  border: 0;
  color: inherit;
  background: transparent;
}

.project-row.selected {
  border-left: 2px solid var(--accent);
  background: var(--bg-elevated);
}

.project-source-row,
.project-form-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: var(--gap-sm);
}

.project-repos-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.34fr);
  gap: var(--gap-md);
  align-items: start;
}

.project-repos-heading .panel-meta {
  max-width: 760px;
  line-height: 1.45;
}

.project-repo-pipeline {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--gap-sm);
  padding: var(--gap-md);
  border-bottom: 1px solid var(--border-subtle);
}

.project-repo-step {
  position: relative;
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: var(--gap-sm);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background: rgba(15, 23, 42, 0.36);
}

.project-repo-step::after {
  content: ">";
  position: absolute;
  right: -13px;
  top: 50%;
  color: var(--text-secondary);
  font-family: var(--font-mono);
  transform: translateY(-50%);
}

.project-repo-step:last-child::after {
  content: "";
}

.project-repo-step strong,
.project-repo-link-panel strong {
  font-family: var(--font-mono);
}

.project-repo-step span,
.project-repo-link-panel span {
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.4;
}

.project-repo-link-panel {
  display: grid;
  gap: var(--gap-sm);
  margin: var(--gap-md);
  padding: var(--gap-md);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: rgba(11, 17, 32, 0.34);
}

.project-repo-link-panel > header {
  display: flex;
  justify-content: space-between;
  gap: var(--gap-sm);
}

.project-repo-link-panel > header > div {
  display: grid;
  gap: 3px;
}

.project-repo-form {
  padding: 0;
}

.project-repo-list,
.project-github-known-list {
  display: grid;
  gap: var(--gap-sm);
  padding: var(--gap-md);
}

.project-status-grid,
.project-mode-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--gap-sm);
  padding: var(--gap-md);
}

.project-stat,
.project-mode {
  display: grid;
  gap: var(--gap-xs);
  min-width: 0;
  padding: var(--gap-sm);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background: var(--bg-glass-light);
}

.project-stat strong,
.project-mode strong {
  font-family: var(--font-mono);
  font-size: 18px;
}

.project-stat span,
.project-mode span,
.project-small-meta {
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.project-mode.active {
  border-color: var(--ui-accent);
  background: var(--ui-accent-soft);
}

.project-mode.disabled {
  opacity: 0.62;
}

.project-advanced-options {
  display: grid;
  gap: var(--gap-sm);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: var(--gap-sm);
  background: rgba(11, 17, 32, 0.32);
}

.project-advanced-options summary {
  cursor: pointer;
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 12px;
}

.project-advanced-options[open] summary {
  color: var(--text-primary);
  margin-bottom: var(--gap-sm);
}

.project-pill-row,
.project-row-actions,
.project-checkbox-list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--gap-xs);
  align-items: center;
}

.project-pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 12px;
}

.project-pill.ok {
  border-color: rgba(34, 197, 94, 0.45);
  color: var(--status-ok);
}

.project-pill.warn {
  border-color: rgba(245, 158, 11, 0.45);
  color: var(--status-warn);
}

.project-pill.error {
  border-color: rgba(239, 68, 68, 0.45);
  color: var(--status-error);
}

.project-repo-row,
.project-graph-card,
.project-run-row,
.project-branch-row {
  display: grid;
  gap: var(--gap-xs);
  padding: var(--gap-md);
  border-bottom: 1px solid var(--border-subtle);
}

.project-repo-row:last-child,
.project-graph-card:last-child,
.project-run-row:last-child,
.project-branch-row:last-child {
  border-bottom: 0;
}

.project-repo-row,
.project-graph-card {
  grid-template-columns: minmax(0, 1fr) auto;
  gap: var(--gap-sm);
}

.project-graph-card.selected {
  border-left: 2px solid var(--accent);
  background: var(--bg-elevated);
}

.project-repo-main,
.project-graph-main {
  display: grid;
  gap: var(--gap-xs);
  min-width: 0;
}

.project-repo-card,
.project-github-known-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: var(--gap-md);
  align-items: start;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: rgba(15, 23, 42, 0.28);
}

.project-repo-card:last-child,
.project-github-known-row:last-child {
  border-bottom: 1px solid var(--border-subtle);
}

.project-repo-card-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: var(--gap-sm);
  align-items: start;
}

.project-repo-title {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.project-repo-title strong,
.project-github-known-row strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.project-repo-title span,
.project-github-known-row span {
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.45;
}

.project-repo-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--gap-xs) var(--gap-md);
  padding-top: var(--gap-xs);
}

.project-repo-detail-grid .project-detail-row {
  padding: 7px 0;
  border-top: 1px solid rgba(148, 163, 184, 0.12);
}

.project-repo-actions {
  justify-content: flex-end;
  min-width: 180px;
}

.project-github-known-row {
  padding: var(--gap-md);
}

.project-github-known-panel .project-empty {
  margin: 0;
}

.project-repo-row.busy {
  background: rgba(56, 189, 248, 0.04);
}

.project-repo-row.ok {
  background: var(--ui-surface);
}

.project-repo-row.error {
  background: rgba(239, 68, 68, 0.05);
}

.project-repo-feedback {
  max-height: 160px;
  overflow: auto;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
  padding: 8px 10px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background: rgba(11, 17, 32, 0.42);
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.45;
}

.project-repo-feedback.busy {
  border-color: rgba(56, 189, 248, 0.35);
  color: #7dd3fc;
}

.project-repo-feedback.ok {
  border-color: rgba(34, 197, 94, 0.35);
  color: var(--status-ok);
}

.project-repo-feedback.warn {
  border-color: rgba(245, 158, 11, 0.45);
  color: var(--status-warn);
}

.project-repo-feedback.error {
  border-color: rgba(239, 68, 68, 0.42);
  color: var(--status-error);
}

.project-repo-workspace-status {
  margin: 0 var(--gap-md) var(--gap-md);
  padding: 8px 10px;
  border: 1px solid rgba(239, 68, 68, 0.42);
  border-radius: var(--radius-sm);
  background: rgba(239, 68, 68, 0.06);
  color: var(--status-error);
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.project-branches-panel {
  overflow: hidden;
}

.project-branches-heading {
  align-items: flex-start;
}

.project-branches-description {
  margin: 0;
  padding: var(--gap-md);
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  line-height: 1.45;
}

.project-branch-flow {
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 0.8fr) minmax(0, 1.4fr);
  gap: var(--gap-sm);
  padding: var(--gap-md);
  border-bottom: 1px solid var(--border-subtle);
}

.project-branch-flow-card {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: var(--gap-sm);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background: rgba(15, 23, 42, 0.36);
}

.project-branch-flow-card strong,
.project-branch-section > header strong {
  font-family: var(--font-mono);
}

.project-branch-flow-card span,
.project-branch-section > header span {
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.45;
}

.project-branch-warnings {
  display: grid;
  gap: var(--gap-xs);
  padding: var(--gap-md);
  border-bottom: 1px solid var(--border-subtle);
}

.project-branch-section {
  display: grid;
  gap: var(--gap-sm);
  padding: var(--gap-md);
  border-bottom: 1px solid var(--border-subtle);
}

.project-branch-section:last-child {
  border-bottom: 0;
}

.project-branch-section > header {
  display: flex;
  gap: var(--gap-sm);
  align-items: flex-start;
  justify-content: space-between;
}

.project-branch-section > header > div {
  display: grid;
  gap: 3px;
}

.project-branch-list,
.project-run-branch-list {
  display: grid;
  gap: var(--gap-sm);
}

.project-branch-card,
.project-run-branch-row {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: rgba(15, 23, 42, 0.28);
}

.project-branch-card:last-child,
.project-run-branch-row:last-child {
  border-bottom: 1px solid var(--border-subtle);
}

.project-branch-card.default {
  border-left: 2px solid var(--accent);
}

.project-branch-card.disabled {
  opacity: 0.78;
}

.project-branch-main {
  display: grid;
  gap: var(--gap-sm);
  min-width: 0;
}

.project-branch-card-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: var(--gap-sm);
  align-items: start;
}

.project-branch-title {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.project-branch-title strong,
.project-branch-title span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.project-branch-title span {
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 12px;
}

.project-branch-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--gap-xs) var(--gap-md);
}

.project-branch-actions {
  align-content: start;
  justify-content: flex-end;
  min-width: 190px;
}

.project-branch-form {
  padding: 0;
}

.project-branch-form-empty .project-empty {
  margin: 0;
}

.project-run-branch-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, auto);
  gap: var(--gap-sm);
  align-items: start;
  padding: var(--gap-md);
}

.project-run-branch-main {
  display: grid;
  gap: var(--gap-sm);
  min-width: 0;
}

.project-run-branch-actions {
  justify-content: flex-end;
  min-width: 220px;
}

.project-run-branch-actions button[disabled] {
  opacity: 0.54;
}

.project-publication-plan {
  display: grid;
  gap: var(--gap-sm);
  padding: var(--gap-sm);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background: rgba(2, 6, 23, 0.34);
}

.project-publication-plan.compact {
  margin-top: 2px;
}

.project-action-summary {
  display: grid;
  gap: var(--gap-xs);
}

.project-action-summary > strong {
  font-size: 13px;
}

.project-publication-plan-title {
  display: flex;
  gap: var(--gap-sm);
  align-items: baseline;
  justify-content: space-between;
  min-width: 0;
}

.project-publication-plan-title span {
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 12px;
}

.project-publication-plan-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--gap-xs) var(--gap-md);
}

.project-publication-plan-grid.compact {
  grid-template-columns: minmax(0, 1fr);
}

.project-publication-files,
.project-publication-action-block,
.project-publication-confirm,
.project-publication-result {
  display: grid;
  gap: var(--gap-xs);
  min-width: 0;
}

.project-publication-files > strong,
.project-publication-action-block > strong,
.project-publication-confirm > strong {
  font-family: var(--font-mono);
  font-size: 12px;
}

.project-publication-confirm,
.project-publication-result {
  padding: var(--gap-sm);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background: rgba(15, 23, 42, 0.45);
}

.project-publication-result.ok {
  border-color: rgba(34, 197, 94, 0.38);
}

.project-publication-result.error {
  border-color: rgba(248, 113, 113, 0.45);
}

.project-publication-confirm-row {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto;
  gap: var(--gap-sm);
  align-items: center;
}

.project-publication-confirm-row input {
  min-width: 0;
  font-family: var(--font-mono);
}

.project-publication-file-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.project-publication-file {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 4px 7px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 11px;
  background: rgba(15, 23, 42, 0.72);
}

.project-publication-file.forbidden {
  border-color: rgba(248, 113, 113, 0.5);
  color: var(--danger);
  background: rgba(127, 29, 29, 0.18);
}

.project-graphs-panel {
  overflow: hidden;
}

.project-graphs-heading {
  align-items: flex-start;
}

.project-graphs-heading .project-row-actions {
  justify-content: flex-end;
}

.project-graphs-description {
  margin: 0;
  padding: var(--gap-md);
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  line-height: 1.45;
}

.project-graph-section {
  display: grid;
  gap: var(--gap-sm);
  padding: var(--gap-md);
  border-bottom: 1px solid var(--border-subtle);
}

.project-graph-section:last-child {
  border-bottom: 0;
}

.project-graph-section > header {
  display: flex;
  gap: var(--gap-sm);
  align-items: flex-start;
  justify-content: space-between;
}

.project-graph-section > header > div {
  display: grid;
  gap: 3px;
}

.project-graph-section > header strong {
  font-family: var(--font-mono);
}

.project-graph-section > header span {
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.45;
}

.project-graph-attach-form {
  padding: 0;
}

.project-graph-list {
  display: grid;
  gap: var(--gap-sm);
}

.project-graph-list.compact {
  gap: var(--gap-xs);
}

.project-graph-canvas {
  min-height: 380px;
  margin: var(--gap-md);
}

.project-graph-inspector {
  display: grid;
  gap: var(--gap-sm);
  padding: var(--gap-md);
  border-top: 1px solid var(--border-subtle);
}

.project-graph-inspector > div {
  display: grid;
  gap: var(--gap-xs);
}

.project-graph-inspector strong {
  font-family: var(--font-mono);
}

.project-graph-inspector span {
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.project-graph-inspector pre {
  max-height: 180px;
  overflow: auto;
  margin: 0;
  padding: var(--gap-sm);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background: var(--bg-primary);
  color: var(--text-secondary);
  font-size: 12px;
}

.project-graph-card.attached,
.project-graph-card.available {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: rgba(15, 23, 42, 0.28);
}

.project-graph-card.attached:last-child,
.project-graph-card.available:last-child {
  border-bottom: 1px solid var(--border-subtle);
}

.project-graph-card.available {
  background: rgba(11, 17, 32, 0.3);
}

.project-graph-card-header,
.project-graph-detail-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: var(--gap-sm);
  align-items: start;
}

.project-graph-title {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.project-graph-title strong,
.project-graph-detail-header strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.project-graph-title span,
.project-graph-description,
.project-graph-card-note {
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.project-graph-card-note {
  padding: 7px 9px;
  border: 1px solid rgba(245, 158, 11, 0.24);
  border-radius: var(--radius-sm);
  background: rgba(245, 158, 11, 0.06);
}

.project-graph-actions {
  align-content: start;
  justify-content: flex-end;
  min-width: 170px;
}

.project-graph-summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--gap-xs) var(--gap-md);
  padding: var(--gap-sm);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background: rgba(11, 17, 32, 0.34);
}

.project-graph-detail-section {
  display: grid;
  gap: var(--gap-xs);
  padding: var(--gap-sm);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background: rgba(11, 17, 32, 0.28);
}

.project-graph-detail-section .project-empty {
  margin: 0;
}

.project-graph-port-list,
.project-graph-readiness-list {
  display: grid;
  gap: var(--gap-xs);
}

.project-graph-port {
  display: grid;
  gap: 2px;
  padding: 7px 0;
  border-top: 1px solid rgba(148, 163, 184, 0.12);
}

.project-graph-port:first-child {
  border-top: 0;
}

.project-graph-agent-table {
  min-width: 0;
  overflow: auto;
}

.project-graph-agent-table-head,
.project-graph-agent-row {
  display: grid;
  grid-template-columns:
    minmax(120px, 1fr)
    minmax(110px, 0.85fr)
    minmax(90px, 0.55fr)
    minmax(120px, 1fr);
  gap: var(--gap-xs);
  align-items: center;
}

.project-graph-agent-table-head {
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0;
}

.project-graph-agent-row {
  padding: 7px 0;
  border-top: 1px solid rgba(148, 163, 184, 0.12);
}

.project-graph-readiness-list > div {
  display: flex;
  flex-wrap: wrap;
  gap: var(--gap-xs);
  align-items: center;
  padding-top: 6px;
  border-top: 1px solid rgba(148, 163, 184, 0.12);
}

.project-graph-detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--gap-xs);
  align-items: center;
}

.project-graph-detail-actions > strong {
  flex-basis: 100%;
}

.project-history-link {
  min-height: 32px;
  padding: 6px 10px;
  font-size: 12px;
}

.project-inspector-section {
  display: grid;
  gap: var(--gap-xs);
  min-width: 0;
}

.project-inspector-section > summary {
  cursor: pointer;
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 12px;
}

.project-inspector-section > summary:hover {
  color: var(--text-primary);
}

.project-inspector-list {
  display: grid;
  gap: 6px;
}

.project-inspector-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: var(--gap-xs);
  align-items: center;
  padding: 7px 9px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background: var(--bg-primary);
}

.project-inspector-row strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.project-tool-details {
  grid-column: 1 / -1;
}

.project-tool-details summary,
.project-content-details summary {
  cursor: pointer;
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 12px;
}

.project-tool-details summary:hover,
.project-content-details summary:hover {
  color: var(--text-primary);
}

.project-content-section {
  padding: var(--gap-sm);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background: rgba(11, 17, 32, 0.34);
}

.project-content-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--gap-sm);
  min-width: 0;
}

.project-content-header strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.project-content-text {
  max-height: 340px;
  overflow: auto;
  padding: var(--gap-sm);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 13px;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.project-content-text.preview::after {
  content: "";
  display: block;
  height: 1px;
  margin-top: var(--gap-xs);
}

.project-content-text.full {
  max-height: 520px;
  margin-top: var(--gap-xs);
}

.project-approval-section {
  padding: var(--gap-sm);
  border: 1px solid rgba(245, 158, 11, 0.36);
  border-radius: var(--radius-sm);
  background: rgba(245, 158, 11, 0.08);
}

.project-approval-section .button-link {
  justify-self: start;
  min-height: 32px;
  padding: 6px 10px;
  font-size: 12px;
}

.project-inspector-advanced pre {
  margin-top: var(--gap-xs);
}

.project-run-row {
  grid-template-columns: minmax(0, 1fr) auto;
  gap: var(--gap-sm);
  align-items: center;
  cursor: pointer;
}

.project-run-main {
  display: grid;
  gap: var(--gap-xs);
  min-width: 0;
}

.project-run-row-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--gap-sm);
  min-width: 0;
}

.project-run-row-header strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.project-run-row:hover,
.project-run-row:focus-visible {
  background: var(--bg-elevated);
  outline: none;
}

.project-run-row.selected {
  border-left: 2px solid var(--accent);
  background: var(--bg-elevated);
}

.project-hidden {
  display: none !important;
}

.project-empty {
  display: grid;
  gap: var(--gap-xs);
  padding: var(--gap-md);
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 13px;
}

.project-empty strong {
  color: var(--text-primary);
  font-size: 13px;
}

.project-empty span {
  overflow-wrap: anywhere;
}

.project-empty-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--gap-xs);
  margin-top: var(--gap-xs);
}

.project-empty-actions .button-link,
.project-empty-actions button {
  min-height: 32px;
  padding: 6px 10px;
  font-size: 12px;
}

.project-canvas-empty {
  position: absolute;
  left: 50%;
  top: 50%;
  display: grid;
  justify-items: center;
  gap: var(--gap-xs);
  width: min(420px, calc(100% - 48px));
  padding: var(--gap-md);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: rgba(11, 17, 32, 0.82);
  color: var(--text-secondary);
  text-align: center;
  transform: translate(-50%, -50%);
}

.project-canvas-empty strong {
  color: var(--text-primary);
  font-family: var(--font-mono);
}

.project-canvas-empty span {
  font-size: 13px;
  line-height: 1.45;
}

@media (max-width: 1180px) {
  .project-admin-grid,
  .project-detail-grid,
  .project-tab-grid,
  .project-graph-workspace,
  .project-repos-workspace {
    grid-template-columns: 1fr;
  }

  .project-repo-pipeline {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .project-branch-flow {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .project-branch-flow-card.wide {
    grid-column: 1 / -1;
  }

  .project-repo-step::after {
    content: "";
  }
}

@media (max-width: 760px) {
  .project-source-row,
  .project-form-row,
  .project-status-grid,
  .project-mode-grid,
  .project-repo-row,
  .project-graph-card,
  .project-branch-card,
  .project-branch-card-header,
  .project-branch-detail-grid,
  .project-run-branch-row,
  .project-publication-plan-grid,
  .project-graph-card-header,
  .project-graph-detail-header,
  .project-graph-summary-grid,
  .project-repo-card,
  .project-repo-card-header,
  .project-repo-detail-grid,
  .project-github-known-row,
  .project-run-row {
    grid-template-columns: 1fr;
  }

  .project-row-actions {
    justify-content: flex-start;
  }

  .project-repo-pipeline {
    grid-template-columns: 1fr;
  }

  .project-branch-flow {
    grid-template-columns: 1fr;
  }

  .project-repo-actions {
    justify-content: flex-start;
    min-width: 0;
  }

  .project-graph-agent-table-head {
    display: none;
  }

  .project-graph-agent-row {
    grid-template-columns: 1fr;
  }

  .project-detail-row {
    grid-template-columns: 1fr;
    gap: 2px;
  }
}

/* Lot 2: Project overview and dedicated Launch */
.project-context-header {
  display: flex;
  gap: 24px;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
}

.project-context-header[hidden],
.launch-proposal[hidden],
.launch-page-error[hidden] {
  display: none !important;
}

.project-context-copy {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.project-context-copy h2 {
  margin: 0;
  font-size: 22px;
}

.project-context-description {
  max-width: 760px;
  margin: 0;
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.45;
}

.project-context-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.project-overview-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  gap: var(--gap-md);
}

.project-overview-attention {
  grid-column: 1 / -1;
}

.project-readiness-list,
.project-attention-list,
.project-overview-runs {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.project-readiness-item {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 9px 0;
  border-top: 1px solid var(--border-subtle);
}

.project-readiness-item:first-child {
  border-top: 0;
}

.project-readiness-marker {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
}

.project-readiness-item.ready .project-readiness-marker {
  border-color: rgba(34, 197, 94, 0.38);
  background: rgba(34, 197, 94, 0.09);
  color: var(--status-ok);
}

.project-readiness-item.warning .project-readiness-marker,
.project-readiness-item.blocked .project-readiness-marker {
  border-color: rgba(245, 158, 11, 0.38);
  background: rgba(245, 158, 11, 0.08);
  color: var(--status-warn);
}

.project-readiness-item > div {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.project-readiness-item strong {
  font-size: 13px;
}

.project-readiness-item span:not(.project-readiness-marker) {
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.4;
}

.project-overview-run {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--border-subtle);
  border-radius: 7px;
  background: var(--bg-primary);
  color: inherit;
  text-decoration: none;
}

.project-overview-run:hover {
  border-color: var(--border-strong);
  background: var(--bg-elevated);
}

.project-overview-run > div {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.project-overview-run strong,
.project-overview-run span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.project-overview-run > div > span {
  color: var(--text-secondary);
  font-size: 11px;
}

.project-settings-details {
  margin-top: var(--gap-md);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  background: var(--bg-secondary);
}

.project-settings-details > summary {
  cursor: pointer;
  padding: 14px 16px;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 700;
}

.project-settings-details[open] > summary {
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-primary);
}

.project-settings-details .project-tab-grid {
  padding: var(--gap-md);
}

.project-runs-table-wrap {
  border: 0;
  border-radius: 0;
}

.project-runs-table {
  min-width: 760px;
}

.project-runs-table .project-run-row {
  display: table-row;
  padding: 0;
  border: 0;
}

.project-runs-table th:nth-child(1) { width: 110px; }
.project-runs-table th:nth-child(2) { width: auto; }
.project-runs-table th:nth-child(3) { width: 180px; }
.project-runs-table th:nth-child(4) { width: 90px; }
.project-runs-table th:nth-child(5) { width: 150px; }
.project-runs-table th:nth-child(6) { width: 105px; }
.project-runs-table th:nth-child(7) { width: 90px; }

.project-runs-table td:nth-child(2) strong,
.project-runs-table td:nth-child(2) span {
  display: block;
  max-width: 520px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.project-runs-table td:nth-child(2) span {
  margin-top: 3px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 10px;
}

.compact-button {
  min-height: 30px;
  padding: 5px 9px;
  font-size: 11px;
}

.project-launch-shell {
  max-width: 1580px;
}

.launch-project-strip {
  display: flex;
  gap: 24px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding: 14px 18px;
}

.launch-project-strip > div:first-child {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.launch-project-strip h2,
.launch-project-strip p {
  margin: 0;
}

.launch-project-strip h2 {
  font-size: 17px;
}

.launch-project-strip p:last-child {
  color: var(--text-secondary);
  font-size: 12px;
}

.launch-page-error {
  margin-bottom: 16px;
}

.launch-page-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.72fr) minmax(340px, 0.78fr);
  gap: 16px;
  align-items: start;
}

.launch-main-column,
.launch-summary-column {
  display: grid;
  gap: 16px;
  min-width: 0;
}

.launch-main-column > .surface-section,
.launch-readiness-panel {
  min-width: 0;
}

.launch-summary-column {
  position: sticky;
  top: 16px;
}

.launch-objective-section,
.launch-proposal,
.launch-configuration-section,
.launch-agents-section,
.launch-advanced-section,
.launch-readiness-panel {
  display: grid;
  gap: 14px;
}

.launch-objective-field,
.launch-config-grid label,
.launch-advanced-section label {
  display: grid;
  gap: 6px;
}

.launch-objective-field > span,
.launch-config-grid label > span,
.launch-advanced-section label > span {
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 700;
}

.launch-objective-field textarea {
  min-height: 138px;
  font-size: 15px;
  line-height: 1.5;
  resize: vertical;
}

.launch-required-label {
  color: var(--status-warn);
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
}

.launch-proposal {
  border-color: rgba(95, 127, 232, 0.36);
  background: rgba(95, 127, 232, 0.06);
}

.launch-proposal .section-heading p:last-child,
.launch-agents-section .section-heading p:last-child {
  margin: 3px 0 0;
  color: var(--text-secondary);
  font-size: 12px;
}

.launch-proposal-summary,
.launch-config-summary {
  display: grid;
  gap: 7px;
}

.launch-detail-row {
  display: grid;
  grid-template-columns: minmax(100px, 0.38fr) minmax(0, 1fr);
  gap: 10px;
  align-items: start;
}

.launch-detail-row > span {
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 11px;
}

.launch-detail-row > strong {
  min-width: 0;
  color: var(--text-secondary);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.launch-config-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr) minmax(150px, 0.55fr);
  gap: 12px;
}

.launch-config-grid small,
.launch-advanced-section small {
  color: var(--text-muted);
  font-size: 10px;
  line-height: 1.4;
}

.launch-graph-summary {
  min-width: 0;
}

.launch-graph-card {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--border-subtle);
  border-radius: 7px;
  background: var(--bg-primary);
}

.launch-graph-card p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.45;
}

.launch-graph-heading {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  justify-content: space-between;
}

.launch-graph-heading > div {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.launch-graph-heading span:not(.project-pill) {
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 10px;
  overflow-wrap: anywhere;
}

.launch-agent-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(270px, 0.65fr);
  gap: 14px;
  align-items: start;
}

.launch-agent-table-head,
.launch-agent-row {
  display: grid;
  grid-template-columns: minmax(145px, 1fr) minmax(120px, 0.75fr) minmax(180px, 1.1fr) minmax(80px, 0.45fr);
  gap: 10px;
  align-items: center;
}

.launch-agent-table-head {
  padding: 0 9px 7px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 9px;
  text-transform: uppercase;
}

.launch-agent-list {
  display: grid;
  gap: 7px;
}

.launch-agent-row {
  cursor: pointer;
  min-width: 0;
  padding: 9px;
  border: 1px solid var(--border-subtle);
  border-radius: 7px;
  background: var(--bg-primary);
}

.launch-agent-row:hover,
.launch-agent-row:focus-visible,
.launch-agent-row.selected {
  border-color: rgba(95, 127, 232, 0.52);
  outline: none;
}

.launch-agent-row.selected {
  background: rgba(95, 127, 232, 0.06);
}

.launch-agent-identity,
.launch-agent-scope,
.launch-agent-status {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.launch-agent-identity strong,
.launch-agent-identity span,
.launch-agent-scope strong,
.launch-agent-scope span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.launch-agent-identity span,
.launch-agent-scope span {
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 10px;
}

.launch-agent-binding {
  min-width: 0;
}

.launch-agent-binding select {
  width: 100%;
}

.launch-static-binding {
  color: var(--text-secondary);
  font-size: 12px;
}

.launch-repo-checklist {
  display: grid;
  max-height: 112px;
  gap: 4px;
  overflow: auto;
}

.launch-repo-checklist label {
  display: flex;
  gap: 7px;
  align-items: center;
  min-width: 0;
  font-size: 11px;
}

.launch-repo-checklist label span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.launch-agent-detail-card {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--border-subtle);
  border-radius: 7px;
  background: var(--bg-primary);
}

.launch-agent-detail-card h3 {
  margin: 0 0 3px;
  font-size: 13px;
}

.launch-agent-detail-card p {
  margin: 5px 0 0;
  color: var(--text-secondary);
  font-size: 11px;
  line-height: 1.45;
}

.launch-advanced-section details {
  border-top: 1px solid var(--border-subtle);
}

.launch-advanced-section summary {
  cursor: pointer;
  padding: 11px 0;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 700;
}

.launch-advanced-section details[open] summary {
  color: var(--text-primary);
}

.launch-public-inputs {
  display: grid;
  gap: 7px;
}

.launch-public-input-row {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) auto minmax(0, 1.5fr);
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  background: var(--bg-primary);
}

.launch-public-input-row > span:last-child {
  color: var(--text-secondary);
  font-size: 11px;
}

.launch-readiness-list,
.launch-warning-list {
  display: grid;
  gap: 7px;
}

.launch-readiness-row {
  display: grid;
  grid-template-columns: 24px minmax(90px, 0.55fr) minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  min-width: 0;
  padding: 8px 0;
  border-top: 1px solid var(--border-subtle);
}

.launch-readiness-row > span {
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
}

.launch-readiness-row.ready > span {
  color: var(--status-ok);
}

.launch-readiness-row.blocked > span {
  color: var(--status-error);
}

.launch-readiness-row strong {
  font-size: 12px;
}

.launch-readiness-row small {
  min-width: 0;
  color: var(--text-secondary);
  font-size: 10px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.launch-feedback {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  padding: 9px;
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  background: var(--bg-primary);
}

.launch-feedback > span {
  color: var(--status-warn);
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
}

.launch-feedback.error > span {
  color: var(--status-error);
}

.launch-feedback.ok > span {
  color: var(--status-ok);
}

.launch-feedback p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 11px;
  line-height: 1.4;
}

.launch-blockers-summary {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  padding-top: 12px;
  border-top: 1px solid var(--border-subtle);
  font-family: var(--font-mono);
  font-size: 11px;
}

.launch-blockers-summary span {
  color: var(--text-secondary);
}

.launch-submit {
  width: 100%;
  min-height: 42px;
}

.launch-disabled-reason {
  margin: -5px 0 0;
  color: var(--text-secondary);
  font-size: 11px;
  line-height: 1.4;
}

.launch-mobile-action {
  display: none;
}

@media (max-width: 1180px) {
  .project-overview-grid,
  .launch-page-layout,
  .launch-agent-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .project-overview-attention {
    grid-column: auto;
  }

  .launch-summary-column {
    position: static;
  }

  .launch-readiness-panel {
    position: static;
  }
}

@media (max-width: 760px) {
  .project-context-header,
  .launch-project-strip {
    align-items: stretch;
    flex-direction: column;
  }

  .project-context-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .project-context-actions .primary-action {
    grid-column: 1 / -1;
  }

  .launch-config-grid,
  .launch-agent-row,
  .launch-public-input-row {
    grid-template-columns: minmax(0, 1fr);
  }

  .project-runs-table .project-run-row {
    display: grid;
  }

  .project-tabs {
    flex-wrap: nowrap;
    max-width: 100%;
    overflow-x: auto;
  }

  .project-tab-button {
    flex: 0 0 auto;
  }

  .project-settings-details .project-tab-grid {
    padding: 10px;
  }

  .launch-agent-table-head {
    display: none;
  }

  .launch-agent-row {
    align-items: stretch;
  }

  .launch-detail-row,
  .launch-readiness-row {
    grid-template-columns: minmax(0, 1fr);
    gap: 3px;
  }

  .launch-readiness-row > span {
    display: none;
  }

  .launch-summary-column .launch-submit {
    display: none;
  }

  .project-launch-shell {
    padding-bottom: 148px;
  }

  .launch-mobile-action {
    position: fixed;
    z-index: 80;
    right: 10px;
    bottom: 70px;
    left: 10px;
    display: block;
    padding: 8px;
    border: 1px solid var(--border-strong);
    border-radius: 8px;
    background: rgba(15, 18, 24, 0.96);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  }

  .launch-mobile-action button {
    width: 100%;
    min-height: 42px;
  }
}

/* Lot 1: shared operator shell and readiness views */

.shell-with-sidebar {
  width: auto;
  max-width: 1600px;
  margin-right: var(--shell-page-gutter);
  margin-left: calc(var(--sidebar-width) + var(--shell-page-gutter));
  padding: 20px 0 40px;
}

html.sidebar-collapsed body .shell-with-sidebar {
  margin-left: calc(var(--sidebar-collapsed-width) + var(--shell-page-gutter));
}

.sidebar {
  background: #0f1218;
  border-right-color: var(--border);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.sidebar svg,
.sidebar-toggle svg,
.mobile-nav svg,
.app-page-header svg,
.runs-filter-band svg,
.runs-workspace svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sidebar-toggle {
  padding: 0;
}

.sidebar-toggle svg {
  flex: 0 0 20px;
  width: 20px;
}

.sidebar-header {
  height: 64px;
  padding: 0 14px;
  border-bottom-color: var(--border);
}

.sidebar-logo {
  gap: 10px;
}

.sidebar-logo-icon {
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  box-shadow: none;
}

.sidebar-logo-icon img {
  display: block;
  width: 30px;
  height: 30px;
}

.sidebar-logo-text {
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 700;
}

.sidebar-nav {
  padding: 10px 8px;
}

.sidebar-section {
  padding: 4px 0;
}

.sidebar-main-links {
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-subtle);
}

.sidebar-link {
  min-height: 38px;
  gap: 10px;
  margin: 1px 0;
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: 6px;
  font-size: 13px;
}

.sidebar-link:hover {
  background: #171c25;
}

.sidebar-link.active {
  border-color: rgba(107, 140, 255, 0.2);
  background: rgba(107, 140, 255, 0.11);
  color: #b9c6ff;
}

.sidebar-link.active::before {
  display: none;
}

.sidebar-link svg {
  width: 17px;
  height: 17px;
}

.sidebar-link-badge {
  min-width: 19px;
  padding: 1px 5px;
  border: 1px solid rgba(245, 158, 11, 0.35);
  border-radius: 6px;
  background: rgba(245, 158, 11, 0.13);
  color: #f6c66f;
  font-family: var(--font-mono);
}

.sidebar-link-badge-error {
  border-color: rgba(248, 113, 113, 0.48);
  background: rgba(248, 113, 113, 0.16);
  color: #fecaca;
}

.sidebar-link-badge-warning {
  border-color: rgba(245, 158, 11, 0.35);
  background: rgba(245, 158, 11, 0.13);
  color: #f6c66f;
}

.sidebar-link-badge[hidden] {
  display: none;
}

.sidebar-group {
  border-bottom: 1px solid var(--border-subtle);
}

.sidebar-group:last-of-type {
  border-bottom: 0;
}

.sidebar-group-toggle {
  display: flex;
  width: 100%;
  min-height: 34px;
  align-items: center;
  justify-content: space-between;
  padding: 8px 9px 5px;
  border: 0;
  background: transparent;
  box-shadow: none;
  color: var(--text-muted);
  font-family: var(--font-body);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.sidebar-group-toggle:hover {
  background: transparent;
  color: var(--text-secondary);
  box-shadow: none;
}

.sidebar-group-toggle svg {
  width: 14px;
  height: 14px;
  transition: transform var(--transition-fast);
}

.sidebar-group-toggle[aria-expanded="true"] svg {
  transform: rotate(90deg);
}

.sidebar-group-content {
  display: grid;
}

.sidebar-group.is-collapsed .sidebar-group-content {
  display: none;
}

.sidebar-footer {
  padding: 8px;
  border-top-color: var(--border);
}

.sidebar-logout-form button {
  min-height: 38px;
  border-color: transparent;
  font-family: var(--font-body);
  font-size: 13px;
}

.shell-error-boundary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  align-items: center;
  margin-bottom: 16px;
  padding: 10px 12px;
  border: 1px solid rgba(239, 68, 68, 0.36);
  border-radius: var(--radius-md);
  background: rgba(239, 68, 68, 0.1);
  color: var(--text-primary);
}

.shell-error-boundary strong {
  color: #fecaca;
}

.shell-error-boundary span {
  color: var(--text-secondary);
  font-size: 13px;
}

html.sidebar-collapsed .sidebar .sidebar-group-toggle {
  display: none;
}

html.sidebar-collapsed .sidebar .sidebar-group-content {
  display: grid !important;
}

html.sidebar-collapsed .sidebar .sidebar-section {
  padding: 4px 6px;
}

html.sidebar-collapsed .sidebar .sidebar-link {
  width: 40px;
  height: 40px;
}

.mobile-nav {
  display: none;
}

.app-page-header {
  min-height: 82px;
  align-items: center;
  margin-bottom: 20px;
  padding: 0 0 18px;
  border-bottom: 1px solid var(--border);
}

.app-page-header .page-heading {
  gap: 2px;
}

.app-page-header .page-heading h1 {
  font-family: var(--font-body);
  font-size: 24px;
  line-height: 1.25;
}

.breadcrumbs {
  display: flex;
  gap: 6px;
  align-items: center;
  min-height: 18px;
  color: var(--text-muted);
  font-size: 11px;
}

.breadcrumbs a,
.breadcrumbs span {
  padding: 0;
  color: inherit;
  font-size: inherit;
}

.breadcrumbs a:hover {
  background: transparent;
  color: var(--text-primary);
}

.page-header-tools,
.live-refresh {
  display: flex;
  gap: 10px;
  align-items: center;
}

.page-header-tools {
  justify-content: flex-end;
  flex-wrap: wrap;
}

.live-refresh {
  min-height: 36px;
  padding: 5px 6px 5px 10px;
  border: 1px solid var(--border-subtle);
  border-radius: 7px;
  background: var(--bg-secondary);
  color: var(--text-secondary);
  font-size: 12px;
}

.live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--status-ok);
}

.auto-refresh-paused .live-dot {
  background: var(--status-warn);
}

.auto-refresh-error .live-dot {
  background: var(--status-error);
}

.realtime-connection[data-realtime-status="connected"] .live-dot {
  background: var(--status-ok);
}

.realtime-connection[data-realtime-status="connecting"] .live-dot,
.realtime-connection[data-realtime-status="reconnecting"] .live-dot,
.realtime-connection[data-realtime-status="hidden"] .live-dot {
  background: var(--status-warn);
}

.realtime-connection[data-realtime-status="unavailable"] .live-dot,
.realtime-connection[data-realtime-status="auth_error"] .live-dot,
.realtime-connection[data-realtime-status="error"] .live-dot {
  background: var(--status-error);
}

.realtime-connection[data-realtime-degraded="true"] {
  border-color: rgba(248, 113, 113, 0.5);
  background: rgba(127, 29, 29, 0.18);
  color: #fecaca;
}

.live-refresh-age {
  color: var(--text-muted);
}

.icon-text-button,
.icon-only {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.icon-text-button {
  min-height: 32px;
  gap: 7px;
  padding: 6px 9px;
  font-size: 12px;
}

.icon-text-button svg,
.icon-only svg {
  width: 16px;
  height: 16px;
}

.refresh-play-icon,
.auto-refresh-paused .refresh-pause-icon {
  display: none;
}

.auto-refresh-paused .refresh-play-icon {
  display: block;
}

.button-link.primary-action,
button.primary-action {
  border: 1px solid #6b8cff;
  background: #5f7fe8;
  color: #fff;
}

.button-link.primary-action:hover,
button.primary-action:hover {
  border-color: #88a2ff;
  background: #718ff0;
  color: #fff;
}

.section-heading,
.filter-band-heading {
  display: flex;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
}

.section-heading h2,
.filter-band-heading h2 {
  margin: 0;
  font-size: 16px;
  line-height: 1.3;
}

.section-heading a {
  color: var(--accent-hover);
  font-size: 12px;
  text-decoration: none;
}

.section-kicker {
  margin: 0 0 2px;
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.surface-section {
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-secondary);
}

.readiness-badge {
  display: inline-flex;
  min-height: 23px;
  align-items: center;
  width: max-content;
  padding: 3px 7px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
}

.readiness-ready {
  border-color: rgba(34, 197, 94, 0.35);
  background: rgba(34, 197, 94, 0.1);
  color: #75dc96;
}

.readiness-degraded,
.readiness-loading {
  border-color: rgba(245, 158, 11, 0.35);
  background: rgba(245, 158, 11, 0.1);
  color: #f4c15d;
}

.readiness-offline {
  border-color: rgba(239, 68, 68, 0.35);
  background: rgba(239, 68, 68, 0.1);
  color: #ff8e8e;
}

.operator-home-shell {
  max-width: 1540px;
}

.home-status-band,
.readiness-overview {
  display: flex;
  gap: 24px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #121720;
}

.home-status-copy {
  display: flex;
  gap: 14px;
  align-items: center;
}

.home-status-copy h2,
.readiness-overview h2 {
  margin: 0;
  font-size: 17px;
}

.home-status-copy p,
.readiness-overview p {
  margin: 3px 0 0;
  color: var(--text-secondary);
  font-size: 13px;
}

.home-status-metrics,
.readiness-counts {
  display: flex;
  gap: 0;
  margin: 0;
}

.home-status-metrics div,
.readiness-counts div {
  min-width: 98px;
  padding: 2px 14px;
  border-left: 1px solid var(--border);
}

.home-status-metrics dt,
.readiness-counts dt {
  color: var(--text-muted);
  font-size: 10px;
  text-transform: uppercase;
}

.home-status-metrics dd,
.readiness-counts dd {
  margin: 2px 0 0;
  font-family: var(--font-mono);
  font-size: 18px;
  font-weight: 600;
}

.home-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(300px, 0.8fr);
  gap: 16px;
  align-items: start;
}

.home-main-column,
.home-side-column {
  display: grid;
  gap: 16px;
}

.continue-list,
.compact-run-list,
.attention-list,
.home-capability-list {
  display: grid;
  margin-top: 12px;
}

.continue-list {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.continue-item,
.compact-run-row,
.attention-row,
.home-capability-row {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  min-width: 0;
  color: var(--text-primary);
  text-decoration: none;
}

.continue-item {
  min-height: 74px;
  padding: 11px;
  border: 1px solid var(--border-subtle);
  border-radius: 7px;
  background: var(--bg-primary);
}

.continue-item:hover,
.compact-run-row:hover,
.attention-row:hover,
.home-capability-row:hover {
  border-color: rgba(107, 140, 255, 0.45);
  background: var(--bg-tertiary);
}

.continue-item span,
.compact-run-main,
.attention-row > span {
  display: grid;
  min-width: 0;
}

.continue-item small,
.compact-run-main span,
.attention-row span span {
  overflow: hidden;
  color: var(--text-muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.continue-item strong,
.compact-run-main strong,
.attention-row strong {
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.compact-run-row,
.attention-row,
.home-capability-row {
  min-height: 52px;
  padding: 8px 2px;
  border-bottom: 1px solid var(--border-subtle);
}

.compact-run-row:last-child,
.attention-row:last-child,
.home-capability-row:last-child {
  border-bottom: 0;
}

.system-summary {
  padding: 0;
}

.system-summary summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  cursor: pointer;
  font-weight: 600;
}

.system-summary summary > span:first-child {
  display: grid;
}

.system-summary summary > span:last-child {
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 400;
}

.system-summary-body {
  display: grid;
  padding: 0 16px 12px;
}

.system-summary-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  border-top: 1px solid var(--border-subtle);
  font-size: 12px;
}

.runs-index-shell {
  max-width: 1600px;
}

.runs-filter-band {
  margin-bottom: 12px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-secondary);
}

.result-count {
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 11px;
}

.runs-filter-form {
  display: grid;
  grid-template-columns: minmax(150px, .8fr) minmax(130px, .7fr) minmax(150px, .8fr) minmax(220px, 1.4fr) 36px;
  gap: 10px;
  align-items: end;
  margin-top: 12px;
}

.runs-filter-form label,
.advanced-filter-grid > label {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.runs-filter-form label > span,
.advanced-filter-grid label > span {
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
}

.runs-filter-form input,
.runs-filter-form select,
.advanced-filter-grid select {
  min-width: 0;
  min-height: 36px;
}

.advanced-filters {
  margin-top: 10px;
  border-top: 1px solid var(--border-subtle);
}

.advanced-filters summary {
  width: max-content;
  padding-top: 9px;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 11px;
}

.advanced-filter-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(140px, 1fr));
  gap: 10px;
  align-items: end;
  padding-top: 10px;
}

.checkbox-control {
  display: flex !important;
  min-height: 36px;
  align-items: center;
  grid-template-columns: 16px 1fr;
  padding: 7px 9px;
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  background: var(--bg-primary);
}

.checkbox-control span {
  color: var(--text-secondary) !important;
  font-size: 11px !important;
  font-weight: 500 !important;
  text-transform: none !important;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  border: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.runs-workspace,
.runs-table-section {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-secondary);
}

.table-scroll {
  overflow: auto;
}

.runs-table {
  width: 100%;
  min-width: 1040px;
  border-collapse: collapse;
  table-layout: fixed;
}

.runs-table th {
  height: 38px;
  padding: 0 10px;
  border-bottom: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 700;
  text-align: left;
  text-transform: uppercase;
}

.runs-table th:nth-child(1) { width: 48px; }
.runs-table th:nth-child(2) { width: 118px; }
.runs-table th:nth-child(3) { width: auto; }
.runs-table th:nth-child(4) { width: 125px; }
.runs-table th:nth-child(5) { width: 165px; }
.runs-table th:nth-child(6) { width: 150px; }
.runs-table th:nth-child(7) { width: 120px; }
.runs-table th:nth-child(8) { width: 140px; }
.runs-table th:nth-child(9) { width: 54px; }

.runs-table td {
  height: 58px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border-subtle);
  overflow: hidden;
  color: var(--text-secondary);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.runs-table tr {
  cursor: pointer;
}

.runs-table tbody tr:hover,
.runs-table tbody tr:focus-visible,
.runs-table tbody tr.is-expanded {
  background: var(--bg-tertiary);
}

.runs-table tbody tr:focus-visible {
  outline: 2px solid var(--border-focus);
  outline-offset: -2px;
}

.runs-table tbody tr.requires-action {
  box-shadow: inset 2px 0 #f3c160;
}

.runs-loading-row td {
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.runs-table td strong,
.runs-table td span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
}

.runs-table td strong {
  color: var(--text-primary);
  font-size: 12px;
}

.table-cell-meta {
  margin-top: 3px;
  color: var(--text-muted);
  font-size: 10px;
}

.technical-value {
  font-family: var(--font-mono);
}

.action-required-cell {
  color: #f3c160 !important;
  font-weight: 600;
}

.runs-expand-cell,
.runs-review-cell {
  overflow: visible !important;
  text-align: center;
}

.runs-expand-button,
.runs-review-link {
  width: 32px;
  height: 32px;
  margin: 0 auto;
}

.runs-expand-button svg {
  transition: transform var(--transition-base);
}

.runs-table tr.is-expanded .runs-expand-button svg {
  transform: rotate(90deg);
}

.runs-detail-row {
  cursor: default !important;
  background: rgba(2, 6, 23, 0.18);
}

.runs-detail-row:hover {
  background: rgba(2, 6, 23, 0.18) !important;
}

.runs-detail-row td {
  height: auto;
  padding: 0;
  overflow: visible;
  white-space: normal;
}

.runs-detail-panel {
  display: grid;
  gap: 12px;
  padding: 14px;
  border-top: 1px solid var(--border-subtle);
}

.runs-detail-panel > header {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  min-width: 0;
}

.runs-detail-panel > header h3 {
  margin: 0;
  color: var(--text-primary);
  font-size: 14px;
  overflow-wrap: anywhere;
}

.runs-detail-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.runs-detail-fact {
  display: grid;
  gap: 5px;
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--border-subtle);
  border-radius: 7px;
  background: var(--bg-primary);
}

.runs-detail-fact h3 {
  margin: 0;
  color: var(--text-muted);
  font-size: 10px;
  text-transform: uppercase;
}

.runs-detail-fact strong {
  color: var(--text-primary);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.runs-detail-fact .button-link {
  justify-self: start;
  min-height: 28px;
  padding: 5px 8px;
  font-size: 11px;
}

.runs-detail-stale {
  margin: 0;
  padding: 8px 10px;
  border: 1px solid var(--status-warn);
  border-radius: 7px;
  color: #f3c160;
  font-size: 12px;
}

.runs-pagination {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 11px;
}

.runs-pagination > div,
.runs-pagination-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  min-width: 0;
}

.runs-pagination label {
  display: flex;
  gap: 6px;
  align-items: center;
}

.runs-pagination select {
  min-height: 30px;
  min-width: 72px;
}

.readiness-shell {
  max-width: 1320px;
}

.readiness-overview > div:first-child {
  display: grid;
  gap: 5px;
}

.readiness-list-heading {
  margin: 22px 0 10px;
}

.capability-readiness-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.capability-readiness-item {
  display: grid;
  gap: 9px;
  min-height: 180px;
  padding: 15px;
  border: 1px solid var(--border);
  border-left-width: 3px;
  border-radius: 8px;
  background: var(--bg-secondary);
}

.capability-readiness-item.is-ready { border-left-color: var(--ui-border-strong); }
.capability-readiness-item.is-degraded { border-left-color: var(--status-warn); }
.capability-readiness-item.is-offline { border-left-color: var(--status-error); }

.capability-readiness-head,
.capability-readiness-footer {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
}

.capability-readiness-head h3 {
  margin: 0;
  font-size: 15px;
}

.capability-readiness-summary,
.capability-readiness-cause {
  margin: 0;
  font-size: 12px;
}

.capability-readiness-summary {
  color: var(--text-primary);
}

.capability-readiness-cause {
  color: var(--text-muted);
}

.capability-metrics {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.capability-metrics span {
  padding: 3px 6px;
  border: 1px solid var(--border-subtle);
  border-radius: 5px;
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 10px;
}

.capability-readiness-footer .button-link {
  min-height: 30px;
  padding: 5px 8px;
  font-size: 11px;
  white-space: nowrap;
}

.settings-reset-action {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: flex-end;
}

.settings-reset-feedback {
  color: var(--status-ok);
  font-size: 12px;
}

@media (max-width: 1180px) {
  .home-layout {
    grid-template-columns: minmax(0, 1.35fr) minmax(280px, .8fr);
  }

  .continue-list {
    grid-template-columns: 1fr;
  }

  .advanced-filter-grid {
    grid-template-columns: repeat(3, minmax(140px, 1fr));
  }
}

@media (max-width: 980px) {
  .home-layout,
  .capability-readiness-list {
    grid-template-columns: 1fr;
  }

  .home-side-column {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .system-summary {
    grid-column: 1 / -1;
  }

  .runs-filter-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .runs-filter-form .icon-only {
    width: 36px;
  }
}

@media (max-width: 768px) {
  body {
    padding-bottom: 60px;
  }

  .shell-with-sidebar,
  html.sidebar-collapsed body .shell-with-sidebar {
    width: auto;
    max-width: none;
    margin: 0;
    padding: 68px 12px 24px;
  }

  .sidebar {
    width: min(300px, calc(100vw - 44px));
    z-index: 110;
  }

  html.sidebar-collapsed .sidebar {
    width: min(300px, calc(100vw - 44px));
  }

  html.sidebar-collapsed .sidebar:not(.open),
  .sidebar:not(.open) {
    transform: translateX(-100%);
  }

  html.sidebar-collapsed .sidebar.open {
    transform: translateX(0);
  }

  html.sidebar-collapsed .sidebar .sidebar-logo-text,
  html.sidebar-collapsed .sidebar .sidebar-link span,
  html.sidebar-collapsed .sidebar .sidebar-link-badge {
    display: inline-flex;
  }

  html.sidebar-collapsed .sidebar .sidebar-group-toggle {
    display: flex;
  }

  html.sidebar-collapsed .sidebar .sidebar-link {
    width: auto;
    height: auto;
    justify-content: flex-start;
  }

  .sidebar-overlay {
    z-index: 109;
    background: rgba(0, 0, 0, 0.68);
    backdrop-filter: none;
  }

  .sidebar-toggle {
    top: 12px;
    left: 12px;
    z-index: 108;
    background: var(--bg-secondary);
    backdrop-filter: none;
  }

  .mobile-nav {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 105;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    min-height: 58px;
    padding: 4px max(4px, env(safe-area-inset-right)) max(4px, env(safe-area-inset-bottom)) max(4px, env(safe-area-inset-left));
    border-top: 1px solid var(--border);
    background: #0f1218;
  }

  .mobile-nav .sidebar-link {
    display: flex;
    min-width: 0;
    min-height: 48px;
    flex-direction: column;
    gap: 2px;
    align-items: center;
    justify-content: center;
    margin: 0;
    padding: 4px 2px;
    border: 0;
    border-radius: 5px;
    background: transparent;
    color: var(--text-muted);
    box-shadow: none;
    font-family: var(--font-body);
    font-size: 10px;
  }

  .mobile-nav .sidebar-link.active {
    background: var(--accent-dim);
    color: #b9c6ff;
  }

  body.sidebar-drawer-open {
    overflow: hidden;
  }

  .mobile-nav svg {
    width: 18px;
    height: 18px;
  }

  .mobile-nav .sidebar-link-badge {
    position: absolute;
    top: 1px;
    right: 12px;
  }

  .app-page-header {
    min-height: 0;
    align-items: stretch;
    padding-bottom: 14px;
  }

  .app-page-header .page-heading h1 {
    font-size: 21px;
  }

  .page-header-tools,
  .page-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .live-refresh {
    width: 100%;
    justify-content: space-between;
  }

  .home-status-band,
  .readiness-overview {
    align-items: stretch;
    flex-direction: column;
  }

  .home-status-copy {
    align-items: flex-start;
    flex-direction: column;
  }

  .home-status-metrics,
  .readiness-counts {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .home-status-metrics div,
  .readiness-counts div {
    min-width: 0;
    padding: 6px 8px;
    border-top: 1px solid var(--border);
    border-left: 0;
  }

  .home-side-column {
    grid-template-columns: 1fr;
  }

  .system-summary {
    grid-column: auto;
  }

  .runs-filter-form,
  .advanced-filter-grid {
    grid-template-columns: 1fr;
  }

  .runs-filter-form .icon-only {
    width: 100%;
  }

  .runs-workspace {
    grid-template-columns: 1fr;
  }

  .runs-table {
    min-width: 0;
  }

  .runs-table thead {
    display: none;
  }

  .runs-table tbody,
  .runs-table tr,
  .runs-table td {
    display: block;
    width: 100%;
  }

  .runs-table tr {
    padding: 8px 10px;
    border-bottom: 1px solid var(--border);
  }

  .runs-table td {
    display: grid;
    grid-template-columns: 96px minmax(0, 1fr);
    gap: 8px;
    height: auto;
    min-height: 30px;
    align-items: center;
    padding: 4px 0;
    border: 0;
    white-space: normal;
  }

  .runs-table td::before {
    content: attr(data-label);
    color: var(--text-muted);
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
  }

  .runs-table td strong,
  .runs-table td span {
    white-space: normal;
  }

  .runs-table tr.runs-detail-row {
    padding: 0;
  }

  .runs-table tr.runs-detail-row td {
    display: block;
    padding: 0;
  }

  .runs-table tr.runs-detail-row td::before {
    display: none;
    content: "";
  }

  .runs-detail-panel > header {
    align-items: flex-start;
  }

  .runs-detail-grid {
    grid-template-columns: 1fr;
  }

  .runs-expand-cell,
  .runs-review-cell {
    display: flex !important;
    justify-content: space-between;
  }

  .runs-expand-button,
  .runs-review-link {
    margin: 0;
  }

  .capability-readiness-footer,
  .settings-reset-action {
    align-items: stretch;
    flex-direction: column;
  }

  .capability-readiness-footer .button-link {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .sidebar,
  .shell-with-sidebar,
  .sidebar-overlay,
  .sidebar-group-toggle svg,
  .ui-button,
  .ui-icon-button,
  .ui-card,
  .ui-loading[aria-busy="true"]::before,
  .ui-skeleton {
    animation: none !important;
    transition: none !important;
  }
}

@media (max-width: 420px) {
  .live-refresh-age {
    display: none;
  }

  .home-status-metrics dt,
  .readiness-counts dt {
    min-height: 28px;
  }

  .surface-section,
  .home-status-band,
  .readiness-overview,
  .runs-filter-band,
  .capability-readiness-item {
    padding: 12px;
  }

  .section-heading {
    align-items: flex-start;
  }
}

/* Settings and Diagnostic v2 */
[hidden] { display: none !important; }

.settings-v2-shell,
.diagnostic-v2-shell {
  width: auto;
  max-width: 1320px;
  padding-bottom: 96px;
}

.settings-v2-instance,
.settings-v2-toolbar,
.diagnostic-v2-actions,
.diagnostic-v2-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.settings-v2-instance,
.settings-v2-panel,
.settings-v2-row,
.diagnostic-v2-empty,
.diagnostic-v2-card,
.diagnostic-v2-health,
.diagnostic-v2-health-card,
.diagnostic-v2-cause,
.diagnostic-v2-section,
.diagnostic-v2-json-panel {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-elevated);
}

.settings-v2-instance { padding: 14px 16px; }

.settings-v2-kicker,
.settings-v2-toolbar label span,
.diagnostic-v2-toolbar label span,
.settings-v2-meta-grid span,
.diagnostic-v2-meta,
.diagnostic-v2-muted {
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.settings-v2-instance strong {
  display: block;
  margin-top: 3px;
  font-family: var(--font-mono);
  font-size: 13px;
}

.settings-v2-toolbar label,
.diagnostic-v2-toolbar label {
  display: grid;
  gap: 5px;
  min-width: min(420px, 100%);
}

.settings-v2-result-count {
  align-self: flex-end;
  padding-bottom: 9px;
  color: var(--text-muted);
  font-size: 12px;
}

.settings-v2-toolbar input,
.diagnostic-v2-toolbar input,
.settings-v2-control input,
.settings-v2-control select {
  width: 100%;
  min-height: 36px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-primary);
  color: var(--text-primary);
  padding: 7px 10px;
}

.diagnostic-v2-filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  max-width: 100%;
}

.diagnostic-v2-filters button {
  white-space: nowrap;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: transparent;
  color: var(--text-secondary);
  padding: 6px 11px;
  font-size: 12px;
}

.diagnostic-v2-filters button.active {
  background: rgba(99, 102, 241, 0.14);
  border-color: rgba(129, 140, 248, 0.45);
  color: var(--accent);
}

.settings-v2-alert {
  margin-bottom: 12px;
  padding: 10px 12px;
  border-radius: 6px;
  border: 1px solid var(--border);
  font-size: 13px;
}

.settings-v2-alert[data-tone="error"] {
  color: var(--status-error);
  border-color: rgba(239, 68, 68, 0.35);
}

.settings-v2-grid {
  display: grid;
  gap: 28px;
}

.settings-v2-section {
  display: grid;
  gap: 12px;
}

.settings-v2-section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  padding: 0 2px 10px;
  border-bottom: 1px solid var(--border);
}

.settings-v2-section-heading h2 {
  margin: 3px 0 0;
  font-size: 18px;
}

.settings-v2-section-heading p {
  max-width: 720px;
  margin: 4px 0 0;
  color: var(--text-secondary);
  font-size: 12px;
}

.settings-v2-section-kicker {
  color: var(--accent);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
}

.settings-v2-section-count {
  display: inline-grid;
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 11px;
}

.settings-v2-section-grid,
.settings-v2-advanced-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.settings-v2-row {
  display: grid;
  gap: 12px;
  padding: 14px;
}

.settings-v2-row-main,
.settings-v2-row-footer,
.settings-v2-panel > header,
.diagnostic-v2-section > summary,
.diagnostic-v2-check header,
.diagnostic-v2-check-meta {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.settings-v2-copy { min-width: 0; }

.settings-v2-copy h3,
.settings-v2-panel h2,
.diagnostic-v2-json-panel h2 {
  margin: 0;
  font-size: 15px;
}

.settings-v2-copy p,
.settings-v2-panel p,
.diagnostic-v2-json-panel p {
  margin: 4px 0 0;
  color: var(--text-secondary);
  font-size: 12px;
}

.settings-v2-copy code,
.diagnostic-v2-check code {
  display: inline-block;
  margin-top: 7px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 11px;
  overflow-wrap: anywhere;
}

.settings-v2-control {
  width: min(260px, 42%);
  min-width: 180px;
}

.settings-v2-readonly {
  min-height: 36px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 12px;
  text-align: right;
}

.settings-v2-meta-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.settings-v2-meta-grid > div {
  min-width: 0;
  border-top: 1px solid var(--border-subtle);
  padding-top: 8px;
}

.settings-v2-meta-grid strong {
  display: block;
  margin-top: 3px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-secondary);
  overflow-wrap: anywhere;
}

.settings-v2-badges,
.settings-v2-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.settings-v2-field-error,
.settings-v2-error-summary {
  color: var(--status-error);
  font-size: 12px;
}

.settings-v2-advanced {
  display: grid;
  gap: 12px;
  margin-top: 30px;
}

.settings-v2-panel { padding: 14px; }

.settings-v2-json,
.diagnostic-v2-json,
.settings-v2-history pre,
.diagnostic-v2-details pre {
  max-height: 360px;
  overflow: auto;
  white-space: pre-wrap;
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  background: var(--bg-primary);
  color: var(--text-secondary);
  padding: 10px;
  font-family: var(--font-mono);
  font-size: 11px;
}

.settings-v2-history {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.settings-v2-history-item {
  display: grid;
  gap: 4px;
  padding: 10px;
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
}

.settings-v2-local { margin-top: 28px; }

.settings-v2-savebar {
  position: sticky;
  bottom: 16px;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 18px;
  padding: 12px 14px;
  border: 1px solid rgba(129, 140, 248, 0.5);
  border-radius: 8px;
  background: rgba(17, 24, 39, 0.96);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.3);
}

.settings-v2-savebar span {
  display: block;
  color: var(--text-secondary);
  font-size: 12px;
}

.diagnostic-v2-actions {
  justify-content: space-between;
  padding-bottom: 2px;
}

.diagnostic-v2-action-buttons {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.diagnostic-v2-action-buttons button {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.diagnostic-v2-action-buttons button svg {
  flex: 0 0 16px;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.diagnostic-v2-action-buttons button:disabled {
  opacity: 0.48;
  cursor: not-allowed;
}

.diagnostic-v2-meta {
  margin-left: auto;
  text-align: right;
}

.diagnostic-v2-empty {
  padding: 26px;
  border-left: 3px solid rgba(107, 140, 255, 0.5);
}
.diagnostic-v2-empty h2 { margin: 0 0 6px; }
.diagnostic-v2-empty p {
  max-width: 780px;
  margin: 0;
  color: var(--text-secondary);
  line-height: 1.6;
}

.diagnostic-v2-summary {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.diagnostic-v2-health {
  display: grid;
  gap: 12px;
  margin-bottom: 12px;
  padding: 14px;
}

.diagnostic-v2-health > header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.diagnostic-v2-health h2,
.diagnostic-v2-health p {
  margin: 0;
}

.diagnostic-v2-health p {
  max-width: 720px;
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.5;
}

.diagnostic-v2-health-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.diagnostic-v2-health-card {
  display: grid;
  gap: 8px;
  padding: 12px;
  background: var(--bg-primary);
}

.diagnostic-v2-health-card > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.diagnostic-v2-health-card p {
  min-height: 36px;
  font-size: 12px;
}

.diagnostic-v2-card { padding: 13px; }

.diagnostic-v2-card strong {
  display: block;
  font-family: var(--font-mono);
  font-size: 20px;
  overflow-wrap: anywhere;
}

.diagnostic-v2-card span {
  display: block;
  margin-top: 3px;
  color: var(--text-muted);
  font-size: 11px;
  text-transform: uppercase;
}

.diagnostic-v2-card.status-healthy strong { color: var(--status-ok); }
.diagnostic-v2-card.status-degraded strong,
.diagnostic-v2-card.status-warning strong { color: var(--status-warn); }
.diagnostic-v2-card.status-critical strong,
.diagnostic-v2-card.status-error strong { color: var(--status-error); }
.diagnostic-v2-card.status-unavailable strong { color: var(--text-muted); }
.diagnostic-v2-card.status-zero strong { color: var(--text-secondary); }

.diagnostic-v2-cause {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 12px 14px;
  margin-bottom: 12px;
}

.diagnostic-v2-cause > span { color: var(--text-secondary); }
.diagnostic-v2-sections { display: grid; gap: 10px; }
.diagnostic-v2-section { overflow: hidden; }

.diagnostic-v2-section > summary {
  cursor: pointer;
  padding: 13px 14px;
  list-style: none;
}

.diagnostic-v2-section > summary::-webkit-details-marker { display: none; }
.diagnostic-v2-section > summary > div:first-child { min-width: 0; }
.diagnostic-v2-section > summary strong { display: block; font-size: 14px; }
.diagnostic-v2-section > summary span { display: inline-flex; color: var(--text-secondary); font-size: 12px; }

.diagnostic-v2-section-meta,
.diagnostic-v2-check-badges {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.diagnostic-v2-section-meta {
  flex: 0 0 auto;
}

.diagnostic-v2-checks {
  display: grid;
  gap: 8px;
  padding: 0 10px 10px;
}

.diagnostic-v2-check {
  display: grid;
  gap: 8px;
  padding: 11px;
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  background: var(--bg-primary);
}

.diagnostic-v2-check header strong {
  display: block;
  margin-top: 3px;
  font-size: 13px;
}

.diagnostic-v2-check-meta {
  justify-content: flex-start;
  flex-wrap: wrap;
}

.diagnostic-v2-check-meta span {
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 11px;
}

.diagnostic-v2-details summary {
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 12px;
}

.diagnostic-v2-details pre {
  margin: 8px 0 0;
}

.diagnostic-v2-json-panel {
  margin-top: 12px;
  padding: 14px;
}

.diagnostic-v2-json-panel > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
}

.diagnostic-v2-json-panel > summary small {
  color: var(--text-muted);
}

@media (max-width: 1180px) {
  .settings-v2-section-grid,
  .settings-v2-advanced-grid { grid-template-columns: 1fr; }
  .settings-v2-meta-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .diagnostic-v2-summary { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .diagnostic-v2-health-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 768px) {
  .settings-v2-shell,
  .diagnostic-v2-shell {
    width: min(100% - 20px, 100%);
    padding-bottom: 116px;
  }

  .settings-v2-row-main,
  .settings-v2-row-footer,
  .settings-v2-panel > header,
  .diagnostic-v2-section > summary,
  .diagnostic-v2-check header { display: grid; }

  .settings-v2-toolbar {
    display: grid;
  }

  .settings-v2-toolbar label {
    width: 100%;
    min-width: 0;
  }

  .settings-v2-result-count {
    align-self: auto;
    padding-bottom: 0;
  }

  .settings-v2-control {
    width: 100%;
    min-width: 0;
  }

  .settings-v2-readonly {
    justify-content: flex-start;
    text-align: left;
  }

  .settings-v2-meta-grid { grid-template-columns: 1fr 1fr; }
  .settings-v2-savebar { bottom: 74px; display: grid; }
  .diagnostic-v2-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  .diagnostic-v2-actions {
    display: grid;
    align-items: stretch;
  }

  .diagnostic-v2-action-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
  }

  .diagnostic-v2-action-buttons [data-generate-diagnostic] {
    grid-column: 1 / -1;
  }

  .diagnostic-v2-action-buttons button {
    width: 100%;
  }

  .diagnostic-v2-meta {
    margin-left: 0;
    text-align: left;
  }

  .diagnostic-v2-toolbar {
    align-items: stretch;
  }

  .diagnostic-v2-toolbar label {
    width: 100%;
    min-width: 0;
  }

  .diagnostic-v2-section-meta,
  .diagnostic-v2-check-badges {
    justify-content: flex-start;
  }
  .diagnostic-v2-health-grid { grid-template-columns: 1fr; }
}

/* Overview particle graph landing */

.particle-overview-shell.shell-with-sidebar {
  width: auto;
  max-width: none;
  min-height: 100vh;
  margin-right: 0;
  margin-left: var(--sidebar-width);
  padding: 0;
}

html.sidebar-collapsed body .particle-overview-shell.shell-with-sidebar {
  margin-left: var(--sidebar-collapsed-width);
}

.particle-graph-stage {
  position: relative;
  display: grid;
  min-height: 100vh;
  place-items: center;
  overflow: hidden;
  isolation: isolate;
  background:
    radial-gradient(circle at 50% 48%, rgba(132, 162, 255, 0.055), transparent 31%),
    radial-gradient(circle at 18% 26%, rgba(56, 189, 248, 0.035), transparent 26%),
    linear-gradient(180deg, #05070b 0%, #080c12 56%, #04060a 100%);
}

.particle-graph-stage::before,
.particle-graph-stage::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.particle-graph-stage::before {
  z-index: 0;
  background-image:
    linear-gradient(rgba(132, 162, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(132, 162, 255, 0.03) 1px, transparent 1px);
  background-size: 58px 58px;
}

.particle-graph-stage::after {
  z-index: 2;
  box-shadow:
    inset 0 0 84px rgba(0, 0, 0, 0.78),
    inset 0 0 210px rgba(0, 0, 0, 0.62);
}

.particle-graph-canvas,
.particle-graph-grid {
  position: absolute;
  inset: 0;
}

.particle-graph-canvas {
  z-index: 1;
}

.particle-graph-grid {
  z-index: 0;
  background: none;
}

.particle-graph-core {
  position: relative;
  z-index: 4;
  display: grid;
  width: min(330px, calc(100vw - 56px));
  min-height: 168px;
  align-content: center;
  justify-items: center;
  gap: 14px;
  padding: 22px;
  text-align: center;
  animation: particle-core-arrive 850ms ease 720ms both;
}

.particle-graph-core::before {
  content: "";
  position: absolute;
  inset: -34px -42px;
  z-index: -1;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(5, 7, 11, 0.72) 0%, rgba(5, 7, 11, 0.46) 42%, rgba(5, 7, 11, 0) 72%);
  box-shadow: none;
}

.particle-graph-core h1 {
  margin: 0;
}

.particle-graph-core h1 {
  color: #eef3ff;
  font-size: 56px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0;
}

.particle-primary {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  margin-top: 8px;
  padding: 0 18px;
  border: 1px solid rgba(132, 162, 255, 0.62);
  border-radius: 8px;
  background: rgba(132, 162, 255, 0.16);
  color: #f4f7ff;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0;
  text-decoration: none;
  transition: background 180ms ease, border-color 180ms ease, transform 180ms ease, box-shadow 180ms ease;
}

.particle-primary:hover,
.particle-primary:focus-visible {
  border-color: rgba(186, 202, 255, 0.95);
  background: rgba(132, 162, 255, 0.28);
  box-shadow: 0 0 26px rgba(132, 162, 255, 0.22);
  color: #fff;
  transform: translateY(-1px);
}

.particle-primary:focus-visible {
  outline: 2px solid var(--border-focus);
  outline-offset: 3px;
}

@keyframes particle-core-arrive {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@media (max-width: 768px) {
  .particle-overview-shell.shell-with-sidebar,
  html.sidebar-collapsed body .particle-overview-shell.shell-with-sidebar {
    width: auto;
    max-width: none;
    margin: 0;
    padding: 68px 12px 76px;
  }

  .particle-graph-stage {
    min-height: calc(100vh - 144px);
    border: 1px solid var(--border);
    border-radius: 8px;
  }

  .particle-graph-core {
    width: min(284px, calc(100vw - 42px));
    min-height: 152px;
    padding: 20px;
  }

  .particle-graph-core h1 {
    font-size: 42px;
  }

}

@media (max-width: 420px) {
  .particle-graph-core {
    width: min(284px, calc(100vw - 36px));
  }

  .particle-graph-core h1 {
    font-size: 36px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .particle-graph-core,
  .particle-primary {
    animation: none !important;
    transition: none !important;
  }
}

/* Supervision cockpit */

.observability-shell {
  width: auto;
  max-width: 1560px;
}

.observability-status-strip {
  display: flex;
  flex-wrap: wrap;
  gap: var(--gap-sm);
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--gap-md);
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 12px;
}

.observability-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--gap-sm);
  margin-bottom: var(--gap-md);
}

.observability-metric {
  display: grid;
  gap: 5px;
  min-width: 0;
  padding: var(--gap-md);
  border: 1px solid var(--border);
  border-left: 3px solid var(--status-info);
  border-radius: var(--radius-md);
  background: var(--bg-glass);
}

.observability-metric.tone-ok {
  border-left-color: var(--status-ok);
}

.observability-metric.tone-warn {
  border-left-color: var(--status-warn);
}

.observability-metric.tone-error {
  border-left-color: var(--status-error);
}

.observability-metric strong {
  min-width: 0;
  overflow: hidden;
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 25px;
  line-height: 1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.observability-metric span,
.observability-metric small,
.observability-panel-meta {
  min-width: 0;
  overflow: hidden;
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.observability-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 420px);
  gap: var(--gap-md);
  align-items: start;
}

.observability-history-panel {
  margin-bottom: var(--gap-md);
}

.observability-range-tabs {
  display: inline-flex;
  gap: 2px;
  align-items: center;
  padding: 3px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: rgba(15, 23, 42, 0.42);
}

.observability-range-tabs button {
  min-width: 42px;
  min-height: 30px;
  padding: 0 10px;
  border: 0;
  border-radius: calc(var(--radius-md) - 2px);
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 12px;
  cursor: pointer;
}

.observability-range-tabs button:hover,
.observability-range-tabs button:focus-visible {
  color: var(--text-primary);
  background: rgba(148, 163, 184, 0.12);
}

.observability-range-tabs button.active {
  color: var(--text-primary);
  background: var(--bg-primary);
  box-shadow: inset 0 0 0 1px var(--border);
}

.observability-history-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--gap-sm);
}

.observability-history-card {
  display: grid;
  gap: 10px;
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--border-subtle);
  border-left: 3px solid var(--status-info);
  border-radius: var(--radius-md);
  background: rgba(15, 23, 42, 0.42);
}

.observability-history-card.tone-ok {
  border-left-color: var(--status-ok);
}

.observability-history-card.tone-warn {
  border-left-color: var(--status-warn);
}

.observability-history-card.tone-error {
  border-left-color: var(--status-error);
}

.observability-history-card header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: var(--gap-sm);
  align-items: center;
}

.observability-history-card header strong,
.observability-history-card header span {
  min-width: 0;
  overflow: hidden;
  font-family: var(--font-mono);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.observability-history-card header strong {
  color: var(--text-primary);
  font-size: 13px;
}

.observability-history-card header span {
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 700;
}

.observability-line-chart {
  display: block;
  width: 100%;
  min-height: 160px;
  aspect-ratio: 640 / 240;
  overflow: visible;
}

.observability-chart-grid {
  stroke: rgba(148, 163, 184, 0.2);
  stroke-width: 1;
}

.observability-chart-axis-label {
  fill: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 10px;
}

.observability-chart-line {
  fill: none;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.observability-chart-marker {
  stroke: var(--bg-primary);
  stroke-width: 1.5;
}

.observability-chart-line.line-0 {
  stroke: var(--status-warn);
}

.observability-chart-marker.line-0 {
  fill: var(--status-warn);
}

.observability-chart-swatch.line-0 {
  background: var(--status-warn);
}

.observability-chart-line.line-1 {
  stroke: var(--status-info);
}

.observability-chart-marker.line-1 {
  fill: var(--status-info);
}

.observability-chart-swatch.line-1 {
  background: var(--status-info);
}

.observability-chart-line.line-2 {
  stroke: var(--status-ok);
}

.observability-chart-marker.line-2 {
  fill: var(--status-ok);
}

.observability-chart-swatch.line-2 {
  background: var(--status-ok);
}

.observability-chart-line.line-3 {
  stroke: #a78bfa;
}

.observability-chart-marker.line-3 {
  fill: #a78bfa;
}

.observability-chart-swatch.line-3 {
  background: #a78bfa;
}

.observability-chart-line.line-4 {
  stroke: #fb7185;
}

.observability-chart-marker.line-4 {
  fill: #fb7185;
}

.observability-chart-swatch.line-4 {
  background: #fb7185;
}

.observability-chart-legend {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.observability-chart-legend-item {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr) auto;
  gap: 7px;
  align-items: center;
  min-width: 0;
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 11px;
}

.observability-chart-legend-item span,
.observability-chart-legend-item strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.observability-chart-legend-item span {
  max-width: min(260px, 58vw);
  overflow-wrap: anywhere;
  white-space: normal;
  line-height: 1.25;
}

.observability-chart-swatch {
  width: 9px;
  height: 9px;
  border-radius: 999px;
}

.observability-panel h2,
.observability-panel p {
  margin: 0;
}

.observability-query-list,
.observability-rule-list {
  display: grid;
  gap: var(--gap-sm);
}

.observability-alert-side,
.observability-alert-list {
  display: grid;
  gap: var(--gap-sm);
  min-width: 0;
}

.observability-side-subheader {
  display: flex;
  gap: var(--gap-sm);
  align-items: center;
  justify-content: space-between;
  min-width: 0;
  margin-top: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 12px;
}

.observability-side-subheader span {
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.observability-query {
  overflow: hidden;
  border: 1px solid var(--border-subtle);
  border-left: 3px solid var(--status-info);
  border-radius: var(--radius-md);
  background: rgba(15, 23, 42, 0.42);
}

.observability-query.status-ok {
  border-left-color: var(--status-ok);
}

.observability-query.status-warn {
  border-left-color: var(--status-warn);
}

.observability-query.status-error {
  border-left-color: var(--status-error);
}

.observability-query summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: var(--gap-sm);
  align-items: center;
  min-height: 44px;
  padding: 10px 12px;
  cursor: pointer;
}

.observability-query summary strong,
.observability-query summary span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.observability-query summary span {
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-weight: 700;
}

.observability-query code {
  display: block;
  padding: 8px 12px;
  overflow-x: auto;
  border-top: 1px solid var(--border-subtle);
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 12px;
  white-space: nowrap;
}

.observability-series-table {
  display: grid;
}

.observability-series-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: var(--gap-sm);
  align-items: center;
  min-height: 34px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-subtle);
}

.observability-series-row:last-child {
  border-bottom: 0;
}

.observability-series-row span,
.observability-series-row strong {
  min-width: 0;
  overflow: hidden;
  font-family: var(--font-mono);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.observability-series-row span {
  color: var(--text-secondary);
}

.observability-rule {
  display: grid;
  gap: 7px;
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--border-subtle);
  border-left: 3px solid var(--status-info);
  border-radius: var(--radius-md);
  background: rgba(15, 23, 42, 0.42);
}

.observability-rule.severity-warning,
.observability-rule.severity-warn {
  border-left-color: var(--status-warn);
}

.observability-rule.severity-critical,
.observability-rule.severity-error {
  border-left-color: var(--status-error);
}

.observability-rule header {
  display: flex;
  gap: var(--gap-sm);
  align-items: center;
  justify-content: space-between;
  min-width: 0;
}

.observability-rule strong,
.observability-rule p,
.observability-rule small {
  min-width: 0;
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.observability-rule p {
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.4;
}

.observability-rule small {
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 11px;
  white-space: nowrap;
}

.observability-alert-link {
  justify-self: start;
}

@media (max-width: 1120px) {
  .observability-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .observability-layout {
    grid-template-columns: 1fr;
  }

  .observability-history-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 680px) {
  .observability-metrics {
    grid-template-columns: 1fr;
  }

  .observability-query summary,
  .observability-series-row {
    grid-template-columns: 1fr;
  }

  .observability-history-card header,
  .observability-chart-legend-item {
    grid-template-columns: 1fr;
  }

  .observability-chart-swatch {
    display: none;
  }
}

/* Supervision realtime board */

.observability-shell {
  max-width: 1500px;
}

.observability-control-rail {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: var(--gap-sm);
  align-items: center;
  margin: 0 0 var(--gap-md);
}

.observability-control-rail .observability-status-strip {
  justify-content: flex-start;
  margin: 0;
}

.observability-section,
.observability-chart-card,
.observability-gpu-gauge,
.observability-alert-donut,
.observability-rule-matrix,
.observability-alert-card {
  min-width: 0;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: rgba(15, 23, 42, 0.5);
}

.observability-board {
  display: grid;
  gap: var(--gap-md);
  align-items: start;
}

.observability-tab-panels {
  min-width: 0;
}

.observability-tab-panel[hidden] {
  display: none !important;
}

.observability-section {
  display: grid;
  gap: var(--gap-sm);
  padding: 0;
  overflow: hidden;
}

.observability-section > :not(header) {
  margin-right: var(--gap-md);
  margin-left: var(--gap-md);
}

.observability-section > :last-child {
  margin-bottom: var(--gap-md);
}

.observability-section-wide {
  grid-row: auto;
}

.observability-section-header {
  display: flex;
  gap: var(--gap-md);
  align-items: center;
  justify-content: space-between;
  min-width: 0;
}

.observability-section-header h2,
.observability-section-header p {
  margin: 0;
}

.observability-section-header h2 {
  color: var(--text-primary);
  font-size: 15px;
  line-height: 1.1;
}

.observability-section-header p {
  min-width: 0;
  overflow: hidden;
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.observability-section-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 52px;
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.observability-section-status.tone-ok {
  border-color: rgba(34, 197, 94, 0.35);
  color: var(--status-ok);
}

.observability-section-status.tone-warn {
  border-color: rgba(245, 158, 11, 0.42);
  color: var(--status-warn);
}

.observability-section-status.tone-error {
  border-color: rgba(248, 113, 113, 0.42);
  color: var(--status-error);
}

.observability-gpu-visuals,
.observability-alert-visuals {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--gap-sm);
}

.observability-llm-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
  overflow: hidden;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--ui-surface);
}

.observability-llm-stat {
  display: grid;
  gap: 5px;
  min-width: 0;
  padding: 12px;
  border-right: 1px solid var(--border-subtle);
}

.observability-llm-stat:last-child {
  border-right: 0;
}

.observability-route-usage {
  margin-top: var(--gap-sm);
}

.observability-route-table-scroll {
  overflow-x: auto;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--ui-surface);
}

.observability-route-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.observability-route-table th,
.observability-route-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-subtle);
  text-align: right;
  white-space: nowrap;
}

.observability-route-table th:first-child,
.observability-route-table td:first-child,
.observability-route-table th:nth-child(2),
.observability-route-table td:nth-child(2) {
  text-align: left;
}

.observability-route-table thead th {
  color: var(--text-secondary);
  font-weight: 700;
}

.observability-route-table tbody th {
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-weight: 700;
}

.observability-route-table tbody tr:last-child > * {
  border-bottom: 0;
}

.observability-gpu-gauge {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  gap: var(--gap-sm);
  align-items: center;
  padding: 12px;
  --ring-color: var(--status-info);
}

.observability-gpu-gauge.tone-ok,
.observability-alert-donut.tone-ok {
  --ring-color: var(--status-ok);
}

.observability-gpu-gauge.tone-warn,
.observability-alert-donut.tone-warn {
  --ring-color: var(--status-warn);
}

.observability-gpu-gauge.tone-error,
.observability-alert-donut.tone-error {
  --ring-color: var(--status-error);
}

.observability-ring {
  position: relative;
  display: grid;
  place-items: center;
  width: 70px;
  height: 70px;
  border-radius: 50%;
  background: conic-gradient(var(--ring-color) calc(var(--value, 0) * 1%), rgba(148, 163, 184, 0.14) 0);
}

.observability-ring::after {
  content: "";
  position: absolute;
  inset: 8px;
  border-radius: 50%;
  background: var(--bg-primary);
}

.observability-ring strong {
  position: relative;
  z-index: 1;
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 14px;
}

.observability-gpu-gauge > div:last-child {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.observability-gpu-gauge span,
.observability-gpu-gauge small,
.observability-llm-stat span,
.observability-llm-stat strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.observability-gpu-gauge span,
.observability-llm-stat strong {
  color: var(--text-primary);
  font-weight: 800;
}

.observability-gpu-gauge small,
.observability-llm-stat span {
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 11px;
}

.observability-llm-stat strong {
  font-family: var(--font-mono);
  font-size: 18px;
  line-height: 1.1;
}

.observability-fill-bar {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.13);
}

.observability-fill-bar i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--status-info);
}

.observability-fill-bar.tone-ok i {
  background: var(--status-ok);
}

.observability-fill-bar.tone-warn i {
  background: var(--status-warn);
}

.observability-fill-bar.tone-error i {
  background: var(--status-error);
}

.observability-chart-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--gap-sm);
}

.observability-chart-grid.compact {
  grid-template-columns: 1fr;
}

.observability-chart-card {
  display: grid;
  gap: 8px;
  padding: 12px;
  border-left: 3px solid var(--status-info);
  background: var(--ui-surface);
}

.observability-chart-card.tone-ok {
  border-left-color: var(--status-ok);
}

.observability-chart-card.tone-warn {
  border-left-color: var(--status-warn);
}

.observability-chart-card.tone-error {
  border-left-color: var(--status-error);
}

.observability-chart-card header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: var(--gap-sm);
  align-items: center;
}

.observability-chart-card header strong,
.observability-chart-card header span {
  min-width: 0;
  overflow: hidden;
  font-family: var(--font-mono);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.observability-chart-card header strong {
  color: var(--text-primary);
  font-size: 13px;
}

.observability-chart-card header span {
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 800;
}

.observability-line-chart {
  min-height: 174px;
  aspect-ratio: 640 / 240;
}

.observability-chart-grid-line {
  stroke: rgba(148, 163, 184, 0.2);
  stroke-width: 1;
}

.observability-chart-time-axis,
.observability-chart-time-tick {
  stroke: rgba(148, 163, 184, 0.24);
  stroke-width: 1;
}

.observability-chart-time-label {
  fill: var(--text-secondary);
  font-size: 11px;
}

.observability-chart-line.line-3 {
  stroke: #a78bfa;
}

.observability-chart-marker.line-3,
.observability-chart-swatch.line-3 {
  fill: #a78bfa;
  background: #a78bfa;
}

.observability-chart-line.line-4 {
  stroke: #fb7185;
}

.observability-chart-marker.line-4,
.observability-chart-swatch.line-4 {
  fill: #fb7185;
  background: #fb7185;
}

.observability-chart-line.line-5 {
  stroke: #22d3ee;
}

.observability-chart-marker.line-5,
.observability-chart-swatch.line-5 {
  fill: #22d3ee;
  background: #22d3ee;
}

.observability-alert-donut,
.observability-rule-matrix {
  padding: 12px;
}

.observability-alert-donut {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  gap: var(--gap-sm);
  align-items: center;
  --ring-color: var(--status-info);
}

.observability-alert-donut > span {
  color: var(--text-primary);
  font-weight: 800;
}

.observability-rule-matrix {
  display: grid;
  gap: 10px;
}

.observability-rule-matrix strong {
  color: var(--text-primary);
}

.observability-rule-dots {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(12px, 1fr));
  gap: 6px;
}

.observability-rule-dots span {
  display: block;
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: var(--status-info);
}

.observability-rule-dots span.tone-ok {
  background: var(--status-ok);
}

.observability-rule-dots span.tone-warn {
  background: var(--status-warn);
}

.observability-rule-dots span.tone-error {
  background: var(--status-error);
}

.observability-alert-list:empty {
  display: none;
}

.observability-alert-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px 10px;
  padding: 10px;
  border-left: 3px solid var(--status-warn);
}

.observability-alert-card.severity-critical,
.observability-alert-card.severity-error {
  border-left-color: var(--status-error);
}

.observability-alert-card p {
  grid-column: 1 / -1;
  min-width: 0;
  margin: 0;
  overflow: hidden;
  color: var(--text-secondary);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.observability-compact-state {
  display: grid;
  place-items: center;
  min-height: 104px;
  padding: 12px;
  border: 1px dashed var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-muted);
  text-align: center;
}

.observability-compact-state strong,
.observability-compact-state span {
  display: block;
}

.observability-query code {
  min-width: 0;
  overflow-wrap: anywhere;
  white-space: normal;
}

@media (max-width: 1100px) {
  .observability-board {
    grid-template-columns: 1fr;
  }

  .observability-section-wide {
    grid-row: auto;
  }
}

@media (max-width: 760px) {
  .observability-shell {
    padding-bottom: 88px;
  }

  .observability-control-rail {
    grid-template-columns: 1fr;
  }

  .observability-status-strip,
  .observability-range-tabs {
    width: 100%;
  }

  .observability-range-tabs button {
    flex: 1;
  }

  .observability-gpu-visuals,
  .observability-alert-visuals,
  .observability-chart-grid {
    grid-template-columns: 1fr;
  }

  .observability-llm-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .observability-llm-stat:nth-child(2n) {
    border-right: 0;
  }

  .observability-llm-stat:nth-child(n + 3) {
    border-top: 1px solid var(--border-subtle);
  }

  .observability-section {
    padding: 0;
  }

  .observability-section > :not(header) {
    margin-right: 12px;
    margin-left: 12px;
  }

  .observability-section-header {
    align-items: flex-start;
  }

  .observability-chart-card header {
    grid-template-columns: 1fr;
  }

  .observability-line-chart {
    min-height: 150px;
  }
}
