:root {
  color-scheme: dark;
  font-family: Inter, "Segoe UI", sans-serif;
  color: #f8f2f2;
  background: #0f0e0f;
  --accent: #d94141;
  --accent-text: #ff9999;
  --accent-solid: #b52d2d;
  --accent-soft: #28191b;
  --muted: #c5b2b4;
  --line: #33282b;
  --surface: #171416;
  line-height: 1.5;
  font-size: 15px;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100vh; display: flex; flex-direction: column; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .55; }
button:focus-visible, a:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
a { color: var(--accent-text); }

.topbar { background: var(--surface); border-bottom: 1px solid var(--line); }
.topbar-inner { max-width: 1040px; min-height: 66px; padding: 0 28px; margin: auto; display: flex; align-items: center; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 750; letter-spacing: -.035em; font-size: 19px; }
.brand-mark { display: block; flex: none; width: 36px; height: 36px; border-radius: 10px; object-fit: cover; }

.layout { width: 100%; max-width: 960px; margin: 32px auto 64px; padding: 0 24px; }
.site-footer { margin-top: auto; padding: 16px 24px; border-top: 1px solid var(--line); background: var(--surface); color: var(--muted); font-size: 13px; text-align: center; }
.site-footer strong { color: var(--accent-text); font-weight: 650; }
.intro, .card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 27px 30px; }
.intro { border-top: 6px solid var(--accent); margin-bottom: 16px; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(28px, 5vw, 40px); letter-spacing: -.048em; line-height: 1.17; font-weight: 750; }
h2 { font-size: 25px; letter-spacing: -.035em; line-height: 1.25; }
h3 { font-size: 16px; }
.intro p, .card-lead { margin-top: 8px; color: var(--muted); }
.card-lead { max-width: 65ch; }
.card + .card { margin-top: 14px; }

.steps { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; padding: 18px 0 0; margin: 19px 0 0; border-top: 1px solid var(--line); }
.step { display: flex; align-items: center; gap: 7px; min-height: 36px; border: 0; border-radius: 8px; padding: 5px 9px; background: transparent; color: var(--muted); font-size: 13px; white-space: nowrap; }
.step:not(:disabled):hover { background: #221719; }
.step[aria-current="step"] { color: var(--accent-text); background: var(--accent-soft); font-weight: 700; }
.step-number { display: grid; place-items: center; min-width: 21px; height: 21px; padding: 0 4px; border-radius: 50%; background: #2b2022; font-size: 11px; }
.step[aria-current="step"] .step-number { background: var(--accent-solid); color: white; }

.notice { margin: 0 0 14px; padding: 11px 15px; background: #15251d; border: 1px solid #304b3d; border-radius: 10px; color: #b0ddbe; white-space: pre-line; }
.notice.error { background: #2c181b; border-color: #603941; color: #ffc0c4; }
.notice.busy { background: var(--accent-soft); border-color: #583539; color: var(--accent-text); }
.field { margin-top: 20px; min-width: 0; }
.field-label { display: flex; align-items: center; gap: 8px; margin-bottom: 7px; font-weight: 650; }
.question { width: 21px; height: 21px; padding: 0; display: inline-grid; place-items: center; line-height: 1; border-radius: 50%; border: 1px solid #583a40; background: var(--surface); color: var(--accent-text); font-size: 13px; font-weight: 700; }
.question:hover, .question[aria-expanded="true"] { background: var(--accent-soft); }
.help { margin: 8px 0 12px; padding: 11px 13px; font-size: 14px; white-space: pre-line; color: #e5c2c7; background: #22191b; border-radius: 8px; }
.hint { color: var(--muted); font-size: 13px; margin-top: 7px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
.text-input, select, textarea { background: var(--surface); border: 1px solid #4d3c41; color: inherit; padding: 10px 12px; border-radius: 8px; width: 100%; min-height: 43px; }
.text-input:focus, select:focus, textarea:focus { outline: 2px solid #e77c82; border-color: var(--accent); }
textarea { min-height: 91px; resize: vertical; }
input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--accent); flex: none; }

.actions { display: flex; align-items: center; gap: 8px; justify-content: flex-end; flex-wrap: wrap; margin-top: 23px; }
.actions .push { margin-right: auto; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 8px 14px; min-height: 41px; border: 1px solid transparent; border-radius: 8px; background: transparent; color: var(--accent-text); font-weight: 650; font-size: 14px; }
.button:hover:not(:disabled) { background: var(--accent-soft); }
.button.secondary { background: var(--surface); border-color: #573b3f; }
.button.primary { color: white; background: var(--accent-solid); }
.button.primary:hover:not(:disabled) { background: #a6282e; }

.choices { display: grid; gap: 9px; grid-template-columns: repeat(auto-fit, minmax(135px, 1fr)); margin-top: 17px; }
.choice { min-height: 47px; text-align: left; padding: 10px 13px; border: 1px solid #403035; border-radius: 9px; background: var(--surface); color: var(--muted); }
.choice[aria-pressed="true"] { border-color: var(--accent); color: var(--accent-text); background: #2b1b1e; font-weight: 700; }
.choice:hover { border-color: var(--accent); }

.table { margin-top: 16px; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.table-head, .table-row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; }
.table-head { min-height: 40px; background: #21191c; font-size: 13px; color: var(--muted); }
.table-body { max-height: 330px; overflow: auto; }
.table-row { min-height: 49px; border-top: 1px solid var(--line); }
.row-name { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.row-meta { flex: none; color: var(--muted); font-size: 13px; max-width: 40%; overflow-wrap: anywhere; }
.row-pill { display: inline-block; font-size: 12px; padding: 3px 8px; border-radius: 6px; background: #312529; color: var(--muted); }
.row-pill.ready { color: #b0ddbe; background: #15251d; }
.row-pill.review { color: #ffcc91; background: #36251a; }
.item-fields { max-height: 340px; overflow: auto; }
.item-fields .field { margin-top: 12px; }

.preview { margin-top: 14px; background: #21191c; border: 1px solid var(--line); border-radius: 10px; padding: 13px 15px; overflow-wrap: anywhere; }
.preview p { color: var(--muted); margin-top: 5px; white-space: pre-wrap; }
.preview pre { font-family: "IBM Plex Mono", Consolas, monospace; white-space: pre-wrap; overflow-wrap: anywhere; margin: 8px 0 0; font-size: 13px; }
.summary { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
details.review-item { margin-top: 9px; padding: 11px 13px; border: 1px solid var(--line); border-radius: 9px; }
details.review-item summary { cursor: pointer; }
details .review-line { display: inline-flex; width: calc(100% - 20px); align-items: center; gap: 9px; vertical-align: middle; }
.item-details { margin: 10px 0 0; color: var(--muted); overflow-wrap: anywhere; white-space: pre-line; }
dialog { width: min(515px, calc(100% - 24px)); max-height: calc(100% - 24px); padding: 24px; border-radius: 14px; border: 1px solid var(--line); color: inherit; background: var(--surface); }
dialog::backdrop { background: #080608b8; }

@media (max-width: 600px) {
  .layout { margin-top: 17px; padding-inline: 12px; }
  .intro, .card { padding-inline: 16px; }
  .topbar-inner { min-height: 57px; padding: 0 14px; }
  .steps { gap: 4px; }
  .step { padding: 4px 6px; }
  .form-grid { grid-template-columns: 1fr; }
  .review-line .row-pill { max-width: 40%; }
}
