/* Zoe Swellmark AM-1 Autonomy Monitor Studio - Stylesheet
 * Dark Nocturnal (default) & Light Daylight Vellum WCAG AA/AAA themes
 * Scoped under body.am1-body / .am1-shell | Zero padding reset on body | >= 44px controls
 */

:root,
html[data-theme="dark"],
body.am1-body[data-theme="nocturnal"] {
  --bg: #0b101b;
  --surface: #121a2b;
  --surface-alt: #182338;
  --bezel: #0d1422;
  --border: #2a3956;
  --text: #eef3fb;
  --text-muted: #b4c2d9;
  --accent: #38bdf8;
  --accent-strong: #0ea5e9;
  --accent-text: #06121e;
  --green: #4ade80;
  --green-btn-bg: #15803d;
  --green-btn-text: #ffffff;
  --green-soft: #14532d;
  --amber: #fbbf24;
  --amber-soft: #451a03;
  --red: #fca5a5;
  --red-btn-bg: #b91c1c;
  --red-btn-text: #ffffff;
  --red-soft: #450a0a;
  --banner-bg: #172033;
  --shadow: 0 10px 28px rgba(0, 0, 0, 0.45);
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}

html[data-theme="light"],
body.am1-body[data-theme="vellum"] {
  --bg: #f4f1ea;
  --surface: #fffdf8;
  --surface-alt: #ebe6dc;
  --bezel: #ece6da;
  --border: #9f9687;
  --text: #141820;
  --text-muted: #333a47;
  --accent: #0369a1;
  --accent-strong: #075985;
  --accent-text: #ffffff;
  --green: #14532d;
  --green-btn-bg: #15803d;
  --green-btn-text: #ffffff;
  --green-soft: #dcfce7;
  --amber: #78350f;
  --amber-soft: #fef3c7;
  --red: #7f1d1d;
  --red-btn-bg: #b91c1c;
  --red-btn-text: #ffffff;
  --red-soft: #fee2e2;
  --banner-bg: #e7e1d5;
  --shadow: 0 6px 18px rgba(20, 24, 32, 0.12);
}

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

body.am1-body {
  margin: 0;
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  line-height: 1.55;
  font-size: 16px;
  overflow-x: clip;
}

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

.am1-shell {
  max-width: 1280px;
  margin: 0 auto;
  padding: 16px 20px 32px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

/* Commercial IP Lock Banner */
.am1-shell .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);
}

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

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

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

.am1-shell .top-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  padding: 16px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
}

.am1-shell .brand-block {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.am1-shell .brand-badge {
  background: var(--accent);
  color: var(--accent-text);
  font-weight: 800;
  font-size: 0.85rem;
  letter-spacing: 0.06em;
  padding: 8px 12px;
  border-radius: 8px;
  flex-shrink: 0;
}

.am1-shell .top-header h1 {
  margin: 0;
  font-size: 1.45rem;
  line-height: 1.2;
}

.am1-shell .subtitle {
  margin: 4px 0 0;
  color: var(--text-muted);
  font-size: 0.92rem;
  max-width: 68ch;
  line-height: 1.55;
}

.am1-shell .header-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.am1-shell .status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-alt);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 600;
}

.am1-shell .status-pill--safe {
  border-color: var(--green);
  color: var(--green);
}

.am1-shell .constitution-banner {
  background: var(--banner-bg);
  border: 1px solid var(--border);
  border-left: 5px solid var(--amber);
  border-radius: 10px;
  padding: 12px 16px;
  font-size: 0.9rem;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  align-items: center;
}

.am1-shell .tab-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.am1-shell .tab-btn {
  min-height: 48px;
  min-width: 48px;
  padding: 10px 16px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.am1-shell .tab-btn:hover {
  border-color: var(--accent);
}

.am1-shell .tab-btn.is-active {
  background: var(--accent);
  color: var(--accent-text);
  border-color: var(--accent);
}

.am1-shell .main-content {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

.am1-shell .tab-panel {
  display: none;
  flex-direction: column;
  gap: 16px;
}

.am1-shell .tab-panel.is-active {
  display: flex;
}

.am1-shell .panel-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 16px;
}

.am1-shell .card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}

.am1-shell .card-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.am1-shell .card-header h2,
.am1-shell .card-header h3 {
  margin: 0;
  font-size: 1.15rem;
}

.am1-shell .badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 700;
}

.am1-shell .badge--green {
  border-color: var(--green);
  color: var(--green);
  background: var(--green-soft);
}

.am1-shell .badge--amber {
  border-color: var(--amber);
  color: var(--amber);
  background: var(--amber-soft);
}

.am1-shell .badge--red {
  border-color: var(--red);
  color: var(--red);
  background: var(--red-soft);
}

.am1-shell .helper-text {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.9rem;
  max-width: 68ch;
  line-height: 1.55;
}

.am1-shell .bezel-plate {
  background: var(--bezel);
  border: 2px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.am1-shell .bezel-port {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.am1-shell .hw-pushbutton {
  width: 56px;
  height: 56px;
  min-width: 44px;
  min-height: 44px;
  border-radius: 50%;
  border: 3px solid var(--accent);
  background: var(--surface-alt);
  color: var(--text);
  font-weight: 800;
  cursor: pointer;
}

.am1-shell .port-label {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.am1-shell .led-bank {
  display: flex;
  gap: 20px;
  align-items: center;
}

.am1-shell .led-unit {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  min-width: 64px;
}

.am1-shell .led {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid var(--border);
  display: inline-block;
}

.am1-shell .led--off {
  background: #334155;
  box-shadow: none;
}

.am1-shell .led--green {
  background: #22c55e;
  box-shadow: 0 0 12px rgba(34, 197, 94, 0.85);
}

.am1-shell .led--blink-green {
  background: #22c55e;
  box-shadow: 0 0 14px rgba(34, 197, 94, 0.95);
  animation: am1LedPulse 1s infinite ease-in-out;
}

.am1-shell .led--amber {
  background: #f59e0b;
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.85);
}

.am1-shell .led--red {
  background: #ef4444;
  box-shadow: 0 0 12px rgba(239, 68, 68, 0.85);
}

@keyframes am1LedPulse {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.28;
    transform: scale(0.92);
  }
}

.am1-shell .led-label {
  font-weight: 800;
  font-size: 0.82rem;
  letter-spacing: 0.05em;
}

.am1-shell .led-state {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
}

.am1-shell .bezel-connectors {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.am1-shell .conn-chip {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  padding: 5px 10px;
  border-radius: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
}

.am1-shell .conn-chip--warn {
  border-color: var(--amber);
  color: var(--amber);
}

.am1-shell .conn-chip--err {
  border-color: var(--red);
  color: var(--red);
}

.am1-shell .action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.am1-shell .action-row--tight {
  gap: 8px;
}

.am1-shell .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  min-width: 46px;
  padding: 10px 16px;
  border-radius: 9px;
  border: 1px solid var(--border);
  font-size: 0.94rem;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.08s ease, background-color 0.15s ease;
}

.am1-shell .btn:active {
  transform: translateY(1px);
}

.am1-shell .btn--primary {
  background: var(--accent);
  color: var(--accent-text);
  border-color: var(--accent);
}

.am1-shell .btn--secondary {
  background: var(--surface-alt);
  color: var(--text);
}

.am1-shell .btn--accent {
  background: var(--green-btn-bg);
  color: var(--green-btn-text);
  border-color: var(--green-btn-bg);
}

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

.am1-shell .field,
.am1-shell .field-inline {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.9rem;
  font-weight: 600;
}

.am1-shell .field-inline {
  flex-direction: row;
  align-items: center;
  flex-wrap: wrap;
}

.am1-shell .select-input,
.am1-shell .text-input {
  min-height: 44px;
  min-width: 44px;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-alt);
  color: var(--text);
  font-size: 0.95rem;
}

.am1-shell .mono-input {
  font-family: var(--font-mono);
  width: 100%;
}

.am1-shell .degradation-box {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
  font-size: 0.92rem;
}

.am1-shell .rating-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.am1-shell .rating-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.92rem;
}

.am1-shell .tap-scale {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(44px, 1fr));
  gap: 6px;
}

.am1-shell .tap-btn {
  min-height: 44px;
  min-width: 44px;
  padding: 4px 2px;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: var(--surface-alt);
  color: var(--text);
  font-weight: 700;
  cursor: pointer;
}

.am1-shell .tap-btn.is-selected {
  background: var(--accent);
  color: var(--accent-text);
  border-color: var(--accent);
}

.am1-shell .kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(135px, 1fr));
  gap: 10px;
}

.am1-shell .kpi-tile {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.am1-shell .kpi-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.am1-shell .kpi-value {
  font-family: var(--font-mono);
  font-size: 1.08rem;
}

.am1-shell .table-wrap {
  overflow-x: auto;
}

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

.am1-shell .data-table th,
.am1-shell .data-table td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--border);
  text-align: left;
}

.am1-shell .data-table th {
  color: var(--text-muted);
  font-weight: 700;
  background: var(--surface-alt);
}

.am1-shell .scrubber-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.am1-shell .scrubber-label {
  font-weight: 700;
  font-size: 0.9rem;
}

.am1-shell .range-slider {
  flex: 1 1 260px;
  min-height: 44px;
  cursor: pointer;
}

.am1-shell .canvas-wrap {
  width: 100%;
  background: var(--bezel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px;
}

.am1-shell .canvas-wrap canvas {
  width: 100%;
  height: auto;
  display: block;
}

.am1-shell .pins-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.am1-shell .pin-btn {
  min-height: 44px;
  min-width: 44px;
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid var(--red);
  background: var(--red-soft);
  color: var(--text);
  font-weight: 700;
  cursor: pointer;
}

.am1-shell .pin-btn.is-active {
  border-color: var(--accent);
  outline: 2px solid var(--accent);
}

.am1-shell .arcade-hero {
  display: flex;
  align-items: center;
  gap: 16px;
}

.am1-shell .weather-glyph {
  min-width: 72px;
  min-height: 72px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 1rem;
  border: 2px solid var(--border);
  background: var(--surface-alt);
}

.am1-shell .weather-glyph--green {
  border-color: var(--green);
  background: var(--green-soft);
  color: var(--green);
}

.am1-shell .weather-glyph--amber {
  border-color: var(--amber);
  background: var(--amber-soft);
  color: var(--amber);
}

.am1-shell .weather-glyph--red {
  border-color: var(--red);
  background: var(--red-soft);
  color: var(--red);
}

.am1-shell .arcade-score-big {
  font-family: var(--font-mono);
  font-size: 2.2rem;
  font-weight: 800;
  line-height: 1.1;
}

.am1-shell .zone-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.am1-shell .legend-chip {
  font-size: 0.8rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
}

.am1-shell .legend-chip--red {
  color: var(--red);
  border-color: var(--red);
}

.am1-shell .legend-chip--amber {
  color: var(--amber);
  border-color: var(--amber);
}

.am1-shell .legend-chip--green {
  color: var(--green);
  border-color: var(--green);
}

.am1-shell .summary-prose {
  margin: 0;
  font-size: 1rem;
  line-height: 1.6;
  max-width: 68ch;
}

.am1-shell .badge-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.am1-shell .arcade-badge-card {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.am1-shell .arcade-badge-card.is-earned {
  border-color: var(--green);
}

.am1-shell .component-bars {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.am1-shell .comp-row {
  display: grid;
  grid-template-columns: 155px 1fr 56px;
  align-items: center;
  gap: 10px;
  font-size: 0.85rem;
}

.am1-shell .comp-progress {
  width: 100%;
  height: 14px;
  accent-color: var(--accent);
}

.am1-shell .svg-blueprint-wrap {
  width: 100%;
  overflow-x: auto;
  background: var(--bezel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
}

.am1-shell .cad-svg {
  width: 100%;
  min-width: 680px;
  height: auto;
  display: block;
}

.am1-shell .svg-shell {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2.2;
}

.am1-shell .svg-inner {
  fill: none;
  stroke: var(--border);
  stroke-width: 1.4;
  stroke-dasharray: 5 4;
}

.am1-shell .svg-boss {
  fill: none;
  stroke: var(--amber);
  stroke-width: 1.8;
}

.am1-shell .svg-slot {
  fill: rgba(245, 158, 11, 0.22);
  stroke: var(--amber);
  stroke-width: 1.5;
}

.am1-shell .svg-rpi {
  fill: rgba(34, 197, 94, 0.14);
  stroke: var(--green);
  stroke-width: 1.8;
}

.am1-shell .svg-hat {
  fill: rgba(56, 189, 248, 0.14);
  stroke: var(--accent);
  stroke-width: 1.5;
}

.am1-shell .svg-buck {
  fill: rgba(245, 158, 11, 0.16);
  stroke: var(--amber);
  stroke-width: 1.6;
}

.am1-shell .svg-cutout {
  fill: var(--surface);
  stroke: var(--red);
  stroke-width: 1.8;
}

.am1-shell .svg-seam {
  stroke: var(--text-muted);
  stroke-width: 1.2;
  stroke-dasharray: 4 3;
}

.am1-shell .svg-led-g {
  fill: #22c55e;
}

.am1-shell .svg-led-a {
  fill: #f59e0b;
}

.am1-shell .svg-title {
  fill: var(--text);
  font-size: 13px;
  font-weight: 700;
  font-family: var(--font-mono);
}

.am1-shell .svg-label {
  fill: var(--text);
  font-size: 12px;
  font-weight: 700;
  text-anchor: middle;
}

.am1-shell .svg-label-left {
  fill: var(--text);
  font-size: 11px;
  font-family: var(--font-mono);
}

.am1-shell .svg-caption {
  fill: var(--text-muted);
  font-size: 11px;
  text-anchor: middle;
  font-family: var(--font-mono);
}

.am1-shell .code-output {
  margin: 0;
  padding: 12px;
  border-radius: 8px;
  background: var(--bezel);
  border: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 0.84rem;
  white-space: pre-wrap;
  word-break: break-word;
  min-height: 92px;
}

.am1-shell .app-footer-bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 16px;
  font-size: 0.82rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
}

/* Read-Only Commercial IP Inspection Modal */
.am1-shell .is-hidden {
  display: none !important;
}

.am1-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);
}

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

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

.am1-shell .pill-group {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  padding: 0.25rem;
  border-radius: 12px;
  background-color: var(--surface-alt);
  border: 1px solid var(--border);
}

.am1-shell .inspect-tab {
  min-height: 44px;
  padding: 0.45rem 0.9rem;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
}

.am1-shell .inspect-tab.is-active {
  background: var(--accent);
  color: var(--accent-text);
  border-color: var(--accent);
}

.am1-shell .modal-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.am1-shell .modal-pre {
  margin: 0;
  width: 100%;
  max-height: 360px;
  overflow: auto;
  border-radius: 10px;
  background-color: var(--bezel);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.85rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  line-height: 1.5;
  white-space: pre;
}

@media (max-width: 720px) {
  .am1-shell {
    padding: 12px 12px 24px;
  }
  .am1-shell .tap-scale {
    grid-template-columns: repeat(auto-fit, minmax(44px, 1fr));
  }
  .am1-shell .comp-row {
    grid-template-columns: 1fr;
  }
}
