:root {
    --bg-main: #0d0f18;
    --bg-sidebar: #131722;
    --bg-card: #1c2132;
    --bg-input: #10131d;
    --border-color: #272d42;
    --text-main: #f1f5f9;
    --text-muted: #8b95a8;
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --success: #10b981;
    --danger: #ef4444;
    --danger-dark: #b91c1c;
    --warning: #f59e0b;
    --protected: #8b5cf6;
    --system-tag: #dc2626;
    --user-tag: #059669;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, Roboto, sans-serif;
}

body {
    background-color: var(--bg-main);
    color: var(--text-main);
    height: 100vh;
    overflow: hidden;
}

/* ── Scrollbars Modernos e Discretos ── */
::-webkit-scrollbar {
    width: 5px;
    height: 5px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: #272d42;
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: #3b82f6;
}

.app-layout {
    display: grid;
    grid-template-columns: 290px 1fr;
    height: 100vh;
}

/* ── Elementos Mobile/Drawer (Ocultos no Desktop) ── */
.sidebar-backdrop {
    display: none;
}

.sidebar-mobile-close-bar {
    display: none;
}

.mobile-topbar {
    display: none;
}

/* ── Sidebar ── */
.sidebar {
    background-color: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    padding: 20px 16px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    overflow-y: auto;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}

.brand-icon {
    font-size: 26px;
    color: var(--primary);
}

.sidebar-brand h2 {
    font-size: 16px;
    font-weight: 700;
}

.badge-web {
    background: #1e3a8a;
    color: #93c5fd;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 600;
}

.card-section {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px;
}

.section-title {
    display: block;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-bottom: 10px;
}

.input-group {
    margin-bottom: 8px;
}

.input-group label {
    display: block;
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 4px;
}

input[type="text"], .custom-select {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 8px 10px;
    color: var(--text-main);
    font-size: 13px;
    outline: none;
    transition: border 0.2s;
}

input[type="text"]:focus, .custom-select:focus {
    border-color: var(--primary);
}

.btn-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    margin-top: 4px;
}

.btn {
    border: none;
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.2s;
}

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

.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); }

.btn-danger { background: var(--danger); color: white; }
.btn-danger-dark { background: var(--danger-dark); color: white; }
.btn-warning { background: var(--warning); color: #1e1e2e; font-weight: 700; }
.btn-info { background: #0284c7; color: white; }

.btn-outline {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-main);
}
.btn-outline:hover:not(:disabled) { background: #272d42; }

.btn-sm { padding: 4px 8px; font-size: 11px; }
.btn-block { width: 100%; padding: 12px; font-size: 14px; }
.btn-text { background: transparent; border: none; color: var(--text-muted); cursor: pointer; font-size: 11px; }
.btn-text:hover { color: var(--text-main); }

.status-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    margin-top: 10px;
}

.status-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
}

.dot-online { background-color: var(--success); box-shadow: 0 0 8px var(--success); }
.dot-offline { background-color: var(--danger); }

.root-badge {
    margin-top: 6px;
    font-size: 11px;
    font-weight: 600;
    color: var(--success);
}

.agent-card p {
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.download-link-box {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 6px;
    margin-bottom: 8px;
    word-break: break-all;
}

.download-link-box code {
    font-size: 11px;
    color: #38bdf8;
    font-family: monospace;
}

.sidebar-footer {
    margin-top: auto;
    border-top: 1px solid var(--border-color);
    padding-top: 12px;
}

.badge-legend {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 10px;
    color: var(--text-muted);
}

.badge {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 3px;
    font-weight: 700;
    font-size: 9px;
    text-align: center;
}
.b-prot { background: var(--protected); color: white; }
.b-susp { background: var(--warning); color: #000; }
.b-sys { background: var(--system-tag); color: white; }
.b-user { background: var(--user-tag); color: white; }

/* ── Main Area ── */
.main-content {
    display: flex;
    flex-direction: column;
    height: 100vh;
    background: var(--bg-main);
    overflow: hidden;
}

.nav-tabs {
    display: flex;
    background: var(--bg-sidebar);
    border-bottom: 1px solid var(--border-color);
    padding: 0 16px;
}

.tab-btn {
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-muted);
    padding: 14px 18px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
}

.tab-btn:hover { color: var(--text-main); }
.tab-btn.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    background: rgba(59, 130, 246, 0.05);
}

.tab-content-container {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.tab-pane {
    display: none;
}
.tab-pane.active {
    display: block;
}

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

.pane-header h3 { font-size: 18px; font-weight: 700; }

/* ── Grid Cards (Diagnóstico) ── */
.grid-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 12px;
}

.info-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.info-label {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 600;
}

.info-val {
    font-size: 15px;
    font-weight: 700;
    word-break: break-all;
}

.highlight-card {
    border-color: #3b82f6;
    background: rgba(59, 130, 246, 0.08);
}
.highlight-val {
    color: #60a5fa;
    font-size: 18px;
}

/* ── Aba Apps Toolbar ── */
.apps-toolbar {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 10px 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 12px;
}

.toolbar-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.search-box {
    margin-left: auto;
    position: relative;
}

.search-box i {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 12px;
}

.search-box input {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 7px 10px 7px 30px;
    color: var(--text-main);
    font-size: 12px;
    width: 220px;
}

.filter-segmented {
    display: flex;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 2px;
    gap: 2px;
}

.filter-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 5px 12px;
    font-size: 11px;
    font-weight: 600;
    border-radius: 4px;
    cursor: pointer;
}
.filter-btn.active {
    background: #272d42;
    color: var(--text-main);
}

.second-row {
    justify-content: space-between;
}

.apps-summary-bar {
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 8px;
    padding-left: 2px;
}

/* ── Lista de Apps ── */
.apps-list-container {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    height: 380px;
    overflow-y: auto;
    padding: 8px;
}

.app-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: 4px;
    transition: background 0.15s;
}

.app-row:hover {
    background: rgba(255, 255, 255, 0.02);
}

.app-info-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}

.app-name {
    font-size: 14px;
    font-weight: 600;
    color: #f8fafc;
    line-height: 1.25;
    word-break: break-word;
}

.app-pkg {
    font-family: var(--font-mono, monospace);
    font-size: 11.5px;
    color: #94a3b8;
    word-break: break-all;
}

.app-pkg-single {
    font-family: var(--font-mono, monospace);
    font-size: 12.5px;
    color: #cbd5e1;
    word-break: break-all;
}

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

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-muted);
    gap: 8px;
}

/* ── Rede / DNS ── */
.network-box {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 16px;
    max-width: 650px;
}

.network-current {
    display: flex;
    gap: 20px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 14px;
    font-size: 13px;
}

.grid-2col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 12px;
}

.presets-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
    font-size: 12px;
    color: var(--text-muted);
}

.dns-hint {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 10px;
    line-height: 1.4;
}

/* ── Instalar APK ── */
.install-dropzone {
    border: 2px dashed var(--border-color);
    border-radius: 12px;
    padding: 40px 20px;
    text-align: center;
    background: rgba(28, 33, 50, 0.4);
    cursor: pointer;
    transition: border 0.2s;
    margin-bottom: 16px;
}

.install-dropzone:hover {
    border-color: var(--primary);
}

.drop-icon {
    font-size: 48px;
    color: var(--primary);
    margin-bottom: 12px;
}

.selected-file-label {
    display: block;
    margin-top: 10px;
    font-weight: 600;
    color: #38bdf8;
    font-size: 13px;
}

.install-progress {
    margin-top: 10px;
    font-size: 13px;
}

/* ── Ajuda ── */
.help-scrollable {
    display: flex;
    flex-direction: column;
    gap: 16px;
    max-width: 800px;
}

.help-section {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 16px;
}

.help-section h4 {
    font-size: 14px;
    margin-bottom: 10px;
    color: #60a5fa;
    display: flex;
    align-items: center;
    gap: 8px;
}

.help-section ol, .help-section p {
    padding-left: 20px;
    font-size: 12px;
    color: #cbd5e1;
    line-height: 1.7;
}

/* ── Console de Log ── */
.console-section {
    background: #090a10;
    border-top: 1px solid var(--border-color);
    height: 140px;
    display: flex;
    flex-direction: column;
}

.console-header {
    background: #0f111a;
    padding: 6px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 11px;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-color);
}

.console-header-title {
    display: flex;
    align-items: center;
    gap: 8px;
}

.console-toggle-pill {
    display: none;
}

.console-body {
    flex: 1;
    overflow-y: auto;
    padding: 8px 16px;
    font-family: 'Consolas', monospace;
    font-size: 11px;
    line-height: 1.5;
}

.log-line { margin-bottom: 2px; }
.log-info { color: #94a3b8; }
.log-error { color: #f87171; }
.log-system { color: #38bdf8; }
.log-success { color: #4ade80; font-weight: 600; }

/* ── Modal de Confirmação em 2 Etapas ── */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.modal-content {
    background: #181c2b;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    width: 90%;
    max-width: 650px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
}

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

.modal-title-box {
    display: flex;
    align-items: center;
    gap: 12px;
}

.modal-warn-icon {
    font-size: 26px;
    color: var(--warning);
}

.modal-title-box h3 { font-size: 16px; font-weight: 700; color: #f8fafc; }
.modal-subtitle { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

.btn-close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 24px;
    cursor: pointer;
    line-height: 1;
}
.btn-close:hover { color: white; }

.modal-body {
    padding: 16px 20px;
    overflow-y: auto;
    flex: 1;
}

.modal-summary-box {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 12px;
}

.summary-item {
    background: #111422;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.sum-count { font-size: 22px; font-weight: 800; }
.sum-label { font-size: 11px; color: var(--text-muted); font-weight: 600; }
.text-danger { color: #f87171; }
.text-success { color: #4ade80; }

.modal-warning-box {
    background: rgba(59, 130, 246, 0.08);
    border: 1px solid #2563eb;
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 12px;
    color: #93c5fd;
    display: flex;
    align-items: center;
    gap: 10px;
    line-height: 1.4;
}

.modal-packages-scroll {
    background: #0f111d;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    max-height: 240px;
    overflow-y: auto;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.modal-pkg-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 4px;
    font-size: 12px;
    font-family: monospace;
    color: #e2e8f0;
}

.modal-pkg-item i { color: #f87171; font-size: 11px; }

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

/* ══════════════════════════════════════════════════════════════════════════════
   📱 RESPONSIVIDADE COMPLETA PARA CELULAR & TABLET
   ══════════════════════════════════════════════════════════════════════════════ */

@media (max-width: 900px) {
    body {
        height: 100vh;
        height: 100dvh;
        overflow: hidden;
        -webkit-tap-highlight-color: transparent;
    }

    .app-layout {
        display: flex;
        flex-direction: column;
        height: 100vh;
        height: 100dvh;
        width: 100%;
        max-width: 100%;
        overflow: hidden;
    }

    /* ── Backdrop do Drawer da Sidebar ── */
    .sidebar-backdrop {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.75);
        backdrop-filter: blur(4px);
        -webkit-backdrop-filter: blur(4px);
        z-index: 1999;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.25s ease;
    }

    .sidebar-backdrop.active {
        display: block;
        opacity: 1;
        pointer-events: auto;
    }

    /* ── Sidebar transformada em Drawer Deslizante (Off-Canvas) ── */
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        width: 300px;
        max-width: 85vw;
        height: 100vh;
        height: 100dvh;
        z-index: 2100;
        background: #111420;
        transform: translateX(-100%);
        visibility: hidden;
        pointer-events: none;
        transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.28s ease;
        padding: 16px 14px;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        gap: 14px;
        border-right: 1px solid var(--border-color);
        box-sizing: border-box;
    }

    .sidebar.open {
        transform: translateX(0);
        visibility: visible;
        pointer-events: auto;
        box-shadow: 15px 0 45px rgba(0, 0, 0, 0.95);
    }

    .sidebar-mobile-close-bar {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding-bottom: 10px;
        border-bottom: 1px solid var(--border-color);
        margin-bottom: 4px;
    }

    .sidebar-mobile-title {
        font-size: 14px;
        font-weight: 700;
        color: #93c5fd;
        display: flex;
        align-items: center;
        gap: 8px;
    }

    .btn-sidebar-close {
        background: #1c2132;
        border: 1px solid var(--border-color);
        border-radius: 8px;
        color: #f1f5f9;
        font-size: 24px;
        width: 40px;
        height: 40px;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        line-height: 1;
        transition: background 0.15s, color 0.15s;
    }

    .btn-sidebar-close:active {
        background: var(--danger);
        color: white;
    }

    /* ── Barra Superior Mobile (Header Fixo) ── */
    .mobile-topbar {
        display: flex;
        align-items: center;
        justify-content: space-between;
        height: 52px;
        min-height: 52px;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
        background: var(--bg-sidebar);
        border-bottom: 1px solid var(--border-color);
        padding: 0 10px;
        flex-shrink: 0;
        z-index: 100;
        gap: 6px;
    }

    .mobile-topbar-left {
        display: flex;
        align-items: center;
        gap: 8px;
        flex-shrink: 0;
    }

    .mobile-menu-btn {
        width: 36px;
        height: 36px;
        border-radius: 8px;
        background: #1c2132;
        border: 1px solid var(--border-color);
        color: var(--text-main);
        font-size: 15px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        transition: background 0.15s, transform 0.1s;
        flex-shrink: 0;
    }

    .mobile-menu-btn:active {
        background: #272d42;
        transform: scale(0.95);
    }

    .mobile-brand {
        display: flex;
        align-items: center;
        gap: 6px;
        white-space: nowrap;
    }

    .brand-icon-sm {
        font-size: 17px;
        color: var(--primary);
    }

    .mobile-brand-title {
        font-size: 13px;
        font-weight: 700;
        color: var(--text-main);
        letter-spacing: -0.2px;
    }

    /* Chip de status do dispositivo no topo */
    .mobile-device-chip {
        display: flex;
        align-items: center;
        gap: 5px;
        background: #10131d;
        border: 1px solid var(--border-color);
        border-radius: 20px;
        padding: 4px 8px;
        cursor: pointer;
        max-width: 140px;
        flex-shrink: 0;
        transition: background 0.15s, border-color 0.15s;
    }

    .mobile-device-chip:active {
        background: #1c2132;
        border-color: var(--primary);
    }

    .mobile-device-name {
        font-size: 11px;
        font-weight: 600;
        color: #e2e8f0;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .mobile-chip-arrow {
        font-size: 9px;
        color: var(--text-muted);
    }

    /* ── Conteúdo Principal ── */
    .main-content {
        flex: 1;
        display: flex;
        flex-direction: column;
        height: 100vh;
        height: 100dvh;
        width: 100%;
        max-width: 100%;
        min-width: 0;
        overflow-x: hidden;
        overflow-y: hidden;
    }

    /* ── Abas de Navegação com Swipe Horizontal ── */
    .nav-tabs {
        width: 100%;
        max-width: 100%;
        min-width: 0;
        box-sizing: border-box;
        overflow-x: auto;
        white-space: nowrap;
        flex-wrap: nowrap;
        padding: 0 6px;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        flex-shrink: 0;
        background: #0f121d;
        border-bottom: 1px solid var(--border-color);
    }

    .nav-tabs::-webkit-scrollbar {
        display: none;
    }

    .tab-btn {
        flex-shrink: 0;
        padding: 11px 13px;
        font-size: 12px;
        gap: 6px;
    }

    .tab-content-container {
        width: 100%;
        max-width: 100%;
        min-width: 0;
        box-sizing: border-box;
        flex: 1;
        padding: 12px 10px;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .pane-header {
        margin-bottom: 12px;
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }

    .pane-header h3 {
        font-size: 16px;
    }

    .pane-header .btn {
        width: 100%;
        min-height: 42px;
    }

    /* ── Diagnóstico: Grid Cards ── */
    .grid-cards {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .highlight-card {
        grid-column: 1 / -1;
        border-left: 4px solid var(--primary);
    }

    .info-card {
        padding: 10px 12px;
        border-radius: 8px;
    }

    .info-label {
        font-size: 10px;
    }

    .info-val {
        font-size: 13px;
    }

    .highlight-val {
        font-size: 16px;
    }

    /* ── Apps Toolbar & Filtros ── */
    .apps-toolbar {
        padding: 10px;
        gap: 8px;
    }

    .apps-toolbar .toolbar-row:first-child {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 6px;
        width: 100%;
    }

    .apps-toolbar .toolbar-row:first-child .btn {
        width: 100%;
        min-height: 40px;
        font-size: 11px;
        padding: 6px 8px;
    }

    .search-box {
        width: 100%;
        margin-left: 0;
    }

    .search-box input {
        width: 100%;
        min-height: 40px;
        font-size: 14px;
        padding-left: 32px;
    }

    .second-row {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }

    .filter-segmented {
        overflow-x: auto;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        width: 100%;
        padding: 3px;
    }

    .filter-segmented::-webkit-scrollbar {
        display: none;
    }

    .filter-btn {
        flex-shrink: 0;
        padding: 6px 12px;
        font-size: 12px;
    }

    #btnBulkRemove {
        width: 100%;
        min-height: 42px;
        margin-top: 2px;
    }

    /* Lista de Apps */
    .apps-list-container {
        height: auto;
        max-height: calc(100dvh - 390px);
        min-height: 240px;
        padding: 6px;
    }

    .app-row {
        flex-wrap: wrap;
        gap: 6px;
        padding: 8px 10px;
    }

    .app-pkg {
        width: 100%;
        font-size: 11px;
        line-height: 1.4;
    }

    .app-actions {
        margin-left: auto;
        display: flex;
        gap: 6px;
    }

    .app-actions .btn {
        min-height: 32px;
        padding: 4px 8px;
        font-size: 11px;
    }

    /* ── Rede / DNS ── */
    .network-box {
        padding: 12px;
    }

    .network-current {
        flex-direction: column;
        gap: 6px;
        font-size: 12px;
    }

    .grid-2col {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .presets-row {
        flex-wrap: wrap;
        gap: 6px;
    }

    .presets-row .preset-btn {
        min-height: 34px;
        padding: 4px 10px;
    }

    #btnApplyDns {
        min-height: 44px;
    }

    /* ── Instalar APK ── */
    .install-dropzone {
        padding: 24px 12px;
    }

    #btnSelectApk {
        min-height: 42px;
        margin-top: 8px;
    }

    #btnUploadInstall {
        min-height: 44px;
    }

    /* ── Console de Logs (Colapsável no Celular) ── */
    .console-section {
        width: 100%;
        max-width: 100%;
        min-width: 0;
        box-sizing: border-box;
        height: 38px;
        min-height: 38px;
        flex-shrink: 0;
        transition: height 0.25s cubic-bezier(0.16, 1, 0.3, 1);
        border-top: 1px solid var(--border-color);
        background: #090a10;
        position: relative;
    }

    .console-header {
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
        height: 38px;
        padding: 0 12px;
        cursor: pointer;
        user-select: none;
    }

    .console-header-title {
        display: flex;
        align-items: center;
        gap: 6px;
    }

    .console-title-text {
        font-size: 11px;
        font-weight: 600;
    }

    .console-toggle-pill {
        display: inline-flex;
        align-items: center;
        gap: 4px;
        background: rgba(59, 130, 246, 0.15);
        color: #93c5fd;
        padding: 2px 8px;
        border-radius: 12px;
        font-size: 10px;
        font-weight: 600;
        margin-left: 6px;
        transition: background 0.15s, color 0.15s;
    }

    .console-body {
        display: none;
    }

    /* Quando o console estiver expandido no celular */
    .console-section.expanded {
        height: 180px;
        min-height: 180px;
    }

    .console-section.expanded .console-body {
        display: block;
        height: calc(180px - 38px);
    }

    .console-section.expanded .console-toggle-pill {
        background: rgba(239, 68, 68, 0.18);
        color: #fca5a5;
    }

    /* ── Modais no Celular ── */
    .modal-content {
        width: 95%;
        max-height: 88vh;
        max-height: 88dvh;
    }

    .modal-header {
        padding: 12px 14px;
    }

    .modal-title-box h3 {
        font-size: 15px;
    }

    .modal-body {
        padding: 12px 14px;
    }

    .modal-packages-scroll {
        max-height: 180px;
    }

    .modal-footer {
        padding: 12px 14px;
        flex-direction: column-reverse;
        gap: 8px;
    }

    .modal-footer .btn {
        width: 100%;
        min-height: 44px;
    }
}

@media (max-width: 480px) {
    /* ── Otimizações Adicionais para Celulares Compactos (iPhone SE, etc.) ── */
    input[type="text"], .custom-select {
        font-size: 16px !important; /* Previne auto-zoom no Safari iOS */
    }

    .grid-cards {
        grid-template-columns: 1fr;
    }

    .highlight-card {
        grid-column: 1;
    }
}

