:root {
  color-scheme: light;
  --ink: #15252b;
  --muted: #5c6b70;
  --line: #ccd5d6;
  --surface: #ffffff;
  --surface-soft: #eef2f1;
  --canvas: #e6ecea;
  --navy: #123d4a;
  --navy-deep: #092b35;
  --blue: #0d5f78;
  --blue-light: #d8edf3;
  --green: #25643f;
  --green-light: #dfeee5;
  --amber: #8a5a10;
  --amber-light: #fff0d0;
  --red: #9f332d;
  --red-light: #f9dfdc;
  --shadow: 0 12px 35px rgb(21 37 43 / 10%);
  font-family: "Aptos", "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--canvas); }
body { margin: 0; color: var(--ink); background: linear-gradient(180deg, #f5f7f6 0, var(--canvas) 34rem); }
button, input, select, textarea { font: inherit; }
button, a, input, select, textarea, summary { outline-offset: 3px; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible { outline: 3px solid #f1bd4d; }
[hidden] { display: none !important; }

.shell, .topbar-inner, .footer-inner { width: min(1520px, calc(100% - 48px)); margin-inline: auto; }
.topbar { background: var(--navy-deep); color: white; border-bottom: 4px solid #e9b949; }
.topbar-inner { min-height: 74px; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.brand { display: flex; align-items: center; gap: 12px; color: white; text-decoration: none; }
.brand-mark { width: 42px; height: 42px; display: grid; place-items: center; background: #e9b949; color: var(--navy-deep); font-weight: 900; border-radius: 6px; letter-spacing: .04em; }
.brand div { display: grid; gap: 2px; }
.brand small { color: #c5d7db; }
.header-badges { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }

.hero { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(320px, .65fr); gap: 48px; align-items: end; padding: 52px 0 36px; }
.hero-copy { max-width: 820px; }
.eyebrow { margin: 0 0 8px; color: var(--blue); font-size: .78rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
h1, h2, h3, p { margin-top: 0; }
h1 { max-width: 920px; margin-bottom: 18px; font-size: clamp(2.1rem, 4vw, 4.6rem); line-height: .99; letter-spacing: -.045em; }
.hero-copy > p:last-child { max-width: 760px; margin: 0; color: var(--muted); font-size: 1.13rem; line-height: 1.65; }
.hero-flow { display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid var(--line); background: rgb(255 255 255 / 72%); box-shadow: var(--shadow); }
.hero-flow div { padding: 22px 18px; display: grid; gap: 6px; border-right: 1px solid var(--line); }
.hero-flow div:last-child { border-right: 0; }
.hero-flow strong { color: var(--blue); font-size: 1.5rem; }
.hero-flow span { font-weight: 750; }

.workspace-grid { display: grid; grid-template-columns: minmax(390px, .78fr) minmax(560px, 1.45fr); gap: 22px; align-items: start; padding-bottom: 48px; }
.control-column { display: grid; gap: 22px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); padding: clamp(20px, 2.2vw, 30px); }
.draft-panel { position: sticky; top: 18px; min-height: 720px; }
.section-heading h2 { margin-bottom: 9px; font-size: 1.35rem; }
.section-heading p:last-child { margin: 0; color: var(--muted); line-height: 1.55; }
.heading-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 18px; margin-bottom: 22px; }

.badge { display: inline-flex; min-height: 30px; align-items: center; padding: 5px 10px; border: 1px solid transparent; border-radius: 999px; font-size: .78rem; font-weight: 800; white-space: nowrap; }
.badge-neutral { color: #31464c; background: #e5ebec; border-color: #c7d2d4; }
.badge-success { color: var(--green); background: var(--green-light); border-color: #a8cbb5; }
.badge-warning { color: var(--amber); background: var(--amber-light); border-color: #e9c574; }
.badge-running { color: var(--blue); background: var(--blue-light); border-color: #95c8d5; }
.badge-danger { color: var(--red); background: var(--red-light); border-color: #dfa49e; }

.choice-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 22px 0 14px; }
.choice-card { display: flex; gap: 12px; min-height: 92px; padding: 15px; border: 1px solid var(--line); background: var(--surface-soft); cursor: pointer; }
.choice-card:has(input:checked) { border: 2px solid var(--blue); padding: 14px; background: var(--blue-light); }
.choice-card input { width: 20px; height: 20px; margin: 2px 0 0; }
.choice-card span { display: grid; align-content: start; gap: 6px; }
.choice-card small { color: var(--muted); line-height: 1.35; }
.notice { padding: 16px; border-left: 4px solid; line-height: 1.5; }
.notice p { margin-bottom: 12px; }
.notice-warning { background: var(--amber-light); border-color: #d0922f; }
.consent-row { display: flex; gap: 10px; align-items: flex-start; font-weight: 700; }
.consent-row input { flex: 0 0 20px; width: 20px; height: 20px; margin-top: 2px; }
.provider-fields, .review-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.provider-fields .field:first-child { grid-column: 1 / -1; }

.field { display: grid; gap: 7px; }
.field-label { font-weight: 760; }
.field-hint { color: var(--muted); line-height: 1.4; }
input, select, textarea { width: 100%; min-height: 46px; border: 1px solid #aebbbc; border-radius: 5px; background: white; color: var(--ink); padding: 10px 12px; }
textarea { min-height: 128px; resize: vertical; line-height: 1.5; }
input:disabled, textarea:disabled { background: #edf1f0; }
.assistant-panel > .field { margin-top: 18px; }
.action-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.button { min-height: 46px; border: 1px solid transparent; border-radius: 5px; padding: 10px 16px; font-weight: 800; cursor: pointer; }
.button-primary { color: white; background: var(--blue); border-color: var(--blue); }
.button-primary:hover { background: #084b60; }
.button-secondary { color: var(--navy); background: white; border-color: #9eb0b3; }
.button-secondary:hover { background: var(--surface-soft); }
.button-danger { color: var(--red); background: var(--red-light); border-color: #d38e87; }
.button-locked { color: #6e7779; background: #e5e9e8; border-color: #c9d0d0; cursor: not-allowed; }
.button:disabled { opacity: .62; cursor: not-allowed; }
.feedback { min-height: 0; margin-top: 14px; padding: 0; line-height: 1.5; }
.feedback:not(:empty) { padding: 13px 14px; border-left: 4px solid; }
.feedback-success { background: var(--green-light); border-color: var(--green); }
.feedback-warning { background: var(--amber-light); border-color: var(--amber); }
.feedback-danger { background: var(--red-light); border-color: var(--red); }
.inline-question { margin-top: 18px; padding: 17px; border: 1px solid #d7ac55; background: #fff8e8; }
.inline-question h3 { margin-bottom: 6px; }
.inline-question p:not(.eyebrow) { color: var(--muted); }

.phase-line { display: flex; gap: 13px; align-items: center; min-height: 66px; padding: 13px; background: var(--surface-soft); border-left: 4px solid #89999c; }
.phase-line div { display: grid; gap: 4px; }
.phase-line small { color: var(--muted); }
.phase-running { border-color: var(--blue); background: var(--blue-light); }
.phase-success { border-color: var(--green); background: var(--green-light); }
.phase-danger { border-color: var(--red); background: var(--red-light); }
.status-dot { width: 13px; height: 13px; flex: 0 0 13px; border-radius: 50%; background: currentColor; }
.phase-running .status-dot { animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { opacity: .3; transform: scale(.78); } }
.step-list { display: grid; gap: 8px; padding: 0; margin: 16px 0; list-style: none; }
.step-list li { display: flex; gap: 10px; align-items: center; padding: 10px 12px; border: 1px solid #d6dede; background: #f8faf9; }
.step-list li > span:first-child { display: grid; place-items: center; width: 24px; height: 24px; color: white; background: var(--green); border-radius: 50%; font-weight: 900; }
.diagnostics { margin-top: 16px; border-top: 1px solid var(--line); padding-top: 14px; }
.diagnostics summary { cursor: pointer; font-weight: 800; }
.diagnostics > p { margin: 10px 0; color: var(--muted); font-size: .9rem; }
.diagnostic-log { padding-left: 22px; color: var(--muted); }
.diagnostic-log li { margin-bottom: 7px; }
.diagnostic-log time { display: inline-block; width: 56px; color: var(--blue); font-variant-numeric: tabular-nums; }
.diagnostic-log small { display: block; margin-left: 56px; }

.draft-metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; margin: 4px 0 24px; background: var(--line); border: 1px solid var(--line); }
.draft-metric { display: grid; gap: 7px; padding: 17px; background: var(--surface-soft); }
.draft-metric span, .task-label { color: var(--muted); font-size: .8rem; font-weight: 760; text-transform: uppercase; letter-spacing: .05em; }
.draft-metric strong { font-size: 1.15rem; }
.draft-content { min-height: 250px; }
.empty-copy { display: grid; place-items: center; min-height: 160px; margin: 0; border: 1px dashed #9eaeaf; color: var(--muted); text-align: center; padding: 24px; }
.task-stack { display: grid; gap: 9px; }
.task-card { display: grid; grid-template-columns: 46px minmax(110px, 1fr) minmax(120px, 1fr) auto; gap: 16px; align-items: center; border: 1px solid var(--line); border-left: 5px solid var(--blue); padding: 14px 16px; background: #fbfcfc; }
.task-card > div:not(.task-order) { display: grid; gap: 4px; }
.task-order { width: 38px; height: 38px; display: grid; place-items: center; color: white; background: var(--navy); font-weight: 900; }
.checkpoint { display: flex; gap: 13px; align-items: center; margin-top: 12px; padding: 14px 16px; background: var(--amber-light); border: 1px solid #e3bf73; }
.checkpoint p { margin: 4px 0 0; color: #67450f; }
.checkpoint-icon { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; color: white; background: var(--amber); font-weight: 900; }
.checkpoint-empty { margin-top: 12px; color: var(--muted); }
.review-box { margin-top: 26px; border-top: 4px solid var(--navy); background: var(--surface-soft); padding: 22px; }
.review-box h3 { margin-bottom: 8px; }
.review-box > p:not(.eyebrow) { color: var(--muted); line-height: 1.55; }
.review-form { margin-top: 20px; }
.review-tasks { display: grid; gap: 10px; margin-top: 14px; }
.review-task { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; border: 1px solid var(--line); background: white; padding: 14px; }
.review-task legend { padding: 0 6px; font-weight: 800; }
.checkpoint-edit { margin-top: 14px; }
.human-decision { margin-top: 18px !important; padding: 13px; color: var(--ink) !important; background: var(--amber-light); border-left: 4px solid var(--amber); font-weight: 700; }

.site-footer { background: var(--navy-deep); color: #d7e4e6; }
.footer-inner { min-height: 82px; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.footer-inner p { margin: 0; }
.footer-inner a { color: white; font-weight: 800; }

@media (max-width: 1050px) {
  .hero { grid-template-columns: 1fr; gap: 26px; }
  .workspace-grid { grid-template-columns: 1fr; }
  .draft-panel { position: static; min-height: 0; }
}

@media (max-width: 680px) {
  .shell, .topbar-inner, .footer-inner { width: min(100% - 24px, 1520px); }
  .topbar-inner { min-height: 68px; }
  .header-badges .badge-neutral { display: none; }
  .brand small { display: none; }
  .hero { padding: 34px 0 24px; }
  h1 { font-size: clamp(2rem, 10vw, 3rem); }
  .hero-flow { grid-template-columns: 1fr; }
  .hero-flow div { grid-template-columns: 32px 1fr; align-items: center; border-right: 0; border-bottom: 1px solid var(--line); padding: 12px 14px; }
  .hero-flow div:last-child { border-bottom: 0; }
  .workspace-grid, .control-column { gap: 12px; }
  .panel { padding: 18px 14px; border-radius: 5px; }
  .heading-row { display: grid; gap: 12px; }
  .choice-grid, .provider-fields, .review-grid, .review-task { grid-template-columns: 1fr; }
  .draft-metrics { grid-template-columns: 1fr 1fr 1fr; }
  .draft-metric { padding: 12px 9px; }
  .draft-metric strong { font-size: .95rem; }
  .task-card { grid-template-columns: 40px 1fr auto; gap: 10px; padding: 12px 10px; }
  .task-card > div:nth-child(3) { grid-column: 2 / 3; }
  .task-card > .badge { grid-column: 3; grid-row: 1; }
  .action-row .button { flex: 1 1 150px; }
  .footer-inner { display: grid; padding-block: 18px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
