/* entradas.css — SIGENT. Identidade visual alinhada ao impressor/integrador:
   Manrope + tokens (accent #635bff). Sobrescreve o base style.css. */

@font-face {
    font-family: 'Manrope';
    font-weight: 200 800;
    font-display: swap;
    src: url('/fonts/manrope-var.woff2') format('woff2');
}
:root, :root[data-theme="light"] {
    --ground: #f4f7fb; --surface: #fff; --surface-2: #f8fafd;
    --ink: #29343d; --muted: #7b8893; --line: #e8eef4; --line-strong: #d9e2ea;
    --accent: #635bff; --accent-hover: #5147f5; --accent-soft: #ecebff;
    --ok: #13c2ab; --ok-soft: #e6faf6; --warn: #f8a437; --warn-soft: #fef3e3;
    --danger: #ff6692; --danger-soft: #ffedf2; --info: #46caeb; --info-soft: #e9f8fd;
    --violet: #8965e5; --violet-soft: #f0eafd;
    --shadow: 0 2px 6px rgba(37,83,185,.05), 0 12px 30px rgba(37,83,185,.06);
    --shadow-lg: 0 10px 40px rgba(37,83,185,.14);
    --radius: 16px; --radius-sm: 10px;
    --sans: 'Manrope', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
}
:root[data-theme="dark"] {
    --ground: #0f1620; --surface: #17212b; --surface-2: #131c26;
    --ink: #e6ecf2; --muted: #8b98a5; --line: #253241; --line-strong: #31404f;
    --accent: #7a73ff; --accent-hover: #928cff; --accent-soft: #262450;
    --ok: #2bd4bd; --ok-soft: #113029; --warn: #f8a437; --warn-soft: #33260f;
    --danger: #ff7ba1; --danger-soft: #351a23; --info: #46caeb; --info-soft: #102c36;
    --violet: #a58cf0; --violet-soft: #251d3e;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 10px 30px rgba(0,0,0,.35);
    --shadow-lg: 0 14px 44px rgba(0,0,0,.5);
    /* tokens legados do style.css remapeados p/ dark */
    --text-primary: #e6ecf2; --text-secondary: #8b98a5; --bg-color: #0f1620; --card-bg: #17212b;
}
body { font-family: var(--sans); background: var(--ground); color: var(--ink); }
h1,h2,h3,h4,h5 { font-family: var(--sans); }
.app-title { display: flex; align-items: center; gap: .6rem; font-size: 1rem; margin: 0; }
.sigent-badge { background: var(--accent); color: #fff; font-weight: 800; letter-spacing: .5px;
    padding: .25rem .8rem; border-radius: 999px; font-size: .95rem; }
.app-sub { color: var(--muted); font-weight: 600; font-size: .9rem; }
header { background: var(--surface); box-shadow: var(--shadow); border-bottom: 1px solid var(--line); }
.panel-desc, .input-hint, small { color: var(--muted); }

.filters-panel, .recebimento-panel, .romaneios-section, .recebimento-historico-section,
.dash-card, .modal-dialog {
    background: var(--surface); border: 1px solid var(--card-border, var(--line));
    border-radius: var(--radius); box-shadow: var(--shadow);
}

input, select, textarea, .recebimento-input, .conf-qtd {
    background: var(--surface); color: var(--ink);
    border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
}
input:focus, select:focus, textarea:focus, .recebimento-input:focus {
    outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(99,91,255,.20);
}

.btn { border-radius: 999px; font-family: var(--sans); font-weight: 600; transition: filter .15s, background .15s; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn-success { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn-warning { background: var(--warn); border-color: var(--warn); color: #3a2a08; }
.btn-secondary { background: var(--surface-2); border: 1px solid var(--line-strong); color: var(--ink); }
.btn-link { color: var(--accent); background: none; }

/* ===== Shell com sidebar (padrão SIGSEP/impressor) ===== */
.app-shell { display: grid; grid-template-columns: 248px minmax(0,1fr); min-height: 100vh; }
.sidebar {
    background: var(--surface); border-right: 1px solid var(--line);
    padding: 18px 14px; display: flex; flex-direction: column; gap: 2px;
    position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.side-brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 14px; }
.side-logo { width: 40px; height: 40px; border-radius: 10px; background: #fff; border: 1px solid var(--line);
    display: grid; place-items: center; box-shadow: var(--shadow); flex-shrink: 0; }
.side-logo img { width: 30px; height: 30px; object-fit: contain; }
.side-brand b { font-size: 15px; display: block; line-height: 1.1; }
.side-brand small { color: var(--accent); font-size: 10.5px; font-weight: 800; letter-spacing: 1.4px; }
.side-group { color: var(--muted); font-size: 10.5px; font-weight: 800; letter-spacing: .8px;
    text-transform: uppercase; padding: 14px 10px 6px; }
.side-nav { display: flex; flex-direction: column; gap: 2px; }
.side-nav .tab-btn {
    display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
    padding: 10px 12px; border-radius: 10px; border: none; background: none;
    font-size: 13.5px; font-weight: 600; color: var(--ink); cursor: pointer; font-family: var(--sans);
}
.side-nav .tab-btn:hover { background: var(--surface-2); }
.side-nav .tab-btn.active { background: var(--accent-soft); color: var(--accent-hover); font-weight: 800; }
.side-ico { width: 18px; height: 18px; flex-shrink: 0; stroke: var(--muted); }
.side-nav .tab-btn.active .side-ico { stroke: var(--accent-hover); }
.side-tema { width: 34px; height: 34px; border-radius: 10px; border: 1px solid var(--line);
    background: none; color: var(--muted); cursor: pointer; flex-shrink: 0; font-size: 16px; }
.side-tema:hover { background: var(--surface-2); }
.side-user { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--line); }
.side-user-row { display: flex; align-items: center; gap: 10px; padding: 4px 6px; }
.side-avatar { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center;
    color: #fff; font-weight: 800; font-size: 12px; flex-shrink: 0;
    background: linear-gradient(135deg, var(--accent), #8965e5); }
.side-user-info { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.side-user-info b { font-size: 13px; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-user-info span { font-size: 11px; color: var(--muted); font-weight: 600; }
.side-logout { width: 100%; margin-top: 8px; padding: 8px; border: 1px solid var(--line); border-radius: 10px;
    background: none; color: var(--danger); font-weight: 700; font-size: 12px; cursor: pointer; }
.side-logout:hover { background: var(--danger-soft); border-color: var(--line-strong); }

.app-main { min-width: 0; display: flex; flex-direction: column; }
.app-header { display: flex; align-items: center; gap: 14px; padding: 14px 26px;
    border-bottom: 1px solid var(--line); background: var(--surface); position: sticky; top: 0; z-index: 20; }
.app-crumb .crumb-top { color: var(--muted); font-size: 11.5px; font-weight: 700; }
.app-crumb h1 { font-size: 17px; font-weight: 800; margin: 0; line-height: 1.1; }
.app-header-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.app-header-right .app-sub { text-transform: uppercase; letter-spacing: .5px; font-size: 11px; font-weight: 700; }
.side-toggle, .side-backdrop { display: none; }

/* app-shell usa a tela toda; anula o container centralizado do base */
.app-main main { max-width: 100% !important; width: 100%; margin: 0; padding: 24px 26px; }

@media (max-width: 860px) {
    .app-shell { grid-template-columns: 1fr; }
    .sidebar { position: fixed; inset: 0 auto 0 0; width: 260px; z-index: 40; transform: translateX(-100%);
        transition: transform .2s; box-shadow: var(--shadow-lg, 0 14px 44px rgba(0,0,0,.2));
        padding-top: calc(18px + var(--safe-top)); padding-bottom: calc(18px + var(--safe-bottom));
        padding-left: calc(14px + var(--safe-left)); }
    .sidebar.open { transform: translateX(0); }
    .side-backdrop.open { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 30; }
    .side-toggle { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 10px;
        border: 1px solid var(--line); background: var(--surface); cursor: pointer; }
    .app-header-right .app-sub { display: none; }
    .app-main main { padding: 16px; }
    /* header compacto já a partir do drawer (☰): mira a CLASSE p/ vencer o base
       header (space-between + wrap) que espalhava/empilhava ☰/crumb/SIGENT */
    .app-header { justify-content: flex-start; flex-wrap: nowrap; gap: .6rem;
        padding: calc(.7rem + var(--safe-top)) 1rem .7rem; }
    .app-crumb { min-width: 0; }
    .app-crumb h1 { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
}

/* ===== Grids no padrão impressor: header uppercase discreto, linhas arejadas ===== */
.romaneios-grid { font-size: .855rem; font-variant-numeric: tabular-nums; }
.romaneios-grid thead { background: none; border-bottom: 1px solid var(--line); }
.romaneios-grid th { background: none; padding: 11px 10px; font-size: .68rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.romaneios-grid td { padding: 12px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.romaneios-grid tbody tr:last-child td { border-bottom: none; }
.romaneios-grid tbody tr:hover { background: var(--surface-2); }
.painel-row:hover { background: var(--surface-2); }

/* badges/chips no tom dos tokens */
.badge-tipo.insucesso { background: var(--warn-soft); color: #a8480d; }
.badge-tipo.reversa { background: var(--accent-soft); color: var(--accent-hover); }
.badge-tipo.cross { background: #dcf3e2; color: #1e7a3d; }
.status-chip { background: var(--surface-2); color: var(--muted); }
.status-chip.s-aguardando { background: var(--warn-soft); color: #7a5b00; }
.status-chip.s-em_recebimento { background: var(--info-soft); color: #0c6b86; }
.status-chip.s-finalizado { background: var(--ok-soft); color: #0e6b5e; }
.painel-chip { background: var(--surface-2); }

/* KPI cards (padrão impressor) */
.dash-kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
    box-shadow: var(--shadow); padding: 16px 18px; display: flex; flex-direction: column; gap: 8px; min-width: 150px; }
.kpi-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.kpi-label { color: var(--muted); font-size: 12.5px; font-weight: 600; }
.kpi-ico { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; flex-shrink: 0; }
.kpi-svg { width: 17px; height: 17px; }
.kpi-accent { background: var(--accent-soft); color: var(--accent); } .kpi-accent .kpi-svg { stroke: var(--accent); }
.kpi-ok { background: var(--ok-soft); color: var(--ok); } .kpi-ok .kpi-svg { stroke: var(--ok); }
.kpi-warn { background: var(--warn-soft); color: var(--warn); } .kpi-warn .kpi-svg { stroke: var(--warn); }
.kpi-violet { background: var(--violet-soft); color: var(--violet); } .kpi-violet .kpi-svg { stroke: var(--violet); }
.kpi-val { font-size: 27px; font-weight: 800; letter-spacing: -.5px; line-height: 1; color: var(--ink); }
.kpi-sub { font-size: 11.5px; font-weight: 600; color: var(--muted); }
.dash-wide { margin-bottom: 1.2rem; }
.dash-card h4 { color: var(--ink); }

/* blindagem dark: garante superfícies escuras mesmo se o base forçar branco */
:root[data-theme="dark"] .dash-kpi,
:root[data-theme="dark"] .dash-card,
:root[data-theme="dark"] .filters-panel,
:root[data-theme="dark"] .romaneios-section,
:root[data-theme="dark"] .recebimento-panel,
:root[data-theme="dark"] .recebimento-historico-section,
:root[data-theme="dark"] .modal-dialog { background: var(--surface); color: var(--ink); }
:root[data-theme="dark"] body,
:root[data-theme="dark"] .tab-panel { background: var(--ground); color: var(--ink); }

/* Aba escondida por RBAC */
.tab-btn.auth-hidden-tab {
    display: none;
}

/* Usa a tela toda (remove o container de 1400px). Padding enxuto p/ caber mais grid. */
main,
.tabs-nav {
    max-width: 100% !important;
    width: 100%;
}
main { padding: 1rem 1.5rem !important; }
.tabs-nav { padding: 0 1.5rem !important; }

/* Não quebrar/justificar texto e badges do grid */
.romaneios-grid td,
.romaneios-grid th { white-space: nowrap; }
.badge-tipo, .badge-dev, .status-chip, .painel-chip { white-space: nowrap; }
/* colunas de nomes podem quebrar só se muito longas, sem justificar */
.romaneios-grid td { text-align: left; }

/* --- Config --- */
.config-form { display: flex; flex-direction: column; gap: 1rem; max-width: 480px; }
.config-inline { display: flex; align-items: center; gap: .5rem; cursor: pointer; }
.config-msg { min-height: 1.2em; font-size: .9rem; margin-top: .5rem; }
.config-msg.ok { color: #16794b; }
.config-msg.erro { color: #b3261e; }
.input-erro { border-color: #b3261e !important; }

/* --- Endereços --- */
.filter-group-btn { display: flex; align-items: flex-end; }
.badge-ok { background: #d7f2e3; color: #16794b; padding: 2px 8px; border-radius: 10px; font-size: .8rem; }
.badge-off { background: #f0f0f0; color: #777; padding: 2px 8px; border-radius: 10px; font-size: .8rem; }
.empty-cell { text-align: center; color: #888; padding: 1rem; }

/* --- Painel de devoluções --- */
.painel-contadores { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1rem; }
.painel-chip { background: #eef2f7; border-radius: 12px; padding: 3px 10px; font-size: .82rem; }
.painel-manual details summary { cursor: pointer; font-weight: 600; }
.painel-acoes { white-space: nowrap; }
.painel-row { cursor: pointer; }
.painel-row:hover { background: #f2f6fc; }
.badge-dev { padding: 2px 8px; border-radius: 10px; font-size: .78rem; font-weight: 600; white-space: nowrap; }
.badge-dev.ok { background: #d7f2e3; color: #16794b; }
.badge-dev.pend { background: #fff3cd; color: #7a5b00; }
.badge-dev.na { background: transparent; color: #aaa; }
.col-check { width: 2.2rem; text-align: center !important; }
.painel-selbar { display: flex; align-items: center; gap: .75rem; margin: -.5rem 0 .8rem; padding: .5rem .8rem;
    background: var(--accent-soft, #eef2f7); border-radius: var(--radius); font-size: .85rem; font-weight: 600; }
/* modal detalhe do painel */
.modal-painel { max-width: 820px; width: 92%; }
.painel-bloco { border-top: 1px solid var(--line); padding-top: .8rem; margin-top: .8rem; }
.painel-bloco-head { display: flex; align-items: center; gap: .75rem; }
.painel-bloco h5 { margin: 0 0 .5rem; }
.painel-bloco-head h5 { margin: 0; }
.painel-itens-wrap { max-height: 220px; overflow: auto; }
.painel-itens-grid td, .painel-itens-grid th { padding: 3px 8px; font-size: .82rem; }
.painel-det-actions { display: flex; align-items: center; gap: .5rem; }
.painel-det-spacer { flex: 1; }

/* Cockpit */
.cockpit-updated { font-size: .78rem; color: #999; margin-left: .5rem; }

/* Indicador de rede (offline / sincronização) na conferência */
.conf-net { padding: .5rem .8rem; border-radius: 8px; font-size: .9rem; margin: .5rem 0; font-weight: 600; }
.conf-net.off { background: #f8d7da; color: #842029; }
.conf-net.sync { background: #fff3cd; color: #7a5b00; }
.conf-net.ok { background: #d7f2e3; color: #16794b; }
.conf-net a { color: inherit; text-decoration: underline; }
.sit-pend { color: #7a5b00; font-weight: 700; margin-left: 4px; }

/* ---------------- MOBILE ---------------- */
@media (max-width: 640px) {
    main { padding: .6rem !important; }
    .app-header { padding: .6rem .8rem; }
    .tabs-nav { padding: 0 .4rem !important; overflow-x: auto; -webkit-overflow-scrolling: touch; flex-wrap: nowrap; }
    .tab-btn { white-space: nowrap; flex: 0 0 auto; }
    /* inputs 16px evita o zoom automático do iOS ao focar */
    input, select, .recebimento-input, .conf-qtd { font-size: 16px !important; }
    .btn { min-height: 42px; }
    .filters-grid { grid-template-columns: 1fr; }
    /* conferência: cabeçalho e bipagem empilhados e botões largos */
    .conf-cabecalho { flex-direction: column; align-items: stretch; gap: .5rem; }
    .conf-cabecalho > div { flex-direction: row; justify-content: space-between; }
    .conf-cabecalho .btn { margin-left: 0; width: 100%; }
    .recebimento-chave-row { flex-wrap: wrap; }
    .recebimento-chave-row input { min-width: 0; flex: 1 1 100%; }
    .recebimento-chave-row .btn { flex: 1 1 auto; }
    .conf-qtd { width: 72px; }
    /* modais ocupam quase a tela */
    .modal-dialog { width: 96% !important; max-width: 96% !important; padding: 1rem;
        padding-bottom: calc(1rem + var(--safe-bottom)); }
    .romaneios-grid td, .romaneios-grid th { padding: 5px 6px; font-size: .8rem; }
    /* KPIs mobile-first: grid 2 col que preenche a linha (sem cards soltos/ragged) */
    .dash-kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .55rem; }
    .dash-kpi { min-width: 0; padding: 12px 14px; }
    .kpi-label { font-size: 11.5px; }
    .kpi-val { font-size: 22px; }
    .painel-det-actions { flex-wrap: wrap; }
    .painel-det-actions .btn { flex: 1 1 auto; }
    /* Recebimento Cross (legado): table-layout:fixed com colunas em % espreme
       o texto até sobrepor a coluna vizinha em telas estreitas. As demais grids
       do app usam auto+table-scroll; aqui alinhamos ao mesmo padrão. */
    .recebimento-grid, .recebimento-grid-planos { table-layout: auto; }
    .recebimento-grid { min-width: 620px; }
    .recebimento-grid-planos { min-width: 720px; }
}
.dev-status { margin-top: .5rem; font-size: .85rem; }
.dev-status.ok { color: #16794b; font-weight: 600; }
.dev-status.erro { color: #b3261e; }
.dev-preview { margin-top: .5rem; max-height: 220px; overflow: auto; }
.dev-preview-grid td, .dev-preview-grid th { padding: 3px 8px; font-size: .82rem; }
.badge-tipo { padding: 2px 8px; border-radius: 10px; font-size: .78rem; font-weight: 600; }
.badge-tipo.insucesso { background: #fde7d9; color: #a8480d; }
.badge-tipo.reversa { background: #dde7fb; color: #234a9e; }
.badge-tipo.cross { background: #dcf3e2; color: #1e7a3d; }
.status-chip { padding: 2px 8px; border-radius: 10px; font-size: .78rem; background: #eef2f7; color: #444; }
.status-chip.s-aguardando { background: #fff3cd; color: #7a5b00; }
.status-chip.s-pendente_cs { background: #f8d7da; color: #842029; }
.status-chip.s-em_recebimento { background: #cfe2ff; color: #084298; }
.status-chip.s-reconferencia { background: #e2d9f3; color: #492a7a; }
.status-chip.s-aguardando_aprovacao,
.status-chip.s-aguardando_endereco { background: #d1ecf1; color: #0c5460; }
.status-chip.s-finalizado { background: #d7f2e3; color: #16794b; }
.status-chip.s-rejeitado { background: #f0f0f0; color: #777; }
.status-chip.s-cancelado { background: #e2e3e5; color: #41464b; }
.mono { font-family: monospace; font-size: .8rem; color: var(--muted); }
/* Meta em cabeçalhos: mesma fonte do resto, discreta (sem monospace) */
.meta { font-family: var(--sans); font-weight: 500; font-size: .8rem; color: var(--muted); }
.modal-dialog .modal-detalhe-resumo { margin-bottom: 1rem; }
/* Bloco chave/valor reaproveitável em modais de detalhe */
.modal-head-line { font-size: 1rem; padding-bottom: .6rem; margin-bottom: .1rem;
    border-bottom: 1px solid #e5e5e5; }
.modal-kv { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .7rem 1.5rem; margin: .85rem 0 0; }
.modal-kv > div { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.modal-kv dt { font-size: .7rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }
.modal-kv dd { margin: 0; font-size: .9rem; }
@media (max-width: 560px) { .modal-kv { grid-template-columns: 1fr; } }
/* Linhas de consulta clicáveis */
.consulta-row, .cockpit-row { cursor: pointer; }
.consulta-row:hover, .cockpit-row:hover { background: var(--surface-2); }
.modal-subtitulo { margin: 1.1rem 0 .5rem; font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }

/* spinner de bip: mantém o tamanho do botão, esconde o texto e centraliza o giro */
.btn.is-loading { position: relative; color: transparent !important; pointer-events: none; }
.btn.is-loading::after {
    content: ''; position: absolute; top: 50%; left: 50%; width: 1em; height: 1em;
    margin: -.5em 0 0 -.5em; border-radius: 50%;
    border: 2px solid currentColor; border-top-color: transparent;
    color: #fff; animation: btnspin .6s linear infinite;
}
.btn-secondary.is-loading::after, .btn-link.is-loading::after { color: var(--accent); }
@keyframes btnspin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .btn.is-loading::after { animation-duration: 1.4s; } }

/* ===== Banho de loja: modais, chips e stagger no padrão impressor ===== */
/* Modal ancorado no topo com scroll + blur no fundo (não corta modal alto) */
.modal-overlay { align-items: flex-start; justify-content: center; padding: 4vh 1rem;
    background: rgba(9, 14, 22, .55); backdrop-filter: blur(2px); overflow-y: auto; }
.modal-dialog { border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-lg); }
.modal-dialog h4 { font-weight: 800; }

/* Chips de status/situação com o ponto colorido (assinatura MatDash) */
.status-chip, .sit { display: inline-flex; align-items: center; gap: 6px; line-height: 1.4; }
.status-chip::before, .sit::before { content: ''; width: 6px; height: 6px;
    border-radius: 50%; background: currentColor; flex-shrink: 0; }

/* Entrada em cascata das linhas de tabela (sem estilizar tela a tela) */
@keyframes riseIn { from { opacity: 0; transform: translateY(9px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: no-preference) {
    main table tbody tr { animation: riseIn .34s cubic-bezier(.22,.61,.36,1) both; }
    main table tbody tr:nth-child(1) { animation-delay: 20ms; }
    main table tbody tr:nth-child(2) { animation-delay: 46ms; }
    main table tbody tr:nth-child(3) { animation-delay: 72ms; }
    main table tbody tr:nth-child(4) { animation-delay: 98ms; }
    main table tbody tr:nth-child(5) { animation-delay: 124ms; }
    main table tbody tr:nth-child(6) { animation-delay: 150ms; }
    main table tbody tr:nth-child(7) { animation-delay: 176ms; }
    main table tbody tr:nth-child(8) { animation-delay: 202ms; }
    main table tbody tr:nth-child(n+9) { animation-delay: 228ms; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; } }

/* Anel de foco acessível no tom do accent */
:focus-visible { outline: none; border-radius: 6px;
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }

/* --- Conferência --- */
.conf-ativo { margin-top: 1rem; }
.conf-cabecalho { display: flex; flex-wrap: wrap; gap: 1.5rem; align-items: center;
    padding: 1rem; background: #f7f9fc; border-radius: 8px; margin-bottom: 1rem; }
.conf-cabecalho > div { display: flex; flex-direction: column; }
.conf-cabecalho .btn { margin-left: auto; }
.badge-cega { background: #4a3a7a; color: #fff; padding: 2px 8px; border-radius: 10px; font-size: .75rem; }
.conf-bip-item { margin-bottom: 1rem; }
.conf-qtd { width: 80px; text-align: center; }
.item-fechado { background: #f4f8f4; }
.item-destaque { outline: 2px solid #f0a500; outline-offset: -2px; background: #fff6e0; }
.conf-lotes { display: inline-block; margin-left: 6px; font-size: .78rem; color: #555; vertical-align: middle; }
.conf-lotes summary { cursor: pointer; color: #0a5a9c; display: inline; }
.conf-lotes div { padding: 2px 0 0 10px; }
.sit { padding: 2px 8px; border-radius: 10px; font-size: .78rem; font-weight: 600; }
.sit-ok { background: #d7f2e3; color: #16794b; }
.sit-sobra { background: #cfe2ff; color: #084298; }
.sit-falta { background: #f8d7da; color: #842029; }
.sit-nao_previsto { background: #fff3cd; color: #7a5b00; }
.sit-sobra_falta { background: #f0d9c0; color: #8a4b00; }
.feedback-ok { background: #d7f2e3; color: #16794b; }
.feedback-erro { background: #f8d7da; color: #842029; }

/* --- Supervisão --- */
.modal-sup { max-width: 900px; width: 92%; }
.sup-conf { margin: 1rem 0; }
.sup-conf h5 { margin: 0 0 .4rem; }
.sup-conf-grid td, .sup-conf-grid th { padding: 4px 8px; font-size: .85rem; }
.sup-acoes { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1rem;
    border-top: 1px solid #e5e5e5; padding-top: 1rem; margin-top: 1rem; }
.sup-finalizar { display: flex; gap: .5rem; align-items: center; }
.sup-outras { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }

/* --- Dashboard --- */
.dash-kpis { display: flex; flex-wrap: wrap; gap: 1rem; margin-top: 1rem; }
.dash-kpi { background: #f7f9fc; border-radius: 8px; padding: .8rem 1.2rem; min-width: 140px; display: flex; flex-direction: column; }
.dash-kpi span { font-size: .78rem; color: #777; }
.dash-kpi strong { font-size: 1.4rem; }
.dash-charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1.2rem; }
.dash-card { background: #fff; border: 1px solid #e5e5e5; border-radius: 8px; padding: 1rem; }
.dash-card h4 { margin: 0 0 .6rem; }
.dash-card canvas { max-height: 260px; }

/* Filtro de período do dashboard (padrão segmentado do impressor) */
.dash-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.dash-head h3 { margin: 0; }
.periodo-filtro { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.seg { display: inline-flex; gap: 4px; background: var(--ground); border: 1px solid var(--line); border-radius: 9px; padding: 3px; }
.seg-btn { font-size: .78rem; font-weight: 600; padding: .3rem .65rem; border: 0; background: transparent; color: var(--muted); border-radius: 6px; cursor: pointer; }
.seg-btn.active { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.periodo-custom { display: inline-flex; align-items: center; gap: .4rem; font-size: .78rem; color: var(--muted); }
.periodo-custom[hidden] { display: none; } /* [hidden] sozinho não vence display: inline-flex */
.periodo-refresh { display: inline-flex; align-items: center; gap: .4rem; font-size: .8rem; font-weight: 600;
    color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 9px;
    padding: .42rem .8rem; cursor: pointer; }
.periodo-refresh:hover { background: var(--ground); }
.periodo-refresh svg { width: 15px; height: 15px; }
.periodo-custom input[type="date"] { padding: .3rem .5rem; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); color: var(--ink); font-size: .78rem; }

/* Skeleton de carregamento (shimmer) */
.skel-bar { display: block; height: 13px; border-radius: 6px; margin: .25rem 0;
    background: linear-gradient(90deg, var(--ground) 25%, var(--line) 37%, var(--ground) 63%);
    background-size: 400% 100%; animation: skel 1.3s ease infinite; }
.skel-bar.skel-lg { height: 26px; width: 70%; margin: .5rem 0; }
.skel-row td { padding: .55rem .75rem; }
.skel-row .skel-bar { width: 100%; }
.skel-card { pointer-events: none; }
@keyframes skel { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }

/* Configurações — linhas em caixa (padrão impressor) */
#configForm { display: flex; flex-direction: column; gap: .75rem; margin-top: .5rem; }
.config-row { display: flex; align-items: center; justify-content: space-between; gap: 1.5rem;
    padding: 1rem 1.15rem; border: 1px solid var(--line); border-radius: 12px; background: var(--ground); }
.config-row-body { min-width: 0; }
.config-row-body strong { display: block; font-weight: 700; color: var(--ink); margin-bottom: .2rem; }
.config-row-body small { color: var(--muted); font-size: .82rem; }
.config-num { width: 110px; text-align: right; padding: .5rem .7rem; border: 1px solid var(--line);
    border-radius: 9px; background: var(--surface); color: var(--ink); font-size: .95rem; font-weight: 600; }
.config-num:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.config-num.input-erro { border-color: var(--danger); box-shadow: 0 0 0 3px rgba(220,53,69,.15); }

/* Toggle switch (52x28) */
.switch { position: relative; display: inline-block; width: 52px; height: 28px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch-track { position: absolute; inset: 0; border-radius: 999px; background: var(--line-strong, #cbd2d9);
    cursor: pointer; transition: background .2s; }
.switch-track::before { content: ''; position: absolute; height: 22px; width: 22px; left: 3px; bottom: 3px;
    background: #fff; border-radius: 50%; box-shadow: 0 1px 3px rgba(0,0,0,.3); transition: transform .2s; }
.switch input:checked + .switch-track { background: var(--accent); }
.switch input:checked + .switch-track::before { transform: translateX(24px); }
