/* RN Acessos - design system unico (sem declaracoes de prioridade forcada, sem recursos externos).
   Origem: rn-acessos-work/design/app.css (T4). Secao 21 = ajustes por pagina.
   Ordem: tokens > base > layout > componentes > utilitarios > responsivo > movimento reduzido.
   Tema: claro por padrao; escuro via prefers-color-scheme ou html[data-theme=dark]. */

/* T14: Barlow (SIL Open Font License), servida pelo próprio painel em /static (sem CDN). */
@font-face { font-family: Barlow; font-style: normal; font-weight: 400; font-display: swap; src: url("/static/barlow-400.woff2") format("woff2"); }
@font-face { font-family: Barlow; font-style: normal; font-weight: 500; font-display: swap; src: url("/static/barlow-500.woff2") format("woff2"); }
@font-face { font-family: Barlow; font-style: normal; font-weight: 600; font-display: swap; src: url("/static/barlow-600.woff2") format("woff2"); }
@font-face { font-family: "Barlow Semi Condensed"; font-style: normal; font-weight: 600; font-display: swap; src: url("/static/barlow-semicondensed-600.woff2") format("woff2"); }

/* ---------- 1. Tokens ---------- */
/* T18/T20: pedido do Rodrigo — verde = ok, azul-céu = atenção (T20, no lugar do amarelo), vermelho = problema, cinza-azulado = informação.
   O verde fica só nas marcas pequenas (ponto, ✓, faixa de 24 h, borda fina): cards e fundos continuam cinza, senão o
   amarelo e o vermelho perdem destaque. Estado nunca só por cor: .pill/.timeline-dot mudam de forma (✓ △ ◇ anel). */
:root {
  color-scheme: light;
  --font: Barlow, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: "Barlow Semi Condensed", Barlow, system-ui, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;

  /* escala de espacamento (4px) */
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 20px; --s6: 24px; --s8: 32px; --s10: 40px;
  /* raios: pequeno para controles, médio para blocos */
  --r-sm: 4px; --r-md: 6px; --r-lg: 10px; --r-pill: 999px;
  /* sombras discretas */
  --sh-1: 0 1px 2px rgba(20, 24, 28, .05);
  --sh-2: 0 8px 24px rgba(20, 24, 28, .16);
  /* tipografia (Barlow lê bem em tamanho menor que system-ui: escala um passo acima) */
  --fs-xs: 13px; --fs-sm: 14px; --fs-md: 15px; --fs-lg: 17px; --fs-xl: 21px; --fs-2xl: 28px;

  /* superficies: cinza claro, sem branco puro de fundo (menos brilho em turno longo) */
  --bg: #e9ecef;
  --surface: #f8f9fa;
  --surface-2: #f0f2f4;
  --border: #d5dae0;
  --border-strong: #b6bec7;
  --hover: #e3e7eb;

  /* texto */
  --text: #1a1f25;
  --muted: #56606b;
  --link: #0e6e43;

  /* acao primaria: verde-esmeralda (T19, pedido do Rodrigo) — mais escuro que o verde do "ok" para não confundir */
  --primary: #0f7a4a;
  --primary-hover: #0b5e39;
  --on-primary: #ffffff;
  --focus: #0f7a4a;

  /* estados: fg (texto), bg (fundo suave), dot (marca/grafico) */
  --ok-fg: #1d6b35;   --ok-bg: #e2f3e7;   --ok-dot: #2e9a4f;
  --warn-fg: #0b5a8a; --warn-bg: #e1f1fc; --warn-dot: #2b8fd6;
  --crit-fg: #a3122b; --crit-bg: #fbe0e4; --crit-dot: #c8102e;
  --info-fg: #4a5866; --info-bg: #e8edf1; --info-dot: #8796a5;
  --unk-fg: #56606b;  --unk-bg: #edf0f2;  --unk-dot: #aeb7c1;
  --ready-fg: #3d5a78; --ready-dot: #5f7d9c;
  --fail-fg: #9e3530;  --fail-bg: #fbe6e4;  --fail-dot: #d0564f;  /* T32: failover (vermelho suave) */  /* T31: link reserva pronto (azul-acinzentado, ≠ azul-céu de atenção) */
  --danger: #b3261e;
  --danger-hover: #8f1d17;

  /* sidebar (grafite nos dois temas) */
  --side-bg: #171b1f;
  --side-text: #c9cfd5;
  --side-muted: #8d97a1;
  --side-hover: #22282e;
  --side-active-bg: #2a3138;
  --side-active-fg: #ffffff;
  --side-accent: #5fd39a;
  --side-border: #262c32;
  --side-w: 224px;
  --top-h: 52px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme=light]) {
    color-scheme: dark;
    --bg: #111417;
    --surface: #181c20;
    --surface-2: #1e2328;
    --border: #2b3138;
    --border-strong: #3d454e;
    --hover: #232930;
    --text: #e3e7eb;
    --muted: #9aa4ae;
    --link: #5fd39a;
    --primary: #0f7a4a;
    --primary-hover: #0e6e43;
    --focus: #5fd39a;
    --ok-fg: #8fdba8;   --ok-bg: #14291b;   --ok-dot: #3dbd66;
    --warn-fg: #a8d8fb; --warn-bg: #0f2a3d; --warn-dot: #7cc4f5;
    --crit-fg: #ff8f9c; --crit-bg: #43121b; --crit-dot: #ff4d63;
    --info-fg: #a9b6c2; --info-bg: #20272e; --info-dot: #6e7d8b;
    --unk-fg: #9aa4ae;  --unk-bg: #1e2328;  --unk-dot: #59636d;
    --ready-fg: #a9c0db; --ready-dot: #7f9bbd;
    --fail-fg: #ffb4ad;  --fail-bg: #3a1d1b;  --fail-dot: #ec7b72;
    --danger: #ff6a5f;
    --danger-hover: #ff857c;
    --sh-1: 0 1px 2px rgba(0, 0, 0, .35);
    --sh-2: 0 8px 24px rgba(0, 0, 0, .6);
    --side-bg: #0b0d0f;
    --side-border: #1d2227;
  }
}

:root[data-theme=dark] {
  color-scheme: dark;
  --bg: #111417;
  --surface: #181c20;
  --surface-2: #1e2328;
  --border: #2b3138;
  --border-strong: #3d454e;
  --hover: #232930;
  --text: #e3e7eb;
  --muted: #9aa4ae;
  --link: #5fd39a;
  --primary: #0f7a4a;
  --primary-hover: #0e6e43;
  --focus: #5fd39a;
  --ok-fg: #8fdba8;   --ok-bg: #14291b;   --ok-dot: #3dbd66;
  --warn-fg: #a8d8fb; --warn-bg: #0f2a3d; --warn-dot: #7cc4f5;
  --crit-fg: #ff8f9c; --crit-bg: #43121b; --crit-dot: #ff4d63;
  --info-fg: #a9b6c2; --info-bg: #20272e; --info-dot: #6e7d8b;
  --unk-fg: #9aa4ae;  --unk-bg: #1e2328;  --unk-dot: #59636d;
    --ready-fg: #a9c0db; --ready-dot: #7f9bbd;
    --fail-fg: #ffb4ad;  --fail-bg: #3a1d1b;  --fail-dot: #ec7b72;
  --danger: #ff6a5f;
  --danger-hover: #ff857c;
  --sh-1: 0 1px 2px rgba(0, 0, 0, .35);
  --sh-2: 0 8px 24px rgba(0, 0, 0, .6);
  --side-bg: #0b0d0f;
  --side-border: #1d2227;
}

/* ---------- 2. Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 var(--fs-md)/1.5 var(--font);
  overflow-wrap: anywhere;
}
h1, h2, h3 { margin: 0; line-height: 1.25; font-weight: 600; }
h1 { font-size: var(--fs-xl); letter-spacing: -.01em; }
h2 { font-size: var(--fs-lg); }
h3 { font-size: var(--fs-md); }
p { margin: 0 0 var(--s3); }
a { color: var(--link); text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }
img, svg { max-width: 100%; }
code, kbd, .mono { font-family: var(--mono); font-size: .92em; }
.mono { font-variant-numeric: tabular-nums; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: var(--fs-xs); }

:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: var(--r-sm); }
:focus:not(:focus-visible) { outline: none; }

.sr-only {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: var(--s2); top: -48px; z-index: 100;
  background: var(--primary); color: var(--on-primary);
  padding: var(--s2) var(--s3); border-radius: var(--r-md);
}
.skip-link:focus { top: var(--s2); }

/* ---------- 3. Layout ---------- */
.app { display: flex; min-height: 100vh; min-height: 100dvh; }

.sidebar {
  position: sticky; top: 0; align-self: flex-start;
  width: var(--side-w); flex: 0 0 var(--side-w);
  height: 100vh; height: 100dvh;
  display: flex; flex-direction: column;
  background: var(--side-bg); color: var(--side-text);
  border-right: 1px solid var(--side-border);
  overflow-y: auto;
  z-index: 40;
}
.brand {
  display: flex; align-items: center; gap: var(--s2);
  height: var(--top-h); padding: 0 var(--s4);
  color: #fff; font-weight: 600; font-size: var(--fs-lg); letter-spacing: -.01em;
  border-bottom: 1px solid var(--side-border);
  text-decoration: none;
}
.brand-mark {
  width: 22px; height: 22px; border-radius: var(--r-sm);
  background: var(--side-accent); flex: none;
}
.nav { padding: var(--s3) var(--s2); display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav-label {
  padding: var(--s3) var(--s3) var(--s1);
  font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase;
  color: var(--side-muted);
}
.nav-item {
  display: flex; align-items: center; gap: var(--s3);
  min-height: 36px; padding: 0 var(--s3);
  color: var(--side-text); text-decoration: none;
  border-radius: var(--r-md); border-left: 3px solid transparent;
  font-size: var(--fs-md);
}
.nav-item svg { width: 16px; height: 16px; flex: none; opacity: .85; }
.nav-item:hover { background: var(--side-hover); color: #fff; }
.nav-item[aria-current=page], .nav-item.active {
  background: var(--side-active-bg); color: var(--side-active-fg);
  border-left-color: var(--side-accent); font-weight: 600;
}
.nav-item:focus-visible { outline-color: #fff; }
.nav-count {
  margin-left: auto; font-size: var(--fs-xs); font-variant-numeric: tabular-nums;
  background: var(--crit-dot); color: #fff; border-radius: var(--r-pill); padding: 0 6px; min-width: 20px; text-align: center;
}
.side-foot {
  padding: var(--s3); border-top: 1px solid var(--side-border);
  display: flex; flex-direction: column; gap: var(--s2);
}
.side-user { display: flex; align-items: center; gap: var(--s2); min-width: 0; }
.avatar {
  width: 28px; height: 28px; flex: none; border-radius: 50%;
  background: var(--side-active-bg); color: #fff;
  display: grid; place-items: center; font-size: var(--fs-xs); font-weight: 600;
}
.side-user-meta { min-width: 0; line-height: 1.25; }
.side-user-meta b { display: block; font-size: var(--fs-sm); color: #fff; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-user-meta span { font-size: var(--fs-xs); color: var(--side-muted); }
.side-btn {
  display: flex; align-items: center; gap: var(--s2); width: 100%; min-height: 32px;
  padding: 0 var(--s3); background: transparent; color: var(--side-text);
  border: 1px solid var(--side-border); border-radius: var(--r-md);
  font: inherit; font-size: var(--fs-sm); cursor: pointer; text-decoration: none;
}
.side-btn:hover { background: var(--side-hover); color: #fff; }
.side-btn:focus-visible { outline-color: #fff; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30;
  height: var(--top-h); display: flex; align-items: center; gap: var(--s3);
  padding: 0 var(--s6);
  background: var(--surface); border-bottom: 1px solid var(--border);
}
.topbar-title { font-size: var(--fs-md); font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar-spacer { flex: 1; }
.menu-btn { display: none; }
.scrim { display: none; }

.content { width: 100%; max-width: 1480px; padding: var(--s6); margin: 0 auto; flex: 1; }
.page-head {
  display: flex; align-items: flex-end; justify-content: space-between; flex-wrap: wrap;
  gap: var(--s3); margin-bottom: var(--s5);
}
.page-head p { margin: var(--s1) 0 0; color: var(--muted); font-size: var(--fs-sm); }
.page-actions { display: flex; gap: var(--s2); flex-wrap: wrap; }

.stack > * + * { margin-top: var(--s4); }
.row { display: flex; align-items: center; gap: var(--s3); flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.grid { display: grid; gap: var(--s4); }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.rail { grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); align-items: start; }
.grid.auto { grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr)); }
.span-all { grid-column: 1 / -1; }

/* ---------- 4. Card ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); box-shadow: var(--sh-1);
  min-width: 0;
}
.card-head {
  display: flex; align-items: center; justify-content: space-between; gap: var(--s3);
  padding: var(--s3) var(--s4); border-bottom: 1px solid var(--border);
  min-height: 44px;
}
.card-head h2 { font-size: var(--fs-md); }
.card-head .sub { color: var(--muted); font-size: var(--fs-xs); }
.card-body { padding: var(--s4); }
.card-foot { padding: var(--s2) var(--s4); border-top: 1px solid var(--border); font-size: var(--fs-sm); color: var(--muted); }
.card.flat { box-shadow: none; }
.card.secondary { background: var(--surface-2); }

/* ---------- 5. Faixa de estado global ---------- */
.statusbar {
  display: flex; align-items: center; flex-wrap: wrap; gap: var(--s3) var(--s6);
  padding: var(--s3) var(--s4);
  background: var(--surface); border: 1px solid var(--border);
  border-left: 4px solid var(--unk-dot); border-radius: var(--r-lg);
  margin-bottom: var(--s4);
}
.statusbar.ok { border-left-color: var(--ok-dot); }
.statusbar.warn { border-left-color: var(--warn-dot); }
.statusbar.crit { border-left-color: var(--crit-dot); }
.statusbar-title { font-size: var(--fs-lg); font-weight: 600; display: flex; align-items: center; gap: var(--s2); }
.statusbar-title::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--unk-dot); }
.statusbar.ok .statusbar-title::before { background: var(--ok-dot); }
.statusbar.warn .statusbar-title::before { background: var(--warn-dot); }
.statusbar.crit .statusbar-title::before { background: var(--crit-dot); }
.statusbar-sub { color: var(--muted); font-size: var(--fs-sm); }
.counters { display: flex; gap: var(--s5); margin-left: auto; flex-wrap: wrap; }
.counter { display: flex; align-items: baseline; gap: var(--s2); font-size: var(--fs-sm); color: var(--muted); }
.counter b { font-size: var(--fs-xl); font-variant-numeric: tabular-nums; color: var(--text); line-height: 1; }
.counter.ok b { color: var(--ok-fg); }
.counter.warn b { color: var(--warn-fg); }
.counter.crit b { color: var(--crit-fg); }

/* ---------- 6. Metricas ---------- */
.metrics { display: grid; gap: var(--s3); grid-template-columns: repeat(auto-fit, minmax(min(100%, 120px), 1fr)); }
.metric { padding: var(--s3); background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-md); min-width: 0; }
.metric span { display: block; font-size: var(--fs-xs); color: var(--muted); }
.metric b { display: block; font-size: var(--fs-xl); font-weight: 600; font-variant-numeric: tabular-nums; line-height: 1.3; }
.metric small { font-size: var(--fs-xs); color: var(--muted); font-weight: 400; }
.meter { height: 6px; border-radius: var(--r-pill); background: var(--hover); overflow: hidden; margin-top: var(--s2); }
.meter > i { display: block; height: 100%; background: var(--ok-dot); border-radius: inherit; }
.meter.warn > i { background: var(--warn-dot); }
.meter.crit > i { background: var(--crit-dot); }

/* ---------- 7. Tabela ---------- */
.table-wrap { width: 100%; overflow-x: auto; }
.table-wrap.scroll { max-height: 70vh; overflow-y: auto; }
.table {
  width: 100%; border-collapse: separate; border-spacing: 0;
  font-size: var(--fs-sm); font-variant-numeric: tabular-nums;
}
.table th, .table td {
  height: 36px; padding: 0 var(--s3); text-align: left; vertical-align: middle;
  border-bottom: 1px solid var(--border); white-space: nowrap;
}
.table th {
  position: sticky; top: 0; z-index: 1;
  background: var(--surface-2); color: var(--muted);
  font-size: var(--fs-xs); font-weight: 600; letter-spacing: .03em; text-transform: uppercase;
  border-bottom: 1px solid var(--border-strong);
}
.table tbody tr:hover { background: var(--hover); }
.table tbody tr:last-child td { border-bottom: 0; }
.table td.wrap { white-space: normal; }
.table .right, .table th.right { text-align: right; }
.table .actions { text-align: right; width: 1%; }
.table .name { font-weight: 600; }
.table .empty-row td { height: auto; padding: var(--s6); text-align: center; color: var(--muted); white-space: normal; }

/* ---------- 8. Pills de status ---------- */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  height: 22px; padding: 0 var(--s2);
  border-radius: var(--r-pill); font-size: var(--fs-xs); font-weight: 600; white-space: nowrap;
  background: var(--unk-bg); color: var(--unk-fg);
}
.pill::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--unk-dot); flex: none; }
.pill.ok { background: var(--ok-bg); color: var(--ok-fg); }
.pill.ok::before { background: var(--ok-dot); }
.pill.warn { background: var(--warn-bg); color: var(--warn-fg); }
.pill.warn::before { background: var(--warn-dot); }
.pill.crit { background: var(--crit-bg); color: var(--crit-fg); }
.pill.crit::before { background: var(--crit-dot); }
.pill.unk { background: var(--unk-bg); color: var(--unk-fg); }
.tag {
  display: inline-block; height: 20px; line-height: 18px; padding: 0 var(--s2);
  border: 1px solid var(--border-strong); border-radius: var(--r-sm);
  font-size: var(--fs-xs); color: var(--muted); white-space: nowrap;
}

/* ---------- 9. Botoes ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s2);
  min-height: 34px; padding: 0 var(--s4);
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border-strong); border-radius: var(--r-md);
  font: inherit; font-size: var(--fs-sm); font-weight: 500; line-height: 1.2;
  text-decoration: none; cursor: pointer; white-space: nowrap;
}
.btn:hover { background: var(--hover); }
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn[aria-disabled=true] { opacity: .55; cursor: not-allowed; transform: none; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.btn.primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn.danger { background: transparent; border-color: var(--danger); color: var(--danger); }
.btn.danger:hover { background: var(--danger); color: #fff; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text); }
.btn.ghost:hover { background: var(--hover); }
.btn.sm { min-height: 28px; padding: 0 var(--s3); font-size: var(--fs-xs); }
.btn.icon-only { width: 34px; padding: 0; }
.btn.icon-only.sm { width: 28px; }
.btn svg { width: 16px; height: 16px; flex: none; }
.btn-group { display: inline-flex; gap: var(--s1); }

/* ---------- 10. Formularios ---------- */
.form-grid { display: grid; gap: var(--s4); grid-template-columns: repeat(2, minmax(0, 1fr)); }
.field { display: flex; flex-direction: column; gap: var(--s1); font-size: var(--fs-sm); font-weight: 500; min-width: 0; }
.field.full { grid-column: 1 / -1; }
.field .hint { font-weight: 400; font-size: var(--fs-xs); color: var(--muted); }
.field .err { font-weight: 400; font-size: var(--fs-xs); color: var(--crit-fg); }
.input, .select, .textarea {
  width: 100%; min-height: 36px; padding: 0 var(--s3);
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border-strong); border-radius: var(--r-md);
  font: inherit; font-size: var(--fs-md); font-weight: 400;
}
.textarea { padding: var(--s2) var(--s3); min-height: 80px; resize: vertical; }
.input::placeholder, .textarea::placeholder { color: var(--muted); opacity: .85; }
.input:hover, .select:hover, .textarea:hover { border-color: var(--muted); }
.input:focus-visible, .select:focus-visible, .textarea:focus-visible {
  outline: 2px solid var(--focus); outline-offset: 0; border-color: var(--focus);
}
.input[aria-invalid=true] { border-color: var(--crit-dot); }
.input:disabled, .select:disabled { background: var(--surface-2); color: var(--muted); }
.toolbar { display: flex; align-items: center; gap: var(--s3); flex-wrap: wrap; padding: var(--s3) var(--s4); border-bottom: 1px solid var(--border); }
.toolbar .input, .toolbar .select { width: auto; }
.toolbar .grow { flex: 1 1 220px; }
.form-error { color: var(--crit-fg); font-size: var(--fs-sm); min-height: 1.5em; margin: 0; }
.form-actions { display: flex; gap: var(--s2); justify-content: flex-end; flex-wrap: wrap; margin-top: var(--s5); }

/* T5: seção "Monitoramento" do formulário de acesso */
.form-section { margin: var(--s5) 0 0; padding: var(--s3) var(--s4) var(--s4); border: 1px solid var(--border); border-radius: var(--r-md); min-width: 0; }
.form-section legend { padding: 0 var(--s1); font-size: var(--fs-sm); font-weight: 600; }
.check { display: flex; align-items: center; gap: var(--s2); font-size: var(--fs-sm); font-weight: 500; cursor: pointer; }
.check.full { grid-column: 1 / -1; }
.check input { width: 16px; height: 16px; margin: 0; accent-color: var(--primary); }

/* ---------- 11. Modal ---------- */
.modal {
  position: fixed; inset: 0; z-index: 60;
  display: none; align-items: center; justify-content: center;
  padding: var(--s4); background: rgba(8, 14, 20, .6);
}
.modal.open { display: flex; }
.modal-box {
  width: 100%; max-width: 640px; max-height: calc(100dvh - 32px);
  display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  box-shadow: var(--sh-2);
}
.modal-box.narrow { max-width: 420px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: var(--s3) var(--s5); border-bottom: 1px solid var(--border); }
.modal-body { padding: var(--s5); overflow-y: auto; }
.secret-box {
  font-family: var(--mono); font-size: var(--fs-lg); padding: var(--s3) var(--s4);
  background: var(--surface-2); border: 1px dashed var(--border-strong); border-radius: var(--r-md);
  user-select: all; word-break: break-all; white-space: pre-wrap;
}

/* ---------- 12. Toast ---------- */
.toasts {
  position: fixed; right: var(--s4); bottom: var(--s4); z-index: 80;
  display: flex; flex-direction: column; gap: var(--s2); max-width: min(360px, calc(100vw - 32px));
}
.toast {
  padding: var(--s3) var(--s4); background: var(--text); color: var(--bg);
  border-radius: var(--r-md); box-shadow: var(--sh-2); font-size: var(--fs-sm);
  border-left: 4px solid var(--ok-dot);
}
.toast.warn { border-left-color: var(--warn-dot); }
.toast.crit { border-left-color: var(--crit-dot); }

/* ---------- 13. Empty state / skeleton ---------- */
.empty { padding: var(--s8) var(--s4); text-align: center; color: var(--muted); }
.empty svg { width: 32px; height: 32px; margin-bottom: var(--s2); opacity: .6; }
.empty b { display: block; color: var(--text); font-size: var(--fs-md); margin-bottom: var(--s1); }
.empty .btn { margin-top: var(--s3); }

/* ---------- 14. Listas / feed (alertas, backups, agenda) ---------- */
.list { list-style: none; margin: 0; padding: 0; }
.list > li {
  display: flex; align-items: center; gap: var(--s3);
  min-height: 40px; padding: var(--s2) var(--s4);
  border-bottom: 1px solid var(--border); font-size: var(--fs-sm);
}
.list > li:last-child { border-bottom: 0; }
.list .grow { flex: 1; min-width: 0; }
.list .when { color: var(--muted); font-size: var(--fs-xs); font-variant-numeric: tabular-nums; white-space: nowrap; }
.list .title { font-weight: 500; }
.list .detail { color: var(--muted); font-size: var(--fs-xs); }
.timeline-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--unk-dot); flex: none; }
.timeline-dot.ok { background: var(--ok-dot); }
.timeline-dot.warn { background: var(--warn-dot); }
.timeline-dot.crit { background: var(--crit-dot); }

/* ---------- 15. Equipamentos (grade NOC) ---------- */
.device-grid { display: grid; gap: var(--s3); grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr)); }
.device {
  display: flex; flex-direction: column; gap: var(--s2);
  padding: var(--s3) var(--s4);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  border-top: 3px solid var(--unk-dot); min-width: 0;
}
.device.ok { border-top-color: var(--ok-dot); }
.device.warn { border-top-color: var(--warn-dot); }
.device.crit { border-top-color: var(--crit-dot); }
.device-head { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--s2); }
.device-name { font-weight: 600; font-size: var(--fs-md); line-height: 1.3; }
.device-meta { font-size: var(--fs-xs); color: var(--muted); }
.device-meta .mono { color: var(--text); }
.device-stats { display: flex; gap: var(--s4); font-size: var(--fs-xs); color: var(--muted); }
.device-stats b { display: block; color: var(--text); font-size: var(--fs-sm); font-variant-numeric: tabular-nums; }

.spark { display: block; width: 100%; height: 28px; color: var(--ok-dot); }
.spark.warn { color: var(--warn-dot); }
.spark.crit { color: var(--crit-dot); }
.spark.unk { color: var(--unk-dot); }
.spark polyline { fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.spark .area { fill: currentColor; stroke: none; opacity: .12; }

/* T5: complementos do NOC (grade real, estados vazios, status na tabela) */
.device.unk { border-top-color: var(--unk-dot); }
.device-head .grow { min-width: 0; }
.device-name { overflow-wrap: anywhere; }
.device-stats { flex-wrap: wrap; }
.device-grid > .empty, .device-grid > p { grid-column: 1 / -1; }
.spark-empty { display: flex; align-items: center; height: 28px; font-size: var(--fs-xs); color: var(--muted); }
.card-tools { display: flex; align-items: center; gap: var(--s3); flex-wrap: wrap; justify-content: flex-end; }
.status-cell { white-space: nowrap; }
.status-cell .lat { font-size: var(--fs-xs); color: var(--muted); font-variant-numeric: tabular-nums; margin-left: var(--s1); }

/* ---------- 16. Chat compacto ---------- */
.chat-messages { max-height: 220px; min-height: 96px; overflow-y: auto; padding: var(--s3) var(--s4); display: flex; flex-direction: column; gap: var(--s2); }
.chatMsg { max-width: 92%; padding: var(--s2) var(--s3); border-radius: var(--r-md); font-size: var(--fs-sm); background: var(--surface-2); border: 1px solid var(--border); white-space: pre-wrap; }
.chatMsg.user { align-self: flex-end; background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.chatMeta { font-size: 11px; font-weight: 600; opacity: .75; margin-bottom: 2px; }
.chatActions { display: flex; gap: var(--s1); margin-top: var(--s1); }
.chatActions button {
  min-height: 24px; padding: 0 var(--s2); background: transparent; color: var(--link);
  border: 1px solid var(--border-strong); border-radius: var(--r-sm); font: inherit; font-size: var(--fs-xs); cursor: pointer;
}
.chatActions button:hover { background: var(--hover); }
.chat-status { min-height: 1.4em; padding: 0 var(--s4); font-size: var(--fs-xs); color: var(--muted); }
.chat-form { display: flex; gap: var(--s2); padding: var(--s3) var(--s4); border-top: 1px solid var(--border); }
.chat-form .input { flex: 1; min-width: 0; }
.chat-quick { display: flex; gap: var(--s2); flex-wrap: wrap; padding: 0 var(--s4) var(--s2); }

/* ---------- 17. Agenda (mini calendario) ---------- */
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; padding: var(--s3) var(--s4); }
.cal-cell { aspect-ratio: 1; min-height: 28px; display: grid; place-items: center; position: relative; font-size: var(--fs-xs); border-radius: var(--r-sm); font-variant-numeric: tabular-nums; }
.cal-cell.head { aspect-ratio: auto; min-height: 20px; color: var(--muted); font-weight: 600; }
.cal-cell.today { background: var(--primary); color: var(--on-primary); font-weight: 600; }
.cal-cell.has::after { content: ""; position: absolute; bottom: 3px; width: 4px; height: 4px; border-radius: 50%; background: var(--warn-dot); }

/* ---------- 18. Login ---------- */
.auth-wrap { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: var(--s4); }
.auth-card { width: 100%; max-width: 380px; padding: var(--s8) var(--s6); }
.auth-card .brand { color: var(--text); border: 0; padding: 0; height: auto; margin-bottom: var(--s5); }
.auth-card h1 { font-size: var(--fs-lg); }
.auth-card .btn { width: 100%; min-height: 40px; }

/* ---------- 19. Utilitarios ---------- */
.mt-0 { margin-top: 0; } .mt-2 { margin-top: var(--s2); } .mt-4 { margin-top: var(--s4); } .mt-6 { margin-top: var(--s6); }
.mb-4 { margin-bottom: var(--s4); }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.hidden { display: none; }
/* .admin-only e so cosmetico: o servidor continua negando rotas/APIs (require_admin).
   Esconde para qualquer papel diferente de Administrador (inclui Operador). */
body:not([data-role=Administrador]) .admin-only { display: none; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

/* ---------- 21. Ajustes por pagina ---------- */
/* Comum: botao "Sair" no rodape da sidebar e titulo de secao vazio */
.side-btn[disabled] { opacity: .6; cursor: progress; }
.page-head .muted { margin: var(--s1) 0 0; }

/* Dashboard (/) - alterna entre visao dashboard e lista de acessos */
.view[hidden] { display: none; }
.cal-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s2); padding: var(--s3) var(--s4) 0; }
.cal-head h3 { font-size: var(--fs-sm); text-transform: capitalize; }
button.cal-cell { border: 0; background: transparent; color: inherit; font: inherit; font-size: var(--fs-xs); cursor: pointer; }
button.cal-cell:not(.today):hover { background: var(--hover); }
.weather-now { display: flex; align-items: baseline; gap: var(--s3); margin-bottom: var(--s3); }
.weather-now b { font-size: var(--fs-2xl); font-weight: 600; font-variant-numeric: tabular-nums; line-height: 1; }
.list > li.muted { color: var(--muted); }

/* Lista de acessos */
.toolbar .count { margin-left: auto; }

/* Agenda (/calendar) - tarefa concluida */
.table tr.done td { color: var(--muted); }
.table tr.done td.name { text-decoration: line-through; }

/* Backup (/backup) */
.notice { display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap; min-height: 1.5em; font-size: var(--fs-sm); }
.list .btn { flex: none; }

/* ---------- 20. Responsivo ---------- */
@media (max-width: 1100px) {
  .grid.rail, .grid.cols-3 { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 860px) {
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0;
    transform: translateX(-100%); visibility: hidden;
    transition: transform .2s ease, visibility 0s linear .2s;
    box-shadow: var(--sh-2);
  }
  body.menu-open .sidebar { transform: none; visibility: visible; transition: transform .2s ease; }
  body.menu-open .scrim { display: block; position: fixed; inset: 0; z-index: 35; background: rgba(8, 14, 20, .55); }
  .menu-btn { display: inline-flex; }
  .topbar { padding: 0 var(--s4); }
  .content { padding: var(--s4); }
  .grid.cols-2 { grid-template-columns: minmax(0, 1fr); }
  .counters { margin-left: 0; }
}

@media (max-width: 520px) {
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .page-head h1 { font-size: var(--fs-lg); }
  .toolbar .input, .toolbar .select { width: 100%; }
  .modal { padding: var(--s2); align-items: flex-end; }
  .modal-body { padding: var(--s4); }
  .toasts { left: var(--s4); right: var(--s4); max-width: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms; animation-duration: .01ms; scroll-behavior: auto; }
  .btn:active { transform: none; }
}

/* Atributo hidden sempre vence o display dos componentes de mesma especificidade declarados antes. */
[hidden] { display: none; }

/* T6: card MikroTik (métricas do coletor REST) */
.metric .spark, .metric .spark-empty { margin-top: var(--s2); }
.metric b.text { font-size: var(--fs-md); overflow-wrap: anywhere; }
.router-note { margin: var(--s3) 0 0; font-size: var(--fs-xs); color: var(--muted); overflow-wrap: anywhere; }
.router-sub { margin: var(--s4) 0 0; font-size: var(--fs-sm); font-weight: 600; }
.router-sub .sub { font-weight: 400; color: var(--muted); margin-left: var(--s2); }
.router-note .pill { margin: 0 var(--s1) var(--s1) 0; }
#routerPill .pill { max-width: 40ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* T13: card Proxmox (VMs com detalhe da configuração) */
.pve-table td { vertical-align: top; }
.pve-table .meter { margin-top: var(--s1); min-width: 64px; }
.pve-toggle { padding: 0 var(--s1); font-weight: 600; text-align: left; white-space: normal; }
.pve-row.open td { border-bottom-color: transparent; }
.pve-detail-row > td { background: var(--surface-2); padding: var(--s3) var(--s4) var(--s4); }
.pve-detail { margin: 0; }
.pve-lists { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: var(--s4); margin-top: var(--s3); }
.pve-lists h4 { margin: 0 0 var(--s1); font-size: var(--fs-xs); font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.pve-lists ul { margin: 0; padding: 0; list-style: none; font-size: var(--fs-sm); }
.pve-lists li { padding: 2px 0; overflow-wrap: anywhere; }

/* T14: NOC — frase de estado, mapa de dependências, atenção, internet, câmeras */
.noc-hero { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: var(--s4) var(--s6); margin-bottom: var(--s6); }
.noc-hero-text { display: flex; flex-direction: column; gap: var(--s2); max-width: 820px; min-width: 0; }
.noc-meta { margin: 0; color: var(--muted); font-size: var(--fs-sm); }
.noc-title { margin: 0; font-family: var(--font-display); font-size: 40px; line-height: 1.08; font-weight: 600; letter-spacing: -.01em; display: flex; align-items: center; gap: var(--s3); }
.noc-title::before { content: ""; flex: none; width: 14px; height: 14px; border-radius: 50%; background: var(--unk-dot); }
.noc-hero.ok .noc-title::before { background: var(--ok-dot); }
.noc-hero.warn .noc-title::before { background: var(--warn-dot); }
.noc-hero.crit .noc-title::before { background: var(--crit-dot); }
.noc-lead { margin: 0; color: var(--muted); font-size: var(--fs-lg); max-width: 72ch; }
.noc-lead:empty { display: none; }
.noc-counts { display: flex; flex-wrap: wrap; gap: var(--s1) var(--s4); color: var(--muted); font-size: var(--fs-sm); }
.noc-counts b { color: var(--text); font-variant-numeric: tabular-nums; }
.noc-section { display: flex; flex-direction: column; gap: var(--s3); margin-bottom: var(--s6); min-width: 0; }
.noc-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--s1) var(--s4); }
.noc-head h2, .noc-row .card-head h2, #pveTitle { font-family: var(--font-display); font-size: var(--fs-xl); font-weight: 600; margin: 0; }
.noc-head p { margin: 0; color: var(--muted); font-size: var(--fs-sm); }
.noc-row { display: flex; flex-wrap: wrap; gap: var(--s6); align-items: flex-start; margin-bottom: var(--s6); }
.noc-row > .noc-section { flex: 2 1 340px; margin-bottom: 0; }
.noc-row > .noc-wide { flex: 3 1 520px; }
.noc-row.thirds > .card { flex: 1 1 320px; min-width: 0; }
.noc-item { flex-wrap: wrap; gap: var(--s2) var(--s3); }
.noc-item .pill { flex: none; }
.noc-item .title { font-weight: 600; }
.t-ok { color: var(--ok-fg); } .t-warn { color: var(--warn-fg); } .t-crit { color: var(--crit-fg); } .t-unk, .t-muted { color: var(--muted); }

/* Mapa: colunas internet → roteador → dependentes; ligações em CSS (bordas), sem posição absoluta dos cards. */
.depmap { display: grid; grid-template-columns: minmax(200px, 250px) minmax(220px, 270px) minmax(0, 1fr); align-items: center; overflow-x: auto; padding: var(--s2) 0; }
.dep-in, .dep-out { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--s3); }
.dep-in > li, .dep-out > li { position: relative; }
.dep-in > li { margin-right: 48px; }
.dep-out > li { margin-left: 48px; }
.dep-in > li::before, .dep-out > li::before { content: ""; position: absolute; top: 50%; width: 24px; border-top: 2px solid var(--border-strong); }
.dep-in > li::before { right: -24px; }
.dep-out > li::before { left: -24px; }
.dep-in > li::after, .dep-out > li::after { content: ""; position: absolute; top: calc(var(--s3) / -2); bottom: calc(var(--s3) / -2); width: 0; border-left: 2px solid var(--border-strong); }
.dep-in > li::after { right: -25px; }
.dep-out > li::after { left: -25px; }
.dep-in > li:first-child::after, .dep-out > li:first-child::after { top: 50%; }
.dep-in > li:last-child::after, .dep-out > li:last-child::after { bottom: 50%; }
.dep-in > li.main::before, .dep-in > li.main::after { border-color: var(--ok-dot); border-width: 3px; }
.dep-in > li.standby::before, .dep-in > li.standby::after { border-style: dashed; }
.dep-in > li.crit::before, .dep-in > li.crit::after { border-color: var(--crit-dot); }
.dep-core { position: relative; }
.dep-core::before, .dep-core::after { content: ""; position: absolute; top: 50%; width: 24px; border-top: 2px solid var(--border-strong); }
.dep-core::before { left: -24px; }
.dep-core::after { right: -24px; }
.dep-node { display: flex; align-items: center; gap: var(--s3); padding: var(--s3) var(--s4); background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-lg); min-height: 64px; box-sizing: border-box; }
.dep-node.ok { border-color: var(--ok-dot); }
.dep-node.warn { border-color: var(--warn-dot); }
.dep-node.crit { border-color: var(--crit-dot); background: var(--crit-bg); }
.dep-node.unk { border-style: dashed; border-color: var(--border-strong); }
.dep-icon { width: 22px; height: 22px; flex: none; color: var(--muted); }
.dep-node.ok .dep-icon { color: var(--ok-fg); } .dep-node.warn .dep-icon { color: var(--warn-fg); } .dep-node.crit .dep-icon { color: var(--crit-fg); }
.dep-text { display: flex; flex-direction: column; min-width: 0; font-size: var(--fs-sm); line-height: 1.35; }
.dep-text b { font-size: var(--fs-md); overflow-wrap: anywhere; }
.dep-text span { overflow-wrap: anywhere; }
.dep-out { display: grid; grid-template-columns: minmax(0, 1fr); }
@media (max-width: 860px) {
  .depmap { grid-template-columns: minmax(0, 1fr); gap: var(--s5); overflow: visible; }
  .dep-in > li, .dep-out > li { margin: 0; }
  .dep-in > li::before, .dep-in > li::after, .dep-out > li::before, .dep-out > li::after { display: none; }
  .dep-core::before { left: 50%; top: calc(var(--s5) * -1); width: 0; height: var(--s5); border-top: 0; border-left: 2px solid var(--border-strong); }
  .dep-core::after { left: 50%; right: auto; top: 100%; width: 0; height: var(--s5); border-top: 0; border-left: 2px solid var(--border-strong); }
  .dep-in { flex-direction: row; flex-wrap: wrap; }
  .dep-in > li { flex: 1 1 140px; }
  .dep-out { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
  .noc-title { font-size: 30px; }
}

/* Internet: um gráfico por WAN, mesma escala */
.net-wan + .net-wan { margin-top: var(--s5); }
.net-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: var(--s2); }
.net-now { color: var(--muted); }
.net-now b { font-family: var(--font-display); font-size: 26px; font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }
.net-spark { display: block; width: 100%; height: 56px; margin-top: var(--s2); overflow: visible; }
.net-spark .base { stroke: var(--border); stroke-width: 1; vector-effect: non-scaling-stroke; }
.net-spark polyline { fill: none; stroke: var(--link); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.net-spark.ok polyline { stroke: var(--ok-dot); }
.net-spark.crit polyline { stroke: var(--crit-dot); }
.net-axis { display: flex; justify-content: space-between; gap: var(--s2); color: var(--muted); font-size: var(--fs-xs); margin-top: var(--s1); font-variant-numeric: tabular-nums; }
.net-foot { margin: var(--s4) 0 0; padding-top: var(--s3); border-top: 1px solid var(--border); color: var(--muted); font-size: var(--fs-sm); }

/* Equipamentos (linha compacta) e câmeras */
.dev-row .detail .mono { color: var(--text); }
.dev-lat { display: flex; flex-direction: column; align-items: flex-end; text-align: right; flex: none; }
.dev-lat b { font-variant-numeric: tabular-nums; }
.noc-list > li.empty { display: block; }
.cam-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s2); margin-top: var(--s4); }
.cam { display: flex; flex-direction: column; gap: 2px; padding: var(--s3); border-radius: var(--r-lg); background: var(--surface-2); border: 1px solid var(--border); min-width: 0; overflow-wrap: anywhere; }
.cam.warn { background: var(--warn-bg); border-color: var(--warn-dot); }
.cam.unk { border-style: dashed; }
@media (max-width: 520px) { .cam-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* Detalhes recolhidos (MikroTik e Zabbix completos) */
.noc-more { margin-bottom: var(--s6); }
.noc-more > summary { cursor: pointer; font-weight: 600; padding: var(--s3) 0; min-height: 44px; box-sizing: border-box; color: var(--link); }
.noc-more[open] > summary { margin-bottom: var(--s3); }

/* ---------- T16: forma + cor (estado nunca só pela cor) ---------- */
.pill.info { background: var(--info-bg); color: var(--info-fg); }
.pill.info::before, .timeline-dot.info { background: var(--info-dot); border-radius: 2px; }
.pill.warn::before, .timeline-dot.warn { border-radius: 0; clip-path: polygon(50% 0, 100% 100%, 0 100%); width: 10px; height: 9px; }
.pill.crit::before, .timeline-dot.crit { border-radius: 0; clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%); width: 10px; height: 10px; }
.pill.unk::before, .timeline-dot.unk { background: transparent; box-shadow: inset 0 0 0 2px var(--unk-dot); }
.pill.crit { font-weight: 600; }

/* Mapa calmo: normal em cinza; só o que está fora do normal ganha cor. */
.dep-node.ok { border-color: var(--border); }
.dep-node.ok .dep-icon { color: var(--muted); }
.dep-node.warn { background: var(--warn-bg); }
.dep-in > li.main::before, .dep-in > li.main::after { border-color: var(--muted); }
.dep-node .t-ok { color: var(--text); }
.net-spark.ok polyline { stroke: var(--text); }
.net-spark polyline { stroke: var(--muted); }
.t-info { color: var(--info-fg); }

/* Hero: frase grande; frescor dos dados logo abaixo */
.noc-title { font-size: 44px; }
.noc-fresh { display: inline-flex; align-items: center; gap: var(--s2); }
.noc-fresh.stale { color: var(--warn-fg); font-weight: 600; }
.noc-actions { display: flex; gap: var(--s2); flex-wrap: wrap; }

/* Disponibilidade 24 h: uma linha por equipamento, 24 blocos (1 por hora, o último é a hora atual) */
.avail { list-style: none; margin: 0; padding: 0; }
.avail-row { display: grid; grid-template-columns: minmax(140px, 1.1fr) minmax(200px, 2fr) 64px 72px; gap: var(--s2) var(--s4); align-items: center; padding: var(--s3) var(--s4); border-bottom: 1px solid var(--border); }
.avail-row:last-child { border-bottom: 0; }
.avail-name { min-width: 0; }
.avail-name .title { font-weight: 600; overflow-wrap: anywhere; display: flex; align-items: center; gap: var(--s2); }
.avail-name .detail { color: var(--muted); font-size: var(--fs-xs); overflow-wrap: anywhere; }
.avail-bar { display: grid; grid-template-columns: repeat(24, minmax(0, 1fr)); gap: 2px; }
.avail-bar i { display: block; height: 20px; border-radius: 2px; background: var(--ok-dot); opacity: .55; }
.avail-bar i.degraded { background: var(--warn-dot); opacity: 1; }
.avail-bar i.down { background: var(--crit-dot); opacity: 1; }
.avail-bar i.none { background: transparent; box-shadow: inset 0 0 0 1px var(--border-strong); opacity: 1; }
.avail-num { text-align: right; font-variant-numeric: tabular-nums; }
.avail-num b { display: block; }
.avail-num span { color: var(--muted); font-size: var(--fs-xs); }
.avail-scale { display: flex; justify-content: space-between; color: var(--muted); font-size: var(--fs-xs); padding: var(--s2) var(--s4) 0; }
.avail-legend { display: flex; flex-wrap: wrap; gap: var(--s1) var(--s4); color: var(--muted); font-size: var(--fs-xs); padding: var(--s3) var(--s4); border-top: 1px solid var(--border); }
.avail-legend i { display: inline-block; width: 12px; height: 12px; border-radius: 2px; vertical-align: -1px; margin-right: var(--s1); background: var(--ok-dot); opacity: .55; }
.avail-legend i.degraded { background: var(--warn-dot); opacity: 1; }
.avail-legend i.down { background: var(--crit-dot); opacity: 1; }
.avail-legend i.none { background: transparent; box-shadow: inset 0 0 0 1px var(--border-strong); opacity: 1; }
@media (max-width: 640px) {
  .avail-row { grid-template-columns: minmax(0, 1fr) auto; }
  .avail-bar { grid-column: 1 / -1; grid-row: 2; }
  .avail-num.lat { display: none; }
}

/* Rotina (inventário, agenda, chat) separada do NOC */
.noc-rotina-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--s1) var(--s4); margin: var(--s8) 0 var(--s3); padding-top: var(--s6); border-top: 1px solid var(--border-strong); }
.noc-rotina-head h2 { margin: 0; font-family: var(--font-display); font-size: var(--fs-xl); font-weight: 600; }
.noc-rotina-head p { margin: 0; color: var(--muted); font-size: var(--fs-sm); }

/* Modo TV: só o NOC, letra maior, sem menu; Esc ou o botão saem */
body.tv .sidebar, body.tv .topbar, body.tv .page-head, body.tv .noc-rotina, body.tv .noc-more, body.tv .admin-only.noc-run { display: none; }
body.tv .content { max-width: none; padding: var(--s6) var(--s10); }
body.tv { font-size: 17px; }
body.tv .noc-title { font-size: 60px; }
body.tv .noc-lead { font-size: 21px; }
body.tv .dep-text { font-size: var(--fs-md); }
body.tv .avail-bar i { height: 26px; }
.noc-row > .noc-half { flex: 1 1 380px; min-width: 0; }

/* ---------- T17: Dashboard em duas colunas (NOC | Agenda + Jarbas) ---------- */
.dash-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0 var(--s6); }
.dash-rail { display: flex; flex-direction: column; gap: var(--s4); margin-bottom: var(--s6); min-width: 0; }
.dash-rail .chat-messages { max-height: 340px; }
@media (min-width: 1360px) {
  .dash-grid { grid-template-columns: minmax(0, 1fr) 360px; grid-template-areas: "top rail" "main rail"; }
  .dash-top { grid-area: top; min-width: 0; }
  .dash-main { grid-area: main; min-width: 0; }
  .dash-rail { grid-area: rail; align-self: start; }
  .dash-rail .cal-grid { font-size: var(--fs-xs); }
}
body.tv .dash-grid { grid-template-columns: minmax(0, 1fr); grid-template-areas: none; }
body.tv .dash-rail { display: none; }

/* ---------- T17: menu lateral em grupos recolhíveis ---------- */
.nav { gap: 0; }
.nav-group { display: flex; flex-direction: column; gap: 2px; padding-bottom: var(--s2); }
.nav-group + .nav-group { border-top: 1px solid var(--side-border); padding-top: var(--s2); }
.nav-group-head { display: flex; align-items: center; justify-content: space-between; width: 100%; min-height: 32px; padding: 0 var(--s3); background: transparent; border: 0; border-radius: var(--r-md); color: var(--side-muted); font: 600 12px/1 var(--font); letter-spacing: .04em; cursor: pointer; text-align: left; }
.nav-group-head:hover { color: var(--side-text); background: var(--side-hover); }
.nav-group-head:focus-visible { outline: 2px solid #fff; outline-offset: -2px; }
.nav-group-head::after { content: ""; width: 7px; height: 7px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg) translateY(-2px); transition: transform .15s ease; }
.nav-group.closed .nav-group-head::after { transform: rotate(-45deg); }
.nav-group.closed .nav-group-items { display: none; }
.nav-group-items { display: flex; flex-direction: column; gap: 2px; }
.nav-item.sub { min-height: 32px; padding-left: calc(var(--s3) + 26px); font-size: var(--fs-sm); color: var(--side-muted); }
.nav-item.sub svg { display: none; }
.nav-item.sub:hover, .nav-item.sub[aria-current=page] { color: var(--side-active-fg); }
.nav-count { background: var(--side-active-bg); color: var(--side-text); font-weight: 600; }
.nav-count.warn { background: var(--warn-dot); color: #062033; }
.nav-count.crit { background: var(--crit-dot); color: #fff; }
.nav-count:empty { display: none; }
.rotina-grid { align-items: start; }
@media (max-width: 1100px) { .rotina-grid { grid-template-columns: minmax(0, 1fr); } }

/* ---------- T18: verde discreto ---------- */
.pill.ok { background: transparent; color: var(--text); box-shadow: inset 0 0 0 1px var(--border); }
.pill.ok::before, .timeline-dot.ok { background: var(--ok-dot); }
.dep-node.ok { border-color: var(--border); }
.dep-node.ok .dep-icon { color: var(--ok-dot); }
.dep-node .t-ok { color: var(--ok-fg); }
.dep-in > li.main::before, .dep-in > li.main::after { border-color: var(--ok-dot); }
.net-spark.ok polyline { stroke: var(--ok-dot); }
.avail-bar i, .avail-legend i { background: var(--ok-dot); opacity: .7; }
.cam.ok { border-color: var(--border); }
.noc-hero.ok .noc-title::before { background: var(--ok-dot); }

/* ---------- T18: Jarbas flutuante ---------- */
.content { padding-bottom: 96px; }
.toasts { bottom: 84px; }
.jarbas-fab { position: fixed; right: var(--s5); bottom: var(--s5); z-index: 60; display: inline-flex; align-items: center; gap: var(--s2); min-height: 48px; padding: 0 var(--s5) 0 var(--s4); border-radius: var(--r-pill); border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); box-shadow: var(--sh-2); font: 600 var(--fs-md) var(--font); cursor: pointer; }
.jarbas-fab svg { width: 20px; height: 20px; color: var(--primary); }
.jarbas-fab:hover { background: var(--hover); }
.jarbas-fab[aria-expanded=true] { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.jarbas-fab[aria-expanded=true] svg { color: var(--on-primary); }
.jarbas-panel { position: fixed; right: var(--s5); bottom: 80px; z-index: 61; width: min(400px, calc(100vw - 32px)); height: min(560px, calc(100vh - 112px)); display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--r-lg); box-shadow: var(--sh-2); }
.jarbas-panel[hidden] { display: none; }
.jarbas-head { display: flex; align-items: flex-start; gap: var(--s2); padding: var(--s3) var(--s3) var(--s3) var(--s4); border-bottom: 1px solid var(--border); }
.jarbas-head .grow { flex: 1; min-width: 0; }
.jarbas-head h2 { margin: 0; font-family: var(--font-display); font-size: var(--fs-lg); font-weight: 600; }
.jarbas-head p { margin: 2px 0 0; color: var(--muted); font-size: var(--fs-xs); }
.jarbas-panel .chat-messages { flex: 1; max-height: none; }
.jarbas-panel .chat-quick { padding-top: var(--s2); }
@media (max-width: 640px) {
  .jarbas-panel { inset: 0; width: auto; height: auto; border-radius: 0; border: 0; }
  .jarbas-fab { width: 52px; padding: 0; justify-content: center; }
  .jarbas-fab span { display: none; }
}
body.tv .jarbas-fab, body.tv .jarbas-panel { display: none; }

/* ---------- T18: páginas do NOC (/noc/<visão>) e bloco Hoje ---------- */
#dashboardView[data-noc-view=geral] [data-noc]:not([data-noc~=geral]),  /* T21: faltava (Dashboard mostrava Proxmox, DVR, atenção...) */
#dashboardView[data-noc-view=internet] [data-noc]:not([data-noc~=internet]),
#dashboardView[data-noc-view=rede] [data-noc]:not([data-noc~=rede]),
#dashboardView[data-noc-view=servidores] [data-noc]:not([data-noc~=servidores]),
#dashboardView[data-noc-view=cameras] [data-noc]:not([data-noc~=cameras]),
#dashboardView[data-noc-view=alertas] [data-noc]:not([data-noc~=alertas]) { display: none; }
#dashboardView:not([data-noc-view=geral]) .noc-more > summary { display: none; }
#dashboardView:not([data-noc-view=geral]) .page-actions { display: none; }
.noc-head-tools { margin-left: auto; display: inline-flex; align-items: center; gap: var(--s3); }
.today-list .when { min-width: 72px; color: var(--text); font-weight: 600; }
.today-list li.done .title { text-decoration: line-through; color: var(--muted); }
.nav-item.sub svg { display: block; width: 14px; height: 14px; opacity: .7; }
.nav-item.sub { padding-left: calc(var(--s3) + 14px); }

/* ---------- T20: Dashboard enxuto, vistos e filtros dos logs ---------- */
/* No Dashboard o estado é uma linha só (a lista completa fica em NOC > Alertas). */
#dashboardView[data-noc-view=geral] .noc-hero { align-items: center; padding: var(--s3) var(--s4); background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); margin-bottom: var(--s5); }
#dashboardView[data-noc-view=geral] .noc-hero-text { flex-direction: row; flex-wrap: wrap; align-items: baseline; gap: var(--s1) var(--s4); max-width: none; }
#dashboardView[data-noc-view=geral] .noc-title { font-size: var(--fs-xl); order: -1; }
#dashboardView[data-noc-view=geral] .noc-title::before { width: 12px; height: 12px; }
#dashboardView[data-noc-view=geral] .noc-lead, #dashboardView[data-noc-view=geral] .noc-counts { display: none; }
#dashboardView[data-noc-view=geral] .noc-meta { font-size: var(--fs-xs); }
#dashboardView[data-noc-view=geral] .noc-hero.warn { border-color: var(--warn-dot); }
#dashboardView[data-noc-view=geral] .noc-hero.crit { border-color: var(--crit-dot); background: var(--crit-bg); }
#dashboardView:not([data-noc-view=geral]) .noc-alerts-link { display: none; }
body.tv #dashboardView[data-noc-view=geral] .noc-title { font-size: 40px; }

.noc-item.seen { opacity: .72; }
.noc-item.seen .title { font-weight: 500; }
.noc-list > li.seen-head { display: block; padding: var(--s2) var(--s4); font-size: var(--fs-xs); font-weight: 600; color: var(--muted); background: var(--surface-2); }

.log-filters { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2) var(--s4); padding: var(--s3) var(--s4); border-bottom: 1px solid var(--border); }
.log-chips { display: flex; flex-wrap: wrap; gap: var(--s2); }
.chip { min-height: 32px; padding: 0 var(--s3); border-radius: var(--r-pill); border: 1px solid var(--border-strong); background: transparent; color: var(--text); font: 500 var(--fs-sm) var(--font); cursor: pointer; }
.chip:hover { background: var(--hover); }
.chip[aria-pressed=true] { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.log-only { display: inline-flex; align-items: center; gap: var(--s2); font-size: var(--fs-sm); }
.log-search { margin-left: auto; width: min(260px, 100%); }
@media (max-width: 640px) { .log-search { margin-left: 0; width: 100%; } }

/* T23: no Dashboard, a linha de estado ("Tudo no ar") vem antes do título da página. */
#dashboardView[data-noc-view=geral] { display: flex; flex-direction: column; }
#dashboardView[data-noc-view=geral] > .noc-hero { order: -1; }

/* ---------- T24: faixa "RN NOC" animada (só no Dashboard) ---------- */
#dashboardView[data-noc-view=geral] > .noc-banner { order: -2; }
#dashboardView[data-noc-view=geral] > .page-head { display: none; }
.noc-banner { display: flex; align-items: center; gap: var(--s6); padding: var(--s3) var(--s5); margin-bottom: var(--s3); background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); min-width: 0; }
.noc-brand { display: flex; align-items: center; gap: var(--s3); flex: none; }
.noc-mark { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 12px; background: var(--primary); color: var(--on-primary); font: 600 24px/1 var(--font-display); letter-spacing: .02em; }
.noc-word { font: 600 36px/1 var(--font-display); letter-spacing: .1em; color: var(--text); }
.noc-art { flex: 1; min-width: 0; height: 88px; overflow: visible; }
.noc-line { fill: none; stroke: var(--border-strong); stroke-width: 2; stroke-dasharray: 1; stroke-dashoffset: 1; animation: noc-draw 1.4s ease-out .1s forwards; }
.noc-flow { fill: none; stroke: var(--ok-dot); stroke-width: 5; stroke-linecap: round; stroke-dasharray: 1 47; opacity: 0; animation: noc-flow 3.6s linear 1.4s infinite, noc-show .4s ease-out 1.4s forwards; }
.noc-banner.warn .noc-flow { stroke: var(--warn-dot); }
.noc-banner.crit .noc-flow { stroke: var(--crit-dot); animation-duration: 1.8s, .4s; }
.noc-node circle { fill: var(--surface); stroke: var(--ok-dot); stroke-width: 3; }
.noc-node.warn circle { stroke: var(--warn-dot); fill: var(--warn-bg); }
.noc-node.crit circle { stroke: var(--crit-dot); fill: var(--crit-bg); stroke-width: 4; }
.noc-node text { fill: var(--muted); font: 500 14px var(--font); text-anchor: middle; }
.noc-node.warn text { fill: var(--warn-fg); }
.noc-node.crit text { fill: var(--crit-fg); font-weight: 600; }
.noc-end { fill: var(--border-strong); }
@keyframes noc-draw { to { stroke-dashoffset: 0; } }
@keyframes noc-flow { to { stroke-dashoffset: -48; } }
@keyframes noc-show { to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  .noc-line { animation: none; stroke-dashoffset: 0; }
  .noc-flow { animation: none; opacity: 1; }
}
@media (max-width: 640px) {
  .noc-banner { gap: var(--s3); padding: var(--s2) var(--s3); }
  .noc-mark { width: 40px; height: 40px; font-size: 19px; border-radius: 10px; }
  .noc-word { font-size: 26px; }
  .noc-art { height: 64px; }
  .noc-node text { font-size: 22px; }
}
body.tv .noc-art { height: 120px; }
body.tv .noc-word { font-size: 48px; }
body.tv .noc-mark { width: 68px; height: 68px; font-size: 30px; }

/* T24: ícones nos pontos da faixa (nuvem, roteador, computador, câmera); mesma cor do estado do ponto. */
.noc-node circle { stroke-width: 2.5; }
.noc-ico { fill: none; stroke: var(--ok-dot); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.noc-node.warn .noc-ico { stroke: var(--warn-fg); }
.noc-node.crit .noc-ico { stroke: var(--crit-fg); }

/* T25: Internet em linha inteira — um gráfico por WAN, lado a lado (empilha em tela estreita). */
.net-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); gap: var(--s5) var(--s8); }
.net-grid > .net-wan + .net-wan { margin-top: 0; }
.net-grid > .net-foot, .net-grid > p { grid-column: 1 / -1; margin-top: 0; }

/* T26: link "Ver todos" no fim dos Logs da rede do Dashboard */
.list > li.log-more { justify-content: center; }

/* T27: download (linha cheia, cor do estado) e upload (tracejada) por link */
.net-now { display: inline-flex; gap: var(--s4); align-items: baseline; }
.net-dir { color: var(--muted); white-space: nowrap; }
.net-dir b { font-family: var(--font-display); font-size: 24px; font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }
.net-spark polyline.ul { stroke: var(--muted); stroke-width: 1.5; stroke-dasharray: 4 3; }
.net-legend { display: inline-flex; align-items: center; gap: var(--s2); margin-right: var(--s3); white-space: nowrap; }
.net-legend i { display: inline-block; width: 18px; height: 0; border-top: 2px solid var(--ok-dot); vertical-align: middle; }
.net-legend i.ul { border-top: 2px dashed var(--muted); margin-left: var(--s2); }
.net-spark.alt polyline.dl { stroke: var(--text); }

/* T28: faixa só com ícones (o nome aparece ao passar o mouse); altura menor sem a linha de nomes. */
.noc-art { height: 76px; }
.noc-node { cursor: default; }
@media (max-width: 640px) { .noc-art { height: 56px; } }
body.tv .noc-art { height: 104px; }

/* T29: Links — gráficos mais altos e mais afastados (com divisória entre as operadoras). */
.net-grid { column-gap: 64px; }
.net-grid > .net-wan { min-width: 0; }
/* T30: em tela larga, cada operadora com ~42% da linha — a primeira na esquerda, a segunda (Claro) na ponta direita. */
@media (min-width: 1100px) {
  .net-grid { display: flex; flex-wrap: wrap; justify-content: space-between; row-gap: var(--s5); }
  .net-grid > .net-wan { flex: 0 1 42%; }
  .net-grid > .net-foot, .net-grid > p { flex: 1 0 100%; }
}
.net-grid .net-spark { height: 120px; }
body.tv .net-grid .net-spark { height: 160px; }

/* T31: link reserva pronto — mesmo destaque da saída principal (borda e linha cheias), em azul-acinzentado. */
.dep-in > li.ready::before, .dep-in > li.ready::after { border-style: solid; border-color: var(--ready-dot); border-width: 3px; }
.dep-node.ready { border-color: var(--ready-dot); }
.dep-node.ready .dep-icon { color: var(--ready-dot); }
.t-ready, .dep-node .t-ready { color: var(--ready-fg); }
.net-spark.alt polyline.dl { stroke: var(--ready-dot); }

/* T32: failover — link em uso, link preferido sem internet e MikroTik em vermelho suave. */
.dep-node.fail { border-color: var(--fail-dot); background: var(--fail-bg); }
.dep-node.fail .dep-icon { color: var(--fail-dot); }
.t-fail, .dep-node .t-fail { color: var(--fail-fg); }
.dep-in > li.fail::before, .dep-in > li.fail::after { border-style: solid; border-color: var(--fail-dot); border-width: 3px; }

/* T37: recuperação de senha e página do SMTP */
.auth-alt { margin: var(--s4) 0 0; text-align: center; }
.form-msg { margin: 0; min-height: 1.5em; font-size: var(--fs-sm); color: var(--ok-fg); }
.form-msg.crit { color: var(--crit-fg); }
.smtp-card { max-width: 860px; }

/* ---------- T39: marca RN (trilha de rede com pacote correndo) ---------- */
.rn-logo { flex: none; display: block; }
.rn-logo .rn-bg { fill: var(--primary); }
.rn-logo .rn-trace { fill: none; stroke: #ffffff; stroke-width: 4.4; stroke-linecap: round; stroke-linejoin: round; }
.rn-logo .rn-src { fill: #ffffff; }
.rn-logo .rn-up { fill: #5fd39a; stroke: var(--primary); stroke-width: 2; }
.rn-logo .rn-pkt { fill: #b8f7d4; stroke: var(--primary); stroke-width: 1.2; }
.rn-logo-sm { width: 38px; height: 38px; }
.rn-logo-lg { width: 64px; height: 64px; }
.rn-logo-noc { width: 60px; height: 60px; }
body.tv .rn-logo-noc { width: 80px; height: 80px; }
.brand { height: auto; min-height: 64px; padding: var(--s3) var(--s4); gap: var(--s3); }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; min-width: 0; }
.brand-text b { font-family: var(--font-display); font-size: 21px; font-weight: 600; letter-spacing: .01em; color: #fff; }
.brand-text small { font-size: 12px; font-weight: 500; color: var(--side-muted); margin-top: 3px; white-space: nowrap; }
.auth-card .brand { display: flex; align-items: center; gap: var(--s4); margin-bottom: var(--s6); }
.auth-card .brand-text b { color: var(--text); font-size: 26px; }
.auth-card .brand-text small { color: var(--muted); font-size: 13px; }
@media (max-width: 640px) { .rn-logo-noc { width: 44px; height: 44px; } }

/* T39b: marca RN como cabo de rede (conectores RJ45 + LED de link). O ícone da aba continua a trilha simples (rn-logo.svg). */
.rn-logo .rn-cable { fill: none; stroke: #ffffff; stroke-width: 5; stroke-linecap: round; stroke-linejoin: round; }
.rn-logo .rn-cable-core { fill: none; stroke: #cfeedd; stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; opacity: .9; }
.rn-logo .rn-plug rect { fill: #ffffff; }
.rn-logo .rn-plug .rn-plug-tip { fill: #e6f5ec; stroke: #ffffff; stroke-width: .8; }
.rn-logo .rn-pins { fill: none; stroke: #d4a72c; stroke-width: .9; stroke-linecap: round; }
.rn-logo .rn-led { fill: #5fd39a; stroke: var(--primary); stroke-width: 1; }
.rn-logo .rn-pkt { stroke-width: 1; }
/* T39c: dois pacotes — TX (verde) vai da origem ao uplink; RX (âmbar, como o LED de atividade do switch) volta no sentido contrário. */
.rn-logo .rn-tx { fill: #b8f7d4; stroke: var(--primary); }
.rn-logo .rn-rx { fill: #f6c85f; stroke: var(--primary); }

/* T40 — Backup da rede (/backup-rede). T40d: reescrito pelo agente de front-end; tudo escopado em .nb-* (e .modal-box.wide).
   Linguagem do NOC: frase de estado com forma + cor, tabela calma (só a régua fina à esquerda e a .pill mostram o estado),
   cartões no celular, diff com números de linha. */
.modal-box.wide { max-width: 1120px; }

/* Frase de estado */
.nb-hero { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s3) var(--s6); padding: var(--s4) var(--s5); margin-bottom: var(--s4); background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); min-width: 0; }
.nb-hero.warn { border-color: var(--warn-dot); }
.nb-hero.crit { border-color: var(--crit-dot); background: var(--crit-bg); }
.nb-hero-text { min-width: 0; flex: 1 1 420px; }
.nb-hero-title { margin: 0; display: flex; align-items: center; gap: var(--s3); font-family: var(--font-display); font-size: 28px; line-height: 1.15; font-weight: 600; letter-spacing: -.01em; }
.nb-hero-title::before { content: ""; flex: none; width: 14px; height: 14px; border-radius: 50%; background: transparent; box-shadow: inset 0 0 0 2px var(--unk-dot); }
.nb-hero.ok .nb-hero-title::before { background: var(--ok-dot); box-shadow: none; }
.nb-hero.info .nb-hero-title::before { background: var(--info-dot); box-shadow: none; border-radius: 2px; }
.nb-hero.warn .nb-hero-title::before { background: var(--warn-dot); box-shadow: none; border-radius: 0; clip-path: polygon(50% 0, 100% 100%, 0 100%); width: 16px; }
.nb-hero.crit .nb-hero-title::before { background: var(--crit-dot); box-shadow: none; border-radius: 0; clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%); width: 16px; height: 16px; }
.nb-hero.crit .nb-hero-title { color: var(--crit-fg); }
.nb-hero-meta { display: flex; flex-wrap: wrap; gap: var(--s1) var(--s5); margin: var(--s2) 0 0; color: var(--muted); font-size: var(--fs-sm); }
.nb-hero-meta:empty { display: none; }
.nb-hero-meta b { color: var(--text); font-weight: 600; }
.nb-hero-side { display: flex; flex-direction: column; align-items: flex-end; gap: var(--s1); }
.nb-hero-side small { color: var(--muted); font-size: var(--fs-xs); }

/* Filtros (contadores que filtram) */
.nb-filters { display: flex; flex-wrap: wrap; gap: var(--s2); padding: var(--s3) var(--s4); border-bottom: 1px solid var(--border); }
.nb-filters[hidden] { display: none; }
.nb-chip { display: inline-flex; align-items: center; gap: 6px; }
.nb-chip b { font-variant-numeric: tabular-nums; font-weight: 600; }
.nb-chip::before { content: none; flex: none; width: 8px; height: 8px; }
.nb-chip.f-ok::before { content: ""; border-radius: 50%; background: var(--ok-dot); }
.nb-chip.f-prob::before { content: ""; width: 10px; height: 10px; background: var(--crit-dot); clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%); }
.nb-chip.f-trust::before { content: ""; width: 10px; height: 9px; background: var(--warn-dot); clip-path: polygon(50% 0, 100% 100%, 0 100%); }
.nb-chip.f-never::before, .nb-chip.f-off::before { content: ""; border-radius: 50%; box-shadow: inset 0 0 0 2px var(--unk-dot); }
.nb-chip[aria-pressed=true]::before { background: var(--on-primary); box-shadow: none; }

/* Tabela por Local */
.nb-table td { vertical-align: top; height: auto; padding-top: var(--s3); padding-bottom: var(--s3); }
.nb-table .nb-state { width: 28%; min-width: 200px; }
.nb-row > td:first-child { box-shadow: inset 3px 0 0 var(--unk-dot); }
.nb-row.s-ok > td:first-child { box-shadow: inset 3px 0 0 var(--ok-dot); }
.nb-row.s-info > td:first-child { box-shadow: inset 3px 0 0 var(--info-dot); }
.nb-row.s-warn > td:first-child { box-shadow: inset 3px 0 0 var(--warn-dot); }
.nb-row.s-crit > td:first-child { box-shadow: inset 4px 0 0 var(--crit-dot); }
.nb-row.s-crit .nb-detail { color: var(--crit-fg); }
.nb-when { margin-top: 2px; font-size: var(--fs-xs); color: var(--muted); }
.nb-when.mono { color: var(--text); }
.nb-detail { margin-top: var(--s1); max-width: 44ch; font-size: var(--fs-xs); color: var(--text); overflow-wrap: anywhere; }
.nb-host { font-size: var(--fs-xs); color: var(--muted); overflow-wrap: anywhere; }
.nb-note { margin-top: var(--s1); max-width: 36ch; font-size: var(--fs-xs); color: var(--muted); overflow-wrap: anywhere; }
.nb-ver b { font-family: var(--font-display); font-size: var(--fs-lg); font-weight: 600; }
.nb-table .nb-site th { position: static; height: auto; padding: var(--s4) var(--s3) var(--s2); background: var(--surface-2); color: var(--text); text-transform: none; letter-spacing: 0; text-align: left; font-size: var(--fs-xs); font-weight: 500; border-bottom: 1px solid var(--border); white-space: normal; }
.nb-site th > span + span { margin-left: var(--s3); }
.nb-site-name { font-family: var(--font-display); font-size: var(--fs-lg); font-weight: 600; }
.nb-site-count { color: var(--muted); }
.nb-site .t-crit, .nb-site .t-warn { font-weight: 600; }
.nb-actions { flex-wrap: nowrap; justify-content: flex-end; }
.nb-empty { padding: var(--s8) var(--s4); }
.nb-empty p { max-width: 52ch; margin: 0 auto; }

/* Destinos e modelos */
.nb-sub { margin: 0 0 var(--s2); font-size: var(--fs-md); }
.nb-dest-form { border-top: 1px solid var(--border); }
.nb-ico { width: 18px; height: 18px; flex: none; color: var(--muted); }
.list > li.nb-off, .nb-off .title { color: var(--muted); }
.nb-planned-foot { padding: var(--s3) var(--s4); }
.nb-planned-foot .nb-sub { font-size: var(--fs-sm); color: var(--muted); }
.nb-planned > li { padding-left: 0; padding-right: 0; min-height: 36px; }

/* Modal Novo / Editar: seções e rodapé fixo */
.nb-job-box { max-width: 780px; }
.nb-form { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; }
.nb-form > .modal-body { flex: 1 1 auto; min-height: 0; }
.nb-foot { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: var(--s2); padding: var(--s3) var(--s5); border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--r-lg) var(--r-lg); }
.nb-sec { margin: 0; padding: 0; border: 0; min-width: 0; }
.nb-sec + .nb-sec { margin-top: var(--s5); padding-top: var(--s5); border-top: 1px solid var(--border); }
.nb-sec > legend { float: left; width: 100%; padding: 0; margin: 0 0 var(--s3); font-family: var(--font-display); font-size: var(--fs-lg); font-weight: 600; }
.nb-sec > .form-grid { clear: both; }
.nb-driver-note { display: flex; flex-direction: column; align-items: flex-start; gap: var(--s1); min-width: 0; }
.nb-driver-note .hint { font-size: var(--fs-xs); color: var(--muted); }
.nb-opts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s2); }
.nb-opts[hidden] { display: none; }
.nb-opt { display: flex; align-items: flex-start; gap: var(--s2); padding: var(--s3); border: 1px solid var(--border-strong); border-radius: var(--r-md); cursor: pointer; font-size: var(--fs-sm); min-width: 0; }
.nb-opt:hover { background: var(--hover); }
.nb-opt input { width: 16px; height: 16px; margin: 2px 0 0; flex: none; accent-color: var(--primary); }
.nb-opt small { display: block; margin-top: 2px; color: var(--muted); font-size: var(--fs-xs); }
.nb-opt:has(input:checked) { border-color: var(--primary); box-shadow: inset 0 0 0 1px var(--primary); }
.nb-enabled { align-self: end; min-height: 36px; }
.nb-dest-picks { display: flex; flex-direction: column; gap: var(--s2); margin-top: var(--s1); }
.nb-pick { align-items: flex-start; font-weight: 400; }
.nb-pick input { margin-top: 3px; }
.nb-pick .mono { color: var(--muted); font-size: var(--fs-xs); }

/* Confiar no equipamento */
.nb-trust-box { max-width: 560px; }
.nb-trust-msg { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--s2); }
.nb-changed { padding: var(--s2) var(--s3); background: var(--crit-bg); border: 1px solid var(--crit-dot); border-radius: var(--r-md); }
.nb-dl { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: var(--s2) var(--s3); margin: 0 0 var(--s3); font-size: var(--fs-sm); }
.nb-dl dt { color: var(--muted); }
.nb-dl dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.nb-fp { display: block; padding: var(--s3); border: 1px solid var(--border-strong); border-radius: var(--r-md); background: var(--surface-2); color: var(--text); font-size: var(--fs-md); line-height: 1.6; letter-spacing: .02em; overflow-wrap: anywhere; user-select: all; }

/* Histórico + O que mudou */
.nb-add { color: var(--ok-fg); font-weight: 600; font-variant-numeric: tabular-nums; }
.nb-del { color: var(--fail-fg); font-weight: 600; font-variant-numeric: tabular-nums; }
.nb-stat { display: inline-flex; gap: 1px; margin-left: var(--s1); vertical-align: -1px; }
.nb-stat i { display: block; width: 8px; height: 8px; border-radius: 1px; }
.nb-stat i.a { background: var(--ok-dot); }
.nb-stat i.r { background: var(--fail-dot); }
.nb-runs-hint { margin: 0 0 var(--s2); }
.nb-runs-hint:empty { display: none; }
.nb-runs { border: 1px solid var(--border); border-radius: var(--r-md); }
.nb-runs > li.nb-run { align-items: flex-start; box-shadow: inset 3px 0 0 var(--unk-dot); }
.nb-runs > li.nb-run.s-ok { box-shadow: inset 3px 0 0 var(--ok-dot); }
.nb-runs > li.nb-run.s-info { box-shadow: inset 3px 0 0 var(--info-dot); }
.nb-runs > li.nb-run.s-warn { box-shadow: inset 3px 0 0 var(--warn-dot); }
.nb-runs > li.nb-run.s-crit { box-shadow: inset 4px 0 0 var(--crit-dot); }
.nb-runs > li.nb-run.sel { background: var(--hover); }
.nb-run .title { display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap; }
.nb-run .detail + .detail { margin-top: 2px; }
.nb-run-btns .btn[aria-pressed=true] { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.nb-run-err { flex-wrap: wrap; }
.nb-copies { display: flex; flex-wrap: wrap; gap: var(--s1); margin-top: var(--s1); }
.nb-diff-box { display: flex; flex-direction: column; gap: var(--s2); min-width: 0; margin-top: var(--s4); padding-top: var(--s3); border-top: 1px solid var(--border); }
.nb-diff-box[hidden] { display: none; }
.nb-diff-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s2); }
.nb-diff-head .nb-sub { margin: 0; font-family: var(--font-display); font-size: var(--fs-lg); }
.nb-diff-info { margin: 0; }
.nb-diff { max-height: 60vh; overflow: auto; border: 1px solid var(--border-strong); border-radius: var(--r-md); background: var(--surface-2); font-family: var(--mono); font-size: var(--fs-xs); line-height: 1.55; font-variant-numeric: tabular-nums; }
.nb-diff .l { display: grid; grid-template-columns: 5ch 5ch 2.5ch auto; width: max-content; min-width: 100%; white-space: pre; }
.nb-diff .l .n { padding: 0 1ch 0 0; text-align: right; color: var(--muted); user-select: none; }
.nb-diff .l .n + .n { border-right: 1px solid var(--border); }
.nb-diff .l .m { text-align: center; color: var(--muted); user-select: none; }
.nb-diff .l .c { padding-right: var(--s3); }
.nb-diff .l.add { background: var(--ok-bg); }
.nb-diff .l.add .m { color: var(--ok-fg); font-weight: 600; }
.nb-diff .l.del { background: var(--fail-bg); }
.nb-diff .l.del .m { color: var(--fail-fg); font-weight: 600; }
.nb-diff .l.hunk { color: var(--muted); background: var(--hover); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.nb-diff .l.hunk:first-child { border-top: 0; }
.nb-diff .l.ctx .c { color: var(--text); }
.nb-diff-legend { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s1) var(--s2); margin: 0; }
.nb-key { display: inline-block; min-width: 2.4ch; padding: 0 var(--s1); border-radius: var(--r-sm); background: var(--hover); font-family: var(--mono); text-align: center; color: var(--text); }
.nb-key.add { background: var(--ok-bg); color: var(--ok-fg); font-weight: 600; }
.nb-key.del { background: var(--fail-bg); color: var(--fail-fg); font-weight: 600; margin-left: var(--s3); }
.nb-key:not(.add):not(.del) { margin-left: var(--s3); }
@media (min-width: 1000px) {
  .nb-runs-layout.diffing { display: grid; grid-template-columns: minmax(300px, 380px) minmax(0, 1fr); gap: var(--s5); align-items: start; }
  .nb-runs-layout.diffing .nb-run { flex-wrap: wrap; }
  .nb-runs-layout.diffing .nb-diff-box { position: sticky; top: 0; margin-top: 0; padding-top: 0; border-top: 0; max-height: calc(100dvh - 140px); }
  .nb-runs-layout.diffing .nb-diff { max-height: none; flex: 1 1 auto; min-height: 240px; }
}

/* Celular: a tabela vira cartões (sem rolagem horizontal da página) */
@media (max-width: 760px) {
  .nb-hero { padding: var(--s3) var(--s4); }
  .nb-hero-title { font-size: 22px; }
  .nb-hero-side { align-items: flex-start; }
  .nb-wrap { overflow-x: visible; }
  .nb-table, .nb-table tbody, .nb-table tr, .nb-table td, .nb-table th { display: block; }
  .nb-table thead { display: none; }
  .nb-table .nb-site th { padding: var(--s4) var(--s4) var(--s1); background: transparent; border-bottom: 0; }
  .nb-table tr.nb-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); margin: var(--s2) var(--s3) var(--s3); background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: inset 4px 0 0 var(--unk-dot); overflow: hidden; }
  .nb-table tr.nb-row.s-ok { box-shadow: inset 4px 0 0 var(--ok-dot); }
  .nb-table tr.nb-row.s-info { box-shadow: inset 4px 0 0 var(--info-dot); }
  .nb-table tr.nb-row.s-warn { box-shadow: inset 4px 0 0 var(--warn-dot); }
  .nb-table tr.nb-row.s-crit { box-shadow: inset 5px 0 0 var(--crit-dot); }
  .nb-table tr.nb-row > td { height: auto; padding: var(--s2) var(--s3) 0 var(--s4); border: 0; white-space: normal; min-width: 0; }
  .nb-table tr.nb-row > td:first-child { box-shadow: none; }
  .nb-table td.nb-equip { order: -1; grid-column: 1 / -1; padding-top: var(--s3); }
  .nb-table td.nb-equip .name { font-size: var(--fs-md); }
  .nb-table td.nb-state { grid-column: 1 / -1; width: auto; min-width: 0; }
  .nb-table td[data-label]::before { content: attr(data-label); display: block; margin-bottom: 2px; font-size: 12px; font-weight: 600; color: var(--muted); }
  .nb-table td.nb-equip::before, .nb-table td.nb-state::before, .nb-table td.actions::before { content: none; }
  .nb-table td.nb-ver { text-align: left; }
  .nb-table td.actions { grid-column: 1 / -1; width: auto; margin-top: var(--s3); padding: var(--s2) var(--s3); border-top: 1px solid var(--border); text-align: left; }
  .nb-actions { flex-wrap: wrap; justify-content: flex-start; }
  .nb-table tr.empty-row td { padding: var(--s2); }
  .nb-opts { grid-template-columns: minmax(0, 1fr); }
  .nb-foot { padding: var(--s3) var(--s4); }
  .nb-dl { grid-template-columns: minmax(0, 1fr); gap: var(--s1); }
  .nb-dl dd { margin-bottom: var(--s2); }
  .nb-run { flex-wrap: wrap; }
}
@media (max-width: 520px) {
  .nb-table tr.nb-row { grid-template-columns: minmax(0, 1fr); }
}

/* T40 — Documentação (/documentacao). T40d: índice fixo ao lado, busca com destaque, leitura com linha curta. */
.docs-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s5); align-items: start; }
.docs-aside { display: flex; flex-direction: column; gap: var(--s4); min-width: 0; padding: var(--s4); background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); }
.docs-search-box { position: relative; }
.docs-search-box svg { position: absolute; left: var(--s3); top: 50%; width: 16px; height: 16px; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.docs-search-box .docs-search { width: 100%; padding-left: 36px; }
.docs-count { margin: var(--s2) 0 0; font-size: var(--fs-xs); color: var(--muted); }
.docs-count:empty { display: none; }
.docs-count.none { color: var(--warn-fg); font-weight: 600; }
.docs-toc h2 { margin: 0 0 var(--s2); font-family: var(--font-display); font-size: var(--fs-lg); }
.docs-toc ol { margin: 0; padding: 0; list-style: none; counter-reset: doc; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr)); gap: 2px var(--s4); }
.docs-toc ol > li { counter-increment: doc; min-width: 0; }
.docs-toc ul { margin: 0 0 var(--s1); padding: 0; list-style: none; }
.docs-toc a { display: flex; align-items: baseline; gap: var(--s2); min-height: 32px; padding: var(--s1) var(--s2); border-radius: var(--r-md); border-left: 3px solid transparent; color: var(--text); text-decoration: none; font-size: var(--fs-sm); line-height: 1.35; }
.docs-toc ol > li > a::before { content: counter(doc); flex: none; min-width: 1.4em; color: var(--muted); font-variant-numeric: tabular-nums; font-weight: 600; }
.docs-toc ul a { padding-left: calc(var(--s2) + 1.4em + var(--s2)); color: var(--muted); font-size: var(--fs-xs); min-height: 28px; }
.docs-toc a:hover { background: var(--hover); text-decoration: underline; }
.docs-toc a[aria-current=true] { background: var(--hover); border-left-color: var(--primary); font-weight: 600; }
.docs-toc a.miss { color: var(--muted); text-decoration: line-through; }
.docs-note { margin: 0; padding-top: var(--s3); border-top: 1px solid var(--border); font-size: var(--fs-xs); color: var(--muted); }
@media (min-width: 1100px) {
  .docs-layout { grid-template-columns: 280px minmax(0, 1fr); }
  .docs-aside { position: sticky; top: calc(var(--top-h) + var(--s4)); max-height: calc(100dvh - var(--top-h) - var(--s8)); overflow-y: auto; }
  .docs-toc ol { grid-template-columns: minmax(0, 1fr); }
}
.docs .doc-sec, .docs [id^=d-] { scroll-margin-top: calc(var(--top-h) + var(--s4)); }
.docs .card-head h2 { font-family: var(--font-display); font-size: var(--fs-xl); }
.docs .doc-sec.closed .card-head { border-bottom: 0; }
.docs .card-body { padding: var(--s5); line-height: 1.6; }
.docs .card-body > p, .docs .card-body > ol, .docs .card-body > ul:not(.list) { max-width: 76ch; }
.docs .card-body h3 { margin: var(--s6) 0 var(--s2); padding-top: var(--s4); border-top: 1px solid var(--border); font-family: var(--font-display); font-size: var(--fs-lg); }
.docs .card-body h3:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
.docs .card-body ol, .docs .card-body ul:not(.list) { margin: 0 0 var(--s3); padding-left: var(--s5); }
.docs .card-body li + li { margin-top: var(--s1); }
.docs .card-body p:last-child { margin-bottom: 0; }
.docs .card-body .mono { padding: 0 3px; border-radius: 3px; background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--border); overflow-wrap: anywhere; }
.docs .table-wrap { border: 1px solid var(--border); border-radius: var(--r-md); margin: 0 0 var(--s3); }
.docs .table th[scope], .docs .table tbody th { width: 1%; white-space: nowrap; position: static; color: var(--text); background: var(--surface-2); text-transform: none; letter-spacing: 0; font-size: var(--fs-sm); }
.docs .table td.wrap, .docs .table tbody th { vertical-align: top; padding-top: var(--s2); padding-bottom: var(--s2); line-height: 1.5; }
.docs .table td { vertical-align: top; padding-top: var(--s2); padding-bottom: var(--s2); height: auto; }
.docs .card-body .table-wrap + h3, .docs .card-body .table-wrap + p { margin-top: var(--s4); }
.docs mark.doc-hit { padding: 0 1px; border-radius: 2px; background: var(--warn-bg); color: var(--text); box-shadow: 0 0 0 1px var(--warn-dot); }
@media (max-width: 640px) {
  .docs .card-body { padding: var(--s4); }
  .docs .table tbody th { white-space: normal; width: 34%; }
}

/* T41 — Backup da rede: agenda por dias/horários, modelos cadastrados, "Testar". Escopado em .nb-*. */
.nb-opts-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.nb-days { display: flex; flex-wrap: wrap; gap: var(--s2); margin-top: var(--s1); }
.nb-day { position: relative; display: inline-flex; cursor: pointer; }
.nb-day input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.nb-day span { display: inline-flex; align-items: center; justify-content: center; min-width: 52px; min-height: 40px; padding: 0 var(--s3);
  border: 1px solid var(--border-strong); border-radius: var(--r-md); font: 600 var(--fs-sm) var(--font); color: var(--text); background: var(--surface); }
.nb-day:hover span { background: var(--hover); }
.nb-day input:checked + span { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.nb-day input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: 2px; }
.nb-day-quick { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s1) var(--s2); margin-top: var(--s2); }
.nb-times { display: flex; flex-wrap: wrap; gap: var(--s2); margin-top: var(--s1); }
.nb-time { display: inline-flex; align-items: center; gap: var(--s1); }
.nb-time .input { width: 124px; }
.nb-add-time { align-self: flex-start; margin-top: var(--s2); }
.nb-add-time[hidden], .nb-sched-days[hidden], .nb-sched-month[hidden], .nb-sched-times[hidden] { display: none; }
.nb-next { margin: 0; padding: var(--s2) var(--s3); border-radius: var(--r-md); background: var(--surface-2); font-size: var(--fs-sm); color: var(--muted); }
.nb-next:empty { display: none; }
.nb-next b { color: var(--text); font-weight: 600; white-space: nowrap; }
.nb-models-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: var(--s2); }
.nb-models-sub { margin: var(--s3) var(--s4) var(--s1); font-size: var(--fs-sm); color: var(--muted); }
.nb-model-cmd { overflow-wrap: anywhere; font-size: var(--fs-xs); }
.nb-models-empty { font-size: var(--fs-sm); }
.nb-test-btn { margin-right: auto; }
.nb-test-btn[hidden] { display: none; }
.nb-test-out { margin: var(--s3) 0 0; max-height: 55vh; overflow: auto; padding: var(--s3); border: 1px solid var(--border); border-radius: var(--r-md);
  background: var(--surface-2); font-size: var(--fs-xs); line-height: 1.5; white-space: pre; }
.nb-test-out[hidden] { display: none; }
.cal-nb .list li { align-items: center; }
.cal-nb .nb-when-at { font-weight: 600; white-space: nowrap; }
@media (max-width: 640px) {
  .nb-opts-3 { grid-template-columns: minmax(0, 1fr); }
  .nb-day span { min-width: 44px; }
}
/* T41b — ver / editar versão */
.nb-view-body { display: flex; flex-direction: column; gap: var(--s3); }
.nb-view-text { width: 100%; min-height: 50vh; font-size: var(--fs-xs); line-height: 1.5; white-space: pre; overflow: auto; tab-size: 4; }
.nb-view-field { margin: 0; }
/* T42 — "Onde guardar" no Novo/Editar backup */
.nb-where-main { display: flex; align-items: flex-start; gap: var(--s3); padding: var(--s3); border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface-2); }
.nb-where-main .title { display: flex; align-items: center; gap: var(--s2); font-weight: 600; }
.nb-where-main .detail { overflow-wrap: anywhere; font-size: var(--fs-xs); margin-top: 2px; }
.nb-newdest { border: 1px dashed var(--border-strong); border-radius: var(--r-md); padding: var(--s2) var(--s3); }
.nb-newdest > summary { display: inline-flex; align-items: center; gap: var(--s2); cursor: pointer; font-weight: 600; font-size: var(--fs-sm); min-height: 32px; }
.nb-newdest > summary svg { width: 16px; height: 16px; }
.nb-newdest[open] > summary { margin-bottom: var(--s2); }
.nb-newdest .form-msg.ok { color: var(--ok-fg); }
.nb-where-soon { margin: 0; }
/* T43 — avisos e regras de conferência */
.nb-rules { display: flex; flex-direction: column; gap: var(--s2); margin-top: var(--s1); }
.nb-rule { display: grid; grid-template-columns: 112px minmax(0, 1.4fr) minmax(0, 1fr) auto; gap: var(--s2); align-items: center; }
.nb-add-rule { align-self: flex-start; margin-top: var(--s2); }
.nb-add-rule[hidden] { display: none; }
.nb-rule-bad { margin-top: 2px; }
@media (max-width: 640px) {
  .nb-rule { grid-template-columns: 104px minmax(0, 1fr) auto; }
  .nb-rule input:nth-of-type(2) { grid-column: 1 / 3; grid-row: 2; }
}
/* T44 — destino SMB */
.nb-dest-form .form-msg.ok { color: var(--ok-fg); }
.nb-dest-form .form-actions { flex-wrap: wrap; }
/* T45 — destino SFTP: confirmar o servidor */
.nb-fpbox:empty { display: none; }
.nb-fp-ask { display: flex; flex-direction: column; gap: var(--s2); padding: var(--s3); border: 1px solid var(--warn-dot); border-radius: var(--r-md); background: var(--warn-bg); }
.nb-fp-ask .btn { align-self: flex-start; }
/* T46 — nuvem */
.nb-cloud-steps { margin: 0 0 var(--s3); padding-left: 1.3em; display: flex; flex-direction: column; gap: var(--s2); font-size: var(--fs-sm); }
/* T47 — Destinos: lista com ícone por tipo (quebra direito no celular) e janela "Novo destino" com os tipos lado a lado */
.list > li.nb-dest { flex-wrap: wrap; align-items: flex-start; row-gap: var(--s2); }
.nb-dest .nb-ico { margin-top: 2px; width: 20px; height: 20px; }
.nb-dest-main { flex: 1 1 200px; min-width: 0; }
.nb-dest-main .title { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s1) var(--s2); }
.nb-dest-main .detail { overflow-wrap: anywhere; font-size: var(--fs-xs); margin-top: 2px; }
.nb-dest-side { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: var(--s2); margin-left: auto; }
.nb-dest-side .btn-group { flex-wrap: wrap; }
.nb-types { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--s2); }
.nb-type { position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: var(--s3); min-height: 96px;
  border: 1px solid var(--border-strong); border-radius: var(--r-md); background: var(--surface); cursor: pointer; font-size: var(--fs-sm); min-width: 0; }
.nb-type:hover { background: var(--hover); }
.nb-type input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.nb-type svg { width: 22px; height: 22px; color: var(--muted); margin-bottom: var(--s1); }
.nb-type b { font-weight: 600; line-height: 1.25; }
.nb-type small { color: var(--muted); font-size: var(--fs-xs); line-height: 1.3; }
.nb-type:has(input:checked) { border-color: var(--primary); box-shadow: inset 0 0 0 1px var(--primary); background: var(--ok-bg); }
.nb-type:has(input:checked) svg { color: var(--primary); }
.nb-type:has(input:focus-visible) { outline: 2px solid var(--focus); outline-offset: 2px; }
.nb-dest-intro { margin: 0 0 var(--s3); }
.nb-dest-help { padding: var(--s2) var(--s3); border-radius: var(--r-md); background: var(--surface-2); color: var(--muted); font-size: var(--fs-xs); line-height: 1.45; }
.nb-dest-help .mono { overflow-wrap: anywhere; }
.nb-dest-enabled { margin-top: var(--s3); }
#destForm .form-msg.ok { color: var(--ok-fg); }
.nb-where-add { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s1) var(--s3); }
.nb-models-empty > span { display: block; }
@media (max-width: 760px) { .nb-types { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .nb-dest-side { margin-left: 30px; justify-content: flex-start; } }
.nb-form .form-grid > .full { grid-column: 1 / -1; }
/* T47: com uma janela aberta, o botão do Jarbas não cobre os botões do rodapé */
body:has(.modal.open) .jarbas-fab { display: none; }
/* T48: 5 tipos de destino */
.nb-types { grid-template-columns: repeat(5, minmax(0, 1fr)); }
@media (max-width: 900px) { .nb-types { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 560px) { .nb-types { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
/* T49 — "Cópias extras" como botão de seleção (lista abre embaixo) */
.nb-sel-wrap { position: relative; }
.nb-sel { display: flex; align-items: center; flex-wrap: wrap; gap: var(--s1) var(--s2); width: 100%; min-height: 42px; padding-right: 40px; text-align: left; cursor: pointer; font: inherit; position: relative; }
.nb-sel::after { content: ""; position: absolute; right: 14px; top: 50%; width: 8px; height: 8px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: translateY(-70%) rotate(45deg); }
.nb-sel[aria-expanded="true"]::after { transform: translateY(-30%) rotate(-135deg); }
.nb-sel-chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: var(--r-pill); background: var(--ok-bg); color: var(--ok-fg); font-size: var(--fs-xs); font-weight: 600; }
.nb-sel-chip svg { width: 14px; height: 14px; }
.nb-sel-panel { position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 30; max-height: 320px; overflow: auto; background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--r-md); box-shadow: var(--sh-2); padding: var(--s1); }
.nb-sel-panel[hidden] { display: none; }
.nb-sel-panel .nb-dest-picks { gap: 2px; margin: 0; }
.nb-sel-opt { display: flex; align-items: center; gap: var(--s2); padding: var(--s2); border-radius: var(--r-sm); cursor: pointer; font-size: var(--fs-sm); min-width: 0; }
.nb-sel-opt:hover { background: var(--hover); }
.nb-sel-opt input { width: 16px; height: 16px; flex: none; accent-color: var(--primary); }
.nb-sel-opt:has(input:checked) { background: var(--ok-bg); }
.nb-sel-opt .grow { display: flex; flex-direction: column; min-width: 0; }
.nb-sel-opt .detail { font-size: var(--fs-xs); color: var(--muted); overflow-wrap: anywhere; }
.nb-sel-add { display: flex; align-items: center; gap: var(--s2); width: 100%; margin-top: var(--s1); padding: var(--s2); border: 0; border-top: 1px solid var(--border); border-radius: 0 0 var(--r-sm) var(--r-sm); background: transparent; color: var(--link); font: 600 var(--fs-sm) var(--font); cursor: pointer; text-align: left; }
.nb-sel-add:hover { background: var(--hover); }
.nb-sel-add svg { width: 16px; height: 16px; }
.nb-sel-add .muted { font-weight: 400; }
.nb-sel-empty { margin: var(--s2); }
@media (max-width: 640px) { .nb-sel-add .muted { display: none; } }
@media (max-width: 640px) { .nb-sel-panel { position: static; margin-top: var(--s1); max-height: none; box-shadow: none; } }
