/* Reset & base */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --bg: #0b1120;
  --surface: #111827;
  --card: #1a2436;
  --border: #1e3251;
  --text: #e2e8f0;
  --muted: #64748b;
  --subtle: #94a3b8;
  --accent: #6366f1;
  --green: #22c55e;
  --blue: #3b82f6;
  --amber: #f59e0b;
  --red: #ef4444;
  --purple: #a855f7;
  --sidebar-w: 220px;
}
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  display: flex;
  overflow: hidden;
}

/* ── Sidebar ─────────────────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  height: 100vh;
  background: #0d1526;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: fixed;
  top: 0; left: 0;
  z-index: 100;
  transition: transform .25s ease;
  overflow: hidden;
}
.sidebar.collapsed {
  transform: translateX(calc(-1 * var(--sidebar-w)));
}
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 99;
}
.sidebar-overlay.visible { display: block; }
.sidebar-logo {
  padding: 22px 18px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--border);
}
.logo-icon {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--accent), #8b5cf6);
  border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; font-weight: 800; color: white;
  flex-shrink: 0;
}
.logo-name { font-size: 0.8rem; font-weight: 700; color: white; letter-spacing: .5px; }
.logo-sub  { font-size: 0.65rem; color: var(--muted); }

.sidebar-nav {
  flex: 1;
  padding: 16px 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow-y: auto;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 8px;
  color: var(--subtle);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  transition: all .15s;
}
.nav-item:hover { background: rgba(99,102,241,.08); color: var(--text); }
.nav-item.active { background: rgba(99,102,241,.15); color: var(--accent); }
.nav-icon { font-size: 1rem; width: 20px; text-align: center; }

.sidebar-bottom {
  padding: 14px 12px;
  border-top: 1px solid var(--border);
}
.user-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  background: rgba(255,255,255,.04);
  border-radius: 8px;
  margin-bottom: 10px;
}
.user-avatar {
  width: 32px; height: 32px;
  background: linear-gradient(135deg, var(--accent), #8b5cf6);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.85rem; font-weight: 700; color: white;
  flex-shrink: 0;
}
.user-name  { font-size: 0.8rem; font-weight: 600; color: var(--text); }
.user-email { font-size: 0.68rem; color: var(--muted); }
.btn-logout {
  width: 100%; padding: 8px;
  background: rgba(239,68,68,.1); border: 1px solid rgba(239,68,68,.2);
  color: #fca5a5; border-radius: 7px; cursor: pointer; font-size: 0.8rem;
  transition: all .15s;
}
.btn-logout:hover { background: rgba(239,68,68,.2); }
.btn-trocar-senha {
  width: 100%; padding: 8px; margin-bottom: 6px;
  background: rgba(99,102,241,.1); border: 1px solid rgba(99,102,241,.2);
  color: #a5b4fc; border-radius: 7px; cursor: pointer; font-size: 0.8rem;
  transition: all .15s;
}
.btn-trocar-senha:hover { background: rgba(99,102,241,.2); }

/* ── Main ────────────────────────────────────────────────────────────────── */
.main {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow-y: auto;
  transition: margin-left .25s ease;
}
.main.expanded { margin-left: 0; }

/* ── Sidebar toggle button ───────────────────────────────────────────────── */
.btn-sidebar-toggle {
  background: rgba(255,255,255,.06);
  border: 1px solid var(--border);
  color: var(--subtle);
  cursor: pointer;
  font-size: 1.1rem;
  width: 36px; height: 36px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: all .15s;
}
.btn-sidebar-toggle:hover { background: rgba(255,255,255,.12); color: var(--text); }

/* ── Mobile ──────────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar { transform: translateX(calc(-1 * var(--sidebar-w))); }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0 !important; }
}

/* ── Topbar ──────────────────────────────────────────────────────────────── */
.topbar {
  padding: 20px 28px 16px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  background: #0d1526;
  position: sticky;
  top: 0;
  z-index: 50;
}
.page-title { font-size: 1.3rem; font-weight: 700; color: white; }
.page-sub   { font-size: 0.8rem; color: var(--muted); margin-top: 3px; }
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}
.last-update {
  font-size: 0.78rem;
  color: var(--muted);
  white-space: nowrap;
}
.btn-action {
  padding: 8px 16px;
  background: rgba(99,102,241,.12); border: 1px solid rgba(99,102,241,.25);
  color: var(--accent); border-radius: 8px; cursor: pointer;
  font-size: 0.83rem; font-weight: 500;
  transition: all .15s;
}
.btn-action:hover { background: rgba(99,102,241,.22); }
.btn-action.loading { opacity: .6; cursor: not-allowed; }

/* ── Content ──────────────────────────────────────────────────────────────── */
#content { padding: 24px 28px; flex: 1; }

/* ── KPI Cards ───────────────────────────────────────────────────────────── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
  margin-bottom: 28px;
}
.kpi-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 18px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  transition: border-color .15s, background .15s;
}
.kpi-card-btn:hover { background: #162032; border-color: var(--accent); }
.kpi-card-btn:active { background: #1e3251; }
.kpi-icon {
  width: 40px; height: 40px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}
.kpi-val  { font-size: 1.6rem; font-weight: 800; color: white; line-height: 1; }
.kpi-lbl  { font-size: 0.72rem; color: var(--muted); margin-top: 4px; }
.kpi-pct  { font-size: 0.7rem; color: var(--subtle); margin-top: 3px; }

/* ── Lot Grid ────────────────────────────────────────────────────────────── */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.section-title { font-size: 1rem; font-weight: 600; color: var(--text); }

.lotes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}
.lote-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  cursor: pointer;
  transition: border-color .2s, box-shadow .2s;
}
.lote-card:hover { border-color: var(--accent); box-shadow: 0 0 0 1px rgba(99,102,241,.2); }
.lote-card.selected { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(99,102,241,.25); }

.lote-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 14px;
}
.lote-num  { font-size: 0.95rem; font-weight: 700; color: white; }
.lote-nome { font-size: 0.7rem; color: var(--muted); margin-top: 2px; }

.badge {
  font-size: 0.65rem; font-weight: 600;
  padding: 3px 8px; border-radius: 20px;
  white-space: nowrap;
}
.badge-green  { background: rgba(34,197,94,.15); color: #4ade80; }
.badge-amber  { background: rgba(245,158,11,.15); color: #fbbf24; }
.badge-blue   { background: rgba(59,130,246,.15); color: #60a5fa; }
.badge-red    { background: rgba(239,68,68,.15);  color: #f87171; }
.badge-gray   { background: rgba(100,116,139,.15); color: #94a3b8; }
.badge-purple { background: rgba(168,85,247,.15);  color: #c084fc; }

.lote-circ-wrap {
  display: flex;
  justify-content: center;
  margin: 10px 0 14px;
  position: relative;
}
.circ-svg { overflow: visible; }
.circ-label {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  pointer-events: none;
}
.circ-pct { font-size: 1.15rem; font-weight: 800; color: white; line-height: 1; display: block; }
.circ-pct-sm { font-size: 0.78rem; font-weight: 800; color: white; line-height: 1; display: block; }
.circ-sub { font-size: 0.6rem; color: var(--muted); }
.circ-atencao { font-size: 0.55rem; color: var(--amber); display: block; margin-top: 2px; }

.lote-stats { font-size: 0.75rem; }
.lote-stat-row {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
  border-top: 1px solid rgba(255,255,255,.05);
}
.lote-stat-row:first-child { border-top: none; }
.stat-lbl { color: var(--muted); }
.stat-val { font-weight: 600; }
.stat-red { color: var(--red); }
.stat-green { color: var(--green); }
.stat-amber { color: var(--amber); }

.lote-alerta {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  background: #2d1010;
  border: 1px solid #7f1d1d;
  border-radius: 7px;
  padding: 8px 10px;
  margin: 8px 0 4px;
}
.lote-alerta-icon { font-size: 1rem; color: var(--red); flex-shrink: 0; margin-top: 1px; }
.lote-alerta-title { font-size: 0.72rem; font-weight: 700; color: var(--red); }
.lote-alerta-sub { font-size: 0.63rem; color: #f87171; margin-top: 2px; }

.alerta-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #2d1010;
  border: 1px solid #7f1d1d;
  border-radius: 8px;
  padding: 12px 16px;
  margin-bottom: 18px;
  font-size: 0.82rem;
  color: #fca5a5;
}
.alerta-banner-icon { font-size: 1.2rem; color: var(--red); flex-shrink: 0; }
.alerta-banner-sub { color: #f87171; }

.lote-footer {
  margin-top: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.7rem;
  color: var(--muted);
}
.btn-ver {
  padding: 6px 12px;
  background: rgba(99,102,241,.12);
  border: 1px solid rgba(99,102,241,.25);
  color: var(--accent); border-radius: 6px;
  cursor: pointer; font-size: 0.75rem; font-weight: 500;
  transition: all .15s;
}
.btn-ver:hover { background: rgba(99,102,241,.22); }

/* ── Lot Detail ───────────────────────────────────────────────────────────── */
.lote-detail {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 24px;
}
.lote-detail-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.lote-detail-title { font-size: 1.05rem; font-weight: 700; color: white; }
.lote-detail-stats {
  display: flex;
  gap: 20px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.detail-stat {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #0f172a;
  padding: 10px 14px;
  border-radius: 8px;
  flex: 1;
  min-width: 120px;
  border: 1px solid transparent;
  transition: border-color .15s, background .15s;
}
.detail-stat-btn:hover {
  background: #162032;
  border-color: var(--border);
}
.detail-stat-btn:active { background: #1e3251; }
.detail-stat-icon {
  width: 28px; height: 28px;
  border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px;
}
.detail-stat-val { font-size: 1.1rem; font-weight: 700; color: white; line-height: 1; }
.detail-stat-lbl { font-size: 0.68rem; color: var(--muted); }

/* ── Table ───────────────────────────────────────────────────────────────── */
.table-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.search-input {
  padding: 8px 12px;
  background: #0f172a; border: 1px solid var(--border);
  border-radius: 8px; color: var(--text); font-size: 0.83rem;
  outline: none; flex: 1; min-width: 180px;
}
.search-input:focus { border-color: var(--accent); }
.filter-select {
  padding: 8px 12px;
  background: #0f172a; border: 1px solid var(--border);
  border-radius: 8px; color: var(--text); font-size: 0.83rem;
  outline: none; cursor: pointer;
}
.btn-sm {
  padding: 7px 13px;
  background: rgba(99,102,241,.1); border: 1px solid rgba(99,102,241,.2);
  color: var(--accent); border-radius: 7px; cursor: pointer;
  font-size: 0.78rem;
}
.table-wrap { overflow-x: auto; border-radius: 8px; }
table {
  width: 100%; border-collapse: collapse;
  font-size: 0.82rem;
}
thead th {
  padding: 10px 12px;
  background: #0f172a;
  color: var(--muted);
  font-weight: 600;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
tbody tr {
  border-bottom: 1px solid rgba(255,255,255,.05);
  transition: background .1s;
}
tbody tr:hover { background: rgba(255,255,255,.03); }
td { padding: 10px 12px; color: var(--text); vertical-align: middle; }
td.muted { color: var(--muted); }
.table-pag {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 12px;
  font-size: 0.78rem;
  color: var(--muted);
}
.pag-btns { display: flex; gap: 6px; }
.pag-btn {
  padding: 5px 10px;
  background: var(--card); border: 1px solid var(--border);
  color: var(--text); border-radius: 6px; cursor: pointer; font-size: 0.78rem;
}
.pag-btn:disabled { opacity: .4; cursor: default; }

.action-btn {
  padding: 5px 8px;
  background: rgba(99,102,241,.1); border: 1px solid rgba(99,102,241,.2);
  color: var(--accent); border-radius: 6px; cursor: pointer; font-size: 0.75rem;
  transition: all .15s;
}
.action-btn:hover { background: rgba(99,102,241,.2); }

/* ── Progresso atualização ───────────────────────────────────────────────── */
.update-bar {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 18px;
  margin-bottom: 16px;
  display: none;
}
.bar-track {
  height: 6px; background: #0f172a; border-radius: 99px; overflow: hidden; margin: 8px 0;
}
.bar-fill {
  height: 100%; background: var(--accent);
  border-radius: 99px; transition: width .3s;
  width: 0%;
}
.bar-label { font-size: 0.78rem; color: var(--muted); }

/* ── Drawer (painel rastreamento) ────────────────────────────────────────── */
.drawer-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 200;
}
.drawer {
  position: fixed; top: 0; right: 0;
  width: 380px; height: 100vh;
  background: var(--card);
  border-left: 1px solid var(--border);
  z-index: 201;
  display: flex; flex-direction: column;
  overflow: hidden;
  transform: translateX(0);
  transition: transform .25s ease;
}
.drawer.hidden, .drawer-overlay.hidden { display: none; }

.drawer-header {
  padding: 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}
.drawer-codigo { font-size: 1.1rem; font-weight: 700; color: white; }
.drawer-close {
  background: none; border: none; color: var(--muted);
  cursor: pointer; font-size: 1rem; padding: 4px;
}
.drawer-close:hover { color: var(--text); }
.drawer-body { padding: 20px; overflow-y: auto; flex: 1; }

.drawer-section { margin-bottom: 20px; }
.drawer-section-title {
  font-size: 0.7rem; font-weight: 600; color: var(--muted);
  text-transform: uppercase; letter-spacing: 1px;
  margin-bottom: 10px;
}
.drawer-field {
  display: flex;
  justify-content: space-between;
  padding: 7px 0;
  border-bottom: 1px solid rgba(255,255,255,.05);
  font-size: 0.82rem;
}
.drawer-field:last-child { border-bottom: none; }
.field-lbl { color: var(--muted); }
.field-val { color: var(--text); font-weight: 500; text-align: right; max-width: 60%; }

/* Timeline de eventos */
.timeline { position: relative; padding-left: 20px; }
.timeline::before {
  content: ''; position: absolute; left: 6px; top: 6px; bottom: 6px;
  width: 2px; background: var(--border);
}
.tl-item {
  position: relative; margin-bottom: 16px;
}
.tl-dot {
  position: absolute; left: -17px; top: 4px;
  width: 10px; height: 10px; border-radius: 50%;
  border: 2px solid var(--accent);
  background: var(--card);
}
.tl-dot.done { background: var(--accent); border-color: var(--accent); }
.tl-status { font-size: 0.83rem; font-weight: 600; color: var(--text); }
.tl-unit   { font-size: 0.75rem; color: var(--muted); margin-top: 2px; }
.tl-date   { font-size: 0.72rem; color: var(--muted); margin-top: 1px; }

/* ── Utilitários ─────────────────────────────────────────────────────────── */
.hidden { display: none !important; }
.loading-spinner {
  text-align: center; padding: 40px; color: var(--muted); font-size: 0.85rem;
}
.empty-state {
  text-align: center; padding: 40px; color: var(--muted); font-size: 0.85rem;
}

/* ── Dashboard Grid ──────────────────────────────────────────────────────── */
.dash-grid-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}
.dash-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}
.dash-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px 20px;
}
.dash-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.dash-card-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 14px;
}
.dash-card-header .dash-card-title { margin-bottom: 0; }
.dash-link {
  font-size: 0.75rem;
  color: var(--accent);
  text-decoration: none;
  cursor: pointer;
}
.dash-link:hover { text-decoration: underline; }

/* ── SLA Gauge ───────────────────────────────────────────────────────────── */
.sla-gauge-wrap { text-align: center; margin-bottom: 14px; }
.sla-sub { font-size: 0.7rem; color: var(--muted); text-align: center; margin-bottom: 12px; }
.sla-metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.sla-metric {
  background: #0f172a;
  border-radius: 8px;
  padding: 8px 10px;
}
.sla-metric-label { font-size: 0.65rem; color: var(--muted); margin-bottom: 4px; }
.sla-metric-val { font-size: 1rem; font-weight: 800; color: white; }
.sla-metric-bar { height: 3px; background: #1e3251; border-radius: 99px; margin-top: 5px; overflow: hidden; }
.sla-metric-fill { height: 100%; border-radius: 99px; transition: width .4s; }

/* ── Linha do Tempo ──────────────────────────────────────────────────────── */
.lt-steps {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.lt-step { }
.lt-step-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 5px;
}
.lt-step-left { display: flex; align-items: center; gap: 8px; }
.lt-step-icon {
  width: 28px; height: 28px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px;
  flex-shrink: 0;
}
.lt-step-name { font-size: 0.78rem; font-weight: 600; color: var(--text); }
.lt-step-count { font-size: 0.7rem; color: var(--muted); }
.lt-step-pct { font-size: 0.78rem; font-weight: 700; }
.lt-bar { height: 6px; background: #1e3251; border-radius: 99px; overflow: hidden; }
.lt-fill { height: 100%; border-radius: 99px; transition: width .4s; }

/* ── UF List ─────────────────────────────────────────────────────────────── */
.uf-list { display: flex; flex-direction: column; gap: 7px; }
.uf-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.78rem;
}
.uf-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  margin-right: 8px;
  flex-shrink: 0;
  display: inline-block;
}
.uf-name { color: var(--text); display: flex; align-items: center; }
.uf-total { font-weight: 700; color: var(--text); }
.uf-bar-wrap { flex: 1; margin: 0 12px; height: 4px; background: #1e3251; border-radius: 99px; overflow: hidden; }
.uf-bar-fill { height: 100%; border-radius: 99px; }

/* ── Alertas ─────────────────────────────────────────────────────────────── */
.alertas-list { display: flex; flex-direction: column; gap: 8px; }
.alerta-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid transparent;
  font-size: 0.78rem;
}
.alerta-item.danger  { background: rgba(239,68,68,.06);  border-color: rgba(239,68,68,.15); }
.alerta-item.warning { background: rgba(245,158,11,.06); border-color: rgba(245,158,11,.15); }
.alerta-item.info    { background: rgba(59,130,246,.06); border-color: rgba(59,130,246,.15); }
.alerta-item.success { background: rgba(34,197,94,.06);  border-color: rgba(34,197,94,.15); }
.alerta-dot {
  width: 24px; height: 24px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 800;
  flex-shrink: 0;
}
.alerta-dot.danger  { background: rgba(239,68,68,.2);  color: var(--red); }
.alerta-dot.warning { background: rgba(245,158,11,.2); color: var(--amber); }
.alerta-dot.info    { background: rgba(59,130,246,.2); color: var(--blue); }
.alerta-dot.success { background: rgba(34,197,94,.2);  color: var(--green); }
.alerta-title { font-weight: 600; color: var(--text); line-height: 1.2; }
.alerta-desc  { font-size: 0.7rem; color: var(--muted); margin-top: 2px; }

/* ── Distribuição Status ─────────────────────────────────────────────────── */
.dist-list { display: flex; flex-direction: column; gap: 10px; }
.dist-row { }
.dist-row-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  margin-bottom: 4px;
}
.dist-label { color: var(--text); font-weight: 500; }
.dist-count { color: var(--muted); }
.dist-bar { height: 6px; background: #1e3251; border-radius: 99px; overflow: hidden; }
.dist-fill { height: 100%; border-radius: 99px; transition: width .4s; }

/* ── Top Cidades ─────────────────────────────────────────────────────────── */
.cidades-list { display: flex; flex-direction: column; gap: 10px; }
.cidade-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.78rem;
}
.cidade-rank {
  width: 20px; height: 20px;
  background: #0f172a;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.65rem; font-weight: 700; color: var(--muted);
  flex-shrink: 0;
}
.cidade-nome { flex: 1; color: var(--text); }
.cidade-count { font-weight: 700; color: var(--text); white-space: nowrap; }
.cidade-badge {
  font-size: 0.65rem; font-weight: 700;
  padding: 2px 6px; border-radius: 4px;
  background: rgba(239,68,68,.15); color: var(--red);
}

/* ── Lotes Scroll ────────────────────────────────────────────────────────── */
.lotes-scroll {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 6px;
}
.lotes-scroll::-webkit-scrollbar { height: 4px; }
.lotes-scroll::-webkit-scrollbar-track { background: #0f172a; border-radius: 99px; }
.lotes-scroll::-webkit-scrollbar-thumb { background: var(--border); border-radius: 99px; }
.lote-mini {
  background: #0f172a;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  min-width: 160px;
  cursor: pointer;
  transition: border-color .15s;
  flex-shrink: 0;
}
.lote-mini:hover { border-color: var(--accent); }
.lote-mini-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.lote-mini-num { font-size: 0.82rem; font-weight: 700; color: white; }
.lote-mini-circ { display: flex; justify-content: center; margin-bottom: 8px; }
.lote-mini-stats { font-size: 0.68rem; color: var(--muted); }
.lote-mini-stat { display: flex; justify-content: space-between; padding: 2px 0; }
.lote-mini-val { color: var(--text); font-weight: 600; }
.lote-mini-updated { font-size: 0.63rem; color: var(--muted); margin-top: 6px; }

/* ── Performance Transportadora ──────────────────────────────────────────── */
.transport-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.transport-row {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.78rem;
}
.transport-logo {
  width: 32px; height: 32px;
  border-radius: 8px;
  background: #0f172a;
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.65rem; font-weight: 700; color: var(--muted);
  flex-shrink: 0;
}
.transport-name { width: 80px; color: var(--text); font-weight: 600; }
.transport-bar-wrap { flex: 1; height: 6px; background: #1e3251; border-radius: 99px; overflow: hidden; }
.transport-bar-fill { height: 100%; border-radius: 99px; background: var(--green); transition: width .4s; }
.transport-pct { width: 40px; text-align: right; font-weight: 700; color: var(--text); }
.transport-atraso { width: 60px; text-align: right; color: var(--red); font-size: 0.72rem; }

/* ── Modal ───────────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.65);
  z-index: 300;
  display: flex; align-items: center; justify-content: center;
}
.modal-overlay.hidden { display: none !important; }
.modal {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 28px;
  width: 420px;
  max-width: 92vw;
}
.modal-title {
  font-size: 1rem; font-weight: 700; color: white;
  margin-bottom: 20px;
}
.modal-form { display: flex; flex-direction: column; gap: 14px; }
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-row { display: flex; align-items: center; gap: 10px; }
.form-label { font-size: 0.75rem; color: var(--muted); font-weight: 500; }
.form-input {
  padding: 9px 12px;
  background: #0f172a; border: 1px solid var(--border);
  border-radius: 8px; color: var(--text); font-size: 0.85rem;
  outline: none; width: 100%;
}
.form-input:focus { border-color: var(--accent); }
.form-checkbox { width: 16px; height: 16px; cursor: pointer; accent-color: var(--accent); }
.modal-actions {
  display: flex; gap: 10px; margin-top: 4px; justify-content: flex-end;
}
.btn-primary {
  padding: 9px 20px;
  background: var(--accent); border: none;
  color: white; border-radius: 8px; cursor: pointer;
  font-size: 0.85rem; font-weight: 600; transition: background .15s;
}
.btn-primary:hover { background: #4f46e5; }
.btn-secondary {
  padding: 9px 16px;
  background: transparent; border: 1px solid var(--border);
  color: var(--text); border-radius: 8px; cursor: pointer; font-size: 0.85rem;
  transition: background .15s;
}
.btn-secondary:hover { background: rgba(255,255,255,.05); }

/* ── Progress bar atualização lote ─────────────────────────────────────── */
#updateProgress {
  background: rgba(99,102,241,.08);
  border: 1px solid rgba(99,102,241,.2);
  border-radius: 10px;
  padding: 12px 16px;
  margin-bottom: 14px;
  font-size: 0.82rem;
  color: var(--subtle);
}
