/* ============================================================================
   MELCH AI OS — Autonomous Company Operating System
   Obsidian Glassmorphism · MELCH Gold (#d4a64a) · Cyan (#38bdf8) · Emerald (#34d399)
   ============================================================================ */

:root {
  --bg: #050811;
  --bg-elevated: rgba(12, 18, 32, 0.74);
  --bg-card: rgba(15, 22, 38, 0.72);
  --bg-card-hover: rgba(20, 30, 52, 0.86);
  --bg-input: rgba(8, 13, 24, 0.85);
  --bg-subtle: rgba(255, 255, 255, 0.035);
  --border: rgba(148, 163, 184, 0.14);
  --border-gold: rgba(212, 166, 74, 0.32);
  --border-strong: rgba(148, 163, 184, 0.28);

  --ink: #f1f5f9;
  --ink-muted: #94a3b8;
  --ink-soft: #64748b;

  --gold: #d4a64a;
  --gold-bright: #f2cf82;
  --gold-dim: rgba(212, 166, 74, 0.14);

  --cyan: #38bdf8;
  --cyan-dim: rgba(56, 189, 248, 0.14);

  --emerald: #34d399;
  --emerald-dim: rgba(52, 211, 153, 0.14);

  --amber: #f59e0b;
  --amber-dim: rgba(245, 158, 11, 0.15);

  --crimson: #f87171;
  --crimson-dim: rgba(248, 113, 113, 0.15);

  --shadow-sm: 0 4px 16px rgba(0, 0, 0, 0.26);
  --shadow-md: 0 12px 34px rgba(0, 0, 0, 0.42);
  --shadow-lg: 0 24px 64px rgba(0, 0, 0, 0.58);
  --glow-gold: 0 0 28px rgba(212, 166, 74, 0.18);
  --glow-cyan: 0 0 28px rgba(56, 189, 248, 0.16);

  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --topbar-h: 58px;
  --dock-w: 244px;

  --font-sans: "Inter", "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: "JetBrains Mono", "Cascadia Code", ui-monospace, SFMono-Regular, Menlo, monospace;
}

[data-theme="light"] {
  --bg: #f2f5fa;
  --bg-elevated: rgba(255, 255, 255, 0.86);
  --bg-card: rgba(255, 255, 255, 0.84);
  --bg-card-hover: rgba(255, 255, 255, 0.97);
  --bg-input: rgba(248, 250, 252, 0.96);
  --bg-subtle: rgba(15, 23, 42, 0.04);
  --border: rgba(15, 23, 42, 0.1);
  --border-gold: rgba(168, 118, 24, 0.32);
  --border-strong: rgba(15, 23, 42, 0.2);

  --ink: #0f172a;
  --ink-muted: #475569;
  --ink-soft: #64748b;

  --gold: #a67618;
  --gold-bright: #c58f24;
  --gold-dim: rgba(166, 118, 24, 0.12);

  --cyan: #0284c7;
  --cyan-dim: rgba(2, 132, 199, 0.11);

  --emerald: #059669;
  --emerald-dim: rgba(5, 150, 105, 0.12);

  --amber: #d97706;
  --amber-dim: rgba(217, 119, 6, 0.13);

  --crimson: #dc2626;
  --crimson-dim: rgba(220, 38, 38, 0.11);

  --shadow-sm: 0 2px 10px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 10px 26px rgba(15, 23, 42, 0.09);
  --shadow-lg: 0 22px 54px rgba(15, 23, 42, 0.14);
  --glow-gold: 0 0 20px rgba(166, 118, 24, 0.12);
  --glow-cyan: 0 0 20px rgba(2, 132, 199, 0.12);
}

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

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* Custom Scrollbars */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: var(--gold); }

/* Ambient Background Layers */
.neural-bg {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
  opacity: 0.55;
}
[data-theme="light"] .neural-bg { opacity: 0.34; }

.aurora-glow {
  position: fixed;
  border-radius: 50%;
  filter: blur(110px);
  pointer-events: none;
  z-index: 0;
  opacity: 0.18;
  animation: auroraDrift 22s ease-in-out infinite alternate;
}
.aurora-gold {
  width: 520px;
  height: 520px;
  top: -160px;
  left: -120px;
  background: radial-gradient(circle, var(--gold), transparent 70%);
}
.aurora-cyan {
  width: 560px;
  height: 560px;
  bottom: -180px;
  right: -140px;
  background: radial-gradient(circle, var(--cyan), transparent 70%);
  animation-delay: -9s;
}
[data-theme="light"] .aurora-glow { opacity: 0.11; }

@keyframes auroraDrift {
  0% { transform: translate(0, 0) scale(1); }
  100% { transform: translate(36px, 24px) scale(1.08); }
}

/* OS Shell */
.os-shell {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Top OS Status Bar */
.os-topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  height: var(--topbar-h);
  padding: 0 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--bg-elevated);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
}

.topbar-left, .topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.os-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: inherit;
  flex-shrink: 0;
}
.brand-emblem {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  box-shadow: var(--glow-gold);
}
.brand-meta {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}
.brand-title {
  font-size: 13.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  background: linear-gradient(90deg, var(--gold-bright), var(--gold), var(--cyan));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.brand-sub {
  font-size: 10.5px;
  color: var(--ink-muted);
  letter-spacing: 0.04em;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 11px;
  border-radius: 999px;
  background: var(--emerald-dim);
  border: 1px solid rgba(52, 211, 153, 0.28);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--emerald);
  white-space: nowrap;
}

.pulse-dot, .clock-dot, .founder-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--emerald);
  display: inline-block;
  flex-shrink: 0;
}
.pulse-dot {
  box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.65);
  animation: pulseRing 2.2s infinite;
}
@keyframes pulseRing {
  0% { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.6); }
  70% { box-shadow: 0 0 0 7px rgba(52, 211, 153, 0); }
  100% { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0); }
}

.clock-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  border-radius: 999px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.clock-dot { background: var(--gold); }
.clock-tz { color: var(--ink-muted); font-size: 10.5px; }

.cmd-trigger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 34px;
  padding: 0 11px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--ink-muted);
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  transition: border-color 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}
.cmd-trigger:hover {
  border-color: var(--border-gold);
  color: var(--ink);
  box-shadow: var(--glow-gold);
}
.cmd-icon { color: var(--gold); font-weight: 700; }

.kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 6px;
  border-radius: 6px;
  border: 1px solid var(--border-strong);
  background: var(--bg-subtle);
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--ink-muted);
  line-height: 1.2;
}

.segmented-toggle {
  display: inline-flex;
  padding: 2px;
  border-radius: 10px;
  background: var(--bg-input);
  border: 1px solid var(--border);
}
.seg-btn {
  border: 0;
  background: transparent;
  color: var(--ink-muted);
  padding: 4px 9px;
  border-radius: 8px;
  font: inherit;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.16s ease;
}
.seg-btn.active {
  background: var(--gold-dim);
  color: var(--gold-bright);
  box-shadow: inset 0 0 0 1px var(--border-gold);
}
[data-theme="light"] .seg-btn.active { color: var(--gold); }

.icon-btn {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--ink);
  cursor: pointer;
  font-size: 15px;
  transition: all 0.18s ease;
}
.icon-btn:hover {
  border-color: var(--border-gold);
  color: var(--gold);
}

/* OS Body & Left Dock */
.os-body {
  display: grid;
  grid-template-columns: var(--dock-w) minmax(0, 1fr);
  flex: 1;
  min-height: calc(100vh - var(--topbar-h));
}

.os-dock {
  position: sticky;
  top: var(--topbar-h);
  height: calc(100vh - var(--topbar-h));
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 12px;
  background: var(--bg-elevated);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-right: 1px solid var(--border);
  overflow-y: auto;
}

.dock-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.dock-section-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink-soft);
  padding: 10px 10px 4px;
}

.dock-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 11px;
  border-radius: 11px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink-muted);
  text-decoration: none;
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.16s ease;
  text-align: left;
}
.dock-item:hover {
  background: var(--bg-subtle);
  color: var(--ink);
  border-color: var(--border);
}
.dock-item.active {
  background: linear-gradient(135deg, var(--gold-dim), var(--cyan-dim));
  color: var(--ink);
  border-color: var(--border-gold);
  box-shadow: var(--glow-gold);
}
.dock-glyph {
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 7px;
  background: var(--bg-subtle);
  font-size: 13px;
  flex-shrink: 0;
}
.dock-item.active .dock-glyph {
  background: var(--gold-dim);
  color: var(--gold-bright);
}
.dock-label {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dock-badge {
  font-size: 10.5px;
  font-family: var(--font-mono);
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--bg-subtle);
  color: var(--ink-muted);
}
.dock-item.active .dock-badge {
  background: rgba(212, 166, 74, 0.22);
  color: var(--gold-bright);
}
[data-theme="light"] .dock-item.active .dock-badge { color: var(--gold); }

.dock-footer {
  padding-top: 10px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.dock-founder-badge {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
}
.founder-title { font-size: 12px; font-weight: 600; }
.founder-sub { font-size: 11px; color: var(--ink-muted); }
.dock-mini-link {
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--cyan);
  text-decoration: none;
  padding: 2px 10px;
}
.dock-mini-link:hover { text-decoration: underline; }

/* Main Viewport */
.os-viewport {
  padding: 22px 26px 40px;
  max-width: 1440px;
  width: 100%;
  margin: 0 auto;
  outline: none;
}

.view-window {
  animation: windowEnter 0.24s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes windowEnter {
  from { opacity: 0; transform: translateY(10px) scale(0.994); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.boot-splash {
  min-height: 60vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  color: var(--ink-muted);
}
.boot-ring {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 3px solid var(--border);
  border-top-color: var(--gold);
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Page Header */
.view-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 20px;
}
.view-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 4px;
}
.view-title {
  margin: 0;
  font-size: clamp(22px, 2.5vw, 28px);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
}
.view-subtitle {
  margin: 5px 0 0;
  color: var(--ink-muted);
  font-size: 13.5px;
  max-width: 72ch;
}
.view-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

/* Glass Cards */
.glass-card {
  background: var(--bg-card);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}
.glass-card.interactive:hover {
  border-color: var(--border-gold);
  box-shadow: var(--shadow-md), var(--glow-gold);
  transform: translateY(-2px);
}
.glass-card.gold-accent {
  border-color: var(--border-gold);
  background: linear-gradient(155deg, rgba(212, 166, 74, 0.08), var(--bg-card) 44%);
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}
.card-title {
  margin: 0;
  font-size: 15px;
  font-weight: 650;
  letter-spacing: -0.01em;
}
.card-meta {
  font-size: 12px;
  color: var(--ink-muted);
}

/* Grids */
.grid-4 {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}
.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}
.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.grid-main-aside {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr);
  gap: 16px;
}
.stack-sm { display: flex; flex-direction: column; gap: 10px; }
.stack-md { display: flex; flex-direction: column; gap: 16px; }
.stack-lg { display: flex; flex-direction: column; gap: 22px; }
.row-wrap { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }

/* KPI Tiles */
.kpi-card {
  position: relative;
  overflow: hidden;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  backdrop-filter: blur(16px);
}
.kpi-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--kpi-color, var(--gold)), transparent);
}
.kpi-label {
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-muted);
}
.kpi-value {
  margin: 6px 0 4px;
  font-size: clamp(20px, 2vw, 26px);
  font-weight: 700;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.kpi-sub {
  font-size: 12px;
  color: var(--ink-muted);
}

/* Buttons & Inputs */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 36px;
  padding: 0 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-subtle);
  color: var(--ink);
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: all 0.16s ease;
}
.btn:hover:not(:disabled) {
  border-color: var(--border-strong);
  background: var(--bg-card-hover);
}
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-primary {
  background: linear-gradient(135deg, var(--gold), #b98525);
  border-color: rgba(242, 207, 130, 0.45);
  color: #090d16;
  box-shadow: var(--glow-gold);
}
.btn-primary:hover:not(:disabled) {
  filter: brightness(1.08);
  background: linear-gradient(135deg, var(--gold-bright), var(--gold));
}
.btn-cyan {
  background: var(--cyan-dim);
  border-color: rgba(56, 189, 248, 0.35);
  color: var(--cyan);
}
.btn-cyan:hover:not(:disabled) {
  background: rgba(56, 189, 248, 0.22);
}
.btn-danger {
  background: var(--crimson-dim);
  border-color: rgba(248, 113, 113, 0.32);
  color: var(--crimson);
}
.btn-sm {
  min-height: 30px;
  padding: 0 10px;
  font-size: 11.5px;
  border-radius: 8px;
}

.input, .select, .textarea {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 11px;
  color: var(--ink);
  font: inherit;
  font-size: 13.5px;
  padding: 9px 12px;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-dim);
}
.textarea {
  min-height: 82px;
  resize: vertical;
}
.field-label {
  display: block;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--ink-muted);
  margin-bottom: 5px;
}

/* Pills & Tags */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  border: 1px solid var(--border);
  background: var(--bg-subtle);
  color: var(--ink-muted);
  white-space: nowrap;
}
.pill-gold { background: var(--gold-dim); border-color: var(--border-gold); color: var(--gold-bright); }
[data-theme="light"] .pill-gold { color: var(--gold); }
.pill-cyan { background: var(--cyan-dim); border-color: rgba(56, 189, 248, 0.32); color: var(--cyan); }
.pill-emerald { background: var(--emerald-dim); border-color: rgba(52, 211, 153, 0.32); color: var(--emerald); }
.pill-amber { background: var(--amber-dim); border-color: rgba(245, 158, 11, 0.35); color: var(--amber); }
.pill-crimson { background: var(--crimson-dim); border-color: rgba(248, 113, 113, 0.35); color: var(--crimson); }

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.filter-chip {
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--ink-muted);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.16s ease;
}
.filter-chip:hover { color: var(--ink); border-color: var(--border-strong); }
.filter-chip.active {
  background: var(--gold-dim);
  border-color: var(--border-gold);
  color: var(--gold-bright);
}
[data-theme="light"] .filter-chip.active { color: var(--gold); }

/* Executive Command Input Box */
.command-box {
  position: relative;
  border-radius: var(--radius-lg);
  padding: 20px;
  background: linear-gradient(145deg, rgba(212, 166, 74, 0.1), rgba(56, 189, 248, 0.05) 55%, var(--bg-card));
  border: 1px solid var(--border-gold);
  box-shadow: var(--shadow-md), var(--glow-gold);
}
.command-input-wrap {
  display: flex;
  gap: 10px;
  margin-top: 10px;
}
.command-input-wrap .input {
  flex: 1;
  min-height: 44px;
  font-size: 14.5px;
}
.command-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 12px;
}
.prompt-chip {
  font-size: 11.5px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-subtle);
  color: var(--ink-muted);
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s ease;
}
.prompt-chip:hover {
  border-color: var(--cyan);
  color: var(--ink);
}

/* Dispatch Result Card */
.dispatch-result {
  margin-top: 16px;
  padding: 18px;
  border-radius: var(--radius-md);
  background: var(--bg-input);
  border: 1px solid var(--border-gold);
  animation: windowEnter 0.22s ease;
}
.alert-banner {
  padding: 10px 13px;
  border-radius: 10px;
  font-size: 12.5px;
  display: flex;
  align-items: flex-start;
  gap: 9px;
}
.alert-amber {
  background: var(--amber-dim);
  border: 1px solid rgba(245, 158, 11, 0.38);
  color: var(--amber);
}
.alert-emerald {
  background: var(--emerald-dim);
  border: 1px solid rgba(52, 211, 153, 0.34);
  color: var(--emerald);
}
.alert-cyan {
  background: var(--cyan-dim);
  border: 1px solid rgba(56, 189, 248, 0.34);
  color: var(--cyan);
}
.handoff-code {
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 12px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.32);
  border: 1px solid var(--border);
  color: var(--gold-bright);
  overflow-x: auto;
  word-break: break-word;
}
[data-theme="light"] .handoff-code {
  background: rgba(15, 23, 42, 0.05);
  color: var(--gold);
}

/* Schedule Timeline */
.schedule-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.schedule-row {
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr);
  gap: 12px;
  padding: 11px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg-subtle);
  transition: all 0.16s ease;
}
.schedule-row.is-now {
  border-color: var(--border-gold);
  background: linear-gradient(90deg, var(--gold-dim), var(--bg-subtle));
  box-shadow: var(--glow-gold);
}
.schedule-time {
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 700;
  color: var(--gold);
  font-variant-numeric: tabular-nums;
}

/* Quick Launch Tiles */
.launch-tile {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--ink);
  text-decoration: none;
  cursor: pointer;
  font: inherit;
  text-align: left;
  transition: all 0.16s ease;
}
.launch-tile:hover {
  border-color: var(--border-gold);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm), var(--glow-gold);
}
.launch-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  background: var(--gold-dim);
  color: var(--gold-bright);
  flex-shrink: 0;
}

/* Agent Cards */
.agent-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.agent-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}
.agent-avatar {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 15px;
  letter-spacing: 0.02em;
  flex-shrink: 0;
  border: 1px solid var(--border);
}
.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}
.status-active { background: var(--emerald); box-shadow: 0 0 8px var(--emerald); }
.status-ready { background: var(--cyan); }
.status-attention { background: var(--amber); box-shadow: 0 0 9px var(--amber); animation: pulseRing 2s infinite; }

/* Ventures Matrix */
.venture-note-area {
  margin-top: 6px;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
}
.venture-note-input {
  width: 100%;
  min-height: 54px;
  padding: 8px 10px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--ink);
  font: inherit;
  font-size: 12px;
  resize: vertical;
}
.venture-note-input:focus {
  outline: none;
  border-color: var(--gold);
}

/* Brain Map Workspace */
.brain-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 16px;
  align-items: stretch;
}
.brain-stage {
  position: relative;
  min-height: 600px;
  height: calc(100vh - 210px);
  max-height: 760px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border-gold);
  background: radial-gradient(circle at 50% 45%, rgba(212, 166, 74, 0.07), var(--bg-card) 65%);
  box-shadow: var(--shadow-md);
}
.brain-canvas-host {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  cursor: grab;
}
.brain-canvas-host:active { cursor: grabbing; }
.brain-overlay-top {
  position: absolute;
  top: 12px;
  left: 12px;
  right: 12px;
  z-index: 4;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  pointer-events: none;
}
.brain-overlay-top > * { pointer-events: auto; }
.brain-legend {
  position: absolute;
  bottom: 12px;
  left: 12px;
  z-index: 4;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 7px 12px;
  border-radius: 999px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  backdrop-filter: blur(12px);
  font-size: 11px;
  color: var(--ink-muted);
}
.legend-item { display: inline-flex; align-items: center; gap: 5px; }
.legend-swatch { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }

.inspector-drawer {
  display: flex;
  flex-direction: column;
  gap: 14px;
  height: 100%;
  max-height: 760px;
  overflow-y: auto;
}

/* Pipeline Board */
.pipeline-board {
  display: grid;
  grid-template-columns: repeat(5, minmax(235px, 1fr));
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 8px;
}
.pipeline-col {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 13px;
  border-radius: var(--radius-md);
  background: var(--bg-card);
  border: 1px solid var(--border);
  min-height: 360px;
}
.pipeline-col-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.pipeline-col-title {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.deal-card {
  padding: 12px;
  border-radius: 12px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: border-color 0.16s ease;
}
.deal-card:hover { border-color: var(--border-gold); }
.deal-value {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 700;
  color: var(--gold-bright);
  font-variant-numeric: tabular-nums;
}
[data-theme="light"] .deal-value { color: var(--gold); }

/* Live Intelligence Desk & Radar */
.radar-panel {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 20px;
  border-radius: var(--radius-md);
  background: var(--bg-input);
  border: 1px solid rgba(56, 189, 248, 0.35);
}
.radar-disc {
  position: relative;
  width: 68px;
  height: 68px;
  border-radius: 50%;
  border: 2px solid rgba(56, 189, 248, 0.45);
  background: radial-gradient(circle, rgba(56, 189, 248, 0.18), transparent 70%);
  flex-shrink: 0;
  overflow: hidden;
}
.radar-disc::before {
  content: "";
  position: absolute;
  inset: 0;
  background: conic-gradient(from 0deg, rgba(56, 189, 248, 0.65), transparent 95deg);
  animation: spin 1.6s linear infinite;
}
.radar-disc::after {
  content: "";
  position: absolute;
  inset: 18px;
  border-radius: 50%;
  border: 1px dashed rgba(56, 189, 248, 0.45);
}

.guardrail-ring {
  width: 92px;
  height: 92px;
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: conic-gradient(var(--ring-color, var(--emerald)) calc(var(--ring-pct, 80) * 1%), var(--border) 0);
  position: relative;
}
.guardrail-ring::before {
  content: "";
  position: absolute;
  inset: 8px;
  border-radius: 50%;
  background: var(--bg);
}
.guardrail-ring-val {
  position: relative;
  z-index: 1;
  font-size: 21px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.guardrail-ring-sub {
  position: relative;
  z-index: 1;
  font-size: 9.5px;
  color: var(--ink-muted);
  text-transform: uppercase;
}

.check-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 9px 11px;
  border-radius: 10px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  font-size: 12.5px;
}

/* Executive Boardroom Staggered Advisor Cards */
.advisor-card {
  opacity: 0;
  animation: advisorReveal 0.38s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  animation-delay: calc(var(--idx, 0) * 85ms);
}
@keyframes advisorReveal {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Toggle Switch */
.switch {
  position: relative;
  width: 42px;
  height: 24px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--bg-input);
  cursor: pointer;
  padding: 0;
  transition: all 0.18s ease;
  flex-shrink: 0;
}
.switch::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--ink-muted);
  transition: transform 0.18s ease, background 0.18s ease;
}
.switch.on {
  background: var(--emerald-dim);
  border-color: var(--emerald);
}
.switch.on::after {
  transform: translateX(18px);
  background: var(--emerald);
}

/* Code / JSON Inspector */
.code-viewer {
  margin: 0;
  padding: 14px;
  border-radius: 12px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.5;
  max-height: 400px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--ink);
}

/* Command Palette Overlay */
.cmd-overlay {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(3, 6, 14, 0.72);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 10vh 16px 16px;
}
.cmd-overlay[hidden] { display: none; }
.cmd-modal {
  width: 100%;
  max-width: 620px;
  border-radius: var(--radius-lg);
  background: var(--bg-elevated);
  border: 1px solid var(--border-gold);
  box-shadow: var(--shadow-lg), var(--glow-gold);
  overflow: hidden;
  animation: windowEnter 0.16s ease;
}
.cmd-input-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
}
.cmd-search-glyph { font-size: 18px; color: var(--gold); }
.cmd-input {
  flex: 1;
  border: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 15px;
  outline: none;
}
.cmd-results {
  max-height: 370px;
  overflow-y: auto;
  padding: 8px;
}
.cmd-item {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  font: inherit;
  text-align: left;
}
.cmd-item:hover, .cmd-item.selected {
  background: var(--gold-dim);
  border-color: var(--border-gold);
}
.cmd-item-title { font-size: 13.5px; font-weight: 600; }
.cmd-item-sub { font-size: 11.5px; color: var(--ink-muted); }
.cmd-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  padding: 9px 16px;
  border-top: 1px solid var(--border);
  font-size: 11px;
  color: var(--ink-muted);
}

/* Toasts */
.toast-root {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  padding: 10px 14px;
  border-radius: 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-gold);
  box-shadow: var(--shadow-md);
  color: var(--ink);
  font-size: 12.5px;
  font-weight: 500;
  animation: windowEnter 0.18s ease;
}

/* Empty & Utility States */
.empty-state {
  text-align: center;
  padding: 28px 16px;
  border-radius: var(--radius-md);
  border: 1px dashed var(--border-strong);
  color: var(--ink-muted);
  font-size: 13px;
}
.muted { color: var(--ink-muted); }
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.divider { height: 1px; background: var(--border); margin: 14px 0; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

/* Responsive Breakpoints */
@media (max-width: 1160px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-main-aside { grid-template-columns: 1fr; }
  .brain-layout { grid-template-columns: 1fr; }
  .brain-stage { min-height: 460px; height: 520px; }
  .status-pill { display: none; }
}

@media (max-width: 960px) {
  .os-body { grid-template-columns: 1fr; }
  .os-dock {
    position: sticky;
    top: var(--topbar-h);
    z-index: 30;
    height: auto;
    padding: 8px 10px;
    border-right: 0;
    border-bottom: 1px solid var(--border);
    flex-direction: row;
    overflow-x: auto;
  }
  .dock-nav {
    flex-direction: row;
    gap: 6px;
  }
  .dock-section-label, .dock-footer { display: none; }
  .dock-item {
    width: auto;
    padding: 7px 10px;
    flex-shrink: 0;
  }
  .os-viewport { padding: 16px 14px 34px; }
  .cmd-label, .clock-tz { display: none; }
}

@media (max-width: 640px) {
  .os-topbar { padding: 0 10px; gap: 6px; }
  .brand-sub, .cmd-trigger .kbd { display: none; }
  .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr; }
  .command-input-wrap { flex-direction: column; }
  .schedule-row { grid-template-columns: 1fr; gap: 4px; }
  .clock-pill { padding: 4px 8px; font-size: 11px; }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .aurora-glow { animation: none; }
}

/* === MELCH AI OS v3.0 CONTROL ROOM STYLES === */

/* Topbar Bridge Pill */
.bridge-pill {
  border-color: var(--border);
  background: var(--bg-subtle);
}
.bridge-pill.bridge-live {
  border-color: rgba(52, 211, 153, 0.45);
  background: var(--emerald-dim);
  color: var(--emerald);
}
.bridge-pill.bridge-live .bridge-dot {
  background: var(--emerald);
  box-shadow: 0 0 10px var(--emerald);
}
.bridge-pill.bridge-local {
  border-color: rgba(245, 158, 11, 0.45);
  background: var(--amber-dim);
  color: var(--amber);
}
.bridge-pill.bridge-local .bridge-dot {
  background: var(--amber);
  box-shadow: 0 0 10px var(--amber);
}
.bridge-pill.bridge-showcase {
  border-color: rgba(56, 189, 248, 0.42);
  background: var(--cyan-dim);
  color: var(--cyan);
}
.bridge-pill.bridge-showcase .bridge-dot {
  background: var(--cyan);
  box-shadow: 0 0 10px var(--cyan);
}

/* Quick Launch Strip */
.quick-launch-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.quick-launch-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 12px;
  border-radius: 999px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--ink);
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  transition: transform 0.14s ease, border-color 0.14s ease, background 0.14s ease;
}
.quick-launch-chip:hover {
  transform: translateY(-1px);
  border-color: var(--border-gold);
  background: var(--bg-card-hover);
}
.ql-dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: var(--gold);
  flex-shrink: 0;
}
.ql-dot.up { background: var(--emerald); box-shadow: 0 0 8px var(--emerald); }
.ql-dot.down { background: var(--crimson); }

/* 5-Column KPI Strip */
.grid-5 {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
}

/* Platform Chips (Post & Publish) */
.platform-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.platform-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 13px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--ink-muted);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}
.platform-chip:hover {
  border-color: var(--border-strong);
  color: var(--ink);
}
.platform-chip.active {
  border-color: var(--gold);
  background: var(--gold-dim);
  color: var(--gold-bright);
  box-shadow: 0 0 0 1px rgba(212, 166, 74, 0.25);
}

/* Media Player Stage */
.media-stage {
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: rgba(4, 7, 15, 0.86);
  overflow: hidden;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
[data-theme="light"] .media-stage {
  background: rgba(15, 23, 42, 0.05);
}
.media-player-video {
  width: 100%;
  max-height: 340px;
  border-radius: 10px;
  background: #000;
  display: block;
}
.media-player-audio {
  width: 100%;
  height: 42px;
}
.script-preview-box {
  max-height: 220px;
  overflow: auto;
  padding: 12px;
  border-radius: 10px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 11.5px;
  white-space: pre-wrap;
  color: var(--ink-muted);
  margin: 0;
}

/* Dispatch Log List */
.dispatch-log-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.dispatch-log-row {
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-subtle);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.dispatch-log-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

/* 7-Stage Content Engine Pipeline */
.pipeline-stages-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}
.stage-card {
  padding: 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg-card);
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: relative;
}
.stage-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background: var(--gold-dim);
  color: var(--gold-bright);
  border: 1px solid var(--border-gold);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
}

/* Pricing Tiers Grid */
.pricing-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}
.pricing-card {
  padding: 18px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--bg-card);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.pricing-card.featured {
  border-color: var(--border-gold);
  box-shadow: var(--glow-gold);
  background: linear-gradient(160deg, rgba(212, 166, 74, 0.09), var(--bg-card) 60%);
}
.pricing-price {
  font-size: 26px;
  font-weight: 750;
  letter-spacing: -0.02em;
  color: var(--ink);
}
.pricing-price small {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-muted);
}
.pricing-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 7px;
  font-size: 12.5px;
  color: var(--ink-muted);
}
.pricing-list li::before {
  content: '✓ ';
  color: var(--emerald);
  font-weight: 700;
}

/* Resources Cards */
.resource-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.resource-url {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-soft);
  word-break: break-all;
}

/* Live Analysis Tables & Horizontal Bars */
.probe-table-wrap {
  width: 100%;
  overflow-x: auto;
}
.probe-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}
.probe-table th,
.probe-table td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}
.probe-table th {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
}
.bar-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.bar-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.bar-meta {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--ink-muted);
}
.bar-track {
  height: 8px;
  border-radius: 999px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  overflow: hidden;
}
.bar-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--gold), var(--cyan));
  transition: width 0.35s ease;
}
.char-counter {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--ink-soft);
}
.char-counter.warn { color: var(--amber); }

@media (max-width: 1200px) {
  .grid-5 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .pricing-grid { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .grid-5 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 480px) {
  .grid-5 { grid-template-columns: 1fr; }
}

/* === MELCH AI OS v3.0 PWA, MULTI-THEME & ANDROID MOBILE-FIRST LAYER === */

/* 4-Theme Color Studio Tokens */
:root,
[data-theme="obsidian-gold"],
[data-theme="dark"] {
  --bg: #060911;
  --bg-elevated: rgba(12, 18, 32, 0.84);
  --bg-card: rgba(15, 22, 38, 0.78);
  --bg-card-hover: rgba(21, 31, 54, 0.90);
  --bg-input: rgba(8, 13, 24, 0.90);
  --bg-subtle: rgba(255, 255, 255, 0.04);
  --border: rgba(148, 163, 184, 0.16);
  --border-gold: rgba(229, 185, 92, 0.38);
  --border-strong: rgba(148, 163, 184, 0.30);
  --ink: #f1f5f9;
  --ink-muted: #94a3b8;
  --ink-soft: #64748b;
  --gold: #e5b95c;
  --gold-bright: #f7d78b;
  --gold-dim: rgba(229, 185, 92, 0.16);
  --cyan: #38bdf8;
  --cyan-dim: rgba(56, 189, 248, 0.16);
  --emerald: #34d399;
  --emerald-dim: rgba(52, 211, 153, 0.16);
  --amber: #f59e0b;
  --amber-dim: rgba(245, 158, 11, 0.16);
  --crimson: #f87171;
  --crimson-dim: rgba(248, 113, 113, 0.16);
  --accent-swatch: #e5b95c;
  --card-top-sheen: rgba(255, 255, 255, 0.07);
}

[data-theme="nairobi-emerald"] {
  --bg: #05100d;
  --bg-elevated: rgba(8, 24, 19, 0.86);
  --bg-card: rgba(10, 30, 24, 0.80);
  --bg-card-hover: rgba(14, 42, 33, 0.92);
  --bg-input: rgba(5, 17, 14, 0.92);
  --bg-subtle: rgba(16, 185, 129, 0.06);
  --border: rgba(52, 211, 153, 0.18);
  --border-gold: rgba(16, 185, 129, 0.44);
  --border-strong: rgba(52, 211, 153, 0.34);
  --ink: #ecfdf5;
  --ink-muted: #99c2b5;
  --ink-soft: #639384;
  --gold: #10b981;
  --gold-bright: #34d399;
  --gold-dim: rgba(16, 185, 129, 0.18);
  --cyan: #f59e0b;
  --cyan-dim: rgba(245, 158, 11, 0.16);
  --emerald: #34d399;
  --emerald-dim: rgba(52, 211, 153, 0.18);
  --amber: #fbbf24;
  --amber-dim: rgba(251, 191, 36, 0.16);
  --crimson: #fb7185;
  --crimson-dim: rgba(251, 113, 133, 0.16);
  --glow-gold: 0 0 28px rgba(16, 185, 129, 0.24);
  --glow-cyan: 0 0 28px rgba(245, 158, 11, 0.18);
  --accent-swatch: #10b981;
  --card-top-sheen: rgba(52, 211, 153, 0.10);
}

[data-theme="cyber-cobalt"] {
  --bg: #060b1a;
  --bg-elevated: rgba(11, 19, 44, 0.86);
  --bg-card: rgba(14, 24, 54, 0.80);
  --bg-card-hover: rgba(20, 34, 74, 0.92);
  --bg-input: rgba(7, 13, 30, 0.92);
  --bg-subtle: rgba(59, 130, 246, 0.06);
  --border: rgba(96, 165, 250, 0.18);
  --border-gold: rgba(59, 130, 246, 0.45);
  --border-strong: rgba(168, 85, 247, 0.34);
  --ink: #eff6ff;
  --ink-muted: #9db4d8;
  --ink-soft: #6a82ad;
  --gold: #3b82f6;
  --gold-bright: #60a5fa;
  --gold-dim: rgba(59, 130, 246, 0.18);
  --cyan: #a855f7;
  --cyan-dim: rgba(168, 85, 247, 0.18);
  --emerald: #22d3ee;
  --emerald-dim: rgba(34, 211, 238, 0.16);
  --amber: #f59e0b;
  --amber-dim: rgba(245, 158, 11, 0.16);
  --crimson: #f43f5e;
  --crimson-dim: rgba(244, 63, 94, 0.16);
  --glow-gold: 0 0 30px rgba(59, 130, 246, 0.26);
  --glow-cyan: 0 0 28px rgba(168, 85, 247, 0.22);
  --accent-swatch: #3b82f6;
  --card-top-sheen: rgba(96, 165, 250, 0.11);
}

[data-theme="savannah-light"],
[data-theme="light"] {
  --bg: #f6f7fb;
  --bg-elevated: rgba(255, 255, 255, 0.94);
  --bg-card: rgba(255, 255, 255, 0.94);
  --bg-card-hover: #ffffff;
  --bg-input: #f8fafc;
  --bg-subtle: rgba(15, 23, 42, 0.045);
  --border: rgba(15, 23, 42, 0.12);
  --border-gold: rgba(180, 123, 22, 0.38);
  --border-strong: rgba(15, 23, 42, 0.24);
  --ink: #0f172a;
  --ink-muted: #334155;
  --ink-soft: #64748b;
  --gold: #b47b16;
  --gold-bright: #92600b;
  --gold-dim: rgba(180, 123, 22, 0.13);
  --cyan: #0369a1;
  --cyan-dim: rgba(3, 105, 161, 0.11);
  --emerald: #047857;
  --emerald-dim: rgba(4, 120, 87, 0.12);
  --amber: #b45309;
  --amber-dim: rgba(180, 83, 9, 0.13);
  --crimson: #dc2626;
  --crimson-dim: rgba(220, 38, 38, 0.12);
  --shadow-sm: 0 2px 10px rgba(15, 23, 42, 0.07);
  --shadow-md: 0 10px 26px rgba(15, 23, 42, 0.10);
  --shadow-lg: 0 22px 54px rgba(15, 23, 42, 0.15);
  --glow-gold: 0 0 20px rgba(180, 123, 22, 0.14);
  --glow-cyan: 0 0 20px rgba(3, 105, 161, 0.12);
  --accent-swatch: #b47b16;
  --card-top-sheen: rgba(255, 255, 255, 0.9);
}

/* Theme-Aware Aurora Accents */
[data-theme="nairobi-emerald"] .aurora-gold {
  background: radial-gradient(circle, rgba(16, 185, 129, 0.26), transparent 68%);
}
[data-theme="nairobi-emerald"] .aurora-cyan {
  background: radial-gradient(circle, rgba(245, 158, 11, 0.18), transparent 68%);
}
[data-theme="cyber-cobalt"] .aurora-gold {
  background: radial-gradient(circle, rgba(59, 130, 246, 0.28), transparent 68%);
}
[data-theme="cyber-cobalt"] .aurora-cyan {
  background: radial-gradient(circle, rgba(168, 85, 247, 0.22), transparent 68%);
}
[data-theme="savannah-light"] .aurora-gold {
  background: radial-gradient(circle, rgba(180, 123, 22, 0.12), transparent 70%);
}
[data-theme="savannah-light"] .aurora-cyan {
  background: radial-gradient(circle, rgba(4, 120, 87, 0.10), transparent 70%);
}

/* Elevated UI/UX Polish */
html, body {
  overflow-x: clip;
  max-width: 100vw;
  -webkit-tap-highlight-color: transparent;
}
.glass-card, .hero-panel, .kpi-card {
  box-shadow: inset 0 1px 0 var(--card-top-sheen), var(--shadow-sm);
  transition: transform 0.16s ease, border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}
.btn:active, .filter-chip:active, .platform-chip:active, .mbn-item:active {
  transform: scale(0.97);
}
.view-window,
.glass-card,
.hero-panel,
.kpi-card,
.grid-2 > *,
.grid-3 > *,
.grid-4 > *,
.grid-5 > *,
.grid-main-aside > *,
.pricing-grid > *,
.pipeline-stages-grid > * {
  min-width: 0;
}

/* PWA One-Tap Install Button */
.pwa-install-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  min-height: 36px;
  border-radius: 999px;
  border: 1px solid var(--border-gold);
  background: linear-gradient(135deg, var(--gold-dim), var(--cyan-dim));
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: var(--glow-gold);
  transition: transform 0.14s ease, filter 0.14s ease;
}
.pwa-install-btn:hover { filter: brightness(1.12); transform: translateY(-1px); }
.pwa-install-btn[hidden] { display: none !important; }

/* Topbar Color Theme Studio Popover */
.theme-studio-wrap {
  position: relative;
}
.theme-swatch-dot {
  width: 16px;
  height: 16px;
  border-radius: 999px;
  background: var(--accent-swatch);
  border: 2px solid var(--ink);
  box-shadow: 0 0 10px var(--accent-swatch);
  display: inline-block;
}
.theme-popover {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 248px;
  padding: 10px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-strong);
  background: var(--bg-elevated);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  gap: 6px;
  z-index: 90;
}
.theme-popover[hidden] { display: none !important; }
.theme-popover-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-soft);
  padding: 2px 6px 6px;
}
.theme-option {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 10px;
  min-height: 44px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  transition: background 0.14s ease, border-color 0.14s ease;
}
.theme-option:hover {
  background: var(--bg-subtle);
  border-color: var(--border);
}
.theme-option.active {
  background: var(--gold-dim);
  border-color: var(--border-gold);
}
.theme-option strong {
  display: block;
  font-size: 12.5px;
  line-height: 1.25;
}
.theme-option small {
  display: block;
  font-size: 11px;
  color: var(--ink-muted);
}
.theme-chip-dots {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
}
.theme-chip-dots i {
  width: 13px;
  height: 13px;
  border-radius: 999px;
  border: 1.5px solid rgba(255, 255, 255, 0.35);
  margin-left: -4px;
  display: inline-block;
}
.theme-chip-dots i:first-child { margin-left: 0; }

/* Fixed Android Bottom Navigation Bar (hidden on desktop) */
.mobile-bottom-nav {
  display: none;
}

/* Mobile Bottom-Sheet Drawer */
.mobile-sheet-overlay {
  position: fixed;
  inset: 0;
  z-index: 120;
  background: rgba(3, 6, 14, 0.68);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.mobile-sheet-overlay[hidden] { display: none !important; }
.mobile-sheet {
  width: 100%;
  max-width: 520px;
  max-height: 86vh;
  background: var(--bg-elevated);
  border-top: 1px solid var(--border-strong);
  border-radius: 22px 22px 0 0;
  box-shadow: 0 -16px 48px rgba(0, 0, 0, 0.55);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding-bottom: max(14px, env(safe-area-inset-bottom));
  animation: sheetSlideUp 0.22s cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes sheetSlideUp {
  from { transform: translateY(36px); opacity: 0.4; }
  to { transform: translateY(0); opacity: 1; }
}
.sheet-handle-wrap {
  display: flex;
  justify-content: center;
  padding: 10px 0 4px;
}
.sheet-handle {
  width: 40px;
  height: 4px;
  border-radius: 999px;
  background: var(--border-strong);
}
.sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 16px 12px;
  border-bottom: 1px solid var(--border);
}
.sheet-title {
  font-size: 15px;
  font-weight: 750;
  color: var(--ink);
}
.sheet-sub {
  font-size: 11.5px;
  color: var(--ink-muted);
}
.sheet-body {
  padding: 14px 16px 10px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.sheet-install-card {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 14px;
  min-height: 54px;
  border-radius: 14px;
  border: 1px solid var(--border-gold);
  background: linear-gradient(135deg, var(--gold-dim), var(--cyan-dim));
  color: var(--ink);
  cursor: pointer;
}
.sheet-install-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--gold);
  color: #060911;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 16px;
  flex-shrink: 0;
}
.sheet-quick-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.sheet-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.sheet-section-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.sheet-theme-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.sheet-theme-card {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 46px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--ink);
  font-size: 12.5px;
  font-weight: 650;
  cursor: pointer;
}
.sheet-theme-card.active {
  border-color: var(--border-gold);
  background: var(--gold-dim);
  box-shadow: 0 0 0 1px var(--border-gold);
}
.sheet-apps-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.sheet-app-tile {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--ink);
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
}
.sheet-app-tile.active {
  border-color: var(--border-gold);
  background: var(--gold-dim);
}
.sat-glyph {
  font-size: 16px;
  width: 24px;
  text-align: center;
  flex-shrink: 0;
}

/* ============================================================================
   Infinix Hot 60i / Android Mobile-First Tuning (<= 820px, tested down to 360px)
   ============================================================================ */
@media (max-width: 820px) {
  :root {
    --topbar-h: 52px;
  }

  .os-topbar {
    min-height: calc(52px + env(safe-area-inset-top));
    padding: env(safe-area-inset-top) 10px 0 10px;
    gap: 6px;
  }
  .desktop-only-pill,
  .topbar-currency,
  .clock-pill,
  .cmd-trigger .cmd-label,
  .cmd-trigger .kbd {
    display: none !important;
  }
  .os-brand {
    gap: 8px;
  }
  .brand-emblem {
    width: 26px;
    height: 26px;
  }
  .brand-title {
    font-size: 13.5px;
  }
  .brand-sub {
    display: block !important;
    font-size: 9.5px;
  }
  .bridge-pill {
    display: inline-flex !important;
    padding: 4px 8px;
    font-size: 10px;
  }
  .pwa-install-btn {
    padding: 5px 10px;
    min-height: 36px;
    font-size: 11px;
  }
  .cmd-trigger,
  .icon-btn {
    min-width: 40px;
    min-height: 40px;
    padding: 0 10px;
    justify-content: center;
  }

  /* Hide desktop dock rail; switch to native Android fixed bottom bar */
  .os-dock {
    display: none !important;
  }
  .os-body {
    grid-template-columns: 1fr !important;
  }
  .os-viewport {
    padding: 14px 12px calc(86px + env(safe-area-inset-bottom)) 12px !important;
    max-width: 100vw;
    overflow-x: clip;
  }

  /* Fixed Android Bottom Nav */
  .mobile-bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 85;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    background: var(--bg-elevated);
    backdrop-filter: blur(22px);
    -webkit-backdrop-filter: blur(22px);
    border-top: 1px solid var(--border-strong);
    padding: 4px 4px max(8px, env(safe-area-inset-bottom)) 4px;
    box-shadow: 0 -8px 28px rgba(0, 0, 0, 0.36);
  }
  .mbn-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    min-height: 50px;
    border-radius: 12px;
    border: 0;
    background: transparent;
    color: var(--ink-muted);
    text-decoration: none;
    font-size: 10.5px;
    font-weight: 650;
    cursor: pointer;
    padding: 4px 2px;
    transition: color 0.14s ease, background 0.14s ease;
  }
  .mbn-icon {
    font-size: 18px;
    line-height: 1.1;
  }
  .mbn-label {
    line-height: 1.1;
    white-space: nowrap;
  }
  .mbn-item.active {
    color: var(--gold-bright);
    background: var(--gold-dim);
  }

  /* Prevent Android Chrome auto-zoom on form focus & guarantee >= 44px touch targets */
  .input,
  .select,
  .textarea {
    font-size: 16px !important;
    min-height: 44px;
    width: 100% !important;
    max-width: 100% !important;
  }
  .btn {
    min-height: 44px;
    padding: 10px 14px;
  }
  .btn-sm {
    min-height: 40px;
    padding: 8px 12px;
  }
  .filter-chip,
  .platform-chip,
  .quick-launch-chip {
    min-height: 40px;
    flex-shrink: 0;
  }

  /* Smooth horizontal scroll for chip & tab rows so nothing overflows 360px */
  .filter-bar,
  .quick-launch-strip {
    flex-wrap: nowrap !important;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 4px;
  }
  .filter-bar::-webkit-scrollbar,
  .quick-launch-strip::-webkit-scrollbar {
    display: none;
  }

  /* Single-column clean stacking across ALL views on 360px-390px screens */
  .view-header {
    flex-direction: column;
    align-items: stretch !important;
    gap: 10px;
  }
  .view-actions {
    width: 100%;
    flex-wrap: wrap;
  }
  .view-actions .segmented-toggle {
    width: 100%;
    overflow-x: auto;
    display: flex;
  }
  .view-actions .seg-btn {
    min-height: 40px;
    white-space: nowrap;
    flex: 1 0 auto;
  }
  .view-title {
    font-size: 21px !important;
  }
  .grid-5,
  .grid-4,
  .grid-3,
  .grid-2,
  .grid-main-aside,
  .pricing-grid,
  .pipeline-stages-grid {
    grid-template-columns: 1fr !important;
  }
  .glass-card,
  .hero-panel {
    padding: 14px !important;
    border-radius: 16px;
  }
  .brain-stage {
    min-height: 360px !important;
    height: 380px !important;
  }
  .toast-root {
    bottom: calc(74px + env(safe-area-inset-bottom)) !important;
    left: 12px !important;
    right: 12px !important;
  }
}

@media (max-width: 390px) {
  .bridge-pill {
    display: none !important;
  }
  .os-viewport {
    padding-left: 10px !important;
    padding-right: 10px !important;
  }
}


/* ============================================================================
   Addendum 2: Mobile Bridge Connection, Unified Leads Inbox & Embed Widget Box
   ============================================================================ */
.sheet-bridge-box {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
}

.sheet-bridge-status-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.bridge-card {
  border-color: rgba(56, 189, 248, 0.25);
}

.bridge-feedback {
  font-size: 12.5px;
  padding: 9px 11px;
  border-radius: 10px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  color: var(--ink);
}

.bridge-feedback.ok {
  background: rgba(16, 185, 129, 0.12);
  border-color: rgba(16, 185, 129, 0.35);
  color: var(--emerald);
}

.bridge-feedback.err {
  background: rgba(244, 63, 94, 0.12);
  border-color: rgba(244, 63, 94, 0.35);
  color: #fb7185;
}

.embed-code-box {
  background: var(--bg-panel);
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  padding: 14px;
}

.code-snippet {
  margin: 0;
  padding: 12px;
  border-radius: 10px;
  background: rgba(2, 6, 14, 0.72);
  border: 1px solid var(--border);
  color: var(--cyan);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-all;
  overflow-x: auto;
}

[data-theme="savannah-light"] .code-snippet {
  background: #101827;
  color: #7dd3fc;
}

.lead-card {
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.lead-card:hover {
  border-color: var(--border-strong);
}

.btn-emerald {
  background: rgba(16, 185, 129, 0.16);
  border-color: rgba(16, 185, 129, 0.38);
  color: var(--emerald);
}

.btn-emerald:hover {
  background: rgba(16, 185, 129, 0.24);
}
