/* ============================================
   GhostPay Mesh — Admin Enhancement Styles
   Sidebar, Disputes, Queue, i18n, Toast, etc.
   ============================================ */

/* === Visibility: hide admin sections by default === */
.admin-section,
.admin-login-section {
    display: none !important;
}

.admin-login-section.active {
    display: flex !important;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 40px 32px;
    position: fixed;
    inset: 0;
    z-index: 9999;
    overflow-y: auto;
}

/* === Admin Layout: Sidebar + Main === */
.admin-section.active {
    display: flex !important;
    padding: 0 !important;
}

.admin-layout {
    display: flex;
    min-height: 100vh;
    width: 100%;
}

.admin-sidebar {
    width: 260px;
    min-width: 260px;
    background: var(--bg-card, #10141D);
    border-right: 1px solid var(--border-subtle, rgba(255,255,255,0.06));
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    transition: transform 0.3s cubic-bezier(0.4,0,0.2,1);
    overflow: hidden;
}

.admin-sidebar-header {
    padding: 20px 20px;
    border-bottom: 1px solid var(--border-subtle, rgba(255,255,255,0.06));
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.admin-sidebar-header img {
    height: 34px;
    width: auto;
    border-radius: 6px;
}

.admin-sidebar-header h2 {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary, #F0F2F5);
    white-space: nowrap;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 12px 10px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.08) transparent;
}

.sidebar-nav::-webkit-scrollbar {
    width: 4px;
}

.sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.08);
    border-radius: 4px;
}

.sidebar-nav-group {
    margin-bottom: 20px;
}

.sidebar-nav-label {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--text-muted, #5A6478);
    padding: 0 12px 8px;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary, #A0A8B8);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4,0,0.2,1);
    text-decoration: none;
    margin-bottom: 1px;
    white-space: nowrap;
    user-select: none;
}

.sidebar-link:hover {
    color: var(--text-primary, #F0F2F5);
    background: rgba(255,255,255,0.04);
}

.sidebar-link.active {
    color: #00F0FF;
    background: rgba(0,240,255,0.08);
}

.sidebar-link svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    opacity: 0.5;
    transition: opacity 0.2s;
}

.sidebar-link:hover svg { opacity: 0.8; }
.sidebar-link.active svg { opacity: 1; color: #00F0FF; }

/* === Admin Main Area === */
.admin-main {
    flex: 1;
    margin-left: 260px;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background: var(--bg-primary, #06080F);
}

.admin-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 28px;
    background: rgba(6,8,15,0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-subtle, rgba(255,255,255,0.06));
    position: sticky;
    top: 0;
    z-index: 50;
    flex-shrink: 0;
    gap: 16px;
}

.admin-header-left {
    display: flex;
    align-items: center;
    gap: 14px;
}

.admin-header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-toggle {
    display: none;
    background: var(--bg-surface, #1A1F2E);
    border: 1px solid var(--border-subtle, rgba(255,255,255,0.06));
    color: var(--text-primary, #F0F2F5);
    padding: 7px;
    border-radius: 8px;
    cursor: pointer;
    transition: border-color 0.2s;
    line-height: 0;
}

.sidebar-toggle:hover {
    border-color: rgba(0,240,255,0.3);
}

.sidebar-toggle svg {
    width: 20px;
    height: 20px;
}

.admin-content {
    flex: 1;
    padding: 20px 24px;
    overflow-x: hidden;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 99;
    transition: opacity 0.3s;
}

/* === Language Toggle === */
.lang-toggle {
    display: flex;
    background: var(--bg-surface, #1A1F2E);
    border: 1px solid var(--border-subtle, rgba(255,255,255,0.06));
    border-radius: 8px;
    overflow: hidden;
}

.lang-btn {
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted, #5A6478);
    background: transparent;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.lang-btn:hover { color: var(--text-secondary, #A0A8B8); }
.lang-btn.active {
    color: #00F0FF;
    background: rgba(0,240,255,0.1);
}

/* === Toast Notifications === */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.toast {
    padding: 14px 20px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary, #F0F2F5);
    background: var(--bg-card, #10141D);
    border: 1px solid var(--border-subtle, rgba(255,255,255,0.06));
    box-shadow: 0 8px 32px rgba(0,0,0,0.4);
    animation: toastIn 0.35s cubic-bezier(0.4,0,0.2,1);
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 280px;
    max-width: 420px;
    pointer-events: auto;
}

.toast.success { border-left: 4px solid #00FF88; }
.toast.error { border-left: 4px solid #FF4466; }
.toast.warning { border-left: 4px solid #FFB020; }
.toast.info { border-left: 4px solid #00F0FF; }

.toast.fade-out {
    animation: toastOut 0.3s forwards;
}

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

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

/* === Skeleton Loader === */
.skeleton {
    background: linear-gradient(90deg,
        var(--bg-surface, #1A1F2E) 25%,
        rgba(255,255,255,0.06) 50%,
        var(--bg-surface, #1A1F2E) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 6px;
}

.skeleton-text { height: 14px; margin-bottom: 8px; }
.skeleton-text.short { width: 60%; }
.skeleton-card { height: 80px; border-radius: 14px; margin-bottom: 16px; }
.skeleton-row { height: 44px; margin-bottom: 4px; border-radius: 8px; }

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* === Modal === */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(4px);
    z-index: 5000;
    display: none;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.modal-overlay.open {
    display: flex;
    opacity: 1;
    pointer-events: auto;
}

.modal {
    background: var(--bg-card, #10141D);
    border: 1px solid var(--border-medium, rgba(255,255,255,0.10));
    border-radius: 20px;
    padding: 32px;
    max-width: 700px;
    width: 92%;
    max-height: 85vh;
    overflow-y: auto;
    transform: scale(0.95) translateY(10px);
    transition: transform 0.3s cubic-bezier(0.4,0,0.2,1);
}

.modal-overlay.open .modal {
    transform: scale(1) translateY(0);
}

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

.modal-header h3 {
    font-size: 20px;
    font-weight: 700;
}

.modal-close {
    background: var(--bg-surface, #1A1F2E);
    border: 1px solid var(--border-subtle, rgba(255,255,255,0.06));
    color: var(--text-muted, #5A6478);
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.2s;
    line-height: 1;
}

.modal-close:hover {
    color: var(--text-primary, #F0F2F5);
    border-color: rgba(255,255,255,0.15);
}

.detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 24px;
}

.detail-item label {
    display: block;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted, #5A6478);
    margin-bottom: 4px;
}

.detail-item span,
.detail-item p {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary, #F0F2F5);
}

.admin-textarea {
    width: 100%;
    min-height: 100px;
    padding: 14px;
    background: var(--bg-surface, #1A1F2E);
    border: 1px solid var(--border-subtle, rgba(255,255,255,0.06));
    border-radius: 10px;
    color: var(--text-primary, #F0F2F5);
    font-family: var(--font-sans, system-ui);
    font-size: 14px;
    resize: vertical;
    transition: border-color 0.2s;
}

.admin-textarea:focus {
    outline: none;
    border-color: rgba(0,240,255,0.3);
}

.modal-actions {
    display: flex;
    gap: 10px;
    margin-top: 24px;
    flex-wrap: wrap;
}

.btn-approve {
    padding: 10px 24px;
    background: #00FF88;
    color: #0D0D12;
    border: none;
    border-radius: 10px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.btn-approve:hover {
    box-shadow: 0 0 20px rgba(0,255,136,0.3);
    transform: translateY(-1px);
}

.btn-deny {
    padding: 10px 24px;
    background: #FF4466;
    color: white;
    border: none;
    border-radius: 10px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.btn-deny:hover {
    box-shadow: 0 0 20px rgba(255,68,102,0.3);
    transform: translateY(-1px);
}

.btn-review {
    padding: 10px 24px;
    background: rgba(0,240,255,0.1);
    color: #00F0FF;
    border: 1px solid rgba(0,240,255,0.3);
    border-radius: 10px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.btn-review:hover {
    background: rgba(0,240,255,0.15);
    box-shadow: 0 0 20px rgba(0,240,255,0.15);
}

/* === Dispute Badges === */
.badge-pending { background: rgba(255,230,0,0.12); color: #FFE600; }
.badge-under_review { background: rgba(0,240,255,0.12); color: #00F0FF; }
.badge-approved { background: rgba(0,255,136,0.12); color: #00FF88; }
.badge-denied { background: rgba(255,68,102,0.12); color: #FF4466; }

/* === Pagination === */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.pagination button {
    padding: 7px 13px;
    background: var(--bg-surface, #1A1F2E);
    border: 1px solid var(--border-subtle, rgba(255,255,255,0.06));
    border-radius: 8px;
    color: var(--text-secondary, #A0A8B8);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.pagination button:hover:not(:disabled) {
    border-color: rgba(0,240,255,0.3);
    color: #00F0FF;
}

.pagination button.active {
    background: rgba(0,240,255,0.1);
    border-color: #00F0FF;
    color: #00F0FF;
}

.pagination button:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

/* === Search Input === */
.search-wrapper {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.search-wrapper svg {
    position: absolute;
    left: 12px;
    width: 16px;
    height: 16px;
    color: var(--text-muted, #5A6478);
    pointer-events: none;
}

.search-input {
    padding: 9px 14px 9px 36px;
    background: var(--bg-surface, #1A1F2E);
    border: 1px solid var(--border-subtle, rgba(255,255,255,0.06));
    border-radius: 10px;
    color: var(--text-primary, #F0F2F5);
    font-size: 13px;
    font-family: inherit;
    width: 260px;
    transition: border-color 0.2s;
}

.search-input:focus {
    outline: none;
    border-color: rgba(0,240,255,0.3);
}

.search-input::placeholder {
    color: var(--text-muted, #5A6478);
}

/* === Queue Monitoring Cards === */
.queue-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 14px;
    margin-bottom: 20px;
}

.queue-card {
    background: var(--bg-card, #10141D);
    border: 1px solid var(--border-subtle, rgba(255,255,255,0.06));
    border-radius: 14px;
    padding: 20px;
    transition: border-color 0.3s, box-shadow 0.3s;
}

.queue-card.warning {
    border-color: rgba(255,176,32,0.4);
    box-shadow: 0 0 16px rgba(255,176,32,0.08);
}

.queue-card.danger {
    border-color: rgba(255,68,102,0.5);
    box-shadow: 0 0 16px rgba(255,68,102,0.1);
    animation: pulseBorder 2s infinite;
}

@keyframes pulseBorder {
    0%, 100% { border-color: rgba(255,68,102,0.5); }
    50% { border-color: rgba(255,68,102,0.9); }
}

.queue-card-name {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted, #5A6478);
    margin-bottom: 6px;
    font-weight: 600;
}

.queue-card-value {
    font-size: 20px;
    font-weight: 700;
    font-family: var(--font-mono, monospace);
    color: var(--text-primary, #F0F2F5);
}

.queue-card-dead {
    font-size: 12px;
    color: #FF4466;
    margin-top: 6px;
}

/* === Auto-refresh Indicator === */
.auto-refresh-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: var(--text-muted, #5A6478);
    font-family: var(--font-mono, monospace);
}

.auto-refresh-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #00FF88;
    animation: pulse-glow 2s infinite;
}

/* === Tab Content Animation === */
.admin-tab-content {
    animation: fadeInTab 0.3s ease;
}

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

/* === Better Table Hover === */
.admin-table tr {
    transition: background 0.15s;
}

.admin-table tr.clickable {
    cursor: pointer;
}

.admin-table tr.clickable:hover td {
    background: rgba(0,240,255,0.04);
}

/* === Reconciliation === */
.recon-results {
    background: var(--bg-surface, #1A1F2E);
    border: 1px solid var(--border-subtle, rgba(255,255,255,0.06));
    border-radius: 12px;
    padding: 20px;
    margin-top: 16px;
}

.recon-results h4 {
    font-size: 15px;
    margin-bottom: 12px;
    font-weight: 600;
}

/* === Mobile Responsive Sidebar === */
@media (max-width: 1024px) {
    .admin-sidebar {
        transform: translateX(-100%);
        z-index: 200;
    }

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

    .sidebar-overlay.open {
        display: block;
    }

    .admin-main {
        margin-left: 0;
    }

    .sidebar-toggle {
        display: flex;
    }

    .admin-content {
        padding: 20px 16px;
    }

    .admin-header {
        padding: 12px 16px;
    }

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

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

    .search-input {
        width: 180px;
    }
}

@media (max-width: 640px) {
    .queue-grid {
        grid-template-columns: 1fr;
    }

    .admin-header-right {
        gap: 8px;
    }

    .modal {
        padding: 20px;
        width: 96%;
        border-radius: 14px;
    }
}

/* === Responsive Tables === */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 -16px;
    padding: 0 16px;
}

@media (max-width: 768px) {
    .admin-table {
        font-size: 12px;
    }
    .admin-table th,
    .admin-table td {
        padding: 8px 10px;
        white-space: nowrap;
    }
    .admin-table .badge {
        font-size: 10px;
        padding: 2px 6px;
    }
}

/* === Pagination Component === */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 16px 0;
    flex-wrap: wrap;
}
.pagination button {
    min-width: 36px;
    height: 36px;
    padding: 0 10px;
    border: 1px solid rgba(255,255,255,0.06);
    background: var(--bg-surface, #1A1F2E);
    color: var(--text-secondary, #A0AEC0);
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    font-family: var(--font-mono, monospace);
    transition: all 0.2s;
}
.pagination button:hover:not(:disabled) {
    border-color: rgba(0,240,255,0.3);
    color: #00F0FF;
    background: rgba(0,240,255,0.05);
}
.pagination button.active {
    background: linear-gradient(135deg, #00F0FF, #A855F7);
    color: #0a0a0f;
    border-color: transparent;
    font-weight: 600;
}
.pagination button:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}
.pagination-info {
    font-size: 12px;
    color: var(--text-muted, #555570);
    text-align: center;
    padding: 4px 0;
    font-family: var(--font-mono, monospace);
}

/* === Admin Header Improvements === */
.admin-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}
.admin-section-header h2 {
    font-size: 20px;
    font-weight: 700;
    margin: 0;
}
.admin-search-box {
    display: flex;
    align-items: center;
    gap: 8px;
}
.admin-search-box input {
    background: var(--bg-surface, #1A1F2E);
    border: 1px solid rgba(255,255,255,0.06);
    color: var(--text-primary, #F0F2F5);
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 13px;
    min-width: 200px;
    transition: border-color 0.2s;
}
.admin-search-box input:focus {
    outline: none;
    border-color: rgba(0,240,255,0.3);
}
.admin-search-box select {
    background: var(--bg-surface, #1A1F2E);
    border: 1px solid rgba(255,255,255,0.06);
    color: var(--text-primary, #F0F2F5);
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 13px;
}

/* === Better Mobile Sidebar === */
@media (max-width: 1024px) {
    .admin-main {
        margin-left: 0 !important;
        padding: 16px !important;
    }
}

@media (max-width: 640px) {
    .admin-section-header {
        flex-direction: column;
        align-items: flex-start;
    }
    .admin-search-box {
        width: 100%;
    }
    .admin-search-box input {
        min-width: 0;
        flex: 1;
    }
    .pagination button {
        min-width: 32px;
        height: 32px;
        font-size: 12px;
    }
}

/* === Navbar Insights shimmer === */
.navbar-insights-shimmer {
    position: relative;
    padding: 6px 14px !important;
    border-radius: 8px;
    font-weight: 600 !important;
    color: #fff !important;
    background: linear-gradient(
        120deg,
        #00F0FF 0%,
        #3B82F6 25%,
        #B026FF 50%,
        #E040FB 75%,
        #00F0FF 100%
    );
    background-size: 300% 100%;
    border: 1px solid rgba(0, 240, 255, 0.35);
    box-shadow: 0 0 20px rgba(0, 240, 255, 0.15);
    animation: navbar-insights-shimmer 8s ease-in-out infinite;
    overflow: hidden;
}

.navbar-insights-shimmer::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        105deg,
        transparent 40%,
        rgba(255, 255, 255, 0.12) 50%,
        transparent 60%
    );
    background-size: 200% 100%;
    animation: navbar-insights-gleam 6s ease-in-out infinite;
    pointer-events: none;
}

@keyframes navbar-insights-shimmer {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

@keyframes navbar-insights-gleam {
    0%, 100% { background-position: 200% 0; }
    50% { background-position: -200% 0; }
}

@media (prefers-reduced-motion: reduce) {
    .navbar-insights-shimmer,
    .navbar-insights-shimmer::after {
        animation: none;
        background-position: 50% 50%;
    }
}

/* === Insights Admin — scoped UI (tab-insights only) === */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

#tab-insights {
    --insights-radius: 11px;
    --insights-radius-sm: 9px;
    --insights-control-h: 44px;
    --insights-border: rgba(255, 255, 255, 0.08);
    --insights-border-hover: rgba(0, 240, 255, 0.28);
    --insights-bg: rgba(10, 14, 22, 0.72);
    --insights-bg-elevated: rgba(16, 20, 29, 0.95);
}

/* Stats grid */
#tab-insights .insights-stats-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

#tab-insights .insights-stat-card {
    padding: 16px 14px;
    background: var(--insights-bg-elevated);
    border: 1px solid var(--insights-border);
    border-radius: var(--insights-radius);
    text-align: center;
    transition: border-color 0.2s ease, background 0.2s ease, transform 0.15s ease;
}

#tab-insights .insights-stat-card:hover {
    border-color: rgba(255, 255, 255, 0.14);
    transform: translateY(-1px);
}

#tab-insights .insights-stat-card__value {
    font-size: 1.5rem;
    font-weight: 700;
    font-family: var(--font-mono, 'JetBrains Mono', monospace);
    line-height: 1.2;
    margin-bottom: 4px;
    color: #F0F2F5;
}

#tab-insights .insights-stat-card__label {
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #8B95A8;
}

#tab-insights .insights-stat-card--cyan .insights-stat-card__value { color: #00F0FF; }
#tab-insights .insights-stat-card--blue .insights-stat-card__value { color: #60A5FA; }
#tab-insights .insights-stat-card--violet .insights-stat-card__value { color: #C084FC; }
#tab-insights .insights-stat-card--amber .insights-stat-card__value { color: #FBBF24; }
#tab-insights .insights-stat-card--green .insights-stat-card__value { color: #34D399; }
#tab-insights .insights-stat-card--slate .insights-stat-card__value { color: #94A3B8; }
#tab-insights .insights-stat-card--gold .insights-stat-card__value { color: #FCD34D; }

/* Main panel */
#tab-insights .insights-panel {
    background: var(--insights-bg-elevated);
    border: 1px solid var(--insights-border);
    border-radius: 14px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.22);
    overflow: hidden;
}

#tab-insights .insights-panel__header {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 22px 24px 18px;
    border-bottom: 1px solid var(--insights-border);
}

#tab-insights .insights-panel__title {
    margin: 0 0 6px;
    font-size: 1.25rem;
    font-weight: 700;
    background: linear-gradient(120deg, #00F0FF, #7C3AED);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

#tab-insights .insights-panel__desc {
    margin: 0;
    font-size: 0.875rem;
    color: #8B95A8;
    max-width: 42ch;
}

#tab-insights .insights-panel__header-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

/* Toolbar */
#tab-insights .insights-toolbar {
    padding: 16px 24px;
    border-bottom: 1px solid var(--insights-border);
}

#tab-insights .insights-toolbar__filters {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
}

#tab-insights .insights-field {
    position: relative;
    display: flex;
    align-items: center;
}

#tab-insights .insights-field--search {
    flex: 1 1 220px;
    max-width: 360px;
    min-width: 180px;
}

#tab-insights .insights-field--select {
    flex: 0 1 auto;
    min-width: 140px;
}

#tab-insights .insights-field__icon {
    position: absolute;
    left: 14px;
    color: #6B7280;
    pointer-events: none;
    display: flex;
}

#tab-insights .insights-control {
    width: 100%;
    height: var(--insights-control-h);
    padding: 0 14px;
    border: 1px solid var(--insights-border);
    border-radius: var(--insights-radius);
    background: var(--insights-bg);
    color: #E8ECF2;
    font-size: 0.875rem;
    font-family: inherit;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
    appearance: none;
    -webkit-appearance: none;
}

#tab-insights .insights-field--search .insights-control {
    padding-left: 40px;
}

#tab-insights .insights-control::placeholder {
    color: #6B7280;
}

#tab-insights .insights-control:hover {
    border-color: rgba(255, 255, 255, 0.14);
    background: rgba(14, 18, 28, 0.9);
}

#tab-insights .insights-control:focus {
    outline: none;
    border-color: rgba(0, 240, 255, 0.45);
    box-shadow: 0 0 0 3px rgba(0, 240, 255, 0.12), 0 0 0 1px rgba(124, 58, 237, 0.2);
}

#tab-insights .insights-control--select {
    padding-right: 36px;
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238B95A8' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
}

#tab-insights .insights-control option {
    background: #10141D;
    color: #E8ECF2;
}

/* Header buttons */
#tab-insights .insights-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: var(--insights-control-h);
    padding: 0 18px;
    border-radius: var(--insights-radius);
    border: 1px solid transparent;
    font-size: 0.875rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    white-space: nowrap;
    transition: transform 0.15s ease, box-shadow 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

#tab-insights .insights-btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 240, 255, 0.2);
}

#tab-insights .insights-btn:active {
    transform: scale(0.98);
}

#tab-insights .insights-btn--primary {
    color: #fff;
    background: linear-gradient(135deg, #00F0FF 0%, #3B82F6 48%, #7C3AED 100%);
    box-shadow: 0 4px 18px rgba(0, 240, 255, 0.12);
}

#tab-insights .insights-btn--primary:hover {
    box-shadow: 0 6px 22px rgba(0, 240, 255, 0.18);
    transform: translateY(-1px);
}

#tab-insights .insights-btn--secondary {
    color: #A5F3FC;
    background: rgba(0, 240, 255, 0.06);
    border-color: rgba(0, 240, 255, 0.28);
}

#tab-insights .insights-btn--secondary:hover {
    background: rgba(0, 240, 255, 0.12);
    border-color: rgba(124, 58, 237, 0.4);
    color: #E0F2FE;
}

#tab-insights .insights-btn__icon {
    font-size: 1rem;
    line-height: 1;
    opacity: 0.9;
}

/* Table */
#tab-insights .insights-table-wrap {
    overflow-x: auto;
    padding: 0 0 8px;
}

#tab-insights .insights-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

#tab-insights .insights-table thead th {
    padding: 14px 18px;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #7C8498;
    background: rgba(255, 255, 255, 0.025);
    border-bottom: 1px solid var(--insights-border);
    white-space: nowrap;
}

#tab-insights .insights-table tbody td {
    padding: 18px;
    vertical-align: middle;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    color: #B8C0CC;
    font-size: 0.875rem;
}

#tab-insights .insights-row {
    min-height: 80px;
    transition: background 0.18s ease;
}

#tab-insights .insights-row:hover td {
    background: rgba(0, 240, 255, 0.03);
}

#tab-insights .insights-table__th-image,
#tab-insights .insights-table__cell-image {
    width: 72px;
}

#tab-insights .insights-table__th-actions,
#tab-insights .insights-table__cell-actions {
    min-width: 200px;
}

#tab-insights .insights-table__cell-date {
    white-space: nowrap;
    color: #8B95A8;
    font-variant-numeric: tabular-nums;
}

/* Thumbnail */
#tab-insights .insights-thumb {
    width: 56px;
    height: 56px;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid var(--insights-border);
    background: rgba(0, 0, 0, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
}

#tab-insights .insights-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

#tab-insights .insights-thumb--empty {
    color: #4B5563;
}

/* Title / slug */
#tab-insights .insights-title {
    font-size: 0.9375rem;
    font-weight: 600;
    color: #F0F2F5;
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    max-width: 320px;
}

#tab-insights .insights-slug {
    margin-top: 6px;
    font-size: 0.75rem;
    color: #6B7280;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 280px;
}

/* Badges */
#tab-insights .insights-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    border-radius: 999px;
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    border: 1px solid transparent;
    white-space: nowrap;
}

#tab-insights .insights-badge--type-internal {
    background: rgba(0, 240, 255, 0.1);
    border-color: rgba(0, 240, 255, 0.25);
    color: #67E8F9;
}

#tab-insights .insights-badge--type-external {
    background: rgba(124, 58, 237, 0.12);
    border-color: rgba(124, 58, 237, 0.28);
    color: #C4B5FD;
}

#tab-insights .insights-badge--source {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.08);
    color: #C7CDD8;
}

#tab-insights .insights-source__favicon {
    width: 14px;
    height: 14px;
    border-radius: 3px;
    object-fit: contain;
}

#tab-insights .insights-badge--category {
    background: rgba(59, 130, 246, 0.08);
    border-color: rgba(59, 130, 246, 0.18);
    color: #93C5FD;
}

#tab-insights .insights-badge--status-published {
    background: rgba(52, 211, 153, 0.1);
    border-color: rgba(52, 211, 153, 0.28);
    color: #6EE7B7;
}

#tab-insights .insights-badge--status-draft {
    background: rgba(251, 191, 36, 0.1);
    border-color: rgba(251, 191, 36, 0.28);
    color: #FCD34D;
}

#tab-insights .insights-badge--status-hidden {
    background: rgba(100, 116, 139, 0.12);
    border-color: rgba(100, 116, 139, 0.25);
    color: #CBD5E1;
}

#tab-insights .insights-status-group {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

#tab-insights .insights-featured {
    color: #FCD34D;
    font-size: 0.875rem;
    line-height: 1;
    cursor: help;
}

/* Action buttons */
#tab-insights .insights-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    position: relative;
}

#tab-insights .insights-actions__primary,
#tab-insights .insights-actions__secondary {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

#tab-insights .insights-action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 36px;
    padding: 0 12px;
    border-radius: var(--insights-radius-sm);
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.04);
    color: #D1D5DB;
    font-size: 0.72rem;
    font-weight: 500;
    font-family: inherit;
    line-height: 1.2;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
    transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease, transform 0.12s ease;
}

#tab-insights .insights-action-btn svg {
    flex-shrink: 0;
}

#tab-insights .insights-action-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.16);
    color: #F3F4F6;
    transform: translateY(-1px);
}

#tab-insights .insights-action-btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 240, 255, 0.18);
}

#tab-insights .insights-action-btn:active {
    transform: translateY(0) scale(0.98);
}

#tab-insights .insights-action-btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none;
}

#tab-insights .insights-action-btn--loading .insights-spinner {
    animation: insightsSpin 0.8s linear infinite;
}

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

#tab-insights .insights-action-btn--open {
    background: rgba(0, 240, 255, 0.08);
    border-color: rgba(0, 240, 255, 0.22);
    color: #67E8F9;
}

#tab-insights .insights-action-btn--refresh {
    background: rgba(124, 58, 237, 0.1);
    border-color: rgba(124, 58, 237, 0.24);
    color: #C4B5FD;
}

#tab-insights .insights-action-btn--feature {
    background: rgba(251, 191, 36, 0.1);
    border-color: rgba(251, 191, 36, 0.24);
    color: #FCD34D;
}

#tab-insights .insights-action-btn--unfeature {
    background: rgba(148, 163, 184, 0.1);
    border-color: rgba(148, 163, 184, 0.22);
    color: #CBD5E1;
}

#tab-insights .insights-action-btn--hide {
    background: rgba(245, 158, 11, 0.1);
    border-color: rgba(245, 158, 11, 0.24);
    color: #FBBF24;
}

#tab-insights .insights-action-btn--unhide {
    background: rgba(52, 211, 153, 0.1);
    border-color: rgba(52, 211, 153, 0.24);
    color: #6EE7B7;
}

#tab-insights .insights-action-btn--preview,
#tab-insights .insights-action-btn--edit {
    background: rgba(99, 102, 241, 0.1);
    border-color: rgba(99, 102, 241, 0.22);
    color: #A5B4FC;
}

#tab-insights .insights-action-btn--publish {
    background: rgba(52, 211, 153, 0.1);
    border-color: rgba(52, 211, 153, 0.24);
    color: #6EE7B7;
}

#tab-insights .insights-action-btn--unpublish {
    background: rgba(148, 163, 184, 0.1);
    border-color: rgba(148, 163, 184, 0.22);
    color: #CBD5E1;
}

#tab-insights .insights-action-btn--delete {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.24);
    color: #FCA5A5;
}

#tab-insights .insights-action-btn--more {
    min-width: 36px;
    padding: 0 10px;
}

/* Responsive actions menu */
#tab-insights .insights-actions__menu {
    position: relative;
    display: none;
}

#tab-insights .insights-actions__dropdown {
    display: none;
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    z-index: 30;
    min-width: 180px;
    padding: 8px;
    border-radius: var(--insights-radius);
    border: 1px solid var(--insights-border);
    background: #121826;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
    flex-direction: column;
    gap: 6px;
}

#tab-insights .insights-actions__menu.is-open .insights-actions__dropdown {
    display: flex;
}

#tab-insights .insights-actions__dropdown .insights-action-btn {
    width: 100%;
    justify-content: flex-start;
}

/* States */
#tab-insights .insights-state {
    text-align: center;
    padding: 40px 24px;
    color: #8B95A8;
    font-size: 0.9rem;
}

#tab-insights .insights-state--loading {
    color: #6B7280;
}

#tab-insights .insights-state--empty {
    color: #7C8498;
}

#tab-insights .insights-state--error {
    color: #FCA5A5;
}

/* Editor inherits dark controls within tab */
#tab-insights #insightsEditorPanel .admin-input,
#tab-insights #insightsEditorPanel textarea.admin-input,
#tab-insights #insightsEditorPanel select.admin-input {
    background: var(--insights-bg);
    border: 1px solid var(--insights-border);
    border-radius: var(--insights-radius-sm);
    color: #E8ECF2;
    min-height: 42px;
}

#tab-insights #insightsEditorPanel .admin-input:focus {
    outline: none;
    border-color: rgba(0, 240, 255, 0.45);
    box-shadow: 0 0 0 3px rgba(0, 240, 255, 0.1);
}

/* Responsive */
@media (max-width: 1200px) {
    #tab-insights .insights-stats-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    #tab-insights .insights-actions__secondary {
        display: none;
    }

    #tab-insights .insights-actions__menu {
        display: block;
    }
}

@media (max-width: 900px) {
    #tab-insights .insights-stats-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    #tab-insights .insights-panel__header {
        padding: 18px 16px;
    }

    #tab-insights .insights-toolbar {
        padding: 14px 16px;
    }

    #tab-insights .insights-field--search {
        flex: 1 1 100%;
        max-width: none;
    }
}

@media (max-width: 640px) {
    #tab-insights .insights-stats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    #tab-insights .insights-panel__header-actions {
        width: 100%;
    }

    #tab-insights .insights-btn {
        flex: 1 1 auto;
    }

    #tab-insights .insights-table thead th:nth-child(4),
    #tab-insights .insights-table tbody td:nth-child(4) {
        display: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    #tab-insights .insights-row,
    #tab-insights .insights-action-btn,
    #tab-insights .insights-btn,
    #tab-insights .insights-stat-card,
    #tab-insights .insights-control {
        transition: none;
    }

    #tab-insights .insights-action-btn--loading .insights-spinner {
        animation: none;
    }
}
