:root {
  --bg: #11071e;
  --bg-accent: #2a1142;
  --surface: rgba(34, 19, 59, 0.9);
  --surface-strong: rgba(54, 30, 88, 0.96);
  --text: #f4ecff;
  --muted: #d0c1eb;
  --line: rgba(198, 170, 255, 0.24);
  --card-border: rgba(195, 149, 255, 0.5);
  --card-border-soft: rgba(195, 149, 255, 0.3);
  --primary: #b86cff;
  --primary-dark: #7f38d8;
  --secondary: #cfa8ff;
  --shadow: 0 26px 70px rgba(9, 2, 20, 0.45);
  --radius-xl: 28px;
  --radius-lg: 18px;
  --radius-md: 12px;
}

body[data-theme="light"] {
  --bg: #dbdcea;
  --bg-accent: #eef2f7;
  --surface: rgba(255, 255, 255, 0.94);
  --surface-strong: rgba(255, 255, 255, 0.98);
  --text: #000;
  --muted: #425466;
  --line: rgba(51, 124, 187, 0.18);
  --card-border: rgba(51, 124, 187, 0.32);
  --card-border-soft: rgba(181, 196, 214, 0.72);
  --primary: #337cbb;
  --primary-dark: #23547f;
  --secondary: #5bc0de;
  --shadow: 0 24px 60px rgba(45, 68, 96, 0.16);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(179, 108, 255, 0.34), transparent 30%),
    radial-gradient(circle at top right, rgba(118, 73, 255, 0.28), transparent 26%),
    radial-gradient(circle at bottom center, rgba(226, 168, 255, 0.14), transparent 30%),
    linear-gradient(180deg, var(--bg), var(--bg-accent));
  min-height: 100vh;
}

body::before,
body::after {
  content: "";
  position: fixed;
  inset: auto;
  width: 360px;
  height: 360px;
  border-radius: 50%;
  filter: blur(40px);
  pointer-events: none;
  z-index: 0;
}

body::before {
  left: -90px;
  top: 80px;
  background: rgba(155, 92, 255, 0.24);
}

body::after {
  right: -120px;
  bottom: 40px;
  background: rgba(97, 57, 193, 0.28);
}

.page-shell {
  position: relative;
  z-index: 1;
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 56px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr);
  gap: 24px;
  align-items: start;
  padding: 34px;
  margin-bottom: 24px;
  background: linear-gradient(135deg, rgba(59, 29, 102, 0.96), rgba(33, 15, 59, 0.92));
  border: 2px solid rgba(208, 168, 255, 0.42);
  border-radius: calc(var(--radius-xl) + 6px);
  box-shadow: var(--shadow);
}

.eyebrow {
  margin: 0 0 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 0.78rem;
  font-weight: 700;
  color: #e0bcff;
}

h1,
h2,
h3 {
  margin: 0;
  font-family: Georgia, "Palatino Linotype", serif;
  line-height: 1.05;
}

h1 {
  font-size: clamp(1.8rem, 3.2vw, 2.8rem);
}

.hero-subtitle {
  margin: 10px 0 0;
  font-size: 1.12rem;
  font-weight: 700;
  color: #f4ecff;
}

.hero-text {
  max-width: 58ch;
  margin: 16px 0 0;
  font-size: 1.05rem;
  line-height: 1.6;
  color: var(--muted);
}

.hero-text a {
  color: #f4ecff;
  font-weight: 700;
  text-underline-offset: 0.16em;
  text-decoration: none;
}

.hero-text a:hover,
.project-note a:hover {
  opacity: 0.88;
  text-decoration: underline;
}

.project-note a {
  color: inherit;
  font-weight: 700;
  text-underline-offset: 0.16em;
  text-decoration: none;
}

.required-note {
  margin: 18px 0 0;
  color: #f0e3ff;
  font-weight: 600;
}

.theme-panel {
  padding: 18px 20px;
  border: 1px solid rgba(214, 183, 255, 0.22);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.04);
}

.theme-panel h2 {
  font-size: 1.05rem;
  margin-bottom: 10px;
}

.theme-toggle {
  display: inline-grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  width: 100%;
}

.theme-choice {
  appearance: none;
  border: 1px solid rgba(214, 183, 255, 0.24);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font: inherit;
  font-weight: 700;
  padding: 12px 14px;
  cursor: pointer;
  transition: background 160ms ease, color 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.theme-choice:hover {
  transform: translateY(-1px);
}

.theme-choice.is-active {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  border-color: transparent;
  box-shadow: 0 12px 24px rgba(38, 53, 86, 0.18);
}

.privacy-panel {
  max-width: 62ch;
  margin-top: 22px;
  padding: 18px 20px;
  border: 1px solid rgba(214, 183, 255, 0.22);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.04);
  display: flex;
  justify-content: flex-start;
}

.privacy-panel h2 {
  font-size: 1.25rem;
  margin-bottom: 8px;
}

.privacy-panel p {
  margin: 0;
  line-height: 1.6;
  color: #f0e3ff;
}

.hero-side {
  display: flex;
  flex-direction: column;
  gap: 18px;
  align-items: stretch;
}

.hero-import {
  display: flex;
  flex-direction: column;
  gap: 14px;
  align-items: flex-start;
  width: 100%;
  padding: 22px;
  border: 1px solid rgba(214, 183, 255, 0.22);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.04);
}

.hero-import-text {
  margin: 0;
  color: #f0e3ff;
  font-weight: 500;
}

.btn {
  appearance: none;
  border: 0;
  border-radius: 999px;
  padding: 14px 18px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
}

.btn-primary {
  color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  box-shadow: 0 16px 28px rgba(142, 76, 255, 0.36);
}

.btn-secondary {
  color: #f5ecff;
  background: rgba(174, 122, 255, 0.18);
  border: 1px solid rgba(214, 183, 255, 0.22);
}

.btn-ghost {
  color: var(--text);
  background: rgba(244, 236, 255, 0.08);
  border: 1px solid rgba(214, 183, 255, 0.18);
}

.card-stack {
  display: grid;
  gap: 18px;
}

.form-card {
  padding: 28px;
  background: var(--surface);
  border: 2px solid var(--card-border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.section-heading {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 16px;
  align-items: start;
  margin-bottom: 22px;
}

.section-number {
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(184, 108, 255, 0.24), rgba(104, 62, 208, 0.2));
  color: #f4e8ff;
  font-weight: 700;
}

.section-heading p,
.subsection-header p,
.contact-card h3 + p,
.declaration p {
  margin: 6px 0 0;
  color: var(--muted);
  line-height: 1.55;
}

.grid,
.toggle-grid,
.contact-card-grid {
  display: grid;
  column-gap: 22px;
  row-gap: 30px;
}

.single-col {
  grid-template-columns: 1fr;
}

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

.postal-city-row {
  grid-template-columns: minmax(120px, 160px) minmax(220px, 1fr);
  column-gap: 12px;
  align-items: end;
}

.doctor-postal-city-row {
  grid-template-columns: minmax(120px, 160px) minmax(220px, 1fr);
  column-gap: 14px;
  align-items: end;
}

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

.textareas-two-col textarea {
  min-height: 108px;
}

.full-span {
  grid-column: 1 / -1;
}

.form-card > :where(.grid, .toggle-grid, .subsection, .optional-field-toggle, .contact-card-grid, label, .declaration)
  + :where(.grid, .toggle-grid, .subsection, .optional-field-toggle, .contact-card-grid, label, .declaration) {
  margin-top: 12px;
}

.block-gap-after {
  margin-bottom: 30px !important;
}

label {
  display: grid;
  gap: 6px;
}

.postal-code-input {
  max-width: 10ch;
  text-align: center;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.08em;
}

.yes-no-card,
.contact-card {
  display: grid;
  gap: 12px;
}

.yes-no-detail {
  display: grid;
  gap: 10px;
}

label > span,
.yes-no-card > span {
  font-size: 0.94rem;
  font-weight: 600;
  line-height: 1.2;
}

.label-note {
  display: block;
  margin-top: 4px;
  font-size: 0.78rem;
  font-weight: 500;
  line-height: 1.35;
  color: var(--muted);
}

.required-mark {
  color: #ffb2df;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-strong);
  color: var(--text);
  font: inherit;
  padding: 13px 14px;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

textarea {
  min-height: 88px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: rgba(195, 149, 255, 0.72);
  box-shadow: 0 0 0 4px rgba(184, 108, 255, 0.18);
}

.toggle-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 18px;
}

.yes-no-card,
.contact-card {
  padding: 16px;
  border: 1px solid var(--card-border-soft);
  background: linear-gradient(180deg, rgba(58, 31, 95, 0.96), rgba(42, 21, 72, 0.92));
  border-radius: 20px;
}

.yes-no-inline {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  align-items: center;
}

.yes-no-inline label {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  font-weight: 500;
}

input[type="radio"] {
  width: auto;
  margin: 0;
  accent-color: var(--primary);
}

.subsection {
  margin-top: 22px;
}

.vaccination-subsection {
  margin-top: 34px;
  margin-bottom: 10px;
}

.subsection-header {
  margin-bottom: 12px;
}

.subsection-header h3 {
  margin: 0;
  font-size: 1.2rem;
  color: #f2e7ff;
}

.section-split {
  align-items: start;
  column-gap: 24px;
}

.section-split-wide {
  column-gap: 38px;
}

.section-column {
  display: grid;
  gap: 12px;
  align-content: start;
}

.section-column-spacious {
  gap: 18px;
}

.storage-section-card .section-column .grid {
  row-gap: 18px;
}

.storage-section-card .section-column label + label,
.storage-section-card .section-column .grid + label,
.storage-section-card .section-column label + .grid {
  margin-top: 4px;
}

.table-grid {
  display: grid;
  gap: 10px;
  align-items: center;
}

.two-rows {
  grid-template-columns: 1.5fr 1fr;
}

.meds-grid {
  grid-template-columns: 1.2fr 0.95fr 0.75fr 0.9fr 1fr 0.9fr;
  column-gap: 14px;
}

.medication-row {
  display: grid;
  grid-template-columns: 1.2fr 0.95fr 0.75fr 0.9fr 1fr 0.9fr;
  gap: 14px;
  grid-column: 1 / -1;
}

.medication-until-disabled {
  opacity: 0.6;
}

.vaccination-row {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 10px;
  grid-column: 1 / -1;
}

.responsive-cell {
  min-width: 0;
}

.responsive-cell-label {
  display: none;
}

.hidden-med-row {
  display: none;
}

.hidden-vaccination-row {
  display: none;
}

.medication-actions {
  margin-top: 14px;
}

.vaccination-actions {
  margin-top: 18px;
  margin-bottom: 8px;
}

.optional-field-toggle {
  margin-top: 2px;
  margin-bottom: 2px;
}

.hidden-optional-field {
  display: none;
}

.hidden-conditional-detail {
  display: none;
}

.btn-inline {
  padding-inline: 20px;
}

.privacy-panel .btn,
.hero-import .btn {
  width: 100%;
  justify-content: center;
  text-align: center;
}

.table-head {
  font-size: 0.84rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #ddc1ff;
  padding: 2px 4px;
}

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

.single-contact-card {
  grid-template-columns: 1fr;
}

.single-contact-card > .contact-card:first-child {
  grid-column: 1 / -1;
}

.contact-person-2-controls {
  display: flex;
  justify-content: flex-start;
  margin-bottom: 16px;
}

.contact-card h3 {
  font-size: 1.5rem;
  color: #ead4ff;
}

.declaration {
  margin-bottom: 18px;
  padding: 16px 18px;
  border-left: 4px solid #d4a6ff;
  border-radius: 14px;
  background: rgba(184, 108, 255, 0.12);
}

.form-actions-card {
  padding-top: 22px;
  padding-bottom: 22px;
}

.project-note {
  margin: 20px 0 28px;
  padding: 18px 22px;
  border: 1px solid rgba(195, 149, 255, 0.42);
  border-radius: 20px;
  background: rgba(42, 23, 69, 0.72);
  box-shadow: 0 16px 40px rgba(9, 0, 26, 0.18);
  font-size: 0.9rem;
}

.project-note-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 52px;
}

.project-note-column {
  min-width: 0;
}

.project-note h2 {
  margin: 0 0 8px;
  font-size: 1rem;
  color: #f3e8ff;
}

.project-note p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
  font-size: 0.86rem;
}

.project-note-meta {
  margin-top: 10px !important;
  font-weight: 600;
}

.project-note-disclaimer {
  margin-top: 8px !important;
  font-size: 0.82rem;
  line-height: 1.45;
}

.form-actions-copy {
  margin-bottom: 18px;
}

.form-actions-copy h2 {
  font-size: 1.4rem;
  margin-bottom: 8px;
}

.form-actions-copy p {
  margin: 0;
  line-height: 1.6;
  color: var(--muted);
}

.option-switch {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 20px;
  padding: 14px 16px;
  border: 1px solid rgba(214, 183, 255, 0.18);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.04);
}

.option-switch input {
  width: auto;
  margin-top: 2px;
  accent-color: var(--primary);
}

.option-switch span {
  line-height: 1.5;
}

.form-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  max-width: 280px;
  padding: 12px 16px;
  border-radius: 14px;
  color: #fff;
  background: rgba(27, 12, 47, 0.94);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.22);
}

.modal-dialog {
  width: min(520px, calc(100% - 24px));
  padding: 0;
  border: 1px solid rgba(214, 183, 255, 0.24);
  border-radius: 22px;
  background: rgba(40, 18, 71, 0.98);
  color: var(--text);
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.45);
}

.modal-dialog::backdrop {
  background: rgba(9, 2, 20, 0.58);
}

.modal-content {
  display: grid;
  gap: 22px;
  padding: 28px;
}

.modal-dialog-wide {
  width: min(720px, calc(100% - 24px));
}

.modal-header {
  display: grid;
  gap: 10px;
}

.modal-header h2 {
  font-size: 1.55rem;
}

.modal-text {
  margin: 0;
  line-height: 1.6;
  color: #f3e9ff;
  font-size: 1.03rem;
}

.modal-copy {
  display: grid;
  gap: 12px;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 18px;
}

.summary-item {
  padding: 14px 16px;
  border: 1px solid var(--card-border-soft);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.04);
}

.summary-item strong {
  display: block;
  margin-bottom: 6px;
  font-size: 0.88rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #ead4ff;
}

.summary-item span {
  display: block;
  line-height: 1.5;
  color: var(--text);
}

body[data-theme="light"] {
  background:
    radial-gradient(circle at top left, rgba(91, 192, 222, 0.2), transparent 28%),
    radial-gradient(circle at top right, rgba(51, 124, 187, 0.16), transparent 24%),
    radial-gradient(circle at bottom center, rgba(240, 173, 78, 0.1), transparent 26%),
    linear-gradient(180deg, var(--bg), var(--bg-accent));
}

body[data-theme="light"]::before {
  background: rgba(51, 124, 187, 0.12);
}

body[data-theme="light"]::after {
  background: rgba(91, 192, 222, 0.16);
}

body[data-theme="light"] .hero {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(239, 243, 248, 0.98));
  border-color: rgba(51, 124, 187, 0.28);
}

body[data-theme="light"] .eyebrow,
body[data-theme="light"] .table-head {
  color: #337cbb;
}

body[data-theme="light"] .hero-text,
body[data-theme="light"] .hero-subtitle,
body[data-theme="light"] .privacy-panel p,
body[data-theme="light"] .hero-import-text,
body[data-theme="light"] .project-note p,
body[data-theme="light"] .modal-text {
  color: #314252;
}

body[data-theme="light"] .required-note,
body[data-theme="light"] .privacy-panel h2,
body[data-theme="light"] .theme-panel h2,
body[data-theme="light"] .subsection-header h3,
body[data-theme="light"] .contact-card h3,
body[data-theme="light"] .project-note h2,
body[data-theme="light"] .summary-item strong {
  color: #23547f;
}

body[data-theme="light"] .hero-text a {
  color: #23547f;
}

body[data-theme="light"] .privacy-panel,
body[data-theme="light"] .hero-import,
body[data-theme="light"] .theme-panel,
body[data-theme="light"] .option-switch,
body[data-theme="light"] .project-note {
  background: rgba(255, 255, 255, 0.82);
  border-color: rgba(51, 124, 187, 0.18);
}

body[data-theme="light"] .btn-secondary {
  color: #23547f;
  background: rgba(51, 124, 187, 0.08);
  border-color: rgba(51, 124, 187, 0.22);
}

body[data-theme="light"] .btn-ghost,
body[data-theme="light"] .theme-choice {
  background: rgba(255, 255, 255, 0.82);
  border-color: rgba(51, 124, 187, 0.18);
}

body[data-theme="light"] .theme-choice {
  color: #23547f;
}

body[data-theme="light"] .theme-choice.is-active {
  background: linear-gradient(135deg, #337cbb, #23547f);
  color: #fff;
  border-color: transparent;
}

body[data-theme="light"] .section-number {
  background: linear-gradient(135deg, #337cbb, #5bc0de);
  color: #fff;
}

body[data-theme="light"] .yes-no-card,
body[data-theme="light"] .contact-card {
  background: linear-gradient(180deg, rgba(246, 248, 251, 0.98), rgba(236, 240, 246, 0.95));
}

body[data-theme="light"] .declaration {
  border-left-color: #337cbb;
  background: rgba(51, 124, 187, 0.08);
}

body[data-theme="light"] .required-mark {
  color: #d9534f;
}

body[data-theme="light"] .toast {
  color: #23547f;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 12px 30px rgba(44, 74, 112, 0.18);
}

body[data-theme="light"] .modal-dialog {
  background: rgba(255, 255, 255, 0.98);
  color: #000;
  border-color: rgba(51, 124, 187, 0.18);
  box-shadow: 0 28px 70px rgba(44, 74, 112, 0.18);
}

body[data-theme="light"] .summary-item {
  background: rgba(241, 246, 251, 0.92);
  border-color: rgba(51, 124, 187, 0.18);
}

body[data-theme="light"] .modal-dialog::backdrop {
  background: rgba(54, 82, 115, 0.18);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}

@media (max-width: 960px) {
  .hero,
  .two-col,
  .postal-city-row,
  .doctor-postal-city-row,
  .three-col,
  .toggle-grid,
  .contact-card-grid,
  .meds-grid,
  .medication-row,
  .vaccination-row,
  .form-actions,
  .project-note-grid,
  .summary-grid {
    grid-template-columns: 1fr;
  }

  .table-head {
    display: none;
  }

  .medication-row,
  .vaccination-row {
    gap: 14px;
    padding: 14px;
    border: 1px solid var(--card-border-soft);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.03);
  }

  .responsive-cell {
    display: grid;
    gap: 6px;
  }

  .responsive-cell-label {
    display: block;
    font-size: 0.82rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted);
  }

  .modal-actions {
    justify-content: stretch;
  }
}

@media (max-width: 960px) {
  body[data-theme="light"] .medication-row,
  body[data-theme="light"] .vaccination-row {
    background: rgba(241, 246, 251, 0.92);
  }
}

@media (max-width: 640px) {
  .page-shell {
    width: min(100% - 20px, 1180px);
    padding-top: 14px;
  }

  .hero,
  .form-card {
    padding: 20px;
    border-radius: 22px;
  }

  .hero-import {
    align-items: stretch;
  }
}

@media print {
  body {
    background: #fff;
  }

  body::before,
  body::after,
  .form-actions-card,
  .toast {
    display: none !important;
  }

  .page-shell {
    width: 100%;
    padding: 0;
  }

  .hero,
  .form-card,
  .yes-no-card,
  .contact-card {
    box-shadow: none;
    background: #fff;
    border: 1px solid #d8d8d8;
  }

  .form-card,
  .hero {
    break-inside: avoid;
  }

  input,
  textarea {
    border-color: #ccc;
    background: #fff;
  }
}
