:root {
    --crm-bg: #f3f6fb;
    --crm-card: #ffffff;
    --crm-border: #e6ebf3;
    --crm-text: #1c2434;
    --crm-muted: #6c7690;
    --crm-primary: #4f46e5;
}

body {
    background: radial-gradient(circle at top right, #eef2ff, #f7f9fc 38%, #f3f6fb);
    color: var(--crm-text);
    font-family: "Inter", "Segoe UI", Arial, sans-serif;
}

.app-shell {
    min-height: 100vh;
}

.crm-sidebar {
    min-height: 100vh;
    background: linear-gradient(180deg, #0f172a, #111827);
    border-right: 1px solid rgba(255, 255, 255, 0.06);
    position: sticky;
    top: 0;
}

.brand-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: rgba(79, 70, 229, 0.24);
    color: #fff;
    font-weight: 700;
}

.crm-sidebar .nav-link {
    color: #c8d1e5;
    border-radius: 10px;
    margin: 4px 0;
    padding: 10px 12px;
}

.crm-sidebar .nav-link:hover,
.crm-sidebar .nav-link.active {
    color: #fff;
    background: rgba(79, 70, 229, 0.28);
}

.crm-topbar {
    background: rgba(255, 255, 255, 0.82);
    border: 1px solid var(--crm-border);
    backdrop-filter: blur(8px);
}

.sidebar-toggle {
    display: none;
}

.content-wrap {
    padding: 24px;
}

.card {
    border: 1px solid var(--crm-border);
    border-radius: 14px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.05);
}

.card-header {
    background: transparent;
    border-bottom: 1px solid var(--crm-border);
    font-weight: 600;
}

.metric-card {
    position: relative;
    overflow: hidden;
}

.metric-card::after {
    content: "";
    position: absolute;
    right: -24px;
    top: -24px;
    width: 88px;
    height: 88px;
    border-radius: 50%;
    background: rgba(79, 70, 229, 0.12);
}

.metric-label {
    color: var(--crm-muted);
    font-weight: 600;
    font-size: 0.9rem;
}

.metric-value {
    font-size: 2rem;
    font-weight: 700;
    margin: 0;
}

.table > :not(caption) > * > * {
    padding: 0.78rem 0.75rem;
}

.table thead th {
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--crm-muted);
    border-bottom-width: 1px;
}

.btn-primary {
    background: linear-gradient(45deg, #4f46e5, #2563eb);
    border: none;
}

.btn-success {
    background: linear-gradient(45deg, #0ea5a4, #22c55e);
    border: none;
}

.form-control,
.form-select {
    border-radius: 10px;
    border-color: #dbe3f0;
}

.toast-container {
    z-index: 1080;
}

.skeleton {
    background: linear-gradient(90deg, #eef1f6 25%, #f6f8fc 37%, #eef1f6 63%);
    background-size: 400% 100%;
    animation: shimmer 1.3s infinite;
    border-radius: 8px;
    height: 14px;
}

@keyframes shimmer {
    0% { background-position: 100% 0; }
    100% { background-position: -100% 0; }
}

body.dark-mode {
    --crm-bg: #0b1120;
    --crm-card: #111827;
    --crm-border: #1f2937;
    --crm-text: #dbe5f8;
    --crm-muted: #9aa8c0;
    background: radial-gradient(circle at top right, #131c33, #0b1120 38%, #0a1020);
}

body.dark-mode .card,
body.dark-mode .crm-topbar,
body.dark-mode .modal-content {
    background: #111827;
    color: #dbe5f8;
    border-color: #253146;
}

body.dark-mode .table,
body.dark-mode .table th,
body.dark-mode .table td,
body.dark-mode .form-control,
body.dark-mode .form-select {
    color: #dbe5f8;
    background-color: #0f172a;
    border-color: #253146;
}

@media (max-width: 991px) {
    .crm-sidebar {
        position: fixed;
        left: -280px;
        top: 0;
        width: 260px;
        z-index: 1060;
        transition: left 0.25s ease;
    }
    .crm-sidebar.open {
        left: 0;
    }
    .sidebar-toggle {
        display: inline-flex;
    }
}
