/* Guardian Tracker — design system */
:root {
  --brand: #1f4bff;
  --brand-600: #1638d6;
  --brand-50: #eef2ff;
  --accent: #10d0c4;
  --ok: #16a34a;
  --ok-bg: #dcfce7;
  --warn: #d97706;
  --warn-bg: #fef3c7;
  --danger: #dc2626;
  --danger-bg: #fee2e2;
  --idle: #64748b;
  --idle-bg: #e2e8f0;
  --poi: #f59e0b;

  --bg: #f3f5fa;
  --surface: #ffffff;
  --surface-2: #f7f8fc;
  --border: #e3e7f0;
  --text: #0f172a;
  --text-2: #475569;
  --text-3: #8a94a8;
  --rail: #0b1124;
  --rail-text: #9aa6c4;
  --shadow: 0 1px 2px rgba(15,23,42,.06), 0 8px 24px rgba(15,23,42,.08);
  --shadow-lg: 0 12px 40px rgba(15,23,42,.18);
  --radius: 14px;
  --radius-sm: 10px;
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #070b16;
  --surface: #0f1629;
  --surface-2: #141c33;
  --border: #222c47;
  --text: #e8ecf6;
  --text-2: #a8b2c9;
  --text-3: #6c7894;
  --brand-50: #172251;
  --ok-bg: #0f2f1f;
  --warn-bg: #352708;
  --danger-bg: #3a1214;
  --idle-bg: #1e263b;
  --rail: #050812;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.35);
  --shadow-lg: 0 12px 40px rgba(0,0,0,.55);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: var(--font);
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }

/* ---------- App shell ---------- */
.app {
  --panel-w: 360px;
  position: relative;
  display: grid;
  grid-template-columns: 76px var(--panel-w) 1fr;
  transition: grid-template-columns .25s ease;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}
.app.no-panel { grid-template-columns: 76px 1fr; }

/* Painel lateral recolhível (computador) */
.app.collapsed { grid-template-columns: 76px 0 1fr; }
.app.collapsed .panel { min-width: 0; overflow: hidden; border-right: 0; }
.panel-collapse {
  position: absolute; top: 50%; left: calc(76px + var(--panel-w)); z-index: 1150;
  transform: translateY(-50%);
  width: 22px; height: 58px; padding: 0;
  display: grid; place-items: center;
  border: 1px solid var(--border); border-left: 0; border-radius: 0 10px 10px 0;
  background: var(--surface); color: var(--text-2);
  box-shadow: 4px 0 14px rgba(0,0,0,.12);
  cursor: pointer; transition: left .25s ease, color .15s;
}
.panel-collapse:hover { color: var(--brand); }
.panel-collapse i { font-size: 12px; transition: transform .25s ease; }
.app.collapsed .panel-collapse { left: 76px; }
.app.collapsed .panel-collapse i { transform: rotate(180deg); }

.rail {
  background: var(--rail);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 14px 0;
  gap: 6px;
  z-index: 1200;
}
.rail-logo {
  width: 44px; height: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--brand), #6d4bff);
  display: grid; place-items: center;
  color: #fff; font-size: 20px;
  margin-bottom: 14px;
  box-shadow: 0 6px 18px rgba(31,75,255,.45);
}
.rail a, .rail button {
  width: 60px;
  padding: 9px 0 7px;
  border-radius: 12px;
  border: 0;
  background: transparent;
  color: var(--rail-text);
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  font-size: 10.5px; font-weight: 500;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.rail a i, .rail button i { font-size: 17px; }
.rail a:hover, .rail button:hover { background: rgba(255,255,255,.06); color: #fff; }
.rail a.active { background: rgba(31,75,255,.22); color: #fff; }
.rail a.active i { color: #7d9bff; }
.rail .spacer { flex: 1; }
.rail .avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: #1c2645; color: #cfd8f3;
  display: grid; place-items: center; font-weight: 600; font-size: 13px;
  margin-top: 6px;
}

/* ---------- Side panel ---------- */
.panel {
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  min-height: 0;
  z-index: 1100;
}
.panel-head { padding: 20px 20px 12px; }
.panel-head h1 { font-size: 19px; margin: 0; letter-spacing: -.01em; }
.panel-head p { margin: 4px 0 0; color: var(--text-2); font-size: 13px; }
.panel-body { padding: 0 20px 20px; overflow-y: auto; flex: 1; min-height: 0; }
.panel-section { padding: 14px 0; border-top: 1px solid var(--border); }
.panel-section:first-child { border-top: 0; }
.section-title {
  font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
  color: var(--text-3); margin: 0 0 10px;
  display: flex; align-items: center; justify-content: space-between;
}

/* ---------- Map area ---------- */
.map-area { position: relative; min-width: 0; }
.map-area .map { position: absolute; inset: 0; background: var(--surface-2); }

.map-overlay { position: absolute; z-index: 800; pointer-events: none; }
.map-overlay > * { pointer-events: auto; }
.overlay-top { top: 16px; left: 16px; right: 16px; display: flex; gap: 12px; align-items: flex-start; justify-content: space-between; }
.overlay-bottom { bottom: 16px; left: 16px; right: 16px; display: flex; justify-content: center; }

/* KPI chips */
.kpis { display: flex; gap: 10px; flex-wrap: wrap; }
.kpi {
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 14px;
  box-shadow: var(--shadow);
  min-width: 112px;
}
.kpi .label { font-size: 11px; color: var(--text-2); display: flex; align-items: center; gap: 6px; }
.kpi .value { font-size: 22px; font-weight: 700; letter-spacing: -.02em; margin-top: 2px; font-variant-numeric: tabular-nums; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }
.dot.ok { background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 25%, transparent); }
.dot.moving { background: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent); }
.dot.idle { background: var(--idle); }
.dot.brand { background: var(--brand); }
.dot.poi { background: var(--poi); }

/* Map tool buttons */
.toolbar {
  display: flex; flex-direction: column; gap: 8px;
}
.tool-group {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
  overflow: hidden;
  display: flex; flex-direction: column;
}
.tool-group button {
  width: 42px; height: 42px; border: 0; background: transparent;
  color: var(--text-2); cursor: pointer; font-size: 15px;
  border-top: 1px solid var(--border);
}
.tool-group button:first-child { border-top: 0; }
.tool-group button:hover { background: var(--surface-2); color: var(--text); }
.tool-group button.on { color: var(--brand); background: var(--brand-50); }

.layer-menu {
  position: absolute; right: 52px; top: 0;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: var(--shadow-lg); padding: 8px; width: 210px; display: none;
}
.layer-menu.open { display: block; }
.layer-menu button {
  width: 100%; display: flex; align-items: center; gap: 10px; padding: 8px 10px;
  border: 0; background: transparent; border-radius: 8px; cursor: pointer; text-align: left; font-size: 13px;
}
.layer-menu button:hover { background: var(--surface-2); }
.layer-menu button.on { background: var(--brand-50); color: var(--brand); font-weight: 600; }
.layer-menu .sw { width: 28px; height: 28px; border-radius: 6px; flex: none; border: 1px solid var(--border); }
.layer-menu hr { border: 0; border-top: 1px solid var(--border); margin: 6px 0; }
.layer-menu label { display: flex; align-items: center; gap: 8px; padding: 6px 10px; font-size: 13px; cursor: pointer; }

/* ---------- Form controls ---------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.field label { font-size: 12px; font-weight: 600; color: var(--text-2); }
.input, .select, .textarea {
  width: 100%;
  border: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  outline: none;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.textarea { resize: vertical; min-height: 70px; }
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--brand);
  background: var(--surface);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 18%, transparent);
}
.select[multiple] { min-height: 120px; }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.search {
  position: relative;
}
.search i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-3); font-size: 13px; }
.search .input { padding-left: 34px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-weight: 600; font-size: 13.5px;
  cursor: pointer;
  transition: background .15s, border-color .15s, transform .05s;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-600); }
.btn-ghost { background: transparent; border-color: var(--border); color: var(--text); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-danger { background: var(--danger-bg); color: var(--danger); }
.btn-danger:hover { filter: brightness(.97); }
.btn-sm { padding: 6px 10px; font-size: 12.5px; }
.btn-block { width: 100%; }
.btn-icon { width: 34px; height: 34px; padding: 0; }

.segmented {
  display: inline-flex; background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 3px; gap: 2px; width: 100%;
}
.segmented button {
  flex: 1; border: 0; background: transparent; padding: 7px 10px; border-radius: 8px;
  font-size: 12.5px; font-weight: 600; color: var(--text-2); cursor: pointer;
}
.segmented button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }

.chip-filter { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.chip-filter button {
  border: 1px solid var(--border); background: var(--surface); color: var(--text-2);
  border-radius: 999px; padding: 5px 11px; font-size: 12px; font-weight: 500; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
}
.chip-filter button.on { border-color: var(--brand); color: var(--brand); background: var(--brand-50); }
.chip-filter .count { font-variant-numeric: tabular-nums; color: var(--text-3); }
.chip-filter button.on .count { color: inherit; }

/* ---------- Device list ---------- */
.device-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.device {
  display: grid; grid-template-columns: 40px 1fr auto; gap: 12px; align-items: center;
  padding: 10px 12px; border-radius: 12px; border: 1px solid transparent; cursor: pointer;
  transition: background .12s, border-color .12s;
}
.device:hover { background: var(--surface-2); }
.device.selected { background: var(--brand-50); border-color: color-mix(in srgb, var(--brand) 35%, transparent); }
.device .badge-icon {
  width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; font-size: 15px;
  background: var(--idle-bg); color: var(--idle);
}
.device.st-moving .badge-icon { background: color-mix(in srgb, var(--accent) 16%, transparent); color: #0b9e95; }
.device.st-online .badge-icon { background: var(--ok-bg); color: var(--ok); }
.device .name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.device .meta { font-size: 12px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.device .side { text-align: right; font-size: 12px; color: var(--text-2); }
.device .speed { font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }
.device .min { min-width: 0; }

.pill {
  display: inline-flex; align-items: center; gap: 5px; border-radius: 999px; padding: 2px 8px;
  font-size: 11px; font-weight: 600;
}
.pill.ok { background: var(--ok-bg); color: var(--ok); }
.pill.moving { background: color-mix(in srgb, var(--accent) 16%, transparent); color: #0b9e95; }
.pill.idle { background: var(--idle-bg); color: var(--idle); }
.pill.warn { background: var(--warn-bg); color: var(--warn); }
.pill.danger { background: var(--danger-bg); color: var(--danger); }

.empty {
  text-align: center; color: var(--text-2); padding: 30px 12px;
}
.empty i { font-size: 28px; color: var(--text-3); margin-bottom: 10px; display: block; }

/* ---------- Cards & lists ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px; box-shadow: var(--shadow);
}
.list-item {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; cursor: pointer;
}
.list-item:hover { background: var(--surface-2); }
.list-item .grow { flex: 1; min-width: 0; }
.list-item .title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-item .sub { font-size: 12px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-item .ico { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; flex: none; }

.stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.stat {
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px;
}
.stat .l { font-size: 11px; color: var(--text-2); }
.stat .v { font-size: 18px; font-weight: 700; margin-top: 2px; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.stat .v small { font-size: 12px; font-weight: 500; color: var(--text-2); }

.notice {
  border-radius: 12px; padding: 10px 12px; font-size: 13px; display: flex; gap: 10px; align-items: flex-start;
  background: var(--surface-2); border: 1px dashed var(--border); color: var(--text-2);
}
.notice.ok { background: var(--ok-bg); color: var(--ok); border: 0; }

/* ---------- Leaflet skin ---------- */
.leaflet-container { font-family: var(--font); background: var(--surface-2); }
.leaflet-control-zoom { display: none; }
.leaflet-popup-content-wrapper {
  border-radius: 14px; background: var(--surface); color: var(--text);
  box-shadow: var(--shadow-lg); padding: 0;
}
.leaflet-popup-content { margin: 0; width: 290px !important; }
.leaflet-popup-tip { background: var(--surface); }
.leaflet-container a.leaflet-popup-close-button { color: var(--text-3); top: 8px; right: 8px; }
.leaflet-control-attribution { font-size: 10px; background: color-mix(in srgb, var(--surface) 80%, transparent) !important; color: var(--text-3); }
.leaflet-control-attribution a { color: var(--text-2); }
.leaflet-tooltip {
  background: var(--surface); color: var(--text); border: 1px solid var(--border);
  border-radius: 8px; box-shadow: var(--shadow); font-family: var(--font); font-size: 12px; padding: 6px 9px;
}

.pop { padding: 14px 16px 12px; }
.pop-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; padding-right: 18px; }
.pop-head .t { font-weight: 700; font-size: 15px; }
.pop-head .s { font-size: 12px; color: var(--text-2); }
.pop-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; margin: 10px 0; }
.pop-grid .l { font-size: 11px; color: var(--text-3); }
.pop-grid .v { font-weight: 600; font-variant-numeric: tabular-nums; }
.pop-addr { font-size: 12.5px; color: var(--text-2); display: flex; gap: 8px; line-height: 1.4; }
.pop-actions { display: flex; gap: 6px; margin-top: 12px; flex-wrap: wrap; }
.pop-actions .btn { flex: 1; }

/* Vehicle markers */
.vmark { position: relative; width: 44px; height: 44px; }
.vmark .halo {
  position: absolute; inset: 4px; border-radius: 50%;
  background: color-mix(in srgb, var(--c) 22%, transparent);
}
.vmark.moving .halo { animation: pulse 2s ease-out infinite; }
.vmark .core {
  position: absolute; inset: 10px; border-radius: 50%; background: var(--c);
  border: 3px solid #fff; box-shadow: 0 3px 10px rgba(0,0,0,.35);
  display: grid; place-items: center;
}
.vmark .core svg { width: 14px; height: 14px; transition: transform .6s ease; }
.vmark .lbl {
  position: absolute; top: 44px; left: 50%; transform: translateX(-50%);
  background: var(--surface); color: var(--text); border: 1px solid var(--border);
  font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 999px; white-space: nowrap;
  box-shadow: var(--shadow);
}
.vmark.sel .core { border-color: #fff; box-shadow: 0 0 0 4px var(--c), 0 3px 12px rgba(0,0,0,.4); }
@keyframes pulse {
  0% { transform: scale(.7); opacity: .9; }
  100% { transform: scale(1.6); opacity: 0; }
}
.poi-mark {
  width: 30px; height: 30px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg);
  background: var(--poi); border: 3px solid #fff; box-shadow: 0 3px 10px rgba(0,0,0,.3);
  display: grid; place-items: center;
}
.poi-mark i { transform: rotate(45deg); color: #fff; font-size: 11px; }
.poi-lbl {
  position: absolute; top: -24px; left: 50%; transform: translateX(-50%); white-space: nowrap;
  background: #111827; color: #fff; font-size: 10.5px; font-weight: 600; padding: 2px 7px; border-radius: 6px;
}
.pin-dot { width: 16px; height: 16px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 2px 8px rgba(0,0,0,.35); }

/* Minha posição */
.me-mark { position: relative; width: 40px; height: 40px; }
.me-halo { position: absolute; inset: 0; border-radius: 50%; background: rgba(31,75,255,.22); animation: pulse 2s ease-out infinite; }
.me-core { position: absolute; inset: 12px; border-radius: 50%; background: #1f4bff; border: 3px solid #fff; box-shadow: 0 2px 8px rgba(0,0,0,.4); }
.me-lbl { position: absolute; top: 40px; left: 50%; transform: translateX(-50%); background: #1f4bff !important; color: #fff !important; border: 0 !important; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.tool-group button.on i { color: var(--brand); }
.follow-card .me-info { font-size: 12px; font-weight: 600; color: var(--brand); display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.follow-card .compass { width: 22px; height: 22px; display: inline-grid; place-items: center; border-radius: 50%; background: var(--brand-50); transition: transform .6s; }

/* Follow card */
.follow-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow-lg);
  padding: 12px 14px; display: none; align-items: center; gap: 14px; max-width: 640px; width: 100%;
}
.follow-card.show { display: flex; }
.follow-card .live { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 700; color: var(--danger); text-transform: uppercase; letter-spacing: .06em; }
.follow-card .live .dot { background: var(--danger); animation: blink 1.2s infinite; }
@keyframes blink { 50% { opacity: .3; } }
.follow-card .grow { flex: 1; min-width: 0; }
@media (max-width: 860px) { .follow-card { flex-wrap: wrap; gap: 10px; } .follow-card .grow { flex-basis: 60%; } .follow-card #fMode { order: 5; flex: 1; } }
.follow-card .t { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.follow-card .s { font-size: 12px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.follow-card .big { font-size: 24px; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.follow-card .big small { font-size: 12px; font-weight: 500; color: var(--text-2); }

/* Playback bar */
.playback {
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow-lg);
  padding: 12px 14px; width: 100%; max-width: 760px; display: none;
}
.playback.show { display: block; }
.playback .row { display: flex; align-items: center; gap: 12px; }
.playback input[type=range] { flex: 1; accent-color: var(--brand); }
.playback .clock { font-variant-numeric: tabular-nums; font-weight: 700; min-width: 130px; }
.playback .spd { font-size: 12px; color: var(--text-2); min-width: 70px; text-align: right; }
.speed-chart { width: 100%; height: 56px; display: block; margin-top: 8px; }

/* Loading */
.loading {
  position: absolute; inset: 0; z-index: 900; display: none; place-items: center;
  background: color-mix(in srgb, var(--surface) 70%, transparent); backdrop-filter: blur(2px);
}
.loading.show { display: grid; }
.loading .box { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 18px 22px; box-shadow: var(--shadow-lg); text-align: center; min-width: 240px; }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--border); border-top-color: var(--brand); animation: spin .8s linear infinite; margin: 0 auto 10px; }
@keyframes spin { to { transform: rotate(360deg); } }
.progress { height: 6px; border-radius: 999px; background: var(--surface-2); overflow: hidden; margin-top: 10px; }
.progress > div { height: 100%; background: var(--brand); width: 0; transition: width .3s; }

/* Toasts */
.toasts { position: fixed; top: 16px; right: 16px; z-index: 5000; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: var(--surface); color: var(--text); border: 1px solid var(--border); border-left: 4px solid var(--brand);
  border-radius: 12px; padding: 10px 14px; box-shadow: var(--shadow-lg); font-size: 13px; max-width: 340px;
  animation: slidein .2s ease-out;
}
.toast.success { border-left-color: var(--ok); }
.toast.danger { border-left-color: var(--danger); }
.toast.warning { border-left-color: var(--warn); }
@keyframes slidein { from { transform: translateX(20px); opacity: 0; } }

/* Mobile panel toggle */
.panel-toggle { display: none; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .app { --panel-w: 320px; }
  .kpi { min-width: 0; padding: 8px 12px; }
  .kpi .value { font-size: 18px; }
}
@media (max-width: 860px) {
  .app, .app.no-panel, .app.collapsed { grid-template-columns: 1fr; grid-template-rows: 1fr 62px; }
  .app.collapsed .panel { overflow: visible; }
  .panel-collapse { display: none; }
  .rail {
    grid-row: 2; flex-direction: row; justify-content: space-around; padding: 4px 8px; gap: 0;
  }
  .rail-logo, .rail .spacer, .rail .avatar { display: none; }
  .rail a, .rail button { width: auto; flex: 1; padding: 7px 0 5px; }
  .map-area { grid-row: 1; grid-column: 1; }
  .panel {
    grid-row: 1; grid-column: 1; align-self: end;
    position: relative; max-height: 58%; border-radius: 18px 18px 0 0; border: 0;
    box-shadow: 0 -10px 30px rgba(0,0,0,.18);
    transform: translateY(calc(100% - 64px)); transition: transform .25s ease;
  }
  .panel.open { transform: none; }
  .panel-toggle {
    display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%;
    border: 0; background: transparent; padding: 10px 0 4px; color: var(--text-2); font-weight: 600; cursor: pointer;
  }
  .panel-toggle::before { content: ""; width: 38px; height: 4px; border-radius: 4px; background: var(--border); position: absolute; top: 6px; }
  .panel-head { padding-top: 10px; }
  .overlay-top { top: 10px; left: 10px; right: 10px; }
  .kpis { gap: 6px; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; max-width: calc(100vw - 80px); }
  .kpis::-webkit-scrollbar { display: none; }
  .kpi { flex: none; }
  .kpi .label { font-size: 10px; }
  .overlay-bottom { bottom: 76px; left: 10px; right: 10px; }
  .toasts { left: 16px; }
}

/* ---------- Páginas sem mapa (administração) ---------- */
.page { overflow-y: auto; padding: 28px 32px 48px; min-width: 0; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.page-head h1 { margin: 0; font-size: 24px; letter-spacing: -.02em; }
.page-head p { margin: 4px 0 0; color: var(--text-2); }
.admin-kpis { margin-bottom: 20px; }
.admin-kpis .kpi { min-width: 150px; backdrop-filter: none; background: var(--surface); }
.toolbar-row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar-row .segmented button { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; }
.table-card { padding: 0; overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); font-weight: 600; padding: 12px 16px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr { cursor: pointer; transition: background .12s; }
.table tbody tr:hover { background: var(--surface-2); }
.table tbody tr:last-child td { border-bottom: 0; }
.table .title { font-weight: 600; }
.table .sub, .sub { font-size: 12px; color: var(--text-2); }
.cell-main { display: flex; align-items: center; gap: 12px; }
.avatar-sm { width: 34px; height: 34px; border-radius: 10px; flex: none; display: grid; place-items: center; font-weight: 700; background: var(--brand-50); color: var(--brand); }
.hint { font-weight: 400; color: var(--text-3); }

.drawer-backdrop { position: fixed; inset: 0; background: rgba(5,8,18,.45); z-index: 3000; opacity: 0; pointer-events: none; transition: opacity .2s; }
.drawer-backdrop.open { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(480px, 100vw); z-index: 3001;
  background: var(--surface); border-left: 1px solid var(--border); box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column; transform: translateX(100%); transition: transform .25s ease;
}
.drawer.open { transform: none; }
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px; border-bottom: 1px solid var(--border); }
.drawer-head h2 { margin: 0; font-size: 18px; }
.drawer-body { padding: 18px 20px; overflow-y: auto; flex: 1; }
.drawer-foot { display: flex; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--border); }
.checks { display: flex; flex-direction: column; gap: 8px; margin: 4px 0 16px; }
.checks label { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.checks input, .pick-list input { accent-color: var(--brand); width: 16px; height: 16px; flex: none; }
.pick-list { border: 1px solid var(--border); border-radius: var(--radius-sm); max-height: 260px; overflow-y: auto; padding: 4px; }
.pick-list label { display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: 8px; cursor: pointer; }
.pick-list label:hover { background: var(--surface-2); }
.pick-list span { display: flex; flex-direction: column; min-width: 0; }
.pick-list small { color: var(--text-2); font-size: 11.5px; }
@media (max-width: 860px) {
  .page { grid-row: 1; padding: 18px 16px 32px; }
  .admin-kpis .kpi { min-width: 0; }
  .table th:nth-child(4), .table td:nth-child(4) { display: none; }
}
