:root {
  color-scheme: light;
  --ink: #17302a;
  --quiet: #4b5d56;
  --line: #a6b7ac;
  --gold: #ead28c;
  --green: #075846;
  --green-hover: #064333;
  --pale: #eaf3ed;
  --paper: #fbfaf5;
  --danger: #982840;
  --focus: #83580c;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 100%;
  color: var(--ink);
  background: var(--paper);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; font-size: 1.25rem; line-height: 1.5; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .58; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 4px; }
p { margin-block: 0 .9rem; }
h1, h2, h3 { line-height: 1.16; margin-block: 0 .65em; overflow-wrap: anywhere; }
h1 { font-size: clamp(1.9rem, 4.2vw, 2.65rem); letter-spacing: -.03em; }
h2 { font-size: 1.45rem; }
h3 { font-size: 1.25rem; }
#screen-title:focus { outline: none; }

.practice-header { background: #142a24; border-bottom: 3px solid #b99b5b; }
.header-inner {
  min-height: 96px;
  max-width: 58rem;
  margin: auto;
  padding: .35rem clamp(.75rem, 3vw, 2.2rem);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .65rem;
}
.practice-logo { width: clamp(118px, 26vw, 188px); height: auto; flex-shrink: 0; }
.header-actions { display: flex; gap: .55rem; align-items: center; justify-content: flex-end; }
.header-button.button { color: #fff8e6; border-color: #91a398; min-height: 60px; background: transparent; font-size: 1rem; }
.header-button.button:hover { background: #264237; }
.header-button:focus-visible { outline-color: var(--gold); }

.main-content { max-width: 53rem; margin: auto; padding: clamp(.9rem, 3vw, 2rem) clamp(.6rem, 3vw, 1.75rem) max(1.4rem, env(safe-area-inset-bottom)); }
.surface { padding: clamp(1.05rem, 4.4vw, 2.1rem); border: 1px solid #d2dcd1; border-radius: 1.25rem; background: #fff; }
.intro { max-width: 48ch; color: var(--quiet); }
.centered { text-align: center; padding-block: clamp(.65rem, 3.5vw, 2.4rem); }
.centered p { margin-inline: auto; max-width: 42ch; }
.centered .button { margin-top: .4rem; }
.centered .privacy-note { margin: 1.35rem auto 0; }
.privacy-note, .hint { color: var(--quiet); font-size: 1.02rem; }
.waiting-device { font-weight: 650; overflow-wrap: anywhere; }
.pair-code { display: block; margin: 1rem auto; background: var(--pale); border: 1px solid var(--line); border-radius: .8rem; width: fit-content; max-width: 100%; padding: .55rem .85rem; font-size: clamp(1.45rem, 5.8vw, 2.9rem); font-weight: 750; letter-spacing: .1em; font-variant-numeric: tabular-nums; user-select: all; }

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 62px;
  padding: .62rem 1rem;
  border: 2px solid var(--line);
  border-radius: .68rem;
  color: var(--ink);
  background: #fff;
  font-weight: 700;
  text-align: center;
  line-height: 1.22;
  overflow-wrap: anywhere;
}
.button:hover { background: var(--pale); }
.button.primary { background: var(--green); color: #fff; border-color: var(--green); min-height: 68px; }
.button.primary:hover { background: var(--green-hover); border-color: var(--green-hover); }
.button.remove { color: var(--danger); }
.actions { margin-top: 1.65rem; padding-top: 1.05rem; border-top: 1px solid #d2dcd1; display: flex; align-items: stretch; flex-wrap: wrap; gap: .75rem; }
.actions .button { min-width: 9.5rem; }
.actions .primary { margin-inline-start: auto; }
.inline-actions { display: flex; flex-wrap: wrap; gap: .65rem; align-items: center; }

.progress-label { margin-bottom: .45rem; font-size: 1.05rem; font-weight: 750; color: var(--green); }
.progress-line { display: grid; grid-template-columns: repeat(5, 1fr); gap: .45rem; margin-bottom: 1.3rem; }
.progress-line span { height: .48rem; background: #dbe6df; border-radius: 20px; }
.progress-line .complete { background: var(--green); }

.field { display: block; margin: 0 0 1.05rem; min-width: 0; }
.field label { display: block; margin-bottom: .35rem; font-weight: 680; }
.required-mark { color: var(--green); }
.field input, .field select, .field textarea {
  display: block;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  min-height: 64px;
  padding: .63rem .75rem;
  border: 2px solid var(--line);
  border-radius: .64rem;
  background: #fff;
  color: var(--ink);
}
.field input::placeholder, .field textarea::placeholder { color: #596861; opacity: 1; }
.field input[type="date"] { appearance: none; }
.field textarea { min-height: 106px; resize: vertical; }
.form-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .85rem; }
.form-row.address { grid-template-columns: 1fr 2fr; }
.fields { border: 0; padding: 0; margin: 0 0 1.1rem; min-width: 0; }
.fields legend { font-weight: 700; padding: 0; margin-bottom: .45rem; }
.choice-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 10rem), 1fr)); gap: .6rem; align-items: stretch; }
.choice, .check-option {
  position: relative;
  min-height: 65px;
  display: flex;
  align-items: center;
  gap: .65rem;
  border: 2px solid var(--line);
  border-radius: .64rem;
  padding: .65rem .8rem;
  line-height: 1.32;
  cursor: pointer;
  overflow-wrap: anywhere;
}
.choice:hover, .check-option:hover { background: #f1f6f2; }
.choice:has(input:checked), .check-option:has(input:checked) { background: var(--pale); border-color: var(--green); }
.choice:focus-within, .check-option:focus-within { box-shadow: 0 0 0 2px var(--focus); }
.choice input, .check-option input { flex: 0 0 auto; width: 1.35rem; height: 1.35rem; margin: 0; accent-color: var(--green); }
.check-option { margin-block: .6rem 1.05rem; }

.pet-card, .terms-block, .review-block { margin-block: 1.08rem; padding: clamp(.75rem, 3.3vw, 1.15rem); border: 1px solid #bfcec3; border-radius: .85rem; }
.pet-card h2, .review-block h2, .terms-block h2 { margin-bottom: .85rem; }
.card-head { display: flex; flex-wrap: wrap; align-items: center; gap: .45rem .7rem; justify-content: space-between; margin-bottom: .7rem; }
.card-head h2 { margin: 0; }
.card-head .button { font-size: 1rem; }
.terms-block { background: #fbfcfa; }
.terms-block p { white-space: pre-wrap; overflow-wrap: anywhere; margin-bottom: 0; }
details { margin: .55rem 0; }
summary { min-height: 62px; padding: .86rem .22rem; color: var(--green); font-weight: 700; cursor: pointer; }
details[open] summary { margin-bottom: .45rem; }
.review-list { display: grid; grid-template-columns: minmax(8rem, 1fr) minmax(0, 1.65fr); gap: .42rem .85rem; margin: 0; line-height: 1.42; }
.review-list dt { font-weight: 650; }
.review-list dd { margin: 0; overflow-wrap: anywhere; white-space: pre-wrap; }
.review-block .button { margin-top: .75rem; }

.status-message { padding: .7rem .9rem; margin-bottom: .65rem; border-radius: .65rem; background: #fff2d3; color: #54380c; border: 1px solid #9c751d; font-size: 1.05rem; }
.status-message.success { background: var(--pale); color: #143b2f; border-color: var(--green); }
.error-message, .status-message.error { padding: .72rem .9rem; color: #811f34; background: #fff0f1; border: 1px solid #c56d7c; border-radius: .65rem; }
.error-message { margin-block: .95rem .25rem; }
.field-error { color: var(--danger); font-weight: 650; margin: -.15rem 0 1rem; }
input[aria-invalid="true"], textarea[aria-invalid="true"], .signature-pad[aria-invalid="true"] { border-color: var(--danger); }
.emergency-note { margin-block: .9rem 0; font-size: 1.05rem; }

.signature-heading { margin-top: 1.45rem; }
.signature-pad {
  display: block;
  width: 100%;
  height: clamp(165px, 27vw, 220px);
  border: 2px solid #759486;
  border-radius: .65rem;
  touch-action: none;
  background: #fff;
  cursor: crosshair;
}
.signature-actions { margin-top: .65rem; }
.signature-actions .button { font-size: 1.05rem; }
.signature-actions .hint { margin: 0; }

@media (max-width: 580px) {
  body { font-size: 1.125rem; }
  .header-inner { min-height: 85px; }
  .header-actions { gap: .35rem; }
  .header-button.button { padding-inline: .45rem; line-height: 1.16; }
  .form-row, .form-row.address { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .actions { gap: .55rem; }
  .actions .button { flex: 1 1 7.5rem; min-width: 0; }
  .review-list { display: block; }
  .review-list dd { margin-bottom: .5rem; }
}

@media (prefers-reduced-motion: no-preference) {
  .button { transition: background-color .12s ease; }
}
