/* ==========================================================================
   NOC Geomap — style.css (estilo "vidro" claro/escuro)
   Adaptado do frontend real: MESMOS seletores/classes do app.js, então é
   drop-in. Requer as CSS variables: carregue noc-geomap.tokens.css ANTES.

   Aplicar tema (padrão escuro, lembrado entre acessos):
     <script>
       const t = localStorage.getItem('nocgeomap.theme') || 'dark';
       document.documentElement.setAttribute('data-theme', t);
     </script>
   Para alternar: setAttribute('data-theme', novo) + localStorage.setItem(...).
   ========================================================================== */

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; font-family: "Sora", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--text); }
.hidden { display: none !important; }
#app, #map { height: 100%; }
#app { display: flex; flex-direction: column; background: var(--bg); }

/* ---------------- Header (barra de vidro) ---------------- */
header {
  display: flex; align-items: center; gap: 8px; padding: 0 16px; height: 56px;
  background: var(--header-bg);
  -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
  color: var(--text); font-size: 14px;
  border-bottom: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  position: relative; z-index: 1000;
}
header > strong { font-size: 17px; font-weight: 700; letter-spacing: .2px; color: var(--text); display: flex; align-items: center; gap: 9px; }
header > strong::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft), 0 0 12px var(--accent); }
header .spacer { flex: 1; }
.muted { color: var(--text-soft); font-size: 13px; margin: 0 4px; }
.tag { background: var(--amber); color: #2a1c00; padding: 3px 9px; border-radius: 20px; font-size: 11px; font-weight: 600; }
.legend { font-size: 12px; color: var(--text-dim); display: flex; align-items: center; gap: 4px; margin-left: 6px; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; margin: 0 3px 0 12px; }
.dot.verde { background: var(--green); } .dot.amarelo { background: var(--amber); } .dot.vermelho { background: var(--red); }
.dot.cinza { background: var(--slate); } .dot.laranja { background: var(--orange); } .dot.azul { background: var(--azul); }

/* ---------------- Botões ---------------- */
button { font-family: inherit; background: var(--accent); color: var(--accent-ink); border: 0; padding: 10px 16px; border-radius: 10px;
  cursor: pointer; font-size: 14px; font-weight: 600; transition: background .15s, transform .05s, box-shadow .15s, filter .15s; }
button:hover { filter: brightness(1.06); box-shadow: 0 6px 22px var(--accent-glow); }
button:active { transform: translateY(1px); }
button.ghost { background: var(--hover); color: var(--text-dim); font-weight: 500; box-shadow: none; }
button.ghost:hover { background: var(--hover); color: var(--text); filter: none; }
button.danger { background: var(--red); color: #fff; } button.danger:hover { filter: brightness(1.06); }
button.small { padding: 6px 11px; font-size: 12px; }

/* menus suspensos do cabeçalho (hover) */
.menu { position: relative; display: inline-block; }
.menu-btn { background: var(--hover); color: var(--text-dim); border: 1px solid transparent; padding: 9px 14px; border-radius: 10px;
  cursor: pointer; font-size: 14px; font-weight: 500; transition: background .15s, color .15s; }
.menu:hover .menu-btn { background: var(--accent-soft); color: var(--text); }
.menu-pop { display: none; position: absolute; right: 0; top: 100%; margin-top: 6px;
  background: var(--panel-strong); -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px);
  border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow);
  min-width: 200px; padding: 6px; z-index: 1600; }
.menu-pop::before { content: ""; position: absolute; left: 0; right: 0; top: -10px; height: 10px; }
.menu:hover .menu-pop { display: block; }
.menu-item { display: block; width: 100%; text-align: left; background: none; color: var(--text-dim); font-weight: 500;
  padding: 9px 12px; border-radius: 8px; border: 0; font-size: 14px; cursor: pointer; transition: background .12s, color .12s; }
.menu-item:hover { background: var(--hover); color: var(--text); }
.menu-item.hidden { display: none; }
.menu-item.map-item.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.menu-item.map-item.on::before { content: "● "; }
.menu-empty { padding: 8px 12px; font-size: 12px; color: var(--text-soft); }
.menu-pop hr { border: 0; border-top: 1px solid var(--line); margin: 5px 4px; }
.editor-only { display: none; }
body.is-editor .editor-only { display: block; }

/* ---------------- Overlays / cards (vidro) ---------------- */
.overlay { position: fixed; inset: 0; background: rgba(2, 8, 16, .55); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center; z-index: 2000; }
.card { background: var(--panel-strong); -webkit-backdrop-filter: blur(22px); backdrop-filter: blur(22px);
  padding: 24px; border-radius: 16px; width: min(440px, 94vw);
  display: flex; flex-direction: column; gap: 11px; box-shadow: var(--shadow); border: 1px solid var(--line);
  max-height: 92vh; overflow-y: auto; }
.card.wide { width: min(720px, 95vw); }
.card h1 { margin: 0; font-size: 24px; color: var(--text); }
.card h2 { margin: 0 0 8px; font-size: 19px; color: var(--text); padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.card .sub { margin: -6px 0 8px; color: var(--text-soft); font-size: 13px; }
.card label { font-size: 12px; font-weight: 600; color: var(--text-soft); margin-bottom: -5px; }
.card input, .card select { padding: 10px 11px; border: 1px solid var(--line-strong); border-radius: 10px; font-size: 14px; width: 100%;
  font-family: inherit; color: var(--text); background: var(--inset); transition: border-color .15s, box-shadow .15s; }
.card input:focus, .card select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.card .row { display: flex; gap: 10px; } .card .row > div { flex: 1; min-width: 0; }
.card label.chk { display: flex; align-items: center; gap: 9px; font-size: 14px; color: var(--text); }
.card input[type=checkbox] { width: auto; accent-color: var(--accent); }
.card label.mini { font-size: 11px; color: var(--text-soft); margin-bottom: -2px; }
#bindAutoMsg { font-size: 12px; color: var(--accent); margin: -4px 0 2px; min-height: 14px; }

/* ---------------- Playlists de cenas (videowall) ---------------- */
.pl-row { display: flex; align-items: center; }
.pl-row .pl-play { flex: 1; }
.pl-edit { background: none; border: 0; color: var(--text-soft); cursor: pointer; padding: 7px 9px; border-radius: 8px; font-size: 13px; }
.pl-edit:hover { background: var(--hover); color: var(--accent); }
.sc-row { display: flex; align-items: center; gap: 6px; padding: 4px 0; font-size: 13px; }
.sc-ord { width: 18px; flex: none; text-align: center; color: var(--text-soft); }
.card input.sc-name { flex: 1; min-width: 0; width: auto; }
.card .sc-map { flex: none; max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-soft); }
.card input.sc-secs { width: 54px; flex: none; }
.sc-row button { flex: none; padding: 4px 8px; }

/* botão de parar e barra de captura */
#playStop { position: fixed; top: 12px; left: 50%; transform: translateX(-50%); z-index: 5000;
  background: var(--panel-strong); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
  color: var(--text); border: 1px solid var(--line); border-radius: 22px; padding: 8px 18px;
  font-family: inherit; font-size: 13px; font-weight: 600; cursor: pointer; box-shadow: var(--shadow); }
#playStop:hover { filter: brightness(1.08); }
#captureBar { position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); z-index: 2500;
  background: var(--panel-strong); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
  border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow);
  padding: 10px 14px; display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--text); }

/* modo reprodução: esconde controles/cabeçalho (mantém legenda e mapa) */
body.playing #app > header,
body.playing .leaflet-control-zoom,
body.playing .leaflet-control-layers,
body.playing .base-ctrl,
body.playing .viewctrl,
body.playing .leaflet-pm-toolbar { display: none !important; }
.card .hint { font-size: 12px; color: var(--text-soft); margin: 2px 0 -2px; }
.card .actions { display: flex; align-items: center; gap: 9px; margin-top: 8px; } .card .actions .spacer { flex: 1; }
.err { color: var(--red); font-size: 13px; min-height: 16px; }
.credit-login { text-align: center; font-size: 12px; color: var(--text-soft); margin-top: 2px; }

/* ---------- Tela de login: cena animada com globo (sempre escura, on-brand) ---------- */
#login.login-scene {
  background: radial-gradient(120% 120% at 50% 32%, #0a1c2e 0%, #06121f 55%, #03080f 100%);
  -webkit-backdrop-filter: none; backdrop-filter: none;
  font-family: 'Sora', 'Inter', system-ui, sans-serif;
}
.login-hero { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 15px; padding: 28px; width: min(440px, 94vw); }
.login-globe {
  width: min(300px, 68vw); aspect-ratio: 1 / 1; margin-bottom: -6px;
  -webkit-mask-image: radial-gradient(circle at 50% 50%, #000 60%, transparent 78%);
          mask-image: radial-gradient(circle at 50% 50%, #000 60%, transparent 78%);
  animation: nocGlobeIn 1.4s cubic-bezier(.2,.7,.2,1) both;
}
.login-globe noc-globe { display: block; width: 100%; height: 100%; }
.login-word { display: flex; align-items: baseline; gap: 0.22em; font-weight: 700; font-size: 46px; line-height: 1;
  animation: nocWordIn 1.1s cubic-bezier(.2,.7,.2,1) 0.5s both; }
.login-word .lw-noc { color: #eaf7ff; text-shadow: 0 0 24px rgba(127,212,255,.45); }
.login-word .lw-geo { color: #7fd4ff; font-weight: 300; text-shadow: 0 0 28px rgba(127,212,255,.45); }
.login-line { width: 64px; height: 1px; transform-origin: center;
  background: linear-gradient(90deg, transparent, #3ba3ff, transparent); animation: nocLineGrow 0.9s ease-out 1.15s both; }
.login-tag { display: flex; align-items: center; gap: 10px; animation: nocTagIn 0.9s ease-out 1.35s both; }
.login-dot { width: 7px; height: 7px; border-radius: 50%; background: #7fd4ff; box-shadow: 0 0 10px #7fd4ff; animation: nocDot 1.8s ease-in-out infinite; }
.login-tag-txt { font-family: 'IBM Plex Mono', monospace; font-size: 11px; white-space: nowrap; letter-spacing: 0.18em; text-transform: uppercase; color: #7fa6c4; }

@keyframes nocGlobeIn { 0%{opacity:0;transform:scale(.86);filter:blur(6px)} 100%{opacity:1;transform:scale(1);filter:blur(0)} }
@keyframes nocWordIn { 0%{opacity:0;transform:translateY(14px);letter-spacing:.42em;filter:blur(5px)} 60%{opacity:1;filter:blur(0)} 100%{opacity:1;transform:translateY(0);letter-spacing:.14em;filter:blur(0)} }
@keyframes nocLineGrow { 0%{transform:scaleX(0);opacity:0} 100%{transform:scaleX(1);opacity:1} }
@keyframes nocTagIn { 0%{opacity:0;transform:translateY(8px)} 100%{opacity:1;transform:translateY(0)} }
@keyframes nocDot { 0%,100%{opacity:.35} 50%{opacity:1} }

.login-form { display: flex; flex-direction: column; gap: 11px; width: 100%; margin-top: 10px; animation: nocTagIn 0.9s ease-out 1.5s both; }
.login-form input { padding: 11px 13px; border-radius: 10px; font-size: 14px; width: 100%; font-family: 'Inter', system-ui, sans-serif;
  color: #eaf7ff; background: rgba(255,255,255,.06); border: 1px solid rgba(127,166,196,.28);
  transition: border-color .15s, box-shadow .15s, background .15s; }
.login-form input::placeholder { color: #6f93b0; }
.login-form input:focus { outline: none; border-color: #3ba3ff; background: rgba(255,255,255,.10); box-shadow: 0 0 0 3px rgba(59,163,255,.25); }
.login-form button { margin-top: 4px; padding: 11px 13px; border: none; border-radius: 10px; font-size: 14px; font-weight: 600; color: #04101c;
  cursor: pointer; font-family: 'Inter', system-ui, sans-serif; background: linear-gradient(180deg, #7fd4ff, #3ba3ff);
  box-shadow: 0 8px 24px rgba(59,163,255,.35); transition: filter .15s, transform .05s; }
.login-form button:hover { filter: brightness(1.06); }
.login-form button:active { transform: translateY(1px); }
.login-form .err { color: #ff9b9b; font-size: 13px; }
#login.login-scene .credit-login { color: #7fa6c4; margin-top: 6px; }
#login.login-scene .dev-credit { color: #7fa6c4; }
#login.login-scene .dev-credit b { color: #c4ddee; }
@media (max-width: 520px) { .login-word { font-size: 38px; } .login-tag-txt { letter-spacing: 0.10em; } }

/* crédito do desenvolvedor + cartão social no hover */
.dev-credit { position: relative; display: inline-block; cursor: pointer; }
.dev-credit b { color: var(--text); font-weight: 600; }
.dev-social { display: none; position: absolute; bottom: 100%; right: 0;
  background: var(--panel-strong); -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px);
  border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); padding: 5px; min-width: 200px; z-index: 4000; }
.dev-credit:hover .dev-social { display: block; }
.dev-social a { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-radius: 8px; font-size: 12px; color: var(--text-dim); text-decoration: none; white-space: nowrap; }
.dev-social a:hover { background: var(--hover); color: var(--accent); }
.dev-social svg { flex: none; }

.capRow { display: flex; gap: 7px; align-items: center; }
.capRow > :first-child { flex: 1; min-width: 0; }
.capRow > select:last-child { flex: none; width: 88px; }

/* chips de hosts no POP */
.chips { display: flex; flex-wrap: wrap; gap: 6px; min-height: 26px; max-height: 180px; overflow-y: auto;
  align-content: flex-start; border: 1px solid var(--line); border-radius: 10px; padding: 8px; background: var(--inset); }
.chip { background: var(--accent-soft); color: var(--accent); border: 1px solid var(--accent-border); border-radius: 20px; padding: 4px 11px;
  font-size: 12px; font-weight: 500; display: inline-flex; align-items: center; gap: 7px; }
.chip b { cursor: pointer; color: var(--red); font-weight: 700; }

/* ---------------- Banner ---------------- */
.banner { background: var(--red); color: #fff; padding: 9px 16px; font-size: 13px; font-weight: 500; }

/* ---------------- Map / Leaflet ---------------- */
#map { background: var(--bg); }
.leaflet-bar { border: none !important; box-shadow: var(--shadow) !important; border-radius: 12px; overflow: hidden; }
.leaflet-bar a { background: var(--panel-strong); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  color: var(--text-dim); width: 34px; height: 34px; line-height: 34px; border-bottom: 1px solid var(--line) !important; }
.leaflet-bar a:hover { background: var(--accent-soft); color: var(--accent); }
.leaflet-control-zoom-in, .leaflet-control-zoom-out { font-size: 18px; }

/* seletor de estilo do mapa (por usuário) */
.base-ctrl { background: var(--panel-strong); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  border: 1px solid var(--line); border-radius: 10px; padding: 3px; box-shadow: var(--shadow-sm); }
.base-ctrl select { border: 0; background: none; font-family: inherit; font-size: 12px; color: var(--text);
  padding: 4px 6px; cursor: pointer; outline: none; max-width: 150px; }

/* legenda dentro do mapa (vidro) */
.map-legend { display: flex; gap: 18px; background: var(--panel-strong); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
  border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); padding: 10px 14px; }
.map-legend .leg-sec { display: flex; flex-direction: column; gap: 3px; }
.map-legend .leg-t { font-size: 10px; font-weight: 700; color: var(--text-soft); text-transform: uppercase; letter-spacing: .8px; margin-bottom: 3px; }
.map-legend .leg-row { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--text-dim); white-space: nowrap; }
.map-legend .dot { margin: 0; width: 11px; height: 11px; }

/* tooltip de enlace (vidro) */
.link-tip { font-size: 12px; line-height: 1.55; padding: 9px 12px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--panel-strong); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
  box-shadow: var(--shadow); color: var(--text-dim); }
.leaflet-tooltip.link-tip { max-width: 340px; }
.link-tip b { color: var(--text); }
.tip-sum { color: var(--text-soft); }
.tip-devs { margin-top: 5px; border-top: 1px solid var(--line); padding-top: 5px; }
.tip-devs .dev { display: flex; align-items: center; gap: 7px; font-size: 12px; white-space: nowrap; padding: 1px 0; }
.tip-devs .dev i { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex: none; }

/* balão de hover do POP */
.pop-card-html { position: fixed; z-index: 1500; max-width: 320px; min-width: 180px;
  background: var(--panel-strong); -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px);
  color: var(--text-dim); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow);
  padding: 10px 13px; font-size: 12px; line-height: 1.5; overflow-y: auto; }
.pop-card-html b { color: var(--text); }
.pop-card-html .tip-sum { color: var(--text-soft); }

/* balão de enlaces empilhados sob o cursor */
.links-card { position: fixed; z-index: 1500; max-width: 340px; min-width: 180px;
  background: var(--panel-strong); -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px);
  color: var(--text-dim); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow);
  padding: 9px 11px; font-size: 12px; line-height: 1.45; overflow-y: auto; }
.links-card .lk-head { font-size: 10px; font-weight: 700; color: var(--text-soft); text-transform: uppercase; letter-spacing: .8px; margin: 0 0 5px 2px; }
.links-card .lk-row { display: flex; align-items: flex-start; gap: 8px; padding: 5px; border-radius: 8px; }
.links-card .lk-row + .lk-row { border-top: 1px solid var(--line); }
.links-card .lk-row:hover { background: var(--hover); cursor: pointer; }
.links-card .dot { margin: 4px 0 0; flex: none; width: 11px; height: 11px; }
.links-card .lk-txt b { color: var(--text); }
.links-card .lk-sum { color: var(--text-soft); font-size: 11px; margin-top: 1px; }

/* ---------------- Fullscreen ---------------- */
#app:fullscreen, #app:-webkit-full-screen { width: 100%; height: 100%; }
body.fs #app { position: relative; }
body.fs #app > header { position: absolute; top: 0; left: 0; right: 0; z-index: 2000; display: none !important; }
body.fs.peek #app > header { display: flex !important; }

/* ---------------- Tom Select ---------------- */
.ts-wrapper { width: 100%; }
.ts-control { border: 1px solid var(--line-strong) !important; border-radius: 10px !important; font-size: 13px; padding: 6px 9px !important;
  box-shadow: none !important; background: var(--inset) !important; color: var(--text) !important; max-height: 132px; overflow-y: auto; }
.ts-control.focus { border-color: var(--accent) !important; box-shadow: 0 0 0 3px var(--accent-soft) !important; }
.ts-control .item { font-size: 12px; padding: 1px 6px !important; color: var(--text); }
.ts-dropdown { z-index: 2100; background: var(--panel-strong); -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px);
  border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); margin-top: 4px; font-size: 13px; color: var(--text); }
.ts-dropdown .option { padding: 5px 9px; line-height: 1.35; }
.ts-dropdown .active { background: var(--accent-soft); color: var(--accent); }

/* ---------------- Página de relatório ---------------- */
header label.hd { color: var(--text-dim); font-size: 13px; display: flex; align-items: center; gap: 7px; }
header label.hd input { padding: 6px 8px; border-radius: 8px; border: 1px solid var(--line); background: var(--inset); color: var(--text); font-family: inherit; }
button.tab { background: var(--hover); color: var(--text-dim); font-weight: 500; box-shadow: none; }
button.tab:hover { background: var(--accent-soft); color: var(--text); filter: none; }
button.tab.on { background: var(--accent); color: var(--accent-ink); }
.report { padding: 22px; overflow: auto; flex: 1; background: var(--bg); }
.cache-info { font-size: 12px; color: var(--text-soft); margin: -6px 0 16px; }

/* cabeçalho que só aparece na impressão / PDF */
.print-head { display: none; }
@media print {
  header, #banner, .cache-info, .menu { display: none !important; }
  body, html, #app { height: auto; background: #fff; color: #0f172a; }
  .report { padding: 0; overflow: visible; }
  .print-head { display: block; margin-bottom: 14px; }
  .print-head h1 { font-size: 18px; margin: 0; color: #0f172a; }
  .print-head .ph-sub { font-size: 12px; color: #555; margin-top: 2px; }
  .card-kpi { box-shadow: none; background: #fff; border-color: #e2e8f0; }
  .card-kpi .kpi { color: #1d4ed8; }
  .rep { font-size: 11px; box-shadow: none; background: #fff; }
  .rep th, .rep td { color: #0f172a; border-color: #e2e8f0; }
  .rep tr, .local, .card-kpi { page-break-inside: avoid; }
  @page { margin: 14mm; }
}
.cards { display: flex; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.card-kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 22px; min-width: 230px; box-shadow: var(--shadow-sm); }
.card-kpi .kpi { font-size: 30px; font-weight: 700; color: var(--accent); letter-spacing: -.5px; font-family: "IBM Plex Mono", monospace; }
.card-kpi .kpi-t { font-size: 13px; font-weight: 600; color: var(--text); margin-top: 3px; }
.card-kpi .kpi-s { font-size: 11px; color: var(--text-soft); margin-top: 3px; }
.rep { width: 100%; border-collapse: separate; border-spacing: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.rep th, .rep td { padding: 11px 14px; border-bottom: 1px solid var(--line); font-size: 13px; text-align: left; color: var(--text); }
.rep tbody tr:last-child td { border-bottom: 0; }
.rep th { background: var(--inset); color: var(--text-soft); font-weight: 600; text-transform: uppercase; font-size: 11px; letter-spacing: .4px; }
.rep th.num, .rep td.num { text-align: right; font-family: "IBM Plex Mono", monospace; }
.rep tbody tr:hover td { background: var(--hover); }
.rep tr.ruim td { background: color-mix(in srgb, var(--red) 14%, transparent); } .rep tr.ruim:hover td { background: color-mix(in srgb, var(--red) 22%, transparent); }
.rep tr.semdados td { color: var(--slate); font-style: italic; }
.local { margin-bottom: 20px; }
.local-h { display: flex; align-items: baseline; gap: 12px; margin-bottom: 8px; }
.local-h b { font-size: 16px; color: var(--text); }
.local-h span { font-size: 12px; color: var(--text-soft); }

/* lista de usuários */
.userRow { display: flex; align-items: center; justify-content: space-between; padding: 9px 2px; border-bottom: 1px solid var(--line); font-size: 13px; color: var(--text); }
.userRow em { color: var(--accent); font-style: normal; background: var(--accent-soft); padding: 2px 9px; border-radius: 20px; margin-left: 7px; font-size: 12px; font-weight: 600; }

/* ============================================================
   Casca: rail (navegação) + barra de comando + áreas (Fase 2a)
   ============================================================ */
#app { position: relative; }

#rail {
  position: absolute; top: 0; left: 0; bottom: 0; width: 76px; z-index: 1200;
  background: var(--panel-strong); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column; align-items: center; gap: 5px; padding: 12px 0;
}
.rail-brand { margin-bottom: 8px; line-height: 0; }
.rail-btn {
  width: 62px; background: none; border: 0; color: var(--text-soft); cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 9px 0;
  border-radius: 12px; font-size: 10.5px; font-weight: 500; position: relative;
  transition: background .15s, color .15s; box-shadow: none;
}
.rail-btn:hover { background: var(--hover); color: var(--text); filter: none; box-shadow: none; }
.rail-btn.on { background: var(--accent-soft); color: var(--accent); }
.rail-btn.on::before { content: ""; position: absolute; left: 0; top: 11px; bottom: 11px; width: 3px;
  border-radius: 0 3px 3px 0; background: var(--accent); box-shadow: 0 0 10px var(--accent); }
.rail-spacer { flex: 1; }

#cmdbar {
  position: absolute; top: 0; left: 76px; right: 0; height: 54px; z-index: 1100;
  display: flex; align-items: center; gap: 10px; padding: 0 14px;
  background: var(--header-bg); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--line);
}
#cmdbar .spacer { flex: 1; }
#cmdbar #menuMapas .menu-pop { left: 0; right: auto; }
#mapTitle { font-weight: 600; max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

#map { position: absolute; left: 76px; top: 54px; right: 0; bottom: 0; height: auto; }
#banner { position: absolute; left: 76px; top: 54px; right: 0; z-index: 1400; }

#areaView {
  position: absolute; left: 76px; top: 54px; right: 0; bottom: 0; z-index: 1050;
  overflow-y: auto; background: var(--bg); padding: 28px 32px;
}
.area { max-width: 920px; }
.area > h2 { margin: 0 0 6px; font-size: 22px; color: var(--text); border: 0; padding: 0; }
.area-sub { color: var(--text-soft); font-size: 13px; margin: 0 0 20px; }
.area-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px; }
.area-card {
  display: flex; flex-direction: column; align-items: flex-start; gap: 4px; text-align: left;
  background: var(--panel-strong); border: 1px solid var(--line); border-radius: 14px;
  padding: 18px; color: var(--text); cursor: pointer; box-shadow: none; font-weight: 500;
}
.area-card:hover { border-color: var(--accent-border); filter: none; box-shadow: var(--shadow-sm); }
.area-card .ac-ic { font-size: 22px; }
.area-card b { font-size: 15px; }
.area-card > span:not(.ac-ic) { font-size: 12px; color: var(--text-soft); font-weight: 400; }
.area-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }

/* Configuração renderizada como página (não modal centralizado) */
.overlay.as-page {
  position: fixed; inset: auto; left: 76px; top: 54px; right: 0; bottom: 0; z-index: 1050;
  background: var(--bg); -webkit-backdrop-filter: none; backdrop-filter: none;
  display: block; align-items: stretch; justify-content: stretch; overflow-y: auto; padding: 28px 32px;
}
.overlay.as-page .card { width: min(920px, 100%); max-height: none; box-shadow: none; }

/* modo reprodução (videowall): esconde a casca, mapa ocupa tudo */
body.playing #rail, body.playing #cmdbar, body.playing #areaView { display: none !important; }
body.playing #map { left: 0; top: 0; }

/* ---------- Dock de saúde da rede (canto inferior esquerdo do mapa) ---------- */
.health-dock {
  background: var(--panel-strong); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
  border: 1px solid var(--line); border-radius: 13px; box-shadow: var(--shadow); padding: 9px 15px;
}
.health-dock .hd-main { display: flex; align-items: center; gap: 16px; }
.health-dock .hd-label { font-size: 9px; letter-spacing: .14em; color: var(--text-soft); font-weight: 600; white-space: nowrap; }
.health-dock .hd-pct { font-family: "IBM Plex Mono", monospace; font-size: 20px; font-weight: 600; line-height: 1.15; color: var(--green); }
.health-dock .hd-spark { width: 120px; height: 32px; display: block; flex: none; }
.health-dock .hd-counts { display: flex; gap: 13px; }
.health-dock .hd-c { display: inline-flex; align-items: center; gap: 5px; font-family: "IBM Plex Mono", monospace; font-size: 13px; font-weight: 600; color: var(--text); }
.health-dock .hd-c i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.health-dock .hd-c.op i { background: var(--green); }
.health-dock .hd-c.sat i { background: var(--amber); }
.health-dock .hd-c.down i { background: var(--slate); }
.health-dock .hd-c.down.on i { background: var(--red); animation: hdAlarm 1.4s ease-in-out infinite; }
.health-dock .hd-c.down.on b { color: var(--red); }
@keyframes hdAlarm { 0%, 100% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.5); opacity: .4; } }

/* ---------- Relatórios: gráfico de área (disponibilidade diária) ---------- */
.chart-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); padding: 14px 16px 10px; margin-bottom: 18px; }
.chart-h { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 8px; }
.chart-h b { font-size: 14px; color: var(--text); }
.chart-h span { font-size: 11px; color: var(--text-soft); font-family: "IBM Plex Mono", monospace; }
.chart-svg { width: 100%; height: 150px; display: block; }
.chart-x { display: flex; justify-content: space-between; font-size: 11px; color: var(--text-soft);
  font-family: "IBM Plex Mono", monospace; margin-top: 2px; }
@media print { .chart-wrap { box-shadow: none; break-inside: avoid; } }

/* ---------- Relatórios: top utilização (barras) ---------- */
.util-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); padding: 14px 16px; margin-bottom: 18px; }
.util-h { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 10px; }
.util-h b { font-size: 14px; color: var(--text); }
.util-h span { font-size: 11px; color: var(--text-soft); font-family: "IBM Plex Mono", monospace; }
.util-empty { font-size: 13px; color: var(--text-soft); margin: 4px 0; }
.util-row { display: flex; align-items: center; gap: 12px; padding: 5px 0; font-size: 13px; }
.util-name { flex: 0 0 210px; max-width: 210px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
.util-bar { flex: 1; height: 12px; background: var(--inset); border-radius: 7px; overflow: hidden; }
.util-bar i { display: block; height: 100%; background: var(--accent); border-radius: 7px; }
.util-row.sat .util-bar i { background: var(--amber); }
.util-val { flex: 0 0 160px; text-align: right; font-family: "IBM Plex Mono", monospace; color: var(--text); }
.util-val em { color: var(--text-soft); font-style: normal; margin-left: 8px; font-size: 11px; }
.util-row.sat .util-val { color: var(--amber); }
@media print { .util-wrap { box-shadow: none; break-inside: avoid; } }
@media (max-width: 640px) { .util-name { flex-basis: 120px; } .util-val { flex-basis: 104px; } }

/* ---------- Logs de auditoria ---------- */
.audit-list { max-height: 62vh; overflow-y: auto; border: 1px solid var(--line); border-radius: 10px; }
.audit-tbl { margin: 0; }
.audit-tbl td:last-child { color: var(--text); }

/* ---------- Feed de eventos ao vivo (sino + painel à direita) ---------- */
.bell-badge { position: absolute; top: 0; right: 0; min-width: 15px; height: 15px; padding: 0 3px;
  border-radius: 8px; background: var(--red); color: #fff; font-size: 10px; font-weight: 700;
  line-height: 15px; text-align: center; font-family: "IBM Plex Mono", monospace; }
#feedPanel { position: absolute; top: 54px; right: 0; bottom: 0; width: 320px; z-index: 1150;
  background: var(--panel-strong); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
  border-left: 1px solid var(--line); display: flex; flex-direction: column; box-shadow: var(--shadow); }
.feed-h { display: flex; align-items: center; gap: 8px; padding: 14px 16px; font-size: 12px; font-weight: 700;
  letter-spacing: .12em; color: var(--text); border-bottom: 1px solid var(--line); }
.feed-h .feed-sub { font-weight: 500; letter-spacing: 0; font-size: 11px; color: var(--text-soft); }
.feed-live { width: 8px; height: 8px; border-radius: 50%; background: var(--red); box-shadow: 0 0 8px var(--red);
  animation: feedBlink 1.2s ease-in-out infinite; }
.feed-x { margin-left: auto; background: none; border: 0; color: var(--text-soft); cursor: pointer;
  font-size: 14px; padding: 2px 7px; border-radius: 6px; box-shadow: none; }
.feed-x:hover { background: var(--hover); color: var(--text); filter: none; }
.feed-list { flex: 1; overflow-y: auto; }
.feed-empty { padding: 20px 16px; font-size: 13px; color: var(--text-soft); }
.ev-row { display: flex; align-items: flex-start; gap: 10px; padding: 12px 16px;
  border-bottom: 1px solid var(--line); cursor: pointer; transition: background .12s; }
.ev-row:hover { background: var(--hover); }
.ev-row.resolvido { opacity: .6; }
.ev-dot { width: 9px; height: 9px; border-radius: 50%; margin-top: 4px; flex: none; }
.ev-dot.verde { background: var(--green); box-shadow: 0 0 8px var(--green); }
.ev-dot.amarelo { background: var(--amber); box-shadow: 0 0 8px var(--amber); }
.ev-dot.vermelho { background: var(--red); box-shadow: 0 0 8px var(--red); }
.ev-body { flex: 1; min-width: 0; }
.ev-t { font-size: 13px; font-weight: 600; color: var(--text); }
.ev-t em { font-style: normal; font-weight: 500; color: var(--text-soft); }
.ev-s { font-size: 11px; color: var(--text-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ev-when { font-size: 10.5px; color: var(--text-soft); font-family: "IBM Plex Mono", monospace; white-space: nowrap; margin-top: 2px; }
@keyframes feedBlink { 0%, 100% { opacity: 1; } 50% { opacity: .3; } }
body.playing #feedPanel { display: none !important; }
.ev-dot.cinza { background: var(--slate); }
.ev-ack { flex: none; align-self: center; background: var(--accent-soft); color: var(--accent); border: 0;
  width: 24px; height: 24px; border-radius: 7px; cursor: pointer; font-size: 13px; box-shadow: none; padding: 0; }
.ev-ack:hover { background: var(--accent); color: var(--accent-ink); filter: none; }
.ev-acked { color: var(--green); font-style: normal; }

/* ---------- Drawer de detalhe do POP (+ reconhecer alarme) ---------- */
#popDrawer { position: absolute; top: 54px; right: 0; bottom: 0; width: 340px; z-index: 1160;
  background: var(--panel-strong); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
  border-left: 1px solid var(--line); display: flex; flex-direction: column; box-shadow: var(--shadow); }
.dr-h { display: flex; align-items: center; gap: 8px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.dr-h b { font-size: 15px; color: var(--text); flex: 1; min-width: 0; }
.dr-body { flex: 1; overflow-y: auto; padding: 14px 16px; }
.dr-kpi { margin-bottom: 12px; }
.dr-kv { font-family: "IBM Plex Mono", monospace; font-size: 26px; font-weight: 600; line-height: 1.1; }
.dr-kl { font-size: 11px; color: var(--text-soft); }
.dr-spark { margin-bottom: 6px; }
.dr-spark-svg { width: 100%; height: 46px; display: block; }
.dr-sub { font-size: 10.5px; color: var(--text-soft); font-family: "IBM Plex Mono", monospace; margin-top: 2px; }
.dr-sec { font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--text-soft);
  margin: 14px 0 8px; border-top: 1px solid var(--line); padding-top: 12px; }
.dr-alarm { display: flex; align-items: flex-start; gap: 9px; padding: 8px 0; }
.dr-alarm .ev-dot { margin-top: 4px; }
.dr-al-b { flex: 1; min-width: 0; }
.dr-al-t { font-size: 13px; font-weight: 600; color: var(--text); }
.dr-ack { flex: none; background: var(--accent); color: var(--accent-ink); border: 0; padding: 5px 10px;
  border-radius: 8px; font-size: 12px; font-weight: 600; cursor: pointer; box-shadow: none; }
.dr-ack:hover { filter: brightness(1.06); }
.dr-msg { width: 100%; margin: 8px 0; padding: 8px 10px; border: 1px solid var(--line-strong); border-radius: 9px;
  font-family: inherit; font-size: 13px; color: var(--text); background: var(--inset); resize: vertical; min-height: 42px; }
.dr-ackall { width: 100%; padding: 9px; border: 0; border-radius: 9px; background: var(--accent); color: var(--accent-ink);
  font-weight: 600; font-size: 13px; cursor: pointer; box-shadow: none; }
.dr-ackall:hover { filter: brightness(1.06); }
.dr-dev { display: flex; align-items: center; gap: 9px; padding: 6px 0; font-size: 13px; }
.dr-dev-n { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
.dr-dev-m { font-family: "IBM Plex Mono", monospace; font-size: 11px; color: var(--text-soft); white-space: nowrap; }
.dr-actions { display: flex; gap: 8px; margin-top: 16px; }
body.playing #popDrawer { display: none !important; }

/* ---------- Busca global (⌘K) ---------- */
.cmd-search { display: flex; align-items: center; gap: 8px; background: var(--inset); color: var(--text-soft);
  border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; cursor: pointer; font-size: 13px;
  font-weight: 500; box-shadow: none; max-width: 340px; }
.cmd-search:hover { border-color: var(--accent-border); color: var(--text); filter: none; }
.cmd-search > span:first-of-type { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cmd-kbd { font-family: "IBM Plex Mono", monospace; font-size: 10px; font-weight: 600; color: var(--text-soft);
  background: var(--hover); border: 1px solid var(--line); border-radius: 5px; padding: 2px 5px; flex: none; }
#cmdk { align-items: flex-start; padding-top: 12vh; }
.cmdk-box { width: min(600px, 94vw); background: var(--panel-strong); -webkit-backdrop-filter: blur(22px); backdrop-filter: blur(22px);
  border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); overflow: hidden; }
.cmdk-in { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); color: var(--text-soft); }
.cmdk-in input { flex: 1; border: 0; background: none; outline: none; font-family: inherit; font-size: 16px; color: var(--text); }
.cmdk-results { max-height: 56vh; overflow-y: auto; padding: 6px; }
.cmdk-g { font-size: 10px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--text-soft); padding: 10px 12px 4px; }
.cmdk-row { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 9px; font-size: 14px; color: var(--text); cursor: pointer; }
.cmdk-row.sel, .cmdk-row:hover { background: var(--accent-soft); color: var(--accent); }
.cmdk-ic { width: 20px; text-align: center; flex: none; }
.cmdk-empty { padding: 24px 16px; text-align: center; color: var(--text-soft); font-size: 13px; }
@media (max-width: 760px) { .cmd-search > span:first-of-type { display: none; } }

/* ---------- Administração: abas inline ---------- */
.adm-nav { display: flex; flex-wrap: wrap; gap: 6px; margin: 2px 0 18px; border-bottom: 1px solid var(--line); padding-bottom: 12px; }
.adm-tab { background: var(--hover); color: var(--text-dim); border: 1px solid transparent; padding: 8px 14px; border-radius: 9px;
  font-size: 13px; font-weight: 500; cursor: pointer; box-shadow: none; }
.adm-tab:hover { background: var(--hover); color: var(--text); filter: none; }
.adm-tab.on { background: var(--accent-soft); color: var(--accent); }
.adm-content .adm-pane.card { width: 100%; max-width: 660px; box-shadow: none; max-height: none; }
.pm-y { color: var(--green); font-weight: 600; }
.pm-n { color: var(--text-soft); }
.zsrc-row { display: flex; align-items: center; gap: 8px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.zsrc-info b { font-size: 14px; }
#zMsg { min-height: 16px; }

/* editor de planos (owner) */
.plan-head, .planRow { display: grid; grid-template-columns: 100px 1.3fr 82px 82px 1fr 60px auto; gap: 6px; align-items: center; }
.plan-head { font-size: 11px; letter-spacing: .04em; text-transform: uppercase; opacity: .55; margin: 8px 2px 2px; }
.planRow { margin: 5px 0; }
.planRow input { width: 100%; }
#planTable { max-height: 52vh; overflow: auto; }
