:root {
  --bg: #faf7f4;
  --surface: #ffffff;
  --surface-soft: #f6f0eb;
  --surface-tint: #fbf6f2;
  --ink: #2f2723;
  --muted: #756a64;
  --brand: #ad7049;
  --brand-deep: #875438;
  --brand-soft: #ead8ca;
  --sand: #c8b89e;
  --pink: #d98ca8;
  --pink-soft: #faedf2;
  --line: #e9e0d9;
  --line-strong: #d8cbc2;
  --success: #47735e;
  --success-soft: #edf5f0;
  --warning: #8d642e;
  --warning-soft: #fff6e8;
  --danger: #a34d4d;
  --danger-soft: #fff0f0;
  --shadow-soft: 0 18px 48px rgba(66, 43, 32, .07);
  --shadow-float: 0 12px 34px rgba(66, 43, 32, .08);
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 12px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Helvetica Neue", Arial, sans-serif;
  --font-display: "Iowan Old Style", Baskerville, "Times New Roman", serif;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button, input, select, textarea { -webkit-tap-highlight-color: transparent; }
button:disabled { cursor: default; }
#app { min-height: 100vh; }

.shell { min-height: 100vh; display: flex; flex-direction: column; }
.kiosk-shell {
  width: min(100%, 860px);
  min-height: 100vh;
  margin: 0 auto;
  padding: max(28px, env(safe-area-inset-top)) 28px max(32px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
}
.admin-shell { max-width: 1320px; width: 100%; margin: 0 auto; padding: 24px; }

/* Authentic Hibiscus wordmark extracted from the approved brand artwork. */
.brand-wordmark {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 0 auto;
  user-select: none;
}
.brand-wordmark img {
  display: block;
  width: min(286px, 62vw);
  height: auto;
}
.brand-wordmark.compact { justify-content: center; margin: 0; }
.brand-wordmark.compact img { width: 156px; }

/* Premium kiosk home */
.kiosk-home {
  justify-content: center;
  padding-top: max(40px, env(safe-area-inset-top));
  padding-bottom: max(40px, env(safe-area-inset-bottom));
}
.home-brand { margin-bottom: 52px; }
.home-main { width: min(100%, 620px); margin: 0 auto; }
.home-intro { text-align: center; margin-bottom: 30px; }
.home-kicker {
  margin-bottom: 11px;
  color: var(--brand);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .15em;
  text-transform: uppercase;
}
.home-intro h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(39px, 5vw, 52px);
  font-weight: 500;
  line-height: 1.04;
  letter-spacing: -.025em;
}
.home-intro p {
  max-width: 480px;
  margin: 15px auto 0;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.55;
}
.arrival-actions { display: grid; gap: 14px; }
.arrival-option {
  width: 100%;
  min-height: 96px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 20px 22px 20px 24px;
  border: 1px solid var(--line);
  border-radius: 19px;
  background: rgba(255,255,255,.96);
  color: var(--ink);
  text-align: left;
  box-shadow: 0 8px 28px rgba(72, 48, 37, .045);
  transition: transform .08s ease, border-color .16s ease, box-shadow .16s ease, background .16s ease;
}
.arrival-option:active { transform: scale(.99); }
.arrival-option:focus-visible { outline: 3px solid rgba(173,112,73,.18); outline-offset: 3px; }
.arrival-option:hover { border-color: #d8c5b9; box-shadow: var(--shadow-float); }
.arrival-primary { background: #fbf6f2; border-color: #dcc9bd; }
.arrival-option strong {
  display: block;
  font-size: 21px;
  font-weight: 650;
  letter-spacing: -.015em;
}
.arrival-option small {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
  font-weight: 450;
}
.arrival-arrow {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  background: #f3ebe5;
  color: var(--brand-deep);
  font-size: 22px;
  font-weight: 450;
}
.arrival-primary .arrival-arrow { background: var(--brand); color: #fff; }
.privacy-note {
  margin: 18px auto 0;
  text-align: center;
  color: #968a83;
  font-size: 12.5px;
  line-height: 1.5;
}

/* Journey shell */
.topbar {
  min-height: 64px;
  display: grid;
  grid-template-columns: 80px 1fr 80px;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}
.topbar-spacer { width: 80px; }
.exit-link {
  justify-self: start;
  min-width: 52px;
  min-height: 44px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--muted);
  font-size: 15px;
  font-weight: 600;
  padding: 10px 8px;
}
.exit-link:hover { background: #f2ebe6; color: var(--ink); }
.exit-link:focus-visible { outline: 3px solid rgba(173,112,73,.18); }

.progress-wrap { width: min(100%, 700px); margin: 10px auto 18px; }
.progress-label {
  display: flex;
  justify-content: space-between;
  color: #8e817a;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 8px;
}
.progress { height: 4px; background: #ece4de; border-radius: 999px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--brand); border-radius: inherit; transition: width .2s ease; }

.card {
  background: var(--surface);
  border: 1px solid rgba(226, 216, 209, .9);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-soft);
  padding: 32px;
}
.card + .card { margin-top: 18px; }
.journey-card { width: min(100%, 700px); margin: 0 auto; padding: 38px 40px 36px; }

.step { max-width: 620px; margin: 0 auto; }
.step h2 {
  margin: 0 0 10px;
  font-family: var(--font-display);
  font-size: clamp(34px, 4.4vw, 46px);
  line-height: 1.06;
  letter-spacing: -.02em;
  font-weight: 500;
}
.step .lead {
  color: var(--muted);
  margin: 0 0 30px;
  font-size: 16px;
  line-height: 1.55;
}

.field { margin-bottom: 22px; }
.field > label {
  display: block;
  margin-bottom: 9px;
  color: #4d433e;
  font-size: 14px;
  font-weight: 650;
}
.field .hint, .field-help {
  margin-top: 7px;
  color: #8d817a;
  font-size: 12.5px;
  line-height: 1.4;
}
.input, .select, .textarea {
  width: 100%;
  min-height: 62px;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  padding: 14px 16px;
  background: #fff;
  color: var(--ink);
  outline: none;
  font-size: 18px;
  box-shadow: none;
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
.input::placeholder, .textarea::placeholder { color: #b5aba5; }
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 4px rgba(173,112,73,.09);
}
.input.input-error { border-color: var(--danger); box-shadow: 0 0 0 4px rgba(163,77,77,.08); }
.textarea { min-height: 104px; resize: vertical; }
.phone-control { position: relative; }
.phone-input {
  padding-right: 78px;
  font-variant-numeric: tabular-nums;
  letter-spacing: .045em;
  font-size: 22px;
}
.phone-count {
  position: absolute;
  top: 50%;
  right: 16px;
  transform: translateY(-50%);
  color: #9c9089;
  font-size: 12px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}
.field-error {
  margin-top: 8px;
  color: var(--danger);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.45;
}
.field-error[hidden] { display: none; }

.btn {
  min-height: 56px;
  border: 1px solid transparent;
  border-radius: 14px;
  padding: 14px 20px;
  font-weight: 650;
  letter-spacing: -.005em;
  transition: transform .08s ease, background .15s ease, border-color .15s ease, box-shadow .15s ease, opacity .15s ease;
}
.btn:active:not(:disabled) { transform: scale(.99); }
.btn:focus-visible { outline: 3px solid rgba(173,112,73,.18); outline-offset: 3px; }
.btn-primary { background: var(--brand); color: #fff; box-shadow: 0 8px 20px rgba(173,112,73,.16); }
.btn-primary:hover:not(:disabled) { background: var(--brand-deep); }
.btn-primary:disabled { background: #d9cdc6; color: #fff; box-shadow: none; opacity: .82; }
.btn-secondary { background: var(--pink-soft); color: #714552; border-color: #edd8df; }
.btn-secondary:hover { background: #f7e2e9; }
.btn-ghost { background: #fff; color: #62544d; border-color: var(--line-strong); }
.btn-ghost:hover { background: #faf7f4; }
.btn-danger { background: var(--danger-soft); color: var(--danger); }
.btn-sm { min-height: 42px; padding: 9px 14px; border-radius: 11px; font-size: 14px; }
.btn-block { width: 100%; }

.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.choice-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.choice-grid.three { grid-template-columns: repeat(3, minmax(0,1fr)); }
.choice { position: relative; }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice label {
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  background: #fff;
  padding: 12px 13px;
  color: #534943;
  font-size: 14.5px;
  font-weight: 600;
  transition: background .14s ease, border-color .14s ease, box-shadow .14s ease, transform .08s ease;
}
.choice label:active { transform: scale(.99); }
.choice input:checked + label {
  background: #f8f0ea;
  border-color: #c79a7c;
  box-shadow: inset 0 0 0 1px #c79a7c;
  color: var(--brand-deep);
}
.choice input:focus-visible + label { outline: 3px solid rgba(173,112,73,.16); outline-offset: 2px; }
.source-grid .choice label { min-height: 52px; font-size: 13.5px; }

.choice-list { display: grid; gap: 10px; }
.choice-row label { min-height: 72px; justify-content: space-between; text-align: left; padding: 16px 17px; }
.choice-row label > span:first-child { display: flex; flex-direction: column; gap: 4px; }
.choice-row label small { color: var(--muted); font-weight: 450; line-height: 1.35; }
.radio-dot {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid #cbbeb6;
  flex: 0 0 auto;
  margin-left: 16px;
  box-shadow: inset 0 0 0 4px #fff;
}
.choice-row input:checked + label .radio-dot { background: var(--brand); border-color: var(--brand); }

.client-confirm {
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fbf8f5;
  margin: 18px 0;
}
.client-avatar {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #f1e7df;
  color: var(--brand-deep);
  font-size: 21px;
  font-weight: 700;
  border: 1px solid #e5d6cc;
}
.client-confirm strong { font-size: 19px; letter-spacing: -.01em; }
.compact-field { margin: 12px 0 0; }
.question { padding: 19px 0; border-top: 1px solid var(--line); }
.question:first-of-type { border-top: 0; padding-top: 0; }
.question-title { color: #433a35; font-weight: 650; line-height: 1.45; margin-bottom: 12px; }
.inline-actions { display: flex; gap: 10px; margin-top: 28px; }
.inline-actions > * { flex: 1; }

.notice {
  border-radius: 15px;
  padding: 16px 17px;
  background: #faf6f2;
  color: #66574f;
  line-height: 1.58;
  margin: 14px 0;
  border: 1px solid #ede2db;
}
.notice.warning { background: var(--warning-soft); color: #74511f; border-color: #f1dfbe; }
.notice.success { background: var(--success-soft); color: #315c49; border-color: #d5e8dd; }

.signature-wrap { border: 1px solid var(--line-strong); border-radius: 15px; background: #fff; overflow: hidden; }
.signature-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 11px 13px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 13px; }
.signature-canvas { display: block; width: 100%; height: 220px; touch-action: none; background: linear-gradient(#fff 0 83%, #e8dfd9 83% 83.5%, #fff 83.5% 100%); }
.signature-preview { max-width: 320px; max-height: 120px; object-fit: contain; }

.done { text-align: center; padding: 38px 28px 30px; }
.done-mark { width: 68px; height: 68px; margin: 0 auto 20px; border-radius: 50%; display: grid; place-items: center; background: var(--success-soft); color: var(--success); font-size: 29px; }
.done h2 { font-family: var(--font-display); font-size: 40px; line-height: 1.08; letter-spacing: -.02em; font-weight: 500; margin: 0 0 10px; }
.done p { color: var(--muted); line-height: 1.55; }

/* Staff/Admin route */
.admin-layout { display: grid; grid-template-columns: 230px 1fr; gap: 22px; }
.sidebar { background: rgba(255,255,255,.96); border: 1px solid var(--line); border-radius: 24px; padding: 14px; height: fit-content; position: sticky; top: 18px; box-shadow: var(--shadow-soft); }
.nav-btn { width: 100%; border: 0; background: transparent; text-align: left; padding: 13px 14px; border-radius: 13px; color: var(--muted); font-weight: 680; margin-bottom: 4px; }
.nav-btn.active { background: var(--surface-soft); color: var(--brand-deep); }
.metrics { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.metric { background: #fff; border: 1px solid var(--line); border-radius: 19px; padding: 17px; box-shadow: 0 8px 24px rgba(73,43,31,.04); }
.metric .value { font-size: 29px; font-weight: 760; letter-spacing: -.04em; margin-bottom: 4px; }
.metric .label { color: var(--muted); font-size: 13px; line-height: 1.35; }
.dashboard-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 18px; }
.panel { background: #fff; border: 1px solid var(--line); border-radius: 22px; padding: 20px; box-shadow: 0 8px 24px rgba(73,43,31,.04); }
.panel h3 { margin: 0 0 15px; font-size: 17px; }
.bar-row { display: grid; grid-template-columns: 120px 1fr 44px; align-items: center; gap: 10px; margin: 11px 0; }
.bar-label { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { height: 9px; background: #eee5df; border-radius: 999px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--brand); border-radius: inherit; }
.bar-value { font-weight: 700; text-align: right; font-size: 13px; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 20px; background: #fff; }
table { width: 100%; border-collapse: collapse; min-width: 720px; }
th, td { text-align: left; padding: 13px 14px; border-bottom: 1px solid var(--line); font-size: 14px; vertical-align: middle; }
th { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; background: #fcfaf8; }
tr:last-child td { border-bottom: 0; }
.badge { display: inline-flex; align-items: center; min-height: 28px; padding: 5px 9px; border-radius: 999px; background: var(--surface-soft); color: #715344; font-size: 12px; font-weight: 700; }
.badge.pink { background: var(--pink-soft); color: #81435a; }
.badge.success { background: var(--success-soft); color: #315c49; }
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 15px; }
.toolbar .input { min-height: 46px; padding: 10px 13px; font-size: 15px; flex: 1 1 260px; }
.record-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px; }
.record-item { border: 1px solid var(--line); border-radius: 15px; padding: 13px; background: #fff; }
.record-item .k { color: var(--muted); font-size: 12px; margin-bottom: 4px; }
.record-item .v { font-weight: 680; }
.health-grid { display: flex; flex-wrap: wrap; gap: 7px; }
.empty { text-align: center; color: var(--muted); padding: 28px 12px; }
.consent-copy { white-space: pre-wrap; line-height: 1.6; color: #594840; }

.modal-backdrop { position: fixed; inset: 0; z-index: 100; background: rgba(42,29,24,.36); display: grid; place-items: center; padding: 20px; backdrop-filter: blur(5px); }
.modal { width: min(760px, 100%); max-height: 88vh; overflow: auto; background: #fff; border-radius: 26px; border: 1px solid var(--line); box-shadow: 0 30px 90px rgba(42,29,24,.25); padding: 24px; }
.small { font-size: 13px; }
.muted { color: var(--muted); }
.warn { color: var(--warning); }

@media (max-width: 860px) {
  .metrics { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .admin-layout { grid-template-columns: 1fr; }
  .sidebar { position: static; display: flex; overflow-x: auto; gap: 6px; }
  .nav-btn { width: auto; white-space: nowrap; margin: 0; }
  .dashboard-grid { grid-template-columns: 1fr; }
}

@media (max-width: 700px) {
  .kiosk-shell { padding-left: 18px; padding-right: 18px; }
  .home-brand { margin-bottom: 38px; }
  .brand-wordmark img { width: min(250px, 70vw); }
  .home-intro h1 { font-size: clamp(36px, 10vw, 44px); }
  .arrival-option { min-height: 92px; padding: 18px; }
  .arrival-option strong { font-size: 19px; }
  .journey-card { padding: 28px 20px 24px; border-radius: 22px; }
  .topbar { grid-template-columns: 64px 1fr 64px; }
  .topbar-spacer { width: 64px; }
  .brand-wordmark.compact img { width: 140px; }
  .grid-2, .choice-grid, .choice-grid.three, .record-grid { grid-template-columns: 1fr; }
  .source-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .inline-actions { flex-direction: column-reverse; }
  .inline-actions > * { width: 100%; }
}

@media (max-height: 700px) and (min-width: 701px) {
  .kiosk-home { justify-content: flex-start; }
  .home-brand { margin-bottom: 30px; }
  .home-intro { margin-bottom: 22px; }
  .arrival-option { min-height: 84px; }
}

@media print {
  body { background: #fff; }
  .no-print, .sidebar, .toolbar { display: none !important; }
  .admin-layout { display: block; }
  .panel, .card, .table-wrap { box-shadow: none; border-color: #ccc; }
}
