:root {
  --bg: #07090d;
  --surface: #0f131a;
  --surface2: #151b26;
  --border: #1e2736;
  --text: #e8edf5;
  --muted: #8b97a8;
  --accent: #38bdf8;
  --accent2: #22c55e;
  --danger: #ef4444;
  --warn: #fbbf24;
  --radius: 14px;
  --font: "DM Sans", system-ui, sans-serif;
  --mono: "JetBrains Mono", monospace;
}

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

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  line-height: 1.5;
  min-height: 100vh;
}

#app {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 260px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 1.25rem;
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 20;
  transition: transform 0.2s;
}

.brand {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  margin-bottom: 2rem;
}

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: linear-gradient(135deg, #0ea5e9, #22c55e);
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 0.85rem;
}

.brand strong {
  display: block;
  font-size: 1rem;
}

.brand span {
  color: var(--muted);
  font-size: 0.75rem;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  flex: 1;
}

.nav-item {
  background: transparent;
  border: none;
  color: var(--muted);
  text-align: left;
  padding: 0.65rem 0.85rem;
  border-radius: 10px;
  cursor: pointer;
  font: inherit;
  font-size: 0.95rem;
}

.nav-item:hover,
.nav-item.active {
  background: var(--surface2);
  color: var(--text);
}

.nav-item.active {
  box-shadow: inset 3px 0 0 var(--accent);
}

.sidebar-footer {
  border-top: 1px solid var(--border);
  padding-top: 1rem;
  font-size: 0.78rem;
  color: var(--muted);
}

.main {
  flex: 1;
  margin-left: 260px;
  min-width: 0;
}

.top-tagline {
  background: linear-gradient(90deg, #0c4a6e 0%, #1e3a5f 50%, #0c4a6e 100%);
  color: #e0f2fe;
  text-align: center;
  font-size: 0.88rem;
  font-weight: 500;
  padding: 0.65rem 1.25rem;
  line-height: 1.45;
  border-bottom: 1px solid #0369a1;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border);
  background: rgba(7, 9, 13, 0.85);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.menu-toggle {
  display: none;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  padding: 0.4rem 0.6rem;
  cursor: pointer;
}

.topbar-title {
  font-weight: 600;
  flex: 1;
}

.overall-badge {
  font-size: 0.8rem;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--muted);
}

.grade-elite { color: #22c55e; border-color: #166534; }
.grade-proficient { color: #38bdf8; border-color: #0369a1; }
.grade-developing { color: #fbbf24; border-color: #92400e; }
.grade-risk { color: #fb923c; border-color: #9a3412; }
.grade-critical { color: #ef4444; border-color: #991b1b; }

.content {
  padding: 1.5rem;
  max-width: 1200px;
}

.hero {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

.eyebrow {
  color: var(--accent);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
}

.hero h1 {
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  line-height: 1.15;
  margin: 0.5rem 0 1rem;
}

.lead {
  color: var(--muted);
  font-size: 1.05rem;
  max-width: 52ch;
}

.hero-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 1.25rem;
}

.hero-card,
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
}

.hero-card h3,
.card h3 {
  margin-top: 0;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 1rem;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
}

.btn {
  border: none;
  border-radius: 10px;
  padding: 0.65rem 1.1rem;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.btn.primary {
  background: linear-gradient(135deg, #0284c7, #0ea5e9);
  color: white;
}

.btn.ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}

.btn.long {
  background: #166534;
  color: #dcfce7;
}

.btn.short {
  background: #991b1b;
  color: #fee2e2;
}

.btn-row {
  display: flex;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.btn.full-width {
  width: 100%;
}

.auth-badge {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 999px;
  padding: 0.4rem 0.85rem;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.auth-badge.signed-in {
  border-color: #166534;
  color: #86efac;
}

.auth-tabs {
  display: flex;
  gap: 0.5rem;
  margin: 1rem 0;
}

.auth-tab {
  flex: 1;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: 8px;
  padding: 0.5rem;
  cursor: pointer;
  font: inherit;
}

.auth-tab.active {
  color: var(--text);
  border-color: var(--accent);
}

.signup-note {
  color: var(--accent);
  font-size: 0.95rem;
  margin: 0.75rem 0;
}

.hidden {
  display: none !important;
}

.waitlist-btn {
  background: linear-gradient(135deg, #059669, #10b981);
  color: white;
  border: none;
  border-radius: 999px;
  padding: 0.4rem 0.85rem;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.wishlist-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 1.25rem 1.5rem;
  margin-bottom: 1rem;
  border-radius: var(--radius);
  border: 1px solid #0369a1;
  background: linear-gradient(135deg, #0c1929 0%, #0f131a 100%);
}

.wishlist-banner.joined {
  border-color: #166534;
  background: linear-gradient(135deg, #052e16 0%, #0f131a 100%);
}

.wishlist-banner.highlight {
  border-color: #7c3aed;
  background: linear-gradient(135deg, #1e1033 0%, #0f131a 100%);
}

.wishlist-banner h3 {
  margin: 0.25rem 0;
  font-size: 1.1rem;
}

.wishlist-banner .eyebrow {
  margin: 0;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal.hidden {
  display: none;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(4px);
}

.modal-panel {
  position: relative;
  z-index: 1;
  width: min(440px, 100%);
  max-height: 90vh;
  overflow-y: auto;
}

.modal-content {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  position: relative;
}

.modal-close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 1.5rem;
  cursor: pointer;
  line-height: 1;
}

.modal-content h2 {
  margin: 0 0 0.5rem;
  padding-right: 2rem;
}

.wishlist-form input,
.wishlist-form select {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  padding: 0.6rem;
  font: inherit;
}

.form-note {
  font-size: 0.78rem;
  margin: 0.5rem 0 1rem;
}

.form-error {
  color: var(--danger);
  font-size: 0.85rem;
  margin-bottom: 0.75rem;
}

.form-error.hidden {
  display: none;
}

.wishlist-success {
  text-align: center;
  padding: 1rem 0;
}

.success-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #166534;
  color: #dcfce7;
  display: grid;
  place-items: center;
  font-size: 1.5rem;
  margin: 0 auto 1rem;
}


.progress-ring-wrap {
  position: relative;
  width: 140px;
  margin: 1rem auto;
}

.progress-ring {
  width: 140px;
  height: 140px;
  transform: rotate(-90deg);
}

.ring-bg {
  fill: none;
  stroke: var(--border);
  stroke-width: 8;
}

.ring-fill {
  fill: none;
  stroke: var(--accent);
  stroke-width: 8;
  stroke-linecap: round;
  stroke-dasharray: 326;
  transition: stroke-dashoffset 0.4s;
}

.progress-label {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 1.5rem;
  font-weight: 700;
}

.stat-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.stat-list li {
  display: flex;
  justify-content: space-between;
  padding: 0.45rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}

.stat-list span {
  color: var(--muted);
}

.pos { color: var(--accent2); }
.neg { color: var(--danger); }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); }

.eval-layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 1rem;
  align-items: start;
}

.eval-sidebar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  position: sticky;
  top: 80px;
}

.day-badge {
  display: inline-block;
  background: var(--surface2);
  border: 1px solid var(--border);
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  font-size: 0.78rem;
  color: var(--accent);
  margin-bottom: 0.75rem;
}

.narrative {
  color: var(--muted);
  font-size: 0.92rem;
}

.window-meta {
  margin: 1rem 0;
  padding: 0.85rem;
  background: var(--surface2);
  border-radius: 10px;
}

.pill {
  display: inline-block;
  font-size: 0.75rem;
  color: var(--accent);
  margin-bottom: 0.35rem;
}

.live-stats {
  list-style: none;
  padding: 0;
  margin: 1rem 0;
}

.live-stats li {
  display: flex;
  justify-content: space-between;
  font-size: 0.88rem;
  padding: 0.3rem 0;
}

.hint {
  font-size: 0.82rem;
  color: var(--muted);
  border-top: 1px solid var(--border);
  padding-top: 0.75rem;
}

.testing-pill {
  display: inline-block;
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  background: #1a2a3a;
  color: #7dd3fc;
  vertical-align: middle;
}

.ai-status-banner {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.65rem 1rem;
  border-radius: var(--radius);
  margin-bottom: 1rem;
  font-size: 0.85rem;
  border: 1px solid var(--border);
}

.ai-status-banner.connected {
  background: #0f1f18;
  border-color: #22543d;
  color: #86efac;
}

.ai-status-banner.offline {
  background: #1f1510;
  border-color: #7c2d12;
  color: #fdba74;
}

.ai-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.connected .ai-dot { background: #22c55e; }
.offline .ai-dot { background: #f97316; }

.ai-error-card {
  max-width: 640px;
  margin: 2rem auto;
}

.ai-error-steps {
  margin: 1rem 0 1.25rem;
  padding-left: 1.25rem;
  color: var(--muted);
  line-height: 1.6;
}

.ai-error-steps code {
  font-size: 0.85em;
}

.chart-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 1rem;
}

.chart-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid var(--border);
}

.chart-toolbar-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.chart-symbol {
  font-weight: 600;
  font-size: 0.9rem;
}

.chart-price {
  font-size: 1rem;
  color: var(--accent);
}

.tf-tabs {
  display: flex;
  gap: 0.25rem;
}

.tf-tab {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: 6px;
  padding: 0.25rem 0.55rem;
  font-size: 0.75rem;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  cursor: pointer;
}

.tf-tab.active {
  color: var(--text);
  border-color: var(--accent);
  background: #1a2a3a;
}

.chart-ohlc-row {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 0.45rem 0.75rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.78rem;
  color: var(--muted);
}

.ohlc-item strong {
  color: var(--text);
  font-family: "JetBrains Mono", ui-monospace, monospace;
}

.chart-legend {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 0.35rem 0.75rem;
  font-size: 0.72rem;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
}

.chart-legend .leg {
  display: inline-block;
  width: 14px;
  height: 2px;
  margin-right: 0.25rem;
  vertical-align: middle;
}

.chart-legend .leg.ema { background: #eab308; }
.chart-legend .leg.sup { background: #38bdf8; }
.chart-legend .leg.res { background: #f59e0b; }
.chart-legend .leg.open { background: #a78bfa; }

.chart-foot {
  padding: 0.45rem 0.75rem 0.6rem;
  font-size: 0.78rem;
  margin: 0;
}

.setup-tag {
  display: inline-block;
  margin: 0.35rem 0 0.5rem;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.72rem;
  background: #1a2a22;
  color: #86efac;
  border: 1px solid #22543d;
}

.btn-xs {
  padding: 0.25rem 0.55rem;
  font-size: 0.72rem;
}

.hidden {
  display: none !important;
}

.chart-head {
  display: flex;
  justify-content: space-between;
  padding: 0.65rem 1rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
  color: var(--muted);
}

#price-chart {
  width: 100%;
  display: block;
}

.action-panel h3 {
  margin-top: 0;
}

.form-row {
  margin-bottom: 0.85rem;
}

.form-row label {
  display: block;
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 0.35rem;
}

.form-row select {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  padding: 0.55rem;
  font: inherit;
}

.checkbox-row label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text);
}

.report-hero h1 {
  margin: 0.3rem 0 0.75rem;
  font-size: 2rem;
}

.report-scores {
  display: flex;
  gap: 1.25rem;
  align-items: center;
  margin-top: 1rem;
}

.score-big {
  font-size: 3.5rem;
  font-weight: 700;
  line-height: 1;
  color: var(--accent);
}

.dim-grid {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.dim-row {
  display: grid;
  grid-template-columns: 140px 1fr 40px;
  gap: 0.75rem;
  align-items: center;
  font-size: 0.88rem;
}

.dim-row span {
  color: var(--muted);
}

.bar-track {
  height: 8px;
  background: var(--surface2);
  border-radius: 999px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 999px;
}

.signal-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.signal-list li {
  display: flex;
  justify-content: space-between;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
}

.timeline {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.tl-item {
  padding: 0.85rem;
  background: var(--surface2);
  border-radius: 10px;
  border-left: 3px solid var(--accent);
}

.tl-day {
  font-size: 0.75rem;
  color: var(--accent);
  text-transform: uppercase;
}

.fix-list {
  margin: 0;
  padding-left: 1.2rem;
}

.fix-list li {
  margin-bottom: 0.65rem;
}

.fixes-card {
  border-color: #0369a1;
  background: linear-gradient(180deg, #0c1929, var(--surface));
}

.profile-header {
  display: flex;
  gap: 1.25rem;
  align-items: center;
  margin: 1rem 0;
}

.grade-pill {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.75rem;
  border: 1px solid var(--border);
  margin-bottom: 0.35rem;
}

.empty-state,
.empty {
  color: var(--muted);
}

.setup-note {
  margin-top: 1rem;
}

.ai-badge {
  display: inline-block;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #a78bfa;
  border: 1px solid #5b21b6;
  border-radius: 999px;
  padding: 0.2rem 0.55rem;
  margin-bottom: 0.5rem;
}

.loading-card {
  text-align: center;
  padding: 3rem 1.5rem;
  max-width: 480px;
  margin: 2rem auto;
}

.loader {
  width: 48px;
  height: 48px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  margin: 0 auto 1.25rem;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.quiz-panel h3 {
  margin-top: 0;
}

.quiz-options {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.quiz-opt {
  text-align: left;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 10px;
  padding: 0.65rem 0.85rem;
  cursor: pointer;
  font: inherit;
}

.quiz-opt:hover:not(:disabled) {
  border-color: var(--accent);
}

.quiz-opt.selected {
  border-color: #22c55e;
  background: #052e16;
}

.quiz-opt:disabled:not(.selected) {
  opacity: 0.45;
}

.quiz-feedback {
  margin-top: 0.75rem;
  font-size: 0.88rem;
}

.disabled-panel {
  opacity: 0.55;
  pointer-events: none;
}

.ai-coaching-card {
  border-color: #5b21b6;
  background: linear-gradient(180deg, #1a1033 0%, var(--surface) 100%);
  margin-bottom: 1rem;
}

.ai-coaching-text p {
  margin: 0 0 0.85rem;
  color: var(--muted);
  line-height: 1.65;
}

.muted-box {
  background: var(--surface2);
}

@media (max-width: 960px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .main {
    margin-left: 0;
  }
  .menu-toggle {
    display: block;
  }
  .hero,
  .grid-3,
  .grid-2,
  .eval-layout {
    grid-template-columns: 1fr;
  }
  .eval-sidebar {
    position: static;
  }
  .top-tagline {
    font-size: 0.78rem;
    padding: 0.5rem 0.75rem;
  }
  .dim-row {
    grid-template-columns: 1fr;
    gap: 0.25rem;
  }
}
