/* Safado Admin — visual layer on top of Tailwind */

body.admin-shell {
    background:
        radial-gradient(900px 420px at -10% -10%, rgba(255, 45, 117, 0.12), transparent 55%),
        radial-gradient(800px 380px at 110% 110%, rgba(138, 43, 226, 0.12), transparent 50%),
        #09090b;
}

body.admin-shell::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    opacity: 0.035;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

#main-content {
    position: relative;
    z-index: 1;
}

.stat-card,
.dash-panel {
    position: relative;
    overflow: hidden;
    border-radius: 1.15rem;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.018));
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 12px 40px -18px rgba(0, 0, 0, 0.7);
}

.stat-card {
    padding: 1.15rem 1.25rem;
    transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    border-color: rgba(255, 45, 117, 0.28);
    box-shadow: 0 18px 44px -16px rgba(255, 45, 117, 0.22);
}

.stat-card .stat-icon {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 0.75rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.85rem;
}

.stat-card .stat-value {
    font-size: 1.65rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
}

.stat-card .stat-label {
    margin-top: 0.35rem;
    font-size: 0.75rem;
    color: #9ca3af;
    letter-spacing: 0.02em;
}

.stat-card .stat-hint {
    margin-top: 0.45rem;
    font-size: 0.7rem;
    color: #6b7280;
}

.ai-insight-btn {
    position: absolute;
    top: 0.6rem;
    right: 0.6rem;
    z-index: 3;
    width: 1.7rem;
    height: 1.7rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border-radius: 0.55rem;
    color: #ff2d75;
    background: rgba(255, 45, 117, 0.12);
    border: 1px solid rgba(255, 45, 117, 0.28);
    transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

.ai-insight-btn svg {
    width: 0.95rem;
    height: 0.95rem;
}

.ai-insight-btn:hover {
    background: rgba(255, 45, 117, 0.22);
    border-color: rgba(255, 45, 117, 0.5);
    transform: scale(1.06);
}

.ai-insight-btn--inline {
    position: static;
}

.dash-panel {
    padding: 1.25rem 1.35rem;
}

.dash-panel-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.1rem;
}

.section-kicker {
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: rgba(255, 45, 117, 0.75);
}

.page-title {
    font-size: clamp(1.6rem, 2.4vw, 2.15rem);
    font-weight: 800;
    letter-spacing: -0.04em;
    background: linear-gradient(135deg, #fff 40%, #ff2d75 160%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.panel-title {
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.panel-sub {
    margin-top: 0.2rem;
    font-size: 0.8rem;
    color: #9ca3af;
}

.presence-bar {
    height: 8px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.06);
    overflow: hidden;
    display: flex;
}

.presence-bar .online {
    background: linear-gradient(90deg, #34d399, #10b981);
}

.presence-bar .offline {
    background: rgba(255, 255, 255, 0.12);
}

.version-bar {
    height: 7px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.06);
    overflow: hidden;
}

.version-bar > span {
    display: block;
    height: 100%;
    border-radius: 999px;
}

.filter-chip {
    border-radius: 0.75rem;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.04);
}

.skeleton-pulse {
    animation: skeleton 1.2s ease-in-out infinite;
    background: linear-gradient(90deg, rgba(255,255,255,0.04), rgba(255,255,255,0.09), rgba(255,255,255,0.04));
    background-size: 200% 100%;
    border-radius: 0.5rem;
}

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

.sidebar-link {
    position: relative;
}

aside#sidebar {
    background: rgba(10, 10, 14, 0.82);
    backdrop-filter: blur(18px);
}

.admin-clock {
    font-variant-numeric: tabular-nums;
}

html,
body.admin-shell {
    max-width: 100%;
    overflow-x: clip;
}

#main-content {
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
}

#main-content img,
#main-content canvas,
#main-content svg,
#main-content video {
    max-width: 100%;
}

#main-content :has(> table) {
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.glass,
.dash-panel {
    min-width: 0;
    max-width: 100%;
}

@media (max-width: 1023px) {
    #main-content table {
        min-width: 40rem;
    }

    #main-content {
        padding-top: calc(4rem + env(safe-area-inset-top, 0px));
    }

    aside#sidebar.sidebar-expanded {
        width: min(16rem, 86vw);
        padding-top: env(safe-area-inset-top, 0px);
    }

    .stat-card {
        padding: 0.9rem 0.85rem;
    }

    .stat-card .stat-value {
        font-size: 1.35rem;
    }

    .dash-panel {
        padding: 1rem;
    }

    .dash-panel-head {
        flex-direction: column;
        align-items: stretch;
        gap: 0.65rem;
    }
}

@media (max-width: 640px) {
    .funnel-step-btn {
        width: 100% !important;
    }

    #main-content {
        padding-left: 0.85rem;
        padding-right: 0.85rem;
        padding-bottom: max(1.5rem, env(safe-area-inset-bottom));
    }

    .page-title {
        font-size: 1.55rem;
    }

    #funnel-chat {
        left: 0.75rem;
        right: 0.75rem;
        bottom: max(0.75rem, env(safe-area-inset-bottom));
        width: auto;
    }

    #funnel-chat-toggle {
        width: 100%;
        justify-content: center;
    }

    #funnel-chat-panel {
        height: min(72dvh, 30rem);
        max-height: calc(100dvh - 5.5rem);
    }

    .filter-chip {
        width: 100%;
        overflow-x: auto;
    }
}
