/* Painel Fancy: uma página calma de cada vez. Menu lateral no computador, barra embaixo no celular. Tema claro. */
:root {
  color-scheme: light;
  --bg: #FFF8F9;
  --surface: #FFFFFF;
  --soft: #FDEBEE;
  --line: #F3D5DB;
  --ink: #2E0A10;
  --muted: #7D5560;
  --brand: #A30F20;
  --brand-ink: #FFFFFF;
  --pink: #F4A3B1;
  --ok: #1B6E43;  --ok-bg: #E4F4EA;
  --warn: #8F5400; --warn-bg: #FDF0D9;
  --info: #2B5293; --info-bg: #E6EEFB;
  --off: #857578; --off-bg: #F1ECED;
  --err: #A1261B; --err-bg: #FCE7E4;
  --bubble: #E3F6DC; --bubble-ink: #1E3818;
  --display: "Abril Fatface", "Bodoni 72", Didot, Georgia, serif;
  --body: "Instrument Sans", "Segoe UI", system-ui, -apple-system, sans-serif;
}
* { box-sizing: border-box; }
html, body { background: var(--bg); margin: 0; }
body { color: var(--ink); font-family: var(--body); font-size: 16px; line-height: 1.5; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--pink); outline-offset: 2px; }
img { max-width: 100%; }
[hidden] { display: none !important; }
.num { font-variant-numeric: tabular-nums; }

/* estrutura */
.shell { display: grid; grid-template-columns: 230px minmax(0, 1fr); min-height: 100vh; }
.side { background: var(--surface); border-right: 1px solid var(--line); padding: 22px 14px; display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; align-items: baseline; gap: 8px; padding: 0 10px 18px; }
.logo { font-family: var(--display); font-size: 32px; color: var(--brand); line-height: 1; }
.logo-sub { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .12em; }
.nav { border: 0; background: none; text-align: left; padding: 11px 12px; border-radius: 10px; font-weight: 600; color: var(--muted); display: flex; align-items: center; gap: 10px; }
.nav svg { width: 20px; height: 20px; flex: none; }
.nav[aria-current="page"] { background: var(--soft); color: var(--brand); }
.nav .badge { margin-left: auto; }
.side .sair { margin-top: auto; }
.badge { background: var(--brand); color: var(--brand-ink); border-radius: 999px; font-size: 12px; font-weight: 700; padding: 0 7px; min-width: 20px; text-align: center; }
main { padding: 32px 24px 64px; }
.col { max-width: 720px; margin: 0 auto; display: grid; gap: 28px; }
.mobile-top { display: none; }
.bottom { display: none; }
@media (max-width: 820px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side { display: none; }
  main { padding: 20px 16px 110px; }
  .mobile-top { display: flex; align-items: baseline; gap: 8px; padding: 14px 16px 0; }
  .bottom { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; background: var(--surface); border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom, 0px)); }
  .bottom .nav { flex-direction: column; gap: 2px; font-size: 11px; padding: 6px 2px; text-align: center; position: relative; }
  .bottom .nav .badge { position: absolute; top: 2px; left: 55%; margin: 0; font-size: 10px; }
}

/* texto */
h1 { font-family: var(--display); font-weight: 400; font-size: 34px; line-height: 1.1; margin: 0; text-wrap: balance; }
h2 { font-size: 18px; margin: 0; font-weight: 700; }
.lede { color: var(--muted); margin: 6px 0 0; max-width: 60ch; }
.label { font-size: 12px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); font-weight: 600; }
.note { font-size: 14px; color: var(--muted); }
.stack { display: grid; gap: 12px; }
.link { color: var(--brand); font-weight: 700; }

/* botões */
.btn { border: 2px solid var(--brand); background: var(--brand); color: var(--brand-ink); border-radius: 12px; padding: 12px 18px; font-weight: 700; font-size: 16px; display: inline-block; text-align: center; text-decoration: none; }
.btn.ghost { background: var(--surface); color: var(--brand); }
.btn.small { padding: 7px 12px; font-size: 14px; border-radius: 10px; }
.btn.block { width: 100%; }
.btn.danger { background: var(--surface); color: var(--err); border-color: var(--err); }
.btn:disabled { opacity: .5; cursor: wait; }
.back { border: 0; background: none; color: var(--brand); font-weight: 700; padding: 0; display: inline-flex; gap: 6px; align-items: center; }

/* cartões */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 20px; }
.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
@media (max-width: 560px) { .tiles { grid-template-columns: minmax(0, 1fr); } }
.tile { text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 18px 20px; display: grid; grid-template-columns: auto 1fr; gap: 4px 16px; align-items: center; }
.tile.plain { grid-template-columns: 1fr; }
.tile:hover { border-color: var(--pink); }
.tile .big { grid-row: span 2; width: 54px; height: 54px; border-radius: 14px; display: grid; place-items: center; font-family: var(--display); font-size: 28px; }
.tile .t { font-weight: 700; font-size: 17px; }
.tile .d { color: var(--muted); font-size: 14px; }
.tile.zero { opacity: .6; }
.c-warn { background: var(--warn-bg); color: var(--warn); }
.c-info { background: var(--info-bg); color: var(--info); }
.c-ok { background: var(--ok-bg); color: var(--ok); }
.c-brand { background: var(--soft); color: var(--brand); }
.c-off { background: var(--off-bg); color: var(--off); }
.help { background: var(--warn-bg); border: 1px solid #F2D6A4; border-radius: 16px; padding: 18px 20px; display: grid; gap: 12px; }
.help b { color: var(--warn); }
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; padding: 4px 10px; border-radius: 999px; white-space: nowrap; }
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.empty { text-align: center; padding: 36px 20px; color: var(--muted); }
.alerta { background: var(--err-bg); color: var(--err); border-radius: 12px; padding: 12px 16px; font-weight: 600; }

/* pedidos */
.groups { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 8px 14px; font-size: 14px; font-weight: 600; color: var(--muted); display: inline-flex; gap: 6px; align-items: center; }
.chip[aria-pressed="true"] { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.orow { text-align: left; width: 100%; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px; display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; align-items: center; }
.orow:hover { border-color: var(--pink); }
.orow .who { font-weight: 700; font-size: 17px; }
.orow .when { color: var(--muted); font-size: 14px; }
.orow .go { color: var(--brand); font-weight: 700; font-size: 14px; text-align: right; }
.next { background: var(--soft); border-radius: 16px; padding: 20px; display: grid; gap: 14px; }
.next .q { font-size: 18px; font-weight: 700; }
.timefield { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.timefield input { border: 1px solid var(--line); background: var(--surface); border-radius: 10px; padding: 9px 12px; font-size: 16px; }
.progress { display: flex; gap: 6px; }
.progress span { flex: 1; height: 6px; border-radius: 999px; background: var(--line); }
.progress span.on { background: var(--brand); }
.item { display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: start; padding: 16px 0; border-top: 1px solid var(--line); }
.item:first-of-type { border-top: 0; padding-top: 4px; }
.item .n { width: 32px; height: 32px; border-radius: 50%; background: var(--soft); color: var(--brand); font-weight: 700; display: grid; place-items: center; }
.item .name { font-weight: 700; }
.arts { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.arts a { display: block; }
.arts img { height: 72px; width: auto; border-radius: 8px; border: 1px solid var(--line); background: var(--soft); }
.arts .pdf { height: 72px; padding: 0 12px; border-radius: 8px; background: var(--soft); color: var(--brand); font-weight: 700; display: grid; place-items: center; text-decoration: none; }
.totals { display: grid; gap: 4px; padding-top: 14px; border-top: 1px solid var(--line); }
.totals div { display: flex; justify-content: space-between; }
.totals .grand { font-weight: 700; font-size: 18px; }
.info { display: grid; gap: 14px; margin: 0; }
.info div { display: grid; gap: 2px; }
.info dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.info dt { font-size: 13px; color: var(--muted); }
details.card summary { cursor: pointer; font-weight: 700; list-style: none; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
details.card summary::-webkit-details-marker { display: none; }
details.card summary::after { content: "Mostrar"; color: var(--brand); font-size: 14px; }
details.card[open] summary::after { content: "Esconder"; }
details.card[open] summary { margin-bottom: 14px; }
.wa { background: var(--soft); border-radius: 12px; padding: 12px; display: grid; gap: 8px; align-content: start; }
.bubble.me { justify-self: end; background: var(--surface); color: var(--ink); border-radius: 12px 12px 3px 12px; }
.bubble { background: var(--bubble); color: var(--bubble-ink); border-radius: 12px 12px 12px 3px; padding: 9px 12px; max-width: 92%; font-size: 15px; white-space: pre-line; overflow-wrap: anywhere; }
.bubble small { display: block; font-size: 12px; opacity: .7; margin-top: 3px; }

/* rota */
.stop { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 14px 0; border-top: 1px solid var(--line); }
.stop:first-child { border-top: 0; padding-top: 0; }
.stop:last-child { padding-bottom: 0; }
.stop .sn { width: 34px; height: 34px; border-radius: 50%; background: var(--brand); color: var(--brand-ink); font-weight: 700; display: grid; place-items: center; }
.stop.start .sn { background: var(--soft); color: var(--brand); }
.stop.out { opacity: .55; }
.stop.out .sn { background: var(--off-bg); color: var(--off); }
.check { display: inline-flex; gap: 8px; align-items: center; font-size: 14px; font-weight: 600; color: var(--muted); }
.check input { width: 20px; height: 20px; accent-color: var(--brand); }
@media (max-width: 480px) { .stop { grid-template-columns: auto minmax(0, 1fr); } .stop .check { grid-column: 2; } }

/* formulários */
.field { display: grid; gap: 6px; }
.field > span { font-weight: 600; font-size: 15px; }
.field input, .field select, .field textarea, .input { border: 1px solid var(--line); background: var(--surface); border-radius: 10px; padding: 10px 12px; font-size: 16px; width: 100%; min-width: 0; }
.field textarea { min-height: 72px; resize: vertical; }
.choices { display: flex; gap: 8px; flex-wrap: wrap; }
.choice { position: relative; }
.choice input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.choice span { display: inline-block; border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 8px 14px; font-weight: 600; font-size: 14px; color: var(--muted); }
.choice input:checked + span { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.choice input:focus-visible + span { outline: 3px solid var(--pink); outline-offset: 2px; }
.newitem { border: 1px solid var(--line); border-radius: 14px; padding: 16px; display: grid; gap: 12px; background: var(--bg); }
.row2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }
@media (max-width: 480px) { .row2 { grid-template-columns: minmax(0, 1fr); } }

/* estoque */
.prow { display: flex; align-items: center; gap: 12px; padding: 14px 0; border-top: 1px solid var(--line); flex-wrap: wrap; }
.prow:first-child { border-top: 0; padding-top: 0; }
.prow:last-child { padding-bottom: 0; }
.prow .pn { flex: 1 1 200px; min-width: 0; }
.prow .pn b { display: block; }
.prow.off .pn b { color: var(--off); text-decoration: line-through; }
.toggle { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; border: 0; background: none; padding: 4px 0; }
.toggle .track { width: 44px; height: 26px; border-radius: 999px; background: var(--off-bg); border: 1px solid var(--line); position: relative; flex: none; }
.toggle .track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: var(--off); transition: transform .15s; }
.toggle[aria-checked="true"] .track { background: var(--ok); border-color: var(--ok); }
.toggle[aria-checked="true"] .track::after { transform: translateX(18px); background: #fff; }
.toggle .lbl { min-width: 88px; text-align: left; color: var(--off); }
.toggle[aria-checked="true"] .lbl { color: var(--ok); }
.pending-tag { display: inline-block; font-size: 12px; font-weight: 700; color: var(--warn); background: var(--warn-bg); border-radius: 999px; padding: 1px 8px; margin-left: 6px; }
.prices { display: grid; gap: 10px; }
.prices label { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 14px; background: var(--bg); border-radius: 10px; }
.money { width: 110px; border: 1px solid var(--line); background: var(--surface); border-radius: 10px; padding: 8px 10px; text-align: right; font-variant-numeric: tabular-nums; font-size: 16px; }
.money.pending { border: 2px dashed var(--warn); background: var(--warn-bg); }
.money.pending::placeholder { color: var(--warn); }
.plush { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 560px) { .plush { grid-template-columns: minmax(0, 1fr); } }
.pcard { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 16px; display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.pcard.off { background: var(--off-bg); }
.pcard b { display: block; }
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--surface); flex: none; }
.stepper button { border: 0; background: var(--soft); width: 38px; height: 38px; font-weight: 700; font-size: 18px; color: var(--brand); }
.stepper span { min-width: 38px; text-align: center; font-weight: 700; }

/* ajustes */
.srow { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 0; border-top: 1px solid var(--line); }
.srow:first-of-type { border-top: 0; }
.dates { display: flex; gap: 8px; flex-wrap: wrap; }
.date { background: var(--soft); border-radius: 10px; padding: 6px 6px 6px 12px; font-weight: 600; display: inline-flex; gap: 4px; align-items: center; }
.date button { border: 0; background: none; color: var(--muted); font-weight: 700; padding: 0 6px; font-size: 18px; }
.addrow { display: flex; gap: 8px; flex-wrap: wrap; }
.addrow input { flex: 1 1 180px; min-width: 0; border: 1px solid var(--line); background: var(--surface); border-radius: 10px; padding: 9px 12px; }

/* login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.login form { width: min(380px, 100%); display: grid; gap: 18px; }
.login .logo { font-size: 48px; text-align: center; }

.toast { position: fixed; left: 50%; bottom: calc(90px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 12px; font-weight: 600; max-width: calc(100% - 32px); z-index: 20; box-shadow: 0 8px 24px rgba(46,10,16,.25); }
.toast.erro { background: var(--err); }
@media (min-width: 821px) { .toast { bottom: 24px; } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
