:root {
    /* From docs/design mockups + ui-kit */
    --primary: #0F3D2E;
    --secondary: #1F6B4F;
    --accent: #2E8B57;
    --highlight: #78C257;
    --highlight-soft: #A8D96A;
    --brand-gradient: linear-gradient(135deg, #0F3D2E 0%, #1F6B4F 48%, #78C257 100%);
    --background: #F4F7F5;
    --surface: #FFFFFF;
    --text: #1A2E24;
    --text-muted: #5C6F65;
    --sidebar-bg: #0F3D2E;
    --sidebar-text: rgba(255, 255, 255, 0.82);
    --sidebar-text-active: #FFFFFF;
    --white: #FFFFFF;
    --sidebar-width: 260px;
    --navbar-height: 64px;
    --radius: 0.75rem;
}

body {
    background-color: var(--background);
    color: var(--text);
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

.bg-background {
    background-color: var(--background);
}

.main-content {
    display: flex;
    flex-direction: column;
    margin-left: var(--sidebar-width);
    padding-top: var(--navbar-height);
    min-height: 100vh;
    transition: margin-left 0.25s ease;
}

.main-content > .container-fluid {
    flex: 1 0 auto;
}

/* Dark sidebar — matches docs/design/dashboard/home.png */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background:
        radial-gradient(ellipse at bottom left, rgba(120, 194, 87, 0.18), transparent 55%),
        var(--sidebar-bg);
    border-right: none;
    z-index: 1040;
    overflow-y: auto;
    padding: 1.25rem 0;
    color: var(--sidebar-text);
    transform: translateX(0);
    transition: transform 0.25s ease;
}

.sidebar-brand {
    padding: 0 1.25rem 1.25rem 2rem    
}

.sidebar-brand-link {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    text-decoration: none;
}

.sidebar-brand-icon {
    height: 36px;
    width: 36px;
    object-fit: contain;
    flex-shrink: 0;
}

.sidebar-brand-wordmark {
    height: 22px;
    width: auto;
    max-width: 148px;
    object-fit: contain;
    display: block;
}

.sidebar-brand-tagline {
    display: block;
    margin-top: 0.35rem;
    margin-left: calc(36px + 0.65rem);
    font-size: 0.58rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.55);
    font-weight: 500;
}

.sidebar-menu .nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.5rem;
    color: var(--sidebar-text);
    font-weight: 500;
    border-left: 3px solid transparent;
    border-radius: 0;
}

.sidebar-menu .nav-link:hover {
    background-color: rgba(255, 255, 255, 0.06);
    color: var(--sidebar-text-active);
}

.sidebar-menu .nav-link.active {
    background-color: rgba(120, 194, 87, 0.22);
    color: var(--sidebar-text-active);
    border-left-color: var(--highlight);
}

.sidebar-menu .nav-parent {
    cursor: pointer;
    user-select: none;
}

.sidebar-menu .nav-parent.active-soft {
    background-color: rgba(255, 255, 255, 0.08);
    color: var(--sidebar-text-active);
    border-left-color: rgba(120, 194, 87, 0.55);
}

.sidebar-menu .nav-parent-chevron {
    font-size: 0.85rem;
    opacity: 0.7;
    transition: transform 0.2s ease;
}

.sidebar-menu .nav-parent[aria-expanded="true"] .nav-parent-chevron {
    transform: rotate(180deg);
}

.sidebar-menu .submenu {
    padding-left: 0.5rem;
}

.sidebar-menu .submenu .nav-link {
    padding: 0.55rem 1.25rem 0.55rem 2rem;
    font-size: 0.92rem;
    font-weight: 400;
}

.sidebar-menu .submenu .nav-link.active {
    background-color: rgba(120, 194, 87, 0.18);
    color: var(--sidebar-text-active);
    border-left-color: var(--highlight);
    font-weight: 500;
}

.top-navbar {
    position: fixed;
    top: 0;
    right: 0;
    left: var(--sidebar-width);
    height: var(--navbar-height);
    background-color: var(--surface);
    border-bottom: 1px solid rgba(15, 61, 46, 0.08);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    z-index: 1045;
    transition: left 0.25s ease;
}

.sidebar-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    padding: 0;
    background: none;
    border: none;
    border-radius: 0.5rem;
    font-size: 1.35rem;
    color: var(--text-muted);
    cursor: pointer;
    position: relative;
    z-index: 1046;
}

.sidebar-toggle:hover {
    background: rgba(15, 61, 46, 0.06);
    color: var(--primary);
}

/* Collapsed sidebar — all viewports */
body.sidebar-collapsed .sidebar {
    transform: translateX(-100%);
}

body.sidebar-collapsed .main-content {
    margin-left: 0;
}

body.sidebar-collapsed .top-navbar {
    left: 0;
}

.btn-ghost {
    background: none;
    border: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.footer {
    flex-shrink: 0;
    padding: 1.5rem 0;
    margin-top: auto;
    border-top: 1px solid rgba(15, 61, 46, 0.08);
}

.page-breadcrumb .breadcrumb {
    margin-bottom: 1.25rem;
    padding: 0;
    background: transparent;
    font-size: 0.875rem;
}

.page-breadcrumb .breadcrumb-item + .breadcrumb-item::before {
    color: rgba(15, 61, 46, 0.35);
}

.page-breadcrumb .breadcrumb-item a {
    color: var(--secondary);
    text-decoration: none;
}

.page-breadcrumb .breadcrumb-item a:hover {
    color: var(--primary);
}

.page-breadcrumb .breadcrumb-item.active {
    color: rgba(15, 61, 46, 0.65);
    font-weight: 500;
}

.card {
    border-radius: var(--radius);
    box-shadow: 0 2px 12px rgba(15, 61, 46, 0.04);
}

.btn-primary {
    background-color: var(--primary);
    border-color: var(--primary);
}

.btn-primary:hover,
.btn-primary:focus {
    background-color: var(--secondary);
    border-color: var(--secondary);
}

.btn-primary:active {
    background-color: #0a2e22 !important;
    border-color: #0a2e22 !important;
}

.btn-highlight {
    background-color: var(--highlight);
    border-color: var(--highlight);
    color: var(--white);
}

.btn-highlight:hover {
    background-color: #68b048;
    border-color: #68b048;
    color: var(--white);
}

.text-primary {
    color: var(--primary) !important;
}

a:not(.btn):not(.nav-link):not(.dropdown-item):not(.page-breadcrumb a) {
    color: var(--secondary);
}

a:not(.btn):not(.nav-link):not(.dropdown-item):hover {
    color: var(--primary);
}

.form-control:focus,
.form-select:focus,
.form-check-input:focus {
    border-color: var(--highlight);
    box-shadow: 0 0 0 0.2rem rgba(120, 194, 87, 0.25);
}

.form-check-input:checked {
    background-color: var(--primary);
    border-color: var(--primary);
}

.badge.bg-secondary {
    background-color: var(--secondary) !important;
}

/* Auth — split layout inspired by docs/design/dashboard/login.png */
.auth-body {
    background-color: var(--background);
}

.auth-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
}

.auth-panel {
    background:
        radial-gradient(ellipse at bottom left, rgba(120, 194, 87, 0.22), transparent 50%),
        radial-gradient(ellipse at top right, rgba(46, 139, 87, 0.35), transparent 45%),
        var(--primary);
    color: var(--white);
    padding: 3rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.auth-panel-title {
    font-size: clamp(1.75rem, 2.5vw, 2.25rem);
    font-weight: 700;
    line-height: 1.25;
    margin-bottom: 0.75rem;
}

.auth-panel-lead {
    color: rgba(255, 255, 255, 0.78);
    margin-bottom: 2rem;    
}

.auth-feature-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 1rem;
}

.auth-feature-list li {
    display: flex;
    gap: 0.85rem;
    align-items: center;
}

.auth-feature-list li > div {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.auth-feature-icon {
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 999px;
    background: rgba(120, 194, 87, 0.2);
    color: var(--highlight);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 1rem;
}

.auth-feature-icon .bi {
    font-size: 1em;
    line-height: 1;
    display: block;    
    text-align: center;
    padding-top: 11px;
}

.auth-feature-list strong {
    display: block;
    font-size: 0.95rem;
}

.auth-feature-list span {
    display: block;
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.85rem;
}

.auth-form-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1.25rem;
    background: var(--background);
}

.auth-form-card {
    width: 100%;
    max-width: 420px;
    background: var(--surface);
    border-radius: 1rem;
    box-shadow: 0 12px 40px rgba(15, 61, 46, 0.08);
    border: 1px solid rgba(15, 61, 46, 0.06);
    padding: 2rem 1.75rem;
}

.auth-brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.55rem;
    margin-bottom: 1.25rem;
    text-align: center;
}

.auth-brand-row {
    display: flex;
    align-items: center;
    gap: 0.65rem;
}

.auth-brand-mark {
    height: 44px;
    width: 44px;
    object-fit: contain;
}

.auth-brand-wordmark {
    height: 28px;
    width: auto;
    max-width: 180px;
    object-fit: contain;
}

.auth-brand-tagline {
    font-size: 0.65rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-muted);
    font-weight: 600;
    margin: 0;
}

.auth-form-title {
    font-size: 1.25rem;
    font-weight: 650;
    text-align: center;
    margin-bottom: 0.35rem;
}

.auth-form-subtitle {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.875rem;
    margin-bottom: 1.5rem;
}

.auth-page {
    background: transparent;
    padding: 1.5rem 1rem;
}

.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(244, 247, 245, 0.88);
    backdrop-filter: blur(2px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-overlay.show {
    display: flex;
}

.loading-spinner {
    text-align: center;
}

.toast-container {
    z-index: 1090;
    pointer-events: none;
}

.toast-container .toast {
    pointer-events: auto;
    min-width: 280px;
    box-shadow: 0 8px 24px rgba(15, 61, 46, 0.18);
}

.chart-wrap {
    position: relative;
    height: 280px;
}

.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 61, 46, 0.4);
    z-index: 1035;
}

@media (max-width: 991.98px) {
    .auth-shell {
        grid-template-columns: 1fr;
    }
    .auth-panel {
        display: none;
    }
    .auth-form-wrap {
        min-height: 100vh;
    }

    /* Mobile/tablet: content is always full-width; sidebar overlays */
    .main-content {
        margin-left: 0;
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }

    .top-navbar {
        left: 0;
        padding: 0 0.75rem;
    }

    body:not(.sidebar-collapsed) .sidebar {
        box-shadow: 8px 0 24px rgba(15, 61, 46, 0.25);
    }

    body:not(.sidebar-collapsed) .sidebar-backdrop {
        display: block;
    }

    body:not(.sidebar-collapsed).sidebar-open {
        overflow: hidden;
    }

    .chart-wrap {
        height: 220px;
    }

    .container-fluid {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }
}
