/* Admin Dashboard — Enterprise UI */
:root {
    --admin-header-h: 60px;
    --admin-sidebar-w: 268px;
    --admin-sidebar-collapsed: 76px;
    --kpi-blue: #2563eb;
    --kpi-blue-bg: linear-gradient(135deg, #dbeafe 0%, #eff6ff 100%);
    --kpi-green: #059669;
    --kpi-green-bg: linear-gradient(135deg, #d1fae5 0%, #ecfdf5 100%);
    --kpi-amber: #d97706;
    --kpi-amber-bg: linear-gradient(135deg, #fef3c7 0%, #fffbeb 100%);
    --kpi-red: #dc2626;
    --kpi-red-bg: linear-gradient(135deg, #fee2e2 0%, #fef2f2 100%);
    --kpi-purple: #7c3aed;
    --kpi-purple-bg: linear-gradient(135deg, #ede9fe 0%, #f5f3ff 100%);
    --kpi-teal: #0d9488;
    --kpi-teal-bg: linear-gradient(135deg, #ccfbf1 0%, #f0fdfa 100%);
    --kpi-indigo: #4f46e5;
    --kpi-indigo-bg: linear-gradient(135deg, #e0e7ff 0%, #eef2ff 100%);
}

[data-theme="dark"] {
    --glc-bg: #0b1220;
    --glc-navy: #111827;
    --glc-text: #f1f5f9;
    --glc-text-secondary: #94a3b8;
    --glc-border: #1f2937;
    --kpi-blue-bg: linear-gradient(135deg, #1e3a5f 0%, #172554 100%);
    --kpi-green-bg: linear-gradient(135deg, #064e3b 0%, #022c22 100%);
    --kpi-amber-bg: linear-gradient(135deg, #78350f 0%, #451a03 100%);
    --kpi-red-bg: linear-gradient(135deg, #7f1d1d 0%, #450a0a 100%);
    --kpi-purple-bg: linear-gradient(135deg, #4c1d95 0%, #2e1065 100%);
    --kpi-teal-bg: linear-gradient(135deg, #134e4a 0%, #042f2e 100%);
    --kpi-indigo-bg: linear-gradient(135deg, #312e81 0%, #1e1b4b 100%);
}

[data-theme="dark"] .card,
[data-theme="dark"] .table,
[data-theme="dark"] .modal-content,
[data-theme="dark"] .dash-activity-card {
    background: #111827;
    color: #f1f5f9;
    border-color: #1f2937;
}

.admin-shell { min-height: 100vh; background: var(--glc-bg); }

/* ── Header ── */
.admin-header {
    position: sticky;
    top: 0;
    z-index: 1030;
    height: var(--admin-header-h);
    background: linear-gradient(90deg, #0a2540 0%, #1e3a5f 55%, #0f2744 100%);
    border-bottom: none;
    box-shadow: 0 4px 24px rgba(10, 37, 64, 0.18);
}

.admin-header .brand {
    font-weight: 800;
    color: #fff;
    font-size: 1.05rem;
    letter-spacing: -0.02em;
}

.admin-header .brand i { color: #60a5fa; }

/* Portal brand (admin + member headers) */
.portal-brand {
    display: inline-flex;
    align-items: center;
    gap: 0.625rem;
    text-decoration: none;
    flex-shrink: 0;
    min-width: 0;
}

.portal-brand-icon {
    width: 34px;
    height: 34px;
    border-radius: 9px;
    overflow: hidden;
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.96);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.25);
}

.portal-brand-icon-img {
    width: auto;
    height: 100%;
    min-width: 100%;
    object-fit: cover;
    object-position: left center;
    display: block;
}

.portal-brand-mark {
    flex-shrink: 0;
    width: 34px;
    height: 34px;
    border-radius: 9px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    background: rgba(255, 255, 255, 0.12) !important;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.portal-brand-mark::after {
    background: #60a5fa !important;
}

.portal-brand-body {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
    line-height: 1.2;
    min-width: 0;
}

.portal-brand-name {
    color: #fff;
    font-family: var(--font-display, 'Manrope', sans-serif);
    font-weight: 700;
    font-size: 0.9375rem;
    letter-spacing: -0.02em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.portal-brand-role {
    font-size: 0.625rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: rgba(255, 255, 255, 0.5);
    line-height: 1;
}

.portal-brand--light .portal-brand-name {
    color: #0a2540;
}

.portal-brand--light .portal-brand-role {
    color: rgba(10, 37, 64, 0.5);
}

.portal-menu-btn {
    color: rgba(255, 255, 255, 0.88) !important;
}

.portal-menu-btn:hover {
    color: #fff !important;
}

.sidebar-portal-logo {
    padding: 0.85rem 0.75rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    margin-bottom: 0.35rem;
}

.sidebar-portal-logo .portal-brand-icon,
.sidebar-portal-logo .portal-brand-mark {
    width: 32px;
    height: 32px;
    border-radius: 8px;
}

.sidebar-portal-logo .portal-brand-name {
    font-size: 0.875rem;
}

.admin-sidebar.collapsed .sidebar-portal-logo .portal-brand-body {
    display: none;
}

.admin-sidebar.collapsed .sidebar-portal-logo .portal-brand {
    justify-content: center;
}

.admin-header .btn-link { color: rgba(255,255,255,0.85) !important; }
.admin-header .form-control {
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.15);
    color: #fff;
}
.admin-header .form-control::placeholder { color: rgba(255,255,255,0.5); }
.admin-header #theme-toggle {
    border-color: rgba(255,255,255,0.25);
    color: #fff;
}
.admin-header .dropdown-toggle {
    background: rgba(255,255,255,0.12);
    border-color: rgba(255,255,255,0.2);
    color: #fff;
}

.admin-layout { display: flex; min-height: calc(100vh - var(--admin-header-h)); }

/* ── Sidebar ── */
.admin-sidebar {
    width: var(--admin-sidebar-w);
    flex-shrink: 0;
    background: linear-gradient(180deg, #0a2540 0%, #0f172a 100%);
    min-height: 100%;
    transition: width 0.2s ease;
    overflow-y: auto;
    border-right: 1px solid rgba(255,255,255,0.06);
}

.admin-sidebar.collapsed { width: var(--admin-sidebar-collapsed); }
.admin-sidebar.collapsed .nav-text,
.admin-sidebar.collapsed .sidebar-section-title,
.admin-sidebar.collapsed .sidebar-brand-text { display: none; }

.sidebar-brand-text {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: rgba(255,255,255,0.45);
}

.admin-sidebar .nav-link {
    color: rgba(255,255,255,0.65);
    border-radius: 8px;
    margin: 2px 0.65rem;
    padding: 0.55rem 0.85rem;
    font-size: 0.8125rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.65rem;
    transition: all 0.18s ease;
}

.admin-sidebar .nav-link i { font-size: 1.05rem; width: 1.25rem; text-align: center; }

.admin-sidebar .nav-link:hover {
    background: rgba(255,255,255,0.07);
    color: #fff;
    transform: translateX(2px);
}

.admin-sidebar .nav-link.active {
    background: linear-gradient(90deg, rgba(37,99,235,0.35) 0%, rgba(37,99,235,0.12) 100%);
    color: #fff;
    box-shadow: inset 3px 0 0 #3b82f6;
}

.sidebar-section-title {
    font-size: 0.62rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: rgba(255,255,255,0.32);
    padding: 1.1rem 1rem 0.4rem;
    font-weight: 700;
}

.admin-main {
    flex: 1;
    min-width: 0;
    padding: 1.5rem 2rem 2.5rem;
    background: var(--glc-bg);
}

.admin-main h2 {
    font-size: 1.65rem;
    background: linear-gradient(135deg, var(--glc-navy) 0%, #334155 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

[data-theme="dark"] .admin-main h2 {
    background: linear-gradient(135deg, #fff 0%, #94a3b8 100%);
    -webkit-background-clip: text;
    background-clip: text;
}

/* ── Dashboard hero ── */
.dash-hero {
    background: linear-gradient(135deg, #0a2540 0%, #1e40af 50%, #2563eb 100%);
    border-radius: 14px;
    padding: 1.35rem 1.5rem;
    color: #fff;
    margin-bottom: 1.5rem;
    box-shadow: 0 8px 32px rgba(37, 99, 235, 0.22);
    position: relative;
    overflow: hidden;
}

.dash-hero::after {
    content: '';
    position: absolute;
    right: -20px;
    top: -20px;
    width: 140px;
    height: 140px;
    background: rgba(255,255,255,0.06);
    border-radius: 50%;
}

.dash-hero-title { font-size: 1.15rem; font-weight: 800; margin-bottom: 0.2rem; }
.dash-hero-sub { opacity: 0.85; font-size: 0.875rem; margin: 0; }
.dash-hero-date {
    font-size: 0.75rem;
    opacity: 0.7;
    margin-top: 0.5rem;
}

.dash-hero-icon {
    width: 52px;
    height: 52px;
    border-radius: 12px;
    background: rgba(255,255,255,0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

/* ── Quick actions toolbar ── */
.quick-actions-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1.75rem;
    padding: 0.85rem 1rem;
    background: #fff;
    border: 1px solid var(--glc-border);
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
}

[data-theme="dark"] .quick-actions-bar { background: #111827; }

.qa-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-size: 0.8125rem;
    font-weight: 600;
    text-decoration: none;
    border: none;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.qa-btn:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,0,0,0.12); color: #fff; }
.qa-btn i { font-size: 0.95rem; }

.qa-btn-primary { background: linear-gradient(135deg, #2563eb, #1d4ed8); color: #fff; }
.qa-btn-warning { background: linear-gradient(135deg, #f59e0b, #d97706); color: #fff; }
.qa-btn-info { background: linear-gradient(135deg, #0ea5e9, #0284c7); color: #fff; }
.qa-btn-success { background: linear-gradient(135deg, #10b981, #059669); color: #fff; }
.qa-btn-secondary { background: #f1f5f9; color: #475569; border: 1px solid #e2e8f0; }
[data-theme="dark"] .qa-btn-secondary { background: #1f2937; color: #e2e8f0; border-color: #374151; }

/* ── Unified panels ── */
.dash-panel {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    box-shadow: 0 1px 4px rgba(15, 23, 42, 0.05);
    overflow: hidden;
}

[data-theme="dark"] .dash-panel {
    background: #111827;
    border-color: #1f2937;
}

.dash-panel-head {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 1rem 1.25rem;
    background: linear-gradient(90deg, #f8fafc 0%, #fff 100%);
    border-bottom: 1px solid #eef2f6;
}

[data-theme="dark"] .dash-panel-head {
    background: linear-gradient(90deg, #1f2937 0%, #111827 100%);
    border-bottom-color: #1f2937;
}

.dash-panel-title {
    font-size: 0.95rem;
    font-weight: 800;
    color: #0f172a;
    margin: 0;
    letter-spacing: -0.01em;
}

[data-theme="dark"] .dash-panel-title { color: #f1f5f9; }

.dash-panel-desc {
    font-size: 0.75rem;
    color: #64748b;
    margin: 0.1rem 0 0;
}

.dash-panel-body { padding: 1.15rem 1.25rem 1.25rem; }

.dash-panel-system .dash-panel-body { padding: 0; }

/* ── Icon overview board (Team / Package / Activity) ── */
.dash-icon-board {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

@media (max-width: 991.98px) {
    .dash-icon-board { grid-template-columns: 1fr; }
}

.dash-icon-section {
    background: #fff;
    border: 1px solid #e8edf2;
    border-radius: 12px;
    padding: 1rem 1.1rem 1.15rem;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
    height: 100%;
}

[data-theme="dark"] .dash-icon-section {
    background: #111827;
    border-color: #1f2937;
}

.dash-icon-section-title {
    font-size: 0.9375rem;
    font-weight: 800;
    color: #0f172a;
    margin: 0 0 0.85rem;
    padding-bottom: 0.65rem;
    border-bottom: 2px solid #e8edf2;
    letter-spacing: -0.02em;
}

[data-theme="dark"] .dash-icon-section-title {
    color: #f8fafc;
    border-bottom-color: #1f2937;
}

.dash-icon-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.dash-icon-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.55rem 0.65rem;
    border-radius: 10px;
    text-decoration: none;
    color: inherit;
    transition: background 0.15s ease, transform 0.15s ease;
}

.dash-icon-item:hover {
    background: #f1f5f9;
    transform: translateX(2px);
}

[data-theme="dark"] .dash-icon-item:hover {
    background: #1e293b;
}

.dash-icon-emoji {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
    line-height: 1;
    background: linear-gradient(145deg, #f8fafc 0%, #eef2ff 100%);
    border-radius: 10px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8), 0 1px 3px rgba(15, 23, 42, 0.06);
}

[data-theme="dark"] .dash-icon-emoji {
    background: linear-gradient(145deg, #1e293b 0%, #0f172a 100%);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.dash-icon-body {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.dash-icon-label {
    font-size: 0.8125rem;
    font-weight: 600;
    color: #334155;
    line-height: 1.3;
}

[data-theme="dark"] .dash-icon-label {
    color: #cbd5e1;
}

.dash-icon-value {
    font-size: 0.8125rem;
    font-weight: 700;
    color: #0f172a;
    white-space: nowrap;
    flex-shrink: 0;
}

[data-theme="dark"] .dash-icon-value {
    color: #f1f5f9;
}

.dash-icon-value.is-status-ok { color: #059669; }
.dash-icon-value.is-status-warn { color: #d97706; }
.dash-icon-value.is-status-neutral { color: #64748b; }

.dash-icon-skeleton {
    height: 42px;
    border-radius: 10px;
    background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
    background-size: 200% 100%;
    animation: kpi-shimmer 1.2s infinite;
}

[data-theme="dark"] .dash-icon-skeleton {
    background: linear-gradient(90deg, #1e293b 25%, #334155 50%, #1e293b 75%);
    background-size: 200% 100%;
}

/* ── Fixed-column KPI grids ── */
.kpi-grid {
    display: grid;
    gap: 0.85rem;
}

.kpi-grid-3 { grid-template-columns: repeat(3, 1fr); }
.kpi-grid-4 { grid-template-columns: repeat(4, 1fr); }
.kpi-grid-5 { grid-template-columns: repeat(5, 1fr); }

@media (max-width: 1199.98px) {
    .kpi-grid-5 { grid-template-columns: repeat(3, 1fr); }
    .kpi-grid-4 { grid-template-columns: repeat(2, 1fr); }
    .kpi-grid-3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 575.98px) {
    .kpi-grid-5,
    .kpi-grid-4,
    .kpi-grid-3 { grid-template-columns: 1fr; }
}

/* ── KPI cards ── */
.kpi-card {
    background: #fff;
    border: 1px solid #e8edf2;
    border-radius: 10px;
    padding: 1rem 1.1rem;
    box-shadow: none;
    transition: box-shadow 0.18s ease;
    position: relative;
    overflow: hidden;
    height: 100%;
    min-height: 96px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

[data-theme="dark"] .kpi-card {
    background: #0f172a;
    border-color: #1e293b;
}

.kpi-card-compact {
    min-height: 88px;
    padding: 0.9rem 1rem;
}

.kpi-card-compact .kpi-value { font-size: 1.35rem; }
.kpi-card-compact .kpi-icon { width: 38px; height: 38px; font-size: 1rem; }

.kpi-card:hover {
    transform: none;
    box-shadow: 0 4px 16px rgba(15, 23, 42, 0.08);
}

/* ── System health strip ── */
.system-status-strip {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 0;
}

.sys-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.15rem;
    border-right: 1px solid #eef2f6;
    min-height: 80px;
}

[data-theme="dark"] .sys-item { border-right-color: #1f2937; }

.sys-item:last-child { border-right: none; }

.sys-item-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
}

.sys-item-icon.primary { background: var(--kpi-blue-bg); color: var(--kpi-blue); }
.sys-item-icon.success { background: var(--kpi-green-bg); color: var(--kpi-green); }
.sys-item-icon.teal { background: var(--kpi-teal-bg); color: var(--kpi-teal); }
.sys-item-icon.indigo { background: var(--kpi-indigo-bg); color: var(--kpi-indigo); }

.sys-item-label {
    font-size: 0.62rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #64748b;
    margin-bottom: 0.2rem;
    line-height: 1.2;
}

.sys-item-value { line-height: 1.2; }

.sys-value-text {
    font-size: 0.85rem;
    font-weight: 700;
    color: #0f172a;
}

[data-theme="dark"] .sys-value-text { color: #f1f5f9; }

.sys-skeleton {
    height: 80px;
    background: linear-gradient(90deg, #e2e8f0 25%, #f8fafc 50%, #e2e8f0 75%);
    background-size: 200% 100%;
    animation: kpi-shimmer 1.2s infinite;
}

@media (max-width: 1199.98px) {
    .system-status-strip { grid-template-columns: repeat(3, 1fr); }
    .sys-item:nth-child(3) { border-right: none; }
    .sys-item { border-bottom: 1px solid #eef2f6; }
}

@media (max-width: 575.98px) {
    .system-status-strip { grid-template-columns: 1fr; }
    .sys-item { border-right: none; }
}

/* ── Charts fixed height ── */
.chart-card-fixed {
    height: 100%;
    min-height: 260px;
    display: flex;
    flex-direction: column;
}

.chart-wrap {
    flex: 1;
    position: relative;
    min-height: 200px;
}

.chart-wrap canvas {
    position: absolute;
    inset: 0;
    width: 100% !important;
    height: 100% !important;
}

/* remove old scattered section styles */
.dashboard-section { margin-bottom: 0; }
.dashboard-section-header { display: none; }

.section-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.05rem;
    color: #fff;
    flex-shrink: 0;
}

.section-icon.members { background: linear-gradient(135deg, #3b82f6, #2563eb); }
.section-icon.sales { background: linear-gradient(135deg, #10b981, #059669); }
.section-icon.income { background: linear-gradient(135deg, #8b5cf6, #7c3aed); }
.section-icon.binary { background: linear-gradient(135deg, #06b6d4, #0891b2); }
.section-icon.system { background: linear-gradient(135deg, #6366f1, #4f46e5); }
.section-icon.charts { background: linear-gradient(135deg, #ec4899, #db2777); }

.kpi-card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    border-radius: 10px 0 0 10px;
}

.kpi-card.primary::before { background: var(--kpi-blue); }
.kpi-card.success::before { background: var(--kpi-green); }
.kpi-card.warning::before { background: var(--kpi-amber); }
.kpi-card.danger::before { background: var(--kpi-red); }
.kpi-card.purple::before { background: var(--kpi-purple); }
.kpi-card.teal::before { background: var(--kpi-teal); }
.kpi-card.indigo::before { background: var(--kpi-indigo); }

.kpi-card .kpi-label {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #64748b;
    margin-bottom: 0.4rem;
    line-height: 1.3;
}

.kpi-card .kpi-value {
    font-size: 1.55rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: #0f172a;
    line-height: 1.15;
}

[data-theme="dark"] .kpi-card .kpi-value { color: #f8fafc; }

.kpi-card .kpi-icon {
    width: 44px;
    height: 44px;
    border-radius: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.kpi-card.primary .kpi-icon { background: var(--kpi-blue-bg); color: var(--kpi-blue); }
.kpi-card.success .kpi-icon { background: var(--kpi-green-bg); color: var(--kpi-green); }
.kpi-card.warning .kpi-icon { background: var(--kpi-amber-bg); color: var(--kpi-amber); }
.kpi-card.danger .kpi-icon { background: var(--kpi-red-bg); color: var(--kpi-red); }
.kpi-card.purple .kpi-icon { background: var(--kpi-purple-bg); color: var(--kpi-purple); }
.kpi-card.teal .kpi-icon { background: var(--kpi-teal-bg); color: var(--kpi-teal); }
.kpi-card.indigo .kpi-icon { background: var(--kpi-indigo-bg); color: var(--kpi-indigo); }

.kpi-status {
    display: inline-block;
    margin-top: 0.35rem;
    padding: 0.15rem 0.55rem;
    border-radius: 999px;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
}

.kpi-status.ok { background: #d1fae5; color: #065f46; }
.kpi-status.warn { background: #fef3c7; color: #92400e; }
.kpi-status.bad { background: #fee2e2; color: #991b1b; }
.kpi-status.neutral { background: #e2e8f0; color: #475569; }

.kpi-skeleton {
    background: linear-gradient(90deg, #e2e8f0 25%, #f8fafc 50%, #e2e8f0 75%);
    background-size: 200% 100%;
    animation: kpi-shimmer 1.2s infinite;
    border-radius: 8px;
    height: 2rem;
    width: 75%;
}

@keyframes kpi-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.kpi-card.kpi-animate {
    animation: kpiFadeUp 0.45s ease both;
}

@keyframes kpiFadeUp {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ── Charts ── */
.chart-card {
    background: #fff;
    border: 1px solid #e8edf2;
    border-radius: 12px;
    padding: 1.15rem 1.25rem;
    margin-bottom: 0;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
    height: 100%;
}

[data-theme="dark"] .chart-card { background: #111827; border-color: #1f2937; }

.chart-card-header {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    margin-bottom: 0.85rem;
    padding-bottom: 0.65rem;
    border-bottom: 1px solid #f1f5f9;
}

[data-theme="dark"] .chart-card-header { border-bottom-color: #1f2937; }

.chart-card-header i {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    color: #fff;
}

.chart-card-header h6 {
    margin: 0;
    font-size: 0.875rem;
    font-weight: 700;
    color: #0f172a;
}

[data-theme="dark"] .chart-card-header h6 { color: #f1f5f9; }

.chart-icon-blue { background: linear-gradient(135deg, #3b82f6, #2563eb); }
.chart-icon-green { background: linear-gradient(135deg, #10b981, #059669); }
.chart-icon-purple { background: linear-gradient(135deg, #8b5cf6, #7c3aed); }
.chart-icon-pink { background: linear-gradient(135deg, #ec4899, #db2777); }
.chart-icon-amber { background: linear-gradient(135deg, #f59e0b, #d97706); }
.chart-icon-teal { background: linear-gradient(135deg, #14b8a6, #0d9488); }
.chart-icon-indigo { background: linear-gradient(135deg, #6366f1, #4f46e5); }
.chart-icon-red { background: linear-gradient(135deg, #f43f5e, #e11d48); }

/* ── Activity table ── */
.dash-activity-card {
    border: 1px solid #e8edf2;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
    background: #fff;
}

.dash-activity-card .card-header {
    background: linear-gradient(90deg, #f8fafc 0%, #fff 100%);
    border-bottom: 1px solid #e8edf2;
    padding: 0.85rem 1.25rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.dash-activity-card .card-header i { color: #2563eb; }

.dash-activity-card .table thead th {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #64748b;
    font-weight: 700;
    background: #f8fafc;
    border-bottom: 1px solid #e8edf2;
}

.activity-badge {
    display: inline-block;
    padding: 0.2rem 0.55rem;
    border-radius: 6px;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    background: #dbeafe;
    color: #1d4ed8;
}

.status-badge-healthy { color: var(--kpi-green); font-weight: 700; }
.status-badge-warning { color: var(--kpi-amber); font-weight: 700; }
.status-badge-error { color: var(--kpi-red); font-weight: 700; }

.admin-toast-container {
    position: fixed;
    top: calc(var(--admin-header-h) + 12px);
    right: 16px;
    z-index: 9999;
}

@media (max-width: 991.98px) {
    .admin-sidebar {
        position: fixed;
        left: 0;
        top: var(--admin-header-h);
        height: calc(100vh - var(--admin-header-h));
        z-index: 1020;
        transform: translateX(-100%);
        box-shadow: 4px 0 24px rgba(0,0,0,0.2);
    }
    .admin-sidebar.show { transform: translateX(0); }
    .admin-main { padding: 1rem; }
    .kpi-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 575.98px) {
    .kpi-grid { grid-template-columns: 1fr; }
    .quick-actions-bar { flex-direction: column; }
    .qa-btn { justify-content: center; }
}

/* ── Table action icons ── */
.admin-action-icons {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.35rem;
    flex-wrap: nowrap;
}

.admin-action-form {
    display: inline-flex;
    margin: 0;
}

.admin-action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    background: #fff;
    color: #475569;
    font-size: 0.9375rem;
    line-height: 1;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.admin-action-btn:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
    color: #1e293b;
}

.admin-action-btn-fund:hover {
    background: #ecfdf5;
    border-color: #6ee7b7;
    color: #059669;
}

.admin-action-btn-impersonate:hover {
    background: #eff6ff;
    border-color: #93c5fd;
    color: #2563eb;
}

[data-theme="dark"] .admin-action-btn {
    background: #1f2937;
    border-color: #374151;
    color: #cbd5e1;
}

[data-theme="dark"] .admin-action-btn:hover {
    background: #374151;
    border-color: #4b5563;
    color: #f8fafc;
}
