/* ========================================================
   Detect Jammer - CSS Principal
   ======================================================== */

/* --- Variáveis de tema --- */
:root {
    --bg:           #0f1117;
    --surface:      #1a1d27;
    --surface2:     #22263a;
    --border:       #2a2d3a;
    --primary:      #ff3b3b;
    --primary-dark: #cc2a2a;
    --primary-glow: rgba(255, 59, 59, 0.25);
    --text:         #e0e0e0;
    --text-muted:   #888da8;
    --text-dim:     #555a72;
    --success:      #4caf50;
    --warning:      #ff9800;
    --danger:       #ff3b3b;
    --info:         #2196f3;
    --sidebar-w:    240px;
    --sidebar-collapsed-w: 60px;
    --topbar-h:     60px;
    --radius:       10px;
    --radius-sm:    6px;
    --shadow:       0 4px 24px rgba(0,0,0,0.5);
    --transition:   0.25s ease;
}

[data-theme="light"] {
    --bg:         #f5f7fa;
    --surface:    #ffffff;
    --surface2:   #f0f2f8;
    --border:     #e0e4ef;
    --text:       #1a1d27;
    --text-muted: #6b7080;
    --text-dim:   #a0a5b8;
    --shadow:     0 4px 24px rgba(0,0,0,0.1);
}

/* --- Reset & Base --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; scroll-behavior: smooth; }

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.6;
    transition: background var(--transition), color var(--transition);
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

img, svg { display: block; }

/* --- Layout Principal (app shell) --- */
.app-wrapper {
    display: flex;
    min-height: 100vh;
}

/* ========================================================
   SIDEBAR
   ======================================================== */
.sidebar {
    width: var(--sidebar-w);
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 200;
    transition: width var(--transition), transform var(--transition);
    overflow: hidden;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    height: var(--topbar-h);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    overflow: hidden;
}

.sidebar-logo-img {
    height: 100%;
    width: auto;
    object-fit: contain;
    display: block;
}

.sidebar-logo-text {
    font-weight: 700;
    font-size: 17px;
    color: var(--text);
    white-space: nowrap;
    transition: opacity var(--transition);
}

.sidebar-nav {
    flex: 1;
    padding: 12px 8px;
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    transition: background var(--transition), color var(--transition);
    white-space: nowrap;
    margin-bottom: 2px;
    text-decoration: none;
}

.sidebar-link:hover {
    background: var(--surface2);
    color: var(--text);
    text-decoration: none;
}

.sidebar-link.active {
    background: var(--primary-glow);
    color: var(--primary);
}

.sidebar-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-label {
    font-size: 14px;
    font-weight: 500;
    transition: opacity var(--transition);
    white-space: nowrap;
}

.sidebar-footer {
    border-top: 1px solid var(--border);
    padding: 12px 8px;
    flex-shrink: 0;
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    margin-bottom: 4px;
}

.sidebar-user-avatar {
    width: 34px;
    height: 34px;
    background: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    font-size: 15px;
    flex-shrink: 0;
    text-transform: uppercase;
}

.sidebar-user-info {
    overflow: hidden;
    transition: opacity var(--transition);
}

.sidebar-user-name {
    display: block;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text);
}

.sidebar-user-role {
    display: block;
    font-size: 11px;
    color: var(--text-muted);
}

.sidebar-logout {
    color: var(--danger);
}

.sidebar-logout:hover {
    background: rgba(255,59,59,0.1);
    color: var(--danger);
}

/* Collapsed sidebar */
.sidebar.collapsed {
    width: var(--sidebar-collapsed-w);
}

.sidebar.collapsed .sidebar-label,
.sidebar.collapsed .sidebar-logo-text,
.sidebar.collapsed .sidebar-user-info {
    opacity: 0;
    pointer-events: none;
    width: 0;
    overflow: hidden;
}

.sidebar.collapsed .sidebar-user {
    justify-content: center;
}

.sidebar.collapsed .sidebar-link {
    justify-content: center;
    padding: 10px;
}

/* Overlay para mobile */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 150;
}

/* ========================================================
   HAMBURGER
   ======================================================== */
.hamburger {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    border-radius: var(--radius-sm);
    z-index: 300;
    position: relative;
}

.hamburger span {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--text);
    border-radius: 2px;
    transition: transform 0.25s, opacity 0.25s, width 0.25s;
    transform-origin: center;
}

.hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger.open span:nth-child(2) { opacity: 0; width: 0; }
.hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ========================================================
   MAIN CONTENT
   ======================================================== */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-w);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: margin-left var(--transition);
}

.main-content.expanded {
    margin-left: var(--sidebar-collapsed-w);
}

/* ========================================================
   TOP BAR
   ======================================================== */
.topbar {
    height: var(--topbar-h);
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 20px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.topbar-hamburger {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    border-radius: var(--radius-sm);
    color: var(--text);
    flex-direction: column;
    gap: 5px;
}

.topbar-hamburger span {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--text);
    border-radius: 2px;
    transition: transform 0.25s, opacity 0.25s;
    transform-origin: center;
}

.topbar-title {
    flex: 1;
    font-size: 17px;
    font-weight: 600;
    color: var(--text);
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.topbar-user {
    font-size: 13px;
    color: var(--text-muted);
}

.theme-toggle {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 15px;
    line-height: 1;
    color: var(--text);
    transition: background var(--transition);
    flex-shrink: 0;
}

.theme-toggle:hover { background: var(--border); }

/* ========================================================
   PAGE CONTENT
   ======================================================== */
.page-content {
    padding: 24px;
    flex: 1;
}

.page-header {
    margin-bottom: 24px;
}

.page-header h1 {
    font-size: 22px;
    font-weight: 700;
}

.page-header p {
    color: var(--text-muted);
    font-size: 14px;
    margin-top: 4px;
}

/* ========================================================
   CARDS GRID
   ======================================================== */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
}

.card-title {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.card-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text);
}

.card-value.primary { color: var(--primary); }
.card-value.success { color: var(--success); }
.card-value.warning { color: var(--warning); }

.card-sub {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

.card-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
}

.card-icon.red   { background: rgba(255,59,59,0.15); color: var(--primary); }
.card-icon.green { background: rgba(76,175,80,0.15); color: var(--success); }
.card-icon.blue  { background: rgba(33,150,243,0.15); color: var(--info); }
.card-icon.orange{ background: rgba(255,152,0,0.15); color: var(--warning); }

/* ========================================================
   FORMS
   ======================================================== */
.form-group {
    margin-bottom: 16px;
}

label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 6px;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="tel"],
select,
textarea {
    width: 100%;
    padding: 10px 14px;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: border-color var(--transition), box-shadow var(--transition);
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

input[readonly] {
    opacity: 0.6;
    cursor: not-allowed;
}

input::placeholder { color: var(--text-dim); }

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    flex-wrap: wrap;
}

/* ========================================================
   BUTTONS
   ======================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 18px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: background var(--transition), opacity var(--transition), transform 0.1s;
    white-space: nowrap;
    text-decoration: none;
}

.btn:hover { opacity: 0.88; }
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary {
    background: var(--primary);
    color: #fff;
}

.btn-secondary {
    background: var(--surface2);
    border: 1px solid var(--border);
    color: var(--text);
}

.btn-success {
    background: var(--success);
    color: #fff;
}

.btn-warning {
    background: var(--warning);
    color: #fff;
}

.btn-danger {
    background: var(--danger);
    color: #fff;
}

.btn-sm {
    padding: 5px 12px;
    font-size: 12px;
}

.btn-icon {
    padding: 7px;
    width: 34px;
    height: 34px;
    justify-content: center;
}

/* ========================================================
   TABLES
   ======================================================== */
.table-wrapper {
    overflow-x: auto;
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

thead tr {
    background: var(--surface2);
}

th {
    padding: 12px 16px;
    text-align: left;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    white-space: nowrap;
}

td {
    padding: 12px 16px;
    border-top: 1px solid var(--border);
    color: var(--text);
    vertical-align: middle;
}

tbody tr:hover { background: var(--surface2); }

.td-actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

/* ========================================================
   BADGES
   ======================================================== */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
}

.badge-pendente  { background: rgba(255,152,0,0.15); color: var(--warning); border: 1px solid var(--warning); }
.badge-aprovado  { background: rgba(76,175,80,0.15); color: var(--success); border: 1px solid var(--success); }
.badge-bloqueado { background: rgba(255,59,59,0.15); color: var(--danger); border: 1px solid var(--danger); }
.badge-admin     { background: rgba(33,150,243,0.15); color: var(--info); border: 1px solid var(--info); }
.badge-user      { background: var(--surface2); color: var(--text-muted); border: 1px solid var(--border); }

/* ========================================================
   ALERT BANNER (jammer detectado)
   ======================================================== */
.jammer-banner {
    display: none;
    position: sticky;
    top: var(--topbar-h);
    z-index: 90;
    background: var(--primary);
    color: #fff;
    padding: 12px 20px;
    flex-direction: column;
    gap: 4px;
    animation: slideBanner 0.3s ease;
}

.jammer-banner.visible { display: flex; }

.jammer-banner-row {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.jammer-banner-title {
    font-size: 16px;
    font-weight: 700;
    flex: 1;
}

.jammer-banner-info {
    font-size: 13px;
    opacity: 0.9;
}

.jammer-banner .btn-silence {
    background: rgba(255,255,255,0.2);
    color: #fff;
    border: 1px solid rgba(255,255,255,0.4);
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}

.jammer-banner .btn-silence:hover { background: rgba(255,255,255,0.3); }

@keyframes slideBanner {
    from { transform: translateY(-100%); opacity: 0; }
    to   { transform: translateY(0); opacity: 1; }
}

/* ── Muted Banner ── */
.muted-banner {
    display: none;
    position: sticky;
    top: var(--topbar-h);
    z-index: 90;
    background: #555a72;
    color: #fff;
    padding: 10px 20px;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    font-size: 14px;
    font-weight: 600;
}
.muted-banner.visible { display: flex; }
.muted-banner .btn-unmute {
    background: rgba(255,255,255,0.2);
    color: #fff;
    border: 1px solid rgba(255,255,255,0.4);
    border-radius: var(--radius-sm);
    padding: 5px 14px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}
.muted-banner .btn-unmute:hover { background: rgba(255,255,255,0.35); }

/* Pulsação do ícone de alerta */
.pulse-icon {
    animation: pulseIcon 1s infinite;
    display: inline-block;
}

@keyframes pulseIcon {
    0%, 100% { transform: scale(1); }
    50%       { transform: scale(1.2); }
}

/* ========================================================
   DEVICE STATUS BAR
   ======================================================== */
.status-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 600;
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.status-dot.online  { background: var(--success); animation: pulseGreen 2s infinite; }
.status-dot.offline { background: var(--danger); }
.status-dot.connecting { background: var(--warning); animation: blinkYellow 1s infinite; }

@keyframes pulseGreen {
    0%, 100% { box-shadow: 0 0 0 0 rgba(76,175,80,0.5); }
    50%       { box-shadow: 0 0 0 6px rgba(76,175,80,0); }
}

@keyframes blinkYellow {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.3; }
}

.status-label { color: var(--text-muted); font-size: 12px; }
.status-spacer { flex: 1; }

/* ========================================================
   MODAL
   ======================================================== */
.modal-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.65);
    z-index: 500;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.modal-backdrop.open { display: flex; }

.modal {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalIn 0.2s ease;
}

@keyframes modalIn {
    from { transform: scale(0.93) translateY(-20px); opacity: 0; }
    to   { transform: scale(1) translateY(0); opacity: 1; }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.modal-title {
    font-size: 17px;
    font-weight: 700;
}

.modal-close {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    font-size: 22px;
    line-height: 1;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover { color: var(--text); }

/* ========================================================
   TOAST NOTIFICATIONS
   ======================================================== */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 600;
}

.toast {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px 18px;
    font-size: 14px;
    max-width: 320px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 10px;
    animation: toastIn 0.3s ease;
    border-left: 4px solid var(--primary);
}

.toast.success { border-left-color: var(--success); }
.toast.error   { border-left-color: var(--danger); }
.toast.warning { border-left-color: var(--warning); }

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

@keyframes toastOut {
    from { transform: translateX(0); opacity: 1; }
    to   { transform: translateX(100%); opacity: 0; }
}

.toast.removing { animation: toastOut 0.3s ease forwards; }

/* ========================================================
   LOGIN / CADASTRO (páginas sem sidebar)
   ======================================================== */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: var(--bg);
}

.auth-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 40px;
    width: 100%;
    max-width: 440px;
    box-shadow: var(--shadow);
}

.auth-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 28px;
    flex-direction: column;
}

.auth-logo-icon {
    width: 56px;
    height: 56px;
    background: var(--primary);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
}

.auth-logo-name {
    font-size: 22px;
    font-weight: 800;
    color: var(--text);
}

.auth-logo-sub {
    font-size: 13px;
    color: var(--text-muted);
    text-align: center;
    margin-top: -18px;
    margin-bottom: 8px;
}

.auth-title {
    font-size: 19px;
    font-weight: 700;
    text-align: center;
    margin-bottom: 20px;
}

.auth-footer {
    text-align: center;
    margin-top: 18px;
    font-size: 14px;
    color: var(--text-muted);
}

.auth-theme-toggle {
    position: fixed;
    top: 16px;
    right: 16px;
}

/* ========================================================
   ALERT MESSAGES (static, not jammer)
   ======================================================== */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.alert-error   { background: rgba(255,59,59,0.12); border: 1px solid rgba(255,59,59,0.3); color: #ff7070; }
.alert-success { background: rgba(76,175,80,0.12); border: 1px solid rgba(76,175,80,0.3); color: #7dd980; }
.alert-warning { background: rgba(255,152,0,0.12); border: 1px solid rgba(255,152,0,0.3); color: #ffb347; }
.alert-info    { background: rgba(33,150,243,0.12); border: 1px solid rgba(33,150,243,0.3); color: #64b5f6; }

/* ========================================================
   SECTION CARD (surface container)
   ======================================================== */
.section-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 20px;
}

.section-card-title {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 18px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ========================================================
   SEPARATOR
   ======================================================== */
.sep {
    height: 1px;
    background: var(--border);
    margin: 20px 0;
}

/* ========================================================
   PWA INSTALL PROMPT (bottom sheet)
   ======================================================== */
.pwa-sheet {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--surface);
    border-top: 1px solid var(--border);
    padding: 20px;
    z-index: 400;
    transform: translateY(100%);
    transition: transform 0.3s ease;
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.pwa-sheet.visible { transform: translateY(0); }

.pwa-sheet-icon {
    width: 48px;
    height: 48px;
    background: transparent;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 22px;
    flex-shrink: 0;
}

.pwa-sheet-text { flex: 1; }
.pwa-sheet-title { font-weight: 700; font-size: 15px; }
.pwa-sheet-sub { font-size: 13px; color: var(--text-muted); }

.pwa-sheet-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

/* iOS instructions modal */
.ios-instructions {
    text-align: center;
    color: var(--text-muted);
    font-size: 14px;
    line-height: 1.8;
}

.ios-instructions strong { color: var(--text); }

/* ========================================================
   ALERT HISTORY TABLE
   ======================================================== */
.history-empty {
    text-align: center;
    color: var(--text-muted);
    padding: 32px 16px;
    font-size: 15px;
}

/* ========================================================
   DIVIDER TEXT
   ======================================================== */
.divider-text {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-muted);
    font-size: 12px;
    margin: 20px 0;
}

.divider-text::before,
.divider-text::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

/* ========================================================
   RESPONSIVE — Tablet / Mobile (≤ 768px)
   ======================================================== */
@media (max-width: 768px) {

    /* ── Sidebar ── */
    .sidebar {
        transform: translateX(-100%);
        width: var(--sidebar-w) !important;
        box-shadow: 4px 0 32px rgba(0,0,0,0.6);
    }
    .sidebar.open          { transform: translateX(0); }
    .sidebar-overlay.open  { display: block; }

    /* Oculta o hamburger do sidebar.php (evita coluna fantasma à esquerda) */
    .hamburger             { display: none !important; }
    /* Mostra apenas o hamburger que está dentro da topbar */
    .topbar-hamburger      { display: flex; }

    .main-content          { margin-left: 0 !important; }

    /* Esconde o título duplicado (topbar já mostra o nome da página) */
    .page-header           { display: none; }

    /* ── Topbar ── */
    .topbar        { padding: 0 10px; gap: 6px; }
    .topbar-user   { display: none; }
    .topbar-title  { font-size: 15px; }
    .theme-toggle  { width: 32px; height: 32px; font-size: 14px; }

    /* ── Page layout ── */
    .page-content  { padding: 10px; }
    .section-card  { padding: 14px; margin-bottom: 12px; }
    .page-header   { margin-bottom: 12px; }
    .page-header h1{ font-size: 17px; }

    /* ── Cards: sempre 2 colunas ── */
    .cards-grid {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
        margin-bottom: 12px;
    }
    .card          { padding: 14px 12px; }
    .card-icon     { width: 32px; height: 32px; margin-bottom: 8px; }
    .card-title    { font-size: 11px; }
    .card-value    { font-size: 20px; }
    .card-sub      { font-size: 11px; }

    /* ── Status bar: indicadores lado a lado, timestamp abaixo ── */
    .status-bar {
        flex-wrap: wrap;
        gap: 6px 12px;
        padding: 8px 12px;
    }
    .status-indicator  { font-size: 12px; }
    .status-dot        { width: 8px; height: 8px; }
    #deviceLabel       { margin-left: 0 !important; width: 100%; font-size: 11px; }
    .status-spacer     { display: none; }
    #lastUpdate        { width: 100%; font-size: 11px; color: var(--text-dim); }
    #btnAtivarPush     { width: 100%; margin-left: 0 !important; justify-content: center; }

    /* ── Jammer banner ── */
    .jammer-banner         { padding: 8px 12px; }
    .jammer-banner-title   { font-size: 14px; }
    .jammer-banner-info    { font-size: 12px; }
    .jammer-banner .btn-silence { padding: 4px 10px; font-size: 12px; }

    /* ── Tabela ── */
    table  { font-size: 12px; }
    th, td { padding: 8px 8px; }
    .table-wrapper { border-radius: var(--radius-sm); }

    /* ── Formulários ── */
    .form-row   { grid-template-columns: 1fr; }
    .form-group { margin-bottom: 12px; }

    /* ── Botões ── */
    .form-actions           { flex-direction: column; gap: 8px; }
    .form-actions .btn      { width: 100%; justify-content: center; }
    .section-card-title     { flex-wrap: wrap; gap: 8px; }

    /* ── Modal ── */
    .modal-backdrop { padding: 8px; align-items: flex-end; }
    .modal {
        padding: 20px 16px;
        border-radius: var(--radius) var(--radius) 0 0;
        max-height: 85vh;
    }

    /* ── Auth ── */
    .auth-card  { padding: 24px 16px; }

    /* ── Toasts ── */
    .toast-container { bottom: 0; right: 0; left: 0; padding: 0 8px 8px; }
    .toast           { max-width: 100%; font-size: 13px; padding: 10px 14px; }

    /* ── PWA sheet ── */
    .pwa-sheet          { flex-direction: column; align-items: flex-start; padding: 16px; gap: 10px; }
    .pwa-sheet-actions  { width: 100%; }
    .pwa-sheet-actions .btn { flex: 1; justify-content: center; }

    /* ── Histórico: header empilhado ── */
    .page-header[style] {
        flex-direction: column !important;
        align-items: flex-start !important;
    }
}

/* ========================================================
   RESPONSIVE — Mobile pequeno (≤ 480px)
   ======================================================== */
@media (max-width: 480px) {

    /* Cards: ainda 2 colunas, mas menores */
    .card-value { font-size: 18px; }

    /* Tabela do dashboard: oculta colunas menos críticas */
    #alertTable th:nth-child(3),
    #alertTable td:nth-child(3),
    #alertTable th:nth-child(4),
    #alertTable td:nth-child(4) { display: none; }

    /* Auth sem card */
    .auth-card {
        border: none;
        box-shadow: none;
        background: transparent;
        padding: 12px 4px;
    }
}

/* ========================================================
   UTILITY
   ======================================================== */
.text-muted  { color: var(--text-muted); }
.text-danger { color: var(--danger); }
.text-success{ color: var(--success); }
.text-center { text-align: center; }
.mt-8  { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mb-8  { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.flex  { display: flex; }
.flex-gap { gap: 8px; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.w-full { width: 100%; }
.hidden { display: none !important; }

/* Loading spinner */
.spinner {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    display: inline-block;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}
