/* מספרת הפינה — the booking app.
   Hebrew, RTL, phone-first: a customer opens this from a WhatsApp message on a phone, so
   the week strip scrolls horizontally and every tap target is finger-sized. No framework —
   this repo has no build step for the browser and adding one to draw a calendar would cost
   more than it saves. */

:root {
  color-scheme: light dark;
  --bg: #faf3ea;
  --card: #ffffff;
  --ink: #14161a;
  --muted: #6b7280;
  --line: #e3e6ea;
  --accent: #b4884a;          /* barber brass */
  --accent-ink: #ffffff;
  /* Purely decorative rings on the calendar — deliberately its own token, separate from
     --accent, so a decoration never inherits a real button's contrast/hover obligations. */
  --decor-ring: #d9b98a;
  --free: #f2f6f2;
  --free-line: #cfe0cf;
  --shut: #f4f4f5;
  --holiday: #fdf6e6;
  --holiday-line: #e8d6a8;
  --danger: #b3261e;
  --radius: 14px;
  --radius-pill: 999px;
  --shadow: 0 1px 2px rgba(20,22,26,.06), 0 8px 24px rgba(20,22,26,.07);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #17130f; --card: #171a20; --ink: #eceef2; --muted: #9aa1ac; --line: #262b33;
    --accent: #d7a75f; --accent-ink: #14161a;
    --decor-ring: #6b4f2c;
    --free: #16211a; --free-line: #2c4433; --shut: #1a1d23;
    --holiday: #241f14; --holiday-line: #4a3d22; --danger: #f2b8b5;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 10px 28px rgba(0,0,0,.35);
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg); color: var(--ink);
  font: 16px/1.5 "Assistant", "Rubik", system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  -webkit-text-size-adjust: 100%;
  padding-bottom: env(safe-area-inset-bottom);
}
.skip { position: absolute; inset-inline-start: -9999px; }
.skip:focus { inset-inline-start: 8px; top: 8px; background: var(--card); padding: 8px 12px; border-radius: 8px; z-index: 20; }

/* ── header ─────────────────────────────────────────────────────────── */
.top {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 16px calc(14px + env(safe-area-inset-top)) 16px;
  background: var(--card); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 10;
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand .mark { font-size: 26px; line-height: 1; }
.brand strong { display: block; font-size: 17px; letter-spacing: -.01em; }
.brand small { display: block; color: var(--muted); font-size: 12.5px; }
.modes { display: flex; gap: 6px; }
.modes button {
  font: inherit; font-size: 13.5px; padding: 7px 12px; border-radius: 999px;
  border: 1px solid var(--line); background: transparent; color: var(--muted); cursor: pointer;
}
.modes button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }

main { max-width: 880px; margin: 0 auto; padding: 16px; display: grid; gap: 16px; }
.pane { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.pane-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 10px; }
h1, h2 { font-size: 18px; margin: 0 0 4px; letter-spacing: -.01em; }
h3 { font-size: 17px; margin: 0 0 10px; }
.note { color: var(--muted); font-size: 13.5px; margin: 2px 0 12px; }
.status { margin: 0; font-size: 14.5px; }
.status[data-kind="error"] { color: var(--danger); }

/* ── service chooser ────────────────────────────────────────────────── */
.svc { display: flex; gap: 6px; flex-wrap: wrap; }
.svc button {
  font: inherit; font-size: 13.5px; padding: 7px 12px; border-radius: 999px;
  border: 1px solid var(--line); background: transparent; color: inherit; cursor: pointer;
}
.svc button[aria-checked="true"] { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); font-weight: 600; }
.svc .price { color: var(--muted); font-size: 12.5px; margin-inline-start: 6px; }

button:disabled { opacity: .4; cursor: default; }

/* ── booking pane: cardless, cream, decorative — scoped to #pane-book only, so the shared
   .pane rule that admin/settings/mine still rely on is never touched. ──────────────────── */
#pane-book.pane {
  background: transparent; border: 0; box-shadow: none; padding: 0 2px 8px;
  position: relative; overflow: hidden;
}

.book-pill { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; position: relative; z-index: 1; }
.book-pill h1 {
  flex: 1; margin: 0; text-align: center; font-size: 16px; font-weight: 700;
  background: var(--line); color: var(--ink); border-radius: var(--radius-pill); padding: 14px 18px;
}
.back-chip {
  font: inherit; flex: none; width: 42px; height: 42px; border-radius: 12px; border: 0;
  background: var(--card); box-shadow: var(--shadow); color: var(--ink); font-size: 18px;
  cursor: pointer; display: grid; place-items: center;
}
/* `display: grid` above wins over the browser's default `[hidden]{display:none}` rule
   (author CSS beats UA CSS on a specificity tie), so app.js setting `.hidden = true` alone
   left this button visible and clickable on the month grid — caught by a real click-point
   test, not by reading the code. */
.back-chip[hidden] { display: none; }

/* Purely decorative "bubble" rings from the reference image — no function, so they must
   never intercept a tap or push the layout wider than the viewport. */
.calendar-wrap { position: relative; overflow: hidden; border-radius: var(--radius); }
.deco { position: absolute; border-radius: 50%; border: 1px solid var(--decor-ring); pointer-events: none; z-index: 0; }
.deco--xs { width: 8px; height: 8px; }
.deco--sm { width: 16px; height: 16px; }
.deco--md { width: 56px; height: 56px; }
.deco--lg { width: 140px; height: 140px; }

/* ── month navigation (shared shape: booking pane's own bar, and admin's smaller one) ──── */
.monthbar { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 4px 14px; position: relative; z-index: 1; }
.monthbar .chev {
  font: inherit; font-size: 20px; line-height: 1; width: 36px; height: 36px; border: 0;
  background: transparent; color: var(--muted); cursor: pointer; border-radius: 10px;
}
.monthbar .month-label { font: inherit; font-size: 16px; font-weight: 700; color: var(--ink); background: transparent; border: 0; cursor: pointer; padding: 4px 10px; }
.monthbar--admin { padding-top: 0; }

.dow-row {
  display: grid; grid-template-columns: repeat(7, 1fr); text-align: center;
  color: var(--muted); font-size: 12.5px; padding: 0 2px 6px; position: relative; z-index: 1;
}

/* ── the month grid — pick a day; the day's hours come up on a second, separate step ───── */
.month-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; position: relative; z-index: 1; }
.month-cell {
  font: inherit; font-size: 15px; aspect-ratio: 1 / 1; border: 0; background: transparent;
  color: var(--ink); border-radius: 12px; cursor: pointer; font-variant-numeric: tabular-nums;
}
/* Padding days from the neighbouring months, shown rather than hidden, muted rather than live. */
.month-cell.is-outside { color: var(--muted); opacity: .55; }
.month-cell.is-today { outline: 2px solid var(--accent); outline-offset: -2px; font-weight: 700; }
.month-cell.is-holiday { color: #8a6d1f; }
@media (prefers-color-scheme: dark) { .month-cell.is-holiday { color: var(--accent); } }
.month-cell.is-unavailable { color: var(--muted); opacity: .35; cursor: default; }
.month-cell:not(:disabled):hover { background: var(--free); }

/* ── the day step — the hours for whichever cell was tapped ─────────────────────────────── */
.day-view { position: relative; z-index: 1; }
.day-view-head { margin: 4px 2px 10px; font-size: 15px; color: var(--muted); }
.day-slots { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 2px; }

.slot {
  font: inherit; font-size: 14px; font-variant-numeric: tabular-nums;
  min-height: 38px; padding: 0 11px; border-radius: 9px; cursor: pointer;
  border: 1px solid var(--free-line); background: var(--free); color: inherit;
}
.slot:hover { border-color: var(--accent); }
.slot:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ── appointment rows (mine / admin) ────────────────────────────────── */
.appt { display: flex; align-items: flex-start; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.appt:last-child { border-bottom: 0; }
.appt-main { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: 3px 10px; }
.appt .when { font-variant-numeric: tabular-nums; font-weight: 700; font-size: 15px; }
.appt .name { font-weight: 600; }
.appt .tel { color: var(--muted); font-size: 14px; text-decoration: none; font-variant-numeric: tabular-nums; direction: ltr; unicode-bidi: isolate; }
.appt .via { flex-basis: 100%; color: var(--muted); font-size: 12.5px; }
.appt .cancel { font: inherit; font-size: 13px; color: var(--danger); background: none; border: 0; cursor: pointer; padding: 4px 2px; flex: none; }

.empty-state { color: var(--muted); font-size: 14.5px; padding: 8px 0; }

/* ── settings ───────────────────────────────────────────────────────── */
.set-group { margin-bottom: 18px; }
.set-group h4 { margin: 0 0 8px; font-size: 15px; }
/* A grid, not a wrapping flex row. As flex, the save button fell to its own line on every
   row and the time inputs were squeezed until their own value was clipped — seven days of
   opening hours became a column of half-legible boxes. Fixed tracks keep label, both
   fields and the button on ONE line at phone width. */
.set-row { display: grid; grid-template-columns: 68px 1fr 1fr auto; align-items: center; gap: 6px; padding: 6px 0; }
.set-row label { font-size: 13.5px; }
.set-row input { font: inherit; font-size: 14px; padding: 7px 6px; border: 1px solid var(--line); border-radius: 9px; background: var(--card); color: inherit; width: 100%; min-width: 0; text-align: center; }
.set-row .via { grid-column: 2 / 4; font-size: 13px; color: var(--muted); }
.set-row .ghost, .set-row .primary { min-height: 36px; padding: 0 10px; font-size: 13.5px; }
/* Three fields plus a button do not fit beside a label at phone width. The fields keep one
   line; the button takes the next, full width, where it also reads as the commit action. */
.set-row-add { grid-template-columns: 1fr 1fr 1fr; }
.set-row-add label { grid-column: 1 / -1; }
.set-row-add .primary { grid-column: 1 / -1; margin-top: 4px; }
.primary, .ghost {
  font: inherit; font-size: 15px; min-height: 42px; padding: 0 18px; border-radius: 11px; cursor: pointer; border: 1px solid transparent;
}
.primary { background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.ghost { background: transparent; border-color: var(--line); color: inherit; }

/* ── booking sheet ──────────────────────────────────────────────────── */
dialog {
  border: 0; border-radius: 16px; padding: 0; width: min(420px, calc(100vw - 24px));
  background: var(--card); color: var(--ink); box-shadow: var(--shadow);
}
dialog::backdrop { background: rgba(10,12,16,.5); }
dialog form { padding: 18px; display: grid; gap: 12px; }
dialog label { display: grid; gap: 5px; font-size: 14px; }
dialog input { font: inherit; font-size: 16px; padding: 11px; border: 1px solid var(--line); border-radius: 11px; background: var(--bg); color: inherit; }
dialog small { color: var(--muted); font-size: 12.5px; }
.sheet-when { margin: 0; font-size: 15px; color: var(--muted); }
.sheet-error { margin: 0; color: var(--danger); font-size: 14px; }
dialog menu { display: flex; gap: 8px; justify-content: flex-start; margin: 4px 0 0; padding: 0; }

.foot { max-width: 880px; margin: 0 auto; padding: 4px 16px 28px; display: flex; justify-content: space-between; gap: 12px; color: var(--muted); font-size: 13px; }
.foot a { color: var(--muted); }

/* המראה החכמה — devplans/image-preview-ai.md stages 6 and 7. Existing tokens only. */
.pv-upload-row { display: flex; gap: 8px; }
.pv-opt {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 18px 8px;
  border: 1.5px dashed var(--line);
  border-radius: 12px;
  text-align: center;
  cursor: pointer;
  font-weight: 600;
}
.pv-consent { display: flex; gap: 8px; align-items: flex-start; margin: 12px 0; cursor: pointer; }
.pv-consent input { margin-top: 3px; flex: none; }
.pv-bar { height: 6px; background: var(--line); border-radius: 999px; overflow: hidden; margin: 10px 0; }
.pv-bar i { display: block; height: 100%; width: 60%; background: var(--accent); border-radius: 999px; }
.pv-variants { display: flex; gap: 8px; flex-wrap: wrap; }
.pv-variant {
  width: 104px;
  padding: 0;
  overflow: hidden;
  border: 2px solid var(--line);
  border-radius: 12px;
  cursor: pointer;
}
.pv-variant[aria-pressed="true"] { border-color: var(--accent); }
.pv-variant img { display: block; width: 100%; height: 104px; object-fit: cover; }
.pv-variant span { display: block; padding: 6px 4px; font-size: 11px; }
.pv-save {
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  padding: 9px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  text-decoration: none;
  color: inherit;
}
/* stage 11ב — full-screen view of the tapped result. Deliberately near-black regardless of
   this page's own light/dark tokens above: a photo reads better against near-black than
   against either --bg value. */
.pv-lightbox {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(15, 10, 8, 0.94);
  display: flex;
  flex-direction: column;
  padding: 14px;
  gap: 12px;
}
/* 🔴 AN AUTHOR-STYLESHEET CLASS SELECTOR BEATS THE BROWSER'S DEFAULT `[hidden]{display:none}`
   UA RULE REGARDLESS OF SOURCE ORDER (Codex review, PR #2211) — `.pv-lightbox`'s `display:
   flex` above rendered even while the element carried the `hidden` attribute, blocking the
   whole screen behind an empty overlay on load. An explicit attribute selector in THIS
   stylesheet is needed to win it back. */
.pv-lightbox[hidden] { display: none; }
.pv-lightbox-top { display: flex; justify-content: flex-end; }
.pv-lightbox-x {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  font-weight: 700;
  font-size: 16px;
  cursor: pointer;
}
.pv-lightbox-img {
  flex: 1;
  min-height: 0;
  width: 100%;
  border-radius: var(--radius);
  object-fit: contain;
  background: rgba(255, 255, 255, 0.04);
}
.pv-lightbox-save-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  border-radius: var(--radius);
  background: #fff;
  color: #14161a;
  font-weight: 800;
  font-size: 15px;
  text-decoration: none;
}
.ip-bars { display: flex; align-items: flex-end; gap: 4px; height: 46px; margin: 10px 0; }
.ip-bars i { flex: 1; background: var(--accent); border-radius: 3px 3px 0 0; opacity: .8; min-height: 6px; }
.ip-list { list-style: none; padding: 0; margin: 8px 0; }
.ip-list li { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 6px 0; }
