/* ============================================================
   AetherForge — STEMist Hacks IV Winning Design System
   ~650+ lines of carefully crafted CSS
   ============================================================ */

:root {
  --bg: #0b1120;
  --bg-elevated: #111827;
  --bg-card: #1e293b;
  --bg-hover: #334155;
  --border: #334155;
  --border-light: #475569;
  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --primary: #6366f1;
  --primary-hover: #818cf8;
  --primary-glow: rgba(99, 102, 241, 0.35);
  --accent: #22d3ee;
  --accent-glow: rgba(34, 211, 238, 0.25);
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #3b82f6;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.5);
  --font: 'Inter', system-ui, -apple-system, sans-serif;
  --mono: 'JetBrains Mono', 'Fira Code', monospace;
  --nav-h: 64px;
  --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="light"] {
  --bg: #f8fafc;
  --bg-elevated: #ffffff;
  --bg-card: #ffffff;
  --bg-hover: #f1f5f9;
  --border: #e2e8f0;
  --border-light: #cbd5e1;
  --text: #0f172a;
  --text-muted: #475569;
  --text-dim: #94a3b8;
  --primary-glow: rgba(99, 102, 241, 0.15);
  --accent-glow: rgba(34, 211, 238, 0.12);
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.12);
}

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

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ---------- Loader ---------- */
.loader {
  position: fixed;
  inset: 0;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  transition: opacity 0.5s, visibility 0.5s;
}
.loader.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
.loader-inner {
  text-align: center;
}
.loader-orb {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  margin: 0 auto 1.5rem;
  animation: pulse-orb 1.4s ease-in-out infinite;
  box-shadow: 0 0 40px var(--primary-glow);
}
@keyframes pulse-orb {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.15); opacity: 0.8; }
}
.loader h2 {
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}
.loader p {
  color: var(--text-muted);
  margin-top: 0.5rem;
}

/* ---------- Navbar ---------- */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--nav-h);
  background: rgba(11, 17, 32, 0.85);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  z-index: 1000;
  transition: background var(--transition);
}
[data-theme="light"] .navbar {
  background: rgba(248, 250, 252, 0.85);
}
.nav-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  cursor: pointer;
  font-weight: 800;
  font-size: 1.25rem;
  letter-spacing: -0.03em;
}
.logo-icon {
  font-size: 1.5rem;
  filter: drop-shadow(0 0 8px var(--primary-glow));
}
.nav-links {
  display: flex;
  list-style: none;
  gap: 0.25rem;
}
.nav-link {
  color: var(--text-muted);
  text-decoration: none;
  padding: 0.45rem 0.85rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 500;
  transition: all var(--transition);
}
.nav-link:hover,
.nav-link.active {
  color: var(--text);
  background: var(--bg-hover);
}
.nav-link.active {
  background: var(--primary);
  color: white;
}
.nav-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.icon-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
}
.icon-btn:hover {
  background: var(--bg-hover);
  border-color: var(--border-light);
}
.user-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 0.25rem 0.75rem 0.25rem 0.25rem;
  border-radius: 999px;
  cursor: pointer;
  color: var(--text);
  font-size: 0.875rem;
}
.avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.75rem;
}
.mobile-only {
  display: none;
}

/* ---------- Main & Sections ---------- */
main {
  padding-top: var(--nav-h);
  min-height: 100vh;
}
.section {
  display: none;
  padding: 2rem 1.5rem 4rem;
  max-width: 1400px;
  margin: 0 auto;
  animation: fadeIn 0.35s ease;
}
.section.active {
  display: block;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.75rem;
  flex-wrap: wrap;
  gap: 1rem;
}
.section-header h2 {
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: -0.03em;
}
.header-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.65rem 1.25rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.9rem;
  border: none;
  cursor: pointer;
  transition: all var(--transition);
  font-family: inherit;
}
.btn-primary {
  background: var(--primary);
  color: white;
  box-shadow: 0 0 20px var(--primary-glow);
}
.btn-primary:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
}
.btn-ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-ghost:hover {
  background: var(--bg-hover);
}
.btn-sm {
  padding: 0.4rem 0.85rem;
  font-size: 0.8rem;
}
.btn-xs {
  padding: 0.25rem 0.6rem;
  font-size: 0.75rem;
}
.btn-block {
  width: 100%;
}
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

/* ---------- Hero ---------- */
.hero {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 3rem;
  align-items: center;
  padding: 3rem 0 4rem;
}
.badge {
  display: inline-block;
  background: rgba(99, 102, 241, 0.15);
  color: var(--primary-hover);
  padding: 0.3rem 0.85rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  margin-bottom: 1.25rem;
  border: 1px solid rgba(99, 102, 241, 0.3);
}
.hero h1 {
  font-size: clamp(2.2rem, 4.5vw, 3.4rem);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.04em;
  margin-bottom: 1.25rem;
}
.gradient-text {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.hero-sub {
  font-size: 1.1rem;
  color: var(--text-muted);
  max-width: 520px;
  margin-bottom: 2rem;
}
.hero-cta {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 2.5rem;
  flex-wrap: wrap;
}
.hero-stats {
  display: flex;
  gap: 2rem;
  flex-wrap: wrap;
}
.stat {
  display: flex;
  flex-direction: column;
}
.stat strong {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--accent);
}
.stat span {
  font-size: 0.8rem;
  color: var(--text-dim);
}
.hero-visual {
  position: relative;
  height: 420px;
}
.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  opacity: 0.5;
}
.orb-1 {
  width: 220px;
  height: 220px;
  background: var(--primary);
  top: 10%;
  left: 10%;
  animation: float 8s ease-in-out infinite;
}
.orb-2 {
  width: 160px;
  height: 160px;
  background: var(--accent);
  bottom: 15%;
  right: 5%;
  animation: float 10s ease-in-out infinite reverse;
}
.orb-3 {
  width: 100px;
  height: 100px;
  background: #a855f7;
  top: 50%;
  left: 50%;
  animation: float 7s ease-in-out infinite 1s;
}
@keyframes float {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(20px, -25px); }
}
.hero-card {
  position: absolute;
  inset: 40px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.card-header {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.75rem 1rem;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
}
.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}
.dot.red { background: #ef4444; }
.dot.yellow { background: #f59e0b; }
.dot.green { background: #10b981; }
.card-title {
  margin-left: 0.5rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  font-family: var(--mono);
}
.code-preview {
  flex: 1;
  padding: 1rem;
  font-family: var(--mono);
  font-size: 0.8rem;
  line-height: 1.55;
  overflow: auto;
  color: var(--text-muted);
  white-space: pre-wrap;
}

/* ---------- Features Grid ---------- */
.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.25rem;
  margin: 3rem 0;
}
.feature-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  cursor: pointer;
  transition: all var(--transition);
}
.feature-card:hover {
  border-color: var(--primary);
  box-shadow: 0 0 30px var(--primary-glow);
  transform: translateY(-3px);
}
.feature-icon {
  font-size: 2rem;
  margin-bottom: 0.75rem;
}
.feature-card h3 {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}
.feature-card p {
  font-size: 0.9rem;
  color: var(--text-muted);
}

/* ---------- Tracks Banner ---------- */
.tracks-banner {
  text-align: center;
  padding: 2.5rem;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.1), rgba(34, 211, 238, 0.08));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-top: 2rem;
}
.tracks-banner h2 {
  font-size: 1.4rem;
  margin-bottom: 1.25rem;
}
.tracks {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.6rem;
}
.track {
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 0.4rem 1rem;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent);
}

/* ---------- Workspace ---------- */
.workspace-layout {
  display: grid;
  grid-template-columns: 200px 1fr 320px;
  gap: 1rem;
  height: calc(100vh - var(--nav-h) - 120px);
  min-height: 480px;
}
.file-tree {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.tree-header {
  padding: 0.75rem 1rem;
  font-weight: 600;
  font-size: 0.85rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg-elevated);
}
.file-list {
  list-style: none;
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem;
}
.file-item {
  padding: 0.4rem 0.6rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
  font-family: var(--mono);
  display: flex;
  align-items: center;
  gap: 0.4rem;
  transition: background var(--transition);
}
.file-item:hover,
.file-item.active {
  background: var(--bg-hover);
}
.file-item.active {
  color: var(--accent);
}
.tree-footer {
  padding: 0.5rem;
  border-top: 1px solid var(--border);
}
.editor-pane {
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.editor-tabs {
  display: flex;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
}
.editor-tab {
  padding: 0.5rem 1rem;
  font-size: 0.8rem;
  font-family: var(--mono);
  cursor: pointer;
  border-right: 1px solid var(--border);
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.editor-tab.active {
  background: var(--bg-card);
  color: var(--accent);
}
.editor-tab .close-tab {
  opacity: 0.5;
  font-size: 0.7rem;
}
.editor-tab .close-tab:hover {
  opacity: 1;
  color: var(--danger);
}
.editor-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  position: relative;
}
#codeEditor {
  flex: 1;
  width: 100%;
  background: transparent;
  border: none;
  color: var(--text);
  font-family: var(--mono);
  font-size: 0.9rem;
  line-height: 1.6;
  padding: 1rem;
  resize: none;
  outline: none;
  tab-size: 2;
}
.editor-status {
  display: flex;
  gap: 1.5rem;
  padding: 0.35rem 1rem;
  font-size: 0.75rem;
  color: var(--text-dim);
  border-top: 1px solid var(--border);
  background: var(--bg-elevated);
}
.preview-pane {
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.preview-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0.75rem;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
  font-weight: 600;
}
#previewFrame {
  flex: 1;
  border: none;
  background: white;
  min-height: 180px;
}
.console-output {
  height: 140px;
  overflow-y: auto;
  padding: 0.5rem 0.75rem;
  font-family: var(--mono);
  font-size: 0.78rem;
  background: #0a0f1a;
  color: #a5b4c8;
  border-top: 1px solid var(--border);
}
.console-output .log-error { color: #f87171; }
.console-output .log-warn { color: #fbbf24; }
.console-output .log-info { color: #60a5fa; }
.console-output .log-success { color: #34d399; }

/* ---------- AI Tutor ---------- */
.tutor-layout {
  display: flex;
  flex-direction: column;
  height: calc(100vh - var(--nav-h) - 140px);
  min-height: 500px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.chat-window {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}
.chat-message {
  display: flex;
  gap: 0.85rem;
  max-width: 85%;
  animation: msgIn 0.3s ease;
}
@keyframes msgIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
.chat-message.user {
  align-self: flex-end;
  flex-direction: row-reverse;
}
.msg-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 1rem;
}
.chat-message.user .msg-avatar {
  background: var(--bg-hover);
}
.msg-body {
  background: var(--bg-elevated);
  padding: 0.85rem 1.1rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}
.chat-message.user .msg-body {
  background: rgba(99, 102, 241, 0.15);
  border-color: rgba(99, 102, 241, 0.3);
}
.msg-body strong {
  display: block;
  font-size: 0.8rem;
  margin-bottom: 0.3rem;
  color: var(--accent);
}
.msg-body p {
  font-size: 0.95rem;
  white-space: pre-wrap;
}
.msg-body code {
  background: rgba(0,0,0,0.3);
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  font-family: var(--mono);
  font-size: 0.85em;
}
.chat-input-area {
  border-top: 1px solid var(--border);
  padding: 1rem;
  background: var(--bg-elevated);
}
.quick-prompts {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.75rem;
}
.prompt-chip {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  font-size: 0.75rem;
  cursor: pointer;
  transition: all var(--transition);
}
.prompt-chip:hover {
  border-color: var(--primary);
  color: var(--text);
}
.input-row {
  display: flex;
  gap: 0.75rem;
}
#chatInput {
  flex: 1;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 0.75rem 1rem;
  font-family: inherit;
  font-size: 0.95rem;
  resize: none;
  outline: none;
}
#chatInput:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

/* ---------- Circuit Lab ---------- */
.circuit-layout {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 1.25rem;
}
.circuit-canvas-wrap {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  position: relative;
}
#circuitCanvas {
  display: block;
  width: 100%;
  background: #0a0f1a;
  cursor: crosshair;
}
.canvas-hint {
  position: absolute;
  bottom: 8px;
  left: 12px;
  font-size: 0.75rem;
  color: var(--text-dim);
  pointer-events: none;
}
.circuit-sidebar {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}
.circuit-sidebar h3 {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.props-panel, .sim-results {
  font-size: 0.9rem;
}
.prop-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}
.prop-row input {
  width: 80px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.3rem 0.5rem;
  border-radius: 4px;
  font-family: var(--mono);
  font-size: 0.85rem;
}
#scopeCanvas {
  width: 100%;
  background: #0a0f1a;
  border-radius: 6px;
  border: 1px solid var(--border);
}

/* ---------- Security ---------- */
.security-layout {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 1.5rem;
}
.scan-input label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--text-muted);
}
#scanCode {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--mono);
  font-size: 0.85rem;
  padding: 1rem;
  resize: vertical;
  outline: none;
  line-height: 1.5;
}
#scanCode:focus {
  border-color: var(--primary);
}
.scan-results {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}
.score-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  text-align: center;
}
.score-circle {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  border: 6px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 0.75rem;
  font-size: 1.75rem;
  font-weight: 800;
  transition: border-color 0.4s;
}
.score-circle.high { border-color: var(--success); color: var(--success); }
.score-circle.medium { border-color: var(--warning); color: var(--warning); }
.score-circle.low { border-color: var(--danger); color: var(--danger); }
.findings-list {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  max-height: 480px;
  overflow-y: auto;
}
.finding {
  padding: 0.85rem;
  border-radius: var(--radius-sm);
  margin-bottom: 0.6rem;
  border-left: 3px solid;
  background: var(--bg-elevated);
}
.finding.critical { border-color: var(--danger); }
.finding.high { border-color: #f97316; }
.finding.medium { border-color: var(--warning); }
.finding.low { border-color: var(--info); }
.finding.info { border-color: var(--text-dim); }
.finding-title {
  font-weight: 700;
  font-size: 0.9rem;
  margin-bottom: 0.25rem;
}
.finding-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
}
.finding-line {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-top: 0.3rem;
}

/* ---------- Vision Lab ---------- */
.vision-layout {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 1.5rem;
}
.vision-preview {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  position: relative;
  min-height: 420px;
}
.drop-zone {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--text-muted);
  font-size: 1rem;
  z-index: 2;
  background: var(--bg-card);
  cursor: pointer;
  transition: background var(--transition);
}
.drop-zone.hidden {
  display: none;
}
.drop-zone:hover,
.drop-zone.dragover {
  background: var(--bg-hover);
  border: 2px dashed var(--primary);
}
#visionCanvas {
  display: block;
  width: 100%;
  height: auto;
  max-height: 520px;
  object-fit: contain;
}
.vision-results {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  max-height: 600px;
  overflow-y: auto;
}
.vision-results h3 {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.detected-list {
  list-style: none;
}
.detected-list li {
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
  display: flex;
  justify-content: space-between;
}
.detected-list .conf {
  color: var(--accent);
  font-family: var(--mono);
  font-size: 0.8rem;
}
.wiring-box {
  background: var(--bg-elevated);
  border-radius: var(--radius-sm);
  padding: 0.85rem;
  font-size: 0.85rem;
  line-height: 1.5;
}
.bom-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}
.bom-table th,
.bom-table td {
  padding: 0.4rem 0.5rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
.bom-table th {
  color: var(--text-muted);
  font-weight: 600;
}

/* ---------- Deploy ---------- */
.deploy-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}
.deploy-form,
.deploy-status {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
}
.form-group {
  margin-bottom: 1.1rem;
}
.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
  color: var(--text-muted);
}
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 0.6rem 0.85rem;
  font-family: inherit;
  font-size: 0.9rem;
  outline: none;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}
.form-group textarea {
  font-family: var(--mono);
  resize: vertical;
}
.deploy-log {
  background: #0a0f1a;
  border-radius: var(--radius-sm);
  padding: 1rem;
  font-family: var(--mono);
  font-size: 0.8rem;
  height: 280px;
  overflow-y: auto;
  color: #a5b4c8;
  line-height: 1.6;
}
.deploy-log .log-ok { color: #34d399; }
.deploy-log .log-step { color: #60a5fa; }
.deploy-log .log-err { color: #f87171; }
.deploy-meta {
  margin-top: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.meta-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.9rem;
}
.meta-row span {
  color: var(--text-muted);
}

/* ---------- Dashboard ---------- */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.25rem;
}
.dash-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
}
.dash-card.wide {
  grid-column: 1 / -1;
}
.dash-card h3 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 1rem;
}
.recent-list {
  list-style: none;
}
.recent-list li {
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  font-size: 0.9rem;
}
.recent-list .time {
  color: var(--text-dim);
  font-size: 0.8rem;
}
.achievements {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}
.achievement {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.85rem;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.achievement.locked {
  opacity: 0.45;
}
.progress-tracks {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.progress-item {
  display: grid;
  grid-template-columns: 180px 1fr 50px;
  align-items: center;
  gap: 1rem;
  font-size: 0.9rem;
}
.progress-bar {
  height: 8px;
  background: var(--bg-elevated);
  border-radius: 999px;
  overflow: hidden;
}
.progress-bar .fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  border-radius: 999px;
  transition: width 0.6s ease;
}

/* ---------- Utilities ---------- */
.muted {
  color: var(--text-dim);
  font-size: 0.9rem;
}
.select {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  outline: none;
}
.hidden {
  display: none !important;
}

/* ---------- Toasts ---------- */
.toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.toast {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.85rem 1.25rem;
  box-shadow: var(--shadow);
  font-size: 0.9rem;
  animation: toastIn 0.3s ease;
  max-width: 340px;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.toast.success { border-left: 3px solid var(--success); }
.toast.error { border-left: 3px solid var(--danger); }
.toast.info { border-left: 3px solid var(--info); }
@keyframes toastIn {
  from { opacity: 0; transform: translateX(30px); }
  to { opacity: 1; transform: translateX(0); }
}

/* ---------- Modal ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 3000;
  backdrop-filter: blur(4px);
}
.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 480px;
  box-shadow: var(--shadow-lg);
  animation: modalIn 0.25s ease;
}
@keyframes modalIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
}
.modal-body {
  padding: 1.25rem;
}
.modal-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .workspace-layout {
    grid-template-columns: 160px 1fr;
  }
  .preview-pane {
    display: none;
  }
  .circuit-layout,
  .security-layout,
  .vision-layout,
  .deploy-layout {
    grid-template-columns: 1fr;
  }
  .hero {
    grid-template-columns: 1fr;
  }
  .hero-visual {
    height: 320px;
  }
}
@media (max-width: 768px) {
  .nav-links {
    display: none;
    position: absolute;
    top: var(--nav-h);
    left: 0;
    right: 0;
    background: var(--bg-elevated);
    flex-direction: column;
    padding: 1rem;
    border-bottom: 1px solid var(--border);
  }
  .nav-links.open {
    display: flex;
  }
  .mobile-only {
    display: flex;
  }
  .user-name {
    display: none;
  }
  .workspace-layout {
    grid-template-columns: 1fr;
    height: auto;
  }
  .file-tree {
    max-height: 160px;
  }
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
  .progress-item {
    grid-template-columns: 1fr;
    gap: 0.35rem;
  }
  .hero-stats {
    gap: 1.25rem;
  }
}
