/* ============================================================
   EDGESecurity DESIGN SYSTEM — edge.css
   Extrai a linguagem da landing (paper/ink/accent) para o app.
   Carregado DEPOIS de style.css; vence por ordem em empates.
   Escopo: body[data-page] (app), body.login-body, body.landing.
   Tokens únicos — sem dezenas de variáveis.
   ============================================================ */
@import url("https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700;800&display=swap");

:root {
  --edge-blue: #2f6fed;
  --edge-blue-light: #7fb2ff;
  --edge-blue-dark: #1b3a8f;
  --edge-black: #080d1a;
  --edge-charcoal: #0e1626;
  --edge-surface: #101a2e;
  --edge-surface-elevated: #16213a;
  --edge-white: #ffffff;
  --edge-muted: #5d645f;
  --edge-border: #d4d8d1;
  --edge-border-active: #2f6fed;
  --edge-paper: #eeede8;
  --edge-ink: #242824;
  --edge-card: #f7f7f4;
  --edge-input: #ffffff;
  --edge-radius-sm: 8px;
  --edge-radius-md: 12px;
  --edge-radius-lg: 16px;
  --edge-radius-pill: 999px;
  --edge-green: #16a34a;
  --edge-red: #dc2626;
  --edge-amber: #d97706;
  --edge-ease: cubic-bezier(0.22, 1, 0.36, 1);
}
body.dark {
  --edge-paper: #0b1220;
  --edge-ink: #e9edf4;
  --edge-muted: #93a1b6;
  --edge-border: rgba(255, 255, 255, 0.12);
  --edge-card: #101a2e;
  --edge-input: #0d1626;
}

/* ---------- base ---------- */
body[data-page], body.login-body, body.landing {
  font-family: Inter, -apple-system, "Segoe UI", sans-serif;
  background: var(--edge-paper);
  color: var(--edge-ink);
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}
body[data-page] :where(button, a, input, select, summary):focus-visible,
body.login-body :where(button, a, input):focus-visible,
body.landing :where(button, a, input, select):focus-visible {
  outline: 2px solid var(--edge-blue);
  outline-offset: 3px;
}
body[data-page] ::selection { background: var(--edge-blue); color: #fff; }

/* ---------- buttons (sem gradiente gratuito) ---------- */
body[data-page] .btn, body.landing .btn {
  border-radius: 10px;
  font-weight: 700;
  letter-spacing: -0.01em;
  transition: background-color 0.18s ease, transform 0.18s var(--edge-ease), box-shadow 0.18s ease;
}
body[data-page] .btn-primary, body.landing .btn-primary {
  background: var(--edge-blue);
  color: #fff;
  box-shadow: 0 8px 20px -8px rgba(47, 111, 237, 0.6);
}
body[data-page] .btn-primary:hover, body.landing .btn-primary:hover { background: var(--edge-blue-dark); transform: translateY(-1px); }
body[data-page] .btn-primary:active, body.landing .btn-primary:active { transform: translateY(0) scale(0.98); }
body[data-page] .btn-secondary, body.landing .btn-secondary {
  background: transparent;
  color: var(--edge-ink);
  border: 1px solid var(--edge-border);
}
body[data-page] .btn-secondary:hover, body.landing .btn-secondary:hover { border-color: var(--edge-blue); color: var(--edge-blue); }
body[data-page] .btn-danger { background: rgba(220, 38, 38, 0.1); color: var(--edge-red); border: 1px solid transparent; }
body[data-page] .btn-danger:hover { border-color: var(--edge-red); }
body[data-page] .btn:disabled { opacity: 0.55; cursor: wait; transform: none; }
body[data-page] .btn-small { border-radius: 8px; min-height: 36px; }

/* ---------- app shell ---------- */
.data-loading { grid-column: 1 / -1; display: flex; flex-direction: column; align-items: flex-start; gap: 14px; padding: 22px; min-height: 96px; color: var(--edge-muted); font-size: .85rem; }
.data-loading-bars { width: min(320px, 100%); height: 28px; border-radius: 4px; background: linear-gradient(currentColor 0 0) top left / 100% 8px no-repeat, linear-gradient(currentColor 0 0) bottom left / 65% 8px no-repeat; opacity: .12; }
body[data-page] { overflow-x: visible; --sidebar-rail: 80px; --sidebar-open: 248px; --content-gutter: 32px; }
body[data-page] .app-shell {
  --sidebar-width: var(--sidebar-rail);
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  transition: grid-template-columns 0.3s var(--edge-ease);
  width: 100%; min-height: 100dvh;
}
body[data-page] .app-shell:has(.sidebar:hover),
body[data-page] .app-shell:has(.sidebar:focus-within) { --sidebar-width: var(--sidebar-open); }
body[data-page] .app-shell > .content { grid-column: 2; margin-left: 0; }
body[data-page] .sidebar {
  display: flex;
  flex-direction: column;
  position: fixed;
  left: 0; top: 0; bottom: 0;
  width: var(--sidebar-width) !important;
  height: 100dvh;
  z-index: 120;
  overflow-x: hidden;
  overflow-y: auto;
  background: var(--edge-black);
  border-right: 1px solid rgba(255, 255, 255, 0.07);
  padding: 20px 14px 16px;
  gap: 6px;
}
body[data-page] .m-header, body[data-page] .m-scrim { display: none; }
body[data-page] .sb-close { display: none; }
body[data-page] .sb-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 2px 10px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  margin-bottom: 14px;
}
body[data-page] .sb-brand img { width: 30px; height: 30px; object-fit: contain; }
body[data-page] .sb-brand b { color: #fff; font-size: 0.82rem; font-weight: 800; letter-spacing: -0.02em; white-space: nowrap; }
body[data-page] .sb-brand b span { font-weight: 400; color: var(--edge-blue-light); }
body[data-page] .sb-brand small { display: block; font-size: 0.62rem; font-weight: 600; color: #7d8aa0; letter-spacing: 0.08em; text-transform: uppercase; }
body[data-page] .sb-live { display: flex; align-items: center; gap: 6px; padding: 0 10px 14px; font-size: 0.68rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: #7d8aa0; }
body[data-page] .sb-live i { width: 7px; height: 7px; border-radius: 50%; background: #22c55e; box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.18); animation: edge-pulse 2.4s infinite; }
@keyframes edge-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.45; } }
body[data-page] .sb-nav { flex-direction: column; gap: 2px; }
body[data-page] .sb-item, body[data-page] .sb-logout {
  border-radius: 10px;
  color: #93a1b6;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 10px 12px;
  border-left: 2px solid transparent;
  transition: color 0.18s ease, background-color 0.18s ease, border-color 0.18s ease;
}
body[data-page] .sb-item:hover, body[data-page] .sb-logout:hover { background: rgba(255, 255, 255, 0.05); color: #fff; }
body[data-page] .sb-item.active {
  background: rgba(47, 111, 237, 0.14);
  border-left-color: var(--edge-blue);
  color: #fff;
  box-shadow: none;
}
body[data-page] .sb-item .ico, body[data-page] .sb-logout .ico {
  display: inline-block;
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
  min-width: 20px;
  line-height: 20px;
  visibility: visible;
  opacity: 1;
  transform: none;
  color: currentColor;
  font-family: boxicons !important;
  font-style: normal;
  font-weight: normal;
  font-variant: normal;
  text-transform: none;
}
body[data-page] .sb-item.active .ico { color: var(--edge-blue-light); opacity: 1; }
body[data-page] .sb-user {
  min-width: 0;
  overflow: hidden;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
}
body[data-page] .sb-user strong,
body[data-page] .sb-user span {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
body[data-page] .sb-user strong { font-size: 0.8rem; }
body[data-page] .sb-user span + span { margin-top: 4px; }
@media (min-width: 768px) {
  /* O rail e o conteúdo compartilham a mesma coluna do layout. */
  body[data-page] .sidebar { transition: width 0.3s var(--edge-ease), box-shadow 0.3s ease; }
  body[data-page] .sidebar:hover, body[data-page] .sidebar:focus-within {
    box-shadow: 24px 0 60px rgba(8, 13, 26, 0.35);
  }
  body[data-page] .sb-brand { justify-content: center; padding-left: 0; padding-right: 0; }
  body[data-page] .sidebar:hover .sb-brand, body[data-page] .sidebar:focus-within .sb-brand { justify-content: flex-start; padding: 2px 10px 16px; }
  body[data-page] .sb-live { justify-content: center; padding-left: 0; padding-right: 0; }
  body[data-page] .sidebar:hover .sb-live, body[data-page] .sidebar:focus-within .sb-live { justify-content: flex-start; padding: 0 10px 14px; }
  body[data-page] .sb-label, body[data-page] .sb-brand b, body[data-page] .sb-brand small,
  body[data-page] .sb-user, body[data-page] .sb-live span {
    max-width: 0;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateX(-6px);
    white-space: nowrap;
    transition: max-width 0.28s var(--edge-ease), opacity 0.2s ease, transform 0.28s var(--edge-ease), visibility 0.2s;
  }
  body[data-page] .sidebar:hover .sb-label, body[data-page] .sidebar:focus-within .sb-label,
  body[data-page] .sidebar:hover .sb-brand b, body[data-page] .sidebar:focus-within .sb-brand b,
  body[data-page] .sidebar:hover .sb-brand small, body[data-page] .sidebar:focus-within .sb-brand small,
  body[data-page] .sidebar:hover .sb-user, body[data-page] .sidebar:focus-within .sb-user,
  body[data-page] .sidebar:hover .sb-live span, body[data-page] .sidebar:focus-within .sb-live span {
    max-width: 240px;
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: none;
  }
  body[data-page] .sb-item, body[data-page] .sb-logout { justify-content: center; }
  body[data-page] .sidebar:not(:hover):not(:focus-within) .sb-item .ico,
  body[data-page] .sidebar:not(:hover):not(:focus-within) .sb-logout .ico {
    display: inline-block;
    visibility: visible;
    opacity: 1;
    transform: none;
    color: currentColor;
  }
  body[data-page] .sidebar:hover .sb-item, body[data-page] .sidebar:focus-within .sb-item,
  body[data-page] .sidebar:hover .sb-logout, body[data-page] .sidebar:focus-within .sb-logout { justify-content: flex-start; }
}

/* ---------- topbar ---------- */
body[data-page] .content {
  flex: 1 1 auto;
  width: auto;
  min-width: 0;
  max-width: none;
  padding: 0 var(--content-gutter) 64px;
}
body[data-page] .app-topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  min-height: 60px; margin: 0 calc(-1 * var(--content-gutter)) 26px; padding: 10px var(--content-gutter);
  background: color-mix(in srgb, var(--edge-paper) 82%, transparent);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--edge-border);
  font-size: 0.72rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--edge-muted);
}
body[data-page] .tb-status { display: inline-flex; align-items: center; gap: 8px; color: var(--edge-ink); letter-spacing: 0.06em; }
body[data-page] .tb-status i { width: 8px; height: 8px; border-radius: 50%; background: #22c55e; box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.16); animation: edge-pulse 2.4s infinite; }

/* ---------- page head: tipografia, não cards ---------- */
body[data-page] .page-head { align-items: flex-end; margin-bottom: 6px; }
body[data-page="cameras"] .page-head { flex-wrap: wrap; }
body[data-page="cameras"] .page-head > div { flex: 1 1 280px; min-width: 0; }
body[data-page="cameras"] .page-head > .btn { flex: 0 1 auto; }
body[data-page] .page-head h1 {
  font-family: Manrope, Inter, sans-serif;
  font-size: clamp(1.7rem, 2.6vw, 2.4rem);
  font-weight: 800; letter-spacing: -0.04em; line-height: 1.05;
}
body[data-page] .page-head .eyebrow { font-size: 0.68rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--edge-blue); margin-bottom: 8px; }
body[data-page] .page-head p { font-size: 0.88rem; max-width: 62ch; }

/* ---------- stat strip (anti KPI-cards) ---------- */
body[data-page] .stat-grid, body[data-page] .admin-stat-grid {
  display: flex; flex-wrap: wrap; gap: 0;
  background: none; border: none;
  border-top: 1px solid var(--edge-border);
  border-bottom: 1px solid var(--edge-border);
  margin: 22px 0 26px;
}
body[data-page] .stat-grid .stat, body[data-page] .admin-stat-grid .stat {
  background: none; border: none; border-radius: 0;
  border-left: 1px solid var(--edge-border);
  padding: 16px 26px 16px 22px; margin: 0; flex: 1 1 160px; min-width: 150px;
}
body[data-page] .stat-grid .stat:first-child, body[data-page] .admin-stat-grid .stat:first-child { border-left: none; padding-left: 2px; }
body[data-page] .stat .label { font-size: 0.66rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--edge-muted); }
body[data-page] .stat .value {
  font-family: Manrope, Inter, sans-serif;
  font-size: 2rem; font-weight: 800; letter-spacing: -0.03em; margin-top: 4px;
  font-variant-numeric: tabular-nums;
}
body[data-page] .stat .hint { font-size: 0.72rem; }

/* ---------- cards: superfície quieta ---------- */
body[data-page] .card {
  background: var(--edge-card);
  border: 1px solid var(--edge-border);
  border-radius: var(--edge-radius-lg);
  box-shadow: none;
  margin-bottom: 22px;
}
body[data-page] .card::after { display: none; }
body[data-page] .card:hover { box-shadow: none; }
body[data-page] .card-head { padding: 18px 22px; }
body[data-page] .card-head h2 { font-family: Manrope, Inter, sans-serif; font-size: 1.02rem; font-weight: 800; letter-spacing: -0.02em; }
body[data-page] .link { color: var(--edge-blue); font-weight: 700; }
body[data-page] .link:hover { color: var(--edge-blue-dark); }

/* ---------- dashboard: hierarquia operacional ---------- */
body[data-page] .dashboard-grid { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 22px; }
body[data-page] .camera-card { background: var(--edge-black); border-color: rgba(255, 255, 255, 0.09); color: #e8edf5; }
body[data-page] .camera-card .card-head { border-bottom-color: rgba(255, 255, 255, 0.09); }
body[data-page] .camera-card .card-head h2 { color: #fff; }
body[data-page] .camera-card .card-head p { color: #8fa0b5; }
body[data-page] .camera-stage { background: #0a1120; border-radius: 0 0 var(--edge-radius-lg) var(--edge-radius-lg); min-height: 340px; display: grid; place-items: center; }
body[data-page] .camera-placeholder { text-align: center; padding: 32px; }
body[data-page] .camera-placeholder .camera-icon { font-size: 2rem; color: var(--edge-blue-light); }
body[data-page] .camera-placeholder strong { display: block; color: #fff; margin: 10px 0 4px; font-size: 1rem; }
body[data-page] .camera-placeholder span { display: block; color: #8fa0b5; font-size: 0.82rem; margin-bottom: 16px; }
body[data-page] .live { color: #ff6b6b; font-weight: 800; font-size: 0.7rem; letter-spacing: 0.1em; animation: edge-pulse 1.6s infinite; }
body[data-page] .list { display: flex; flex-direction: column; }
body[data-page] .list-item {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 13px 22px; border-bottom: 1px solid var(--edge-border);
  transition: background-color 0.15s ease;
}
body[data-page] .list-item:last-child { border-bottom: none; }
body[data-page] .list-item:hover { background: rgba(47, 111, 237, 0.05); }
body[data-page] .list-item strong { font-size: 0.86rem; }
body[data-page] .list-item span span, body[data-page] .list-item div span { font-size: 0.74rem; color: var(--edge-muted); }

/* ---------- níveis e badges: cor + label + ponto ---------- */
body[data-page] .level, body[data-page] .badge {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 0.66rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase;
  padding: 5px 10px; border-radius: var(--edge-radius-pill); white-space: nowrap;
}
body[data-page] .level::before, body[data-page] .badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
body[data-page] .level.critical, body[data-page] .badge.red { background: rgba(220, 38, 38, 0.1); color: #b91c1c; }
body[data-page] .level.high, body[data-page] .badge.amber { background: rgba(217, 119, 6, 0.12); color: #b45309; }
body[data-page] .level.normal, body[data-page] .badge.green { background: rgba(22, 163, 74, 0.1); color: #15803d; }
body[data-page] .badge.blue { background: rgba(47, 111, 237, 0.1); color: var(--edge-blue-dark); }
body[data-page] .status-pill {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 0.7rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase;
  padding: 7px 13px; border-radius: var(--edge-radius-pill);
  background: rgba(125, 138, 160, 0.14); color: var(--edge-muted); border: 1px solid var(--edge-border);
}
body[data-page] .status-pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
body[data-page] .status-pill.live { background: rgba(220, 38, 38, 0.1); color: #dc2626; border-color: rgba(220, 38, 38, 0.3); animation: edge-pulse 1.6s infinite; }
body.dark .level.critical, body.dark .badge.red { color: #f87171; }
body.dark .level.high, body.dark .badge.amber { color: #fbbf24; }
body.dark .level.normal, body.dark .badge.green { color: #4ade80; }
body.dark .badge.blue { color: var(--edge-blue-light); }

/* ---------- tabelas: ferramenta profissional ---------- */
body[data-page] .table-wrap { overflow-x: auto; border: none; }
body[data-page] table { width: 100%; border-collapse: collapse; font-size: 0.83rem; }
body[data-page] thead th {
  position: sticky; top: 0;
  text-align: left; font-size: 0.66rem; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--edge-muted); padding: 12px 16px;
  border-bottom: 1px solid var(--edge-border); background: var(--edge-card); white-space: nowrap;
}
body[data-page] tbody td { padding: 13px 16px; border-bottom: 1px solid var(--edge-border); vertical-align: middle; font-variant-numeric: tabular-nums; white-space: normal; }
body[data-page] tbody tr:last-child td { border-bottom: none; }
body[data-page] tbody tr { transition: background-color 0.15s ease; }
body[data-page] tbody tr:hover { background: rgba(47, 111, 237, 0.05); }
body[data-page] .monitor-title { font-family: Manrope, Inter, sans-serif; font-size: 1rem; font-weight: 800; letter-spacing: -0.02em; margin: 20px 0 4px; }
body[data-page] .monitor-title:first-child { margin-top: 0; }

/* ---------- formulários ---------- */
body[data-page] label { display: flex; flex-direction: column; gap: 7px; font-size: 0.78rem; font-weight: 600; color: var(--edge-ink); }
body[data-page] input, body[data-page] select, body[data-page] textarea {
  min-height: 44px; padding: 11px 14px; font-size: 0.88rem; color: var(--edge-ink);
  background: var(--edge-input); border: 1px solid var(--edge-border); border-radius: 10px;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
  width: 100%;
}
body[data-page] input::placeholder { color: var(--edge-muted); opacity: 0.75; }
body[data-page] input:focus, body[data-page] select:focus, body[data-page] textarea:focus {
  outline: none; border-color: var(--edge-border-active); box-shadow: 0 0 0 3px rgba(47, 111, 237, 0.16);
}
body[data-page] input[type="checkbox"] { width: 17px; height: 17px; min-height: 0; accent-color: var(--edge-blue); padding: 0; }
body[data-page] .filter-card { display: flex; flex-wrap: wrap; gap: 12px; padding: 16px 20px; background: none; border-top: 1px solid var(--edge-border); border-bottom: 1px solid var(--edge-border); border-left: none; border-right: none; border-radius: 0; margin-bottom: 22px; }
body[data-page] .filter-card > * { flex: 1 1 160px; }
body[data-page] .filters { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; padding: 4px 22px 22px; }
body[data-page] .filters > * { flex: 1 1 160px; }
body[data-page] .settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 22px; }
body[data-page] .settings-card { display: flex; flex-direction: column; gap: 14px; padding: 22px; }
body[data-page] .settings-card h2 { font-family: Manrope, Inter, sans-serif; font-size: 1rem; font-weight: 800; letter-spacing: -0.02em; }
body[data-page] .settings-card .btn { align-self: flex-start; }
body[data-page] .switch-line { flex-direction: row !important; align-items: center; gap: 10px; }
body[data-page] .form-error { color: #b91c1c; font-size: 0.78rem; font-weight: 600; }
body[data-page] .form-error:not(:empty) { background: rgba(220, 38, 38, 0.07); border: 1px solid rgba(220, 38, 38, 0.3); border-radius: 10px; padding: 10px 13px; }

/* ---------- câmeras: grid operacional ---------- */
body[data-page] .camera-live-card { background: var(--edge-black); border-color: rgba(255, 255, 255, 0.09); color: #e8edf5; }
body[data-page] .camera-live-card .card-head { border-bottom-color: rgba(255, 255, 255, 0.09); }
body[data-page] .camera-live-card h2 { color: #fff; }
body[data-page] .camera-live-card .card-head p { color: #8fa0b5; }
body[data-page] .camera-stage-real { position: relative; background: #05080f; aspect-ratio: 16/9; max-height: 62vh; overflow: hidden; }
body[data-page] .camera-stage-real video, body[data-page] .ai-overlay { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
body[data-page] .camera-empty-real { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; gap: 8px; padding: 24px; }
body[data-page] .camera-empty-real strong { color: #fff; font-size: 1.05rem; }
body[data-page] .camera-empty-real span { color: #8fa0b5; font-size: 0.82rem; max-width: 44ch; }
body[data-page] .camera-controls { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; padding: 16px 22px 22px; }
body[data-page] .camera-picker { flex: 2 1 220px; font-size: 0.78rem; font-weight: 600; color: #c6d2e2; }
body[data-page] .camera-live-card select { background: #0d1626; border-color: rgba(255, 255, 255, 0.14); color: #fff; }
body[data-page] .camera-live-card .btn-secondary { border-color: rgba(255, 255, 255, 0.2); color: #e8edf5; }
body[data-page] .camera-live-card .btn-secondary:hover { border-color: var(--edge-blue-light); color: var(--edge-blue-light); }
body[data-page] .camera-error { margin: 0 22px 20px; font-size: 0.8rem; font-weight: 600; color: #f87171; }
body[data-page] .camera-error:not([hidden]) { display: block; background: rgba(220, 38, 38, 0.1); border: 1px solid rgba(220, 38, 38, 0.35); border-radius: 10px; padding: 10px 13px; }
body[data-page] .ip-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; padding: 4px 22px 22px; }
body[data-page] .ip-actions { display: flex; gap: 10px; flex-wrap: wrap; grid-column: 1 / -1; }
body[data-page] .ai-metrics { display: flex; border-top: 1px solid var(--edge-border); border-bottom: 1px solid var(--edge-border); }
body[data-page] .ai-metrics > div { flex: 1; padding: 14px 22px; border-left: 1px solid var(--edge-border); }
body[data-page] .ai-metrics > div:first-child { border-left: none; }
body[data-page] .ai-metrics span { display: block; font-size: 0.66rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--edge-muted); }
body[data-page] .ai-metrics strong { font-family: Manrope, Inter, sans-serif; font-size: 1.7rem; font-weight: 800; font-variant-numeric: tabular-nums; }
body[data-page] .ai-warning { padding: 14px 22px 20px; font-size: 0.76rem; color: var(--edge-muted); }
body[data-page] .device-row {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 13px 22px; border-bottom: 1px solid var(--edge-border);
}
body[data-page] .device-row:last-child { border-bottom: none; }
body[data-page] .device-row strong { display: block; font-size: 0.86rem; }
body[data-page] .device-row small { color: var(--edge-muted); font-size: 0.74rem; }
body[data-page] .device-actions { display: flex; gap: 8px; flex-shrink: 0; }

/* ---------- relatórios ---------- */
body[data-page] .report-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
body[data-page] .chart-card canvas { padding: 6px 22px 22px; max-height: 300px; }

/* ---------- empty states: tipografia, não clichê ---------- */
body[data-page] .empty, body[data-page] .empty-state, body[data-page] .table-wrap > .empty-state {
  text-align: center; padding: 44px 24px; color: var(--edge-muted); font-size: 0.86rem;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
}
body[data-page] .empty::before, body[data-page] .empty-state::before {
  content: "—"; font-family: Manrope, serif; font-size: 1.6rem; color: var(--edge-blue); line-height: 1;
}

/* ---------- modal ---------- */
body[data-page] .modal, body[data-page="admin"] .modal {
  position: fixed; inset: 0; z-index: 200;
  display: grid; place-items: center; padding: 20px;
  background: rgba(8, 13, 26, 0.6);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  animation: edge-fade 0.22s ease;
}
body[data-page] .modal.hidden { display: none; }
@keyframes edge-fade { from { opacity: 0; } }
body[data-page] .modal-box {
  width: min(560px, 100%); max-height: 90vh; overflow: auto;
  background: var(--edge-paper); color: var(--edge-ink);
  border: 1px solid var(--edge-border); border-radius: 20px;
  animation: edge-rise 0.28s var(--edge-ease);
}
@keyframes edge-rise { from { opacity: 0; transform: translateY(14px) scale(0.99); } }
body[data-page] .modal-box .card-head { position: sticky; top: 0; background: var(--edge-paper); }
body[data-page] .form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; padding: 6px 22px 22px; }
body[data-page] .form-grid .form-actions, body[data-page] .form-grid fieldset { grid-column: 1 / -1; }
body[data-page] .permission-box { border: 1px solid var(--edge-border); border-radius: var(--edge-radius-md); padding: 14px; }
body[data-page] .permission-box legend { font-size: 0.72rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: var(--edge-muted); padding: 0 8px; }
body[data-page] .permission-grid, body[data-page] .camera-permission-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 8px; }
body[data-page] .permission-check { flex-direction: row !important; align-items: center; gap: 10px; font-size: 0.82rem; font-weight: 500; padding: 8px 10px; border-radius: 8px; transition: background-color 0.15s ease; }
body[data-page] .permission-check:hover { background: rgba(47, 111, 237, 0.06); }
body[data-page] .form-actions { display: flex; gap: 10px; justify-content: flex-end; }

/* ---------- app toast: explicit final geometry ---------- */
body[data-page] .edge-toast {
  position: fixed; right: 24px; bottom: 24px; left: auto;
  width: max-content; max-width: min(520px, calc(100vw - 32px));
  min-width: 0; min-height: 0; height: auto;
  transform: translateY(12px);
  background: var(--edge-black); color: #fff; font-size: 0.82rem; font-weight: 600;
  padding: 13px 20px; border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 16px 40px rgba(8, 13, 26, 0.4);
  opacity: 0; pointer-events: none; z-index: 300;
  transition: opacity 0.25s ease, transform 0.25s var(--edge-ease);
}
body[data-page] .edge-toast.show { opacity: 1; transform: translateY(0); }
@media (prefers-reduced-motion: reduce) {
  body[data-page] .edge-toast { transition: none; transform: none; }
}

/* ---------- motion funcional de entrada ---------- */
@media (prefers-reduced-motion: no-preference) {
  body[data-page] .content > * { animation: edge-rise 0.45s var(--edge-ease) backwards; }
  body[data-page] .content > *:nth-child(2) { animation-delay: 0.05s; }
  body[data-page] .content > *:nth-child(3) { animation-delay: 0.1s; }
  body[data-page] .content > *:nth-child(4) { animation-delay: 0.15s; }
  body[data-page] .content > *:nth-child(n+5) { animation-delay: 0.2s; }
}
@media (prefers-reduced-motion: reduce) {
  body[data-page] *, body.login-body *, body.landing * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ---------- admin (super-admin): herda sistema ---------- */
body[data-page="admin"] { background: var(--edge-paper); }
body[data-page="admin"] .admin-hero { background: var(--edge-black); border-bottom: 1px solid rgba(255,255,255,0.08); color: #e2e8f0; padding: 14px 0; }
body[data-page="admin"] .admin-wrap { max-width: 1240px; margin: 0 auto; padding: 26px 32px 64px; }
body[data-page="admin"] .admin-card { background: var(--edge-card); border: 1px solid var(--edge-border); border-radius: var(--edge-radius-lg); margin-bottom: 22px; overflow: hidden; }
body[data-page="admin"] .admin-toolbar { display: flex; flex-wrap: wrap; gap: 10px; padding: 16px 20px; border-bottom: 1px solid var(--edge-border); }
body[data-page="admin"] .admin-toolbar input, body[data-page="admin"] .admin-toolbar select { flex: 1 1 160px; }
body[data-page="admin"] .admin-card h3 { font-family: Manrope, Inter, sans-serif; padding: 18px 22px 0; }

/* ============================================================
   LOGIN — .lg-* namespace isolado (referência estrutura 50/50)
   Sem OAuth · sem "or" · campos reais preservados.
   ============================================================ */
body.login-body { background: var(--edge-black); font-family: Inter, sans-serif; }
.lg-viewport { min-height: 100dvh; display: grid; place-items: center; padding: clamp(12px, 2.5vw, 32px); }
.lg-shell {
  width: min(1240px, 100%); min-height: min(780px, calc(100dvh - clamp(24px, 5vw, 64px)));
  display: grid; grid-template-columns: 1.04fr 1fr;
  background: var(--edge-charcoal); border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 24px; overflow: hidden;
  box-shadow: 0 40px 100px rgba(0, 0, 0, 0.5);
}
.lg-visual { position: relative; overflow: hidden; isolation: isolate; background: #0a1c4f; min-height: 100%; }
.lg-visual .lg-mesh { position: absolute; inset: -20%; z-index: 0;
  background:
    radial-gradient(42% 38% at 22% 28%, rgba(47, 111, 237, 0.85) 0%, transparent 70%),
    radial-gradient(46% 42% at 78% 20%, rgba(34, 211, 238, 0.4) 0%, transparent 70%),
    radial-gradient(55% 50% at 60% 85%, rgba(27, 58, 143, 0.9) 0%, transparent 72%),
    radial-gradient(30% 30% at 85% 75%, rgba(127, 178, 255, 0.35) 0%, transparent 70%),
    linear-gradient(160deg, #0a1c4f 0%, #0a1430 60%, #060b1c 100%);
  animation: none;
}
.lg-visual .lg-mesh::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(160, 202, 255, 0.18) 1px, transparent 1.5px);
  background-size: 24px 24px;
  mask-image: radial-gradient(75% 70% at 50% 42%, #000 12%, transparent 78%);
  opacity: 0.55;
}
.lg-visual .lg-mesh::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, transparent 0 48%, rgba(127, 178, 255, 0.12) 49% 49.4%, transparent 50% 100%);
  background-size: 180px 180px;
  opacity: 0.45;
}
.lg-visual .lg-shade {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(6, 11, 28, 0.28) 0%, transparent 32%, transparent 60%, rgba(6, 11, 28, 0.6) 100%);
}
.lg-top { position: absolute; z-index: 3; top: 0; left: 0; right: 0; display: flex; align-items: center; gap: 10px; padding: 26px 30px; }
.lg-top img { width: 32px; height: 32px; object-fit: contain; }
.lg-top b { color: #fff; font-size: 0.9rem; font-weight: 800; letter-spacing: -0.02em; }
.lg-top b span { font-weight: 400; color: var(--edge-blue-light); }
.lg-copy { position: absolute; z-index: 3; left: 30px; right: 30px; bottom: 30px; }
.lg-copy .eyebrow { font-size: 0.66rem; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--edge-blue-light); margin-bottom: 10px; }
.lg-copy h2 { font-family: Manrope, sans-serif; color: #fff; font-size: clamp(1.6rem, 2.6vw, 2.4rem); font-weight: 800; letter-spacing: -0.035em; line-height: 1.04; }
.lg-copy h2 em { font-style: normal; color: var(--edge-blue-light); }
.lg-copy p { color: #b9c7e4; font-size: 0.85rem; margin-top: 10px; max-width: 38ch; line-height: 1.6; }
.lg-form-side { display: grid; place-items: center; padding: clamp(28px, 4vw, 56px); background: var(--edge-charcoal); }
.lg-form { width: min(400px, 100%); display: flex; flex-direction: column; gap: 18px; }
.lg-back { align-self: flex-start; font-size: 0.78rem; font-weight: 600; color: #8fa0b5; min-height: 44px; display: inline-flex; align-items: center; }
.lg-back:hover { color: #fff; }
.lg-form h1 { font-family: Manrope, sans-serif; color: #fff; font-size: 1.7rem; font-weight: 800; letter-spacing: -0.03em; }
.lg-form .sub { color: #8fa0b5; font-size: 0.86rem; margin-top: -12px; }
.lg-field { display: flex; flex-direction: column; gap: 8px; font-size: 0.78rem; font-weight: 600; color: #c6d2e2; }
.lg-field .lg-input-wrap { position: relative; }
.lg-field input {
  width: 100%; min-height: 54px; padding: 14px 16px; font-size: 0.92rem; color: #fff;
  background: var(--edge-surface-elevated); border: 1px solid rgba(255, 255, 255, 0.12); border-radius: 12px;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}
.lg-field input::placeholder { color: #5f6f8c; }
.lg-field input:focus { outline: none; border-color: var(--edge-blue); box-shadow: 0 0 0 3px rgba(47, 111, 237, 0.35); }
.lg-field input[aria-invalid="true"] { border-color: var(--edge-red); box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.25); }
.lg-eye { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); width: 44px; height: 44px; display: grid; place-items: center; color: #8fa0b5; background: transparent; border: 0; border-radius: 10px; font-size: 1.15rem; }
.lg-eye:hover { color: #fff; background: rgba(255, 255, 255, 0.06); }
.lg-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 0.78rem; color: #8fa0b5; }
.lg-check { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; min-height: 44px; }
.lg-check input { width: 17px; height: 17px; accent-color: var(--edge-blue); }
.lg-error { color: #fca5a5; font-size: 0.8rem; font-weight: 600; line-height: 1.5; }
.lg-error:not(:empty) { background: rgba(220, 38, 38, 0.1); border: 1px solid rgba(220, 38, 38, 0.4); border-radius: 12px; padding: 11px 14px; }
.lg-submit {
  min-height: 54px; border-radius: 12px; font-size: 0.95rem; font-weight: 800; color: #fff;
  background: var(--edge-blue); display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  box-shadow: 0 14px 30px -10px rgba(47, 111, 237, 0.7);
  transition: background-color 0.18s ease, transform 0.18s var(--edge-ease);
}
.lg-submit:hover:not(:disabled) { background: var(--edge-blue-dark); transform: translateY(-1px); }
.lg-submit:disabled { opacity: 0.7; cursor: wait; }
.lg-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; border-top: 1px solid rgba(255,255,255,0.09); padding-top: 18px; font-size: 0.76rem; color: #8fa0b5; }
.lg-foot a { color: var(--edge-blue-light); font-weight: 700; }
.lg-foot a:hover { color: #fff; }
.lg-status { font-weight: 700; }
@media (max-width: 900px) {
  .lg-shell { grid-template-columns: 1fr; min-height: 0; }
  .lg-visual { min-height: 190px; }
  .lg-copy { left: 20px; right: 20px; bottom: 16px; }
  .lg-copy h2 { font-size: 1.3rem; }
  .lg-copy p { display: none; }
  .lg-top { padding: 16px 20px; }
  .lg-form-side { padding: 28px 20px 36px; }
}

/* ============================================================
   CADASTRO / PAGAMENTO — irmãos do login (body.landing)
   ============================================================ */
body.landing { background: var(--edge-black); }
body.landing .lp-top { background: transparent; border-bottom: 1px solid rgba(255,255,255,0.09); }
body.landing .lp-brand__word, body.landing .lp-brand { color: #fff; }
body.landing .lp-link { color: #b9c7e4; }
body.landing .lp-cta { background: var(--edge-blue); color: #fff; border-radius: 10px; }
body.landing .cadastro-wrap { display: grid; grid-template-columns: minmax(280px, 5fr) 7fr; max-width: 1180px; margin: 0 auto; gap: 0; padding: clamp(12px, 2.5vw, 32px); }
body.landing .cad-rail { position: relative; overflow: hidden; border-radius: 20px 0 0 20px; background: #0a1c4f; padding: 30px; display: flex; flex-direction: column; justify-content: space-between; gap: 24px; min-height: 100%; }
body.landing .cad-rail::before { content: ""; position: absolute; inset: -20%;
  background: radial-gradient(45% 40% at 25% 25%, rgba(47,111,237,0.8) 0%, transparent 70%),
    radial-gradient(50% 45% at 75% 80%, rgba(27,58,143,0.85) 0%, transparent 70%),
    linear-gradient(160deg, #0a1c4f, #060b1c); }
body.landing .cad-rail::after { content: ""; position: absolute; inset: 0;
  background-image: radial-gradient(rgba(255,255,255,0.3) 1px, transparent 1.4px); background-size: 24px 24px;
  mask-image: radial-gradient(75% 65% at 50% 45%, #000 20%, transparent 78%); }
body.landing .cad-rail > * { position: relative; z-index: 1; }
body.landing .cad-rail h2 { font-family: Manrope, sans-serif; color: #fff; font-size: 1.5rem; font-weight: 800; letter-spacing: -0.03em; line-height: 1.1; }
body.landing .cad-rail h2 em { font-style: normal; color: var(--edge-blue-light); }
body.landing .cad-rail ol { list-style: none; display: flex; flex-direction: column; gap: 14px; margin-top: 22px; }
body.landing .cad-rail li { display: flex; gap: 12px; align-items: baseline; color: #b9c7e4; font-size: 0.82rem; }
body.landing .cad-rail li b { color: var(--edge-blue-light); font-size: 0.72rem; }
body.landing .cadastro-card { background: var(--edge-charcoal); border: 1px solid rgba(255,255,255,0.09); border-left: none; border-radius: 0 20px 20px 0; color: #e8edf5; }
body.landing .cadastro-head h1 { font-family: Manrope, sans-serif; letter-spacing: -0.03em; color: #fff; }
body.landing .cadastro-head p { color: #8fa0b5; }
body.landing .cadastro-head strong, body.landing .cadastro-head b { color: #fff; }
body.landing .cad-fieldset { background: transparent; border: 1px solid rgba(255,255,255,0.12); border-radius: 14px; padding: 22px; margin: 0 0 18px; }
body.landing .cad-fieldset legend {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 0.78rem; font-weight: 800; letter-spacing: 0.02em; color: #fff;
  background: var(--edge-surface-elevated); border: 1px solid rgba(255,255,255,0.12);
  border-radius: 999px; padding: 7px 14px; margin-left: 8px;
}
body.landing .cad-fieldset legend i { color: var(--edge-blue-light); }
body.landing .cad-actions .btn-secondary { border-color: rgba(255,255,255,0.2); color: #e8edf5; }
body.landing .cad-actions .btn-secondary:hover { border-color: var(--edge-blue-light); color: var(--edge-blue-light); }
body.landing .cad-fieldset { border: 1px solid rgba(255,255,255,0.1); border-radius: var(--edge-radius-md); }
body.landing .cad-fieldset legend { color: #fff; }
body.landing .cad-grid label { color: #c6d2e2; }
body.landing .cad-grid input { background: var(--edge-surface-elevated); border: 1px solid rgba(255,255,255,0.12); color: #fff; }
body.landing .cad-grid input::placeholder { color: #5f6f8c; }
body.landing .cad-grid input:focus { outline: none; border-color: var(--edge-blue); box-shadow: 0 0 0 3px rgba(47,111,237,0.35); }
body.landing .cad-hint, body.landing .cad-footnote { color: #8fa0b5; }
body.landing .pay-card { background: var(--edge-charcoal); border: 1px solid rgba(255,255,255,0.09); color: #e8edf5; }
body.landing .pay-card h1 { color: #fff; font-family: Manrope, sans-serif; letter-spacing: -0.03em; }
body.landing .pay-meta { color: #8fa0b5; }
@media (max-width: 900px) {
  body.landing .cadastro-wrap { grid-template-columns: 1fr; }
  body.landing .cad-rail { border-radius: 20px 20px 0 0; min-height: 0; padding: 22px; }
  body.landing .cad-rail ol { display: none; }
  body.landing .cadastro-card { border-radius: 0 0 20px 20px; border-left: 1px solid rgba(255,255,255,0.09); border-top: none; }
}

/* ============================================================
   ROUTE TRANSITION estática (login/cadastro).
   Mesmos tokens/ritmo do StaggeredMenu; só transform/opacity.
   ============================================================ */
.rt-static { position: fixed; inset: 0; z-index: 160; visibility: hidden; pointer-events: none; display: none; }
.rt-static.on { display: block; visibility: visible; pointer-events: all; }
.rt-static .rt-layer { position: absolute; inset: 0; transform: translateX(101%); will-change: transform; }
.rt-static .rt-brand {
  position: absolute; inset: 0; display: grid; place-items: center; align-content: center;
  font-family: Manrope, Inter, sans-serif; font-size: 15px; font-weight: 800; letter-spacing: -0.02em;
  color: #fff; opacity: 0;
}
.rt-static .rt-brand span { font-weight: 400; color: var(--edge-blue-light); }
.rt-static.reveal .rt-layer { transform: translateX(0); animation: rt-out 0.72s cubic-bezier(0.87, 0, 0.13, 1) both; }
.rt-static.reveal .rt-layer:nth-child(1) { animation-delay: 0.02s; }
.rt-static.reveal .rt-layer:nth-child(2) { animation-delay: 0.08s; }
.rt-static.reveal .rt-layer:nth-child(3) { animation-delay: 0.14s; }
.rt-static.reveal .rt-brand { opacity: 1; animation: rt-brand-out 0.25s ease both; }
@keyframes rt-out { to { transform: translateX(-101%); } }
@keyframes rt-brand-out { to { opacity: 0; } }
.rt-static.cover .rt-layer { animation: rt-in 0.6s cubic-bezier(0.87, 0, 0.13, 1) both; }
.rt-static.cover .rt-layer:nth-child(1) { animation-delay: 0s; }
.rt-static.cover .rt-layer:nth-child(2) { animation-delay: 0.06s; }
.rt-static.cover .rt-layer:nth-child(3) { animation-delay: 0.12s; }
.rt-static.cover .rt-brand { animation: rt-brand-in 0.3s ease 0.42s both; }
@keyframes rt-in { from { transform: translateX(101%); } to { transform: translateX(0); } }
@keyframes rt-brand-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@media (max-width: 700px) {
  .rt-static.reveal .rt-layer { animation-duration: 0.45s; }
  .rt-static.cover .rt-layer { animation-duration: 0.4s; }
  .rt-static.cover .rt-brand { animation-delay: 0.28s; }
}

/* ---------- responsivo app ---------- */
@media (max-width: 1100px) {
  body[data-page] .dashboard-grid, body[data-page] .report-grid { grid-template-columns: 1fr; }
  body[data-page] .stat-grid .stat { flex: 1 1 200px; }
}
@media (max-width: 767px) {
  /* MOBILE HEADER + DRAWER (substitui a bottom-bar) */
  body[data-page] .m-header {
    display: flex; align-items: center; gap: 10px;
    position: fixed; z-index: 130; top: 0; left: 0; right: 0;
    min-height: 60px; padding: 8px 12px;
    padding-top: calc(8px + env(safe-area-inset-top, 0px));
    background: rgba(8, 13, 26, 0.92);
    backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    color: #fff;
  }
  body[data-page] .m-brand { display: flex; align-items: center; gap: 8px; font-size: 0.78rem; font-weight: 800; letter-spacing: -0.02em; }
  body[data-page] .m-brand img { width: 26px; height: 26px; object-fit: contain; }
  body[data-page] .m-section { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: #b9c7e4; }
  body[data-page] .m-status { display: inline-flex; align-items: center; gap: 6px; font-size: 0.62rem; font-weight: 800; letter-spacing: 0.08em; color: #8fa0b5; }
  body[data-page] .m-status i { width: 7px; height: 7px; border-radius: 50%; background: #22c55e; }
  body[data-page] #menu-btn {
    width: 44px; height: 44px; display: grid; place-items: center; flex-shrink: 0;
    border-radius: 12px; border: 1px solid rgba(255, 255, 255, 0.16); color: #fff; font-size: 1.35rem;
  }
  body[data-page] .sidebar {
    width: min(300px, 84vw) !important;
    transform: translateX(-105%);
    transition: transform 0.3s var(--edge-ease);
    z-index: 140;
    padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  }
  body[data-page] .sb-close {
    display: grid; place-items: center; align-self: flex-end;
    width: 44px; min-height: 44px; flex-shrink: 0; color: #fff; background: transparent;
    font-size: 1.5rem; border-radius: 10px;
  }
  body[data-page].drawer-open .sidebar { transform: none; box-shadow: 24px 0 60px rgba(0, 0, 0, 0.45); }
  body[data-page] .m-scrim {
    display: block; position: fixed; inset: 0; z-index: 135;
    background: rgba(8, 13, 26, 0.55);
    backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
    opacity: 0; pointer-events: none; transition: opacity 0.3s ease;
  }
  body[data-page].drawer-open .m-scrim { opacity: 1; pointer-events: auto; }
  body[data-page].drawer-open { overflow: hidden; }
  body[data-page] .sb-item, body[data-page] .sb-logout { min-height: 48px; }
  body[data-page] .content { margin-left: 0; padding: 76px 14px 40px; }
  body[data-page] .app-shell { display: block; }
  body[data-page] .app-topbar { display: none; }
  body[data-page] .form-grid { grid-template-columns: 1fr; }
  /* Dense tables retain readable columns; only their own container scrolls. */
  body[data-page] .table-wrap table:has(th:nth-child(6)) { min-width: 680px; }
  body[data-page] .page-head { flex-direction: column; align-items: flex-start; }
  /* KPIs 2x2 compactos */
  body[data-page] .stat-grid, body[data-page] .admin-stat-grid {
    display: grid; grid-template-columns: 1fr 1fr; gap: 1px;
    background: var(--edge-border); border: 1px solid var(--edge-border); border-radius: var(--edge-radius-md);
    overflow: hidden; margin: 18px 0 20px;
  }
  body[data-page] .stat-grid .stat, body[data-page] .admin-stat-grid .stat {
    background: var(--edge-card); border: none; border-radius: 0;
    padding: 12px 14px; margin: 0; min-width: 0;
  }
  body[data-page] .stat .value { font-size: 1.45rem; }
  /* empty states compactos */
  body[data-page] .empty, body[data-page] .empty-state, body[data-page] .table-wrap > .empty-state { padding: 26px 18px; }
}

/* Intrinsic content must shrink inside the shared shell, including nested grids. */
body[data-page] .content > *,
body[data-page] :is(.dashboard-grid, .report-grid, .settings-grid, .form-grid) > * { min-width: 0; }
body[data-page] :is(.page-head, .filters, .form-actions) { flex-wrap: wrap; }
body[data-page] :is(.page-head, .card, .stat, .admin-card) { overflow-wrap: anywhere; }
body[data-page] .settings-grid { grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr)); }
body[data-page] :is(input, select, textarea, video, canvas) { max-width: 100%; }
body[data-page] .table-wrap { max-width: 100%; min-width: 0; }
body[data-page] .modal { z-index: 200; }
@media (min-width: 768px) and (max-width: 1023px) {
  body[data-page] { --content-gutter: 20px; }
}
