:root {
  --bg: #f6f8fb;
  --card: #ffffff;
  --text: #111827;
  --muted: #6b7280;
  --line: #e5e7eb;
  --line-strong: #d1d5db;
  --primary: #238B22;
  --primary-dark: #1c6f1c;
  --primary-soft: #eef8ee;
  --danger: #dc2626;
  --success: #059669;
  --shadow: 0 18px 45px rgba(15, 23, 42, 0.08);
  --radius: 18px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background: var(--bg);
  font-family: Inter, Pretendard, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
}

button,
input,
select {
  font: inherit;
}

.page-shell {
  width: min(100% - 32px, 900px);
  margin: 0 auto;
  padding: 48px 0 128px;
}

.page-header {
  margin-bottom: 28px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--primary);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 10px;
  font-size: clamp(30px, 5vw, 42px);
  line-height: 1.15;
  letter-spacing: 0;
}

.lead {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 16px;
}

.form-layout {
  display: grid;
  gap: 24px;
}

.form-card {
  padding: 28px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.section-heading {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
}

.section-index {
  display: inline-grid;
  flex: 0 0 auto;
  place-items: center;
  width: 38px;
  height: 38px;
  color: var(--primary);
  background: var(--primary-soft);
  border: 1px solid #b9dfb8;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 800;
}

.section-heading h2 {
  margin-bottom: 4px;
  font-size: 20px;
  letter-spacing: 0;
}

.section-heading p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 14px;
}

.field-grid,
.upload-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

.field,
.upload-field {
  min-width: 0;
}

.field-row {
  display: grid;
  grid-column: 1 / -1;
  gap: 20px;
  min-width: 0;
}

.field-pair {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.field-account {
  grid-template-columns: minmax(150px, 0.8fr) minmax(220px, 1.2fr) minmax(180px, 1fr);
}

.field-wide {
  grid-column: 1 / -1;
}

label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 8px;
  font-size: 14px;
  font-weight: 700;
}

.required {
  color: var(--danger);
}

input,
select,
.secondary-button {
  width: 100%;
  height: 46px;
  padding: 0 14px;
  color: var(--text);
  background: #ffffff;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  outline: none;
  transition: border-color 160ms ease, box-shadow 160ms ease, background-color 160ms ease;
}

select {
  cursor: pointer;
  padding-right: 44px;
}

.input-action {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 112px;
  gap: 10px;
}

.input-action input {
  min-width: 0;
}

.secondary-button {
  color: var(--primary);
  background: var(--primary-soft);
  border-color: #b9dfb8;
  cursor: pointer;
  font-weight: 800;
  white-space: nowrap;
  transition: transform 160ms ease, border-color 160ms ease, background-color 160ms ease, color 160ms ease;
}

.secondary-button:hover {
  transform: translateY(-1px);
  color: #ffffff;
  background: var(--primary);
  border-color: var(--primary);
}

input::placeholder {
  color: #9ca3af;
}

input:focus,
select:focus,
.dropzone:focus,
.secondary-button:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(35, 139, 34, 0.14);
}

input[aria-invalid="true"],
select[aria-invalid="true"] {
  border-color: var(--danger);
  background: #fff7f7;
}

select:disabled {
  color: #9ca3af;
  background: #f3f4f6;
  cursor: not-allowed;
}

.hint {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.error-message {
  min-height: 18px;
  margin: 6px 0 0;
  color: var(--danger);
  font-size: 12px;
  font-weight: 600;
}

.hidden {
  display: none;
}

.upload-field input[type="file"] {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  white-space: nowrap;
  border: 0;
  clip: rect(0, 0, 0, 0);
}

.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  place-items: center;
  min-height: 136px;
  padding: 20px;
  text-align: center;
  background: #f9fafb;
  border: 1px dashed #7bc67a;
  border-radius: 16px;
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease, background-color 160ms ease;
}

.dropzone:hover,
.dropzone.is-dragover {
  transform: translateY(-1px);
  background: var(--primary-soft);
  border-color: var(--primary);
}

.dropzone strong {
  display: block;
  margin-bottom: 6px;
  font-size: 14px;
}

.dropzone span {
  color: var(--muted);
  font-size: 12px;
}

.upload-prompt {
  display: grid;
  place-items: center;
  gap: 2px;
}

.upload-preview {
  display: none;
  width: 100%;
  margin-top: 10px;
}

.upload-field.is-uploaded .upload-preview {
  display: block;
}

.preview-card {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  width: 100%;
  padding: 10px;
  text-align: left;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.preview-thumb {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  overflow: hidden;
  color: var(--primary);
  background: var(--primary-soft);
  border: 1px solid #b9dfb8;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 900;
}

.preview-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.preview-info {
  min-width: 0;
}

.preview-name {
  overflow: hidden;
  color: var(--text);
  font-size: 13px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.preview-meta {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.preview-scroll {
  display: flex;
  gap: 10px;
  width: 100%;
  overflow-x: auto;
  padding: 2px 2px 8px;
  scrollbar-width: thin;
}

.preview-scroll .preview-card {
  flex: 0 0 214px;
  grid-template-columns: 52px minmax(0, 1fr);
}

.preview-scroll .preview-thumb {
  width: 52px;
  height: 52px;
}

.upload-field.is-uploaded .dropzone {
  background: #ecfdf5;
  border-color: #34d399;
}

.file-status {
  min-height: 20px;
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  word-break: break-all;
}

.upload-field.is-uploaded .file-status {
  color: var(--success);
}

.upload-field-wide {
  grid-column: 1 / -1;
}

.upload-field-wide .dropzone {
  min-height: 118px;
}

.agreement-card {
  scroll-margin-top: 24px;
}

.agreement-box {
  display: grid;
  gap: 14px;
  padding: 18px;
  background: #f9fafb;
  border: 1px solid var(--line);
  border-radius: 16px;
}

.agreement-file-link {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  justify-content: center;
  padding: 9px 13px;
  color: var(--primary);
  background: var(--primary-soft);
  border: 1px solid #b9dfb8;
  border-radius: 11px;
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
  transition: transform 160ms ease, background-color 160ms ease, color 160ms ease;
}

.agreement-file-link:hover,
.agreement-file-link:focus {
  transform: translateY(-1px);
  color: #ffffff;
  background: var(--primary);
}

.agreement-checkbox {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  margin-bottom: 0;
  color: var(--text);
  cursor: pointer;
  line-height: 1.6;
}

.agreement-checkbox input {
  width: 18px;
  height: 18px;
  margin: 3px 0 0;
  padding: 0;
  accent-color: var(--primary);
  cursor: pointer;
}

.agreement-checkbox input[aria-invalid="true"] {
  outline: 3px solid rgba(220, 38, 38, 0.14);
  outline-offset: 2px;
}

.agreement-checkbox strong {
  color: var(--danger);
}

.agreement-note {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

.sticky-submit {
  position: sticky;
  bottom: 18px;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 16px 36px rgba(15, 23, 42, 0.14);
  backdrop-filter: blur(12px);
}

.submit-summary {
  display: grid;
  gap: 2px;
}

.submit-summary strong {
  font-size: 14px;
}

.submit-summary span {
  color: var(--muted);
  font-size: 12px;
}

.submit-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-width: 156px;
  height: 48px;
  padding: 0 22px;
  color: #ffffff;
  background: var(--primary);
  border: 0;
  border-radius: 13px;
  cursor: pointer;
  font-weight: 800;
  transition: transform 160ms ease, background-color 160ms ease, box-shadow 160ms ease;
}

.submit-button:hover {
  transform: translateY(-1px);
  background: var(--primary-dark);
  box-shadow: 0 12px 24px rgba(35, 139, 34, 0.25);
}

.submit-button:disabled {
  transform: none;
  cursor: wait;
  opacity: 0.78;
  box-shadow: none;
}

.spinner {
  display: none;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.45);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: spin 700ms linear infinite;
}

.submit-button.is-loading .spinner {
  display: inline-block;
}

.submit-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(17, 24, 39, 0.58);
  backdrop-filter: blur(5px);
}

.submit-overlay.is-visible {
  display: flex;
}

.submit-overlay-panel {
  display: grid;
  place-items: center;
  gap: 16px;
  width: min(100%, 320px);
  padding: 30px 24px;
  text-align: center;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.28);
}

.submit-overlay-spinner {
  width: 44px;
  height: 44px;
  border: 4px solid #d9ead9;
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 780ms linear infinite;
}

.submit-overlay-panel p {
  margin-bottom: 0;
  color: var(--text);
  font-size: 16px;
  font-weight: 800;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 96px;
  z-index: 20;
  max-width: min(360px, calc(100vw - 32px));
  padding: 14px 16px;
  color: #064e3b;
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  border-radius: 14px;
  box-shadow: var(--shadow);
  font-size: 14px;
  font-weight: 800;
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.postcode-modal {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.postcode-modal.is-visible {
  display: flex;
}

.postcode-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
}

.postcode-panel {
  position: relative;
  z-index: 1;
  width: min(100%, 560px);
  height: min(720px, calc(100vh - 40px));
  overflow: hidden;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.24);
}

.postcode-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}

.postcode-header h2 {
  margin-bottom: 3px;
  font-size: 18px;
}

.postcode-header p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 13px;
}

.postcode-close {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  color: var(--muted);
  background: #f9fafb;
  border: 1px solid var(--line);
  border-radius: 10px;
  cursor: pointer;
  font-size: 24px;
  line-height: 1;
  transition: background-color 160ms ease, color 160ms ease, transform 160ms ease;
}

.postcode-close:hover,
.postcode-close:focus {
  color: var(--text);
  background: var(--primary-soft);
  transform: translateY(-1px);
}

.postcode-layer {
  width: 100%;
  height: calc(100% - 76px);
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 720px) {
  .page-shell {
    width: min(100% - 24px, 900px);
    padding-top: 28px;
  }

  .form-card {
    padding: 20px;
    border-radius: 16px;
  }

  .section-heading {
    gap: 12px;
  }

  .field-grid,
  .upload-grid,
  .field-row {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .input-action {
    grid-template-columns: 1fr;
  }

  .sticky-submit {
    left: 12px;
    right: 12px;
    bottom: 12px;
    flex-direction: column;
    align-items: stretch;
  }

  .submit-button {
    width: 100%;
  }

  .toast {
    right: 16px;
    bottom: 112px;
  }

  .postcode-modal {
    padding: 10px;
  }

  .postcode-panel {
    height: min(640px, calc(100vh - 20px));
    border-radius: 16px;
  }
}


/* 기타 직접 입력 필드 간격 */
.etc-input-field {
  margin-top: 10px;
}

/* 1차 기타 선택 시 2차 드롭박스 숨김 */
.field.is-hidden-by-etc {
  display: none;
}