/* Painel de operação de frota: escuro, denso e legível. Dois acentos — âmbar (receita, em aberto, ação)
     e verde-água (custos, confirmando). Verde e vermelho ficam reservados a pago/vencida. Sem emoji. */
  /* Identidade MRF (guia de marca 1.0, set/2026): preto quente, dourado chapado para receita e ação,
     azul para custos e "confirmando", verde pago, laranja atenção, vermelho vencida. Sem tema claro: o preto é a marca. */
  :root {
    color-scheme: dark;
    --bg: #0A0908; --surface: #181613; --surface-2: #1E1B17; --surface-3: #23201C; --border: #37322B; --border-2: #4A443B; --grid: #2A2621;
    --text: #F3EFE7; --text-2: #B9B2A6; --text-3: #8E877C; --text-4: #625B50;
    --accent: #C9A14A; --accent-ink: #0A0908; --accent-bg: #292113; --accent-hover: #B08C3C; --accent-dark: #8E6C2C; --link: #E2C47E;
    --teal: #5AA2F0; --teal-bg: #17212D;
    --good: #4CC38A; --good-bg: #15271D;
    --warn: #FF6A2B; --warn-bg: #31190E;
    --serious: #FF6A2B; --serious-bg: #31190E;
    --crit: #F0596C; --crit-bg: #2F1618;
    --c-frete: #C9A14A; --c-custos: #5AA2F0; --c-neg: #F0596C; --c-3: #3CC6B7; --c-4: #E07AA0; --c-5: #D9CFBD; --c-6: #A78BFA;
    --font: 'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --display: 'Archivo', 'Arial Black', var(--font);
    --mono: 'IBM Plex Mono', ui-monospace, Consolas, monospace;
    --radius: 12px;
  }
  * { box-sizing: border-box; }
  [hidden] { display: none !important; }
  html, body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.45 var(--font); -webkit-text-size-adjust: 100%; }
  a { color: var(--link); text-decoration: none; }
  a:hover { text-decoration: underline; }
  button, input, select { font: inherit; }
  h1, h2, h3 { font-family: var(--display); font-weight: 800; font-stretch: 118%; letter-spacing: -0.01em; }
  .display { font-family: var(--display); }
  .mono { font-family: var(--mono); font-size: 12px; }
  .sp { flex: 1; }
  .muted { color: var(--text-3); }
  .empty { padding: 26px 16px; color: var(--text-3); text-align: center; }

  /* ---------- casca: barra lateral + conteúdo ---------- */
  .app { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100vh; }
  .side { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 6px; padding: 22px 14px; background: var(--surface); border-right: 1px solid var(--border); }
  .brand { display: flex; align-items: center; gap: 12px; padding: 4px 8px 18px 8px; }
  .brand .logo { height: 20px; width: auto; display: block; }
  .brand .logo img { height: 20px; width: auto; display: block; }
  .brand .name { font-family: var(--display); font-weight: 700; font-stretch: 112%; font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--text-3); padding-left: 10px; border-left: 1px solid var(--border); line-height: 1.2; }
  .brand .sub { font-size: 12px; color: var(--text-3); }
  .side nav { display: flex; flex-direction: column; gap: 4px; }
  .side nav a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; color: var(--text-2); font-weight: 500; }
  .side nav a:hover { background: var(--surface-2); text-decoration: none; color: var(--text); }
  .side nav a.on { background: var(--surface-3); color: var(--text); box-shadow: inset 3px 0 0 var(--accent); }
  .side nav a svg { flex: 0 0 auto; }
  .side nav a .lbl { flex: 1; }
  .badge { min-width: 22px; height: 22px; padding: 0 7px; border-radius: 11px; background: var(--accent); color: var(--accent-ink); font-size: 12px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; }
  .status { margin-top: auto; display: flex; flex-direction: column; gap: 8px; padding: 14px; border-radius: 12px; background: var(--bg); border: 1px solid var(--border); font-size: 13px; }
  .status .l { display: flex; align-items: center; gap: 8px; color: var(--text-2); font-size: 12px; }
  .status .l b { color: var(--text); font-weight: 500; font-size: 13px; }
  .status .row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding-top: 8px; border-top: 1px solid var(--border); }
  .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--text-4); flex: 0 0 auto; }
  .dot.on { background: var(--good); } .dot.mid { background: var(--accent); } .dot.off { background: var(--crit); }
  main { padding: 24px 32px 40px; display: flex; flex-direction: column; gap: 18px; max-width: 1440px; }
  main > * { min-width: 0; }
  .mobilebar, .tabs { display: none; }

  @media (max-width: 899px) {
    .app { grid-template-columns: 1fr; }
    .side { display: none; }
    .mobilebar { display: flex; align-items: center; gap: 10px; padding: 12px 16px; position: sticky; top: 0; z-index: 5; background: var(--surface); border-bottom: 1px solid var(--border); }
    .mobilebar .logo { height: 18px; width: auto; display: block; }
    .mobilebar .logo img { height: 18px; width: auto; display: block; }
    .mobilebar .name { font-family: var(--display); font-weight: 700; font-stretch: 112%; font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--text-3); padding-left: 10px; border-left: 1px solid var(--border); }
    main { padding: 14px 16px 92px; gap: 14px; }
    .tabs { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); position: fixed; bottom: 0; left: 0; right: 0; z-index: 5; padding: 8px 6px calc(10px + env(safe-area-inset-bottom)); background: var(--surface); border-top: 1px solid var(--border); }
    .tabs a { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 6px 0; color: var(--text-2); font-size: 11px; font-weight: 500; position: relative; }
    .tabs a:hover { text-decoration: none; }
    .tabs a.on { color: var(--accent); }
    .tabs .badge { position: absolute; top: 0; right: calc(50% - 22px); min-width: 18px; height: 18px; font-size: 11px; }
  }

  /* ---------- avisos ---------- */
  .banner { padding: 10px 14px; border-radius: 10px; font-size: 13px; display: flex; gap: 10px; align-items: flex-start; border: 1px solid transparent; }
  .banner::before { content: ''; width: 8px; height: 8px; border-radius: 50%; margin-top: 6px; flex: 0 0 auto; background: currentColor; }
  .banner.warn { background: var(--warn-bg); color: var(--warn); }
  .banner.crit { background: var(--crit-bg); color: var(--crit); }
  .banner.info { background: var(--teal-bg); color: var(--teal); }
  .banner code { background: rgba(0,0,0,.15); padding: 1px 5px; border-radius: 4px; font-family: var(--mono); font-size: 12px; }
  .banner a { color: inherit; text-decoration: underline; }

  /* ---------- blocos ---------- */
  .toolbar { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
  .toolbar h1 { margin: 0; font-size: 24px; line-height: 1.1; }
  .toolbar .sub { font-size: 13px; color: var(--text-3); }
  .toolbar .ttl { display: flex; flex-direction: column; gap: 2px; }
  .grid { display: grid; gap: 14px; }
  .grid > * { min-width: 0; }
  .g12 { grid-template-columns: repeat(12, minmax(0, 1fr)); }
  .c2 { grid-column: span 2; } .c3 { grid-column: span 3; } .c4 { grid-column: span 4; } .c5 { grid-column: span 5; } .c6 { grid-column: span 6; } .c7 { grid-column: span 7; } .c8 { grid-column: span 8; } .c12 { grid-column: span 12; }
  @media (max-width: 1199px) { .c2 { grid-column: span 3; } .c3 { grid-column: span 4; } .c4.hero-col { grid-column: span 12; } .c5, .c7 { grid-column: span 12; } .c8, .c4.side-col { grid-column: span 12; } }
  @media (max-width: 899px) { .c2, .c3, .c4 { grid-column: span 6; } .c4.hero-col { grid-column: span 12; } .c6 { grid-column: span 12; } }
  .card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
  .card.warm { border-color: var(--accent); }
  .card.teal { border-color: var(--teal); }
  .card .head { display: flex; align-items: center; gap: 10px; padding: 13px 20px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
  .card .head h2 { font-size: 12px; margin: 0; font-family: var(--display); font-weight: 700; font-stretch: 112%; letter-spacing: .08em; text-transform: uppercase; color: var(--text-2); }
  .card .head .n { color: var(--text-3); font-size: 12px; }
  .card .body { padding: 16px 20px; }
  .tile { padding: 16px 18px; display: flex; flex-direction: column; gap: 4px; }
  .tile .label { color: var(--text-2); font-size: 13px; }
  .tile .value { font-family: var(--mono); font-weight: 600; font-variant-numeric: tabular-nums; font-size: clamp(17px, 1.5vw, 23px); line-height: 1.1; letter-spacing: -0.01em; white-space: nowrap; }
  .tile.hero .value { font-weight: 600; font-size: clamp(28px, 2.9vw, 40px); line-height: 1.1; letter-spacing: -0.01em; color: var(--accent); }
  .tile .sub { color: var(--text-3); font-size: 12px; }
  .tile .value.neg { color: var(--crit); }
  .seg { display: inline-flex; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 3px; }
  .seg button { border: 0; background: transparent; color: var(--text-2); height: 32px; padding: 0 12px; border-radius: 8px; cursor: pointer; font-size: 13px; }
  .seg button.on { background: var(--surface-3); color: var(--text); font-weight: 500; }
  .pill { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 500; white-space: nowrap; }
  .pill i.d { width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: 0 0 auto; }
  .pill .ic { font-style: normal; font-size: 11px; line-height: 1; flex: 0 0 auto; }
  .pill.good { background: var(--good-bg); color: var(--good); }
  .pill.warn { background: var(--warn-bg); color: var(--warn); }
  .pill.serious { background: var(--serious-bg); color: var(--serious); }
  .pill.crit { background: var(--crit-bg); color: var(--crit); }
  .pill.teal { background: var(--teal-bg); color: var(--teal); }
  .pill.accent { background: var(--accent-bg); color: var(--accent); }
  .pill.muted { background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border); }
  .pill.good, .pill.warn, .pill.serious, .pill.crit, .pill.teal, .pill.accent { border: 1px solid color-mix(in srgb, currentColor 35%, transparent); }
  .pill.muted i.d { background: var(--text-3); }
  button.pill { border: 0; cursor: pointer; }
  .placa { font-family: var(--mono); font-size: 12px; font-weight: 600; letter-spacing: .04em; color: var(--text-2); padding: 1px 6px; border-radius: 4px; background: var(--surface-3); border: 1px solid var(--border-2); white-space: nowrap; }
  .btn { height: 36px; padding: 0 14px; border-radius: 9px; border: 1px solid var(--border-2); background: var(--surface-3); color: var(--text); cursor: pointer; font-size: 13px; font-weight: 500; display: inline-flex; align-items: center; justify-content: center; gap: 6px; white-space: nowrap; }
  .btn:hover { border-color: var(--text-3); }
  .btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
  .btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
  .btn.ghost { background: transparent; color: var(--text-2); border-color: var(--border); }
  .btn:focus-visible, .tog:focus-visible, .sel:focus-visible, a:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--link); }
  .btn.danger:hover { border-color: var(--crit); color: var(--crit); }
  .btn.sm { height: 32px; padding: 0 11px; font-size: 12px; }
  .btn:disabled { opacity: .5; cursor: default; }
  .acts-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

  /* ---------- tabelas ---------- */
  .wrap { overflow-x: auto; }
  table { width: 100%; border-collapse: collapse; }
  th, td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; white-space: nowrap; }
  th { font-family: var(--display); font-weight: 700; font-stretch: 112%; color: var(--text-3); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; }
  td.num, th.num { text-align: right; }
  td.num { font-family: var(--mono); font-size: 13px; }
  td.w { white-space: normal; }
  tbody tr:last-child td { border-bottom: 0; }
  tr.total td { font-weight: 600; background: var(--bg); }
  @media (max-width: 720px) {
    table.cards, table.cards tbody, table.cards tr, table.cards td { display: block; }
    table.cards thead { display: none; }
    table.cards tr { padding: 10px 16px; border-bottom: 1px solid var(--border); }
    table.cards td { border: 0; padding: 3px 0; white-space: normal; display: flex; gap: 10px; justify-content: space-between; align-items: center; }
    table.cards td::before { content: attr(data-l); color: var(--text-3); font: 12px var(--font); flex: 0 0 34%; text-align: left; }
    table.cards td > * { min-width: 0; }
    table.cards td:not([data-l])::before { content: none; }
    table.cards td.actions { justify-content: flex-end; padding-top: 8px; }
  }

  /* ---------- gráficos ---------- */
  .chart { position: relative; }
  .chart svg { display: block; width: 100%; height: auto; overflow: visible; }
  .chart .legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--text-2); margin-bottom: 8px; }
  .chart .legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
  .chart .grid-line { stroke: var(--grid); stroke-width: 1; }
  .chart .axis { fill: var(--text-3); font-size: 11px; font-family: var(--mono); }
  .chart .base { stroke: var(--border-2); stroke-width: 1; }
  .chart .lbl { fill: var(--text-2); font-size: 12px; }
  .chart .lbl.v { font-family: var(--mono); font-size: 11px; }
  .chart .bar { stroke: var(--surface); stroke-width: 1; }
  .chart .hit { fill: transparent; }
  .chart .hit:hover + g .bar { filter: brightness(1.12); }
  .tip { position: fixed; z-index: 20; pointer-events: none; background: var(--text); color: var(--bg); padding: 6px 9px; border-radius: 7px; font-size: 12px; line-height: 1.4; box-shadow: 0 4px 16px rgba(0,0,0,.3); opacity: 0; transition: opacity .1s; max-width: 260px; }
  .tip.on { opacity: 1; }

  /* ---------- despesas (pendências) ---------- */
  .despesa { display: flex; flex-direction: column; gap: 12px; padding: 16px 18px; }
  .despesa .top { display: flex; align-items: flex-start; gap: 14px; }
  .despesa .who { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
  .despesa .who .nm { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 16px; font-weight: 600; }
  .despesa .who .nm .tp { font-size: 13px; color: var(--text-3); font-weight: 400; }
  .despesa .who .det { font-size: 13px; color: var(--text-3); }
  .despesa .val { display: flex; flex-direction: column; align-items: flex-end; flex: 0 0 auto; }
  .despesa .val b { font-family: var(--display); font-weight: 600; font-size: 22px; line-height: 1; }
  .despesa .val span { font-size: 12px; color: var(--text-3); }
  .etapa { display: flex; align-items: center; gap: 8px; padding: 9px 12px; border-radius: 10px; background: var(--bg); border: 1px solid var(--border); font-size: 13px; color: var(--text-2); }
  .etapa.teal { border-color: var(--teal); }
  .avatar { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; font-family: var(--display); font-weight: 700; font-size: 14px; color: #0A0908; background: var(--teal); flex: 0 0 auto; }
  @media (max-width: 600px) { .despesa .top { flex-wrap: wrap; } .despesa .val { align-items: flex-start; width: 100%; flex-direction: row; gap: 8px; align-items: baseline; } }

  /* ---------- motoristas ---------- */
  .drivers { grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
  .driver { padding: 16px; cursor: pointer; display: grid; gap: 10px; }
  .driver:hover { border-color: var(--text-3); }
  .driver .w { display: flex; gap: 12px; align-items: center; }
  .driver .w > div { min-width: 0; flex: 1; }
  .driver .name { font-size: 15px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .driver .sub { color: var(--text-3); font-size: 12px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
  .driver .stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; padding-top: 10px; border-top: 1px solid var(--border); }
  .driver .stats div { font-size: 11px; color: var(--text-3); min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .driver .stats b { display: block; color: var(--text); font-size: 13px; font-weight: 500; font-family: var(--mono); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
  .driver .stats b.neg { color: var(--crit); }
  .driver .tags { display: flex; gap: 6px; flex-wrap: wrap; }
  .profile { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; padding: 18px 20px; }
  .profile .avatar { width: 56px; height: 56px; font-size: 19px; border-radius: 16px; }
  .profile h1 { margin: 0; font-size: 24px; }
  .profile .line { color: var(--text-2); font-size: 13px; display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
  .profile > div { flex: 1 1 200px; }
  @media (max-width: 600px) { .profile .btn { width: 100%; } }

  /* ---------- interruptores, decisões, falas ---------- */
  .switch { display: flex; gap: 12px; align-items: flex-start; padding: 14px 18px; }
  .switch + .switch { border-top: 1px solid var(--border); }
  .switch .txt { flex: 1; min-width: 0; }
  .switch .txt b { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 14px; }
  .switch .txt span { color: var(--text-2); font-size: 13px; }
  .tog { flex: 0 0 auto; width: 44px; height: 26px; border-radius: 999px; border: 0; background: var(--border-2); position: relative; cursor: pointer; transition: background .15s; margin-top: 2px; padding: 0; }
  .tog::after { content: ''; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 3px rgba(0,0,0,.3); }
  .tog.on { background: var(--good); } .tog.on::after { transform: translateX(18px); }
  .tog.sm { width: 40px; height: 22px; margin: 0; } .tog.sm::after { width: 16px; height: 16px; } .tog.sm.on::after { transform: translateX(18px); }
  .decisao { display: grid; grid-template-columns: auto 1fr; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
  .decisao:last-child { border-bottom: 0; }
  .decisao .q { font-weight: 600; margin-bottom: 2px; }
  .decisao .ops { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
  .decisao > div { min-width: 0; }
  .decisao .ops .btn { justify-content: space-between; gap: 10px; width: 100%; height: auto; min-height: 40px; padding: 8px 12px; text-align: left; white-space: normal; background: var(--bg); border-color: var(--border); }
  .decisao .ops .btn > span:first-child { flex: 1; min-width: 0; overflow-wrap: anywhere; }
  .decisao .ops .btn .mono { color: var(--text-2); }
  .fala { padding: 10px 18px; border-bottom: 1px solid var(--border); display: grid; gap: 4px; }
  .fala:last-child { border-bottom: 0; }
  .fala .t { white-space: pre-wrap; font-size: 13px; }
  .fala .m { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 12px; color: var(--text-3); }
  .timeline { display: flex; flex-direction: column; gap: 12px; padding: 16px 18px; font-size: 13px; }
  .timeline .ev { display: flex; gap: 10px; }
  .timeline .ev .dot { margin-top: 6px; }
  .timeline .ev .c { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
  .timeline .ev .c .h { color: var(--text-3); font-size: 12px; }
  .timeline .ev .c .b { white-space: pre-wrap; overflow-wrap: anywhere; }

  /* ---------- conexão ---------- */
  .steps { display: grid; gap: 12px; }
  .opcoes { display: grid; gap: 8px; margin: 2px 0 10px; }
  .opcoes label { display: grid; grid-template-columns: 18px 1fr; gap: 10px; align-items: start; padding: 10px 12px; border: 1px solid var(--border-2); border-radius: 10px; cursor: pointer; }
  .opcoes label:has(input:checked) { border-color: var(--accent); background: var(--surface-2); }
  .step .opcoes input { height: auto; margin: 3px 0 0; padding: 0; accent-color: var(--accent); }
  .opcoes b { display: block; font-size: 13px; font-weight: 600; }
  .opcoes small { display: block; color: var(--text-2); font-size: 12px; margin-top: 2px; line-height: 1.4; }
  .form-planilha { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 10px; align-items: end; }
  .form-planilha .acts-row { grid-column: 1 / -1; }
  @media (max-width: 720px) { .form-planilha { grid-template-columns: 1fr; } }
  .step { display: grid; grid-template-columns: 32px 1fr; gap: 14px; padding: 16px 18px; }
  .step .num { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-weight: 600; font-size: 13px; background: var(--surface-2); border: 1px solid var(--border-2); color: var(--text-2); }
  .step.done .num { background: var(--good-bg); border-color: transparent; color: var(--good); }
  .step.todo { opacity: .55; }
  .step > div { min-width: 0; }
  .step p, .step code { overflow-wrap: anywhere; }
  .step code { font-family: var(--mono); font-size: 12px; background: var(--surface-3); padding: 1px 5px; border-radius: 4px; }
  .step h3 { margin: 3px 0 4px; font-size: 14px; font-family: var(--font); font-weight: 600; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
  .step p { margin: 0 0 8px; color: var(--text-2); font-size: 13px; }
  .step .acts { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 8px; }
  .step input, .switch input { height: 36px; padding: 0 10px; border-radius: 9px; border: 1px solid var(--border-2); background: var(--bg); color: var(--text); font-size: 14px; min-width: 0; }
  .qrbox { display: flex; gap: 18px; flex-wrap: wrap; align-items: center; margin-top: 10px; }
  .qrbox img { width: 240px; height: 240px; border-radius: 12px; background: #fff; padding: 10px; border: 1px solid var(--border); image-rendering: pixelated; }
  .qrbox ol { margin: 0; padding-left: 18px; color: var(--text-2); font-size: 13px; line-height: 1.7; }
  .code { font: 600 26px/1 var(--mono); letter-spacing: .18em; padding: 10px 14px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border-2); display: inline-block; }
  .groups { display: grid; gap: 6px; max-height: 320px; overflow-y: auto; margin-top: 8px; }
  .groups button, .groups .item { text-align: left; display: flex; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 9px; border: 1px solid var(--border); background: var(--bg); color: var(--text); cursor: pointer; font: inherit; }
  .groups button:hover { border-color: var(--text-3); }
  .groups button.sel { border-color: var(--accent); background: var(--accent-bg); }
  .groups .gn { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }

  /* ---------- modal / form ---------- */
  dialog { border: 1px solid var(--border); border-radius: 14px; background: var(--surface); color: var(--text); padding: 0; max-width: min(94vw, 440px); width: 100%; box-shadow: 0 20px 60px rgba(0,0,0,.4); }
  dialog::backdrop { background: rgba(0,0,0,.55); }
  dialog .head { padding: 14px 18px; border-bottom: 1px solid var(--border); font-weight: 600; display: flex; align-items: center; }
  dialog form { padding: 16px 18px; display: grid; gap: 12px; }
  dialog .foot { display: flex; gap: 8px; justify-content: flex-end; padding-top: 4px; }
  label.f { display: grid; gap: 4px; font-size: 12px; color: var(--text-2); }
  label.f input, label.f select { height: 40px; padding: 0 10px; border-radius: 9px; border: 1px solid var(--border-2); background: var(--bg); color: var(--text); font-size: 14px; }
  label.f input:focus, label.f select:focus, .step input:focus, .switch input:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }
  label.f input[readonly] { background: var(--surface-2); color: var(--text-2); }
  .err { color: var(--crit); font-size: 13px; min-height: 1em; }
  dialog.viewer { max-width: min(94vw, 900px); width: auto; }
  dialog.viewer img { display: block; max-width: 90vw; max-height: 85vh; }
  dialog.viewer iframe { width: 80vw; height: 80vh; border: 0; display: block; }
  .thumb { width: 44px; height: 44px; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); background: var(--surface-2); display: block; }
  a.thumb.pdf { display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 600; color: var(--text-2); text-decoration: none; }
  .thumb.lg { width: 56px; height: 72px; }
  .toast { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 8px 14px; border-radius: 8px; font-size: 13px; opacity: 0; transition: opacity .2s; pointer-events: none; z-index: 30; }
  .toast.on { opacity: 1; }
  @media (max-width: 899px) { .toast { bottom: 86px; } }

/* ---------- complementos: filtros, menu "Mais", impressão, login ---------- */
.sel { height: 36px; padding: 0 30px 0 10px; border-radius: 9px; border: 1px solid var(--border-2); background: var(--surface-3); color: var(--text); font-size: 13px; max-width: 220px; }
.sel:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }
a.btn { text-decoration: none; }
a.btn:hover { text-decoration: none; }
a.placa { text-decoration: none; }
tr.inativa td { opacity: .55; }
.tog:disabled { opacity: .5; cursor: default; }
.brand .logo, .mobilebar .logo { flex: 0 0 auto; }
.mais { display: none; }
@media (max-width: 899px) {
  .tabs a.on { color: var(--accent); }
  .mais { position: fixed; left: 12px; right: 12px; bottom: calc(74px + env(safe-area-inset-bottom)); z-index: 6; background: var(--surface); border: 1px solid var(--border-2); border-radius: 14px; box-shadow: 0 12px 40px rgba(0,0,0,.45); padding: 6px; display: none; grid-template-columns: 1fr 1fr; gap: 4px; }
  .mais.on { display: grid; }
  .mais a { display: block; padding: 12px 14px; border-radius: 10px; color: var(--text); font-weight: 500; }
  .mais a:hover { background: var(--surface-2); text-decoration: none; }
  .mais a.on { background: var(--surface-3); color: var(--accent); }
  .mais a.danger { color: var(--crit); }
  .toolbar .sel { max-width: 100%; flex: 1 1 140px; }
}
.print-head, .print-foot { display: none; }
@media print {
  .side, .tabs, .mobilebar, .mais, .toast, .tip, .no-print { display: none !important; }
  .print-head { display: flex; align-items: center; gap: 14px; padding-bottom: 10px; margin-bottom: 14px; border-bottom: 2pt solid #C9A14A; }
  .print-head img { height: 22px; }
  .print-head .rz { font: 700 11px var(--display); letter-spacing: .08em; text-transform: uppercase; color: #333; }
  .print-foot { display: block; margin-top: 18px; padding-top: 8px; border-top: 1pt solid #ccc; font-size: 10px; color: #555; }
  :root { color-scheme: light; --bg: #fff; --surface: #fff; --surface-2: #f4f4f4; --surface-3: #eee; --border: #ccc; --border-2: #bbb; --text: #000; --text-2: #333; --text-3: #555; --accent: #000; --accent-ink: #fff; --accent-bg: #eee; --teal: #333; --teal-bg: #eee; --good: #000; --good-bg: #eee; --warn: #000; --warn-bg: #eee; --crit: #000; --crit-bg: #eee; }
  html, body { background: #fff; color: #000; font-size: 11px; }
  .app { display: block; }
  main { padding: 0; max-width: none; }
  .card { border: 1px solid #ccc; box-shadow: none; break-inside: avoid; }
  .tile .value, .tile.hero .value { color: #000 !important; }
  th, td { padding: 4px 8px; }
  .grid.g12 { gap: 8px; }
}

/* ---------- bot: comportamento e mensagens ---------- */
.prazo { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.prazo input { width: 90px; height: 36px; padding: 0 10px; border-radius: 9px; border: 1px solid var(--border-2); background: var(--bg); color: var(--text); font-family: var(--mono); font-size: 13px; text-align: right; }
.fala-item { padding: 14px 18px; border-bottom: 1px solid var(--border); display: grid; gap: 6px; }
.fala-item:last-child { border-bottom: 0; }
.fala-item .fi-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.fala-item .fi-quando { color: var(--text-3); font-size: 12px; }
pre.previa { margin: 0; padding: 10px 12px; border-radius: 10px; background: var(--bg); border: 1px solid var(--border); font: 13px/1.5 var(--font); white-space: pre-wrap; overflow-wrap: anywhere; color: var(--text-2); }
.form-fala textarea { min-height: 120px; padding: 10px; border-radius: 9px; border: 1px solid var(--border-2); background: var(--bg); color: var(--text); font: 14px/1.5 var(--font); resize: vertical; }
.form-fala textarea:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }
.vars { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1px solid var(--border-2); background: var(--surface-3); color: var(--text); border-radius: 999px; padding: 3px 10px; font: 12px var(--mono); cursor: pointer; }
.chip:hover { border-color: var(--accent); color: var(--accent); }
dialog.form-fala-wide { max-width: min(94vw, 560px); }

/* ---------- alertas e confirmações ---------- */
.alertas { list-style: none; margin: 0; padding: 8px 12px 12px; display: grid; gap: 8px; }
.alertas li { display: grid; grid-template-columns: auto 1fr; gap: 10px; align-items: center; padding: 10px 12px; border-radius: 10px; background: var(--bg); border: 1px solid var(--border); border-left: 3px solid var(--text-3); cursor: default; }
.alertas li[data-link] { cursor: pointer; }
.alertas li.crit { border-left-color: var(--crit); }
.alertas li.warn { border-left-color: var(--warn); }
.alertas li .al-d { font-size: 13px; color: var(--text-2); }
.confirmacao { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; padding: 10px 12px; border-radius: 10px; background: var(--teal-bg); border: 1px solid var(--teal); }
.confirmacao .cf-t { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 160px; }

/* ---------- marca: logo e login ---------- */
.login .brand { flex-direction: column; gap: 14px; }
.login .brand img.metalica { width: min(320px, 78vw); height: auto; display: block; }
.login .brand .name { border-left: 0; padding-left: 0; }
.fala-item .fi-head b, .despesa .who .nm { font-family: var(--font); }
