/* ============================================================
   SMART MIX — acabamento profissional (v50)
   Camada sobre o style.css: mesma identidade (laranja + grafite), com
   tipografia, espaçamento, ícones, tabelas e cartões no padrão de ERP/SaaS.
   ============================================================ */
:root {
  --fundo: #f4f6f8; --painel: #ffffff; --painel-2: #f8fafb; --borda: #e2e7ec; --borda-forte: #cfd7de;
  --texto: #15202b; --suave: #5f6e7b; --apagado: #8794a0;
  --lateral: #18212b; --lateral-2: #1f2a35; --lateral-texto: #b9c6d2; --lateral-titulo: #6f8091;
  --acento: #c25e00; --acento-escuro: #9e4c00; --acento-claro: #fff3e6;
  --raio: 12px; --raio-peq: 8px;
  --sombra-1: 0 1px 2px rgba(16, 24, 32, .06), 0 1px 1px rgba(16, 24, 32, .03);
  --sombra-2: 0 8px 24px rgba(16, 24, 32, .10), 0 2px 6px rgba(16, 24, 32, .05);
  --sombra-3: 0 24px 60px rgba(16, 24, 32, .22);
  --foco: 0 0 0 3px rgba(243, 146, 0, .35);
  --fonte: "Inter", "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --fundo: #0d151d; --painel: #131e29; --painel-2: #172431; --borda: #24323f; --borda-forte: #33465a;
    --texto: #e6edf3; --suave: #98a8b6; --apagado: #6d7e8d;
    --lateral: #0a1219; --lateral-2: #111c26; --lateral-texto: #a9b8c5; --lateral-titulo: #5d6f80;
    --acento: #ff9f2e; --acento-escuro: #f39200; --acento-claro: #2c2014;
    --sombra-1: 0 1px 2px rgba(0, 0, 0, .4); --sombra-2: 0 8px 24px rgba(0, 0, 0, .45); --sombra-3: 0 24px 60px rgba(0, 0, 0, .6);
  }
}
body { font-family: var(--fonte); font-size: 14.5px; line-height: 1.5; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; font-feature-settings: "cv11", "ss01"; }
h1 { font-size: 1.55rem; font-weight: 700; letter-spacing: -.015em; }
h2 { font-size: 1.05rem; font-weight: 650; letter-spacing: -.005em; }
h3 { font-size: .95rem; font-weight: 650; }
::selection { background: rgba(243, 146, 0, .25); }
.ico { width: 18px; height: 18px; flex: none; }
.nw { white-space: nowrap; }

/* ---------- estrutura: menu lateral + topo ---------- */
.app { grid-template-columns: 252px minmax(0, 1fr); background: var(--fundo); }
.lateral { padding: 14px 10px 10px; gap: 4px; border-top: 0; background: var(--lateral); box-shadow: inset -1px 0 0 rgba(255, 255, 255, .04); }
.lateral::before { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 3px; background: var(--faixa-wb); }
.lateral .marca { padding: 6px 10px 14px; gap: 10px; border-bottom: 1px solid rgba(255, 255, 255, .06); margin-bottom: 6px; }
.lateral .marca img { width: 40px; }
.lateral .marca strong { font-size: 1.05rem; }
.lateral .marca small { max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#menu { gap: 0; padding-right: 2px; scrollbar-width: thin; scrollbar-color: #2e3c4a transparent; }
.menu-grupo { display: flex; flex-direction: column; gap: 1px; padding: 6px 0; }
.menu-grupo + .menu-grupo { border-top: 1px solid rgba(255, 255, 255, .05); }
.menu-titulo { margin: 4px 10px 4px; font-size: .68rem; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: var(--lateral-titulo); }
#menu a, .menu-ajuda { white-space: nowrap; display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 7px; font-size: .9rem; font-weight: 500; color: var(--lateral-texto); text-decoration: none; position: relative; transition: background .12s, color .12s; }
#menu a .ico, .menu-ajuda .ico { opacity: .75; }
#menu a:hover, .menu-ajuda:hover { background: rgba(255, 255, 255, .055); color: #fff; }
#menu a.ativo { background: rgba(243, 146, 0, .14); color: #fff; font-weight: 600; }
#menu a.ativo .ico { color: var(--sm-laranja); opacity: 1; }
#menu a.ativo::before { content: ''; position: absolute; left: -10px; top: 6px; bottom: 6px; width: 3px; border-radius: 0 3px 3px 0; background: var(--sm-laranja); }
.menu-ajuda { margin-top: auto; border-top: 1px solid rgba(255, 255, 255, .06); border-radius: 0; padding-top: 12px; }
.principal { min-width: 0; display: flex; flex-direction: column; }
.topo { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 14px; height: 58px; padding: 0 28px; background: color-mix(in srgb, var(--painel) 88%, transparent); backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--borda); }
.topo-btn { display: none; background: none; border: 0; color: var(--texto); padding: 6px; border-radius: 8px; cursor: pointer; }
.topo-trilha { display: flex; align-items: center; gap: 8px; font-size: .9rem; min-width: 0; }
.topo-trilha span { color: var(--suave); }
.topo-trilha span:not(:empty)::after { content: '/'; margin-left: 8px; color: var(--borda-forte); }
.topo-trilha strong { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topo-dir { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.topo-empresa { font-size: .85rem; color: var(--suave); padding: 4px 10px; border: 1px solid var(--borda); border-radius: 99px; background: var(--painel-2); max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topo-empresa:empty { display: none; }
.app .usuario { position: relative; margin: 0; padding: 0; border: 0; display: block; }
.usuario-chip { display: flex; align-items: center; gap: 10px; background: none; border: 1px solid transparent; border-radius: 10px; padding: 4px 8px 4px 4px; cursor: pointer; font: inherit; color: var(--texto); }
.usuario-chip:hover, .usuario-chip[aria-expanded=true] { background: var(--painel-2); border-color: var(--borda); }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: .8rem; letter-spacing: .02em; color: #1d2731; background: linear-gradient(135deg, #ffb347, var(--sm-laranja)); }
.usuario-txt { display: grid; text-align: left; line-height: 1.2; }
#usuario-nome { font-weight: 600; font-size: .88rem; max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.usuario-perfil { font-size: .74rem; color: var(--suave); }
.menu-usuario { position: absolute; right: 0; top: calc(100% + 6px); min-width: 220px; background: var(--painel); border: 1px solid var(--borda); border-radius: 12px; box-shadow: var(--sombra-2); padding: 6px; display: grid; gap: 2px; z-index: 30; }
.menu-usuario a, .menu-usuario button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border-radius: 8px; border: 0; background: none; color: var(--texto); font: inherit; font-size: .9rem; text-decoration: none; cursor: pointer; text-align: left; }
.menu-usuario a:hover, .menu-usuario button:hover { background: var(--painel-2); }
.menu-usuario #btn-sair { color: var(--alerta); border-top: 1px solid var(--borda); border-radius: 0 0 8px 8px; margin-top: 4px; padding-top: 10px; }
.conteudo { padding: 26px 28px 40px; max-width: 1360px; }
.lateral-fundo { position: fixed; inset: 0; background: rgba(8, 14, 20, .5); z-index: 39; }
@media (max-width: 980px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .lateral { position: fixed; left: 0; top: 0; bottom: 0; width: 272px; height: 100vh; z-index: 40; transform: translateX(-100%); transition: transform .2s ease; flex-direction: column; padding: 14px 10px; }
  body.lateral-aberta .lateral { transform: none; box-shadow: var(--sombra-3); }
  #menu { flex-direction: column; overflow-y: auto; overflow-x: hidden; }
  #menu a { white-space: normal; }
  .topo { padding: 0 14px; gap: 8px; }
  .topo-btn { display: inline-flex; }
  .topo-empresa, .usuario-txt { display: none; }
  .conteudo { padding: 18px 14px 32px; }
}

/* ---------- componentes ---------- */
.cabecalho { margin-bottom: 20px; }
.cabecalho h1 { display: flex; align-items: center; gap: 10px; }
.cartao { border-radius: var(--raio); box-shadow: var(--sombra-1); padding: 20px 22px; margin-bottom: 20px; }
.cartao > h2:first-child, .cartao-topo h2 { margin-bottom: 12px; }
.cartao-topo { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 4px; }
.cartao-topo h2 { margin: 0 0 12px; }
details.cartao > summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: 8px; }
details.cartao > summary::-webkit-details-marker { display: none; }
details.cartao > summary::before { content: ''; width: 8px; height: 8px; border-right: 2px solid var(--suave); border-bottom: 2px solid var(--suave); transform: rotate(-45deg); transition: transform .15s; margin-right: 4px; }
details.cartao[open] > summary::before { transform: rotate(45deg); }
details.cartao[open] > summary { margin-bottom: 14px; }
.grade { gap: 16px; margin-bottom: 20px; }
.indicador { border-radius: var(--raio); box-shadow: var(--sombra-1); padding: 16px 18px; position: relative; overflow: hidden; }
.indicador .rotulo { font-size: .76rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--suave); }
.indicador .valor { font-size: 1.75rem; font-weight: 700; letter-spacing: -.02em; margin-top: 4px; }
.indicador::after { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--borda); }
.grade .indicador:first-child::after { background: var(--sm-laranja); }

label { font-size: .84rem; font-weight: 500; color: var(--suave); gap: 6px; }
input, select, textarea { border-radius: var(--raio-peq); border-color: var(--borda-forte); padding: 9px 11px; min-height: 38px; transition: border-color .12s, box-shadow .12s; background-color: var(--painel); }
input:hover, select:hover, textarea:hover { border-color: var(--apagado); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--sm-laranja); box-shadow: var(--foco); }
input[type=checkbox], input[type=radio] { min-height: 0; accent-color: var(--acento); width: 16px; height: 16px; }
select { appearance: none; -webkit-appearance: none; padding-right: 32px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238794a0' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 11px center; }
label.check { display: flex; align-items: center; gap: 8px; color: var(--texto); font-weight: 500; }
.form { gap: 16px; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); align-items: start; }
.form > label, .filtros > label { align-content: start; }
.cartao > .dica + .btn, .cartao > .dica + div, .cartao > p + .acoes { margin-top: 12px; }
.cartao > .dica:last-child { margin-bottom: 0; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 38px; padding: 8px 16px; border-radius: var(--raio-peq); border-color: var(--borda-forte); font-size: .9rem; box-shadow: var(--sombra-1); transition: background .12s, border-color .12s, box-shadow .12s, transform .05s; }
.btn:hover { border-color: var(--apagado); background: var(--painel-2); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: none; box-shadow: var(--foco); }
.btn.primario { background: var(--acento); border-color: var(--acento); color: #fff; box-shadow: 0 1px 2px rgba(194, 94, 0, .35), inset 0 1px 0 rgba(255, 255, 255, .12); }
.btn.primario:hover { background: var(--acento-escuro); border-color: var(--acento-escuro); }
@media (prefers-color-scheme: dark) { .btn.primario { color: #1d1206; } }
.btn.perigo { color: var(--alerta); }
.btn.perigo:hover { background: color-mix(in srgb, var(--alerta) 8%, var(--painel)); border-color: color-mix(in srgb, var(--alerta) 40%, var(--borda)); }
.btn.peq { min-height: 30px; padding: 4px 10px; font-size: .82rem; }
.link { font-weight: 600; }

.tabela-wrap { border: 1px solid var(--borda); border-radius: 10px; overflow: auto; }
.tabela-wrap table { margin: 0; }
table { font-size: .9rem; }
thead th { position: sticky; top: 0; z-index: 1; background: var(--painel-2); color: var(--suave); font-size: .72rem; font-weight: 700; letter-spacing: .06em; padding: 10px 12px; border-bottom: 1px solid var(--borda); }
td { padding: 10px 12px; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: color-mix(in srgb, var(--sm-laranja) 4%, transparent); }
.vazio { padding: 28px 0; }

.etiqueta { font-size: .72rem; padding: 3px 9px; letter-spacing: .01em; border: 1px solid transparent; }
.dica { color: var(--suave); }
.alerta-caixa { background: color-mix(in srgb, var(--aviso) 12%, var(--painel)); border: 1px solid color-mix(in srgb, var(--aviso) 40%, var(--borda)); border-left: 4px solid var(--aviso); border-radius: 10px; padding: 12px 16px; margin-bottom: 18px; }

dialog#modal { border: 0; border-radius: 16px; box-shadow: var(--sombra-3); padding: 0; max-width: min(640px, 94vw); background: var(--painel); color: var(--texto); }
dialog#modal::backdrop { background: rgba(10, 16, 22, .55); backdrop-filter: blur(2px); }
#modal-form { padding: 24px; }
#modal-form > h2 { font-size: 1.15rem; margin: 0 0 16px; padding-bottom: 12px; border-bottom: 1px solid var(--borda); }
#modal-form > .acoes { justify-content: flex-end; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--borda); }
.aviso { border-radius: 10px; box-shadow: var(--sombra-2); font-weight: 600; }

/* ---------- login ---------- */
#tela-login { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(360px, .95fr); padding: 0; place-items: stretch; background: var(--fundo); }
.login-marca { background: radial-gradient(900px 500px at 10% 0%, #34424f 0%, #1d2731 55%, #141c24 100%); color: #e9eff4; padding: 48px 56px; display: flex; flex-direction: column; justify-content: center; gap: 22px; position: relative; overflow: hidden; }
.login-marca::before { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 4px; background: var(--faixa-wb); }
.login-marca::after { content: ''; position: absolute; right: -120px; bottom: -120px; width: 380px; height: 380px; border-radius: 50%; border: 60px solid rgba(243, 146, 0, .07); }
.login-marca .marca { padding: 0; }
.login-marca .marca img { width: 52px; }
.login-marca .marca strong { font-size: 1.35rem; }
.login-marca h2 { font-size: 2.1rem; line-height: 1.15; letter-spacing: -.025em; margin: 18px 0 0; max-width: 520px; }
.login-marca ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; color: #c3d0db; }
.login-marca li { display: flex; gap: 10px; align-items: center; }
.login-marca li::before { content: ''; width: 18px; height: 18px; border-radius: 50%; flex: none; background: rgba(243, 146, 0, .18) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23f39200' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 12l4 4 8-8'/%3E%3C/svg%3E") center / 12px no-repeat; }
.login-selos { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 0; }
.login-selos span { font-size: .76rem; color: #aebdc9; border: 1px solid rgba(255, 255, 255, .12); border-radius: 99px; padding: 4px 10px; background: rgba(255, 255, 255, .03); }
.login > .login-caixa { align-self: center; justify-self: center; max-width: 400px; width: calc(100% - 48px); margin: 32px 0; padding: 32px 34px; border-radius: 16px; box-shadow: var(--sombra-2); }
.login-caixa::before { display: none; }
.login-caixa h1 { font-size: 1.3rem; text-align: center; }
.login-caixa .btn.primario { min-height: 44px; font-size: 1rem; }
.login-logo { max-width: 190px; }
.campo-codigo { font-size: 1.5rem; letter-spacing: .3em; text-align: center; font-variant-numeric: tabular-nums; }
@media (max-width: 860px) {
  #tela-login { grid-template-columns: 1fr; }
  .login-marca { padding: 28px 22px; gap: 12px; }
  .login-marca h2 { font-size: 1.45rem; margin-top: 6px; }
  .login-marca ul, .login-selos { display: none; }
}
.login .bloqueio, .login #link-erro { grid-column: 2; align-self: center; justify-self: center; }
@media (max-width: 860px) { .login .bloqueio, .login #link-erro { grid-column: 1; } }

/* ---------- segurança ---------- */
.qr { display: grid; place-items: center; padding: 12px; background: #fff; border-radius: 12px; border: 1px solid var(--borda); width: fit-content; margin: 8px auto; }
.qr img, .qr canvas, .qr svg { display: block; }
.chave-totp { font-size: .95rem; letter-spacing: .06em; background: var(--painel-2); padding: 2px 6px; border-radius: 6px; word-break: break-all; }
.passos { padding-left: 20px; margin: 6px 0; display: grid; gap: 4px; }
.cod-rec { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin: 12px 0; }
.cod-rec code { font-size: 1rem; letter-spacing: .08em; text-align: center; padding: 8px; border: 1px dashed var(--borda-forte); border-radius: 8px; background: var(--painel-2); }
.dias-semana { display: grid; gap: 6px; }
.dias-semana > div { display: flex; flex-wrap: wrap; gap: 10px 14px; padding-top: 6px; }
.rotulo-campo { font-size: .84rem; font-weight: 500; color: var(--suave); }

/* ---------- impressão / documentos ---------- */
@media print {
  .topo, .lateral, .lateral-fundo { display: none !important; }
  .app { display: block; }
  .conteudo { padding: 0; max-width: none; }
  .cartao, .indicador { box-shadow: none; }
  thead th { position: static; }
  .tabela-wrap { border: 0; }
}

/* ---------- documentos (carta, comprovante, laudos, relatórios) — menos tinta, leitura mais limpa ---------- */
.doc { font-family: "Inter", "Segoe UI", Arial, Helvetica, sans-serif; color: #17222c; border-color: #dfe5ea; border-radius: 10px; box-shadow: var(--sombra-1); }
.doc-topo { border-bottom: 1.5px solid var(--doc1, #0a2a43); padding-bottom: 12px; }
.doc-titulo { font-weight: 750; letter-spacing: -.005em; }
.doc-empresa { letter-spacing: .14em; }
.doc-seq { border-radius: 10px; }
.doc-info { border-color: #d3dde5; border-radius: 8px; }
.doc-info > div { border-color: #e4eaef; }
.doc-info label, .doc-campo label { font-size: 9px; letter-spacing: .1em; color: #66747f; }
.doc-info b, .doc-campo b { font-weight: 650; }
.doc-sec { background: var(--doc2claro, #e8f6fd); color: var(--doc1, #0a2a43); border-left: 4px solid var(--doc2, #0077b6); border-radius: 4px; padding: 5px 10px 5px 9px; }
.doc-sec small { color: #4f5f6b; }
.doc-tab th, .doc-tab td { border-color: #d3dde5; }
.doc-tab tbody tr:nth-child(even) td { background: #f8fafc; }
.doc-tab tbody tr:hover td { background: inherit; }
.doc-tab td.indicador { background: #fff8d9 !important; }
.doc-campo { border-color: #d3dde5; border-radius: 6px; }
.doc-assin div { border-top-color: #3c4b57; }
.doc-rodape { border-top-color: #e4eaef; color: #7b8994; }

/* rastreamento da frota */
.frota-mapa { height: 440px; border-radius: 10px; overflow: hidden; border: 1px solid var(--borda); background: var(--painel-2); margin-bottom: 10px; }
.frota-linha { cursor: pointer; }
.leaflet-tooltip.frota-rotulo { font: 600 12px var(--fonte); padding: 2px 6px; border-radius: 6px; }
code.quebra { word-break: break-all; display: inline-block; margin-top: 4px; }
@media (max-width: 700px) { .frota-mapa { height: 320px; } }
