/* Visual inspirado na referência "Belleza": rosé suave, verde-sálvia, títulos serifados. */
:root {
  --bg: #fbf6f3; --side: #f7ebe8; --card: #fff; --ink: #2b2024; --muted: #85777c; --line: #f0e4e1;
  --brand: #bd5d67; --brand-ink: #fff; --rose-soft: #f9e1e1; --sage: #5e8a68; --sage-soft: #e2eee3;
  --peach: #fde7d4; --amber: #b8742a; --bad: #b5424c; --ok: #4f8a5e;
  --serif: 'Playfair Display', Georgia, 'Times New Roman', serif;
  --sans: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --shadow: 0 1px 2px rgba(120, 70, 70, .05), 0 6px 20px rgba(120, 70, 70, .05);
}
* { box-sizing: border-box; }
body { margin: 0; font: 15px/1.45 var(--sans); background: var(--bg); color: var(--ink); color-scheme: light; }
a { color: var(--brand); }

/* ---------- Estrutura ---------- */
#shell { display: block; min-height: 100vh; }
#side { display: none; }
body.authed #side { display: block; }
#content { min-width: 0; }
main { max-width: 1180px; margin: 0 auto; padding: 16px 16px 90px; }

header#top { display: flex; gap: 12px; align-items: center; padding: 12px 16px; background: var(--card); border-bottom: 1px solid var(--line); }
header#top #gsearch { flex: 1; max-width: 520px; background: var(--bg) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%2385777c' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M20 20l-3.5-3.5'/%3E%3C/svg%3E") no-repeat 12px center; padding-left: 38px; border-radius: 12px; }
#who { display: flex; align-items: center; gap: 10px; margin-left: auto; font-size: 13px; line-height: 1.2; text-align: left; }
.avatar { width: 38px; height: 38px; border-radius: 50%; background: var(--rose-soft); color: var(--brand); display: grid; place-items: center; font-weight: 600; flex: none; }
.avatar.sage { background: var(--sage-soft); color: var(--sage); }
#who small { display: block; color: var(--muted); }

/* Menu: lateral no desktop, barra inferior no celular */
nav#nav { position: fixed; bottom: 0; left: 0; right: 0; z-index: 5; display: flex; overflow-x: auto; background: var(--card); border-top: 1px solid var(--line); padding: 4px; }
nav#nav a { flex: 1 0 auto; min-width: 66px; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 8px; color: var(--muted); text-decoration: none; font-size: 11px; border-radius: 12px; }
nav#nav a svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
nav#nav a.on { color: var(--brand); background: var(--rose-soft); font-weight: 600; }
.brand { display: none; }

@media (min-width: 900px) {
  body.authed #shell { display: grid; grid-template-columns: 252px 1fr; }
  body.authed #side { display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; background: linear-gradient(180deg, var(--side), #f9efec); border-right: 1px solid var(--line); padding: 22px 14px; }
  .brand { display: flex; flex-direction: column; align-items: center; color: var(--brand); margin-bottom: 22px; }
  .brand-name { font: 600 30px var(--serif); color: #5b2c34; letter-spacing: .5px; }
  .brand small { font-size: 10px; letter-spacing: 1.8px; text-transform: uppercase; color: var(--muted); text-align: center; }
  nav#nav { position: static; flex-direction: column; overflow: visible; background: none; border: 0; padding: 0; gap: 2px; }
  nav#nav a { flex-direction: row; gap: 14px; padding: 12px 16px; font-size: 15px; color: #4b3b41; border-radius: 12px; min-width: 0; }
  nav#nav a:hover { background: rgba(189, 93, 103, .08); }
  nav#nav a.on { background: #e9c4c4; color: #7a2f3a; }
  .side-foot { margin-top: auto; padding: 14px; font: 14px/1.4 var(--serif); color: var(--muted); border-left: 2px solid var(--brand); }
  main { padding: 28px 32px 40px; }
  header#top { padding: 14px 32px; }
}
.side-foot { display: none; }
@media (min-width: 900px) { body.authed .side-foot { display: block; } }

/* ---------- Tipografia ---------- */
h1 { font: 700 28px/1.15 var(--serif); margin: 4px 0 14px; }
h2 { font: 600 19px var(--serif); margin: 22px 0 10px; }
.muted { color: var(--muted); font-size: 13px; }
.stat { font: 700 26px var(--serif); }
.accent { color: var(--brand); }

/* ---------- Componentes ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 14px; margin-bottom: 12px; box-shadow: var(--shadow); }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; } .grow { flex: 1; min-width: 0; }
.between { justify-content: space-between; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
input, select, textarea, button { font: inherit; color: inherit; }
input, select, textarea { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--rose-soft); border-color: var(--brand); }
label { display: block; font-size: 13px; color: var(--muted); margin: 10px 0 4px; }
button { padding: 10px 16px; border-radius: 12px; border: 1px solid var(--line); background: #fff; cursor: pointer; }
button:hover { border-color: #e3c9c9; }
button.primary { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); font-weight: 600; box-shadow: 0 4px 12px rgba(189, 93, 103, .25); }
button.danger { color: var(--bad); }
button.link { border: 0; background: none; color: var(--brand); padding: 4px 6px; box-shadow: none; }
button.sm { padding: 6px 12px; font-size: 13px; }

.badge { display: inline-block; font-size: 12px; font-weight: 500; padding: 3px 12px; border-radius: 99px; background: var(--rose-soft); color: #9a4048; white-space: nowrap; border: 0; }
.s-confirmado, .s-pago { background: var(--sage-soft); color: var(--sage); }
.s-aguardando, .s-pendente { background: var(--peach); color: var(--amber); }
.s-concluido { background: #ebeeea; color: #66756a; }
.s-cancelado, .s-faltou { background: #f3e4e5; color: var(--bad); }

.appt { display: flex; gap: 12px; align-items: center; cursor: pointer; } .appt .time { font-weight: 700; min-width: 54px; }
.cancelled { opacity: .55; text-decoration: line-through; }
table { width: 100%; border-collapse: collapse; font-size: 14px; } td, th { padding: 8px 4px; border-bottom: 1px solid var(--line); text-align: left; }
td.n, th.n { text-align: right; white-space: nowrap; }

#modal { position: fixed; inset: 0; background: rgba(60, 30, 36, .4); display: flex; align-items: flex-end; justify-content: center; z-index: 20; }
#modal[hidden], #toast[hidden], header#top[hidden], nav#nav[hidden] { display: none; }
#modal .sheet { background: #fff; width: 100%; max-width: 540px; max-height: 92vh; overflow: auto; border-radius: 20px 20px 0 0; padding: 20px; }
@media (min-width: 600px) { #modal { align-items: center; } #modal .sheet { border-radius: 20px; } }
#toast { position: fixed; bottom: 84px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 12px; z-index: 30; max-width: 90vw; }
#toast.err { background: var(--bad); }
.auth { max-width: 400px; margin: 7vh auto 0; padding: 22px; }
.auth h1 { text-align: center; }

/* ---------- Painel "Visão geral" ---------- */
.greet h1 { font-size: 34px; margin: 0; } .greet p { margin: 2px 0 0; color: var(--muted); font-size: 16px; }
.dash-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
@media (min-width: 1000px) { .kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 599px) {
  .kpi { flex-direction: column; align-items: flex-start; gap: 8px; padding: 14px; }
  .kpi .ico { width: 38px; height: 38px; } .kpi .val { font-size: 21px; }
  .greet h1 { font-size: 28px; } .dash-head { margin-bottom: 12px; }
  .who-name { display: none; } header#top { padding: 10px 12px; }
  .tl li { grid-template-columns: 42px 10px 1fr auto; gap: 8px; } .tl .avatar { display: none; }
  .panel-title h2 { font-size: 17px; }
}
.kpi { border-radius: 18px; padding: 16px; display: flex; gap: 12px; align-items: center; border: 1px solid var(--line); }
.kpi.rose { background: #fbe6e6; } .kpi.sage { background: #e9f1e8; }
.kpi .ico { width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; flex: none; background: rgba(255, 255, 255, .7); color: var(--brand); }
.kpi.sage .ico { color: var(--sage); }
.kpi .ico svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.kpi .lbl { font-size: 13px; color: #5d4d53; } .kpi .val { font: 700 26px/1.15 var(--serif); }
.kpi .delta { font-size: 12px; color: var(--muted); } .up { color: var(--ok); font-weight: 600; } .down { color: var(--bad); font-weight: 600; }
.dash { display: grid; gap: 16px; }
@media (min-width: 1000px) { .dash { grid-template-columns: 1.15fr 1fr; align-items: start; } }
.panel-title { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.panel-title h2 { margin: 0; display: flex; align-items: center; gap: 10px; } .panel-title svg { width: 22px; height: 22px; fill: none; stroke: var(--brand); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tl { list-style: none; margin: 0; padding: 0; }
.tl li { display: grid; grid-template-columns: 48px 12px 1fr auto; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.tl li:last-child { border-bottom: 0; }
.tl .t { font-size: 14px; color: #4b3b41; } .tl .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--brand); }
.tl .dot.ok { background: var(--sage); } .tl .dot.wait { background: #e2a46b; } .tl .dot.off { background: #d9c9c9; }
.tl .who { display: flex; align-items: center; gap: 10px; min-width: 0; } .tl .who strong { display: block; font-weight: 600; } .tl .who .muted { display: block; }
.next-row { display: grid; grid-template-columns: 52px 1fr auto; gap: 10px; align-items: center; padding: 9px 0; border-bottom: 1px solid var(--line); }
.next-row:last-child { border-bottom: 0; }
.bdays { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 10px; text-align: center; }
.bday { padding: 6px; } .bday .avatar { margin: 0 auto 6px; width: 48px; height: 48px; }
.bday strong { display: block; font-weight: 600; font-size: 14px; }
.chart { width: 100%; height: auto; display: block; }
.chart text { font: 11px var(--sans); fill: var(--muted); }
.chart .tip { fill: #fff; font-weight: 600; }
.empty { color: var(--muted); text-align: center; padding: 18px 0; }

/* ---------- Financeiro ---------- */
.chip { padding: 7px 16px; border-radius: 99px; font-size: 14px; background: #fff; }
.chip.on { background: var(--rose-soft); color: #9a4048; border-color: #ecc3c6; font-weight: 600; }
.strip { display: flex; gap: 22px; flex-wrap: wrap; font-size: 14px; padding: 12px 16px; }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); } .legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; }
.hbar { margin-bottom: 12px; } .hbar .track { height: 8px; border-radius: 99px; background: #f4eae7; margin-top: 5px; overflow: hidden; }
.hbar .fill { height: 100%; border-radius: 99px; background: #7ea287; } .hbar .fill.rose { background: #d98e95; }
.stmt-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.stmt-row:last-child { border-bottom: 0; }
.dot-ico { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; flex: none; }
.dot-ico.in { background: var(--sage-soft); color: var(--sage); } .dot-ico.out { background: var(--rose-soft); color: var(--bad); }
a.chip { text-decoration: none; color: inherit; display: inline-block; }

.kpi .val { white-space: nowrap; }

/* ---------- Tour de primeiro acesso ---------- */
#tour { position: fixed; inset: 0; z-index: 60; }
.tour-block { position: absolute; inset: 0; }
.tour-spot { position: fixed; border-radius: 14px; box-shadow: 0 0 0 9999px rgba(60, 30, 36, .55); outline: 2px solid #fff; pointer-events: none; transition: all .25s ease; display: none; }
.tour-card { position: fixed; background: #fff; border-radius: 18px; padding: 18px; box-shadow: 0 12px 40px rgba(60, 30, 36, .35); }
.tour-card h3 { font: 700 20px var(--serif); margin: 4px 0 6px; } .tour-card p { margin: 0 0 14px; color: #4b3b41; line-height: 1.5; }
.tour-step { font-size: 12px; color: var(--muted); letter-spacing: .5px; text-transform: uppercase; }
.tour-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.tour-skip { display: block; margin: 10px auto 0; font-size: 13px; color: var(--muted); }
body:has(#tour) { overflow: hidden; }
#tour.nospot .tour-block { background: rgba(60, 30, 36, .55); }
