/* Zoe Swellmark GAM-1 Edge Autonomy Studio
 * Dual Themes: Nocturnal Obsidian (default) + Daylight Vellum
 * Zero CDN | Strict CSP 'self' | >= 44px controls | Scoped under .es-shell / body.es-body
 */

:root,
body.es-body[data-theme="nocturnal"] {
  --bg-canvas: #090e17;
  --bg-surface: #111827;
  --bg-surface-alt: #0d1422;
  --bg-elevated: #172033;
  --border-subtle: #233046;
  --es-border-strong: #334155;
  --text-primary: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;

  --accent-primary: #34d399;
  --accent-primary-bg: rgba(16, 185, 129, 0.16);
  --accent-primary-border: rgba(52, 211, 153, 0.45);
  --accent-contrast-text: #042f2e;

  --color-knee: #38bdf8;
  --color-ankle: #fbbf24;
  --color-arm: #34d399;
  --color-wc: #f472b6;
  --color-coupled: #a78bfa;

  --status-green-text: #6ee7b7;
  --status-green-bg: rgba(16, 185, 129, 0.16);
  --status-green-border: rgba(52, 211, 153, 0.48);

  --status-yellow-text: #fde047;
  --status-yellow-bg: rgba(234, 179, 8, 0.16);
  --status-yellow-border: rgba(250, 204, 21, 0.48);

  --status-red-text: #fda4af;
  --status-red-bg: rgba(244, 63, 94, 0.18);
  --status-red-border: rgba(251, 113, 133, 0.55);

  --canvas-bg: #0d1422;
  --canvas-grid: #1e293b;
  --canvas-axis-text: #cbd5e1;
  --canvas-bar-line: #64748b;
  --canvas-bar-text: #cbd5e1;
  --canvas-probe: #f8fafc;
  --canvas-probe-stroke: #090e17;
  --canvas-kernel-fill: rgba(52, 211, 153, 0.14);
  --canvas-track-bg: #1e293b;
  --canvas-value-text: #f8fafc;

  --slider-track: #263248;
  --slider-thumb-border: #090e17;
  --focus-ring: #38bdf8;
}

body.es-body[data-theme="vellum"] {
  --bg-canvas: #f5f2ea;
  --bg-surface: #fffdf8;
  --bg-surface-alt: #efeae0;
  --bg-elevated: #e7e0d2;
  --border-subtle: #cfc6b4;
  --es-border-strong: #9f947e;
  --text-primary: #14181f;
  --text-secondary: #2d3748;
  --text-muted: #4a5568;

  --accent-primary: #065f46;
  --accent-primary-bg: rgba(6, 95, 70, 0.10);
  --accent-primary-border: rgba(6, 95, 70, 0.55);
  --accent-contrast-text: #ffffff;

  --color-knee: #075985;
  --color-ankle: #92400e;
  --color-arm: #065f46;
  --color-wc: #9d174d;
  --color-coupled: #5b21b6;

  --status-green-text: #065f46;
  --status-green-bg: rgba(5, 150, 105, 0.10);
  --status-green-border: rgba(5, 150, 105, 0.55);

  --status-yellow-text: #713f12;
  --status-yellow-bg: rgba(202, 138, 4, 0.12);
  --status-yellow-border: rgba(161, 98, 7, 0.55);

  --status-red-text: #991b1b;
  --status-red-bg: rgba(225, 29, 72, 0.10);
  --status-red-border: rgba(190, 18, 60, 0.55);

  --canvas-bg: #fffdf8;
  --canvas-grid: #d6cebe;
  --canvas-axis-text: #1f2937;
  --canvas-bar-line: #57534e;
  --canvas-bar-text: #1f2937;
  --canvas-probe: #0f172a;
  --canvas-probe-stroke: #fffdf8;
  --canvas-kernel-fill: rgba(4, 120, 87, 0.13);
  --canvas-track-bg: #e5decb;
  --canvas-value-text: #111827;

  --slider-track: #cfc6b4;
  --slider-thumb-border: #fffdf8;
  --focus-ring: #0369a1;
}

.es-shell *,
.es-shell *::before,
.es-shell *::after {
  box-sizing: border-box;
}

body.es-body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background-color: var(--bg-canvas);
  color: var(--text-primary);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  line-height: 1.60;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}

body.es-body.ns-split-ready {
  padding-top: 56px;
}

.es-shell {
  width: 100%;
  min-width: 0;
}

.es-shell .mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}

.es-shell .overline {
  text-decoration: overline;
}

.es-shell :focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 2px;
}

/* Commercial IP Lock Banner (Site Design System Tokens) */
.zs-licensing-band {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px 20px;
  padding: 18px 22px;
  border-radius: 12px;
  border: 1px solid var(--zs-rule-strong);
  background: var(--zs-surface);
  color: var(--zs-ink);
}

.zs-licensing-copy-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.zs-licensing-copy {
  margin: 0;
  max-width: 68ch;
  font-size: 0.94rem;
  line-height: 1.6;
  color: var(--zs-ink-soft);
}

.zs-licensing-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

/* Constitutional top bar */
.es-shell .const-banner {
  background-color: var(--bg-surface-alt);
  border-bottom: 1px solid var(--border-subtle);
  padding: 0.5rem 1rem;
  font-size: 0.78rem;
  line-height: 1.55;
  color: var(--text-secondary);
}

.es-shell .const-banner-inner {
  max-width: 1360px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  min-width: 0;
}

.es-shell .const-flags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.es-shell .const-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 0.72rem;
}

/* Header */
.es-shell .studio-header {
  position: static;
  background-color: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
}

.es-shell .header-inner {
  max-width: 1360px;
  margin: 0 auto;
  padding: 0.85rem 1rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  min-width: 0;
}

.es-shell .brand-block {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
  max-width: 100%;
}

.es-shell .brand-mark {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background-color: var(--accent-primary-bg);
  border: 1px solid var(--accent-primary-border);
  color: var(--accent-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.78rem;
  flex-shrink: 0;
}

.es-shell .brand-title {
  margin: 0;
  font-size: clamp(1.1rem, 2vw, 1.35rem);
  font-weight: 700;
  line-height: 1.25;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.es-shell .brand-subtitle {
  margin: 0.15rem 0 0;
  font-size: 0.78rem;
  line-height: 1.5;
  color: var(--text-muted);
  overflow-wrap: anywhere;
}

.es-shell .header-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
}

/* Interactive controls inside .es-shell: ALL >= 44px height */
.es-shell button,
.es-shell .btn,
.es-shell .phase-btn,
.es-shell .mode-btn,
.es-shell .domain-tab,
.es-shell .apbf-tab,
.es-shell .preset-btn,
.es-shell .toggle-switch,
.es-shell select {
  min-height: 44px;
  font-family: inherit;
  cursor: pointer;
}

.es-shell .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.5rem 0.85rem;
  border-radius: 10px;
  border: 1px solid var(--es-border-strong);
  background-color: var(--bg-elevated);
  color: var(--text-primary);
  font-size: 0.82rem;
  font-weight: 600;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.es-shell .btn:hover {
  border-color: var(--accent-primary);
}

.es-shell .btn-accent,
.es-shell .btn-solid {
  background-color: var(--accent-primary);
  border-color: var(--accent-primary);
  color: var(--accent-contrast-text);
}

.es-shell .btn-danger {
  background-color: var(--status-red-bg);
  border-color: var(--status-red-border);
  color: var(--status-red-text);
}

.es-shell .btn-warn {
  background-color: var(--status-yellow-bg);
  border-color: var(--status-yellow-border);
  color: var(--status-yellow-text);
}

.es-shell .btn-good {
  background-color: var(--status-green-bg);
  border-color: var(--status-green-border);
  color: var(--status-green-text);
}

/* Segmented controls */
.es-shell .pill-group {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  padding: 0.25rem;
  border-radius: 12px;
  background-color: var(--bg-surface-alt);
  border: 1px solid var(--border-subtle);
  max-width: 100%;
}

.es-shell .phase-btn,
.es-shell .mode-btn,
.es-shell .domain-tab,
.es-shell .apbf-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.45rem 0.85rem;
  border-radius: 8px;
  border: 1px solid transparent;
  background-color: transparent;
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-weight: 600;
}

.es-shell .phase-btn.is-active,
.es-shell .mode-btn.is-active,
.es-shell .domain-tab.is-active,
.es-shell .apbf-tab.is-active {
  background-color: var(--accent-primary-bg);
  border-color: var(--accent-primary-border);
  color: var(--accent-primary);
}

/* Main layout */
.es-shell .studio-main {
  max-width: 1360px;
  margin: 0 auto;
  padding: 1.1rem 1rem 2.25rem;
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
  min-width: 0;
}

.es-shell .card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  padding: 1rem;
  min-width: 0;
}

.es-shell .card-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
  min-width: 0;
}

.es-shell .card-title {
  margin: 0;
  font-size: 0.96rem;
  font-weight: 700;
  line-height: 1.35;
  color: var(--text-primary);
}

.es-shell .card-subtitle {
  margin: 0.2rem 0 0;
  font-size: 0.82rem;
  line-height: 1.58;
  max-width: 68ch;
  color: var(--text-muted);
}

/* Mode & Domain Bar */
.es-shell .toolbar-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

/* KPI Strip */
.es-shell .kpi-grid {
  display: grid;
  grid-template-columns: repeat(1, minmax(0, 1fr));
  gap: 0.85rem;
}

@media (min-width: 640px) {
  .es-shell .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 1024px) {
  .es-shell .kpi-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.es-shell .kpi-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  padding: 0.95rem 1rem;
  min-width: 0;
}

.es-shell .kpi-card-highlight {
  border-color: var(--accent-primary-border);
}

.es-shell .kpi-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.es-shell .kpi-label {
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
}

.es-shell .kpi-value-row {
  margin-top: 0.45rem;
  display: flex;
  align-items: baseline;
  gap: 0.55rem;
}

.es-shell .kpi-value {
  font-size: 1.65rem;
  font-weight: 700;
  color: var(--text-primary);
}

.es-shell .kpi-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.es-shell .kpi-foot {
  margin-top: 0.45rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  flex-wrap: wrap;
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Status pills & badges */
.es-shell .pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  border: 1px solid var(--border-subtle);
  background-color: var(--bg-surface-alt);
  color: var(--text-secondary);
}

.es-shell .level-green {
  color: var(--status-green-text);
  background-color: var(--status-green-bg);
  border-color: var(--status-green-border);
}

.es-shell .level-yellow {
  color: var(--status-yellow-text);
  background-color: var(--status-yellow-bg);
  border-color: var(--status-yellow-border);
}

.es-shell .level-red {
  color: var(--status-red-text);
  background-color: var(--status-red-bg);
  border-color: var(--status-red-border);
}

/* Main two-column grid */
.es-shell .studio-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1.1rem;
  align-items: start;
}

@media (min-width: 1024px) {
  .es-shell .studio-grid {
    grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  }
}

.es-shell .col-stack {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-width: 0;
}

/* Presets grid */
.es-shell .preset-grid {
  display: grid;
  grid-template-columns: repeat(1, minmax(0, 1fr));
  gap: 0.5rem;
}

@media (min-width: 520px) {
  .es-shell .preset-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.es-shell .preset-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  padding: 0.6rem 0.75rem;
  border-radius: 10px;
  border: 1px solid var(--border-subtle);
  background-color: var(--bg-surface-alt);
  color: var(--text-primary);
  text-align: left;
  gap: 0.15rem;
}

.es-shell .preset-btn.is-active {
  border-color: var(--accent-primary-border);
  background-color: var(--accent-primary-bg);
}

.es-shell .preset-name {
  font-size: 0.82rem;
  font-weight: 700;
}

.es-shell .preset-desc {
  font-size: 0.74rem;
  color: var(--text-muted);
}

/* Sliders with >= 44px interactive hit height */
.es-shell .slider-field {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.15rem 0;
}

.es-shell .slider-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.es-shell .slider-val {
  font-weight: 700;
  color: var(--text-primary);
}

.es-shell .slider-grid-2 {
  display: grid;
  grid-template-columns: repeat(1, minmax(0, 1fr));
  gap: 0.65rem;
}

@media (min-width: 520px) {
  .es-shell .slider-grid-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.es-shell input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  min-height: 44px;
  height: 44px;
  margin: 0;
  background: transparent;
  cursor: pointer;
}

.es-shell input[type="range"]::-webkit-slider-runnable-track {
  height: 8px;
  border-radius: 999px;
  background-color: var(--slider-track);
  border: 1px solid var(--border-subtle);
}

.es-shell input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 22px;
  height: 22px;
  margin-top: -8px;
  border-radius: 50%;
  background-color: var(--accent-primary);
  border: 2px solid var(--slider-thumb-border);
}

.es-shell input[type="range"]::-moz-range-track {
  height: 8px;
  border-radius: 999px;
  background-color: var(--slider-track);
  border: 1px solid var(--border-subtle);
}

.es-shell input[type="range"]::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background-color: var(--accent-primary);
  border: 2px solid var(--slider-thumb-border);
}

/* Switch toggle (>= 44px) */
.es-shell .switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding-top: 0.6rem;
  border-top: 1px solid var(--border-subtle);
}

.es-shell .toggle-switch {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  min-width: 104px;
  padding: 0.45rem 0.75rem;
  border-radius: 999px;
  border: 1px solid var(--es-border-strong);
  background-color: var(--bg-surface-alt);
  color: var(--text-primary);
  font-size: 0.78rem;
  font-weight: 700;
}

.es-shell .toggle-switch.is-on {
  background-color: var(--status-green-bg);
  border-color: var(--status-green-border);
  color: var(--status-green-text);
}

.es-shell .toggle-switch.is-alert {
  background-color: var(--status-red-bg);
  border-color: var(--status-red-border);
  color: var(--status-red-text);
}

.es-shell .btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

/* Domain color classes (zero inline styles) */
.es-shell .domain-text-knee { color: var(--color-knee); }
.es-shell .domain-text-ankle { color: var(--color-ankle); }
.es-shell .domain-text-arm { color: var(--color-arm); }
.es-shell .domain-text-wc { color: var(--color-wc); }
.es-shell .domain-text-coupled { color: var(--color-coupled); }

.es-shell .legend-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  font-size: 0.75rem;
}

.es-shell .legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.es-shell .legend-swatch {
  width: 12px;
  height: 4px;
  border-radius: 999px;
  display: inline-block;
}

.es-shell .swatch-knee { background-color: var(--color-knee); }
.es-shell .swatch-ankle { background-color: var(--color-ankle); }
.es-shell .swatch-arm { background-color: var(--color-arm); }
.es-shell .swatch-wc { background-color: var(--color-wc); }
.es-shell .swatch-coupled { background-color: var(--color-coupled); }

/* Canvas containers */
.es-shell .canvas-box-main {
  position: relative;
  height: 300px;
  width: 100%;
  border-radius: 10px;
  background-color: var(--canvas-bg);
  border: 1px solid var(--border-subtle);
  overflow: hidden;
  cursor: crosshair;
}

.es-shell .canvas-box-sub {
  position: relative;
  height: 240px;
  width: 100%;
  border-radius: 10px;
  background-color: var(--canvas-bg);
  border: 1px solid var(--border-subtle);
  overflow: hidden;
}

.es-shell .canvas-box-dial {
  position: relative;
  height: 240px;
  width: 100%;
  max-width: 320px;
  margin: 0 auto;
}

.es-shell canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.es-shell .probe-grid {
  margin-top: 0.75rem;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.45rem;
}

@media (min-width: 768px) {
  .es-shell .probe-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}

.es-shell .probe-cell {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.4rem 0.6rem;
  border-radius: 8px;
  background-color: var(--bg-surface-alt);
  border: 1px solid var(--border-subtle);
  font-size: 0.74rem;
}

.es-shell .subchart-grid {
  display: grid;
  grid-template-columns: repeat(1, minmax(0, 1fr));
  gap: 1rem;
}

@media (min-width: 768px) {
  .es-shell .subchart-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Sliding Window & S1-P3 Rule Engine */
.es-shell .alert-banners {
  display: grid;
  grid-template-columns: repeat(1, minmax(0, 1fr));
  gap: 0.6rem;
  margin-top: 0.75rem;
}

@media (min-width: 640px) {
  .es-shell .alert-banners {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.es-shell .alert-banner {
  border-radius: 10px;
  border: 1px solid var(--border-subtle);
  padding: 0.65rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.es-shell .alert-banner-title {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.es-shell .alert-banner-state {
  font-size: 1rem;
  font-weight: 800;
}

.es-shell .alert-banner-detail {
  font-size: 0.74rem;
}

.es-shell .ring-metrics-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.65rem;
  font-size: 0.75rem;
}

.es-shell .ring-metric-chip {
  padding: 0.3rem 0.6rem;
  border-radius: 8px;
  background-color: var(--bg-surface-alt);
  border: 1px solid var(--border-subtle);
}

.es-shell .rule-badges-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.45rem;
  margin-top: 0.75rem;
}

@media (min-width: 640px) {
  .es-shell .rule-badges-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.es-shell .rule-badge {
  padding: 0.45rem 0.6rem;
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
  background-color: var(--bg-surface-alt);
  font-size: 0.73rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
}

.es-shell .rule-badge.rule-alert {
  background-color: var(--status-red-bg);
  border-color: var(--status-red-border);
  color: var(--status-red-text);
  font-weight: 700;
}

.es-shell .rule-badge.rule-warn {
  background-color: var(--status-yellow-bg);
  border-color: var(--status-yellow-border);
  color: var(--status-yellow-text);
  font-weight: 700;
}

.es-shell .rule-badge.rule-pass {
  background-color: var(--status-green-bg);
  border-color: var(--status-green-border);
  color: var(--status-green-text);
  font-weight: 700;
}

/* Conjunctive Gate Panel */
.es-shell .gate-checklist {
  display: grid;
  grid-template-columns: repeat(1, minmax(0, 1fr));
  gap: 0.5rem;
}

@media (min-width: 640px) {
  .es-shell .gate-checklist {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.es-shell .gate-item {
  padding: 0.65rem 0.75rem;
  border-radius: 10px;
  border: 1px solid var(--border-subtle);
  background-color: var(--bg-surface-alt);
  font-size: 0.78rem;
}

.es-shell .gate-item.is-met {
  border-color: var(--status-green-border);
  background-color: var(--status-green-bg);
  color: var(--status-green-text);
}

.es-shell .gate-item.is-unmet {
  border-color: var(--status-yellow-border);
  background-color: var(--status-yellow-bg);
  color: var(--status-yellow-text);
}

/* Table */
.es-shell .table-wrap {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
}

.es-shell .summary-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
}

.es-shell .summary-table th,
.es-shell .summary-table td {
  padding: 0.5rem 0.45rem;
  border-bottom: 1px solid var(--border-subtle);
  text-align: left;
}

.es-shell .summary-table th.num,
.es-shell .summary-table td.num {
  text-align: right;
}

.es-shell .summary-table th {
  color: var(--text-muted);
  font-weight: 700;
}

.es-shell .notes-box {
  margin-top: 0.75rem;
  padding: 0.75rem;
  border-radius: 10px;
  background-color: var(--bg-surface-alt);
  border: 1px solid var(--border-subtle);
  font-size: 0.82rem;
  line-height: 1.6;
  color: var(--text-secondary);
  max-width: 68ch;
}

.es-shell .notes-box div + div {
  margin-top: 0.35rem;
}

/* Green-Time Trajectory Mode */
.es-shell .green-time-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1rem;
}

@media (min-width: 900px) {
  .es-shell .green-time-grid {
    grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  }
}

.es-shell .script-card {
  padding: 0.85rem;
  border-radius: 10px;
  background-color: var(--bg-surface-alt);
  border: 1px solid var(--border-subtle);
}

.es-shell .script-card + .script-card {
  margin-top: 0.65rem;
}

.es-shell .script-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}

.es-shell .script-title {
  margin: 0;
  font-size: 0.84rem;
  font-weight: 700;
}

.es-shell .script-body {
  margin: 0;
  font-size: 0.84rem;
  line-height: 1.6;
  color: var(--text-secondary);
  max-width: 68ch;
}

/* Domain panel & View visibility */
.es-shell .is-hidden {
  display: none !important;
}

/* Modal */
.es-shell .modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 320;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background-color: rgba(2, 6, 23, 0.78);
}

.es-shell .modal-backdrop.is-open {
  display: flex;
}

.es-shell .modal-panel {
  width: 100%;
  max-width: 640px;
  max-height: 88vh;
  overflow-y: auto;
  border-radius: 16px;
  background-color: var(--bg-surface);
  border: 1px solid var(--es-border-strong);
  padding: 1.15rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.es-shell .modal-panel-wide {
  max-width: 820px;
}

.es-shell .modal-textarea {
  width: 100%;
  min-height: 180px;
  border-radius: 10px;
  background-color: var(--bg-surface-alt);
  border: 1px solid var(--es-border-strong);
  color: var(--text-primary);
  padding: 0.75rem;
  font-size: 0.78rem;
}

.es-shell .modal-pre {
  margin: 0;
  width: 100%;
  max-height: 360px;
  overflow: auto;
  border-radius: 10px;
  background-color: var(--bg-surface-alt);
  border: 1px solid var(--es-border-strong);
  color: var(--text-primary);
  padding: 0.85rem;
  font-size: 0.76rem;
  line-height: 1.5;
  white-space: pre;
}

.es-shell .modal-error {
  margin: 0;
  font-size: 0.78rem;
  color: var(--status-red-text);
}

/* Toast */
.es-shell .toast-banner {
  position: fixed;
  bottom: 1rem;
  right: 1rem;
  z-index: 340;
  display: none;
  padding: 0.7rem 1rem;
  border-radius: 12px;
  background-color: var(--bg-elevated);
  border: 1px solid var(--accent-primary-border);
  color: var(--text-primary);
  font-size: 0.82rem;
  font-weight: 600;
}

.es-shell .toast-banner.is-visible {
  display: block;
}

/* Off-screen copy textarea (zero inline JS style mutation) */
.es-shell .sr-copy-buffer {
  position: fixed;
  left: -9999px;
  top: 0;
  width: 1px;
  height: 1px;
  opacity: 0;
}
