/**
 * app.css — Estilos customizados do painel UniFi Controle
 *
 * Organização:
 *  1. Variáveis CSS (tema claro e escuro)
 *  2. Reset e base
 *  3. Layout principal (sidebar + main)
 *  4. Navbar / Topbar
 *  5. Sidebar
 *  6. Cards e métricas
 *  7. Tabelas
 *  8. Formulários e modais
 *  9. Badges e status
 * 10. Toasts
 * 11. Paginação
 * 12. Utilitários / animações
 * 13. Responsivo (mobile)
 */

/* ═══════════════════════════════════════════════════
   1. VARIÁVEIS CSS
═══════════════════════════════════════════════════ */

:root {
  /* Dimensões de layout */
  --sidebar-width: 240px;
  --navbar-height: 56px;

  /* Paleta principal */
  --color-primary:   #0d6efd;
  --color-primary-dark: #0a58ca;
  --color-success:   #198754;
  --color-danger:    #dc3545;
  --color-warning:   #ffc107;
  --color-info:      #0dcaf0;

  /* Status de dispositivos */
  --color-online:    #20c997;
  --color-offline:   #f87171;
  --color-degraded:  #fbbf24;

  /* Fundo e superfícies (tema claro – padrão Bootstrap) */
  --bg-app:          #f8f9fa;
  --bg-sidebar:      #1e2130;
  --bg-card:         #ffffff;
  --bg-table-hover:  rgba(13, 110, 253, 0.04);

  /* Texto sidebar */
  --text-sidebar:        #adb5bd;
  --text-sidebar-active: #ffffff;
  --text-sidebar-hover:  #dee2e6;

  /* Bordas */
  --border-color: rgba(0, 0, 0, 0.08);
  --border-card:  rgba(0, 0, 0, 0.1);

  /* Sombras */
  --shadow-card: 0 1px 4px rgba(0, 0, 0, 0.08);
  --shadow-modal: 0 8px 40px rgba(0, 0, 0, 0.18);

  /* Transições */
  --transition-fast: 0.15s ease;
  --transition-base: 0.25s ease;
}

/* Variáveis do tema escuro */
[data-bs-theme="dark"] {
  --bg-app:          #0f1117;
  --bg-sidebar:      #161b24;
  --bg-card:         #1a2030;
  --bg-table-hover:  rgba(255, 255, 255, 0.04);
  --border-color:    rgba(255, 255, 255, 0.07);
  --border-card:     rgba(255, 255, 255, 0.09);
  --shadow-card:     0 1px 6px rgba(0, 0, 0, 0.4);
  --shadow-modal:    0 12px 48px rgba(0, 0, 0, 0.6);
}

/* ═══════════════════════════════════════════════════
   2. RESET E BASE
═══════════════════════════════════════════════════ */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
  background-color: var(--bg-app);
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  font-size: 0.9rem;
  line-height: 1.5;
  transition: background-color var(--transition-base);
}

/* Scrollbar customizada */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(128, 128, 128, 0.3); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(128, 128, 128, 0.5); }

/* ═══════════════════════════════════════════════════
   3. LAYOUT PRINCIPAL
═══════════════════════════════════════════════════ */

#app-layout {
  display: flex;
  min-height: 100vh;
}

/* Área de conteúdo principal */
#app-main {
  flex: 1;
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  background: var(--bg-app);
  transition: margin-left var(--transition-base);
}

#app-content {
  padding: 28px 28px 48px;
  min-height: calc(100vh - var(--navbar-height));
  margin-top: var(--navbar-height);
}

/* ═══════════════════════════════════════════════════
   4. NAVBAR / TOPBAR
═══════════════════════════════════════════════════ */

#app-navbar {
  position: fixed;
  top: 0;
  left: var(--sidebar-width);
  right: 0;
  height: var(--navbar-height);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 12px;
  z-index: 1000;
  transition: left var(--transition-base), background var(--transition-base);
  box-shadow: var(--shadow-card);
}

.navbar-page-title {
  font-size: 1rem;
  font-weight: 600;
}

.navbar-breadcrumb {
  font-size: 0.78rem;
  margin: 0;
}

.api-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 20px;
  border: 1px solid;
  cursor: default;
}

.api-status-pill.online {
  color: var(--color-online);
  background: rgba(32, 201, 151, 0.1);
  border-color: rgba(32, 201, 151, 0.3);
}

.api-status-pill.offline {
  color: var(--color-offline);
  background: rgba(248, 113, 113, 0.1);
  border-color: rgba(248, 113, 113, 0.3);
}

.api-status-pill .pulse-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  animation: pulse 2s infinite;
}

.ws-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.7rem;
  color: var(--color-online);
  background: rgba(32, 201, 151, 0.1);
  border: 1px solid rgba(32, 201, 151, 0.25);
  padding: 2px 8px;
  border-radius: 20px;
}

.ws-badge.disconnected {
  color: var(--color-offline);
  background: rgba(248, 113, 113, 0.1);
  border-color: rgba(248, 113, 113, 0.25);
}

.ws-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  animation: pulse 1.8s infinite;
}

/* ═══════════════════════════════════════════════════
   5. SIDEBAR
═══════════════════════════════════════════════════ */

#app-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--bg-sidebar);
  display: flex;
  flex-direction: column;
  z-index: 1100;
  overflow-y: auto;
  transition: transform var(--transition-base);
  border-right: 1px solid rgba(255, 255, 255, 0.06);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 18px;
  text-decoration: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  transition: background var(--transition-fast);
}

.sidebar-brand:hover {
  background: rgba(255, 255, 255, 0.04);
}

.sidebar-logo {
  width: 34px;
  height: 34px;
  background: var(--color-primary);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  color: #fff;
  flex-shrink: 0;
}

.sidebar-brand-text {
  font-size: 0.95rem;
  font-weight: 700;
  color: #f1f3f5;
  letter-spacing: -0.01em;
}

.sidebar-section-label {
  padding: 16px 18px 4px;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #4b5563;
}

.sidebar-nav {
  flex: 1;
  padding: 6px 8px;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 8px;
  color: var(--text-sidebar);
  text-decoration: none;
  font-size: 0.855rem;
  font-weight: 500;
  transition: background var(--transition-fast), color var(--transition-fast);
  position: relative;
  white-space: nowrap;
}

.sidebar-link:hover {
  background: rgba(255, 255, 255, 0.07);
  color: var(--text-sidebar-hover);
}

.sidebar-link.active {
  background: rgba(13, 110, 253, 0.2);
  color: #6ea8fe;
  font-weight: 600;
}

.sidebar-link .bi {
  font-size: 1rem;
  width: 18px;
  text-align: center;
  flex-shrink: 0;
}

.sidebar-badge {
  margin-left: auto;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 10px;
  background: rgba(248, 113, 113, 0.25);
  color: var(--color-offline);
}

.sidebar-footer {
  padding: 12px 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: background var(--transition-fast);
}

.sidebar-user:hover {
  background: rgba(255, 255, 255, 0.06);
}

.sidebar-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(13, 110, 253, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  color: #6ea8fe;
  font-weight: 700;
  flex-shrink: 0;
}

.sidebar-username {
  font-size: 0.82rem;
  font-weight: 600;
  color: #e5e7eb;
  line-height: 1.2;
}

.sidebar-role {
  font-size: 0.68rem;
  color: #6b7280;
}

/* ═══════════════════════════════════════════════════
   6. CARDS E MÉTRICAS
═══════════════════════════════════════════════════ */

.metric-card {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: 12px;
  padding: 20px 22px;
  box-shadow: var(--shadow-card);
  transition: box-shadow var(--transition-fast), border-color var(--transition-fast);
  border-left: 4px solid var(--color-primary);
}

.metric-card:hover {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

.metric-card.danger  { border-left-color: var(--color-danger); }
.metric-card.success { border-left-color: var(--color-success); }
.metric-card.warning { border-left-color: #f59e0b; }
.metric-card.info    { border-left-color: var(--color-info); }

.metric-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
}

.metric-icon.primary { background: rgba(13, 110, 253, 0.15); color: var(--color-primary); }
.metric-icon.success { background: rgba(25, 135, 84, 0.15);  color: var(--color-success); }
.metric-icon.danger  { background: rgba(220, 53, 69, 0.15);  color: var(--color-danger); }
.metric-icon.warning { background: rgba(245, 158, 11, 0.15); color: #f59e0b; }
.metric-icon.info    { background: rgba(13, 202, 240, 0.15); color: var(--color-info); }
.metric-icon.teal    { background: rgba(32, 201, 151, 0.15); color: var(--color-online); }

.metric-value {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.1;
}

.metric-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.06em;
  opacity: 0.65;
}

.metric-sub {
  font-size: 0.77rem;
  opacity: 0.55;
}

/* Card genérico */
.app-card {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: 12px;
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

.app-card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.app-card-title {
  font-size: 0.88rem;
  font-weight: 600;
  margin: 0;
}

.app-card-body {
  padding: 20px;
}

/* ═══════════════════════════════════════════════════
   7. TABELAS
═══════════════════════════════════════════════════ */

.app-table-wrapper {
  overflow-x: auto;
  border-radius: 0 0 12px 12px;
}

.app-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.855rem;
}

.app-table thead th {
  padding: 11px 16px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  opacity: 0.55;
  white-space: nowrap;
  border-bottom: 1px solid var(--border-color);
  background: transparent;
  cursor: pointer;
  user-select: none;
}

.app-table thead th:hover {
  opacity: 0.85;
}

.app-table thead th.sorted-asc::after  { content: ' ↑'; }
.app-table thead th.sorted-desc::after { content: ' ↓'; }

.app-table tbody tr {
  border-bottom: 1px solid var(--border-color);
  transition: background var(--transition-fast);
}

.app-table tbody tr:last-child {
  border-bottom: none;
}

.app-table tbody tr:hover {
  background: var(--bg-table-hover);
}

.app-table tbody td {
  padding: 13px 16px;
  vertical-align: middle;
}

/* Estado vazio da tabela */
.table-empty {
  padding: 48px 24px;
  text-align: center;
}

.table-empty .bi {
  font-size: 2.5rem;
  opacity: 0.3;
  display: block;
  margin-bottom: 10px;
}

.table-empty p {
  opacity: 0.45;
  font-size: 0.88rem;
  margin: 0;
}

/* ═══════════════════════════════════════════════════
   8. FORMULÁRIOS E MODAIS
═══════════════════════════════════════════════════ */

/* Sobreposição do modal */
.modal-backdrop-custom {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(2px);
  z-index: 1050;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: fadeIn 0.15s ease;
}

.modal-box {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: 16px;
  box-shadow: var(--shadow-modal);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  animation: slideUp 0.2s ease;
}

.modal-box.modal-lg {
  max-width: 720px;
}

.modal-box-header {
  padding: 20px 24px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-color);
}

.modal-box-title {
  font-size: 1rem;
  font-weight: 700;
  margin: 0;
}

.modal-box-body {
  padding: 24px;
}

.modal-box-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* Campos de formulário */
.field-label {
  font-size: 0.76rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  opacity: 0.65;
  margin-bottom: 5px;
  display: block;
}

.field-error {
  font-size: 0.76rem;
  color: var(--color-danger);
  margin-top: 4px;
  display: none;
}

.field-error.visible {
  display: block;
}

/* Spinner de loading inline em botões */
.btn-loading {
  pointer-events: none;
  opacity: 0.75;
}

/* ═══════════════════════════════════════════════════
   9. BADGES E STATUS
═══════════════════════════════════════════════════ */

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 600;
  border: 1px solid;
}

.status-badge.online {
  background: rgba(32, 201, 151, 0.12);
  color: var(--color-online);
  border-color: rgba(32, 201, 151, 0.3);
}

.status-badge.offline {
  background: rgba(248, 113, 113, 0.12);
  color: var(--color-offline);
  border-color: rgba(248, 113, 113, 0.3);
}

.status-badge.warning {
  background: rgba(251, 191, 36, 0.12);
  color: var(--color-degraded);
  border-color: rgba(251, 191, 36, 0.3);
}

.status-badge.info {
  background: rgba(13, 110, 253, 0.12);
  color: #6ea8fe;
  border-color: rgba(13, 110, 253, 0.3);
}

.status-badge.active {
  background: rgba(25, 135, 84, 0.12);
  color: #5cb85c;
  border-color: rgba(25, 135, 84, 0.3);
}

.status-badge.inactive {
  background: rgba(108, 117, 125, 0.1);
  color: #6c757d;
  border-color: rgba(108, 117, 125, 0.25);
}

.status-badge.blocked {
  background: rgba(220, 53, 69, 0.12);
  color: var(--color-danger);
  border-color: rgba(220, 53, 69, 0.3);
}

/* Role badges */
.role-badge {
  padding: 2px 9px;
  border-radius: 20px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.role-badge.superadmin { background: rgba(156, 39, 176, 0.15); color: #ce93d8; }
.role-badge.admin      { background: rgba(13, 110, 253, 0.15); color: #6ea8fe; }
.role-badge.operator   { background: rgba(25, 135, 84, 0.15);  color: #5cb85c; }
.role-badge.readonly   { background: rgba(108, 117, 125, 0.1); color: #6c757d; }

/* Barra de sinal Wi-Fi */
.signal-bar {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.78rem;
  font-weight: 600;
}

.signal-bar.excellent { color: var(--color-online); }
.signal-bar.good      { color: #84cc16; }
.signal-bar.fair      { color: var(--color-degraded); }
.signal-bar.poor      { color: var(--color-offline); }

/* Connection type badges */
.type-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 9px;
  border-radius: 20px;
  font-size: .72rem;
  font-weight: 600;
}
.type-badge.wifi {
  background: rgba(13, 110, 253, 0.13);
  color: #6ea8fe;
  border: 1px solid rgba(13, 110, 253, 0.3);
}
.type-badge.wired {
  background: rgba(168, 85, 247, 0.12);
  color: #c084fc;
  border: 1px solid rgba(168, 85, 247, 0.3);
}

/* Barra de progresso de satisfação */
.satisfaction-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 100px;
}

.satisfaction-track {
  flex: 1;
  height: 5px;
  border-radius: 3px;
  background: rgba(128, 128, 128, 0.2);
  overflow: hidden;
}

.satisfaction-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.4s ease;
}

.satisfaction-fill.high   { background: var(--color-online); }
.satisfaction-fill.medium { background: var(--color-degraded); }
.satisfaction-fill.low    { background: var(--color-offline); }

.satisfaction-text {
  font-size: 0.75rem;
  font-weight: 600;
  min-width: 32px;
  text-align: right;
}

/* ═══════════════════════════════════════════════════
   10. TOASTS
═══════════════════════════════════════════════════ */

#toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column-reverse;
  gap: 8px;
  pointer-events: none;
}

.app-toast {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-left: 3px solid;
  border-radius: 10px;
  padding: 12px 16px;
  min-width: 300px;
  max-width: 400px;
  box-shadow: var(--shadow-modal);
  pointer-events: all;
  animation: toastIn 0.22s ease;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.app-toast.removing {
  opacity: 0;
  transform: translateX(16px);
}

.app-toast.success { border-left-color: var(--color-online); }
.app-toast.error   { border-left-color: var(--color-offline); }
.app-toast.warning { border-left-color: var(--color-degraded); }
.app-toast.info    { border-left-color: var(--color-primary); }

.toast-icon {
  font-size: 1.1rem;
  flex-shrink: 0;
  margin-top: 1px;
}

.toast-icon.success { color: var(--color-online); }
.toast-icon.error   { color: var(--color-offline); }
.toast-icon.warning { color: var(--color-degraded); }
.toast-icon.info    { color: var(--color-primary); }

.toast-title {
  font-size: 0.85rem;
  font-weight: 600;
  line-height: 1.3;
}

.toast-msg {
  font-size: 0.78rem;
  opacity: 0.65;
  margin-top: 2px;
}

.toast-close {
  background: none;
  border: none;
  opacity: 0.4;
  cursor: pointer;
  font-size: 0.9rem;
  padding: 0;
  margin-left: auto;
  flex-shrink: 0;
  line-height: 1;
}

.toast-close:hover {
  opacity: 0.8;
}

/* ═══════════════════════════════════════════════════
   11. PAGINAÇÃO
═══════════════════════════════════════════════════ */

.app-pagination {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.82rem;
}

.page-btn {
  min-width: 32px;
  height: 32px;
  padding: 0 8px;
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition-fast), border-color var(--transition-fast);
  font-size: 0.82rem;
}

.page-btn:hover:not(:disabled) {
  background: rgba(13, 110, 253, 0.08);
  border-color: rgba(13, 110, 253, 0.3);
}

.page-btn.active {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
  font-weight: 600;
}

.page-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

/* ═══════════════════════════════════════════════════
   12. UTILITÁRIOS E ANIMAÇÕES
═══════════════════════════════════════════════════ */

/* Spinner de carregamento de página */
.loading-spinner {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 64px 24px;
  gap: 12px;
  opacity: 0.6;
  font-size: 0.88rem;
}

/* Overlay de loading sobre área */
.loading-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(var(--bg-card), 0.7);
  backdrop-filter: blur(2px);
  z-index: 10;
  border-radius: 12px;
}

/* Wrapper de gráfico Chart.js */
.chart-container {
  position: relative;
}

/* Cabeçalho de página com ações */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.page-header-title {
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.2;
  margin: 0;
}

.page-header-sub {
  font-size: 0.82rem;
  opacity: 0.55;
  margin: 2px 0 0;
}

/* Barra de filtros */
.filter-bar {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: 10px;
  padding: 14px 18px;
  margin-bottom: 18px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-end;
}

/* Barra de progresso genérica */
.progress-bar-custom {
  height: 5px;
  border-radius: 3px;
  background: rgba(128, 128, 128, 0.18);
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.4s ease;
}

/* Animações */
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.35; }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(16px); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes countUp {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Textos com truncagem */
.text-truncate-cell {
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Separador de seção na sidebar */
.section-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.06);
  margin: 6px 10px;
}

/* Botão de ação compacto */
.btn-action {
  width: 30px;
  height: 30px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 7px;
  font-size: 0.88rem;
  border: 1px solid var(--border-color);
  background: transparent;
  cursor: pointer;
  transition: background var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast);
  opacity: 0.75;
}

.btn-action:hover { opacity: 1; }
.btn-action.edit:hover  { background: rgba(13, 110, 253, 0.1);  border-color: rgba(13, 110, 253, 0.3);  color: var(--color-primary); }
.btn-action.del:hover   { background: rgba(220, 53, 69, 0.1);   border-color: rgba(220, 53, 69, 0.3);   color: var(--color-danger); }
.btn-action.info:hover  { background: rgba(13, 202, 240, 0.1);  border-color: rgba(13, 202, 240, 0.3);  color: var(--color-info); }
.btn-action.test:hover  { background: rgba(25, 135, 84, 0.1);   border-color: rgba(25, 135, 84, 0.3);   color: var(--color-success); }
.btn-action.block:hover { background: rgba(220, 53, 69, 0.1);   border-color: rgba(220, 53, 69, 0.3);   color: var(--color-danger); }
.btn-action.warn:hover  { background: rgba(245, 158, 11, 0.1);  border-color: rgba(245, 158, 11, 0.3);  color: #f59e0b; }

/* Seletor de controlador global */
.controller-selector-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

/* Página de login */
#login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--bg-app);
}

.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: 20px;
  padding: 40px 36px;
  box-shadow: var(--shadow-modal);
  animation: slideUp 0.3s ease;
}

.login-logo {
  width: 58px;
  height: 58px;
  background: var(--color-primary);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  color: #fff;
  margin-bottom: 16px;
}

/* Oculto por padrão — controlado por JS */
.app-shell {
  display: none;
}

/* Tabela de WLAN cards */
.wlan-card {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: 12px;
  padding: 18px 20px;
  transition: border-color var(--transition-fast);
}

.wlan-card:hover {
  border-color: rgba(13, 110, 253, 0.3);
}

/* Timeline de logs */
.timeline {
  list-style: none;
  padding: 0;
  margin: 0;
}

.timeline li {
  display: flex;
  gap: 14px;
  padding-bottom: 16px;
  position: relative;
}

.timeline li::before {
  content: '';
  position: absolute;
  left: 17px;
  top: 38px;
  bottom: 0;
  width: 1px;
  background: var(--border-color);
}

.timeline li:last-child::before {
  display: none;
}

.tl-dot {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  flex-shrink: 0;
}

/* ═══════════════════════════════════════════════════
   13. RESPONSIVO (MOBILE)
═══════════════════════════════════════════════════ */

@media (max-width: 768px) {
  #app-sidebar {
    transform: translateX(-100%);
  }

  #app-sidebar.open {
    transform: translateX(0);
  }

  #app-main {
    margin-left: 0;
  }

  #app-navbar {
    left: 0;
  }

  #app-content {
    padding: 20px 16px 40px;
  }

  .filter-bar {
    flex-direction: column;
  }

  .page-header {
    flex-direction: column;
  }

  .modal-box {
    max-width: 100%;
  }

  .app-toast {
    min-width: 260px;
    max-width: calc(100vw - 40px);
  }

  .metric-value {
    font-size: 1.6rem;
  }
}

@media (max-width: 480px) {
  .sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1099;
    display: none;
  }

  .sidebar-backdrop.visible {
    display: block;
  }
}
