/* Zoe Swellmark Autonomy Console 64 - Zero-CDN Accessible Stylesheet
 * 3 Themes on html[data-theme]: c64 (Classic C64 Blue), nocturnal (Dark Nocturnal), vellum (Daylight Vellum)
 * Scoped cleanly under body.a64-body / .a64-shell so #nuclideSplitBar and .zs-footer stay untouched.
 */

html[data-theme="c64"] body.a64-body,
html[data-theme="c64"] .a64-shell {
  --bg: #1b2273;
  --surface: #252e8c;
  --surface-alt: #131858;
  --border: #96a8ff;
  --text: #f3f6ff;
  --muted: #cfd9ff;
  --btn-bg: #121754;
  --btn-fg: #ffffff;
  --btn-hover-bg: #1d257a;
  --btn-active-bg: #d4deff;
  --btn-active-fg: #0d1245;
  --crt-bg: #151b63;
  --crt-fg: #c9d5ff;
  --crt-border: #8fa2ff;
  --code-bg: #10154d;
  --code-fg: #e2e8ff;
  --banner-bg: #10154a;
  --banner-fg: #f3f6ff;
  --error-bg: #54121b;
  --error-fg: #ffecef;
  --error-border: #ff99a8;
  --badge-bg: #0f1447;
  --badge-fg: #bfe8ff;
  --progress-track: #0e1342;
  --progress-fill: #9ee6ff;
  --focus-ring: #ffe875;
}

html[data-theme="nocturnal"] body.a64-body,
html[data-theme="nocturnal"] .a64-shell {
  --bg: #0b101b;
  --surface: #141c2e;
  --surface-alt: #0f1624;
  --border: #5c76a3;
  --text: #f0f5fc;
  --muted: #c2d0e6;
  --btn-bg: #19243b;
  --btn-fg: #f7faff;
  --btn-hover-bg: #233252;
  --btn-active-bg: #8bf2be;
  --btn-active-fg: #061c12;
  --crt-bg: #070c14;
  --crt-fg: #90f5c4;
  --crt-border: #4e9e79;
  --code-bg: #080d16;
  --code-fg: #dce8fa;
  --banner-bg: #111b2e;
  --banner-fg: #eaf2ff;
  --error-bg: #4d1018;
  --error-fg: #ffebee;
  --error-border: #ff8f9e;
  --badge-bg: #0b1626;
  --badge-fg: #90f5c4;
  --progress-track: #09101a;
  --progress-fill: #8bf2be;
  --focus-ring: #ffd866;
}

html[data-theme="vellum"] body.a64-body,
html[data-theme="vellum"] .a64-shell {
  --bg: #f5f0e4;
  --surface: #fffdf8;
  --surface-alt: #e9e2d1;
  --border: #4f586b;
  --text: #161a24;
  --muted: #394152;
  --btn-bg: #e5decb;
  --btn-fg: #12161f;
  --btn-hover-bg: #d7ceba;
  --btn-active-bg: #18274a;
  --btn-active-fg: #ffffff;
  --crt-bg: #141a2b;
  --crt-fg: #b8f5d2;
  --crt-border: #3a4663;
  --code-bg: #ece5d5;
  --code-fg: #141822;
  --banner-bg: #e7dfc9;
  --banner-fg: #151924;
  --error-bg: #fde8eb;
  --error-fg: #6b0f1c;
  --error-border: #a11c2f;
  --badge-bg: #18274a;
  --badge-fg: #ffffff;
  --progress-track: #d9d0bc;
  --progress-fill: #18274a;
  --focus-ring: #9e2a00;
}

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

.a64-shell [hidden] {
  display: none !important;
}

body.a64-body {
  margin: 0;
  font-family: "IBM Plex Sans", "Segoe UI", system-ui, -apple-system, sans-serif;
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.55;
  font-size: 16px;
  overflow-x: clip;
}

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

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

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

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

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

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

.a64-shell h1,
.a64-shell h2,
.a64-shell h3 {
  margin-top: 0;
  color: var(--text);
  line-height: 1.25;
}

.a64-shell h1 {
  font-size: clamp(1.45rem, 2.5vw, 2rem);
  margin-bottom: 0.35rem;
}

.a64-shell h2 {
  font-size: 1.3rem;
  margin-bottom: 0.35rem;
}

.a64-shell h3 {
  font-size: 1.08rem;
  margin-bottom: 0.65rem;
}

.a64-shell p {
  margin-top: 0;
  color: var(--text);
}

.a64-shell a:not(.zs-btn) {
  color: var(--btn-fg);
}

.a64-shell button,
.a64-shell [role="tab"],
.a64-shell select,
.a64-shell input[type="range"],
.a64-shell input[type="file"],
.a64-shell input[type="text"],
.a64-shell input[type="number"] {
  min-height: 44px;
  font-family: inherit;
  font-size: 0.95rem;
}

.a64-shell .action-btn,
.a64-shell .theme-btn {
  min-height: 44px;
}

.a64-shell button:focus-visible,
.a64-shell [role="tab"]:focus-visible,
.a64-shell select:focus-visible,
.a64-shell input:focus-visible,
.a64-shell a:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 2px;
}

.a64-shell .site-header {
  max-width: 1240px;
  margin: 0 auto;
  padding: 1.25rem 1.25rem 0.75rem;
}

.a64-shell .header-main {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
}

.a64-shell .eyebrow {
  margin: 0 0 0.25rem;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.a64-shell .subtitle {
  margin: 0;
  max-width: 68ch;
  line-height: 1.55;
  color: var(--muted);
}

.a64-shell .theme-switcher {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.a64-shell .theme-btn,
.a64-shell .action-btn,
.a64-shell [role="tab"] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.55rem 0.95rem;
  border-radius: 8px;
  border: 2px solid var(--border);
  background-color: var(--btn-bg);
  color: var(--btn-fg);
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}

.a64-shell .primary-btn {
  background-color: var(--btn-active-bg);
  color: var(--btn-active-fg);
  border-color: var(--btn-active-bg);
}

.a64-shell .theme-btn:hover,
.a64-shell .action-btn:hover,
.a64-shell [role="tab"]:hover {
  background-color: var(--btn-hover-bg);
  color: var(--btn-fg);
}

.a64-shell .theme-btn[aria-pressed="true"],
.a64-shell .action-btn[aria-pressed="true"],
.a64-shell [role="tab"][aria-selected="true"] {
  background-color: var(--btn-active-bg);
  color: var(--btn-active-fg);
  border-color: var(--btn-active-bg);
}

.a64-shell .constitution-banner {
  margin-top: 0.9rem;
  padding: 0.7rem 0.95rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background-color: var(--banner-bg);
  color: var(--banner-fg);
  font-size: 0.88rem;
  font-family: "IBM Plex Mono", "DejaVu Sans Mono", ui-monospace, monospace;
  overflow-wrap: anywhere;
}

.a64-shell .studio-main {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0.75rem 1.25rem 2rem;
}

.a64-shell .tab-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-bottom: 1rem;
}

.a64-shell .tab-panel {
  background-color: var(--surface);
  border: 2px solid var(--border);
  border-radius: 12px;
  padding: 1.2rem;
}

.a64-shell .panel-header {
  margin-bottom: 1rem;
}

.a64-shell .panel-header p {
  margin-bottom: 0;
  max-width: 68ch;
  line-height: 1.55;
  color: var(--muted);
}

.a64-shell .controls-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.85rem;
  margin-bottom: 1rem;
}

.a64-shell .control-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.a64-shell .control-field label,
.a64-shell .slider-row label,
.a64-shell .gauge-row label {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
}

.a64-shell .control-actions {
  justify-content: flex-end;
  gap: 0.5rem;
}

.a64-shell select,
.a64-shell input[type="text"],
.a64-shell input[type="number"],
.a64-shell input[type="file"] {
  width: 100%;
  padding: 0.5rem 0.7rem;
  border-radius: 8px;
  border: 2px solid var(--border);
  background-color: var(--btn-bg);
  color: var(--btn-fg);
}

.a64-shell input[type="range"] {
  width: 100%;
  accent-color: var(--btn-active-bg);
  cursor: pointer;
}

.a64-shell .validation-banner {
  margin: 0.75rem 0 1rem;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  border: 2px solid var(--error-border);
  background-color: var(--error-bg);
  color: var(--error-fg);
  font-weight: 600;
}

.a64-shell .crt-wrapper {
  margin-top: 0.75rem;
}

.a64-shell .crt-bezel {
  background-color: var(--crt-bg);
  border: 3px solid var(--crt-border);
  border-radius: 10px;
  padding: 0.85rem;
  overflow-x: auto;
}

.a64-shell .crt-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--crt-border);
  color: var(--crt-fg);
  font-family: "IBM Plex Mono", "DejaVu Sans Mono", ui-monospace, monospace;
  font-size: 0.82rem;
  font-weight: 700;
}

.a64-shell .crt-screen {
  margin: 0;
  padding: 0.4rem;
  background-color: var(--crt-bg);
  color: var(--crt-fg);
  font-family: "IBM Plex Mono", "DejaVu Sans Mono", ui-monospace, monospace;
  font-size: clamp(0.75rem, 1.35vw, 0.98rem);
  line-height: 1.32;
  white-space: pre;
  overflow-x: auto;
}

.a64-shell .proof-grid,
.a64-shell .dock-grid,
.a64-shell .bridge-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(310px, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}

.a64-shell .card {
  background-color: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem;
  min-width: 0;
}

.a64-shell .metric-list {
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.6rem;
}

.a64-shell .metric-list div {
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.5rem 0.65rem;
}

.a64-shell .metric-list dt {
  font-size: 0.8rem;
  color: var(--muted);
  font-weight: 600;
}

.a64-shell .metric-list dd {
  margin: 0.15rem 0 0;
  font-family: "IBM Plex Mono", "DejaVu Sans Mono", ui-monospace, monospace;
  font-weight: 700;
  color: var(--text);
}

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

.a64-shell .data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.a64-shell .data-table th,
.a64-shell .data-table td {
  text-align: left;
  padding: 0.45rem 0.6rem;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}

.a64-shell .data-table th {
  background-color: var(--surface);
  font-weight: 700;
}

.a64-shell .code-dump {
  margin: 0;
  padding: 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background-color: var(--code-bg);
  color: var(--code-fg);
  font-family: "IBM Plex Mono", "DejaVu Sans Mono", ui-monospace, monospace;
  font-size: 0.82rem;
  line-height: 1.4;
  max-height: 290px;
  overflow: auto;
  white-space: pre;
}

.a64-shell .gauge-stack {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.a64-shell .slider-row,
.a64-shell .gauge-row {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin-bottom: 0.75rem;
}

.a64-shell .score-summary {
  margin-top: 0.75rem;
  padding: 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background-color: var(--surface);
}

.a64-shell .score-big {
  margin: 0 0 0.35rem;
  font-size: 1.12rem;
}

.a64-shell .score-sub {
  margin: 0;
  font-size: 0.86rem;
  color: var(--muted);
  font-family: "IBM Plex Mono", "DejaVu Sans Mono", ui-monospace, monospace;
  overflow-wrap: anywhere;
}

.a64-shell .muted-note {
  font-size: 0.88rem;
  color: var(--muted);
  max-width: 68ch;
  line-height: 1.55;
}

.a64-shell .badge {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  border-radius: 6px;
  background-color: var(--badge-bg);
  color: var(--badge-fg);
  border: 1px solid var(--border);
  font-family: "IBM Plex Mono", "DejaVu Sans Mono", ui-monospace, monospace;
  font-size: 0.85rem;
}

.a64-shell .micro-btn-row,
.a64-shell .inspect-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-top: 0.65rem;
}

.a64-shell .arcade-progress {
  width: 100%;
  height: 22px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background-color: var(--progress-track);
  appearance: none;
}

.a64-shell .arcade-progress::-webkit-progress-bar {
  background-color: var(--progress-track);
  border-radius: 6px;
}

.a64-shell .arcade-progress::-webkit-progress-value {
  background-color: var(--progress-fill);
  border-radius: 6px;
}

.a64-shell .arcade-progress::-moz-progress-bar {
  background-color: var(--progress-fill);
  border-radius: 6px;
}

.a64-shell .site-status-bar {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 1.25rem 1.75rem;
  font-size: 0.85rem;
  color: var(--muted);
}

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

.a64-shell .modal-panel {
  width: 100%;
  max-width: 760px;
  max-height: 88vh;
  overflow-y: auto;
  border-radius: 14px;
  background-color: var(--surface);
  border: 2px solid var(--border);
  padding: 1.15rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.a64-shell .modal-header-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
}

@media (max-width: 640px) {
  .a64-shell .site-header,
  .a64-shell .studio-main,
  .a64-shell .site-status-bar {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
  }

  .a64-shell .tab-panel {
    padding: 0.85rem;
  }
}
