/* Zoe Swellmark Universal Autonomy Kernel - Studio Stylesheet
 * Dual Themes: Nocturnal Obsidian (default) & Daylight Vellum
 * Scoped cleanly under body.uk-body / .uk-shell | Zero padding reset on body
 */

:root,
html[data-theme="dark"],
body.uk-body[data-theme="nocturnal"] {
  --bg: #0b0f17;
  --surface: #141b29;
  --surface-alt: #1b2436;
  --border: #334155;
  --text: #f1f5f9;
  --text-muted: #cbd5e1;
  --accent: #93c5fd;
  --accent-good: #34d399;
  --accent-warn: #fbbf24;
  --accent-vg: #60a5fa;
  --btn-primary-bg: #1e40af;
  --btn-primary-fg: #ffffff;
  --btn-primary-border: #3b82f6;
  --btn-secondary-bg: #1e293b;
  --btn-secondary-fg: #f8fafc;
  --btn-secondary-border: #475569;
  --btn-warn-bg: #92400e;
  --btn-warn-fg: #fef3c7;
  --btn-warn-border: #d97706;
  --input-bg: #0f1623;
  --input-fg: #f8fafc;
  --input-border: #475569;
  --code-bg: #090d14;
  --code-fg: #e2e8f0;
  --track-bg: #293548;
  --info-bg: #1e3a8a;
  --info-fg: #eff6ff;
  --good-bg: #064e3b;
  --good-fg: #ecfdf5;
  --warn-bg: #78350f;
  --warn-fg: #fef3c7;
  --err-bg: #7f1d1d;
  --err-fg: #fee2e2;
  --idle-bg: #1e293b;
  --idle-fg: #f1f5f9;
  --c64-bg: #1b175c;
  --c64-fg: #c7d2fe;
  --c64-border: #6366f1;
}

html[data-theme="light"],
body.uk-body[data-theme="vellum"] {
  --bg: #f7f4ec;
  --surface: #fffdf7;
  --surface-alt: #f0ebe0;
  --border: #94a3b8;
  --text: #111827;
  --text-muted: #374151;
  --accent: #1d4ed8;
  --accent-good: #047857;
  --accent-warn: #92400e;
  --accent-vg: #1e40af;
  --btn-primary-bg: #1e40af;
  --btn-primary-fg: #ffffff;
  --btn-primary-border: #1e3a8a;
  --btn-secondary-bg: #e2ddd0;
  --btn-secondary-fg: #111827;
  --btn-secondary-border: #64748b;
  --btn-warn-bg: #92400e;
  --btn-warn-fg: #ffffff;
  --btn-warn-border: #78350f;
  --input-bg: #ffffff;
  --input-fg: #111827;
  --input-border: #64748b;
  --code-bg: #f3efe4;
  --code-fg: #111827;
  --track-bg: #d6d0c0;
  --info-bg: #dbeafe;
  --info-fg: #1e3a8a;
  --good-bg: #d1fae5;
  --good-fg: #064e3b;
  --warn-bg: #fef3c7;
  --warn-fg: #78350f;
  --err-bg: #fee2e2;
  --err-fg: #7f1d1d;
  --idle-bg: #e2e8f0;
  --idle-fg: #0f172a;
  --c64-bg: #1b175c;
  --c64-fg: #e0e7ff;
  --c64-border: #3730a3;
}

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

body.uk-body {
  margin: 0;
  background-color: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  overflow-x: clip;
}

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

.uk-shell {
  max-width: 1360px;
  margin: 0 auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

/* Commercial IP Lock Banner (Site Design System Tokens) */
.uk-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);
}

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

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

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

.uk-shell .card {
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  min-width: 0;
}

.uk-shell .subpanel {
  background-color: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  min-width: 0;
}

.uk-shell h1,
.uk-shell h2,
.uk-shell h3,
.uk-shell p {
  margin: 0;
}

.uk-shell h1 {
  font-size: 1.55rem;
  line-height: 1.25;
  color: var(--text);
}

.uk-shell h2 {
  font-size: 1.2rem;
  line-height: 1.3;
  color: var(--text);
}

.uk-shell h3 {
  font-size: 1.02rem;
  line-height: 1.35;
  color: var(--text);
}

.uk-shell .eyebrow {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 4px;
}

.uk-shell .subtitle,
.uk-shell .device-sub,
.uk-shell .muted-note {
  font-size: 0.9rem;
  color: var(--text-muted);
  max-width: 68ch;
  line-height: 1.55;
}

.uk-shell .top-header {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.uk-shell .header-main {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.uk-shell .brand-block {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.uk-shell .constitutional-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background-color: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.88rem;
  color: var(--text);
}

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

.uk-shell .panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.uk-shell .panel-header,
.uk-shell .section-title-row,
.uk-shell .device-header,
.uk-shell .validator-header-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.uk-shell .controls-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.uk-shell .control-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.uk-shell .control-wide {
  grid-column: span 2;
}

.uk-shell .control-label,
.uk-shell .control-heading-text {
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--text);
  min-width: 44px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}

.uk-shell .input-action-row,
.uk-shell .file-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.uk-shell .control-input {
  flex: 1 1 240px;
  min-width: 44px;
  min-height: 44px;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid var(--input-border);
  background-color: var(--input-bg);
  color: var(--input-fg);
  font-size: 0.95rem;
}

.uk-shell .mono-input {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.88rem;
}

.uk-shell .file-input-hidden {
  display: none;
}

.uk-shell .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  padding: 10px 16px;
  border-radius: 8px;
  border: 1px solid transparent;
  font-size: 0.94rem;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  line-height: 1.2;
}

.uk-shell .btn:focus-visible,
.uk-shell .control-input:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

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

.uk-shell .btn-secondary {
  background-color: var(--btn-secondary-bg);
  color: var(--btn-secondary-fg);
  border-color: var(--btn-secondary-border);
}

.uk-shell .btn-warn {
  background-color: var(--btn-warn-bg);
  color: var(--btn-warn-fg);
  border-color: var(--btn-warn-border);
}

.uk-shell .btn-glove {
  min-height: 52px;
  min-width: 110px;
  flex: 1 1 130px;
  font-size: 0.98rem;
}

.uk-shell .badge,
.uk-shell .status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 12px;
  border-radius: 14px;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: normal;
  max-width: 100%;
  text-align: center;
  overflow-wrap: anywhere;
}

.uk-shell .badge-info,
.uk-shell .badge-accent {
  background-color: var(--info-bg);
  color: var(--info-fg);
}

.uk-shell .badge-good,
.uk-shell .status-good {
  background-color: var(--good-bg);
  color: var(--good-fg);
}

.uk-shell .badge-warn,
.uk-shell .status-warn {
  background-color: var(--warn-bg);
  color: var(--warn-fg);
}

.uk-shell .badge-err,
.uk-shell .status-err {
  background-color: var(--err-bg);
  color: var(--err-fg);
}

.uk-shell .status-idle {
  background-color: var(--idle-bg);
  color: var(--idle-fg);
}

.uk-shell .devices-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.uk-shell .device-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

.uk-shell .ios-visual-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
}

.uk-shell .donut-wrap {
  width: 120px;
  height: 120px;
  flex-shrink: 0;
}

.uk-shell .donut-svg {
  width: 100%;
  height: 100%;
  display: block;
}

.uk-shell .donut-track {
  fill: none;
  stroke: var(--track-bg);
  stroke-width: 12;
}

.uk-shell .donut-fill {
  fill: none;
  stroke: var(--accent-good);
  stroke-width: 12;
  stroke-linecap: round;
}

.uk-shell .donut-text {
  fill: var(--text);
  font-size: 18px;
  font-weight: 700;
}

.uk-shell .donut-subtext {
  fill: var(--text-muted);
  font-size: 10px;
  font-weight: 600;
}

.uk-shell .ios-gauges {
  flex: 1 1 200px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}

.uk-shell .gauge-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.uk-shell .gauge-label-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-size: 0.88rem;
  color: var(--text);
}

.uk-shell .gauge-svg {
  width: 100%;
  height: 14px;
  display: block;
}

.uk-shell .gauge-track {
  fill: var(--track-bg);
}

.uk-shell .gauge-good {
  fill: var(--accent-good);
}

.uk-shell .gauge-vg {
  fill: var(--accent-vg);
}

.uk-shell .kv-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 8px;
}

.uk-shell .kv-k {
  display: block;
  font-size: 0.78rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.uk-shell .kv-v {
  font-size: 0.92rem;
  color: var(--text);
}

.uk-shell .mono-line {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.82rem;
  color: var(--text);
  word-break: break-all;
}

.uk-shell .am1-status-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.uk-shell .status-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  display: inline-block;
  border: 2px solid var(--border);
}

.uk-shell .dot-good {
  background-color: var(--accent-good);
}

.uk-shell .dot-warn {
  background-color: var(--accent-warn);
}

.uk-shell .android-telemetry {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.uk-shell .phase-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.uk-shell .counters-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.uk-shell .counter-box {
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px;
  text-align: center;
}

.uk-shell .counter-num {
  font-size: 1.25rem;
  color: var(--text);
}

.uk-shell .glove-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.uk-shell .trend-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
  font-size: 0.85rem;
}

.uk-shell .legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text);
}

.uk-shell .legend-swatch {
  width: 14px;
  height: 4px;
  display: inline-block;
  border-radius: 2px;
}

.uk-shell .swatch-k {
  background-color: var(--accent);
}

.uk-shell .swatch-g {
  background-color: var(--accent-good);
}

.uk-shell .trend-svg {
  width: 100%;
  height: 130px;
  display: block;
}

.uk-shell .trend-grid {
  stroke: var(--border);
  stroke-width: 1;
}

.uk-shell .trend-axis-label {
  fill: var(--text-muted);
  font-size: 10px;
}

.uk-shell .trend-line-k {
  stroke: var(--accent);
  stroke-width: 2.5;
}

.uk-shell .trend-line-g {
  stroke: var(--accent-good);
  stroke-width: 2.5;
}

.uk-shell .trend-point-k {
  fill: var(--accent);
}

.uk-shell .trend-point-g {
  fill: var(--accent-good);
}

.uk-shell .c64-crt {
  margin: 0;
  padding: 12px;
  border-radius: 8px;
  border: 3px solid var(--c64-border);
  background-color: var(--c64-bg);
  color: var(--c64-fg);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.78rem;
  line-height: 1.25;
  overflow-x: auto;
  white-space: pre;
}

.uk-shell .code-box {
  margin: 8px 0 0 0;
  padding: 10px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background-color: var(--code-bg);
  color: var(--code-fg);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.8rem;
  line-height: 1.4;
  max-height: 220px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

.uk-shell .parity-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.uk-shell .parity-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.uk-shell .metrics-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 8px;
}

.uk-shell .metric-tile {
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px;
  min-width: 0;
}

.uk-shell .metric-tile strong {
  font-size: 0.9rem;
  color: var(--text);
  word-break: break-word;
}

.uk-shell .quick-log-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.uk-shell .quick-log-btn {
  flex: 1 1 110px;
  font-size: 0.85rem;
  padding: 8px 10px;
}

.uk-shell .json-full-panel {
  width: 100%;
}

.uk-shell .footer-panel {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.uk-shell .footer-flags {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.85rem;
  color: var(--text);
  word-break: break-word;
}

@media (max-width: 960px) {
  .uk-shell .controls-grid,
  .uk-shell .devices-grid,
  .uk-shell .parity-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .uk-shell .control-wide {
    grid-column: span 1;
  }

  .uk-shell .metrics-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 520px) {
  .uk-shell {
    padding: 10px;
  }

  .uk-shell .metrics-grid,
  .uk-shell .kv-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}
