:root {
  --bg: #f6f3ec; --card: #ffffff; --ink: #1d1b18; --soft: #6f6a60; --line: #e4dfd3;
  --gold: #a87a1f; --gold-bg: #f3e7cc; --ok: #2f7d4f; --bad: #b3402f; --bad-bg: #f8e1dc;
  --slot: 34px; --radius: 12px;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #161412; --card: #211e1b; --ink: #f1ece2; --soft: #a59e91; --line: #36312b;
    --gold: #d2a544; --gold-bg: #3a2f17; --ok: #6cc391; --bad: #ee8a78; --bad-bg: #44211b; }
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--ink); font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; -webkit-text-size-adjust: 100%; }
h1, h2, h3 { margin: 0; line-height: 1.2; }
h1 { font-size: 22px; } h2 { font-size: 17px; } h3 { font-size: 15px; }
button, input, select, textarea { font: inherit; color: inherit; }
.num { font-variant-numeric: tabular-nums; }
.soft { color: var(--soft); } .small { font-size: 13px; } .right { text-align: right; } .grow { flex: 1; min-width: 0; }
.row { display: flex; align-items: center; gap: 10px; } .wrap { flex-wrap: wrap; } .between { justify-content: space-between; }
.stack > * + * { margin-top: 12px; }

/* estrutura */
.shell { min-height: 100%; padding-bottom: calc(74px + env(safe-area-inset-bottom)); }
.top { position: sticky; top: 0; z-index: 5; background: var(--bg); padding: 14px 16px 10px; border-bottom: 1px solid var(--line); }
.main { padding: 14px 16px; max-width: 1100px; margin: 0 auto; }
.nav { position: fixed; bottom: 0; left: 0; right: 0; z-index: 6; display: flex; background: var(--card); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.nav button { flex: 1; border: 0; background: none; padding: 9px 2px 8px; font-size: 11.5px; color: var(--soft); display: flex; flex-direction: column; align-items: center; gap: 3px; cursor: pointer; }
.nav button svg { width: 23px; height: 23px; }
.nav button.on { color: var(--gold); font-weight: 600; }
@media (min-width: 900px) {
  .shell { padding: 0 0 0 190px; }
  .nav { top: 0; right: auto; width: 190px; flex-direction: column; justify-content: flex-start; border-top: 0; border-right: 1px solid var(--line); padding: 18px 10px; gap: 4px; }
  .nav button { flex: none; flex-direction: row; gap: 12px; font-size: 15px; padding: 11px 12px; border-radius: 10px; }
  .nav button.on { background: var(--gold-bg); }
}

/* peças */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.card + .card { margin-top: 10px; }
.btn { border: 1px solid var(--line); background: var(--card); border-radius: 10px; padding: 10px 14px; min-height: 44px; cursor: pointer; font-weight: 600; white-space: nowrap; }
.btn.primary { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.btn.gold { background: var(--gold); color: var(--card); border-color: var(--gold); }
.btn.danger { color: var(--bad); }
.btn.sm { min-height: 36px; padding: 6px 10px; font-size: 14px; }
.btn.icon { width: 44px; padding: 0; font-size: 20px; }
.btn:disabled { opacity: .5; }
label { display: block; font-size: 13px; color: var(--soft); margin-bottom: 4px; }
input, select, textarea { width: 100%; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; min-height: 44px; }
input[type=checkbox] { width: 20px; min-height: 20px; height: 20px; accent-color: var(--gold); padding: 0; }
input[type=color] { padding: 3px; width: 56px; }
input:focus, select:focus, textarea:focus, .btn:focus-visible { outline: 2px solid var(--gold); outline-offset: 1px; }
.field { margin-bottom: 12px; } .cols { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; } .cols3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
.tag { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 99px; background: var(--gold-bg); color: var(--gold); }
.tag.bad { background: var(--bad-bg); color: var(--bad); } .tag.ok { background: transparent; color: var(--ok); border: 1px solid var(--ok); }
.big { font-size: 30px; font-weight: 700; letter-spacing: -.5px; }
.list > div { display: flex; align-items: center; gap: 10px; padding: 11px 0; border-top: 1px solid var(--line); }
.list > div:first-child { border-top: 0; }
.tabs { display: flex; gap: 6px; margin-bottom: 12px; overflow-x: auto; }
.tabs button { border: 1px solid var(--line); background: var(--card); border-radius: 99px; padding: 8px 14px; min-height: 40px; cursor: pointer; white-space: nowrap; }
.tabs button.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.empty { text-align: center; color: var(--soft); padding: 28px 10px; }
.dot { width: 12px; height: 12px; border-radius: 50%; flex: none; }

/* agenda */
.agenda { display: flex; overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); }
.hours { flex: none; width: 50px; position: sticky; left: 0; z-index: 2; background: var(--card); border-right: 1px solid var(--line); }
.hours div { height: var(--slot); font-size: 11.5px; color: var(--soft); text-align: right; padding: 2px 6px 0 0; }
.hours div:nth-child(odd) { visibility: hidden; }
.pro { flex: 1 0 132px; min-width: 132px; border-right: 1px solid var(--line); }
.pro:last-child { border-right: 0; }
.pro-head, .hours-head { height: 42px; position: sticky; top: 0; }
.pro-head { display: flex; align-items: center; justify-content: center; gap: 7px; font-weight: 600; font-size: 14px; border-bottom: 3px solid var(--c); padding: 0 6px; }
.hours-head { border-bottom: 3px solid var(--line); }
.slots { position: relative; cursor: pointer; background-image: linear-gradient(var(--line) 1px, transparent 1px); background-size: 100% calc(var(--slot) * 2); }
.appt { position: absolute; left: 3px; right: 3px; border-radius: 7px; padding: 3px 6px; font-size: 12.5px; line-height: 1.25; overflow: hidden; cursor: pointer;
  background: color-mix(in srgb, var(--c) 22%, var(--card)); border-left: 4px solid var(--c); }
.appt b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.appt.done { opacity: .55; }
.now { position: absolute; left: 0; right: 0; height: 2px; background: var(--bad); z-index: 1; pointer-events: none; }

/* janelas */
.sheet-bg { position: fixed; inset: 0; z-index: 20; background: rgba(0,0,0,.45); display: flex; align-items: flex-end; justify-content: center; }
.sheet { background: var(--bg); width: 100%; max-width: 560px; max-height: 92vh; overflow-y: auto; border-radius: 18px 18px 0 0; padding: 16px 16px calc(18px + env(safe-area-inset-bottom)); }
@media (min-width: 700px) { .sheet-bg { align-items: center; } .sheet { border-radius: 18px; } }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
#toast { position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%); z-index: 40; background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 99px; font-size: 14px; opacity: 0; pointer-events: none; transition: opacity .2s; max-width: 90vw; text-align: center; }
#toast.show { opacity: 1; }
.login { max-width: 400px; margin: 0 auto; padding: 48px 20px; }
.login img { width: 64px; height: 64px; border-radius: 16px; display: block; margin-bottom: 18px; }
table { width: 100%; border-collapse: collapse; } td, th { padding: 7px 4px; border-top: 1px solid var(--line); text-align: left; font-size: 14px; } th { color: var(--soft); font-weight: 500; border-top: 0; }
td.num, th.num { text-align: right; }
.daylabel { text-transform: capitalize; flex: 1 0 100%; }
@media (min-width: 700px) { .daylabel { flex: 1; } }

/* relatórios */
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 10px; }
.stats .card { margin: 0; } .statv { font-size: 22px; font-weight: 700; letter-spacing: -.3px; }
@media (min-width: 900px) { .stats { grid-template-columns: repeat(4, 1fr); } }
.bar { padding: 9px 0; border-top: 1px solid var(--line); } .bar:first-of-type { border-top: 0; }
.track { height: 8px; border-radius: 99px; background: var(--line); margin: 5px 0 3px; overflow: hidden; }
.track i { display: block; height: 100%; border-radius: 99px; background: var(--gold); }
@media print { .nav, .tabs, #print, .top { display: none !important; } .shell { padding: 0; } body { background: #fff; color: #000; } .card { break-inside: avoid; } }
@media (max-width: 420px) { .nav button { font-size: 10.5px; } }
.suggest { margin-top: 4px; max-height: 240px; overflow-y: auto; border-radius: 10px; }
.suggest:not(:empty) { border: 1px solid var(--line); background: var(--card); }
.suggest button { display: flex; justify-content: space-between; align-items: center; gap: 10px; width: 100%; text-align: left; border: 0; border-top: 1px solid var(--line); background: none; padding: 11px 12px; min-height: 44px; cursor: pointer; }
.suggest button:first-child { border-top: 0; } .suggest button:hover { background: var(--gold-bg); }
.btn.wa { border-color: var(--ok); color: var(--ok); }
textarea { min-height: 96px; resize: vertical; line-height: 1.4; }
a.btn { display: flex; align-items: center; justify-content: center; gap: 6px; text-decoration: none; text-align: center; white-space: normal; }
@media (max-width: 899px) { .nav { overflow-x: auto; } .nav button { flex: 1 0 60px; } }

/* comando de voz */
.fab { position: fixed; right: 16px; bottom: calc(86px + env(safe-area-inset-bottom)); z-index: 7; width: 58px; height: 58px; border-radius: 50%; border: 0; cursor: pointer;
  background: var(--gold); color: var(--card); box-shadow: 0 4px 14px rgba(0,0,0,.28); display: flex; align-items: center; justify-content: center; }
.fab svg { width: 28px; height: 28px; }
.fab:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }
@media (min-width: 900px) { .fab { bottom: 24px; right: 24px; } }
@media print { .fab { display: none; } }
.rec { display: flex; align-items: center; gap: 12px; font-size: 18px; }
.pulse { width: 16px; height: 16px; border-radius: 50%; background: var(--bad); animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .35; transform: scale(.75); } }
@media (prefers-reduced-motion: reduce) { .pulse { animation: none; } }
.pick { display: flex; align-items: center; gap: 10px; padding: 10px 12px; margin: 0 0 6px; min-height: 44px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); color: var(--ink); font-size: 16px; cursor: pointer; }
input[type=radio] { width: 20px; min-height: 20px; height: 20px; flex: none; accent-color: var(--gold); padding: 0; margin: 0; }
