:root {
  --bg: #090b12;
  --panel: #10131c;
  --panel-2: #161a25;
  --panel-3: #1c212e;
  --border: #232838;
  --text: #e8eaf0;
  --muted: #8b93a7;
  --accent: #3b82f6;
  --accent-2: #22c55e;
  --danger: #ef4444;
  --warn: #f59e0b;
  --purple: #a855f7;
  --cyan: #06b6d4;
  --teal: #14b8a6;
  --radius: 0px;
  --shadow: 0 8px 24px rgba(0,0,0,.28);
  --shadow-lg: 0 20px 60px rgba(0,0,0,.45);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Poppins", system-ui, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background:
    radial-gradient(1200px 600px at 100% -10%, rgba(91,139,255,.08), transparent 60%),
    var(--bg);
  color: var(--text);
  min-height: 100vh;
  animation: page-fade-in .18s ease;
}
body.page-fade-out { animation: page-fade-out .12s ease forwards; }
@keyframes page-fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes page-fade-out { to { opacity: 0; } }

/* ---------- topbar ---------- */

.condo-chip {
  display: inline-flex; align-items: center; gap: 7px; max-width: 240px;
  padding: 6px 10px; font-size: 12.5px; font-weight: 600;
  background: rgba(59,130,246,.14); color: var(--accent); text-decoration: none;
  border: 1px solid rgba(59,130,246,.35);
  transition: background .15s ease, border-color .15s ease, transform .1s ease;
}
.condo-chip svg { flex: none; }
.condo-chip svg:first-child { width: 14px; height: 14px; }
.condo-chip-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.condo-chip-caret { width: 13px; height: 13px; opacity: .75; transition: transform .15s ease; }
a.condo-chip { cursor: pointer; }
a.condo-chip:hover { background: rgba(59,130,246,.24); border-color: rgba(59,130,246,.55); }
a.condo-chip:hover .condo-chip-caret { transform: translateY(1px); }
a.condo-chip:active { transform: scale(.97); }
a.condo-chip:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.topbar {
  display: flex;
  /* flex-start (não center) -- com o menu cheio, o bloco da direita (nav +
     user-box) pode quebrar em 2 linhas; centralizar a marca nessa altura
     toda a jogava pro vão entre as duas linhas, parecendo flutuar numa
     faixa própria. Alinhando pelo topo, ela fica colada na primeira linha
     (o menu), igual um cabeçalho normal. */
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  row-gap: 10px;
  padding: 14px 24px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
  flex-wrap: wrap;
}

.topbar .brand { display: flex; align-items: center; gap: 10px; flex: none; }
.topbar .brand img { width: 32px; height: 32px; display: block; flex: none; }
.topbar .brand-name { font-size: 16px; font-weight: 700; color: var(--text); white-space: nowrap; }
@media (max-width: 480px) { .topbar .brand-name { display: none; } }

/* flex-basis 0% (em vez de auto) -- sem isso o navegador calcula o tamanho
   "natural" do nav-group (todo o menu numa linha só, largo demais) pra
   decidir se ele cabe ao lado da marca, e como nunca cabe, joga a marca
   pra uma linha sozinha antes mesmo do menu tentar quebrar. Com base 0,
   o nav-group sempre disputa a linha da marca normalmente, e quem quebra
   por conta própria é só o conteúdo dele (nav, depois user-box). */
.topbar .nav-group { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; flex: 1 1 0%; min-width: 0; justify-content: flex-end; }

.topbar nav { display: flex; gap: 2px; flex-wrap: wrap; justify-content: flex-end; }
.topbar nav a svg { width: 15px; height: 15px; flex: none; }
.topbar nav a {
  display: flex; align-items: center; gap: 6px;
  color: var(--muted);
  text-decoration: none;
  padding: 8px 10px;
  border-radius: var(--radius);
  font-size: 13.5px;
  font-weight: 500;
  white-space: nowrap;
  transition: background .15s, color .15s;
}
.topbar nav a:hover { background: var(--panel-2); color: var(--text); }
.topbar nav a.active { background: var(--accent); color: white; }

/* ---------- "Mais": itens do menu que não couberam numa linha só ---------- */
.nav-more { position: relative; display: inline-flex; align-items: center; }
.nav-more-toggle {
  display: flex; align-items: center; gap: 5px;
  color: var(--muted); background: none; border: none; cursor: pointer;
  padding: 8px 10px; margin: 0; font-size: 13.5px; font-weight: 500;
  border-radius: var(--radius); white-space: nowrap; box-shadow: none;
  transition: background .15s, color .15s;
}
.nav-more-toggle:hover { background: var(--panel-2); color: var(--text); transform: none; box-shadow: none; }
.nav-more-toggle svg { width: 13px; height: 13px; flex: none; }
.nav-more-menu {
  display: none; position: absolute; left: 0; top: 100%; margin-top: 6px;
  background: var(--panel-3); border: 1px solid var(--border); min-width: 200px;
  box-shadow: var(--shadow-lg); z-index: 50; padding: 4px;
}
.nav-more-menu.open { display: block; }
.nav-more-menu a {
  display: flex; align-items: center; gap: 8px; padding: 9px 10px;
  color: var(--muted); text-decoration: none; font-size: 13.5px; font-weight: 500;
}
.nav-more-menu a svg { width: 15px; height: 15px; flex: none; }
.nav-more-menu a:hover { background: var(--panel-2); color: var(--text); }
.nav-more-menu a.active { background: var(--accent); color: #fff; }

/* ---------- sino de alertas ---------- */
.nav-bell { position: relative; display: inline-flex; align-items: center; }
.nav-bell-toggle {
  position: relative; display: flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; color: var(--muted); background: none; border: none; cursor: pointer;
  margin: 0; padding: 0; border-radius: var(--radius); box-shadow: none;
  transition: background .15s, color .15s;
}
.nav-bell-toggle:hover { background: var(--panel-2); color: var(--text); transform: none; box-shadow: none; }
.nav-bell-toggle svg { width: 16px; height: 16px; flex: none; }
.nav-bell-badge {
  position: absolute; top: 2px; right: 2px; min-width: 15px; height: 15px; padding: 0 3px;
  display: flex; align-items: center; justify-content: center;
  background: var(--danger); color: #fff; font-size: 10px; font-weight: 700; line-height: 1;
  border-radius: 999px; border: 2px solid var(--panel);
}
.nav-bell-menu {
  display: none; position: absolute; right: 0; top: 100%; margin-top: 6px;
  width: 320px; max-width: calc(100vw - 32px); background: var(--panel-3); border: 1px solid var(--border);
  box-shadow: var(--shadow-lg); z-index: 50;
}
.nav-bell-menu.open { display: block; }
.nav-bell-head {
  padding: 12px 14px; font-size: 12px; font-weight: 700; letter-spacing: .04em;
  color: var(--muted); text-transform: uppercase; border-bottom: 1px solid var(--border);
}
.nav-bell-list { max-height: 340px; overflow-y: auto; }
.nav-bell-item { display: flex; align-items: flex-start; gap: 10px; padding: 11px 14px; border-bottom: 1px solid var(--border); }
.nav-bell-item:last-child { border-bottom: none; }
.nav-bell-icon { width: 28px; height: 28px; flex: none; display: flex; align-items: center; justify-content: center; }
.nav-bell-icon svg { width: 14px; height: 14px; }
.nav-bell-icon.err { background: rgba(239,68,68,.16); color: var(--danger); }
.nav-bell-icon.warn { background: rgba(245,158,11,.16); color: var(--warn); }
.nav-bell-main { min-width: 0; flex: 1; }
.nav-bell-title { font-size: 13px; font-weight: 600; }
.nav-bell-sub { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.nav-bell-empty { padding: 22px 14px; text-align: center; color: var(--muted); font-size: 13px; }
.nav-bell-foot { display: flex; justify-content: center; padding: 8px; border-top: 1px solid var(--border); }
.nav-bell-foot a { font-size: 12.5px; font-weight: 600; color: var(--accent); text-decoration: none; padding: 6px 10px; }
.nav-bell-foot a:hover { text-decoration: underline; }

.topbar .user-box {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
  border-left: 1px solid var(--border);
  padding-left: 16px;
  flex: none;
  white-space: nowrap;
}

.link-btn {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
  padding: 6px 10px;
  border-radius: var(--radius);
  margin: 0;
}
.link-btn:hover { background: var(--panel-2); color: var(--text); transform: none; box-shadow: none; }

main { width: 100%; margin: 0 auto; padding: 24px; }

/* Styles for consolidated action menu */
.actions-menu {
  position: relative;
  display: inline-block;
  height: 24px;
}
.actions-menu-btn {
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 6px 12px;
  cursor: pointer;
  border-radius: 0;
  font-size: 18px;
  line-height: 1;
  transition: background 0.2s;
}
.actions-menu-btn:hover {
  background: var(--panel-3);
  border-color: var(--accent);
}
.actions-menu-content {
  display: none;
  position: absolute;
  right: 0;
  top: 100%;
  margin-top: 5px;
  background-color: var(--panel-3);
  min-width: 140px;
  box-shadow: var(--shadow-lg);
  z-index: 9999;
  border: 1px solid var(--border);
  border-radius: 0;
}
.actions-menu-content button {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  padding: 10px 12px;
  margin: 0;
  border: none;
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
}
.actions-menu-content button:hover {
  background: var(--panel-2);
  color: var(--accent);
}

/* ---------- sections & cards ---------- */

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin: 28px 0 14px;
}
.section-header:first-child { margin-top: 0; }
.section-header h2 {
  display: flex; align-items: center; gap: 9px;
  margin: 0; font-size: 18px; font-weight: 700;
}
.section-header h2 svg { width: 18px; height: 18px; flex: none; color: var(--accent); }
.section-header .actions { display: flex; gap: 10px; flex-wrap: wrap; }
.section-header .actions button { margin-top: 0; }

/* ---------- busca ---------- */

.filter-tabs { display: flex; gap: 6px; margin-bottom: 12px; flex-wrap: wrap; }
.filter-tabs button {
  margin-top: 0; padding: 7px 16px; font-size: 13px; font-weight: 600;
  background: var(--panel-2); border: 1px solid var(--border); color: var(--muted);
  box-shadow: none; border-radius: 0;
}
.filter-tabs button:hover { background: var(--panel-3); color: var(--text); transform: none; box-shadow: none; }
.filter-tabs button.active { background: var(--accent); border-color: var(--accent); color: #fff; }

.search-box { position: relative; width: 100%; margin-bottom: 14px; display: flex; gap: 10px; }
.search-box svg {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  width: 15px; height: 15px; color: var(--muted); pointer-events: none;
}
.search-box input {
  flex: 1;
  padding: 9px 14px 9px 38px;
  background: transparent;
  border: 1px solid var(--border);
}
.search-box select {
  width: auto;
  min-width: 180px;
  padding: 9px 14px;
  background: var(--panel-2);
  border: 1px solid var(--border);
}
.search-box input:focus { background: transparent; }

/* ---------- seletor de dias da semana (visitantes) ---------- */

.weekday-picker { display: flex; gap: 6px; flex-wrap: wrap; }
.weekday-picker button {
  flex: 1; min-width: 52px; margin-top: 0;
  padding: 8px 4px; font-size: 13px; font-weight: 600;
  background: var(--panel-2); border: 1px solid var(--border); color: var(--muted);
  box-shadow: none;
}
.weekday-picker button:hover { background: var(--panel-3); color: var(--text); transform: none; box-shadow: none; }
.weekday-picker button.on { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ---------- listas de seleção (envio de moradores) ---------- */

.pick-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 16px; margin-top: 14px; }
.pick-col { min-width: 0; }
.pick-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
.pick-count { font-size: 11.5px; font-weight: 600; color: var(--accent); margin-left: 4px; }
.bulk-summary { margin-top: 14px; }
.bulk-summary .field-hint { display: flex; align-items: center; gap: 6px; font-size: 12.5px; }
.bulk-summary .field-hint svg { width: 14px; height: 14px; color: var(--accent); flex: none; }
.bulk-summary .field-hint b { color: var(--text); }
.chk-inline {
  display: flex; align-items: center; gap: 6px; margin: 0;
  font-size: 12.5px; color: var(--text); cursor: pointer; white-space: nowrap;
}
.chk-inline input { width: auto; margin: 0; }

/* lista de permissões no cadastro de usuário -- quebra linha conforme o
   espaço, em vez de um checkbox por linha */
.chk-list {
  display: flex; flex-wrap: wrap; gap: 8px 18px;
  padding: 10px 12px; background: var(--panel-2); border: 1px solid var(--border);
  margin-top: 6px;
}

/* ---------- lista de telas que um porteiro pode ver (cadastro de usuário) ----------
   Duas colunas -- com 7+ telas, uma lista de uma coluna só fica comprida
   demais dentro do modal. */
.perm-list {
  margin-top: 6px; display: grid; grid-template-columns: 1fr 1fr; gap: 1px;
  border: 1px solid var(--border); background: var(--border); border-radius: var(--radius);
  overflow: hidden;
}
@media (max-width: 560px) {
  .perm-list { grid-template-columns: 1fr; }
}
.perm-row {
  display: flex; flex-direction: column; background: var(--panel-2);
}
.perm-row-full { grid-column: 1 / -1; }
.perm-row-head {
  display: flex; align-items: center; gap: 12px; margin: 0;
  padding: 10px 12px; cursor: pointer;
  transition: background .1s ease;
}
.perm-row-head:hover { background: var(--panel-3); }
.perm-row-icon {
  width: 30px; height: 30px; flex: none; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--panel-3); color: var(--muted);
}
.perm-row-icon svg { width: 15px; height: 15px; }
.perm-row-main { flex: 1; min-width: 0; }
.perm-row-title { font-size: 13.5px; font-weight: 600; }
.perm-row-desc { font-size: 12px; color: var(--muted); margin-top: 1px; }
.perm-row input[type="checkbox"] { width: 18px; height: 18px; flex: none; margin: 0; cursor: pointer; }

/* ---------- sub-permissões (ex: dentro de "Moradores": editar / enviar p/ facial) ---------- */
.perm-subrow {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 0;
  padding: 8px 14px 8px 54px; border-top: 1px solid var(--border);
  background: var(--panel); cursor: pointer; transition: background .1s ease;
}
.perm-subrow:hover { background: var(--panel-3); }
.perm-subrow.disabled { opacity: .45; cursor: not-allowed; }
.perm-subrow-text { display: flex; flex-direction: column; font-size: 12.5px; font-weight: 600; }
.perm-subrow-desc { font-size: 11px; font-weight: 400; color: var(--muted); margin-top: 1px; }
.perm-subrow input[type="checkbox"] { width: 16px; height: 16px; flex: none; margin: 0; cursor: pointer; }
.perm-subrow input[type="checkbox"]:disabled { cursor: not-allowed; }

.pick-list {
  /* altura fixa + scroll interno: a tela não cresce conforme o número de
     moradores, então funciona igual com 5 ou com 500 cadastrados */
  height: 230px; overflow-y: auto;
  border: 1px solid var(--border); background: var(--panel-2);
  border-radius: var(--radius);
}
.pick-item {
  display: flex; align-items: center; gap: 10px; margin: 0;
  padding: 9px 12px; border-bottom: 1px solid var(--border);
  font-size: 13px; color: var(--text); cursor: pointer;
  transition: background .1s ease;
}
.pick-item:last-child { border-bottom: none; }
.pick-item:hover { background: var(--panel-3); }
.pick-item input { width: auto; margin: 0; flex: none; }
.pick-item .pick-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pick-item .muted { font-size: 12px; flex: none; }
.pick-item.sem-foto { opacity: .55; cursor: not-allowed; }
.pick-device-icon {
  width: 26px; height: 26px; flex: none; border-radius: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--panel-3); color: var(--muted);
}
.pick-device-icon svg { width: 14px; height: 14px; }

@media (max-width: 760px) {
  .pick-grid { grid-template-columns: 1fr; }
}

/* ---------- catálogo de relatórios ---------- */

.report-catalog-card { padding: 8px; }
.report-row {
  display: flex; align-items: center; gap: 14px;
  padding: 13px 14px; border-bottom: 1px solid var(--border);
  cursor: pointer; border-radius: 0;
  transition: background .1s ease;
}
.report-row:last-child { border-bottom: none; }
.report-row:hover { background: var(--panel-2); }
.report-row.active { background: rgba(91,139,255,.1); }
.report-row.active .report-row-icon { background: var(--accent); color: #fff; }
.report-row-icon {
  width: 34px; height: 34px; flex: none; border-radius: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--panel-2); color: var(--muted);
}
.report-row-icon svg { width: 16px; height: 16px; }
.report-row-icon.blue { background: rgba(59,130,246,.16); color: var(--accent); }
.report-row-icon.green { background: rgba(34,197,94,.16); color: var(--accent-2); }
.report-row-icon.purple { background: rgba(168,85,247,.16); color: var(--purple); }
.report-row-icon.cyan { background: rgba(6,182,212,.16); color: var(--cyan); }
.report-row-icon.teal { background: rgba(20,184,166,.16); color: var(--teal); }
.report-row-icon.warn { background: rgba(245,158,11,.16); color: var(--warn); }
.report-row-icon.red { background: rgba(239,68,68,.16); color: var(--danger); }
.report-row-title { font-size: 13.5px; font-weight: 600; flex: none; min-width: 190px; }
.report-row-desc { flex: 1; min-width: 0; font-size: 12.5px; color: var(--muted); }
.report-row-count { flex: none; }
.report-row-chevron { flex: none; color: var(--muted); display: flex; }
.report-row-chevron svg { width: 16px; height: 16px; }

@media (max-width: 760px) {
  .report-row { flex-wrap: wrap; }
  .report-row-desc { flex-basis: 100%; margin-left: 48px; }
}

/* ---------- envio em massa ---------- */

.progress-bar {
  width: 100%; height: 8px; background: var(--panel-2);
  border: 1px solid var(--border); overflow: hidden;
}
.progress-fill {
  height: 100%; width: 0%; background: var(--accent);
  transition: width .25s ease;
}
.progress-label { font-size: 13px; color: var(--muted); margin: 10px 0; }

.bulk-log {
  max-height: 220px; overflow-y: auto;
  border: 1px solid var(--border); background: var(--panel-2);
  padding: 8px; font-size: 12.5px;
}
.bulk-line { padding: 3px 4px; }
.bulk-line.ok { color: var(--accent-2); }
.bulk-line.err { color: var(--danger); }

/* ---------- faixas de horário ---------- */

.span-row {
  border: 1px solid var(--border); background: var(--panel-2);
  padding: 12px; margin-bottom: 10px;
}
.span-times { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.span-times input[type="time"] { flex: 1; min-width: 0; }
.span-times .span-sep { color: var(--muted); font-size: 13px; flex: none; }
.span-times .span-remove { margin-top: 0; padding: 8px 12px; flex: none; line-height: 1; }
.span-days button { min-width: 42px; font-size: 12px; padding: 6px 2px; }

.device-group { margin-bottom: 24px; }
.device-group h3 {
  display: flex; align-items: center; gap: 7px;
  font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
  color: var(--muted); margin: 0 0 10px;
}
.device-group h3 svg { width: 14px; height: 14px; flex: none; }
.device-group h3 span { text-transform: none; letter-spacing: normal; font-weight: 500; }

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
}
.card.flat { padding: 0; overflow: hidden; }
.card.flat table { margin: 0; }

/* Tabela com scroll próprio: a página não cresce sem fim conforme o
   cadastro aumenta -- com 10 ou com 500 moradores a tela tem o mesmo
   tamanho. O cabeçalho fica fixo no topo enquanto rola. */
.card.flat.scrollable { max-height: 62vh; overflow-y: auto; }
.card.flat.scrollable thead th { position: sticky; top: 0; z-index: 2; }

h2 { font-size: 16px; margin-top: 0; }

/* ---------- forms ---------- */

label { display: block; font-size: 13px; color: var(--muted); margin: 10px 0 4px; font-weight: 500; }
label:first-child { margin-top: 0; }
input, select, textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
  /* sem isso os campos herdam a fonte do navegador (Arial/monoespacada) em
     vez da fonte do sistema usada no resto da tela */
  font-family: inherit;
  font-size: 14px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(91,139,255,.18); }
input::placeholder, textarea::placeholder { color: #5f6675; }

/* ---------- checkbox ---------- */

input[type="checkbox"] {
  appearance: none; -webkit-appearance: none;
  width: 18px; height: 18px; flex: none; padding: 0;
  border-radius: 0; border: 1.5px solid var(--border);
  background: var(--panel-2);
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: background .12s ease, border-color .12s ease;
}
input[type="checkbox"]:hover { border-color: var(--accent); }
input[type="checkbox"]:checked {
  background: var(--accent); border-color: var(--accent);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: center; background-size: 12px;
}
input[type="checkbox"]:disabled { opacity: .45; cursor: not-allowed; }
input[type="checkbox"]:focus-visible { box-shadow: 0 0 0 3px rgba(91,139,255,.28); }

/* display:block tira o espaco fantasma que o inline deixa embaixo, e
   resize:vertical impede arrastar na horizontal e estourar o modal */
textarea { line-height: 1.5; resize: vertical; display: block; }

.field-hint { font-size: 12px; color: var(--muted); margin-top: 4px; }

/* ---------- select pesquisável ---------- */

.ssel { position: relative; }
.ssel-native {
  position: absolute; top: 0; left: 0; width: 1px; height: 1px;
  opacity: 0; pointer-events: none;
}
.ssel-input { cursor: pointer; }
.ssel-panel {
  display: none; position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 40;
  max-height: 240px; overflow-y: auto;
  background: var(--panel-2); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
}
.ssel-panel.open { display: block; }
.ssel-item { padding: 9px 12px; font-size: 13.5px; cursor: pointer; }
.ssel-item:hover { background: var(--panel-3); }
.ssel-item.active { color: var(--accent); font-weight: 600; }
.ssel-item.disabled { opacity: .45; cursor: not-allowed; }
.ssel-empty { padding: 12px; font-size: 13px; color: var(--muted); text-align: center; }

/* ---------- buttons ---------- */

button {
  background: var(--accent);
  color: white;
  border: none;
  padding: 10px 18px;
  border-radius: var(--radius);
  font-size: 14px;
  cursor: pointer;
  margin-top: 12px;
  font-weight: 600;
  transition: opacity .15s ease, transform .08s ease, box-shadow .15s ease, background .15s ease;
}
button:hover { opacity: .94; transform: translateY(-1px); box-shadow: 0 6px 16px rgba(91,139,255,.25); }
button:active { transform: translateY(0) scale(.96); box-shadow: none; opacity: .85; }
button.secondary { background: var(--panel-2); border: 1px solid var(--border); color: var(--text); }
button.secondary:hover { box-shadow: 0 6px 16px rgba(0,0,0,.25); background: var(--panel-3); }
button.danger { background: var(--danger); }
button.danger:hover { box-shadow: 0 6px 16px rgba(239,91,91,.25); }
button.ghost { background: transparent; border: 1px solid var(--border); color: var(--muted); box-shadow: none; }
button.ghost:hover { background: var(--panel-2); color: var(--text); box-shadow: none; }
button:disabled { opacity: .45; cursor: not-allowed; transform: none; box-shadow: none; }
button.icon-btn { padding: 8px 12px; }
button.block { width: 100%; }

/* small icon-only round buttons for table rows */
/* O flex fica num div interno, nunca no proprio <td> -- display:flex tira a
   celula do layout de tabela e a borda dela para de acompanhar a altura da
   linha, o que deixa a linha divisoria quebrada/desalinhada. */
.row-actions > div { display: flex; gap: 6px; flex-wrap: wrap; }
.row-actions button { padding: 7px 12px; font-size: 13px; margin-top: 0; }

/* ---------- tables ---------- */

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 14px 16px; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; background: var(--panel-2); }
tbody tr { transition: background .12s ease; }
tbody tr:hover { background: var(--panel-2); }
tr:last-child td { border-bottom: none; }
.empty-row td { color: var(--muted); text-align: center; padding: 40px 20px; font-size: 14px; }
tr.clickable { cursor: pointer; }

/* Segunda linha da celula (previa da mensagem, e-mail do destinatario):
   corta com reticencias em vez de empurrar a coluna e desalinhar a tabela. */
td .trunc {
  max-width: 320px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  margin-top: 3px;
}

.avatar {
  width: 40px; height: 40px; border-radius: 0;
  object-fit: cover; background: var(--panel-3); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; font-weight: 700; color: var(--muted);
}
.avatar.tiny { width: 26px; height: 26px; font-size: 10px; }
.avatar.icon-avatar { background: var(--panel-3); color: var(--muted); }
.avatar.icon-avatar svg { width: 18px; height: 18px; }
.avatar.avatar-photo { padding: 0; overflow: hidden; }
.avatar.avatar-photo img { width: 100%; height: 100%; object-fit: cover; border-radius: 0; }

/* ---------- badges ---------- */

.badge {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 5px 12px; border-radius: 0; font-size: 12.5px; font-weight: 600; white-space: nowrap;
}
.badge::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: none; }
.badge.ok { background: rgba(55,201,142,.15); color: var(--accent-2); }
.badge.err { background: rgba(239,91,91,.15); color: var(--danger); }
.badge.pending { background: rgba(154,162,177,.15); color: var(--muted); }
.badge.warn { background: rgba(232,179,74,.15); color: var(--warn); }
.badge.live { background: rgba(55,201,142,.15); color: var(--accent-2); }
.badge.live::before { animation: pulse-dot 1.4s ease-in-out infinite; }
@keyframes pulse-dot { 0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(55,201,142,.5); } 50% { opacity: .6; box-shadow: 0 0 0 4px rgba(55,201,142,0); } }

/* ---------- detalhe do aviso de correspondencia ---------- */

.detail-value { margin: 0 0 16px; font-size: 14px; }
/* a mensagem preserva as quebras de linha que o porteiro digitou */
.detail-message { white-space: pre-wrap; color: var(--muted); }
.detail-status { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.detail-status-row { display: flex; align-items: center; gap: 10px; }

/* marca o campo que pode ficar em branco, pra nao precisar de texto de ajuda */
.label-opcional {
  text-transform: none; font-weight: 400; font-size: 11px;
  color: var(--muted); opacity: .75; margin-left: 6px;
}

/* ---------- destaque de campo principal vs. secundário num formulário ---------- */
label.label-principal {
  color: var(--text); font-weight: 700; font-size: 14px;
}
label.label-secundario {
  font-size: 12px; opacity: .8;
}

/* previa do texto que o morador vai receber -- e leitura, nao campo, entao
   nao pode parecer editavel */
.previa {
  margin: 0; padding: 10px 12px;
  background: var(--panel-3); border-left: 2px solid var(--accent);
  color: var(--muted); font-size: 13px; line-height: 1.5;
}

/* campo de codigo de barras + botao de camera lado a lado */
.barcode-row { display: flex; gap: 8px; align-items: flex-start; }
.barcode-row input { flex: 1; }
.barcode-row button { margin-top: 0; white-space: nowrap; }

/* codigo de barras/rastreio em fonte monoespacada -- fica mais facil de
   conferir digito a digito contra a etiqueta física */
.barcode-text { font-family: "Consolas", "SFMono-Regular", Menlo, monospace; letter-spacing: .02em; }

.live-feed {
  display: flex; flex-direction: column; gap: 10px;
  /* ocupa a tela e rola por dentro -- a página em si não cresce */
  height: 68vh; overflow-y: auto; padding-right: 4px;
}
.live-feed-item {
  display: flex; align-items: center; gap: 12px;
  background: var(--panel-2); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 12px 14px; animation: toast-in .25s ease;
}
.live-feed-item .avatar { width: 36px; height: 36px; font-size: 15px; flex: none; }
.live-feed-item .lf-main { flex: 1; min-width: 0; }
.live-feed-item .lf-title { font-weight: 600; font-size: 13.5px; }
.live-feed-item .lf-sub { color: var(--muted); font-size: 12px; margin-top: 2px; }
.live-feed-empty { color: var(--muted); font-size: 13px; text-align: center; padding: 30px 10px; }

.row { display: flex; gap: 20px; flex-wrap: wrap; }
.row > * { flex: 1; min-width: 260px; }

/* formulário de modal em duas colunas -- pra bater o olho e ver o
   cadastro quase inteiro de uma vez, sem rolar uma pilha de campos */
.form-cols-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 28px; margin-bottom: 6px; }
@media (max-width: 680px) {
  .form-cols-2 { grid-template-columns: 1fr; }
}

video, img.preview {
  width: 100%; max-width: 320px; border-radius: var(--radius);
  border: 1px solid var(--border); background: #000;
  object-fit: cover;
}

.msg { font-size: 13px; margin-top: 10px; min-height: 16px; }
.msg.ok { color: var(--accent-2); }
.msg.err { color: var(--danger); }
.muted { color: var(--muted); font-size: 13px; }

.actions-row { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- abas de captura de foto ---------- */

.capture-tabs {
  display: flex; gap: 4px; background: var(--panel-2);
  border: 1px solid var(--border); border-radius: var(--radius); padding: 4px; margin-bottom: 16px;
}
.capture-tab {
  flex: 1; margin: 0; padding: 8px 12px; font-size: 13px; font-weight: 600;
  background: transparent; color: var(--muted); box-shadow: none;
  border-radius: 0;
}
.capture-tab:hover { background: var(--panel-3); color: var(--text); transform: none; box-shadow: none; }
.capture-tab.active { background: var(--accent); color: white; }
.capture-tab.active:hover { background: var(--accent); opacity: .95; }

/* ---------- seletor visual de formato do veículo (moldes com desenho) ---------- */
.body-style-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 16px;
}
@media (max-width: 480px) { .body-style-grid { grid-template-columns: repeat(2, 1fr); } }
.body-style-btn {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  margin: 0; padding: 12px 6px; font-size: 12px; font-weight: 600;
  background: var(--panel-2); color: var(--muted); box-shadow: none;
  border: 1px solid var(--border); border-radius: var(--radius);
}
.body-style-btn .bs-icon { display: flex; }
.body-style-btn .bs-icon svg { width: 46px; height: 29px; }
.body-style-btn:hover { background: var(--panel-3); color: var(--text); transform: none; box-shadow: none; border-color: var(--border); }
.body-style-btn.active { background: rgba(59,130,246,.12); color: var(--accent); border-color: var(--accent); }

/* ---------- modal ---------- */

.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(6,8,12,.6);
  backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: opacity .18s ease, visibility 0s linear .18s;
  padding: 20px;
}
.modal-overlay.open {
  opacity: 1;
  visibility: visible;
  transition: opacity .18s ease, visibility 0s linear 0s;
}
.modal {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 0;
  overflow: hidden;
  width: 100%;
  max-width: 480px;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  transform: scale(.93) translateY(14px);
  transition: transform .2s cubic-bezier(.2,.9,.3,1.2);
}
.modal-overlay.open .modal { transform: scale(1) translateY(0); }
.modal.wide { max-width: 760px; }
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 22px; border-bottom: 1px solid var(--border); flex: none;
}
.modal-header h3 { margin: 0; font-size: 16px; display: flex; align-items: center; gap: 8px; }
.modal-close {
  background: none; border: none; color: var(--muted); font-size: 18px;
  cursor: pointer; padding: 6px 10px; margin: 0; border-radius: var(--radius); line-height: 1;
}
.modal-close:hover { background: var(--panel-2); color: var(--text); transform: none; box-shadow: none; }
.modal-body { padding: 22px; overflow-y: auto; }
.modal-body form > button:last-of-type,
.modal-body .modal-submit { width: 100%; }

/* ---------- modal de confirmação ---------- */

.confirm-modal { max-width: 420px; }
.confirm-modal .modal-body p {
  margin: 0 0 20px; font-size: 14px; line-height: 1.5; color: var(--text);
}
.confirm-actions { display: flex; gap: 10px; justify-content: flex-end; }
.confirm-actions button { margin-top: 0; min-width: 110px; }

@keyframes spin { to { transform: rotate(360deg); } }
.spinner {
  width: 34px; height: 34px; border-radius: 0;
  border: 3px solid var(--border); border-top-color: var(--accent);
  animation: spin .7s linear infinite;
  margin: 10px auto;
}
.scan-loading { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 30px 10px; text-align: center; }
.scan-subnet-row { display: flex; gap: 10px; align-items: flex-start; }
.scan-subnet-row input { margin: 0; }
.scan-subnet-row button { margin: 0; flex: none; }

.support-log-text {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 12.5px;
  line-height: 1.6;
  min-height: 320px;
  white-space: pre;
  overflow-x: auto;
}
#support-log-actions button { margin: 0; }

/* ---------- toast ---------- */

.toast-wrap {
  position: fixed; top: 20px; right: 20px; display: flex; flex-direction: column; gap: 10px;
  z-index: 2000; max-width: 340px;
}
.toast {
  background: var(--panel); border: 1px solid var(--border); border-left: 4px solid var(--accent);
  border-radius: var(--radius); padding: 13px 16px; font-size: 13.5px; box-shadow: var(--shadow-lg);
  animation: toast-in .22s cubic-bezier(.2,.9,.3,1.2);
}
.toast.ok { border-left-color: var(--accent-2); }
.toast.err { border-left-color: var(--danger); }
@keyframes toast-in { from { opacity: 0; transform: translateX(24px) scale(.97); } to { opacity: 1; transform: translateX(0) scale(1); } }
@keyframes toast-out { to { opacity: 0; transform: translateX(24px) scale(.97); } }

/* ---------- login page ---------- */

.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.login-card {
  width: 100%;
  max-width: 360px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 0;
  padding: 32px 28px;
  box-shadow: var(--shadow);
  animation: toast-in .25s ease;
}
.login-card .brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin-bottom: 22px;
}
.login-card .brand img { width: 48px; height: 48px; }
.login-card .brand h1 { font-size: 18px; margin: 0; text-align: center; }
.login-card .brand p { color: var(--muted); font-size: 13px; margin: 0; }
.login-card button { width: 100%; padding: 11px; font-size: 15px; }

@media (max-width: 720px) {
  .topbar { flex-direction: column; align-items: flex-start; gap: 10px; }
  .topbar .nav-group { width: 100%; justify-content: space-between; }
  main { padding: 16px; }
  th, td { padding: 10px; }
  .section-header { align-items: stretch; }
  .section-header .actions { width: 100%; }
  .section-header .actions button { flex: 1; }
}

/* ================================================================
   Componentes compartilhados de "página com painel" -- usados nas
   telas de listagem (Moradores, Veículos, Visitantes, Dispositivos,
   Horários, Usuários, Sistema) pra dar o mesmo visual do dashboard:
   cards de estatística no topo + coluna lateral com listas/ações.
   ================================================================ */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  display: flex; align-items: center; gap: 14px;
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px;
  text-decoration: none; color: inherit;
  transition: transform .12s ease, border-color .12s ease, background .12s ease;
}
a.stat-card { cursor: pointer; }
a.stat-card:hover { transform: translateY(-2px); border-color: var(--accent); background: var(--panel-2); }
.stat-icon {
  width: 46px; height: 46px; flex: none; border-radius: 0;
  display: flex; align-items: center; justify-content: center;
}
.stat-icon svg { width: 22px; height: 22px; }
.stat-icon.blue { background: rgba(59,130,246,.16); color: var(--accent); }
.stat-icon.green { background: rgba(34,197,94,.16); color: var(--accent-2); }
.stat-icon.purple { background: rgba(168,85,247,.16); color: var(--purple); }
.stat-icon.cyan { background: rgba(6,182,212,.16); color: var(--cyan); }
.stat-icon.teal { background: rgba(20,184,166,.16); color: var(--teal); }
.stat-icon.warn { background: rgba(245,158,11,.16); color: var(--warn); }
.stat-icon.red { background: rgba(239,68,68,.16); color: var(--danger); }
.stat-body { min-width: 0; }
.stat-label { font-size: 12.5px; color: var(--muted); }
.stat-value { font-size: 25px; font-weight: 700; line-height: 1.35; }
.stat-sub { font-size: 12px; color: var(--muted); }
.stat-sub.blue { color: var(--accent); }
.stat-sub.green { color: var(--accent-2); }
.stat-sub.red { color: var(--danger); }
.stat-sub a { color: var(--accent); text-decoration: none; }

.page-grid { display: grid; grid-template-columns: 1.7fr 1fr; gap: 20px; align-items: start; }
@media (max-width: 980px) { .page-grid { grid-template-columns: 1fr; } }

.side-card-header {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin-bottom: 12px;
}
.side-card-header h3 { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 14.5px; font-weight: 700; }
.side-card-header h3 svg { width: 16px; height: 16px; color: var(--accent); flex: none; }
.side-card-header a { color: var(--accent); text-decoration: none; font-size: 12.5px; font-weight: 600; }
.side-card-header a:hover { text-decoration: underline; }

.side-list { display: flex; flex-direction: column; }
.side-row {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 2px; border-bottom: 1px solid var(--border);
}
.side-row:last-child { border-bottom: none; }
.side-row .side-avatar {
  width: 34px; height: 34px; border-radius: 0; flex: none;
  display: flex; align-items: center; justify-content: center;
  background: var(--panel-3); color: var(--muted); font-size: 12px; font-weight: 700;
  object-fit: cover;
}
.side-row .side-main { flex: 1; min-width: 0; }
.side-row .side-title { font-size: 13px; font-weight: 600; }
.side-row .side-sub { font-size: 11.5px; color: var(--muted); margin-top: 1px; }
.side-row .side-end { flex: none; text-align: right; font-size: 11.5px; color: var(--muted); }
.side-row .side-chevron { flex: none; color: var(--muted); display: flex; }
.side-row .side-chevron svg { width: 14px; height: 14px; }

.quick-actions { display: flex; flex-direction: column; gap: 4px; }
.quick-actions a, .quick-actions button {
  display: flex; align-items: center; gap: 9px;
  padding: 10px 6px; margin: 0; background: none; border: none;
  color: var(--text); text-decoration: none; font-size: 13px; font-weight: 500;
  text-align: left; border-radius: var(--radius); box-shadow: none;
  transition: background .12s ease;
}
.quick-actions a:hover, .quick-actions button:hover { background: var(--panel-2); transform: none; box-shadow: none; }
.quick-actions svg { width: 15px; height: 15px; color: var(--accent); flex: none; }

.rule-list { margin: 0; padding-left: 18px; font-size: 12.5px; color: var(--muted); line-height: 1.9; }
.empty-mini { color: var(--muted); font-size: 13px; text-align: center; padding: 24px 10px; }

/* ---------- seções numeradas dentro de formulários (cadastros longos) ---------- */
.form-section-title {
  display: flex; align-items: center; gap: 10px;
  font-size: 14px; font-weight: 700; color: var(--text);
  margin: 22px 0 10px;
  padding-bottom: 8px; border-bottom: 1px solid var(--border);
}
.form-section-title:first-child { margin-top: 0; }
.form-section-num {
  width: 22px; height: 22px; flex: none; border-radius: 0;
  background: var(--accent); color: #fff; font-size: 12px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}

/* ---------- caixa de envio de arquivo (foto / documentos) ---------- */
.dropzone {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 6px; text-align: center;
  border: 1.5px dashed var(--border); border-radius: var(--radius);
  background: var(--panel-2); padding: 22px 14px; cursor: pointer;
  transition: border-color .15s ease, background .15s ease;
  min-height: 130px;
}
.dropzone:hover, .dropzone.drag-over { border-color: var(--accent); background: var(--panel-3); }
.dropzone svg { width: 26px; height: 26px; color: var(--muted); }
.dropzone .dz-text { font-size: 13px; color: var(--text); font-weight: 500; }
.dropzone .dz-hint { font-size: 11.5px; color: var(--muted); }
.dropzone.small { min-height: 96px; padding: 16px 10px; }
.dropzone.has-file { border-style: solid; border-color: var(--accent-2); }
.dropzone img.dz-preview {
  max-width: 100%; max-height: 110px; border-radius: 0;
  object-fit: cover; display: block;
}
.dropzone .dz-filename {
  font-size: 12.5px; color: var(--accent-2); font-weight: 600; word-break: break-all;
  display: flex; align-items: center; gap: 6px;
}
.dropzone .dz-filename svg { width: 15px; height: 15px; color: var(--accent-2); flex: none; }
.dropzone .dz-preview-wrap { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.dropzone .dz-change-hint { font-size: 11px; color: var(--muted); }
.dropzone .dz-file-actions { display: flex; align-items: center; justify-content: center; gap: 10px; margin-top: 4px; }
.dropzone .dz-view-link {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; font-weight: 600; color: var(--accent); text-decoration: none;
}
.dropzone .dz-view-link svg { width: 13px; height: 13px; }
.dropzone .dz-view-link:hover { text-decoration: underline; }

/* ---------- botões de ação diretos nas linhas de tabela (editar/apagar) ----------
   Estilo padrão do sistema inteiro: círculo, ícone bem visível. A cor da borda
   já entrega o que o botão faz sem precisar ler o tooltip -- neutro (editar/
   ações comuns), verde (ações "positivas", tipo liberar acesso) e vermelho
   (excluir/remover), sempre com o mesmo desenho. */
.icon-action-btn {
  width: 44px; height: 44px; flex: none; margin: 0; padding: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--panel-2); border: 1.5px solid var(--border); border-radius: 50%;
  color: var(--muted); box-shadow: none; text-decoration: none; cursor: pointer;
  transition: background .12s ease, border-color .12s ease, color .12s ease;
}
.icon-action-btn[disabled] { opacity: .4; cursor: not-allowed; }
.icon-action-btn svg { width: 22px; height: 22px; }
.icon-action-btn:hover { background: var(--panel-3); color: var(--text); border-color: var(--text); transform: none; box-shadow: none; }
.icon-action-btn.edit { color: var(--warn); border-color: var(--warn); }
.icon-action-btn.edit:hover { background: rgba(245,158,11,.12); color: var(--warn); border-color: var(--warn); }
.icon-action-btn.remove { color: var(--danger); border-color: var(--danger); }
.icon-action-btn.remove:hover { background: rgba(239,68,68,.12); border-color: var(--danger); color: var(--danger); }
.icon-action-btn.chat { color: var(--accent-2); border-color: var(--accent-2); }
.icon-action-btn.chat:hover { background: rgba(34,197,94,.12); border-color: var(--accent-2); color: var(--accent-2); }
.icon-action-btn.toggle-on { color: var(--accent); border-color: var(--accent); }
.icon-action-btn.toggle-on:hover { background: rgba(59,130,246,.12); border-color: var(--accent); color: var(--accent); }

/* ---------- barra de rolagem (fina e escura, em vez da branca padrão do navegador) ---------- */
* { scrollbar-width: thin; scrollbar-color: var(--panel-3) transparent; }
*::-webkit-scrollbar { width: 9px; height: 9px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: var(--panel-3); border-radius: 0; border: 2px solid transparent; background-clip: padding-box; }
*::-webkit-scrollbar-thumb:hover { background: var(--border); background-clip: padding-box; }

/* ---------- painel de webcam inline (dentro do próprio formulário) ---------- */
.webcam-inline-panel {
  margin-top: 10px; padding: 12px; background: var(--panel-2);
  border: 1px solid var(--border); border-radius: var(--radius);
}
.webcam-inline-panel video {
  width: 100%; max-width: 100%; border-radius: 0;
  background: #000; display: block; margin-bottom: 10px;
}
.btn-webcam-toggle { display: flex; align-items: center; gap: 7px; }
.btn-webcam-toggle svg { width: 14px; height: 14px; }

/* ---------- tela de monitoramento (grade de até 4 câmeras) ---------- */
.monitor-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 14px;
}
@media (max-width: 900px) { .monitor-grid { grid-template-columns: 1fr; } }
/* só 1 câmera cadastrada: 1 quadro só, sem esticar de ponta a ponta da tela */
.monitor-grid.single { grid-template-columns: 1fr; max-width: 720px; }

.monitor-cell {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; display: flex; flex-direction: column;
}
.monitor-cell-head {
  display: flex; align-items: center; gap: 8px; padding: 8px 10px;
  border-bottom: 1px solid var(--border); background: var(--panel-2);
}
.monitor-cell-head select { flex: 1; min-width: 0; margin: 0; }
.monitor-cell-status { flex: none; }
.monitor-cell-remove {
  flex: none; display: flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; padding: 0; margin: 0; background: none; border: none;
  color: var(--muted); cursor: pointer; box-shadow: none;
}
.monitor-cell-remove svg { width: 16px; height: 16px; }
.monitor-cell-remove:hover { color: var(--danger); background: rgba(239,91,91,.12); transform: none; box-shadow: none; }

.monitor-cell-body {
  position: relative; aspect-ratio: 16 / 9; background: #0a0c10;
}
.monitor-cell-stream {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.monitor-cell-stream img { width: 100%; height: 100%; object-fit: contain; display: block; }

.monitor-cell-body.is-empty { cursor: pointer; }
.monitor-cell-body.is-empty:hover .monitor-cell-empty { color: var(--text); }
.monitor-cell-body.is-empty:hover .monitor-cell-empty svg { color: var(--accent); }
.monitor-cell-empty {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  color: var(--muted); font-size: 13px; text-align: center; padding: 20px;
  transition: color .15s ease;
}
.monitor-cell-empty svg { width: 30px; height: 30px; color: var(--muted); transition: color .15s ease; }
.monitor-empty-hint { font-size: 12px; color: var(--muted); }
.monitor-empty-link {
  display: inline-flex; align-items: center; gap: 4px; margin-top: 4px;
  color: var(--accent); font-size: 12.5px; font-weight: 600; text-decoration: none;
}
.monitor-empty-link:hover { text-decoration: underline; }
.monitor-empty-link svg { width: 14px; height: 14px; color: inherit; }

.monitor-cell-offline {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  flex-direction: column; gap: 6px; color: var(--danger); background: rgba(10,12,16,.85); font-size: 13px;
}

.monitor-cell-expand {
  position: absolute; right: 8px; bottom: 8px; z-index: 2;
  display: flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; padding: 0; margin: 0;
  background: rgba(0,0,0,.5); border: 1px solid rgba(255,255,255,.18); color: #fff;
  opacity: 0; transition: opacity .15s ease; cursor: pointer; box-shadow: none;
}
.monitor-cell-expand svg { width: 15px; height: 15px; }
.monitor-cell-expand:hover { background: rgba(0,0,0,.7); transform: none; box-shadow: none; }
.monitor-cell-body:hover .monitor-cell-expand,
.monitor-cell-expand:focus-visible { opacity: 1; }
@media (hover: none) { .monitor-cell-expand { opacity: .7; } }

.monitor-cell:fullscreen { background: #000; }
.monitor-cell:fullscreen .monitor-cell-body { flex: 1; aspect-ratio: auto; }
.monitor-cell:fullscreen .monitor-cell-expand { opacity: .7; }

/* ---------- modo parede: só a grade das câmeras, sem nenhuma outra borda/chrome ---------- */
.wall-fullscreen-btn {
  display: none;
}
body.wall-mode {
  overflow: hidden;
}
body.wall-mode .topbar,
body.wall-mode .section-header,
body.wall-mode #monitor-hint {
  display: none !important;
}
body.wall-mode main {
  padding: 0; margin: 0; max-width: none; height: 100vh;
}
body.wall-mode .monitor-grid {
  height: 100vh; width: 100vw; gap: 0;
}
body.wall-mode .monitor-cell {
  border: none; border-radius: 0; height: 100%;
}
body.wall-mode .monitor-cell-head {
  display: none;
}
body.wall-mode .monitor-cell-body {
  height: 100%; aspect-ratio: auto;
}
body.wall-mode .monitor-cell-body img {
  object-fit: cover;
}
body.wall-mode .wall-fullscreen-btn {
  display: flex; align-items: center; justify-content: center;
  position: fixed; right: 10px; bottom: 10px; z-index: 50;
  width: 34px; height: 34px; border-radius: 0; border: 1px solid rgba(255,255,255,.25);
  background: rgba(0,0,0,.35); color: #fff; opacity: .25; cursor: pointer; transition: opacity .15s;
}
body.wall-mode .wall-fullscreen-btn:hover { opacity: 1; }
body.wall-mode .wall-fullscreen-btn::before {
  content: '⛶'; font-size: 18px; line-height: 1;
}
