:root {
  color-scheme: light;
  --ink: #24201d;
  --muted: #6f6861;
  --paper: #fffdfb;
  --wash: #f7f2ed;
  --rose: #b46472;
  --rose-dark: #8e4153;
  --sage: #6d8068;
  --sage-soft: #eaf1e5;
  --line: #e7ddd5;
  --shadow: 0 18px 45px rgba(46, 38, 32, 0.13);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(180, 100, 114, 0.12), transparent 32rem),
    linear-gradient(180deg, #fffdfb 0%, #f4eee8 100%);
  color: var(--ink);
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.shell {
  width: min(100%, 920px);
  margin: 0 auto;
  padding: 0 0 max(2rem, env(safe-area-inset-bottom));
}

.brand-hero {
  position: relative;
  min-height: clamp(270px, 43vh, 420px);
  overflow: hidden;
  display: flex;
  align-items: flex-end;
  isolation: isolate;
}

.brand-hero__image,
.brand-hero__overlay {
  position: absolute;
  inset: 0;
}

.brand-hero__image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: -2;
}

.brand-hero__overlay {
  z-index: -1;
  background:
    linear-gradient(180deg, rgba(36, 32, 29, 0.08), rgba(36, 32, 29, 0.66)),
    linear-gradient(90deg, rgba(36, 32, 29, 0.5), transparent 70%);
}

.brand-hero__content {
  width: 100%;
  padding: calc(2.2rem + env(safe-area-inset-top)) 1.1rem 1.45rem;
  color: white;
}

.admin-pill {
  position: absolute;
  top: calc(0.85rem + env(safe-area-inset-top));
  right: 0.85rem;
  z-index: 2;
  min-height: 2.35rem;
  display: inline-grid;
  place-items: center;
  padding: 0 0.85rem;
  border: 1px solid rgba(255, 255, 255, 0.42);
  border-radius: 999px;
  background: rgba(255, 253, 251, 0.88);
  color: var(--rose-dark);
  font-size: 0.86rem;
  font-weight: 850;
  text-decoration: none;
  box-shadow: 0 8px 22px rgba(36, 32, 29, 0.18);
}

.eyebrow {
  margin: 0 0 0.4rem;
  color: var(--rose-dark);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.brand-hero .eyebrow {
  color: #f8d8dd;
}

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

h1 {
  margin-bottom: 0.55rem;
  font-size: clamp(2rem, 9vw, 4rem);
  line-height: 0.95;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0.25rem;
  font-size: 1.25rem;
  line-height: 1.2;
}

h3 {
  margin-bottom: 0.35rem;
  font-size: 1rem;
}

p {
  color: var(--muted);
  line-height: 1.55;
}

.brand-hero p {
  max-width: 32rem;
  margin-bottom: 0;
  color: rgba(255, 255, 255, 0.9);
}

.consent-form {
  display: grid;
  gap: 0.85rem;
  padding: 0.85rem;
}

.form-section,
.success-panel,
.detail-panel,
.empty-state {
  background: rgba(255, 253, 251, 0.94);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.form-section {
  padding: 1rem;
}

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

.section-heading p {
  margin-bottom: 0;
  font-size: 0.94rem;
}

.step {
  display: inline-grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border-radius: 999px;
  background: var(--sage-soft);
  color: #41523f;
  font-weight: 800;
}

.field,
.choice-group,
.signature-block {
  display: grid;
  gap: 0.45rem;
  margin-bottom: 1rem;
}

.field span,
.choice-group legend,
.signature-header {
  color: var(--ink);
  font-size: 0.91rem;
  font-weight: 750;
}

small {
  color: var(--muted);
  font-weight: 500;
}

input,
textarea {
  width: 100%;
  border: 1px solid #d9cec6;
  border-radius: 8px;
  background: white;
  color: var(--ink);
  min-height: 3.05rem;
  padding: 0.82rem 0.9rem;
  outline: none;
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

textarea {
  resize: vertical;
}

input:focus,
textarea:focus {
  border-color: var(--rose);
  box-shadow: 0 0 0 4px rgba(180, 100, 114, 0.16);
}

.field-grid {
  display: grid;
  gap: 0.85rem;
}

.check-row,
.choice-card,
.screening-item,
.notice,
.record-row {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffaf7;
}

.check-row {
  display: grid;
  grid-template-columns: 1.35rem 1fr;
  gap: 0.72rem;
  align-items: start;
  padding: 0.9rem;
  margin-bottom: 0.75rem;
  line-height: 1.45;
}

.check-row input {
  width: 1.15rem;
  height: 1.15rem;
  min-height: auto;
  margin: 0.13rem 0 0;
  accent-color: var(--rose-dark);
}

.statement {
  background: white;
}

.photo-consent {
  background: var(--sage-soft);
  border-color: #d8e4d3;
}

.choice-group {
  margin: 1rem 0 0;
  padding: 0;
  border: 0;
}

.choice-card {
  display: grid;
  grid-template-columns: 1.25rem 1fr;
  gap: 0.65rem;
  align-items: center;
  min-height: 3.5rem;
  padding: 0.75rem 0.9rem;
  margin-bottom: 0.62rem;
  font-weight: 750;
}

.choice-card input {
  width: 1.05rem;
  height: 1.05rem;
  min-height: auto;
  accent-color: var(--rose-dark);
}

.screening-list {
  display: grid;
  gap: 0.7rem;
  margin-bottom: 1rem;
}

.screening-item {
  display: grid;
  gap: 0.85rem;
  padding: 0.9rem;
}

.screening-item legend {
  display: contents;
  line-height: 1.45;
  font-weight: 700;
}

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

.segmented label {
  position: relative;
}

.segmented input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.segmented span {
  display: grid;
  place-items: center;
  min-height: 2.8rem;
  border: 1px solid #d9cec6;
  border-radius: 8px;
  background: white;
  color: var(--muted);
  font-weight: 800;
}

.segmented input:checked + span {
  border-color: var(--rose-dark);
  background: #f7e6e9;
  color: var(--rose-dark);
}

.notice {
  padding: 0.95rem;
  margin-bottom: 0.75rem;
}

.notice p {
  margin-bottom: 0;
}

.signature-block {
  margin-top: 0.5rem;
}

.signature-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

#signatureCanvas {
  width: 100%;
  height: 180px;
  border: 1px solid #d9cec6;
  border-radius: 8px;
  background: #fffdfb;
  touch-action: none;
}

.ghost-button,
.admin-action {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--rose-dark);
  min-height: 2.35rem;
  padding: 0.45rem 0.75rem;
  font-weight: 800;
  text-decoration: none;
}

.submit-button {
  width: 100%;
  min-height: 3.35rem;
  border: 0;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--rose-dark), #5f6f5d);
  color: white;
  font-weight: 850;
  box-shadow: 0 12px 30px rgba(142, 65, 83, 0.22);
}

.submit-button:disabled {
  cursor: wait;
  opacity: 0.7;
}

.form-message {
  min-height: 1.6rem;
  margin: 0.7rem 0;
  color: var(--rose-dark);
  font-weight: 750;
}

.form-message.success {
  color: var(--sage);
}

.success-panel {
  margin: 0.85rem;
  padding: 1.2rem;
}

.success-panel h2 {
  font-size: 1.8rem;
}

.hidden {
  display: none !important;
}

.admin-body {
  background: #f7f2ed;
}

.admin-shell {
  width: min(100%, 1100px);
  margin: 0 auto;
  padding: 1rem;
}

.admin-header {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  justify-content: space-between;
  padding: 1rem 0 1.2rem;
}

.admin-header h1 {
  margin: 0;
  color: var(--ink);
  font-size: clamp(2rem, 7vw, 3rem);
}

.admin-search {
  display: grid;
  gap: 0.65rem;
  margin-bottom: 1rem;
}

.record-list {
  display: grid;
  gap: 0.65rem;
}

.record-row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  padding: 0.85rem;
  color: var(--ink);
  text-decoration: none;
}

.record-row strong,
.record-row small {
  display: block;
}

.record-row small {
  margin-top: 0.2rem;
  color: var(--muted);
}

.record-meta {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.record-meta em {
  display: inline-grid;
  place-items: center;
  min-height: 1.75rem;
  padding: 0 0.55rem;
  border-radius: 999px;
  background: var(--sage-soft);
  color: #41523f;
  font-size: 0.75rem;
  font-style: normal;
  font-weight: 800;
}

.empty-state {
  padding: 1.25rem;
  text-align: center;
}

.detail-grid {
  display: grid;
  gap: 0.85rem;
  margin-bottom: 0.85rem;
}

.detail-panel {
  padding: 1rem;
  margin-bottom: 0.85rem;
}

dl {
  display: grid;
  gap: 0.7rem;
  margin: 0;
}

dt {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

dd {
  margin: -0.55rem 0 0;
  overflow-wrap: anywhere;
}

.answer-list {
  display: grid;
  gap: 0.55rem;
}

.answer-row {
  display: grid;
  gap: 0.35rem;
  padding: 0.75rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.answer-row strong {
  color: var(--rose-dark);
}

.review-note {
  margin-top: 0.85rem;
  background: #fffaf7;
}

.signature-image {
  display: block;
  width: 100%;
  max-width: 520px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

@media (min-width: 680px) {
  .consent-form {
    gap: 1rem;
    padding: 1rem;
  }

  .form-section,
  .success-panel,
  .detail-panel {
    padding: 1.25rem;
  }

  .field-grid,
  .detail-grid {
    grid-template-columns: 1fr 1fr;
  }

  .admin-search {
    grid-template-columns: 1fr auto;
    align-items: end;
  }

  .admin-search .submit-button {
    width: 11rem;
    margin-bottom: 1rem;
  }
}
