:root {
  --plum: #7a2f5b; --plum-2: #5c2144; --blush: #f6d8c6; --rose: #e9b7a5;
  --bg: #fbf7f4; --card: #fff; --ink: #2a1f26; --muted: #7d6f77; --line: #eadfd9;
  --ok: #2f7a55; --warn: #b7791f; --bad: #b23a48; --info: #3b5ba9;
  --r: 14px; --shadow: 0 1px 2px rgba(60, 20, 40, .06), 0 6px 20px rgba(60, 20, 40, .06);
  font-family: Inter, system-ui, sans-serif; color: var(--ink); background: var(--bg);
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; -webkit-font-smoothing: antialiased; }
h1, h2, h3, .brand { font-family: Fraunces, Georgia, serif; font-weight: 600; letter-spacing: -.01em; }
h1 { font-size: 1.6rem; margin: 0 0 .25rem; } h2 { font-size: 1.25rem; margin: 1.25rem 0 .5rem; } h3 { font-size: 1.05rem; margin: .5rem 0; }
a { color: var(--plum); }
.splash { display: grid; place-items: center; height: 100vh; font: 600 2rem Fraunces, serif; color: var(--plum); }
.muted { color: var(--muted); } .small { font-size: .85rem; } .right { text-align: right; } .nowrap { white-space: nowrap; }
.row { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; } .spacer { flex: 1; }
.grid { display: grid; gap: .75rem; } .g2 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.g4 { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }

/* Layout */
.shell { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.side { background: var(--plum-2); color: #f8eaf1; padding: 1rem .75rem; position: sticky; top: 0; height: 100vh; overflow: auto; }
.side .brand { font-size: 1.4rem; padding: .25rem .5rem 1rem; display: flex; gap: .5rem; align-items: center; }
.side .brand img { width: 34px; height: 34px; border-radius: 8px; object-fit: cover; background: #fff; }
.side nav a { display: flex; gap: .6rem; align-items: center; padding: .6rem .7rem; border-radius: 10px; color: inherit; text-decoration: none; font-weight: 500; }
.side nav a:hover { background: rgba(255,255,255,.08); } .side nav a.on { background: var(--blush); color: var(--plum-2); }
.side .who { border-top: 1px solid rgba(255,255,255,.15); margin-top: 1rem; padding: .75rem .5rem; font-size: .85rem; }
.side .badge { margin-left: auto; }
.main { padding: 1.25rem clamp(1rem, 3vw, 2.25rem) 5rem; max-width: 1200px; width: 100%; }
.topbar { display: none; }
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; inset: 0 25% 0 0; z-index: 30; transform: translateX(-105%); transition: transform .2s; }
  .side.open { transform: none; box-shadow: 0 0 0 100vmax rgba(0,0,0,.35); }
  .topbar { display: flex; align-items: center; gap: .5rem; position: sticky; top: 0; z-index: 20; background: var(--plum-2); color: #fff; padding: .6rem .9rem; }
  .topbar .brand { font-size: 1.15rem; }
  .main { padding-top: 1rem; }
}

/* Components */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 1rem; box-shadow: var(--shadow); }
.card + .card { margin-top: .75rem; }
.stat { display: flex; flex-direction: column; gap: .15rem; } .stat b { font: 600 1.5rem Fraunces, serif; } .stat span { color: var(--muted); font-size: .85rem; }
.btn { appearance: none; border: 1px solid var(--line); background: #fff; color: var(--ink); border-radius: 10px; padding: .55rem .9rem; font: 500 .92rem Inter, sans-serif; cursor: pointer; display: inline-flex; gap: .4rem; align-items: center; text-decoration: none; }
.btn:hover { border-color: var(--rose); } .btn:disabled { opacity: .5; cursor: default; }
.btn.primary { background: var(--plum); color: #fff; border-color: var(--plum); } .btn.primary:hover { background: var(--plum-2); }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #fff; } .btn.bad { color: var(--bad); }
.btn.sm { padding: .3rem .6rem; font-size: .82rem; border-radius: 8px; } .btn.block { width: 100%; justify-content: center; }
.btn.ghost { background: transparent; border-color: transparent; } .topbar .btn.ghost { color: #fff; font-size: 1.3rem; }
.badge { display: inline-block; padding: .12rem .5rem; border-radius: 99px; font-size: .75rem; font-weight: 600; background: #f1e8ec; color: var(--plum-2); white-space: nowrap; }
.b-pendente { background: #fff2d9; color: #8a5a00; } .b-proposta { background: #ffe9d6; color: #a14d00; } .b-confirmada { background: #e2efff; color: var(--info); }
.b-em_atendimento { background: #efe4ff; color: #5b3aa9; } .b-concluida { background: #dff3e8; color: var(--ok); }
.b-recusada, .b-cancelada, .b-nao_compareceu, .b-low { background: #fbe3e6; color: var(--bad); } .b-bloqueio { background: #eee; color: #555; }
.b-paga { background: #dff3e8; color: var(--ok); } .b-aberta { background: #fff2d9; color: #8a5a00; } .b-vencida { background: #fbe3e6; color: var(--bad); }

label { display: block; font-size: .82rem; font-weight: 500; color: var(--muted); margin-bottom: .25rem; }
input, select, textarea { width: 100%; font: 400 .95rem Inter, sans-serif; padding: .6rem .7rem; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink); }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--rose); border-color: var(--rose); }
input[type=checkbox] { width: auto; accent-color: var(--plum); } textarea { min-height: 80px; }
.check { display: flex; align-items: center; gap: .45rem; font-size: .92rem; color: var(--ink); font-weight: 400; margin: 0; }
.chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.chip { border: 1px solid var(--line); background: #fff; border-radius: 99px; padding: .4rem .8rem; cursor: pointer; font-size: .9rem; user-select: none; }
.chip.on { background: var(--plum); color: #fff; border-color: var(--plum); }
.chip input { display: none; }

table.t { width: 100%; border-collapse: collapse; font-size: .92rem; }
.t th { text-align: left; font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: .5rem; border-bottom: 1px solid var(--line); }
.t td { padding: .6rem .5rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
.t tr:last-child td { border-bottom: 0; }
.table-wrap { overflow-x: auto; }
@media (max-width: 640px) {
  .t.resp thead { display: none; } .t.resp tr { display: block; padding: .6rem 0; border-bottom: 1px solid var(--line); }
  .t.resp td { display: flex; justify-content: space-between; gap: 1rem; border: 0; padding: .2rem .25rem; }
  .t.resp td::before { content: attr(data-l); color: var(--muted); font-size: .8rem; }
}

.tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--line); margin: .75rem 0 1rem; overflow-x: auto; }
.tabs a { padding: .55rem .9rem; text-decoration: none; color: var(--muted); font-weight: 500; border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs a.on { color: var(--plum); border-color: var(--plum); }

.appt { display: grid; grid-template-columns: 64px 1fr auto; gap: .75rem; align-items: start; }
.appt .hr { font: 600 1.1rem Fraunces, serif; color: var(--plum); }
.appt .acts { display: flex; flex-wrap: wrap; gap: .3rem; justify-content: flex-end; }
@media (max-width: 640px) { .appt { grid-template-columns: 52px 1fr; } .appt .acts { grid-column: 1 / -1; justify-content: flex-start; } }

/* Modal & toast */
.modal-bg { position: fixed; inset: 0; background: rgba(42, 20, 32, .45); z-index: 50; display: grid; place-items: center; padding: 1rem; }
.modal { background: #fff; border-radius: 18px; width: min(640px, 100%); max-height: 92vh; overflow: auto; padding: 1.25rem; }
.modal header { display: flex; align-items: center; margin-bottom: .75rem; } .modal header h3 { margin: 0; flex: 1; }
.modal footer { display: flex; justify-content: flex-end; gap: .5rem; margin-top: 1rem; position: sticky; bottom: -1.25rem; background: #fff; padding: .75rem 0 0; }
#toast { position: fixed; left: 50%; bottom: 1.25rem; transform: translateX(-50%); z-index: 60; }
#toast div { background: var(--ink); color: #fff; padding: .7rem 1rem; border-radius: 12px; margin-top: .4rem; box-shadow: var(--shadow); font-size: .92rem; }
#toast div.err { background: var(--bad); }

/* Login / público */
.center-page { min-height: 100vh; display: grid; place-items: center; padding: 1rem; background: radial-gradient(1200px 600px at 10% -10%, var(--blush), transparent), var(--bg); }
.auth-card { width: min(420px, 100%); }
.pub { max-width: 720px; margin: 0 auto; padding: 1rem 1rem 4rem; }
.pub-head { display: flex; gap: 1rem; align-items: center; margin: .5rem 0 1rem; }
.pub-head img { width: 72px; height: 72px; border-radius: 16px; object-fit: cover; background: #fff; border: 1px solid var(--line); }
.step { display: flex; gap: .6rem; align-items: center; font-weight: 600; margin: 1.25rem 0 .6rem; }
.step i { font-style: normal; width: 26px; height: 26px; display: grid; place-items: center; background: var(--plum); color: #fff; border-radius: 50%; font-size: .85rem; }
.svc { display: flex; justify-content: space-between; gap: .5rem; padding: .7rem .8rem; border: 1px solid var(--line); border-radius: 12px; background: #fff; cursor: pointer; }
.svc.on { border-color: var(--plum); background: #fbf0f5; }
.sticky-cta { position: sticky; bottom: 0; background: linear-gradient(transparent, var(--bg) 30%); padding: 1rem 0 .5rem; }
.map { width: 100%; height: 220px; border: 0; border-radius: 12px; }
.logo-prev { width: 96px; height: 96px; border-radius: 16px; object-fit: cover; border: 1px solid var(--line); background: #fff; }

/* Ficha impressa (inspirada na ficha de papel do salão) */
.ficha { background: #fff; border: 1px solid var(--ink); padding: 1rem; font-size: .9rem; }
.ficha .fh { display: flex; justify-content: space-between; align-items: end; border-bottom: 2px solid var(--ink); padding-bottom: .5rem; }
.ficha .fh b { font: italic 700 1.6rem Inter, sans-serif; letter-spacing: -.02em; }
.ficha table { width: 100%; border-collapse: collapse; margin-top: .5rem; }
.ficha th, .ficha td { border: 1px solid var(--ink); padding: .35rem .5rem; }
.ficha td.cat { writing-mode: vertical-rl; transform: rotate(180deg); text-align: center; font-weight: 700; width: 28px; text-transform: uppercase; }
.ficha .tot { text-align: right; font-weight: 700; font-size: 1.05rem; margin-top: .5rem; }
@media print {
  body * { visibility: hidden; } .ficha, .ficha * { visibility: visible; }
  .ficha { position: absolute; left: 0; top: 0; width: 100%; border: 0; }
}
.empty { text-align: center; color: var(--muted); padding: 2rem 1rem; }
.qr { width: 200px; height: 200px; border-radius: 12px; border: 1px solid var(--line); background: #fff; }

.status-card { text-align: center; padding: 1.5rem 1rem; }
.status-card .ico { font-size: 2.4rem; }
.cmp { display: grid; grid-template-columns: 1fr auto 1fr; gap: .5rem; align-items: center; text-align: center; margin: .75rem 0; }
.cmp .old { text-decoration: line-through; color: var(--muted); }
.hint { background: #fbf0f5; border: 1px dashed var(--rose); border-radius: 12px; padding: .7rem .8rem; font-size: .88rem; }
