/* S121 · Executive Visual System + S120 Final · Executive Visual System
   Shared visual foundation for the Founder OS surface.
   Scope is intentionally CSS-only: no provider, queue, finance, or runtime behavior. */

:root {
  --ev-font-ui: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --ev-font-mono: "SF Mono", "Roboto Mono", ui-monospace, Menlo, Consolas, monospace;

  --ev-space-0: 0;
  --ev-space-1: 4px;
  --ev-space-2: 8px;
  --ev-space-3: 12px;
  --ev-space-4: 16px;
  --ev-space-5: 20px;
  --ev-space-6: 24px;
  --ev-space-7: 32px;
  --ev-space-8: 40px;
  --ev-space-9: 56px;
  --ev-space-panel: 18px;
  --ev-space-section: 28px;

  --ev-radius-xs: 6px;
  --ev-radius-sm: 8px;
  --ev-radius-md: 12px;
  --ev-radius-lg: 16px;
  --ev-radius-xl: 22px;
  --ev-radius-panel: 18px;
  --ev-radius-pill: 999px;

  --ev-type-xs: 11px;
  --ev-type-sm: 12px;
  --ev-type-base: 14px;
  --ev-type-md: 15px;
  --ev-type-lg: 18px;
  --ev-type-xl: 24px;
  --ev-line-tight: 1.22;
  --ev-line-body: 1.55;

  --ev-surface-0: #101114;
  --ev-surface-1: #15171b;
  --ev-surface-2: #1b1e24;
  --ev-surface-3: #222630;
  --ev-surface-glass: rgba(27, 30, 36, 0.82);
  --ev-line: rgba(255, 255, 255, 0.075);
  --ev-line-strong: rgba(255, 255, 255, 0.14);
  --ev-line-silent: rgba(255, 255, 255, 0.052);

  --ev-primary: #7aa2ff;
  --ev-primary-soft: rgba(122, 162, 255, 0.14);
  --ev-primary-muted: rgba(122, 162, 255, 0.08);
  --ev-secondary: #b99dff;
  --ev-secondary-soft: rgba(185, 157, 255, 0.14);
  --ev-contextual: #5ed3c5;
  --ev-contextual-soft: rgba(94, 211, 197, 0.13);
  --ev-success: #6fdf8f;
  --ev-success-soft: rgba(111, 223, 143, 0.13);
  --ev-warning: #f3c56b;
  --ev-warning-soft: rgba(243, 197, 107, 0.14);
  --ev-critical: #ff7b7b;
  --ev-critical-soft: rgba(255, 123, 123, 0.14);
  --ev-muted: #8c929d;
  --ev-text: #eef1f7;
  --ev-text-2: #bdc3cf;
  --ev-text-3: #8d94a1;

  --ev-shadow-soft: 0 16px 48px rgba(0, 0, 0, 0.22);
  --ev-shadow-card: 0 10px 30px rgba(0, 0, 0, 0.18);
  --ev-shadow-panel: 0 22px 70px rgba(0, 0, 0, 0.30);
  --ev-shadow-silent: 0 1px 0 rgba(255, 255, 255, 0.035), 0 14px 36px rgba(0, 0, 0, 0.14);
  --ev-shadow-ambient: 0 24px 90px rgba(0, 0, 0, 0.26);
  --ev-focus-ring: 0 0 0 3px rgba(122, 162, 255, 0.18);

  --ev-motion-fast: 120ms;
  --ev-motion-base: 180ms;
  --ev-motion-slow: 280ms;
  --ev-ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --ev-ease-out: cubic-bezier(0.16, 1, 0.3, 1);

  --ev-state-primary: var(--ev-primary);
  --ev-state-secondary: var(--ev-secondary);
  --ev-state-muted: var(--ev-muted);
  --ev-state-contextual: var(--ev-contextual);
  --ev-state-critical: var(--ev-critical);
  --ev-state-success: var(--ev-success);
}

html {
  color-scheme: dark;
}

body {
  font-family: var(--ev-font-ui);
}

:where(button, a, input, textarea, select, summary, .card, .badge, .status-pill, .task-feed-item, .codex-task-card, .artifact-chat-thumb) {
  transition:
    background-color var(--ev-motion-base) var(--ev-ease),
    border-color var(--ev-motion-base) var(--ev-ease),
    color var(--ev-motion-base) var(--ev-ease),
    box-shadow var(--ev-motion-base) var(--ev-ease),
    transform var(--ev-motion-fast) var(--ev-ease),
    opacity var(--ev-motion-base) var(--ev-ease);
}

:where(button, a, input, textarea, select):focus-visible {
  outline: none;
  box-shadow: var(--ev-focus-ring);
}

:where(button, .btn, .icon-btn, .send-btn, .flow-action, .mission-create-btn) {
  font-family: var(--ev-font-ui);
}

:where(.badge, .pill, .status-pill, .mode-chip, .persona-chip, .capability-pill, .msg-capability-badge, .type-chip, .risk-chip) {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 24px;
  padding: 3px 9px;
  border: 1px solid var(--ev-line);
  border-radius: var(--ev-radius-pill);
  background: rgba(255, 255, 255, 0.045);
  color: var(--ev-text-2);
  font-size: var(--ev-type-xs);
  font-weight: 650;
  line-height: 1.2;
  letter-spacing: 0;
}

:where(.badge.primary, .status-primary, .is-primary, [data-state="primary"], [data-tone="primary"]) {
  border-color: rgba(122, 162, 255, 0.28);
  background: var(--ev-primary-soft);
  color: #dce6ff;
}

:where(.badge.secondary, .status-secondary, .is-secondary, [data-state="secondary"], [data-tone="secondary"]) {
  border-color: rgba(185, 157, 255, 0.25);
  background: var(--ev-secondary-soft);
  color: #eadfff;
}

:where(.badge.contextual, .status-contextual, .is-contextual, [data-state="contextual"], [data-tone="contextual"]) {
  border-color: rgba(94, 211, 197, 0.26);
  background: var(--ev-contextual-soft);
  color: #d7fff9;
}

:where(.badge.muted, .status-muted, .is-muted, [data-state="muted"], [data-tone="muted"]) {
  border-color: var(--ev-line-silent);
  background: rgba(255, 255, 255, 0.026);
  color: var(--ev-text-3);
}

:where(.badge.success, .status-success, .is-success, [data-state="success"], [data-status="success"], [data-status="passed"], [data-tone="success"]) {
  border-color: rgba(111, 223, 143, 0.28);
  background: var(--ev-success-soft);
  color: #d8ffe1;
}

:where(.badge.warning, .status-warning, .is-warning, [data-state="warning"], [data-status="warning"], [data-status="attention"], [data-tone="warning"]) {
  border-color: rgba(243, 197, 107, 0.30);
  background: var(--ev-warning-soft);
  color: #ffe7ad;
}

:where(.badge.critical, .status-critical, .is-critical, [data-state="critical"], [data-status="failed"], [data-status="error"], [data-tone="critical"]) {
  border-color: rgba(255, 123, 123, 0.32);
  background: var(--ev-critical-soft);
  color: #ffd6d6;
}

:where(.card, .panel, .drawer, .summary-card, .metric-card, .mission-card, .capability-card, .knowledge-card, .artifact-card, .event-card, .list-card, .alert-card) {
  border: 1px solid var(--ev-line-silent);
  border-radius: var(--ev-radius-panel);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.012)),
    var(--ev-surface-1);
  box-shadow: var(--ev-shadow-silent);
}

:where(.card, .panel, .drawer, .summary-card, .metric-card, .mission-card, .capability-card, .knowledge-card, .artifact-card, .event-card, .list-card, .alert-card):hover {
  border-color: var(--ev-line-strong);
}

:where(.card-header, .panel-header, .drawer-header, .section-header, .list-header) {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--ev-space-3);
}

:where(.card-title, .panel-title, .drawer-title, .section-title, .list-title) {
  color: var(--ev-text);
  font-size: var(--ev-type-sm);
  font-weight: 760;
  line-height: var(--ev-line-tight);
  letter-spacing: 0;
}

:where(.card-subtitle, .panel-subtitle, .drawer-subtitle, .section-subtitle, .list-subtitle) {
  color: var(--ev-text-3);
  font-size: var(--ev-type-xs);
  line-height: var(--ev-line-body);
  letter-spacing: 0;
}

:where(table) {
  width: 100%;
  border-collapse: collapse;
  color: var(--ev-text-2);
  font-size: var(--ev-type-sm);
}

:where(th) {
  color: var(--ev-text-3);
  font-size: var(--ev-type-xs);
  font-weight: 750;
  text-align: left;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

:where(td, th) {
  border-bottom: 1px solid var(--ev-line);
  padding: 10px 8px;
}

:where(.timeline, .execution-timeline, .activity-list) {
  position: relative;
}

:where(.timeline-item, .activity-item, .event-row) {
  border-color: var(--ev-line);
}

:where(.timeline-item, .activity-item, .event-row, .list-row, .artifact-row) {
  border-bottom: 1px solid var(--ev-line-silent);
}

:where(.timeline-item:last-child, .activity-item:last-child, .event-row:last-child, .list-row:last-child, .artifact-row:last-child) {
  border-bottom-color: transparent;
}

:where(.technical-links) {
  display: inline-block;
  color: var(--ev-text-3);
  font-size: var(--ev-type-xs);
}

:where(.technical-links summary) {
  cursor: pointer;
  color: var(--ev-text-3);
  list-style: none;
}

:where(.technical-links summary::-webkit-details-marker) {
  display: none;
}

:where(.technical-links[open]) {
  padding: 4px 8px;
  border: 1px solid var(--ev-line);
  border-radius: var(--ev-radius-sm);
  background: rgba(255, 255, 255, 0.035);
}

:where(.technical-links a) {
  color: var(--ev-primary);
  text-decoration: none;
}

:where(.loading-dot, .spinner, .live-dot) {
  color: var(--ev-warning);
}

body:not(.ia-clean) {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 12% -10%, rgba(122, 162, 255, 0.12), transparent 30%),
    radial-gradient(circle at 88% 0%, rgba(94, 211, 197, 0.08), transparent 28%),
    var(--ev-surface-0);
  color: var(--ev-text);
  font-size: var(--ev-type-base);
  line-height: var(--ev-line-body);
}

body:not(.ia-clean) :where(.container, .shell, main) {
  box-sizing: border-box;
}

body:not(.ia-clean) :where(.container, .shell) {
  width: min(1180px, calc(100vw - 40px));
  margin: 0 auto;
}

body:not(.ia-clean) :where(.topbar, header.topbar, .page-header) {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--ev-space-4);
  min-height: 64px;
  border-bottom: 1px solid var(--ev-line);
  background: rgba(16, 17, 20, 0.82);
  backdrop-filter: blur(18px);
}

body:not(.ia-clean) :where(.hero, .page-hero) {
  padding: var(--ev-space-8) 0 var(--ev-space-6);
}

body:not(.ia-clean) :where(h1, .hero-title) {
  margin: 0 0 var(--ev-space-3);
  color: var(--ev-text);
  font-size: clamp(28px, 4vw, 48px);
  line-height: 1.04;
  letter-spacing: 0;
}

body:not(.ia-clean) :where(h2, h3) {
  color: var(--ev-text);
  letter-spacing: 0;
}

body:not(.ia-clean) :where(p, .muted, .subtitle) {
  color: var(--ev-text-3);
}

body:not(.ia-clean) :where(.grid, .cards, .summary-grid) {
  gap: var(--ev-space-4);
}

body:not(.ia-clean) :where(.back, .btn, button, a.button) {
  border-radius: var(--ev-radius-pill);
}

body.ia-clean {
  --bg: var(--ev-surface-0);
  --bg-lsb: #111215;
  --bg-center: #15171b;
  --bg-rp: #111215;
  --bg-elev: var(--ev-surface-2);
  --bg-hover: rgba(255, 255, 255, 0.055);
  --bg-input: rgba(255, 255, 255, 0.045);
  --tx-1: var(--ev-text);
  --tx-2: var(--ev-text-2);
  --tx-3: var(--ev-text-3);
  --bd-1: var(--ev-line);
  --bd-2: var(--ev-line-strong);
  --bd-silent: var(--ev-line-silent);
  --r-sm: var(--ev-radius-sm);
  --r-md: var(--ev-radius-md);
  --r-lg: var(--ev-radius-lg);
  --r-xl: var(--ev-radius-xl);
  background: var(--ev-surface-0);
}

body.ia-clean :where(.tb, .lsb, .rp, .center) {
  border-color: var(--ev-line-silent);
}

body.ia-clean .tb {
  min-height: 60px;
  background: rgba(17, 18, 21, 0.78);
  backdrop-filter: blur(22px);
  box-shadow: 0 1px 0 var(--ev-line-silent);
}

body.ia-clean .tb-title {
  color: var(--ev-text);
  font-weight: 720;
  letter-spacing: 0;
}

body.ia-clean .lsb,
body.ia-clean .rp {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.012), transparent 30%),
    var(--ev-surface-0);
}

body.ia-clean .center {
  background:
    radial-gradient(circle at 50% -12%, rgba(122, 162, 255, 0.052), transparent 28%),
    var(--ev-surface-1);
}

body.ia-clean :where(.comp-card, .founder-flow-dock, .founder-presence-copilot, .rp-codex-section, .rp-exec-card, .rp-ledger-task, .codex-task-card, .task-feed-item, .artifact-chat-thumb, .knowledge-card, .capability-card, .mission-card, .artifact-card, .drawer-card, .alert-card, .list-card) {
  border: 1px solid var(--ev-line-silent);
  border-radius: var(--ev-radius-panel);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.032), rgba(255, 255, 255, 0.010)),
    var(--ev-surface-1);
  box-shadow: var(--ev-shadow-silent);
}

body.ia-clean :where(.comp-card, .founder-flow-dock, .founder-presence-copilot, .rp-codex-section, .artifact-chat-thumb, .mission-card, .knowledge-card, .capability-card):hover {
  border-color: var(--ev-line-strong);
  transform: translateY(-1px);
}

body.ia-clean .comp-card {
  border-radius: var(--ev-radius-xl);
  box-shadow: var(--ev-shadow-ambient);
}

body.ia-clean :where(.comp-input, textarea, input, select) {
  border-color: var(--ev-line-silent);
  background: rgba(255, 255, 255, 0.030);
  color: var(--ev-text);
}

body.ia-clean :where(.send-btn, .mission-create-btn, .flow-action.primary) {
  background: linear-gradient(135deg, var(--ev-primary), #5f83ee);
  color: #07101f;
  box-shadow: 0 12px 30px rgba(122, 162, 255, 0.20);
}

body.ia-clean :where(.send-btn, .mission-create-btn, .flow-action.primary):hover {
  transform: translateY(-1px);
  box-shadow: 0 16px 42px rgba(122, 162, 255, 0.25);
}

body.ia-clean :where(.msg, .message) {
  letter-spacing: 0;
}

body.ia-clean :where(.msg-assistant, .assistant-message) {
  color: var(--ev-text-2);
}

body.ia-clean :where(.rp-section-title, .panel-title, .flow-title, .founder-card-title) {
  color: var(--ev-text);
  font-size: var(--ev-type-sm);
  font-weight: 760;
  letter-spacing: 0;
}

body.ia-clean :where(.rp-section-subtitle, .flow-subtitle, .muted, .meta) {
  color: var(--ev-text-3);
}

body.ia-clean :where(.rp-section, .rp-codex-section, .founder-presence-copilot, .founder-flow-dock) {
  padding: var(--ev-space-panel);
}

body.ia-clean :where(.rp-section + .rp-section, .rp-codex-section + .rp-codex-section) {
  margin-top: var(--ev-space-4);
}

body.ia-clean :where(.nav-badge, .badge-count, .counter, .metric-count) {
  border-color: var(--ev-line-silent);
  background: rgba(255, 255, 255, 0.034);
  color: var(--ev-text-3);
}

body.ia-clean :where(.nav-badge:empty, .badge-count:empty, .counter:empty, .metric-count:empty) {
  display: none;
}

body.ia-clean :where(.sidebar-group, .nav-section, .menu-section) {
  border-color: transparent;
}

body.ia-clean :where(.sidebar-group-title, .nav-section-title, .menu-section-title) {
  color: rgba(189, 195, 207, 0.58);
  font-size: var(--ev-type-xs);
  font-weight: 720;
  letter-spacing: 0.02em;
}

body.ia-clean :where(.nav-item, .sidebar-link, .menu-link) {
  border-radius: var(--ev-radius-md);
}

body.ia-clean :where(.nav-item:hover, .sidebar-link:hover, .menu-link:hover) {
  background: rgba(255, 255, 255, 0.045);
}

body.ia-clean :where(.nav-item.active, .sidebar-link.active, .menu-link.active, [aria-current="page"]) {
  background: var(--ev-primary-muted);
  color: var(--ev-text);
}

body.ia-clean :where(.flow-step, .timeline-row, .ledger-event, .exec-node) {
  border-color: var(--ev-line);
}

body.ia-clean :where(.flow-step.is-active, .exec-node.active, .capability-active) {
  border-color: rgba(122, 162, 255, 0.30);
  background: var(--ev-primary-soft);
}

body.ia-clean :where(.flow-step.is-complete, .exec-node.complete, .capability-ready) {
  border-color: rgba(111, 223, 143, 0.26);
  background: var(--ev-success-soft);
}

body.ia-clean :where(.flow-step.is-attention, .exec-node.attention, .capability-risk) {
  border-color: rgba(243, 197, 107, 0.30);
  background: var(--ev-warning-soft);
}

body.ia-clean :where(.alert, .toast, .notice) {
  border: 1px solid var(--ev-line-silent);
  border-radius: var(--ev-radius-md);
  background: rgba(255, 255, 255, 0.032);
  color: var(--ev-text-2);
}

body.ia-clean :where(.alert.critical, .toast.critical, .notice.critical, [data-alert="critical"]) {
  border-color: rgba(255, 123, 123, 0.30);
  background: var(--ev-critical-soft);
  color: #ffdada;
}

body.ia-clean :where(.alert.success, .toast.success, .notice.success, [data-alert="success"]) {
  border-color: rgba(111, 223, 143, 0.24);
  background: var(--ev-success-soft);
  color: #dafee4;
}

body.ia-clean :where(.artifact-chat-thumb, .artifact-card, .artifact-row) {
  overflow: hidden;
}

body.ia-clean :where(.artifact-chat-thumb img, .artifact-card img) {
  border-radius: calc(var(--ev-radius-md) - 2px);
}

body.ia-clean :where(.rp-technical, .debug, .raw-json, pre) {
  border-radius: var(--ev-radius-md);
  border-color: var(--ev-line-silent);
  background: rgba(0, 0, 0, 0.22);
  color: #cbd2df;
  font-family: var(--ev-font-mono);
}

body.ia-clean:not(.technical-view) :where(.rp-technical, .debug-panel, .raw-json, .technical-only, [data-technical="true"]) {
  display: none;
}

@media (max-width: 860px) {
  body:not(.ia-clean) :where(.container, .shell) {
    width: min(100vw - 24px, 1180px);
  }

  body.ia-clean .tb {
    min-height: 56px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
