:root {
  --bg: #E9EDF0; --surface: #FFFFFF; --surface2: #F4F6F8; --ink: #17222B; --muted: #5A6772; --line: #CBD3D9;
  --steel: #2B5876; --steel-soft: #DCE7EE;
  --ok: #23764A; --ok-soft: #DDEFE4; --falta: #B33A2B; --falta-soft: #F6E0DC;
  --sobra: #9A600E; --sobra-soft: #F5E9D2; --pend: #7A8590; --pend-soft: #E6EAED;
  --sans: "Barlow", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --cond: "Barlow Condensed", "Arial Narrow", system-ui, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #11171C; --surface: #1A2229; --surface2: #151C22; --ink: #E6ECF0; --muted: #97A5B0; --line: #2C3740;
    --steel: #86B6D6; --steel-soft: #1F3341; --ok: #63C48F; --ok-soft: #173326; --falta: #F0806F; --falta-soft: #3A1F1B;
    --sobra: #E5AE52; --sobra-soft: #36291A; --pend: #8C99A3; --pend-soft: #232C33; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #11171C; --surface: #1A2229; --surface2: #151C22; --ink: #E6ECF0; --muted: #97A5B0; --line: #2C3740;
  --steel: #86B6D6; --steel-soft: #1F3341; --ok: #63C48F; --ok-soft: #173326; --falta: #F0806F; --falta-soft: #3A1F1B;
  --sobra: #E5AE52; --sobra-soft: #36291A; --pend: #8C99A3; --pend-soft: #232C33; color-scheme: dark;
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.45 var(--sans); }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--steel); outline-offset: 2px; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.cond { font-family: var(--cond); }
h1, h2, h3 { font-family: var(--cond); margin: 0; line-height: 1.05; letter-spacing: -.01em; }

.wrap { max-width: 1200px; margin: 0 auto; padding: 16px 16px 64px; }
.top { display: flex; flex-wrap: wrap; gap: 10px 20px; align-items: center; padding: 10px 16px; background: var(--surface);
  border-bottom: 2px solid var(--ink); position: sticky; top: 0; z-index: 10; }
.top .brand { font-family: var(--cond); font-weight: 700; font-size: 22px; }
.top .who { font-size: 13px; color: var(--muted); }
.spacer { flex: 1; }
@media (max-width: 600px) {
  /* celular: cabeçalho compacto, só as abas ficam presas no topo */
  .top { padding: 6px 10px; gap: 6px; }
  .top .brand, .top .who, .top .spacer { display: none; }
  .top .tabs { order: -1; width: 100%; display: grid; grid-template-columns: 1fr 1fr; }
  .top .tabs button { padding: 10px 6px; font-size: 14px; }
  .top > .btn { padding: 5px 9px; font-size: 13px; }
  .head-row h1 { font-size: 24px; }
  .head-row .tools { width: 100%; }
  .head-row .tools .btn { flex: 1; }
  .wrap { padding: 10px 10px 48px; }
  .board .big, .stat .n { font-size: 28px; }
}
.tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.tabs button { border: 1px solid transparent; background: none; padding: 8px 14px; border-radius: 6px; cursor: pointer; font-weight: 600; color: var(--muted); position: relative; }
.tabs button.on { background: var(--steel); color: var(--surface); }
.tabs .count { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 99px; background: var(--falta); color: #fff; font-size: 12px; margin-left: 6px; }

.btn { border: 1px solid var(--line); background: var(--surface); border-radius: 6px; padding: 9px 14px; cursor: pointer; font-weight: 600; white-space: nowrap; }
.btn:hover { border-color: var(--steel); }
.btn.primary { background: var(--steel); border-color: var(--steel); color: var(--surface); }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.warn { background: var(--sobra); border-color: var(--sobra); color: #fff; }
.btn.ghost { background: transparent; }
.btn.big { padding: 16px 20px; font-size: 18px; font-family: var(--cond); letter-spacing: .02em; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.notice { background: var(--steel-soft); border-left: 3px solid var(--steel); padding: 10px 14px; border-radius: 0 6px 6px 0; margin: 12px 0; font-size: 14px; }
.notice.erro { background: var(--falta-soft); border-color: var(--falta); }
.notice.ok { background: var(--ok-soft); border-color: var(--ok); }

.head-row { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: end; justify-content: space-between; margin: 8px 0 14px; }
.head-row h1 { font-size: clamp(26px, 4vw, 38px); }
.head-row .sub { color: var(--muted); margin-top: 4px; }

/* placar */
.board { display: grid; grid-template-columns: 1.4fr repeat(4, 1fr); background: var(--surface); border: 1px solid var(--line); border-radius: 6px; overflow: hidden; margin-bottom: 12px; }
.board > * { padding: 12px 16px; border-left: 1px solid var(--line); }
.board > *:first-child { border-left: 0; }
.board .lbl { font-size: 13px; color: var(--muted); }
.board .big { font-family: var(--cond); font-size: 34px; font-weight: 700; line-height: 1.05; }
.board .big small { font-size: 18px; color: var(--muted); font-weight: 500; }
.stat { all: unset; cursor: pointer; padding: 12px 16px; border-left: 1px solid var(--line); display: flex; flex-direction: column; position: relative; }
.stat .n { font-family: var(--cond); font-size: 34px; font-weight: 700; line-height: 1.05; }
.stat .t { font-size: 13px; color: var(--muted); }
.stat[aria-pressed="true"] { background: var(--surface2); }
.stat[aria-pressed="true"]::after { content: ""; position: absolute; inset: auto 0 0 0; height: 3px; background: currentColor; }
.c-ok { color: var(--ok); } .c-falta { color: var(--falta); } .c-sobra { color: var(--sobra); } .c-pend { color: var(--pend); }
.bar { height: 8px; background: var(--pend-soft); border-radius: 4px; margin-top: 8px; display: flex; overflow: hidden; }
.bar span { display: block; height: 100%; }
@media (max-width: 760px) {
  .board { grid-template-columns: repeat(2, 1fr); }
  .board > *:first-child { grid-column: 1 / -1; border-bottom: 1px solid var(--line); }
  .board > *:nth-child(2n) { border-left: 0; }
}

.tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.search { flex: 1 1 260px; display: flex; align-items: center; background: var(--surface); border: 1.5px solid var(--line); border-radius: 6px; padding: 0 10px; }
.search input { border: 0; background: transparent; padding: 10px 6px; width: 100%; outline: none; font-size: 16px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.seg button { border: 0; background: var(--surface); padding: 9px 12px; cursor: pointer; font-weight: 600; color: var(--muted); }
.seg button.on { background: var(--steel-soft); color: var(--ink); }

/* itens da contagem */
.list { display: grid; gap: 8px; }
.item { display: grid; grid-template-columns: minmax(0, 1fr) 120px 220px; gap: 14px; align-items: center; background: var(--surface);
  border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; box-shadow: inset 5px 0 0 var(--pend); }
.item.contado { box-shadow: inset 5px 0 0 var(--ok); }
.item.foco { outline: 3px solid var(--steel); }
.item .nm { font-weight: 600; font-size: 16px; line-height: 1.25; }
.item .cd { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; margin-top: 2px; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.chip { font-size: 12px; background: var(--surface2); border: 1px solid var(--line); border-radius: 99px; padding: 1px 8px; }
.chip.base { background: var(--steel-soft); border-color: transparent; font-weight: 600; }
.chip.warn { background: var(--sobra-soft); color: var(--sobra); border-color: transparent; }
.qtd { text-align: center; }
.qtd .lb { font-size: 12px; color: var(--muted); }
.qtd .v { font-family: var(--cond); font-size: 32px; font-weight: 700; line-height: 1; }
.qtd .v small { font-size: 15px; color: var(--muted); font-weight: 500; }
.stepper { display: flex; border: 2px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--surface); height: 56px; }
.stepper button { border: 0; background: var(--surface2); width: 56px; font-size: 26px; cursor: pointer; }
.stepper input { width: 100%; min-width: 0; border: 0; text-align: center; font-family: var(--cond); font-size: 30px; font-weight: 700; background: transparent; -moz-appearance: textfield; }
.stepper input::-webkit-outer-spin-button, .stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.stepper.filled { border-color: var(--ok); }
.fis-lb { font-size: 12px; color: var(--muted); margin-bottom: 3px; display: flex; justify-content: space-between; }
@media (max-width: 760px) {
  .item { grid-template-columns: 1fr 1fr; }
  .item .prod { grid-column: 1 / -1; }
}

/* pedidos (visão por pedido) */
.orders { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 10px; }
.order { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; }
.order h3 { font-size: 24px; }
.order table { width: 100%; border-collapse: collapse; margin-top: 6px; font-size: 14px; }
.order td { padding: 4px 0; border-top: 1px solid var(--line); vertical-align: top; }
.order td.q { text-align: right; font-family: var(--cond); font-size: 20px; font-weight: 700; white-space: nowrap; padding-left: 8px; }

/* retirada (depósito) */
.ret-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; }
.ret { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 14px; display: grid; gap: 8px; border-top: 6px solid var(--pend); }
.ret.sep { border-top-color: var(--steel); }
.ret.pronto { border-top-color: var(--ok); }
.ret.atrasado { border-top-color: var(--falta); }
.ret .num { font-family: var(--cond); font-size: 38px; font-weight: 700; line-height: 1; }
.ret .timer { font-family: var(--cond); font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; }
.ret ul { margin: 0; padding: 0; list-style: none; }
.ret li { display: flex; justify-content: space-between; gap: 10px; padding: 6px 0; border-top: 1px solid var(--line); font-weight: 600; }
.ret li b { font-family: var(--cond); font-size: 22px; white-space: nowrap; }
.ret .acts { display: grid; grid-template-columns: 1fr auto; gap: 6px; }
.new-flash { animation: flash 1s ease 3; }
@keyframes flash { 50% { background: var(--falta-soft); } }

/* alerta global de nova retirada */
.alerta { position: fixed; left: 50%; top: 12px; transform: translateX(-50%); z-index: 50; background: var(--falta); color: #fff;
  padding: 14px 22px; border-radius: 10px; font-family: var(--cond); font-size: 26px; font-weight: 700; box-shadow: 0 8px 30px rgba(0,0,0,.35);
  cursor: pointer; animation: pulse 1s ease-in-out infinite; max-width: calc(100% - 24px); text-align: center; }
@keyframes pulse { 50% { transform: translateX(-50%) scale(1.04); } }

/* TV */
.tv { min-height: 100vh; background: #0B1015; color: #F2F5F7; padding: 18px 22px; display: grid; grid-template-rows: auto 1fr; gap: 16px; }
.tv-head { display: flex; align-items: center; gap: 24px; flex-wrap: wrap; }
.tv-head .clock { font-family: var(--cond); font-size: 54px; font-weight: 700; line-height: 1; }
.tv-head .m { font-family: var(--cond); font-size: 22px; color: #9FB0BD; }
.tv-head .m b { color: #fff; font-size: 30px; display: block; }
.tv-cols { display: grid; grid-template-columns: 2fr 1fr; gap: 18px; align-items: start; }
.tv-col h2 { font-size: 28px; color: #9FB0BD; margin-bottom: 10px; text-transform: uppercase; letter-spacing: .04em; }
.tv-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); gap: 14px; }
.tv-card { background: #17202A; border-radius: 14px; padding: 16px 20px; border-left: 12px solid #7A8590; }
.tv-card.sep { border-left-color: #4E9BD1; }
.tv-card.pronto { border-left-color: #3FBF7F; }
.tv-card.atrasado { border-left-color: #F0806F; }
.tv-card .row1 { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.tv-card .num { font-family: var(--cond); font-size: 64px; font-weight: 700; line-height: 1; }
.tv-card .t { font-family: var(--cond); font-size: 44px; font-weight: 700; font-variant-numeric: tabular-nums; }
.tv-card .cli { font-size: 24px; color: #C9D3DA; margin: 4px 0 8px; }
.tv-card .it { font-size: 28px; font-weight: 600; line-height: 1.25; padding: 6px 0; border-top: 1px solid #2A3540; display: flex; gap: 14px; }
.tv-card .it b { font-family: var(--cond); font-size: 36px; min-width: 56px; }
.tv-card .st { font-family: var(--cond); font-size: 22px; letter-spacing: .05em; text-transform: uppercase; color: #9FB0BD; }
.tv-empty { font-size: 32px; color: #6E7F8C; padding: 40px 0; }
.tv-sound { position: fixed; inset: 0; background: rgba(0,0,0,.85); display: grid; place-items: center; z-index: 60; }
.tv-sound button { font-size: 32px; padding: 24px 40px; border-radius: 14px; border: 0; background: #4E9BD1; color: #fff; font-family: var(--cond); font-weight: 700; cursor: pointer; }
@media (max-width: 1000px) { .tv-cols { grid-template-columns: 1fr; } }

/* admin */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; margin-bottom: 14px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 12px 14px; }
.kpi .l { font-size: 13px; color: var(--muted); }
.kpi .v { font-family: var(--cond); font-size: 32px; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.kpi .v small { font-size: 16px; color: var(--muted); font-weight: 500; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 14px; margin-bottom: 14px; }
.card h2 { font-size: 24px; margin-bottom: 8px; }
.tw { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; font-size: 14px; }
table.t th { text-align: left; font-size: 12.5px; color: var(--muted); font-weight: 500; padding: 8px; border-bottom: 1px solid var(--line); background: var(--surface2); white-space: nowrap; }
table.t td { padding: 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.t td.n, table.t th.n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.t td.big { font-family: var(--cond); font-size: 20px; font-weight: 700; }
table.t tr.falta td:first-child { box-shadow: inset 4px 0 0 var(--falta); }
table.t tr.sobra td:first-child { box-shadow: inset 4px 0 0 var(--sobra); }
table.t tr.ok td:first-child { box-shadow: inset 4px 0 0 var(--ok); }
.tag { display: inline-block; font-size: 12.5px; font-weight: 600; padding: 3px 10px; border-radius: 99px; white-space: nowrap; }
.tag.ok { background: var(--ok-soft); color: var(--ok); } .tag.falta { background: var(--falta-soft); color: var(--falta); }
.tag.sobra { background: var(--sobra-soft); color: var(--sobra); } .tag.pend, .tag.semsis { background: var(--pend-soft); color: var(--pend); }
.hbar { height: 14px; border-radius: 3px; background: var(--steel); min-width: 2px; }
.hbar.late { background: var(--falta); }
.cfg-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 14px; }
.checklist { max-height: 260px; overflow-y: auto; border: 1px solid var(--line); border-radius: 6px; padding: 6px 10px; background: var(--surface2); }
.checklist label { display: flex; gap: 8px; align-items: center; padding: 3px 0; font-size: 14px; }
.checklist label.sug { font-weight: 600; }
.field { display: grid; gap: 4px; margin-bottom: 10px; }
.field > span { font-size: 13px; font-weight: 600; }
.field input, .field select { border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; background: var(--surface); }
.legend { color: var(--muted); font-size: 13.5px; max-width: 90ch; margin-top: 12px; }

/* login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login .box { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 24px; width: min(420px, 100%); display: grid; gap: 14px; }
.login .roles { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.login .roles button { padding: 16px; border-radius: 8px; border: 2px solid var(--line); background: var(--surface2); cursor: pointer; font-weight: 600; }
.login .roles button.on { border-color: var(--steel); background: var(--steel-soft); }
.login input { border: 1px solid var(--line); border-radius: 6px; padding: 12px; font-size: 18px; background: var(--surface); width: 100%; }

dialog { border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink); max-width: 620px; width: calc(100% - 32px); padding: 18px; }
dialog::backdrop { background: rgba(10, 15, 20, .45); }
dialog textarea { width: 100%; height: 260px; font: 13px/1.4 ui-monospace, Menlo, Consolas, monospace; background: var(--surface2); color: var(--ink); border: 1px solid var(--line); border-radius: 6px; padding: 10px; }
.toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 6px; font-size: 14px; opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 70; max-width: calc(100% - 24px); }
.toast.on { opacity: 1; }
.mockbar { background: var(--sobra-soft); color: var(--sobra); text-align: center; font-size: 13px; padding: 4px 8px; font-weight: 600; }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* carros */
.chip.carro { font-weight: 700; border: 0; }
.chip.carro-1, .seg-carro button.carro-1.on { background: var(--steel); color: var(--surface); }
.chip.carro-2, .seg-carro button.carro-2.on { background: var(--sobra); color: #fff; }
.chip.carro-outro { background: var(--pend); color: #fff; }
.c1 { color: var(--steel); } .c2 { color: var(--sobra); }
.seg-carro { display: flex; margin: 0 0 12px; width: 100%; }
.seg-carro button { flex: 1; padding: 12px 10px; font-size: 16px; font-family: var(--cond); letter-spacing: .02em; }
