/* ── Tokens ──────────────────────────────────────────────────────── */
:root {
  --bg:       #f3f4f2;
  --surface:  #ffffff;
  --border:   #e7e7e3;
  --text:     #131613;
  --text-2:   #565b56;
  --text-3:   #9a9d98;
  --accent:   #0f766e;
  --accent-2: #f0faf8;
  --positive: #16a34a;
  --negative: #dc2626;
  --r:        12px;
  --shadow:   0 1px 2px rgba(20, 30, 25, 0.04), 0 4px 16px rgba(20, 30, 25, 0.04);
}

/* ── Reset ───────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI Variable", "Segoe UI", system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.65;
}
h1, h2, h3, h4, p, dl, ul, ol { margin: 0; }

/* ── Shell ───────────────────────────────────────────────────────── */
.app-shell {
  max-width: 1440px;
  margin: 0 auto;
  padding: 20px 24px 64px;
}

/* ── Stack Utilities ─────────────────────────────────────────────── */
.stack-xs { display: grid; gap: 4px; }
.stack-sm { display: grid; gap: 10px; }
.stack-md { display: grid; gap: 18px; }
.stack-lg { display: grid; gap: 24px; }

/* ── Topbar ──────────────────────────────────────────────────────── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 20px;
  margin-bottom: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  box-shadow: var(--shadow);
}

.brand { display: flex; align-items: center; gap: 12px; }

.brand-mark {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: var(--accent);
  color: #fff;
}

.brand-mark svg { width: 18px; height: 18px; }

h1 {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

/* ── Health Badge ────────────────────────────────────────────────── */
.health-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.health-badge::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-3);
}

.health-badge.is-ready::before { background: var(--positive); }
.health-badge.muted::before    { background: var(--negative); }

/* ── Eyebrow ─────────────────────────────────────────────────────── */
.eyebrow {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-3);
}

/* ── Workspace Grid ──────────────────────────────────────────────── */
.workspace-grid {
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  gap: 20px;
  align-items: stretch;
}

.control-rail {
  position: sticky;
  top: 20px;
  align-self: start;
}

/* ── Cards ───────────────────────────────────────────────────────── */
.control-card,
.summary-card,
.results-empty {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 24px;
  box-shadow: var(--shadow);
}

h3 { font-size: 1rem; font-weight: 700; line-height: 1.4; }
h4 { font-size: 0.88rem; font-weight: 600; color: var(--text-2); }

/* ── Form Sections ───────────────────────────────────────────────── */
.form-section {
  padding-top: 20px;
  border-top: 1px solid var(--border);
  display: grid;
  gap: 14px;
}

/* ── Symbol Picker ───────────────────────────────────────────────── */
.panel-muted {
  padding: 14px;
  background: var(--bg);
  border-radius: var(--r);
  display: grid;
  gap: 14px;
}

/* ── Form Fields ─────────────────────────────────────────────────── */
.field { display: grid; gap: 6px; }

.field > span,
.field-title {
  font-size: 0.83rem;
  font-weight: 600;
  color: var(--text-2);
}

.field-header { display: grid; gap: 3px; }

textarea, select {
  width: 100%;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  color: var(--text);
  font: inherit;
  font-size: 0.92rem;
  transition: border-color 140ms ease, box-shadow 140ms ease;
}

textarea { min-height: 130px; resize: vertical; }
select[multiple] { min-height: 200px; padding-block: 8px; }

textarea:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 12%, transparent);
}

small {
  font-size: 0.77rem;
  color: var(--text-3);
  line-height: 1.5;
}

/* ── Custom Ticker Row ───────────────────────────────────────────── */
.custom-ticker-row { display: flex; gap: 8px; }

.custom-ticker-row input {
  flex: 1;
  padding: 9px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  color: var(--text);
  font: inherit;
  font-size: 0.92rem;
  font-family: "Cascadia Code", "Consolas", monospace;
  text-transform: uppercase;
  transition: border-color 140ms ease, box-shadow 140ms ease;
}

.custom-ticker-row input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 12%, transparent);
}

/* ── Symbol-Mode Radio Cards ─────────────────────────────────────── */
.choice-grid { display: grid; gap: 6px; }

.choice-card {
  position: relative;
  display: block;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: var(--surface);
  cursor: pointer;
  transition: border-color 140ms ease;
}

.choice-card:hover { border-color: var(--accent); }

.choice-card input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.choice-card.is-active { border-color: var(--accent); }

.choice-copy {
  display: grid;
  gap: 2px;
  padding: 11px 13px;
  color: var(--text-2);
  font-size: 0.83rem;
}

.choice-title {
  color: var(--text);
  font-size: 0.88rem;
  font-weight: 600;
}

.choice-kicker {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}

/* ── Subtle Copy ─────────────────────────────────────────────────── */
.subtle-copy { font-size: 0.83rem; color: var(--text-3); }

/* ── Buttons ─────────────────────────────────────────────────────── */
.button-primary,
.button-secondary,
.suggestion-button {
  cursor: pointer;
  border: none;
  font: inherit;
  transition: opacity 140ms ease, background 140ms ease;
}

.button-primary,
.button-secondary {
  min-height: 40px;
  padding: 0 16px;
  border-radius: var(--r);
  font-weight: 600;
  font-size: 0.88rem;
}

.button-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 1px 2px rgba(15, 118, 110, 0.25);
}
.button-primary:hover { background: #0a5c56; }
.button-primary:disabled { opacity: 0.5; cursor: wait; box-shadow: none; }

.button-secondary {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-2);
}
.button-secondary:hover { border-color: var(--text-3); }

/* ── Suggestion Buttons ──────────────────────────────────────────── */
.suggestion-button {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: var(--surface);
  text-align: left;
  transition: border-color 140ms ease;
}

.suggestion-button:hover { border-color: var(--accent); }

.suggestion-label {
  display: block;
  margin-bottom: 3px;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}

.suggestion-button strong {
  display: block;
  font-size: 0.86rem;
  color: var(--text);
  line-height: 1.45;
  font-weight: 500;
}

/* ── Form Footer ─────────────────────────────────────────────────── */
.form-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.form-message {
  font-size: 0.83rem;
  color: var(--text-3);
  min-height: 20px;
  flex: 1;
}
.form-message.is-error { color: var(--negative); }

/* ── Badges ──────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.73rem;
  font-weight: 600;
  white-space: nowrap;
  border: 1px solid var(--border);
  color: var(--text-2);
  background: var(--surface);
}

.badge.muted { color: var(--text-3); }

/* ── Run Progress ────────────────────────────────────────────────── */
.run-progress {
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.run-stages {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 2px;
}

.run-stage {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 0;
  border-bottom: 1px solid var(--border);
  color: var(--text-3);
  font-size: 0.83rem;
}

.run-stage:last-child { border-bottom: none; }

.run-stage.is-active { color: var(--accent); }

.run-stage.is-active .stage-status::after {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  margin-left: 6px;
  vertical-align: middle;
  animation: pulse 1.1s ease-in-out infinite;
}

.run-stage.is-done { color: var(--text-2); }

.run-stage.is-done .stage-status::after {
  content: "✓";
  margin-left: 6px;
  color: var(--positive);
  font-weight: 700;
}

.stage-label { flex: 1; }

@keyframes pulse {
  0%, 100% { opacity: 1;   transform: scale(1); }
  50%       { opacity: 0.3; transform: scale(0.7); }
}

/* ── Results Stage ───────────────────────────────────────────────── */
.results-stage {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.results-empty {
  flex: 1;
  min-height: 340px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.empty-shell {
  display: grid;
  justify-items: center;
  gap: 10px;
  max-width: 400px;
  text-align: center;
}

.empty-icon {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  margin-bottom: 6px;
  border-radius: 16px;
  background: var(--accent-2);
  color: var(--accent);
}

.empty-icon svg { width: 28px; height: 28px; }

/* ── Summary Card ────────────────────────────────────────────────── */
.summary-card { display: grid; gap: 0; }

.results-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 20px;
}

.results-header .eyebrow { color: var(--accent); }

h2 {
  font-size: clamp(1.3rem, 2.5vw, 2rem);
  line-height: 1.15;
  letter-spacing: -0.03em;
  font-weight: 800;
}

.path-text {
  font-family: "Cascadia Code", "Consolas", monospace;
  font-size: 0.75rem;
  color: var(--text-3);
  word-break: break-all;
  text-align: right;
  max-width: 260px;
}

/* ── Result Sections ─────────────────────────────────────────────── */
.result-section {
  padding-top: 20px;
  padding-bottom: 20px;
  border-top: 1px solid var(--border);
  display: grid;
  gap: 12px;
}

.result-section p,
.evidence-text { color: var(--text-2); font-size: 0.9rem; line-height: 1.65; }

.result-section--opportunity h3 { color: var(--positive); }
.result-section--risk h3        { color: var(--negative); }

/* ── Summary Grid ────────────────────────────────────────────────── */
.summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 32px;
}

.summary-grid > .result-section { padding-top: 20px; }

.summary-grid-inner {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

/* ── Sentiment ───────────────────────────────────────────────────── */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.metric-line { font-size: 0.86rem; color: var(--text-2); }

.sentiment-badge.positive { border-color: var(--positive); color: var(--positive); }
.sentiment-badge.negative { border-color: var(--negative); color: var(--negative); }
.sentiment-badge.neutral  { color: var(--text-2); }

/* ── Token / Bullet Lists ────────────────────────────────────────── */
.token-list, .bullet-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 4px;
}

.token-list li, .bullet-list li {
  padding: 5px 0;
  border-bottom: 1px solid var(--border);
  color: var(--text-2);
  font-size: 0.85rem;
  line-height: 1.5;
}

.token-list li:last-child,
.bullet-list li:last-child { border-bottom: none; }

/* ── Evidence Cards ──────────────────────────────────────────────── */
.evidence-card {
  padding: 12px 0;
  border-top: 1px solid var(--border);
}

.evidence-card:first-child { border-top: none; padding-top: 0; }

.evidence-meta { font-size: 0.77rem; color: var(--text-3); }
.evidence-score { font-size: 0.77rem; color: var(--text-3); white-space: nowrap; }

/* ── Responsive ──────────────────────────────────────────────────── */
@media (max-width: 1000px) {
  .workspace-grid { grid-template-columns: 1fr; }
  .control-rail   { position: static; }
}

@media (max-width: 640px) {
  .app-shell { padding: 12px 14px 40px; }
  .control-card,
  .summary-card,
  .results-empty { padding: 18px; }

  .summary-grid,
  .summary-grid-inner { grid-template-columns: 1fr; }

  .section-header,
  .form-footer,
  .results-header { flex-direction: column; align-items: stretch; }

  .button-primary,
  .button-secondary { width: 100%; }

  .path-text { text-align: left; max-width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

[hidden] { display: none !important; }

/* Footer: HR-facing disclaimer + portfolio back-link */
.site-footer {
  margin-top: 24px;
  padding: 20px 4px 8px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  align-items: center;
  justify-content: space-between;
}
.footer-disclaimer {
  margin: 0;
  color: var(--text-3);
  font-size: 0.82rem;
  max-width: 60ch;
}
.footer-links {
  margin: 0;
  font-size: 0.85rem;
}
.footer-links a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}
.footer-links a:hover {
  text-decoration: underline;
}
