:root {
  --ink: #2F2C25;
  --text: #3D3A31;
  --muted: #5C574C;
  --cream: #FEFAF3;
  --sand: #F2ECE1;
  --page: #E9E4DA;
  --line: rgba(47, 44, 37, 0.16);
  --line-strong: rgba(47, 44, 37, 0.24);
  --error: #A12C1F;
  --disabled: #D9D3C7;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--page);
  color: var(--text);
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font-family: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; }
:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }
input::placeholder, textarea::placeholder { color: #7A7468; }

.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;
}
.noscript { margin: 24px 16px; font-size: 17px; line-height: 1.5; }

/* Page shell: full screen on phones, a centered card on larger screens */
.shell {
  max-width: 560px;
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--cream);
}
@media (min-width: 600px) {
  .shell {
    margin: 32px auto;
    min-height: calc(100vh - 64px);
    border-radius: 20px;
    box-shadow: 0 1px 2px rgba(47, 44, 37, 0.08), 0 12px 40px rgba(47, 44, 37, 0.12);
  }
  .top { border-radius: 20px 20px 0 0; }
  .foot { border-radius: 0 0 20px 20px; }
}

/* Header */
.top {
  height: 64px;
  flex-shrink: 0;
  padding: 0 12px 0 16px;
  background: var(--ink);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.top img { height: 40px; width: auto; display: block; }
.top :focus-visible { outline-color: var(--cream); }
.lang { display: flex; gap: 4px; }
.lang button {
  min-width: 44px; height: 44px; padding: 0 10px; border-radius: 8px;
  border: 2px solid rgba(254, 250, 243, 0.4); background: transparent; color: var(--cream);
  font-size: 14px; font-weight: 700; letter-spacing: 0.5px;
}
.lang button[aria-pressed="true"] { background: var(--cream); border-color: var(--cream); color: var(--ink); font-weight: 800; }

.demo { background: #FFF1C2; color: #4A3B00; font-size: 13px; line-height: 1.4; font-weight: 600; padding: 8px 16px; text-align: center; }

/* Progress */
.progress { flex-shrink: 0; padding: 16px 20px 0; }
.progress-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; font-size: 13px; font-weight: 600; color: var(--muted); }
.progress-row .step { letter-spacing: 0.6px; text-transform: uppercase; }
.bars { display: flex; gap: 6px; margin-top: 10px; }
.bars span { flex: 1 1 0; height: 4px; border-radius: 2px; background: rgba(47, 44, 37, 0.14); }
.bars span.done { background: var(--ink); }

/* Content */
.content { flex: 1 0 auto; padding: 20px 20px 28px; display: flex; flex-direction: column; gap: 14px; }
h1 { margin: 0; font-size: 28px; line-height: 1.15; font-weight: 900; color: var(--ink); }
h1:focus { outline: none; }
h2 { margin: 10px 0 0; font-size: 18px; line-height: 1.3; font-weight: 800; color: var(--ink); }
.sub { margin: 0; font-size: 15px; line-height: 1.45; color: var(--muted); }
.stack { display: flex; flex-direction: column; gap: 12px; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }

.urgent { padding: 12px 14px 2px; border-radius: 12px; background: var(--sand); border: 2px solid rgba(47, 44, 37, 0.18); }
.urgent p { margin: 0; font-size: 15px; line-height: 1.4; font-weight: 600; color: var(--ink); }
.call { min-height: 44px; display: inline-flex; align-items: center; gap: 8px; font-size: 16px; font-weight: 700; color: var(--ink); }
.call:hover { color: #000; }
.call-row { display: flex; flex-direction: column; margin-top: 4px; }

/* Visit-type choices */
.choice {
  width: 100%; min-height: 68px; display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; text-align: left; border-radius: 12px;
  border: 2px solid var(--line); background: #FFFFFF; color: var(--ink);
}
.choice-text { flex: 1 1 auto; display: flex; flex-direction: column; gap: 3px; }
.choice .t { font-size: 17px; font-weight: 700; }
.choice .s { font-size: 14px; line-height: 1.35; color: var(--muted); }
.choice .d { font-size: 13px; font-weight: 700; color: var(--muted); }
.choice svg { flex-shrink: 0; }
.choice[aria-pressed="true"] { border-color: var(--ink); background: var(--ink); color: var(--cream); }
.choice[aria-pressed="true"] .s, .choice[aria-pressed="true"] .d { color: #E8E2D6; }

.pill {
  min-height: 52px; padding: 8px 10px; border-radius: 10px;
  border: 2px solid var(--line); background: #FFFFFF; color: var(--ink);
  font-size: 16px; font-weight: 600;
}
.pill[aria-pressed="true"] { border-color: var(--ink); background: var(--ink); color: var(--cream); font-weight: 700; }

/* Days and times */
.days { display: flex; gap: 8px; overflow-x: auto; margin: 0 -20px; padding: 2px 20px 6px; scrollbar-width: thin; }
.day {
  flex: 0 0 auto; width: 76px; height: 80px; border-radius: 12px;
  border: 2px solid var(--line); background: #FFFFFF; color: var(--ink);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
}
.day .w { font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; color: var(--muted); }
.day .n { font-size: 24px; font-weight: 800; line-height: 1.1; }
.day .m { font-size: 13px; text-transform: capitalize; color: var(--muted); }
.day[aria-pressed="true"] { border-color: var(--ink); background: var(--ink); color: var(--cream); }
.day[aria-pressed="true"] .w, .day[aria-pressed="true"] .m { color: var(--cream); }
.dayhead { margin: 0; font-size: 16px; font-weight: 700; }
.times { display: grid; grid-template-columns: 1fr; gap: 8px; }
.period { margin: 6px 0 0; font-size: 13px; font-weight: 700; letter-spacing: 0.6px; text-transform: uppercase; color: var(--muted); }
.time {
  height: 48px; border-radius: 10px; border: 2px solid var(--line);
  background: #FFFFFF; color: var(--ink); font-size: 16px; font-weight: 600;
}
.time[aria-pressed="true"] { border-color: var(--ink); background: var(--ink); color: var(--cream); font-weight: 700; }

.skeleton {
  border-color: transparent;
  background: linear-gradient(90deg, #EFE9DE 25%, #F8F4EC 50%, #EFE9DE 75%);
  background-size: 200% 100%;
  animation: shimmer 1.2s ease-in-out infinite;
}
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }
@media (prefers-reduced-motion: reduce) { .skeleton { animation: none; } }

/* Form */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label, .field .label { font-size: 15px; font-weight: 600; color: var(--ink); }
.field input, .field select, .field textarea {
  width: 100%; height: 52px; padding: 0 14px; border-radius: 10px;
  border: 2px solid var(--line-strong); background: #FFFFFF; font-size: 17px; color: var(--ink);
}
.field select { padding: 0 12px; }
.field textarea { height: auto; padding: 12px 14px; line-height: 1.4; resize: vertical; }
.field [aria-invalid="true"] { border-color: var(--error); }
.err { font-size: 14px; font-weight: 600; color: var(--error); }
.check { display: flex; align-items: center; gap: 12px; min-height: 48px; font-size: 16px; line-height: 1.35; color: var(--ink); }
.check input { width: 24px; height: 24px; margin: 0; flex-shrink: 0; accent-color: var(--ink); }
.note { font-size: 14px; line-height: 1.4; font-weight: 600; color: var(--ink); background: var(--sand); border-radius: 8px; padding: 10px 12px; }
.note[hidden] { display: none; }
.hp { position: absolute; left: -10000px; top: auto; width: 1px; height: 1px; overflow: hidden; }

/* Review */
.card { border-radius: 14px; background: #FFFFFF; border: 1px solid rgba(47, 44, 37, 0.12); padding: 2px 16px; }
.row { display: flex; align-items: flex-start; gap: 12px; padding: 14px 0; border-bottom: 1px solid rgba(47, 44, 37, 0.1); }
.row:last-child { border-bottom: 0; }
.row-body { flex: 1 1 auto; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.row .k { font-size: 13px; font-weight: 600; letter-spacing: 0.5px; text-transform: uppercase; color: var(--muted); }
.row .v { font-size: 17px; font-weight: 700; color: var(--ink); overflow-wrap: anywhere; }
.row .x { font-size: 15px; color: var(--muted); overflow-wrap: anywhere; }
.linkbtn { min-height: 44px; padding: 0 6px; border: none; background: transparent; font-size: 15px; font-weight: 700; color: var(--ink); text-decoration: underline; }
.alert { border-radius: 12px; padding: 12px 14px; background: #FBECE9; border: 2px solid #E2B1A8; color: #6B1E14; font-size: 15px; line-height: 1.45; font-weight: 600; }
.alert:focus { outline: none; }
.alert a { color: inherit; }
.ts { min-height: 65px; }

/* Done */
.done-icon { width: 64px; height: 64px; border-radius: 32px; background: var(--ink); display: flex; align-items: center; justify-content: center; margin-top: 4px; }
.big { margin: 0; font-size: 17px; line-height: 1.45; color: var(--text); }
.summary { border-radius: 14px; background: #FFFFFF; border: 1px solid rgba(47, 44, 37, 0.12); padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.summary div { display: flex; flex-direction: column; gap: 3px; }
.summary .k { font-size: 13px; font-weight: 600; letter-spacing: 0.5px; text-transform: uppercase; color: var(--muted); }
.summary .v { font-size: 17px; font-weight: 700; color: var(--ink); }
.summary .x { font-size: 15px; color: var(--muted); }
.actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.actions a, .actions button {
  min-height: 52px; padding: 6px 10px; border-radius: 10px; border: 2px solid var(--ink); background: transparent;
  display: flex; align-items: center; justify-content: center; text-align: center;
  font-size: 15px; font-weight: 700; color: var(--ink); text-decoration: none;
}
.bring { border-radius: 14px; background: var(--sand); padding: 16px; }
.bring h2 { margin: 0; font-size: 16px; }
.bring ul { margin: 8px 0 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; font-size: 15px; line-height: 1.4; color: var(--text); }
.callbig {
  min-height: 56px; border-radius: 12px; background: var(--ink); color: var(--cream);
  display: flex; align-items: center; justify-content: center; gap: 10px;
  font-size: 18px; font-weight: 700; text-decoration: none;
}

/* Footer buttons */
.foot {
  position: sticky; bottom: 0; flex-shrink: 0;
  display: flex; gap: 10px;
  padding: 12px 16px calc(22px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid rgba(47, 44, 37, 0.1);
  background: var(--cream);
}
.btn { height: 52px; border-radius: 10px; font-size: 17px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; gap: 10px; }
a.btn { text-decoration: none; }
.btn-primary { flex: 1 1 auto; border: none; background: var(--ink); color: var(--cream); }
.btn-primary:disabled { background: var(--disabled); color: var(--muted); }
.btn-ghost { padding: 0 18px; border: 2px solid var(--ink); background: transparent; color: var(--ink); font-size: 16px; }
.btn-wide { flex: 1 1 auto; }
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 3px solid rgba(92, 87, 76, 0.35); border-top-color: var(--muted); animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2.4s; } }
