:root {
  --bg-0: #050508;
  --bg-1: #0a0a0f;
  --bg-2: #111118;
  --bg-3: #1a1a24;
  --border: #252532;
  --text-1: #f0f0f5;
  --text-2: #a0a0b0;
  --text-3: #606070;
  --accent-cyan: #00d4ff;
  --accent-orange: #ff6b35;
  --accent-green: #00e5a0;
  --accent-red: #ff3860;
  --accent-yellow: #ffc107;
  --font-ui: 'Inter', sans-serif;
  --font-mono: 'Share Tech Mono', monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; background: var(--bg-0); color: var(--text-1); font-family: var(--font-ui); overflow: hidden; }

body { display: flex; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg-1); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-3); }

/* ===== SIDEBAR ===== */
.sidebar {
  width: 260px;
  background: var(--bg-1);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 28px 20px;
  gap: 6px;
  flex-shrink: 0;
  z-index: 10;
}

.logo { font-family: var(--font-mono); font-size: 22px; letter-spacing: 3px; margin-bottom: 32px; color: var(--text-1); font-weight: 700; }
.logo span { color: var(--accent-cyan); }
.logo small { display: block; font-size: 10px; letter-spacing: 2px; color: var(--text-3); margin-top: 4px; font-weight: 400; }

.nav-btn {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; border-radius: 6px;
  background: transparent; border: none; color: var(--text-2);
  font-family: var(--font-ui); font-size: 14px; cursor: pointer;
  transition: all 0.15s; text-align: left; font-weight: 500;
}
.nav-btn:hover { background: var(--bg-2); color: var(--text-1); }
.nav-btn.active { background: var(--bg-2); color: var(--accent-cyan); box-shadow: inset 3px 0 0 var(--accent-cyan); }
.nav-icon { font-family: var(--font-mono); font-size: 16px; width: 20px; text-align: center; }

.sidebar-footer {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* ===== MAIN ===== */
main { flex: 1; overflow-y: auto; padding: 40px; position: relative; }

section { display: none; max-width: 1200px; margin: 0 auto; }
section.active { display: block; animation: fadeIn 0.35s ease; }

@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

h1 { font-size: 32px; font-weight: 700; margin-bottom: 8px; letter-spacing: -0.5px; }
.subtitle { color: var(--text-2); margin-bottom: 36px; font-size: 15px; max-width: 640px; line-height: 1.5; }

/* ===== WORKFLOW INDICATOR ===== */
.workflow-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}
.workflow-step {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.3px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  color: var(--text-3);
  transition: all 0.2s;
}
.workflow-step .step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--bg-3);
  font-size: 10px;
  font-family: var(--font-mono);
}
.workflow-step.active {
  background: rgba(0, 212, 255, 0.08);
  border-color: rgba(0, 212, 255, 0.3);
  color: var(--accent-cyan);
}
.workflow-step.active .step-num {
  background: var(--accent-cyan);
  color: #000;
}
.workflow-step.completed {
  background: rgba(0, 229, 160, 0.08);
  border-color: rgba(0, 229, 160, 0.3);
  color: var(--accent-green);
}
.workflow-step.completed .step-num {
  background: var(--accent-green);
  color: #000;
}
.workflow-arrow {
  color: var(--text-3);
  font-size: 11px;
  opacity: 0.5;
}

/* ===== CARDS ===== */
.card {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 28px;
  margin-bottom: 24px;
}
.card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; flex-wrap: wrap; gap: 12px; }
.card-title { font-size: 11px; text-transform: uppercase; letter-spacing: 1.5px; color: var(--text-3); font-weight: 700; }

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 20px; border-radius: 6px; border: 1px solid transparent;
  font-family: var(--font-ui); font-size: 13px; font-weight: 600;
  cursor: pointer; transition: all 0.15s; white-space: nowrap;
}
.btn-primary { background: var(--accent-cyan); color: #000; }
.btn-primary:hover { filter: brightness(1.15); transform: translateY(-1px); }
.btn-secondary { background: var(--bg-3); color: var(--text-1); border-color: var(--border); }
.btn-secondary:hover { background: var(--border); border-color: var(--text-3); }
.btn-danger { background: var(--accent-red); color: #fff; }
.btn-danger:hover { filter: brightness(1.15); }
.btn-success { background: var(--accent-green); color: #000; }
.btn-success:hover { filter: brightness(1.15); transform: translateY(-1px); }
.btn:disabled { opacity: 0.35; cursor: not-allowed; transform: none !important; filter: none !important; }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-lg { padding: 12px 28px; font-size: 14px; }
.btn-full { width: 100%; }

/* ===== STATUS PILLS ===== */
.pill {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 5px 12px; border-radius: 20px;
  font-family: var(--font-mono); font-size: 11px; font-weight: 700;
  background: var(--bg-2); border: 1px solid var(--border); letter-spacing: 0.5px;
}
.pill::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill.idle { color: var(--text-3); }
.pill.ready { color: var(--accent-green); }
.pill.recording { color: var(--accent-red); animation: pulse 1.2s infinite; }
.pill.processed { color: var(--accent-cyan); }

@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }

/* ===== METERS ===== */
.meter { display: flex; align-items: center; gap: 14px; margin-bottom: 10px; }
.meter-label { width: 64px; font-family: var(--font-mono); font-size: 11px; color: var(--text-3); font-weight: 700; letter-spacing: 1px; }
.meter-bar-bg { flex: 1; height: 8px; background: var(--bg-2); border-radius: 4px; overflow: hidden; position: relative; }
.meter-bar-bg::after { content: ''; position: absolute; left: 50%; top: 0; bottom: 0; width: 1px; background: var(--border); }
.meter-bar-fill { height: 100%; border-radius: 4px; transition: width 0.08s linear; position: relative; }
.meter-value { width: 80px; text-align: right; font-family: var(--font-mono); font-size: 12px; color: var(--text-1); }

/* ===== TIMELINE ===== */
.timeline-container { display: flex; align-items: center; gap: 12px; margin-top: 16px; }
.timeline-label {
  font-family: var(--font-mono); font-size: 11px; color: var(--text-3); min-width: 30px;
}
.timeline-label-right {
  font-family: var(--font-mono); font-size: 11px; color: var(--text-3); min-width: 40px; text-align: right;
}
.timeline-slider {
  flex: 1; -webkit-appearance: none; appearance: none;
  height: 5px; background: var(--bg-3); border-radius: 3px; outline: none;
}
.timeline-slider::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 16px; height: 16px; background: var(--accent-cyan); border-radius: 50%; cursor: pointer; border: 3px solid var(--bg-1); box-shadow: 0 0 0 1px var(--border); }
.timeline-slider::-moz-range-thumb { width: 16px; height: 16px; background: var(--accent-cyan); border-radius: 50%; cursor: pointer; border: 3px solid var(--bg-1); box-shadow: 0 0 0 1px var(--border); }

/* ===== 3D VIZ ===== */
.viz-layout { display: grid; grid-template-columns: 1fr; gap: 16px; }
.viz-canvas-wrap { position: relative; height: 520px; background: var(--bg-0); border-radius: 10px; border: 1px solid var(--border); overflow: hidden; }
.viz-canvas-wrap canvas { display: block; width: 100%; height: 100%; }
.viz-overlay {
  position: absolute; top: 16px; left: 16px; right: 16px;
  display: flex; justify-content: space-between; pointer-events: none; gap: 12px;
}
.viz-controls { pointer-events: auto; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.viz-readout {
  font-family: var(--font-mono); font-size: 11px; color: var(--text-2);
  background: rgba(5,5,8,0.85); padding: 10px 14px; border-radius: 6px;
  pointer-events: auto; border: 1px solid var(--border); backdrop-filter: blur(4px);
  min-width: 160px;
}
.viz-readout .row { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 3px; }
.viz-readout .row:last-child { margin-bottom: 0; }

/* ===== GRAPH ===== */
.graph-container { height: 220px; background: var(--bg-0); border-radius: 10px; border: 1px solid var(--border); position: relative; overflow: hidden; }
.graph-container canvas { display: block; width: 100%; height: 100%; }

/* ===== DROP ZONE ===== */
.drop-zone {
  border: 2px dashed var(--border); border-radius: 10px;
  padding: 56px 24px; text-align: center; color: var(--text-2);
  transition: all 0.2s; cursor: pointer; font-size: 14px;
}
.drop-zone:hover, .drop-zone.dragover { border-color: var(--accent-cyan); background: rgba(0,212,255,0.04); color: var(--text-1); }
.drop-zone-icon { font-size: 28px; margin-bottom: 10px; opacity: 0.6; }
.drop-zone strong { display: block; margin-top: 12px; font-size: 14px; }
.drop-zone-hint { margin-top: 6px; font-size: 13px; }
.drop-zone-input { display: none; }

/* ===== CODE BLOCK ===== */
.code-block {
  background: var(--bg-0); border: 1px solid var(--border);
  border-radius: 8px; padding: 20px;
  font-family: var(--font-mono); font-size: 12px;
  overflow-x: auto; max-height: 420px; color: var(--text-2);
  white-space: pre; line-height: 1.6;
}
.code-block.expanded { max-height: none; }
.code-actions { display: flex; gap: 10px; margin-top: 12px; }
.code-actions .btn { flex: 1; }

/* ===== MODAL ===== */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.75);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-overlay.active { display: flex; }
.modal-content {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: 12px;
  width: 100%;
  max-width: 960px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.modal-header h3 { font-size: 14px; text-transform: uppercase; letter-spacing: 1px; color: var(--text-3); }
.modal-close {
  background: none; border: none; color: var(--text-3);
  font-size: 20px; cursor: pointer; padding: 4px;
}
.modal-close:hover { color: var(--text-1); }
.modal-body {
  flex: 1;
  overflow: auto;
  padding: 20px;
}
.modal-body .code-block {
  max-height: none;
  margin: 0;
}
.modal-footer {
  display: flex;
  gap: 10px;
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.modal-footer .btn { flex: 1; }

/* ===== DOCS ===== */
.doc-section h3 { font-size: 20px; margin: 32px 0 14px; color: var(--text-1); font-weight: 600; }
.doc-section h3:first-child { margin-top: 0; }
.doc-section p { color: var(--text-2); line-height: 1.75; margin-bottom: 14px; font-size: 14.5px; }
.doc-section ol, .doc-section ul { margin-left: 22px; color: var(--text-2); line-height: 1.85; font-size: 14px; }
.doc-section li { margin-bottom: 8px; }
.doc-section code {
  background: var(--bg-2); padding: 2px 6px; border-radius: 4px;
  font-family: var(--font-mono); font-size: 12px; color: var(--accent-cyan); border: 1px solid var(--border);
}

/* ===== INFO BOXES ===== */
.warning-box {
  background: rgba(255, 107, 53, 0.06); border: 1px solid rgba(255, 107, 53, 0.25);
  border-radius: 8px; padding: 18px; margin: 18px 0; color: var(--accent-orange); font-size: 14px; line-height: 1.7;
}
.warning-box strong { display: block; margin-bottom: 6px; font-size: 13px; text-transform: uppercase; letter-spacing: 0.5px; }
.warning-box ol { margin-left: 18px; color: inherit; }
.warning-box li { margin-bottom: 6px; }

.tip-box {
  background: rgba(0, 212, 255, 0.06); border: 1px solid rgba(0, 212, 255, 0.25);
  border-radius: 8px; padding: 18px; margin: 18px 0; color: var(--accent-cyan); font-size: 14px; line-height: 1.7;
}
.tip-box strong { display: block; margin-bottom: 6px; font-size: 13px; text-transform: uppercase; letter-spacing: 0.5px; }

/* ===== PRESET CARDS ===== */
.preset-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; margin-bottom: 24px; }
.preset-card .metric { font-family: var(--font-mono); font-size: 13px; color: var(--text-2); line-height: 1.9; }
.preset-card .metric span { color: var(--text-1); }

/* ===== EMPTY STATE ===== */
.empty-state { text-align: center; padding: 48px; color: var(--text-3); font-size: 14px; }
.empty-state-icon { font-size: 32px; margin-bottom: 12px; opacity: 0.5; }

/* ===== TOAST NOTIFICATIONS ===== */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 18px;
  min-width: 280px;
  max-width: 400px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  animation: toastIn 0.3s ease;
  font-size: 13px;
  color: var(--text-1);
}
.toast.toast-error { border-color: rgba(255, 56, 96, 0.3); }
.toast.toast-error .toast-icon { color: var(--accent-red); }
.toast.toast-success { border-color: rgba(0, 229, 160, 0.3); }
.toast.toast-success .toast-icon { color: var(--accent-green); }
.toast.toast-info { border-color: rgba(0, 212, 255, 0.3); }
.toast.toast-info .toast-icon { color: var(--accent-cyan); }
.toast-icon { font-size: 16px; flex-shrink: 0; }
.toast-message { flex: 1; line-height: 1.4; }
.toast-close {
  background: none; border: none; color: var(--text-3); cursor: pointer; font-size: 16px; padding: 2px;
}
.toast-close:hover { color: var(--text-1); }

@keyframes toastIn {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}

/* ===== UTILITY CLASSES (replacing inline styles) ===== */
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)); gap: 20px; }
.grid-info { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 16px; }

.flex-row { display: flex; gap: 12px; flex-wrap: wrap; }
.flex-row-lg { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }

.mt-sm { margin-top: 14px; }
.mt-md { margin-top: 20px; }
.mt-lg { margin-top: 28px; }
.mb-lg { margin-bottom: 28px; }

.card-inner { margin: 0; padding: 20px; }
.card-title-green { color: var(--accent-green); }
.card-title-yellow { color: var(--accent-yellow); }

.mono-display {
  font-family: var(--font-mono);
  font-size: 36px;
  margin-top: 10px;
  color: var(--text-1);
}

.select-styled {
  background: var(--bg-2);
  color: var(--text-1);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 6px 8px;
  font-size: 12px;
  font-family: var(--font-ui);
}

.select-styled-lg {
  background: var(--bg-2);
  color: var(--text-1);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 14px;
  font-family: var(--font-ui);
  font-size: 13px;
  min-width: 160px;
}

.text-mono-muted {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-3);
}
.text-mono-accent {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-1);
  font-weight: 700;
}
.text-orange { color: var(--accent-orange); }
.text-cyan { color: var(--accent-cyan); }
.text-right { text-align: right; }

.card-padded-sm { padding: 20px; }
.card-header-tight { margin-bottom: 12px; }
.field-label { color: var(--text-2); font-size: 14px; font-weight: 500; }

/* ===== MOBILE NAV (bottom bar) ===== */
.mobile-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg-1);
  border-top: 1px solid var(--border);
  z-index: 100;
  padding: 8px 12px;
  justify-content: space-around;
  gap: 4px;
}
.mobile-nav-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 8px;
  border-radius: 8px;
  background: transparent;
  border: none;
  color: var(--text-3);
  font-family: var(--font-ui);
  font-size: 10px;
  cursor: pointer;
  transition: all 0.15s;
  flex: 1;
  min-width: 0;
}
.mobile-nav-btn:hover { color: var(--text-1); }
.mobile-nav-btn.active { color: var(--accent-cyan); background: rgba(0, 212, 255, 0.06); }
.mobile-nav-icon { font-family: var(--font-mono); font-size: 18px; }

/* ===== RESPONSIVE ===== */
@media (max-width: 900px) {
  body { flex-direction: column; padding-bottom: 72px; }
  .sidebar { display: none; }
  .mobile-nav { display: flex; }
  main { padding: 20px; padding-bottom: 80px; }
  h1 { font-size: 24px; }
  .subtitle { font-size: 14px; margin-bottom: 24px; }

  .viz-canvas-wrap { height: 360px; }
  .viz-overlay { flex-direction: column; top: 8px; left: 8px; right: 8px; }
  .viz-readout { min-width: auto; width: 100%; }
  .viz-controls { width: 100%; }

  .preset-grid { grid-template-columns: 1fr; }
  .grid-2 { grid-template-columns: 1fr; }

  .workflow-indicator { gap: 4px; }
  .workflow-step { padding: 4px 10px; font-size: 11px; }
  .workflow-arrow { display: none; }

  .card { padding: 20px; }

  .toast-container { top: 12px; right: 12px; left: 12px; }
  .toast { max-width: 100%; min-width: auto; }

  .modal-content { max-width: 100%; max-height: 95vh; }
}

@media (max-width: 600px) {
  .viz-canvas-wrap { height: 280px; }
  .btn { padding: 10px 14px; font-size: 12px; }
  .flex-row-lg { gap: 10px; }
  .select-styled-lg { min-width: 120px; }
}

@media (max-width: 400px) {
  .workflow-step .step-label { display: none; }
}
.hidden { display: none !important; }
.drop-zone-success-title { color: var(--accent-green); font-weight: 600; }
.drop-zone-success-meta { font-size: 12px; margin-top: 4px; color: var(--text-3); }
