/* ============================================================
   DC SECURITY SCAN - Design System
   Temas: light / dark   |   Fonte: system stack
   ============================================================ */

:root {
  --font-sans: "Inter", "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, Helvetica, Arial, sans-serif;
  --font-mono: "JetBrains Mono", "Cascadia Code", Consolas, "SF Mono", Menlo, monospace;

  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 20px;

  --sev-critical: #e0245e;
  --sev-critical-soft: rgba(224, 36, 94, .14);
  --sev-high: #f2760c;
  --sev-high-soft: rgba(242, 118, 12, .14);
  --sev-medium: #d9a406;
  --sev-medium-soft: rgba(217, 164, 6, .16);
  --sev-low: #10a37f;
  --sev-low-soft: rgba(16, 163, 127, .14);

  --transition: 180ms cubic-bezier(.4, 0, .2, 1);
}

/* ---------------------------- DARK ---------------------------- */
html[data-theme="dark"] {
  --bg: #070b14;
  --bg-elevated: #0d1421;
  --surface: #111a2b;
  --surface-2: #162034;
  --surface-hover: #1b273e;
  --border: #22304a;
  --border-strong: #2e3f5e;
  --text: #e8eefc;
  --text-muted: #94a3bd;
  --text-dim: #64748b;
  --accent: #3b82f6;
  --accent-hover: #60a5fa;
  --accent-soft: rgba(59, 130, 246, .14);
  --shadow: 0 18px 48px -24px rgba(0, 0, 0, .9);
  --shadow-sm: 0 2px 10px -4px rgba(0, 0, 0, .6);
  --glow: radial-gradient(1200px 500px at 12% -10%, rgba(59, 130, 246, .13), transparent 60%),
          radial-gradient(900px 420px at 92% 0%, rgba(224, 36, 94, .09), transparent 60%);

  /* Malha neural do plano de fundo */
  --neural-node: rgba(96, 165, 250, .55);
  --neural-node-soft: rgba(96, 165, 250, .13);
  --neural-link: rgba(96, 165, 250, .11);
  --neural-link-soft: rgba(148, 163, 189, .05);
  --neural-pulse-a: rgba(59, 130, 246, .15);
  --neural-pulse-b: rgba(16, 163, 127, .09);
  --neural-opacity: .6;
  --veil-strong: 84%;
  --veil-soft: 78%;
}

/* ---------------------------- LIGHT ---------------------------- */
html[data-theme="light"] {
  --bg: #f2f5fa;
  --bg-elevated: #ffffff;
  --surface: #ffffff;
  --surface-2: #f7f9fd;
  --surface-hover: #eef3fb;
  --border: #dde5f0;
  --border-strong: #c6d3e5;
  --text: #0f1b2d;
  --text-muted: #55637a;
  --text-dim: #8291a8;
  --accent: #1d5fd8;
  --accent-hover: #1a54c0;
  --accent-soft: rgba(29, 95, 216, .1);
  --shadow: 0 18px 40px -28px rgba(15, 27, 45, .45);
  --shadow-sm: 0 1px 3px rgba(15, 27, 45, .08);
  --glow: radial-gradient(1100px 480px at 10% -12%, rgba(29, 95, 216, .1), transparent 60%),
          radial-gradient(820px 400px at 95% -6%, rgba(224, 36, 94, .07), transparent 60%);

  /* Malha neural do plano de fundo */
  --neural-node: rgba(29, 95, 216, .40);
  --neural-node-soft: rgba(29, 95, 216, .10);
  --neural-link: rgba(29, 95, 216, .09);
  --neural-link-soft: rgba(71, 85, 105, .045);
  --neural-pulse-a: rgba(29, 95, 216, .10);
  --neural-pulse-b: rgba(16, 163, 127, .07);
  --neural-opacity: .75;
  --veil-strong: 88%;
  --veil-soft: 82%;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  font-family: var(--font-sans);
  background: var(--bg);
  background-image: var(--glow);
  background-attachment: fixed;
  color: var(--text);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  transition: background-color var(--transition), color var(--transition);
}

/* ---------------------------------------------------------------
   Plano de fundo "rede neural"
   - ::before  malha de nos e sinapses (lattice de 132px com as
               diagonais alinhadas aos nos), com deriva lenta;
   - ::after   ativacoes difusas que respiram por tras da malha.
   Ambos sao puramente decorativos e nao capturam eventos.
   --------------------------------------------------------------- */
body::before,
body::after {
  content: "";
  position: fixed;
  pointer-events: none;
}

body::before {
  inset: -160px;
  z-index: -2;
  opacity: var(--neural-opacity);
  background-image:
    /* nucleo do neuronio */
    radial-gradient(circle at 50% 50%, var(--neural-node) 0 1.5px, transparent 2.3px),
    /* halo do neuronio */
    radial-gradient(circle at 50% 50%, var(--neural-node-soft) 0 4px, transparent 6px),
    /* sinapses diagonais */
    repeating-linear-gradient(45deg, var(--neural-link) 0 1px, transparent 1px 93.34px),
    repeating-linear-gradient(-45deg, var(--neural-link) 0 1px, transparent 1px 93.34px),
    /* camadas verticais, evocando as camadas da rede */
    repeating-linear-gradient(90deg, var(--neural-link-soft) 0 1px, transparent 1px 132px);
  background-size: 132px 132px;
  animation: neural-drift 120s linear infinite;
}

body::after {
  inset: 0;
  z-index: -1;
  background-image:
    radial-gradient(46vmax 30vmax at 6% -10%, var(--neural-pulse-a), transparent 62%),
    radial-gradient(38vmax 26vmax at 96% 2%, var(--neural-pulse-b), transparent 60%),
    radial-gradient(42vmax 28vmax at 58% 112%, var(--neural-pulse-a), transparent 62%);
  animation: neural-breathe 22s ease-in-out infinite;
}

@keyframes neural-drift {
  from { background-position: 0 0; }
  to   { background-position: 264px 132px; }
}
@keyframes neural-breathe {
  0%, 100% { opacity: .85; transform: scale(1); }
  50%      { opacity: 1;   transform: scale(1.03); }
}
@media (prefers-reduced-motion: reduce) {
  body::before, body::after { animation: none; }
}

h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -.015em; }
p { margin: 0; }
button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
svg { fill: currentColor; }

/* O atributo `hidden` sempre prevalece sobre o display definido nas classes. */
[hidden] { display: none !important; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 8px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: var(--text-dim); background-clip: content-box; }

/* ============================ LAYOUT ============================ */
.app-shell {
  display: grid;
  grid-template-columns: 268px 1fr;
  min-height: 100vh;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 22px 16px;
  background: color-mix(in srgb, var(--bg-elevated) var(--veil-strong), transparent);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border-right: 1px solid var(--border);
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 40;
}

.brand { display: flex; align-items: center; gap: 12px; padding: 4px 8px 14px; border-bottom: 1px solid var(--border); }
.brand-mark {
  width: 42px; height: 42px; flex: none;
  display: grid; place-items: center;
  border-radius: 12px;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid var(--border);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.25; }
.brand-text strong { font-size: 15px; letter-spacing: -.02em; }
.brand-text span { font-size: 11px; color: var(--text-dim); text-transform: uppercase; letter-spacing: .09em; }

.nav { display: flex; flex-direction: column; gap: 3px; flex: 1; }
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  text-align: left;
  font-size: 13.5px;
  font-weight: 500;
  transition: all var(--transition);
}
.nav-item svg { width: 18px; height: 18px; flex: none; opacity: .85; }
.nav-item:hover { background: var(--surface-hover); color: var(--text); }
.nav-item.is-active {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 28%, transparent);
  font-weight: 600;
}

.sidebar-footer { padding-top: 12px; border-top: 1px solid var(--border); }
.engine-card {
  display: flex; align-items: center; gap: 11px;
  padding: 11px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.engine-card strong { display: block; font-size: 12.5px; }
.engine-card small { color: var(--text-dim); font-size: 11px; }
.engine-dot {
  width: 9px; height: 9px; border-radius: 50%; flex: none;
  background: var(--sev-low);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--sev-low) 22%, transparent);
}
.engine-dot.is-busy { background: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); animation: pulse 1.4s infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .35; } }

.main { display: flex; flex-direction: column; min-width: 0; }

.topbar {
  display: flex; align-items: center; gap: 16px;
  padding: 16px 28px;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg-elevated) 82%, transparent);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  position: sticky; top: 0; z-index: 30;
}
.topbar-title { flex: 1; min-width: 0; }
.topbar-title h1 { font-size: 19px; }
.topbar-title p { font-size: 12.5px; color: var(--text-muted); }
.topbar-actions { display: flex; align-items: center; gap: 10px; }

.content { padding: 24px 28px 56px; display: flex; flex-direction: column; gap: 20px; }
.view { display: none; flex-direction: column; gap: 20px; animation: fade .25s ease; }
.view.is-active { display: flex; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ============================ COMPONENTES ============================ */
.card {
  background: color-mix(in srgb, var(--surface) var(--veil-strong), transparent);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.card-head {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 15px 18px;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface-2) var(--veil-soft), transparent);
  flex-wrap: wrap;
}
.card-head h2 { font-size: 14.5px; }
.card-body { padding: 18px; }
.card-body.no-pad { padding: 0; }
.muted { color: var(--text-muted); font-size: 12px; }
.empty { color: var(--text-dim); font-size: 13px; text-align: center; padding: 26px 10px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 15px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-size: 13px; font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--transition);
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); transform: translateY(-1px); }
.btn-ghost { background: var(--surface-2); border-color: var(--border); color: var(--text-muted); }
.btn-ghost:hover:not(:disabled) { background: var(--surface-hover); color: var(--text); }
.btn-danger { background: transparent; border-color: color-mix(in srgb, var(--sev-critical) 40%, transparent); color: var(--sev-critical); }
.btn-danger:hover:not(:disabled) { background: var(--sev-critical-soft); }
.btn-sm { padding: 6px 11px; font-size: 12px; }

.icon-btn {
  display: grid; place-items: center;
  width: 36px; height: 36px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition);
}
.icon-btn svg { width: 17px; height: 17px; }
.icon-btn:hover { background: var(--surface-hover); color: var(--text); }
html[data-theme="dark"] .icon-sun { display: none; }
html[data-theme="light"] .icon-moon { display: none; }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 11px;
  font-size: 11.5px; font-weight: 600;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid color-mix(in srgb, var(--accent) 26%, transparent);
}

.only-mobile { display: none; }

/* ---------------------------- KPI ---------------------------- */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(196px, 1fr)); gap: 14px; }
.kpi {
  position: relative;
  padding: 16px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: transform var(--transition), border-color var(--transition);
}
.kpi:hover { transform: translateY(-2px); border-color: var(--border-strong); }
.kpi::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 3px; background: var(--kpi-color, var(--accent)); }
.kpi-label { font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--text-dim); font-weight: 600; }
.kpi-value { font-size: 30px; font-weight: 700; letter-spacing: -.03em; margin-top: 4px; line-height: 1.1; }
.kpi-foot { font-size: 11.5px; color: var(--text-muted); margin-top: 4px; }

.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); gap: 20px; }
.grid-form { display: grid; grid-template-columns: minmax(340px, 420px) 1fr; gap: 20px; align-items: start; }

/* ---------------------------- Chart ---------------------------- */
.severity-chart { display: flex; flex-direction: column; gap: 14px; }
.sev-row { display: grid; grid-template-columns: 92px 1fr 92px; align-items: center; gap: 12px; }
.sev-name { font-size: 12.5px; font-weight: 600; display: flex; align-items: center; gap: 7px; }
.sev-name i { width: 9px; height: 9px; border-radius: 3px; display: inline-block; }
.sev-track { height: 10px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); overflow: hidden; }
.sev-fill { height: 100%; border-radius: 999px; transition: width .6s cubic-bezier(.4,0,.2,1); }
.sev-meta { font-size: 12px; color: var(--text-muted); text-align: right; font-variant-numeric: tabular-nums; }

.ranking { display: flex; flex-direction: column; gap: 11px; }
.rank-item { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; padding-bottom: 11px; border-bottom: 1px dashed var(--border); }
.rank-item:last-child { border-bottom: none; padding-bottom: 0; }
.rank-name { font-size: 13px; font-weight: 600; }
.rank-scope { font-size: 11px; color: var(--text-dim); font-family: var(--font-mono); }
.rank-bar { grid-column: 1 / -1; height: 7px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); overflow: hidden; }
.rank-bar span { display: block; height: 100%; border-radius: 999px; }
.rank-score { font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; }

/* ---------------------------- Tabelas ---------------------------- */
.table-wrap { overflow-x: auto; max-height: 620px; }
.table { width: 100%; border-collapse: collapse; font-size: 12.8px; }
.table thead th {
  position: sticky; top: 0; z-index: 2;
  text-align: left;
  padding: 11px 14px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .06em;
  color: var(--text-dim);
  white-space: nowrap;
}
.table tbody td { padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: var(--surface-hover); }
.mono { font-family: var(--font-mono); font-size: 12px; }
.nowrap { white-space: nowrap; }
.tnum { font-variant-numeric: tabular-nums; }

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 10.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .05em;
  white-space: nowrap;
}
.badge i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-critical { color: var(--sev-critical); background: var(--sev-critical-soft); }
.badge-high { color: var(--sev-high); background: var(--sev-high-soft); }
.badge-medium { color: var(--sev-medium); background: var(--sev-medium-soft); }
.badge-low { color: var(--sev-low); background: var(--sev-low-soft); }
.badge-neutral { color: var(--text-muted); background: var(--surface-2); }
.badge-accent { color: var(--accent); background: var(--accent-soft); }

/* ---------------------------- Formularios ---------------------------- */
.form { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field label { font-size: 12px; font-weight: 600; color: var(--text-muted); }
.req { color: var(--sev-critical); }
.field input, .field select, .field textarea, .filters input, .filters select {
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
  width: 100%;
}
.field textarea { resize: vertical; font-family: var(--font-mono); font-size: 12.5px; line-height: 1.6; }
.field input:focus, .field select:focus, .field textarea:focus,
.filters input:focus, .filters select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.hint { font-size: 11px; color: var(--text-dim); }
.form-actions { display: flex; gap: 10px; margin-top: 4px; }

.scope-status { font-size: 11.5px; min-height: 18px; font-weight: 500; }
.scope-status.ok { color: var(--sev-low); }
.scope-status.err { color: var(--sev-critical); }

.checkbox { display: flex; gap: 10px; align-items: flex-start; font-size: 12.5px; color: var(--text-muted); line-height: 1.5; cursor: pointer; }
.checkbox input { margin-top: 2px; width: 16px; height: 16px; accent-color: var(--accent); flex: none; }

.filters { display: flex; gap: 10px; flex-wrap: wrap; }
.filters input, .filters select { width: auto; min-width: 180px; }

.alert { padding: 10px 13px; border-radius: var(--radius-sm); font-size: 12.5px; border: 1px solid; }
.alert-error { color: var(--sev-critical); background: var(--sev-critical-soft); border-color: color-mix(in srgb, var(--sev-critical) 32%, transparent); }
.alert-info { color: var(--accent); background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 28%, transparent); }

/* ---------------------------- Operadoras ---------------------------- */
.operator-list { display: flex; flex-direction: column; max-height: 640px; overflow-y: auto; }
.operator-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px 14px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
}
.operator-row:last-child { border-bottom: none; }
.operator-row:hover { background: var(--surface-hover); }
.op-name { font-size: 13.5px; font-weight: 650; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.op-scope { font-family: var(--font-mono); font-size: 11.5px; color: var(--text-dim); word-break: break-all; }
.op-meta { grid-column: 1 / -1; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 2px; }
.op-actions { display: flex; gap: 6px; align-self: start; }

/* ------------------- Matriz de exposicao (operadoras x portas) ------------------- */
.exposure { display: flex; flex-direction: column; gap: 14px; }
.exposure-scroll { overflow-x: auto; overflow-y: hidden; padding-bottom: 4px; }

/* O SVG usa dimensoes reais em pixels; nao pode ser esticado pelo container,
   caso contrario o viewBox escala todo o desenho (texto, bolhas e barras). */
.em-svg { display: block; flex: none; max-width: none; font-family: var(--font-sans); }

/* faixas alternadas e guias */
.em-band { fill: color-mix(in srgb, var(--surface-2) 55%, transparent); }
.em-guide { stroke: var(--border); stroke-width: 1; stroke-dasharray: 2 6; opacity: .55; }

/* eixos e rotulos */
.em-axis { font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; fill: var(--text-dim); }
.em-port { font-size: 12px; font-weight: 700; fill: var(--text); font-variant-numeric: tabular-nums; }
.em-foot { font-size: 11px; fill: var(--text-muted); font-variant-numeric: tabular-nums; }
.em-op { font-size: 13px; font-weight: 650; fill: var(--text); }
.em-op-sub { font-size: 10.5px; fill: var(--text-dim); font-variant-numeric: tabular-nums; }

/* bolhas da matriz */
.em-void { fill: var(--border-strong); opacity: .45; }
.em-halo { opacity: .12; }
.em-bubble { fill-opacity: .34; stroke-width: 1.4; stroke-opacity: .85; transition: fill-opacity var(--transition), stroke-opacity var(--transition); }
.em-bubble-value { font-size: 10.5px; font-weight: 700; fill: var(--text); font-variant-numeric: tabular-nums; pointer-events: none; }
.em-cell { cursor: help; }
.em-cell:hover .em-bubble { fill-opacity: .62; stroke-opacity: 1; }
.em-cell:hover .em-halo { opacity: .26; }

/* barra empilhada de severidade */
.em-bar-track { fill: color-mix(in srgb, var(--surface-2) 70%, transparent); stroke: var(--border); stroke-width: 1; }
.em-seg rect { fill-opacity: .82; }
.em-seg:hover rect { fill-opacity: 1; }
.em-total { font-size: 12.5px; font-weight: 700; fill: var(--text); font-variant-numeric: tabular-nums; }
.em-row { cursor: help; }

/* legenda */
.exposure-legend {
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
  padding-top: 12px; border-top: 1px solid var(--border);
}
.em-legend-group { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.em-key { display: inline-flex; align-items: center; gap: 7px; font-size: 11.5px; color: var(--text-muted); }
.em-key i { width: 10px; height: 10px; border-radius: 50%; opacity: .55; box-shadow: 0 0 0 1px currentColor inset; }
.em-key-text { font-size: 11.5px; color: var(--text-dim); }
.em-scale { display: inline-flex; align-items: center; gap: 6px; }
.em-scale i { border-radius: 50%; background: var(--text-dim); opacity: .35; }
.em-scale i:nth-child(1) { width: 6px; height: 6px; }
.em-scale i:nth-child(2) { width: 11px; height: 11px; }
.em-scale i:nth-child(3) { width: 16px; height: 16px; }

/* ---------------------------- Scans ativos ---------------------------- */.active-scan { display: flex; flex-direction: column; gap: 9px; padding: 14px 0; border-bottom: 1px dashed var(--border); }
.active-scan:first-child { padding-top: 0; }
.active-scan:last-child { border-bottom: none; padding-bottom: 0; }
.as-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.as-name { font-size: 13.5px; font-weight: 650; }

/* Barra de progresso translucida (altura 20px) com o percentual sobreposto */
.progress {
  position: relative;
  height: 20px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface-2) 45%, transparent);
  border: 1px solid color-mix(in srgb, var(--border-strong) 65%, transparent);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  box-shadow: inset 0 1px 3px color-mix(in srgb, var(--bg) 55%, transparent);
  overflow: hidden;
}
.progress > span {
  position: relative;
  display: block;
  height: 100%;
  min-width: 0;
  border-radius: inherit;
  overflow: hidden;
  background: linear-gradient(90deg,
    color-mix(in srgb, var(--accent) 42%, transparent),
    color-mix(in srgb, var(--accent-hover) 66%, transparent));
  box-shadow: 0 0 16px color-mix(in srgb, var(--accent) 30%, transparent);
  transition: width .4s ease;
}
/* Sinal em movimento, reforcando que a varredura esta ativa */
.progress > span::after {
  content: "";
  position: absolute;
  top: 0; bottom: 0; left: -34px; right: -34px;
  background-image: repeating-linear-gradient(115deg,
    rgba(255, 255, 255, .14) 0 8px, transparent 8px 20px);
  animation: progress-stripes 1.2s linear infinite;
}
.progress-value {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .01em;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  text-shadow: 0 1px 3px color-mix(in srgb, var(--bg) 78%, transparent);
  pointer-events: none;
}
@keyframes progress-stripes {
  from { transform: translateX(0); }
  to   { transform: translateX(22.07px); }
}
@media (prefers-reduced-motion: reduce) {
  .progress > span::after { animation: none; }
}
.as-meta { display: flex; gap: 16px; font-size: 11.5px; color: var(--text-muted); flex-wrap: wrap; font-variant-numeric: tabular-nums; }

/* ---------------------------- Perfil de varredura ---------------------------- */
.profile-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.chip-warn { color: var(--sev-critical); background: var(--sev-critical-soft); border-color: color-mix(in srgb, var(--sev-critical) 30%, transparent); }

.profile-toolbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 11px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-elevated);
  flex-wrap: wrap;
}
.preset-group { display: flex; gap: 6px; flex-wrap: wrap; }
.preset {
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-muted);
  font-size: 12px; font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
}
.preset:hover { background: var(--accent-soft); color: var(--accent); border-color: color-mix(in srgb, var(--accent) 32%, transparent); }
.preset:active { transform: scale(.97); }
.toolbar-filters { display: flex; gap: 8px; flex-wrap: wrap; }
.toolbar-filters select, .toolbar-filters input {
  padding: 7px 11px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  outline: none;
  font-size: 12.5px;
  min-width: 172px;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.toolbar-filters select:focus, .toolbar-filters input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.table-select tbody tr { cursor: pointer; }
.table-select .col-check { width: 44px; text-align: center; padding-left: 16px; padding-right: 4px; }
.table-select input[type="checkbox"] {
  width: 16px; height: 16px;
  accent-color: var(--accent);
  cursor: pointer;
  vertical-align: middle;
}
.table-select tbody tr.is-off { opacity: .42; }
.table-select tbody tr.is-off:hover { opacity: .72; }
.table-select tbody tr.is-off td:not(.col-check) { text-decoration: line-through; text-decoration-color: var(--text-dim); text-decoration-thickness: 1px; }
.table-select tbody tr.is-off .badge { text-decoration: none; }

/* ---------------------------- Toast ---------------------------- */
.toast-stack { position: fixed; bottom: 22px; right: 22px; z-index: 200; display: flex; flex-direction: column; gap: 10px; }
.toast {
  min-width: 260px; max-width: 380px;
  padding: 12px 15px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  box-shadow: var(--shadow);
  font-size: 13px;
  animation: slide .25s ease;
}
.toast.ok { border-left-color: var(--sev-low); }
.toast.err { border-left-color: var(--sev-critical); }
.toast strong { display: block; font-size: 12.5px; margin-bottom: 2px; }
.toast span { color: var(--text-muted); font-size: 12px; }
@keyframes slide { from { opacity: 0; transform: translateX(24px); } to { opacity: 1; transform: none; } }

/* ============================================================
   RELATORIO EXECUTIVO (max. 3 paginas A4)
   ============================================================ */
.report-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.report-toolbar h2 { font-size: 17px; }
.report-actions { display: flex; gap: 10px; }
.report-root { display: flex; flex-direction: column; gap: 22px; align-items: center; }

.page {
  width: 210mm;
  min-height: 297mm;
  padding: 14mm 15mm 12mm;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: var(--shadow);
  display: flex; flex-direction: column;
  font-size: 9.6pt;
  line-height: 1.45;
}

.rpt-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; padding-bottom: 8px; border-bottom: 2px solid var(--accent); }
.rpt-header .rpt-brand { display: flex; align-items: center; gap: 10px; }
.rpt-logo { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 9px; background: var(--accent-soft); color: var(--accent); }
.rpt-title { font-size: 15pt; font-weight: 700; letter-spacing: -.02em; line-height: 1.15; }
.rpt-sub { font-size: 8pt; color: var(--text-muted); text-transform: uppercase; letter-spacing: .08em; }
.rpt-meta { text-align: right; font-size: 7.6pt; color: var(--text-muted); line-height: 1.5; }
.rpt-class { display: inline-block; margin-top: 3px; padding: 2px 7px; border-radius: 4px; font-size: 6.8pt; font-weight: 800; letter-spacing: .1em; color: var(--sev-critical); background: var(--sev-critical-soft); }

.rpt-section { margin-top: 9px; }
.rpt-section > h3 {
  font-size: 9.4pt; font-weight: 700; text-transform: uppercase; letter-spacing: .07em;
  color: var(--accent); margin-bottom: 5px; padding-bottom: 3px; border-bottom: 1px solid var(--border);
}
.rpt-p { font-size: 8.6pt; color: var(--text-muted); text-align: justify; margin-bottom: 5px; }
.rpt-p b { color: var(--text); }

.rpt-kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.rpt-kpi { padding: 7px 9px; border: 1px solid var(--border); border-left: 3px solid var(--k, var(--accent)); border-radius: 5px; background: var(--surface-2); }
.rpt-kpi .k-label { font-size: 6.6pt; text-transform: uppercase; letter-spacing: .06em; color: var(--text-dim); font-weight: 700; }
.rpt-kpi .k-value { font-size: 17pt; font-weight: 700; line-height: 1.1; letter-spacing: -.03em; }
.rpt-kpi .k-foot { font-size: 6.6pt; color: var(--text-muted); }

.rpt-table { width: 100%; border-collapse: collapse; font-size: 7.8pt; }
.rpt-table th {
  text-align: left; padding: 4px 6px;
  background: var(--surface-2);
  border-bottom: 1.2px solid var(--border-strong);
  font-size: 6.9pt; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: var(--text-dim);
}
.rpt-table td { padding: 3.6px 6px; border-bottom: .8px solid var(--border); }
.rpt-table tbody tr:nth-child(even) { background: color-mix(in srgb, var(--surface-2) 55%, transparent); }
.rpt-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.rpt-table .c { text-align: center; }

.rpt-pill { display: inline-block; padding: 1px 6px; border-radius: 999px; font-size: 6.6pt; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; }
.p-critical { color: var(--sev-critical); background: var(--sev-critical-soft); }
.p-high { color: var(--sev-high); background: var(--sev-high-soft); }
.p-medium { color: var(--sev-medium); background: var(--sev-medium-soft); }
.p-low { color: var(--sev-low); background: var(--sev-low-soft); }

.rpt-bars { display: flex; flex-direction: column; gap: 4px; }
.rpt-bar { display: grid; grid-template-columns: 66px 1fr 74px; align-items: center; gap: 7px; font-size: 7.6pt; }
.rpt-bar .track { height: 7px; background: var(--surface-2); border: .8px solid var(--border); border-radius: 999px; overflow: hidden; }
.rpt-bar .fill { height: 100%; border-radius: 999px; }
.rpt-bar .val { text-align: right; color: var(--text-muted); font-variant-numeric: tabular-nums; }

.rpt-ops { display: flex; flex-direction: column; gap: 6px; }
.rpt-op {
  border: 1px solid var(--border); border-radius: 6px; overflow: hidden;
  break-inside: avoid; page-break-inside: avoid;
}
.rpt-op-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 5px 8px; background: var(--surface-2); border-bottom: 1px solid var(--border); }
.rpt-op-name { font-size: 9pt; font-weight: 700; }
.rpt-op-scope { font-family: var(--font-mono); font-size: 6.8pt; color: var(--text-dim); }
.rpt-op-body { padding: 6px 8px; display: grid; grid-template-columns: 168px 1fr; gap: 10px; align-items: start; }
.rpt-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
.rpt-stat { padding: 4px 6px; border-radius: 4px; background: var(--surface-2); border: 1px solid var(--border); }
.rpt-stat .s-l { font-size: 6.2pt; text-transform: uppercase; letter-spacing: .05em; color: var(--text-dim); font-weight: 700; }
.rpt-stat .s-v { font-size: 11pt; font-weight: 700; line-height: 1.15; }

.rpt-actions-list { counter-reset: step; display: flex; flex-direction: column; gap: 5px; }
.rpt-action { display: grid; grid-template-columns: 20px 1fr; gap: 8px; padding: 6px 8px; border: 1px solid var(--border); border-radius: 5px; background: var(--surface-2); break-inside: avoid; }
.rpt-action .n { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; font-size: 7.6pt; font-weight: 800; background: var(--accent); color: #fff; }
.rpt-action h4 { font-size: 8.2pt; }
.rpt-action p { font-size: 7.4pt; color: var(--text-muted); }
.rpt-action .tag { font-size: 6.4pt; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--text-dim); }

.rpt-footer { margin-top: auto; padding-top: 7px; border-top: 1px solid var(--border); display: flex; justify-content: space-between; font-size: 6.8pt; color: var(--text-dim); }

.rpt-note { font-size: 7pt; color: var(--text-dim); font-style: italic; margin-top: 5px; }

/* ============================ AUTENTICACAO ============================ */

/* O shell so aparece quando a sessao esta validada. */
body[data-auth="pending"] .app-shell,
body[data-auth="anon"] .app-shell { display: none; }
body[data-auth="ok"] .auth-gate { display: none; }

.auth-gate {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  grid-template-columns: 1.05fr .95fr;
  /* translucido para que a malha neural do fundo permaneca visivel */
  background: color-mix(in srgb, var(--bg) 62%, transparent);
  overflow: auto;
}

.auth-aside {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 26px;
  padding: 56px 60px;
  background:
    radial-gradient(900px 520px at 12% 8%, color-mix(in srgb, var(--accent) 22%, transparent), transparent 62%),
    radial-gradient(700px 460px at 88% 92%, color-mix(in srgb, var(--sev-critical) 14%, transparent), transparent 60%),
    var(--bg-elevated);
  border-right: 1px solid var(--border);
}

.auth-brand { display: flex; align-items: center; gap: 13px; }
.auth-brand strong { display: block; font-size: 16px; letter-spacing: -.01em; }
.auth-brand span { font-size: 11px; color: var(--text-dim); text-transform: uppercase; letter-spacing: .09em; }

.auth-aside h2 {
  font-size: 30px;
  line-height: 1.22;
  letter-spacing: -.02em;
  max-width: 15ch;
  font-weight: 700;
}

.auth-points { display: flex; flex-direction: column; gap: 12px; max-width: 46ch; }
.auth-points li { display: flex; align-items: flex-start; gap: 11px; font-size: 13.5px; color: var(--text-muted); }
.auth-points li span {
  flex: 0 0 auto;
  width: 17px; height: 17px;
  margin-top: 1px;
  border-radius: 50%;
  background: var(--accent-soft);
  border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent);
  position: relative;
}
.auth-points li span::after {
  content: '';
  position: absolute; inset: 0;
  margin: auto;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent);
}

.auth-legal {
  max-width: 48ch;
  font-size: 11.5px;
  line-height: 1.6;
  color: var(--text-dim);
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.auth-panel {
  position: relative;
  display: grid;
  place-items: center;
  padding: 40px 24px;
}

.auth-theme { position: absolute; top: 22px; right: 22px; }

.auth-card {
  width: min(400px, 100%);
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px 30px;
  box-shadow: var(--shadow);
}
.auth-card h1 { font-size: 21px; letter-spacing: -.015em; }
.auth-sub { font-size: 13px; color: var(--text-muted); margin-top: -10px; }
.auth-submit { width: 100%; justify-content: center; padding: 11px 16px; font-size: 14px; }
.auth-note { font-size: 11.5px; color: var(--text-dim); text-align: center; }
.auth-actions { display: flex; gap: 10px; }
.auth-actions .btn { flex: 1; justify-content: center; }

.auth-error {
  display: flex;
  gap: 8px;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--sev-critical);
  background: color-mix(in srgb, var(--sev-critical) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--sev-critical) 34%, transparent);
  border-radius: var(--radius-sm);
  padding: 9px 11px;
}

.input-reveal { position: relative; display: block; }
.input-reveal input { width: 100%; padding-right: 42px; }
.reveal-btn {
  position: absolute;
  top: 50%; right: 6px;
  transform: translateY(-50%);
  display: grid; place-items: center;
  width: 30px; height: 30px;
  border: none; border-radius: 7px;
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
  transition: var(--transition);
}
.reveal-btn:hover { background: var(--surface-hover); color: var(--text); }
.reveal-btn svg { fill: currentColor; }
.reveal-btn.is-on { color: var(--accent); }

.strength { height: 5px; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--border); overflow: hidden; margin-top: 8px; }
.strength i { display: block; height: 100%; width: 0; border-radius: 99px; background: var(--sev-critical); transition: width .25s ease, background .25s ease; }
.strength[data-level="1"] i { width: 25%; background: var(--sev-critical); }
.strength[data-level="2"] i { width: 50%; background: var(--sev-high); }
.strength[data-level="3"] i { width: 75%; background: var(--sev-medium); }
.strength[data-level="4"] i { width: 100%; background: var(--sev-low); }

/* -------------------------- Menu de conta -------------------------- */

.account { position: relative; }
.account-btn {
  display: flex; align-items: center; gap: 9px;
  padding: 5px 10px 5px 5px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 99px;
  color: var(--text);
  cursor: pointer;
  transition: var(--transition);
}
.account-btn:hover { border-color: var(--border-strong); background: var(--surface-hover); }
.account-btn svg { fill: var(--text-dim); }
.avatar {
  display: grid; place-items: center;
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 11.5px; font-weight: 800; letter-spacing: .02em;
}
.account-id { display: flex; flex-direction: column; line-height: 1.2; text-align: left; }
.account-id strong { font-size: 12.5px; max-width: 130px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-id small { font-size: 10.5px; color: var(--text-dim); }

.account-menu {
  position: absolute;
  top: calc(100% + 9px); right: 0;
  z-index: 40;
  width: 262px;
  display: flex; flex-direction: column; gap: 3px;
  padding: 8px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.account-head { padding: 8px 9px 10px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.account-head strong { display: block; font-size: 13px; }
.account-head small { display: block; font-size: 11.5px; color: var(--text-dim); margin-bottom: 7px; }
.account-meta { display: flex; justify-content: space-between; gap: 10px; padding: 4px 9px; font-size: 11.5px; color: var(--text-dim); }
.account-meta b { color: var(--text-muted); font-weight: 600; }
.account-item {
  display: flex; align-items: center; gap: 9px;
  width: 100%;
  padding: 9px;
  margin-top: 2px;
  background: transparent;
  border: none; border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 12.5px; text-align: left;
  cursor: pointer;
  transition: var(--transition);
}
.account-item svg { fill: currentColor; }
.account-item:hover { background: var(--surface-hover); color: var(--text); }
.account-item.danger:hover { background: color-mix(in srgb, var(--sev-critical) 14%, transparent); color: var(--sev-critical); }

.role-chip {
  display: inline-flex; align-items: center;
  padding: 3px 9px;
  border-radius: 99px;
  font-size: 10.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid color-mix(in srgb, var(--accent) 32%, transparent);
}
.role-chip.is-operator {
  background: color-mix(in srgb, var(--sev-low) 14%, transparent);
  color: var(--sev-low);
  border-color: color-mix(in srgb, var(--sev-low) 34%, transparent);
}

/* -------------------------- Gestao de usuarios -------------------------- */

.role-hint {
  font-size: 11.5px;
  line-height: 1.55;
  color: var(--text-dim);
  background: var(--surface-2);
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 11px;
  margin-top: -4px;
}

.user-row { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.user-row:last-child { border-bottom: none; }
.user-row .avatar { width: 34px; height: 34px; font-size: 12px; }
.user-row .avatar.is-operator { background: var(--sev-low); }
.user-main { flex: 1; min-width: 0; }
.user-main strong { display: block; font-size: 13.5px; }
.user-main small { display: block; font-size: 11.5px; color: var(--text-dim); }
.user-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.user-actions { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.state-chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 8px; border-radius: 99px;
  font-size: 10.5px; font-weight: 600;
  background: var(--surface-2); color: var(--text-dim);
  border: 1px solid var(--border);
}
.state-chip.is-danger { color: var(--sev-critical); border-color: color-mix(in srgb, var(--sev-critical) 34%, transparent); background: color-mix(in srgb, var(--sev-critical) 12%, transparent); }
.state-chip.is-warn { color: var(--sev-high); border-color: color-mix(in srgb, var(--sev-high) 34%, transparent); background: color-mix(in srgb, var(--sev-high) 12%, transparent); }
.state-chip.is-ok { color: var(--sev-low); border-color: color-mix(in srgb, var(--sev-low) 34%, transparent); background: color-mix(in srgb, var(--sev-low) 12%, transparent); }

.secret-box {
  margin-top: 16px;
  padding: 14px;
  border-radius: var(--radius-sm);
  border: 1px solid color-mix(in srgb, var(--sev-medium) 42%, transparent);
  background: color-mix(in srgb, var(--sev-medium) 10%, transparent);
}
.secret-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 9px; }
.secret-head strong { font-size: 12.5px; color: var(--sev-medium); }
.secret-box code {
  display: block;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--bg);
  border: 1px solid var(--border);
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 14px; letter-spacing: .04em;
  word-break: break-all;
  -webkit-user-select: all;
  user-select: all;
}
.secret-actions { display: flex; align-items: center; gap: 10px; margin-top: 9px; flex-wrap: wrap; }
.secret-actions .muted { font-size: 11px; }

/* -------------------------- Painel deslizante -------------------------- */

.sheet-backdrop {
  position: fixed; inset: 0; z-index: 80;
  display: grid; place-items: center;
  padding: 24px;
  background: color-mix(in srgb, #000 62%, transparent);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
}
.sheet {
  width: min(430px, 100%);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 22px;
}
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.sheet-head h2 { font-size: 16px; }

/* ============================ IMPRESSAO ============================ */
@page { size: A4 portrait; margin: 0; }

@media print {
  html, body { background: #fff !important; background-image: none !important; }
  .sidebar, .topbar, .no-print, .toast-stack { display: none !important; }
  .auth-gate, .sheet-backdrop, .account-menu { display: none !important; }
  .app-shell { display: block; }
  .content { padding: 0; gap: 0; }
  .view { display: none !important; }
  .view[data-view="report"].is-active { display: block !important; }
  .report-root { gap: 0; display: block; }
  .page {
    width: 210mm; min-height: 297mm; height: 297mm;
    margin: 0; padding: 12mm 13mm 10mm;
    border: none; border-radius: 0; box-shadow: none;
    page-break-after: always; break-after: page;
    overflow: hidden;
  }
  .page:last-child { page-break-after: auto; break-after: auto; }
  * { -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important; }
}

/* ============================ RESPONSIVO ============================ */
@media (max-width: 1180px) {
  .grid-form { grid-template-columns: 1fr; }
}
@media (max-width: 980px) {
  .app-shell { grid-template-columns: 1fr; }
  .auth-gate { grid-template-columns: 1fr; }
  .auth-aside { display: none; }
  .account-id { display: none; }
  .account-btn { padding: 4px; }
  .sidebar {
    position: fixed; inset: 0 auto 0 0; width: 268px;
    transform: translateX(-100%);
    transition: transform var(--transition);
    box-shadow: var(--shadow);
  }
  .sidebar.is-open { transform: none; }
  .only-mobile { display: grid; }
  .content, .topbar { padding-left: 16px; padding-right: 16px; }
  .page { width: 100%; min-height: 0; padding: 16px; }
  .rpt-kpis { grid-template-columns: repeat(2, 1fr); }
  .rpt-op-body { grid-template-columns: 1fr; }
}
@media (max-width: 620px) {
  .field-row { grid-template-columns: 1fr; }
  .topbar-actions .btn span { display: none; }
  .kpi-value { font-size: 25px; }
  .auth-card { padding: 24px 20px; }
  .user-row { flex-wrap: wrap; }
  .user-actions { width: 100%; justify-content: flex-start; }
}
