/* ========== TOKENS ========== */
:root {
  --ink: #0F1B2D;
  --ink-2: #2A3447;
  --muted: #5A6478;
  --muted-2: #8A93A6;
  --line: #E6EAF1;
  --line-2: #EEF1F5;
  --bg: #F6F8FB;
  --surface: #FFFFFF;
  --surface-2: #FAFBFD;
  --navy: #0B2545;
  --navy-2: #112E54;
  --navy-3: #1A3A66;
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;
  --r-xl: 20px;
  --shadow-sm: 0 1px 2px rgba(15,27,45,.04), 0 1px 1px rgba(15,27,45,.03);
  --shadow-md: 0 4px 12px rgba(15,27,45,.06), 0 1px 2px rgba(15,27,45,.04);
}
[data-theme="dark"] {
  --ink: #E8EEF8;
  --ink-2: #B8C2D6;
  --muted: #8A93A6;
  --muted-2: #6E7689;
  --line: #1F2A3D;
  --line-2: #18222F;
  --bg: #0B131F;
  --surface: #121C2B;
  --surface-2: #0F1827;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body, #root { margin: 0; padding: 0; height: 100%; }
body {
  font-family: "Inter", -apple-system, "Segoe UI", system-ui, sans-serif;
  color: var(--ink);
  background: #F1F3F7;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "ss01", "cv11";
}

/* ============================================================
   LOGIN
============================================================ */
.login-root {
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  width: 100%;
  height: 100%;
  font-family: "Inter", sans-serif;
}

.login-brand {
  background: linear-gradient(160deg, #0B2545 0%, #112E54 50%, #0B2545 100%);
  color: #fff;
  position: relative;
  overflow: hidden;
}
.login-brand::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(800px 400px at 110% -10%, rgba(255,255,255,.07), transparent 60%),
    radial-gradient(600px 400px at -10% 110%, rgba(255,255,255,.05), transparent 60%);
  pointer-events: none;
}
.login-brand::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.04) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse 90% 80% at 50% 50%, black, transparent 80%);
  pointer-events: none;
}
.login-brand-inner {
  position: relative;
  z-index: 1;
  height: 100%;
  padding: 56px 64px;
  display: flex;
  flex-direction: column;
  gap: 44px;
}
.login-logo { display: flex; align-items: center; }
/* Mostra apenas a variante que casa com o tema atual (data-theme em <html>).
   Sem JS: as duas imgs ficam no DOM, mas so' uma e' display:block.
   Logo horizontal com tagline — height generosa pro tagline ser legivel. */
.login-logo-img {
  height: 130px;
  width: auto;
  display: none;
}
[data-theme="light"] .login-logo-img-light { display: block; }
[data-theme="dark"]  .login-logo-img-dark  { display: block; }

.login-hero { max-width: 520px; }
.login-hero-eyebrow {
  display: inline-block;
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  letter-spacing: 0.12em;
  padding: 4px 10px;
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 999px;
  color: #C5D0E5;
  margin-bottom: 24px;
}
.login-hero-title {
  font-size: 44px;
  line-height: 1.1;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 0 0 20px;
  text-wrap: balance;
}
.login-hero-body {
  color: #9AA8C4;
  font-size: 15px;
  line-height: 1.6;
  margin: 0;
  max-width: 460px;
}

.login-viz {
  margin-top: auto;
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 14px;
  padding: 20px 22px;
  backdrop-filter: blur(6px);
}
.login-viz-head {
  display: flex; justify-content: space-between;
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  color: #C5D0E5;
  letter-spacing: 0.04em;
  margin-bottom: 10px;
}
.login-viz-svg { width: 100%; height: 110px; display: block; }
.login-viz-foot {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-top: 6px;
  border-top: 1px solid rgba(255,255,255,.08);
  padding-top: 14px;
}
.login-viz-foot > div { display: flex; flex-direction: column; gap: 2px; }
.lvf-k { color: #7E8AA3; font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; }
.lvf-v { font-family: "JetBrains Mono", monospace; font-size: 16px; font-weight: 500; }

.login-foot {
  display: flex; justify-content: space-between;
  font-size: 12px; color: #6E7995;
}

/* RIGHT */
.login-main {
  background: #F1F3F7;
  display: grid;
  place-items: center;
  padding: 40px;
}
.login-card {
  width: 100%;
  max-width: 460px;
  background: #fff;
  border-radius: 16px;
  border: 1px solid var(--line);
  padding: 44px 44px 34px;
  box-shadow: var(--shadow-md);
}
.login-card-eyebrow {
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  color: #8A93A6;
  letter-spacing: 0.14em;
  margin-bottom: 8px;
}
.login-card-title {
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 0 0 6px;
  color: var(--ink);
}
.login-card-sub { color: var(--muted); font-size: 14px; margin: 0 0 28px; }

.login-form { display: flex; flex-direction: column; gap: 16px; }
.login-field { display: flex; flex-direction: column; gap: 6px; }
.login-field-label {
  display: flex; justify-content: space-between;
  font-size: 12.5px; font-weight: 500; color: var(--ink-2);
}
.login-link { font-size: 12.5px; text-decoration: none; font-weight: 500; }
.login-field input {
  height: 46px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 14px;
  font-family: inherit;
  background: var(--surface);
  color: var(--ink);
  transition: border-color .15s, box-shadow .15s;
}
.login-field input:focus {
  outline: none;
  border-color: #0B2545;
  box-shadow: 0 0 0 3px rgba(11,37,69,.08);
}
.login-pw { position: relative; }
.login-pw input { padding-right: 44px; width: 100%; }
.login-pw-eye {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  background: transparent; border: 0; color: var(--muted-2);
  cursor: pointer; padding: 6px; border-radius: 6px;
}
.login-pw-eye:hover { color: var(--ink-2); background: var(--line-2); }

.login-row { display: flex; align-items: center; }
.login-check {
  display: flex; align-items: center; gap: 10px;
  font-size: 13px; color: var(--ink-2);
  cursor: pointer; user-select: none;
}
.login-check input { display: none; }
.login-check-box {
  width: 18px; height: 18px; border-radius: 5px;
  border: 1.5px solid #C8CFDB;
  display: grid; place-items: center;
  transition: all .15s;
}

.login-error {
  background: #FBE0E0;
  color: #A82828;
  border: 1px solid #F2B8B8;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 13px;
  font-weight: 500;
}

.login-submit {
  height: 50px;
  border: 0;
  border-radius: 10px;
  color: #fff;
  font-weight: 600;
  font-size: 14.5px;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  cursor: pointer;
  transition: filter .15s, transform .05s;
  margin-top: 6px;
  letter-spacing: 0.01em;
}
.login-submit:hover { filter: brightness(1.05); }
.login-submit:active { transform: translateY(1px); }
.login-submit:disabled { opacity: .8; cursor: progress; }
.login-spinner {
  width: 18px; height: 18px; border-radius: 50%;
  border: 2.4px solid rgba(255,255,255,.4); border-top-color: #fff;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.login-divider {
  text-align: center;
  position: relative;
  font-size: 12px;
  color: var(--muted-2);
  margin: 4px 0;
}
.login-divider::before,
.login-divider::after {
  content: "";
  position: absolute; top: 50%;
  width: calc(50% - 16px);
  height: 1px;
  background: var(--line);
}
.login-divider::before { left: 0; }
.login-divider::after { right: 0; }

.login-sso {
  height: 46px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-weight: 500;
  font-size: 13.5px;
  color: var(--ink-2);
  display: flex; align-items: center; justify-content: center; gap: 10px;
  cursor: pointer;
  transition: background .15s;
}
.login-sso:hover { background: var(--surface-2); }

.login-meta {
  margin-top: 28px;
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; color: var(--muted);
}
.login-meta-dot { width: 8px; height: 8px; border-radius: 50%; }

/* ============================================================
   DASHBOARD
============================================================ */
.dash-root {
  display: grid;
  grid-template-columns: 360px 1fr;
  height: 100vh;
  max-height: 100vh;
  overflow: hidden;
  font-family: "Inter", sans-serif;
  background: var(--bg);
  color: var(--ink);
}
.dash-root.is-compact { grid-template-columns: 310px 1fr; }

/* SIDEBAR */
.dash-side {
  background: linear-gradient(180deg, #0B2545 0%, #0A2040 100%);
  color: #C5D0E5;
  padding: 22px 14px 18px;
  display: flex; flex-direction: column;
  position: relative;
  overflow-y: auto;
  min-height: 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.12) transparent;
}
.dash-side::-webkit-scrollbar { width: 6px; }
.dash-side::-webkit-scrollbar-track { background: transparent; }
.dash-side::-webkit-scrollbar-thumb { background: rgba(255,255,255,.12); border-radius: 3px; }
.dash-side::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.2); }
.dash-side-brand { display: flex; align-items: center; padding: 0 4px 22px; }
.dash-side-logo {
  /* Logo horizontal com tagline (viewBox 480x110 ≈ 4.36:1). Ocupa toda a
     largura util da sidebar — quanto maior, mais legivel a tagline. */
  width: 100%;
  height: auto;
  display: block;
}

.dash-side-section {
  font-family: "JetBrains Mono", monospace;
  font-size: 12px;
  letter-spacing: 0.16em;
  color: #5A6E92;
  padding: 14px 12px 8px;
}

/* Dropdown de filtro de cliente (admin_sistema) — fica logo abaixo da
   seção CLIENTE no sidebar. Match do estilo escuro do sidebar. */
.dash-side-cliente {
  padding: 0 12px 4px;
}
.dash-side-cliente-sel {
  width: 100%;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.10);
  color: #E8ECF5;
  font-family: inherit;
  font-size: 14px;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
.dash-side-cliente-sel:hover { background: rgba(255,255,255,.10); }
.dash-side-cliente-sel:focus {
  outline: none;
  border-color: var(--accent, #E08B2A);
}
.dash-side-cliente-sel option {
  background: #1A2332;
  color: #E8ECF5;
}

/* ── Pagina de gerenciamento de usuarios (admin_sistema) ── */
.usuarios-tabela-wrap { width: 100%; overflow-x: auto; }
.usuarios-tabela {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  color: var(--ink, #0F1B2D);
}
.usuarios-tabela thead th {
  text-align: left;
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted, #6B7280);
  padding: 8px 12px;
  border-bottom: 1px solid var(--line, #E5E7EB);
}
/* Headers clicaveis (Tag, Num. serie). Cursor + hover sutil + indicador
   `▲▼↕` ao lado pra deixar claro que ordenam. */
.usuarios-tabela thead th.th-ordenavel {
  cursor: pointer;
  user-select: none;
}
.usuarios-tabela thead th.th-ordenavel:hover { color: var(--ink, #0F1B2D); }
.usuarios-tabela thead th .th-ordem-ind {
  display: inline-block;
  margin-left: 6px;
  font-size: 9px;
  opacity: .55;
  vertical-align: 1px;
}
.usuarios-tabela thead th[aria-sort="ascending"] .th-ordem-ind,
.usuarios-tabela thead th[aria-sort="descending"] .th-ordem-ind {
  opacity: 1;
  color: var(--accent, #E08B2A);
}
.usuarios-tabela tbody td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line, #E5E7EB);
  vertical-align: middle;
}
.usuarios-tabela tbody tr.is-inativo { opacity: .5; }
.usuarios-tabela tbody tr:hover { background: var(--surface-2, #F5F6F8); }
.usuarios-email { font-family: "JetBrains Mono", monospace; font-size: 12px; }
.usuarios-data { font-family: "JetBrains Mono", monospace; font-size: 11.5px; color: var(--muted, #6B7280); }
.usuarios-empty { text-align: center; padding: 24px; color: var(--muted, #6B7280); }
.usuarios-erro { padding: 16px; color: #B42318; font-size: 13px; }
.usuarios-papel {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  font-family: "JetBrains Mono", monospace;
  letter-spacing: 0.04em;
}
.usuarios-papel.papel-admin_sistema { background: rgba(232,81,30,.10); color: #B5400F; }
.usuarios-papel.papel-admin_cliente { background: rgba(34,160,107,.10); color: #1F7A4D; }
.usuarios-papel.papel-usuario       { background: rgba(59,110,224,.08); color: #3B6EE0; }
.usuarios-status {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
}
.usuarios-status.is-on  { background: rgba(34,160,107,.10); color: #1F7A4D; }
.usuarios-status.is-off { background: rgba(11,42,74,.06);   color: var(--muted, #6B7280); }
.usuarios-acoes {
  text-align: right;
  white-space: nowrap;
}
.usuarios-btn-acao {
  background: transparent;
  border: 1px solid var(--line, #E5E7EB);
  color: var(--ink-2, #374151);
  padding: 4px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  margin-left: 6px;
  transition: background .15s, border-color .15s, color .15s;
}
.usuarios-btn-acao:first-child { margin-left: 0; }
.usuarios-btn-acao:hover {
  background: var(--surface-2, #F5F6F8);
  border-color: var(--ink-2, #374151);
}
.usuarios-btn-acao.is-danger {
  color: #B42318;
  border-color: rgba(180,35,24,.30);
}
.usuarios-btn-acao.is-danger:hover {
  background: rgba(180,35,24,.06);
  border-color: #B42318;
}

/* Coluna de senha na tabela de maquinas: codigo monoespaco + botao
   pequeno pra mostrar/ocultar. Senha NUNCA aparece visivel por default. */
.maquinas-senha-cell {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.maquinas-senha-cell code {
  font-family: "JetBrains Mono", monospace;
  font-size: 12px;
  color: var(--ink, #0F1B2D);
  letter-spacing: 0.04em;
}
.maquinas-senha-toggle {
  background: transparent;
  border: 1px solid var(--line, #E5E7EB);
  color: var(--muted, #6B7280);
  padding: 1px 8px;
  border-radius: 4px;
  font-size: 10.5px;
  font-weight: 600;
  cursor: pointer;
  letter-spacing: 0.04em;
  transition: background .15s, color .15s;
}
.maquinas-senha-toggle:hover {
  background: var(--surface-2, #F5F6F8);
  color: var(--ink, #0F1B2D);
}

/* ── Modal de criação de usuário ── */
.usuario-form { display: flex; flex-direction: column; gap: 14px; }
.usuario-form-row { display: flex; flex-direction: column; gap: 6px; }
.usuario-form-lbl {
  font-family: "JetBrains Mono", monospace;
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--rep-muted, #6B7280);
}
.usuario-form-inp {
  width: 100%;
  padding: 9px 12px;
  border: 1.5px solid var(--rep-line, #D8DEE8);
  border-radius: 8px;
  font-family: inherit;
  font-size: 13px;
  background: #fff;
  color: var(--ink, #0F1B2D);
  transition: border-color .15s, box-shadow .15s;
}
.usuario-form-inp:focus {
  outline: none;
  border-color: var(--accent, #E08B2A);
  box-shadow: 0 0 0 3px rgba(232,139,42,.15);
}

/* Linha do campo de senha — input + botoes (mostrar/gerar/copiar) inline. */
.usuario-form-senha {
  display: flex;
  gap: 6px;
  align-items: stretch;
}
.usuario-form-senha .usuario-form-inp {
  flex: 1;
  font-family: "JetBrains Mono", monospace;
  letter-spacing: 0.04em;
}
.usuario-form-senha-btn {
  background: #fff;
  border: 1.5px solid var(--rep-line, #D8DEE8);
  color: var(--ink-2, #374151);
  padding: 0 12px;
  border-radius: 8px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s;
}
.usuario-form-senha-btn:hover:not(:disabled) {
  background: var(--surface-2, #F5F6F8);
  border-color: var(--ink-2, #374151);
  color: var(--ink, #0F1B2D);
}
.usuario-form-senha-btn:disabled {
  opacity: .5;
  cursor: not-allowed;
}
.usuario-form-papeis {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.usuario-papel-opt {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border: 1.5px solid var(--rep-line, #D8DEE8);
  border-radius: 8px;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.usuario-papel-opt input { margin-top: 3px; accent-color: var(--accent, #E08B2A); }
.usuario-papel-opt:hover { background: var(--surface-2, #F5F6F8); }
.usuario-papel-opt.is-on {
  border-color: var(--accent, #E08B2A);
  background: rgba(232,139,42,.06);
}
.usuario-papel-titulo { font-size: 13px; font-weight: 600; color: var(--ink, #0F1B2D); }
.usuario-papel-desc  { font-size: 11.5px; color: var(--muted, #6B7280); margin-top: 2px; }
.usuario-form-erro {
  padding: 10px 12px;
  background: rgba(180,35,24,.08);
  border: 1px solid rgba(180,35,24,.20);
  border-radius: 8px;
  color: #B42318;
  font-size: 12.5px;
}
.usuario-form-acoes {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 6px;
}

.dash-nav { display: flex; flex-direction: column; gap: 2px; }
.dash-nav-item {
  position: relative;
  background: transparent;
  border: 0;
  color: #B8C2D6;
  display: flex; align-items: center; gap: 12px;
  padding: 11px 12px;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s, color .15s;
  text-align: left;
}
.dash-nav-item:hover { background: rgba(255,255,255,.04); color: #fff; }
.dash-nav-item.is-active {
  background: rgba(255,255,255,.06);
  color: #fff;
}
.dash-nav-bar {
  position: absolute; left: -14px; top: 8px; bottom: 8px;
  width: 3px; border-radius: 0 3px 3px 0;
}
.dash-nav-label { flex: 1; }
.dash-nav-badge {
  background: rgba(255,255,255,.08);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 999px;
  font-family: "JetBrains Mono", monospace;
}
.dash-nav-dot {
  width: 7px; height: 7px; border-radius: 50%;
  box-shadow: 0 0 0 3px rgba(224,139,42,.2);
}
.dash-nav-chev {
  display: inline-flex;
  color: #8A93A6;
  transition: transform .18s ease;
  margin-left: 2px;
}
.dash-nav-chev.is-open {
  transform: rotate(90deg);
  color: #fff;
}

.dash-nav-sub {
  display: flex;
  flex-direction: column;
  gap: 1px;
  margin: 2px 0 4px;
  padding-left: 18px;
  border-left: 1px solid rgba(255,255,255,.06);
  margin-left: 22px;
  animation: navSubFade .18s ease;
}
@keyframes navSubFade {
  from { opacity: 0; transform: translateY(-2px); }
  to   { opacity: 1; transform: translateY(0); }
}
.dash-nav-subitem {
  background: transparent;
  border: 0;
  color: #B8C2D6;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 8px;
  font-family: "Inter", sans-serif;
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: background .15s, color .15s;
}
.dash-nav-subitem:hover {
  background: rgba(255,255,255,.04);
  color: #fff;
}
.dash-nav-sublabel {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dash-nav-subcount {
  font-family: "JetBrains Mono", monospace;
  font-size: 11.5px;
  color: #8A93A6;
  background: rgba(255,255,255,.06);
  padding: 1px 7px;
  border-radius: 999px;
}
/* Bolinha indicando arquivo(s) novo(s) na pasta — desaparece ao expandir.
   Posicionada a esquerda do nome da pasta (entre o chevron e o label).
   `--accent-glow` e setado inline (cor do accent) para o halo combinar. */
.dash-nav-subnovo {
  display: inline-block;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  flex-shrink: 0;
}
/* Aproxima a bolinha do nome — o gap padrao do flex (10px) deixa muito
   "solta"; visualmente fica melhor como uma unidade so [• Pasta]. */
.dash-nav-subnovo + .dash-nav-sublabel { margin-left: -4px; }
.dash-nav-subitem.has-novo .dash-nav-sublabel {
  color: #fff;
  font-weight: 600;
}
.dash-nav-sub-empty {
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  color: #6E7995;
  padding: 8px 12px;
  letter-spacing: 0.04em;
}
.dash-nav-subitem.is-open {
  background: rgba(255,255,255,.06);
  color: #fff;
}
/* Pasta criada apos edicao manual de estacas — agrupa por obra com label
   laranja para diferenciar dos contratos importados. */
.dash-nav-subitem.is-edited .dash-nav-sublabel { color: var(--accent, #E08B2A); }
.dash-nav-subitem.is-edited.is-open .dash-nav-sublabel { color: var(--accent, #E08B2A); }

/* Botao "Carregar mais" no fim da lista de pastas — apenas um "+"
   dentro de um circulo centralizado. */
.dash-nav-mais {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  margin-top: 4px;
  padding: 8px 0;
  background: transparent;
  border: 0;
  cursor: pointer;
}
.dash-nav-mais-circ {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,.20);
  color: #C5D0E5;
  transition: background .15s, border-color .15s, color .15s;
}
.dash-nav-mais:hover .dash-nav-mais-circ {
  background: rgba(255,255,255,.08);
  border-color: rgba(255,255,255,.4);
  color: #fff;
}
.editor-iframe-modal {
  position: fixed;
  inset: 0;
  z-index: 1200;
  /* Fundo opaco — o iframe cobre toda a area com seu proprio body branco,
     entao o que aparece fora do dialogo (caso haja, em telas estreitas)
     e' essa cor. Sem `backdrop-filter` para nao forcar o Chrome a
     recompositar o iframe + dashboard a cada frame, o que deixava a
     edicao da estaca lenta. */
  background: #0B2A4A;
}
.editor-iframe-modal iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  background: transparent;
}
.dash-nav-subchev {
  display: inline-flex;
  color: #8A93A6;
  transition: transform .18s ease;
}
.dash-nav-subchev.is-open {
  transform: rotate(90deg);
  color: var(--accent, #E08B2A);
}

.dash-nav-files {
  display: flex;
  flex-direction: column;
  gap: 1px;
  margin: 2px 0 6px;
  padding-left: 16px;
  border-left: 1px solid rgba(255,255,255,.06);
  margin-left: 18px;
  animation: navSubFade .18s ease;
  max-height: 320px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.12) transparent;
}
.dash-nav-files::-webkit-scrollbar { width: 4px; }
.dash-nav-files::-webkit-scrollbar-thumb { background: rgba(255,255,255,.12); border-radius: 2px; }
.dash-nav-file {
  background: transparent;
  border: 0;
  color: #9AA8C4;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 6px;
  font-family: "Inter", sans-serif;
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  width: 100%;
  /* Transition apenas em color: a borda (box-shadow do .is-active) muda
   * instantaneo, entao se o background tambem nao tinha transition rapida
   * a navegacao por seta deixava o fundo do item anterior "pendurado"
   * enquanto a borda ja tinha pulado para o proximo. */
  transition: color .15s;
}
.dash-nav-file:hover {
  background: rgba(255,255,255,.04);
  color: #fff;
}
.dash-nav-file-dot {
  width: 5px; height: 5px;
  border-radius: 50%;
  background: #5A6E92;
  flex-shrink: 0;
}
.dash-nav-file:hover .dash-nav-file-dot {
  background: var(--accent, #E08B2A);
}
.dash-nav-file-name {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Estaca ainda nao aberta pelo usuario logado: nome em negrito, cor mais
   clara, e uma pequena bolinha accent na esquerda. Visualmente distinta
   da estaca atualmente aberta (.is-active). */
.dash-nav-file.is-nao-lido {
  color: #fff;
  font-weight: 600;
}
.dash-nav-file.is-nao-lido .dash-nav-file-dot { background: var(--accent, #E08B2A); }
.dash-nav-file-novo {
  display: inline-block;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  flex-shrink: 0;
}
.dash-nav-file-empty {
  font-family: "JetBrains Mono", monospace;
  font-size: 10.5px;
  color: #5A6E92;
  padding: 6px 10px;
  letter-spacing: 0.04em;
}

/* Linha do arquivo na sidebar — wrapper que aloja o botao do arquivo
 * e (apenas em obras editadas) o botao de excluir ao lado direito. */
.dash-nav-file-row {
  display: flex;
  align-items: stretch;
  gap: 4px;
  width: 100%;
}
.dash-nav-file-row .dash-nav-file {
  flex: 1 1 auto;
  width: auto;
  min-width: 0;
}
.dash-nav-file-del {
  flex-shrink: 0;
  width: 22px;
  border: 0;
  background: transparent;
  color: #6B7794;
  font-size: 16px;
  line-height: 1;
  padding: 0;
  border-radius: 6px;
  cursor: pointer;
  opacity: 0;
  transition: opacity .15s, background .15s, color .15s;
}
.dash-nav-file-row:hover .dash-nav-file-del,
.dash-nav-file-del:focus-visible {
  opacity: 1;
}
.dash-nav-file-del:hover {
  background: rgba(224, 70, 70, .18);
  color: #FF8A8A;
}

/* Planilha de estacas (painel principal quando uma pasta está aberta) */
.pasta-planilha-scroll {
  overflow: auto;
  max-height: calc(100vh - 280px);
  margin: -18px -20px;
}
.pasta-planilha-tabela {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
  color: var(--ink-2);
}
.pasta-planilha-tabela thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #fff;
  text-align: left;
  font-family: "JetBrains Mono", monospace;
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 500;
  color: var(--muted-2);
  padding: 14px 14px;
  border-bottom: 1px solid var(--line-2);
  white-space: nowrap;
}
.pasta-planilha-tabela tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line-2);
  font-family: "JetBrains Mono", monospace;
  white-space: nowrap;
}
.pasta-planilha-tabela tbody td:first-child {
  color: var(--ink);
  font-weight: 600;
}
.pasta-planilha-tabela tbody tr {
  cursor: pointer;
  transition: background .12s;
}
.pasta-planilha-tabela tbody tr:hover {
  background: var(--surface-2);
}
.pasta-planilha-tabela tbody tr.linha-erro td {
  color: #C0382B;
  font-style: italic;
}
.pasta-planilha-empty {
  padding: 24px 14px !important;
  text-align: center;
  color: var(--muted) !important;
  font-family: "Inter", sans-serif !important;
  font-weight: 500 !important;
}

/* Estado ativo do arquivo na sidebar */
.dash-nav-file.is-active {
  background: rgba(224,139,42,.12);
  color: #fff;
  box-shadow: inset 2px 0 0 var(--accent, #E08B2A);
}
.dash-nav-file.is-active .dash-nav-file-dot {
  background: var(--accent, #E08B2A);
  box-shadow: 0 0 0 3px rgba(224,139,42,.2);
}

/* Painel do gráfico (iframe da tela de estacas).
 *
 * Layout intencional: o iframe ocupa exatamente a viewport visivel da
 * area principal (100vh - topbar 64px - padding vertical 56px). Ao abrir
 * a tela o efeito do EstacaGrafico rola o frame pra topo, deixando o
 * pagehead "Voltar/PDF" escondido acima e o foot-nav escondido abaixo.
 * O usuario faz scroll up/down para acessa-los.
 */
.dash-page-grafico {
  display: flex;
  flex-direction: column;
  min-height: 0;
  gap: 18px;
  /* O foot-nav e o pagehead so devem aparecer com scroll explicito.
   * Adiciona scroll-padding-top = topo da viewport para que scrollIntoView
   * (block:start) alinhe o iframe exatamente no inicio visivel sem deixar
   * sobrar pixels do foot-nav. */
  scroll-padding: 0;
}
/* Override do .dash-page padding so para a tela do grafico: zera vertical
 * pra que o iframe (height: 100vh - 64px do topbar) preencha 100%
 * da area visivel sem deixar pixels do foot-nav aparecendo. */
.dash-page.dash-page-grafico {
  padding-top: 0;
  padding-bottom: 0;
}
.dash-grafico-frame {
  flex: none;
  height: calc(100vh - 64px);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.dash-grafico-iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

/* Botao "Voltar" mobile-only do EstacaGrafico — em desktop o atalho fica
   no .dash-actions do .dash-pagehead. Em mobile (.dash-actions hidden e
   .dash-pagehead hidden), este botao fica fixed no canto superior esquerdo,
   logo abaixo da .dash-head, dando saida explicita pra tela de origem. */
.grafico-voltar-mobile { display: none; }

/* Tela de detalhes da obra — renderizada via iframe pra reaproveitar
 * o detalhes-obra.html (que tem CSS/JS proprios). O ?embed=1 esconde
 * o sidebar interno do HTML, deixando so o conteudo. */
.dash-page.dash-page-detalhes-obra { padding: 0; overflow: hidden; }
/* Altura espelha o calc usado pelo dash-grafico-frame: 100vh menos o
 * header de 64px do dash-main. */
.detalhes-obra-frame {
  width: 100%;
  height: calc(100vh - 64px);
  background: var(--bg);
  overflow: hidden;
}
.detalhes-obra-iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

/* Foot-nav (rodape de navegacao entre estacas). Aparece em fluxo,
 * abaixo do iframe — visivel apenas quando o usuario rola para baixo. */
.estaca-foot-nav {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 24px;
  align-items: center;
  padding: 14px 24px;
  border: 1px solid #E5E7EB;
  border-radius: 12px;
  background: #fafbfc;
  font-family: 'Inter', sans-serif;
  flex: none;
}
.estaca-foot-nav__btn {
  background: transparent;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: inherit;
  text-align: left;
  padding: 6px 0;
  color: #0F1115;
  transition: color 200ms cubic-bezier(0.22, 1, 0.36, 1);
}
.estaca-foot-nav__btn--right {
  justify-content: flex-end;
  text-align: right;
}
.estaca-foot-nav__btn:hover:not(:disabled) { color: #E8511E; }
.estaca-foot-nav__btn:disabled {
  cursor: not-allowed;
  opacity: 0.35;
  color: #9CA3AF;
}
.estaca-foot-nav__btn:disabled .estaca-foot-nav__arrow { color: #9CA3AF; }
.estaca-foot-nav__arrow {
  font-family: 'Archivo', 'Inter', sans-serif;
  font-size: 18px;
  font-weight: 600;
  color: #1E4D7B;
  transition: transform 200ms cubic-bezier(0.22, 1, 0.36, 1), color 200ms;
}
.estaca-foot-nav__btn:hover:not(:disabled) .estaca-foot-nav__arrow { color: #E8511E; }
.estaca-foot-nav__btn--left:hover:not(:disabled) .estaca-foot-nav__arrow { transform: translateX(-3px); }
.estaca-foot-nav__btn--right:hover:not(:disabled) .estaca-foot-nav__arrow { transform: translateX(3px); }
.estaca-foot-nav__lbl {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #6B7280;
  display: block;
  margin-bottom: 2px;
}
.estaca-foot-nav__name {
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  font-weight: 500;
}
.estaca-foot-nav__center {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.08em;
  color: #6B7280;
  text-align: center;
}

/* FAB de baixar PNG — default escondido. Aparece so em mobile via regra
   no @media (max-width: 767px) mais abaixo. Em desktop o usuario tem o
   botao "Relatorio PDF/XLSX" no dash-pagehead. */
.png-fab-mobile { display: none; }
.estaca-foot-nav__center strong {
  display: block;
  color: #0F1115;
  font-size: 13px;
  font-weight: 600;
  margin-top: 2px;
  letter-spacing: 0.04em;
}

/* Mapa (Leaflet) */
.dash-page-mapa {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}
.mapa-frame {
  flex: 1;
  min-height: 0;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  position: relative;
}
.mapa-container {
  width: 100%;
  height: 100%;
}
.mapa-legenda {
  display: flex;
  gap: 16px;
  font-size: 12px;
  color: var(--muted);
  align-items: center;
}
.mapa-legenda i {
  display: inline-block;
  width: 9px; height: 9px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: middle;
}
.mapa-pin-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
}
.mapa-pin {
  display: block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid #fff;
}
.leaflet-popup-content-wrapper {
  border-radius: 10px;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--line);
  padding: 4px;
}
.leaflet-popup-content {
  margin: 10px 14px;
  font-family: "Inter", sans-serif;
  color: var(--ink);
}
.mapa-popup-bairro {
  font-family: "JetBrains Mono", monospace;
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 4px;
}
.mapa-popup-nome {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 4px;
}
.mapa-popup-meta {
  font-size: 11.5px;
  color: var(--muted);
  font-family: "JetBrains Mono", monospace;
}
.leaflet-popup-tip {
  background: #fff;
}

/* ============================================================
   Tela do Mapa (nova versão SVG + tabela)
============================================================ */
.map-page {
  display: flex;
  flex-direction: column;
  gap: 24px;
}
.map-section {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.map-page .page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  flex-wrap: wrap;
}
.map-page .eyebrow {
  font-family: "JetBrains Mono", monospace;
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
}
.map-page .h1 {
  font-size: 26px;
  font-weight: 600;
  color: var(--ink);
  margin: 0 0 4px;
  letter-spacing: -0.01em;
}
.map-page .bread {
  font-size: 12.5px;
  color: var(--muted);
}
.map-page .actions {
  display: flex;
  gap: 8px;
}
.map-page .btn-ghost,
.map-page .btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: "Inter", sans-serif;
  font-size: 12.5px;
  font-weight: 500;
  padding: 8px 14px;
  border-radius: 8px;
  cursor: pointer;
  border: 1px solid var(--line);
  transition: all .15s ease;
}
.map-page .btn-ghost {
  background: #fff;
  color: var(--ink);
}
.map-page .btn-ghost:hover {
  border-color: #c8d0dc;
  background: #f6f8fb;
}
.map-page .btn-primary {
  background: var(--accent, #E08B2A);
  color: #fff;
  border-color: transparent;
}
.map-page .btn-primary:hover {
  filter: brightness(.95);
}

.map-card {
  position: relative;
  width: 100%;
  /* Ocupa praticamente toda a altura util da viewport: sobra so o
     header/eyebrow + o botao "Ver tabela de enderecos" + paddings. */
  height: calc(100vh - 240px);
  min-height: 480px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #EEF2F7;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.map-svg {
  width: 100%;
  height: 100%;
  display: block;
  transition: transform .25s ease;
}
.map-leaflet {
  width: 100%;
  height: 100%;
  position: absolute;
  inset: 0;
  z-index: 1;
}
.map-card .map-toolbar,
.map-card .map-zoom,
.map-card .map-legend,
.map-card .map-scale,
.map-card .pin-tooltip { z-index: 500; }
.map-card .leaflet-top.leaflet-left { display: none; }

.map-toolbar {
  position: absolute;
  top: 14px;
  left: 14px;
  right: 14px;
  display: flex;
  gap: 10px;
  align-items: center;
  pointer-events: none;
}
.map-toolbar > * { pointer-events: auto; }
.map-search {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 12px;
  width: 320px;
  box-shadow: var(--shadow-sm);
  color: var(--muted);
}
.map-search input {
  border: 0;
  outline: 0;
  font-size: 13px;
  width: 100%;
  background: transparent;
  color: var(--ink);
}
.map-chips {
  display: flex;
  gap: 6px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 4px;
  box-shadow: var(--shadow-sm);
}
.map-chips .chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 7px;
  border: 0;
  background: transparent;
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
  cursor: pointer;
  transition: all .15s ease;
}
.map-chips .chip i {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
}
.map-chips .chip.is-active {
  background: #f0f3f8;
  color: var(--ink);
}
.map-chips .chip:hover:not(.is-active) {
  color: var(--ink);
}

.map-zoom {
  position: absolute;
  bottom: 80px;
  right: 14px;
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.map-zoom button {
  width: 36px;
  height: 36px;
  border: 0;
  background: #fff;
  cursor: pointer;
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
  border-bottom: 1px solid var(--line);
}
.map-zoom button:last-child { border-bottom: 0; }
.map-zoom button:hover { background: #f6f8fb; }

.map-legend {
  position: absolute;
  bottom: 14px;
  left: 14px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
  box-shadow: var(--shadow-sm);
  min-width: 200px;
}
.map-legend h4 {
  font-family: "JetBrains Mono", monospace;
  font-size: 9.5px;
  letter-spacing: 0.14em;
  color: var(--muted);
  margin: 0 0 8px;
  font-weight: 600;
}
.map-legend ul {
  list-style: none;
  margin: 0; padding: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.map-legend li {
  font-size: 12px;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 8px;
}
.map-legend li i {
  display: inline-block;
  width: 9px; height: 9px;
  border-radius: 50%;
}

.map-scale {
  position: absolute;
  bottom: 14px;
  right: 60px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--muted);
  background: rgba(255,255,255,.85);
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid var(--line);
}
.map-scale-bar {
  display: inline-block;
  width: 50px;
  height: 3px;
  background: var(--ink);
  border-radius: 2px;
}

.pin-tooltip {
  position: absolute;
  top: 70px;
  right: 14px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
  box-shadow: var(--shadow-md);
  width: 240px;
}
.pin-tooltip-close {
  position: absolute;
  top: 6px;
  right: 8px;
  border: 0;
  background: transparent;
  cursor: pointer;
  font-size: 18px;
  color: var(--muted);
  line-height: 1;
  padding: 2px 6px;
}
.pin-tooltip-close:hover { color: var(--ink); }
.pin-tooltip-bairro {
  font-family: "JetBrains Mono", monospace;
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 4px;
}
.pin-tooltip-nome {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 4px;
}
.pin-tooltip-meta {
  font-size: 11.5px;
  color: var(--muted);
  font-family: "JetBrains Mono", monospace;
}

.scroll-hint {
  align-self: center;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 16px;
  font-size: 12.5px;
  color: var(--muted);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: all .15s ease;
}
.scroll-hint:hover {
  color: var(--ink);
  border-color: #c8d0dc;
}

/* Botao "Ver todas" sobreposto no canto superior direito do mapa.
   Reposiciona o mapa pra mostrar todas as maquinas via fitBounds. */
.map-fit-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  font-family: 'Inter', sans-serif;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(15,27,45,.10);
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
}
.map-fit-btn:hover:not(:disabled) {
  border-color: var(--accent, #E08B2A);
  color: var(--accent, #E08B2A);
}
.map-fit-btn:disabled {
  opacity: .5;
  cursor: not-allowed;
}
[data-theme="dark"] .map-fit-btn { background: var(--surface); }
[data-theme="dark"] .map-fit-btn:hover:not(:disabled) { background: var(--surface-2); }

.table-section {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.table-section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  flex-wrap: wrap;
}
.table-section-head h2 {
  font-size: 18px;
  font-weight: 600;
  color: var(--ink);
  margin: 0 0 2px;
}
.table-section-head p {
  font-size: 12.5px;
  color: var(--muted);
  margin: 0;
}
.table-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.tc-filter {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  background: #fafbfd;
}
.tc-filter-search {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 10px;
  flex: 1;
  max-width: 360px;
  color: var(--muted);
}
.tc-filter-search input {
  border: 0;
  outline: 0;
  font-size: 12.5px;
  width: 100%;
  background: transparent;
  color: var(--ink);
}
.tc-filter-count {
  font-size: 12px;
  color: var(--muted);
  font-family: "JetBrains Mono", monospace;
}
.tc-grid-header,
.tc-row {
  display: grid;
  grid-template-columns: 130px 1.6fr 1fr 0.8fr 0.6fr 160px;
  gap: 14px;
  align-items: center;
  padding: 10px 14px;
}
.tc-grid-header {
  background: #fafbfd;
  border-bottom: 1px solid var(--line);
  font-family: "JetBrains Mono", monospace;
  font-size: 10.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}
.tc-list {
  display: flex;
  flex-direction: column;
}
.tc-row {
  font-size: 13px;
  color: var(--ink);
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  transition: background .15s ease;
}
.tc-row:last-child { border-bottom: 0; }
.tc-row:hover { background: #f6f8fb; }
.tc-id {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: "JetBrains Mono", monospace;
  font-size: 11.5px;
  color: var(--muted);
  font-weight: 600;
}
.tc-dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
}
.tc-obra {
  font-weight: 500;
  color: var(--ink);
}
.tc-end, .tc-cidade {
  color: var(--muted);
  font-size: 12.5px;
}
.tc-est {
  font-family: "JetBrains Mono", monospace;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink);
}
.tc-acoes {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
  flex-wrap: wrap;
}
.tc-act-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 5px 10px;
  font-size: 11.5px;
  color: var(--ink);
  cursor: pointer;
  transition: all .15s ease;
}
.tc-act-btn:hover {
  background: #f0f3f8;
  border-color: #c8d0dc;
}
.tc-act-btn.is-primary {
  background: var(--accent, #E08B2A);
  border-color: transparent;
  color: #fff;
}
.tc-act-btn.is-primary:hover { filter: brightness(.95); background: var(--accent, #E08B2A); }
.tc-row.is-editing {
  background: #fafbfd;
}
.tc-input {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 5px 8px;
  font-size: 12.5px;
  font-family: "Inter", sans-serif;
  color: var(--ink);
  background: #fff;
  width: 100%;
  outline: 0;
  transition: border-color .15s ease;
}
.tc-input:focus {
  border-color: var(--accent, #E08B2A);
}
.tc-row.is-editing {
  grid-template-rows: auto auto;
  row-gap: 8px;
  position: relative;
  z-index: 1;
}
.tc-row.is-editing .tc-cep-row {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 8px;
  padding-top: 4px;
  border-top: 1px dashed var(--line);
}
.tc-cep-label {
  font-family: "JetBrains Mono", monospace;
  font-size: 10.5px;
  color: var(--muted);
  font-weight: 600;
  letter-spacing: 0.08em;
}
.tc-cep-input { width: 110px !important; }
.tc-coords {
  margin-left: auto;
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  color: var(--muted);
}
.tc-autocomplete {
  position: relative;
  width: 100%;
}
.tc-suggest {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow-md);
  list-style: none;
  margin: 0;
  padding: 4px;
  z-index: 50;
  max-height: 240px;
  overflow-y: auto;
}
.tc-suggest li {
  padding: 6px 8px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.tc-suggest li:hover { background: #f0f3f8; }
.tc-suggest-rua {
  font-size: 12.5px;
  color: var(--ink);
  font-weight: 500;
}
.tc-suggest-cidade {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ============================================================
   Tela de Monitoramento Remoto
============================================================ */
.mon-page {
  --ok: #22A06B;
  --warn: #E08B2A;
  --alert: #D14343;
  --idle: #6E7689;
  --ink-2: #2A3447;
  --muted-2: #8A93A6;
  --line-2: #EEF1F5;
  --surface-2: #FAFBFD;
  --accent-soft: #FBE7CB;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.mon-page .page-head { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 18px; flex-shrink: 0; }
.mon-page .eyebrow { font-family: "JetBrains Mono", monospace; font-size: 10.5px; letter-spacing: 0.16em; color: var(--muted); margin-bottom: 6px; display: flex; align-items: center; gap: 8px; }
.mon-page .live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--alert); box-shadow: 0 0 0 3px rgba(209,67,67,.2); animation: monPulse 1.4s ease-in-out infinite; }
@keyframes monPulse { 0%,100% { opacity: 1; } 50% { opacity: .4; } }
.mon-page .h1 { font-size: 28px; font-weight: 600; letter-spacing: -0.02em; margin: 0; }
.mon-page .bread { margin-top: 4px; font-size: 12.5px; color: var(--muted); font-family: "JetBrains Mono", monospace; }

.mon-page .status-strip { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 16px; flex-shrink: 0; }
.mon-page .strip-card { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; display: flex; align-items: center; gap: 12px; }
.mon-page .strip-icon { width: 36px; height: 36px; border-radius: 8px; display: grid; place-items: center; }
.mon-page .strip-icon.s-idle { background: rgba(34,160,107,.12); color: var(--ok); }
.mon-page .strip-icon.s-drill { background: rgba(224,139,42,.12); color: var(--warn); }
.mon-page .strip-icon.s-concrete { background: rgba(43,108,176,.12); color: #2B6CB0; }
.mon-page .strip-label { font-size: 11.5px; color: var(--muted); font-weight: 500; }
.mon-page .strip-value { font-family: "JetBrains Mono", monospace; font-size: 22px; font-weight: 600; line-height: 1.1; }

.mon-page .page-bar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; flex-shrink: 0; }
.mon-page .page-bar-left { font-family: "JetBrains Mono", monospace; font-size: 12px; color: var(--muted); }
.mon-page .page-bar-left b { color: var(--ink); font-weight: 600; }
.mon-page .pager { display: flex; align-items: center; gap: 6px; }
.mon-page .pager-btn { width: 32px; height: 32px; background: #fff; border: 1px solid var(--line); border-radius: 7px; cursor: pointer; display: grid; place-items: center; color: var(--ink-2); }
.mon-page .pager-btn:hover:not(:disabled) { background: var(--surface-2); }
.mon-page .pager-btn:disabled { opacity: .4; cursor: not-allowed; }
.mon-page .pager-dots { display: flex; gap: 4px; padding: 0 8px; }
.mon-page .pager-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--line); cursor: pointer; transition: all .15s; border: 0; padding: 0; }
.mon-page .pager-dot.is-active { background: var(--accent, #E08B2A); width: 24px; border-radius: 4px; }

/* Modo tela cheia do monitoramento — esconde header, status-strip e
   page-bar, deixando apenas os cards de maquina ocupando toda a viewport.
   Cards do .machine-page sao grid 3x2 com 1fr, entao crescem juntos. */
.mon-page.mon-fullscreen {
  position: fixed;
  inset: 0;
  z-index: 9000;
  background: var(--bg, #FAFBFD);
  padding: 12px;
  display: flex;
  flex-direction: column;
  margin: 0;
}
.mon-page.mon-fullscreen .mon-page-head,
.mon-page.mon-fullscreen .status-strip,
.mon-page.mon-fullscreen .page-bar { display: none; }
/* Em tela cheia, viewport vira flex container e a grade flat ocupa tudo. */
.mon-page.mon-fullscreen .machine-viewport {
  overflow: hidden;
  scroll-snap-type: none;
  display: flex;
}
.machine-page.is-flat {
  flex: 1;
  width: 100%;
  height: 100%;
  display: grid;
  gap: 12px;
  min-width: 0;
  min-height: 0;
  scroll-snap-align: none;
  padding: 0;
}
.mon-fs-exit {
  position: absolute;
  top: 14px; right: 14px;
  width: 36px; height: 36px;
  border-radius: 50%;
  background: rgba(15,17,21,0.78);
  color: #fff;
  border: 0;
  display: grid; place-items: center;
  cursor: pointer;
  z-index: 9100;
  transition: background .15s;
}
.mon-fs-exit:hover { background: rgba(15,17,21,0.92); }

.mon-page .machine-viewport { flex: 1; overflow-x: auto; overflow-y: hidden; min-height: 0; scroll-behavior: smooth; scroll-snap-type: x mandatory; }
.mon-page .machine-viewport::-webkit-scrollbar { height: 8px; }
.mon-page .machine-viewport::-webkit-scrollbar-thumb { background: var(--line); border-radius: 4px; }
.mon-page .machine-track { display: flex; gap: 20px; height: 100%; }
.mon-page .machine-page { display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(2, 1fr); gap: 16px; flex-shrink: 0; width: 100%; min-width: 100%; scroll-snap-align: start; padding-bottom: 4px; }

.mon-page .machine {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  display: flex; flex-direction: column;
  box-shadow: var(--shadow-sm);
  transition: box-shadow .15s, transform .15s;
  cursor: pointer;
  min-height: 0;
}
.mon-page .machine:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.mon-page .machine.is-add {
  border: 2px dashed var(--line);
  background: var(--surface-2);
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--muted);
  transition: all .15s;
}
.mon-page .machine.is-add:hover { border-color: var(--accent, #E08B2A); background: #fff; color: var(--accent, #E08B2A); }
.mon-page .machine.is-add svg { width: 36px; height: 36px; }
.mon-page .machine.is-add span { font-size: 13px; font-weight: 500; }
.mon-page .machine.is-add small { font-size: 11px; color: var(--muted-2); }

.mon-page .m-head { padding: 8px 12px; color: #fff; display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 12.5px; letter-spacing: 0.02em; }
.mon-page .m-head.ok { background: linear-gradient(90deg, #C57318, #E08B2A); }
.mon-page .m-head.warn { background: linear-gradient(90deg, #1F4F8A, #2B6CB0); }
.mon-page .m-head.idle { background: linear-gradient(90deg, #1A7A4E, #22A06B); }
.mon-page .m-head-dot { width: 8px; height: 8px; border-radius: 50%; background: rgba(255,255,255,.95); animation: monPulse 1.4s ease-in-out infinite; }
.mon-page .m-head-dot.idle { animation: none; opacity: .6; }
.mon-page .m-head-name { flex: 1; }
.mon-page .m-head-state { font-family: "JetBrains Mono", monospace; font-size: 10.5px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; background: rgba(0,0,0,.18); padding: 2px 7px; border-radius: 4px; }

.mon-page .m-info { background: var(--surface-2); border-bottom: 1px solid var(--line-2); padding: 8px 12px; display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; font-size: 10.5px; }
.mon-page .m-info-cell { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.mon-page .m-info-k { color: var(--muted); font-weight: 500; }
.mon-page .m-info-v { font-family: "JetBrains Mono", monospace; font-weight: 600; font-size: 11.5px; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.mon-page .m-meta { padding: 8px 12px; display: grid; grid-template-columns: 1fr 1fr; gap: 6px 14px; border-bottom: 1px solid var(--line-2); font-size: 10.5px; }
.mon-page .m-meta div { display: flex; gap: 6px; min-width: 0; }
.mon-page .m-meta-k { color: var(--muted); font-weight: 500; flex-shrink: 0; }
.mon-page .m-meta-v { color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.mon-page .m-body { flex: 1; display: grid; grid-template-columns: 130px 1fr; gap: 0; min-height: 0; }
.mon-page .m-list { background: var(--surface-2); border-right: 1px solid var(--line-2); padding: 8px 10px; display: flex; flex-direction: column; gap: 6px; font-size: 10.5px; }
.mon-page .m-list-tab { font-family: "JetBrains Mono", monospace; font-size: 9px; letter-spacing: 0.12em; color: var(--accent, #E08B2A); background: var(--accent-soft); padding: 2px 6px; border-radius: 4px; width: max-content; font-weight: 600; margin-bottom: 4px; }
.mon-page .m-list-row { display: flex; flex-direction: column; gap: 1px; padding: 4px 0; border-bottom: 1px dashed var(--line-2); }
.mon-page .m-list-row:last-child { border-bottom: 0; }
.mon-page .m-list-k { color: var(--muted); font-size: 10px; font-weight: 500; }
.mon-page .m-list-v { font-family: "JetBrains Mono", monospace; font-weight: 600; font-size: 12px; color: var(--ink); }
.mon-page .m-list-v.dim { color: var(--muted-2); font-weight: 500; }

.mon-page .m-gauges { padding: 12px; display: grid; grid-template-columns: 1.15fr 1fr; grid-template-rows: auto 1fr; gap: 10px; min-width: 0; min-height: 0; }
.mon-page .gauge-hero { grid-row: 1 / span 2; background: linear-gradient(160deg, #0F1B2D 0%, #1A2B47 100%); border-radius: 10px; padding: 12px; display: flex; flex-direction: column; position: relative; overflow: hidden; }
.mon-page .gauge-hero::before { content: ""; position: absolute; inset: 0; background: radial-gradient(circle at 70% 30%, rgba(224,139,42,.18), transparent 60%); pointer-events: none; }
.mon-page .gh-title { font-family: "JetBrains Mono", monospace; font-size: 9px; letter-spacing: 0.14em; color: #9AA8C4; font-weight: 500; position: relative; }
.mon-page .gh-svg { width: 100%; flex: 1; min-height: 0; position: relative; }
.mon-page .gh-readout { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; pointer-events: none; margin-top: 12px; }
.mon-page .gh-value { font-family: "JetBrains Mono", monospace; font-size: 26px; font-weight: 700; color: #fff; line-height: 1; letter-spacing: -0.02em; }
.mon-page .gh-unit { font-size: 10px; color: #9AA8C4; font-weight: 500; margin-top: 3px; letter-spacing: 0.04em; }
.mon-page .gh-range { display: flex; justify-content: space-between; font-family: "JetBrains Mono", monospace; font-size: 9px; color: #5A6E92; margin-top: 4px; position: relative; }

.mon-page .gauge-spark { background: var(--surface-2); border: 1px solid var(--line-2); border-radius: 8px; padding: 8px 10px; display: flex; flex-direction: column; min-width: 0; position: relative; overflow: hidden; }
.mon-page .gs-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 2px; }
.mon-page .gs-title { font-size: 9.5px; font-weight: 600; color: var(--muted); letter-spacing: 0.04em; }
.mon-page .gs-value { font-family: "JetBrains Mono", monospace; font-size: 13px; font-weight: 700; color: var(--ink); line-height: 1; }
.mon-page .gs-value small { font-size: 8.5px; color: var(--muted); font-weight: 500; margin-left: 2px; }
.mon-page .gs-svg { width: 100%; flex: 1; min-height: 0; display: block; margin-top: 2px; }

/* Modal */
/* `backdrop-filter: blur(4px)` removido — quando o modal abria por cima
   do EstacaGrafico (iframe do graficos.html com Chart.js), o Chrome
   precisava recompor o blur a cada keystroke num input do modal,
   travando a digitacao. Cor escurecida pra compensar a falta do blur. */
.modal-backdrop { position: fixed; inset: 0; background: rgba(15,27,45,.65); display: none; align-items: center; justify-content: center; z-index: 100; }
.modal-backdrop.is-open { display: flex; }
.modal { background: #fff; border-radius: 14px; width: 480px; max-width: 90vw; box-shadow: 0 20px 50px rgba(15,27,45,.25); overflow: hidden; }
.modal-head { padding: 20px 24px 14px; border-bottom: 1px solid var(--line-2); }
.modal-head h3 { margin: 0; font-size: 18px; font-weight: 600; letter-spacing: -0.01em; }
.modal-head p { margin: 4px 0 0; font-size: 12.5px; color: var(--muted); }
.modal-body { padding: 18px 24px; display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.modal-body .full { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field-label { font-family: "JetBrains Mono", monospace; font-size: 9.5px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); font-weight: 500; }
.field-input, .field-select { height: 38px; padding: 0 12px; border: 1px solid var(--line); border-radius: 8px; font-size: 13px; color: var(--ink); background: #fff; font-family: inherit; }
.field-input:focus, .field-select:focus { outline: none; border-color: var(--accent, #E08B2A); box-shadow: 0 0 0 3px rgba(224,139,42,.12); }
.modal-foot { padding: 14px 24px; border-top: 1px solid var(--line-2); display: flex; justify-content: flex-end; gap: 8px; background: #FAFBFD; }
.modal-foot .btn-ghost, .modal-foot .btn-primary { height: 38px; padding: 0 14px; border-radius: 8px; font-size: 13px; font-weight: 500; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; border: 1px solid transparent; }
.modal-foot .btn-ghost { background: #fff; border-color: var(--line); color: var(--ink); }
.modal-foot .btn-ghost:hover { background: #FAFBFD; }
.modal-foot .btn-primary { background: var(--accent, #E08B2A); color: #fff; border: 0; }
.modal-foot .btn-primary:hover { filter: brightness(1.05); }
.modal-foot .btn-ghost.btn-danger { color: #D14343; border-color: rgba(209, 67, 67, 0.35); }
.modal-foot .btn-ghost.btn-danger:hover { background: rgba(209, 67, 67, 0.08); border-color: #D14343; }
.orfaos-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; max-height: 360px; overflow-y: auto; }
.orfao-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border: 1px solid var(--line);
  border-radius: 8px; background: #fff;
}
.orfao-info { flex: 1; min-width: 0; }
.orfao-nome { font-size: 13px; font-weight: 600; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.orfao-sub { font-size: 11.5px; color: var(--muted); margin-top: 1px; }
.orfao-row .btn-primary {
  height: 32px; padding: 0 12px; border-radius: 8px;
  font-size: 12.5px; font-weight: 500; color: #fff; border: 0; cursor: pointer;
}
.orfao-row .btn-primary:hover { filter: brightness(1.05); }
[data-theme="dark"] .orfao-row { background: var(--surface); border-color: var(--line); }

.dash-side-project {
  margin: 0 6px;
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.06);
  border-radius: 10px;
  padding: 12px;
}
.dsp-row { display: flex; align-items: flex-start; gap: 10px; }
.dsp-mark {
  width: 28px; height: 28px;
  border-radius: 6px;
  background: linear-gradient(135deg, #2A4A77, #1A3A66);
  border: 1px solid rgba(255,255,255,.08);
  flex-shrink: 0;
}
.dsp-title { color: #fff; font-size: 12.5px; font-weight: 600; line-height: 1.3; }
.dsp-sub { color: #7E8AA3; font-size: 11px; margin-top: 2px; }
.dsp-progress { margin-top: 12px; }
.dsp-progress-bar {
  height: 4px; background: rgba(255,255,255,.08);
  border-radius: 999px; overflow: hidden;
}
.dsp-progress-bar > span { display: block; height: 100%; border-radius: inherit; }
.dsp-progress-meta {
  display: flex; justify-content: space-between;
  font-family: "JetBrains Mono", monospace;
  font-size: 10.5px; color: #9AA8C4;
  margin-top: 6px;
}

.dash-side-foot {
  margin-top: auto;
  padding: 14px 12px 0;
  border-top: 1px solid rgba(255,255,255,.06);
  display: flex; flex-direction: column; gap: 4px;
}
.dsf-status { display: flex; align-items: center; gap: 8px; font-size: 11.5px; color: #B8C2D6; }
.dsf-dot { width: 7px; height: 7px; border-radius: 50%; background: #22A06B; box-shadow: 0 0 0 3px rgba(34,160,107,.2); }
.dsf-version { font-family: "JetBrains Mono", monospace; font-size: 10.5px; color: #5A6E92; }

/* MAIN */
.dash-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; overflow: hidden; }

.dash-head {
  height: 64px;
  border-bottom: 1px solid var(--line);
  background: #fff;
  display: flex; align-items: center;
  padding: 0 28px;
  gap: 20px;
}
.dash-search {
  flex: 1;
  max-width: 480px;
  height: 38px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  display: flex; align-items: center; gap: 10px;
  padding: 0 12px;
  color: var(--muted);
  position: relative;
}
.dash-search-popover {
  position: absolute;
  top: calc(100% + 6px); left: 0; right: 0;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 12px 32px rgba(15, 27, 45, .12);
  max-height: 420px; overflow-y: auto;
  z-index: 50;
  padding: 6px;
}
.dash-search-vazio {
  padding: 16px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}
.dash-search-grupo + .dash-search-grupo { margin-top: 6px; }
.dash-search-grupo-titulo {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .06em;
  color: var(--muted);
  text-transform: uppercase;
  padding: 8px 10px 4px;
}
.dash-search-item {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  font-family: inherit;
}
.dash-search-item:hover,
.dash-search-item.is-active { background: var(--surface-2); }
.dash-search-titulo {
  font-size: 13px; font-weight: 500;
  color: var(--ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.dash-search-subtitulo {
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.dash-search input {
  flex: 1; border: 0; background: transparent;
  font-size: 13.5px; color: var(--ink); font-family: inherit;
  outline: none;
}
.dash-search input::placeholder { color: var(--muted-2); }
.dash-search kbd {
  font-family: "JetBrains Mono", monospace;
  font-size: 10.5px; color: var(--muted);
  background: #fff; border: 1px solid var(--line);
  border-radius: 4px; padding: 2px 6px;
}

.dash-head-tools {
  margin-left: auto;
  display: flex; align-items: center; gap: 6px;
}
.dash-icon-btn {
  position: relative;
  width: 36px; height: 36px;
  background: transparent;
  border: 0; border-radius: 8px;
  color: var(--ink-2);
  cursor: pointer;
  display: grid; place-items: center;
  transition: background .15s;
}
.dash-icon-btn:hover { background: var(--line-2); }
.dash-icon-badge {
  position: absolute; top: 6px; right: 6px;
  min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 999px;
  font-family: "JetBrains Mono", monospace;
  font-size: 9.5px; font-weight: 600;
  color: #fff;
  display: grid; place-items: center;
  border: 2px solid #fff;
}
.dash-divider { width: 1px; height: 24px; background: var(--line); margin: 0 6px; }
.dash-user {
  background: transparent; border: 0;
  text-align: right;
  padding: 0 8px;
  cursor: pointer;
}
.dash-user-name { font-size: 13px; font-weight: 600; color: var(--ink); }
.dash-user-role { font-size: 11px; color: var(--muted); }
.dash-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0B2545, #1A3A66);
  color: #fff;
  display: grid; place-items: center;
  font-size: 12px; font-weight: 600;
  font-family: "JetBrains Mono", monospace;
  letter-spacing: 0.04em;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px var(--line);
}

/* PAGE */
.dash-page { padding: 28px; flex: 1; min-width: 0; min-height: 0; overflow: auto; }

.dash-pagehead {
  display: flex; align-items: flex-end; justify-content: space-between;
  margin-bottom: 24px;
}
.dash-eyebrow {
  font-family: "JetBrains Mono", monospace;
  font-size: 10.5px;
  letter-spacing: 0.16em;
  color: var(--muted);
  margin-bottom: 6px;
}
.dash-h1 {
  font-size: 32px;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 0;
  color: var(--ink);
}
.dash-bread {
  margin-top: 6px;
  font-size: 12.5px; color: var(--muted);
  font-family: "JetBrains Mono", monospace;
}

.dash-actions { display: flex; gap: 10px; }
.dash-btn-ghost,
.dash-btn-primary {
  height: 40px;
  padding: 0 16px;
  border-radius: 8px;
  font-size: 13px; font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  display: inline-flex; align-items: center; gap: 8px;
  border: 1px solid transparent;
  transition: filter .15s, background .15s;
}
.dash-btn-ghost {
  background: #fff;
  border-color: var(--line);
  color: var(--ink-2);
}
.dash-btn-ghost:hover { background: var(--surface-2); }

/* Menu de importacao (Arquivo .DMP / Arquivo(s) .CGE / Pasta com .CGE).
   Aparece abaixo do botao "Importar". Fecha ao clicar fora ou em um item. */
.import-menu-wrap { position: relative; display: inline-block; }
.import-menu-pop {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 220px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 6px 24px rgba(11,42,74,0.10);
  padding: 6px;
  z-index: 50;
}
.import-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 12px;
  background: transparent;
  border: 0;
  border-radius: 6px;
  font-family: inherit;
  font-size: 13px;
  color: var(--ink, #0F1B2D);
  cursor: pointer;
  text-align: left;
}
.import-menu-item:hover { background: var(--surface-2, #F5F6F8); }
.import-menu-item__lbl { display: flex; flex-direction: column; gap: 2px; }
.import-menu-item__sub {
  font-size: 11px;
  color: var(--muted, #6B7280);
  font-weight: 400;
}
.import-menu-item__icon {
  width: 18px; height: 18px;
  flex-shrink: 0;
  color: var(--muted, #6B7280);
}

/* Resumo final da importacao em lote (.cge) — exibido pelo
   ImportCgeProgressModal apos receber o evento 'fim'. */
.import-summary {
  list-style: none;
  margin: 0 0 12px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  color: var(--ink, #0F1B2D);
}
.import-summary li::before {
  display: inline-block;
  width: 14px;
  text-align: center;
  margin-right: 8px;
  font-family: "JetBrains Mono", monospace;
}
.import-summary li::before        { content: "•"; color: var(--muted, #6B7280); }
.import-summary li.is-ok::before  { content: "✓"; color: #1F7A4D; }
.import-summary li.is-warn::before{ content: "↺"; color: #B97400; }
.import-summary li.is-fail::before{ content: "✗"; color: #B42318; }

.import-details {
  margin-top: 8px;
  border-top: 1px solid var(--line, #E5E7EB);
  padding-top: 8px;
}
.import-details summary {
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-2, #374151);
  user-select: none;
  padding: 4px 0;
}
.import-details summary:hover { color: var(--ink, #0F1B2D); }
.import-list {
  margin: 6px 0 0;
  padding: 0 0 0 18px;
  font-size: 12px;
  color: var(--muted, #6B7280);
  max-height: 200px;
  overflow-y: auto;
  font-family: "JetBrains Mono", monospace;
}
.import-list li { margin: 2px 0; word-break: break-all; }
.dash-btn-primary {
  color: #fff;
  border: 0;
}
.dash-btn-primary:hover { filter: brightness(1.05); }

/* KPI cards */
.dash-kpis {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}
.kpi {
  position: relative;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
}

/* Icone "i" + tooltip on hover/focus. Por padrao eh inline (usado tambem
   no header de Cards via <InfoTip>); dentro de um .kpi vira absolute pra
   ancorar no canto superior direito do card. */
.kpi-info {
  position: relative;
  width: 22px; height: 22px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%;
  color: var(--muted);
  cursor: help;
  outline: none;
}
.kpi .kpi-info {
  position: absolute;
  top: 10px; right: 10px;
}
.kpi-info:hover, .kpi-info:focus { color: var(--ink); background: var(--line); }
.kpi-info-tip {
  position: absolute;
  top: calc(100% + 10px);
  right: -8px;
  width: 280px;
  padding: 12px 14px;
  background: #0F1B2D;
  color: #D8DEE8;
  font-family: "Inter", sans-serif;
  font-size: 12px;
  line-height: 1.55;
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(15,27,45,0.20);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition: opacity .15s ease, transform .15s ease, visibility .15s;
  pointer-events: none;
  z-index: 30;
  white-space: normal;
  text-align: left;
}
/* Seta apontando pra cima (icone fica acima do tooltip). */
.kpi-info-tip::after {
  content: '';
  position: absolute;
  bottom: 100%;
  right: 14px;
  border: 6px solid transparent;
  border-bottom-color: #0F1B2D;
}
.kpi-info-tip strong {
  display: block;
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent, #E08B2A);
  margin-top: 4px;
}
.kpi-info-tip strong:first-child { margin-top: 0; }
.kpi-info-tip p { margin: 4px 0 8px; color: #D8DEE8; }
.kpi-info-tip p:last-child { margin-bottom: 0; }
.kpi-info-tip em { color: #fff; font-style: normal; font-weight: 600; }
.kpi-info-tip code {
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  background: rgba(255,255,255,0.10);
  padding: 1px 4px;
  border-radius: 3px;
}
.kpi-info:hover .kpi-info-tip,
.kpi-info:focus .kpi-info-tip {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.kpi-label {
  font-size: 12.5px; color: var(--muted);
  font-weight: 500;
}
.kpi-row {
  display: flex; align-items: flex-end; justify-content: space-between;
  margin-top: 8px;
}
.kpi-value {
  font-family: "JetBrains Mono", monospace;
  font-size: 32px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--ink);
  line-height: 1;
}
.kpi-delta {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11.5px; font-weight: 600;
  margin-top: 8px;
  font-family: "JetBrains Mono", monospace;
}
.kpi-delta.up { color: #1A7A4E; }
.kpi-delta.down { color: #C0382B; }
.kpi-unit { color: var(--muted); font-weight: 500; margin-left: 6px; }

/* Rows */
.dash-row {
  display: grid;
  gap: 16px;
  margin-bottom: 20px;
}
.dash-row:has(.dash-chart) { grid-template-columns: 2fr 1fr; }
.dash-row:has(.dash-table) { grid-template-columns: 1.55fr 1fr; }
/* Override: quando o row foi marcado como full (mapa removido), a tabela
   ocupa 100% da largura disponivel. */
.dash-row.dash-row-full { grid-template-columns: 1fr; }

.d-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
  display: flex; flex-direction: column;
  min-width: 0;
}
.d-card-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line-2);
}
.d-card-head h3 {
  font-size: 14px; font-weight: 600; margin: 0;
  letter-spacing: -0.005em;
}
.d-card-body { padding: 18px 20px; flex: 1; min-width: 0; }

.d-pill {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  height: 30px;
  padding: 0 10px;
  font-size: 12px; font-weight: 500;
  color: var(--ink-2);
  display: inline-flex; align-items: center; gap: 6px;
  cursor: pointer;
}
.d-pill:hover { background: var(--surface-2); }

.d-select {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  height: 30px;
  padding: 0 28px 0 10px;
  font-family: inherit;
  font-size: 12px; font-weight: 500;
  color: var(--ink-2);
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' fill='none' stroke='%23667085' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'><path d='M3 5l3 3 3-3'/></svg>");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 10px;
  cursor: pointer;
}
.d-select:hover { background-color: var(--surface-2); }
.d-select-group { display: inline-flex; gap: 8px; }

/* ===== Filtros do grafico de Producao (botao + popover) ============
   Substitui a fileira de selects (.d-select-group) no header do card. Um
   unico trigger abre um popover ancorado a direita com todos os controles
   agrupados (metrica, granularidade, periodo, maquina, diametro do trado). */
.prod-filtros-wrap {
  position: relative;
  display: inline-flex;
}
.prod-filtros-trigger {
  display: inline-flex; align-items: center; gap: 6px;
  height: 32px;
  padding: 0 12px;
  font-size: 13px; font-weight: 500;
  color: var(--ink-2);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
  font-family: inherit;
  transition: background .15s, border-color .15s;
}
.prod-filtros-trigger:hover { background: var(--surface-2); }
.prod-filtros-trigger.is-open {
  background: var(--surface-2);
  border-color: var(--line-2);
}
.prod-filtros-badge {
  display: inline-grid; place-items: center;
  min-width: 18px; height: 18px;
  padding: 0 5px;
  font-size: 10.5px; font-weight: 700;
  background: var(--accent, #E08B2A);
  color: #fff;
  border-radius: 999px;
  margin-left: 2px;
}
.prod-filtros-pop {
  position: absolute;
  top: calc(100% + 6px); right: 0;
  width: 280px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 16px 40px rgba(15, 27, 45, .18), 0 2px 6px rgba(15, 27, 45, .08);
  padding: 14px;
  z-index: 50;
  display: flex; flex-direction: column; gap: 12px;
}
.prod-filtros-grupo {
  display: flex; flex-direction: column; gap: 6px;
}
.prod-filtros-rotulo {
  font-size: 10.5px; font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
  font-family: "JetBrains Mono", monospace;
}
.prod-filtros-seg {
  display: inline-flex;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 2px;
  gap: 2px;
}
.prod-filtros-seg-btn {
  flex: 1;
  height: 28px;
  padding: 0 10px;
  font-size: 12.5px; font-weight: 500;
  color: var(--ink-2);
  background: transparent;
  border: 0;
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
  transition: background .12s, color .12s;
}
.prod-filtros-seg-btn:hover { color: var(--ink); }
.prod-filtros-seg-btn.is-active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 1px 2px rgba(15, 27, 45, .08);
}
.prod-filtros-select { width: 100%; }
.prod-filtros-rodape {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}
.prod-filtros-limpar {
  font-size: 12px; font-weight: 500;
  color: var(--accent);
  background: transparent;
  border: 0;
  cursor: pointer;
  font-family: inherit;
  padding: 4px 0;
}
.prod-filtros-limpar:hover { text-decoration: underline; }
.prod-filtros-ok {
  height: 32px;
  padding: 0 18px;
  font-size: 13px; font-weight: 600;
  color: #fff;
  background: var(--accent, #E08B2A);
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  font-family: inherit;
  transition: filter .15s;
}
.prod-filtros-ok:hover { filter: brightness(1.05); }
.prod-filtros-ok:active { filter: brightness(0.95); }

/* Linha "toggle" (label + descricao + switch) usada no popover. Compacta o
   suficiente para nao competir com os grupos rotulados acima. */
.prod-filtros-switch {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-top: 1px solid var(--line);
  cursor: pointer;
}
.prod-filtros-switch-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
}
.prod-filtros-switch-desc {
  display: block;
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 2px;
}
.prod-filtros-toggle {
  position: relative;
  flex-shrink: 0;
  width: 32px; height: 18px;
}
.prod-filtros-toggle input {
  position: absolute;
  width: 100%; height: 100%;
  opacity: 0;
  margin: 0;
  cursor: pointer;
}
.prod-filtros-toggle-track {
  position: absolute;
  inset: 0;
  background: var(--line-2);
  border-radius: 999px;
  transition: background .15s;
}
.prod-filtros-toggle-track::before {
  content: "";
  position: absolute;
  top: 2px; left: 2px;
  width: 14px; height: 14px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 1px 2px rgba(15, 27, 45, .18);
  transition: transform .15s;
}
.prod-filtros-toggle input:checked + .prod-filtros-toggle-track {
  background: var(--accent, #E08B2A);
}
.prod-filtros-toggle input:checked + .prod-filtros-toggle-track::before {
  transform: translateX(14px);
}
/* No dark, --surface (#121C2B) e --bg (#0B131F) sao quase iguais, entao o
   popover ficava confundido com a pagina. Forcamos um fundo levemente mais
   claro que --surface e uma sombra preta (rgba 0,0,0) com opacidade maior
   pra dar uma sensacao de elevacao real em vez da sombra navy-on-navy. */
[data-theme="dark"] .prod-filtros-pop {
  background: #1B2638;
  border-color: #2A3950;
  box-shadow: 0 16px 40px rgba(0, 0, 0, .55), 0 2px 6px rgba(0, 0, 0, .35);
}

.dash-link {
  font-size: 12.5px; font-weight: 500;
  color: var(--accent);
  text-decoration: none;
  background: transparent;
  border: 0;
  padding: 0;
  cursor: pointer;
  font-family: inherit;
}
.dash-link:hover { text-decoration: underline; }

/* Mapa miniatura no card do dashboard */
.dash-map-mini {
  width: 100%;
  height: 220px;
  border-radius: 8px;
  overflow: hidden;
  background: #F6F8FB;
  border: 1px solid var(--line-2);
}
.dash-map-mini-canvas {
  width: 100%;
  height: 100%;
}

/* Chart */
.prod-chart-wrap { width: 100%; }
.prod-chart { width: 100%; height: 240px; display: block; }
/* Reduz o padding do card do grafico de producao pra dar mais espaco
   visual ao SVG (que ocupa todo o body). */
.d-card.dash-chart .d-card-body { padding: 10px 14px; }

/* Tooltip do gráfico de produção (ProductionChart) — aparece ao passar
   o mouse, posicionado relativo ao wrapper. pointer-events:none pra nao
   bloquear o onMouseMove do SVG quando o mouse passa por cima dele. */
.prod-tooltip {
  position: absolute;
  pointer-events: none;
  background: #0F1B2D;
  color: #fff;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 12px;
  box-shadow: 0 6px 20px rgba(15,27,45,0.20);
  z-index: 5;
  white-space: nowrap;
}
.prod-tooltip-label {
  font-family: "JetBrains Mono", monospace;
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #9AA8C4;
  margin-bottom: 2px;
}
.prod-tooltip-valor strong {
  font-size: 15px;
  font-weight: 700;
}
.prod-tooltip-unit {
  font-size: 11px;
  margin-left: 4px;
  color: #B8C2D6;
}

/* Tooltip do sparkline dos KPIs — menor, fica acima do mini-grafico. */
.kpi-tooltip {
  position: absolute;
  pointer-events: none;
  background: #0F1B2D;
  color: #fff;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 11.5px;
  white-space: nowrap;
  box-shadow: 0 4px 12px rgba(15,27,45,0.20);
  z-index: 5;
  font-family: "JetBrains Mono", monospace;
}
.kpi-tooltip strong { font-weight: 700; font-size: 12px; }
.kpi-tooltip-unit { color: #9AA8C4; margin-left: 4px; font-size: 10px; }
.dash-legend {
  display: flex; gap: 18px;
  margin-top: 8px;
  font-size: 12px; color: var(--muted);
}
.dash-legend i {
  display: inline-block;
  width: 10px; height: 10px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: middle;
}

/* Front list */
.front-list {
  list-style: none; margin: 0; padding: 0;
  display: flex; flex-direction: column; gap: 14px;
  /* Acima de 4 obras a lista rola — altura calculada empiricamente
     baseada na linha tipica com nome + contrato + tags + barra + gap. */
  max-height: 305px; overflow-y: auto;
  /* Nunca rola na horizontal: textos longos devem truncar/quebrar
     no proprio item (ver .fl-name / .fl-crew / .fl-tags abaixo). */
  overflow-x: hidden;
}
/* Linhas clicaveis abrem a tela de detalhes da obra — hover sutil indica
 * que sao interativas. So aplica quando o onClick esta presente (role=button). */
.front-list li[role="button"] {
  padding: 8px 10px;
  margin: -8px -10px;
  border-radius: 8px;
  transition: background .12s;
}
.front-list li[role="button"]:hover { background: var(--line-2); }
.front-list li[role="button"]:focus-visible {
  outline: 2px solid var(--accent, #E08B2A);
  outline-offset: 2px;
}
.fl-row { display: flex; align-items: center; gap: 12px; min-width: 0; }
.fl-status {
  width: 8px; height: 8px; border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 0 0 3px color-mix(in oklab, currentColor 12%, transparent);
}
.fl-info { flex: 1; min-width: 0; }
.fl-name {
  font-size: 13px; font-weight: 600; color: var(--ink);
  /* Trunca nomes longos com elipse pra evitar scroll lateral no card */
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.fl-crew {
  font-size: 11.5px; color: var(--muted); margin-top: 1px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.fl-tags {
  font-family: "JetBrains Mono", monospace;
  font-size: 10.5px; letter-spacing: 0.06em;
  color: var(--muted); margin-top: 3px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.fl-pct {
  font-family: "JetBrains Mono", monospace;
  font-size: 13px; font-weight: 600; color: var(--ink);
}
.fl-bar {
  height: 4px; background: var(--line-2);
  border-radius: 999px; margin-top: 8px; overflow: hidden;
}
.fl-bar > span { display: block; height: 100%; border-radius: inherit; transition: width .3s; }
.fl-edit {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; padding: 0;
  border: 1px solid transparent; border-radius: 6px;
  background: transparent; color: var(--muted); cursor: pointer;
  flex-shrink: 0;
}
.fl-edit:hover { background: var(--line-2); color: var(--ink); }
.fl-edit:focus-visible { outline: none; border-color: var(--accent, #E08B2A); }
.fl-edit-danger:hover { background: rgba(209, 67, 67, 0.12); color: #D14343; }
.front-list li.is-finalizada .fl-name,
.front-list li.is-finalizada .fl-pct { color: var(--muted); }
.front-list li.is-finalizada .fl-name { text-decoration: line-through; text-decoration-color: var(--line); }
.fl-badge {
  display: inline-block; margin-left: 8px; padding: 1px 8px;
  font-family: "JetBrains Mono", monospace;
  font-size: 9.5px; letter-spacing: 0.08em; text-transform: uppercase;
  font-weight: 600;
  color: var(--muted); background: var(--line-2); border-radius: 999px;
  vertical-align: middle;
}

/* Pile table */
.pile-table-wrap {
  max-height: 320px;
  overflow-y: auto;
  overflow-x: hidden;
}
.pile-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.pile-table thead th {
  text-align: center;
  font-family: "JetBrains Mono", monospace;
  font-size: 10px;
  letter-spacing: 0.12em;
  color: var(--muted-2);
  font-weight: 500;
  padding: 8px 0 12px;
  border-bottom: 1px solid var(--line-2);
  position: sticky;
  top: 0;
  background: var(--card, #fff);
  z-index: 1;
}
.pile-table tbody td { text-align: center; }
.pt-empty {
  padding: 24px 0;
  text-align: center;
  color: var(--muted-2);
  font-size: 12.5px;
}
.pile-table tbody tr.pt-row-clicavel { cursor: pointer; transition: background .12s ease; }
.pile-table tbody tr.pt-row-clicavel:hover { background: var(--line-2, #F2F4F8); }
.pile-table tbody tr.pt-row-clicavel:focus { outline: none; background: var(--line-2, #F2F4F8); }
.pile-table tbody td {
  padding: 12px 0;
  border-bottom: 1px solid var(--line-2);
  color: var(--ink-2);
}
.pile-table tbody tr:last-child td { border-bottom: 0; }
.pt-id { font-family: "JetBrains Mono", monospace; font-weight: 600; color: var(--ink); }
.pt-num { font-family: "JetBrains Mono", monospace; }
.pt-badge {
  display: inline-block;
  padding: 2px 8px; border-radius: 999px;
  font-size: 10.5px; font-weight: 600;
  font-family: "JetBrains Mono", monospace;
  letter-spacing: 0.04em; text-transform: uppercase;
}
.pt-prog {
  width: 80px;
  height: 4px; background: var(--line-2); border-radius: 999px;
  margin-left: auto; overflow: hidden;
}
.pt-prog > span { display: block; height: 100%; }

/* Site map */
.site-map { display: flex; flex-direction: column; gap: 10px; }
.site-map-svg { width: 100%; height: 220px; border-radius: 8px; display: block; }
.site-map-legend {
  display: flex; gap: 14px;
  font-size: 11.5px; color: var(--muted);
}
/* Toasts */
.toast-host {
  position: fixed;
  right: 20px;
  top: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  background: #1A7A4E;
  color: #fff;
  padding: 12px 16px;
  border-radius: 8px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .18);
  font-size: 13px;
  font-weight: 600;
  min-width: 220px;
  max-width: 360px;
  animation: toast-in .22s ease-out;
}
.toast-info { background: #1A7A4E; }
@keyframes toast-in {
  from { transform: translateY(-8px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

.site-map-legend i {
  display: inline-block;
  width: 8px; height: 8px; border-radius: 50%;
  margin-right: 6px;
  vertical-align: middle;
}

/* ============================================================
   DARK THEME OVERRIDES
   Centraliza ajustes pra componentes que ainda hardcodam cores
   light. Cada regra aqui sobrescreve a base via especificidade
   (uma camada extra de seletor). Quando um componente migrar
   pra usar tokens diretamente, a regra correspondente aqui pode
   ser removida sem perda.
============================================================ */
[data-theme="dark"] body { background: var(--bg); }

/* Header / topo */
[data-theme="dark"] .dash-head { background: var(--surface); }
[data-theme="dark"] .dash-search-popover { background: var(--surface); }
[data-theme="dark"] .dash-search kbd { background: var(--surface); }
[data-theme="dark"] .dash-icon-badge { border-color: var(--surface); }
[data-theme="dark"] .dash-avatar { border-color: var(--surface); box-shadow: 0 0 0 1px var(--line); }

/* Botoes do dashboard */
[data-theme="dark"] .dash-btn-ghost { background: var(--surface); color: var(--ink-2); }
[data-theme="dark"] .dash-btn-ghost:hover { background: var(--surface-2); }

/* Menu de importacao */
[data-theme="dark"] .import-menu-pop { background: var(--surface); }

/* KPI cards */
[data-theme="dark"] .kpi { background: var(--surface); }

/* Card generico (usado por Card React) */
[data-theme="dark"] .d-card { background: var(--surface); }
[data-theme="dark"] .d-pill { background: var(--surface); color: var(--ink-2); }
[data-theme="dark"] .d-pill:hover { background: var(--surface-2); }
[data-theme="dark"] .d-select { background-color: var(--surface); color: var(--ink-2); }

/* Tabelas (Contratos / Maquinas / Ultimas estacas) */
[data-theme="dark"] .table-card { background: var(--surface); }
[data-theme="dark"] .tc-filter { background: var(--surface-2); }
[data-theme="dark"] .tc-filter-search { background: var(--surface); }
[data-theme="dark"] .tc-grid-header { background: var(--surface-2); }
[data-theme="dark"] .tc-row:hover { background: var(--surface-2); }
[data-theme="dark"] .tc-act-btn:hover { background: var(--surface-2); border-color: var(--line); }
[data-theme="dark"] .tc-row.is-editing { background: var(--surface-2); }
[data-theme="dark"] .tc-input { background: var(--surface); color: var(--ink); }
[data-theme="dark"] .tc-suggest { background: var(--surface); }
[data-theme="dark"] .tc-suggest li:hover { background: var(--surface-2); }

/* Modais */
[data-theme="dark"] .modal { background: var(--surface); }
[data-theme="dark"] .modal-foot { background: var(--surface-2); }
[data-theme="dark"] .modal-foot .btn-ghost { background: var(--surface); color: var(--ink); }
[data-theme="dark"] .modal-foot .btn-ghost:hover { background: var(--surface-2); }
[data-theme="dark"] .modal-backdrop { background: rgba(0,0,0,0.65); }

/* Inputs em formularios genericos */
[data-theme="dark"] .field-input { background: var(--surface); color: var(--ink); border-color: var(--line); color-scheme: dark; }
[data-theme="dark"] .field-input:focus { border-color: var(--accent, #E08B2A); }
[data-theme="dark"] .field-input[type="date"]::-webkit-calendar-picker-indicator {
  cursor: pointer;
  opacity: 0.85;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23E8EEF8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><rect x='3' y='4' width='18' height='18' rx='2' ry='2'/><line x1='16' y1='2' x2='16' y2='6'/><line x1='8' y1='2' x2='8' y2='6'/><line x1='3' y1='10' x2='21' y2='10'/></svg>");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 16px 16px;
  color: transparent;
}
[data-theme="dark"] .field-input[type="date"]::-webkit-calendar-picker-indicator:hover { opacity: 1; }

/* Mapa (pagina dedicada) */
[data-theme="dark"] .map-page .btn-ghost { background: var(--surface); color: var(--ink); }
[data-theme="dark"] .map-page .btn-ghost:hover { background: var(--surface-2); border-color: var(--line); }
[data-theme="dark"] .map-card { background: var(--surface-2); }
[data-theme="dark"] .map-zoom { background: var(--surface); border-color: var(--line); }
[data-theme="dark"] .map-zoom button { background: var(--surface); color: var(--ink); }
[data-theme="dark"] .map-zoom button:hover { background: var(--surface-2); }
[data-theme="dark"] .map-legend { background: var(--surface); color: var(--ink); border-color: var(--line); }
[data-theme="dark"] .map-scale { background: rgba(18,28,43,0.85); color: var(--ink); }

/* Monitoramento */
[data-theme="dark"] .mon-page .strip-card { background: var(--surface); }

/* Status / badges (usuarios) — mantem matiz, sobe luminosidade pra
   garantir contraste sobre fundo escuro. */
[data-theme="dark"] .usuarios-papel.papel-admin_sistema { color: #FF9D6E; background: rgba(232,81,30,.18); }
[data-theme="dark"] .usuarios-papel.papel-admin_cliente { color: #57D499; background: rgba(34,160,107,.18); }
[data-theme="dark"] .usuarios-papel.papel-usuario       { color: #87A6F2; background: rgba(59,110,224,.18); }
[data-theme="dark"] .usuarios-status.is-on  { color: #57D499; background: rgba(34,160,107,.18); }
[data-theme="dark"] .usuarios-status.is-off { color: var(--muted); background: rgba(255,255,255,.05); }
[data-theme="dark"] .kpi-delta.up   { color: #57D499; }
[data-theme="dark"] .kpi-delta.down { color: #F37771; }

/* Tabela de usuarios */
[data-theme="dark"] .usuarios-tabela thead th { background: var(--surface-2); color: var(--muted); }
[data-theme="dark"] .usuarios-tabela tbody td { border-color: var(--line); }
[data-theme="dark"] .usuarios-erro { color: #F37771; }

/* Sidebar — em light fica navy; em dark escurece pra alinhar com o
   fundo do conteudo principal e nao competir visualmente. */
[data-theme="dark"] .dash-side {
  background: linear-gradient(180deg, #0A1220 0%, #060B14 100%);
  color: var(--ink-2);
}

/* Tabela "Ultimas estacas executadas" (PileTable). thead usa
   var(--card, #fff) — sem fallback de tema, fica branco. */
[data-theme="dark"] .pile-table thead th { background: var(--surface); }

/* Tabela da PastaPlanilha (planilha de estacas) — thead sticky branco. */
[data-theme="dark"] .pasta-planilha-tabela thead th { background: var(--surface); }

/* Botao "Ver tabela de enderecos" abaixo do mapa */
[data-theme="dark"] .scroll-hint { background: var(--surface); }
[data-theme="dark"] .scroll-hint:hover { border-color: var(--line); color: var(--ink); }

/* Foot-nav de navegacao entre estacas (aparece abaixo do iframe) */
[data-theme="dark"] .estaca-foot-nav {
  background: var(--surface);
  border-color: var(--line);
}
[data-theme="dark"] .estaca-foot-nav__btn { color: var(--ink); }
[data-theme="dark"] .estaca-foot-nav__btn:disabled { color: var(--muted); }
[data-theme="dark"] .estaca-foot-nav__btn:disabled .estaca-foot-nav__arrow { color: var(--muted); }
/* "Estaca X de Y" no centro: o <strong> tem color #0F1115 hardcoded
   no light, que some no fundo escuro. Forca a cor de tinta clara. */
[data-theme="dark"] .estaca-foot-nav__center { color: var(--muted); }
[data-theme="dark"] .estaca-foot-nav__center strong { color: var(--ink); }

/* Wrapper do iframe do editor de estacas — em dark, escurece o
   "fundo" que aparece nas bordas do modal. */
[data-theme="dark"] .editor-iframe-modal { background: #0B131F; }

/* Modal Adicionar/Editar usuario — inputs e botoes auxiliares (mostrar/
   gerar/copiar senha) hardcodam #fff. */
[data-theme="dark"] .usuario-form-inp {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--line);
}
[data-theme="dark"] .usuario-form-senha-btn {
  background: var(--surface);
  color: var(--ink-2);
  border-color: var(--line);
}
[data-theme="dark"] .usuario-form-senha-btn:hover:not(:disabled) {
  background: var(--surface-2);
  border-color: var(--ink-2);
  color: var(--ink);
}
[data-theme="dark"] .usuario-papel-opt { border-color: var(--line); }
[data-theme="dark"] .usuario-papel-opt:hover { background: var(--surface-2); }
[data-theme="dark"] .usuario-papel-opt.is-on { background: rgba(232,139,42,.12); }

/* Atribuicao do Google Maps (copyright/termos/atalhos) — exigida pelos
   ToS, entao nao removemos. Em dark mode, escurece o fundo e clareia
   o texto pra que a barra deixe de competir visualmente. */
[data-theme="dark"] .gm-style-cc { background: transparent !important; }
[data-theme="dark"] .gm-style-cc > div,
[data-theme="dark"] .gm-style-cc span {
  background: rgba(15,24,39,0.78) !important;
  color: var(--ink-2) !important;
}
[data-theme="dark"] .gm-style-cc a {
  color: var(--muted) !important;
}
[data-theme="dark"] .gm-style-cc a:hover {
  color: var(--ink) !important;
}

/* ============================================================
   RESPONSIVO — MOBILE (<= 767px)
   So visualizacao: telas de edicao seguem desktop-only.
============================================================ */

/* Botao hamburguer no header (so aparece em mobile). */
.dash-hamburguer {
  display: none;
  background: transparent;
  border: 0;
  width: 38px; height: 38px;
  border-radius: 8px;
  color: var(--ink-2);
  cursor: pointer;
  align-items: center;
  justify-content: center;
}
.dash-hamburguer:hover { background: var(--surface-2); }

/* Backdrop semitransparente do drawer (so renderiza quando aberto). */
.dash-side-backdrop {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 99;
}

@media (max-width: 767px) {
  /* ---------- LOGIN ---------- */
  .login-root { grid-template-columns: 1fr; }
  .login-brand { display: none; }
  .login-main { padding: 16px; }
  .login-card {
    padding: 28px 22px 24px;
    border-radius: 12px;
  }
  .login-card-title { font-size: 22px; }
  .login-card-sub { font-size: 13px; margin-bottom: 20px; }

  /* ---------- DASHBOARD ---------- */
  /* Layout single-column: sidebar vira off-canvas drawer */
  .dash-root,
  .dash-root.is-compact {
    grid-template-columns: 1fr;
  }
  .dash-side {
    position: fixed;
    left: 0; top: 0; bottom: 0;
    width: 280px;
    z-index: 100;
    transform: translateX(-100%);
    transition: transform .22s ease;
    box-shadow: 4px 0 24px rgba(0,0,0,.35);
  }
  .dash-side.is-aberto { transform: translateX(0); }
  .dash-side-backdrop.is-aberto { display: block; }
  .dash-hamburguer { display: inline-flex; }

  /* Header compacto e fixo no topo — em mobile o .dash-page rola e o
     .dash-head precisa permanecer visivel pra o hamburger nunca sumir. */
  .dash-head {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 50;
    padding: 0 12px;
    gap: 8px;
    height: 56px;
  }
  /* Busca habilitada em mobile — ocupa o espaco entre o hamburger e os
     tools (lado direito). Versao compacta pra caber em ~390px de largura. */
  .dash-search {
    height: 36px;
    padding: 0 10px;
    gap: 6px;
    min-width: 0;
    flex: 1;
  }
  /* iOS Safari aplica zoom automatico em inputs/select/textarea com
     font-size < 16px ao receber foco — zoom que so sai com pinch out.
     Forca minimo 16px em todos eles no mobile pra evitar esse bug.
     A versao desktop dos estilos individuais mantem o tamanho original. */
  input, textarea, select {
    font-size: 16px !important;
  }
  /* Esconde atalhos do lado direito pra abrir espaco pra busca.
     Configuracoes/notificacoes/avatar continuam acessiveis via menu
     lateral (sidebar). Mantem TemaToggle + Sair. */
  .dash-head-tools .dash-icon-btn[title="Configurações"],
  .dash-head-tools .dash-icon-btn[title="Notificações"],
  .dash-head-tools .dash-divider,
  .dash-head-tools .dash-avatar { display: none; }
  /* Nome+empresa do usuario tambem escondidos — so o atalho de Sair fica. */
  .dash-user { display: none; }
  .dash-head-tools { gap: 2px; }

  /* Padding interno das paginas reduzido pra ganhar largura util.
     `overflow-x: hidden` previne scroll lateral acidental por filhos
     que ainda nao foram migrados pro mobile.
     `padding-top: 72px` reserva o espaco do .dash-head fixo (56px) +
     16px de respiro. .dash-page-grafico / .dash-page-detalhes-obra
     sobrescrevem com 56px (sem respiro extra, pra o iframe encostar).
     `padding-bottom` precisa ser generoso pra o ultimo card nao encostar
     na home indicator do iOS (PWA / Safari mobile). Usa safe-area-inset
     pra somar a area protegida do dispositivo + 48px de respiro visual. */
  .dash-page {
    padding: 72px 12px calc(48px + env(safe-area-inset-bottom, 0px));
    overflow-x: hidden;
  }
  /* padding-top: 56px (altura do .dash-head) + 12px de respiro + safe-area
     inset do iOS. No iPhone em modo PWA (viewport-fit=cover) o topo do
     iframe estava sendo cortado pela barra fixa — o env() resolve. Em
     navegador desktop e Android, env(safe-area-inset-top) cai pra 0px e
     o layout fica igual ao simulador (56 + 12 = 68px). */
  .dash-page.dash-page-grafico { padding-top: calc(68px + env(safe-area-inset-top, 0px)); }
  .dash-page.dash-page-detalhes-obra { padding-top: calc(68px + env(safe-area-inset-top, 0px)); }

  /* Tela do grafico em mobile: pagehead INTEIRA escondida (nome do arquivo,
     subtitulo E o eyebrow com nome da obra). O nome da obra agora aparece
     dentro do proprio card de dados da estaca (header-obra em
     graficos.html), eliminando o duplo scroll (pagina + card). */
  .dash-page-grafico .dash-pagehead { display: none; }
  /* Iframe ocupa todo o espaco disponivel — sem altura fixa de
     calc(100vh-64px), que sobrava conteudo abaixo e exigia scroll na
     .dash-page. flex: 1 + min-height: 0 fazem ele preencher o restante
     da pagina e so o conteudo interno do iframe rola.
     Em mobile, removemos a aparencia de card (bg branco, border, radius,
     shadow) do frame: o iframe agora exibe dois cards separados (header
     da estaca + carrossel de graficos), com o bg da pagina visivel entre
     eles. Assim o usuario nao ve um card "engolindo" outros dois. */
  .dash-page-grafico .dash-grafico-frame {
    flex: 1;
    height: auto;
    min-height: 0;
    background: transparent;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    overflow: visible;
  }
  /* Trava o scroll da .dash-page no grafico — overflow: hidden evita o
     rubber-band do iOS Safari mesmo quando o conteudo cabe certinho.
     overscroll-behavior: contain impede que scroll do iframe propague
     pra pagina externa. So o conteudo interno do iframe rola. */
  .dash-page.dash-page-grafico {
    overflow: hidden;
    overscroll-behavior: contain;
  }

  /* Foot-nav (Anterior / Estaca X de Y / Proxima) escondido em mobile.
     Navegacao entre estacas vira gesto de arrastar (swipe) — tratado pelo
     script.js do iframe, que postMessage 'estaca-nav' pro parent. */
  .estaca-foot-nav { display: none !important; }

  /* Link "← Planilha" do EstacaGrafico em mobile — mesmo visual do
     .frota-voltar-mob (texto azul, sem pill, sem borda). Posicionado
     logo abaixo da .dash-head fixa (56px), ancorado a esquerda. */
  .grafico-voltar-mobile {
    display: inline-block;
    position: fixed;
    top: calc(64px + env(safe-area-inset-top, 0px));
    left: 16px;
    z-index: 50;
    background: transparent;
    border: 0;
    padding: 4px 0;
    color: var(--ink);
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }
  .grafico-voltar-mobile:active { opacity: .7; }

  /* d-card pega 100% da largura disponivel, mas se algum filho (chart,
     tabela) estourar, mantem dentro do card via overflow hidden no body. */
  .d-card { max-width: 100%; }
  .d-card-body { overflow-x: hidden; }

  /* Esconde as acoes admin (Importar, Adicionar obra, Adicionar maquina,
     Adicionar usuario, etc.) no header de cada pagina — mobile e somente
     visualizacao. */
  .dash-actions { display: none !important; }

  /* Esconde itens de menu admin/desktop-only em mobile. As respectivas
     paginas continuam funcionando se acessadas por URL, mas nao aparecem
     no menu hamburguer pra reforcar o escopo "consulta". */
  .dash-nav-item[data-nav-id="monitoramento"],
  .dash-nav-item[data-nav-id="usuarios"],
  .dash-nav-item[data-nav-id="maquinas"] {
    display: none !important;
  }

  /* ---------- KPI cards: 1 coluna em mobile ---------- */
  .dash-kpis {
    grid-template-columns: 1fr;
    gap: 12px;
    margin-bottom: 16px;
  }
  .kpi { padding: 14px 16px; }
  .kpi-value { font-size: 26px; }

  /* ---------- Rows do dashboard sempre em 1 coluna ---------- */
  .dash-row,
  .dash-row:has(.dash-chart),
  .dash-row:has(.dash-table),
  .dash-row.dash-row-full {
    grid-template-columns: 1fr;
    gap: 12px;
    margin-bottom: 16px;
  }
  .d-card-head {
    padding: 12px 14px;
    flex-wrap: wrap;
    gap: 10px;
    /* Empilha titulo em cima, controles embaixo (que tambem se quebram) */
    align-items: flex-start;
  }
  .d-card-head h3 { font-size: 13px; }
  .d-card-body { padding: 14px; }

  /* Permite os filtros (Mensal / Maquinas / Periodo) quebrarem em
     linhas em vez de estourar a tela */
  .d-select-group {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    width: 100%;
  }
  .d-select {
    flex: 1 1 auto;
    min-width: 0;
    max-width: 100%;
  }

  /* ---------- Tabela "ultimas estacas": vira lista de cards ----------
     Cada <tr> vira um card com pares "rotulo: valor" — sem scroll lateral.
     Os data-label nos <td> sao usados pelo ::before. O <tr> usa flex column
     pra permitir reordenar colunas via `order` (Obra no topo). */
  /* Aumenta o max-height herdado do desktop (.pile-table-wrap: 320px) pra
     caber uma celula inteira em mobile: cada <tr> agora tem ~340-360px
     (Obra+Estaca+fim+tag+diametro+prof+vol+consumo+alertas). 400px deixa
     uma celula inteira visivel + uma "espiada" da proxima como dica de
     que tem mais conteudo abaixo. Mantem o scroll interno (overflow-y
     herda do desktop como `auto`). */
  .pile-table-wrap { max-height: 400px; }
  .pile-table { min-width: 0; display: block; width: 100%; font-size: 13.5px; }
  .pile-table thead { display: none; }
  .pile-table tbody { display: block; }
  .pile-table tbody tr {
    display: flex;
    flex-direction: column;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 10px 12px;
    margin-bottom: 10px;
    background: var(--surface);
  }
  .pile-table tbody tr:last-child td { border: 0; }
  .pile-table tbody td {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    text-align: right !important;
    padding: 5px 0 !important;
    border: 0 !important;
    gap: 12px;
  }
  .pile-table tbody td::before {
    content: attr(data-label);
    color: var(--muted);
    font-weight: 500;
    font-size: 11.5px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-family: "JetBrains Mono", monospace;
    flex-shrink: 0;
  }
  /* "Estaca" e o identificador — destaque maior no topo do card */
  .pile-table tbody td.pt-id { font-size: 15px; font-weight: 600; padding-top: 2px !important; }
  /* Obra vira a primeira linha do card (ordem: -1 < default 0 dos demais).
     Estaca (pt-id) fica em segundo via `order: 0` herdado. */
  .pile-table tbody td[data-label="Obra"] { order: -1; }

  /* ---------- Pasta-planilha (estacas dentro do contrato): vira cards ----------
     Mesmo padrao do .pile-table — cada <tr> vira um card com pares
     "rotulo: valor". 15 colunas em scroll horizontal ficavam impossiveis de
     ler em mobile; a lista de cards usa scroll vertical natural. */
  .pasta-planilha-scroll {
    overflow: visible;
    max-height: none;
    margin: 0;
  }
  .pasta-planilha-tabela { display: block; width: 100%; min-width: 0; }
  .pasta-planilha-tabela thead { display: none; }
  .pasta-planilha-tabela tbody { display: block; }
  .pasta-planilha-tabela tbody tr {
    display: block;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 10px 12px;
    margin-bottom: 10px;
    background: var(--surface);
  }
  .pasta-planilha-tabela tbody td {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    text-align: right !important;
    padding: 5px 0 !important;
    border: 0 !important;
    gap: 12px;
    white-space: normal !important;
  }
  .pasta-planilha-tabela tbody td::before {
    content: attr(data-label);
    color: var(--muted);
    font-weight: 500;
    font-size: 10.5px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-family: "JetBrains Mono", monospace;
    flex-shrink: 0;
  }
  /* "Estaca" no topo do card — destaque visual maior */
  .pasta-planilha-tabela tbody td.pp-id {
    font-size: 14px;
    font-weight: 600;
    color: var(--ink);
    padding-top: 2px !important;
  }
  /* Contrato dentro do card e redundante (usuario clicou na pasta) */
  .pasta-planilha-tabela tbody td[data-label="Contrato"] { display: none !important; }

  /* ---------- Producao: popover de filtros em mobile ----------
     Os 4 selects antigos ficavam escondidos em mobile (ocupavam mais que o
     chart). Com o popover unificado, mantemos o botao visivel e o popover
     ocupa quase toda a largura, ancorado a direita. */
  .dash-chart .d-select-group { display: none; }
  .prod-filtros-pop {
    width: min(320px, calc(100vw - 32px));
  }

  /* ---------- FAB de baixar PNG (mobile) ----------
     Floating action button no canto inferior direito da tela do grafico.
     Substitui o "Relatorio PDF/XLSX" do pagehead (escondido em mobile).
     Chama /api/png (Puppeteer screenshot) — mesmo visual do PDF.
     Icone: SF Symbol "square.and.arrow.down" (padrao iOS de salvar). */
  .png-fab-mobile {
    position: fixed;
    bottom: 18px;
    right: 18px;
    z-index: 60;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--accent, #E08B2A);
    color: #fff;
    border: 0;
    border-radius: 999px;
    padding: 11px 18px 11px 16px;
    font-size: 14px;
    font-weight: 600;
    line-height: 1;
    box-shadow: 0 8px 20px rgba(15, 27, 45, 0.18),
                0 2px 4px rgba(15, 27, 45, 0.10);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }
  .png-fab-mobile:active { transform: scale(0.97); }
  .png-fab-mobile:disabled { opacity: 0.6; cursor: wait; }
  .png-fab-icon { display: block; }
  .png-fab-label { letter-spacing: 0.02em; }

  /* Spinner CSS no estado "gerando" — circulo com setor branco girando.
     Substitui o emoji de ampulheta (visual generico) por algo
     coerente com o resto da UI iOS-like. */
  .png-fab-spinner {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2.2px solid rgba(255, 255, 255, 0.35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: png-fab-spin 0.8s linear infinite;
  }
  @keyframes png-fab-spin {
    to { transform: rotate(360deg); }
  }

  /* ---------- Sombra "flutuante" em TODOS os cards do mobile ----------
     Aplica em cards genericos (.d-card), KPIs (.kpi) e nas listas
     convertidas em cards (.pile-table e .pasta-planilha-tabela). Sombra
     mais forte que --shadow-md, pra dar a sensacao de elevacao no toque. */
  .d-card,
  .kpi,
  .pile-table tbody tr,
  .pasta-planilha-tabela tbody tr {
    box-shadow:
      0 8px 20px rgba(15, 27, 45, 0.10),
      0 2px 6px rgba(15, 27, 45, 0.06);
  }

  /* ---------- FrontList (lista de obras): empilhar e reduzir paddings ---------- */
  .d-pill { font-size: 11px; padding: 4px 8px; }
  /* Remove o scroll interno do desktop (.front-list: max-height 305px) —
     em mobile a lista expande inteira e a propria pagina rola. Evita
     scroll-dentro-de-scroll que confunde o gesto de swipe.
     IMPORTANTE: usa `overflow: visible` (shorthand) em vez de so o eixo Y.
     Quando um eixo e' `hidden` e o outro `visible`, a spec coerce o
     `visible` pra `auto` — fica um scroll container invisivel que captura
     o touch antes da pagina rolar, causando a sensacao de "rubber-band"
     dentro do card. Shorthand zera os dois eixos. A truncacao horizontal
     ja' e' tratada nos filhos (.fl-name / .fl-crew / .fl-tags). */
  .front-list {
    max-height: none;
    overflow: visible;
  }

  /* ---------- Modais ocupam quase a tela toda ---------- */
  .modal { width: 96vw; max-width: 96vw; border-radius: 10px; }
  .modal-body { grid-template-columns: 1fr; padding: 14px 16px; }

  /* Modal de Nova/Editar obra (status da obra) — compacto em mobile.
     Menor que os outros modais porque os campos sao poucos (5 inputs)
     e o usuario ja viu o contexto no FrontList antes de abrir. */
  .modal-obra {
    width: 86vw !important;
    max-width: 86vw !important;
  }
  .modal-obra .modal-head { padding: 14px 16px 8px; }
  .modal-obra .modal-head h3 { font-size: 16px; }
  .modal-obra .modal-head p { font-size: 11.5px; }
  .modal-obra .modal-body { padding: 12px 16px; gap: 10px; }
  .modal-obra .modal-foot { padding: 10px 16px; }

  /* ============================================================
     MAPA — TABELA DE MAQUINAS COMO CARDS NO MOBILE
     Em desktop a tabela tem 9 colunas (status, tag, ns, obra,
     contrato, endereco, cidade, ult.atualizacao, acoes). Espremer
     isso num celular fica ilegivel. Aqui cada `.tc-row` vira um
     cartao stackado verticalmente. Posicoes dos filhos sao
     enderecadas via `:nth-child` (sem precisar mexer no JSX).
     Ordem dos spans em login-dash.jsx (MapaPage):
       1=tc-id (status) 2=tag 3=num_serie 4=obra 5=contrato
       6=endereco 7=cidade 8=ult.atualizacao 9=acoes
  ============================================================ */
  /* Cabecalho de colunas nao faz sentido em layout de cards. */
  .table-card .tc-grid-header { display: none !important; }

  .table-card .tc-list {
    gap: 10px;
    padding: 10px;
    background: transparent;
  }

  /* Override do grid-template-columns inline (style={{...}}) — por isso !important. */
  .table-card .tc-row {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 6px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface, #fff);
    box-shadow: 0 1px 3px rgba(0,0,0,.04);
    border-bottom: 1px solid var(--line);
  }
  .table-card .tc-row:hover { background: var(--surface, #fff); }

  /* 1) Status: badge no topo */
  .table-card .tc-row > *:nth-child(1) {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
  }

  /* 2) TAG + 3) Nº Série numa linha so, lado a lado */
  .table-card .tc-row > *:nth-child(2),
  .table-card .tc-row > *:nth-child(3) {
    display: inline-block;
    margin-right: 8px;
  }
  .table-card .tc-row > *:nth-child(2) {
    font-size: 17px;
    font-weight: 700;
    color: var(--ink);
  }
  .table-card .tc-row > *:nth-child(3) {
    font-size: 13px;
    color: var(--muted);
  }
  /* Wrapper visual: empurra a obra pra proxima linha. */
  .table-card .tc-row > *:nth-child(3)::after { content: ""; display: block; }

  /* 4) Obra (negrito secundario) */
  .table-card .tc-row > *:nth-child(4) {
    font-size: 14px;
    color: var(--ink);
    margin-top: 4px;
  }

  /* 5) Contrato — rotulo "Contrato:" pra dar contexto sem header */
  .table-card .tc-row > *:nth-child(5) {
    font-size: 13px;
    color: var(--muted);
  }
  .table-card .tc-row > *:nth-child(5)::before {
    content: "Contrato: ";
    font-family: "JetBrains Mono", monospace;
    font-size: 10.5px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
    margin-right: 4px;
  }

  /* 6) Endereco — mesma logica */
  .table-card .tc-row > *:nth-child(6) {
    font-size: 13.5px;
    color: var(--ink);
    margin-top: 4px;
  }
  .table-card .tc-row > *:nth-child(6)::before {
    content: "Endereço: ";
    display: block;
    font-family: "JetBrains Mono", monospace;
    font-size: 10.5px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
    margin-bottom: 2px;
  }

  /* 7) Cidade — pequeno */
  .table-card .tc-row > *:nth-child(7) {
    font-size: 12.5px;
    color: var(--muted);
  }

  /* 8) Ult. atualizacao — pequeno, com rotulo */
  .table-card .tc-row > *:nth-child(8) {
    font-size: 12.5px;
    color: var(--muted);
    margin-top: 2px;
  }
  .table-card .tc-row > *:nth-child(8)::before {
    content: "Atualizado: ";
    font-family: "JetBrains Mono", monospace;
    font-size: 10.5px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
    margin-right: 4px;
  }

  /* 9) Acoes (Editar / Focar) — botoes ocupando largura cheia, padding
     tocavel (44px-ish), separador acima. */
  .table-card .tc-row > *:nth-child(9) {
    display: flex !important;
    justify-content: stretch;
    gap: 8px;
    margin-top: 10px;
    padding-top: 12px;
    border-top: 1px dashed var(--line);
  }
  .table-card .tc-row .tc-act-btn {
    flex: 1;
    justify-content: center;
    padding: 10px 12px;
    font-size: 13.5px;
  }

  /* Filtro: campo de busca + select dividem a linha. Igualamos a altura ao
     .d-select (30px) pra os dois nao ficarem desnivelados em mobile — antes
     o search calculava altura via padding interno e ficava ~4px menor. */
  .table-card .tc-filter {
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px;
  }
  .table-card .tc-filter-search {
    max-width: none;
    height: 30px;
    padding: 0 10px;
    box-sizing: border-box;
  }
  .table-card .tc-filter-count { display: none; }
}

/* ============================================================
   TRAVA DE ORIENTACAO (PORTRAIT) — overlay full-screen quando
   um celular esta em landscape. O HTML do overlay vive em
   index.html (.rotate-lock). Por padrao esta `display: none`;
   so vira `flex` quando a media query bate.

   Filtro `max-height: 500px` garante que so phones disparem:
   iPhone Pro Max em landscape tem altura ~430px, iPad em
   landscape tem ~820px. `max-width: 932px` reforca (descarta
   monitores girados de pe).

   z-index altissimo (99999) cobre tambem iframes (graficos.html
   embedados no Dashboard ficam abaixo do overlay).
   ============================================================ */
.rotate-lock {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: var(--bg, #0B131F);
  color: var(--ink, #E8EDF5);
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px;
  /* env() reserva safe-area-inset (notch/home indicator) em iPhones */
  padding-top: max(24px, env(safe-area-inset-top, 0px));
  padding-bottom: max(24px, env(safe-area-inset-bottom, 0px));
}
.rotate-lock-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  max-width: 320px;
}
.rotate-lock-icon {
  width: 64px;
  height: 64px;
  opacity: 0.9;
  /* Animacao sutil: o icone pulsa de landscape (-90deg) pra portrait (0deg)
     mostrando visualmente o que fazer. */
  animation: rotate-lock-pulse 2.6s ease-in-out infinite;
  transform-origin: center;
}
@keyframes rotate-lock-pulse {
  0%, 100% { transform: rotate(-90deg); opacity: 0.55; }
  50%      { transform: rotate(0deg);   opacity: 1; }
}
.rotate-lock-titulo {
  font-family: "Inter", sans-serif;
  font-size: 17px;
  font-weight: 600;
  margin: 0;
  letter-spacing: 0.01em;
}
.rotate-lock-sub {
  font-family: "Inter", sans-serif;
  font-size: 13.5px;
  color: var(--muted, #8A93A6);
  margin: 0;
  line-height: 1.45;
}

@media (orientation: landscape) and (max-height: 500px) and (max-width: 932px) {
  .rotate-lock { display: flex; }
}

/* ============================================================
   FROTA — KPI clicavel + telas de monitoramento de maquinas
   (FrotaPage / FrotaRelatorio em login-dash.jsx).
============================================================ */

/* KPI "card-botao": cursor + leve elevacao no hover, anel no foco. */
.kpi-clicavel { cursor: pointer; transition: box-shadow .15s ease, transform .15s ease, border-color .15s ease; }
.kpi-clicavel:hover { border-color: var(--muted-2); box-shadow: var(--shadow-md); transform: translateY(-1px); }
.kpi-clicavel:focus-visible { outline: 2px solid var(--navy-3); outline-offset: 2px; }
.kpi-seta {
  position: absolute; top: 10px; right: 10px;
  display: inline-flex; color: var(--muted-2);
  transition: transform .15s ease, color .15s ease;
}
/* Quando o KPI tem botao "i", a seta cede o canto e fica ao lado dele. */
.kpi-clicavel:has(.kpi-info) .kpi-seta { right: 38px; top: 13px; }
.kpi-clicavel:hover .kpi-seta { color: var(--ink); transform: translateX(2px); }

/* ---- status bar (clicavel pra filtrar) ---- */
.frota-statusbar {
  display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-md); padding: 4px; margin-bottom: 16px;
}
.frota-pill {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: var(--r-sm);
  border: 1px solid transparent; background: transparent;
  cursor: pointer; font-family: inherit; text-align: left;
  transition: background .15s ease, border-color .15s ease;
}
.frota-pill:hover { background: var(--surface-2); }
.frota-pill.is-active { background: var(--surface-2); border-color: var(--line); }
.frota-pill__dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.frota-pill__txt { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.frota-pill__lbl { font-size: 11.5px; font-weight: 600; color: var(--ink-2); letter-spacing: .01em; }
.frota-pill__num { font-size: 20px; font-weight: 700; color: var(--ink); line-height: 1; font-variant-numeric: tabular-nums; }

/* ---- busca no header do Card ---- */
.frota-busca {
  height: 34px; min-width: 240px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: var(--r-sm);
  background: var(--surface-2); color: var(--ink);
  font-family: inherit; font-size: 13px;
}
.frota-busca::placeholder { color: var(--muted-2); }
.frota-busca:focus { outline: none; border-color: var(--muted-2); }

/* selo "ao vivo · 60s" + busca no header do Card "Frota" */
.frota-card-tools { display: flex; align-items: center; gap: 10px; }
.frota-live {
  display: inline-flex; align-items: center; gap: 6px; flex-shrink: 0;
  padding: 4px 9px; border-radius: 999px;
  background: rgba(34, 160, 107, .12); color: #1F7A4D;
  font-family: "JetBrains Mono", monospace; font-size: 10px; font-weight: 600;
  letter-spacing: .08em; text-transform: uppercase; white-space: nowrap;
}
.frota-live::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%;
  background: #22A06B; animation: frotaLivePulse 1.8s ease-in-out infinite;
}
@keyframes frotaLivePulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .25; }
}
@media (prefers-reduced-motion: reduce) {
  .frota-live::before { animation: none; }
}

/* ---- badge de status ---- */
.frota-badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 9px; border-radius: 999px;
  font-size: 11px; font-weight: 600; letter-spacing: .01em;
  white-space: nowrap;
}
.frota-badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; }
.frota-badge--offline     { background: rgba(148,163,184,.16); color: #64748B; }
.frota-badge--offline::before { background: #94A3B8; }
.frota-badge--ocioso      { background: rgba(34,160,107,.14);  color: #1F7A4D; }
.frota-badge--ocioso::before { background: #22A06B; }
.frota-badge--concretando { background: rgba(59,130,246,.14);  color: #2563EB; }
.frota-badge--concretando::before { background: #3B82F6; }
.frota-badge--perfurando  { background: rgba(209,67,67,.14);   color: #C0392B; }
.frota-badge--perfurando::before { background: #D14343; }
.frota-badge--erro        { background: rgba(224,160,42,.16);  color: #B07816; }
.frota-badge--erro::before { background: #E0A02A; }

/* ---- tabela (desktop) ---- */
.frota-tabela-wrap { width: 100%; overflow-x: auto; }
.frota-cards { display: none; }
.frota-row { cursor: pointer; }
.frota-tag { font-weight: 600; color: var(--ink); }
.frota-update strong { color: var(--ink); font-weight: 600; }
.frota-update span { color: var(--muted); font-family: "JetBrains Mono", monospace; font-size: 11.5px; }
/* linha/card da maquina cujo relatorio esta' aberto */
.frota-row--sel > td:first-child { box-shadow: inset 3px 0 0 var(--navy-3); }
.frota-row--sel > td { background: var(--surface-2); }

/* ---- cards (mobile) ---- */
.frota-card {
  display: flex; flex-direction: column; gap: 8px;
  width: 100%; text-align: left; font-family: inherit;
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: var(--r-md); padding: 12px 14px; cursor: pointer;
}
.frota-card:active { background: var(--line-2); }
.frota-card--sel { border-color: var(--navy-3); box-shadow: inset 3px 0 0 var(--navy-3); }
.frota-card__top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.frota-card__tag { font-weight: 700; font-size: 15px; color: var(--ink); }
.frota-card__rows { display: flex; flex-direction: column; gap: 3px; }
.frota-card__row { display: flex; justify-content: space-between; gap: 10px; font-size: 12.5px; }
.frota-card__row .lbl { color: var(--muted); }
.frota-card__row .val { color: var(--ink); font-family: "JetBrains Mono", monospace; font-size: 12px; }
.frota-card__update {
  display: flex; justify-content: space-between; gap: 8px;
  margin-top: 2px; padding-top: 8px; border-top: 1px solid var(--line);
}
.frota-card__update .when { font-size: 12px; font-weight: 600; color: var(--ink); }
.frota-card__update .ts { font-family: "JetBrains Mono", monospace; font-size: 11px; color: var(--muted); }

/* ---- botao voltar (so mobile — dash-actions some no mobile) ---- */
.frota-voltar-mob {
  display: none;
  align-self: flex-start; margin-bottom: 4px;
  background: transparent; border: 0; padding: 4px 0;
  color: var(--ink); font-family: inherit; font-size: 14px; font-weight: 600; cursor: pointer;
}

/* ---- card de relatorio inline (entre status bar e lista) ---- */
/* Wrapper que anima a expansao: grid-template-rows 0fr→1fr empurra a
   lista pra baixo suavemente; o filho precisa de overflow:hidden +
   min-height:0 pro colapso do row funcionar. Sem `forwards` — ao fim da
   animacao volta pro estado em repouso (1fr), identico ao keyframe `to`. */
.frota-detalhe {
  display: grid;
  grid-template-rows: 1fr;
  margin-bottom: 16px;
  animation: frotaDetalheIn .3s cubic-bezier(.22, 1, .36, 1);
}
.frota-detalhe > * { overflow: hidden; min-height: 0; }
@keyframes frotaDetalheIn {
  from { grid-template-rows: 0fr; opacity: 0; margin-bottom: 0; }
  to   { grid-template-rows: 1fr; opacity: 1; margin-bottom: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  .frota-detalhe { animation: none; }
}

.frota-detalhe-card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); box-shadow: var(--shadow-md);
}
.frota-detalhe-hd {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  padding: 16px 18px; border-bottom: 1px solid var(--line-2);
}
.frota-detalhe-tag {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  font-size: 17px; font-weight: 700; color: var(--ink); letter-spacing: -.01em;
}
.frota-detalhe-meta {
  margin-top: 5px; font-size: 12px; color: var(--muted);
  font-family: "JetBrains Mono", monospace;
}
.frota-detalhe-fechar {
  flex-shrink: 0; width: 30px; height: 30px;
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent; border: 1px solid var(--line); border-radius: var(--r-sm);
  color: var(--muted); cursor: pointer; transition: background .15s ease, color .15s ease;
}
.frota-detalhe-fechar:hover { background: var(--surface-2); color: var(--ink); }
.frota-detalhe-body { padding: 16px 18px 18px; }

/* ---- relatorio: periodo, KPIs, grafico ---- */
.frota-periodo {
  display: inline-flex; border: 1px solid var(--line); border-radius: var(--r-sm);
  overflow: hidden; margin-bottom: 16px;
}
.frota-periodo button {
  font-family: inherit; font-size: 12.5px; font-weight: 500;
  padding: 7px 16px; background: var(--surface); border: 0;
  border-right: 1px solid var(--line); cursor: pointer; color: var(--muted);
}
.frota-periodo button:last-child { border-right: 0; }
.frota-periodo button.is-active { background: var(--navy); color: #fff; }

.frota-kpis {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px;
  margin-bottom: 18px;
  transition: opacity .15s ease;
}
/* refetch ao trocar de periodo — esmaece so os KPIs, sem desmontar nada */
.frota-kpis.is-recarregando { opacity: .45; }
.frota-kpi {
  display: flex; flex-direction: column; gap: 4px;
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: var(--r-md); padding: 14px 16px;
}
.frota-kpi__lbl {
  display: flex; align-items: center; gap: 7px;
  font-size: 11.5px; font-weight: 500; color: var(--muted);
}
.frota-kpi__lbl::before { content: ""; width: 8px; height: 8px; border-radius: 50%; }
.frota-kpi--ocioso .frota-kpi__lbl::before      { background: #22A06B; }
.frota-kpi--perfurando .frota-kpi__lbl::before  { background: #D14343; }
.frota-kpi--concretando .frota-kpi__lbl::before { background: #3B82F6; }
.frota-kpi--offline .frota-kpi__lbl::before     { background: #94A3B8; }
.frota-kpi__val { font-size: 20px; font-weight: 700; color: var(--ink); letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.frota-kpi__pct { font-family: "JetBrains Mono", monospace; font-size: 11px; color: var(--muted); }

.frota-chart-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 8px; flex-wrap: wrap;
}
.frota-chart-titulo {
  font-size: 12px; font-weight: 600; color: var(--ink-2);
}
/* toggle Totais / Linha do tempo — mesmo visual do seletor de periodo */
.frota-chart-toggle {
  display: inline-flex; border: 1px solid var(--line); border-radius: var(--r-sm);
  overflow: hidden; flex-shrink: 0;
}
.frota-chart-toggle button {
  font-family: inherit; font-size: 12px; font-weight: 500;
  padding: 5px 12px; background: var(--surface); border: 0;
  border-right: 1px solid var(--line); cursor: pointer; color: var(--muted);
}
.frota-chart-toggle button:last-child { border-right: 0; }
.frota-chart-toggle button.is-active { background: var(--navy); color: #fff; }
.frota-chart { width: 100%; }
.frota-chart-wrap { width: 100%; }
/* modo timeline: o SVG fica alto (zoom vertical, 1 min visível) — o card
   inteiro expande pra mostrar o gráfico todo, sem scroll interno. */
.frota-chart-wrap.is-timeline {
  border: 1px solid var(--line-2); border-radius: var(--r-sm);
}
/* viewBox renderizado na largura real em px (ver FrotaChart) — width 100% +
   height auto mantem o 1:1, sem esticar. */
.frota-chart-svg { display: block; width: 100%; height: auto; }
.frota-chart-grid { stroke: var(--line-2); stroke-width: 1; }
.frota-chart-eixo { stroke: var(--line); stroke-width: 1; }
.frota-chart-axis { font-family: "JetBrains Mono", monospace; font-size: 11px; fill: var(--muted); }
.frota-chart-vazio {
  display: flex; align-items: center; justify-content: center;
  min-height: 160px; padding: 24px;
  color: var(--muted); font-size: 13px;
}
.frota-legenda {
  display: flex; flex-wrap: wrap; gap: 16px;
  margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line-2);
}
.frota-legenda__item { display: flex; align-items: center; gap: 7px; font-family: "JetBrains Mono", monospace; font-size: 11px; color: var(--muted); }
.frota-legenda__sw { width: 12px; height: 12px; border-radius: 3px; }
/* swatch hachurado — espelha o <pattern> dos gaps offline do modo timeline */
.frota-legenda__sw--hachura {
  background: repeating-linear-gradient(
    45deg,
    rgba(148, 163, 184, .12) 0 3px,
    rgba(148, 163, 184, .55) 3px 4.6px
  );
}

@media (max-width: 767px) {
  /* Pills em grade 3x2: cabe os 6 status sem scroll horizontal. Reduz
     gap/padding pra apertar tudo e label/numero ficam um pouco menores
     que no desktop. */
  .frota-statusbar {
    grid-template-columns: repeat(3, 1fr); gap: 6px; padding: 6px;
  }
  .frota-pill { padding: 8px 10px; gap: 8px; }
  .frota-pill__lbl { font-size: 11px; }
  .frota-pill__num { font-size: 18px; }
  .frota-card-tools { width: 100%; }
  .frota-busca { flex: 1; min-width: 0; width: auto; }
  .frota-tabela-wrap { display: none; }
  .frota-cards { display: flex; flex-direction: column; gap: 10px; }
  .frota-voltar-mob { display: inline-block; }
  .frota-kpis { grid-template-columns: 1fr 1fr; }
}
