:root {
  --bg: #f4f6f9;
  --panel: #ffffff;
  --ink: #172033;
  --muted: #667085;
  --line: #d9e0eb;
  --soft: #eef3f8;
  --accent: #214f83;
  --accent-strong: #163b64;
  --good: #1f7a55;
  --warn: #9a5b00;
  --danger: #9f2f2f;
  --shadow: 0 18px 50px rgba(20, 35, 60, .10);
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: radial-gradient(circle at top left, #e7eef7, transparent 34rem), var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans KR", sans-serif;
}
button, input, textarea, select { font: inherit; }
.app-shell { width: min(1440px, calc(100% - 32px)); margin: 0 auto; padding: 28px 0 64px; }
.hero, .workbench, .result-grid, .save-grid, .delivery-section, .scenario-strip, .tech-details {
  background: rgba(255,255,255,.92);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  border-radius: 26px;
}
.hero { display: grid; grid-template-columns: 1fr 320px; gap: 24px; padding: 34px; align-items: stretch; }
.eyebrow, .section-kicker, .section-title p { margin: 0 0 8px; color: var(--accent); font-weight: 800; letter-spacing: -.02em; }
h1 { margin: 0; font-size: clamp(32px, 4vw, 56px); line-height: 1.05; letter-spacing: -.06em; }
.lead { max-width: 790px; margin: 18px 0 0; color: var(--muted); font-size: 18px; line-height: 1.7; }
.hero-panel { display: flex; flex-direction: column; gap: 12px; justify-content: center; padding: 24px; border-radius: 22px; background: linear-gradient(145deg, #123252, #286293); color: #fff; }
.hero-panel strong { font-size: 28px; letter-spacing: -.04em; }
.hero-panel small { color: rgba(255,255,255,.78); line-height: 1.6; }
.state-pill, .mini-status, .risk-badge { display: inline-flex; width: fit-content; align-items: center; border-radius: 999px; padding: 8px 12px; font-weight: 800; font-size: 13px; }
.state-pill { background: rgba(255,255,255,.16); }
.stepper { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; margin: 18px 0; }
.step { display: flex; gap: 10px; align-items: center; padding: 14px 16px; border: 1px solid var(--line); border-radius: 18px; background: rgba(255,255,255,.74); color: var(--muted); }
.step span { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--soft); font-weight: 900; }
.step.active { color: var(--ink); border-color: #7ea7cf; background: #eef6ff; }
.step.done { color: var(--good); border-color: #a7dcc6; background: #f1fbf6; }
.scenario-strip { margin: 18px 0; padding: 24px; display: grid; grid-template-columns: 280px 1fr; gap: 20px; align-items: center; }
.scenario-strip h2, .section-title h2, .delivery-section h2 { margin: 0; letter-spacing: -.04em; }
.scenario-buttons { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.scenario-btn { border: 1px solid var(--line); background: #fff; color: var(--ink); border-radius: 18px; padding: 16px; text-align: left; cursor: pointer; transition: .18s ease; }
.scenario-btn:hover, .scenario-btn.active { transform: translateY(-2px); border-color: #6fa1cf; box-shadow: 0 12px 28px rgba(33,79,131,.14); }
.scenario-btn strong { display: block; margin-bottom: 6px; }
.scenario-btn span { color: var(--muted); font-size: 14px; }
.workbench { display: grid; grid-template-columns: minmax(420px, .92fr) 1.08fr; gap: 18px; padding: 18px; }
.input-pane, .case-pane, .draft-card, .review-card, .save-preview, .history-card { background: #fff; border: 1px solid var(--line); border-radius: 22px; padding: 22px; }
label { display: grid; gap: 8px; color: #374151; font-weight: 800; margin-top: 14px; }
input, textarea, select { width: 100%; border: 1px solid var(--line); border-radius: 14px; padding: 13px 14px; background: #fbfcfe; color: var(--ink); outline: none; }
input:focus, textarea:focus, select:focus { border-color: #6fa1cf; box-shadow: 0 0 0 4px rgba(111,161,207,.14); }
textarea { resize: vertical; line-height: 1.6; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
button { border: 0; border-radius: 14px; padding: 13px 16px; background: var(--accent); color: #fff; font-weight: 900; cursor: pointer; transition: .16s ease; }
button:hover { background: var(--accent-strong); transform: translateY(-1px); }
button.secondary { color: var(--accent); background: #e8f1fa; }
button.save { background: var(--good); }
button.wide { width: 100%; margin-top: 16px; }
.notice { margin: 16px 0 0; color: var(--muted); background: var(--soft); border-radius: 16px; padding: 14px; line-height: 1.6; }
.row-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.mini-status { background: #eef3f8; color: var(--muted); }
.mini-status.active { background: #fff3d8; color: var(--warn); }
.mini-status.done { background: #eaf8f0; color: var(--good); }
.case-list { display: grid; gap: 14px; }
.case-card { border: 1px solid var(--line); background: #fbfcfe; border-radius: 18px; padding: 16px; opacity: .74; transform: translateY(4px); transition: .2s ease; }
.case-card.visible { opacity: 1; transform: translateY(0); }
.case-card header { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.case-card h3 { margin: 8px 0; letter-spacing: -.03em; }
.case-card p { margin: 0; color: var(--muted); line-height: 1.6; }
.case-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.case-meta span { border-radius: 999px; background: #eef3f8; padding: 7px 10px; font-weight: 800; font-size: 13px; color: #334155; }
.result-grid { display: grid; grid-template-columns: 1.32fr .68fr; gap: 18px; padding: 18px; margin-top: 18px; }
.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; min-width: 780px; }
th, td { border-bottom: 1px solid var(--line); padding: 14px 12px; text-align: left; vertical-align: top; }
th { color: var(--muted); font-size: 13px; background: #f8fafc; }
td { line-height: 1.6; }
.risk-badge { background: #eef3f8; color: var(--muted); }
.risk-badge.low { background: #eaf8f0; color: var(--good); }
.risk-badge.mid { background: #fff3d8; color: var(--warn); }
.risk-badge.high { background: #fdeaea; color: var(--danger); }
.review-controls { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.compare-box { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.compare-box div { background: var(--soft); border-radius: 16px; padding: 14px; }
.compare-box span { display: block; color: var(--muted); font-size: 13px; font-weight: 800; margin-bottom: 6px; }
.compare-box strong { font-size: 20px; letter-spacing: -.03em; }
.save-grid { display: grid; grid-template-columns: 1.12fr .88fr; gap: 18px; padding: 18px; margin-top: 18px; }
pre { white-space: pre-wrap; overflow: auto; min-height: 190px; margin: 0; padding: 18px; border-radius: 18px; background: #0f172a; color: #e2e8f0; line-height: 1.7; }
.history-list { display: grid; gap: 10px; padding: 0; margin: 0; list-style: none; }
.history-list li { padding: 13px; border: 1px solid var(--line); border-radius: 14px; background: #fbfcfe; line-height: 1.5; }
.delivery-section { display: grid; grid-template-columns: .7fr 1.3fr; gap: 24px; margin-top: 18px; padding: 28px; }
.delivery-section p { color: var(--muted); line-height: 1.7; }
.delivery-list { display: grid; gap: 10px; margin: 0; padding: 0; counter-reset: item; list-style: none; }
.delivery-list li { display: grid; grid-template-columns: 130px 1fr; gap: 12px; align-items: start; border: 1px solid var(--line); background: #fbfcfe; border-radius: 16px; padding: 15px; }
.delivery-list span { color: var(--muted); line-height: 1.5; }
.tech-details { margin-top: 18px; padding: 22px; }
.tech-details summary { cursor: pointer; font-weight: 900; color: var(--accent); }
.tech-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-top: 16px; }
.tech-grid div { display: grid; gap: 8px; border: 1px solid var(--line); border-radius: 16px; padding: 14px; background: #fbfcfe; }
.tech-grid span { color: var(--muted); line-height: 1.5; }
body.is-loading .case-card { opacity: .45; }
body.has-generated .draft-card, body.has-saved .save-preview { border-color: #7db79d; box-shadow: 0 0 0 4px rgba(31,122,85,.08); }
@media (max-width: 1080px) {
  .hero, .scenario-strip, .workbench, .result-grid, .save-grid, .delivery-section { grid-template-columns: 1fr; }
  .stepper { grid-template-columns: 1fr 1fr; }
  .scenario-buttons, .tech-grid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .app-shell { width: min(100% - 20px, 1440px); padding-top: 12px; }
  .hero, .scenario-strip, .workbench, .result-grid, .save-grid, .delivery-section { padding: 14px; border-radius: 18px; }
  h1 { font-size: 30px; }
  .two-col, .review-controls, .compare-box, .stepper { grid-template-columns: 1fr; }
  .actions button { width: 100%; }
}


.document-cta {
  display: grid;
  gap: 6px;
  margin-top: 14px;
}
.doc-download {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 10px 14px;
  border-radius: 6px;
  background: #245c4f;
  color: #fff;
  font-weight: 800;
  text-decoration: none;
}
.document-cta small {
  color: #53606f;
}
.document-section {
  margin-top: 16px;
  padding: 16px;
  border: 1px solid #d9e0e8;
  border-radius: 8px;
  background: #fff;
}
.secondary-doc {
  width: fit-content;
  margin-top: 8px;
}
