:root {
  --bg: #f6f7f2;
  --panel: #ffffff;
  --panel-2: #f0f2ec;
  --ink: #20242a;
  --muted: #69707a;
  --line: #d8dcd2;
  --accent: #e24b3f;
  --accent-dark: #b6322b;
  --nav: #262a33;
  --nav-ink: #f8f4eb;
  --blue: #21618c;
  --green: #166534;
  --amber: #8a5a00;
  --red: #9f2525;
  --shadow: 0 18px 40px rgba(35, 41, 48, 0.1);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
}

button,
input,
textarea {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.auth-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(320px, 440px) 1fr;
}

.auth-side {
  background: var(--nav);
  color: var(--nav-ink);
  padding: 48px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.auth-side h1,
.top h1,
.page-title {
  letter-spacing: 0;
}

.auth-side h1 {
  margin: 0 0 16px;
  font-size: 44px;
  line-height: 1;
}

.auth-side p {
  color: #c9c6bd;
  line-height: 1.55;
}

.auth-main {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
}

.auth-card,
.content-panel,
.detail-panel,
.question-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.auth-card {
  width: min(100%, 460px);
  padding: 28px;
}

.tabs,
.nav,
.row,
.toolbar,
.metric-grid,
.job-item,
.summary-grid,
.verification-grid {
  display: flex;
  gap: 12px;
}

.tabs {
  margin-bottom: 20px;
}

.tab,
.nav button {
  background: transparent;
  color: var(--muted);
  padding: 10px 12px;
  border-radius: 8px;
}

.tab.active,
.nav button.active {
  background: var(--accent);
  color: white;
}

.field {
  display: grid;
  gap: 7px;
  margin-bottom: 15px;
}

.field label {
  font-weight: 700;
  font-size: 13px;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  background: #fbfcf8;
  color: var(--ink);
  border-radius: 8px;
  padding: 12px 13px;
  outline: none;
}

textarea {
  min-height: 144px;
  resize: vertical;
  line-height: 1.5;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(33, 97, 140, 0.16);
}

.primary,
.secondary,
.ghost,
.danger {
  min-height: 42px;
  border-radius: 8px;
  padding: 0 16px;
  font-weight: 800;
}

.primary {
  background: var(--accent);
  color: white;
}

.primary:hover {
  background: var(--accent-dark);
}

.secondary {
  background: var(--nav);
  color: var(--nav-ink);
}

.ghost {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
}

.danger {
  background: #f8dddd;
  color: var(--red);
}

.muted {
  color: var(--muted);
}

.tiny {
  font-size: 12px;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 264px 1fr;
}

.sidebar {
  background: var(--nav);
  color: var(--nav-ink);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.brand {
  display: grid;
  gap: 4px;
}

.brand strong {
  font-size: 22px;
}

.brand span,
.user-block span {
  color: #c9c6bd;
  font-size: 13px;
}

.nav {
  flex-direction: column;
}

.nav button {
  color: var(--nav-ink);
  text-align: left;
}

.nav button:not(.active):hover {
  background: rgba(255, 255, 255, 0.08);
}

.sidebar-parser {
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  padding: 14px;
  display: grid;
  gap: 12px;
}

.sidebar-parser-head {
  display: grid;
  gap: 4px;
}

.sidebar-parser-head strong {
  font-size: 14px;
}

.sidebar-parser-head span,
.sidebar-note {
  color: #c9c6bd;
  font-size: 12px;
  line-height: 1.45;
}

.radio-row {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 6px 9px;
  align-items: center;
  margin: 10px 0;
  font-size: 13px;
  font-weight: 800;
}

.radio-row input {
  width: 16px;
  height: 16px;
  padding: 0;
}

.radio-row em {
  grid-column: 2;
  color: #c9c6bd;
  font-size: 11px;
  font-style: normal;
  font-weight: 700;
}

.radio-row.disabled {
  opacity: 0.5;
}

.compact-field {
  gap: 5px;
  margin-bottom: 10px;
}

.sidebar-parser .compact-field label {
  color: var(--nav-ink);
  font-size: 12px;
}

.sidebar-parser input[type="text"],
.sidebar-parser input[type="password"],
.sidebar-parser input:not([type]) {
  min-height: 38px;
  background: #181c24;
  border-color: rgba(255, 255, 255, 0.16);
  color: var(--nav-ink);
  padding: 9px 10px;
}

.sidebar-save {
  width: 100%;
  background: transparent;
  color: var(--nav-ink);
  border-color: rgba(255, 255, 255, 0.22);
}

.user-block {
  margin-top: auto;
  display: grid;
  gap: 12px;
}

.main {
  padding: 28px 36px 48px;
}

.top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
}

.top h1,
.page-title {
  margin: 0;
  font-size: 36px;
}

.status-pill,
.chip,
.job-status {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 800;
}

.status-pill.ok,
.job-status.completed {
  background: #dceee2;
  color: var(--green);
}

.status-pill.waiting,
.job-status.running,
.job-status.queued {
  background: #f5ebc8;
  color: var(--amber);
}

.status-pill.bad,
.job-status.failed {
  background: #f8dddd;
  color: var(--red);
}

.content-panel,
.detail-panel,
.question-panel {
  padding: 22px;
  margin-bottom: 18px;
}

.parser-settings {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 18px;
}

.parser-settings h2 {
  margin: 0 0 4px;
  font-size: 20px;
}

.parser-settings p {
  margin: 0;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 12px 0;
  font-weight: 800;
}

.check-row input {
  width: 18px;
  height: 18px;
}

.toolbar {
  align-items: center;
  flex-wrap: wrap;
}

.toolbar .primary {
  min-width: 184px;
}

.metric-grid,
.summary-grid,
.verification-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.metric,
.summary-card {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}

.metric span,
.summary-card span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  margin-bottom: 8px;
}

.metric strong,
.summary-card strong {
  display: block;
  font-size: 22px;
}

.metric small {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.35;
  margin-top: 6px;
}

.symbol-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.market-reference {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(180px, 0.7fr) minmax(260px, 1fr);
  gap: 12px;
  align-items: end;
}

.market-reference .field,
.run-assumptions .field {
  margin-bottom: 0;
}

.run-assumptions {
  display: grid;
  grid-template-columns: minmax(160px, 0.4fr) minmax(220px, 0.6fr);
  gap: 12px;
  align-items: end;
  margin-top: 12px;
  max-width: 620px;
}

.reference-note {
  margin: 8px 0 0;
}

.chip {
  background: #e2edf4;
  color: var(--blue);
}

.chip small {
  margin-left: 6px;
  color: var(--muted);
  font-size: 11px;
}

.message {
  border-radius: 8px;
  padding: 13px 15px;
  margin: 14px 0;
  font-weight: 700;
}

.message.info {
  background: #dceaf3;
  color: var(--blue);
}

.message.warn {
  background: #f5ebc8;
  color: var(--amber);
}

.message.error {
  background: #f8dddd;
  color: var(--red);
}

.progress-panel {
  margin: 16px 0;
}

.progress-heading {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 10px;
}

.progress-heading strong {
  color: var(--blue);
}

.progress-heading span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.progress-list {
  display: grid;
  gap: 0;
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--line);
}

.progress-step {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.step-marker {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--panel-2);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.progress-step.done .step-marker {
  background: #dceee2;
  border-color: #bedfc8;
  color: var(--green);
}

.progress-step.current .step-marker {
  background: #f5ebc8;
  border-color: #e6d08b;
  color: var(--amber);
}

.progress-step.blocked .step-marker {
  background: #f8dddd;
  border-color: #e3b9b9;
  color: var(--red);
}

.step-copy {
  display: grid;
  gap: 4px;
}

.step-copy strong {
  font-size: 14px;
}

.step-copy small {
  color: var(--muted);
  line-height: 1.4;
}

.jobs {
  display: grid;
  gap: 10px;
}

.job-item {
  width: 100%;
  align-items: center;
  justify-content: space-between;
  text-align: left;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  color: var(--ink);
}

.job-item:hover,
.job-item.active {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(33, 97, 140, 0.1);
}

.job-title {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.job-title strong,
.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chart-wrap {
  height: 280px;
  border: 1px solid var(--line);
  background: #fbfcf8;
  border-radius: 8px;
  padding: 10px;
}

canvas {
  width: 100%;
  height: 100%;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

table {
  border-collapse: collapse;
  width: 100%;
  min-width: 760px;
  background: var(--panel);
}

th,
td {
  text-align: left;
  border-bottom: 1px solid var(--line);
  padding: 10px 12px;
  font-size: 13px;
}

th {
  background: var(--panel-2);
  color: var(--muted);
  font-weight: 800;
}

.question-panel {
  display: grid;
  gap: 14px;
}

.empty {
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 28px;
  text-align: center;
  color: var(--muted);
}

@media (max-width: 900px) {
  .auth-page,
  .app-shell {
    grid-template-columns: 1fr;
  }

  .auth-side {
    min-height: 260px;
  }

  .sidebar {
    position: static;
  }

  .nav {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .main {
    padding: 22px;
  }

  .metric-grid,
  .summary-grid,
  .verification-grid,
  .market-reference {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  .auth-side,
  .auth-main,
  .main {
    padding: 18px;
  }

  .top {
    flex-direction: column;
  }

  .metric-grid,
  .summary-grid,
  .verification-grid,
  .market-reference {
    grid-template-columns: 1fr;
  }

  .toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .toolbar button {
    width: 100%;
  }

  .progress-heading {
    flex-direction: column;
  }
}

/* ---------- Public site / landing ---------- */
.site { min-height: 100vh; display: flex; flex-direction: column; }

.site-nav {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 28px;
  background: rgba(246,247,242,0.92); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.site-brand { display: inline-flex; align-items: center; gap: 4px; background: transparent; color: var(--ink); font-weight: 800; font-size: 19px; letter-spacing: -0.3px; }
.site-links { display: flex; align-items: center; gap: 4px; }
.site-link { background: transparent; color: var(--muted); font-weight: 600; font-size: 14px; padding: 8px 12px; border-radius: 8px; }
.site-link:hover { color: var(--ink); background: var(--panel-2); }
.site-link.active { color: var(--ink); }
.site-login { background: var(--accent); color: #fff; font-weight: 700; font-size: 14px; padding: 9px 18px; border-radius: 8px; margin-left: 6px; }
.site-login:hover { background: var(--accent-dark); }
.site-main { flex: 1; }

.hero { background: var(--nav); color: var(--nav-ink); padding: 84px 24px 74px; text-align: center; }
.hero-inner { max-width: 760px; margin: 0 auto; }
.eyebrow { display: inline-block; font-size: 12px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; color: var(--accent); background: rgba(226,75,63,0.15); padding: 5px 12px; border-radius: 999px; margin-bottom: 22px; }
.hero h1 { font-size: 46px; line-height: 1.08; font-weight: 800; letter-spacing: -1px; margin: 0 0 18px; }
.hero .hl { color: #f0806f; }
.hero-sub { font-size: 18px; line-height: 1.6; color: #c7cad2; max-width: 620px; margin: 0 auto 30px; }
.hero-cta { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.btn-primary { display: inline-block; background: var(--accent); color: #fff; font-weight: 700; font-size: 16px; padding: 13px 28px; border-radius: 9px; text-decoration: none; }
.btn-primary:hover { background: var(--accent-dark); }
.btn-ghost { display: inline-block; color: var(--nav-ink); font-weight: 600; font-size: 16px; padding: 13px 24px; border-radius: 9px; text-decoration: none; border: 1px solid rgba(248,244,235,0.28); }
.btn-ghost:hover { border-color: rgba(248,244,235,0.6); }
.btn-ghost.dark { color: var(--ink); border-color: var(--line); }
.btn-ghost.dark:hover { border-color: var(--muted); }
.hero-examples { margin-top: 40px; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.ex-label { font-size: 13px; color: #9aa0aa; }
.hero-examples code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13.5px; color: #e8e9ec; background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.1); padding: 9px 14px; border-radius: 8px; max-width: 100%; }

.strip { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; max-width: 960px; margin: 0 auto; padding: 60px 24px; }
.feature { text-align: left; }
.fnum { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; background: var(--panel-2); color: var(--accent); font-weight: 800; border-radius: 9px; margin-bottom: 12px; }
.feature h3 { margin: 0 0 6px; font-size: 18px; }
.feature p { margin: 0; color: var(--muted); line-height: 1.55; font-size: 15px; }

.data-band { background: var(--panel); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); text-align: center; padding: 56px 24px; }
.data-band h2 { margin: 0 0 12px; font-size: 26px; }
.data-band p { max-width: 680px; margin: 0 auto; color: var(--muted); line-height: 1.65; font-size: 16px; }

.final-cta { text-align: center; padding: 70px 24px; }
.final-cta h2 { margin: 0 0 10px; font-size: 30px; letter-spacing: -0.5px; }
.final-cta p { margin: 0 0 26px; color: var(--muted); font-size: 16px; }

.doc { max-width: 720px; margin: 0 auto; padding: 60px 24px 72px; }
.doc h1 { font-size: 34px; margin: 0 0 16px; letter-spacing: -0.6px; }
.doc h2 { font-size: 21px; margin: 34px 0 10px; }
.doc p, .doc li { line-height: 1.7; color: #3a4048; font-size: 16px; }
.doc .lead { font-size: 19px; color: var(--ink); margin-bottom: 22px; }
.doc ul { padding-left: 20px; }
.doc li { margin-bottom: 8px; }
.soon { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 22px 26px; margin-top: 20px; }
.soon-tag { display: inline-block; font-size: 12px; font-weight: 700; letter-spacing: 0.5px; text-transform: uppercase; color: var(--accent); margin-bottom: 12px; }

.auth-wrap { display: flex; justify-content: center; padding: 56px 20px 72px; }
.alpha-note { margin-top: 16px; text-align: center; font-size: 13px; color: var(--muted); line-height: 1.5; }
.alpha-note a { color: var(--accent); font-weight: 700; text-decoration: none; }

.site-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 22px 28px; background: var(--nav); color: #b7bcc5; }
.foot-brand { display: inline-flex; align-items: center; gap: 6px; color: var(--nav-ink); font-weight: 700; }
.foot-copy { font-size: 13px; }

@media (max-width: 640px) {
  .site-nav { padding: 12px 16px; }
  .site-link { padding: 7px 8px; font-size: 13px; }
  .hero { padding: 58px 18px 52px; }
  .hero h1 { font-size: 32px; }
  .hero-sub { font-size: 16px; }
  .strip { grid-template-columns: 1fr; padding: 40px 20px; gap: 26px; }
  .final-cta h2 { font-size: 24px; }
}

/* ---------- Blog ---------- */
.blog-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; margin-top: 26px; }
.blog-card { text-align: left; display: flex; flex-direction: column; gap: 7px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 20px 22px; }
button.blog-card:hover { border-color: var(--accent); box-shadow: var(--shadow); }
.soon-card { opacity: 0.72; }
.blog-cat { font-size: 11px; font-weight: 700; letter-spacing: .6px; text-transform: uppercase; color: var(--accent); }
.blog-title { font-size: 17px; font-weight: 700; line-height: 1.3; color: var(--ink); }
.blog-tag { font-size: 14px; color: var(--muted); line-height: 1.5; }
.blog-read { font-size: 13px; font-weight: 700; color: var(--accent); margin-top: 4px; }
.blog-soon { font-size: 12px; font-weight: 700; color: var(--muted); margin-top: 4px; text-transform: uppercase; letter-spacing: .4px; }

.bp-article { max-width: 720px; }
.bp-back { background: transparent; color: var(--muted); font-weight: 600; font-size: 13px; padding: 0; margin-bottom: 18px; }
.bp-back:hover { color: var(--accent); }
.bp-cat { font-size: 12px; font-weight: 700; letter-spacing: .6px; text-transform: uppercase; color: var(--accent); margin-bottom: 10px; }
.bp-meta { font-size: 13px; color: var(--muted); margin: 8px 0 4px; }
.bp-query { margin: 20px 0; background: var(--nav); border-radius: 10px; padding: 12px 16px; font-family: ui-monospace, Menlo, monospace; font-size: 13px; color: #e8e9ec; line-height: 1.5; overflow-x: auto; }
.bp-query-tag { color: #8a93a8; }
.bp-stats { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; margin: 20px 0; }
.bp-tile { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 13px 14px; }
.bp-tile-v { font-size: 22px; font-weight: 800; }
.bp-tile-v.up { color: #157347; }
.bp-tile-v.down { color: #b02a2a; }
.bp-tile-l { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.bp-chart { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px 10px; margin: 8px 0 20px; }
.bp-chart-t { font-size: 13px; font-weight: 700; margin-bottom: 8px; }
.bp-callout { border-left: 3px solid var(--accent); background: #fbe9e7; border-radius: 0 10px 10px 0; padding: 14px 18px; margin: 20px 0; }
.bp-callout-t { font-weight: 700; font-size: 14px; margin-bottom: 4px; }
.bp-callout-x { font-size: 14.5px; line-height: 1.6; color: #3a4048; }
.bp-cta { margin-top: 30px; padding-top: 24px; border-top: 1px solid var(--line); }
.bp-cta p { color: var(--muted); margin: 0 0 14px; }

@media (max-width: 640px) {
  .blog-grid { grid-template-columns: 1fr; }
  .bp-stats { grid-template-columns: repeat(2, 1fr); }
}

.bp-disclaimer { font-size: 12.5px; line-height: 1.55; color: var(--muted); background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 10px 14px; margin: 16px 0 4px; }
.bp-disclaimer strong { color: var(--ink); }

.bp-cmp { width: 100%; border-collapse: collapse; margin: 18px 0; font-size: 14.5px; }
.bp-cmp th, .bp-cmp td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.bp-cmp thead th { font-size: 12px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); }
.bp-cmp tbody td:first-child { color: var(--muted); }
.bp-cmp tbody td:not(:first-child) { font-weight: 700; }
.bp-cmp tbody tr:last-child td { border-bottom: 0; }
