/* ========================================
   BuildPro AI — Super Admin Dashboard
   Light Mode Default + Optional Dark Mode
   (Matches orders/dashboard design system)
   ======================================== */

/* ---------- ROOT VARIABLES (LIGHT MODE) ---------- */
:root {
    /* Base colors — light mode */
    --bg-base: var(--sys-bg, #ebebeb);
    --bg-surface: #ffffff;
    --bg-card: #f7f9fc;
    --bg-card-hover: #eef2f7;
    --bg-input: #ffffff;
    --bg-sidebar: #ffffff;
    --bg-topbar: rgba(238, 242, 247, 0.92);

    /* Text — dark on light */
    --text-primary: #4f4a54;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --text-inverse: #f1f5f9;

    /* Accent colors (matching styles.css) */
    --neon-blue: #7c3aed;
    --neon-purple: #8b5cf6;
    --neon-green: #10b981;
    --neon-orange: #f59e0b;
    --neon-pink: #ec4899;
    --neon-cyan: #06b6d4;
    --neon-red: #ef4444;

    /* Card styling */
    --card-bg: #f7f9fc;
    --card-border: #e0e6ed;
    --card-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);

    /* Borders & Radius */
    --border-color: #e0e6ed;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;

    /* Sizes */
    --sidebar-w: 260px;
    --sidebar-collapsed: 72px;
    --topbar-h: 64px;

    /* Fonts */
    --font-primary: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-display: 'Space Grotesk', 'Inter', sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.25s ease;
    --transition-smooth: 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ---------- DARK MODE OVERRIDES ---------- */
body.dark {
    --bg-base: #3a363f;
    --bg-surface: #4f4a54;
    --bg-card: rgba(30, 41, 59, 0.55);
    --bg-card-hover: rgba(30, 41, 59, 0.75);
    --bg-input: rgba(15, 23, 42, 0.7);
    --bg-sidebar: #4f4a54;
    --bg-topbar: rgba(10, 15, 30, 0.85);
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --text-inverse: #4f4a54;
    --card-bg: rgba(30, 41, 59, 0.55);
    --card-border: rgba(148, 163, 184, 0.1);
    --card-shadow: 0 4px 24px rgba(0, 0, 0, 0.25);
    --border-color: rgba(148, 163, 184, 0.1);
}

/* ---------- RESET ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; scroll-behavior: smooth; }
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-base);
    color: var(--text-primary);
    display: flex;
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { cursor: pointer; font-family: inherit; }
input, select, textarea { font-family: inherit; }
table { border-collapse: collapse; width: 100%; }

/* ---------- CUSTOM SCROLLBAR ---------- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.12); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(0,0,0,0.2); }
body.dark ::-webkit-scrollbar-thumb { background: rgba(148,163,184,0.2); }
body.dark ::-webkit-scrollbar-thumb:hover { background: rgba(148,163,184,0.35); }

/* ============= SIDEBAR ============== */
.admin-sidebar {
    position: fixed;
    left: 0; top: 0; bottom: 0;
    width: var(--sidebar-w);
    background: #f6f7f8;
    border-right: 1px solid #d9dde3;
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: width var(--transition-smooth);
    overflow: hidden;
    box-shadow: none;
}
body.dark .admin-sidebar { background: #4f4a54; border-right-color: #635e69; }
.admin-sidebar.collapsed { width: var(--sidebar-collapsed); }
.admin-sidebar.collapsed .brand-text,
.admin-sidebar.collapsed .nav-item span,
.admin-sidebar.collapsed .nav-badge,
.admin-sidebar.collapsed .nav-group-title,
.admin-sidebar.collapsed .admin-info { display: none; }
.admin-sidebar.collapsed .sidebar-brand { justify-content: center; }
.admin-sidebar.collapsed .nav-item { justify-content: center; padding: 10px; }

/* Brand */
.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px 20px 16px;
    border-bottom: 1px solid var(--border-color);
}
.brand-icon {
    width: 36px; height: 36px;
    background: linear-gradient(135deg, var(--neon-blue), var(--neon-purple));
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    color: #fff;
    flex-shrink: 0;
}
.brand-name {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.15rem;
    color: var(--text-primary);
}
.brand-badge {
    display: inline-block;
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 1.5px;
    color: var(--neon-blue);
    background: rgba(124,58,237,0.1);
    padding: 2px 6px;
    border-radius: 4px;
    margin-top: 2px;
}

/* Nav */
.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 12px 10px;
}
.nav-group { margin-bottom: 8px; }
.nav-group-title {
    display: block;
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--text-muted);
    padding: 12px 12px 6px;
}
.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 14px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    transition: all var(--transition-fast);
    position: relative;
    white-space: nowrap;
}
.nav-item:hover { color: var(--text-primary); background: rgba(124,58,237,0.06); }
body.dark .nav-item:hover { background: rgba(255,255,255,0.04); }
.nav-item.active {
    color: var(--neon-blue);
    background: rgba(124,58,237,0.1);
}
.nav-item.active::before {
    content: '';
    position: absolute;
    left: 0; top: 50%;
    transform: translateY(-50%);
    width: 3px; height: 20px;
    background: var(--neon-blue);
    border-radius: 0 3px 3px 0;
}
.nav-item i { width: 20px; height: 20px; flex-shrink: 0; }
.nav-badge {
    margin-left: auto;
    background: rgba(124,58,237,0.12);
    color: var(--neon-blue);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.7rem;
    font-weight: 600;
}

/* Sidebar Footer */
.sidebar-footer {
    border-top: 1px solid var(--border-color);
    padding: 12px 10px;
}
.admin-profile {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    margin-bottom: 4px;
}
.admin-avatar {
    width: 34px; height: 34px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--neon-blue), var(--neon-purple));
    display: flex; align-items: center; justify-content: center;
    color: #fff;
    font-weight: 700;
    font-size: 0.85rem;
    flex-shrink: 0;
}
.admin-name { font-weight: 600; font-size: 0.85rem; color: var(--text-primary); }
.admin-role { font-size: 0.7rem; color: var(--neon-blue); }
.admin-info { display: flex; flex-direction: column; }
.nav-back { color: var(--text-muted); font-size: 0.82rem; }

/* ============= MAIN AREA ============= */
.admin-main {
    margin-left: var(--sidebar-w);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: margin-left var(--transition-smooth);
}
.admin-sidebar.collapsed ~ .admin-main { margin-left: var(--sidebar-collapsed); }

/* ============= TOPBAR ============= */
.admin-topbar {
    position: sticky;
    top: 0;
    height: var(--topbar-h);
    background: var(--bg-topbar);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    z-index: 90;
    min-height: 64px;
}
.topbar-center {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    z-index: 2;
    display: flex;
    align-items: center;
}
.topbar-center a {
    display: flex;
    align-items: center;
    text-decoration: none;
    transition: opacity 0.2s ease;
}
.topbar-center a:hover {
    opacity: 0.85;
}
.topbar-logo {
    height: 42px;
    width: auto;
    display: block;
    object-fit: contain;
    filter: drop-shadow(0 1px 2px rgba(0,0,0,0.06));
}
.sidebar-brand .logo-img,
.logo-img {
    height: 38px;
    width: auto;
    max-width: 160px;
    display: block;
    object-fit: contain;
    filter: drop-shadow(0 1px 2px rgba(0,0,0,0.06));
}
body.dark .topbar-logo,
body.dark .logo-img {
    filter: brightness(1.1) drop-shadow(0 1px 3px rgba(0,0,0,0.3));
}
.topbar-left { display: flex; align-items: center; gap: 16px; }
.topbar-right { display: flex; align-items: center; gap: 8px; }
.topbar-toggle {
    background: none; border: none;
    color: var(--text-secondary);
    padding: 6px;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}
.topbar-toggle:hover { color: var(--text-primary); background: rgba(0,0,0,0.05); }
body.dark .topbar-toggle:hover { background: rgba(255,255,255,0.05); }

/* Search */
.topbar-search {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #ffffff;
    border: 1.5px solid #d0d7e0;
    border-radius: 10px;
    padding: 6px 12px;
    min-width: 300px;
    transition: all var(--transition-fast);
}
body.dark .topbar-search { background: rgba(15,23,42,0.7); border-color: #635e69; }
.topbar-search:focus-within {
    border-color: var(--neon-blue);
    box-shadow: 0 0 0 3px rgba(124,58,237,0.12);
}
.topbar-search input {
    background: none; border: none; outline: none;
    color: var(--text-primary);
    flex: 1;
    font-size: 0.85rem;
}
.topbar-search input::placeholder { color: var(--text-muted); }
.topbar-search kbd {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    color: var(--text-muted);
    background: rgba(0,0,0,0.04);
    padding: 2px 6px;
    border-radius: 4px;
    border: 1px solid var(--border-color);
}
body.dark .topbar-search kbd { background: rgba(255,255,255,0.06); }

/* Topbar buttons */
.topbar-btn, .topbar-notif {
    background: none; border: none;
    color: var(--text-secondary);
    padding: 8px;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
    position: relative;
}
.topbar-btn:hover, .topbar-notif:hover {
    color: var(--text-primary);
    background: rgba(0,0,0,0.05);
}
body.dark .topbar-btn:hover, body.dark .topbar-notif:hover { background: rgba(255,255,255,0.05); }
.topbar-indicator {
    display: flex; align-items: center; gap: 6px;
    font-size: 0.78rem; font-weight: 500;
    color: var(--text-secondary);
    padding: 6px 12px;
    background: rgba(16,185,129,0.08);
    border-radius: 20px;
    border: 1px solid rgba(16,185,129,0.15);
}
.indicator-dot {
    width: 7px; height: 7px;
    border-radius: 50%;
    animation: pulse 2s infinite;
}
.indicator-dot.success { background: var(--neon-green); box-shadow: 0 0 6px var(--neon-green); }
.indicator-dot.warning { background: var(--neon-orange); box-shadow: 0 0 6px var(--neon-orange); }
.indicator-dot.error { background: var(--neon-red); box-shadow: 0 0 6px var(--neon-red); }
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}
.notif-count {
    position: absolute;
    top: 2px; right: 2px;
    background: var(--neon-red);
    color: #fff;
    font-size: 0.6rem;
    font-weight: 700;
    width: 16px; height: 16px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
}

/* ============= CONTENT AREA ============= */
.admin-content { padding: 24px; }

/* ============= PANELS ============= */
.panel { display: none; animation: fadeSlideIn 0.35s ease; }
.panel.active { display: block; }
@keyframes fadeSlideIn {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}
.panel-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 36px;
    flex-wrap: wrap;
    gap: 12px;
}
.panel-title-row h1 {
    font-family: 'Inter', sans-serif;
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.3px;
}
.panel-subtitle {
    font-size: 0.78rem;
    color: var(--text-muted);
}
.panel-actions {
    display: flex; align-items: center; gap: 10px;
}
.filter-group { display: flex; gap: 8px; flex-wrap: wrap; }

/* ========== STAT CARDS — Reference Layout (matches orders.css) ========== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 0;
    margin-bottom: 24px;
    border: 1px solid #d9e1e8;
    border-radius: 16px;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 1px 4px rgba(15,23,42,0.04);
}
.stats-grid.stats-6 {
    grid-template-columns: repeat(6, 1fr);
}
.stat-card {
    background: transparent;
    border: 0;
    border-inline-start: 1px solid #e5ebf0;
    border-radius: 0;
    box-shadow: none;
    min-height: 92px;
    padding: 14px 16px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    position: relative;
    overflow: hidden;
    transition: none;
}
.stat-card:first-child {
    border-inline-start: 0;
}
.stat-card::before {
    content: '';
    position: absolute;
    bottom: 12px;
    left: 22px;
    right: 22px;
    height: 2px;
    width: auto;
    top: auto;
    background: linear-gradient(90deg, #93c5fd, #38bdf8);
    opacity: .9;
    border-radius: 999px;
}
.stat-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0;
}
.stat-card-label {
    font-size: 0.82rem;
    font-weight: 700;
    color: #3f3f46;
}
.stat-card-value {
    font-family: 'Inter', sans-serif;
    font-size: 1.35rem;
    font-weight: 800;
    color: #4f4a54;
    margin-bottom: 4px;
    line-height: 1.2;
}
.stat-card-icon {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: none;
    flex-shrink: 0;
}
.stat-card-icon i { width: 16px; height: 16px; }
.stat-card-icon.blue { background: rgba(59,130,246,0.1); color: #3b82f6; }
.stat-card-icon.purple { background: rgba(124,58,237,0.1); color: #7c3aed; }
.stat-card-icon.cyan { background: rgba(6,182,212,0.1); color: #06b6d4; }
.stat-card-icon.amber { background: rgba(245,158,11,0.1); color: #f59e0b; }
.stat-card-icon.green { background: rgba(16,185,129,0.1); color: #10b981; }
.stat-card-icon.red { background: rgba(239,68,68,0.1); color: #ef4444; }

.stat-card-change {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 0;
    border-radius: 0;
    background: transparent;
    font-size: 0.78rem;
    font-weight: 700;
}
.stat-card-change.positive { color: #16a34a; }
.stat-card-change.negative { color: #dc2626; }
.stat-card-change.neutral { color: #6b7280; }

/* Dark mode stats grid */
body.dark .stats-grid {
    background: #4f4a54;
    border-color: #635e69;
}
body.dark .stat-card {
    border-inline-start-color: rgba(148,163,184,0.10);
}
body.dark .stat-card-label { color: #cbd5e1; }
body.dark .stat-card-value { color: #f8fafc; }
body.dark .stat-card-change.positive { color: #34d399; }
body.dark .stat-card-change.negative { color: #f87171; }
body.dark .stat-card-change.neutral { color: #94a3b8; }
body.dark .stat-card-icon.blue { background: rgba(59,130,246,0.2); color: #60a5fa; }
body.dark .stat-card-icon.purple { background: rgba(124,58,237,0.2); color: #a78bfa; }
body.dark .stat-card-icon.cyan { background: rgba(6,182,212,0.2); color: #22d3ee; }
body.dark .stat-card-icon.amber { background: rgba(245,158,11,0.2); color: #fbbf24; }
body.dark .stat-card-icon.green { background: rgba(16,185,129,0.2); color: #34d399; }
body.dark .stat-card-icon.red { background: rgba(239,68,68,0.2); color: #f87171; }

@media (max-width: 1200px) {
    .stats-grid.stats-6 { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 768px) {
    .stats-grid.stats-6 { grid-template-columns: repeat(2, 1fr); }
}

/* ========== CHART CARDS ========== */
.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}
.chart-card {
    background: #fff;
    border: 1px solid #d9e1e8;
    border-radius: 16px;
    padding: 20px;
    transition: all var(--transition-normal);
    box-shadow: 0 1px 4px rgba(15,23,42,0.04);
}
.chart-card.full { grid-column: 1 / -1; }
.chart-card:hover { border-color: #c7d0db; }
body.dark .chart-card { background: #4f4a54; border-color: #635e69; }
body.dark .chart-card:hover { border-color: rgba(148,163,184,0.2); }
.chart-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}
.chart-header h3 {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
}
.chart-total {
    font-family: 'Inter', sans-serif;
    font-size: 1rem;
    font-weight: 700;
    color: #16a34a;
}
.chart-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 14px;
    justify-content: center;
}
.legend-item {
    display: flex; align-items: center; gap: 6px;
    font-size: 0.75rem;
    color: var(--text-secondary);
}
.legend-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}
.view-all {
    font-size: 0.78rem;
    color: var(--neon-blue);
    font-weight: 500;
    transition: opacity var(--transition-fast);
}
.view-all:hover { opacity: 0.8; }

/* ========== BOTTOM GRID ========== */
.bottom-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 20px;
}

/* ========== ACTIVITY FEED ========== */
.activity-feed { max-height: 300px; overflow-y: auto; }
.activity-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-color);
}
.activity-item:last-child { border-bottom: none; }
.activity-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    margin-top: 5px;
    flex-shrink: 0;
}
.activity-dot.create { background: var(--neon-green); }
.activity-dot.update { background: var(--neon-blue); }
.activity-dot.delete { background: var(--neon-red); }
.activity-dot.login { background: var(--neon-purple); }
.activity-text {
    font-size: 0.82rem;
    color: var(--text-secondary);
    line-height: 1.4;
}
.activity-text strong { color: var(--text-primary); font-weight: 600; }
.activity-time {
    font-size: 0.68rem;
    color: var(--text-muted);
    margin-top: 2px;
}

/* ========== WILAYAS LIST ========== */
.wilayas-list { display: flex; flex-direction: column; gap: 8px; }
.wilaya-row {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.82rem;
}
.wilaya-rank {
    width: 22px; height: 22px;
    border-radius: 6px;
    background: rgba(14,165,233,0.1);
    color: var(--neon-blue);
    display: flex; align-items: center; justify-content: center;
    font-size: 0.7rem;
    font-weight: 700;
}
.wilaya-name { flex: 1; color: var(--text-secondary); }
.wilaya-bar-bg {
    width: 80px; height: 6px;
    background: rgba(0,0,0,0.06);
    border-radius: 3px;
    overflow: hidden;
}
body.dark .wilaya-bar-bg { background: rgba(255,255,255,0.05); }
.wilaya-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--neon-blue), var(--neon-cyan));
    border-radius: 3px;
    transition: width 0.8s ease;
}
.wilaya-count {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--text-muted);
    min-width: 30px;
    text-align: right;
}

/* ========== ADMIN TABLE ========== */
.admin-table-wrap {
    overflow-x: auto;
    background: #fff;
    border: 1px solid #d9e1e8;
    border-radius: 16px;
    box-shadow: 0 1px 4px rgba(15,23,42,0.04);
}
body.dark .admin-table-wrap { background: #4f4a54; border-color: #635e69; }
.admin-table { width: 100%; }
.admin-table thead th {
    background: #f0f4f8;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: #64748b;
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}
body.dark .admin-table thead th { background: rgba(0,0,0,0.2); color: var(--text-muted); }
.admin-table tbody tr {
    border-bottom: 1px solid var(--border-color);
    transition: background var(--transition-fast);
}
.admin-table tbody tr:hover { background: #f0f6ff; }
body.dark .admin-table tbody tr:hover { background: rgba(255,255,255,0.02); }
.admin-table tbody tr:last-child { border-bottom: none; }
.admin-table td {
    padding: 12px 16px;
    font-size: 0.83rem;
    color: var(--text-secondary);
    white-space: nowrap;
}
.user-cell {
    display: flex; align-items: center; gap: 10px;
}
.user-cell-avatar {
    width: 32px; height: 32px;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--neon-blue), var(--neon-purple));
    display: flex; align-items: center; justify-content: center;
    color: #fff;
    font-weight: 700;
    font-size: 0.72rem;
    flex-shrink: 0;
}
.user-cell-name { font-weight: 600; color: var(--text-primary); }

/* Status badges */
.badge {
    display: inline-flex;
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 0.74rem;
    font-weight: 700;
    letter-spacing: 0.2px;
}
.badge-admin { background: #ede9fe; color: #5b21b6; border: 1px solid #ddd6fe; }
.badge-user { background: #dbeafe; color: #1d4ed8; border: 1px solid #bfdbfe; }
.badge-operator { background: #fef3c7; color: #b45309; border: 1px solid #fde68a; }
.badge-confirmer { background: #fce7f3; color: #be185d; border: 1px solid #fbcfe8; }
.badge-free { background: #f1f5f9; color: #475569; border: 1px solid #e2e8f0; }
.badge-pro { background: #dbeafe; color: #1d4ed8; border: 1px solid #bfdbfe; }
.badge-enterprise { background: #ede9fe; color: #5b21b6; border: 1px solid #ddd6fe; }
.badge-active { background: #d1fae5; color: #065f46; border: 1px solid #a7f3d0; }
.badge-inactive { background: #fee2e2; color: #b91c1c; border: 1px solid #fecaca; }
.badge-new { background: #dbeafe; color: #1d4ed8; border: 1px solid #bfdbfe; }
.badge-confirmed { background: #d1fae5; color: #065f46; border: 1px solid #a7f3d0; }
.badge-shipped { background: #ede9fe; color: #5b21b6; border: 1px solid #ddd6fe; }
.badge-delivered { background: #d1fae5; color: #047857; border: 1px solid #6ee7b7; }
.badge-cancelled { background: #f1f5f9; color: #475569; border: 1px solid #e2e8f0; }
.badge-returned { background: #fee2e2; color: #b91c1c; border: 1px solid #fecaca; }

/* Pagination */
.table-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 16px 0;
}
.page-btn {
    background: #fff;
    border: 1px solid #d9e1e8;
    color: var(--text-secondary);
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    font-size: 0.78rem;
    font-weight: 500;
    transition: all var(--transition-fast);
}
body.dark .page-btn { background: #4f4a54; border-color: #635e69; }
.page-btn:hover { color: var(--text-primary); border-color: var(--neon-blue); }
.page-btn.active {
    background: var(--neon-blue);
    border-color: var(--neon-blue);
    color: #fff;
}
.page-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ========== FORM ELEMENTS ========== */
.admin-input, .admin-select {
    background: #ffffff;
    border: 1.5px solid #d0d7e0;
    border-radius: 10px;
    color: var(--text-primary);
    padding: 8px 12px;
    font-size: 0.85rem;
    outline: none;
    transition: all var(--transition-fast);
}
body.dark .admin-input, body.dark .admin-select {
    background: rgba(15,23,42,0.7);
    border-color: #635e69;
}
.admin-input:focus, .admin-select:focus {
    border-color: var(--neon-blue);
    box-shadow: 0 0 0 3px rgba(124,58,237,0.12);
}
.admin-select {
    cursor: pointer;
    -webkit-appearance: none;
    padding-right: 28px;
    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='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
}
.admin-select option { background: var(--bg-surface); color: var(--text-primary); }
textarea.admin-input { resize: vertical; min-height: 60px; }

/* Buttons */
.admin-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 600;
    border: none;
    transition: all var(--transition-fast);
    white-space: nowrap;
}
.admin-btn.primary {
    background: linear-gradient(135deg, #7c3aed, #5b21b6);
    color: #fff;
}
.admin-btn.primary:hover {
    box-shadow: 0 4px 16px rgba(124,58,237,0.3);
    transform: translateY(-1px);
}
.admin-btn.outline {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
}
.admin-btn.outline:hover { border-color: var(--neon-blue); color: var(--neon-blue); }
.admin-btn.danger {
    background: rgba(239,68,68,0.15);
    color: var(--neon-red);
}
.admin-btn.danger:hover { background: rgba(239,68,68,0.25); }
.admin-btn.sm { padding: 5px 10px; font-size: 0.75rem; }

/* ========== TOGGLE SWITCH ========== */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 42px; height: 22px;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(148,163,184,0.2);
    border-radius: 22px;
    transition: var(--transition-fast);
}
.toggle-slider::before {
    content: '';
    position: absolute;
    width: 16px; height: 16px;
    left: 3px; bottom: 3px;
    background: #fff;
    border-radius: 50%;
    transition: var(--transition-fast);
}
.toggle-switch input:checked + .toggle-slider { background: var(--neon-blue); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(20px); }

/* ========== SETTINGS ========== */
.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
    gap: 20px;
}
.settings-card {
    background: #fff;
    border: 1px solid #d9e1e8;
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 1px 4px rgba(15,23,42,0.04);
}
body.dark .settings-card { background: #4f4a54; border-color: #635e69; }
.settings-card h3 {
    display: flex; align-items: center; gap: 8px;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}
.settings-field {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 0;
}
.settings-field label:first-child {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 500;
    white-space: nowrap;
}
.settings-field .admin-input,
.settings-field .admin-select {
    width: 180px;
}

/* ========== STORES GRID ========== */
.stores-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 16px;
}
.store-card {
    background: #fff;
    border: 1px solid #d9e1e8;
    border-radius: 16px;
    padding: 20px;
    transition: all var(--transition-normal);
    box-shadow: 0 1px 4px rgba(15,23,42,0.04);
}
.store-card:hover {
    border-color: #c7d0db;
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.06);
}
body.dark .store-card { background: #4f4a54; border-color: #635e69; }
body.dark .store-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,0.2); }
.store-header {
    display: flex; align-items: center; gap: 12px;
    margin-bottom: 14px;
}
.store-icon {
    width: 40px; height: 40px;
    border-radius: var(--radius-md);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.1rem;
}
.store-icon.shopify { background: rgba(16,185,129,0.12); color: var(--neon-green); }
.store-icon.woo { background: rgba(139,92,246,0.12); color: var(--neon-purple); }
.store-name { font-weight: 700; color: var(--text-primary); font-size: 0.95rem; }
.store-url { font-size: 0.75rem; color: var(--text-muted); }
.store-meta { display: flex; gap: 14px; flex-wrap: wrap; }
.store-stat {
    font-size: 0.78rem;
    color: var(--text-secondary);
}
.store-stat strong { color: var(--text-primary); }

/* ========== CARRIERS GRID ========== */
.carriers-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}
.carrier-card {
    background: #fff;
    border: 1px solid #d9e1e8;
    border-radius: 16px;
    padding: 20px;
    transition: all var(--transition-normal);
    box-shadow: 0 1px 4px rgba(15,23,42,0.04);
}
.carrier-card:hover { border-color: #c7d0db; }
body.dark .carrier-card { background: #4f4a54; border-color: #635e69; }
.carrier-name {
    font-weight: 700;
    font-size: 1rem;
    color: var(--text-primary);
    margin-bottom: 6px;
    text-transform: capitalize;
}
.carrier-info {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-bottom: 12px;
}
.carrier-stats { display: flex; gap: 16px; }
.carrier-stat-value {
    font-family: var(--font-display);
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-primary);
}
.carrier-stat-label { font-size: 0.68rem; color: var(--text-muted); }

/* ========== NOTIFICATIONS LIST ========== */
.notif-list { display: flex; flex-direction: column; gap: 10px; }
.notif-item {
    background: #fff;
    border: 1px solid #d9e1e8;
    border-radius: var(--radius-md);
    padding: 14px 18px;
    display: flex; align-items: flex-start; gap: 12px;
    transition: all var(--transition-fast);
    box-shadow: 0 1px 4px rgba(15,23,42,0.04);
}
body.dark .notif-item { background: #4f4a54; border-color: #635e69; }
.notif-item.unread { border-left: 3px solid var(--neon-blue); }
.notif-type-dot {
    width: 10px; height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
    margin-top: 4px;
}
.notif-type-dot.info { background: var(--neon-blue); }
.notif-type-dot.success { background: var(--neon-green); }
.notif-type-dot.warning { background: var(--neon-orange); }
.notif-type-dot.error { background: var(--neon-red); }
.notif-type-dot.system { background: var(--neon-purple); }
.notif-content { flex: 1; }
.notif-title { font-weight: 600; color: var(--text-primary); font-size: 0.88rem; margin-bottom: 2px; }
.notif-message { font-size: 0.78rem; color: var(--text-secondary); }
.notif-time { font-size: 0.68rem; color: var(--text-muted); margin-top: 4px; }

/* ========== SYSTEM HEALTH ========== */
.system-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px;
}
.system-card {
    background: #fff;
    border: 1px solid #d9e1e8;
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 1px 4px rgba(15,23,42,0.04);
}
body.dark .system-card { background: #4f4a54; border-color: #635e69; }
.system-card h4 {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-muted);
    margin-bottom: 12px;
}
.system-value {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 4px;
}
.system-detail {
    font-size: 0.75rem;
    color: var(--text-secondary);
}
.system-bar {
    width: 100%; height: 6px;
    background: rgba(0,0,0,0.06);
    border-radius: 3px;
    margin-top: 10px;
    overflow: hidden;
}
body.dark .system-bar { background: rgba(255,255,255,0.05); }
.system-bar-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.8s ease;
    background: linear-gradient(90deg, var(--neon-green), var(--neon-blue));
}
.system-bar-fill.warning { background: linear-gradient(90deg, var(--neon-orange), var(--neon-red)); }

/* ========== FUNNEL CHART ========== */
.funnel-chart {
    display: flex;
    align-items: flex-end;
    gap: 4px;
    height: 200px;
    padding: 20px 0;
}
.funnel-step {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}
.funnel-bar {
    width: 100%;
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    transition: height 0.8s ease;
    position: relative;
}
.funnel-label {
    font-size: 0.72rem;
    color: var(--text-muted);
    text-align: center;
}
.funnel-value {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--text-primary);
}

/* ========== MODAL ========== */
.admin-modal {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease;
}
.modal-backdrop {
    position: absolute; inset: 0;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
}
.modal-box {
    position: relative;
    background: #fff;
    border: 1px solid #d9e1e8;
    border-radius: var(--radius-xl);
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    overflow-y: auto;
    animation: slideUp 0.3s ease;
    box-shadow: 0 20px 60px rgba(0,0,0,0.1);
}
body.dark .modal-box { background: #4f4a54; border-color: #635e69; box-shadow: 0 20px 60px rgba(0,0,0,0.5); }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { transform: translateY(40px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
}
.modal-header h3 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
}
.modal-close {
    background: none; border: none;
    color: var(--text-muted);
    font-size: 1.3rem;
    padding: 4px;
    line-height: 1;
    transition: color var(--transition-fast);
}
.modal-close:hover { color: var(--text-primary); }
.modal-body { padding: 20px 24px; }
.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
}

/* ========== TOAST ========== */
.admin-toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 600;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.admin-toast {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 18px;
    border-radius: var(--radius-md);
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    box-shadow: 0 8px 32px rgba(0,0,0,0.1);
    font-size: 0.85rem;
    color: var(--text-primary);
    min-width: 280px;
    animation: slideIn 0.35s ease;
}
body.dark .admin-toast { box-shadow: 0 8px 32px rgba(0,0,0,0.3); }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
.admin-toast.success { border-left: 3px solid var(--neon-green); }
.admin-toast.error { border-left: 3px solid var(--neon-red); }
.admin-toast.warning { border-left: 3px solid var(--neon-orange); }
.admin-toast.info { border-left: 3px solid var(--neon-blue); }

/* ========== LOADING ========== */
.loading-placeholder {
    text-align: center;
    padding: 40px;
    color: var(--text-muted);
    font-size: 0.85rem;
}
.spinner {
    display: inline-block;
    width: 20px; height: 20px;
    border: 2px solid rgba(0,0,0,0.08);
    border-top-color: var(--neon-blue);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}
body.dark .spinner { border-color: rgba(255,255,255,0.1); border-top-color: var(--neon-blue); }
@keyframes spin { to { transform: rotate(360deg); } }

/* ========== RESPONSIVE ========== */
@media (max-width: 1200px) {
    .bottom-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 1024px) {
    .bottom-grid { grid-template-columns: 1fr; }
    .charts-grid { grid-template-columns: 1fr; }
    .topbar-search { min-width: 200px; }
}
@media (max-width: 768px) {
    .admin-sidebar {
        transform: translateX(-100%);
        width: var(--sidebar-w);
        z-index: 200;
    }
    .admin-sidebar.open { transform: translateX(0); }
    .admin-main { margin-left: 0 !important; }
    .topbar-search { display: none; }
    .hero-stats { grid-template-columns: 1fr 1fr; }
    .admin-content { padding: 16px; }
}
