:root {
  --bg: #faf5ec;
  --surface: #ffffff;
  --surface-2: #f3ecdf;
  --ink: #1e2a24;
  --muted: #6a7466;
  --line: #e6ddcc;
  --brand: #1f5e4b;
  --brand-ink: #ffffff;
  --brand-soft: #e3efe8;
  --accent: #d9734e;
  --sand: #efe2cb;
  --sand-2: #e2cfae;
  --leaf: #8fc1a6;
  --danger: #b3412e;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(30, 42, 36, 0.06), 0 8px 24px rgba(30, 42, 36, 0.06);
  --font-display: 'Fraunces', Georgia, serif;
  --font-body: 'DM Sans', system-ui, -apple-system, sans-serif;
  color-scheme: light;
}
[data-app='pro'] {
  --brand: #22314a;
  --brand-soft: #e4e8f0;
  --accent: #d9973e;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121714;
    --surface: #1a211d;
    --surface-2: #222b26;
    --ink: #ede8df;
    --muted: #9ba69a;
    --line: #2d3832;
    --brand: #5fb08c;
    --brand-ink: #0e1411;
    --brand-soft: #1f3229;
    --sand: #cdbb9b;
    --sand-2: #a8926c;
    --shadow: none;
    color-scheme: dark;
  }
  [data-app='pro'] {
    --brand: #8fa8d6;
    --brand-soft: #232c3d;
    --brand-ink: #0f131b;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 var(--font-body);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
#app { max-width: 560px; margin: 0 auto; min-height: 100dvh; }
a { color: var(--brand); }
h1, h2, h3 { font-family: var(--font-display); font-weight: 600; line-height: 1.15; margin: 0; letter-spacing: -0.01em; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.05rem; }
p { margin: 0; }
code { font-size: 0.9em; background: var(--surface-2); padding: 1px 5px; border-radius: 6px; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.stack > * + * { margin-top: 16px; }
.stack-sm > * + * { margin-top: 8px; }

/* ---------- chrome ---------- */
.topbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: calc(12px + env(safe-area-inset-top)) 16px 12px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 8px; font-family: var(--font-display); font-weight: 600; font-size: 1.25rem; }
.brand svg { width: 30px; height: 30px; }
.tag { font-family: var(--font-body); font-size: 0.7rem; font-weight: 700; letter-spacing: 0.08em; background: var(--brand); color: var(--brand-ink); padding: 2px 7px; border-radius: 99px; }
.content { padding: 20px 16px calc(96px + env(safe-area-inset-bottom)); }

.nav {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); z-index: 5;
  width: 100%; max-width: 560px;
  display: flex; justify-content: space-around;
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  background: var(--surface); border-top: 1px solid var(--line);
}
.nav button {
  position: relative; flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 6px 0; border: 0; background: none; color: var(--muted); font: 500 0.72rem var(--font-body); cursor: pointer;
}
.nav button.on { color: var(--brand); }
.nav .badge {
  position: absolute; top: 2px; left: calc(50% + 6px);
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 99px;
  background: var(--accent); color: #fff; font-size: 0.7rem; font-weight: 700; line-height: 18px;
}

/* ---------- forms ---------- */
.field { display: block; }
.label { display: block; font-weight: 600; font-size: 0.9rem; margin-bottom: 6px; }
.hint { font-size: 0.82rem; color: var(--muted); margin-top: 6px; }
input, select, textarea {
  width: 100%; font: inherit; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  padding: 11px 12px; min-height: 46px;
}
textarea { min-height: 76px; resize: vertical; }
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible {
  outline: 2px solid var(--brand); outline-offset: 1px;
}
input[type='checkbox'] { width: 20px; height: 20px; min-height: 0; accent-color: var(--brand); margin: 0; flex: none; }
.row2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }
.row2 > * { min-width: 0; }
/* iOS Safari gives date/time inputs an intrinsic min-width, so they spill into the next column. */
input[type='date'], input[type='time'] { -webkit-appearance: none; appearance: none; min-width: 0; max-width: 100%; display: block; }
input::-webkit-date-and-time-value { text-align: left; }
.error { color: var(--danger); font-size: 0.9rem; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px; padding: 10px 18px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  font: 600 0.95rem var(--font-body); cursor: pointer; text-decoration: none;
}
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn.accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.ghost { background: none; }
.btn.danger { color: var(--danger); }
.btn.sm { min-height: 36px; padding: 6px 12px; font-size: 0.85rem; }
.btn.block { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.seg { display: flex; gap: 6px; background: var(--surface-2); padding: 4px; border-radius: 14px; }
.seg button {
  flex: 1; min-height: 40px; border: 0; border-radius: 10px; background: none;
  font: 600 0.9rem var(--font-body); color: var(--muted); cursor: pointer;
}
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }

.type-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.type-card {
  text-align: left; padding: 10px 12px; border-radius: 12px; cursor: pointer;
  background: var(--surface); border: 1px solid var(--line); color: var(--ink); font: inherit;
}
.type-card strong { display: block; font-size: 0.92rem; }
.type-card span { display: block; font-size: 0.75rem; color: var(--muted); line-height: 1.3; margin-top: 2px; }
.type-card.on { border-color: var(--brand); background: var(--brand-soft); box-shadow: inset 0 0 0 1px var(--brand); }

/* ---------- cards ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.section-title { display: flex; align-items: baseline; justify-content: space-between; margin: 28px 0 12px; }
.section-title:first-child { margin-top: 0; }
.empty { text-align: center; padding: 28px 16px; color: var(--muted); border: 1px dashed var(--line); border-radius: var(--radius); }
.banner { background: color-mix(in srgb, var(--accent) 14%, var(--surface)); border: 1px solid color-mix(in srgb, var(--accent) 40%, var(--line)); border-radius: var(--radius); padding: 14px 16px; }
.banner ul { margin: 6px 0 0; padding-left: 18px; }

.hero { padding: 4px 0 20px; }
.hero h1 { font-size: 2rem; }
.hero p { color: var(--muted); margin-top: 6px; }

.therapist {
  display: grid; grid-template-columns: auto 1fr; gap: 12px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow);
}
.therapist + .therapist { margin-top: 10px; }
.avatar {
  width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center;
  background: var(--brand-soft); color: var(--brand); font-weight: 700;
}
.t-name { font-weight: 700; }
.t-meta { font-size: 0.82rem; color: var(--muted); }
.t-bio { font-size: 0.88rem; margin-top: 4px; }
.t-terms { font-size: 0.78rem; color: var(--muted); margin-top: 6px; }
.t-foot { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; border-top: 1px solid var(--line); padding-top: 10px; }
.price { font-family: var(--font-display); font-size: 1.2rem; font-weight: 600; }

.booking { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.booking + .booking { margin-top: 10px; }
.booking-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.booking-title { font-weight: 700; }
.booking-meta { margin: 10px 0 0; display: grid; gap: 6px; font-size: 0.88rem; }
.booking-meta div { display: grid; grid-template-columns: 56px 1fr; gap: 8px; }
.booking-meta dt { color: var(--muted); }
.booking-meta dd { margin: 0; }
.note { margin-top: 8px; font-size: 0.88rem; font-style: italic; color: var(--muted); }
.booking-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }

.chip { font-size: 0.72rem; font-weight: 700; padding: 3px 9px; border-radius: 99px; white-space: nowrap; background: var(--surface-2); color: var(--muted); }
.chip-pending { background: color-mix(in srgb, var(--accent) 18%, var(--surface)); color: color-mix(in srgb, var(--accent) 70%, var(--ink)); }
.chip-accepted { background: var(--brand-soft); color: var(--brand); }
.chip-completed { background: var(--brand-soft); color: var(--brand); }
.chip-declined, .chip-cancelled { color: var(--danger); }

/* ---------- pro editors ---------- */
.svc { padding: 12px 0; border-bottom: 1px solid var(--line); }
.svc:last-of-type { border-bottom: 0; }
.svc-prices { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 8px; }
.svc-prices label span { display: block; font-size: 0.75rem; color: var(--muted); margin-bottom: 2px; }
.svc-prices input { padding: 8px 10px; min-height: 40px; font-size: 0.9rem; }
.check { display: flex; align-items: center; gap: 10px; padding: 9px 0; cursor: pointer; }
.check-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 12px; }
fieldset { border: 0; margin: 0; padding: 0; }
fieldset + fieldset { margin-top: 18px; }
legend { display: flex; width: 100%; justify-content: space-between; align-items: center; font-weight: 700; padding: 0; margin-bottom: 4px; }
.day { display: grid; grid-template-columns: 1.3fr 1fr 1fr; gap: 8px; align-items: center; padding: 6px 0; }
.day select { min-height: 40px; padding: 6px 8px; }
.day.off select { opacity: 0.4; }
.sticky-save { position: sticky; bottom: calc(76px + env(safe-area-inset-bottom)); margin-top: 16px; }

/* ---------- auth ---------- */
.auth { padding: calc(40px + env(safe-area-inset-top)) 16px 40px; }
.auth-hero { text-align: center; margin-bottom: 24px; }
.auth-hero svg { width: 72px; height: 72px; }
.auth-hero h1 { font-size: 2.4rem; margin-top: 4px; }
.auth-hero p { color: var(--muted); }
.switch-app { display: block; text-align: center; margin-top: 20px; font-size: 0.9rem; }

/* ---------- sheet & toast ---------- */
.sheet-backdrop { position: fixed; inset: 0; z-index: 10; background: rgba(0, 0, 0, 0.4); display: flex; align-items: flex-end; justify-content: center; }
.sheet {
  width: 100%; max-width: 560px; max-height: 90dvh; overflow: auto;
  background: var(--surface); border-radius: 22px 22px 0 0; padding: 20px 16px calc(20px + env(safe-area-inset-bottom));
}
.summary { display: grid; gap: 8px; margin: 14px 0; font-size: 0.92rem; }
.summary div { display: flex; justify-content: space-between; gap: 12px; }
.summary dt { color: var(--muted); }
.summary dd { margin: 0; text-align: right; }
.summary .total { border-top: 1px solid var(--line); padding-top: 8px; font-weight: 700; }

.toast {
  position: fixed; left: 50%; bottom: calc(90px + env(safe-area-inset-bottom)); z-index: 20;
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  max-width: calc(100% - 32px); padding: 10px 16px; border-radius: 12px;
  background: var(--ink); color: var(--bg); font-size: 0.9rem; transition: 0.2s ease;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- social sign-in & loading ---------- */
.btn.social { gap: 10px; font-weight: 600; }
.btn.social:disabled { opacity: 0.55; }
.divider { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 0.8rem; }
.divider::before, .divider::after { content: ''; flex: 1; border-top: 1px solid var(--line); }
.loading { min-height: 100dvh; display: grid; place-items: center; }
.loading svg { width: 64px; height: 64px; animation: breathe 1.6s ease-in-out infinite; }
@keyframes breathe { 50% { transform: scale(0.9); opacity: 0.6; } }
@media (prefers-reduced-motion: reduce) { .loading svg { animation: none; } }
.push-banner { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }

/* ---------- ratings ---------- */
.rating { font-size: 0.82rem; font-weight: 600; color: var(--ink); background: none; border: 0; padding: 0; cursor: pointer; font-family: inherit; }
.rating .star { color: var(--accent); }
.rating .muted { font-weight: 400; }
.rating.new { color: var(--muted); font-weight: 500; cursor: default; }
.review { padding: 12px 0; border-bottom: 1px solid var(--line); }
.review:last-child { border-bottom: 0; }
.review-stars { color: var(--accent); letter-spacing: 1px; }
.review p { margin-top: 4px; font-size: 0.92rem; }
.star-input { display: inline-flex; flex-direction: row-reverse; justify-content: flex-end; gap: 4px; }
.star-input input { position: absolute; opacity: 0; pointer-events: none; }
.star-input label { font-size: 2.2rem; line-height: 1; color: var(--line); cursor: pointer; transition: color 0.1s; }
.star-input input:checked ~ label, .star-input label:hover, .star-input label:hover ~ label { color: var(--accent); }
.star-input input:focus-visible + label { outline: 2px solid var(--brand); border-radius: 6px; }
.rating-summary { display: flex; align-items: baseline; gap: 10px; }
.rating-summary .big { font-family: var(--font-display); font-size: 2rem; font-weight: 600; }

/* ---------- password field & keyboard ---------- */
.pw-wrap { position: relative; display: block; }
.pw-wrap input { padding-right: 52px; }
.pw-toggle {
  position: absolute; top: 0; right: 0; height: 100%; width: 48px;
  display: grid; place-items: center; border: 0; background: none; color: var(--muted); cursor: pointer; border-radius: 0 12px 12px 0;
}
.pw-toggle:hover { color: var(--ink); }
/* Room to scroll the focused field above the iOS keyboard (height set from visualViewport). */
body { padding-bottom: var(--keyboard, 0px); }

/* ---------- location check ---------- */
.place { box-shadow: none; background: var(--surface-2); }
.place-name { font-weight: 700; }
