:root {
  --navy: #0b1f3a;
  --navy-2: #17385f;
  --ink: #172033;
  --muted: #667085;
  --line: #d9e1eb;
  --soft: #f4f7fb;
  --white: #ffffff;
  --emerald: #087a5b;
  --emerald-soft: #eaf8f3;
  --gold: #a56d12;
  --gold-soft: #fff7e7;
  --danger: #b42318;
  --danger-soft: #fff0ee;
  --shadow: 0 18px 45px rgba(16, 33, 56, 0.09);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background: linear-gradient(180deg, #edf3f9 0, #f8fafc 320px, #f5f7fa 100%);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.55;
}
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }

.site-header {
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
  color: white;
  background: var(--navy);
}
.header-inner {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 22px 0;
  display: flex;
  align-items: center;
  gap: 14px;
}
.brand-mark {
  width: 48px;
  height: 48px;
  border-radius: 15px;
  display: grid;
  place-items: center;
  flex: 0 0 48px;
  color: var(--navy);
  background: white;
  font-weight: 900;
  letter-spacing: -0.04em;
}
.site-header h1 { margin: 1px 0 0; font-size: clamp(1.2rem, 2.5vw, 1.6rem); line-height: 1.2; }
.eyebrow, .section-kicker {
  margin: 0;
  color: #b6c6db;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.page-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 30px auto 56px;
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 28px;
  align-items: start;
}
.form-guide {
  position: sticky;
  top: 24px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow);
}
.form-guide .section-kicker, .intro-card .section-kicker, .form-section .section-kicker, .success-panel .section-kicker { color: var(--gold); }
.form-guide h2, .intro-card h2, .form-section h2, .success-panel h2 { margin: 4px 0 8px; line-height: 1.25; color: var(--navy); }
.form-guide p { margin: 0; color: var(--muted); }
.section-nav { margin: 22px 0; display: grid; gap: 8px; }
.section-nav a {
  padding: 9px 10px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  border-radius: 12px;
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 700;
}
.section-nav a:hover, .section-nav a:focus-visible { color: var(--navy); background: var(--soft); outline: none; }
.section-nav span { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; color: white; background: var(--navy); font-size: 0.76rem; }
.privacy-note { padding: 15px; border: 1px solid #bce7d9; border-radius: 16px; background: var(--emerald-soft); }
.privacy-note strong { color: var(--emerald); }
.privacy-note p { margin-top: 4px; font-size: 0.86rem; }

.form-column { min-width: 0; }
.intro-card, .form-section, .submit-section, .success-panel {
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--white);
  box-shadow: var(--shadow);
}
.intro-card { padding: 24px 28px; margin-bottom: 18px; }
.intro-card p:last-child { margin: 0; color: var(--muted); }
.form-section { padding: 28px; margin-bottom: 18px; scroll-margin-top: 20px; }
.section-heading { margin-bottom: 22px; display: flex; gap: 14px; align-items: center; }
.section-heading.with-action { justify-content: space-between; }
.heading-pair { display: flex; gap: 14px; align-items: center; }
.section-heading h2 { margin-bottom: 0; }
.step-number { width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center; flex: 0 0 42px; color: white; background: var(--navy); font-weight: 900; }
.section-copy { margin: -10px 0 20px; color: var(--muted); }

.field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.field-wide { grid-column: 1 / -1; }
.field { display: grid; gap: 7px; min-width: 0; }
.field > span, fieldset legend { color: #344054; font-size: 0.9rem; font-weight: 800; }
.field b, fieldset b { color: var(--danger); }
.field small { color: var(--muted); font-size: 0.8rem; }
.compact-field { max-width: 260px; }
input, select, textarea {
  width: 100%;
  min-height: 48px;
  padding: 11px 13px;
  border: 1px solid #cbd5e1;
  border-radius: 13px;
  color: var(--ink);
  background: white;
  outline: none;
  transition: border-color 0.18s, box-shadow 0.18s, background 0.18s;
}
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: #4b77a8; box-shadow: 0 0 0 4px rgba(75, 119, 168, 0.13); }
input:disabled, select:disabled, textarea:disabled { color: #78869a; background: #f2f4f7; cursor: not-allowed; }
input[aria-invalid="true"], select[aria-invalid="true"], textarea[aria-invalid="true"] { border-color: var(--danger); box-shadow: 0 0 0 3px rgba(180, 35, 24, 0.1); }
.form-trap { position: fixed !important; left: -10000px !important; width: 1px !important; height: 1px !important; opacity: 0 !important; }

.rule-note, .warning-note, .field-status, .calculation-check {
  margin: 14px 0 18px;
  padding: 12px 14px;
  border-radius: 13px;
  font-size: 0.88rem;
}
.rule-note { color: #714b0a; border: 1px solid #f0d392; background: var(--gold-soft); }
.warning-note, .form-error { color: var(--danger); border: 1px solid #f5c2bc; background: var(--danger-soft); }
.field-status { padding: 0; margin: 12px 0 0; color: var(--muted); }
.field-status.error { color: var(--danger); }

.stack-list { display: grid; gap: 16px; }
.officer-card, .business-card {
  position: relative;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fbfcfe;
}
.card-title { margin: 0 0 16px; display: flex; justify-content: space-between; align-items: center; gap: 12px; color: var(--navy); }
.card-title h3 { margin: 0; font-size: 1rem; }
.officer-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.upload-grid { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.upload-field { padding: 13px; border: 1px dashed #aab7c7; border-radius: 13px; background: white; }
.upload-field input { min-height: auto; padding: 8px 0 0; border: 0; border-radius: 0; box-shadow: none; font-size: 0.82rem; }
.upload-field small { display: block; margin-top: 6px; }

.choice-grid { margin: 0 0 20px; padding: 0; border: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.choice-grid legend { margin-bottom: 8px; }
.choice-card { padding: 15px; display: flex; align-items: flex-start; gap: 10px; border: 1px solid var(--line); border-radius: 15px; background: white; cursor: pointer; }
.choice-card:has(input:checked) { border-color: var(--emerald); background: var(--emerald-soft); box-shadow: 0 0 0 2px rgba(8, 122, 91, 0.08); }
.choice-card input { width: 18px; min-height: 18px; margin: 3px 0 0; box-shadow: none; }
.choice-card span { display: grid; gap: 2px; }
.choice-card small { color: var(--muted); }
.vo-address { padding: 18px; border: 1px solid #bce7d9; border-radius: 16px; background: var(--emerald-soft); }
.vo-address p:last-child { margin: 5px 0 0; color: #245348; }

.primary-button, .secondary-button, .icon-button {
  border: 0;
  border-radius: 13px;
  font-weight: 850;
  transition: transform 0.16s, filter 0.16s, opacity 0.16s;
}
.primary-button { width: 100%; min-height: 54px; padding: 14px 20px; color: white; background: var(--emerald); }
.secondary-button { min-height: 42px; padding: 9px 14px; color: white; background: var(--navy); }
.icon-button { padding: 7px 10px; color: var(--danger); background: var(--danger-soft); }
.primary-button:hover, .secondary-button:hover, .icon-button:hover { filter: brightness(1.06); }
.primary-button:active, .secondary-button:active, .icon-button:active { transform: translateY(1px); }
button:disabled { cursor: not-allowed; opacity: 0.62; }

.kbli-search-wrap { position: relative; }
.suggestion-list {
  position: absolute;
  z-index: 20;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  max-height: 280px;
  margin: 0;
  padding: 6px;
  overflow-y: auto;
  list-style: none;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: white;
  box-shadow: 0 18px 35px rgba(15, 31, 55, 0.16);
}
.suggestion-list button { width: 100%; padding: 10px; border: 0; border-radius: 9px; display: grid; grid-template-columns: 62px 1fr; gap: 10px; color: var(--ink); background: white; text-align: left; }
.suggestion-list button:hover, .suggestion-list button:focus-visible { background: var(--soft); outline: none; }
.kbli-code { color: var(--emerald); font-weight: 900; letter-spacing: 0.03em; }
.selected-kbli { margin-top: 10px; padding: 12px; border-radius: 12px; color: var(--navy); background: var(--emerald-soft); font-size: 0.9rem; }

.money-input, .percent-input { display: flex; }
.money-input > span, .percent-input > span { min-width: 48px; display: grid; place-items: center; color: #475467; border: 1px solid #cbd5e1; background: #f2f4f7; font-weight: 800; }
.money-input > span { border-radius: 13px 0 0 13px; border-right: 0; }
.percent-input > span { border-radius: 0 13px 13px 0; border-left: 0; }
.money-input input { border-radius: 0 13px 13px 0; }
.percent-input input { border-radius: 13px 0 0 13px; }
.calculated-card { padding: 16px; border-radius: 15px; display: flex; align-items: center; justify-content: space-between; gap: 16px; color: #235246; background: var(--emerald-soft); }
.calculated-card span { font-weight: 750; }
.calculated-card strong { color: var(--emerald); font-size: 1.25rem; }
.allocation-heading { margin: 26px 0 12px; display: flex; justify-content: space-between; align-items: end; gap: 18px; }
.allocation-heading h3 { margin: 0 0 2px; color: var(--navy); }
.allocation-heading p { margin: 0; color: var(--muted); font-size: 0.88rem; }
.allocation-total { text-align: right; }
.allocation-total span { display: block; color: var(--muted); font-size: 0.78rem; }
.allocation-total strong { color: var(--navy); font-size: 1.2rem; }
.allocation-list { display: grid; gap: 10px; }
.allocation-row { padding: 12px 14px; border: 1px solid var(--line); border-radius: 14px; display: grid; grid-template-columns: minmax(0, 1fr) 130px 180px; gap: 12px; align-items: center; background: #fbfcfe; }
.allocation-person strong, .allocation-person small { display: block; }
.allocation-person small { color: var(--muted); }
.allocation-row input { min-height: 42px; }
.allocation-amount { text-align: right; color: var(--navy); font-weight: 850; }
.calculation-check { color: #714b0a; border: 1px solid #f0d392; background: var(--gold-soft); }
.calculation-check.valid { color: var(--emerald); border-color: #bce7d9; background: var(--emerald-soft); }

.submit-section { padding: 24px 28px; }
.consent-row { display: flex; align-items: flex-start; gap: 11px; color: #344054; }
.consent-row input { width: 20px; min-height: 20px; margin-top: 3px; }
.form-error { margin: 16px 0; padding: 13px 14px; border-radius: 13px; }
.submit-section .primary-button { margin-top: 20px; }
.submit-note { margin: 8px 0 0; color: var(--muted); font-size: 0.82rem; text-align: center; }
.success-panel { padding: 44px 30px; text-align: center; }
.success-icon { width: 58px; height: 58px; margin: 0 auto 18px; border-radius: 50%; display: grid; place-items: center; color: white; background: var(--emerald); font-size: 1.7rem; font-weight: 900; }
.success-panel p { color: var(--muted); }
.success-panel > strong { width: fit-content; margin: 18px auto; padding: 12px 18px; display: block; border-radius: 13px; color: var(--navy); background: var(--soft); font-size: 1.15rem; letter-spacing: 0.04em; }

footer { padding: 26px 16px; color: #738096; text-align: center; font-size: 0.86rem; }

@media (max-width: 900px) {
  .page-shell { grid-template-columns: 1fr; }
  .form-guide { position: static; }
  .section-nav { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 640px) {
  body { font-size: 15px; }
  .header-inner, .page-shell { width: min(100% - 22px, 1180px); }
  .page-shell { margin-top: 18px; gap: 16px; }
  .form-guide, .form-section, .intro-card, .submit-section, .success-panel { border-radius: 18px; padding: 20px; }
  .form-guide { padding-bottom: 16px; }
  .section-nav { grid-template-columns: 1fr; }
  .privacy-note { display: none; }
  .field-grid, .officer-fields, .upload-grid, .choice-grid { grid-template-columns: 1fr; }
  .section-heading.with-action, .allocation-heading { align-items: stretch; flex-direction: column; }
  .section-heading.with-action .secondary-button { width: 100%; }
  .allocation-total { text-align: left; }
  .allocation-row { grid-template-columns: 1fr 100px; }
  .allocation-amount { grid-column: 1 / -1; text-align: left; }
  .calculated-card { align-items: flex-start; flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
