:root {
  color-scheme: light;
  --bg: #f3ede2;
  --paper: #fffaf2;
  --ink: #26211b;
  --muted: #b1766a;
  --line: #d7c4ab;
  --accent: #b97062;
  --accent-strong: #b97062;
  --shadow: 0 18px 50px rgba(67, 45, 24, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Georgia, "Times New Roman", serif;
  background:
    radial-gradient(circle at top left, rgba(176, 126, 71, 0.14), transparent 32%),
    linear-gradient(180deg, #efe4d3, var(--bg));
  color: var(--ink);
}

.page {
  width: min(760px, 100%);
  margin: 0 auto;
  padding: 24px 10px 40px;
}

.hero {
  padding: 24px;
  border: 1px solid rgba(109, 60, 18, 0.15);
  border-radius: 24px;
  background: rgba(255, 250, 242, 0.84);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-size: 12px;
}

h1 {
  margin: 0;
  font-size: clamp(32px, 8vw, 48px);
  line-height: 0.95;
}

.lead {
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.5;
}

.form {
  display: grid;
  gap: 14px;
  margin-top: 20px;
  padding: 24px 18px;
  border-radius: 24px;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.form-alert {
  padding: 14px 16px;
  border: 1px solid #d28b7d;
  border-radius: 16px;
  background: #fff1ed;
  color: #8a3d2f;
  line-height: 1.45;
}

.form-alert[hidden] {
  display: none;
}

.field,
.checkbox {
  display: grid;
  gap: 8px;
}

.field span,
.field > label,
.checkbox span {
  font-size: 14px;
  color: var(--muted);
}

.field-hint {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

input,
textarea,
button {
  font: inherit;
}

input,
textarea {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
  color: var(--ink);
}

.date-control {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.date-picker-button {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
  color: var(--ink);
  font-size: 14px;
  cursor: pointer;
}

.date-picker-button:hover,
.date-picker-button:focus-visible {
  border-color: var(--accent);
  outline: none;
}

.native-date-picker {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

input.invalid,
textarea.invalid {
  border-color: #c65846;
  background: #fff7f4;
  box-shadow: 0 0 0 3px rgba(198, 88, 70, 0.12);
}

textarea {
  resize: vertical;
}

.checkbox {
  grid-template-columns: auto 1fr;
  align-items: flex-start;
  column-gap: 16px;
  padding: 4px 0 8px;
}

.checkbox input {
  width: 24px;
  min-width: 24px;
  height: 24px;
  margin: 2px 0 0;
  padding: 0;
  border-radius: 6px;
}

.checkbox-text {
  display: block;
  line-height: 1.45;
  padding-top: 1px;
}

.actions {
  display: grid;
  gap: 10px;
  margin-top: 4px;
}

.submit {
  padding: 16px 18px;
  border-radius: 999px;
  font-weight: 700;
  cursor: pointer;
}

.submit {
  border: 0;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #fffdf8;
}

.submit:disabled {
  opacity: 0.6;
  cursor: wait;
}

.loading-overlay {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(38, 33, 27, 0.38);
  backdrop-filter: blur(4px);
  z-index: 1000;
}

.loading-overlay[hidden] {
  display: none;
}

.loading-card {
  display: grid;
  justify-items: center;
  gap: 14px;
  width: min(280px, 100%);
  padding: 24px 20px;
  border: 1px solid rgba(109, 60, 18, 0.15);
  border-radius: 24px;
  background: rgba(255, 250, 242, 0.98);
  box-shadow: var(--shadow);
  text-align: center;
}

.loading-card p {
  margin: 0;
  color: var(--ink);
  line-height: 1.4;
}

.spinner {
  width: 42px;
  height: 42px;
  border: 3px solid rgba(143, 90, 42, 0.18);
  border-top-color: var(--accent-strong);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.info-note {
  padding: 12px 16px;
  border-left: 4px solid var(--accent);
  background: rgba(185, 112, 98, 0.06);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.5;
  border-radius: 4px 16px 16px 4px;
  margin-bottom: 8px;
}

.info-note strong {
  color: var(--accent);
}

.consent-link {
  display: inline;
  padding: 0;
  margin: 0;
  border: 0;
  border-bottom: 1.5px dashed var(--accent);
  background: transparent;
  color: var(--accent);
  font: inherit;
  font-size: inherit;
  line-height: inherit;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.consent-link:hover,
.consent-link:focus-visible {
  color: #934a3e;
  border-bottom-style: solid;
  border-bottom-color: #934a3e;
  outline: none;
}

body.modal-open {
  overflow: hidden;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(38, 33, 27, 0.45);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 1100;
  animation: modalFadeIn 0.2s ease-out;
}

.modal-overlay[hidden] {
  display: none;
}

.modal-card {
  display: flex;
  flex-direction: column;
  width: min(560px, 100%);
  max-height: min(85vh, 680px);
  padding: 24px;
  border: 1px solid rgba(109, 60, 18, 0.15);
  border-radius: 24px;
  background: var(--paper);
  box-shadow: var(--shadow);
  animation: modalScaleUp 0.2s ease-out;
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.modal-title {
  margin: 0;
  font-size: 20px;
  line-height: 1.25;
  color: var(--ink);
}

.modal-close {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(185, 112, 98, 0.12);
  color: var(--ink);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  transition: background-color 0.15s ease, transform 0.15s ease;
}

.modal-close:hover,
.modal-close:focus-visible {
  background: rgba(185, 112, 98, 0.25);
  transform: scale(1.05);
  outline: none;
}

.modal-body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding-right: 4px;
  font-size: 14px;
  line-height: 1.6;
  color: var(--ink);
  overscroll-behavior: contain;
}

.modal-body-document {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding-right: 0;
}

.consent-document {
  flex: 1 1 auto;
  width: 100%;
  min-height: 360px;
  border: 0;
  border-radius: 8px;
  background: #fff;
}

.modal-body p {
  margin: 0 0 12px;
}

.modal-body p:last-child {
  margin-bottom: 0;
}

.modal-body strong {
  color: var(--accent);
}

.modal-actions {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: flex-end;
}

.modal-btn-close {
  padding: 12px 24px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #fffdf8;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.modal-btn-close:hover,
.modal-btn-close:focus-visible {
  opacity: 0.92;
  transform: translateY(-1px);
  outline: none;
}

@media (max-width: 480px) {
  .date-control {
    grid-template-columns: 1fr;
  }

  .modal-card {
    max-height: calc(100vh - 24px);
    padding: 18px;
    border-radius: 18px;
  }

  .consent-document {
    min-height: 320px;
  }
}

@keyframes modalFadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes modalScaleUp {
  from {
    opacity: 0;
    transform: scale(0.96);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

