:root {
  --fundo: #f4f5f7;
  --superficie: #ffffff;
  --superficie-2: #f8fafc;
  --borda: #e3e6eb;
  --borda-forte: #cfd4dc;
  --texto: #111827;
  --texto-2: #4b5563;
  --texto-3: #8a93a3;
  --primaria: #0f5bd8;
  --primaria-hover: #0b4bb5;
  --primaria-suave: #e8f0fe;
  --perigo: #dc2626;
  --ok: #16a34a;
  --alerta: #d97706;
  --editado: #fff7d6;
  --editado-borda: #f2c94c;
  --raio: 10px;
  --sombra: 0 1px 2px rgba(16, 24, 40, .05);
  --sombra-alta: 0 12px 32px rgba(16, 24, 40, .16);
  --topo: 60px;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-size: 13px;
  color: var(--texto);
  background: var(--fundo);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
button, input, select, textarea { font: inherit; color: inherit; }
svg:has(> use) { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ---------- Topo ---------- */
.topbar {
  height: var(--topo);
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 0 20px;
  background: var(--superficie);
  border-bottom: 1px solid var(--borda);
  flex: none;
}
.marca { display: flex; align-items: center; gap: 10px; min-width: 230px; }
.marca-icone {
  width: 34px; height: 34px; border-radius: 9px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, #0f5bd8, #3b82f6);
  color: #fff;
}
.marca-icone svg { width: 18px; height: 18px; }
.marca-titulo { font-weight: 700; font-size: 14px; letter-spacing: -.01em; }
.marca-sub { font-size: 11px; color: var(--texto-3); font-weight: 500; letter-spacing: .04em; }

.segmentado {
  display: flex; gap: 2px; padding: 3px;
  background: #eef0f3; border-radius: 9px;
}
.segmentado button {
  display: flex; align-items: center; gap: 6px;
  border: 0; background: transparent; border-radius: 7px;
  padding: 6px 12px; font-weight: 500; color: var(--texto-2); cursor: pointer;
}
.segmentado button:hover { color: var(--texto); }
.segmentado button.ativo { background: var(--superficie); color: var(--texto); box-shadow: 0 1px 3px rgba(0,0,0,.1); }

.topbar-acoes { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.pill-status {
  display: flex; align-items: center; gap: 8px;
  border: 1px solid var(--borda); background: var(--superficie-2);
  border-radius: 999px; padding: 6px 12px; cursor: pointer; color: var(--texto-2); font-weight: 500;
}
.pill-status .ponto { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); }
.pill-status.pendente { background: #fffbeb; border-color: #fde68a; color: #92400e; }
.pill-status.pendente .ponto { background: var(--alerta); }

/* ---------- Botoes ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  height: 32px; padding: 0 12px;
  border: 1px solid var(--borda-forte); border-radius: 8px;
  background: var(--superficie); color: var(--texto); font-weight: 500;
  cursor: pointer; white-space: nowrap;
}
.btn:hover { background: var(--superficie-2); border-color: #b9c0cb; }
.btn-primario { background: var(--primaria); border-color: var(--primaria); color: #fff; }
.btn-primario:hover { background: var(--primaria-hover); border-color: var(--primaria-hover); }
.btn-fantasma { border-color: transparent; background: transparent; color: var(--texto-2); padding: 0 8px; }
.btn-perigo { color: var(--perigo); border-color: #f3b4b4; }
.btn-perigo-fantasma { color: var(--perigo); border-color: transparent; background: transparent; }
.btn-perigo-fantasma:hover { background: #fef2f2; border-color: transparent; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-icone {
  width: 32px; height: 32px; border-radius: 8px; border: 0; background: transparent;
  display: grid; place-items: center; cursor: pointer; color: var(--texto-2);
}
.btn-icone:hover { background: #eef0f3; color: var(--texto); }

.menu { position: relative; }
.menu-lista {
  position: absolute; top: calc(100% + 6px); left: 0; z-index: 3000;
  min-width: 250px; padding: 6px;
  background: var(--superficie); border: 1px solid var(--borda); border-radius: var(--raio);
  box-shadow: var(--sombra-alta); display: none;
}
.menu-lista.direita { left: auto; right: 0; }
.menu-lista.aberto { display: block; }
.menu-lista button {
  display: block; width: 100%; text-align: left;
  border: 0; background: transparent; padding: 8px 10px; border-radius: 6px; cursor: pointer;
}
.menu-lista button:hover { background: var(--primaria-suave); color: var(--primaria); }
.menu-rotulo { font-size: 11px; font-weight: 600; color: var(--texto-3); text-transform: uppercase; letter-spacing: .05em; padding: 8px 10px 4px; }

/* ---------- Resumo (paineis no padrao da tabela original) ---------- */
.resumo {
  display: grid;
  grid-template-columns: minmax(150px, .8fr) minmax(250px, 1.45fr) minmax(200px, 1.1fr) minmax(340px, 2fr) minmax(160px, .9fr) minmax(160px, .9fr);
  gap: 12px; padding: 14px 20px 0; flex: none;
}
.ind {
  display: flex; align-items: center; gap: 12px; min-width: 0;
  background: var(--superficie); border: 1px solid var(--borda); border-radius: var(--raio);
  padding: 10px 14px; box-shadow: var(--sombra);
}
.ico-ind { flex: none; }
.ind-corpo { flex: 1; min-width: 0; }
.ind-valor { font-size: 26px; font-weight: 700; letter-spacing: -.02em; line-height: 1.05; }
.ind-rotulo { font-size: 11.5px; font-weight: 600; color: var(--texto-2); line-height: 1.25; margin-top: 2px; }
.ind-sub { font-size: 11.5px; color: var(--texto-3); margin-top: 2px; font-variant-numeric: tabular-nums; }
.ind-titulo { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--texto-2); margin-bottom: 4px; }
.ind-linha {
  display: flex; align-items: center; gap: 7px; width: 100%; padding: 2px 6px; margin: 0 -6px;
  border: 1px solid transparent; border-radius: 6px; background: transparent; text-align: left; font-size: 12px;
}
button.ind-linha { cursor: pointer; }
button.ind-linha:hover { background: #f1f3f6; }
.ind-linha.ativo { border-color: var(--cor); background: color-mix(in srgb, var(--cor) 9%, white); }
.ind-linha i { width: 9px; height: 9px; border-radius: 3px; background: var(--cor); flex: none; }
.ind-linha .rot { flex: 1; color: var(--texto-2); font-weight: 500; }
.ind-linha b { font-size: 14px; font-variant-numeric: tabular-nums; min-width: 22px; text-align: right; }
.ind-linha .km { min-width: 82px; text-align: right; color: var(--texto-2); font-variant-numeric: tabular-nums; }
.ind-situacoes .barra { display: flex; height: 7px; border-radius: 4px; overflow: hidden; margin: 2px 0 6px; background: #eef0f3; }
.ind-situacoes .barra span { display: block; height: 100%; }
.ind-sits { display: grid; grid-template-columns: 1fr 1fr; gap: 1px 10px; }
.ind-sit {
  display: flex; align-items: center; gap: 6px; padding: 2px 6px; border: 1px solid transparent; border-radius: 6px;
  background: transparent; cursor: pointer; font-size: 11.5px; color: var(--texto-2); text-align: left;
}
.ind-sit:hover { background: #f1f3f6; }
.ind-sit.ativo { border-color: var(--cor); background: color-mix(in srgb, var(--cor) 9%, white); color: var(--texto); }
.ind-sit i { width: 8px; height: 8px; border-radius: 50%; background: var(--cor); flex: none; }
.ind-sit b { margin-left: auto; font-size: 13px; color: var(--texto); font-variant-numeric: tabular-nums; }

/* ---------- Ferramentas ---------- */
.ferramentas { display: flex; align-items: center; gap: 8px; padding: 12px 20px; flex: none; }
.busca {
  display: flex; align-items: center; gap: 8px; width: 340px; height: 32px; padding: 0 10px;
  background: var(--superficie); border: 1px solid var(--borda-forte); border-radius: 8px; color: var(--texto-3);
}
.busca:focus-within { border-color: var(--primaria); box-shadow: 0 0 0 3px var(--primaria-suave); }
.busca input { border: 0; outline: 0; flex: 1; background: transparent; color: var(--texto); }
.seletor {
  height: 32px; padding: 0 28px 0 10px; border: 1px solid var(--borda-forte); border-radius: 8px;
  background: var(--superficie) 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='%238a93a3' stroke-width='2.5'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 9px center;
  appearance: none; cursor: pointer; max-width: 210px;
}
.seletor.ativo { border-color: var(--primaria); background-color: var(--primaria-suave); }
.contador { color: var(--texto-3); font-weight: 500; margin-left: 4px; white-space: nowrap; }
.espaco { flex: 1; }

/* ---------- Area de trabalho ---------- */
.area { flex: 1; min-height: 0; display: flex; gap: 12px; padding: 0 20px 16px; }
.painel-tabela, .painel-mapa {
  background: var(--superficie); border: 1px solid var(--borda); border-radius: var(--raio);
  box-shadow: var(--sombra); overflow: hidden; min-width: 0; position: relative;
}
.painel-tabela { flex: 1; }
.painel-mapa { flex: 1; display: none; }
.area[data-modo="dividido"] .painel-mapa { display: block; flex: 0 0 42%; }
.area[data-modo="mapa"] .painel-tabela { display: none; }
.area[data-modo="mapa"] .painel-mapa { display: block; }
.area[data-modo="mapa"] { padding-top: 0; }
#grade, #mapa { width: 100%; height: 100%; }

/* ---------- Tabulator ---------- */
.tabulator { border: 0; background: var(--superficie); font-size: 12.5px; }
.tabulator .tabulator-header { background: var(--superficie-2); border-bottom: 1px solid var(--borda); color: var(--texto-2); }
.tabulator .tabulator-header .tabulator-col { background: var(--superficie-2); border-right: 1px solid #edf0f3; }
.tabulator .tabulator-header .tabulator-col .tabulator-col-content { padding: 9px 10px; }
.tabulator .tabulator-header .tabulator-col .tabulator-col-title { font-weight: 600; font-size: 11.5px; text-transform: uppercase; letter-spacing: .03em; }
.tabulator .tabulator-header .tabulator-col.tabulator-sortable:hover { background: #eef1f5; }
.tabulator-row { border-bottom: 1px solid #f0f2f5; min-height: 36px; }
.tabulator-row.tabulator-row-even { background: var(--superficie); }
.tabulator-row .tabulator-cell { padding: 9px 10px; border-right: 1px solid #f3f4f6; }
.tabulator-row.tabulator-selectable:hover { background: #f5f8ff; }
.tabulator-row.tabulator-selected { background: #e8f0fe !important; }
.tabulator-row.tabulator-selected .tabulator-cell { border-right-color: #d6e3fb; }
.tabulator-row .tabulator-cell.tabulator-frozen { background: inherit; }
.tabulator-row .tabulator-cell.tabulator-editing { border: 2px solid var(--primaria); padding: 0; }
.tabulator-row .tabulator-cell.tabulator-editing input,
.tabulator-row .tabulator-cell.tabulator-editing textarea { padding: 7px 8px !important; }
.tabulator .tabulator-cell.celula-editada { background: var(--editado) !important; box-shadow: inset 3px 0 0 var(--editado-borda); }
.tabulator .tabulator-footer { background: var(--superficie-2); border-top: 1px solid var(--borda); }
.tabulator-edit-list { border-radius: 8px; box-shadow: var(--sombra-alta); border: 1px solid var(--borda); font-size: 12.5px; }
.tabulator-edit-list .tabulator-edit-list-item { padding: 7px 10px; }
.tabulator-edit-list .tabulator-edit-list-item.active { background: var(--primaria); }
.tabulator .tabulator-tableholder .tabulator-placeholder span { color: var(--texto-3); font-weight: 500; font-size: 13px; }
.col-acao { cursor: pointer; }

/* ---------- Celulas especiais ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px; max-width: 100%;
  padding: 2px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 600;
  color: var(--c); background: color-mix(in srgb, var(--c) 11%, white);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--c); flex: none; }
.tipo { display: inline-flex; align-items: center; gap: 7px; font-weight: 500; }
.tipo i { width: 10px; height: 10px; border-radius: 3px; background: var(--c); flex: none; }

.doc { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; font-size: 11.5px; font-weight: 600; }
.doc .ico-doc { flex: none; }
.doc-txt { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-sim { color: #2f6b3d; }
.doc-nao { color: #9a3a26; }
.doc-parcial { color: #9a6a00; }
.doc-na, .doc-vazio { color: #9aa1ac; font-weight: 500; }

.geo-ok { color: var(--primaria); }
.geo-sem { color: #d1d5db; }
.num { font-variant-numeric: tabular-nums; }

/* ---------- Gaveta de detalhes ---------- */
.gaveta {
  position: fixed; top: var(--topo); right: 0; bottom: 0; width: 460px; max-width: 100vw;
  background: var(--superficie); border-left: 1px solid var(--borda); box-shadow: var(--sombra-alta);
  display: flex; flex-direction: column; z-index: 2000;
  transform: translateX(100%); transition: transform .2s ease;
}
.gaveta.aberta { transform: none; }
.gaveta-topo { display: flex; justify-content: space-between; align-items: flex-start; padding: 16px 18px 10px; }
.gaveta-sup { display: flex; gap: 8px; align-items: center; color: var(--texto-3); font-weight: 600; font-size: 11.5px; }
.gaveta h2 { margin: 6px 0 0; font-size: 17px; letter-spacing: -.01em; line-height: 1.3; }
.gaveta-abas { display: flex; gap: 2px; padding: 0 18px; border-bottom: 1px solid var(--borda); }
.gaveta-abas button { border: 0; background: transparent; padding: 9px 10px; font-weight: 500; color: var(--texto-2); border-bottom: 2px solid transparent; cursor: pointer; margin-bottom: -1px; }
.gaveta-abas button.ativo { color: var(--primaria); border-bottom-color: var(--primaria); }
.gaveta-corpo { flex: 1; overflow: auto; padding: 6px 18px 18px; }
.gaveta-rodape { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--borda); background: var(--superficie-2); }

.form-grupo { margin-top: 14px; }
.form-grupo h4 { margin: 0 0 8px; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--texto-3); font-weight: 600; }
.form-grade { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 12px; }
.campo { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.campo.largo { grid-column: 1 / -1; }
.campo label { font-size: 11.5px; font-weight: 500; color: var(--texto-2); display: flex; gap: 6px; align-items: center; }
.campo label .marcador { width: 6px; height: 6px; border-radius: 50%; background: var(--editado-borda); display: none; }
.campo.editado label .marcador { display: inline-block; }
.campo input, .campo select, .campo textarea {
  border: 1px solid var(--borda-forte); border-radius: 7px; padding: 7px 9px; background: var(--superficie); outline: 0; width: 100%;
}
.campo textarea { resize: vertical; min-height: 60px; line-height: 1.45; }
.campo input:focus, .campo select:focus, .campo textarea:focus { border-color: var(--primaria); box-shadow: 0 0 0 3px var(--primaria-suave); }
.campo.editado input, .campo.editado select, .campo.editado textarea { background: var(--editado); border-color: var(--editado-borda); }
.campo input[readonly] { background: var(--superficie-2); color: var(--texto-3); }
.doc-campo { display: flex; gap: 6px; }
.doc-campo select { flex: 0 0 132px; }

.historico-item { padding: 10px 0; border-bottom: 1px solid #f0f2f5; }
.historico-item .quando { color: var(--texto-3); font-size: 11.5px; }
.historico-item .de { color: #b91c1c; text-decoration: line-through; word-break: break-word; }
.historico-item .para { color: #15803d; word-break: break-word; }
.vazio { color: var(--texto-3); padding: 24px 0; text-align: center; }

/* ---------- Mapa ---------- */
.leaflet-container { font: inherit; background: #eef0f2; }
.mapa-barra { position: absolute; top: 12px; right: 12px; z-index: 1000; }
.btn-mapa { box-shadow: var(--sombra-alta); border-color: var(--borda); }
.camadas-lista {
  display: none; margin-top: 6px; width: 230px; padding: 8px;
  background: var(--superficie); border: 1px solid var(--borda); border-radius: var(--raio); box-shadow: var(--sombra-alta);
}
.camadas-lista.aberto { display: block; }
.camadas-lista .menu-rotulo { padding: 6px 4px 4px; }
.chk { display: flex; align-items: center; gap: 8px; padding: 5px 4px; cursor: pointer; border-radius: 6px; }
.chk:hover { background: var(--superficie-2); }

.legenda {
  position: absolute; left: 12px; bottom: 12px; z-index: 1000;
  background: rgba(255,255,255,.95); border: 1px solid var(--borda); border-radius: var(--raio);
  padding: 10px 12px; box-shadow: var(--sombra); font-size: 12px;
}
.legenda-titulo { font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--texto-3); margin-bottom: 6px; }
.legenda-item { display: flex; align-items: center; gap: 8px; padding: 2px 0; }
.legenda-item i { width: 22px; height: 5px; border-radius: 3px; background: var(--c); box-shadow: 0 0 0 1.5px #fff, 0 0 0 2.5px rgba(0,0,0,.08); }
.legenda-item i.fino { height: 2px; box-shadow: none; }

.edicao-barra {
  position: absolute; top: 12px; left: 12px; z-index: 1100;
  background: var(--superficie); border: 1px solid var(--borda); border-radius: 12px; box-shadow: var(--sombra-alta);
  padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; max-width: calc(100% - 150px);
}
.edicao-barra[hidden] { display: none; }
.edicao-titulo { font-weight: 500; }
.edicao-dica { font-size: 11.5px; color: var(--texto-3); }
.edicao-acoes { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.simplificar { display: inline-flex; align-items: center; gap: 4px; color: var(--texto-2); }
.simplificar input { width: 52px; height: 32px; border: 1px solid var(--borda-forte); border-radius: 8px; padding: 0 6px; }

.popup-trecho { min-width: 230px; }
.popup-trecho .sup { display: flex; gap: 6px; align-items: center; color: var(--texto-3); font-size: 11px; font-weight: 600; }
.popup-trecho h4 { margin: 4px 0 6px; font-size: 13.5px; }
.popup-trecho p { margin: 0 0 8px; color: var(--texto-2); }
.popup-trecho .btn { height: 28px; font-size: 12px; }
.leaflet-popup-content-wrapper { border-radius: 10px; box-shadow: var(--sombra-alta); }
.leaflet-popup-content { margin: 12px 14px; }
.rotulo-rodovia { background: transparent; border: 0; box-shadow: none; font-weight: 700; color: #374151; text-shadow: 0 0 3px #fff, 0 0 3px #fff, 0 0 3px #fff; }
.rotulo-rodovia::before { display: none; }

/* ---------- Dialogos ---------- */
.dialogo {
  border: 0; border-radius: 14px; padding: 0; width: 720px; max-width: calc(100vw - 32px); max-height: calc(100vh - 64px);
  box-shadow: var(--sombra-alta); color: var(--texto);
}
.dialogo[open] { display: flex; flex-direction: column; }
.dialogo-pequeno { width: 380px; }
.dialogo::backdrop { background: rgba(15, 23, 42, .35); }
.dialogo-topo { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--borda); }
.dialogo-topo h3 { margin: 0; font-size: 15px; }
.dialogo-corpo { padding: 12px 18px; overflow: auto; flex: 1; }
.dialogo-rodape { display: flex; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--borda); background: var(--superficie-2); }
.tabela-simples { width: 100%; border-collapse: collapse; }
.tabela-simples th, .tabela-simples td { text-align: left; padding: 7px 8px; border-bottom: 1px solid #f0f2f5; vertical-align: top; }
.tabela-simples th { font-size: 11px; text-transform: uppercase; color: var(--texto-3); letter-spacing: .04em; }
.tag { font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 999px; background: #eef0f3; color: var(--texto-2); }
.tag.novo { background: #dcfce7; color: #166534; }
.tag.excluido { background: #fee2e2; color: #991b1b; }
.tag.geo { background: #e0e7ff; color: #3730a3; }

/* ---------- Toasts ---------- */
.toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 5000; }
.toast { background: #111827; color: #fff; padding: 10px 14px; border-radius: 9px; box-shadow: var(--sombra-alta); font-weight: 500; animation: entrar .2s ease; }
@keyframes entrar { from { opacity: 0; transform: translateY(8px); } }

.carregando { position: fixed; inset: 0; display: grid; place-items: center; background: var(--fundo); z-index: 9000; color: var(--texto-3); font-weight: 500; }

/* Telas menores: os seis paineis continuam numa linha so (compactos) para nao roubar altura da planilha. */
@media (max-width: 1600px) {
  .resumo {
    grid-template-columns: minmax(118px, .75fr) minmax(220px, 1.45fr) minmax(165px, 1.05fr) minmax(300px, 2fr) minmax(125px, .8fr) minmax(125px, .8fr);
    gap: 8px; overflow-x: auto;
  }
  .ind { gap: 8px; padding: 8px 10px; }
  .ind .ico-ind { width: 30px; height: 30px; }
  .ind-valor { font-size: 22px; }
  .ind-rotulo { font-size: 11px; }
  .ind-linha { font-size: 11.5px; gap: 5px; }
  .ind-linha .km { min-width: 72px; }
  .ind-sit { font-size: 11px; }
}
@media (max-width: 1200px) {
  .busca { width: 240px; }
}

/* ---------- Banco de dados: status, usuario, login ---------- */
.pill-status.salvando { background: var(--primaria-suave); border-color: #c7dafc; color: var(--primaria); }
.pill-status.salvando .ponto { background: var(--primaria); animation: pulsar 1s ease-in-out infinite; }
@keyframes pulsar { 50% { opacity: .3; } }

.usuario {
  display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 10px 0 4px;
  border: 1px solid transparent; border-radius: 999px; background: transparent; cursor: pointer;
}
.usuario:hover { background: var(--superficie-2); border-color: var(--borda); }
.avatar {
  width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center;
  background: var(--primaria-suave); color: var(--primaria); font-weight: 700; font-size: 11px;
}
.usuario-txt { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.15; }
.usuario-txt b { font-weight: 600; font-size: 12.5px; }
.usuario-txt small { font-size: 11px; color: var(--texto-3); }

body:not(.admin) .so-admin { display: none !important; }
body.somente-leitura .so-editor { display: none !important; }
.campo select:disabled, .campo input:disabled, .campo textarea:disabled { background: var(--superficie-2); color: var(--texto); opacity: 1; }

.login {
  position: fixed; inset: 0; z-index: 9500; display: grid; place-items: center;
  background: radial-gradient(1200px 600px at 20% 0%, #e8f0fe, var(--fundo));
}
.login[hidden] { display: none; }
.login-caixa {
  width: 380px; max-width: calc(100vw - 32px); display: flex; flex-direction: column; gap: 12px;
  background: var(--superficie); border: 1px solid var(--borda); border-radius: 16px; padding: 28px; box-shadow: var(--sombra-alta);
}
.login-texto { margin: 4px 0 2px; color: var(--texto-2); line-height: 1.5; }
.login-entrar { height: 38px; justify-content: center; margin-top: 4px; }
.aviso-form { margin: 0; min-height: 18px; color: var(--perigo); font-size: 12.5px; line-height: 1.45; }
.link { border: 0; background: transparent; color: var(--primaria); cursor: pointer; padding: 0; font-weight: 500; }
.link:hover { text-decoration: underline; }
.link-perigo { color: var(--perigo); }

.toast-erro { background: #991b1b; max-width: 560px; }

/* ---------- Gaveta: carimbo, tramitacao, historico ---------- */
.carimbo { margin-top: 12px; font-size: 11.5px; color: var(--texto-3); }

.form-tramite { margin-top: 14px; padding: 12px; border: 1px solid var(--borda); border-radius: var(--raio); background: var(--superficie-2); }
.form-tramite h4 { margin: 0 0 10px; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--texto-3); font-weight: 600; }
.replicar { margin-top: 10px; padding-top: 8px; border-top: 1px dashed var(--borda-forte); }
.replicar-titulo { font-size: 11.5px; font-weight: 500; color: var(--texto-2); margin-bottom: 4px; }
.replicar .chk { align-items: center; flex-wrap: wrap; }
.form-tramite-acoes { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.dica-tramite { flex: 1; font-size: 11.5px; color: var(--texto-3); }

.linha-tempo { margin-top: 16px; }
.tramite { display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px solid #f0f2f5; }
.tramite-data { flex: 0 0 76px; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--texto-2); }
.tramite-corpo { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }
.tramite-desc { line-height: 1.45; word-break: break-word; }
.tramite-sei { font-size: 11.5px; color: var(--texto-2); }
.tramite-autor { font-size: 11px; color: var(--texto-3); }

.historico-item .mudanca { margin-top: 6px; padding-left: 10px; border-left: 2px solid var(--borda); }
.historico-item .mudanca b { font-weight: 600; font-size: 11.5px; color: var(--texto-2); }

/* ---------- Dialogo de administracao ---------- */
.secao { margin: 14px 0 6px; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--texto-3); font-weight: 600; }
.secao:first-child { margin-top: 4px; }
.nota { margin: 0 0 8px; color: var(--texto-2); line-height: 1.5; }
.entrada-tabela, .tabela-simples select { border: 1px solid var(--borda-forte); border-radius: 6px; padding: 4px 6px; background: var(--superficie); max-width: 100%; }
.tabela-acessos td { font-size: 12px; }
.tabela-acessos small { color: var(--texto-3); }
.tabela-acessos tr.ev-acesso_negado td { color: var(--perigo); }
