/* Encaixa — design system. Tokens no :root; tema escuro automático; cor da marca do negócio via --brand. */
:root {
  --brand: #0f766e;
  --brand-ink: #fff;
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #f1f3f6;
  --line: #e3e6eb;
  --text: #14171c;
  --muted: #5d6573;
  --faint: #8a93a3;
  --ok: #15803d; --ok-bg: #e8f6ed;
  --warn: #b45309; --warn-bg: #fdf3e2;
  --bad: #b91c1c; --bad-bg: #fdecec;
  --info: #1d4ed8; --info-bg: #e9effd;
  --radius: 14px; --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 4px 16px rgba(16, 24, 40, .06);
  --shadow-lg: 0 12px 40px rgba(16, 24, 40, .18);
  --focus: 0 0 0 3px color-mix(in srgb, var(--brand) 35%, transparent);
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1116; --surface: #161a21; --surface-2: #1d222b; --line: #2a303b;
    --text: #e8ebf0; --muted: #a2aab8; --faint: #747d8c;
    --ok: #4ade80; --ok-bg: #12301f; --warn: #fbbf24; --warn-bg: #33280f;
    --bad: #f87171; --bad-bg: #3a1717; --info: #93b4ff; --info-bg: #17223d;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 4px 16px rgba(0, 0, 0, .3);
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 15px/1.5 var(--font); color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .4em; letter-spacing: -.01em; }
h1 { font-size: 1.6rem; } h2 { font-size: 1.2rem; } h3 { font-size: 1rem; }
p { margin: 0 0 .8em; }
a { color: var(--brand); }
small, .muted { color: var(--muted); }
.faint { color: var(--faint); }
.tabnum { font-variant-numeric: tabular-nums; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 8px; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ---- botões ---- */
.btn { --b: var(--surface); --c: var(--text); display: inline-flex; align-items: center; justify-content: center; gap: .5em;
  min-height: 44px; padding: 0 18px; border-radius: 12px; border: 1px solid var(--line); background: var(--b); color: var(--c);
  font: 600 15px var(--font); cursor: pointer; text-decoration: none; transition: transform .08s, background .15s, opacity .15s; white-space: nowrap; }
.btn:hover { background: color-mix(in srgb, var(--b) 92%, var(--text)); }
.btn:active { transform: scale(.98); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn.primary { --b: var(--brand); --c: var(--brand-ink); border-color: transparent; }
.btn.primary:hover { background: color-mix(in srgb, var(--brand) 88%, #000); }
.btn.danger { --c: var(--bad); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.sm { min-height: 34px; padding: 0 12px; font-size: 13px; border-radius: 9px; }
.btn.block { width: 100%; }
.btn.lg { min-height: 52px; font-size: 16px; }
.btn .spin { width: 16px; height: 16px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- formulários ---- */
.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field > span { font-size: 13px; font-weight: 600; color: var(--muted); }
.input, select.input, textarea.input { width: 100%; min-height: 46px; padding: 10px 14px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--surface); color: var(--text); font: 16px var(--font); transition: border-color .15s, box-shadow .15s; }
textarea.input { min-height: 80px; resize: vertical; }
.input:focus { outline: none; border-color: var(--brand); box-shadow: var(--focus); }
.input[aria-invalid="true"] { border-color: var(--bad); }
.err { color: var(--bad); font-size: 13px; min-height: 0; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 520px) { .grid2 { grid-template-columns: 1fr; } }

/* ---- superfícies ---- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 99px; font-size: 12px; font-weight: 600; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.badge.ok { background: var(--ok-bg); color: var(--ok); } .badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.bad { background: var(--bad-bg); color: var(--bad); } .badge.info { background: var(--info-bg); color: var(--info); }
.badge.brand { background: color-mix(in srgb, var(--brand) 14%, transparent); color: var(--brand); }
.divider { height: 1px; background: var(--line); margin: 14px 0; border: 0; }
.avatar { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; font-weight: 700; color: var(--brand-ink); background: var(--brand); flex: none; }

/* ---- feedback ---- */
.toast-wrap { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 100; display: grid; gap: 8px; width: min(92vw, 420px); pointer-events: none; }
.toast { background: var(--text); color: var(--bg); padding: 12px 16px; border-radius: 12px; box-shadow: var(--shadow-lg); font-weight: 500; animation: rise .25s ease-out; pointer-events: auto; }
.toast.bad { background: var(--bad); color: #fff; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }
.skeleton { background: linear-gradient(90deg, var(--surface-2), color-mix(in srgb, var(--surface-2) 60%, var(--surface)), var(--surface-2)); background-size: 200% 100%; animation: shimmer 1.2s infinite; border-radius: 10px; }
@keyframes shimmer { to { background-position: -200% 0; } }
.empty { text-align: center; padding: 28px 16px; color: var(--muted); }
.empty .icon { font-size: 28px; margin-bottom: 6px; }

/* ---- modal / drawer ---- */
dialog { border: 0; padding: 0; border-radius: 18px; background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg); width: min(94vw, 520px); max-height: 90vh; }
dialog::backdrop { background: rgba(10, 14, 20, .45); backdrop-filter: blur(2px); }
dialog .dlg-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px 0; }
dialog .dlg-body { padding: 14px 18px 18px; overflow: auto; }
@media (max-width: 600px) { dialog { width: 100vw; max-width: 100vw; margin: auto 0 0; border-radius: 18px 18px 0 0; } }

/* ============ fluxo público de agendamento ============ */
.shell { max-width: 640px; margin: 0 auto; padding: 16px 16px 120px; }
.biz-head { display: flex; gap: 12px; align-items: center; padding: 8px 0 18px; }
.biz-head h1 { font-size: 1.25rem; margin: 0; }
.steps { display: flex; gap: 6px; margin: 0 0 18px; }
.steps i { flex: 1; height: 4px; border-radius: 4px; background: var(--line); transition: background .3s; }
.steps i.on { background: var(--brand); }
.section-title { display: flex; justify-content: space-between; align-items: baseline; margin: 6px 0 10px; }
.section-title h2 { margin: 0; }
.link-btn { background: none; border: 0; color: var(--brand); font: 600 14px var(--font); cursor: pointer; padding: 6px; }

.svc-list { display: grid; gap: 10px; }
.svc { display: flex; gap: 12px; align-items: center; width: 100%; text-align: left; background: var(--surface); border: 1.5px solid var(--line);
  border-radius: var(--radius); padding: 14px 16px; cursor: pointer; color: var(--text); font: inherit; transition: border-color .15s, box-shadow .15s, transform .08s; }
.svc:hover { border-color: color-mix(in srgb, var(--brand) 50%, var(--line)); }
.svc:active { transform: scale(.995); }
.svc[aria-pressed="true"] { border-color: var(--brand); box-shadow: var(--focus); }
.svc .name { font-weight: 600; }
.svc .meta { color: var(--muted); font-size: 13px; }
.svc .price { margin-left: auto; font-weight: 700; white-space: nowrap; }

.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 8px; scroll-snap-type: x proximity; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; scroll-snap-align: start; border: 1.5px solid var(--line); background: var(--surface); color: var(--text); border-radius: 99px;
  padding: 8px 14px; font: 600 14px var(--font); cursor: pointer; min-height: 40px; }
.chip[aria-pressed="true"] { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }

.days { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 10px; scroll-snap-type: x mandatory; scrollbar-width: none; }
.days::-webkit-scrollbar { display: none; }
.day { flex: none; width: 62px; scroll-snap-align: start; display: grid; justify-items: center; gap: 2px; padding: 10px 0; border-radius: 14px;
  border: 1.5px solid var(--line); background: var(--surface); color: var(--text); cursor: pointer; font: inherit; position: relative; }
.day .wd { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.day .dn { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.day .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--ok); }
.day.none { opacity: .45; }
.day.none .dot { background: transparent; }
.day[aria-pressed="true"] { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.day[aria-pressed="true"] .wd { color: inherit; opacity: .85; }
.day[aria-pressed="true"] .dot { background: var(--brand-ink); }

.slot-group { margin: 14px 0 4px; font-size: 13px; font-weight: 600; color: var(--muted); }
.slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; }
.slot { min-height: 46px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--surface); color: var(--text);
  font: 600 15px var(--font); cursor: pointer; font-variant-numeric: tabular-nums; position: relative; }
.slot:hover { border-color: var(--brand); }
.slot.smart::after { content: ""; position: absolute; top: 6px; right: 6px; width: 6px; height: 6px; border-radius: 50%; background: var(--brand); }
.slot[aria-pressed="true"] { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.legend { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; margin-top: 10px; }
.legend::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--brand); }

.sticky-cta { position: fixed; left: 0; right: 0; bottom: 0; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(8px); border-top: 1px solid var(--line); z-index: 20; }
.sticky-cta .inner { max-width: 640px; margin: 0 auto; display: flex; gap: 12px; align-items: center; }
.sticky-cta .sum { flex: 1; min-width: 0; font-size: 13px; color: var(--muted); }
.sticky-cta .sum b { display: block; color: var(--text); font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.summary { display: grid; gap: 8px; }
.summary .line { display: flex; justify-content: space-between; gap: 12px; }
.summary .line span:first-child { color: var(--muted); }
.success-mark { width: 72px; height: 72px; border-radius: 50%; display: grid; place-items: center; margin: 8px auto 14px;
  background: color-mix(in srgb, var(--ok) 16%, transparent); color: var(--ok); animation: pop .35s cubic-bezier(.2, 1.4, .4, 1); }
@keyframes pop { from { transform: scale(.5); opacity: 0; } }
.pix-box { font-family: ui-monospace, Consolas, monospace; font-size: 12px; word-break: break-all; background: var(--surface-2); padding: 12px; border-radius: 10px; border: 1px dashed var(--line); }
.timer { font-variant-numeric: tabular-nums; font-weight: 700; }
.trust { display: flex; gap: 14px; flex-wrap: wrap; justify-content: center; font-size: 12px; color: var(--faint); margin-top: 22px; }
.powered { text-align: center; font-size: 12px; color: var(--faint); margin-top: 26px; }
.powered a { color: inherit; }
.fade-in { animation: rise .25s ease-out; }
