/* =====================================================
   WiFi Live - Painel MikroTik + Ads
   Mesmo layout do admin principal (RX PRULE)
   ===================================================== */

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

:root {
    --primary: #7c3aed;
    --primary-dark: #6d28d9;
    --primary-light: #a78bfa;
    --bg: #f5f3ff;
    --sidebar-bg: #ffffff;
    --card-bg: #ffffff;
    --text: #1a1a2e;
    --text-secondary: #4a4565;
    --text-muted: #8b83a8;
    --border: #e5e0f0;
    --danger: #dc2626;
    --success: #10b981;
    --warning: #f59e0b;
    --radius: 8px;
    --transition: all 0.2s ease;
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    font-size: 15px;
    background: var(--bg);
    color: var(--text);
}

/* =====================================================
   LOGIN
   ===================================================== */
.login-view {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1e1b4b 0%, #312e81 50%, #4c1d95 100%);
    padding: 1rem;
}

.login-box {
    background: #fff;
    border-radius: 16px;
    padding: 2.5rem;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.login-logo {
    text-align: center;
    margin-bottom: 2rem;
}

.login-logo h1 {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--primary);
    letter-spacing: 0.05em;
    margin-top: 0.5rem;
}

.login-logo p {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.login-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: var(--danger);
    padding: 0.65rem 1rem;
    border-radius: var(--radius);
    font-size: 0.82rem;
    margin-bottom: 1.25rem;
    text-align: center;
}

.login-field {
    position: relative;
    margin-bottom: 1.25rem;
}

.login-field > i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 16px;
}

.login-field input {
    width: 100%;
    padding: 0.8rem 0.8rem 0.8rem 2.5rem;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.9rem;
    color: var(--text);
    outline: none;
    transition: var(--transition);
    font-family: inherit;
}

.login-field input:focus { border-color: var(--primary); }

.login-eye {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 16px;
}

.login-submit {
    width: 100%;
    padding: 0.85rem;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
    margin-top: 0.5rem;
}

.login-submit:hover { background: var(--primary-dark); }
.login-submit:disabled { opacity: 0.6; cursor: not-allowed; }

.login-hint {
    text-align: center;
    margin-top: 1.5rem;
    color: var(--text-muted);
    font-size: 0.75rem;
}
.login-hint code {
    background: rgba(124,58,237,0.08);
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    font-size: 0.72rem;
}

/* =====================================================
   PANEL LAYOUT
   ===================================================== */
.panel-view { min-height: 100vh; }

.app-wrapper {
    display: flex;
    min-height: 100vh;
}

/* =====================================================
   SIDEBAR
   ===================================================== */
.sidebar {
    width: 250px;
    min-width: 250px;
    background: var(--sidebar-bg);
    height: 100vh;
    position: sticky;
    top: 0;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border);
    overflow-y: auto;
    z-index: 100;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 1.25rem 1.25rem 0.75rem;
}

.sidebar-logo span {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--primary);
    letter-spacing: 0.04em;
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.75rem 1.25rem;
    margin: 0 0.75rem 0.5rem;
    background: var(--bg);
    border-radius: var(--radius);
}

.sidebar-user > i {
    font-size: 24px;
    color: var(--primary);
}

.sidebar-user div {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.sidebar-user span {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user small {
    font-size: 0.7rem;
    color: var(--primary-light);
    font-weight: 600;
}

.sidebar-menu {
    flex: 1;
    padding: 0.25rem 0;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.55rem 1.25rem;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.85rem;
    transition: var(--transition);
}

.sidebar-link:hover {
    background: rgba(124, 58, 237, 0.06);
    color: var(--primary);
}

.sidebar-link.active {
    background: rgba(124, 58, 237, 0.1);
    color: var(--primary);
    font-weight: 600;
}

.sidebar-link i { font-size: 16px; width: 18px; text-align: center; }

.sidebar-sep {
    height: 1px;
    background: var(--border);
    margin: 0.4rem 1rem;
}

.sidebar-group-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.55rem 1.25rem;
    color: var(--text-secondary);
    font-size: 0.85rem;
    cursor: pointer;
    transition: var(--transition);
}

.sidebar-group-title:hover { background: rgba(124,58,237,0.06); color: var(--primary); }
.sidebar-group-title span { display: flex; align-items: center; gap: 0.6rem; }
.sidebar-group-title i.arrow { font-size: 12px; transition: transform 0.2s; }
.sidebar-group.open .sidebar-group-title i.arrow { transform: rotate(180deg); }
.sidebar-group-items { display: none; padding-left: 1rem; }
.sidebar-group.open .sidebar-group-items { display: block; }

.sidebar-bottom {
    padding: 0.5rem 0;
    border-top: 1px solid var(--border);
    margin-top: auto;
}

.sidebar-logout { color: var(--danger) !important; }
.sidebar-logout:hover { background: rgba(220,38,38,0.06) !important; }

/* =====================================================
   CONTENT
   ===================================================== */
.content-wrapper {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow-y: auto;
}

.topbar {
    background: var(--card-bg);
    height: 56px;
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0 1.5rem;
    margin: 0.75rem;
    border-radius: var(--radius);
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.topbar-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 22px;
    color: var(--text);
    cursor: pointer;
}

.topbar-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary);
    flex: 1;
}

.topbar-info {
    font-size: 0.82rem;
    color: var(--primary);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.35rem;
    background: rgba(124,58,237,0.08);
    padding: 0.35rem 0.85rem;
    border-radius: 20px;
}

.content {
    padding: 0 0.75rem 1.5rem;
    flex: 1;
}

/* =====================================================
   DASHBOARD CARDS
   ===================================================== */
.dash-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.stat-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
    transition: var(--transition);
}

.stat-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.08); transform: translateY(-1px); }

.stat-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

.stat-icon.purple { background: rgba(124,58,237,0.1); color: var(--primary); }
.stat-icon.green  { background: rgba(16,185,129,0.1); color: var(--success); }
.stat-icon.yellow { background: rgba(245,158,11,0.1); color: var(--warning); }
.stat-icon.red    { background: rgba(220,38,38,0.1);  color: var(--danger); }
.stat-icon.blue   { background: rgba(59,130,246,0.1); color: #3b82f6; }

.stat-info { min-width: 0; }
.stat-value { font-size: 1.5rem; font-weight: 800; color: var(--text); line-height: 1; }
.stat-label { font-size: 0.78rem; color: var(--text-muted); margin-top: 0.2rem; }

/* =====================================================
   DATA TABLES
   ===================================================== */
.table-toolbar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}
.table-search {
    flex: 1;
    min-width: 180px;
    padding: 0.55rem 0.85rem;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.85rem;
    color: var(--text);
    outline: none;
    transition: var(--transition);
    font-family: inherit;
}
.table-search:focus { border-color: var(--primary); }
.table-search::placeholder { color: var(--text-muted); }

.btn { padding: 0.55rem 1.1rem; border: none; border-radius: var(--radius); font-size: 0.82rem; font-weight: 600; cursor: pointer; transition: var(--transition); font-family: inherit; display: inline-flex; align-items: center; gap: 0.4rem; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-sm { padding: 0.35rem 0.7rem; font-size: 0.75rem; }
.btn-success { background: var(--success); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-warning { background: var(--warning); color: #fff; }
.btn-outline { background: transparent; border: 1.5px solid var(--border); color: var(--text-secondary); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.data-table-wrap {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
    overflow: hidden;
}
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.84rem;
}
.data-table th {
    background: var(--primary);
    color: #fff;
    padding: 0.7rem 0.85rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    white-space: nowrap;
}
.data-table td {
    padding: 0.65rem 0.85rem;
    border-bottom: 1px solid var(--border);
    color: var(--text);
    vertical-align: middle;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: rgba(124,58,237,0.03); }
.data-table .actions { display: flex; gap: 0.35rem; }
.data-table .no-data { text-align: center; color: var(--text-muted); padding: 2rem !important; }

/* =====================================================
   FORM CARDS
   ===================================================== */
.form-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
    max-width: 560px;
}
.form-card h3 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 1.25rem;
    padding-bottom: 0.65rem;
    border-bottom: 2px solid var(--border);
}
.form-row {
    margin-bottom: 1.1rem;
}
.form-row label {
    display: block;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.3rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.form-row input, .form-row select, .form-row textarea {
    width: 100%;
    padding: 0.6rem 0.85rem;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.88rem;
    color: var(--text);
    outline: none;
    transition: var(--transition);
    font-family: inherit;
    background: #fff;
}
.form-row input:focus, .form-row select:focus, .form-row textarea:focus { border-color: var(--primary); }
.form-row select { cursor: pointer; }
.form-row textarea { resize: vertical; min-height: 80px; }
.form-row .hint { font-size: 0.72rem; color: var(--text-muted); margin-top: 0.25rem; }
.form-actions { margin-top: 1.25rem; display: flex; gap: 0.5rem; }

/* =====================================================
   ALERTS & BADGES
   ===================================================== */
.alert {
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    font-size: 0.84rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.alert-success { background: #ecfdf5; border: 1px solid #a7f3d0; color: #065f46; }
.alert-error { background: #fef2f2; border: 1px solid #fecaca; color: #991b1b; }
.alert-warning { background: #fffbeb; border: 1px solid #fde68a; color: #92400e; }
.alert-info { background: #eff6ff; border: 1px solid #bfdbfe; color: #1e40af; }

.badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}
.badge-ativo { background: #d1fae5; color: #065f46; }
.badge-inativo { background: #fee2e2; color: #991b1b; }
.badge-suspenso { background: #fef3c7; color: #92400e; }
.badge-admin { background: #fef3c7; color: #92400e; }
.badge-cliente { background: #ede9fe; color: #6d28d9; }
.badge-video { background: #dbeafe; color: #1e40af; }
.badge-imagem { background: #d1fae5; color: #065f46; }
.badge-link { background: #fef3c7; color: #92400e; }

/* =====================================================
   LOADING & EMPTY
   ===================================================== */
.loading { display: flex; align-items: center; justify-content: center; padding: 3rem; color: var(--text-muted); font-size: 0.88rem; gap: 0.5rem; }
.loading::before { content: ''; width: 20px; height: 20px; border: 2px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin 0.6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.empty-state { text-align: center; padding: 2.5rem 1rem; color: var(--text-muted); }
.empty-state i { font-size: 40px; display: block; margin-bottom: 0.75rem; color: var(--border); }
.empty-state p { font-size: 0.88rem; }

/* Result card */
.result-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 1.25rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
    margin-top: 1rem;
}
.result-card .result-row { display: flex; justify-content: space-between; padding: 0.4rem 0; border-bottom: 1px solid var(--border); font-size: 0.84rem; }
.result-card .result-row:last-child { border-bottom: none; }
.result-card .result-key { color: var(--text-muted); }
.result-card .result-val { font-weight: 600; color: var(--text); word-break: break-all; }

/* Token display */
.token-display {
    background: var(--bg);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    padding: 0.75rem 1rem;
    font-family: monospace;
    font-size: 0.82rem;
    word-break: break-all;
    color: var(--primary);
    position: relative;
    cursor: pointer;
}
.token-display:hover { border-color: var(--primary); }
.token-display::after {
    content: 'Clique para copiar';
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.68rem;
    color: var(--text-muted);
    font-family: 'Segoe UI', sans-serif;
}

/* =====================================================
   RESPONSIVE
   ===================================================== */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: -260px;
        top: 0;
        transition: left 0.3s ease;
        box-shadow: none;
        z-index: 200;
    }
    .sidebar.open { left: 0; box-shadow: 4px 0 20px rgba(0,0,0,0.15); }
    .topbar-toggle { display: block; }
    .sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.3);
        z-index: 150;
    }
    .sidebar-overlay.open { display: block; }
    .dash-stats { grid-template-columns: 1fr 1fr; }
    .form-card { max-width: 100%; }
}

@media (max-width: 480px) {
    .dash-stats { grid-template-columns: 1fr; }
}

/* =====================================================
   MODAL OVERLAY
   ===================================================== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999;
    padding: 1rem;
    animation: fadeIn 0.2s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal-box {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 1.5rem;
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    animation: slideUp 0.2s ease;
}
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

.modal-box h3 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 1rem;
    padding-bottom: 0.65rem;
    border-bottom: 2px solid var(--border);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* =====================================================
   TABS ACTIVE STATE
   ===================================================== */
.tab-active {
    background: var(--primary) !important;
    color: #fff !important;
    border-color: var(--primary) !important;
}

/* =====================================================
   ADMIN SENSITIVE DATA CARDS
   ===================================================== */
.sensitive-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-left: 4px solid var(--primary);
    border-radius: var(--radius);
    padding: 1.25rem;
    color: var(--text);
    margin-bottom: 0.75rem;
    box-shadow: var(--shadow);
}
.sensitive-card h4 {
    color: var(--primary);
    font-size: 0.85rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}
.sensitive-card .s-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.45rem 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.82rem;
}
.sensitive-card .s-row:last-child { border-bottom: none; }
.sensitive-card .s-key { color: var(--text-muted); }
.sensitive-card .s-val { font-weight: 600; color: var(--text); font-family: monospace; word-break: break-all; }
.sensitive-card .s-val code { background: #ede9fe; color: #6d28d9; padding: 0.15rem 0.5rem; border-radius: 4px; }
.sensitive-card .btn-outline { background: transparent; border-color: var(--border); color: var(--text); }
.sensitive-card .btn-outline:hover { background: var(--bg); border-color: var(--primary); color: var(--primary); }

/* =====================================================
   MIKROTIK STATUS INDICATORS
   ===================================================== */
.mk-status {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
    white-space: nowrap;
}
.mk-online { background: #d1fae5; color: #065f46; }
.mk-offline { background: #fef3c7; color: #92400e; }
.mk-not-installed { background: #fee2e2; color: #991b1b; }

.mk-row-disabled { opacity: 0.6; }
.mk-row-disabled td { color: var(--text-muted) !important; }

/* INSTALL BANNER */
.mk-install-banner {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-left: 4px solid #f59e0b;
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    margin-bottom: 1rem;
    color: #92400e;
}
.mk-install-banner > i {
    font-size: 1.5rem;
    color: #f59e0b;
    flex-shrink: 0;
}
.mk-install-banner div { flex: 1; }
.mk-install-banner strong { display: block; font-size: 0.9rem; margin-bottom: 0.15rem; }
.mk-install-banner p { font-size: 0.78rem; margin: 0; color: #a16207; }
.mk-install-banner .btn { flex-shrink: 0; }

/* =====================================================
   MIKROTIK CONTEXT SIDEBAR
   ===================================================== */
.mk-context-header {
    padding: 1rem;
    margin: 0 0.75rem 0.75rem;
    background: var(--card);
    border-radius: var(--radius);
    border: 2px solid var(--border);
}
.mk-context-info {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    margin-top: 0.6rem;
}
.mk-context-name {
    font-weight: 800;
    font-size: 1rem;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.mk-back-btn {
    color: var(--text-muted) !important;
    border-color: var(--border) !important;
    font-size: 0.78rem;
    padding: 0.3rem 0.8rem;
    background: var(--bg) !important;
}
.mk-back-btn:hover {
    background: var(--border) !important;
    color: var(--text) !important;
}
.sidebar-link.disabled {
    opacity: 0.35;
    cursor: not-allowed;
    pointer-events: none;
}

/* =====================================================
   MIKROTIK CARD GRID
   ===================================================== */
.mk-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}
.mk-card {
    background: var(--card-bg);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    padding: 1.15rem;
    cursor: pointer;
    transition: var(--transition);
}
.mk-card:hover {
    border-color: var(--primary-light);
    box-shadow: 0 4px 16px rgba(124,58,237,0.12);
    transform: translateY(-2px);
}
.mk-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.85rem;
}
.mk-card-header strong {
    font-size: 0.92rem;
    color: var(--text);
}
.mk-card-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.4rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
}
.mk-card-stats div {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}
.mk-card-stats i {
    width: 16px;
    color: var(--primary-light);
    font-size: 14px;
}
.mk-card-footer {
    margin-top: 0.75rem;
    padding-top: 0.6rem;
    border-top: 1px solid var(--border);
    font-size: 0.75rem;
    color: var(--text-muted);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* =====================================================
   QUICK INFO MODAL
   ===================================================== */
.mk-quick-row {
    padding: 0.55rem 0;
    font-size: 0.85rem;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.mk-quick-row:last-child { border-bottom: none; }
.mk-quick-row i { color: var(--primary-light); width: 20px; font-size: 16px; }

/* =====================================================
   TOGGLE SWITCH
   ===================================================== */
.cfg-toggle { position: relative; width: 44px; height: 24px; flex-shrink: 0; }
.cfg-toggle input { opacity: 0; width: 0; height: 0; }
.cfg-toggle-slider {
    position: absolute; inset: 0; cursor: pointer; border-radius: 24px;
    background: #cbd5e1; transition: all 0.2s ease;
}
.cfg-toggle-slider::before {
    content: ""; position: absolute; left: 3px; top: 3px;
    width: 18px; height: 18px; border-radius: 50%;
    background: #fff; transition: transform 0.2s ease; box-shadow: 0 1px 3px rgba(0,0,0,.15);
}
.cfg-toggle input:checked + .cfg-toggle-slider { background: var(--primary, #7c3aed); }
.cfg-toggle input:checked + .cfg-toggle-slider::before { transform: translateX(20px); }

/* Config Section */
.cfg-section {
    background: var(--card-bg, #fff);
    border: 2px solid var(--border, #e2e8f0);
    border-radius: var(--radius, 12px);
    padding: 1.25rem;
    margin-bottom: 1rem;
}
.cfg-section-title {
    font-size: 0.92rem; font-weight: 700; color: var(--text, #1e293b);
    display: flex; align-items: center; gap: 8px; margin-bottom: 1rem;
    padding-bottom: 0.75rem; border-bottom: 1px solid var(--border, #e2e8f0);
}
.cfg-section-title i { color: var(--primary, #7c3aed); font-size: 1rem; }

/* Field Toggle Card */
.cfg-field-card {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 14px; background: var(--bg, #f8fafc);
    border: 1px solid var(--border, #e2e8f0); border-radius: 10px;
    transition: all 0.15s ease;
}
.cfg-field-card:hover { border-color: var(--primary-light, #a78bfa); }
.cfg-field-card .cfg-field-icon {
    width: 36px; height: 36px; border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.9rem; flex-shrink: 0;
}
.cfg-field-card .cfg-field-info { flex: 1; min-width: 0; }
.cfg-field-card .cfg-field-name { font-size: 0.85rem; font-weight: 600; color: var(--text, #1e293b); }
.cfg-field-card .cfg-field-desc { font-size: 0.72rem; color: var(--text-muted, #94a3b8); }

/* Plan Cards */
.plan-card {
    background: var(--card-bg, #fff);
    border: 2px solid var(--border, #e2e8f0);
    border-radius: var(--radius, 12px);
    padding: 1.25rem;
    transition: all 0.2s ease;
    position: relative;
}
.plan-card:hover { border-color: var(--primary-light, #a78bfa); box-shadow: 0 4px 16px rgba(124,58,237,.08); }
.plan-card-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 0.75rem; }
.plan-card-name { font-size: 0.95rem; font-weight: 800; text-transform: uppercase; color: var(--text, #1e293b); letter-spacing: 0.3px; }
.plan-card-id { font-size: 0.7rem; color: var(--text-muted, #94a3b8); margin-top: 2px; }
.plan-card-desc { font-size: 0.78rem; color: var(--text-secondary, #64748b); line-height: 1.4; margin-bottom: 0.75rem; min-height: 2.2rem; }
.plan-card-meta { display: flex; flex-direction: column; gap: 6px; margin-bottom: 0.75rem; }
.plan-card-meta-row { display: flex; align-items: center; gap: 8px; font-size: 0.82rem; }
.plan-card-meta-row i { color: var(--primary, #7c3aed); width: 16px; }
.plan-card-meta-row .plan-badge {
    display: inline-block; padding: 2px 10px; border-radius: 6px;
    font-size: 0.72rem; font-weight: 700;
}
.plan-badge-time { background: #ede9fe; color: #6d28d9; }
.plan-badge-price { background: #dcfce7; color: #16a34a; }
.plan-card-actions { display: flex; gap: 8px; padding-top: 0.75rem; border-top: 1px solid var(--border, #e2e8f0); }
.plan-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1rem; }

/* =====================================================
   DIALOG ANIMATIONS
   ===================================================== */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(20px) scale(.96); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes slideIn { from { opacity: 0; transform: translateX(40px); } to { opacity: 1; transform: translateX(0); } }

/* =====================================================
   ADS PAGE — Glassmorphism Design
   ===================================================== */
.np-ads-page {
    --np-bg: #0b1020;
    --np-surface: rgba(22, 28, 48, 0.75);
    --np-card-bg: rgba(30, 38, 66, 0.55);
    --np-border: rgba(255, 255, 255, 0.08);
    --np-glow: rgba(139, 92, 246, 0.35);
    --np-text: #e9ecff;
    --np-muted: #9ca3cf;
    --np-dim: #6b7299;
    --np-accent: #8b5cf6;
    --np-cyan: #06b6d4;
    --np-pink: #f472b6;
    --np-grad: linear-gradient(135deg, #8b5cf6 0%, #06b6d4 100%);
    --np-radius: 14px;
    background-color: var(--np-bg);
    background-image:
        radial-gradient(circle at 15% 20%, rgba(139,92,246,0.2) 0%, transparent 40%),
        radial-gradient(circle at 85% 10%, rgba(6,182,212,0.15) 0%, transparent 40%),
        radial-gradient(circle at 50% 90%, rgba(244,114,182,0.1) 0%, transparent 45%);
    border-radius: var(--np-radius);
    padding: 1.5rem;
    margin: -1rem;
    padding-bottom: 2rem;
}
.np-ads-page::before { display: none; }

/* Stats */
.np-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}
.np-stat-card {
    background: var(--np-surface);
    backdrop-filter: blur(16px);
    border: 1px solid var(--np-border);
    border-radius: var(--np-radius);
    padding: 16px 18px;
    display: flex;
    align-items: center;
    gap: 14px;
    transition: all 0.2s ease;
}
.np-stat-card:hover {
    border-color: var(--np-glow);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(139,92,246,0.15);
}
.np-stat-icon {
    width: 44px; height: 44px;
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 18px; color: #fff;
    flex-shrink: 0;
}
.np-stat-icon.purple { background: linear-gradient(135deg, #8b5cf6, #6d28d9); }
.np-stat-icon.cyan { background: linear-gradient(135deg, #06b6d4, #0891b2); }
.np-stat-icon.pink { background: linear-gradient(135deg, #f472b6, #ec4899); }
.np-stat-icon.green { background: linear-gradient(135deg, #10b981, #059669); }
.np-stat-value { font-size: 1.5rem; font-weight: 700; color: var(--np-text); line-height: 1; }
.np-stat-label { font-size: 0.72rem; color: var(--np-muted); text-transform: uppercase; letter-spacing: 0.5px; margin-top: 2px; }

/* Toolbar */
.np-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 10px;
}
.np-toolbar-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--np-text);
}

/* Buttons */
.np-btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 10px 18px;
    border: none;
    border-radius: 10px;
    font-size: 0.85rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}
.np-btn-primary {
    background: var(--np-grad);
    color: #fff;
    box-shadow: 0 4px 16px rgba(139,92,246,0.3);
}
.np-btn-primary:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(139,92,246,0.4); }
.np-btn-ghost {
    background: rgba(255,255,255,0.06);
    color: var(--np-muted);
    border: 1px solid var(--np-border);
}
.np-btn-ghost:hover { background: rgba(255,255,255,0.1); color: var(--np-text); }
.np-btn-danger {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: #fff;
}
.np-btn-sm { padding: 6px 12px; font-size: 0.78rem; border-radius: 8px; }

/* Card */
.np-card {
    background: var(--np-surface);
    backdrop-filter: blur(16px);
    border: 1px solid var(--np-border);
    border-radius: var(--np-radius);
    padding: 20px 22px;
    margin-bottom: 16px;
}

/* Ad Grid */
.np-ad-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 14px;
}
.np-ad-card {
    background: var(--card-bg, #fff);
    border: 2px solid var(--border, #e2e8f0);
    border-radius: var(--radius, 12px);
    overflow: hidden;
    transition: all 0.2s ease;
}
.np-ad-card:hover {
    border-color: var(--primary-light, #a78bfa);
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(124,58,237,0.12);
}
.np-ad-preview {
    width: 100%;
    height: 160px;
    background: var(--bg, #f1f5f9);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
}
.np-ad-preview img, .np-ad-preview video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.np-ad-preview .np-type-badge {
    position: absolute;
    top: 8px; left: 8px;
    padding: 3px 10px;
    border-radius: 6px;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.np-type-video { background: rgba(139,92,246,0.85); color: #fff; }
.np-type-imagem { background: rgba(16,185,129,0.85); color: #fff; }
.np-type-link { background: rgba(245,158,11,0.85); color: #fff; }
.np-ad-body {
    padding: 14px 16px;
}
.np-ad-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text, #1e293b);
    margin-bottom: 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.np-ad-meta {
    display: flex;
    gap: 12px;
    font-size: 0.72rem;
    color: var(--text-secondary, #64748b);
    margin-bottom: 10px;
}
.np-ad-meta span {
    display: flex;
    align-items: center;
    gap: 4px;
}
.np-ad-actions {
    display: flex;
    gap: 6px;
    justify-content: flex-end;
    padding-top: 8px;
    border-top: 1px solid var(--border, #e2e8f0);
}
.np-ad-status {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 0.68rem;
    font-weight: 600;
}
.np-status-ativo { background: rgba(16,185,129,0.15); color: #10b981; }
.np-status-inativo { background: rgba(239,68,68,0.15); color: #ef4444; }

/* Upload Zone */
.np-upload-zone {
    border: 2px dashed rgba(124,58,237,0.25);
    border-radius: var(--radius, 12px);
    padding: 32px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    background: rgba(124,58,237,0.03);
    margin-bottom: 16px;
}
.np-upload-zone:hover, .np-upload-zone.dragover {
    border-color: var(--primary, #7c3aed);
    background: rgba(124,58,237,0.08);
}
.np-upload-zone i {
    font-size: 2rem;
    color: var(--primary, #7c3aed);
    margin-bottom: 8px;
}
.np-upload-zone p {
    color: var(--text-secondary, #64748b);
    font-size: 0.85rem;
    margin: 4px 0;
}
.np-upload-zone .np-upload-limits {
    font-size: 0.72rem;
    color: var(--text-muted, #94a3b8);
    margin-top: 6px;
}
.np-upload-preview {
    margin-top: 12px;
    border-radius: 10px;
    overflow: hidden;
    max-height: 200px;
    display: none;
}
.np-upload-preview img, .np-upload-preview video {
    max-width: 100%;
    max-height: 200px;
    border-radius: 10px;
    object-fit: contain;
}
.np-upload-progress {
    width: 100%;
    height: 4px;
    background: rgba(255,255,255,0.08);
    border-radius: 2px;
    margin-top: 12px;
    overflow: hidden;
    display: none;
}
.np-upload-progress-bar {
    height: 100%;
    background: var(--np-grad);
    border-radius: 2px;
    width: 0%;
    transition: width 0.3s linear;
}
.np-upload-info {
    font-size: 0.78rem;
    color: var(--np-muted);
    margin-top: 8px;
    display: none;
}

/* Form */
.np-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}
@media (max-width: 600px) { .np-form-grid { grid-template-columns: 1fr; } }
.np-form-group { margin-bottom: 0; }
.np-label {
    display: block;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--np-muted);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-bottom: 5px;
}
.np-input {
    width: 100%;
    padding: 10px 14px;
    background: rgba(11,16,32,0.7);
    border: 1px solid var(--np-border);
    border-radius: 10px;
    color: var(--np-text);
    font-size: 0.88rem;
    font-family: inherit;
    transition: border 0.2s;
    outline: none;
}
.np-input:focus {
    border-color: var(--np-accent);
    box-shadow: 0 0 0 3px rgba(139,92,246,0.15);
}
.np-select {
    width: 100%;
    padding: 10px 14px;
    background: rgba(11,16,32,0.7);
    border: 1px solid var(--np-border);
    border-radius: 10px;
    color: var(--np-text);
    font-size: 0.88rem;
    font-family: inherit;
    outline: none;
    cursor: pointer;
}
.np-select:focus { border-color: var(--np-accent); }

/* Device selector */
.np-device-select {
    display: flex;
    gap: 8px;
}
.np-device-opt {
    flex: 1;
    padding: 10px;
    border: 2px solid var(--border, #e2e8f0);
    border-radius: 10px;
    background: var(--bg, #f8fafc);
    color: var(--text-secondary, #64748b);
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.78rem;
    font-weight: 600;
}
.np-device-opt:hover { border-color: var(--primary-light, #a78bfa); color: var(--text, #1e293b); }
.np-device-opt.active {
    border-color: var(--primary, #7c3aed);
    background: rgba(124,58,237,0.08);
    color: var(--primary, #7c3aed);
    box-shadow: 0 0 0 2px rgba(124,58,237,0.15);
}
.np-device-opt i { font-size: 1.1rem; display: block; margin-bottom: 4px; }

/* Form actions */
.np-form-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--np-border);
}

/* Empty state */
.np-empty {
    text-align: center;
    padding: 48px 20px;
    color: var(--np-dim);
}
.np-empty i { font-size: 2.5rem; opacity: 0.3; margin-bottom: 12px; }
.np-empty p { font-size: 0.9rem; margin: 4px 0; }

/* Alert */
.np-alert {
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 0.82rem;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.np-alert-error { background: rgba(239,68,68,0.12); color: #f87171; border: 1px solid rgba(239,68,68,0.2); }
.np-alert-success { background: rgba(16,185,129,0.12); color: #34d399; border: 1px solid rgba(16,185,129,0.2); }

/* Responsive */
@media (max-width: 768px) {
    .np-ads-page { padding: 1rem; margin: -0.5rem; }
    .np-stats { grid-template-columns: 1fr 1fr; }
    .np-ad-grid { grid-template-columns: 1fr; }
    .np-device-select { flex-direction: column; }
}
