:root {
  --azul: #0a2f8f;
  --azul-escuro: #061f63;
  --azul-medio: #0d3db0;
  --verde: #b8e600;
  --verde-escuro: #9ac400;
  --branco: #ffffff;
  --cinza: #f0f4fb;
  --texto: #0a2f8f;
  --erro: #d62828;
  --sombra: 0 18px 40px rgba(6, 31, 99, 0.28);
  --fonte: "Montserrat", "Arial Narrow", Arial, sans-serif;
  --script: "Caveat", cursive;
  --pad-x: clamp(12px, 3vw, 28px);
  --pad-y: clamp(16px, 2.5vw, 28px);
  --header-h: 76px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
}

html,
body {
  min-height: 100%;
  min-height: 100dvh;
}

body {
  font-family: var(--fonte);
  color: var(--texto);
  background: var(--azul);
  line-height: 1.4;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

button,
input,
.btn {
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

/* ---------- Login ---------- */

.login-page {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  align-content: center;
  padding:
    calc(16px + var(--safe-top))
    calc(16px + var(--safe-right))
    calc(24px + var(--safe-bottom) + min(14vh, 110px))
    calc(16px + var(--safe-left));
  background:
    radial-gradient(circle at top right, rgba(184, 230, 0, 0.18), transparent 36%),
    linear-gradient(160deg, var(--azul-escuro) 0%, var(--azul) 45%, var(--azul-medio) 100%);
  position: relative;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.login-shell {
  position: relative;
  z-index: 1;
  width: min(100%, 440px);
  padding-bottom: 8px;
}

.brand {
  text-align: center;
  margin-bottom: clamp(14px, 3vw, 28px);
  color: var(--branco);
}

.brand-with-logo {
  display: grid;
  gap: 14px;
  justify-items: center;
}

.login-footer {
  margin-top: 16px;
  text-align: center;
  display: grid;
  justify-items: center;
  gap: 6px;
}

.login-logo {
  display: block;
  width: auto;
  height: auto;
  max-width: min(200px, 60vw);
  max-height: 72px;
  object-fit: contain;
  mix-blend-mode: screen;
}

.login-skyline {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: min(1400px, 100%);
  height: auto;
  max-height: min(28vh, 220px);
  object-fit: contain;
  object-position: center bottom;
  opacity: 0.22;
  mix-blend-mode: screen;
  pointer-events: none;
  z-index: 0;
}

.app-footer {
  position: relative;
  flex-shrink: 0;
  height: clamp(100px, 15vh, 150px);
  margin-top: auto;
  overflow: hidden;
  pointer-events: none;
  background: transparent;
  border: 0;
}

.app-footer-glow {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 80% at 50% 120%, rgba(184, 230, 0, 0.12), transparent 55%),
    linear-gradient(to top, rgba(10, 47, 143, 0.10) 0%, rgba(10, 47, 143, 0.03) 45%, transparent 100%);
}

.app-footer-skyline {
  position: absolute;
  left: 50%;
  bottom: -4px;
  transform: translateX(-50%);
  width: min(1200px, 160vw);
  height: auto;
  max-height: 130px;
  object-fit: contain;
  object-position: center bottom;
  opacity: 0.18;
  /* silhueta azul da marca, sem caixa pesada */
  filter: brightness(0) saturate(100%) invert(16%) sepia(67%) saturate(1800%) hue-rotate(206deg) brightness(0.95);
  -webkit-mask-image: linear-gradient(to top, #000 35%, transparent 100%);
  mask-image: linear-gradient(to top, #000 35%, transparent 100%);
}

body.app-body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  background:
    radial-gradient(circle at top right, rgba(184, 230, 0, 0.06), transparent 28%),
    linear-gradient(180deg, #eef3ff 0%, #f7f9fd 72%, #e8eefb 100%);
}

.brand-title {
  font-size: clamp(1.85rem, 7vw, 3rem);
  font-weight: 900;
  letter-spacing: -0.03em;
  font-style: italic;
  text-transform: uppercase;
  line-height: 0.95;
  word-break: break-word;
}

.brand-title span {
  color: var(--verde);
  font-style: normal;
}

.brand-heart {
  display: inline-block;
  color: var(--verde);
  transform: translateY(2px);
}

.brand-script {
  margin-top: 8px;
  font-family: var(--script);
  font-size: clamp(1.25rem, 4.5vw, 1.7rem);
  color: var(--verde);
  font-weight: 600;
}

.login-card {
  background: var(--branco);
  border: 4px solid var(--verde);
  box-shadow: var(--sombra);
  padding: clamp(20px, 4vw, 32px) clamp(16px, 4vw, 28px) clamp(18px, 3vw, 28px);
}

.login-card h1 {
  font-size: clamp(1.25rem, 4vw, 1.55rem);
  font-weight: 900;
  font-style: italic;
  text-transform: uppercase;
  color: var(--azul);
  margin-bottom: 6px;
}

.login-card p {
  color: #4a5f8a;
  margin-bottom: 22px;
  font-size: clamp(0.88rem, 2.8vw, 0.95rem);
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 8px;
  color: var(--azul);
}

.form-group input {
  width: 100%;
  border: 2px solid #c9d6ef;
  background: var(--cinza);
  color: var(--azul);
  font: inherit;
  font-size: 16px; /* evita zoom automático no iOS */
  font-weight: 600;
  padding: 14px;
  min-height: 48px;
  border-radius: 0;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-group select {
  width: 100%;
  border: 2px solid #c9d6ef;
  background: var(--cinza);
  color: var(--azul);
  font: inherit;
  font-size: 16px;
  font-weight: 600;
  padding: 14px;
  min-height: 48px;
  border-radius: 0;
  outline: none;
}

.form-group input:focus,
.form-group select:focus {
  border-color: var(--azul);
  box-shadow: 0 0 0 3px rgba(10, 47, 143, 0.15);
}

.captcha-group .captcha-row {
  display: grid;
  grid-template-columns: 1fr 44px;
  gap: 10px;
  align-items: stretch;
  margin-bottom: 10px;
}

.captcha-board {
  position: relative;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  min-height: 64px;
  padding: 10px 12px;
  border: 2px solid rgba(10, 47, 143, 0.16);
  background:
    linear-gradient(135deg, rgba(184, 230, 0, 0.16) 0 12%, transparent 12% 24%, rgba(184, 230, 0, 0.12) 24% 36%, transparent 36% 48%, rgba(10, 47, 143, 0.08) 48% 60%, transparent 60% 72%, rgba(184, 230, 0, 0.14) 72% 84%, transparent 84%),
    linear-gradient(160deg, #061f63 0%, #0a2f8f 55%, #0d3db0 100%);
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
}

.captcha-board::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(
      -18deg,
      transparent 0 10px,
      rgba(255, 255, 255, 0.05) 10px 12px
    );
  pointer-events: none;
}

.captcha-digit {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  color: var(--verde);
  font-family: var(--fonte);
  font-size: clamp(1.45rem, 5vw, 1.8rem);
  font-weight: 900;
  font-style: italic;
  letter-spacing: 0.04em;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.18);
}

.captcha-digit-0 { transform: rotate(-8deg) translateY(2px); }
.captcha-digit-1 { transform: rotate(6deg) translateY(-3px); color: #fff; }
.captcha-digit-2 { transform: rotate(-4deg) translateY(1px); }
.captcha-digit-3 { transform: rotate(9deg) translateY(-2px); color: #fff; }

.captcha-refresh {
  display: grid;
  place-items: center;
  border: 2px solid rgba(10, 47, 143, 0.16);
  background: var(--cinza);
  color: var(--azul);
  transition: background 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}

.captcha-refresh svg {
  width: 20px;
  height: 20px;
  display: block;
}

@media (hover: hover) {
  .captcha-refresh:hover {
    background: #fff;
    border-color: var(--azul);
  }
}

.captcha-refresh:active {
  transform: scale(0.96);
}

.captcha-input {
  letter-spacing: 0.35em;
  text-align: center;
  font-weight: 800 !important;
  font-size: 1.15rem !important;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  cursor: pointer;
  font: inherit;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 14px 20px;
  min-height: 44px;
  transition: transform 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn-verde {
  width: 100%;
  background: var(--verde);
  color: var(--azul);
  margin-top: 8px;
  box-shadow: 0 8px 0 var(--verde-escuro);
  font-size: 1rem;
  min-height: 52px;
}

.btn-verde:hover {
  background: #c8f31a;
}

.btn-verde:active {
  transform: translateY(2px);
  box-shadow: 0 4px 0 var(--verde-escuro);
}

.btn-sair {
  background: transparent;
  color: var(--branco);
  border: 2px solid rgba(255, 255, 255, 0.45);
  padding: 10px 16px;
  font-size: 0.82rem;
  white-space: nowrap;
  flex-shrink: 0;
}

.btn-sair:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--verde);
  color: var(--verde);
}

.alert {
  padding: 12px 14px;
  margin-bottom: 16px;
  font-weight: 700;
  font-size: 0.92rem;
  border-left: 4px solid var(--erro);
  background: #ffe8e8;
  color: var(--erro);
  word-break: break-word;
}

/* ---------- App shell ---------- */

.app-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  flex-shrink: 0;
  background: linear-gradient(90deg, var(--azul-escuro), var(--azul));
  color: var(--branco);
  border-bottom: 4px solid var(--verde);
  padding:
    calc(12px + var(--safe-top))
    calc(var(--pad-x) + var(--safe-right))
    12px
    calc(var(--pad-x) + var(--safe-left));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px 16px;
  flex-wrap: wrap;
}

.app-header .brand-mini {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1 1 auto;
}

.app-header .brand-mini strong {
  font-size: clamp(1.05rem, 3.5vw, 1.35rem);
  font-style: italic;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.app-header .brand-mini strong span {
  color: var(--verde);
}

.app-header .brand-mini small {
  font-family: var(--script);
  font-size: clamp(1rem, 3vw, 1.15rem);
  color: var(--verde);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
  max-width: 100%;
}

.user-chip {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.22);
  padding: 8px 12px;
  font-size: clamp(0.75rem, 2.4vw, 0.85rem);
  font-weight: 700;
  max-width: min(220px, 42vw);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-main {
  min-height: 0;
  flex: 1 0 auto;
  background: transparent;
  padding:
    var(--pad-y)
    calc(var(--pad-x) + var(--safe-right))
    calc(var(--pad-y) + 16px + var(--safe-bottom))
    calc(var(--pad-x) + var(--safe-left));
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
}

.page-head {
  margin-bottom: clamp(16px, 3vw, 24px);
}

.page-head h1 {
  font-size: clamp(1.4rem, 5vw, 2.2rem);
  font-weight: 900;
  font-style: italic;
  text-transform: uppercase;
  color: var(--azul);
  line-height: 1.1;
}

.page-head p {
  margin-top: 6px;
  color: #4a5f8a;
  font-weight: 600;
  font-size: clamp(0.9rem, 2.8vw, 1rem);
}

.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
  gap: clamp(14px, 2.5vw, 20px);
}

.dash-card {
  background: var(--branco);
  border: 3px solid var(--azul);
  box-shadow: 0 12px 28px rgba(10, 47, 143, 0.12);
  display: flex;
  flex-direction: column;
  min-height: 200px;
  overflow: hidden;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

@media (hover: hover) {
  .dash-card:hover {
    transform: translateY(-4px);
    border-color: var(--verde);
    box-shadow: 0 18px 34px rgba(10, 47, 143, 0.2);
  }
}

.dash-card:active {
  transform: scale(0.99);
}

.dash-card-top {
  background: var(--azul);
  color: var(--branco);
  padding: clamp(14px, 3vw, 18px);
}

.dash-card-top h2 {
  font-size: clamp(1.1rem, 3.5vw, 1.25rem);
  font-weight: 900;
  font-style: italic;
  text-transform: uppercase;
}

.dash-card-top span {
  display: block;
  margin-top: 4px;
  font-family: var(--script);
  font-size: clamp(1.1rem, 3.5vw, 1.25rem);
  color: var(--verde);
}

.dash-card-body {
  padding: clamp(14px, 3vw, 18px);
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 16px;
}

.dash-card-body p {
  color: #4a5f8a;
  font-weight: 600;
  line-height: 1.45;
  font-size: clamp(0.9rem, 2.8vw, 1rem);
}

.btn-card {
  align-self: flex-start;
  background: var(--verde);
  color: var(--azul);
  padding: 12px 16px;
  font-size: 0.82rem;
  min-height: 44px;
}

.dash-card.disabled {
  opacity: 0.55;
  pointer-events: none;
}

.dash-card.disabled .dash-card-top {
  background: #6b7a9b;
}

/* ---------- UI compartilhada ---------- */

.page-bar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.page-bar .page-head {
  margin-bottom: 0;
}

.page-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.btn-ghost,
.btn-accent {
  min-height: 44px;
  padding: 11px 18px;
  font-size: 0.82rem;
}

.btn-ghost {
  background: transparent;
  color: var(--azul);
  border: 2px solid rgba(10, 47, 143, 0.25);
}

.btn-ghost:hover {
  border-color: var(--azul);
  background: rgba(10, 47, 143, 0.05);
}

.btn-accent {
  background: var(--verde);
  color: var(--azul);
}

.btn-accent:hover {
  background: #c8f31a;
}

.btn-accent.full,
.btn-ghost.full {
  width: 100%;
}

.kpi-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1px;
  background: rgba(10, 47, 143, 0.12);
  border: 1px solid rgba(10, 47, 143, 0.12);
  margin-bottom: 18px;
  overflow: hidden;
}

.kpi-row .kpi {
  background: #fff;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.kpi-row .kpi span {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #6b7c9d;
}

.kpi-row .kpi strong {
  font-size: clamp(1.15rem, 3vw, 1.5rem);
  font-weight: 900;
  font-style: italic;
  color: var(--azul);
  line-height: 1;
}

.flash {
  padding: 12px 14px;
  margin-bottom: 16px;
  font-weight: 700;
  font-size: 0.92rem;
}

.flash-ok {
  background: #eef9c8;
  color: #355200;
  border-left: 4px solid var(--verde);
}

.flash-erro {
  background: #ffe8e8;
  color: var(--erro);
  border-left: 4px solid var(--erro);
}

.muted {
  color: #6b7c9d;
  font-weight: 600;
  font-size: 0.92rem;
}

/* ---------- Mapa ---------- */

.map-page {
  max-width: 1400px;
}

.map-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.75fr) minmax(300px, 0.85fr);
  gap: 16px;
  align-items: stretch;
  min-height: clamp(420px, 68dvh, 760px);
}

.map-stage {
  position: relative;
  background: #d7e3f8;
  border: 1px solid rgba(10, 47, 143, 0.18);
  min-height: 420px;
  overflow: hidden;
}

.map-stage .map-search {
  /* mantém o dropdown da zona acima do canvas do mapa */
  z-index: 1200;
}

.map-search {
  position: absolute;
  top: 14px;
  left: 14px;
  right: 14px;
  z-index: 800;
  width: min(640px, calc(100% - 28px));
  pointer-events: none;
}

.map-search-row {
  pointer-events: auto;
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(168px, 0.85fr);
  gap: 8px;
  align-items: stretch;
}

.map-search-shell {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  padding: 0 8px 0 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.85);
  box-shadow:
    0 10px 28px rgba(6, 31, 99, 0.18),
    0 1px 0 rgba(255, 255, 255, 0.7) inset;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  transition:
    box-shadow 0.22s ease,
    border-color 0.22s ease,
    transform 0.22s ease;
}

.map-search.is-focused .map-search-shell,
.map-search-shell:focus-within {
  border-color: rgba(184, 230, 0, 0.85);
  box-shadow:
    0 14px 34px rgba(6, 31, 99, 0.22),
    0 0 0 3px rgba(184, 230, 0, 0.28);
  transform: translateY(-1px);
}

/* Select ocupa a caixa inteira — o popup nativo alinha com o retângulo certo */
.map-zona-shell {
  position: relative;
  z-index: 2;
  display: block;
  min-width: 0;
  min-height: 52px;
  padding: 0;
  overflow: visible;
  border-radius: 16px;
  background: #fff;
  border: 1px solid rgba(255, 255, 255, 0.85);
  box-shadow:
    0 10px 28px rgba(6, 31, 99, 0.18),
    0 1px 0 rgba(255, 255, 255, 0.7) inset;
  transition: box-shadow 0.22s ease, border-color 0.22s ease;
}

.map-zona-shell:focus-within {
  border-color: rgba(184, 230, 0, 0.85);
  box-shadow:
    0 14px 34px rgba(6, 31, 99, 0.22),
    0 0 0 3px rgba(184, 230, 0, 0.28);
}

.map-zona-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 1;
  width: 22px;
  height: 22px;
  color: var(--azul);
  opacity: 0.72;
  display: grid;
  place-items: center;
  pointer-events: none;
}

.map-zona-icon svg {
  width: 18px;
  height: 18px;
  display: block;
}

.map-zona-shell select {
  display: block;
  width: 100%;
  height: 52px;
  margin: 0;
  border: 0;
  outline: 0;
  border-radius: 16px;
  background-color: transparent;
  color: var(--azul-escuro);
  font: inherit;
  font-size: 0.88rem;
  font-weight: 650;
  letter-spacing: -0.01em;
  line-height: 1.2;
  padding: 0 34px 0 42px;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, rgba(10, 47, 143, 0.55) 50%),
    linear-gradient(135deg, rgba(10, 47, 143, 0.55) 50%, transparent 50%);
  background-position:
    calc(100% - 16px) calc(50% - 2px),
    calc(100% - 10px) calc(50% - 2px);
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
}

.map-zona-shell select:focus {
  outline: none;
}

.map-zona-shell select option {
  color: #061f63;
  background: #fff;
  font-weight: 600;
}

.map-search-icon {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  color: var(--azul);
  opacity: 0.72;
  display: grid;
  place-items: center;
}

.map-search-icon svg {
  width: 20px;
  height: 20px;
  display: block;
}

.map-search-shell input {
  flex: 1 1 auto;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--azul-escuro);
  font: inherit;
  font-size: 0.95rem;
  font-weight: 650;
  letter-spacing: -0.01em;
  padding: 14px 0;
  -webkit-appearance: none;
  appearance: none;
}

.map-search-shell input::placeholder {
  color: rgba(10, 47, 143, 0.42);
  font-weight: 600;
}

.map-search-shell input::-webkit-search-decoration,
.map-search-shell input::-webkit-search-cancel-button,
.map-search-shell input::-webkit-search-results-button,
.map-search-shell input::-webkit-search-results-decoration {
  -webkit-appearance: none;
  appearance: none;
}

.map-search-clear {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 12px;
  background: rgba(10, 47, 143, 0.08);
  color: var(--azul);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.map-search-clear svg {
  width: 16px;
  height: 16px;
  display: block;
}

.map-search-clear:hover {
  background: rgba(10, 47, 143, 0.14);
}

.map-search-clear:active {
  transform: scale(0.94);
}

.person-zona {
  display: block;
  margin-top: 2px;
  color: #0a2f8f;
  font-size: 0.72rem;
  font-weight: 750;
  font-style: normal;
}

.field-hint {
  display: block;
  margin-top: 6px;
  color: #6b7c9d;
  font-size: 0.74rem;
  font-weight: 650;
}

.map-search-meta {
  pointer-events: none;
  margin-top: 8px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  padding: 7px 12px;
  border-radius: 999px;
  background: rgba(6, 31, 99, 0.88);
  color: #fff;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  box-shadow: 0 8px 18px rgba(6, 31, 99, 0.2);
  animation: map-search-meta-in 0.22s ease;
}

.map-search-meta[hidden] {
  display: none !important;
}

@keyframes map-search-meta-in {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

#mapa-osasco {
  width: 100%;
  height: 100%;
  min-height: clamp(420px, 68dvh, 760px);
  z-index: 1;
}

#mapa-osasco .leaflet-container {
  width: 100%;
  height: 100%;
  font: inherit;
  touch-action: pan-x pan-y;
}

.map-hint {
  position: absolute;
  left: 12px;
  bottom: 12px;
  z-index: 500;
  background: rgba(6, 31, 99, 0.92);
  color: #fff;
  padding: 8px 12px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  max-width: calc(100% - 84px);
  border-radius: 10px;
  box-shadow: 0 8px 18px rgba(6, 31, 99, 0.18);
}

#mapa-osasco .leaflet-control-zoom {
  border: 0 !important;
  box-shadow: 0 10px 24px rgba(6, 31, 99, 0.18) !important;
  border-radius: 14px !important;
  overflow: hidden;
}

#mapa-osasco .leaflet-control-zoom a {
  width: 38px !important;
  height: 38px !important;
  line-height: 38px !important;
  color: var(--azul) !important;
  background: rgba(255, 255, 255, 0.94) !important;
  border-bottom: 1px solid rgba(10, 47, 143, 0.1) !important;
  font-size: 18px !important;
}

#mapa-osasco .leaflet-control-zoom a:last-child {
  border-bottom: 0 !important;
}

#mapa-osasco .leaflet-control-zoom a:hover {
  background: #fff !important;
  color: var(--azul-escuro) !important;
}

.map-tip {
  font-family: var(--fonte);
  font-weight: 700;
  font-size: 0.8rem;
}

.detail-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
}

.detail-section {
  background: #fff;
  border: 1px solid rgba(10, 47, 143, 0.14);
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1;
}

.detail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(10, 47, 143, 0.1);
  background: linear-gradient(180deg, #f7f9fd, #fff);
}

.detail-head h2 {
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--azul);
}

.badge {
  min-width: 24px;
  height: 24px;
  padding: 0 8px;
  display: inline-grid;
  place-items: center;
  background: var(--verde);
  color: var(--azul);
  font-size: 0.75rem;
  font-weight: 900;
}

.detail-body {
  padding: 14px 16px;
  overflow: auto;
  max-height: clamp(180px, 30dvh, 340px);
}

.detail-city h3 {
  font-size: 1.2rem;
  font-weight: 900;
  color: var(--azul);
  line-height: 1.15;
}

.detail-city p {
  margin-top: 4px;
  color: #6b7c9d;
  font-weight: 700;
  font-size: 0.86rem;
}

.people-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.person-card {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 12px 0;
  border-top: 1px solid rgba(10, 47, 143, 0.08);
}

.people-list .person-card:first-child {
  border-top: 0;
  padding-top: 0;
}

.person-main {
  min-width: 0;
}

.person-main strong {
  display: block;
  color: var(--azul);
  font-size: 0.92rem;
  font-weight: 800;
  line-height: 1.25;
}

.person-main span {
  display: block;
  margin-top: 2px;
  color: #6b7c9d;
  font-size: 0.78rem;
  font-weight: 600;
}

.person-meta {
  text-align: right;
  flex-shrink: 0;
}

.person-meta b {
  display: block;
  color: var(--azul);
  font-size: 0.95rem;
  font-weight: 900;
  font-style: italic;
}

.person-meta a {
  display: inline-block;
  margin-top: 4px;
  color: var(--azul);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-bottom: 1px solid rgba(10, 47, 143, 0.25);
}

/* ---------- Cadastro ---------- */

.cadastro-layout {
  display: grid;
  grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.panel {
  background: #fff;
  border: 1px solid rgba(10, 47, 143, 0.14);
}

.panel-head {
  padding: 14px 16px;
  border-bottom: 1px solid rgba(10, 47, 143, 0.1);
  background: linear-gradient(180deg, #f7f9fd, #fff);
}

.panel-head h2 {
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--azul);
}

.list-head {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.search-input {
  width: 100%;
  border: 1px solid rgba(10, 47, 143, 0.18);
  background: #fff;
  color: var(--azul);
  font: inherit;
  font-size: 16px;
  font-weight: 600;
  padding: 11px 12px;
  outline: none;
}

.search-input:focus {
  border-color: var(--azul);
  box-shadow: 0 0 0 3px rgba(10, 47, 143, 0.12);
}

.search-meta {
  margin: 0;
  color: #6b7c9d;
  font-size: 0.78rem;
  font-weight: 700;
}

.empty-search {
  padding: 18px 16px;
}

.panel-body {
  padding: 16px;
}

.panel-foot {
  padding: 0 16px 16px;
  display: grid;
  gap: 8px;
}

.form-panel {
  position: sticky;
  top: calc(var(--header-h) + 8px);
}

.record-list {
  max-height: min(70dvh, 760px);
  overflow: auto;
}

.record-item {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(10, 47, 143, 0.08);
}

.record-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.record-item.is-filtered-out,
.record-item[hidden] {
  display: none !important;
}

.record-item:last-child {
  border-bottom: 0;
}

.record-item.is-pending {
  background: linear-gradient(90deg, rgba(184, 230, 0, 0.12), transparent 55%);
}

.record-main {
  min-width: 0;
}

.record-main strong {
  display: block;
  color: var(--azul);
  font-size: 0.95rem;
  font-weight: 800;
}

.record-main span,
.record-main em {
  display: block;
  margin-top: 3px;
  font-style: normal;
  font-size: 0.8rem;
  font-weight: 600;
  color: #6b7c9d;
}

.record-side {
  text-align: right;
  flex-shrink: 0;
}

.record-side b {
  display: block;
  color: var(--azul);
  font-size: 1rem;
  font-weight: 900;
  font-style: italic;
}

.record-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 6px;
}

.record-actions a {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--azul);
}

.record-actions a.danger {
  color: var(--erro);
}

/* ---------- Avatares / Foto ---------- */

.avatar {
  flex-shrink: 0;
  overflow: hidden;
  border: 2px solid var(--azul);
  background: linear-gradient(160deg, #0a2f8f, #061f63);
  color: var(--verde);
  display: grid;
  place-items: center;
  font-weight: 900;
  letter-spacing: 0.02em;
}

.avatar img {
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: cover;
  object-position: center top;
}

.avatar span {
  line-height: 1;
}

.avatar-sm {
  width: 44px;
  height: 44px;
  font-size: 0.72rem;
}

.avatar-md {
  width: 52px;
  height: 52px;
  font-size: 0.8rem;
}

.avatar-xl {
  width: 120px;
  height: 120px;
  font-size: 1.5rem;
  border-width: 3px;
  border-color: var(--verde);
}

.foto-uploader {
  display: flex;
  align-items: center;
  gap: 14px;
}

.foto-actions {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.file-btn {
  display: inline-flex;
  width: fit-content;
  cursor: pointer;
}

.foto-hint {
  color: #6b7c9d;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.35;
}

.check-remove {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--erro);
  font-size: 0.8rem;
  font-weight: 700;
}

.check-admin {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 4px 0 16px;
  color: var(--azul);
  font-size: 0.9rem;
  font-weight: 700;
}

.perms-block {
  margin-top: 8px;
  padding-top: 12px;
  border-top: 1px solid rgba(10, 47, 143, 0.1);
}

.perms-block h3 {
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--azul);
  margin-bottom: 6px;
}

.perms-grid {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.perm-card {
  display: grid;
  gap: 6px;
  padding: 12px;
  background: var(--cinza);
  border-left: 4px solid var(--verde);
}

.perm-card strong {
  color: var(--azul);
  font-size: 0.92rem;
}

.perm-card span {
  color: #6b7c9d;
  font-size: 0.78rem;
  font-weight: 600;
}

.perm-card label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--azul);
  font-size: 0.82rem;
  font-weight: 700;
}

.senha-box {
  margin-bottom: 16px;
  border-color: var(--verde);
}

.senha-box p {
  color: #4a5f8a;
  font-weight: 600;
  margin-bottom: 10px;
}

.senha-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.senha-code {
  display: inline-block;
  padding: 12px 16px;
  background: #0a2f8f;
  color: #b8e600;
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.senha-copy {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 14px;
}

.senha-copy svg {
  flex-shrink: 0;
}

.senha-copy.is-copied {
  border-color: var(--verde);
  color: #355200;
  background: #eef9c8;
}

.presence-wrap {
  position: relative;
}

.presence-dot {
  position: absolute;
  right: -2px;
  bottom: -2px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid #fff;
}

.presence-dot.is-online {
  background: #2ecc71;
}

.presence-dot.is-offline {
  background: #9aa8c7;
}

.user-access-meta {
  display: block !important;
  margin-top: 4px !important;
  font-size: 0.74rem !important;
  color: #7a8aa8 !important;
}

.audit-filters {
  margin-bottom: 16px;
}

.audit-filters-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  align-items: end;
}

.audit-filter-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.audit-meta {
  min-width: 140px;
}

.audit-meta .audit-ip,
.audit-meta .audit-mod {
  display: block;
  margin-top: 4px;
  font-size: 0.74rem;
  font-weight: 700;
  color: #6b7c9d;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.audit-item .record-main em {
  white-space: normal;
}

.foto-group[hidden] {
  display: none !important;
}

/* ---------- UI Dialog / Toast ---------- */

html.ui-lock,
body.ui-lock {
  overflow: hidden;
}

#ui-dialog-root {
  position: relative;
  z-index: 10000;
}

.ui-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(6, 31, 99, 0.55);
  backdrop-filter: blur(3px);
  opacity: 0;
  transition: opacity 0.18s ease;
}

.ui-backdrop.is-open {
  opacity: 1;
}

.ui-modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.18s ease, transform 0.18s ease;
  pointer-events: none;
}

.ui-modal.is-open {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}

.ui-modal[hidden],
.ui-backdrop[hidden] {
  display: none !important;
}

.ui-modal-card {
  width: min(100%, 420px);
  background: #fff;
  border: 1px solid rgba(10, 47, 143, 0.14);
  box-shadow: 0 24px 60px rgba(6, 31, 99, 0.28);
  padding: 22px 22px 18px;
  position: relative;
}

.ui-modal-accent {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 4px;
  background: var(--verde);
}

.ui-modal-accent.is-danger {
  background: var(--erro);
}

.ui-modal-accent.is-info,
.ui-modal-accent.is-confirm {
  background: var(--azul);
}

.ui-modal-kicker {
  margin: 8px 0 6px;
  font-family: var(--script);
  color: var(--verde);
  font-size: 1.2rem;
  font-weight: 700;
}

.ui-modal-card h2 {
  color: var(--azul);
  font-size: 1.35rem;
  font-weight: 900;
  font-style: italic;
  text-transform: uppercase;
  line-height: 1.1;
}

.ui-modal-message {
  margin-top: 10px;
  color: #4a5f8a;
  font-weight: 600;
  font-size: 0.95rem;
  line-height: 1.45;
}

.ui-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 22px;
}

.btn-danger {
  background: var(--erro);
  color: #fff;
  min-height: 44px;
  padding: 11px 18px;
  font-size: 0.82rem;
}

.btn-danger:hover {
  filter: brightness(1.05);
}

#ui-toast-host {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 10001;
  display: grid;
  gap: 10px;
  width: min(100% - 32px, 360px);
  pointer-events: none;
}

.ui-toast {
  pointer-events: auto;
  display: grid;
  grid-template-columns: 4px 1fr auto;
  gap: 0;
  background: #fff;
  border: 1px solid rgba(10, 47, 143, 0.14);
  box-shadow: 0 14px 34px rgba(6, 31, 99, 0.18);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.ui-toast.is-open {
  opacity: 1;
  transform: none;
}

.ui-toast-bar {
  background: var(--verde);
}

.ui-toast.is-erro .ui-toast-bar,
.ui-toast.is-danger .ui-toast-bar {
  background: var(--erro);
}

.ui-toast.is-info .ui-toast-bar {
  background: var(--azul);
}

.ui-toast-body {
  padding: 12px 8px 12px 14px;
}

.ui-toast-body strong {
  display: block;
  color: var(--azul);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.ui-toast-body p {
  margin-top: 4px;
  color: #4a5f8a;
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.35;
}

.ui-toast-close {
  border: 0;
  background: transparent;
  color: #6b7c9d;
  font-size: 1.3rem;
  line-height: 1;
  padding: 10px 12px;
  cursor: pointer;
}

/* ---------- BI Estratégico ---------- */

.bi-page {
  max-width: 1440px;
  width: 100%;
}

.bi-hero-kpis {
  display: grid;
  grid-template-columns: 1.4fr repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.bi-kpi {
  background:
    linear-gradient(160deg, rgba(255, 255, 255, 0.98), rgba(240, 244, 251, 0.96));
  border: 1px solid rgba(10, 47, 143, 0.12);
  padding: 16px 18px;
  min-height: 112px;
  display: grid;
  align-content: start;
  gap: 4px;
  box-shadow: 0 10px 24px rgba(6, 31, 99, 0.08);
}

.bi-kpi-main {
  background:
    radial-gradient(circle at top right, rgba(184, 230, 0, 0.28), transparent 42%),
    linear-gradient(145deg, #061f63 0%, #0a2f8f 55%, #0d3db0 100%);
  color: #fff;
  border-color: transparent;
}

.bi-kpi span {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #6b7c9d;
}

.bi-kpi-main span {
  color: rgba(255, 255, 255, 0.72);
}

.bi-kpi strong {
  font-size: clamp(1.55rem, 3vw, 2.1rem);
  font-weight: 900;
  font-style: italic;
  line-height: 1.05;
  color: var(--azul);
}

.bi-kpi-main strong {
  color: var(--verde);
}

.bi-kpi small {
  color: #7a8bab;
  font-size: 0.78rem;
  font-weight: 650;
}

.bi-kpi-main small {
  color: rgba(255, 255, 255, 0.7);
}

.bi-grid-main {
  display: grid;
  grid-template-columns: minmax(0, 1.75fr) minmax(280px, 0.85fr);
  gap: 16px;
  margin-bottom: 16px;
  align-items: stretch;
}

.bi-side {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 0;
}

.bi-side .bi-panel {
  min-height: 0;
}

.bi-side .bi-insight {
  flex: 1 1 auto;
}

.bi-grid-secondary {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 16px;
}

.bi-panel {
  background: #fff;
  border: 1px solid rgba(10, 47, 143, 0.12);
  box-shadow: 0 12px 28px rgba(6, 31, 99, 0.08);
  overflow: hidden;
}

.bi-map-panel {
  display: flex;
  flex-direction: column;
  min-height: clamp(520px, 68dvh, 720px);
  overflow: hidden;
}

.bi-panel-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding: 16px 18px 12px;
  flex: 0 0 auto;
}

.bi-panel-head h2 {
  font-size: 0.95rem;
  font-weight: 900;
  font-style: italic;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--azul);
}

.bi-panel-head p {
  margin-top: 3px;
  color: #6b7c9d;
  font-size: 0.8rem;
  font-weight: 650;
}

.bi-legend {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #6b7c9d;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  flex-shrink: 0;
}

.bi-legend i {
  width: 14px;
  height: 10px;
  display: block;
}

.bi-legend i:nth-child(2) { background: #2f5fb8; }
.bi-legend i:nth-child(3) { background: #5aa0ff; }
.bi-legend i:nth-child(4) { background: #8fd400; }
.bi-legend i:nth-child(5) { background: #b8e600; }

.bi-map-stage {
  position: relative;
  flex: 1 1 auto;
  width: 100%;
  min-height: 460px;
  height: 100%;
  background: #d7e3f8;
}

#bi-mapa {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}

#bi-mapa .leaflet-container {
  width: 100% !important;
  height: 100% !important;
  font: inherit;
}

.bi-map-status {
  position: absolute;
  left: 12px;
  bottom: 12px;
  z-index: 500;
  background: rgba(6, 31, 99, 0.9);
  color: #fff;
  padding: 8px 12px;
  font-size: 0.74rem;
  font-weight: 700;
  border-radius: 10px;
  max-width: calc(100% - 84px);
}

.bi-map-float {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 600;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(10, 47, 143, 0.12);
  box-shadow: 0 10px 24px rgba(6, 31, 99, 0.16);
  padding: 10px 12px;
  min-width: 160px;
  backdrop-filter: blur(10px);
}

.bi-map-float strong {
  display: block;
  color: var(--azul);
  font-size: 0.92rem;
  font-weight: 850;
}

.bi-map-float span {
  display: block;
  margin-top: 2px;
  color: #6b7c9d;
  font-size: 0.78rem;
  font-weight: 650;
}

.bi-donut-wrap {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 8px 14px;
  align-items: center;
  padding: 0 16px 18px;
}

.bi-donut svg {
  width: 100%;
  max-width: 180px;
  display: block;
}

.bi-donut-value {
  fill: var(--azul);
  font-size: 18px;
  font-weight: 900;
  font-family: var(--fonte);
}

.bi-donut-label {
  fill: #6b7c9d;
  font-size: 10px;
  font-weight: 700;
  font-family: var(--fonte);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.bi-party-list {
  list-style: none;
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
}

.bi-party-list li {
  display: grid;
  grid-template-columns: 10px 1fr auto;
  gap: 10px;
  align-items: center;
}

.bi-party-list i {
  width: 10px;
  height: 10px;
  border-radius: 2px;
}

.bi-party-list strong {
  display: block;
  color: var(--azul);
  font-size: 0.82rem;
  font-weight: 800;
  line-height: 1.2;
}

.bi-party-list span {
  display: block;
  color: #7a8bab;
  font-size: 0.72rem;
  font-weight: 650;
}

.bi-party-list b {
  color: var(--azul);
  font-size: 0.82rem;
  font-weight: 900;
}

.bi-insight-list {
  list-style: none;
  margin: 0;
  padding: 0 18px 18px;
  display: grid;
  gap: 10px;
}

.bi-insight-list li {
  position: relative;
  padding: 10px 12px 10px 14px;
  background: linear-gradient(90deg, rgba(184, 230, 0, 0.14), rgba(240, 244, 251, 0.5));
  border-left: 3px solid var(--verde);
  color: #35507a;
  font-size: 0.86rem;
  font-weight: 650;
  line-height: 1.45;
}

.bi-insight-list strong {
  color: var(--azul);
  font-weight: 850;
}

.bi-bars {
  padding: 4px 18px 18px;
  display: grid;
  gap: 12px;
}

.bi-bar-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 72px;
  gap: 6px 10px;
  align-items: center;
}

.bi-bar-meta {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: baseline;
}

.bi-bar-pos {
  color: #8a9bb8;
  font-size: 0.72rem;
  font-weight: 800;
}

.bi-bar-meta strong {
  color: var(--azul);
  font-size: 0.86rem;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bi-bar-meta em {
  color: #7a8bab;
  font-style: normal;
  font-size: 0.72rem;
  font-weight: 750;
}

.bi-bar-track {
  height: 10px;
  background: rgba(10, 47, 143, 0.08);
  overflow: hidden;
}

.bi-bar-track span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #0a2f8f, #b8e600);
  min-width: 6px;
}

.bi-bar-val {
  text-align: right;
  color: var(--azul);
  font-size: 0.8rem;
  font-weight: 850;
}

.bi-rank {
  padding: 2px 10px 12px;
  display: grid;
  gap: 4px;
  max-height: 520px;
  overflow: auto;
}

.bi-rank-item {
  display: grid;
  grid-template-columns: 28px 40px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 8px;
  border-bottom: 1px solid rgba(10, 47, 143, 0.06);
}

.bi-rank-item > b {
  color: #8a9bb8;
  font-size: 0.72rem;
  font-weight: 800;
}

.bi-rank-main strong {
  display: block;
  color: var(--azul);
  font-size: 0.86rem;
  font-weight: 800;
  line-height: 1.2;
}

.bi-rank-main span {
  display: block;
  margin-top: 2px;
  color: #7a8bab;
  font-size: 0.72rem;
  font-weight: 650;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bi-rank-votos {
  color: var(--azul);
  font-size: 0.9rem;
  font-weight: 900;
}

#bi-mapa .leaflet-control-zoom {
  border: 0 !important;
  box-shadow: 0 10px 24px rgba(6, 31, 99, 0.18) !important;
  border-radius: 14px !important;
  overflow: hidden;
}

#bi-mapa .leaflet-control-zoom a {
  width: 36px !important;
  height: 36px !important;
  line-height: 36px !important;
  color: var(--azul) !important;
  background: rgba(255, 255, 255, 0.94) !important;
  border-bottom: 1px solid rgba(10, 47, 143, 0.1) !important;
}

/* ---------- Relatórios ---------- */

.relatorios-page {
  max-width: 1200px;
}

.report-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
  gap: clamp(14px, 2.5vw, 20px);
}

.report-card {
  background: #fff;
  border: 3px solid var(--azul);
  box-shadow: 0 12px 28px rgba(10, 47, 143, 0.12);
  display: flex;
  flex-direction: column;
  min-height: 200px;
  overflow: hidden;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

@media (hover: hover) {
  .report-card:hover {
    transform: translateY(-4px);
    border-color: var(--verde);
    box-shadow: 0 18px 34px rgba(10, 47, 143, 0.2);
  }
}

.report-card-top {
  background: var(--azul);
  color: #fff;
  padding: clamp(14px, 3vw, 18px);
}

.report-card-top h2 {
  font-size: clamp(1.05rem, 3.2vw, 1.2rem);
  font-weight: 900;
  font-style: italic;
  text-transform: uppercase;
}

.report-card-top span {
  display: block;
  margin-top: 4px;
  font-family: var(--script);
  font-size: clamp(1.05rem, 3.2vw, 1.2rem);
  color: var(--verde);
}

.report-card-body {
  padding: clamp(14px, 3vw, 18px);
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 16px;
}

.report-card-body p {
  color: #4a5f8a;
  font-weight: 600;
  line-height: 1.45;
  font-size: clamp(0.9rem, 2.8vw, 1rem);
}

.report-view-page {
  max-width: 980px;
}

.report-sheet {
  background: #fff;
  border: 1px solid rgba(10, 47, 143, 0.14);
  box-shadow: 0 14px 34px rgba(6, 31, 99, 0.1);
  padding: clamp(18px, 3vw, 28px);
}

.report-sheet-head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
  padding-bottom: 16px;
  border-bottom: 3px solid var(--azul);
  margin-bottom: 18px;
}

.report-sheet-head strong {
  display: block;
  color: var(--azul);
  font-size: 1.2rem;
  font-weight: 900;
  font-style: italic;
  text-transform: uppercase;
}

.report-sheet-head > div > span {
  display: block;
  margin-top: 4px;
  color: #6b7c9d;
  font-weight: 650;
  font-size: 0.86rem;
}

.report-sheet-meta {
  text-align: right;
}

.report-sheet-meta b {
  display: block;
  color: var(--azul);
  font-size: 1rem;
  font-weight: 900;
}

.report-sheet-meta span {
  display: block;
  margin-top: 3px;
  color: #6b7c9d;
  font-size: 0.8rem;
  font-weight: 650;
}

.report-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  margin-bottom: 20px;
}

.report-summary div {
  background: linear-gradient(160deg, #f4f7ff, #eef3ff);
  border: 1px solid rgba(10, 47, 143, 0.1);
  padding: 12px 14px;
}

.report-summary span {
  display: block;
  color: #6b7c9d;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.report-summary strong {
  display: block;
  margin-top: 4px;
  color: var(--azul);
  font-size: 1.2rem;
  font-weight: 900;
  font-style: italic;
}

.report-block {
  margin-bottom: 22px;
}

.report-block h2 {
  margin-bottom: 10px;
  color: var(--azul);
  font-size: 0.92rem;
  font-weight: 900;
  font-style: italic;
  text-transform: uppercase;
}

.report-table-wrap {
  width: 100%;
  overflow-x: auto;
}

.report-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.86rem;
}

.report-table th,
.report-table td {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(10, 47, 143, 0.1);
  text-align: left;
  vertical-align: top;
}

.report-table th {
  background: var(--azul);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.report-table tbody tr:nth-child(even) {
  background: #f7f9fd;
}

.report-table td {
  color: #243b66;
  font-weight: 650;
}

.report-notes {
  margin-top: 8px;
  padding-top: 12px;
  border-top: 1px dashed rgba(10, 47, 143, 0.18);
}

.report-notes p {
  color: #6b7c9d;
  font-size: 0.8rem;
  font-weight: 650;
  margin-top: 4px;
}

.report-sheet-foot {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 18px;
  padding-top: 12px;
  border-top: 2px solid rgba(10, 47, 143, 0.14);
  color: #6b7c9d;
  font-size: 0.76rem;
  font-weight: 700;
}

@media print {
  @page {
    size: A4;
    margin: 12mm;
  }

  html,
  body {
    background: #fff !important;
  }

  .no-print,
  .app-header,
  .app-footer,
  .page-bar,
  #ui-toast-host,
  .ui-backdrop,
  .ui-modal {
    display: none !important;
  }

  .app-body,
  .app-main,
  .report-view-page {
    padding: 0 !important;
    margin: 0 !important;
    max-width: none !important;
    box-shadow: none !important;
  }

  .report-sheet {
    border: 0 !important;
    box-shadow: none !important;
    padding: 0 !important;
  }

  .report-table th {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .report-table tr {
    break-inside: avoid;
  }
}

/* ---------- Breakpoints ---------- */

@media (max-width: 480px) {
  .app-header {
    flex-direction: column;
    align-items: stretch;
  }

  .header-actions {
    width: 100%;
    justify-content: space-between;
  }

  .user-chip {
    max-width: calc(100% - 90px);
  }

  .page-actions,
  .btn-ghost,
  .btn-accent {
    width: 100%;
  }

  .ui-modal-actions {
    flex-direction: column-reverse;
  }

  .ui-modal-actions .btn {
    width: 100%;
  }

  #ui-toast-host {
    right: 12px;
    left: 12px;
    bottom: 12px;
    width: auto;
  }

  .kpi-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dash-card {
    min-height: 180px;
  }

  .login-card {
    border-width: 3px;
    padding: 18px 14px 16px;
  }

  .login-card p {
    margin-bottom: 14px;
  }

  .login-page {
    place-items: start center;
    align-content: start;
    padding-top: calc(12px + var(--safe-top));
    padding-bottom: calc(28px + var(--safe-bottom) + min(12vh, 90px));
  }

  .brand {
    margin-bottom: 12px;
  }

  .brand-title {
    font-size: clamp(1.55rem, 8vw, 2.1rem);
  }

  .brand-script {
    font-size: clamp(1.05rem, 4vw, 1.35rem);
  }

  .login-logo {
    max-height: 64px;
    max-width: min(180px, 70vw);
  }

  .captcha-board {
    min-height: 54px;
    padding: 8px 10px;
  }

  .form-panel {
    position: static;
  }

  .record-item {
    flex-direction: column;
    gap: 10px;
  }

  .record-side,
  .record-actions {
    text-align: left;
    justify-content: flex-start;
  }
}

@media (max-width: 768px) {
  .cards-grid {
    grid-template-columns: 1fr;
  }

  .app-main {
    max-width: none;
  }

  .map-workspace,
  .cadastro-layout {
    grid-template-columns: 1fr;
  }

  .map-stage,
  #mapa-osasco {
    min-height: 360px;
  }

  .map-search {
    top: 10px;
    left: 10px;
    right: 10px;
    width: calc(100% - 20px);
  }

  .map-search-row {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .map-search-shell,
  .map-zona-shell {
    min-height: 48px;
    border-radius: 14px;
  }

  .map-zona-shell select {
    height: 48px;
    border-radius: 14px;
    font-size: 0.9rem;
  }

  .map-search-shell input {
    font-size: 0.9rem;
  }

  .bi-hero-kpis,
  .bi-grid-main,
  .bi-grid-secondary,
  .bi-donut-wrap {
    grid-template-columns: 1fr;
  }

  .bi-map-panel {
    min-height: 420px;
  }

  .bi-map-stage {
    min-height: 380px;
    height: 420px;
    flex: none;
  }

  .bi-rank {
    max-height: none;
  }

  .detail-body {
    max-height: none;
  }
}

@media (min-width: 769px) and (max-width: 1024px) {
  .cards-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .map-workspace {
    grid-template-columns: 1fr;
  }

  .bi-grid-main,
  .bi-grid-secondary {
    grid-template-columns: 1fr;
  }

  .bi-map-panel {
    min-height: 480px;
  }

  .bi-map-stage {
    min-height: 440px;
    height: 480px;
  }

  .bi-hero-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .bi-kpi-main {
    grid-column: 1 / -1;
  }

  .detail-panel {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .kpi-row {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (min-width: 1025px) {
  .cards-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .app-main {
    padding-top: 32px;
    padding-bottom: 48px;
  }
}

@media (max-height: 780px) {
  .login-page {
    place-items: start center;
    align-content: start;
  }

  .brand {
    margin-bottom: 10px;
  }

  .login-card h1 {
    font-size: 1.2rem;
  }

  .login-card p {
    margin-bottom: 12px;
    font-size: 0.86rem;
  }

  .form-group {
    margin-bottom: 12px;
  }
}

@media (max-height: 500px) and (orientation: landscape) {
  .login-page {
    place-items: start center;
    align-content: start;
    padding-top: calc(12px + var(--safe-top));
    padding-bottom: calc(16px + var(--safe-bottom));
  }

  .brand {
    margin-bottom: 8px;
  }

  .brand-title {
    font-size: 1.45rem;
  }

  .login-skyline {
    max-height: 18vh;
    opacity: 0.16;
  }

  .map-stage,
  #mapa-osasco {
    min-height: 260px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition: none !important;
    animation: none !important;
  }
}
