/* RodoBI - app web responsivo */
:root {
  color-scheme: light;
  --page: #f9f9f7;
  --surface-1: #fcfcfb;
  --surface-2: #ffffff;
  --text-primary: #0b0b0b;
  --text-secondary: #52514e;
  --text-muted: #898781;
  --grid: #e1e0d9;
  --baseline: #c3c2b7;
  --border: rgba(11, 11, 11, 0.10);
  --hover: rgba(11, 11, 11, 0.05);
  --series-1: #2a78d6;
  --series-1-wash: rgba(42, 120, 214, 0.10);
  --series-1-track: #cde2fb;
  --good: #0ca30c;
  --good-text: #006300;
  --warning: #fab219;
  --serious: #ec835a;
  --critical: #d03b3b;
  --accent: #2a78d6;
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 4px 16px rgba(0,0,0,.05);
  --radius: 12px;
  /* paleta categórica (ordem fixa, validada: CVD e visão normal) - pizza */
  --cat-1: #257de0; --cat-2: #f47230; --cat-3: #00b894; --cat-4: #f2a600; --cat-5: #ee7fac; --cat-6: #008a17;
  --cat-outros: #b4b2a9;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --page: #0d0d0d;
    --surface-1: #1a1a19;
    --surface-2: #222221;
    --text-primary: #f0efec;
    --text-secondary: #c3c2b7;
    --text-muted: #898781;
    --grid: #2c2c2a;
    --baseline: #383835;
    --border: rgba(255, 255, 255, 0.10);
    --hover: rgba(255, 255, 255, 0.06);
    --series-1: #3987e5;
    --series-1-wash: rgba(57, 135, 229, 0.12);
    --series-1-track: #184f95;
    --good-text: #0ca30c;
    --shadow: none;
    --cat-1: #338ced; --cat-2: #e76624; --cat-3: #00a888; --cat-4: #d28e05; --cat-5: #e24d8b; --cat-6: #0aac23;
    --cat-outros: #5f5e5a;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { background: var(--page); color: var(--text-primary); font-size: 14px; line-height: 1.4; -webkit-text-size-adjust: 100%; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.muted { color: var(--text-muted); }
.sec { color: var(--text-secondary); }
.num { font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------ login */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card { width: 100%; max-width: 380px; background: var(--surface-1); border: 1px solid var(--border); border-radius: 16px; padding: 32px 28px; box-shadow: var(--shadow); }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 18px; letter-spacing: -.01em; }
.brand-mark { width: 28px; height: 28px; border-radius: 8px; background: var(--accent); display: grid; place-items: center; color: #fff; }
.brand-mark svg { width: 18px; height: 18px; }
.login-card h1 { font-size: 20px; margin: 24px 0 4px; }
.login-card p { margin: 0 0 20px; color: var(--text-secondary); }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 13px; color: var(--text-secondary); }
.input, .select { height: 40px; padding: 0 12px; border-radius: 8px; border: 1px solid var(--baseline); background: var(--surface-2); outline: none; width: 100%; }
.input:focus, .select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--series-1-wash); }
.btn { height: 40px; padding: 0 16px; border-radius: 8px; border: 1px solid var(--baseline); background: var(--surface-2); font-weight: 500; display: inline-flex; align-items: center; justify-content: center; gap: 6px; white-space: nowrap; }
.btn:hover { background: var(--hover); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { filter: brightness(1.08); background: var(--accent); }
.btn-perigo { color: var(--serious); } .btn-perigo:hover { background: var(--serious); border-color: var(--serious); color: #fff; }
.btn-sm { height: 32px; padding: 0 10px; font-size: 13px; }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-block { width: 100%; }
/* login: mostrar senha, manter conectado, recuperar senha */
.senha-wrap { position: relative; }
.senha-wrap .input { padding-right: 44px; }
.olho { position: absolute; right: 4px; top: 4px; width: 32px; height: 32px; border: 0; border-radius: 6px; background: transparent; color: var(--text-secondary); display: grid; place-items: center; cursor: pointer; }
.olho:hover { color: var(--text-primary); background: var(--series-1-wash); }
.olho:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.olho svg { width: 18px; height: 18px; }
.olho .o-fechado { display: none; }
.olho[aria-pressed="true"] .o-aberto { display: none; }
.olho[aria-pressed="true"] .o-fechado { display: inline; }
.login-opcoes { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: -2px 0 14px; flex-wrap: wrap; }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-secondary); cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--accent); margin: 0; }
.link { border: 0; background: none; padding: 0; color: var(--accent); font-size: 13px; cursor: pointer; }
.link:hover { text-decoration: underline; }
.input.codigo { font-size: 20px; letter-spacing: 8px; text-align: center; font-variant-numeric: tabular-nums; }
.dica-campo { font-size: 12px; color: var(--text-secondary); }
.login-card .ok { color: var(--text-secondary); font-size: 13px; margin: 0 0 10px; }
.login-card .ok:empty { display: none; }
.btn:disabled { opacity: .55; cursor: default; }
.erro { color: var(--critical); font-size: 13px; min-height: 18px; margin: 4px 0 10px; }

/* ------------------------------------------------------------ topo */
.topbar { position: sticky; top: 0; z-index: 20; background: var(--surface-1); border-bottom: 1px solid var(--border); }
.topbar-inner { max-width: 1400px; margin: 0 auto; padding: 0 20px; height: 56px; display: flex; align-items: center; gap: 16px; }
.tabs { display: flex; gap: 4px; margin-left: 12px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { height: 36px; padding: 0 14px; border-radius: 8px; border: 0; background: transparent; color: var(--text-secondary); font-weight: 500; white-space: nowrap; }
.tab:hover { background: var(--hover); }
.tab.ativo { background: var(--series-1-wash); color: var(--text-primary); }
.topbar .espaco { flex: 1; }
.user-chip { display: flex; align-items: center; gap: 10px; }
.user-chip .info { text-align: right; line-height: 1.2; }
.user-chip .nome { font-weight: 600; font-size: 13px; }
.user-chip .perfil { font-size: 12px; color: var(--text-muted); }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--series-1-wash); display: grid; place-items: center; font-weight: 600; font-size: 13px; }

/* ------------------------------------------------------------ filtros */
.filtros { max-width: 1400px; margin: 0 auto; padding: 14px 20px 6px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.filtros .periodo { display: flex; gap: 6px; align-items: center; }
.filtros input[type=date] { height: 36px; width: 140px; }
.filtros .select { height: 36px; width: auto; }
.filtro-toggle { display: none; }
.filtros-extra { display: contents; }
.atualizado { margin-left: auto; font-size: 12px; color: var(--text-muted); }

.ms { position: relative; }
.ms-btn { height: 36px; padding: 0 10px 0 12px; border-radius: 8px; border: 1px solid var(--baseline); background: var(--surface-2); display: inline-flex; align-items: center; gap: 6px; max-width: 240px; }
.ms-btn .ms-lbl { color: var(--text-muted); }
.ms-btn .ms-val { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ms-btn.on { border-color: var(--accent); background: var(--series-1-wash); }
.ms-btn svg { width: 14px; height: 14px; flex: none; color: var(--text-muted); }
.ms-pop { position: absolute; top: 40px; left: 0; z-index: 40; width: 300px; max-width: calc(100vw - 24px); background: var(--surface-1); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 8px 32px rgba(0,0,0,.14); padding: 8px; }
.ms-pop .input { height: 34px; margin-bottom: 6px; }
.ms-list { max-height: 280px; overflow: auto; }
.ms-opt { display: flex; align-items: center; gap: 8px; padding: 7px 8px; border-radius: 6px; cursor: pointer; }
.ms-opt:hover { background: var(--hover); }
.ms-opt .chk { width: 16px; height: 16px; flex: none; border-radius: 4px; border: 1.5px solid var(--baseline); display: grid; place-items: center; }
.ms-opt.sel .chk { background: var(--accent); border-color: var(--accent); }
.ms-opt.sel .chk::after { content: ""; width: 8px; height: 4px; border: 2px solid #fff; border-top: 0; border-right: 0; transform: rotate(-45deg) translate(1px, -1px); }
.ms-foot { display: flex; justify-content: space-between; border-top: 1px solid var(--border); margin-top: 6px; padding-top: 6px; }

/* ------------------------------------------------------------ conteúdo */
main { max-width: 1400px; margin: 0 auto; padding: 8px 20px 40px; }
.aviso { background: var(--series-1-wash); border-radius: 10px; padding: 10px 14px; margin: 6px 0 12px; color: var(--text-secondary); font-size: 13px; }
.aviso.ok-km { background: rgba(12,163,12,.10); color: var(--good-text); }
.sit-resumo { display: flex; flex-wrap: wrap; gap: 6px 24px; font-size: 13px; color: var(--text-secondary); margin: 2px 0 12px; } .sit-resumo b { color: var(--text-primary, inherit); }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(165px, 1fr)); gap: 12px; margin: 8px 0 16px; }
.kpi { background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); min-height: 96px; }
.kpi .lbl { font-size: 13px; color: var(--text-secondary); }
.kpi .val { font-size: 26px; font-weight: 600; letter-spacing: -.02em; margin-top: 4px; white-space: nowrap; }
.kpi .sub { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.kpi .delta { font-size: 12px; margin-top: 4px; display: inline-flex; gap: 4px; align-items: center; }
.delta.bom { color: var(--good-text); }
.delta.ruim { color: var(--critical); }
.delta.neutro { color: var(--text-muted); }
.kpi.hero { grid-column: span 2; }
.kpi.hero .val { font-size: 34px; }

.grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 16px; }
.span-12 { grid-column: span 12; } .span-8 { grid-column: span 8; } .span-7 { grid-column: span 7; }
.span-6 { grid-column: span 6; } .span-5 { grid-column: span 5; } .span-4 { grid-column: span 4; }
.card { background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); min-width: 0; transition: opacity .15s; }
.card.carregando { opacity: .5; }
.card-h { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.card-h h3 { margin: 0; font-size: 15px; font-weight: 600; }
.card-h .sub { font-size: 12px; color: var(--text-muted); width: 100%; margin-top: -4px; }
.card-h .acoes { margin-left: auto; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.seg { display: inline-flex; border: 1px solid var(--baseline); border-radius: 8px; overflow: hidden; }
.seg button { height: 30px; padding: 0 10px; border: 0; background: transparent; font-size: 12.5px; color: var(--text-secondary); }
.seg button + button { border-left: 1px solid var(--baseline); }
.seg button.on { background: var(--series-1-wash); color: var(--text-primary); font-weight: 600; }
.card .select { height: 30px; font-size: 12.5px; padding: 0 8px; width: auto; }
.ignorados { font-size: 12px; color: var(--text-muted); margin-top: 6px; }
.vazio { padding: 40px 0; text-align: center; color: var(--text-muted); }

/* gráficos */
.chart { position: relative; width: 100%; }
.chart svg { display: block; width: 100%; overflow: visible; }
.chart text { fill: var(--text-muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart .gridline { stroke: var(--grid); stroke-width: 1; shape-rendering: crispEdges; }
.chart .baseline { stroke: var(--baseline); stroke-width: 1; shape-rendering: crispEdges; }
.chart .bar { fill: var(--series-1); }
.chart .bar.hl { filter: brightness(1.15); }
.chart .line { fill: none; stroke: var(--series-1); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .area { fill: var(--series-1-wash); }
.chart .dot { fill: var(--series-1); stroke: var(--surface-1); stroke-width: 2; }
.chart .cross { stroke: var(--baseline); stroke-width: 1; }
.chart .hit { fill: transparent; }
.chart .lbl-val { fill: var(--text-secondary); font-size: 11px; }

.tip { position: fixed; z-index: 100; pointer-events: none; background: var(--surface-1); border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; box-shadow: 0 6px 24px rgba(0,0,0,.16); font-size: 12px; min-width: 120px; }
.tip .t { color: var(--text-muted); margin-bottom: 4px; }
.tip .r { display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.tip .r b { font-size: 13px; color: var(--text-primary); font-variant-numeric: tabular-nums; }
.tip .r span { color: var(--text-secondary); }
.tip .k { width: 12px; height: 2px; background: var(--series-1); display: inline-block; margin-right: 6px; vertical-align: middle; }

/* ranking (barras horizontais) */
.hbars { display: flex; flex-direction: column; gap: 8px; }
.hbar { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; align-items: center; padding: 2px 4px; border-radius: 6px; }
.hbar:hover { background: var(--hover); }
.hbar .nome { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.hbar .valor { font-size: 13px; font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }
.hbar .trilha { grid-column: 1 / -1; height: 8px; position: relative; }
.hbar .barra { position: absolute; left: 0; top: 0; bottom: 0; background: var(--series-1); border-radius: 0 4px 4px 0; min-width: 2px; }
.hbar .barra.serious { background: var(--serious); } .hbar .barra.good { background: var(--good); }
.hbar .extra { font-size: 12px; color: var(--text-muted); font-weight: 400; margin-left: 6px; }

/* tabelas: cabeçalho em faixa, linhas arejadas, números alinhados, destaque no valor principal */
.tabela-wrap { overflow-x: auto; scrollbar-width: thin; }
/* rolagem horizontal: primeira coluna fixa, sombra nas bordas e botão para a direita */
.tabela-box { position: relative; }
.tabela-box::before, .tabela-box::after { content: ""; position: absolute; top: 0; bottom: 0; width: 28px; pointer-events: none; opacity: 0; transition: opacity .15s; z-index: 2; }
.tabela-box::after { right: 0; background: linear-gradient(to left, var(--surface-1), transparent); }
.tabela-box::before { left: var(--col1, 0px); background: linear-gradient(to right, rgba(0,0,0,.08), transparent); width: 10px; }
.tabela-box.tem-dir::after { opacity: 1; }
.tabela-box.rolavel.tem-esq::before { opacity: 1; }
.rolar-dir { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); z-index: 3; width: 32px; height: 32px; border-radius: 50%;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--accent); box-shadow: 0 2px 10px rgba(0,0,0,.15);
  display: none; place-items: center; cursor: pointer; animation: cutuca 1.6s ease-in-out 3; }
.rolar-dir svg { width: 18px; height: 18px; }
.tabela-box.tem-dir .rolar-dir { display: grid; }
@keyframes cutuca { 0%, 100% { transform: translate(0, -50%); } 50% { transform: translate(4px, -50%); } }
@media (prefers-reduced-motion: reduce) { .rolar-dir { animation: none; } }
.tabela-box.rolavel table.t th:first-child, .tabela-box.rolavel table.t td:first-child { position: sticky; left: 0; z-index: 1; background-color: var(--surface-1); }
.tabela-box.rolavel table.t thead th:first-child { background: var(--page); }
.tabela-box.rolavel table.t tr.total td:first-child { background: linear-gradient(var(--series-1-wash), var(--series-1-wash)), var(--surface-1); }
.tabela-box.rolavel table.t tbody tr:hover td:first-child { background: linear-gradient(var(--hover), var(--hover)), var(--surface-1); }
@media print { .rolar-dir, .tabela-box::before, .tabela-box::after { display: none; } }
table.t { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
table.t th { text-align: left; font-weight: 600; color: var(--text-muted); font-size: 11px; text-transform: uppercase; letter-spacing: .05em;
  padding: 9px 12px; background: var(--page); white-space: nowrap; }
table.t thead th:first-child { border-radius: 8px 0 0 8px; }
table.t thead th:last-child { border-radius: 0 8px 8px 0; }
table.t td { padding: 10px 12px; border-bottom: 1px solid var(--grid); white-space: nowrap; color: var(--text-primary); transition: background .1s; }
table.t tbody tr:last-child td { border-bottom: 0; }
table.t td.r, table.t th.r { text-align: right; font-variant-numeric: tabular-nums; }
table.t td.forte { font-weight: 600; }
table.t td.suave { color: var(--text-secondary); }
table.t td.nome { font-weight: 500; }
table.t th.col-total, table.t td.col-total { background: var(--series-1-wash); }
table.t tbody tr:hover td { background: var(--hover); }
table.t tbody tr:hover td.col-total { background: var(--series-1-wash); }
table.t tbody tr.click { cursor: pointer; }
table.t tbody tr.sel td { background: var(--series-1-wash); }
table.t tr.zero td, table.t tr.zero td.forte { color: var(--text-muted); font-weight: 400; }
table.t tr.zero .meter { opacity: .45; }
table.t .traco { color: var(--text-muted); opacity: .6; }
table.t .nm { display: inline-flex; align-items: center; gap: 9px; }
table.t .mk { width: 9px; height: 9px; border-radius: 3px; flex: none; }
table.t .mk.sem { background: transparent; }
table.t tr.total td { font-weight: 700; background: var(--series-1-wash); border-bottom: 0; border-top: 1px solid var(--series-1-track); }
table.t tr.total td:first-child { border-radius: 0 0 0 8px; }
table.t tr.total td:last-child { border-radius: 0 0 8px 0; }
table.t tr.total + tr.pct td { border-top: 0; }
table.t tr.pct td { color: var(--text-muted); font-size: 12px; border-bottom: 0; }
table.t td.sec { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); background: var(--page); border-radius: 8px; }
table.t td.pctcol, table.t th.pctcol { width: 1%; }
.pag { display: flex; align-items: center; gap: 8px; justify-content: flex-end; margin-top: 10px; font-size: 13px; color: var(--text-secondary); }

.meter { display: inline-flex; align-items: center; gap: 10px; }
.meter .num { min-width: 48px; text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.meter .trk { display: inline-block; width: 72px; height: 8px; border-radius: 4px; background: var(--series-1-track); overflow: hidden; }
.meter .fil { display: block; height: 100%; background: var(--series-1); border-radius: 4px; }
.meter .fil.serious { background: var(--serious); } .meter .fil.good { background: var(--good); }
.status { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; }
.status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.status.baixa { color: var(--serious); } .status.alta { color: var(--good-text); } .status.cancel { color: var(--text-muted); }
.badge { display: inline-block; font-size: 11px; padding: 2px 8px; border-radius: 10px; background: var(--hover); color: var(--text-secondary); }
.badge.warn { background: rgba(250,178,25,.18); color: var(--text-primary); }
.badge.erro { background: rgba(208,59,59,.14); color: var(--critical); font-weight: 600; }
.badge.ok { background: rgba(12,163,12,.14); color: var(--good-text); }
.tab .alerta { display: inline-block; min-width: 18px; height: 18px; padding: 0 5px; margin-left: 6px; border-radius: 9px; background: var(--critical);
  color: #fff; font-size: 11px; font-weight: 700; line-height: 18px; text-align: center; vertical-align: 1px; }
table.t .motivo { display: inline-block; max-width: 360px; overflow: hidden; text-overflow: ellipsis; vertical-align: bottom; }

/* modal */
.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 60; display: grid; place-items: center; padding: 16px; }
.modal { background: var(--surface-1); border-radius: 14px; width: 100%; max-width: 640px; max-height: calc(100vh - 32px); overflow: auto; padding: 20px; box-shadow: 0 16px 48px rgba(0,0,0,.25); }
.modal h2 { margin: 0 0 4px; font-size: 18px; }
.modal .fechar { float: right; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; margin-top: 14px; }
.form-grid .full { grid-column: 1 / -1; }
.check { display: flex; align-items: center; gap: 8px; height: 40px; }
.modal-acoes { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.dl { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; margin: 14px 0; }
.dl div { background: var(--page); border-radius: 8px; padding: 8px 10px; }
.dl span { display: block; font-size: 12px; color: var(--text-muted); }
.dl b { font-size: 15px; }

.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--text-primary); color: var(--surface-1); padding: 10px 16px; border-radius: 8px; z-index: 200; font-size: 13px; max-width: 90vw; }

/* boletim */
.boletim-barra { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 14px 0 4px; }
.boletim-barra .select { height: 40px; }
.boletim-cab { margin: 10px 0 2px; }
.boletim-cab h2 { margin: 0; font-size: 20px; }
.fin-2col { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
@media (max-width: 720px) { .fin-2col { grid-template-columns: 1fr; } }

@media print {
  body { background: #fff; font-size: 11px; }
  .topbar, .filtros, .boletim-barra, .card-h .acoes, .aviso { display: none !important; }
  main { max-width: none; padding: 0; }
  .card, .kpi { box-shadow: none; break-inside: avoid; border-color: #ccc; }
  .grid { gap: 8px; }
  .kpi .val { font-size: 18px; }
}

/* ------------------------------------------------------------ responsivo */
@media (max-width: 1000px) {
  .span-8, .span-7, .span-6, .span-5, .span-4 { grid-column: span 12; }
}
@media (max-width: 720px) {
  .topbar-inner { padding: 0 12px; gap: 8px; height: auto; flex-wrap: wrap; padding-top: 8px; }
  .brand span { display: none; }
  .tabs { order: 3; width: 100%; margin: 0 0 6px; }
  .tab { flex: 1; }
  .user-chip .info { display: none; }
  .filtros { padding: 10px 12px 4px; }
  .filtro-toggle { display: inline-flex; }
  .filtros-extra { display: none; }
  .filtros.aberto .filtros-extra { display: flex; flex-wrap: wrap; gap: 8px; width: 100%; }
  .filtros .periodo { width: 100%; flex-wrap: wrap; }
  .filtros .periodo .select { flex: 1 1 100%; height: 40px; }
  .filtros input[type=date] { flex: 1 1 0; width: auto; min-width: 0; height: 40px; }
  .atualizado { width: 100%; margin: 0; }
  main { padding: 8px 12px 32px; }
  .kpis { grid-template-columns: 1fr 1fr; gap: 8px; }
  .kpi { padding: 12px; min-height: 0; }
  .kpi .val { font-size: 20px; }
  .kpi.hero { grid-column: 1 / -1; }
  .kpi.hero .val { font-size: 30px; }
  .card { padding: 12px; }
  .form-grid { grid-template-columns: 1fr; }
  .ms-btn { max-width: 100%; }
}

/* pizza (só no desktop: no celular a tabela basta) */
.pizza { display: flex; align-items: center; gap: 20px; margin: 4px 0 14px; }
.pizza svg { flex: 0 0 auto; overflow: visible; }
.pizza .fatia { stroke: var(--surface-1); stroke-width: 2; stroke-linejoin: round; transition: opacity .12s; cursor: default; }
.pizza-leg { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; min-width: 0; flex: 1 1 auto; max-width: 340px; font-size: 13px; }
.pizza-leg li { display: grid; grid-template-columns: 10px minmax(0, 1fr) auto; align-items: center; gap: 8px; transition: opacity .12s; }
.pizza-leg li.off { opacity: .45; }
.pizza-leg i { width: 10px; height: 10px; border-radius: 2px; }
.pizza-leg .n { color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pizza-leg b { font-weight: 600; font-variant-numeric: tabular-nums; color: var(--text-primary); }
/* celular: pizza menor, legenda ao lado (ou embaixo, se não couber) */
@media (max-width: 899px) {
  .pizza { gap: 14px; flex-wrap: wrap; }
  .pizza svg { width: 128px; height: 128px; }
  .pizza-leg { min-width: 150px; font-size: 12.5px; gap: 5px; }
}
@media print { .pizza { break-inside: avoid; } }

/* iPhone/iPad: o Safari dá zoom ao tocar num campo com fonte menor que 16px e a página
   fica maior que a tela depois disso. Nos aparelhos de toque, todo campo usa 16px. */
@media (pointer: coarse), (max-width: 899px) {
  input:not(.codigo):not([type=checkbox]):not([type=radio]), select, textarea { font-size: 16px; }
  .card .select { height: 34px; font-size: 16px; }
}
.fin-2col table.t tr.total td { border-radius: 0; border-top: 0; }

/* lista de passagens da conferência: quebra o texto longo para a linha caber sem rolar */
.tabela-box.conf-itens table.t { width: 100%; }
.tabela-box.conf-itens table.t td { white-space: normal; vertical-align: top; padding: 8px 10px; }
.tabela-box.conf-itens table.t th { padding: 9px 10px; white-space: normal; }
.tabela-box.conf-itens table.t td.nw, .tabela-box.conf-itens table.t td.r { white-space: nowrap; }
.tabela-box.conf-itens table.t .motivo { display: inline; max-width: none; overflow: visible; white-space: normal; }
.tabela-box.conf-itens.rolavel table.t th:first-child, .tabela-box.conf-itens.rolavel table.t td:first-child { position: static; }
