/* ==========================================================================
   Niterói Atende — Design system
   Cores derivadas da logomarca da Prefeitura (laranja #EE7214 / azul #1E7CBE)
   ========================================================================== */
:root {
  --orange: #EE7214;
  --orange-600: #D4600A;
  --orange-400: #F59A52;
  --orange-50: #FFF3EA;
  --blue: #1E7CBE;
  --blue-600: #17669D;
  --blue-50: #EAF3FB;
  --navy: #0D2B45;
  --navy-2: #123A5C;
  --navy-3: #1B4A72;

  --bg: #F3F5F9;
  --surface: #FFFFFF;
  --surface-2: #F8FAFC;
  --border: #E3E8EF;
  --border-strong: #CDD5DF;
  --text: #17212B;
  --text-2: #3A4757;
  --muted: #6B7787;

  --green: #1E9E62;
  --green-50: #E8F7F0;
  --amber: #E39B21;
  --amber-50: #FDF4E3;
  --red: #D64545;
  --red-50: #FCECEC;
  --gray: #A0AABA;

  --radius: 14px;
  --radius-sm: 9px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow: 0 1px 3px rgba(16, 24, 40, .06), 0 6px 18px rgba(16, 24, 40, .05);
  --shadow-lg: 0 20px 50px rgba(13, 43, 69, .22);
  --ease: cubic-bezier(.2, .8, .2, 1);
  --sidebar: 256px;
  font-synthesis: none;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.num { font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
h1, h2, h3, h4 { margin: 0; letter-spacing: -.01em; }

/* ---------------------------------------------------------------- boot */
.boot { height: 100vh; display: grid; place-items: center; }
.spinner {
  width: 34px; height: 34px; border-radius: 50%;
  border: 3px solid var(--border); border-top-color: var(--orange);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes shimmer { 0% { background-position: -400px 0; } 100% { background-position: 400px 0; } }

/* ---------------------------------------------------------------- login */
.login {
  min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr;
}
.login-hero {
  position: relative; overflow: hidden; color: #fff; padding: 56px;
  display: flex; flex-direction: column; justify-content: space-between;
  background:
    radial-gradient(900px 500px at 110% -10%, rgba(238, 114, 20, .45), transparent 60%),
    radial-gradient(700px 500px at -20% 120%, rgba(30, 124, 190, .55), transparent 60%),
    linear-gradient(160deg, var(--navy) 0%, #0A2238 100%);
}
.login-hero::after {
  content: ""; position: absolute; inset: 0; opacity: .08;
  background-image: radial-gradient(#fff 1px, transparent 1px); background-size: 22px 22px;
}
.login-hero > * { position: relative; z-index: 1; }
.login-hero .tag {
  display: inline-flex; gap: 8px; align-items: center; padding: 6px 12px; border-radius: 99px;
  background: rgba(255, 255, 255, .1); border: 1px solid rgba(255, 255, 255, .18); font-size: 12px; font-weight: 600;
}
.login-hero h2 { font-size: 40px; line-height: 1.1; font-weight: 800; margin: 18px 0 14px; max-width: 520px; }
.login-hero h2 span { color: var(--orange-400); }
.login-hero p { color: rgba(255, 255, 255, .78); max-width: 480px; line-height: 1.6; font-size: 15px; }
.hero-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; max-width: 520px; }
.hero-stats div {
  padding: 16px; border-radius: 12px; background: rgba(255, 255, 255, .07);
  border: 1px solid rgba(255, 255, 255, .12); backdrop-filter: blur(6px);
}
.hero-stats b { display: block; font-size: 26px; font-weight: 800; }
.hero-stats small { color: rgba(255, 255, 255, .7); }
.login-panel { display: grid; place-items: center; padding: 40px; background: var(--surface); }
.login-card { width: 100%; max-width: 380px; animation: fadeUp .5s var(--ease); }
.login-card img { height: 64px; margin-bottom: 28px; }
.login-card h1 { font-size: 24px; font-weight: 800; }
.login-card .sub { color: var(--muted); margin: 6px 0 26px; }
.login-card .field { margin-bottom: 16px; }
.login-card .btn { width: 100%; height: 46px; font-size: 15px; }
.login-err { color: var(--red); background: var(--red-50); padding: 10px 12px; border-radius: 8px; margin-bottom: 14px; font-size: 13px; }

/* ---------------------------------------------------------------- forms */
.field label { display: block; font-size: 12px; font-weight: 600; color: var(--text-2); margin-bottom: 6px; }
.input, .select {
  width: 100%; height: 40px; padding: 0 12px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: #fff; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.select {
  appearance: none; padding-right: 32px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236B7787' stroke-width='2.5'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 11px center;
}
.input:focus, .select:focus { border-color: var(--orange); box-shadow: 0 0 0 3px rgba(238, 114, 20, .15); }
.input[type=number] { text-align: right; font-variant-numeric: tabular-nums; }
.input.warn { border-color: var(--amber); background: var(--amber-50); }
.check { display: inline-flex; gap: 8px; align-items: center; cursor: pointer; font-size: 13px; }
.check input { accent-color: var(--orange); width: 16px; height: 16px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 38px; padding: 0 16px; border-radius: var(--radius-sm); border: 1px solid transparent;
  font-weight: 600; cursor: pointer; transition: all .15s var(--ease); white-space: nowrap;
}
.btn svg { width: 16px; height: 16px; }
.btn-primary { background: linear-gradient(180deg, var(--orange) 0%, var(--orange-600) 100%); color: #fff; box-shadow: 0 2px 8px rgba(238, 114, 20, .3); }
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(238, 114, 20, .35); }
.btn-secondary { background: #fff; border-color: var(--border-strong); color: var(--text-2); }
.btn-secondary:hover { border-color: var(--blue); color: var(--blue); }
.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-danger { background: #fff; border-color: #F1C3C3; color: var(--red); }
.btn-danger:hover { background: var(--red-50); }
.btn-sm { height: 30px; padding: 0 10px; font-size: 12px; }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none !important; }
.icon-btn {
  width: 34px; height: 34px; display: inline-grid; place-items: center; border-radius: 9px;
  border: 1px solid var(--border); background: #fff; cursor: pointer; color: var(--text-2);
}
.icon-btn:hover { border-color: var(--orange); color: var(--orange); }
.icon-btn svg { width: 17px; height: 17px; }

/* ---------------------------------------------------------------- shell */
.shell { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column;
  background: linear-gradient(185deg, var(--navy) 0%, #0A2338 100%); color: #C9D6E3; z-index: 30;
}
.brand { padding: 18px 16px 14px; }
.brand-card {
  background: #fff; border-radius: 12px; padding: 12px 14px; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 6px 20px rgba(0, 0, 0, .25);
}
.brand-card img { height: 46px; }
.brand-app { margin: 14px 4px 0; display: flex; align-items: center; gap: 8px; }
.brand-app b { color: #fff; font-size: 15px; font-weight: 800; letter-spacing: -.01em; }
.brand-app span { font-size: 11px; color: #8FA6BD; }
.dot-live { width: 8px; height: 8px; border-radius: 50%; background: var(--orange); box-shadow: 0 0 0 4px rgba(238, 114, 20, .2); }
.nav { padding: 8px 10px; flex: 1; overflow-y: auto; }
.nav-sec { font-size: 10.5px; text-transform: uppercase; letter-spacing: .09em; color: #6F89A3; padding: 16px 12px 6px; font-weight: 700; }
.nav a {
  position: relative; display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: 10px;
  color: #C3D1DF; font-weight: 500; margin-bottom: 2px; transition: background .15s, color .15s;
}
.nav a svg { width: 18px; height: 18px; opacity: .85; }
.nav a:hover { background: rgba(255, 255, 255, .06); color: #fff; text-decoration: none; }
.nav a.active { background: linear-gradient(90deg, rgba(238, 114, 20, .22), rgba(238, 114, 20, .05)); color: #fff; }
.nav a.active::before { content: ""; position: absolute; left: -10px; top: 8px; bottom: 8px; width: 4px; border-radius: 0 4px 4px 0; background: var(--orange); }
.nav a.active svg { color: var(--orange-400); opacity: 1; }
.userbox { margin: 10px; padding: 12px; border-radius: 12px; background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .08); }
.userbox .who { display: flex; gap: 10px; align-items: center; }
.avatar {
  width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; font-weight: 800; color: #fff; flex: none;
  background: linear-gradient(135deg, var(--orange), var(--blue));
}
.userbox .who b { color: #fff; display: block; font-size: 13px; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.userbox .who small { color: #8FA6BD; font-size: 11px; }
.userbox .acts { display: flex; gap: 6px; margin-top: 10px; }
.userbox .acts button {
  flex: 1; height: 30px; border-radius: 8px; border: 1px solid rgba(255, 255, 255, .12);
  background: transparent; color: #C9D6E3; font-size: 12px; cursor: pointer;
}
.userbox .acts button:hover { background: rgba(255, 255, 255, .08); color: #fff; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; gap: 14px; padding: 18px 28px 14px; background: var(--bg);
}
.topbar .burger { display: none; }
.topbar .titles { flex: 1; min-width: 0; }
.topbar h1 { font-size: 22px; font-weight: 800; }
.topbar .crumb { color: var(--muted); font-size: 13px; margin-top: 2px; }
.topbar .actions { display: flex; gap: 8px; }

.filters {
  position: sticky; top: 0; z-index: 20; display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px;
  padding: 12px 28px; background: rgba(243, 245, 249, .88); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.filters .field { min-width: 150px; }
.filters .field label { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.filters .select { height: 36px; background-color: #fff; }
.filters .spacer { flex: 1; }
.scope-lock {
  display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 12px; border-radius: 9px;
  background: var(--blue-50); color: var(--blue-600); font-weight: 600; font-size: 12.5px;
}
.scope-lock svg { width: 15px; height: 15px; }

.page { padding: 22px 28px 48px; animation: fadeUp .35s var(--ease); }

/* ---------------------------------------------------------------- cards & grid */
.grid { display: grid; gap: 18px; }
.g-kpi { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.g-3 { grid-template-columns: 2fr 1fr; }
.g-2 { grid-template-columns: 1fr 1fr; }
.mt { margin-top: 18px; }
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm);
  min-width: 0;
}
.card-h { display: flex; align-items: flex-start; gap: 10px; padding: 16px 18px 6px; }
.card-h h3 { font-size: 15px; font-weight: 700; }
.card-h .desc { color: var(--muted); font-size: 12.5px; margin-top: 3px; }
.card-h .right { margin-left: auto; display: flex; gap: 6px; align-items: center; }
.card-b { padding: 10px 18px 18px; }
.chart-box { position: relative; height: 290px; }
.chart-box.sm { height: 230px; }
.chart-box.lg { height: 340px; }

.info {
  display: inline-grid; place-items: center; width: 17px; height: 17px; border-radius: 50%;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--muted);
  font-size: 10.5px; font-weight: 700; cursor: help; flex: none; position: relative;
}
.info:hover::after {
  content: attr(data-tip); position: absolute; left: 50%; top: calc(100% + 8px); transform: translateX(-50%);
  width: 260px; padding: 10px 12px; border-radius: 9px; background: var(--navy); color: #fff;
  font-size: 12px; font-weight: 400; line-height: 1.5; text-align: left; z-index: 50; box-shadow: var(--shadow-lg);
  white-space: normal;
}

/* data context strip */
.context {
  display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px;
}
.chip {
  display: inline-flex; align-items: center; gap: 7px; padding: 6px 11px; border-radius: 99px;
  background: #fff; border: 1px solid var(--border); font-size: 12.5px; color: var(--text-2);
}
.chip svg { width: 14px; height: 14px; color: var(--muted); }
.chip b { color: var(--text); font-weight: 700; }
.chip.ok { background: var(--green-50); border-color: #BFE6D3; }
.chip.warn { background: var(--amber-50); border-color: #F3D9A8; }
.chip.bad { background: var(--red-50); border-color: #F1C3C3; }

/* KPI */
.kpi { padding: 16px 16px 14px; position: relative; overflow: hidden; transition: transform .2s var(--ease), box-shadow .2s; }
.kpi:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.kpi .top { display: flex; align-items: center; gap: 10px; }
.kpi .ico {
  width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; color: #fff; flex: none;
}
.kpi .ico svg { width: 18px; height: 18px; }
.kpi .lbl { font-size: 12px; font-weight: 600; color: var(--muted); line-height: 1.25; flex: 1; }
.kpi .val { font-size: 28px; font-weight: 800; margin: 12px 0 6px; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.kpi .val small { font-size: 15px; font-weight: 700; color: var(--muted); margin-left: 2px; }
.kpi .foot { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--muted); min-height: 20px; flex-wrap: wrap; }
.kpi .bar { height: 6px; border-radius: 6px; background: var(--surface-2); overflow: hidden; margin-top: 4px; border: 1px solid var(--border); }
.kpi .bar i { display: block; height: 100%; border-radius: 6px; transition: width .8s var(--ease); }
.ico-orange { background: linear-gradient(135deg, var(--orange-400), var(--orange-600)); }
.ico-blue { background: linear-gradient(135deg, #3E9BDB, var(--blue-600)); }
.ico-navy { background: linear-gradient(135deg, var(--navy-3), var(--navy)); }
.ico-green { background: linear-gradient(135deg, #38C186, #17895A); }
.ico-teal { background: linear-gradient(135deg, #2BB6AE, #138A84); }
.ico-amber { background: linear-gradient(135deg, #F4B74E, #D98A0B); }

.delta { display: inline-flex; align-items: center; gap: 3px; padding: 2px 7px; border-radius: 99px; font-weight: 700; font-size: 11px; }
.delta.up { background: var(--green-50); color: var(--green); }
.delta.down { background: var(--red-50); color: var(--red); }
.delta.flat { background: var(--surface-2); color: var(--muted); }

/* table */
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
.tbl th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted);
  font-weight: 700; padding: 10px 12px; border-bottom: 1px solid var(--border); background: var(--surface-2);
  position: sticky; top: 0; white-space: nowrap; user-select: none;
}
.tbl th.sortable { cursor: pointer; }
.tbl th.sortable:hover { color: var(--text); }
.tbl th.sorted { color: var(--orange-600); }
.tbl td { padding: 11px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: none; }
.tbl tbody tr { transition: background .12s; }
.tbl tbody tr.clickable { cursor: pointer; }
.tbl tbody tr.clickable:hover { background: var(--orange-50); }
.tbl .r { text-align: right; }
.tbl .c { text-align: center; }
.rank {
  display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 7px;
  background: var(--surface-2); font-weight: 700; font-size: 12px; color: var(--muted);
}
.rank.top { background: var(--orange-50); color: var(--orange-600); }
.ar-name b { display: block; font-weight: 600; }
.ar-name small { color: var(--muted); }
.rate { display: flex; align-items: center; gap: 8px; min-width: 130px; }
.rate .track { flex: 1; height: 7px; background: var(--surface-2); border-radius: 7px; overflow: hidden; border: 1px solid var(--border); }
.rate .track i { display: block; height: 100%; border-radius: 7px; }
.rate b { width: 50px; text-align: right; font-variant-numeric: tabular-nums; }
.dots { display: inline-flex; gap: 3px; }
.dots i { width: 7px; height: 7px; border-radius: 2px; background: var(--border); }
.dots i.on { background: var(--blue); }

.badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 99px; font-size: 11.5px; font-weight: 600;
  background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border);
}
.badge.orange { background: var(--orange-50); color: var(--orange-600); border-color: #F8D2B4; }
.badge.blue { background: var(--blue-50); color: var(--blue-600); border-color: #C5DEF1; }
.badge.green { background: var(--green-50); color: var(--green); border-color: #BFE6D3; }
.badge.red { background: var(--red-50); color: var(--red); border-color: #F1C3C3; }
.badge.amber { background: var(--amber-50); color: #A86E06; border-color: #F3D9A8; }
.badge.gray { color: var(--muted); }

.empty { padding: 40px 20px; text-align: center; color: var(--muted); }
.empty svg { width: 40px; height: 40px; color: var(--border-strong); margin-bottom: 10px; }
.skeleton {
  border-radius: 10px; min-height: 120px;
  background: linear-gradient(90deg, #EEF1F5 0px, #F7F9FB 200px, #EEF1F5 400px); background-size: 800px 100%;
  animation: shimmer 1.3s infinite linear;
}

/* ---------------------------------------------------------------- AR spotlight (regional) */
.spot {
  display: grid; grid-template-columns: auto 1fr auto; gap: 18px; align-items: center; padding: 18px 20px;
  background: linear-gradient(120deg, var(--navy) 0%, var(--navy-3) 100%); color: #fff; border: none;
}
.spot .avatar { width: 52px; height: 52px; font-size: 18px; border-radius: 14px; }
.spot h3 { font-size: 18px; }
.spot p { margin: 4px 0 0; color: #B8CADB; font-size: 13px; }
.spot .links { display: flex; gap: 8px; flex-wrap: wrap; }
.spot .links a { color: #fff; background: rgba(255, 255, 255, .1); padding: 8px 12px; border-radius: 9px; font-size: 12.5px; font-weight: 600; }
.spot .links a:hover { background: rgba(255, 255, 255, .18); text-decoration: none; }

/* ---------------------------------------------------------------- map */
.map-layout { display: grid; grid-template-columns: 1fr 360px; gap: 18px; height: calc(100vh - 190px); min-height: 560px; }
.map-card { position: relative; overflow: hidden; }
#gmap { position: absolute; inset: 0; }
.map-legend {
  position: absolute; left: 14px; bottom: 14px; z-index: 5; background: rgba(255, 255, 255, .96);
  border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; box-shadow: var(--shadow); font-size: 12px;
}
.map-legend b { display: block; margin-bottom: 6px; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.map-legend .row { display: flex; align-items: center; gap: 7px; margin: 3px 0; }
.map-legend i { width: 11px; height: 11px; border-radius: 50%; display: inline-block; }
.map-metric {
  position: absolute; top: 14px; left: 14px; z-index: 5; display: flex; gap: 4px; padding: 4px;
  background: rgba(255, 255, 255, .96); border: 1px solid var(--border); border-radius: 11px; box-shadow: var(--shadow);
}
.map-metric button { border: none; background: transparent; padding: 7px 11px; border-radius: 8px; font-size: 12.5px; font-weight: 600; color: var(--text-2); cursor: pointer; }
.map-metric button.on { background: var(--navy); color: #fff; }
.map-list { display: flex; flex-direction: column; overflow: hidden; }
.map-list .list { overflow-y: auto; padding: 4px 10px 12px; }
.map-item {
  display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: 10px; cursor: pointer; transition: background .12s;
}
.map-item:hover, .map-item.on { background: var(--orange-50); }
.map-item .pin { width: 12px; height: 12px; border-radius: 50%; flex: none; box-shadow: 0 0 0 3px rgba(0, 0, 0, .05); }
.map-item .t { flex: 1; min-width: 0; }
.map-item .t b { display: block; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.map-item .t small { color: var(--muted); }
.map-item .v { font-weight: 700; font-variant-numeric: tabular-nums; }

.ar-pin {
  --c: var(--orange);
  position: absolute; display: grid; place-items: center; border-radius: 50%; color: #fff; font-weight: 800; font-size: 11px;
  background: var(--c); border: 3px solid #fff; box-shadow: 0 4px 14px rgba(13, 43, 69, .35); cursor: pointer;
  transform: translate(-50%, calc(-100% - 9px)); transform-origin: 50% calc(100% + 9px);
  transition: transform .15s var(--ease), opacity .2s, background .2s; font-family: Inter, sans-serif; outline: none;
}
.ar-pin::after {
  content: ""; position: absolute; bottom: -9px; left: 50%; transform: translateX(-50%);
  border: 6px solid transparent; border-top-color: #fff;
}
.ar-pin:hover, .ar-pin:focus-visible, .ar-pin.on { transform: translate(-50%, calc(-100% - 9px)) scale(1.15); z-index: 1000 !important; }
.ar-pin.on { box-shadow: 0 0 0 6px rgba(238, 114, 20, .3), 0 4px 14px rgba(13, 43, 69, .35); }
.ar-pin.dim { opacity: .28; }

.map-layers {
  position: absolute; top: 14px; right: 62px; z-index: 5; width: 200px; padding: 10px 10px 8px;
  background: rgba(255, 255, 255, .96); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow); font-size: 12px;
}
.map-toggle { display: flex; align-items: center; gap: 8px; font-weight: 700; color: var(--text); cursor: pointer; padding: 2px 2px 8px; user-select: none; }
.map-toggle input { position: absolute; opacity: 0; pointer-events: none; }
.map-toggle span { width: 30px; height: 17px; border-radius: 99px; background: #cbd3dc; position: relative; transition: background .2s; flex: none; }
.map-toggle span::after { content: ""; position: absolute; top: 2px; left: 2px; width: 13px; height: 13px; border-radius: 50%; background: #fff; transition: transform .2s var(--ease); box-shadow: 0 1px 3px rgba(0,0,0,.25); }
.map-toggle input:checked + span { background: var(--orange); }
.map-toggle input:checked + span::after { transform: translateX(13px); }
.map-toggle input:focus-visible + span { box-shadow: 0 0 0 3px rgba(238, 114, 20, .3); }
.map-regioes { display: flex; flex-direction: column; gap: 1px; border-top: 1px solid var(--border); padding-top: 6px; transition: opacity .2s; }
.map-regioes.disabled { opacity: .4; pointer-events: none; }
.map-regioes button {
  display: flex; align-items: center; gap: 8px; border: none; background: transparent; text-align: left; cursor: pointer;
  padding: 5px 6px; border-radius: 7px; font-size: 12px; color: var(--text-2); transition: background .12s, opacity .15s;
}
.map-regioes button:hover { background: var(--surface-2); }
.map-regioes button i { width: 12px; height: 12px; border-radius: 3px; opacity: .85; flex: none; }
.map-regioes.focus button { opacity: .45; }
.map-regioes.focus button.on { opacity: 1; background: var(--orange-50); font-weight: 700; color: var(--text); }
.map-src { margin-top: 6px; font-size: 10px; color: var(--muted); }
.map-tip {
  position: absolute; z-index: 6; pointer-events: none; background: var(--navy); color: #fff; border-radius: 9px;
  padding: 8px 10px; font-size: 12px; box-shadow: var(--shadow-lg); max-width: 240px; display: flex; flex-direction: column; gap: 3px;
}
.map-tip span { display: flex; align-items: center; gap: 6px; color: rgba(255,255,255,.8); }
.map-tip i { width: 9px; height: 9px; border-radius: 2px; display: inline-block; }
.map-tip small { color: #ffc89a; font-weight: 600; }
.bairro-label {
  position: absolute; transform: translate(-50%, -50%); white-space: nowrap; pointer-events: none;
  font: 700 10.5px/1 Inter, sans-serif; letter-spacing: .04em; text-transform: uppercase; color: #3c4b5c;
  text-shadow: 0 0 3px #fff, 0 0 3px #fff, 0 0 2px #fff; transition: opacity .2s;
}
.bairro-label.dim { opacity: .25; }
.map-tip[hidden], .map-layers[hidden] { display: none; }
.map-fallback { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: 30px; color: var(--muted); background: var(--surface-2); }

/* ---------------------------------------------------------------- drawer */
.drawer-backdrop {
  position: fixed; inset: 0; background: rgba(13, 43, 69, .35); opacity: 0; pointer-events: none;
  transition: opacity .25s; z-index: 80; backdrop-filter: blur(2px);
}
.drawer-backdrop.open { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed; top: 0; right: 0; height: 100vh; width: min(560px, 100vw); background: var(--bg); z-index: 90;
  transform: translateX(105%); transition: transform .35s var(--ease); box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column;
}
.drawer.open { transform: none; }
.dr-head {
  padding: 22px 22px 18px; color: #fff; position: relative;
  background: radial-gradient(500px 200px at 100% 0%, rgba(238, 114, 20, .45), transparent 70%), linear-gradient(140deg, var(--navy), var(--navy-3));
}
.dr-head .close {
  position: absolute; right: 14px; top: 14px; width: 34px; height: 34px; border-radius: 10px; border: none; cursor: pointer;
  background: rgba(255, 255, 255, .12); color: #fff; display: grid; place-items: center;
}
.dr-head .close:hover { background: rgba(255, 255, 255, .22); }
.dr-head .eyebrow { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--orange-400); font-weight: 700; }
.dr-head h2 { font-size: 22px; font-weight: 800; margin: 6px 40px 4px 0; }
.dr-head .decreto { color: #AFC3D6; font-size: 12.5px; }
.dr-person { display: flex; gap: 12px; align-items: center; margin-top: 16px; }
.dr-person .avatar { width: 44px; height: 44px; border-radius: 12px; }
.dr-person b { display: block; }
.dr-person small { color: #AFC3D6; }
.dr-actions { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 16px; }
.dr-actions a, .dr-actions button {
  display: flex; flex-direction: column; align-items: center; gap: 5px; padding: 10px 4px; border-radius: 10px;
  background: rgba(255, 255, 255, .1); color: #fff; font-size: 11.5px; font-weight: 600; border: none; cursor: pointer;
}
.dr-actions a:hover, .dr-actions button:hover { background: rgba(255, 255, 255, .2); text-decoration: none; }
.dr-actions svg { width: 18px; height: 18px; }
.dr-body { flex: 1; overflow-y: auto; padding: 18px 22px 30px; }
.dr-body .card { margin-bottom: 14px; }
.mini-kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.mini-kpi { background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: 12px; }
.mini-kpi small { color: var(--muted); font-size: 11.5px; font-weight: 600; }
.mini-kpi b { display: block; font-size: 21px; font-weight: 800; margin-top: 4px; font-variant-numeric: tabular-nums; }
.hbar { display: grid; grid-template-columns: 140px 1fr 56px; gap: 10px; align-items: center; margin: 7px 0; font-size: 12.5px; }
.hbar .track { height: 9px; background: var(--surface-2); border-radius: 9px; overflow: hidden; border: 1px solid var(--border); }
.hbar .track i { display: block; height: 100%; border-radius: 9px; }
.hbar b { text-align: right; font-variant-numeric: tabular-nums; }
.addr { display: flex; gap: 10px; color: var(--text-2); font-size: 13px; line-height: 1.5; }
.addr svg { width: 18px; height: 18px; color: var(--orange); flex: none; margin-top: 2px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }

/* ---------------------------------------------------------------- heatmap / coverage */
.heat { width: 100%; border-collapse: separate; border-spacing: 4px; font-size: 12px; }
.heat th { font-size: 10.5px; color: var(--muted); font-weight: 700; text-transform: uppercase; padding: 2px; }
.heat td.name { white-space: nowrap; padding-right: 10px; font-weight: 600; color: var(--text-2); }
.heat td.cell {
  height: 32px; min-width: 42px; border-radius: 7px; text-align: center; font-weight: 700; font-size: 11px;
  font-variant-numeric: tabular-nums; cursor: default; transition: transform .1s, box-shadow .1s;
}
.heat td.cell.click { cursor: pointer; }
.heat td.cell.click:hover { transform: scale(1.08); box-shadow: 0 3px 10px rgba(13, 43, 69, .2); }
.heat td.cell.sel { outline: 3px solid var(--orange); outline-offset: 1px; }
.heat-legend { display: flex; gap: 14px; align-items: center; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.heat-legend i { display: inline-block; width: 14px; height: 14px; border-radius: 4px; vertical-align: -3px; margin-right: 5px; }

/* ---------------------------------------------------------------- lançamento form */
.form-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.fs { border: 1px solid var(--border); border-radius: 12px; padding: 14px; background: var(--surface-2); }
.fs h4 { font-size: 13px; display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.fs h4 i { width: 10px; height: 10px; border-radius: 3px; }
.fs .row { display: grid; grid-template-columns: 1fr 110px; gap: 10px; align-items: center; margin-bottom: 8px; }
.fs .row label { font-size: 12.5px; color: var(--text-2); }
.fs .row label small { display: block; color: var(--muted); font-size: 10.5px; }
.fs .total { display: flex; justify-content: space-between; border-top: 1px dashed var(--border-strong); padding-top: 10px; margin-top: 10px; font-weight: 700; }
.form-bar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 16px; }
.form-bar .meta { margin-right: auto; color: var(--muted); font-size: 12.5px; }

/* ---------------------------------------------------------------- checks */
.check-item { border: 1px solid var(--border); border-radius: 12px; background: #fff; margin-bottom: 10px; overflow: hidden; }
.check-item summary { list-style: none; display: flex; gap: 12px; align-items: center; padding: 14px 16px; cursor: pointer; }
.check-item summary::-webkit-details-marker { display: none; }
.check-item .sev { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; flex: none; }
.check-item .sev svg { width: 17px; height: 17px; }
.check-item .t { flex: 1; }
.check-item .t b { display: block; }
.check-item .t small { color: var(--muted); }
.check-item ul { margin: 0; padding: 4px 16px 14px 60px; color: var(--text-2); line-height: 1.8; columns: 2; font-size: 12.5px; }

/* ---------------------------------------------------------------- tabs */
.tabs { display: inline-flex; gap: 4px; padding: 4px; background: #fff; border: 1px solid var(--border); border-radius: 11px; margin-bottom: 16px; }
.tabs button { border: none; background: transparent; padding: 8px 14px; border-radius: 8px; font-weight: 600; color: var(--text-2); cursor: pointer; }
.tabs button.on { background: var(--navy); color: #fff; }

/* ---------------------------------------------------------------- modal & toast */
.modal-bg {
  position: fixed; inset: 0; z-index: 100; background: rgba(13, 43, 69, .45); display: grid; place-items: center; padding: 20px;
  animation: fadeUp .2s; backdrop-filter: blur(2px);
}
.modal { width: min(560px, 100%); background: #fff; border-radius: 16px; box-shadow: var(--shadow-lg); max-height: 90vh; display: flex; flex-direction: column; }
.modal-h { padding: 18px 20px 8px; display: flex; align-items: center; }
.modal-h h3 { font-size: 17px; flex: 1; }
.modal-b { padding: 10px 20px; overflow-y: auto; }
.modal-b .field { margin-bottom: 12px; }
.modal-b .two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.modal-f { padding: 14px 20px 18px; display: flex; justify-content: flex-end; gap: 8px; }
.toast-root { position: fixed; right: 20px; bottom: 20px; z-index: 120; display: flex; flex-direction: column; gap: 8px; }
.toast {
  min-width: 260px; max-width: 380px; padding: 12px 14px; border-radius: 11px; background: var(--navy); color: #fff;
  box-shadow: var(--shadow-lg); animation: fadeUp .25s var(--ease); font-size: 13px; border-left: 4px solid var(--orange);
}
.toast.ok { border-left-color: var(--green); }
.toast.err { border-left-color: var(--red); }

/* ---------------------------------------------------------------- responsive */
@media (max-width: 1400px) { .g-kpi { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 1100px) {
  .g-3, .g-2 { grid-template-columns: 1fr; }
  .map-layout { grid-template-columns: 1fr; height: auto; }
  .map-card { height: 520px; }
  .map-list .list { max-height: 420px; }
  .form-grid { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; transform: translateX(-100%); transition: transform .3s var(--ease); width: var(--sidebar); }
  .shell.nav-open .sidebar { transform: none; box-shadow: var(--shadow-lg); }
  .topbar .burger { display: inline-grid; }
  .topbar, .filters, .page { padding-left: 16px; padding-right: 16px; }
  .login { grid-template-columns: 1fr; }
  .login-hero { display: none; }
  .g-kpi { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .spot { grid-template-columns: auto 1fr; }
  .spot .links { grid-column: 1 / -1; }
  .check-item ul { columns: 1; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
