/* ═══════════════════════════════════════════════════════════════
   SafeMap.net — consola de operações
   Sistema visual: Linear (DESIGN.md · Linear-design-analysis)
   Canvas #010102 · escada de superfícies · acento único lavanda
   Tipografia: Inter (display/texto) · JetBrains Mono (dados)
   ═══════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  --primary-rgb: 94, 106, 210;

  /* ── acento único ── */
  --primary: #5e6ad2;
  --on-primary: #ffffff;
  --primary-hover: #828fff;
  --primary-focus: #5e69d1;

  /* ── escada de superfícies ── */
  --canvas: #010102;
  --surface-1: #0f1011;
  --surface-2: #141516;
  --surface-3: #18191a;
  --surface-4: #191a1b;

  /* ── hairlines ── */
  --hairline: #23252a;
  --hairline-strong: #34343a;
  --hairline-tertiary: #3e3e44;

  /* ── tinta ── */
  --ink: #f7f8f8;
  --ink-muted: #d0d6e0;
  --ink-subtle: #8a8f98;
  --ink-tertiary: #62666d;

  /* ── semântica (única cor semântica + estado de erro funcional) ── */
  --success: #27a644;
  --danger: #e5484d;

  /* ── tipografia ── */
  --ui: 'Inter', -apple-system, system-ui, 'Segoe UI', Roboto, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;

  /* ── formas ── */
  --r-xs: 4px;
  --r-sm: 6px;
  --r-md: 8px;
  --r-lg: 12px;
  --r-xl: 16px;
  --r-pill: 9999px;

  /* ── espaçamento ── */
  --s-xxs: 4px;
  --s-xs: 8px;
  --s-sm: 12px;
  --s-md: 16px;
  --s-lg: 24px;
  --s-xl: 32px;
  --s-xxl: 48px;

  /* controlos nativos (select, date, time, scrollbars) em esquema escuro */
  color-scheme: dark;

  /* ── realce de aresta superior nos painéis levantados ── */
  --edge: inset 0 1px 0 rgba(255, 255, 255, 0.04);
  --focus-ring: 0 0 0 2px rgba(var(--primary-rgb), 0.5);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  background: var(--canvas);
  color: var(--ink);
  font-family: var(--ui);
  font-size: 15px;
  letter-spacing: -0.05px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
}

a { color: var(--primary-hover); text-decoration: none; }
a:hover { text-decoration: underline; }

::selection { background: rgba(var(--primary-rgb), 0.32); }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--hairline-strong); border-radius: var(--r-pill); }
::-webkit-scrollbar-thumb:hover { background: var(--hairline-tertiary); }
* { scrollbar-width: thin; scrollbar-color: var(--hairline-strong) transparent; }

.label,
.sc {
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  color: var(--ink-subtle);
}

/* ── botões ── */
button {
  position: relative;
  font-family: var(--ui);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  background: var(--surface-1);
  color: var(--ink-muted);
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  padding: 8px 14px;
  cursor: pointer;
  transition:
    background 0.15s ease,
    border-color 0.15s ease,
    color 0.15s ease;
}
button:hover {
  background: var(--surface-2);
  border-color: var(--hairline-strong);
  color: var(--ink);
}
button:active { background: var(--surface-3); }
button:focus-visible { outline: none; box-shadow: var(--focus-ring); }

/* CTA lavanda — o acento cromático único */
button.primary {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--on-primary);
}
button.primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); color: var(--on-primary); }
button.primary:active { background: var(--primary-focus); border-color: var(--primary-focus); }

/* ação principal dentro de painel — lavanda em tinta, não em preenchimento */
button.cyan {
  background: rgba(var(--primary-rgb), 0.12);
  border-color: rgba(var(--primary-rgb), 0.35);
  color: var(--primary-hover);
}
button.cyan:hover {
  background: rgba(var(--primary-rgb), 0.2);
  border-color: rgba(var(--primary-rgb), 0.5);
  color: var(--primary-hover);
}

button:disabled { opacity: .4; cursor: not-allowed; }

/* selecionado = elevação de superfície */
button.active {
  background: var(--surface-2);
  border-color: var(--hairline-strong);
  color: var(--ink);
}

input, select, textarea {
  font-family: var(--ui);
  font-size: 15px;
  letter-spacing: -0.05px;
  background: var(--surface-1);
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  color: var(--ink);
  padding: 8px 12px;
  width: 100%;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--hairline-strong);
  box-shadow: var(--focus-ring);
}
input::placeholder, textarea::placeholder { color: var(--ink-tertiary); }

/* ============ layout do mapa ============ */

#map { position: absolute; inset: 0; }
body.map-page { overflow: hidden; }

.topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 56px;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 16px;
  background: var(--canvas);
  border-bottom: 1px solid var(--hairline);
  z-index: 40;
}
.brand {
  color: var(--ink);
  font-weight: 600;
  font-size: 17px;
  letter-spacing: -0.4px;
  text-transform: uppercase;
  white-space: nowrap;
}
.brand .dot { color: var(--primary); }
a.brand:hover { text-decoration: none; }
.topbar .status {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-subtle);
  letter-spacing: 0.4px;
  text-transform: uppercase;
  font-variant-numeric: tabular-nums;
}

/* ponto "live" — indicador de estado */
.status .live-dot {
  position: relative;
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--success);
  display: inline-block;
  flex-shrink: 0;
}
.status .live-dot::before {
  content: '';
  position: absolute; inset: 0;
  border-radius: 50%;
  border: 1px solid var(--success);
  animation: pulse-ring-expand 2.4s cubic-bezier(0, 0.55, 0.45, 1) infinite;
  will-change: transform, opacity;
}
.status .live-dot.offline { background: var(--danger); }
.status .live-dot.offline::before { border-color: var(--danger); animation-duration: 1.4s; }
@keyframes pulse-ring-expand {
  0% { transform: scale(0.6); opacity: 0.5; }
  100% { transform: scale(2.6); opacity: 0; }
}

.time-filters {
  display: flex;
  gap: 4px;
  flex-wrap: nowrap;
}
.time-filters button {
  padding: 5px 12px;
  font-size: 13px;
  border-radius: var(--r-pill);
  background: transparent;
  border-color: transparent;
  color: var(--ink-subtle);
}
.time-filters button:hover { background: var(--surface-1); border-color: transparent; color: var(--ink); }
.time-filters button.active {
  background: var(--surface-2);
  border-color: transparent;
  color: var(--ink);
}
.time-filters button.locked { color: var(--ink-tertiary); background: transparent; border-color: transparent; }
.time-filters button.locked:hover { background: transparent; color: var(--ink-tertiary); }
.time-filters button.locked:hover::before {
  content: attr(data-tip);
  position: absolute;
  top: calc(100% + 8px); left: 50%;
  transform: translateX(-50%);
  background: var(--surface-3);
  border: 1px solid var(--hairline-strong);
  border-radius: var(--r-xs);
  color: var(--ink-muted);
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
  padding: 3px 8px;
  white-space: nowrap;
  z-index: 60;
}

/* barra lateral de ferramentas */
.toolrail {
  position: fixed;
  top: 72px; left: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  z-index: 35;
}
.toolrail button {
  display: flex; align-items: center; justify-content: flex-start;
  gap: 10px;
  width: 152px; height: 38px;
  padding: 0 12px;
  background: var(--surface-1);
  border-radius: var(--r-md);
  border-color: var(--hairline);
  box-shadow: var(--edge);
}
.toolrail button .ico {
  font-size: 15px;
  width: 18px;
  text-align: center;
  color: var(--ink-subtle);
  flex-shrink: 0;
  transition: color 0.15s ease;
}
.toolrail button .tag {
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  color: var(--ink-muted);
  white-space: nowrap;
  transition: color 0.15s ease;
}
.toolrail button:hover { background: var(--surface-2); border-color: var(--hairline-strong); }
.toolrail button:hover .tag,
.toolrail button:hover .ico { color: var(--ink); }
.toolrail button.active {
  background: var(--surface-2);
  border-color: var(--hairline-strong);
}
.toolrail button.active .tag { color: var(--ink); }
.toolrail button.active .ico { color: var(--primary); }

/* painéis */
.panel {
  position: fixed;
  top: 72px; left: 180px;
  width: 320px;
  max-height: calc(100vh - 150px);
  overflow-y: auto;
  background: var(--surface-1);
  border: 1px solid var(--hairline);
  border-radius: var(--r-lg);
  box-shadow: var(--edge);
  padding: var(--s-lg);
  z-index: 34;
  animation: slide-in-left 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes slide-in-left {
  0% { transform: translateX(-12px); opacity: 0; }
  100% { transform: translateX(0); opacity: 1; }
}
.panel h3 {
  font-size: 22px;
  font-weight: 500;
  line-height: 1.25;
  letter-spacing: -0.4px;
  text-transform: none;
  color: var(--ink);
  margin-bottom: var(--s-md);
}
.panel .row { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }

/* interruptores de camada */
.panel label.toggle {
  display: flex; align-items: center; gap: 10px;
  font-size: 14px; cursor: pointer; padding: 6px 0;
  letter-spacing: 0;
  color: var(--ink-muted);
  transition: color 0.15s ease;
}
.panel label.toggle:hover { color: var(--ink); }
.panel label.toggle input {
  appearance: none;
  -webkit-appearance: none;
  position: relative;
  width: 28px; height: 16px;
  border-radius: var(--r-pill);
  background: var(--surface-3);
  border: 1px solid var(--hairline-strong);
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
  flex-shrink: 0;
  margin: 0;
  padding: 0;
  box-shadow: none;
}
.panel label.toggle input::after {
  content: '';
  position: absolute; top: 2px; left: 2px;
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--ink-tertiary);
  transition: left 0.2s ease, background 0.2s ease;
}
.panel label.toggle input:checked {
  background: var(--primary);
  border-color: var(--primary);
}
.panel label.toggle input:checked::after {
  left: 14px;
  background: var(--on-primary);
}
.panel label.toggle input:focus-visible { outline: none; box-shadow: var(--focus-ring); }

.panel .hint { font-size: 13px; color: var(--ink-subtle); margin-top: var(--s-sm); line-height: 1.5; }
.panel .sep { border-top: 1px solid var(--hairline); margin: var(--s-md) 0 var(--s-sm); }
.panel .sub {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-subtle);
  letter-spacing: 0.4px;
  text-transform: uppercase;
  margin-bottom: var(--s-xs);
}
.panel .close {
  position: absolute; top: 12px; right: 12px;
  border: 1px solid transparent; background: transparent;
  font-size: 13px; width: auto; height: auto; padding: 4px 6px;
  color: var(--ink-subtle);
  border-radius: var(--r-xs);
}
.panel .close:hover { color: var(--ink); background: var(--surface-2); border-color: transparent; }

/* atribuição do serviço de pesquisa (LocationIQ) */
.panel .attrib {
  font-size: 12px;
  letter-spacing: 0;
  color: var(--ink-tertiary);
  margin-top: 6px;
  text-align: right;
}
.panel .attrib a { color: var(--ink-subtle); text-decoration: none; }
.panel .attrib a:hover { color: var(--ink); text-decoration: underline; }

.results-list { margin-top: var(--s-sm); }
.results-list .item {
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: var(--r-md);
  margin-bottom: 2px;
  cursor: pointer;
  font-size: 14px;
  line-height: 1.4;
  color: var(--ink-muted);
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.results-list .item:hover, .results-list .item.sel {
  background: var(--surface-2);
  border-color: var(--hairline-strong);
  color: var(--ink);
}
.results-list .item small { color: var(--ink-subtle); display: block; font-size: 12px; }

.route-alt {
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  padding: 10px 12px;
  margin-top: 8px;
  cursor: pointer;
  font-size: 14px;
  color: var(--ink-muted);
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.route-alt:hover { background: var(--surface-2); border-color: var(--hairline-strong); color: var(--ink); }
.route-alt.sel {
  background: var(--surface-2);
  border-color: rgba(var(--primary-rgb), 0.5);
  color: var(--ink);
}
.route-alt .risk { color: var(--ink-subtle); font-size: 13px; margin-top: 4px; }

.aoi-item {
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  padding: 10px 12px;
  margin-top: 8px;
  font-size: 14px;
  color: var(--ink-muted);
  transition: border-color 0.15s ease;
}
.aoi-item:hover { border-color: var(--hairline-strong); }
.aoi-item .metrics { color: var(--ink); font-size: 13px; margin: 4px 0; font-variant-numeric: tabular-nums; }
.aoi-item .actions { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.aoi-item .actions button { font-size: 12px; padding: 4px 10px; }

/* painel de evento */
#event-panel {
  position: fixed;
  top: 72px; right: 16px;
  width: 340px;
  background: var(--surface-1);
  border: 1px solid var(--hairline);
  border-radius: var(--r-lg);
  box-shadow: var(--edge);
  padding: var(--s-lg);
  z-index: 36;
  display: none;
}
#event-panel.open { display: block; animation: slide-in-right 0.28s cubic-bezier(0.16, 1, 0.3, 1); }
@keyframes slide-in-right {
  0% { transform: translateX(12px); opacity: 0; }
  100% { transform: translateX(0); opacity: 1; }
}
#event-panel h3 {
  color: var(--ink);
  font-size: 22px;
  font-weight: 500;
  line-height: 1.25;
  letter-spacing: -0.4px;
  text-transform: none;
  margin-bottom: var(--s-md);
}
#event-panel .field { margin-bottom: var(--s-sm); }
#event-panel .field .k {
  font-size: 12px;
  color: var(--ink-subtle);
  letter-spacing: 0.4px;
  text-transform: uppercase;
  font-weight: 500;
  margin-bottom: 3px;
}
#event-panel .field .v { font-size: 15px; line-height: 1.5; color: var(--ink-muted); word-wrap: break-word; }
#event-panel .field .v.coord {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
#event-panel .close {
  position: absolute; top: 12px; right: 12px;
  border: 1px solid transparent; background: transparent;
  padding: 4px 6px; color: var(--ink-subtle);
  border-radius: var(--r-xs);
}
#event-panel .close:hover { color: var(--ink); background: var(--surface-2); }

/* HUD */
.hud {
  position: fixed;
  bottom: 58px; right: 16px;
  background: var(--surface-1);
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  box-shadow: var(--edge);
  padding: 10px 14px;
  font-size: 12px;
  color: var(--ink-subtle);
  z-index: 30;
  letter-spacing: 0;
  line-height: 1.6;
  text-align: right;
  min-width: 190px;
  font-variant-numeric: tabular-nums;
}
.hud .coords {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink);
  font-weight: 500;
}
.hud .scalebar {
  height: 4px;
  border: 1px solid var(--hairline-tertiary);
  border-top: none;
  margin-top: 4px;
  margin-left: auto;
  transition: width 0.2s ease;
}

/* rodapé de créditos */
.credits {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 12px;
  letter-spacing: 0;
  color: var(--ink-tertiary);
  background: var(--canvas);
  border-top: 1px solid var(--hairline);
  z-index: 32;
  text-transform: uppercase;
}
.credits a { color: var(--ink-subtle); }
.credits a:hover { color: var(--ink); text-decoration: none; }
.credits .credits-center {
  display: flex;
  align-items: center;
  gap: 6px;
}
.credits .credits-links {
  position: absolute;
  right: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.credits .credits-links a { color: var(--ink-subtle); transition: color 0.15s ease; }
.credits .credits-links a:hover { color: var(--ink); text-decoration: none; }

/* presets de região */
.region-presets {
  position: fixed;
  bottom: 42px; left: 16px;
  display: flex;
  gap: 4px;
  z-index: 30;
  flex-wrap: wrap;
  max-width: 460px;
}
.region-presets button {
  font-size: 13px; padding: 5px 12px;
  background: var(--surface-1);
  border-radius: var(--r-pill);
  border-color: var(--hairline);
  box-shadow: var(--edge);
}

/* nav móvel */
.mobilenav { display: none; }

@media (max-width: 768px) {
  .toolrail { display: none; }
  .region-presets { display: none; }
  .credits .credits-links { display: none; }
  .hud { bottom: 114px; right: 8px; font-size: 11px; min-width: 150px; }
  .topbar { gap: 10px; padding: 0 12px; height: 64px; flex-wrap: wrap; }
  .brand { font-size: 15px; }
  .time-filters { order: 3; width: 100%; overflow-x: auto; padding-bottom: 4px; }
  .panel { left: 8px; right: 8px; width: auto; top: 76px; }
  #event-panel { left: 8px; right: 8px; width: auto; top: auto; bottom: 100px; max-height: 50vh; overflow-y: auto; }
  .maplibregl-ctrl-bottom-left,
  .maplibregl-ctrl-bottom-right { bottom: 88px; }
  .maplibregl-ctrl-attrib { max-width: calc(100vw - 16px); }
  .mobilenav {
    display: flex;
    position: fixed;
    bottom: 30px; left: 8px; right: 8px;
    height: 54px;
    background: var(--surface-1);
    border: 1px solid var(--hairline);
    border-radius: var(--r-lg);
    box-shadow: var(--edge);
    overflow: hidden;
    z-index: 38;
  }
  .mobilenav button {
    flex: 1;
    border: none;
    background: transparent;
    border-radius: 0;
    border-right: 1px solid var(--hairline);
    font-size: 17px;
    height: 100%;
    color: var(--ink-subtle);
  }
  .mobilenav button:last-child { border-right: none; }
  .mobilenav button:hover { background: var(--surface-2); color: var(--ink); }
  .mobilenav button.active {
    background: var(--surface-2);
    color: var(--primary);
  }
}

/* toasts */
#toasts {
  position: fixed;
  top: 68px; left: 50%;
  transform: translateX(-50%);
  z-index: 90;
  display: flex; flex-direction: column; gap: 8px;
  align-items: center;
}
.toast {
  background: var(--surface-2);
  border: 1px solid var(--hairline-strong);
  border-radius: var(--r-md);
  color: var(--ink);
  padding: 10px 16px;
  font-size: 14px;
  letter-spacing: -0.05px;
  animation: toast-in .22s cubic-bezier(0.16, 1, 0.3, 1);
  max-width: 90vw;
  box-shadow: var(--edge);
}
.toast.error { border-color: rgba(229, 72, 77, 0.5); color: var(--danger); }
.toast.info { border-color: rgba(var(--primary-rgb), 0.5); color: var(--primary-hover); }
@keyframes toast-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: translateY(0); } }

/* ============ páginas de documento (login/pricing/legal/admin) ============ */

.doc-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 48px 24px 96px;
  background: var(--canvas);
  position: relative;
}
.doc-header {
  width: 100%;
  max-width: 1280px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--s-xxl);
}
.doc-header nav { display: flex; gap: 24px; font-size: 14px; letter-spacing: 0; }
.doc-header nav a { color: var(--ink-subtle); transition: color 0.15s ease; }
.doc-header nav a:hover { color: var(--ink); text-decoration: none; }

.card {
  width: 100%;
  max-width: 440px;
  background: var(--surface-1);
  border: 1px solid var(--hairline);
  border-radius: var(--r-lg);
  box-shadow: var(--edge);
  padding: var(--s-xl);
}
.card h1 {
  font-size: 28px;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.6px;
  text-transform: none;
  color: var(--ink);
  margin-bottom: var(--s-lg);
}
.card .field { margin-bottom: var(--s-md); }
.card .field label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  color: var(--ink-subtle);
  margin-bottom: 6px;
}
.card button.block { width: 100%; padding: 11px; margin-top: 8px; }
.switch { text-align: center; margin-top: var(--s-md); font-size: 13px; color: var(--ink-subtle); letter-spacing: 0; line-height: 1.5; }
.card .msg { font-size: 14px; margin-top: var(--s-sm); line-height: 1.5; min-height: 16px; color: var(--ink-muted); }
.card .msg.error { color: var(--danger); }
.card .msg.ok { color: var(--success); }

/* controlo segmentado — padrão pricing-tab (seleção = elevação de superfície) */
.tabs {
  display: flex;
  gap: 3px;
  margin-bottom: var(--s-lg);
  background: var(--canvas);
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  padding: 3px;
}
.tabs button {
  flex: 1;
  font-size: 13px;
  padding: 6px 14px;
  background: transparent;
  border-color: transparent;
  color: var(--ink-subtle);
  border-radius: var(--r-sm);
}
.tabs button:hover { background: var(--surface-2); border-color: transparent; color: var(--ink); }
.tabs button.active { background: var(--surface-3); border-color: transparent; color: var(--ink); }

/* pricing */
.plans {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--s-lg);
  width: 100%;
  max-width: 1280px;
}
.plan {
  background: var(--surface-1);
  border: 1px solid var(--hairline);
  border-radius: var(--r-lg);
  box-shadow: var(--edge);
  padding: var(--s-lg);
  display: flex;
  flex-direction: column;
  transition: background 0.2s ease, border-color 0.2s ease;
}
.plan:hover { background: var(--surface-2); border-color: var(--hairline-strong); }
.plan.featured {
  background: var(--surface-2);
  border-color: var(--hairline-strong);
}
.plan h2 {
  font-size: 28px;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.6px;
  text-transform: none;
  color: var(--ink);
}
.plan .price {
  font-size: 40px; color: var(--ink); margin: var(--s-sm) 0 var(--s-xxs);
  font-weight: 600; line-height: 1.15; letter-spacing: -1px;
  font-variant-numeric: tabular-nums;
}
.plan .price small { font-size: 14px; color: var(--ink-subtle); font-weight: 400; letter-spacing: 0; }
.plan ul { list-style: none; margin: var(--s-lg) 0; flex: 1; }
.plan ul li {
  padding: 10px 0 10px 20px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink-muted);
  position: relative;
  border-bottom: 1px solid var(--hairline);
}
.plan ul li::before { content: '→'; position: absolute; left: 0; color: var(--primary); }
.plan ul li.off { color: var(--ink-tertiary); }
.plan ul li.off::before { content: '·'; color: var(--ink-tertiary); }

/* legal */
.legal-doc { max-width: 760px; width: 100%; line-height: 1.6; font-size: 16px; color: var(--ink-muted); }
.legal-doc h1 {
  font-size: 40px; color: var(--ink); letter-spacing: -1px; line-height: 1.15;
  text-transform: none; font-weight: 600; margin: var(--s-xxl) 0 var(--s-md);
}
.legal-doc h1:first-child { margin-top: 0; }
.legal-doc h2 {
  font-size: 22px; color: var(--ink); letter-spacing: -0.4px; line-height: 1.25;
  text-transform: none; font-weight: 500; margin: var(--s-xl) 0 var(--s-sm);
}
.legal-doc p, .legal-doc li { color: var(--ink-muted); margin-bottom: var(--s-sm); }
.legal-doc strong { color: var(--ink); font-weight: 500; }
.legal-doc ul { padding-left: 20px; }
.legal-doc a { color: var(--primary-hover); }

/* admin */
.admin-wrap { width: 100%; max-width: 1280px; }
.admin-tabs { display: flex; gap: 4px; margin-bottom: var(--s-lg); flex-wrap: wrap; }
.admin-tabs button {
  background: transparent;
  border-color: transparent;
  color: var(--ink-subtle);
  border-radius: var(--r-pill);
  padding: 6px 14px;
}
.admin-tabs button:hover { background: var(--surface-1); border-color: transparent; color: var(--ink); }
.admin-tabs button.active { background: var(--surface-2); border-color: transparent; color: var(--ink); }
.admin-section { display: none; }
.admin-section.active { display: block; animation: fade-up 0.25s cubic-bezier(0.16, 1, 0.3, 1); }
@keyframes fade-up { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  color: var(--ink-muted);
}
table.data th {
  text-align: left;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  color: var(--ink-subtle);
  padding: 10px 12px;
  border-bottom: 1px solid var(--hairline-strong);
}
table.data td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--hairline);
  vertical-align: top;
}
table.data tr { transition: background 0.15s ease; }
table.data tr:hover td { background: var(--surface-1); }
table.data .actions { display: flex; gap: 4px; }
table.data .actions button { font-size: 12px; padding: 4px 10px; }
.tier-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  background: var(--surface-2);
  color: var(--ink-muted);
  border: 1px solid var(--hairline);
  border-radius: var(--r-pill);
}
.tier-badge.pro {
  border-color: rgba(var(--primary-rgb), 0.45);
  color: var(--primary-hover);
  background: rgba(var(--primary-rgb), 0.12);
}
.tier-badge.gratuito { color: var(--ink-subtle); }

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--s-md);
  margin-bottom: var(--s-md);
}
.form-grid .field label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  color: var(--ink-subtle);
  margin-bottom: 6px;
}
.form-grid .field.wide { grid-column: 1 / -1; }

.kpi-row { display: flex; gap: var(--s-md); margin-bottom: var(--s-lg); flex-wrap: wrap; }
.kpi {
  border: 1px solid var(--hairline);
  border-radius: var(--r-lg);
  padding: var(--s-lg);
  background: var(--surface-1);
  box-shadow: var(--edge);
  min-width: 170px;
  transition: background 0.2s ease, border-color 0.2s ease;
}
.kpi:hover { background: var(--surface-2); border-color: var(--hairline-strong); }
.kpi .n {
  font-size: 40px;
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -1px;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.kpi .k { font-size: 12px; font-weight: 500; letter-spacing: 0.4px; text-transform: uppercase; color: var(--ink-subtle); margin-top: 6px; }

/* marcador de utilizador (GPS) */
.me-marker {
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--primary);
  border: 2px solid var(--ink);
  box-shadow: 0 0 0 rgba(var(--primary-rgb), .5);
  animation: mepulse 2s infinite;
}
@keyframes mepulse {
  0% { box-shadow: 0 0 0 0 rgba(var(--primary-rgb), .5); }
  70% { box-shadow: 0 0 0 16px rgba(var(--primary-rgb), 0); }
  100% { box-shadow: 0 0 0 0 rgba(var(--primary-rgb), 0); }
}

/* atribuição maplibre discreta — acima da barra de créditos (30px) */
.maplibregl-ctrl-bottom-left,
.maplibregl-ctrl-bottom-right { bottom: 30px; }
.maplibregl-ctrl-bottom-right .maplibregl-ctrl { margin: 0 8px 4px 0; }
.maplibregl-ctrl-bottom-left .maplibregl-ctrl { margin: 0 0 4px 8px; }
.maplibregl-ctrl-attrib {
  background: rgba(1, 1, 2, .8) !important;
  font-family: var(--ui) !important;
  font-size: 11px !important;
  border-radius: var(--r-xs) var(--r-xs) 0 0;
  max-width: calc(100vw - 24px);
}
.maplibregl-ctrl-attrib-inner { color: var(--ink-tertiary); }
.maplibregl-ctrl-attrib a { color: var(--ink-subtle) !important; }
.maplibregl-ctrl-attrib a:hover { color: var(--ink) !important; }
.maplibregl-popup-content {
  background: var(--surface-2) !important;
  color: var(--ink) !important;
  font-family: var(--ui) !important;
  border: 1px solid var(--hairline-strong) !important;
  border-radius: var(--r-md) !important;
  box-shadow: none !important;
}
.maplibregl-popup-close-button { color: var(--ink-subtle) !important; font-size: 16px !important; }
.maplibregl-popup-close-button:hover { color: var(--ink) !important; background: transparent !important; }

/* códigos de utilização única — token de ID em mono */
input[autocomplete="one-time-code"] {
  font-family: var(--mono);
  font-weight: 500;
  color: var(--ink);
}
