/* ============================================================
   Neurônio Admin — componentes genéricos copiados do neuronio-dashboard
   (styles.css), com os estilos que lá são inline convertidos em classes:
   o HTML do portal não tem `style=` (CSP). Cor só por token de tokens.css.
   ============================================================ */
* { margin: 0; padding: 0; box-sizing: border-box; }
[hidden] { display: none !important; }
body { font-family: var(--font-sans); background: var(--background); color: var(--foreground); overflow-x: hidden;
       -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
body.sem-rolagem { overflow: hidden; }
.num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

/* === GRID DE FUNDO (sem glow — DS Finza: profundidade por borda) === */
.circuit-bg {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: 0; pointer-events: none;
  background-image:
    linear-gradient(var(--border) 1px, transparent 1px),
    linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 40px 40px, 40px 40px;
  opacity: 0.5;
}

/* === LOGIN (cartão do dashboard + estados do portal) === */
.login-container {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  position: relative; z-index: 1;
}
.login-card {
  background: var(--card);
  border: 1px solid var(--border); border-radius: var(--radius-xl); padding: 48px 40px;
  width: 400px; max-width: 90vw; position: relative; overflow: hidden;
}
.login-cabecalho { text-align: center; margin-bottom: 32px; }
.login-logo { height: 36px; width: auto; margin: 0 auto 16px; display: block; }
.login-subtitulo { color: var(--muted-foreground); font-size: 13px; }
.login-titulo { font-family: var(--font-display); font-size: 16px; font-weight: 600; letter-spacing: -0.02em; text-align: center; margin-bottom: 8px; }
.login-texto { color: var(--muted-foreground); font-size: 13px; line-height: 1.5; text-align: center; margin-bottom: 20px; }
.login-campo { margin-bottom: 16px; position: relative; }
.login-campo-ultimo { margin-bottom: 24px; }
.login-icone { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted-foreground); pointer-events: none; }
.login-input {
  width: 100%; padding: 12px 16px 12px 44px; background: var(--background); border: 1px solid var(--input);
  border-radius: var(--radius-lg); color: var(--foreground); font-size: 16px; outline: none; transition: border-color var(--duration-base) var(--ease-out);
}
.login-input:focus { border-color: var(--ring); box-shadow: 0 0 0 3px rgba(var(--ring-rgb), 0.35); }
.login-input::placeholder { color: var(--muted-foreground); }
.login-btn {
  width: 100%; padding: 12px; background: var(--primary); border: none; border-radius: var(--radius-lg);
  color: var(--primary-foreground); font-size: 14px; font-weight: 600; cursor: pointer; transition: background var(--duration-base) var(--ease-out);
}
.login-btn:hover { background: var(--primary-hover); }
.login-btn:disabled { opacity: 0.7; cursor: not-allowed; }
.login-error { color: var(--destructive); font-size: 12px; margin-top: 8px; display: none; text-align: center; }
.login-error.visivel { display: block; }
.login-ok { color: var(--success); font-size: 12px; margin-bottom: 16px; text-align: center; line-height: 1.5; }
.login-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 16px; margin-top: 16px; }
.login-requisitos { list-style: none; margin: -4px 0 20px; display: flex; flex-direction: column; gap: 4px; }
.login-requisitos li { font-size: 12px; color: var(--muted-foreground); padding-left: 16px; position: relative; }
.login-requisitos li::before {
  content: ''; position: absolute; left: 2px; top: 6px; width: 6px; height: 6px; border-radius: 50%; background: var(--muted-foreground);
}
.login-requisitos li.ok { color: var(--success); }
.login-requisitos li.ok::before { background: var(--success); }

/* === SIDEBAR === */
.sidebar {
  position: fixed; left: 0; top: 0; width: 240px; height: 100vh;
  background: var(--sidebar);
  border-right: 1px solid var(--border); z-index: 50; display: flex; flex-direction: column;
  padding: 24px 16px; overflow-y: auto;
}
.sidebar-logo { padding: 0 8px 24px; border-bottom: 1px solid var(--border); margin-bottom: 24px; }
.sidebar-logo img { height: 32px; opacity: 0.9; }
.nav-item {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: var(--radius-md);
  color: var(--muted-foreground); font-size: 13px; font-weight: 500; cursor: pointer; transition: all 0.2s;
  margin-bottom: 4px; text-decoration: none; border: 1px solid transparent;
}
.nav-item:hover { color: var(--foreground); background: var(--muted); }
.nav-item.active { color: var(--foreground); background: rgba(var(--primary-rgb), 0.22); border: 1px solid rgba(var(--primary-rgb), 0.55); }
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }
.sidebar-rodape { margin-top: auto; padding-top: 12px; }
.sidebar-usuario {
  padding: 8px 16px; font-size: 11px; color: var(--muted-foreground);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* === MAIN CONTENT === */
.main-content { margin-left: 240px; padding: 24px 32px; position: relative; z-index: 1; min-height: 100vh; }
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 28px; }
.page-title { font-family: var(--font-display); font-size: 22px; font-weight: 600; letter-spacing: -0.02em; }
.page-subtitle { color: var(--muted-foreground); font-size: 13px; margin-top: 2px; }
.page-subtitle:empty { display: none; }
.page-intro { font-size: 13px; color: var(--muted-foreground); margin: -12px 0 16px; line-height: 1.5; }
.page-intro strong { color: var(--foreground); }
.page-section { display: none; }
.page-section.active { display: block; }

/* === CARDS === */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin-bottom: 24px; }
.kpi-grid > * { min-width: 0; }
.kpi-card {
  background: linear-gradient(135deg, var(--card) 0%, var(--muted) 100%);
  border: 1px solid var(--border); border-radius: var(--radius-xl); padding: 20px; position: relative;
  overflow: visible; transition: all 0.3s;
}
.kpi-card:hover { border-color: rgba(var(--primary-rgb), 0.4); transform: translateY(-2px); box-shadow: var(--shadow-overlay); z-index: 51; }
.kpi-value { font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-size: 28px; font-weight: 700; line-height: 1; margin-bottom: 4px; letter-spacing: -0.5px; }
.kpi-label { font-size: 12px; color: var(--muted-foreground); font-weight: 500; text-transform: uppercase; letter-spacing: 0.5px; }
.kpi-detail { font-size: 11px; color: var(--muted-foreground); margin-top: 6px; line-height: 1.5; }
.chart-card {
  background: linear-gradient(135deg, var(--card) 0%, var(--muted) 100%);
  border: 1px solid var(--border); border-radius: var(--radius-xl); padding: 20px; position: relative;
}
.chart-card:hover { border-color: rgba(var(--primary-rgb), 0.3); }
.chart-title { font-family: var(--font-display); font-size: 14px; font-weight: 600; letter-spacing: -0.02em; margin-bottom: 16px; }
.chart-state { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 160px; text-align: center; font-size: 13px; padding: 16px; gap: 6px; line-height: 1.5; color: var(--muted-foreground); }
.chart-state-erro { color: var(--destructive); }

/* === TABELA === */
.table-card {
  background: linear-gradient(135deg, var(--card) 0%, var(--card) 100%);
  border: 1px solid var(--border); border-radius: var(--radius-xl); padding: 20px; position: relative;
}
.table-card + .table-card { margin-top: 16px; }
.table-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; padding-right: 24px; }
.table-head .chart-title { margin-bottom: 0; }
.table-acoes { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.table-contador { font-size: 12px; color: var(--muted-foreground); }
.table-rolagem { overflow-x: auto; }
.table-filters { display: flex; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.filter-input {
  padding: 8px 12px; background: var(--background); border: 1px solid var(--border); border-radius: var(--radius-md);
  color: var(--foreground); font-size: 13px; outline: none; transition: border-color 0.3s;
}
.filter-input:focus { border-color: var(--primary); }
.filter-busca { flex: 1; min-width: 200px; }
.filter-select {
  padding: 8px 12px; background: var(--background); border: 1px solid var(--border); border-radius: var(--radius-md);
  color: var(--foreground); font-size: 13px; outline: none; cursor: pointer;
}
.filter-select option { background: var(--card); color: var(--foreground); }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th {
  text-align: left; padding: 10px 12px; color: var(--muted-foreground); font-weight: 600; font-size: 11px;
  text-transform: uppercase; letter-spacing: 0.5px; border-bottom: 1px solid var(--border);
  cursor: pointer; user-select: none; white-space: nowrap;
}
thead th:hover { color: var(--foreground); }
thead th.sorted { color: var(--ring); }
thead th.fixo { cursor: default; }
thead th.fixo:hover { color: var(--muted-foreground); }
tbody tr { border-bottom: 1px solid var(--border); transition: background 0.2s; }
tbody tr:hover { background: rgba(var(--primary-rgb), 0.05); }
tbody tr.clicavel { cursor: pointer; }
tbody td { padding: 10px 12px; white-space: nowrap; }
.td-vazio { text-align: center; color: var(--muted-foreground); font-size: 12px; padding: 20px 12px; white-space: normal; }
.pagination { display: flex; align-items: center; justify-content: space-between; margin-top: 16px; font-size: 13px; color: var(--muted-foreground); }
.pagination-botoes { display: flex; gap: 8px; }
.page-btn {
  padding: 6px 12px; background: var(--background); border: 1px solid var(--border); border-radius: var(--radius-sm);
  color: var(--muted-foreground); font-size: 12px; cursor: pointer; transition: all 0.2s;
}
.page-btn:hover { border-color: var(--primary); color: var(--foreground); }
.page-btn:disabled { opacity: 0.3; cursor: not-allowed; }

/* Filtros ativos, seletor de colunas */
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.filter-pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 6px 4px 10px; border-radius: var(--radius-full);
  background: rgba(var(--ring-rgb), 0.12); border: 1px solid rgba(var(--ring-rgb), 0.4); font-size: 12px; color: var(--foreground);
}
.filter-pill button {
  background: none; border: none; color: var(--muted-foreground); cursor: pointer; font-size: 15px; line-height: 1; padding: 0 4px;
}
.filter-pill button:hover { color: var(--foreground); }
.col-picker { position: relative; }
.col-picker > summary { list-style: none; display: inline-flex; align-items: center; height: 100%; }
.col-picker > summary::-webkit-details-marker { display: none; }
.col-picker-menu {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 60; min-width: 200px;
  background: var(--popover); border: 1px solid var(--border); border-radius: var(--radius-md);
  box-shadow: var(--shadow-overlay); padding: 8px; display: flex; flex-direction: column; gap: 2px;
}
.col-picker-menu label { display: flex; align-items: center; gap: 8px; font-size: 12px; padding: 5px 6px; border-radius: var(--radius-sm); cursor: pointer; }
.col-picker-menu label:hover { background: var(--muted); }

/* === BADGES === */
.badge {
  display: inline-block; padding: 2px 8px; border-radius: var(--radius-sm); font-size: 11px; font-weight: 600;
}
.badge-esp32 { background: rgba(var(--primary-rgb), 0.15); color: var(--foreground); }
.badge-esp8266 { background: var(--muted); color: var(--muted-foreground); }
.badge-software { background: rgba(var(--success-rgb), 0.15); color: var(--success); }
.badge-online, .badge-ativo { background: rgba(var(--success-rgb), 0.15); color: var(--success); }
.badge-offline, .badge-inativo { background: rgba(var(--destructive-rgb), 0.15); color: var(--destructive); }
.badge-aviso { background: rgba(var(--warning-rgb), 0.15); color: var(--warning); }
.badge-info { background: rgba(var(--info-rgb), 0.15); color: var(--info); }
.badge-muted { background: var(--muted); color: var(--muted-foreground); }
.badge-emuso {
  background: rgba(var(--primary-rgb), 0.22); border: 1px solid rgba(var(--primary-rgb), 0.55); color: var(--foreground);
  display: inline-flex; align-items: center; gap: 4px;
}
.badge-emuso::before {
  content: ''; width: 6px; height: 6px; border-radius: 50%;
  background: var(--primary); animation: pulse-ring 2s infinite;
}
.signal-bars { display: inline-flex; align-items: flex-end; gap: 2px; height: 14px; }
.signal-bar { width: 3px; border-radius: 1px; background: var(--border); }
.signal-bar.active { background: var(--success); }
.signal-bar.medium { background: var(--warning); }
.signal-bar.weak { background: var(--destructive); }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.estado-badge { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; white-space: nowrap; }
.infer-mark { color: var(--muted-foreground); font-size: 9px; margin-left: 1px; }
@keyframes pulse-ring { 0% { opacity: 1; transform: scale(0.8); } 100% { opacity: 0; transform: scale(1.6); } }

/* === TOOLTIP INFO (OBRIGATÓRIO em todo card e tabela) === */
.info-wrap { position: absolute; top: 10px; right: 10px; z-index: 1000; }
.info-wrap svg { color: var(--muted-foreground); cursor: help; transition: color 0.2s; }
.info-wrap:hover svg { color: var(--foreground); }
.info-tip {
  display: none; position: absolute; top: 22px; right: 0; background: var(--card);
  border: 1px solid var(--border); border-radius: var(--radius-md); padding: 10px 14px; width: 260px;
  font-size: 12px; color: var(--foreground); box-shadow: var(--shadow-overlay);
  line-height: 1.5; z-index: 1001;
}
.info-wrap:hover .info-tip, .info-wrap.active .info-tip { display: block; }

/* === BOTÕES (estilos inline do dashboard viraram classes) === */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 8px 18px; border: 1px solid transparent; border-radius: var(--radius-md);
  font-family: inherit; font-size: 13px; font-weight: 600; cursor: pointer; text-decoration: none;
  transition: all 0.2s;
}
.btn:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-primario { background: var(--primary); color: var(--primary-foreground); }
.btn-primario:hover:not(:disabled) { background: var(--primary-hover); }
.btn-secundario { background: transparent; color: var(--muted-foreground); border-color: var(--input); font-weight: 400; }
.btn-secundario:hover:not(:disabled) { border-color: var(--muted-foreground); }
.btn-neutro { background: var(--muted); color: var(--foreground); border-color: var(--input); font-weight: 400; }
.btn-neutro:hover:not(:disabled) { background: var(--accent); }
.btn-perigo { background: var(--destructive); color: var(--destructive-foreground); }
.btn-aviso { background: var(--warning); color: var(--warning-foreground); }
.btn-info { background: var(--info); color: var(--info-foreground); }
.btn-grande { padding: 12px 24px; }
.btn .spinner { width: 14px; height: 14px; }
.link-btn {
  background: none; border: none; padding: 0; font: inherit; font-size: 12px; color: var(--ring);
  cursor: pointer; text-decoration: underline; text-underline-offset: 2px;
}
.link-btn:hover { color: var(--foreground); }
.logout-btn, .sidebar-acao {
  display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: var(--radius-md); width: 100%;
  color: var(--muted-foreground); font-size: 12px; cursor: pointer; transition: all 0.2s; margin-top: 8px;
  background: none; border: none; font-family: inherit; text-align: left;
}
.logout-btn:hover { color: var(--destructive); background: rgba(var(--destructive-rgb), 0.1); }
.sidebar-acao { margin-top: 0; }
.sidebar-acao:hover { color: var(--foreground); background: var(--accent); }
.version-badge {
  display: block; width: 100%; font-family: inherit;
  padding: 4px 10px; border-radius: var(--radius-sm); font-size: 11px; font-weight: 600;
  color: var(--foreground); background: rgba(var(--primary-rgb), 0.1); border: 1px solid rgba(var(--primary-rgb), 0.2);
  cursor: pointer; transition: all 0.2s; text-align: center; margin-top: 8px;
}
.version-badge:hover { background: rgba(var(--primary-rgb), 0.2); border-color: rgba(var(--primary-rgb), 0.4); }

/* === FORMULÁRIOS (padrão dos formulários de liberação do dashboard) === */
.form-painel { background: var(--background); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 20px; position: relative; }
.form-titulo { font-size: 14px; font-weight: 600; color: var(--foreground); margin-bottom: 16px; }
.form-campos { display: flex; flex-direction: column; gap: 12px; }
.campo-rotulo { font-size: 12px; color: var(--muted-foreground); display: block; margin-bottom: 4px; }
.campo-input {
  width: 100%; padding: 10px 12px; background: var(--muted); border: 1px solid var(--input); border-radius: var(--radius-md);
  color: var(--foreground); font-size: 13px; font-family: inherit; outline: none; color-scheme: dark;
}
.campo-input:focus { border-color: var(--ring); }
.campo-input:disabled { opacity: 0.6; cursor: not-allowed; }
textarea.campo-input { resize: vertical; line-height: 1.5; }
.campo-ajuda { font-size: 11px; color: var(--muted-foreground); margin-top: 4px; line-height: 1.4; }
.campo-erro { font-size: 12px; color: var(--destructive); margin-top: 4px; }
.campo-erro:empty { display: none; }
.campo-check { display: flex; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; }
.form-acoes { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; margin-top: 4px; }
.feedback { font-size: 13px; line-height: 1.5; }
.feedback:empty { display: none; }
.feedback-erro { color: var(--destructive); }
.feedback-ok { color: var(--success); }

/* === MODAIS === */
.modal-overlay {
  display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(var(--background-rgb), 0.75); z-index: 1000; align-items: center; justify-content: center;
  backdrop-filter: blur(4px);
}
.modal-overlay.active { display: flex; }
.modal-container {
  background: linear-gradient(135deg, var(--card) 0%, var(--card) 100%);
  border: 1px solid var(--border); border-radius: var(--radius-xl); width: 95%; max-width: 1100px;
  max-height: 85vh; display: flex; flex-direction: column; overflow: hidden;
  box-shadow: var(--shadow-overlay);
}
.modal-container.modal-sm { max-width: 600px; }
.modal-container.modal-md { max-width: 900px; }
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 24px; border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.modal-header h2 { font-family: var(--font-display); font-size: 16px; font-weight: 600; letter-spacing: -0.02em; }
.modal-header h2 span { color: var(--ring); font-family: var(--font-mono); }
.modal-header-acoes { display: flex; align-items: center; gap: 8px; }
.modal-close {
  width: 32px; height: 32px; border-radius: var(--radius-md); border: 1px solid var(--border);
  background: transparent; color: var(--muted-foreground); cursor: pointer; display: flex;
  align-items: center; justify-content: center; transition: all 0.2s;
}
.modal-close:hover { background: rgba(var(--destructive-rgb), 0.1); border-color: rgba(var(--destructive-rgb), 0.3); color: var(--destructive); }
.modal-tabs-nav { display: flex; border-bottom: 1px solid var(--border); padding: 0 24px; gap: 0; flex-shrink: 0; }
.modal-tab {
  padding: 10px 16px; font-size: 13px; font-weight: 500; color: var(--muted-foreground); cursor: pointer;
  border: none; border-bottom: 2px solid transparent; background: none; font-family: inherit; transition: all 0.2s;
}
.modal-tab:hover { color: var(--foreground); }
.modal-tab.active { color: var(--foreground); border-bottom-color: var(--primary); }
.modal-body { overflow-y: auto; flex: 1; min-height: 0; padding: 0; position: relative; }
.modal-body.com-padding { padding: 20px 24px; }
.modal-body table { width: 100%; border-collapse: collapse; font-size: 12px; }
.modal-body thead th {
  position: sticky; top: 0; background: var(--card); z-index: 5;
  text-align: left; padding: 10px 12px; color: var(--muted-foreground); font-weight: 600;
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border);
}
.modal-body tbody tr { border-bottom: 1px solid var(--border); transition: background 0.15s; }
.modal-body tbody tr:hover { background: rgba(var(--primary-rgb), 0.05); }
.modal-body tbody td { padding: 8px 12px; white-space: nowrap; }
.modal-rodape {
  display: flex; align-items: center; justify-content: flex-end; gap: 12px; flex-wrap: wrap;
  padding: 14px 24px; border-top: 1px solid var(--border); flex-shrink: 0;
}
.modal-loading {
  display: flex; align-items: center; justify-content: center; padding: 60px;
  color: var(--muted-foreground); font-size: 14px; gap: 12px;
}
.modal-empty { text-align: center; padding: 60px; color: var(--muted-foreground); font-size: 14px; }
.modal-field { display: inline-flex; flex-direction: column; gap: 2px; padding: 8px 12px; background: var(--background); border: 1px solid var(--border); border-radius: var(--radius-md); min-width: 120px; }
.modal-field-label { font-size: 10px; color: var(--muted-foreground); text-transform: uppercase; letter-spacing: 0.5px; }
.modal-field-value { font-size: 13px; color: var(--foreground); font-weight: 500; font-family: var(--font-mono); }
.modal-field-sub { font-size: 11px; color: var(--muted-foreground); font-weight: 400; overflow-wrap: anywhere; }
.modal-section-label { font-size: 10px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--muted-foreground); margin: 20px 0 8px; padding-top: 14px; border-top: 1px solid var(--border); }
.spinner {
  width: 20px; height: 20px; border: 2px solid var(--border); border-top-color: var(--primary);
  border-radius: 50%; animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Changelog */
.changelog-version { margin-bottom: 24px; }
.changelog-version:last-child { margin-bottom: 0; }
.changelog-version-header { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.changelog-version-tag {
  font-size: 14px; font-weight: 700; color: var(--foreground);
  background: rgba(var(--primary-rgb), 0.1); padding: 2px 8px; border-radius: var(--radius-sm);
}
.changelog-version-title { font-size: 13px; color: var(--foreground); font-weight: 600; }
.changelog-version-date { font-size: 11px; color: var(--muted-foreground); margin-left: auto; }
.changelog-list { list-style: none; padding: 0; margin: 0; }
.changelog-list li { font-size: 12px; color: var(--muted-foreground); padding: 4px 0 4px 16px; position: relative; }
.changelog-list li::before {
  content: ''; position: absolute; left: 0; top: 11px;
  width: 6px; height: 6px; border-radius: 50%; background: var(--primary);
}

/* === CONFIRMAÇÃO (showConfirmDialog do dashboard, em classes) === */
.confirm-overlay { z-index: 100000; background: rgba(var(--background-rgb), 0.6); backdrop-filter: blur(2px); }
.confirm-card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-xl);
  padding: 28px 32px; max-width: 400px; width: 90%; text-align: center;
  box-shadow: 0 20px 60px rgba(var(--background-rgb), 0.5);
}
.confirm-icone { display: block; margin: 0 auto 16px; width: 48px; height: 48px; }
.confirm-icone .triangulo { fill: var(--warning); stroke: var(--warning); }
.confirm-icone .marca { stroke: var(--card); }
.confirm-icone .ponto { fill: var(--card); }
.confirm-msg { color: var(--foreground); font-size: 15px; font-weight: 500; line-height: 1.5; margin-bottom: 8px; white-space: pre-line; }
.confirm-sub { color: var(--muted-foreground); font-size: 13px; line-height: 1.5; white-space: pre-line; }
.confirm-motivo { margin-top: 16px; text-align: left; }
.confirm-acoes { display: flex; gap: 12px; justify-content: center; margin-top: 24px; }
.confirm-acoes .btn { padding: 8px 24px; font-size: 14px; }

/* === AVISOS FLUTUANTES (403, 409, erro de rede) === */
.avisos { position: fixed; right: 24px; bottom: 24px; z-index: 100001; display: flex; flex-direction: column; gap: 8px; max-width: 380px; }
.aviso {
  background: var(--card); border: 1px solid var(--border); border-left-width: 3px; border-radius: var(--radius-md);
  padding: 12px 16px; font-size: 13px; line-height: 1.5; color: var(--foreground); box-shadow: var(--shadow-overlay);
  animation: fadeIn 0.2s ease-out;
}
.aviso-erro { border-left-color: var(--destructive); }
.aviso-ok { border-left-color: var(--success); }

/* === SEM PERMISSÃO === */
.sem-permissao {
  display: flex; align-items: center; justify-content: center; min-height: 100vh; position: relative; z-index: 1;
  color: var(--muted-foreground); font-size: 18px; text-align: center; padding: 20px; line-height: 1.5;
}
.sem-permissao-icone { display: block; margin: 0 auto 16px; color: var(--muted-foreground); }
.sem-permissao-sub { display: block; font-size: 14px; }
.sem-permissao-sair {
  margin-top: 24px; padding: 10px 28px; background: var(--card); color: var(--muted-foreground);
  border: 1px solid var(--border); border-radius: var(--radius-md); cursor: pointer; font-size: 14px; font-family: inherit;
}
.sem-permissao-sair:hover { color: var(--foreground); }

/* === ANIMAÇÕES === */
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.fade-in { animation: fadeIn 0.4s ease-out; }

/* === SCROLLBAR === */
::-webkit-scrollbar { width: 12px; }
::-webkit-scrollbar-track { background: var(--background); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: var(--radius-sm); }
::-webkit-scrollbar-thumb:hover { background: var(--input); }

/* === FOCO ACESSÍVEL === */
*:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(var(--ring-rgb), 0.5); }

/* === TELAS (Neurônios, Organizações, Usuários, Perfis, Chaves de API, Auditoria) === */
/* Estado operacional: mesmas cores do ESTADOS do dashboard (lá eram inline). */
.dot-operando { background: var(--success); }
.dot-permanente { background: var(--chart-2); }
.dot-pronto { background: var(--chart-1); }
.dot-bloqueado { background: var(--destructive); }
.dot-sem_contato { background: var(--warning); }
.dot-silencioso { background: var(--muted-foreground); }
/* Barras de sinal: alturas 4/7/10/13 px do renderSignalBars do dashboard. */
.signal-bar.altura-1 { height: 4px; }
.signal-bar.altura-2 { height: 7px; }
.signal-bar.altura-3 { height: 10px; }
.signal-bar.altura-4 { height: 13px; }
.sinal-pct { color: var(--muted-foreground); font-size: 11px; margin-left: 4px; }
.credito-permanente { color: var(--success); }
.credito-bloqueado { color: var(--destructive); }
.credito-nenhum { color: var(--muted-foreground); }
.credito-normal { color: var(--foreground); }
.conexao-antiga { color: var(--destructive); }
.texto-mudo { color: var(--muted-foreground); }
.texto-info { color: var(--info); }
.texto-pequeno { font-size: 11px; }
.texto-equipamento { display: inline-block; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }
.texto-quebra { white-space: pre-line; overflow-wrap: anywhere; font-size: 13px; line-height: 1.5; }
.id-celula { display: inline-flex; align-items: center; gap: 6px; }
.badge-mini { font-size: 9px; padding: 1px 6px; }
.badge-4g { background: var(--info); color: var(--info-foreground); }
tbody tr.linha-emuso { background: rgba(var(--warning-rgb), 0.04); }
tbody td.quebra, .modal-body tbody td.quebra { white-space: normal; overflow-wrap: anywhere; min-width: 160px; max-width: 420px; }
.col-picker-hint { font-size: 11px; color: var(--muted-foreground); padding: 6px 6px 2px; border-top: 1px solid var(--border); margin-top: 4px; line-height: 1.4; }
.table-filters .filter-select { max-width: 240px; }
.table-filters .link-btn { align-self: center; }
.filtros-auditoria { margin-bottom: 6px; }
.carregar-mais { display: flex; justify-content: center; margin-top: 12px; }

/* Ficha e modais de formulário */
.aba-painel { position: relative; }
.aba-painel > .info-wrap { top: 0; right: 0; }
.aba-intro { font-size: 12px; color: var(--muted-foreground); line-height: 1.5; margin-bottom: 14px; padding-right: 28px; }
.ficha-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px; }
.ficha-grid .modal-field { min-width: 0; }
.ficha-grid-espaco { margin-top: 16px; }
.modal-section-label-primeira { margin-top: 0; padding-top: 0; border-top: none; }
.form-ficha { margin-top: 16px; }
.secao-acoes { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }
.modal-header-acoes:empty { display: none; }
.modal-header .modal-header-acoes { margin-left: auto; margin-right: 12px; }
.aviso-bloco {
  border: 1px solid rgba(var(--warning-rgb), 0.4); background: rgba(var(--warning-rgb), 0.08);
  border-radius: var(--radius-md); padding: 12px 14px; margin: 12px 0; font-size: 13px; line-height: 1.5; color: var(--foreground);
}
.aviso-bloco-info { border-color: rgba(var(--info-rgb), 0.4); background: rgba(var(--info-rgb), 0.08); }
.checks-lista {
  display: flex; flex-direction: column; gap: 6px; max-height: 280px; overflow-y: auto;
  padding: 10px 12px; background: var(--muted); border: 1px solid var(--input); border-radius: var(--radius-md);
}
.checks-grupo-titulo { font-size: 10px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--muted-foreground); margin-top: 6px; }
.checks-grupo-titulo:first-child { margin-top: 0; }
.campo-check { align-items: flex-start; }
.campo-check input { margin-top: 3px; }
.check-sub { color: var(--muted-foreground); font-size: 12px; }
.segredo-caixa { display: flex; gap: 8px; }
.segredo-caixa .campo-input { font-family: var(--font-mono); font-size: 12px; }
.diff-antes { color: var(--destructive); }
.diff-depois { color: var(--success); }

/* Linha do tempo dos vínculos */
.linha-tempo { list-style: none; margin: 0; padding: 0 0 0 18px; border-left: 2px solid var(--border); display: flex; flex-direction: column; gap: 16px; }
.linha-tempo li { position: relative; }
.linha-tempo li::before {
  content: ''; position: absolute; left: -25px; top: 3px; width: 12px; height: 12px; border-radius: 50%;
  background: var(--border); border: 2px solid var(--card);
}
.linha-tempo li.atual::before { background: var(--success); }
.linha-tempo li.implicito::before { background: var(--muted); border-color: var(--border); }
.lt-periodo { font-family: var(--font-mono); font-size: 11px; color: var(--muted-foreground); }
.lt-titulo { font-size: 14px; font-weight: 600; margin: 2px 0; color: var(--foreground); }
.lt-detalhe { font-size: 12px; color: var(--muted-foreground); line-height: 1.6; }

/* === MOBILE === */
.mobile-header {
  display: none; position: fixed; top: 0; left: 0; right: 0; height: 56px; z-index: 40;
  background: linear-gradient(180deg, var(--background) 0%, var(--background) 100%);
  border-bottom: 1px solid var(--border); align-items: center; padding: 0 16px; gap: 12px;
}
.hamburger {
  background: none; border: none; color: var(--muted-foreground); cursor: pointer; padding: 4px;
  display: flex; align-items: center; justify-content: center;
}
.hamburger svg { width: 24px; height: 24px; }
.mobile-header img { height: 26px; opacity: 0.9; }
.sidebar-overlay {
  display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(var(--background-rgb), 0.6); z-index: 45; backdrop-filter: blur(2px);
}
.sidebar-overlay.active { display: block; }

/* === TELA INÍCIO === */
.inicio-barra { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.inicio-gerado { font-size: 12px; color: var(--muted-foreground); }
.charts-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-bottom: 24px; }
.kpi-card.clicavel { cursor: pointer; }
.kpi-icon { width: 36px; height: 36px; border-radius: var(--radius-lg); display: flex; align-items: center; justify-content: center; margin-bottom: 12px; }
.kpi-icon svg { width: 20px; height: 20px; }
.tom-primario { background: rgba(var(--primary-rgb), 0.15); color: var(--ring); }
.tom-info { background: rgba(var(--info-rgb), 0.15); color: var(--info); }
.tom-sucesso { background: rgba(var(--success-rgb), 0.15); color: var(--success); }
.tom-aviso { background: rgba(var(--warning-rgb), 0.15); color: var(--warning); }
.kpi-link { display: inline-block; text-decoration: none; color: var(--foreground); border-radius: var(--radius-sm); }
.kpi-link.valor-info { color: var(--info); }
.kpi-link.valor-sucesso { color: var(--success); }
.kpi-link.valor-aviso { color: var(--warning); }
.kpi-link:hover { text-decoration: underline; text-underline-offset: 4px; }
.kpi-link:focus-visible, .pendencia:focus-visible, .org-barra:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
.pendencias { display: flex; flex-direction: column; }
.pendencia {
  display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; align-items: baseline;
  padding: 10px 8px; border-radius: var(--radius-sm); color: var(--foreground); text-decoration: none;
  border-bottom: 1px solid var(--border);
}
.pendencia:last-child { border-bottom: none; }
.pendencia:hover { background: rgba(var(--primary-rgb), 0.08); }
.pendencia-titulo { font-size: 13px; font-weight: 500; }
.pendencia-n { font-size: 18px; font-weight: 700; text-align: right; }
.pendencia-aberta { color: var(--warning); }
.pendencia-zerada { color: var(--success); }
.pendencia-indefinida { color: var(--muted-foreground); }
.pendencia-sub { grid-column: 1 / -1; font-size: 11px; color: var(--muted-foreground); line-height: 1.5; }
.org-barras { display: flex; flex-direction: column; gap: 4px; }
.org-barra {
  display: grid; grid-template-columns: minmax(80px, 150px) minmax(0, 1fr) auto; align-items: center; gap: 10px;
  padding: 6px 4px; border-radius: var(--radius-sm); color: var(--foreground); text-decoration: none; font-size: 12px;
}
.org-barra:hover { background: rgba(var(--primary-rgb), 0.08); }
.org-barra-nome { color: var(--muted-foreground); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.org-barra-trilho { display: block; height: 18px; background: var(--muted); border-radius: var(--radius-sm); overflow: hidden; }
.org-barra-preenche { display: block; height: 100%; background: var(--chart-1); border-radius: var(--radius-sm); }
.org-barra-n { font-weight: 600; text-align: right; min-width: 48px; }
.org-barras-outras { font-size: 11px; color: var(--muted-foreground); padding: 6px 4px; }
.inicio-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.inicio-chip { font-size: 12px; padding: 4px 10px; border-radius: var(--radius-full); background: var(--muted); color: var(--foreground); }
.inicio-secao-titulo { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; color: var(--muted-foreground); margin: 16px 0 8px; }
.inicio-frota + .table-card { margin-top: 0; }

@media (max-width: 768px) {
  .mobile-header { display: flex; }
  .sidebar { transform: translateX(-100%); transition: transform 0.3s ease; z-index: 50; width: 260px; }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; padding: 72px 16px 24px; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .page-header { flex-wrap: wrap; gap: 12px; }
  .page-title { font-size: 18px; }
  .kpi-value { font-size: 22px; }
  .kpi-card, .chart-card { padding: 16px; }
  .table-card { padding: 14px; }
  .table-filters { flex-direction: column; }
  .filter-input, .filter-select { width: 100%; }
  .col-picker-menu { right: auto; left: 0; }
  .modal-container, .modal-container.modal-sm, .modal-container.modal-md { width: 100%; max-width: 100%; max-height: 100vh; border-radius: 0; }
  .modal-tabs-nav { overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; padding: 0 16px; }
  .modal-tabs-nav::-webkit-scrollbar { display: none; }
  .modal-tab { white-space: nowrap; flex-shrink: 0; padding: 10px 12px; font-size: 12px; }
  .modal-body.com-padding { padding: 16px; }
  .modal-field { min-width: 100px; }
  .login-card { padding: 32px 24px; }
  .info-tip { width: 200px; }
  .avisos { left: 16px; right: 16px; bottom: 16px; max-width: none; }
  .form-acoes .btn { flex: 1; }
  .table-filters .filter-select { max-width: none; }
  .modal-rodape .btn { flex: 1 1 auto; }
  .segredo-caixa { flex-direction: column; }
  .charts-grid { grid-template-columns: 1fr; }
  .org-barra { grid-template-columns: minmax(70px, 110px) minmax(0, 1fr) auto; }
}
@media (max-width: 480px) {
  .kpi-grid { grid-template-columns: 1fr; }
  .main-content { padding: 64px 12px 20px; }
  .pagination { flex-direction: column; gap: 8px; text-align: center; }
}

/* Safari (iOS) dá zoom em campo com fonte < 16px e não desfaz: em tela de toque todo campo vai a 16px,
   com o padding vertical reduzido na mesma medida para a altura não mudar (mesma regra do dashboard). */
@media (max-width: 768px), (hover: none) and (pointer: coarse) {
  input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]):not([type="file"]),
  select,
  textarea { font-size: 16px; }
  .filter-input, .filter-select { padding-top: 6px; padding-bottom: 6px; }
  .campo-input { padding-top: 8px; padding-bottom: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  .fade-in, .aviso, .badge-emuso::before { animation: none; }
}

/* === TELA HISTÓRICO DE ACESSOS === */
.kpi-value.valor-info { color: var(--info); }
.kpi-value.valor-sucesso { color: var(--success); }
.kpi-value.valor-primario { color: var(--foreground); }
