/* Saloon App styles. Values copied from docs/salon-style-reference.html.
   Logical properties only (inline-start/end), so RTL and LTR both work. */

@font-face {
  font-family: "Readex Pro";
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url(fonts/readex-arabic.woff2) format("woff2");
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC;
}
@font-face {
  font-family: "Readex Pro";
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url(fonts/readex-latin.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --bg: #FBF6F8;  --surface: #FFFFFF;  --ink: #2B1E2C;  --muted: #7A6878;
  --berry: #8C2F5F;  --berry-soft: #F4E3EC;
  --teal: #2C6B66;   --teal-soft: #E1EFEE;
  --line: #EADDE4;
  --warn: #B2562A;   --warn-soft: #FBEDE3;
  --gold: #9A7420;   --gold-soft: #F6EDD6;
  --silver: #5E6B78; --silver-soft: #E7ECF0;
  --bronze: #94552F; --bronze-soft: #F4E5DA;
  color-scheme: light;
  box-sizing: border-box;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg:#1A1319; --surface:#251B24; --ink:#F3E9EF; --muted:#B39FB0;
    --berry:#E08AB5; --berry-soft:#3A2333; --teal:#7CC4BD; --teal-soft:#1E3533;
    --line:#3A2C38; --warn:#F0A47A; --warn-soft:#3A2A20;
    --gold:#E3C26F; --gold-soft:#3A3020; --silver:#B9C4CE; --silver-soft:#2C3238;
    --bronze:#E0A07A; --bronze-soft:#3A2820;
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: inherit; }
html { height: 100%; scroll-padding-top: env(safe-area-inset-top, 0px); }
body {
  margin: 0; min-height: 100%; background: var(--bg); color: var(--ink);
  font-family: "Readex Pro", Tahoma, "Segoe UI", system-ui, sans-serif; font-size: 16px; line-height: 1.6;
  -webkit-tap-highlight-color: transparent;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--berry); }
:focus-visible { outline: 3px solid var(--berry); outline-offset: 2px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.wrap { max-width: 560px; margin: 0 auto; padding: 0 16px 120px; }

/* ---------- header / list ---------- */
header.top {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5; background: var(--bg);
  padding: 18px 0 12px; border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand h1 { margin: 0; font-size: 1.6rem; font-weight: 700; }
.brand .count { color: var(--muted); font-size: .9rem; }
.brand .tools { display: flex; gap: 8px; }
.iconbtn {
  background: none; border: 1.5px solid var(--line); border-radius: 12px; min-width: 44px; height: 44px;
  display: grid; place-items: center; font-size: 1.1rem; padding: 0 8px; text-decoration: none; color: var(--ink);
}
.iconbtn.lang { font-size: .9rem; font-weight: 500; }
.search { margin-top: 12px; display: flex; gap: 8px; }
.search input {
  flex: 1; min-width: 0; border: 1.5px solid var(--line); background: var(--surface);
  border-radius: 14px; padding: 12px 14px;
}
.search .more {
  border: 1.5px solid var(--line); background: var(--surface); border-radius: 14px;
  padding: 0 14px; white-space: nowrap; min-height: 44px;
}
.search .more[data-on="true"] { border-color: var(--berry); color: var(--berry); }
.chips { display: flex; gap: 8px; margin-top: 10px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  border: 1.5px solid var(--line); background: transparent; border-radius: 999px; padding: 6px 14px;
  white-space: nowrap; font-size: .9rem; color: var(--muted); min-height: 44px; text-decoration: none;
  display: inline-flex; align-items: center;
}
.chip[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.chip.pending { border-color: var(--berry); color: var(--berry); }

.bday-banner {
  display: flex; align-items: center; gap: 12px; width: 100%; margin-top: 14px; background: var(--berry-soft); color: var(--berry);
  border: 0; border-radius: 14px; padding: 12px 14px; text-align: start;
}
.bday-banner b { display: block; }
.bday-banner span { font-size: .88rem; }
.bday-banner .ic { font-size: 1.6rem; }

.list { list-style: none; margin: 8px 0 0; padding: 0; }
.row {
  display: flex; align-items: center; gap: 14px; padding: 14px 4px; border: 0; border-bottom: 1px solid var(--line);
  width: 100%; background: none; text-align: start; text-decoration: none; color: inherit;
}
.avatar {
  flex: none; width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center;
  background: var(--berry-soft); color: var(--berry); font-weight: 600; font-size: 1.1rem; border: 2.5px solid transparent;
}
.avatar.gold { border-color: var(--gold); } .avatar.silver { border-color: var(--silver); } .avatar.bronze { border-color: var(--bronze); }
.row .who { flex: 1; min-width: 0; }
.row .name { font-weight: 600; }
.row .sub { color: var(--muted); font-size: .88rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.badges { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.due { font-size: .78rem; background: var(--warn-soft); color: var(--warn); border-radius: 8px; padding: 3px 8px; white-space: nowrap; }
.bd { font-size: .78rem; background: var(--berry-soft); color: var(--berry); border-radius: 8px; padding: 3px 8px; white-space: nowrap; }
.tier { font-size: .75rem; border-radius: 6px; padding: 1px 7px; font-weight: 500; white-space: nowrap; }
.tier.gold { background: var(--gold-soft); color: var(--gold); } .tier.silver { background: var(--silver-soft); color: var(--silver); }
.tier.bronze { background: var(--bronze-soft); color: var(--bronze); } .tier.new { background: var(--teal-soft); color: var(--teal); }

.fab {
  position: fixed; inset-inline: 0; margin-inline: auto; width: fit-content;
  bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  background: var(--berry); color: #fff; border: 0; border-radius: 999px; padding: 14px 26px; font-weight: 600;
  box-shadow: 0 8px 24px -8px var(--berry); z-index: 6;
}

.empty { text-align: center; padding: 56px 12px; color: var(--muted); }
.empty strong { display: block; color: var(--ink); font-size: 1.1rem; margin-bottom: 6px; }

/* skeleton rows while loading */
.skel { display: flex; align-items: center; gap: 14px; padding: 14px 4px; border-bottom: 1px solid var(--line); }
.skel i { display: block; background: var(--line); border-radius: 8px; }
.skel .a { width: 46px; height: 46px; border-radius: 50%; }
.skel .l { flex: 1; } .skel .l i { height: 14px; margin: 6px 0; } .skel .l i + i { width: 60%; }

/* ---------- detail ---------- */
.back { background: none; border: 0; color: var(--berry); padding: 0; font-weight: 500; text-decoration: none; min-height: 44px; display: inline-flex; align-items: center; }
.linkbtn { background: none; border: 0; padding: 0; font-size: .85rem; color: var(--muted); min-height: 32px; }
.hero { padding: 22px 0 18px; border-bottom: 1px solid var(--line); }
.hero h2 { margin: 8px 0 2px; font-size: 1.9rem; line-height: 1.25; font-weight: 700; }
.hero .meta { color: var(--muted); }
.actions { display: flex; gap: 8px; margin-top: 16px; flex-wrap: wrap; }
.btn {
  border: 0; border-radius: 12px; padding: 11px 16px; font-weight: 500; text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px;
}
.btn.wa { background: var(--teal); color: #fff; }
.btn.call { background: var(--teal-soft); color: var(--teal); }
.btn.ghost { background: transparent; border: 1.5px solid var(--line); color: var(--ink); }
.btn.primary { background: var(--berry); color: #fff; }
.btn.soft { background: var(--berry-soft); color: var(--berry); }
.btn.danger { background: transparent; color: var(--warn); border: 1.5px solid var(--warn-soft); }
.btn[disabled] { opacity: .55; }

section.block { padding: 20px 0; border-bottom: 1px solid var(--line); }
section.block h3 { margin: 0 0 12px; font-size: 1.05rem; font-weight: 600; }
dl.prefs { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 10px 16px; }
dl.prefs dt { color: var(--muted); font-size: .9rem; }
dl.prefs dd { margin: 0; }
.alert { background: var(--warn-soft); color: var(--warn); border-radius: 12px; padding: 10px 14px; margin-bottom: 12px; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { background: var(--berry-soft); color: var(--berry); border-radius: 8px; padding: 3px 10px; font-size: .88rem; }
.tag.no { background: var(--line); color: var(--muted); text-decoration: line-through; }

.loyal { border-radius: 16px; padding: 16px; margin-top: 18px; }
.loyal.gold { background: var(--gold-soft); color: var(--gold); } .loyal.silver { background: var(--silver-soft); color: var(--silver); }
.loyal.bronze { background: var(--bronze-soft); color: var(--bronze); } .loyal.new, .loyal.none { background: var(--teal-soft); color: var(--teal); }
.loyal .l-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.loyal .l-name { font-size: 1.25rem; font-weight: 700; }
.loyal .l-stats { display: flex; gap: 18px; margin-top: 8px; color: var(--ink); }
.loyal .l-stats b { display: block; font-size: 1.3rem; line-height: 1.2; }
.loyal .l-stats span { font-size: .82rem; color: var(--muted); }
.bar { height: 8px; border-radius: 99px; background: rgba(127,127,127,.18); margin-top: 12px; overflow: hidden; }
.bar i { display: block; height: 100%; background: currentColor; border-radius: 99px; }
.loyal .l-next { font-size: .85rem; margin-top: 6px; }

.visit { padding: 12px 0; border-top: 1px dashed var(--line); }
.visit:first-of-type { border-top: 0; }
.visit .v-top { display: flex; justify-content: space-between; gap: 8px; }
.visit .v-date { color: var(--muted); font-size: .88rem; }
.visit .v-price { font-weight: 600; white-space: nowrap; }
.visit .v-note { color: var(--muted); font-size: .92rem; }
.visit .v-acts { display: flex; gap: 14px; }

/* ---------- sheet ---------- */
.sheet-bg { position: fixed; inset: 0; background: rgba(20,10,20,.45); z-index: 20; }
.sheet {
  position: fixed; inset-inline: 0; bottom: 0; z-index: 21; background: var(--bg);
  border-radius: 22px 22px 0 0; max-height: 92%; overflow-y: auto;
  padding: 18px 18px calc(24px + env(safe-area-inset-bottom, 0px));
  transform: translateY(100%); transition: transform .25s ease; max-width: 560px; margin: 0 auto;
}
.sheet.open { transform: translateY(0); }
.sheet h3 { margin: 0 0 14px; font-size: 1.25rem; font-weight: 700; }
.sheet h4 { margin: 18px 0 8px; font-size: 1rem; font-weight: 600; }
.field { margin-bottom: 14px; }
.field label, .flabel { display: block; font-size: .9rem; color: var(--muted); margin-bottom: 4px; }
.field input, .field textarea, .field select {
  width: 100%; border: 1.5px solid var(--line); background: var(--surface); border-radius: 12px; padding: 11px 12px; min-height: 44px;
}
.field textarea { min-height: 72px; resize: vertical; }
.field .hint { font-size: .8rem; color: var(--muted); margin-top: 3px; }
.field .ferr { font-size: .85rem; color: var(--warn); margin-top: 3px; }
.field [aria-invalid="true"] { border-color: var(--warn); }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.three { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.check { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 12px; }
.check input { width: 22px; height: 22px; flex: none; margin-top: 2px; accent-color: var(--berry); }
.sheet .foot { display: flex; gap: 8px; margin-top: 6px; }
.sheet .foot .btn { flex: 1; }
.menu-item {
  display: block; width: 100%; text-align: start; background: var(--surface); border: 1.5px solid var(--line);
  border-radius: 14px; padding: 14px 16px; margin-bottom: 10px;
}
.menu-item b { display: block; }
.menu-item span { font-size: .88rem; color: var(--muted); }
.err { color: var(--warn); font-size: .9rem; margin: 4px 0 10px; min-height: 1em; }
.notice { background: var(--warn-soft); color: var(--warn); border-radius: 12px; padding: 12px 14px; margin-top: 16px; }
.small { font-size: .85rem; color: var(--muted); }
.preview { background: var(--surface); border: 1.5px dashed var(--line); border-radius: 12px; padding: 10px 12px; white-space: pre-wrap; font-size: .9rem; margin: -6px 0 14px; }

/* ---------- toast (tier-up celebration) ---------- */
.toast {
  position: fixed; inset-inline: 16px; margin-inline: auto; max-width: 420px; z-index: 40;
  bottom: calc(90px + env(safe-area-inset-bottom, 0px));
  background: var(--ink); color: var(--bg); border-radius: 14px; padding: 14px 16px; text-align: center; font-weight: 600;
  animation: toast-in .3s ease;
}
.toast.err { background: var(--warn); color: #fff; }
@keyframes toast-in { from { transform: translateY(16px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- intake (customer-facing, full screen) ---------- */
.intake { position: fixed; inset: 0; z-index: 30; background: var(--bg); overflow-y: auto; }
.intake.page { position: static; overflow: visible; }
.intake .in { max-width: 520px; margin: 0 auto; padding: calc(28px + env(safe-area-inset-top, 0px)) 20px calc(40px + env(safe-area-inset-bottom, 0px)); }
.intake .in-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; min-height: 44px; }
.intake .logo { max-height: 56px; max-width: 160px; }
.intake .welcome { font-size: 1.9rem; font-weight: 700; line-height: 1.25; margin: 6px 0; }
.intake .lead { color: var(--muted); margin: 0 0 22px; }
.intake .group { background: var(--surface); border: 1.5px solid var(--line); border-radius: 18px; padding: 16px 16px 4px; margin-bottom: 16px; }
.intake .group h4 { margin: 0 0 12px; color: var(--berry); font-size: 1rem; font-weight: 600; }
.intake .field input, .intake .field textarea, .intake .field select { background: var(--bg); }
.pills { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 14px; border: 0; padding: 0; min-width: 0; }
.pills label { position: relative; border: 1.5px solid var(--line); border-radius: 999px; padding: 7px 14px; font-size: .92rem; cursor: pointer; min-height: 44px; display: inline-flex; align-items: center; }
.pills input { position: absolute; opacity: 0; pointer-events: none; }
.pills input:checked + span { color: var(--berry); font-weight: 600; }
.pills label:has(input:checked) { border-color: var(--berry); background: var(--berry-soft); }
.pills label:has(input:focus-visible) { outline: 3px solid var(--berry); outline-offset: 2px; }
.intake .submit { width: 100%; padding: 15px; font-size: 1.05rem; border-radius: 14px; }
.intake .done { text-align: center; padding-top: 20vh; }
.intake .done .big { font-size: 3rem; }
.staff-exit { background: none; border: 0; color: var(--muted); font-size: .85rem; padding: 0; min-height: 44px; }
.pin { letter-spacing: normal; text-align: center; font-size: 1.4rem; }
.ts-box { margin: 4px 0 14px; min-height: 65px; }

/* ---------- review ---------- */
.sub-card { background: var(--surface); border: 1.5px solid var(--line); border-radius: 16px; padding: 14px 16px; margin-top: 14px; }
.sub-card h3 { margin: 0; font-size: 1.1rem; font-weight: 600; }
.diff { width: 100%; border-collapse: collapse; margin: 10px 0; font-size: .9rem; }
.diff th, .diff td { text-align: start; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
.diff th { color: var(--muted); font-weight: 500; }
.diff .old { color: var(--muted); }
.diff-wrap { overflow-x: auto; }

/* ---------- settings ---------- */
.set-section { padding: 18px 0; border-bottom: 1px solid var(--line); }
.set-section h3 { margin: 0 0 8px; font-size: 1.05rem; font-weight: 600; }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 0; border-bottom: 1px dashed var(--line); }
.set-row:last-child { border-bottom: 0; }
.set-row .who { flex: 1; min-width: 0; }
.set-row .sub { color: var(--muted); font-size: .85rem; display: block; }
.badge-off { font-size: .75rem; border-radius: 6px; padding: 1px 7px; background: var(--line); color: var(--muted); }

/* ---------- login ---------- */
.auth { max-width: 400px; margin: 0 auto; padding: calc(12vh + env(safe-area-inset-top, 0px)) 20px 40px; }
.auth h1 { font-size: 1.6rem; font-weight: 700; margin: 0 0 4px; }
.auth .lead { color: var(--muted); margin: 0 0 22px; }
.auth .btn { width: 100%; }
.auth .top-tools { display: flex; justify-content: flex-end; margin-bottom: 12px; }

/* ---------- bookings ---------- */
.day-nav { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 12px; }
.day-nav input { border: 1.5px solid var(--line); background: var(--surface); border-radius: 12px; padding: 9px 12px; min-height: 44px; }
.staff-col h3 { margin: 18px 0 4px; font-size: 1.05rem; font-weight: 600; }
.bk { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); width: 100%; background: none; border-inline: 0; border-top: 0; text-align: start; }
.bk .t { font-weight: 600; min-width: 64px; }
.bk .st { font-size: .75rem; border-radius: 6px; padding: 1px 7px; background: var(--teal-soft); color: var(--teal); }
.bk .st.cancelled { background: var(--line); color: var(--muted); }
.bk .st.done { background: var(--berry-soft); color: var(--berry); }

@media (prefers-reduced-motion: reduce) {
  .sheet { transition: none; }
  .toast { animation: none; }
}

/* small helpers (no inline styles: CSP forbids them) */
.mt { margin-top: 14px; }
.pre { white-space: pre-wrap; margin: 14px 0 0; }
.sec-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 8px; }
.sec-head h3 { margin: 0 !important; }
.actions.bottom { margin-top: 20px; }
.intake .h4 { margin: 0 0 12px; color: var(--berry); font-size: 1rem; font-weight: 600; }

/* Text on accent buttons: white in light mode; in dark mode the accents are light, so use the dark ground for contrast (WCAG AA). */
:root { --on-accent: #fff; }
@media (prefers-color-scheme: dark) { :root { --on-accent: var(--bg); } }
.fab, .btn.primary, .btn.wa, .toast.err { color: var(--on-accent); }
textarea[id^="tpl_"] { min-height: 120px; }

/* WCAG AA text contrast (spec asks for accessibility ≥ 95). The spec tokens stay as they are for
   backgrounds, borders and rings; only TEXT on the light tinted backgrounds uses these slightly
   darker shades, in light mode. Dark mode already passes, so the variants equal the tokens there. */
:root { --warn-text: #A95228; --gold-text: #86651C; --muted-strong: #6D5D6B; }
@media (prefers-color-scheme: dark) { :root { --warn-text: var(--warn); --gold-text: var(--gold); --muted-strong: var(--muted); } }
.due, .alert, .notice { color: var(--warn-text); }
.tier.gold, .loyal.gold { color: var(--gold-text); }
.loyal .l-stats span, .loyal .small, .tag.no, .badge-off { color: var(--muted-strong); }
