/* Central Béé — identidade visual oficial (Béé_GuiaDeMarca)
   laranja de ação #FF4712 · escuro #31261D · creme #F1EFD8 · azul #96D9E8
   Mesmos tokens do protótipo aprovado (prototipo/index.html). */
/* Layout: app de operação — barra lateral (desktop) / barra inferior (celular, tablet da loja),
   conteúdo em painéis; a cor de ação laranja só aparece no que é clicável ou pede atenção. */
:root {
  --laranja: #FF4712;
  --laranja-ink: #FFFFFF;
  --laranja-suave: #FFE3D8;
  --bg: #F1EFD8;
  --surface: #FFFDF6;
  --surface-2: #F7F4E2;
  --ink: #31261D;
  --ink-2: #6F6253;
  --line: #E1DAC1;
  --azul: #96D9E8;
  --azul-suave: #DDF2F7;
  --azul-ink: #11505F;
  --ok: #2F7A4E;
  --ok-suave: #DDF0E3;
  --warn: #A9650E;
  --warn-suave: #FBEBCF;
  --crit: #C03A2B;
  --crit-suave: #F9DEDA;
  --sombra: 0 1px 2px rgba(49, 38, 29, .06), 0 6px 20px rgba(49, 38, 29, .07);
  --f-display: "Bricolage Grotesque", "Avenir Next", "Segoe UI", system-ui, sans-serif;
  --f-body: "Figtree", "Avenir Next", "Segoe UI", system-ui, sans-serif;
  --r: 14px;
  --r-sm: 9px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --laranja: #FF6A3D; --laranja-ink: #1E1813; --laranja-suave: #4A2619;
    --bg: #1C1712; --surface: #272019; --surface-2: #30281F; --ink: #F1EFD8; --ink-2: #BDB29D; --line: #42372B;
    --azul: #7CC7D8; --azul-suave: #173840; --azul-ink: #A9E3F0;
    --ok: #6CC793; --ok-suave: #1D3527; --warn: #E8B05A; --warn-suave: #3D2E15; --crit: #F08070; --crit-suave: #43211C;
    --sombra: 0 1px 2px rgba(0,0,0,.3), 0 6px 20px rgba(0,0,0,.25);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --laranja: #FF6A3D; --laranja-ink: #1E1813; --laranja-suave: #4A2619;
  --bg: #1C1712; --surface: #272019; --surface-2: #30281F; --ink: #F1EFD8; --ink-2: #BDB29D; --line: #42372B;
  --azul: #7CC7D8; --azul-suave: #173840; --azul-ink: #A9E3F0;
  --ok: #6CC793; --ok-suave: #1D3527; --warn: #E8B05A; --warn-suave: #3D2E15; --crit: #F08070; --crit-suave: #43211C;
  --sombra: 0 1px 2px rgba(0,0,0,.3), 0 6px 20px rgba(0,0,0,.25);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.5 var(--f-body);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { font-family: var(--f-display); font-weight: 800; letter-spacing: -.01em; text-wrap: balance; margin: 0; }
h1 { font-size: 1.75rem; line-height: 1.15; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1rem; font-weight: 600; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--azul); outline-offset: 2px; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--ink-2); }
.small { font-size: .85rem; }
.label { font-size: .72rem; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--ink-2); }

/* ---------- casca do app */
.app { display: grid; grid-template-columns: 236px minmax(0, 1fr); min-height: 100%; }
.side {
  background: var(--surface); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 4px; padding: 18px 12px; position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px 14px; }
.brand img { width: 44px; height: 44px; }
.brand b { font-family: var(--f-display); font-size: 1.05rem; line-height: 1.1; }
.brand span { display: block; font-size: .78rem; color: var(--ink-2); }
.nav-item { text-decoration: none;
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  border: 0; background: transparent; padding: 9px 10px; border-radius: var(--r-sm); cursor: pointer; color: var(--ink-2); font-weight: 600;
}
.nav-item svg { width: 19px; height: 19px; flex: none; }
.nav-item:hover { background: var(--surface-2); color: var(--ink); }
.nav-item[aria-current="page"] { background: var(--laranja-suave); color: var(--ink); }
.nav-item[aria-current="page"] svg { color: var(--laranja); }
.nav-item .badge { margin-left: auto; background: var(--laranja); color: var(--laranja-ink); border-radius: 999px; font-size: .72rem; padding: 0 7px; min-width: 20px; text-align: center; }
.side .quem { margin-top: auto; border-top: 1px solid var(--line); padding: 12px 8px 0; font-size: .85rem; }
.side .quem b { display: block; }

main { padding-block: 26px 90px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); min-width: 0; }
.wrap { max-width: 1120px; margin: 0 auto; display: grid; gap: 20px; }
.head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 12px; }
.head p { margin: 4px 0 0; color: var(--ink-2); }

.bottom-nav { display: none; }

@media (max-width: 820px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .side { display: none; }
  .bottom-nav {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
    background: var(--surface); border-top: 1px solid var(--line); overflow-x: auto;
    padding-bottom: env(safe-area-inset-bottom, 0px); padding-left: env(safe-area-inset-left, 0px); padding-right: env(safe-area-inset-right, 0px);
  }
  .bottom-nav .nav-item { flex-direction: column; gap: 2px; font-size: .7rem; padding: 8px 10px; min-width: 72px; align-items: center; border-radius: 0; }
  .bottom-nav .nav-item .badge { position: absolute; margin: 0 0 0 22px; }
  .bottom-nav .nav-item { position: relative; }
  .mobile-top { display: flex !important; }
  h1 { font-size: 1.45rem; }
}
.mobile-top { display: none; align-items: center; gap: 10px; }
.mobile-top img { width: 36px; height: 36px; }

/* ---------- componentes */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; min-width: 0; }
.panel > header { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); }
.g3 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); }
.split { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start; }
@media (max-width: 980px) { .split { grid-template-columns: minmax(0, 1fr); } }
.sticky { position: sticky; top: 16px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  padding: 9px 15px; border-radius: 999px; cursor: pointer; font-weight: 600; white-space: nowrap;
}
.btn:hover { background: var(--surface-2); }
.btn.prim { background: var(--laranja); border-color: var(--laranja); color: var(--laranja-ink); }
.btn.prim:hover { filter: brightness(1.05); }
.btn.big { padding: 13px 22px; font-size: 1rem; }
.btn.sm { padding: 5px 11px; font-size: .85rem; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn svg { width: 17px; height: 17px; }

.field { display: grid; gap: 5px; }
.field label { font-size: .82rem; font-weight: 600; }
.input, select.input, textarea.input {
  width: 100%; border: 1px solid var(--line); background: var(--surface); border-radius: var(--r-sm);
  padding: 10px 12px; min-height: 42px;
}
textarea.input { min-height: 70px; resize: vertical; }
.input:focus { border-color: var(--laranja); outline: none; box-shadow: 0 0 0 3px var(--laranja-suave); }

.pill { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 999px; font-size: .78rem; font-weight: 700; white-space: nowrap; }
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.st-pendente { background: var(--warn-suave); color: var(--warn); }
.st-em_preparo { background: var(--laranja-suave); color: var(--laranja); }
.st-aguardando_retirada { background: var(--azul-suave); color: var(--azul-ink); }
.st-entregue { background: var(--ok-suave); color: var(--ok); }
.st-cancelado { background: var(--surface-2); color: var(--ink-2); }
.tag { display: inline-block; padding: 1px 8px; border-radius: 6px; background: var(--surface-2); font-size: .78rem; font-weight: 600; color: var(--ink-2); }

.stat { display: grid; gap: 2px; }
.stat b { font-family: var(--f-display); font-size: 1.9rem; line-height: 1; font-variant-numeric: tabular-nums; }

table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: .72rem; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-2); font-weight: 700; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
td.r, th.r { text-align: right; }
.tbl { overflow-x: auto; }
tr.cat td { background: var(--surface-2); font-weight: 700; font-size: .85rem; }
tr.click { cursor: pointer; }
tr.click:hover td { background: var(--surface-2); }

.stepper { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; background: var(--surface); }
.stepper button { border: 0; background: transparent; width: 36px; height: 36px; cursor: pointer; font-size: 1.15rem; font-weight: 700; color: var(--ink-2); }
.stepper button:hover { background: var(--surface-2); color: var(--laranja); }
.stepper input { width: 56px; border: 0; text-align: center; background: transparent; font-weight: 700; font-variant-numeric: tabular-nums; height: 36px; }
.stepper.on { border-color: var(--laranja); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 5px 12px; cursor: pointer; font-weight: 600; font-size: .85rem; }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }

.seg2 { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; padding: 3px; background: var(--surface-2); gap: 2px; flex-wrap: wrap; }
.seg2 button { border: 0; background: transparent; border-radius: 999px; padding: 5px 12px; cursor: pointer; font-weight: 600; font-size: .85rem; color: var(--ink-2); }
.seg2 button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--sombra); }

.switch { position: relative; width: 42px; height: 24px; border-radius: 999px; border: 0; background: var(--line); cursor: pointer; flex: none; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: var(--surface); transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch[aria-checked="true"] { background: var(--ok); }
.switch[aria-checked="true"]::after { transform: translateX(18px); }
.switch:disabled { opacity: .5; cursor: not-allowed; }

/* kanban */
.kanban { display: grid; grid-template-columns: repeat(4, minmax(230px, 1fr)); gap: 12px; overflow-x: auto; padding-bottom: 6px; }
.col { background: var(--surface-2); border-radius: var(--r); padding: 10px; display: grid; gap: 10px; align-content: start; min-height: 220px; }
.col > header { display: flex; justify-content: space-between; align-items: center; padding: 2px 4px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 12px; display: grid; gap: 8px; cursor: pointer; text-align: left; width: 100%; }
.card:hover { border-color: var(--laranja); }
.card .top { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.card .n { font-family: var(--f-display); font-weight: 800; }
.card .unread { width: 8px; height: 8px; border-radius: 50%; background: var(--laranja); display: inline-block; }

/* linha do tempo de status */
.steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
.steps i { height: 5px; border-radius: 99px; background: var(--line); }
.steps i.on { background: var(--laranja); }
.steps.done i { background: var(--ok); }
.timeline { display: grid; gap: 0; }
.tl { display: grid; grid-template-columns: 18px 1fr; gap: 10px; position: relative; padding-bottom: 14px; }
.tl::before { content: ""; position: absolute; left: 8px; top: 16px; bottom: 0; width: 2px; background: var(--line); }
.tl:last-child::before { display: none; }
.tl .dot { width: 18px; height: 18px; border-radius: 50%; border: 3px solid var(--laranja); background: var(--surface); margin-top: 2px; }
.tl.ok .dot { border-color: var(--ok); background: var(--ok); }

/* gaveta lateral + modal */
.scrim { position: fixed; inset: 0; background: rgba(28, 22, 16, .45); z-index: 40; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(520px, 100%); z-index: 41; background: var(--surface);
  display: flex; flex-direction: column; box-shadow: -10px 0 40px rgba(0,0,0,.18);
  padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px); padding-right: env(safe-area-inset-right, 0px);
}
.drawer > header { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.drawer .body { padding: 18px 20px; overflow-y: auto; display: grid; gap: 18px; align-content: start; flex: 1; }
.drawer > footer { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
.modal {
  position: fixed; z-index: 41; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(560px, calc(100% - 32px)); max-height: calc(100% - 40px); overflow: auto;
  background: var(--surface); border-radius: var(--r); box-shadow: var(--sombra); padding: 22px; display: grid; gap: 16px;
}

.chat { display: grid; gap: 8px; }
.msg { max-width: 85%; padding: 8px 12px; border-radius: 14px; background: var(--surface-2); }
.msg.eu { justify-self: end; background: var(--laranja-suave); }
.msg small { display: block; color: var(--ink-2); font-size: .72rem; margin-top: 2px; }
.chat-form { display: flex; gap: 8px; }

.calc { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; }
.calc div { background: var(--surface-2); border-radius: var(--r-sm); padding: 10px 12px; }
.calc b { display: block; font-family: var(--f-display); font-size: 1.35rem; font-variant-numeric: tabular-nums; }
.calc .alerta { background: var(--warn-suave); }
.calc .alerta b { color: var(--warn); }

.casq-bloco { border: 1px solid var(--line); border-radius: var(--r); padding: 14px; display: grid; gap: 10px; }
.casq-bloco header { display: flex; justify-content: space-between; align-items: baseline; }
.duo { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 420px) { .duo { grid-template-columns: 1fr; } }

.perm-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.perm-row:last-child { border-bottom: 0; }
.perm-row .ef { font-size: .75rem; font-weight: 700; }
.ef.sim { color: var(--ok); }
.ef.nao { color: var(--ink-2); }

.toast {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(24px + env(safe-area-inset-bottom, 0px)); z-index: 60;
  background: var(--ink); color: var(--bg); padding: 11px 18px; border-radius: 999px; box-shadow: var(--sombra); font-weight: 600;
  display: flex; gap: 10px; align-items: center; max-width: calc(100% - 32px);
}
@media (max-width: 820px) { .toast { bottom: calc(84px + env(safe-area-inset-bottom, 0px)); } }

/* login */
.login { min-height: 100%; display: grid; place-items: center; padding-block: 32px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.login .box { width: min(400px, 100%); background: var(--surface); border-radius: 22px; padding: 30px 28px; box-shadow: var(--sombra); display: grid; gap: 16px; }
.login .box img { width: 84px; height: 84px; justify-self: center; }
.login h1 { text-align: center; }

.empty { padding: 26px; text-align: center; color: var(--ink-2); border: 1.5px dashed var(--line); border-radius: var(--r); }
.list { display: grid; gap: 10px; }
.row-card { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 12px; align-items: center; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); cursor: pointer; width: 100%; text-align: left; }
.row-card:hover { border-color: var(--laranja); }
.pdf { display: inline-flex; align-items: center; gap: 5px; font-size: .8rem; font-weight: 700; color: var(--crit); background: var(--crit-suave); padding: 2px 8px; border-radius: 6px; }
.lock { display: inline-flex; gap: 4px; align-items: center; font-size: .75rem; color: var(--ink-2); font-weight: 600; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* ---------- estados (carregando, erro, vazio) e extras do app real */
.carregando { display: grid; place-items: center; padding: 60px 16px; color: var(--ink-2); gap: 12px; }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--laranja); animation: girar .8s linear infinite; }
@keyframes girar { to { transform: rotate(360deg); } }
.erro-box { border: 1px solid var(--crit); background: var(--crit-suave); color: var(--crit); border-radius: var(--r-sm); padding: 10px 14px; font-weight: 600; }
.aviso-box { background: var(--warn-suave); color: var(--warn); border-radius: var(--r-sm); padding: 10px 14px; font-weight: 600; font-size: .9rem; }
.loja-sel { margin: 0 4px 10px; }
.loja-sel select { width: 100%; }
.toast.erro { background: var(--crit); color: #fff; }
.toast button { background: transparent; border: 1px solid currentColor; color: inherit; border-radius: 999px; padding: 2px 10px; cursor: pointer; font-weight: 700; }
.mais { display: flex; justify-content: center; padding-top: 12px; }
.check { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--laranja); }
.mobile-top select { max-width: 46%; margin-left: auto; min-height: 36px; padding: 6px 10px; }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2s; } }
