:root {
    --admin-bg: #f5f7fb;
    --admin-surface: #ffffff;
    --admin-border: #e5e7eb;
    --admin-sidebar: #111827;
    --admin-sidebar-soft: #1f2937;
    --admin-primary: #0d6efd;
    --admin-text: #111827;
    --admin-muted: #6b7280;
}

body.admin-body {
    margin: 0;
    background: var(--admin-bg);
    color: var(--admin-text);
    font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.admin-shell {
    min-height: 100vh;
    display: flex;
}

.admin-sidebar {
    width: 320px;
    background: linear-gradient(180deg, var(--admin-sidebar) 0%, #0f172a 100%);
    color: #fff;
    display: flex;
    flex-direction: column;
    padding: 1.25rem;
    position: sticky;
    top: 0;
    min-height: 100vh;
    max-height: 100vh;
    overflow: hidden;
}

.admin-brand-wrap {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: .75rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(255,255,255,.08);
    margin-bottom: 1rem;
}

.admin-brand {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    min-width: 0;
}

.admin-brand img {
    width: 56px;
    height: 56px;
    object-fit: contain;
    background: rgba(255,255,255,.08);
    border-radius: 14px;
    padding: 8px;
}

.admin-brand-title {
    font-size: 1.05rem;
    font-weight: 700;
}

.admin-brand-subtitle {
    color: rgba(255,255,255,.65);
    font-size: .85rem;
}

.admin-sidebar-collapse {
    border: 1px solid rgba(255,255,255,.12);
    background: rgba(255,255,255,.06);
    color: #fff;
    width: 42px;
    height: 42px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    transition: all .2s ease;
}

.admin-sidebar-collapse:hover {
    background: rgba(255,255,255,.12);
    border-color: rgba(255,255,255,.18);
}

.admin-nav {
    display: flex;
    flex-direction: column;
    gap: .85rem;
    overflow-y: auto;
    padding-right: .25rem;
}

.admin-nav::-webkit-scrollbar {
    width: 8px;
}

.admin-nav::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,.12);
    border-radius: 999px;
}

.admin-nav-group {
    border: 1px solid rgba(255,255,255,.08);
    border-radius: 18px;
    background: rgba(255,255,255,.03);
    overflow: hidden;
}

.admin-nav-group[open] {
    background: rgba(255,255,255,.05);
    border-color: rgba(255,255,255,.12);
}

.admin-nav-group summary {
    list-style: none;
}

.admin-nav-group summary::-webkit-details-marker {
    display: none;
}

.admin-nav-group-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    padding: .9rem 1rem;
    cursor: pointer;
    user-select: none;
    color: rgba(255,255,255,.92);
    font-weight: 600;
}

.admin-nav-group-label {
    display: inline-flex;
    align-items: center;
    gap: .75rem;
    min-width: 0;
}

.admin-nav-group-label i,
.admin-nav-link i {
    width: 1.1rem;
    text-align: center;
    font-size: 1rem;
    flex: 0 0 1.1rem;
}

.admin-nav-group-chevron {
    color: rgba(255,255,255,.65);
    transition: transform .2s ease;
}

.admin-nav-group[open] .admin-nav-group-chevron {
    transform: rotate(180deg);
}

.admin-nav-group-items {
    display: flex;
    flex-direction: column;
    gap: .4rem;
    padding: 0 .75rem .8rem;
}

.admin-nav-link {
    display: flex;
    align-items: center;
    gap: .75rem;
    text-decoration: none;
    color: rgba(255,255,255,.88);
    border: 1px solid transparent;
    background: transparent;
    border-radius: 14px;
    padding: .75rem .85rem;
    transition: all .2s ease;
    min-width: 0;
}

.admin-nav-link span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.admin-nav-link:hover,
.admin-nav-link.active {
    color: #fff;
    background: rgba(255,255,255,.08);
    border-color: rgba(255,255,255,.08);
}

.admin-sidebar-footer {
    margin-top: auto;
    padding-top: 1rem;
    border-top: 1px solid rgba(255,255,255,.08);
}

.admin-mini-list {
    margin: .5rem 0 0;
    padding-left: 1rem;
    color: rgba(255,255,255,.78);
}

.admin-main {
    flex: 1;
    min-width: 0;
}

.admin-topbar {
    background: var(--admin-surface);
    border-bottom: 1px solid var(--admin-border);
    padding: 1.25rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.admin-topbar h1 {
    font-size: 1.45rem;
    margin: 0;
    font-weight: 700;
}

.admin-topbar p {
    margin: .25rem 0 0;
    color: var(--admin-muted);
}

.admin-topbar-actions {
    display: flex;
    gap: .75rem;
    flex-wrap: wrap;
}

.admin-content {
    padding: 1.5rem;
}

.admin-card {
    background: var(--admin-surface);
    border: 1px solid var(--admin-border);
    border-radius: 20px;
    padding: 1.25rem;
    box-shadow: 0 10px 30px rgba(15, 23, 42, .04);
}

.stat-card {
    min-height: 150px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.stat-label {
    font-size: .85rem;
    color: var(--admin-muted);
    text-transform: uppercase;
    letter-spacing: .08em;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    margin: .3rem 0;
}

.stat-hint {
    color: var(--admin-muted);
}

.table code {
    font-size: .82rem;
}

.form-text code {
    color: inherit;
}

@media (max-width: 991.98px) {
    .admin-shell {
        flex-direction: column;
    }

    .admin-sidebar {
        width: 100%;
        min-height: auto;
        max-height: none;
        position: static;
        overflow: visible;
    }

    .admin-nav {
        overflow: visible;
    }

    .admin-topbar {
        padding: 1rem;
        flex-direction: column;
        align-items: flex-start;
    }

    .admin-content {
        padding: 1rem;
    }
}

.admin-pre{white-space:pre-wrap;word-break:break-word;max-height:540px;overflow:auto;background:#0f172a;color:#e2e8f0;padding:16px;border-radius:14px;margin:0}.session-timeline{display:flex;flex-direction:column;gap:12px}.timeline-item{border:1px solid rgba(15,23,42,.08);border-radius:16px;padding:14px}.timeline-user{background:#f8fafc}.timeline-assistant{background:#eff6ff}.timeline-head{display:flex;justify-content:space-between;gap:12px;margin-bottom:8px;font-size:.9rem;color:#475569}.timeline-body{white-space:pre-wrap;word-break:break-word}

.summary-stack{display:flex;flex-direction:column;gap:10px}.summary-row{display:flex;justify-content:space-between;gap:16px;padding:10px 0;border-bottom:1px dashed var(--admin-border)}.summary-row:last-child{border-bottom:0;padding-bottom:0}.metric-line{display:flex;justify-content:space-between;gap:14px;padding:10px 0;border-bottom:1px dashed var(--admin-border)}.metric-line:last-child{border-bottom:0;padding-bottom:0}.trend-legend{display:flex;gap:16px;flex-wrap:wrap;color:var(--admin-muted);font-size:.92rem}.legend-dot{display:inline-block;width:10px;height:10px;border-radius:999px;margin-right:6px}.legend-dot.sessions,.trend-bar.sessions{background:#2563eb}.legend-dot.contacts,.trend-bar.contacts{background:#059669}.legend-dot.audit,.trend-bar.audit{background:#7c3aed}.trend-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(16px,1fr));gap:8px;align-items:end;min-height:260px}.trend-col{display:flex;flex-direction:column;align-items:center;gap:8px;min-width:0}.trend-bars{height:220px;width:100%;display:flex;align-items:flex-end;justify-content:center;gap:3px;border-radius:12px;background:linear-gradient(180deg,#f8fafc 0%, #eef2ff 100%);padding:8px 4px}.trend-bar{width:30%;min-height:8px;border-radius:999px 999px 4px 4px}.trend-label{font-size:.75rem;color:var(--admin-muted)}
