:root {
  --bg: #fbf7f2;
  --card: #ffffff;
  --text: #2b2420;
  --muted: #7a6e66;
  --line: #e8dfd6;
  --accent: #c8642c;
  --accent-text: #ffffff;
  --accent-soft: #fbe9de;
  --error: #b3261e;
  --radius: 16px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1c1916;
    --card: #26221e;
    --text: #f3ece6;
    --muted: #b3a79d;
    --line: #3a342e;
    --accent: #f09a62;
    --accent-text: #241409;
    --accent-soft: #3a2a20;
    --error: #ffb4ab;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #1c1916; --card: #26221e; --text: #f3ece6; --muted: #b3a79d; --line: #3a342e;
  --accent: #f09a62; --accent-text: #241409; --accent-soft: #3a2a20; --error: #ffb4ab;
  color-scheme: dark;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
.hidden { display: none !important; }
.muted { color: var(--muted); }
.center { text-align: center; }

.top {
  display: flex; align-items: center; justify-content: space-between;
  max-width: 560px; margin: 0 auto; padding: 16px;
}
.brand { font-weight: 700; font-size: 18px; }
.top-actions { display: flex; align-items: center; gap: 8px; }
.theme-btn {
  border: 1px solid var(--line); background: var(--card); color: var(--text);
  border-radius: 999px; padding: 6px 12px; font-size: 14px; font-weight: 600;
  min-height: 36px;
}
.theme-btn:focus-visible, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.logo { font-size: 22px; }

main { max-width: 1000px; margin: 0 auto; padding: 0 16px; }
main > .card { max-width: 560px; margin-left: auto; margin-right: auto; }
main > .card.wide { max-width: 1000px; }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px 20px;
  margin-bottom: 16px;
}
h1 { font-size: 24px; margin: 0 0 8px; }
h2 { font-size: 17px; margin: 0 0 8px; }
.big { font-size: 48px; }

.stack { display: flex; flex-direction: column; gap: 14px; margin-top: 16px; }
label { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: 14px; }
.hint { font-weight: 400; color: var(--muted); font-size: 13px; }
input, textarea {
  font: inherit; color: var(--text); background: var(--bg);
  border: 1px solid var(--line); border-radius: 10px; padding: 12px;
  width: 100%;
}
input:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }

button { font: inherit; cursor: pointer; }
button:disabled { opacity: .4; cursor: default; }
.primary, .secondary {
  border-radius: 999px; padding: 13px 18px; font-weight: 700; width: 100%;
}
.primary { background: var(--accent); color: var(--accent-text); border: none; }
.secondary { background: transparent; color: var(--text); border: 1px solid var(--line); }
.link { background: none; border: none; color: var(--accent); padding: 4px; font-weight: 600; }

.tabs { display: flex; gap: 8px; margin-top: 16px; }
.tab {
  flex: 1; padding: 10px; border-radius: 999px; border: 1px solid var(--line);
  background: transparent; color: var(--text); font-weight: 600;
}
.tab.active { background: var(--accent-soft); border-color: var(--accent); }

.or { display: flex; align-items: center; gap: 12px; color: var(--muted); margin: 18px 0 12px; font-size: 14px; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }

.error { color: var(--error); font-size: 14px; margin: 12px 0 0; }

.cats .row { display: flex; align-items: center; gap: 12px; }
.cats .label { flex: 1; font-weight: 600; font-size: 14px; }
.round {
  width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line);
  background: transparent; color: var(--text); font-size: 20px;
}
.count { min-width: 24px; text-align: center; font-weight: 700; font-size: 18px; }

.panel { border-top: 1px solid var(--line); padding-top: 16px; margin-top: 16px; }
.panel.soon { background: var(--accent-soft); border: none; border-radius: 12px; padding: 16px; }
.pills { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.pills li { background: var(--accent-soft); border-radius: 999px; padding: 6px 12px; font-weight: 600; }

.prices { width: 100%; border-collapse: collapse; }
.prices td { padding: 8px 0; border-bottom: 1px solid var(--line); }
.prices td:last-child { text-align: right; font-weight: 700; }

.foot { text-align: center; font-size: 13px; padding: 24px 16px 40px; }

/* ---------- Booking ---------- */
.small { font-size: 13px; }
.stack.tight { gap: 8px; margin-top: 8px; }
.label-text { display: block; font-weight: 600; font-size: 14px; margin-bottom: 6px; }
.row-dates { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  border: 1px solid var(--line); background: transparent; color: var(--text);
  border-radius: 999px; padding: 8px 16px; font-weight: 600; min-height: 40px;
}
.chip.active { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }

.book-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; margin-top: 8px; }
/* Let the time rows scroll inside their box instead of stretching the page */
.book-grid > *, .book-send, .days, .day, .slots, .row-dates > label, .row-dates input { min-width: 0; }
.row-dates input { width: 100%; }
@media (min-width: 820px) {
  /* Laptops and tablets: options on the left, days and times on the right */
  .book-grid {
    grid-template-columns: 300px minmax(0, 1fr);
    grid-template-areas: "options days" "send days";
    align-items: start;
  }
  .book-options { grid-area: options; }
  .book-send { grid-area: send; margin-top: 0; }
  #book-days { grid-area: days; }
}
.days { display: flex; flex-direction: column; gap: 12px; }
.day { border: 1px solid var(--line); border-radius: 12px; padding: 12px; }
.day-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 8px; }
.tag { background: var(--accent-soft); border-radius: 999px; padding: 2px 10px; font-size: 12px; font-weight: 600; }
.picked-tag { background: var(--accent); color: var(--accent-text); }
.slots { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: thin; }
@media (min-width: 820px) { .slots { flex-wrap: wrap; overflow: visible; } }
.slot {
  flex: 0 0 auto; border: 1px solid var(--line); background: var(--bg); color: var(--text);
  border-radius: 10px; padding: 8px 12px; font-size: 14px; font-weight: 600; min-height: 40px;
}
.slot.on { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.summary { display: flex; flex-direction: column; gap: 2px; padding: 12px; border-radius: 12px; background: var(--accent-soft); }

.request { border: 1px solid var(--line); border-radius: 12px; padding: 12px; }
.request-top { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.request .status { font-size: 13px; font-weight: 700; }
.request.accepted .status { color: #2e7d32; }
.request.declined { opacity: .7; }
.reply { margin-top: 6px; font-size: 14px; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .request.accepted .status { color: #81c995; } }
:root[data-theme="dark"] .request.accepted .status { color: #81c995; }

/* Header lines up with the wider booking page on laptops */
body.wide-page .top { max-width: 1000px; }

/* Suggested times */
.request.suggested { border-color: var(--accent); }
.suggestion { margin-top: 10px; padding: 12px; border-radius: 10px; background: var(--accent-soft); }
.visit-list { margin: 4px 0 8px; padding-left: 18px; font-size: 14px; }
.row-buttons { display: flex; gap: 8px; margin-top: 8px; }
.row-buttons button { flex: 1; }

/* Payments */
.request .pay { margin-top: 10px; }
.request.is-paid .status { color: #2e7d32; }
.paid-banner {
  background: var(--accent-soft); border: 1px solid var(--accent); border-radius: 12px;
  padding: 12px; margin-bottom: 16px; font-weight: 600;
}

/* Cancellations */
.manage { margin-top: 10px; border-top: 1px solid var(--line); padding-top: 8px; }
.manage summary { cursor: pointer; font-weight: 600; font-size: 14px; color: var(--accent); }
.visit-rows { list-style: none; padding: 0; margin: 8px 0; display: flex; flex-direction: column; gap: 6px; }
.visit-rows li { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 14px; }
.struck { text-decoration: line-through; color: var(--muted); }
.small-btn { width: auto; padding: 8px 14px; font-size: 14px; margin: 4px 0 8px; }
.request.is-cancelled { opacity: .7; }
.policy-title { margin-top: 16px; }
.policy { margin: 0; padding-left: 18px; font-size: 14px; display: flex; flex-direction: column; gap: 4px; }

/* Visit updates */
.updates { display: flex; flex-direction: column; gap: 16px; }
.update { border: 1px solid var(--line); border-radius: 12px; padding: 12px; }
.update-top { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.update-note { margin: 8px 0; white-space: pre-wrap; }
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); gap: 6px; margin-top: 8px; }
.thumb { padding: 0; border: none; border-radius: 8px; overflow: hidden; aspect-ratio: 1; background: var(--line); cursor: zoom-in; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }

.lightbox {
  position: fixed; inset: 0; z-index: 50; background: rgba(0, 0, 0, .92);
  display: flex; align-items: center; justify-content: center;
}
.lightbox img { max-width: 100%; max-height: 82vh; object-fit: contain; }
.lightbox-bar {
  position: absolute; top: 0; left: 0; right: 0; display: flex; justify-content: space-between; align-items: center;
  gap: 12px; padding: 12px 16px; color: #fff; font-weight: 600;
}
.lightbox-bar a { color: #fff; margin-left: auto; }
.lightbox-bar button, .lb-nav { background: rgba(255, 255, 255, .15); color: #fff; border: none; border-radius: 999px; }
.lightbox-bar button { width: 40px; height: 40px; font-size: 18px; }
.lb-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 48px; height: 48px; font-size: 28px; }
.lb-nav.prev { left: 12px; }
.lb-nav.next { right: 12px; }
.lb-nav:disabled { opacity: .25; }

.update-times { margin-top: 4px; font-size: 14px; font-weight: 600; color: var(--accent); }

/* Your visits */
h3.sub { font-size: 15px; margin: 16px 0 8px; }
h3.sub.inline { display: inline; margin: 0; }
details.previous { margin-top: 16px; }
details.previous > summary { cursor: pointer; list-style: revert; }
details.previous[open] > summary { margin-bottom: 8px; }

/* Messages */
.new-badge { background: var(--accent); color: var(--accent-text); border-radius: 999px; padding: 2px 10px; font-size: 12px; margin-left: 6px; vertical-align: middle; }
.chat-thread {
  display: flex; flex-direction: column; gap: 10px; max-height: 360px; overflow-y: auto;
  padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg);
}
.chat-empty { margin: 0; text-align: center; }
.bubble-row { display: flex; flex-direction: column; max-width: 82%; }
.bubble-row.mine { align-self: flex-end; align-items: flex-end; }
.bubble-row.theirs { align-self: flex-start; align-items: flex-start; }
.bubble { padding: 9px 13px; border-radius: 16px; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 15px; }
.mine .bubble { background: var(--accent); color: var(--accent-text); border-bottom-right-radius: 4px; }
.theirs .bubble { background: var(--card); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.bubble-time { font-size: 11px; margin-top: 3px; }
.chat-form { display: flex; gap: 8px; margin-top: 10px; align-items: flex-end; }
.chat-form textarea { flex: 1; resize: vertical; min-height: 48px; }
.chat-form button { width: auto; padding: 13px 20px; }

/* On my way */
.otw-banner {
  background: var(--accent); color: var(--accent-text); border-radius: 12px;
  padding: 12px 14px; margin: 8px 0 12px; font-size: 15px;
}
.otw-line { margin: 8px 0 0; font-weight: 600; color: var(--accent); }
.otw .bubble { font-weight: 600; }

.request.is-past { opacity: .75; }
.request.is-past .small-btn { margin-top: 8px; }
.request.is-past .status { color: var(--muted) !important; }

/* Bottom menu */
.tab-section > h1 { margin-bottom: 4px; }
.panel.first { border-top: none; margin-top: 8px; padding-top: 0; }
body.has-nav { padding-bottom: calc(76px + env(safe-area-inset-bottom)); }
.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  display: flex; justify-content: center;
  background: var(--card); border-top: 1px solid var(--line);
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  box-shadow: 0 -2px 12px rgba(0, 0, 0, .06);
}
.bottom-nav button {
  position: relative; flex: 1; max-width: 120px; min-height: 56px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  background: none; border: none; border-radius: 12px; color: var(--muted);
  font-size: 12px; font-weight: 600; padding: 4px 2px;
}
.bottom-nav .ico { font-size: 20px; line-height: 1; filter: grayscale(1); opacity: .7; }
.bottom-nav button.active { color: var(--accent); background: var(--accent-soft); }
.bottom-nav button.active .ico { filter: none; opacity: 1; }
.nav-badge {
  position: absolute; top: 4px; left: calc(50% + 6px);
  background: #d93025; color: #fff; border-radius: 999px; min-width: 18px; height: 18px;
  font-size: 11px; line-height: 18px; padding: 0 5px; text-align: center;
}
/* Messages gets more room when it has its own section */
[data-tab="messages"] .chat-thread { max-height: calc(100vh - 330px); min-height: 220px; }

/* Home summary cards */
.home-summary { display: flex; flex-direction: column; gap: 10px; margin: 12px 0 4px; }
.summary-card {
  display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; align-items: center;
  border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px;
  color: var(--text); text-decoration: none;
}
.summary-card > * { grid-column: 1; }
.summary-card .summary-go { grid-column: 2; grid-row: 1 / span 3; color: var(--accent); font-weight: 700; font-size: 14px; }
.summary-label { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.summary-card:hover { border-color: var(--accent); }
.bottom-nav button { font-size: 11px; }

/* "+N" on the last photo, and View visit */
.thumb { position: relative; }
.more-photos {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  background: rgba(0, 0, 0, .5); color: #fff; font-size: 22px; font-weight: 700;
}
.update .photo-grid { grid-template-columns: repeat(3, 1fr); }
.update-note.clamp { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.view-visit {
  display: block; margin: 10px 0 0 auto; background: none; border: none; padding: 6px 0;
  color: var(--accent); font-weight: 700; font-size: 14px;
}

/* Full-screen visit */
.visit-sheet {
  position: fixed; inset: 0; z-index: 45; background: var(--bg); overflow-y: auto;
}
.sheet-bar {
  position: sticky; top: 0; display: flex; align-items: center; gap: 12px;
  background: var(--card); border-bottom: 1px solid var(--line); padding: 12px 16px;
}
.sheet-body { max-width: 720px; margin: 0 auto; padding: 16px 16px 40px; }
.sheet-body .photo-grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; }
body.sheet-open { overflow: hidden; }
body.sheet-open .bottom-nav { display: none; }

.chat-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.chat-head h1 { margin-bottom: 8px; }

/* Bookings as blocks */
#bookings-current, #bookings-past { margin-bottom: 8px; }
.booking-card { border: 1px solid var(--line); border-radius: 14px; padding: 14px; }
.booking-card.today { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.booking-card.done { background: var(--bg); }
.booking-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 2px; }
.booking-top strong { margin-right: auto; }
.booking-top .new-badge { margin-left: 0; order: 2; }
.booking-top .pill { order: 3; }
.pill { font-size: 12px; font-weight: 700; border-radius: 999px; padding: 2px 10px; background: var(--accent-soft); }
.pill.today { background: var(--accent); color: var(--accent-text); }
.pill.done { background: var(--line); color: var(--muted); }
.progress-line { display: flex; align-items: center; gap: 10px; font-size: 13px; font-weight: 600; margin: 8px 0 2px; }
.progress-line .bar { flex: 1; height: 6px; border-radius: 999px; background: var(--line); overflow: hidden; }
.progress-line .bar > span { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
.next-line { margin: 8px 0 0; }
.booking-card .photo-grid { grid-template-columns: repeat(3, 1fr); }
.summary-card { width: 100%; text-align: left; background: none; font: inherit; cursor: pointer; }
.update.is-today { border-color: var(--accent); }
.update-top .new-badge { margin-left: auto; }
#booking-sheet-sub a { color: var(--accent); font-weight: 700; }

/* Fold away past bookings */
.past-fold { margin-top: 16px; }
.past-fold > summary {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  cursor: pointer; list-style: none; padding: 6px 0;
}
.past-fold > summary::-webkit-details-marker { display: none; }
.past-fold > summary h3::before { content: "▸ "; display: inline-block; transition: transform .15s; }
.past-fold[open] > summary h3::before { content: "▾ "; }
.past-fold .fold-hint { color: var(--accent); font-weight: 700; }
.past-fold[open] > summary { margin-bottom: 8px; }

/* Tips */
.card-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.card-foot .view-visit { margin: 0 0 0 auto; }
.tip-link { background: none; border: none; padding: 6px 0; color: var(--muted); font-weight: 600; font-size: 14px; }
.tip-link:hover { color: var(--accent); }
.tip-box { width: 100%; border-radius: 12px; background: var(--accent-soft); padding: 12px 14px; margin-top: 4px; }
.tip-title { margin: 0 0 2px; font-weight: 700; }
.tip-box .muted.small { margin: 0 0 10px; }
.tip-buttons { display: flex; flex-wrap: wrap; gap: 8px; }
.tip-chip { background: var(--card); }
.tip-chip .muted { font-weight: 500; }
.tip-other { display: flex; align-items: center; gap: 8px; margin-top: 10px; }
.tip-other .dollar { font-weight: 700; }
.tip-other input { max-width: 120px; padding: 9px 10px; }
.tip-other button { width: auto; padding: 10px 18px; }
.tip-thanks { margin: 0; font-weight: 600; color: var(--accent); font-size: 14px; }
.tip-note {
  display: flex; align-items: flex-start; gap: 8px; font-size: 14px; color: var(--muted);
  border: 1px dashed var(--line); border-radius: 12px; padding: 10px 12px;
}
.tip-note span { flex: 1; }
.link-inline { background: none; border: none; padding: 0; font: inherit; color: var(--accent); font-weight: 700; text-decoration: underline; cursor: pointer; }
.tip-x { background: none; border: none; color: var(--muted); font-size: 14px; padding: 2px 4px; min-width: 32px; min-height: 32px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Cost breakdown */
.cost-box { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; background: var(--card); }
.cost-box h3 { margin: 0 0 8px; font-size: 15px; }
.cost-row { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; padding: 4px 0; }
.cost-row span:last-child { white-space: nowrap; font-variant-numeric: tabular-nums; }
.cost-row.sub { border-top: 1px solid var(--line); margin-top: 6px; padding-top: 8px; }
.cost-row.refund span:last-child { color: #2e7d32; }
.cost-row.total { border-top: 2px solid var(--text); margin-top: 6px; padding-top: 8px; font-weight: 700; font-size: 15px; }
.cost-row.muted { color: var(--muted); }
.cost-note { margin: 6px 0 0; }
.cost-note a { color: var(--accent); font-weight: 700; }

/* Payment reminders */
.pay-reminder {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  border: 1px solid var(--accent); background: var(--accent-soft); border-radius: 12px;
  padding: 10px 14px; margin: 12px 0 4px; font-size: 14px;
}
.pay-reminder > span { flex: 1; min-width: 200px; }
.pay-link { color: var(--accent); font-weight: 700; text-decoration: none; white-space: nowrap; }
.request.due-soon { border-color: var(--accent); }
.due-line { margin-top: 8px; font-size: 14px; font-weight: 600; color: var(--accent); }

/* Copy times to all days */
.copy-note { margin: 6px 0 0; color: #2e7d32; font-weight: 600; }
.copy-note.warn { color: var(--error); }
.warn-tag { background: #fde7e4; color: #8c1d18; }
:root[data-theme="dark"] .warn-tag { background: #5c1f1a; color: #ffdad6; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .warn-tag { background: #5c1f1a; color: #ffdad6; } }

/* Terms links */
.agree { margin: 4px 0 0; text-align: center; }
.agree a, .foot a { color: var(--accent); }
.link-btn { display: block; text-align: center; text-decoration: none; }

/* Contact */
.contact-row { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0; }
.contact-btn {
  flex: 1; min-width: 120px; text-align: center; text-decoration: none; font-weight: 700;
  border: 1px solid var(--accent); color: var(--accent); border-radius: 999px; padding: 10px 14px;
}
.contact-line { display: inline-block; color: var(--accent); font-weight: 600; text-decoration: none; margin-top: 4px; }
.contact-number { width: 100%; margin: 0 0 2px; font-size: 18px; font-weight: 700; }
