:root {
    --sidebar-width: 256px;
    --primary-color: #2563eb;
    --sidebar-bg: #0f172a;
    --sidebar-hover: #1e293b;
    --body-bg: #f1f5f9;
}

body {
    background-color: var(--body-bg);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: #0f172a;
    overflow-x: hidden;
}

/* Desktop Sidebar */
.app-sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    color: #e2e8f0;
    min-height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1030;
    display: flex;
    flex-direction: column;
    transition: transform 0.25s ease;
}

.app-sidebar .brand-area {
    padding: 1.15rem 1.25rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    gap: 0.7rem;
}

.app-sidebar .brand-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: #fff;
    flex-shrink: 0;
}

.app-sidebar .nav-section-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #64748b;
    padding: 1rem 1.25rem 0.35rem;
    font-weight: 600;
}

.app-sidebar .nav-link {
    color: #cbd5e1;
    padding: 0.62rem 1.15rem;
    margin: 0.12rem 0.75rem;
    border-radius: 0.55rem;
    display: flex;
    align-items: center;
    gap: 0.7rem;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.15s ease;
}

.app-sidebar .nav-link:hover {
    background: var(--sidebar-hover);
    color: #fff;
}

.app-sidebar .nav-link.active {
    background: var(--primary-color);
    color: #fff;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.32);
}

.app-sidebar .nav-link i {
    font-size: 1.05rem;
    width: 20px;
    text-align: center;
}

/* Main Layout */
.app-main {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.app-topbar {
    background: #ffffff;
    border-bottom: 1px solid #e2e8f0;
    padding: 0.75rem 1.25rem;
    position: sticky;
    top: 0;
    z-index: 1020;
}

.app-content {
    padding: 1.25rem;
    flex: 1;
}

/* Cards & KPI Widgets */
.card {
    border: 1px solid #e2e8f0;
    border-radius: 0.85rem;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.card-header {
    background: #fff;
    border-bottom: 1px solid #f1f5f9;
    padding: 0.9rem 1.15rem;
    font-weight: 600;
}

.kpi-card {
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.kpi-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.06);
}

.kpi-icon {
    width: 46px;
    height: 46px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    flex-shrink: 0;
}

/* Purple utility badge */
.bg-purple-subtle {
    background-color: #f3e8ff !important;
}
.text-purple {
    color: #7e22ce !important;
}

/* Tables */
.table > :not(caption) > * > * {
    padding: 0.75rem 0.85rem;
    vertical-align: middle;
}

.table thead th {
    font-size: 0.76rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #64748b;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    white-space: nowrap;
}

/* Mobile Responsive Adjustments */
@media (max-width: 991.98px) {
    .app-sidebar {
        display: none;
    }
    .app-main {
        margin-left: 0;
    }
    .app-content {
        padding: 0.9rem;
    }
}

/* Offcanvas mobile sidebar styling */
.offcanvas.mobile-sidebar {
    background: var(--sidebar-bg);
    color: #e2e8f0;
    max-width: 280px;
}

.offcanvas.mobile-sidebar .nav-link {
    color: #cbd5e1;
    padding: 0.65rem 1rem;
    border-radius: 0.5rem;
    margin-bottom: 0.15rem;
    display: flex;
    align-items: center;
    gap: 0.65rem;
}

.offcanvas.mobile-sidebar .nav-link.active {
    background: var(--primary-color);
    color: #fff;
}

/* Login Page */
.login-wrapper {
    min-height: 100vh;
    background: linear-gradient(135deg, #0f172a 0%, #1e3a8a 55%, #2563eb 100%);
}

.print-only {
    display: none;
}

/* Print Styles (Invoice & Cari Ekstre) */
@media print {
    .print-only {
        display: block !important;
    }
    .no-print,
    .app-sidebar,
    .app-topbar,
    .offcanvas {
        display: none !important;
    }
    .app-main {
        margin-left: 0 !important;
    }
    .app-content {
        padding: 0 !important;
    }
    body {
        background: #fff !important;
    }
    .card {
        border: none !important;
        box-shadow: none !important;
    }
    .print-summary-grid {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        gap: 10px !important;
        width: 100% !important;
        margin: 0 !important;
    }
    .print-summary-col {
        flex: 1 1 33.333% !important;
        width: 33.333% !important;
        max-width: 33.333% !important;
        padding: 0 !important;
    }
    .print-summary-box {
        border: 1px solid #cbd5e1 !important;
        border-radius: 6px !important;
        break-inside: avoid;
    }
}
