/* Overturn — styles */
:root {
  --bg: #f6f7f9;
  --card: #ffffff;
  --ink: #16202b;
  --muted: #5c6b7a;
  --line: #e3e8ee;
  --accent: #0f766e;
  --accent-ink: #ffffff;
  --accent-soft: #e6f4f2;
  --ok: #15803d;
  --ok-soft: #e8f6ec;
  --warn: #b45309;
  --warn-soft: #fdf1e0;
  --bad: #b91c1c;
  --bad-soft: #fdeaea;
  --blue: #1d4ed8;
  --blue-soft: #e8eefc;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(22, 32, 43, 0.05), 0 8px 24px -12px rgba(22, 32, 43, 0.12);
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.mono { font-family: var(--mono); font-size: 0.92em; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.hidden { display: none !important; }
code {
  font-family: var(--mono);
  background: #eef1f5;
  border-radius: 5px;
  padding: 1px 5px;
  font-size: 0.9em;
}
a { color: var(--accent); }

/* ---------- top bar ---------- */
.top {
  position: sticky; top: 0; z-index: 20;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.top-inner {
  max-width: 1280px; margin: 0 auto; padding: 10px 24px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.logo { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 17px; letter-spacing: -0.01em; color: var(--accent); }
.top-right { display: flex; align-items: center; gap: 12px; }
.top-link { font-size: 13px; color: var(--muted); text-decoration: none; }
.top-link:hover { color: var(--ink); }

/* ---------- chips ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 600;
  padding: 3px 10px; border-radius: 999px;
  background: #eef1f5; color: var(--muted);
  white-space: nowrap;
}
.chip-ok { background: var(--ok-soft); color: var(--ok); }
.chip-warn { background: var(--warn-soft); color: var(--warn); }
.chip-wait { background: var(--blue-soft); color: var(--blue); }

/* ---------- buttons ---------- */
.btn {
  font: inherit; font-weight: 600; font-size: 14px;
  border: 1px solid transparent; border-radius: 10px;
  padding: 9px 16px; cursor: pointer;
  transition: transform 0.06s ease, box-shadow 0.12s ease, background 0.12s ease;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); color: var(--accent-ink); box-shadow: var(--shadow); }
.btn-primary:hover { background: #0d655e; }
.btn-ghost { background: #fff; border-color: var(--line); color: var(--ink); }
.btn-ghost:hover { border-color: #c6ced8; background: #fafbfc; }
.btn-sm { font-size: 13px; padding: 6px 12px; }
.btn:disabled { opacity: 0.55; cursor: default; }

/* ---------- hero ---------- */
.hero { padding: 56px 24px 40px; }
.hero-inner { max-width: 880px; margin: 0 auto; }
.hero h1 {
  font-size: clamp(34px, 6vw, 54px); line-height: 1.06;
  letter-spacing: -0.03em; margin: 0 0 18px;
}
.hero .accent { color: var(--accent); }
.hero .sub { font-size: 17px; color: var(--muted); max-width: 720px; margin: 0 0 28px; }

.stats { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 28px; }
.stat {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 18px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; min-width: 150px;
}
.stat strong { font-size: 24px; letter-spacing: -0.02em; color: var(--accent); }
.stat span { font-size: 12.5px; color: var(--muted); }

.intake-card, .prompts-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 20px; margin-bottom: 18px;
}
.intake-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
#letter-input {
  width: 100%; resize: vertical; min-height: 170px;
  font-family: var(--mono); font-size: 13px; line-height: 1.5;
  border: 1px solid var(--line); border-radius: 10px; padding: 12px;
  background: #fbfcfd; color: var(--ink);
}
#letter-input:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
.intake-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 12px; }
.sample-buttons { display: flex; gap: 8px; flex-wrap: wrap; }

.prompts-card .prompt-chips { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 10px; }
.prompt-chip {
  font: inherit; font-size: 13.5px; text-align: left;
  background: var(--accent-soft); color: var(--accent);
  border: 1px solid #cfe8e4; border-radius: 10px; padding: 9px 13px;
  cursor: pointer; max-width: 100%;
}
.prompt-chip:hover { background: #d9eeea; }

/* ---------- workspace ---------- */
.workspace { max-width: 1280px; margin: 0 auto; padding: 8px 24px 48px; }

.stepper {
  list-style: none; display: flex; gap: 6px; padding: 0; margin: 18px 0;
  flex-wrap: wrap;
}
.stepper li {
  display: flex; align-items: center; gap: 7px;
  font-size: 13px; font-weight: 600; color: var(--muted);
  background: #eef1f5; border-radius: 999px; padding: 5px 14px 5px 10px;
}
.stepper li .step-dot { width: 9px; height: 9px; border-radius: 50%; background: #c3ccd6; }
.stepper li.done { background: var(--ok-soft); color: var(--ok); }
.stepper li.done .step-dot { background: var(--ok); }
.stepper li.active { background: var(--accent-soft); color: var(--accent); box-shadow: 0 0 0 1px #bfe0db inset; }
.stepper li.active .step-dot { background: var(--accent); animation: pulse 1.4s infinite; }
@keyframes pulse { 50% { opacity: 0.35; } }

.grid {
  display: grid; grid-template-columns: minmax(280px, 5fr) minmax(340px, 6fr) minmax(320px, 5fr);
  gap: 18px; align-items: start;
}
.col { display: flex; flex-direction: column; gap: 18px; min-width: 0; }

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 18px;
}
.card-title { font-weight: 700; font-size: 15px; margin-bottom: 10px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.card-title .mono { font-weight: 500; }

.field { display: flex; gap: 10px; padding: 4px 0; font-size: 14px; align-items: baseline; }
.field-label { flex: 0 0 108px; color: var(--muted); font-size: 12.5px; text-transform: uppercase; letter-spacing: 0.04em; }
.field-value { font-weight: 600; overflow-wrap: anywhere; }
.review-note { margin-top: 10px; font-size: 12.5px; color: var(--warn); background: var(--warn-soft); border-radius: 8px; padding: 7px 10px; }
.review-note.ok { color: var(--ok); background: var(--ok-soft); }

.code-chip {
  display: inline-block; font-family: var(--mono); font-size: 12px; font-weight: 700;
  border-radius: 6px; padding: 2px 7px; margin-right: 4px;
}
.code-appealable { background: var(--warn-soft); color: var(--warn); }
.code-final { background: #eef1f5; color: var(--muted); }

.big-number { font-size: 40px; font-weight: 800; letter-spacing: -0.03em; line-height: 1; margin: 6px 0 10px; }
.big-number .unit { font-size: 13px; font-weight: 600; color: var(--muted); margin-left: 8px; letter-spacing: 0; }
.deadline-ok { color: var(--ok); }
.deadline-urgent { color: var(--warn); }
.deadline-expired { color: var(--bad); }

.factor { display: flex; gap: 10px; padding: 6px 0; border-top: 1px dashed var(--line); font-size: 13.5px; }
.factor:first-of-type { margin-top: 8px; }
.factor-pts { flex: 0 0 34px; font-weight: 800; font-family: var(--mono); }
.pts-plus { color: var(--ok); }
.pts-minus { color: var(--bad); }
.pts-zero { color: var(--muted); }

/* strategy chips */
.strategy-chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.chip-strategy {
  font: inherit; font-size: 12.5px; font-weight: 600;
  border: 1px solid var(--line); background: #fff; color: var(--muted);
  border-radius: 999px; padding: 5px 12px; cursor: pointer;
}
.chip-strategy:hover { border-color: var(--accent); color: var(--accent); }
.chip-strategy.chip-active { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }

.letter-empty { padding: 18px 6px; }
.letter-preview {
  border: 1px solid var(--line); border-radius: 10px; background: #fbfcfd;
  padding: 16px 18px; max-height: 480px; overflow: auto;
}
.letter-preview h1 { font-size: 19px; margin: 0 0 10px; }
.letter-preview h2 { font-size: 14.5px; margin: 16px 0 6px; color: var(--accent); }
.letter-preview p { margin: 8px 0; font-size: 13.8px; }
.letter-preview ul { margin: 8px 0; padding-left: 20px; }
.letter-preview li { font-size: 13.5px; margin: 4px 0; }
.letter-editor {
  width: 100%; font-family: var(--mono); font-size: 12.8px; line-height: 1.5;
  border: 1px solid var(--line); border-radius: 10px; padding: 12px;
  background: #fbfcfd; resize: vertical;
}
.letter-editor:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
.letter-actions { display: flex; align-items: center; gap: 10px; margin-top: 10px; flex-wrap: wrap; }

.evidence-list { display: flex; flex-direction: column; gap: 8px; }
.evidence-item {
  display: flex; gap: 10px; align-items: flex-start;
  border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px;
  cursor: pointer; font-size: 13.5px;
}
.evidence-item:hover { border-color: #c6ced8; }
.evidence-item.on { background: var(--accent-soft); border-color: #bfe0db; }
.evidence-item input { margin-top: 3px; accent-color: var(--accent); }

/* approvals */
.approval-card {
  background: linear-gradient(180deg, #fffaf0, #fff);
  border: 1.5px solid #f0c96a; border-radius: var(--radius);
  box-shadow: 0 10px 30px -12px rgba(180, 83, 9, 0.35);
  padding: 16px; margin-bottom: 18px;
}
.approval-title { font-weight: 800; font-size: 15px; margin-bottom: 6px; }
.approval-detail { font-size: 14px; margin-bottom: 8px; }
.approval-note { font-size: 12.5px; color: var(--warn); margin-bottom: 12px; }
.approval-actions { display: flex; gap: 10px; }

/* console */
.console-card { display: flex; flex-direction: column; min-height: 300px; }
.console-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.console-hint { margin: -4px 0 12px; }
.activity-feed { display: flex; flex-direction: column; gap: 8px; max-height: 620px; overflow: auto; padding-right: 2px; }

.feed-card { border-radius: 10px; padding: 9px 12px; font-size: 13.5px; border: 1px solid var(--line); background: #fbfcfd; }
.feed-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.feed-head strong { font-size: 13.5px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); flex: 0 0 auto; }
.tool-error .dot { background: var(--bad); }
.tool-name { margin-top: 2px; }
.feed-card details { margin-top: 6px; }
.feed-card summary { cursor: pointer; color: var(--muted); font-size: 12px; }
.feed-card details div { margin-top: 5px; overflow-wrap: anywhere; white-space: pre-wrap; }
.err { color: var(--bad); }

.actor-chip {
  font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em;
  border-radius: 999px; padding: 1px 7px;
}
.actor-agent { background: var(--accent-soft); color: var(--accent); }
.actor-demo-agent { background: #efe7fd; color: #6d28d9; }
.actor-human { background: var(--blue-soft); color: var(--blue); }

.agent-bubble {
  background: var(--accent-soft); border-color: #cfe8e4; color: #0b5952;
  border-left: 3px solid var(--accent);
}
.user-note { background: var(--blue-soft); border-color: #d4e0fa; border-left: 3px solid var(--blue); }
.system-note { color: var(--muted); font-size: 12.5px; background: transparent; border-style: dashed; }

/* footer */
.footer { border-top: 1px solid var(--line); background: #fff; margin-top: 20px; }
.footer-inner { max-width: 1280px; margin: 0 auto; padding: 22px 24px 30px; font-size: 13px; color: var(--muted); }

/* responsive */
@media (max-width: 1080px) {
  .grid { grid-template-columns: 1fr 1fr; }
  .col:nth-child(3) { grid-column: 1 / -1; }
}
@media (max-width: 720px) {
  .grid { grid-template-columns: 1fr; }
  .hero { padding-top: 36px; }
}
