:root {
  color-scheme: light;
  --background: #ffffff;
  --surface: #ffffff;
  --ink: #161917;
  --muted: #6c736e;
  --line: #d5dad7;
  --line-strong: #aeb7b1;
  --green: #167a55;
  --green-dark: #0d5d3f;
  --green-soft: #eef8f3;
  --danger: #b42318;
  --shadow: 0 22px 60px rgba(20, 42, 30, 0.12);
  --radius: 14px;
  font-family:
    Pretendard, "Noto Sans KR", "Apple SD Gothic Neo", "Malgun Gothic",
    system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--background);
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  margin: 0;
  color: var(--ink);
  background: var(--background);
  font-size: 17px;
  line-height: 1.5;
  overflow-wrap: break-word;
  word-break: keep-all;
}

button,
input {
  font: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

button:not(:disabled) {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.skip-link {
  position: fixed;
  z-index: 100;
  top: 12px;
  left: 12px;
  padding: 10px 14px;
  border-radius: 10px;
  color: #fff;
  background: var(--green-dark);
  font-weight: 800;
  transform: translateY(-180%);
}

.skip-link:focus {
  transform: translateY(0);
}

.topbar {
  position: relative;
  z-index: 30;
  display: flex;
  width: min(100% - 40px, 1040px);
  min-height: 72px;
  margin: 0 auto;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.office-button,
.admin-button {
  min-height: 44px;
  padding: 8px 17px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  color: var(--ink);
  background: #fff;
  font-size: 15px;
  font-weight: 850;
}

.office-button:hover,
.admin-button:hover {
  border-color: var(--green);
  color: var(--green-dark);
}

.intake-cover {
  display: grid;
  min-height: calc(100svh - 72px);
  padding: 24px;
  place-items: center;
}

.intake-cover__content {
  display: grid;
  width: min(100%, 700px);
  margin-top: -72px;
  justify-items: center;
  text-align: center;
}

.intake-cover h1 {
  margin: 0;
  font-size: clamp(42px, 7vw, 68px);
  line-height: 1.12;
  letter-spacing: -0.06em;
}

.cover-start-button {
  width: min(100%, 300px);
  min-height: 70px;
  margin-top: 38px;
  padding: 14px 24px;
  border: 2px solid var(--green);
  border-radius: 16px;
  color: #fff;
  background: var(--green);
  font-size: 21px;
  font-weight: 900;
}

.cover-start-button:hover {
  border-color: var(--green-dark);
  background: var(--green-dark);
}

.office-card {
  width: 100%;
  margin-top: 0;
  padding: 24px 26px;
  border: 1px solid var(--line-strong);
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 14px 38px rgba(20, 42, 30, 0.08);
  text-align: left;
}

.office-card__label {
  margin: 0 0 5px;
  color: var(--green-dark);
  font-size: 14px;
  font-weight: 900;
}

.office-card h2 {
  margin: 0;
  font-size: clamp(20px, 3.5vw, 25px);
  line-height: 1.3;
  letter-spacing: -0.035em;
}

.office-card__representative {
  margin: 5px 0 18px;
  color: var(--muted);
  font-size: 16px;
}

.office-card__representative strong {
  color: var(--ink);
}

.office-card__details {
  margin: 0;
  border-top: 1px solid var(--line);
}

.office-card__details > div {
  display: grid;
  grid-template-columns: 82px 1fr;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
  gap: 14px;
}

.office-card__details > div:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.office-card__details dt {
  color: var(--muted);
  font-size: 14px;
  font-weight: 850;
}

.office-card__details dd {
  margin: 0;
  font-size: 15px;
  font-weight: 750;
}

.office-card__phones {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
}

.office-card__phones a {
  color: var(--green-dark);
  font-weight: 900;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.page-shell {
  width: min(100% - 40px, 820px);
  margin: 0 auto;
  padding: 8px 0 56px;
}

.page-heading {
  text-align: center;
}

.page-heading h1,
.page-heading p,
.review-heading h2,
.success-panel h2,
.success-panel p,
.admin-toolbar p {
  margin-top: 0;
}

.page-heading h1 {
  margin-bottom: 8px;
  font-size: clamp(34px, 6vw, 50px);
  line-height: 1.14;
  letter-spacing: -0.055em;
}

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

.progress {
  display: grid;
  grid-template-columns: auto 1fr auto 1fr auto;
  width: min(100%, 430px);
  margin: 32px auto 36px;
  padding: 0;
  align-items: start;
  list-style: none;
}

.progress__item {
  display: grid;
  gap: 6px;
  justify-items: center;
  color: #8c938f;
}

.progress__item span {
  display: grid;
  width: 36px;
  height: 36px;
  border: 2px solid var(--line);
  border-radius: 50%;
  place-items: center;
  background: #fff;
  font-size: 15px;
  font-weight: 900;
}

.progress__item strong {
  font-size: 13px;
  font-weight: 850;
}

.progress__item.is-current,
.progress__item.is-complete {
  color: var(--green);
}

.progress__item.is-current span,
.progress__item.is-complete span {
  border-color: var(--green);
}

.progress__item.is-current span {
  color: #fff;
  background: var(--green);
}

.progress__item.is-complete span {
  position: relative;
  color: transparent;
}

.progress__item.is-complete span::after {
  content: "✓";
  position: absolute;
  color: var(--green);
}

.progress__line {
  height: 2px;
  margin: 17px 10px 0;
  background: var(--line);
}

.intake-card {
  border: 1px solid var(--line-strong);
  border-radius: 20px;
  background: var(--surface);
  overflow: hidden;
}

.step-panel {
  padding: 32px;
  animation: reveal 180ms ease-out both;
}

@keyframes reveal {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

fieldset {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.question + .question {
  margin-top: 32px;
  padding-top: 30px;
  border-top: 1px solid var(--line);
}

.question legend {
  display: flex;
  width: 100%;
  margin-bottom: 18px;
  padding: 0;
  align-items: center;
  gap: 11px;
  font-size: 21px;
  font-weight: 900;
  letter-spacing: -0.035em;
}

.number-badge {
  display: grid;
  flex: 0 0 auto;
  width: 31px;
  height: 31px;
  border-radius: 50%;
  place-items: center;
  color: #fff;
  background: var(--green);
  font-size: 14px;
  font-weight: 900;
}

.choice-grid {
  display: grid;
  gap: 11px;
}

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

.choice-grid--four,
.choice-grid--complexes {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.choice-button {
  min-height: 64px;
  padding: 12px 16px;
  border: 2px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  background: #fff;
  font-size: 18px;
  font-weight: 850;
  line-height: 1.3;
  transition:
    border-color 130ms ease,
    background-color 130ms ease,
    color 130ms ease,
    transform 130ms ease;
}

.choice-button:hover {
  border-color: var(--green);
}

.choice-button:active {
  transform: scale(0.985);
}

.choice-button.is-selected {
  border-color: var(--green);
  color: #fff;
  background: var(--green);
}

.choice-button--compact {
  min-height: 56px;
  font-size: 16px;
}

.choice-button--wide {
  grid-column: 1 / -1;
}

.field-grid {
  display: grid;
  gap: 16px;
}

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

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

.optional-fields {
  margin-top: 20px;
}

.other-complex-field {
  margin-bottom: 20px;
}

.field {
  display: grid;
  min-width: 0;
  gap: 8px;
  font-weight: 850;
}

.field > span:first-child {
  font-size: 16px;
}

.field small,
.room-choice small {
  margin-left: 4px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

input[type="text"],
input[type="tel"],
input[type="password"] {
  width: 100%;
  min-height: 58px;
  padding: 12px 15px;
  border: 2px solid var(--line);
  border-radius: 12px;
  outline: none;
  color: var(--ink);
  background: #fff;
}

input::placeholder {
  color: #8a918d;
}

input:hover {
  border-color: var(--line-strong);
}

input:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 4px rgba(22, 122, 85, 0.13);
}

input[aria-invalid="true"] {
  border-color: var(--danger);
}

input[aria-invalid="true"]:focus {
  box-shadow: 0 0 0 4px rgba(180, 35, 24, 0.12);
}

.input-suffix {
  position: relative;
  display: block;
}

.input-suffix input {
  padding-right: 44px;
}

.input-suffix b {
  position: absolute;
  top: 50%;
  right: 15px;
  color: var(--muted);
  font-size: 14px;
  transform: translateY(-50%);
}

.room-choice {
  margin-top: 22px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.room-choice legend {
  margin-bottom: 12px;
  font-size: 16px;
  font-weight: 850;
}

.consent {
  display: flex;
  margin-top: 22px;
  align-items: flex-start;
  gap: 10px;
  color: var(--ink);
  font-size: 15px;
  font-weight: 750;
  cursor: pointer;
}

.consent input {
  width: 22px;
  height: 22px;
  margin: 1px 0 0;
  flex: 0 0 auto;
  accent-color: var(--green);
}

.consent input:focus-visible {
  outline: 4px solid rgba(22, 122, 85, 0.2);
  outline-offset: 3px;
}

.form-message {
  min-height: 0;
  margin: 14px 0 0;
  color: var(--danger);
  font-size: 14px;
  font-weight: 800;
}

.form-message:empty {
  margin-top: 0;
}

.step-actions {
  display: grid;
  grid-template-columns: 0.8fr 1.2fr;
  gap: 11px;
  margin-top: 28px;
}

.primary-button,
.secondary-button {
  display: grid;
  min-height: 62px;
  padding: 12px 20px;
  border-radius: 14px;
  place-items: center;
  font-weight: 900;
}

.primary-button {
  border: 2px solid var(--green);
  color: #fff;
  background: var(--green);
}

.primary-button:not(:disabled):hover {
  border-color: var(--green-dark);
  background: var(--green-dark);
}

.secondary-button {
  border: 2px solid var(--line-strong);
  color: var(--ink);
  background: #fff;
}

.secondary-button:not(:disabled):hover {
  border-color: var(--green);
  color: var(--green-dark);
}

button:focus-visible {
  outline: 4px solid rgba(22, 122, 85, 0.2);
  outline-offset: 3px;
}

.review-heading {
  display: flex;
  margin-bottom: 24px;
  align-items: center;
  gap: 14px;
}

.review-check,
.success-mark {
  display: grid;
  flex: 0 0 auto;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  place-items: center;
  color: #fff;
  background: var(--green);
  font-size: 26px;
  font-weight: 900;
}

.review-heading h2,
.success-panel h2 {
  margin-bottom: 0;
  font-size: 26px;
  line-height: 1.25;
  letter-spacing: -0.04em;
}

.review-list {
  margin: 0;
  border-top: 1px solid var(--line);
}

.review-list > div {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 18px;
  padding: 15px 4px;
  border-bottom: 1px solid var(--line);
}

.review-list dt {
  color: var(--muted);
  font-size: 15px;
  font-weight: 800;
}

.review-list dd {
  margin: 0;
  font-weight: 850;
  text-align: right;
}

.success-panel {
  padding: 52px 32px;
  text-align: center;
  animation: reveal 180ms ease-out both;
}

.success-mark {
  width: 66px;
  height: 66px;
  margin: 0 auto 18px;
  font-size: 34px;
}

.success-panel h2 {
  margin-bottom: 9px;
}

.success-panel p {
  margin-bottom: 0;
  color: var(--muted);
}

.success-restart {
  width: min(100%, 300px);
  margin: 28px auto 0;
}

.office-dialog,
.admin-dialog,
.confirm-dialog {
  width: min(calc(100% - 24px), 1120px);
  max-width: none;
  max-height: min(88vh, 820px);
  margin: auto;
  padding: 0;
  border: 0;
  border-radius: 18px;
  color: var(--ink);
  background: #fff;
  box-shadow: var(--shadow);
}

.office-dialog::backdrop,
.admin-dialog::backdrop,
.confirm-dialog::backdrop {
  background: rgba(13, 22, 17, 0.52);
}

.confirm-dialog {
  width: min(calc(100% - 24px), 520px);
}

.office-dialog {
  width: min(calc(100% - 24px), 700px);
}

.office-dialog__shell {
  padding: 26px;
}

.office-dialog .office-card {
  padding: 0;
  border: 0;
  box-shadow: none;
}

.office-dialog__close-button {
  width: 100%;
  margin-top: 22px;
}

.confirm-shell {
  padding: 30px;
}

.confirm-shell h2 {
  margin: 0 0 8px;
  font-size: 26px;
  line-height: 1.3;
  letter-spacing: -0.04em;
}

.confirm-shell > p:not(.form-message) {
  margin: 0;
  color: var(--muted);
}

.delete-summary {
  margin-top: 18px !important;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--ink) !important;
  background: #fafcfb;
  font-weight: 850;
}

.confirm-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 24px;
}

.confirm-actions .secondary-button {
  margin: 0;
}

.danger-button {
  min-height: 62px;
  padding: 12px 20px;
  border: 2px solid var(--danger);
  border-radius: 14px;
  color: #fff;
  background: var(--danger);
  font-weight: 900;
}

.danger-button:not(:disabled):hover {
  border-color: #8f1c13;
  background: #8f1c13;
}

.dialog-shell {
  padding: 26px;
}

.dialog-header {
  display: flex;
  margin-bottom: 24px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.dialog-header h2 {
  margin: 0;
  font-size: 27px;
  letter-spacing: -0.035em;
}

.dialog-close {
  display: grid;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  place-items: center;
  color: var(--ink);
  background: #fff;
}

.dialog-close:hover {
  border-color: var(--green);
  color: var(--green);
}

.dialog-close svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
}

.admin-login {
  width: min(100%, 430px);
  margin: 12px auto 30px;
}

.admin-login__submit {
  width: 100%;
  margin-top: 18px;
}

.admin-toolbar {
  display: flex;
  margin-bottom: 14px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.admin-toolbar p {
  margin-bottom: 0;
  font-weight: 850;
}

.admin-toolbar > div {
  display: flex;
  gap: 8px;
}

.text-button {
  min-height: 42px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--green-dark);
  background: #fff;
  font-size: 14px;
  font-weight: 850;
}

.text-button:hover {
  border-color: var(--green);
  background: var(--green-soft);
}

.table-scroll {
  max-height: min(60vh, 560px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.table-scroll:focus-visible {
  outline: 4px solid rgba(22, 122, 85, 0.2);
  outline-offset: 3px;
}

.submissions-table {
  width: 100%;
  min-width: 1020px;
  border-collapse: collapse;
  font-size: 14px;
}

.submissions-table th,
.submissions-table td {
  padding: 13px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.submissions-table th {
  position: sticky;
  z-index: 1;
  top: 0;
  color: var(--green-dark);
  background: var(--green-soft);
  font-size: 13px;
  white-space: nowrap;
}

.submissions-table tbody tr:last-child td {
  border-bottom: 0;
}

.submissions-table tbody tr:hover {
  background: #fafcfb;
}

.table-delete-button {
  min-height: 38px;
  padding: 7px 11px;
  border: 1px solid #e6aaa5;
  border-radius: 9px;
  color: var(--danger);
  background: #fff;
  font-size: 13px;
  font-weight: 850;
  white-space: nowrap;
}

.table-delete-button:not(:disabled):hover {
  border-color: var(--danger);
  background: #fff6f5;
}

.empty-row {
  padding: 36px 16px !important;
  color: var(--muted);
  text-align: center !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

[hidden] {
  display: none !important;
}

@media (max-width: 700px) {
  .topbar {
    width: min(100% - 24px, 1040px);
    min-height: 62px;
  }

  .intake-cover {
    min-height: calc(100svh - 62px);
    padding: 20px;
  }

  .intake-cover__content {
    margin-top: -62px;
  }

  .intake-cover h1 {
    font-size: clamp(38px, 12vw, 50px);
  }

  .cover-start-button {
    margin-top: 30px;
  }

  .office-card {
    padding: 20px;
  }

  .office-dialog__shell {
    padding: 20px 16px;
  }

  .office-dialog .office-card {
    padding: 0;
  }

  .office-card__details > div {
    grid-template-columns: 72px 1fr;
    gap: 10px;
  }

  .admin-button {
    min-height: 42px;
  }

  .page-shell {
    width: min(100% - 24px, 820px);
    padding-top: 2px;
  }

  .page-heading h1 {
    font-size: 34px;
  }

  .progress {
    margin: 25px auto 28px;
  }

  .intake-card {
    border-right: 0;
    border-left: 0;
    border-radius: 0;
  }

  .step-panel,
  .success-panel {
    padding: 26px 4px;
  }

  .question legend {
    font-size: 20px;
  }

  .choice-grid--four,
  .choice-grid--complexes,
  .field-grid--three,
  .field-grid--two {
    grid-template-columns: 1fr;
  }

  .step-actions {
    grid-template-columns: 1fr 1.25fr;
  }

  .review-list > div {
    grid-template-columns: 88px 1fr;
    gap: 12px;
  }

  .dialog-shell {
    padding: 20px 16px;
  }

  .confirm-shell {
    padding: 26px 20px;
  }

  .office-dialog,
  .admin-dialog {
    max-height: 92vh;
  }
}

@media (max-width: 390px) {
  .choice-grid--two,
  .step-actions {
    grid-template-columns: 1fr;
  }

  .step-actions .secondary-button {
    order: 2;
  }

  .admin-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .confirm-actions {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
