:root {
  --navy: #173f6d;
  --navy-strong: #0d2c50;
  --blue-soft: #edf5ff;
  --green: #08745b;
  --green-soft: #e9f8f3;
  --red: #b4232f;
  --yellow: #fff8d9;
  --ink: #202635;
  --muted: #697386;
  --line: #dce2ea;
  --surface: #ffffff;
  --background: #f5f7fa;
  --shadow: 0 10px 30px rgba(20, 48, 82, 0.08);
  --radius: 18px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body { margin: 0; font-family: "Malgun Gothic", "Apple SD Gothic Neo", sans-serif; color: var(--ink); background: var(--background); line-height: 1.55; }
button, input, select, textarea { font: inherit; }
button, select { cursor: pointer; }
textarea { resize: vertical; }
.skip-link { position: fixed; top: -60px; left: 16px; padding: 10px 14px; background: #fff; color: var(--navy); z-index: 100; }
.skip-link:focus { top: 12px; }

.app-header { background: linear-gradient(135deg, var(--navy-strong), var(--navy)); color: #fff; padding: 30px max(22px, calc((100vw - 1180px) / 2)); }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.eyebrow { margin: 0 0 5px; color: #b9d8fb; font-weight: 700; letter-spacing: .08em; font-size: .82rem; }
h1 { font-size: clamp(1.8rem, 4vw, 2.55rem); line-height: 1.2; margin: 0; letter-spacing: -.035em; }
.privacy-summary { max-width: 850px; margin: 18px 0 0; color: #e7f1fc; }
.privacy-badge { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; border: 1px solid rgba(255,255,255,.34); border-radius: 999px; padding: 9px 14px; background: rgba(255,255,255,.1); font-weight: 700; font-size: .9rem; }
.privacy-dot { width: 10px; height: 10px; border-radius: 50%; background: #69e2b8; box-shadow: 0 0 0 4px rgba(105,226,184,.16); }

.layout { max-width: 1180px; margin: 0 auto; padding: 24px 22px 72px; }
.step-nav { display: flex; gap: 8px; overflow-x: auto; margin-bottom: 18px; scrollbar-width: thin; }
.step-nav a { flex: 1 0 auto; text-align: center; text-decoration: none; color: var(--navy); border: 1px solid var(--line); border-radius: 12px; background: #fff; padding: 11px 14px; font-weight: 700; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.section-card { padding: clamp(20px, 3vw, 32px); margin-bottom: 20px; scroll-margin-top: 16px; }
.section-heading { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 24px; }
.section-heading.compact { margin-bottom: 16px; }
.section-heading h2, .output-card h2 { margin: 0; font-size: 1.45rem; letter-spacing: -.02em; }
.section-heading p { margin: 4px 0 0; color: var(--muted); }
.step-number { display: inline-grid; place-items: center; width: 36px; height: 36px; flex: 0 0 36px; border-radius: 11px; background: var(--navy); color: #fff; font-weight: 800; }

.form-grid { display: grid; gap: 16px; }
.two-col { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.field { display: flex; flex-direction: column; gap: 7px; min-width: 0; font-weight: 700; }
.field.full { grid-column: 1 / -1; }
.field > span { font-size: .94rem; }
.field b { color: var(--red); }
.field input, .field select, .field textarea, #classification-request { width: 100%; border: 1px solid #cbd3df; border-radius: 11px; background: #fff; color: var(--ink); padding: 12px 13px; font-weight: 400; }
.field input:focus, .field select:focus, .field textarea:focus, #classification-request:focus { outline: 3px solid rgba(42,116,190,.18); border-color: #2a74be; }
.field-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.subpanel { margin-top: 18px; padding: 18px; border-radius: 14px; background: var(--blue-soft); border: 1px solid #d3e6fb; }
.subpanel-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 4px 0 14px; }
.subpanel-heading h3, .subpanel-heading h4 { margin: 0; }
.travel-stops { display: grid; gap: 14px; }
.card-inset { padding: 16px; border: 1px solid #c8daef; border-radius: 14px; background: rgba(255,255,255,.85); }
.validation-message { margin: 14px 0 0; color: var(--red); font-weight: 700; }
.notice { margin-top: 14px; border: 1px solid #eadf9f; border-radius: 12px; background: var(--yellow); }
.compact-notice { padding: 14px; }
.compact-notice p { margin: 8px 0 0; color: #6b5a08; font-size: .88rem; }
hr { border: 0; border-top: 1px solid var(--line); margin: 28px 0; }

.question-actions { display: flex; justify-content: flex-end; margin: -10px 0 12px; }
.question-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.question-columns h3 { margin: 0 0 12px; color: var(--navy); }
.question-list { display: grid; gap: 12px; }
.question-item { min-width: 0; border: 1px solid var(--line); border-radius: 13px; padding: 15px; margin: 0; background: #fbfcfe; }
.question-text { width: 100%; padding: 0; font-weight: 700; }
.question-note { margin: 6px 0 10px; color: var(--muted); font-size: .86rem; }
.answer-options { display: flex; gap: 7px; flex-wrap: wrap; }
.answer-chip { position: relative; }
.answer-chip input { position: absolute; opacity: 0; pointer-events: none; }
.answer-chip span { display: inline-block; border: 1px solid #cbd3df; border-radius: 999px; padding: 7px 10px; background: #fff; font-size: .88rem; font-weight: 600; }
.answer-chip input:checked + span { border-color: var(--navy); background: var(--navy); color: #fff; }
.answer-chip input:focus-visible + span { outline: 3px solid rgba(42,116,190,.25); }
.question-item.auto-locked { background: var(--green-soft); border-color: #9bd2c1; }
.check-field { display: flex; gap: 10px; align-items: flex-start; margin-top: 18px; font-weight: 700; }
.check-field input { margin-top: 4px; width: 18px; height: 18px; }

.result-layout { display: grid; grid-template-columns: minmax(0,.9fr) minmax(0,1.1fr); gap: 20px; margin-bottom: 20px; scroll-margin-top: 16px; }
.result-card, .output-card { padding: clamp(20px, 3vw, 28px); }
.assessment { border-left: 5px solid var(--navy); background: var(--blue-soft); border-radius: 10px; padding: 15px 16px; margin-bottom: 14px; }
.assessment[data-grade="A"] { border-color: var(--red); background: #fff0f1; }
.assessment[data-grade="C"] { border-color: var(--green); background: var(--green-soft); }
.assessment h3 { margin: 0 0 6px; font-size: 1.18rem; }
.assessment p { margin: 4px 0; }
.assessment-action { margin-top: 12px !important; padding-top: 11px; border-top: 1px solid rgba(23,63,109,.18); font-weight: 700; }
details { border: 1px solid var(--line); border-radius: 12px; background: #fff; }
summary { cursor: pointer; padding: 13px 15px; font-weight: 700; }
.details-body { padding: 0 15px 15px; }
#classification-request { margin-top: 12px; min-height: 330px; line-height: 1.55; background: #fbfcfe; }

.local-identifiers { background: var(--yellow); border-color: #eadf9f; }
.local-identifiers .details-body { padding-top: 6px; }
.form-subheading { margin: 12px 0 -2px; padding-bottom: 7px; border-bottom: 1px solid #e4d98f; color: var(--navy); font-size: 1rem; }
.document-actions, .button-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.button { border: 0; border-radius: 11px; padding: 11px 15px; font-weight: 800; }
.button.primary { color: #fff; background: var(--navy); }
.button.secondary { color: var(--navy); background: #e7f1fc; }
.button.ghost { color: var(--navy); background: transparent; border: 1px solid #bdcbe0; }
.button.danger { color: var(--red); background: #fff0f1; }
.button.small { padding: 7px 10px; font-size: .86rem; }
.button:disabled { opacity: .5; cursor: not-allowed; }
.status-line { min-height: 1.4em; margin: 12px 0 0; color: var(--muted); }

@media (max-width: 820px) {
  .header-inner { align-items: flex-start; flex-direction: column; }
  .privacy-badge { align-self: flex-start; }
  .two-col, .question-columns, .result-layout { grid-template-columns: 1fr; }
  .field.full { grid-column: auto; }
}

@media (max-width: 520px) {
  .app-header { padding: 22px 18px; }
  .layout { padding: 16px 12px 52px; }
  .section-card, .result-card, .output-card { padding: 18px 15px; border-radius: 14px; }
  .step-nav a { font-size: .84rem; padding: 9px 10px; }
  .field-pair { grid-template-columns: 1fr; }
  .answer-options { gap: 5px; }
  .answer-chip span { padding: 8px 9px; }
  .document-actions .button { width: 100%; }
}

@media print {
  .app-header, .step-nav, .button, .privacy-summary { display: none !important; }
  body { background: #fff; }
  .layout { max-width: none; padding: 0; }
  .card { box-shadow: none; break-inside: avoid; }
}
