/* =====================================================================
   Acesso Condomínio — estilos do painel (sem frameworks, compatível com CSP)
   ===================================================================== */
/* Temas (Meu perfil › Aparência): <html data-theme="oceano|indigo|grafite|personalizado" data-mode="auto|claro|escuro">.
   "Oceano" é o padrão. "Personalizado" vem de /perfil/tema (cores escolhidas pelo usuário). */
:root {
    --primary: #0f4c5c;
    --primary-600: #136072;
    --accent: #0e7490;
    --accent-contrast: #ffffff;
    --sidebar: #082f3a;
    --sidebar-text: #c6dade;
    --sidebar-strong: #ffffff;
    --sidebar-muted: #6f97a3;
    --sidebar-hover: rgba(255, 255, 255, .07);
    --sidebar-line: rgba(255, 255, 255, .09);
    --bg: #f3f5f9;
    --surface: #ffffff;
    --surface-2: #f8fafc;
    --border: #e2e8f0;
    --text: #1f2937;
    --muted: #64748b;
    --success: #16a34a;
    --success-bg: #dcfce7;
    --warning: #b45309;
    --warning-bg: #fef3c7;
    --danger: #dc2626;
    --danger-bg: #fee2e2;
    --info: #0369a1;
    --info-bg: #e0f2fe;
    --radius: 10px;
    --shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 4px 12px rgba(15, 23, 42, .04);
    --sidebar-w: 256px;
    color-scheme: light;
}
:root[data-theme="indigo"] {
    --primary: #3730a3; --primary-600: #4338ca; --accent: #4f46e5;
    --sidebar: #1e1b4b; --sidebar-text: #d4d4f7; --sidebar-muted: #8f8fd0;
}
:root[data-theme="grafite"] {
    --primary: #3f3f46; --primary-600: #52525b; --accent: #ea580c;
    --sidebar: #18181b; --sidebar-text: #d4d4d8; --sidebar-muted: #8b8b94;
}

/* Modo escuro: automático (aparelho) a não ser que o usuário escolha "Claro"; ou forçado com "Escuro" */
@media (prefers-color-scheme: dark) {
    :root:not([data-mode="claro"]) {
        --bg: #0b1220;
        --surface: #111a2b;
        --surface-2: #0f1727;
        --border: #1f2a3d;
        --text: #e5e7eb;
        --muted: #94a3b8;
        --success-bg: #12301f;
        --warning-bg: #3a2a0c;
        --danger-bg: #3b1515;
        color-scheme: dark;
    }
}
:root[data-mode="escuro"] {
    --bg: #0b1220;
    --surface: #111a2b;
    --surface-2: #0f1727;
    --border: #1f2a3d;
    --text: #e5e7eb;
    --muted: #94a3b8;
    --success-bg: #12301f;
    --warning-bg: #3a2a0c;
    --danger-bg: #3b1515;
    color-scheme: dark;
}

/* Cor de "informação"/destaque (nome do condomínio no topo, avisos, selos, seleção…) sai da cor
   principal do TEMA — nada fica azul fixo. Navegador antigo sem color-mix usa o azul acima. */
@supports (color: color-mix(in srgb, red 50%, blue)) {
    :root {
        --info: color-mix(in srgb, var(--accent) 80%, #000);
        --info-bg: color-mix(in srgb, var(--accent) 12%, var(--surface));
        --accent-soft: color-mix(in srgb, var(--accent) 35%, var(--surface));
    }
    @media (prefers-color-scheme: dark) {
        :root:not([data-mode="claro"]) {
            --info: color-mix(in srgb, var(--accent) 65%, #fff);
            --info-bg: color-mix(in srgb, var(--accent) 22%, var(--surface));
        }
    }
    :root[data-mode="escuro"] {
        --info: color-mix(in srgb, var(--accent) 65%, #fff);
        --info-bg: color-mix(in srgb, var(--accent) 22%, var(--surface));
    }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 15px;
    line-height: 1.5;
    color: var(--text);
    background: var(--bg);
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.5rem; margin: 0; }
h2 { font-size: 1.05rem; }
code { font-size: .82em; background: var(--surface-2); border: 1px solid var(--border); padding: 1px 5px; border-radius: 4px; }
img { max-width: 100%; }
[hidden] { display: none !important; }

.icon { width: 20px; height: 20px; flex-shrink: 0; }
.icon-sm { width: 16px; height: 16px; }
.icon-lg { width: 40px; height: 40px; }
.icon-xl { width: 64px; height: 64px; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.center { text-align: center; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.text-success { color: var(--success); }
.inline { display: inline; margin: 0; }

.skip-link { position: absolute; left: -999px; top: 0; background: var(--primary); color: #fff; padding: 8px 12px; z-index: 100; }
.skip-link:focus { left: 8px; }

/* ---------- Layout ---------- */
.layout { display: flex; min-height: 100vh; }
.sidebar {
    width: var(--sidebar-w);
    background: var(--sidebar);
    color: var(--sidebar-text);
    position: fixed; inset: 0 auto 0 0;
    display: flex; flex-direction: column;
    z-index: 40;
    transition: transform .2s ease;
}
.sidebar-brand { display: flex; align-items: center; gap: 12px; padding: 20px 18px; border-bottom: 1px solid var(--sidebar-line); }
.brand-logo { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; background: linear-gradient(135deg, var(--accent), var(--primary)); color: #fff; }
.brand-logo-lg { width: 64px; height: 64px; border-radius: 16px; margin: 0 auto 12px; }
.brand-logo-lg .icon { width: 36px; height: 36px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-text strong { color: var(--sidebar-strong); font-size: .98rem; }
.brand-text small { color: var(--sidebar-muted); font-size: .75rem; }
.sidebar-nav { flex: 1; overflow-y: auto; padding: 12px 10px; overscroll-behavior: contain; }
/* Barra de rolagem do menu: fina, discreta, no tom do menu (aparece mais forte ao passar o mouse) */
.sidebar-nav { scrollbar-width: thin; scrollbar-color: var(--sidebar-line) transparent; }
.sidebar-nav:hover { scrollbar-color: var(--sidebar-muted) transparent; }
.sidebar-nav::-webkit-scrollbar { width: 6px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.sidebar-nav::-webkit-scrollbar-thumb { background: var(--sidebar-line); border-radius: 999px; }
.sidebar-nav:hover::-webkit-scrollbar-thumb { background: var(--sidebar-muted); }
.sidebar-nav::-webkit-scrollbar-thumb:hover { background: var(--sidebar-text); }
.nav-section { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: var(--sidebar-muted); padding: 16px 10px 6px; }
.nav-link {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 12px; margin: 2px 0;
    border-radius: 8px; color: var(--sidebar-text);
    font-size: .92rem; width: 100%;
    background: none; border: 0; cursor: pointer; text-align: left; font-family: inherit;
}
.nav-link:hover { background: var(--sidebar-hover); color: var(--sidebar-strong); text-decoration: none; }
.nav-link.active { background: var(--accent); color: var(--accent-contrast); }
.sidebar-foot { padding: 10px; border-top: 1px solid var(--sidebar-line); }

.main { flex: 1; margin-left: var(--sidebar-w); display: flex; flex-direction: column; min-width: 0; transition: margin-left .2s ease; }
/* Desktop: menu recolhido */
body.sidebar-collapsed .sidebar { transform: translateX(-100%); }
body.sidebar-collapsed .main { margin-left: 0; }
.topbar {
    position: sticky; top: 0; z-index: 30;
    display: flex; align-items: center; gap: 12px;
    padding: 10px 24px; padding-top: max(10px, env(safe-area-inset-top));
    background: var(--surface); border-bottom: 1px solid var(--border);
}
.topbar-context { flex: 1; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-width: 0; }
.context-chip { display: inline-flex; align-items: center; gap: 6px; background: var(--info-bg); color: var(--info); padding: 4px 10px; border-radius: 999px; font-size: .85rem; font-weight: 600; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.icon-btn { background: none; border: 1px solid var(--border); border-radius: 8px; padding: 6px; color: var(--text); cursor: pointer; display: inline-grid; place-items: center; }

.user-menu { position: relative; }
.user-menu summary { list-style: none; display: flex; align-items: center; gap: 10px; cursor: pointer; padding: 4px 6px; border-radius: 8px; }
.user-menu summary::-webkit-details-marker { display: none; }
.user-menu summary:hover { background: var(--surface-2); }
.user-meta { display: flex; flex-direction: column; line-height: 1.2; }
.user-meta small { color: var(--muted); font-size: .78rem; }
.user-dropdown { position: absolute; right: 0; top: calc(100% + 6px); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); min-width: 190px; padding: 6px; z-index: 50; }
.user-dropdown a, .user-dropdown button { display: flex; align-items: center; gap: 8px; width: 100%; padding: 8px 10px; border-radius: 6px; color: var(--text); background: none; border: 0; font: inherit; cursor: pointer; text-align: left; }
.user-dropdown a:hover, .user-dropdown button:hover { background: var(--surface-2); text-decoration: none; }

.avatar { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: var(--primary); color: #fff; font-weight: 700; flex-shrink: 0; }
.avatar-muted { background: var(--border); color: var(--muted); width: 40px; height: 40px; }
.avatar-lg { width: 72px; height: 72px; font-size: 1.6rem; }
.thumb { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; display: block; }

.content { flex: 1; padding: 24px; width: 100%; } /* ocupa toda a largura (com ou sem o menu lateral) */
.footer { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 16px 24px; color: var(--muted); font-size: .8rem; }
.footer-status.offline { color: var(--danger); font-weight: 600; }
.backdrop { display: none; }

/* ---------- Componentes ---------- */
.page-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-header p { margin: 4px 0 0; }
.header-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.back-link { display: inline-flex; align-items: center; gap: 4px; font-size: .85rem; margin-bottom: 6px; color: var(--muted); }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; margin-bottom: 20px; }
.card-title { margin: 0 0 14px; display: flex; align-items: center; gap: 8px; }
.card-title:not(:first-child) { margin-top: 24px; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 20px; }
.grid-2 > .card { margin-bottom: 0; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--primary); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.stat strong { display: block; font-size: 1.8rem; line-height: 1.2; }
.stat .stat-text { font-size: 1.15rem; }
.stat-label { color: var(--muted); font-size: .8rem; }
.stat-success { border-left-color: var(--success); }
.stat-warning { border-left-color: #f59e0b; }
.stat-danger { border-left-color: var(--danger); }
.stat-info { border-left-color: var(--accent); }
.quick-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 20px; }

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 9px 16px; border-radius: 8px; border: 1px solid transparent;
    font: inherit; font-weight: 600; font-size: .9rem; cursor: pointer;
    text-decoration: none; white-space: nowrap; line-height: 1.2;
    min-height: 40px; /* mesma altura dos campos */
}
.btn:hover { text-decoration: none; filter: brightness(1.05); }
.btn:focus-visible, .nav-link:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid rgba(47,128,237,.45); outline-color: color-mix(in srgb, var(--accent) 45%, transparent); outline-offset: 1px; }
.btn-primary { background: var(--accent); color: var(--accent-contrast); }
.btn-ghost { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-warning { background: var(--warning-bg); color: var(--warning); border-color: #fcd34d; }
.btn-danger-ghost { background: var(--surface); color: var(--danger); border-color: var(--border); }
.btn-danger-ghost:hover { background: var(--danger-bg); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { filter: brightness(.95); }
.btn-sm { padding: 6px 10px; font-size: .82rem; min-height: 32px; }
.btn-block { width: 100%; }

.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: .75rem; font-weight: 600; background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); }
.badge-success { background: var(--success-bg); color: var(--success); border-color: transparent; }
.badge-warning { background: var(--warning-bg); color: var(--warning); border-color: transparent; }
.badge-danger { background: var(--danger-bg); color: var(--danger); border-color: transparent; }
.badge-info { background: var(--info-bg); color: var(--info); border-color: transparent; }

.alert { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 12px 14px; border-radius: 8px; margin-bottom: 12px; border: 1px solid transparent; }
/* alerta que começa com ícone: texto corrido (em flex, cada trecho com <strong> virava uma coluna no celular) */
.alert:has(> svg.icon:first-child) { display: block; }
.alert > svg.icon:first-child { vertical-align: -3px; margin-right: 4px; }
.alert-success { background: var(--success-bg); color: var(--success); }
.alert-error { background: var(--danger-bg); color: var(--danger); }
.alert-warning { background: var(--warning-bg); color: var(--warning); }
.alert-info { background: var(--info-bg); color: var(--info); }
.alert-close { background: none; border: 0; color: inherit; cursor: pointer; padding: 0; }
.flash-stack { margin-bottom: 8px; }

/* ---------- Tabelas ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--surface-2); }
.table-compact td { padding: 8px 10px; font-size: .88rem; }
.table th.right { text-align: right; }
/* Celular: cada linha da tabela vira um cartão (rótulo: valor), sem rolar para o lado. Rótulos vêm do
   cabeçalho (app.js coloca data-label nas células). */
@media (max-width: 640px) {
    .table.table-stack thead { display: none; }
    .table.table-stack, .table.table-stack tbody, .table.table-stack tr, .table.table-stack td { display: block; width: 100%; }
    .table.table-stack tr { border: 1px solid var(--border); border-radius: 10px; padding: 6px 12px; margin-bottom: 10px; background: var(--surface); }
    .table.table-stack tbody tr:hover { background: var(--surface); }
    .table.table-stack td { border: 0; padding: 6px 0; display: flex; gap: 12px; justify-content: space-between; align-items: flex-start; text-align: right; overflow-wrap: anywhere; white-space: normal; min-width: 0; }
    .table.table-stack td > * { min-width: 0; }
    .table.table-stack td.nowrap { flex-wrap: wrap; justify-content: flex-end; }
    .table.table-stack td.nowrap::before { flex-basis: 100%; }
    .table.table-stack td::before { content: attr(data-label); flex: 0 0 38%; text-align: left; font-size: .76rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
    .table.table-stack td[data-label=""]::before, .table.table-stack td:not([data-label])::before, .table.table-stack td.actions::before { display: none; }
    .table.table-stack td[data-label=""], .table.table-stack td:not([data-label]) { justify-content: flex-start; text-align: left; }
    .table.table-stack td.actions { justify-content: flex-end; flex-wrap: wrap; border-top: 1px solid var(--border); margin-top: 4px; padding-top: 8px; }
    .table.table-stack td.avatar-cell { width: 100%; min-width: 0; }
    .table.table-stack td[colspan] { justify-content: center; }
    /* Célula com duas linhas (nome<br><small>detalhe</small>): no cartão as linhas ficavam lado a lado e
       espremidas; aqui o rótulo fica à esquerda e as linhas, uma embaixo da outra, à direita. */
    .table.table-stack td[data-label]:not([data-label=""]):not(.actions):has(> br) { display: grid; grid-template-columns: 38% minmax(0, 1fr); column-gap: 12px; row-gap: 2px; justify-items: end; align-items: start; }
    .table.table-stack td[data-label]:not([data-label=""]):not(.actions):has(> br)::before { grid-column: 1; grid-row: 1 / span 4; justify-self: start; }
    .table.table-stack td[data-label]:not([data-label=""]):not(.actions):has(> br) > * { grid-column: 2; }
    .table.table-stack td:has(> br) > br { display: none; }
    .table-wrap:has(.table-stack) { overflow-x: visible; }
}
.actions { text-align: right; white-space: nowrap; }
.actions > * { margin-left: 4px; }
.avatar-cell { width: 52px; }
.details-cell { max-width: 320px; word-break: break-word; }

.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; padding: 14px; }
.filters input[type="search"] { flex: 1 1 220px; }
.inline-field { display: inline-flex; align-items: center; gap: 6px; font-size: .85rem; color: var(--muted); }

.pagination { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 14px; flex-wrap: wrap; font-size: .85rem; }
.pages { display: flex; gap: 4px; }
.pages a { padding: 5px 11px; border: 1px solid var(--border); border-radius: 6px; color: var(--text); }
.pages a.current { background: var(--accent); color: #fff; border-color: var(--accent); }
.pages a:hover:not(.current) { background: var(--surface-2); text-decoration: none; }
.pages-gap { padding: 5px 4px; color: var(--muted); }
.per-page select { width: auto; min-height: 32px; padding: 4px 8px; }

.empty { text-align: center; padding: 36px 12px; color: var(--muted); }
.empty p { margin: 8px 0 0; }

/* ---------- Formulários ---------- */
.form-grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 0 16px; }
.form-grid > * { grid-column: span 12; }
.col-2 { grid-column: span 2 !important; }
.col-3 { grid-column: span 3 !important; }
.col-4 { grid-column: span 4 !important; }
.col-6 { grid-column: span 6 !important; }
.col-8 { grid-column: span 8 !important; }
.col-12 { grid-column: span 12 !important; }
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; }
.field label, .field .label { font-weight: 600; font-size: .86rem; }
.req { color: var(--danger); }
input[type="text"], input[type="email"], input[type="password"], input[type="number"], input[type="date"],
input[type="datetime-local"], input[type="time"], input[type="month"], input[type="url"],
input[type="search"], input[type="tel"], input:not([type]), select, textarea {
    width: 100%; padding: 9px 12px; border: 1px solid var(--border); border-radius: 8px;
    background: var(--surface); color: var(--text); font: inherit; font-size: .92rem; min-height: 40px;
}
/* Padrão visual: TODO campo de uma linha tem exatamente 40px (texto, select, data, hora, busca) — campos lado a lado
   ficam alinhados e com a mesma altura dos botões (.btn = 40px; .btn-sm = 32px). */
input[type="text"], input[type="email"], input[type="password"], input[type="number"], input[type="date"],
input[type="datetime-local"], input[type="time"], input[type="month"], input[type="url"],
input[type="search"], input[type="tel"], input:not([type]), select:not([multiple]) { height: 40px; line-height: 1.25; padding-top: 0; padding-bottom: 0; }
textarea { line-height: 1.45; }
input[type="time"], input[type="date"], input[type="datetime-local"] { line-height: 1.2; }
/* hora 24 h (app.js troca o campo nativo, que mostraria AM/PM em navegador em inglês) */
.time-24 { font-variant-numeric: tabular-nums; letter-spacing: .02em; }
.datetime-24 { display: grid; grid-template-columns: minmax(0, 1fr) 96px; gap: 8px; }
/* data DD/MM/AAAA + botão do calendário (o campo nativo fica escondido só para abrir o calendário) */
.date-br { position: relative; display: flex; align-items: stretch; min-width: 0; }
.date-br .date-br-text { flex: 1 1 auto; min-width: 0; padding-right: 40px; font-variant-numeric: tabular-nums; }
.date-br-btn { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); background: none; border: 0; color: var(--muted); padding: 6px; cursor: pointer; display: grid; place-items: center; border-radius: 6px; }
.date-br-btn:hover { color: var(--accent); background: var(--surface-2); }
.date-br-native { position: absolute; left: 0; bottom: 0; width: 1px; height: 1px; opacity: 0; pointer-events: none; border: 0; padding: 0; }
.inline-field .date-br { width: 150px; }
input::-webkit-calendar-picker-indicator { cursor: pointer; opacity: .6; }
input::-webkit-calendar-picker-indicator:hover { opacity: 1; }
.filters input, .filters select { width: auto; }
textarea { resize: vertical; min-height: 0; }
/* Escolher arquivo: botão no mesmo padrão dos botões do sistema */
input[type="file"] { font: inherit; font-size: .86rem; color: var(--muted); max-width: 100%; }
input[type="file"]::file-selector-button {
    margin-right: 12px; padding: 8px 14px; border: 1px solid var(--border); border-radius: 8px;
    background: var(--surface); color: var(--text); font: inherit; font-weight: 600; font-size: .86rem; cursor: pointer;
}
input[type="file"]::-webkit-file-upload-button {
    margin-right: 12px; padding: 8px 14px; border: 1px solid var(--border); border-radius: 8px;
    background: var(--surface); color: var(--text); font: inherit; font-weight: 600; font-size: .86rem; cursor: pointer;
}
input[type="file"]:hover::file-selector-button { background: var(--surface-2); border-color: var(--accent); color: var(--accent); }
input[type="file"]:focus-visible { outline: 3px solid rgba(47,128,237,.45); outline-color: color-mix(in srgb, var(--accent) 45%, transparent); outline-offset: 2px; border-radius: 8px; }
.file-box { display: flex; align-items: center; flex: 1 1 320px; padding: 8px; border: 1px dashed var(--border); border-radius: 8px; background: var(--surface-2); }
.file-box input[type="file"] { width: 100%; }
/* dentro de um campo em coluna o "320px" virava ALTURA (caixa enorme e vazia no Mapa) */
.field > .file-box { flex: 0 0 auto; }
.has-error input, .has-error select, .has-error textarea { border-color: var(--danger); }
.error { color: var(--danger); font-size: .8rem; }
.hint { color: var(--muted); font-size: .8rem; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 500; font-size: .9rem; margin: 6px 0; cursor: pointer; }
.check input { width: 16px; height: 16px; }
.check.disabled { opacity: .5; cursor: not-allowed; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; padding-top: 12px; border-top: 1px solid var(--border); margin-top: 8px; }
.form > .card:last-of-type { margin-bottom: 12px; }

.photo-side { width: 200px; display: flex; flex-direction: column; gap: 8px; }
.photo-preview { width: 200px; height: 200px; border-radius: 12px; background: var(--surface-2); border: 1px dashed var(--border); display: grid; place-items: center; overflow: hidden; color: var(--muted); }
.photo-preview img { width: 100%; height: 100%; object-fit: cover; }

.segmented { display: flex; gap: 8px; flex-wrap: wrap; }
.segmented label { display: flex; align-items: center; gap: 6px; padding: 8px 12px; border: 1px solid var(--border); border-radius: 8px; cursor: pointer; font-weight: 500; }
.segmented label:has(input:checked) { border-color: var(--accent); background: var(--info-bg); }

/* Abas (operadores) */
/* a barra de abas rola na horizontal quando não cabe (celular), sem alargar a página */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 18px; overflow-x: auto; overflow-y: hidden; -webkit-overflow-scrolling: touch; scrollbar-width: thin; max-width: 100%; }
.tabs::-webkit-scrollbar { height: 4px; }
.tabs::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
.tab { flex: 0 0 auto; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; background: none; border: 0; border-bottom: 2px solid transparent; padding: 10px 14px; font: inherit; font-weight: 600; color: var(--muted); cursor: pointer; }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.perm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.perm-group { border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 14px 12px; margin: 0; }
.perm-group legend { padding: 0 6px; font-weight: 700; }
.perm-key { display: none; }
.preset-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }

.details { display: grid; grid-template-columns: 140px 1fr; gap: 8px 12px; margin: 0; }
.details dt { color: var(--muted); }
.details dd { margin: 0; }
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; flex-direction: column; padding: 10px 0; border-bottom: 1px solid var(--border); }
.list li:last-child { border-bottom: 0; }
.people-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px; margin-bottom: 14px; }
.person { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px; padding: 16px; border: 1px solid var(--border); border-radius: var(--radius); }
.person-photo { width: 72px; height: 72px; border-radius: 50%; object-fit: cover; }

.token-card { border-color: var(--accent); }
.copy-row { display: flex; gap: 8px; }
.copy-row input { font-family: ui-monospace, Consolas, monospace; font-size: .8rem; }

/* ---------- Blocos e unidades ---------- */
.icon-xs { width: 12px; height: 12px; vertical-align: -1px; }
.inline-form { display: flex; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.inline-form .grow { flex: 1 1 320px; margin-bottom: 0; }
.inline-form > .btn { margin-top: 26px; }
.tile-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; margin-bottom: 20px; }
.tile { display: flex; align-items: center; gap: 14px; padding: 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); color: var(--text); transition: border-color .15s, transform .15s; }
.tile:hover { text-decoration: none; border-color: var(--accent); transform: translateY(-2px); }
.tile-icon { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 10px; background: var(--info-bg); color: var(--accent); flex-shrink: 0; }
.tile-body { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.tile-body strong { font-size: 1.25rem; overflow: hidden; text-overflow: ellipsis; }
.unit-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 10px; }
.unit-chip { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: 12px 6px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-2); color: var(--text); }
.unit-chip:hover { text-decoration: none; border-color: var(--accent); background: var(--info-bg); }
.unit-chip strong { font-size: 1.05rem; }
.unit-chip small { color: var(--muted); display: inline-flex; align-items: center; gap: 3px; }
.details-compact { margin: 6px 0 16px; font-size: .88rem; }
.block { display: block; }

/* ---------- Barra de pesquisa + Mais opções ---------- */
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 12px; }
.toolbar .grow { flex: 1 1 280px; }
.toolbar select { width: auto; }
.more-menu { position: relative; }
.more-menu > summary { list-style: none; }
.more-menu > summary::-webkit-details-marker { display: none; }
.more-dropdown { position: absolute; right: 0; top: calc(100% + 6px); z-index: 45; min-width: 230px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 10px 30px rgba(15,23,42,.15); padding: 6px; }
.more-dropdown a, .more-dropdown button { display: flex; align-items: center; gap: 8px; width: 100%; padding: 9px 10px; border: 0; background: none; border-radius: 6px; font: inherit; font-size: .9rem; color: var(--text); cursor: pointer; text-align: left; }
.more-dropdown a:hover, .more-dropdown button:hover { background: var(--surface-2); text-decoration: none; }
.more-dropdown button.danger { color: var(--danger); }
.more-dropdown form { margin: 0; }
.unit-chip.occupied { border-color: #bfdbfe; border-color: var(--accent-soft, #bfdbfe); }
.dialog { border: 0; border-radius: 14px; padding: 22px; width: min(560px, calc(100vw - 32px)); background: var(--surface); color: var(--text); box-shadow: 0 25px 60px rgba(0,0,0,.3); }
.dialog::backdrop { background: rgba(15,23,42,.55); }
.dialog .card-title { margin-top: 0; }
/* Janela de lista (Portaria: Previstos / No local): mais larga, cabeçalho fixo e lista com rolagem própria */
.dialog-list { width: min(960px, calc(100vw - 32px)); max-height: calc(100vh - 48px); padding: 0; overflow: hidden; }
.dialog-list[open] { display: flex; flex-direction: column; }
.dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.dialog-head .card-title { margin: 0; }
.dialog-body { padding: 8px 20px 20px; overflow: auto; }
@media (max-width: 640px) {
    .dialog-list { width: calc(100vw - 16px); max-height: calc(100vh - 16px); }
    .dialog-head { padding: 12px 14px; }
    .dialog-body { padding: 6px 12px 14px; }
}

/* ---------- Interruptores (Sim/Não) e senha ---------- */
.switch-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px 24px; margin: 6px 0 18px; }
.switch-row { display: flex; flex-direction: column; gap: 6px; }
.switch-label { font-size: .86rem; color: var(--muted); }
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: .95rem; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch-track { position: relative; width: 42px; height: 22px; border-radius: 999px; background: var(--border); transition: background .15s; }
.switch-track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.3); transition: transform .15s; }
.switch input:checked + .switch-track { background: var(--accent); }
.switch input:checked + .switch-track::after { transform: translateX(20px); }
.switch input:focus-visible + .switch-track { outline: 3px solid rgba(47,128,237,.45); outline-color: color-mix(in srgb, var(--accent) 45%, transparent); outline-offset: 2px; }
.password-wrap { position: relative; }
.password-wrap input { padding-right: 42px; }
.icon-btn-plain { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); background: none; border: 0; color: var(--muted); cursor: pointer; padding: 6px; display: grid; place-items: center; }

/* ---------- Portaria ---------- */
.portaria-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.live-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--success); margin-right: 4px; animation: pulse 1.6s infinite; }
.live-dot.off { background: var(--danger); animation: none; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(22,163,74,.5); } 70% { box-shadow: 0 0 0 8px rgba(22,163,74,0); } 100% { box-shadow: 0 0 0 0 rgba(22,163,74,0); } }
.portaria-search { position: relative; }
.search-box { display: flex; align-items: center; gap: 10px; border: 1px solid var(--border); border-radius: 8px; padding: 0 12px; background: var(--surface); }
.search-box input { border: 0; padding: 12px 0; font-size: 1rem; outline: none; box-shadow: none; }
.search-box:focus-within { outline: 3px solid rgba(47,128,237,.35); outline-color: color-mix(in srgb, var(--accent) 35%, transparent); }
.search-results { margin-top: 10px; border: 1px solid var(--border); border-radius: 8px; max-height: 420px; overflow-y: auto; }
.search-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-bottom: 1px solid var(--border); }
.search-item:last-child { border-bottom: 0; }
.search-info { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.search-empty { padding: 12px; margin: 0; }
.portaria-avatar { display: inline-grid; place-items: center; width: 48px; height: 48px; border-radius: 50%; background: var(--border); color: var(--muted); font-weight: 700; font-size: 1.1rem; overflow: hidden; flex-shrink: 0; }
.portaria-avatar img { width: 100%; height: 100%; object-fit: cover; }
.person-cell { display: flex; align-items: center; gap: 12px; }
.person-cell > div { display: flex; flex-direction: column; }
.portaria-table td { vertical-align: middle; }
.portaria-table .badge { margin-top: 4px; }
.row-new { animation: rowIn 2.5s ease; }
@keyframes rowIn { 0% { background: var(--info-bg); } 100% { background: transparent; } }
.row-denied td:first-child { box-shadow: inset 3px 0 0 var(--danger); }
.last-event { border-left: 5px solid var(--success); }
.last-event.denied { border-left-color: var(--danger); }
.last-event.flash { animation: rowIn 2s ease; }
.last-event-body { display: flex; gap: 22px; align-items: center; flex-wrap: wrap; }
.last-event-info { flex: 1; min-width: 220px; }
.last-event-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.last-event-head strong { font-size: 1.5rem; }
.last-event-info p { margin: 6px 0 0; }
.last-event-meta { display: flex; gap: 18px; flex-wrap: wrap; font-weight: 600; }
/* Aviso flutuante (canto superior direito): mensagens depois de salvar e avisos do JS (window.showToast).
   Cores fixas com texto branco: legíveis no modo claro e no escuro. */
.toast-stack { position: fixed; top: 72px; right: 20px; z-index: 90; display: flex; flex-direction: column; gap: 10px; width: min(420px, calc(100vw - 32px)); pointer-events: none; }
.toast-item { pointer-events: auto; display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border-radius: 10px; color: #fff; background: #0e7490;
    box-shadow: 0 12px 30px rgba(15, 23, 42, .28); font-weight: 600; font-size: .92rem; line-height: 1.4; animation: toast-in .25s ease-out; }
.toast-success { background: #15803d; }
.toast-error { background: #b91c1c; }
.toast-warning { background: #b45309; }
.toast-info { background: #0e7490; }
.toast-icon { flex-shrink: 0; display: inline-flex; margin-top: 1px; }
.toast-text { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.toast-close { flex-shrink: 0; display: inline-flex; background: none; border: 0; padding: 0; color: inherit; opacity: .85; cursor: pointer; }
.toast-close:hover { opacity: 1; }
.toast-item.leaving { opacity: 0; transform: translateX(16px); transition: opacity .2s, transform .2s; }
@keyframes toast-in { from { opacity: 0; transform: translateX(16px); } to { opacity: 1; transform: none; } }
@media (max-width: 640px) { .toast-stack { top: 64px; left: 12px; right: 12px; width: auto; } }
@media (prefers-reduced-motion: reduce) { .toast-item { animation: none; } .toast-item.leaving { transition: none; } }

/* ---------- Portaria: busca única e painel de acesso ---------- */
.search-box-lg input { font-size: 1.1rem; padding: 14px 0; }
.search-mode { font-size: .75rem; color: var(--info); background: var(--info-bg); padding: 3px 9px; border-radius: 999px; white-space: nowrap; }
button.search-item { width: 100%; background: var(--surface); border: 0; border-bottom: 1px solid var(--border); font: inherit; color: var(--text); text-align: left; cursor: pointer; }
button.search-item:hover, button.search-item:focus-visible { background: var(--info-bg); }
a.search-item { color: var(--text); text-decoration: none; background: var(--surface); }
a.search-item:hover, a.search-item:focus-visible { background: var(--info-bg); text-decoration: none; }
.search-renew { color: var(--accent); font-weight: 600; }
.search-info strong { font-size: 1rem; }
.search-empty { padding: 14px; display: flex; flex-direction: column; align-items: flex-start; gap: 10px; }
.search-empty p { margin: 0; }
.badge-muted { background: var(--surface-2); color: var(--muted); }
.row-clickable { cursor: pointer; }
.person-panel { border-left: 5px solid var(--success); }
.person-panel.blocked { border-left-color: #f59e0b; }
.person-head { display: flex; align-items: center; gap: 18px; margin-bottom: 16px; }
.person-title { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.person-title h2 { margin: 0; font-size: 1.45rem; }
.person-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.person-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; margin-bottom: 14px; }
.person-history h3 { font-size: .9rem; margin: 0 0 8px; color: var(--muted); }
.history-line { display: flex; justify-content: space-between; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--border); font-size: .88rem; }
.release-box { display: flex; gap: 14px; align-items: flex-end; flex-wrap: wrap; padding: 14px; background: var(--surface-2); border-radius: var(--radius); margin-bottom: 12px; }
.release-box .field { margin: 0; flex: 1 1 240px; }
.release-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.release-actions .btn { padding: 12px 20px; font-size: 1rem; }
.person-links { display: flex; gap: 8px; flex-wrap: wrap; }
@media (max-width: 760px) { .person-grid { grid-template-columns: 1fr; } .person-head { flex-wrap: wrap; } }

/* ---------- Visitante: regras de acesso ---------- */
.rule-panel { margin-top: 16px; }
.weekday-picker { display: flex; gap: 6px; flex-wrap: wrap; }
.weekday-picker label { cursor: pointer; }
.weekday-picker input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.weekday-picker span { display: inline-grid; place-items: center; min-width: 52px; padding: 9px 10px; border: 1px solid var(--border); border-radius: 8px; font-weight: 600; background: var(--surface); }
.weekday-picker input:checked + span { background: var(--accent); border-color: var(--accent); color: #fff; }
.weekday-picker input:focus-visible + span { outline: 3px solid rgba(47,128,237,.45); outline-color: color-mix(in srgb, var(--accent) 45%, transparent); }
.date-adder { display: flex; gap: 8px; flex-wrap: wrap; }
.date-adder input { width: auto; }
.date-chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.date-chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 6px 5px 11px; background: var(--info-bg); color: var(--info); border-radius: 999px; font-weight: 600; font-size: .88rem; }
.date-chip button { border: 0; background: none; color: inherit; cursor: pointer; font-size: 1.1rem; line-height: 1; padding: 0 4px; }

/* ---------- Foto facial (Upload / Webcam / CFTV) ---------- */
.photo-capture { display: flex; gap: 20px; align-items: flex-start; flex-wrap: wrap; }
.photo-capture-body { flex: 1 1 320px; display: flex; flex-direction: column; gap: 10px; }
.photo-capture-body .label { font-weight: 600; font-size: .86rem; }
.capture-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.capture-tab { display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); font: inherit; font-size: .88rem; font-weight: 600; cursor: pointer; }
.capture-tab.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.capture-panel { padding: 12px; border: 1px dashed var(--border); border-radius: 8px; background: var(--surface-2); }
.capture-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.capture-actions select { width: auto; min-width: 200px; }
.webcam-box video { width: 100%; max-width: 360px; border-radius: 8px; background: #000; display: block; margin-bottom: 8px; transform: scaleX(-1); }
.capture-ok { color: var(--success); font-weight: 600; }
.subtitle { font-size: .95rem; margin: 18px 0 10px; }

/* ---------- Equipamento: ações, lotes, credenciais, rotas ---------- */
.device-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.device-actions .btn-label { display: inline !important; }
.batch { border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; margin-bottom: 8px; }
.batch summary { cursor: pointer; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.batch-log { white-space: pre-wrap; font-size: .75rem; max-height: 260px; overflow: auto; background: var(--surface-2); padding: 10px; border-radius: 6px; margin: 10px 0 0; }
.progress { height: 6px; background: var(--border); border-radius: 999px; margin-top: 10px; overflow: hidden; }
.progress-bar { display: block; height: 100%; width: 0; background: var(--accent); transition: width .3s; }
/* "Sincronizar com o servidor": porcentagem ao vivo (device-sync.js) */
.sync-progress { margin: 2px 0 12px; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); }
.sweep-fields { margin-top: 12px; }
/* Card "Backup e fila" ao vivo (device-live.js) */
.batch-pct { font-variant-numeric: tabular-nums; }
.live-dot { display: inline-flex; align-items: center; gap: 5px; margin-left: 8px; font-size: .72rem; font-weight: 600; color: var(--success); text-transform: uppercase; letter-spacing: .03em; }
.live-dot::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--success); animation: live-pulse 1.6s ease-in-out infinite; }
@keyframes live-pulse { 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) { .live-dot::before { animation: none; } }
.btn.is-disabled { pointer-events: none; opacity: .55; }
.sync-progress-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.sync-progress-pct { font-size: 1.25rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.sync-progress .progress { height: 10px; margin-top: 8px; }
.sync-progress .sync-progress-status { margin: 8px 0 0; font-variant-numeric: tabular-nums; }
.sync-progress.is-done .progress-bar { background: var(--success); }
.sync-progress.is-error .progress-bar { background: var(--danger); }
.progress.is-indeterminate .progress-bar { width: 35%; animation: progress-slide 1.1s ease-in-out infinite; }
@keyframes progress-slide { from { transform: translateX(-100%); } to { transform: translateX(290%); } }
@media (prefers-reduced-motion: reduce) { .progress.is-indeterminate .progress-bar { animation: none; width: 100%; opacity: .45; } }
.cred-list { display: flex; flex-direction: column; gap: 10px; }
.cred-item { border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; display: flex; flex-direction: column; gap: 4px; }
.cred-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cred-edit summary { cursor: pointer; font-size: .82rem; color: var(--accent); margin-top: 4px; }
.cred-edit[open] { padding-top: 6px; }
.cred-edit form { margin: 8px 0; }
/* Credenciais › Detalhes */
.kv-list { display: grid; grid-template-columns: minmax(110px, max-content) 1fr; gap: 8px 16px; margin: 0; }
.kv-list dt { color: var(--muted); font-size: .85rem; font-weight: 600; }
.kv-list dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.mono { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
.cred-photo-link { display: inline-block; margin-bottom: 14px; border-radius: 10px; }
.cred-photo { display: block; width: 160px; height: 160px; object-fit: cover; border-radius: 10px; border: 1px solid var(--border); }
.cred-name { display: inline-flex; align-items: center; gap: 6px; }
.cred-target-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.cred-targets li { gap: 4px; }
/* ações das credenciais e botões do topo: com texto também no celular (são as ações principais da tela) */
.cred-actions .btn-label, .quick-actions .btn-label { display: inline; }
@media (max-width: 480px) { .kv-list { grid-template-columns: 1fr; gap: 2px 0; } .kv-list dd { margin-bottom: 8px; } }
.device-picker { margin: 6px 0 12px; display: flex; flex-direction: column; gap: 8px; }
.device-picker .label { font-weight: 600; font-size: .86rem; }
.device-checks { padding: 8px 12px; border: 1px dashed var(--border); border-radius: 8px; }
.chip-checks { display: flex; gap: 6px; flex-wrap: wrap; }
.chip-checks label { cursor: pointer; }
/* Bilhetes */
.note-body { margin: 4px 0 8px; white-space: normal; overflow-wrap: anywhere; line-height: 1.5; }
.note-reply { display: flex; flex-direction: column; gap: 4px; padding: 10px 12px; border-radius: 8px; background: var(--success-bg); }
.note-reply strong { display: inline-flex; align-items: center; gap: 6px; color: var(--success); font-size: .85rem; }
.table tr.is-new td:first-child { box-shadow: inset 3px 0 0 var(--warning); }
.note-alert { text-decoration: none; }
/* Bilhetes › Configurar: grupos Portaria / Síndico */
.note-group { margin: 0 0 12px; display: flex; flex-direction: column; gap: 6px; }
.note-group > p { margin: 0; }
.note-chips { margin-bottom: 6px; }
.dialog-scroll { max-height: calc(100vh - 32px); overflow: auto; }
.chip-checks input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.chip-checks span { display: inline-block; padding: 7px 12px; border: 1px solid var(--border); border-radius: 999px; font-weight: 600; font-size: .86rem; background: var(--surface); }
.chip-checks input:checked + span { background: var(--accent); border-color: var(--accent); color: #fff; }
.chip-checks input:focus-visible + span { outline: 3px solid rgba(47,128,237,.45); outline-color: color-mix(in srgb, var(--accent) 45%, transparent); }
.text-warning { color: var(--warning); font-weight: 600; }
.plate { font-family: ui-monospace, Consolas, monospace; letter-spacing: .05em; background: var(--surface-2); border: 1px solid var(--border); padding: 2px 8px; border-radius: 4px; }

/* ---------- Login / erros ---------- */
body.auth { min-height: 100vh; display: grid; place-items: center; background: linear-gradient(160deg, var(--sidebar), var(--primary) 60%, var(--accent)); padding: 16px; }
.auth-wrap { width: 100%; max-width: 420px; }
.auth-wrap .footer { justify-content: center; color: rgba(255,255,255,.75); }
.auth-card { background: var(--surface); border-radius: 16px; padding: 32px 28px; box-shadow: 0 20px 50px rgba(0,0,0,.25); }
.auth-brand { text-align: center; margin-bottom: 22px; }
.auth-brand h1 { font-size: 1.35rem; }
.auth-brand p { margin: 4px 0 0; }
.error-code { font-size: 3.5rem; font-weight: 800; color: var(--accent); line-height: 1; }
.auth-card.center .btn { margin-top: 12px; }
.debug { text-align: left; white-space: pre-wrap; font-size: .75rem; background: var(--surface-2); padding: 12px; border-radius: 8px; max-height: 300px; overflow: auto; margin-top: 16px; }

/* ---------- Responsivo ---------- */
@media (max-width: 960px) {
    .sidebar { transform: translateX(-100%); }
    body.sidebar-open .sidebar { transform: none; }
    body.sidebar-open .backdrop { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 35; }
    .main { margin-left: 0; }
    body.sidebar-collapsed .sidebar { transform: translateX(-100%); }
    body.sidebar-collapsed.sidebar-open .sidebar { transform: none; }
    .content { padding: 16px; }
    .topbar { padding-left: 16px; padding-right: 16px; }
    .user-meta { display: none; }
    .col-2, .col-3, .col-4, .col-6, .col-8 { grid-column: span 12 !important; }
    .btn-label { display: none; }
    .actions .btn-sm { padding: 7px; }
    .details { grid-template-columns: 1fr; }
    .details dt { font-size: .8rem; }
}
@media (min-width: 961px) and (max-width: 1200px) {
    .col-3 { grid-column: span 6 !important; }
}

/* ---------- Convites e entrada única ---------- */
.btn-success { background: var(--success); color: #fff; }
.btn-success:disabled { opacity: .55; cursor: not-allowed; }
.btn-whatsapp { background: #25d366; color: #fff; }
.invite-share .copy-row { margin-bottom: 12px; }
.invite-status { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.invite-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.invite-message summary { cursor: pointer; color: var(--muted); font-size: .88rem; }
.invite-message p { background: var(--surface-2); border-radius: 8px; padding: 10px 12px; }
.usage-list { list-style: none; margin: 0 0 12px; padding: 0; }
.usage-list li { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 8px 0; border-bottom: 1px solid var(--border); }
.usage-list li > span:first-child { flex: 1 1 160px; }
.invite-card { padding: 26px 22px; }
.invite-form { display: flex; flex-direction: column; gap: 10px; }
.invite-preview { width: 180px; height: 180px; margin: 4px auto 6px; border-radius: 50%; overflow: hidden; display: grid; place-items: center; background: var(--surface-2); color: var(--muted); border: 3px solid var(--border); }
.invite-preview img { width: 100%; height: 100%; object-fit: cover; }
.invite-camera { position: relative; overflow: hidden; cursor: pointer; }
.invite-camera input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.invite-tips { margin: 0; padding-left: 18px; }
.invite-badges { display: inline-flex; gap: 4px; flex-wrap: wrap; }
.empty-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.card-head .card-title { margin: 0; }
.card-head > p { margin: 0; flex: 1 1 260px; }
/* Equipamentos › Comunicação: erro da última tentativa embaixo da data */
.dev-comm { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; }
.dev-error { max-width: 460px; overflow-wrap: anywhere; }
@media (max-width: 640px) { .table.table-stack .dev-comm { align-items: flex-end; } }
.check-list { display: grid; gap: 6px; max-height: 320px; overflow: auto; }
.list-filter { width: 100%; margin-bottom: 10px; }
/* ---------- Aparência (Meu perfil) ---------- */
.theme-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; margin-bottom: 12px; }
.theme-card { position: relative; display: flex; flex-direction: column; gap: 8px; padding: 12px; border: 2px solid var(--border); border-radius: 12px; background: var(--surface); cursor: pointer; }
.theme-card:has(input:checked) { border-color: var(--accent); box-shadow: 0 0 0 3px var(--info-bg); }
.theme-card input { position: absolute; opacity: 0; pointer-events: none; }
.theme-card:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.theme-swatches { display: flex; gap: 6px; }
.theme-swatches i { flex: 1; height: 34px; border-radius: 8px; border: 1px solid rgba(0, 0, 0, .08); }
.theme-swatches i:nth-child(1) { background: var(--sw1); }
.theme-swatches i:nth-child(2) { background: var(--sw2); }
.theme-swatches i:nth-child(3) { background: var(--sw3); }
.theme-card[data-preset="oceano"] { --sw1: #0e7490; --sw2: #0f4c5c; --sw3: #082f3a; }
.theme-card[data-preset="indigo"] { --sw1: #4f46e5; --sw2: #3730a3; --sw3: #1e1b4b; }
.theme-card[data-preset="grafite"] { --sw1: #ea580c; --sw2: #3f3f46; --sw3: #18181b; }
.theme-card[data-preset="personalizado"] { --sw1: #cccccc; --sw2: #999999; --sw3: #666666; }
.theme-custom { margin-bottom: 12px; }
.color-field { display: flex; align-items: center; gap: 10px; }
.color-field input[type="color"] { width: 56px; height: 40px; padding: 2px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); cursor: pointer; }

/* ---------- Reservas: calendário + blocos de horário ---------- */
.booking-grid { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 16px; align-items: start; }
@media (max-width: 1000px) { .booking-grid { grid-template-columns: 1fr; } }
.calendar-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.calendar-head h2 { margin: 0; font-size: 1.05rem; }
.icon-btn.disabled { opacity: .35; cursor: default; }
.calendar { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.cal-wd { text-align: center; font-size: .72rem; font-weight: 700; color: var(--muted); text-transform: uppercase; padding: 4px 0; }
.cal-day { position: relative; aspect-ratio: 1; border-radius: 10px; display: grid; place-items: center; text-decoration: none; color: var(--text); border: 1px solid var(--border); background: var(--surface); font-weight: 600; min-height: 38px; }
.cal-day { -webkit-tap-highlight-color: transparent; }
@media (hover: hover) { a.cal-day:hover { border-color: var(--accent); } }
.cal-day.selected { outline: 2px solid var(--accent); outline-offset: 1px; }
.cal-count { position: absolute; top: 3px; right: 4px; font-size: .62rem; font-weight: 700; background: var(--accent); color: #fff; border-radius: 999px; min-width: 15px; height: 15px; display: grid; place-items: center; padding: 0 3px; }
.cal-day.st-livre { background: var(--success-bg); border-color: transparent; }
.cal-day.st-parcial { background: var(--warning-bg); border-color: transparent; }
.cal-day.st-lotado { background: var(--danger-bg); border-color: transparent; color: var(--danger); }
.cal-day.st-indisponivel { background: var(--surface-2); color: var(--muted); }
.cal-day.st-passado { background: none; border-color: transparent; color: var(--muted); opacity: .45; }
.cal-legend { display: flex; flex-wrap: wrap; gap: 10px; margin: 10px 0 4px; font-size: .78rem; color: var(--muted); }
.cal-legend .dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; vertical-align: middle; margin-right: 3px; }
.dot.st-livre { background: var(--success-bg); border: 1px solid var(--success); }
.dot.st-parcial { background: var(--warning-bg); border: 1px solid var(--warning); }
.dot.st-lotado { background: var(--danger-bg); border: 1px solid var(--danger); }
.dot.st-indisponivel { background: var(--surface-2); border: 1px solid var(--border); }
.slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); gap: 6px; margin-bottom: 12px; }
.slot { display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 8px 4px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; font-weight: 700; cursor: pointer; font-variant-numeric: tabular-nums; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
.slot small { font-weight: 500; font-size: .68rem; color: var(--muted); }
.slot.st-livre { border-color: var(--success); }
/* "passar o mouse" só em aparelhos com mouse: no celular o toque deixava a cor de hover grudada no último horário */
@media (hover: hover) { .slot.st-livre:not(.selected):hover { background: var(--success-bg); } }
.slot:focus { outline: none; }
.slot:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
/* horário que só pode ser TÉRMINO (fechamento ou logo antes de uma reserva) */
.slot.st-fim { border-style: dashed; }
/* esperando o término: os términos possíveis em destaque, o resto apagado */
.slot.can-end { border: 1px solid var(--accent); border-style: solid; background: var(--surface); background: color-mix(in srgb, var(--accent) 12%, var(--surface)); }
.slot.can-end small { color: var(--accent); font-weight: 700; }
@media (hover: hover) { .slot.can-end:hover { background: color-mix(in srgb, var(--accent) 24%, var(--surface)); } }
.slot.dimmed { opacity: .4; }
/* marcado: a faixa inteira com a mesma cor forte; início e término com a borda mais grossa */
.slot.selected { background: var(--accent); border-color: var(--accent); border-style: solid; color: var(--accent-contrast); opacity: 1; }
.slot.selected small { color: inherit; opacity: .9; font-weight: 700; }
.slot.selected.sel-edge { box-shadow: inset 0 0 0 2px var(--accent-contrast); }
.slot.selected.sel-waiting { animation: slot-wait 1.2s ease-in-out infinite; }
@keyframes slot-wait { 50% { box-shadow: inset 0 0 0 2px var(--accent-contrast), 0 0 0 3px var(--accent-soft, rgba(14, 116, 144, .35)); } }
@media (prefers-reduced-motion: reduce) { .slot.selected.sel-waiting { animation: none; } }
.slot.st-ocupado { background: var(--danger-bg); border-color: transparent; color: var(--danger); }
.slot.st-intervalo { background: var(--warning-bg); border-color: transparent; color: var(--warning); }
.slot.st-passado, .slot.st-indisponivel { background: var(--surface-2); color: var(--muted); opacity: .6; }
.slot:disabled { cursor: not-allowed; }
.booking-summary { font-weight: 600; padding: 10px 12px; border-radius: 8px; background: var(--info-bg); color: var(--info); margin: 0 0 12px; }
.fixed-value { margin: 0; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-2); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.destinations { display: flex; flex-direction: column; gap: 8px; }
.destinations > .label { font-weight: 600; font-size: .86rem; }
.dest-list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.dest-list:empty { display: none; }
.dest-list li { display: inline-flex; align-items: center; gap: 6px; padding: 4px 4px 4px 10px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface-2); font-size: .88rem; }
.dest-list li .icon-btn { padding: 2px 6px; border: 0; line-height: 1; }
.filter-units { display: contents; } /* bloco e unidade viram itens da barra de filtros */
.dest-picker { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 560px) { .dest-picker { grid-template-columns: 1fr; } }
.settings-switch .switch-row { flex-direction: row; align-items: center; justify-content: space-between; gap: 16px; }
.actuation-buttons { display: flex; gap: 12px; flex-wrap: wrap; }
.btn-actuation { display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 150px; padding: 14px 16px; background: var(--accent); color: #fff; border-radius: 12px; }
.btn-actuation span { font-weight: 700; }
.btn-actuation small { opacity: .85; font-size: .75rem; }
.btn-actuation:disabled { opacity: .6; }
.settings-switch { grid-template-columns: 1fr; }
/* ---------- Módulos ---------- */
.notif-bell { position: relative; margin-left: auto; }
.notif-count { position: absolute; top: 2px; right: 2px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--danger); color: #fff; font-size: .7rem; font-weight: 700; display: grid; place-items: center; }
.notif-count[hidden] { display: none; }
.notif-list li.unread strong { color: var(--accent); }
.scan-row { display: flex; gap: 8px; }
.scan-row input { flex: 1; }
.scan-box { margin-top: 10px; }
.scan-box video { width: 100%; max-width: 420px; border-radius: 8px; background: #000; display: block; }
.simple-photo { display: flex; flex-direction: column; gap: 8px; max-width: 300px; margin-top: 12px; }
.simple-photo-box { width: 100%; aspect-ratio: 1; border-radius: 10px; background: var(--surface-2); display: grid; place-items: center; color: var(--muted); overflow: hidden; }
.simple-photo-box img { width: 100%; height: 100%; object-fit: cover; }
.simple-photo-video { width: 100%; border-radius: 10px; background: #000; }
.sp-cftv { display: flex; gap: 8px; align-items: center; }
/* editor de foto (photo-editor.js) */
.pe-canvas { width: 100%; height: 100%; display: block; touch-action: none; cursor: grab; }
.pe-canvas.dragging { cursor: grabbing; }
.photo-tools { display: flex; flex-direction: column; gap: 4px; }
.photo-tools-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; }
.tool-btn { aspect-ratio: 1; min-height: 32px; padding: 0; background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 8px; display: grid; place-items: center; cursor: pointer; }
.tool-btn:hover { background: var(--surface-2); border-color: var(--accent); }
.tool-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.sp-cftv select { flex: 1; min-width: 0; }
.thumb { width: 56px; height: 56px; border-radius: 8px; object-fit: cover; display: inline-grid; place-items: center; background: var(--surface-2); color: var(--muted); }
/* foto de pessoa nas listas: sempre um quadrado (não estica para retângulo na célula da tabela) */
.person-thumb { width: 44px; height: 44px; min-width: 44px; aspect-ratio: 1 / 1; border-radius: 8px; object-fit: cover; display: block; background: var(--surface-2); }
.avatar-cell { width: 56px; min-width: 56px; }
.avatar-cell .avatar-muted { border-radius: 8px; width: 44px; height: 44px; }
/* Foto + nome na mesma célula (página da unidade): no celular vira o topo do cartão */
.person-cell { display: flex; align-items: center; gap: 10px; min-width: 0; }
.person-cell-text { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.person-cell-text small { font-size: .78rem; }
.person-thumb-link { display: block; border-radius: 8px; flex-shrink: 0; }
.person-thumb-empty { border-radius: 8px; width: 44px; height: 44px; flex-shrink: 0; }
@media (max-width: 640px) {
    .table.table-stack td.person-td { justify-content: flex-start; text-align: left; padding-bottom: 8px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
    .table.table-stack td.person-td::before { display: none; }
    .table.table-stack td.person-td .person-thumb, .table.table-stack td.person-td .person-thumb-empty { width: 56px; height: 56px; min-width: 56px; }
}
.delivery-list { list-style: none; margin: 0; padding: 0; }
.delivery-list li { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.notice-list { display: grid; gap: 14px; }
.notice { border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px; }
.notice.pinned { border-color: var(--accent); background: var(--info-bg); }
.notice header { display: flex; justify-content: space-between; gap: 10px; align-items: center; }
.notice h3 { margin: 0; font-size: 1.05rem; }
.notice p { margin: 8px 0; }
.notice footer { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.rule-list { margin: 8px 0; padding-left: 18px; }
.policy { border: 1px solid var(--border); border-radius: 8px; padding: 8px 12px; margin-bottom: 10px; }
.policy summary { cursor: pointer; font-weight: 600; }
.policy-text { max-height: 260px; overflow: auto; font-size: .9rem; margin-top: 8px; }
.check.accept { font-weight: 600; margin: 10px 0; }
.area-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; margin-bottom: 20px; }
.area-card { display: flex; flex-direction: column; gap: 4px; text-decoration: none; color: inherit; margin: 0; }
.area-card:hover { border-color: var(--accent); }
/* Reserva passo a passo */
.btn-lg { padding: 12px 22px; font-size: 1rem; }
.steps { list-style: none; display: flex; gap: 6px; padding: 0; margin: 0 0 14px; counter-reset: none; }
.step { flex: 1 1 0; min-width: 0; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); font-size: .88rem; color: var(--muted); }
/* o conteúdo é sempre .step-link (link ou não): mesmo alinhamento em todas as etapas */
.step-link { display: flex; align-items: center; gap: 8px; width: 100%; min-width: 0; padding: 8px 10px; text-decoration: none; color: inherit; -webkit-tap-highlight-color: transparent; }
.step-num { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--surface-2); font-weight: 700; flex-shrink: 0; font-size: .8rem; }
.step-num .step-ok { display: none; }
.step-num .step-ok .icon { width: 14px; height: 14px; }
.step-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.step.current { border-color: var(--accent); color: var(--text); font-weight: 600; }
.step.current .step-num { background: var(--accent); color: var(--accent-contrast); }
.step.done { color: var(--text); border-color: var(--success); }
.step.done .step-num { background: var(--success); color: #fff; }
.step.done .step-num .step-n { display: none; }
.step.done .step-num .step-ok { display: inline-grid; place-items: center; }
@media (hover: hover) { .step.done a.step-link:hover .step-label { text-decoration: underline; } }
.booking-choice { display: flex; flex-wrap: wrap; gap: 8px 18px; align-items: center; padding: 10px 14px; margin: 0 0 14px; border-radius: 10px; background: var(--info-bg); color: var(--info); }
.booking-choice > span { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.booking-choice a { color: inherit; text-decoration: underline; }
.area-pick { gap: 6px; padding: 16px; }
.area-pick-name { display: flex; align-items: center; gap: 6px; font-size: 1.05rem; }
.area-pick-go { margin-top: auto; padding-top: 6px; color: var(--accent); font-weight: 600; display: inline-flex; align-items: center; gap: 4px; }
.booking-details { border-top: 1px solid var(--border); margin-top: 6px; padding-top: 6px; }
@media (max-width: 640px) {
    .step-link { padding: 6px; gap: 4px; justify-content: center; }
    .step .step-label { display: none; }
    .step.current .step-label { display: inline; }
}
/* Valores a cobrar: itens da unidade; "apenas reservado" = horário de uso ainda não passou */
.charge-items { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; font-size: .86rem; }
.charge-items li { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2px 10px; }
.charge-items li.is-reserved { color: var(--muted); }
.charge-price { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.charge-sum strong { white-space: nowrap; }
.charge-sum small { display: block; white-space: nowrap; }
@media (max-width: 640px) {
    .table.table-stack td.charge-cell { flex-direction: column; align-items: stretch; text-align: left; gap: 4px; }
    .table.table-stack td.charge-cell::before { flex-basis: auto; }
    .charge-items li { border-bottom: 1px dashed var(--border); padding-bottom: 4px; }
}
/* Renovar convite: foto atual + escolher "usar a mesma" ou "solicitar nova" */
.renew-photo { display: flex; gap: 14px; align-items: flex-start; flex-wrap: wrap; margin-bottom: 8px; }
.renew-thumb { width: 72px; height: 72px; min-width: 72px; border-radius: 10px; }
.renew-choices { display: grid; gap: 8px; flex: 1 1 260px; }
.renew-choice { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; cursor: pointer; }
.renew-choice input { margin-top: 3px; }
.renew-choice:has(input:checked) { border-color: var(--accent); background: var(--info-bg); }
/* Configuração › Módulos: botão "Configurar" ao lado do interruptor + janela do módulo */
.switch-row-actions { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.module-summary { margin-top: 4px; display: flex; align-items: center; gap: 4px; }
.dialog .switch-row { flex-direction: row; align-items: center; justify-content: space-between; gap: 16px; margin: 10px 0 14px; }
.dialog-head-inline { padding: 0 0 8px; border-bottom: 0; }
@media (max-width: 640px) {
    .settings-switch .switch-row { flex-wrap: wrap; }
    .settings-switch .switch-row-actions { width: 100%; justify-content: space-between; }
}
/* Relatórios: filtros e gráficos (SVG gerado no servidor; cores por variável, valem para todos os temas e o modo escuro) */
.report-filter .inline-form .field { margin-bottom: 0; }
.report-presets { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.preset-chip { display: inline-flex; padding: 5px 12px; border-radius: 999px; border: 1px solid var(--border); color: var(--text); text-decoration: none; font-size: .85rem; background: var(--surface); }
.preset-chip.active { background: var(--info-bg); color: var(--info); border-color: transparent; font-weight: 600; }
@media (hover: hover) { .preset-chip:not(.active):hover { border-color: var(--accent); } }
.chart-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 4px 0 6px; }
.chart-cols { display: block; max-width: none; }
.chart-cols .chart-grid { stroke: var(--border); stroke-dasharray: 3 3; }
.chart-cols .chart-base { stroke: var(--muted); stroke-width: 1; }
.chart-cols .chart-tick, .chart-cols .chart-label { fill: var(--muted); font-size: 10px; font-family: inherit; }
.chart-cols .chart-bar { fill: var(--accent); }
.chart-cols .chart-hit { fill: transparent; }
.chart-cols .chart-col { outline: none; cursor: default; }
.chart-cols .chart-col:hover .chart-hit, .chart-cols .chart-col:focus .chart-hit { fill: var(--surface-2); }
.chart-cols .chart-col:hover .chart-bar, .chart-cols .chart-col:focus .chart-bar { fill: var(--primary); }
.hbars { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.hbar-row { display: grid; grid-template-columns: minmax(0, 40%) minmax(0, 1fr) auto; align-items: center; gap: 10px; font-size: .88rem; }
.hbar-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar { width: 100%; height: 10px; display: block; }
.hbar rect { fill: var(--accent); }
.hbar-value { white-space: nowrap; text-align: right; font-variant-numeric: tabular-nums; }
.report-table summary { cursor: pointer; color: var(--accent); font-size: .88rem; margin-top: 4px; }
.stat small { display: block; margin-top: 2px; }
@media (max-width: 640px) { .hbar-row { grid-template-columns: minmax(0, 1fr) auto; } .hbar { grid-column: 1 / -1; grid-row: 2; } }
@media print {
    .sidebar, .topbar, .no-print, .page-header .btn { display: none !important; }
    .content { padding: 0 !important; }
    .card { break-inside: avoid; box-shadow: none; }
    .chart-scroll { overflow: visible; }
}
/* Próximas atualizações */
.roadmap-list { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 10px; }
.roadmap-item { display: flex; gap: 14px; align-items: flex-start; margin: 0; padding: 14px 16px; }
.roadmap-num { flex-shrink: 0; display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--accent); color: var(--accent-contrast); font-weight: 700; }
.roadmap-body { min-width: 0; display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }
.roadmap-title { margin: 0; font-size: 1rem; display: flex; align-items: center; gap: 6px; }
.roadmap-text { margin: 0; color: var(--muted); font-size: .9rem; }
/* Minhas reservas (cartões) */
.res-list { display: grid; gap: 10px; }
.res-card { border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; background: var(--surface); display: flex; flex-direction: column; gap: 4px; }
.res-card.is-cancelled, .res-card.is-past { opacity: .7; }
.res-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.res-area { display: inline-flex; align-items: center; gap: 6px; font-size: 1rem; }
.res-when, .res-meta { margin: 0; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.res-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px 12px; flex-wrap: wrap; border-top: 1px solid var(--border); margin-top: 6px; padding-top: 8px; }
.res-foot .btn-label { display: inline; }
.res-card.is-waiting { border-color: var(--warning); }
.res-note { margin: 2px 0 0; display: flex; align-items: flex-start; gap: 6px; color: var(--muted); }
.res-note .icon { flex-shrink: 0; margin-top: 2px; }
/* Reservas › Aguardando aprovação (equipe) */
.approval-check { align-items: flex-start; font-weight: 400; margin-top: 12px; }
.approval-check input { margin-top: 3px; flex-shrink: 0; }
.approval-card { border-color: var(--warning); }
.approval-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.rival-note { display: block; color: var(--warning); }
.tab .badge { margin-left: 2px; }
/* Aviso no celular (Web Push) */
.push-status { display: flex; align-items: flex-start; gap: 6px; margin: 4px 0 10px; font-weight: 600; }
.push-status.is-ok { color: var(--success); }
.push-status.is-warn { color: var(--warning); }
.push-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.push-actions:empty { display: none; }
.push-prompt { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); padding: 12px 14px; margin-bottom: 16px; }
.push-prompt-icon { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 50%; background: var(--bg); background: color-mix(in srgb, var(--accent) 14%, var(--surface)); color: var(--accent); flex-shrink: 0; }
.push-prompt-text { flex: 1 1 220px; min-width: 0; }
.push-prompt-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.push-prompt[hidden] { display: none; }
/* Mapas: planta em PDF convertida no navegador */
.pdf-convert { margin-top: 8px; display: flex; flex-direction: column; gap: 8px; }
.pdf-status { margin: 0; color: var(--muted); }
.pdf-status.is-ok { color: var(--success); font-weight: 600; }
.pdf-status.is-warn { color: var(--warning); font-weight: 600; }
.pdf-page { display: flex; flex-direction: column; gap: 4px; max-width: 260px; }
.pdf-preview { max-width: 100%; max-height: 260px; object-fit: contain; border: 1px solid var(--border); border-radius: 8px; background: #fff; align-self: flex-start; }
.res-foot form { margin-left: auto; }
.charges-total { margin: 0 0 0 auto; align-self: center; }
.presence-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 10px 0; border-top: 1px solid var(--border); }
.presence-row .grow { flex: 1 1 260px; }
.presence-row input[type=number] { width: 90px; }
.presence-row select { width: auto; }

/* Fila do equipamento (tela de backup) */
.queue-list { max-height: 280px; overflow-y: auto; }

/* Atualizações do sistema */
.update-inline { align-items: center; margin-bottom: 8px; }
.update-inline > .btn { margin-top: 0; }
.update-log { max-height: 320px; overflow-y: auto; }
.pre-line { white-space: pre-line; }
.release-switch summary { cursor: pointer; color: var(--accent); }
.release-switch .update-inline { margin-top: 8px; }

/* Digital de pânico (credenciais) */
.panic-check { align-items: flex-start; font-weight: 400; }
.panic-check input { margin-top: 3px; }
.capture-panel input[type="file"] { width: 100%; }
.cred-advanced { margin: 4px 0 14px; }

/* ---------- Mapas ---------- */
.map-tabs { flex-wrap: wrap; }
.map-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 20px; align-items: start; }
@media (max-width: 1000px) { .map-layout { grid-template-columns: 1fr; } }
.map-card { padding: 14px; }
.map-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.map-zoom { display: flex; align-items: center; gap: 6px; }
.map-zoom .btn { min-width: 34px; font-size: 1.05rem; line-height: 1; }
.map-zoom-value { min-width: 48px; text-align: center; font-size: .85rem; color: var(--muted); }
.map-hint { margin: 0 0 8px; color: var(--accent); font-weight: 600; }
.map-viewport { position: relative; overflow: auto; max-height: 75vh; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-2); }
.map-stage { position: relative; width: 100%; user-select: none; -webkit-user-select: none; }
.map-img { display: block; width: 100%; height: auto; }
.map-layer { position: absolute; inset: 0; }
.map-stage.placing, .map-stage.placing .map-img { cursor: crosshair; }
.map-marker {
    position: absolute; transform: translate(-50%, -50%); width: 30px; height: 30px; padding: 0;
    border-radius: 50%; border: 2px solid #fff; color: #fff; background: #475569; cursor: pointer;
    display: flex; align-items: center; justify-content: center; box-shadow: 0 2px 6px rgba(0,0,0,.35); touch-action: none;
}
.map-marker .icon { width: 16px; height: 16px; }
.map-marker:hover, .map-marker:focus-visible { z-index: 3; transform: translate(-50%, -50%) scale(1.15); }
.map-marker.selected { outline: 3px solid var(--accent); outline-offset: 2px; z-index: 2; }
.map-marker.pulse { animation: mk-pulse 1s ease-out 2; }
@keyframes mk-pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 75%, transparent); } 100% { box-shadow: 0 0 0 20px transparent; } }
.mk-qty { position: absolute; top: -8px; right: -10px; background: #111827; color: #fff; border-radius: 999px; font-size: .68rem; font-weight: 700; padding: 1px 5px; line-height: 1.3; }
.mk-lote { background: #2563eb; } .mk-camera { background: #7c3aed; } .mk-portao { background: #059669; }
.mk-caixa_passagem { background: #b45309; } .mk-switch_nobreak { background: #dc2626; } .mk-rede { background: #0d9488; }
.mk-equipamento { background: #0891b2; } .mk-eletrica { background: #ca8a04; } .mk-outro { background: #475569; }
.map-tip { position: absolute; transform: translate(-50%, calc(-100% - 10px)); background: #111827; color: #fff; padding: 8px 10px; border-radius: 8px; font-size: .82rem; max-width: 260px; z-index: 5; pointer-events: none; box-shadow: 0 6px 18px rgba(0,0,0,.25); }
.map-tip.below { transform: translate(-50%, 10px); }
.map-tip strong { display: block; }
.map-tip .tip-type { display: block; opacity: .75; font-size: .76rem; }
.map-tip .tip-notes { display: block; margin-top: 4px; white-space: pre-line; }
.map-search { margin-bottom: 10px; }
.lg-group { margin-bottom: 10px; }
.lg-title { display: flex; align-items: center; gap: 6px; font-size: .76rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; margin: 6px 0; }
.lg-dot { width: 12px; height: 12px; border-radius: 50%; display: inline-block; }
.lg-item { display: block; width: 100%; text-align: left; background: none; border: 0; padding: 6px 8px; border-radius: 6px; font: inherit; font-size: .88rem; color: var(--text); cursor: pointer; }
.lg-item:hover { background: var(--surface-2); }
.map-edit-map summary { cursor: pointer; color: var(--accent); }
.map-edit-map form { margin-top: 10px; }
.input-narrow { width: 100px !important; }

/* ---------- Campo com busca (bloco/unidade): clicou mostra tudo, digitou filtra ---------- */
.combo { position: relative; width: 100%; }
.combo > select { display: none; }
.combo-input { padding-right: 34px !important; cursor: text; }
.combo::after { content: ""; position: absolute; right: 13px; top: 50%; width: 7px; height: 7px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: translateY(-70%) rotate(45deg); pointer-events: none; }
.combo-list { position: absolute; z-index: 40; left: 0; right: 0; top: calc(100% + 4px); max-height: 280px; overflow-y: auto; margin: 0; padding: 4px; list-style: none; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 10px 24px rgba(15,23,42,.14); }
.combo-list li { padding: 8px 10px; border-radius: 6px; cursor: pointer; font-size: .9rem; }
.combo-list li:hover, .combo-list li.hl { background: var(--surface-2); }
.combo-list li.sel { font-weight: 600; color: var(--accent); }
.combo-list li.empty { color: var(--muted); cursor: default; background: none; }
.filters .combo { width: auto; min-width: 230px; flex: 0 1 260px; }
.map-help { margin: 0; }
/* menu do botão direito e janela flutuante do mapa */
.map-menu { position: fixed; z-index: 60; min-width: 190px; padding: 4px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 12px 28px rgba(15,23,42,.18); }
.map-menu-item { display: block; width: 100%; text-align: left; background: none; border: 0; padding: 9px 12px; border-radius: 6px; font: inherit; font-size: .9rem; color: var(--text); cursor: pointer; }
.map-menu-item:hover, .map-menu-item:focus-visible { background: var(--surface-2); outline: none; }
.map-menu-item.danger { color: var(--danger); }
.map-pop { position: fixed; z-index: 60; width: 300px; max-width: calc(100vw - 16px); padding: 14px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 14px 32px rgba(15,23,42,.22); }
.map-pop-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 8px; }
.map-pop-head strong { font-size: .98rem; }
.map-pop-type { margin: 0 0 4px; color: var(--muted); font-size: .85rem; }
.map-pop-notes { margin: 0 0 10px; white-space: pre-line; font-size: .9rem; }
.map-pop-form .field { margin-bottom: 10px; }
.map-pop-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.map-pop-close { background: none; border: 0; padding: 4px; border-radius: 6px; color: var(--muted); cursor: pointer; line-height: 0; }
.map-pop-close:hover { background: var(--surface-2); color: var(--text); }
.lg-tip { position: fixed; transform: none; max-width: 280px; }
/* Detalhes da licença */
.page-actions { margin: -8px 0 16px; }
.usage-stats { grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); margin-bottom: 12px; }
