/* Public booking page — /book/<slug> and /book/manage/<token>.
   Deliberately its own small stylesheet rather than portal.css: a homeowner
   is looking at the CLIENT's business here, not at BizGrips, so the page is
   neutral and quiet, with the business name doing the branding. Same token
   approach as portal.css, plus a dark set, since this opens from a text on
   whatever phone the homeowner holds. */

:root {
  --ink: #14161c;
  --bg: #f6f7fb;
  --panel: #fff;
  --line: #e8eaf0;
  --line-strong: #d7dae3;
  --muted: #5b616e;
  --faint: #8b909b;
  --ac: #6467f2;
  --ac-ink: #fff;
  --ac-wash: rgba(100, 103, 242, .09);
  --red: #b3372a;
  --red-bg: #fbecea;
  --red-line: #efc4be;
  --yellow: #8a5a00;
  --yellow-bg: #fff4d6;
  --green: #2d7a4a;
  --green-bg: #e7f4ec;
  --sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  --radius: 18px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink: #f2f3f7;
    --bg: #111218;
    --panel: #1a1c24;
    --line: rgba(242, 243, 247, .1);
    --line-strong: rgba(242, 243, 247, .2);
    --muted: rgba(242, 243, 247, .64);
    --faint: rgba(242, 243, 247, .44);
    --ac: #8c8ff7;
    --ac-ink: #10112a;
    --ac-wash: rgba(140, 143, 247, .14);
    --red: #f08a7d;
    --red-bg: rgba(240, 138, 125, .12);
    --red-line: rgba(240, 138, 125, .35);
    --yellow: #f2c46b;
    --yellow-bg: rgba(242, 196, 107, .12);
    --green: #7fd19c;
    --green-bg: rgba(127, 209, 156, .12);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { margin: 0; min-height: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 400 15px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--ac); }
button, input, textarea, select { font: inherit; color: inherit; }

.bp {
  max-width: 640px; margin: 0 auto;
  padding: 28px 16px calc(40px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: 16px;
}
.bp-loading { padding: 80px 0; text-align: center; color: var(--muted); }

/* ----------------------------------------------------------------- header */
.bp-head { display: flex; flex-direction: column; gap: 6px; padding: 4px 4px 6px; }
.bp-business {
  font-size: 13px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
  color: var(--muted);
}
.bp-h1 { margin: 0; font-size: 28px; line-height: 1.15; font-weight: 800; letter-spacing: -.03em; }
.bp-h2 { margin: 0; font-size: 18px; line-height: 1.25; font-weight: 750; letter-spacing: -.015em; }
.bp-h3 { margin: 18px 0 10px; font-size: 14px; font-weight: 600; }
.bp-meta { display: flex; flex-wrap: wrap; gap: 4px 8px; font-size: 14px; color: var(--muted); }
.bp-sep { color: var(--faint); }
.bp-desc { margin: 6px 0 0; font-size: 15px; color: var(--muted); white-space: pre-line; }
.bp-muted { margin: 0; color: var(--muted); }
.bp-small { margin: 0; font-size: 12.5px; color: var(--faint); }
.bp-label {
  font-size: 11.5px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; color: var(--muted);
}
.bp-stack { display: flex; flex-direction: column; gap: 4px; min-width: 0; }

.bp-test {
  padding: 11px 14px; border-radius: 10px;
  background: var(--yellow-bg); color: var(--yellow);
  font-size: 13.5px; line-height: 1.45;
}
.bp-flash {
  padding: 12px 14px; border-radius: 10px;
  background: var(--green-bg); color: var(--green); font-weight: 600;
}
.bp-error {
  margin: 12px 0 0; padding: 11px 14px; border-radius: 9px;
  background: var(--red-bg); border: 1px solid var(--red-line); color: var(--red);
  font-size: 14px;
}
.bp-note {
  margin: 0; padding: 11px 14px; border-radius: 9px;
  background: var(--ac-wash); font-size: 14px;
}

/* ------------------------------------------------------------------ cards */
.bp-card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px;
  box-shadow: 0 1px 2px rgba(20, 22, 28, .04), 0 12px 32px -24px rgba(20, 22, 28, .25);
}
.bp-pad { padding: 22px 20px; display: flex; flex-direction: column; gap: 12px; }
.bp-card-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 14px; }
.bp-card-head .bp-link { margin-left: auto; }

/* ----------------------------------------------------------------- buttons */
.bp-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-strong); background: transparent;
  font-weight: 600; font-size: 15px; cursor: pointer; text-decoration: none; color: var(--ink);
}
.bp-btn:hover:not(:disabled) { border-color: var(--ink); }
.bp-btn:disabled { opacity: .5; cursor: not-allowed; }
.bp-btn--primary { background: var(--ac); border-color: var(--ac); color: var(--ac-ink); box-shadow: 0 8px 20px -12px var(--ac); }
.bp-btn--primary:hover:not(:disabled) { border-color: var(--ac); filter: brightness(1.08); }
.bp-btn--danger { color: var(--red); border-color: var(--red-line); }
.bp-btn--danger:hover:not(:disabled) { border-color: var(--red); }
.bp-btn--sm { min-height: 36px; padding: 6px 12px; font-size: 13.5px; }
.bp-link {
  border: none; background: none; padding: 4px 0; cursor: pointer;
  color: var(--ac); font-weight: 600; font-size: 14px;
}
.bp-link:hover { text-decoration: underline; }
.bp-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 4px; }
.bp-actions .bp-muted { flex-basis: 100%; }

/* ------------------------------------------------------------------ picker */
.bp-weeknav { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.bp-range { flex: 1; text-align: center; font-weight: 600; font-size: 14.5px; }
.bp-arrow {
  width: 40px; height: 40px; border-radius: 50%; flex: none; cursor: pointer;
  border: 1px solid var(--line-strong); background: var(--panel);
  font-size: 22px; line-height: 1; padding: 0 0 3px;
}
.bp-arrow:disabled { opacity: .3; cursor: not-allowed; }

.bp-days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.bp-day {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 9px 2px 8px; border-radius: 14px; cursor: pointer;
  border: 1px solid var(--line-strong); background: var(--panel);
}
.bp-day:hover:not(:disabled) { border-color: var(--ac); }
.bp-day.is-on { background: var(--ac); border-color: var(--ac); color: var(--ac-ink); }
.bp-day.is-empty, .bp-day:disabled { cursor: not-allowed; opacity: .45; background: transparent; }
.bp-dow { font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.bp-dnum { font-size: 19px; font-weight: 750; line-height: 1.1; font-variant-numeric: tabular-nums; }
.bp-dcount { font-size: 10.5px; opacity: .75; white-space: nowrap; }

.bp-times { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 8px; }
.bp-time {
  min-height: 46px; padding: 10px 6px; border-radius: 12px; cursor: pointer;
  border: 1px solid color-mix(in srgb, var(--ac) 45%, transparent); background: var(--panel); color: var(--ac);
  font-weight: 600; font-size: 15px;
}
.bp-time:hover { background: var(--ac-wash); }
.bp-time.is-on { background: var(--ac); color: var(--ac-ink); }
.bp-times-empty {
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  padding: 28px 8px 12px; text-align: center; color: var(--muted);
}
.bp-times-empty p { margin: 0; }

/* -------------------------------------------------------------------- form */
.bp-chosen {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 0 0 16px; margin-bottom: 16px; border-bottom: 1px solid var(--line);
}
.bp-chosen b { font-size: 17px; }
.bp-chosen .bp-link { margin-left: auto; }
.bp-form { display: flex; flex-direction: column; gap: 16px; margin-top: 4px; }
.bp-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.bp-full { grid-column: 1 / -1; }
.bp-field { display: flex; flex-direction: column; gap: 6px; font-size: 13.5px; font-weight: 600; }
.bp-field i { font-style: normal; color: var(--red); }
.bp-field input, .bp-field textarea {
  width: 100%; padding: 11px 12px; border-radius: 12px;
  border: 1px solid var(--line-strong); background: var(--panel);
  font-size: 16px; font-weight: 400; /* 16px stops iOS zooming on focus */
}
.bp-field textarea { resize: vertical; min-height: 84px; }
.bp-field input:focus, .bp-field textarea:focus { outline: none; border-color: var(--ac); box-shadow: 0 0 0 4px var(--ac-wash); }
.bp-btn:focus-visible, .bp-day:focus-visible, .bp-time:focus-visible, .bp-arrow:focus-visible, .bp-link:focus-visible {
  outline: 2px solid var(--ac); outline-offset: 1px;
}
.bp-submit { width: 100%; min-height: 50px; font-size: 16px; }
/* The honeypot: off-screen, not display:none, which some bots skip. */
.bp-hp { position: absolute; left: -10000px; top: auto; width: 1px; height: 1px; overflow: hidden; }

/* -------------------------------------------------------------------- done */
.bp-done { align-items: center; text-align: center; }
.bp-tick {
  width: 52px; height: 52px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--green-bg); color: var(--green); font-size: 26px; font-weight: 700;
}
.bp-when { margin: 0; font-size: 20px; font-weight: 750; line-height: 1.3; }
.bp-when.is-struck { text-decoration: line-through; color: var(--muted); }
.bp-status-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.bp-status {
  padding: 4px 10px; border-radius: 20px; font-size: 12px; font-weight: 700;
  background: var(--ac-wash); color: var(--ac); white-space: nowrap;
}
.bp-status.is-cancelled, .bp-status.is-no_show { background: var(--red-bg); color: var(--red); }
.bp-status.is-completed { background: var(--green-bg); color: var(--green); }

.bp-manage {
  width: 100%; margin-top: 8px; padding: 14px; border-radius: 14px; text-align: left;
  background: var(--ac-wash); display: flex; flex-direction: column; gap: 6px;
}
.bp-copy { display: flex; align-items: center; gap: 10px; }
.bp-url { flex: 1; min-width: 0; font-size: 14px; overflow-wrap: anywhere; }

.bp-foot { padding: 12px 0 0; text-align: center; font-size: 12px; color: var(--faint); }

/* api.js copy() confirms with a toast. */
.toast {
  position: fixed; left: 50%; bottom: calc(22px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  z-index: 60; padding: 11px 18px; border-radius: 9px;
  background: var(--ink); color: var(--bg); font-size: 14px;
}
.toast--err { background: var(--red); color: #fff; }

@media (max-width: 520px) {
  .bp { padding-top: 18px; gap: 14px; }
  .bp-h1 { font-size: 24px; }
  .bp-card { padding: 14px 12px; }
  .bp-pad { padding: 18px 16px; }
  .bp-grid { grid-template-columns: minmax(0, 1fr); }
  .bp-days { gap: 4px; }
  .bp-day { padding: 8px 0 7px; border-radius: 8px; }
  .bp-dnum { font-size: 17px; }
  .bp-dcount { display: none; }
  .bp-times { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .bp-actions .bp-btn { flex: 1 1 auto; white-space: nowrap; }
}
