/* Base tokens (Default skin, light/dark), layout and components. Skins live in themes.css. */
/* Layout: one phone-width booking column centred on a quiet stage; prototype controls live in a sticky bar above it.
   Skins only swap tokens + a few extension rules — structure never changes. */
:root {
  --page: #e9ecf2;
  --bg: #f6f7fa;
  --surface: #ffffff;
  --surface-2: #edf0f5;
  --text: #141a26;
  --muted: #5b6475;
  --line: #dce1ea;
  --primary: #1e3a6e;
  --on-primary: #ffffff;
  --accent: #a9782a;
  --ok: #17784c;
  --danger: #b8321d;
  --focus: #3a6ad6;
  --shadow: 0 1px 2px rgba(20, 30, 55, .06), 0 6px 18px rgba(20, 30, 55, .06);
  --shadow-press: 0 1px 2px rgba(20, 30, 55, .08);
  --radius: 16px;
  --radius-sm: 10px;
  --bw: 1px;
  --font-display: "Bricolage Grotesque", ui-sans-serif, system-ui, sans-serif;
  --font-body: "Figtree", ui-sans-serif, system-ui, sans-serif;
  --display-case: none;
  --display-track: -0.015em;
  --app-bg: var(--bg);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --page: #0a0d13; --bg: #0f131b; --surface: #171c27; --surface-2: #202634; --text: #e8ecf3;
    --muted: #9aa3b4; --line: #2a3242; --primary: #92b1ef; --on-primary: #0b1426; --accent: #d8a957;
    --ok: #4fc68d; --danger: #ff7b64; --focus: #92b1ef; --shadow: 0 1px 0 rgba(255,255,255,.03);
    --shadow-press: none; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --page: #0a0d13; --bg: #0f131b; --surface: #171c27; --surface-2: #202634; --text: #e8ecf3;
  --muted: #9aa3b4; --line: #2a3242; --primary: #92b1ef; --on-primary: #0b1426; --accent: #d8a957;
  --ok: #4fc68d; --danger: #ff7b64; --focus: #92b1ef; --shadow: 0 1px 0 rgba(255,255,255,.03);
  --shadow-press: none; color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  background: var(--page);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.45;
  -webkit-tap-highlight-color: transparent;
}
body::before {
  content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px);
  z-index: 10; background: var(--surface);
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

/* ---------- Stage + app column ---------- */
.stage { display: flex; justify-content: center; padding-block: 28px 48px; }
.app {
  position: relative;
  width: 100%; max-width: 420px; min-height: 800px;
  display: flex; flex-direction: column;
  background: var(--app-bg);
  color: var(--text);
  font-family: var(--font-body);
  border: 1px solid var(--line);
  border-radius: 28px;
  overflow: clip;
  box-shadow: 0 20px 60px rgba(15, 20, 35, .12);
}
@media (max-width: 480px) {
  .stage { padding-block: 0; }
  .app { border: 0; border-radius: 0; box-shadow: none; min-height: 100dvh; }
}
.pad { padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }

/* Shop header */
.shop { display: flex; align-items: center; gap: 12px; padding-block: 18px 12px; }
.mono {
  width: 44px; height: 44px; flex: none; display: grid; place-items: center;
  border-radius: 12px; background: var(--primary); color: var(--on-primary);
  font-family: var(--font-display); font-weight: 800; font-size: 22px;
}
.shop-name { font-family: var(--font-display); font-weight: 800; font-size: 18px; line-height: 1.1; letter-spacing: var(--display-track); text-transform: var(--display-case); }
.shop-addr { font-size: 13px; color: var(--muted); }
.shop-text { min-width: 0; flex: 1; }
.hud { display: none; }

/* Progress */
.progress { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; padding-block: 4px 10px; }
.progress i { height: 4px; border-radius: 4px; background: var(--line); }
.progress i.on { background: var(--primary); }

/* Summary chips */
.chips { display: flex; flex-wrap: wrap; gap: 6px; min-height: 0; padding-block: 0 4px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; border: var(--bw) solid var(--line);
  background: var(--surface); border-radius: 999px; padding: 5px 10px 5px 12px;
  font-size: 13px; font-weight: 600;
}
.chip svg { width: 12px; height: 12px; opacity: .6; }

/* Screen */
.screen { flex: 1; display: flex; flex-direction: column; gap: 16px; padding-block: 12px 24px; }
.screen.enter { animation: enter .22s ease-out; }
@keyframes enter { from { opacity: 0; transform: translateX(14px); } to { opacity: 1; transform: none; } }
.q {
  margin: 0; font-family: var(--font-display); font-weight: 800; font-size: 28px; line-height: 1.08;
  letter-spacing: var(--display-track); text-transform: var(--display-case); text-wrap: balance;
}
.sub { margin: -8px 0 0; color: var(--muted); font-size: 15px; }
.stack { display: flex; flex-direction: column; gap: 10px; }

/* Cards */
.card {
  position: relative; width: 100%; text-align: left;
  background: var(--surface); border: var(--bw) solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 16px;
  transition: transform .08s ease, box-shadow .08s ease, border-color .15s ease;
}
button.card:hover { border-color: var(--primary); }
button.card:active { transform: scale(.985); box-shadow: var(--shadow-press); }
.svc { display: flex; align-items: center; gap: 12px; min-height: 76px; }
.svc-main { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.svc-name { font-weight: 700; font-size: 17px; }
.svc-meta { color: var(--muted); font-size: 14px; }
.svc-price { font-weight: 700; font-size: 17px; font-variant-numeric: tabular-nums; }
.badge {
  position: absolute; top: -9px; right: 14px; background: var(--accent); color: var(--surface);
  font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  padding: 2px 8px; border-radius: 999px;
}

/* Barbers */
.any { display: flex; align-items: center; gap: 14px; }
.any-icon { width: 48px; height: 48px; flex: none; border-radius: 50%; display: grid; place-items: center; background: var(--primary); color: var(--on-primary); }
.any-icon svg { width: 24px; height: 24px; }
.grow { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.strong { font-weight: 700; font-size: 17px; }
.hint { font-size: 13px; color: var(--muted); }
.hint b { color: var(--ok); font-weight: 700; }
.barbers { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 10px; }
.barber { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; padding: 16px 10px; }
.avatar {
  width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center;
  color: #fff; font-family: var(--font-display); font-weight: 800; font-size: 24px;
}
.barber .hint { line-height: 1.25; }

/* Days + slots */
.days { display: flex; gap: 8px; overflow-x: auto; scroll-snap-type: x mandatory; padding: 2px 2px 8px; margin: 0 -2px; scrollbar-width: none; }
.days::-webkit-scrollbar { display: none; }
.day {
  flex: none; width: 58px; scroll-snap-align: start; display: flex; flex-direction: column; align-items: center; gap: 2px;
  border: var(--bw) solid var(--line); background: var(--surface); border-radius: var(--radius-sm); padding: 8px 0;
}
.day small { font-size: 12px; color: var(--muted); text-transform: capitalize; }
.day strong { font-size: 20px; font-variant-numeric: tabular-nums; }
.day[aria-pressed="true"] { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.day[aria-pressed="true"] small { color: inherit; opacity: .8; }
.day:disabled { opacity: .38; cursor: default; }
.group-label { font-size: 12px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; }
.times { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.time {
  border: var(--bw) solid var(--line); background: var(--surface); border-radius: var(--radius-sm);
  padding: 12px 0; font-weight: 700; font-variant-numeric: tabular-nums;
}
.time:hover { border-color: var(--primary); }
.time:active { background: var(--primary); color: var(--on-primary); }
.empty { text-align: center; padding: 28px 16px; display: flex; flex-direction: column; gap: 12px; align-items: center; }

/* Forms */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-weight: 600; font-size: 14px; }
.input {
  width: 100%; border: var(--bw) solid var(--line); background: var(--surface); border-radius: var(--radius-sm);
  padding: 14px; font-size: 17px;
}
.input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 25%, transparent); }
.note { font-size: 13px; color: var(--muted); }
details.credit summary { cursor: pointer; font-weight: 600; color: var(--primary); list-style: none; padding: 4px 0; }
details.credit summary::-webkit-details-marker { display: none; }
.row { display: flex; gap: 8px; }
.row .input { flex: 1; min-width: 0; text-transform: uppercase; }
.msg-err { color: var(--danger); font-size: 14px; font-weight: 600; }
.msg-ok { color: var(--ok); font-size: 14px; font-weight: 600; }

.summary { display: flex; flex-direction: column; gap: 10px; }
.sum-row { display: flex; justify-content: space-between; gap: 12px; font-size: 15px; }
.sum-row span:first-child { color: var(--muted); }
.sum-row span:last-child { font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }
.sum-total { border-top: 1px dashed var(--line); padding-top: 10px; font-size: 17px; }
.sum-total span:first-child { color: var(--text); font-weight: 700; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; min-height: 54px; padding: 0 18px; border-radius: var(--radius);
  border: var(--bw) solid var(--primary); background: var(--primary); color: var(--on-primary);
  font-weight: 700; font-size: 17px; text-decoration: none;
  transition: transform .08s ease, box-shadow .08s ease, opacity .15s;
}
.btn:active { transform: scale(.985); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.ghost { background: var(--surface); color: var(--text); border-color: var(--line); }
.btn.small { width: auto; min-height: 44px; font-size: 15px; }
.btn.danger { background: var(--surface); color: var(--danger); border-color: var(--line); }
.btn svg { width: 20px; height: 20px; flex: none; }
.link { background: none; border: 0; padding: 0; color: var(--primary); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }

.cta {
  position: sticky; bottom: 0; z-index: 2;
  display: flex; flex-direction: column; gap: 8px;
  padding-block: 12px calc(14px + env(safe-area-inset-bottom, 0px));
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(8px);
  border-top: 1px solid var(--line);
}
.cta-line { display: flex; justify-content: space-between; font-size: 14px; color: var(--muted); }
.cta-line b { color: var(--text); font-size: 16px; font-variant-numeric: tabular-nums; }

.toast {
  position: fixed; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%) translateY(20px);
  background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 999px; font-weight: 600; font-size: 14px;
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 20;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}


/* ---------- Customer page additions ---------- */
body { margin: 0; }
.mute {
  flex: none; width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; font-size: 18px; line-height: 1;
  background: var(--surface); border: var(--bw) solid var(--line);
}
.shop .hud { flex: none; }
.skel { border-radius: var(--radius); background: linear-gradient(90deg, var(--surface-2), var(--surface), var(--surface-2)) 0 0 / 200% 100%; animation: shimmer 1.2s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }
img.avatar { object-fit: cover; }
.card.soon { display: flex; flex-direction: column; gap: 4px; border-style: dashed; }
.warn { background: color-mix(in srgb, var(--danger) 10%, var(--surface)); border-color: color-mix(in srgb, var(--danger) 35%, var(--line)); }

/* ---------- Pix + confirmation (Step 2) ---------- */
/* Pix */
.pay-head { display: flex; justify-content: space-between; align-items: end; gap: 12px; }
.amount { font-family: var(--font-display); font-weight: 800; font-size: 40px; line-height: 1; font-variant-numeric: tabular-nums; letter-spacing: var(--display-track); }
.timer { text-align: right; font-size: 13px; color: var(--muted); }
.timer b { display: block; font-size: 22px; color: var(--text); font-variant-numeric: tabular-nums; }
.code { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 12px; color: var(--muted); background: var(--surface-2); border: 0; text-overflow: ellipsis; padding: 10px 12px; }
.steps { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 10px; counter-reset: s; }
.steps li { display: flex; gap: 12px; align-items: baseline; counter-increment: s; }
.steps li::before {
  content: counter(s); flex: none; width: 24px; height: 24px; display: grid; place-items: center; border-radius: 50%;
  background: var(--surface-2); font-size: 13px; font-weight: 700;
}
details.qr summary { cursor: pointer; font-weight: 600; color: var(--primary); }
details.qr canvas { display: block; margin: 12px auto 0; width: 200px; max-width: 100%; height: auto; border-radius: 8px; }
.waiting { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.pulse { width: 10px; height: 10px; border-radius: 50%; background: var(--ok); animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .25; transform: scale(.7); } }
.sim {
  border: 2px dashed var(--muted); background: transparent; color: var(--muted); border-radius: var(--radius-sm);
  padding: 12px; font-weight: 600; font-size: 14px;
}
.sim small { display: block; font-weight: 500; font-size: 12px; }
/* Done */
.done-hero { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; padding-block: 12px 4px; }
.check { width: 84px; height: 84px; }
.check circle { fill: color-mix(in srgb, var(--ok) 14%, transparent); stroke: var(--ok); stroke-width: 3; }
.check path { fill: none; stroke: var(--ok); stroke-width: 5; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 60; stroke-dashoffset: 60; animation: draw .45s .15s ease-out forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
details.qr img { display: block; margin: 12px auto 0; width: 220px; max-width: 100%; height: auto; border-radius: 8px; background: #fff; image-rendering: pixelated; }
.code { width: 100%; }
.addr-btn { text-align: left; }
.btn[aria-disabled="true"], .btn:disabled { opacity: .55; }
.expired-credit { font-weight: 700; font-size: 20px; letter-spacing: .08em; text-align: center; font-family: ui-monospace, "SF Mono", Menlo, monospace; }
.alts { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.alts .time { min-width: 72px; }
.stamp { display: none; }
.plus { display: none; }

/* Legal notice (details screen) and footer links */
.legal-note { margin: 12px 2px 0; font-size: .8rem; line-height: 1.4; opacity: .75; }
.legal-note a, .legal-links a { color: inherit; text-decoration: underline; }
.legal-links { text-align: center; font-size: .75rem; opacity: .6; padding: 14px 16px calc(14px + env(safe-area-inset-bottom)); }
