/* Texas DFC Evaluation - Styles */
:root {
  --bg: #0f1419;
  --panel: #1a2129;
  --line: #2b3642;
  --fg: #e6edf3;
  --mut: #8b98a5;
  --acc: #3b82f6;
  --ok: #22c55e;
  --bad: #ef4444;
  --warn: #f59e0b;
  --purple: #7c3aed;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--fg);
  font: 13px/1.6 ui-sans-serif, system-ui, -apple-system, sans-serif;
  min-height: 100vh;
}

header {
  padding: 12px 24px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
header h1 { font-size: 15px; font-weight: 700; white-space: nowrap; }
header h1 span { color: var(--mut); font-weight: 400; }
#modeTag {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  background: rgba(245,158,11,.12);
  color: var(--warn);
  border: 1px solid rgba(245,158,11,.2);
}
#auth { margin-left: auto; display: flex; align-items: center; gap: 8px; }
#authLabel { font-size: 12px; color: var(--mut); }

nav { padding: 0 24px; border-bottom: 1px solid var(--line); display: flex; align-items: center; }
.tc {
  background: transparent;
  color: var(--mut);
  border: none;
  border-bottom: 2px solid transparent;
  padding: 10px 18px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.tc.active { color: var(--fg); border-bottom-color: var(--acc); }
#statusLine { margin-left: auto; font-size: 12px; color: var(--mut); }

main { max-width: 1120px; margin: 0 auto; padding: 24px; display: flex; flex-direction: column; gap: 18px; }
section { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 18px; }
section > h3 {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--mut);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}
section > h3 .desc { font-weight: 400; text-transform: none; letter-spacing: 0; font-size: 12px; }

.question-panel { padding: 0; overflow: hidden; }
.question-shell { display: grid; grid-template-columns: minmax(0,1.25fr) minmax(280px,.75fr); gap: 0; }
.question-main { padding: 24px; border-right: 1px solid var(--line); }
.question-kicker { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; color: var(--acc); margin-bottom: 8px; }
.question-title { font-size: 27px; line-height: 1.2; font-weight: 800; max-width: 760px; letter-spacing: 0; }
.question-copy { color: var(--mut); font-size: 13px; margin-top: 10px; max-width: 760px; }
.question-side { padding: 20px; background: rgba(15,20,25,.42); display: flex; flex-direction: column; gap: 12px; }
.context-card { border: 1px solid var(--line); border-radius: 8px; padding: 12px; background: rgba(15,20,25,.55); }

/* React UI / shadcn visual language: light slate surfaces with dark MINT chrome. */
:root { --bg:#fff; --panel:#fff; --line:#e2e8f0; --fg:#0f172a; --mut:#64748b; --acc:#2563eb; --surface-muted:#f8fafc; }
body { background:var(--bg); color:var(--fg); font-size:14px; }
header { min-height:50px; padding:10px 24px; background:#222; border-bottom-color:#7f7f7f; color:#fff; }
header h1 span { color:rgba(255,255,255,.65); }
#authLabel { color:rgba(255,255,255,.7); }
nav { background:#222; border-bottom-color:#7f7f7f; gap:4px; }
.tc, nav .tc { color:rgba(255,255,255,.7); background:transparent !important; border:0; border-bottom:2px solid transparent; border-radius:0; padding:14px 16px 12px; }
nav .tc { border:0 !important; border-bottom:2px solid transparent !important; }
.tc.active { color:#fff; border-bottom-color:#60a5fa; }
#statusLine { color:rgba(255,255,255,.7); }
#auth .ghost { color:#fff; background:transparent; border-color:rgba(255,255,255,.45); }
#auth .ghost:hover { color:#fff; background:rgba(255,255,255,.1); border-color:#fff; }
main { max-width:1200px; padding:28px 24px; gap:20px; }
section { border-radius:8px; box-shadow:0 1px 2px rgba(15,23,42,.04); }
section > h3 { color:#334155; }
.question-title { color:#0f172a; }
.question-copy { color:#64748b; }
.question-kicker { color:#2563eb; }
.dfc-grid { gap:16px; }
.dfc-grid label { color:#475569; letter-spacing:.06em; }
.dfc-actions { margin-top:14px; }
.piece-contract { padding:16px; border-radius:8px; background:#f8fafc; }
#piecesSection > p { max-width:760px; color:#64748b; }
#piecesSection h4 { color:#334155; font-size:13px; margin-bottom:8px; }
#pieceSource { min-height:220px; background:#0f172a; color:#e2e8f0; border-color:#1e293b; }
#pieceSource:focus { border-color:#60a5fa; box-shadow:0 0 0 2px rgba(37,99,235,.15); }
@media (max-width: 760px) {
  header { padding:10px 16px; }
  nav { padding:0 12px; overflow-x:auto; }
  .tc, nav .tc { white-space:nowrap; padding-left:12px; padding-right:12px; }
  main { padding:18px 14px; }
  .question-shell { display:block; }
  .question-main { border-right:0; border-bottom:1px solid var(--line); }
  .question-title { font-size:23px; }
}
.question-side { background:var(--surface-muted); }
.context-card { background:var(--surface-muted); }
input, select, textarea { border:1px solid #cbd5e1; border-radius:6px; background:#fff; color:var(--fg); padding:8px 10px; font:inherit; }
input:focus, select:focus, textarea:focus { outline:none; border-color:var(--acc); box-shadow:0 0 0 2px rgba(37,99,235,.15); }
textarea { font-family:ui-monospace,SFMono-Regular,Menlo,monospace; font-size:12px; line-height:1.5; }
button { border-radius:6px; font-weight:600; }
button:not(.ghost) { background:var(--acc); color:#fff; border:1px solid var(--acc); padding:8px 14px; }
button:not(.ghost):hover { background:#1d4ed8; border-color:#1d4ed8; }
button.ghost { color:#334155; background:#fff; border:1px solid #cbd5e1; padding:7px 12px; }
button.ghost:hover { background:#f1f5f9; border-color:#94a3b8; }
.context-card .cc-label, .map-card .cc-label { font-size: 11px; color: var(--mut); font-weight: 700; text-transform: uppercase; letter-spacing: .05em; margin-bottom: 4px; }
.context-card .cc-value { font-size: 14px; font-weight: 700; }
.map-card { border: 1px solid var(--line); border-radius: 8px; padding: 16px; background: #f8fafc; }
.map-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.map-title { font-size: 16px; font-weight: 800; line-height: 1.2; }
.map-chip { font-size: 11px; color: var(--mut); border: 1px solid var(--line); border-radius: 999px; padding: 3px 8px; white-space: nowrap; }
.dfc-map { height: 250px; border: 1px solid #cbd5e1; border-radius: 7px; background: #eaf2fb; position: relative; overflow: hidden; }
.dfc-map svg { width: 100%; height: 100%; display: block; }
.map-path { fill: rgba(37,99,235,.10); stroke: #64748b; stroke-width: 1.25; }
.map-path.selected { fill: rgba(22,163,74,.30); stroke: #15803d; stroke-width: 2.8; }
.map-label { font-size: 9px; fill: #334155; font-weight: 800; text-anchor: middle; paint-order: stroke; stroke: #eaf2fb; stroke-width: 2.5px; }
.map-label.selected { font-size: 14px; fill: #14532d; stroke: #fff; stroke-width: 3px; }
.map-status { position: absolute; left: 10px; right: 10px; bottom: 8px; background: rgba(255,255,255,.94); border: 1px solid #cbd5e1; border-radius: 6px; padding: 7px 9px; font-size: 11px; color: #475569; box-shadow: 0 1px 2px rgba(15,23,42,.08); }
.question-grid { margin-top: 18px; }
.question-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 16px; }
.advanced-dfc { margin-top: 12px; border-top: 1px solid var(--line); padding-top: 12px; }
.advanced-dfc summary { cursor: pointer; color: var(--mut); font-size: 12px; }
.answer-summary { display: grid; grid-template-columns: minmax(0,1.1fr) repeat(3,minmax(120px,.3fr)); gap: 12px; margin-bottom: 14px; }
.answer-hero, .answer-stat { background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 14px; }
.answer-hero { border-left: 3px solid var(--acc); }
.answer-label { font-size: 11px; color: var(--mut); font-weight: 700; text-transform: uppercase; letter-spacing: .05em; margin-bottom: 5px; }
.answer-title { font-size: 18px; font-weight: 800; line-height: 1.25; }
.answer-copy { font-size: 12px; color: var(--mut); margin-top: 7px; }
.answer-stat .value { font-size: 24px; font-weight: 800; line-height: 1.1; }
.metric-grid { display: grid; grid-template-columns: repeat(auto-fit,minmax(238px,1fr)); gap: 12px; }
.metric-card { background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 14px; display: flex; flex-direction: column; gap: 10px; min-height: 210px; }
.metric-card.ok { border-left: 3px solid var(--ok); }
.metric-card.warn { border-left: 3px solid var(--warn); }
.metric-card.bad { border-left: 3px solid var(--bad); }
.metric-card .mc-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.metric-card .mc-title { font-size: 14px; font-weight: 800; line-height: 1.25; }
.metric-card .mc-status { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; white-space: nowrap; }
.metric-card.ok .mc-status { color: var(--ok); }
.metric-card.warn .mc-status { color: var(--warn); }
.metric-card.bad .mc-status { color: var(--bad); }
.metric-card .mc-row { display: flex; justify-content: space-between; gap: 10px; border-top: 1px solid var(--line); padding-top: 7px; font-size: 12px; }
.metric-card .mc-row span:first-child { color: var(--mut); }
.metric-card .mc-note { font-size: 12px; color: var(--mut); line-height: 1.5; flex: 1; }
.metric-card .mc-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: auto; }
.workflow-note { background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 12px; color: var(--mut); font-size: 12px; margin-bottom: 12px; }
.section-subhead { font-size: 13px; color: var(--mut); margin: -4px 0 14px; }

/* sources */
#sourcesList { display: flex; gap: 10px; flex-wrap: wrap; }
.src-card { background: var(--bg); border: 1px solid var(--line); border-left: 3px solid var(--acc); border-radius: 7px; padding: 10px 13px; flex: 1; min-width: 180px; max-width: 320px; }
.src-card .s-label { font-weight: 600; font-size: 12.5px; margin-bottom: 3px; }
.src-card .s-svo { color: var(--acc); font-family: ui-monospace, monospace; font-size: 11px; margin-bottom: 2px; }
.src-card .s-meta { color: var(--mut); font-size: 11px; }
.src-card .s-uri { color: var(--mut); font-size: 10.5px; margin-top: 4px; opacity: .7; word-break: break-all; }

/* inference */
.bfs-note { color: var(--mut); font-size: 12px; margin-bottom: 14px; line-height: 1.6; border-left: 3px solid var(--line); padding-left: 10px; }
.tog { background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 5px 14px; font-size: 12px; cursor: pointer; color: var(--mut); }
.tog.active { border-color: var(--acc); color: var(--acc); background: rgba(59,130,246,.08); }
#graphOut { display: flex; flex-direction: column; gap: 12px; }
.branch { background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 14px; }
.branch-header { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.branch-index { background: var(--acc); color: #fff; font-size: 11px; font-weight: 700; border-radius: 50%; width: 20px; height: 20px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.branch-title { font-weight: 600; font-size: 13px; }

/* versus layout */
.versus { display: grid; grid-template-columns: 1fr auto 1fr; gap: 12px; align-items: center; margin-bottom: 14px; }
.vs-box { background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 9px 12px; }
.vs-box .vb-role { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--mut); margin-bottom: 4px; }
.vs-box .vb-svo { color: var(--acc); font-family: ui-monospace, monospace; font-size: 11.5px; }
.vs-box .vb-props { font-size: 11px; color: var(--mut); margin-top: 3px; }
.vs-arrow { color: var(--mut); font-size: 18px; text-align: center; }

/* chain steps */
.chain { display: flex; flex-direction: column; gap: 0; }
.step-row { display: flex; align-items: stretch; gap: 0; }
.step-gutter { width: 2px; background: var(--line); margin: 0 16px; flex-shrink: 0; }
.step-content { flex: 1; padding: 6px 0; }
.gap-line { font-size: 11.5px; color: var(--warn); padding: 4px 0; display: flex; align-items: center; gap: 6px; }
.gap-line::before { content: "⚠"; font-size: 12px; }
.transform-box { background: var(--panel); border: 1px solid var(--line); border-left: 3px solid var(--purple); border-radius: 6px; padding: 9px 12px; margin: 4px 0; }
.transform-box .tb-name { font-weight: 600; font-size: 12.5px; }
.transform-box .tb-type { font-size: 11px; color: #a78bfa; margin-left: 6px; }
.transform-box .tb-method { font-size: 11px; color: var(--mut); margin-top: 2px; }
.transform-box .tb-changes { font-size: 11px; color: var(--fg); margin-top: 4px; }
.transform-box .tb-changes b { color: var(--ok); }
.result-line { font-size: 11.5px; color: var(--ok); padding: 4px 0; display: flex; align-items: center; gap: 6px; }
.result-line::before { content: "✓"; font-weight: 700; }

/* convergence */
.convergence { background: var(--bg); border: 1px solid rgba(34,197,94,.25); border-left: 3px solid var(--ok); border-radius: 8px; padding: 14px; }
.conv-header { font-size: 12px; font-weight: 700; color: var(--ok); margin-bottom: 8px; }
.model-box { background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 9px 12px; }
.model-box .mb-name { font-weight: 600; font-size: 13px; }
.model-box .mb-type { font-size: 11px; color: var(--ok); margin-left: 6px; }
.model-box .mb-out { font-size: 12px; color: var(--mut); margin-top: 4px; }

/* run */
#runSection .row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
#runOut { margin-top: 14px; }
.dfc-grid { display: grid; grid-template-columns: repeat(auto-fit,minmax(220px,1fr)); gap: 12px; margin-bottom: 12px; }
.dfc-grid label { display: flex; flex-direction: column; gap: 5px; color: var(--mut); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.dfc-grid input, .dfc-grid select { width: 100%; text-transform: none; letter-spacing: 0; font-weight: 400; color: var(--fg); }
.dfc-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 8px; }
.risk-grid { display: grid; grid-template-columns: repeat(auto-fit,minmax(170px,1fr)); gap: 12px; margin-top: 2px; }
.risk-box { background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 12px; }
.risk-box .rb-label { font-size: 11px; color: var(--mut); margin-bottom: 4px; }
.risk-box .rb-val { font-size: 26px; font-weight: 700; line-height: 1.2; }
.risk-factors { display: grid; grid-template-columns: 1fr 1fr; gap: 3px 18px; margin-top: 12px; font-size: 12px; }
.rf { display: flex; justify-content: space-between; padding: 3px 0; border-bottom: 1px solid var(--line); }

button { background: var(--acc); color: #fff; border: none; border-radius: 7px; padding: 8px 14px; font-size: 13px; cursor: pointer; }
button.ghost { background: transparent; border: 1px solid var(--line); color: var(--fg); }
button:disabled { opacity: .4; cursor: not-allowed; }
button.pill-btn { background: transparent; border: 1px solid var(--line); color: var(--mut); padding: 5px 12px; font-size: 12px; border-radius: 20px; }
button.pill-btn.active { background: var(--acc); border-color: var(--acc); color: #fff; }
input[type=text], input[type=number], select { background: var(--bg); border: 1px solid var(--line); color: var(--fg); border-radius: 6px; padding: 6px 10px; font-size: 13px; }
select:disabled { opacity: .45; cursor: not-allowed; }
label { font-size: 13px; }
pre { background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 12px; overflow: auto; font-size: 11.5px; max-height: 380px; margin-top: 2px; white-space: pre-wrap; }
.pill { display: inline-block; padding: 1px 7px; border-radius: 10px; font-size: 11px; font-weight: 600; }
.pill.ok { background: rgba(34,197,94,.15); color: var(--ok); }
.pill.bad { background: rgba(239,68,68,.15); color: var(--bad); }
code { background: var(--bg); padding: 1px 5px; border-radius: 4px; font-size: 11.5px; font-family: ui-monospace, monospace; }
.err { color: var(--bad); }
.muted { color: var(--mut); }

@media (max-width: 860px) {
  header { padding: 12px 16px; }
  #auth { width: 100%; margin-left: 0; }
  nav { padding: 0 16px; overflow: auto; }
  main { padding: 16px; }
  .question-shell { grid-template-columns: 1fr; }
  .question-main { border-right: none; border-bottom: 1px solid var(--line); padding: 20px; }
  .question-side { padding: 16px; }
  .question-title { font-size: 22px; }
  .answer-summary { grid-template-columns: 1fr; }
}
