:root {
  color-scheme: light;
  --page: #f9f9f7; --surface: #fcfcfb; --surface-2: #f3f2ee; --ink: #0b0b0b; --ink-2: #52514e; --muted: #898781;
  --grid: #e1e0d9; --axis: #c3c2b7; --border: rgba(11,11,11,0.10); --hover: rgba(11,11,11,0.05);
  --c-ml: #2a78d6; --c-shopee: #eb6834; --c-tiktok: #1baf7a; --c-lucro: #0b0b0b;
  --good: #0ca30c; --good-text: #006300; --bad: #d03b3b; --bad-text: #a32a2a; --warn: #fab219; --warn-bg: #fff6e0;
  --accent: #2a78d6; --ok-bg: #0f7a0f;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --page: #0d0d0d; --surface: #1a1a19; --surface-2: #222220; --ink: #f0efec; --ink-2: #c3c2b7; --muted: #898781;
    --grid: #2c2c2a; --axis: #383835; --border: rgba(255,255,255,0.10); --hover: rgba(255,255,255,0.06);
    --c-ml: #3987e5; --c-shopee: #d95926; --c-tiktok: #199e70; --c-lucro: #f0efec;
    --good-text: #0ca30c; --bad-text: #e66767; --warn-bg: #2a2310; --accent: #3987e5;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0d0d0d; --surface: #1a1a19; --surface-2: #222220; --ink: #f0efec; --ink-2: #c3c2b7; --muted: #898781;
  --grid: #2c2c2a; --axis: #383835; --border: rgba(255,255,255,0.10); --hover: rgba(255,255,255,0.06);
  --c-ml: #3987e5; --c-shopee: #d95926; --c-tiktok: #199e70; --c-lucro: #f0efec;
  --good-text: #0ca30c; --bad-text: #e66767; --warn-bg: #2a2310; --accent: #3987e5;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--page); color: var(--ink); font: 14.5px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif; }
body { min-height: 100vh; }
button, input, select { font: inherit; color: inherit; }
.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }

/* topo */
.topo { position: sticky; top: 0; z-index: 20; background: var(--page); border-bottom: 1px solid var(--border); }
.topo-linha { display: flex; align-items: center; gap: 8px 20px; flex-wrap: wrap; max-width: 1360px; margin: 0 auto; padding: 10px 20px; }
.marca { display: flex; align-items: center; gap: 9px; font-weight: 680; font-size: 17px; letter-spacing: -0.01em; }
.marca svg { width: 26px; height: 26px; }
.abas { display: flex; gap: 2px; flex-wrap: wrap; }
.abas button { background: none; border: 0; padding: 7px 12px; border-radius: 8px; color: var(--ink-2); cursor: pointer; font-size: 14px; }
.abas button:hover { background: var(--hover); color: var(--ink); }
.abas button[aria-selected="true"] { background: var(--ink); color: var(--page); }
.sync { margin-left: auto; display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--muted); }
.sync .msg { max-width: 360px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pc { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.pc[hidden] { display: none; }
.pc::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--axis); }
.pc.on::before { background: var(--good-text); }
.btn { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 6px 12px; cursor: pointer; font-size: 13.5px; }
.btn:hover { background: var(--hover); }
.btn.prim { background: var(--ink); color: var(--page); border-color: var(--ink); }
.btn.prim:hover { opacity: .88; }
.btn.perigo { color: var(--bad-text); }
.btn:disabled { opacity: .5; cursor: default; }
.btn-icone { background: none; border: 1px solid var(--border); border-radius: 8px; width: 32px; height: 32px; cursor: pointer; color: var(--ink-2); }
.girando { display: inline-block; width: 10px; height: 10px; border: 2px solid var(--axis); border-top-color: var(--accent); border-radius: 50%; animation: gira .8s linear infinite; vertical-align: -1px; }
@keyframes gira { to { transform: rotate(360deg); } }

.filtros { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; max-width: 1360px; margin: 0 auto; padding: 14px 20px 0; }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 9px; overflow: hidden; background: var(--surface); }
.seg button { background: none; border: 0; padding: 6px 12px; font-size: 13.5px; color: var(--ink-2); cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.seg button + button { border-left: 1px solid var(--border); }
.seg button:hover { background: var(--hover); }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--page); }
.datas { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.datas[hidden] { display: none; }
input:not([type]), input[type=date], input[type=search], input[type=text], input[type=number], input[type=month], input[type=time], select {
  font-size: 13.5px; padding: 6px 9px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--ink);
}
input:focus-visible, select:focus-visible, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.periodo-txt { font-size: 13px; color: var(--muted); }

main { max-width: 1360px; margin: 0 auto; padding: 14px 20px 60px; }
.grid { display: grid; gap: 14px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; min-width: 0; }
.card h2 { font-size: 14.5px; margin: 0 0 2px; font-weight: 620; }
.card .sub { font-size: 12.5px; color: var(--muted); margin: 0 0 12px; }
.card-topo { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.dois { grid-template-columns: 1fr; }
@media (min-width: 980px) { .dois { grid-template-columns: 1.1fr 1fr; } .dois.igual { grid-template-columns: 1fr 1fr; } }

/* KPIs */
.kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 900px) { .kpis { grid-template-columns: 2fr repeat(4, minmax(0, 1fr)); } }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 13px 16px; min-width: 0; }
.tile .rot { font-size: 12.5px; color: var(--muted); margin-bottom: 3px; }
.tile .val { font-size: 23px; font-weight: 620; letter-spacing: -0.015em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile .det { font-size: 12.5px; color: var(--ink-2); margin-top: 3px; }
.tile.hero { grid-column: span 2; }
@media (min-width: 900px) { .tile.hero { grid-column: auto; } }
.tile.hero .val { font-size: clamp(30px, 3.6vw, 44px); line-height: 1.1; }
.selo { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; font-weight: 600; padding: 2px 9px; border-radius: 99px; border: 1px solid currentColor; }
.bom { color: var(--good-text); }
.ruim { color: var(--bad-text); }
.neutro { color: var(--muted); }

/* avisos */
.avisos { display: grid; gap: 8px; margin-bottom: 14px; }
.aviso { display: flex; gap: 10px; align-items: baseline; background: var(--warn-bg); border: 1px solid color-mix(in srgb, var(--warn) 45%, transparent); border-radius: 10px; padding: 8px 12px; font-size: 13.5px; }
.aviso b { font-weight: 620; }
.aviso .ic { color: #b07800; }
.aviso .acao { margin-left: auto; white-space: nowrap; }
.link { background: none; border: 0; padding: 0; color: var(--accent); cursor: pointer; text-decoration: underline; text-underline-offset: 2px; font-size: inherit; }

/* tabelas */
.tabela-wrap { overflow-x: auto; margin: 0 -4px; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th { text-align: left; font-weight: 560; color: var(--muted); font-size: 12px; padding: 7px 8px; border-bottom: 1px solid var(--border); white-space: nowrap; }
th.num { text-align: right; }
th[data-ord] { cursor: pointer; user-select: none; }
th[data-ord]:hover { color: var(--ink); }
th .seta { font-size: 10px; margin-left: 3px; }
td { padding: 7px 8px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tbody tr:hover td { background: var(--hover); }
tr.grupo td { font-weight: 560; cursor: pointer; }
tr.grupo td:first-child::before { content: '▸'; display: inline-block; width: 14px; color: var(--muted); }
tr.grupo.aberto td:first-child::before { content: '▾'; }
tr.grupo-unico td { font-weight: 560; }
tr.grupo-unico td:first-child { padding-left: 22px; }
tr.filho td:first-child { padding-left: 30px; color: var(--ink-2); }
tr.total td { font-weight: 620; border-top: 2px solid var(--border); }
tr.det td { background: var(--surface-2); }
.mini { font-size: 12px; color: var(--muted); }
.trunc { max-width: 380px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pill { display: inline-block; font-size: 11.5px; padding: 1px 7px; border-radius: 99px; background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--border); white-space: nowrap; }
.pill.ruim { color: var(--bad-text); border-color: color-mix(in srgb, var(--bad) 40%, transparent); }
.pill.aviso-p { color: #8a5d00; border-color: color-mix(in srgb, var(--warn) 60%, transparent); }
:root[data-theme="dark"] .pill.aviso-p { color: var(--warn); }
.canal { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.canal i { width: 9px; height: 9px; border-radius: 3px; display: inline-block; }
.ferramentas { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; margin-bottom: 12px; }
.ferramentas .dir { margin-left: auto; }
label.chk { display: inline-flex; gap: 6px; align-items: center; font-size: 13px; color: var(--ink-2); cursor: pointer; }
.vazio { color: var(--muted); padding: 28px 8px; text-align: center; font-size: 13.5px; }

/* DRE */
.dre td { border-bottom: 0; padding: 5px 8px; }
.dre tr.sep td { border-top: 1px solid var(--border); font-weight: 620; padding-top: 8px; }
.dre .barra { width: 34%; }
.dre .trilho { height: 8px; background: var(--surface-2); border-radius: 4px; overflow: hidden; }
.dre .trilho span { display: block; height: 100%; border-radius: 0 4px 4px 0; background: var(--axis); }
.dre .trilho span.pos { background: var(--good); }
.dre .trilho span.neg { background: var(--bad); }

/* gráficos */
.grafico { position: relative; width: 100%; }
.grafico svg { display: block; width: 100%; height: auto; overflow: visible; }
.grafico text { fill: var(--muted); font-size: 11px; font-family: inherit; }
.legenda { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12.5px; color: var(--ink-2); margin-bottom: 8px; }
.legenda span { display: inline-flex; align-items: center; gap: 6px; }
.legenda i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.legenda i.linha { height: 2px; width: 14px; border-radius: 1px; background: var(--c-lucro); }
.tooltip { position: fixed; z-index: 50; pointer-events: none; background: var(--surface); color: var(--ink); border: 1px solid var(--border); border-radius: 9px; padding: 8px 10px; font-size: 12.5px; box-shadow: 0 6px 24px rgba(0,0,0,.14); display: none; min-width: 170px; }
.tooltip .t { font-weight: 620; margin-bottom: 4px; }
.tooltip .l { display: flex; gap: 12px; justify-content: space-between; }
.tooltip .l span:first-child { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-2); }
.tooltip i { width: 8px; height: 8px; border-radius: 2px; display: inline-block; }
.hbar { display: grid; grid-template-columns: 44px 1fr auto; gap: 4px 10px; align-items: center; font-size: 13px; }
.hbar .rot { color: var(--ink-2); font-weight: 560; }
.hbar .trilho { display: flex; gap: 2px; height: 14px; }
.hbar .trilho span { height: 100%; min-width: 2px; }
.hbar .trilho span:last-child { border-radius: 0 4px 4px 0; }
.hbar .v { text-align: right; font-variant-numeric: tabular-nums; color: var(--ink-2); white-space: nowrap; }
.hbar .linha-h { display: contents; }
.hbar .linha-h:hover > * { background: var(--hover); }

/* canais */
.canais { grid-template-columns: repeat(1, minmax(0, 1fr)); }
@media (min-width: 900px) { .canais { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.canal-card .cab { display: flex; align-items: center; gap: 8px; font-weight: 620; margin-bottom: 8px; }
.canal-card .cab i { width: 12px; height: 12px; border-radius: 3px; }
.kv { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; font-size: 13.5px; }
.kv span:nth-child(odd) { color: var(--muted); }
.kv span:nth-child(even) { text-align: right; font-variant-numeric: tabular-nums; }
.canal-linha { display: grid; grid-template-columns: minmax(90px, 1.2fr) repeat(5, minmax(0, 1fr)); gap: 8px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 13.5px; }
.canal-linha:last-child { border-bottom: 0; }
.canal-linha.cab { font-size: 12px; color: var(--muted); padding-top: 0; }

/* simulador */
.sim-campos { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 640px) { .sim-campos { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.sim-rot { grid-column: 1 / -1; display: grid; gap: 4px; justify-items: start; font-size: 12.5px; color: var(--muted); }
.sim-faixa { width: 100%; margin: 14px 0 0; accent-color: var(--ink); }
.sim-val { font-size: 34px; font-weight: 620; letter-spacing: -0.015em; line-height: 1.15; margin: 2px 0 6px; }
.sim-det { font-size: 12.5px; color: var(--ink-2); }
.abaixo { color: #8a5d00; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .abaixo { color: var(--warn); } }
:root[data-theme="dark"] .abaixo { color: var(--warn); }
tr.atual td { background: var(--surface-2); font-weight: 620; }

/* produção */
.abas .cont { display: inline-block; min-width: 18px; margin-left: 6px; padding: 0 5px; border-radius: 99px; background: var(--c-shopee); color: #fff; font-size: 11px; font-weight: 600; line-height: 17px; text-align: center; }
.abas .cont:empty { display: none; }
.kpis-prod { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 900px) { .kpis-prod { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.acc { color: var(--accent); }
.aviso-t { color: #8a5d00; }
:root[data-theme="dark"] .aviso-t { color: var(--warn); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .aviso-t { color: var(--warn); } }
tr.feito td:not(:last-child) { opacity: .55; }
.item-pk { white-space: nowrap; }
.item-pk + .item-pk { margin-top: 2px; }
.tl { margin-top: 4px; }
.tl-linha { display: grid; grid-template-columns: minmax(90px, 170px) 1fr; gap: 10px; align-items: center; margin: 5px 0; }
.tl-nome { font-size: 12.5px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tl-eixo { position: relative; height: 16px; font-size: 11px; color: var(--muted); }
.tl-eixo span { position: absolute; top: 0; transform: translateX(3px); white-space: nowrap; }
.tl-trilho { position: relative; height: 22px; background: var(--surface-2); border-radius: 6px; overflow: hidden; }
.tl-trilho span { position: absolute; top: 3px; bottom: 3px; border-radius: 4px; background: color-mix(in srgb, var(--ink-2) 55%, transparent); box-shadow: inset -2px 0 0 var(--surface-2); cursor: default; }
.tl-trilho span:hover { filter: brightness(1.25); }
.tl-trilho span.rodando { background: var(--accent); }
.tl-trilho span.atrasa { background: var(--bad); }
.tl-dia { position: absolute; top: 0; bottom: 0; border-left: 1px dashed var(--axis); }
.maqs { grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); align-items: start; }
.maq { border: 1px solid var(--border); border-radius: 10px; padding: 10px; background: var(--page); min-width: 0; }
.maq-cab { display: grid; gap: 1px; margin-bottom: 8px; }
.job { border-top: 1px solid var(--border); padding: 8px 4px; border-radius: 6px; }
.job-l { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; }
.job-n { font-size: 13.5px; font-weight: 560; overflow-wrap: anywhere; }
.job-i { margin-top: 2px; font-variant-numeric: tabular-nums; }
.job.feita { padding: 5px 4px; }
.job.feita .job-n { color: var(--muted); font-weight: 500; }
.num-ped { font-variant-numeric: tabular-nums; font-size: inherit; }
.job[draggable="true"] { cursor: grab; }
.job[draggable="true"]:hover { background: var(--hover); }
.job[draggable="true"]:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.job.arrastando { opacity: .35; }
.pino { background: none; border: 0; padding: 0 2px; cursor: pointer; font-size: 11px; line-height: 1; }
.maq.pode { outline: 2px dashed color-mix(in srgb, var(--accent) 55%, transparent); outline-offset: 2px; }
.maq.naopode { outline: 2px dashed color-mix(in srgb, var(--bad) 45%, transparent); outline-offset: 2px; }
.marcador-drop { height: 4px; margin: 3px 0; border-radius: 2px; background: var(--accent); }
/* botão de estado: a cor é onde a peça está; o clique leva ao passo seguinte */
.estado { position: relative; overflow: hidden; display: inline-flex; align-items: center; justify-content: center; min-width: 104px; padding: 4px 12px;
  border-radius: 99px; border: 1px solid transparent; font-size: 12.5px; font-weight: 620; line-height: 1.3; white-space: nowrap; font-variant-numeric: tabular-nums; cursor: pointer; }
button.estado:hover { filter: brightness(1.1); }
button.estado:active { transform: translateY(1px); }
.estado.fila { background: var(--surface-2); color: var(--ink-2); border-color: var(--axis); }
.estado.atraso { background: var(--bad); color: #fff; }
.estado.rod { background: var(--accent); color: #fff; }
.estado.rod::after { content: ''; position: absolute; left: 0; bottom: 0; height: 3px; width: var(--p, 0%); background: rgba(255,255,255,.8); }
.estado.terminou { background: var(--warn); color: #2b1d00; }
.estado.ok { background: var(--ok-bg); color: #fff; }
.ja-impressa { background: none; border: 1px solid var(--border); border-radius: 99px; padding: 0 7px; margin-left: 4px; font: inherit; font-size: 11px; color: var(--muted); cursor: pointer; }
.so-sozinha.on { color: var(--ink); border-color: var(--axis); background: var(--surface-2); }
.so-sozinha:hover { color: var(--ink); border-color: var(--axis); }
.so-nome { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ja-impressa:not(.so-sozinha):hover { color: var(--good-text); border-color: color-mix(in srgb, var(--good) 50%, transparent); }
.ic-item { background: none; border: 0; padding: 0 2px; font: inherit; cursor: pointer; min-width: 1.2em; }
.ic-item:hover { filter: brightness(1.3); text-decoration: underline; }
.link-peca { background: none; border: 0; padding: 0; font: inherit; color: inherit; cursor: pointer; text-align: left; }
.link-peca:hover { text-decoration: underline; text-underline-offset: 2px; color: var(--ink); }
.cores-arq { display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; font-size: 12.5px; color: var(--muted); grid-column: 1 / -1; }
.cores-arq label, .campos .cores-arq label { display: flex; align-items: center; gap: 8px; color: var(--ink); }
.cores-arq label i { width: 14px; height: 14px; border-radius: 50%; border: 1px solid var(--axis); flex: none; }
.cores-arq label.so-mesa { padding-left: 22px; } /* a cor só desta mesa, embaixo do filamento */
/* o nome ocupa o que sobra e as listas ficam na mesma coluna, à direita; "corrigida" vem antes da lista */
.cores-arq label .mini { flex: 1; min-width: 0; }
.cores-arq label .pill { order: 1; }
.campos .cores-arq label select { order: 2; width: 270px; max-width: 55%; flex: none; }
/* quadrinhos do card: enviar até, duração, começa, pronto */
.quadros { display: grid; grid-template-columns: repeat(auto-fit, minmax(76px, 1fr)); gap: 6px; margin: 7px 0 6px; }
.qd { display: grid; gap: 1px; min-width: 0; padding: 5px 8px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-2); line-height: 1.2; }
.qd .rot { font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.qd b { font-size: 15px; font-weight: 650; font-variant-numeric: tabular-nums; }
.qd .sub { font-size: 11.5px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.qd.q-ruim { border-color: color-mix(in srgb, var(--bad) 55%, transparent); background: color-mix(in srgb, var(--bad) 10%, var(--surface-2)); }
.qd.q-ruim b { color: var(--bad-text); }
.qd.q-aviso { border-color: color-mix(in srgb, var(--warn) 65%, transparent); background: color-mix(in srgb, var(--warn) 14%, var(--surface-2)); }
.abre-lote { background: none; border: 0; padding: 0; font: inherit; color: inherit; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; text-align: left; }
.abre-lote:hover .cor-l, .abre-lote:hover > span:first-child { text-decoration: underline; text-underline-offset: 2px; }
.abre-lote .pasta { font-size: 12px; opacity: .65; }
.abre-lote:hover .pasta { opacity: 1; }
.abre-lote:disabled { cursor: progress; opacity: .6; }
.cor-l { display: inline-flex; align-items: center; gap: 6px; }
.cor-l i { width: 11px; height: 11px; border-radius: 50%; border: 1px solid var(--axis); display: inline-block; flex: none; }
.cor-l i + i { margin-left: -9px; }
.lote-ps { margin-top: 3px; display: grid; gap: 1px; color: var(--ink-2); overflow-wrap: anywhere; }
.conversa { max-height: 260px; overflow-y: auto; display: grid; gap: 6px; padding: 10px; margin: 8px 0; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); font-size: 13px; }
.conversa .msg { max-width: 85%; justify-self: start; padding: 5px 9px; border-radius: 9px; background: var(--surface); border: 1px solid var(--border); white-space: pre-wrap; overflow-wrap: anywhere; }
.conversa .msg.loja { justify-self: end; background: color-mix(in srgb, var(--accent) 12%, var(--surface)); }
.conversa .msg .mini { display: block; }
.esc-lista { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 6px 16px; margin: 10px 0 4px; }
.esc-lista label { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 13.5px; }
.esc-lista input { width: 64px; flex: none; }
.legenda-estado { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 8px; }
.legenda-estado .estado { min-width: 0; cursor: default; font-size: 11.5px; padding: 2px 9px; }
.maqs-prod { display: grid; gap: 4px; font-size: 12.5px; color: var(--muted); grid-column: 1 / -1; }
.maqs-prod label.chk { display: inline-flex; color: var(--ink); }
.maqs-prod input[type=checkbox] { width: auto; }
.maqs-prod > div { display: flex; flex-wrap: wrap; gap: 6px 16px; }
.imp-tab input { width: 100%; min-width: 60px; }
.imp-tab td { padding: 5px 4px; }
.imp-tab input[type=checkbox] { width: auto; min-width: 0; }

/* diálogo */
dialog { border: 1px solid var(--border); border-radius: 14px; background: var(--surface); color: var(--ink); padding: 0; width: min(640px, calc(100vw - 32px)); box-shadow: 0 20px 60px rgba(0,0,0,.25); }
dialog:has(#f-prod) { width: min(860px, calc(100vw - 32px)); } /* editar produto: as listas de mesas precisam de largura */
dialog::backdrop { background: rgba(0,0,0,.35); }
dialog form { padding: 18px 20px; }
dialog h3 { margin: 0 0 14px; font-size: 16px; }
.campos { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 14px; }
.campos label { display: grid; gap: 4px; align-content: start; font-size: 12.5px; color: var(--muted); }
.campos label.largo { grid-column: 1 / -1; }
.campos input, .campos select { width: 100%; min-width: 0; color: var(--ink); }
/* caixa de marcar com explicação: a caixa numa coluna, o texto na outra */
.campos label.chk.largo { grid-template-columns: auto minmax(0, 1fr); gap: 2px 8px; align-items: center; color: var(--ink); }
.campos label.chk.largo input { width: auto; }
.campos label.chk.largo .mini { grid-column: 2; }
.calc { margin-top: 14px; padding: 12px; border: 1px dashed var(--axis); border-radius: 10px; }
.calc h4 { margin: 0 0 8px; font-size: 13px; font-weight: 600; }
.calc .campos { grid-template-columns: repeat(5, minmax(0, 1fr)); }
@media (max-width: 640px) { .campos { grid-template-columns: minmax(0, 1fr); } .calc .campos { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.calc .res { margin-top: 8px; display: flex; justify-content: space-between; align-items: center; font-size: 13px; gap: 10px; flex-wrap: wrap; }
.botoes { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; }
.botoes .esq { margin-right: auto; }

.soltar { position: fixed; inset: 0; z-index: 60; display: none; align-items: center; justify-content: center; background: color-mix(in srgb, var(--page) 80%, transparent); border: 3px dashed var(--accent); font-size: 20px; font-weight: 600; }
.soltar.on { display: flex; }
.toast { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); z-index: 70; background: var(--ink); color: var(--page); padding: 9px 16px; border-radius: 10px; font-size: 13.5px; display: none; max-width: 90vw; }
.toast.on { display: block; }
.fora { position: fixed; inset: 0; z-index: 80; display: none; align-items: center; justify-content: center; background: var(--page); text-align: center; padding: 20px; }
.fora.on { display: flex; }
@media (max-width: 700px) {
  .topo-linha, .filtros, main { padding-left: 16px; padding-right: 16px; }
  .sync .msg { display: none; }
  /* celular: marca e botões numa linha, abas noutra, rolando de lado */
  .topo-linha { padding-top: calc(8px + env(safe-area-inset-top)); padding-bottom: 8px; }
  .sync { gap: 8px; }
  .sync .btn { padding: 6px 10px; }
  .abas { order: 3; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 0 16px; width: calc(100% + 32px); }
  .abas::-webkit-scrollbar { display: none; }
  .abas button { flex: none; padding: 9px 12px; }
  .tile .val { white-space: normal; }
  .pc .est { display: none; }
  .quadros { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* histórico de impressões: a linha de cada dia separa os dias */
tr.hist-dia td { background: var(--surface-2); padding-top: 8px; padding-bottom: 8px; }
