@import url('https://fonts.googleapis.com/css2?family=Sarabun:wght@300;400;500;600;700;800&display=swap');

:root {
    /* Eco Green – Nature-Friendly palette */
    --primary: #1A5632;
    --primary-dark: #134226;
    --primary-light: #E8F5E9;
    --primary-accent: #4CAF50;
    --primary-green: #1A5632;
    --dark-green: #1A5632;
    --light-green: #EEF6F0;
    --text-color: #1f2937;
    --text-muted: #64748b;
    --sidebar-width: 270px;
    --header-height: 60px;
    --ghg-primary: #1A5632;
    --ghg-primary-dark: #134226;
    --ghg-primary-light: #E8F5E9;
    --accent: #43A047;
    --accent-light: #E8F5E9;
    --accent-dark: #2E7D32;
    --info-blue: #3B82F6;
    --bg-body: #F2F5F0;
    --bg-card: #ffffff;
    --border-color: #D7E4D9;
    --radius: 12px;
    --radius-lg: 16px;
    --shadow-sm: 0 1px 3px rgba(26,86,50,.06);
    --shadow: 0 4px 16px rgba(26,86,50,.08);
    --shadow-lg: 0 8px 28px rgba(26,86,50,.12);
}

html,
body {
    font-family: 'Sarabun', sans-serif !important;
    font-size: 15px;
    margin: 0;
    padding: 0 !important;
    background-color: var(--bg-body);
    color: var(--text-color);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    letter-spacing: -0.01em;
    overflow-x: hidden;
}

/* Layout */
.dashboard-container {
    min-height: 100vh;
}

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* ========================================
   PROFESSIONAL SIDEBAR
   ======================================== */
.sidebar-permanent {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    max-width: var(--sidebar-width);
    flex: 0 0 var(--sidebar-width);
    min-height: 100vh;
    background: linear-gradient(180deg, #1A5632 0%, #164A2C 40%, #0F3A20 100%);
    border-right: none;
    display: flex;
    flex-direction: column;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: sticky;
    top: 0;
    z-index: 99;
    box-shadow: 3px 0 16px rgba(26,86,50,.18);
    overflow: hidden;
}

.sidebar-permanent.collapsed {
    width: 70px;
    min-width: 70px;
    max-width: 70px;
    flex: 0 0 70px;
    overflow: visible;
}

.sidebar-header {
    padding: 0;
    border-bottom: 1px solid rgba(255,255,255,.1);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 76px;
    background: rgba(0,0,0,.08);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-permanent.collapsed .sidebar-header {
    padding: 1.2rem 0.7rem;
    justify-content: center;
}

.sidebar-logo {
    height: auto;
    width: 80%;
    max-width: none;
    object-fit: contain;
    flex-shrink: 0;
    border-radius: 0;
    padding: 0;
    transition: width 0.3s ease;
}

.sidebar-permanent.collapsed .sidebar-logo {
    width: 42px;
}

.sidebar-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: #ffffff;
    white-space: nowrap;
    overflow: hidden;
    transition: opacity 0.25s ease, width 0.3s ease;
    letter-spacing: -.2px;
}

.sidebar-brand-sub {
    font-size: 0.68rem;
    color: rgba(255,255,255,.85);
    font-weight: 400;
    display: block;
    margin-top: 2px;
    transition: opacity 0.25s ease;
}

.sidebar-permanent.collapsed .sidebar-title,
.sidebar-permanent.collapsed .sidebar-brand-sub {
    opacity: 0;
    width: 0;
    display: none;
}

/* Sidebar Section Labels */
.sidebar-section-label {
    font-size: 0.65rem;
    font-weight: 700;
    color: rgba(255,255,255,.8);
    text-transform: uppercase;
    letter-spacing: 1.2px;
    padding: 1rem 1rem 0.4rem 1rem;
    margin: 0;
}

.sidebar-permanent.collapsed .sidebar-section-label {
    display: none;
}

.sidebar-nav {
    flex: 1;
    padding: 0.5rem 0;
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar-nav::-webkit-scrollbar {
    width: 4px;
}

.sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,.15);
    border-radius: 4px;
}

.sidebar-nav ul {
    margin: 0;
    padding: 0;
}

.sidebar-nav li {
    list-style: none;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.55rem 1rem;
    color: rgba(255,255,255,.92);
    text-decoration: none;
    transition: all 0.2s ease;
    font-weight: 500;
    font-size: 0.82rem;
    margin: 1px 0.5rem;
    border-radius: 8px;
}

.sidebar-nav a:hover {
    background-color: rgba(255,255,255,.08);
    color: #ffffff;
}

.sidebar-nav a.active {
    background: linear-gradient(135deg, rgba(76,175,80,.25), rgba(76,175,80,.12));
    color: #ffffff;
    box-shadow: inset 3px 0 0 var(--accent);
    font-weight: 600;
}

/* Sidebar User Footer */
.sidebar-user-footer {
    padding: 0.75rem 1rem;
    border-top: 1px solid rgba(255,255,255,.08);
    display: flex;
    align-items: center;
    gap: 0.65rem;
}

.sidebar-user-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: rgba(74,124,181,.4);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.8rem;
    flex-shrink: 0;
}

.sidebar-user-info {
    overflow: hidden;
}

.sidebar-user-name {
    font-size: 0.8rem;
    font-weight: 600;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-role {
    font-size: 0.65rem;
    color: rgba(255,255,255,.75);
    font-weight: 400;
}

.sidebar-permanent.collapsed .sidebar-user-info {
    display: none;
}

/* Nested sidebar menu */
.menu-group > .menu-parent {
    cursor: pointer;
    position: relative;
    padding-right: 2rem !important;
}

.menu-group > .menu-parent::after {
    content: '';
    position: absolute;
    right: 0.75rem;
    top: 50%;
    width: 6px;
    height: 6px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: translateY(-50%) rotate(45deg);
    transition: transform 0.25s ease;
    opacity: 0.75;
}

.menu-group.open > .menu-parent::after {
    transform: translateY(-30%) rotate(-135deg);
}

.menu-group.active-group > .menu-parent {
    background: linear-gradient(135deg, rgba(76,175,80,.25), rgba(76,175,80,.12));
    color: #ffffff;
    box-shadow: inset 3px 0 0 var(--accent);
}

.sidebar-submenu {
    list-style: none;
    margin: 0 0.5rem;
    padding: 0;
    position: relative;
    background: rgba(0,0,0,.12);
    border-radius: 8px;
    border-left: none;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, padding 0.3s ease, margin 0.3s ease;
}

.menu-group.open > .sidebar-submenu {
    max-height: 600px;
    padding: 0.35rem 0;
    margin: 0.25rem 0.5rem;
}

.sidebar-submenu::before {
    content: '';
    position: absolute;
    left: 1.25rem;
    top: 0.5rem;
    bottom: 0.5rem;
    width: 1px;
    background: rgba(255,255,255,.25);
}


.sidebar-submenu a,
.sidebar-submenu .submenu-title {
    display: block;
    padding: 0.4rem 1rem 0.4rem 2.5rem;
    color: rgba(255,255,255,.85);
    text-decoration: none;
    font-size: 0.85rem;
    white-space: normal;
    line-height: 1.2;
    font-weight: 500;
    transition: all 0.2s ease;
}

.sidebar-submenu a {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-height: 48px;
    border-radius: 6px;
    margin: 0.15rem 0.5rem;
}

.sidebar-submenu .submenu-icon {
    width: 18px;
    text-align: center;
    flex-shrink: 0;
    color: inherit;
    font-size: 0.85rem;
}

.sidebar-submenu a:hover {
    background-color: rgba(76, 175, 80, 0.1);
    color: #fff;
    transform: translateX(2px);
}

.sidebar-submenu .submenu-text {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
}

.sidebar-permanent.collapsed .sidebar-submenu {
    padding-left: 0.5rem;
}

.sidebar-permanent.collapsed .menu-group > .menu-parent::after {
    display: none;
}

.sidebar-permanent.collapsed .sidebar-submenu a {
    justify-content: center;
    padding-left: 0.5rem;
    padding-right: 0.5rem;
}


.sidebar-permanent.collapsed .sidebar-submenu .submenu-text {
    display: none;
}

.sidebar-submenu a.active {
    background-color: rgba(76, 175, 80, 0.18);
    color: #fff;
    font-weight: 600;
    box-shadow: inset 3px 0 0 var(--accent), 0 2px 4px rgba(76, 175, 80, 0.1);
}

/* 3rd-level sub-group */
.sub-group { position: relative; }
.sub-group > .sub-parent {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 2rem 0.4rem 2.5rem;
    color: rgba(255,255,255,.85);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    position: relative;
    border-radius: 6px;
    margin: 0.15rem 0.5rem;
    min-height: 48px;
    transition: all 0.2s ease;
    user-select: none;
}
.sub-group > .sub-parent:hover {
    background-color: rgba(76,175,80,.1);
    color: #fff;
    transform: translateX(2px);
}
.sub-group > .sub-parent::after {
    content: '';
    position: absolute;
    right: 0.75rem;
    top: 50%;
    width: 5px;
    height: 5px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: translateY(-50%) rotate(45deg);
    transition: transform 0.25s ease;
    opacity: 0.75;
}
.sub-group.open > .sub-parent::after {
    transform: translateY(-30%) rotate(-135deg);
}
.sub-group.active-sub > .sub-parent {
    background: rgba(76,175,80,.15);
    color: #fff;
}
.sub-submenu {
    list-style: none;
    padding: 0;
    margin: 0 0.5rem;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    background: rgba(0,0,0,.1);
    border-radius: 6px;
}
.sub-group.open > .sub-submenu {
    max-height: 300px;
    padding: 0.25rem 0;
    margin: 0.1rem 0.5rem;
}
.sub-submenu a {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 1rem 0.35rem 3.25rem;
    color: rgba(255,255,255,.8);
    font-size: 0.82rem;
    text-decoration: none;
    border-radius: 5px;
    margin: 0.1rem 0.35rem;
    min-height: 40px;
    transition: all 0.2s ease;
}
.sub-submenu a:hover { background: rgba(76,175,80,.12); color: #fff; transform: translateX(2px); }
.sub-submenu a.active { background: rgba(76,175,80,.2); color: #fff; font-weight: 600; }

/* Professional theme overrides */
body {
    background: var(--bg-body) !important;
}

.form-label {
    font-size: 0.9rem;
    font-weight: 600;
    color: #374151;
}

/* Form pages base font size */
.ghg-form-page,
.scope1-page,
.energy-form,
.energy-page {
    font-size: 16px;
}

/* Consistent form control heights */
.form-control,
.form-select {
    height: 42px;
    padding: 0.5rem 0.85rem;
    font-size: 0.9rem;
    border-radius: 8px;
    border: 1.5px solid #d1d5db;
    transition: border-color 0.2s, box-shadow 0.2s;
    background-color: #fff;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(26,86,50,.1);
}

textarea.form-control {
    height: auto;
    min-height: 80px;
}

.input-group .form-control,
.input-group .form-select {
    height: 42px;
}

.input-group-text {
    height: 42px;
    font-size: 0.85rem;
    border-radius: 8px;
    border: 1.5px solid #d1d5db;
    background: #f8fafc;
    color: var(--text-muted);
    padding: 0.5rem 0.75rem;
}

/* Row-level input consistency */
.row .form-control,
.row .form-select,
.row .input-group-text {
    height: 42px;
}

.row textarea.form-control {
    height: auto;
}

.section-number,
.unit-badge,
.btn-primary,
.btn-new,
.filter-btn,
.btn-view,
.btn-edit {
    background: var(--primary) !important;
    color: #fff !important;
    border-radius: 8px;
}

.btn-primary:hover,
.btn-new:hover,
.filter-btn:hover,
.btn-view:hover,
.btn-edit:hover {
    background: var(--primary-dark) !important;
    box-shadow: 0 2px 8px rgba(26,86,50,.2);
}

/* Professional card styling */
.card {
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    background: #fff;
    transition: box-shadow 0.2s;
}

.card:hover {
    box-shadow: var(--shadow);
}

.card-header {
    background: #f8fafc;
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
    padding: 1rem 1.25rem;
}

.section-title {
    border-bottom-color: var(--primary) !important;
}

.header-right {
    border-left-color: var(--primary) !important;
}

.file-input-label {
    border-color: var(--primary) !important;
    color: var(--primary) !important;
}

.file-input-label:hover {
    background: rgba(27, 42, 74, 0.08) !important;
}

.section-header,
.total-card {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%) !important;
    color: #fff !important;
}

.co2-value {
    color: var(--primary) !important;
}

.result-card:hover {
    border-color: var(--primary) !important;
}

.stat-card {
    border-left-color: var(--primary) !important;
}

.sidebar-nav a i {
    width: 20px;
    text-align: center;
    flex-shrink: 0;
}

.sidebar-nav .menu-text {
    transition: opacity 0.25s ease, width 0.3s ease, margin 0.3s ease;
    white-space: normal;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
    line-height: 1.2;
}

.sidebar-permanent.collapsed .menu-text {
    opacity: 0;
    width: 0;
    margin-left: 0;
    overflow: hidden;
    display: none;
}

.main-wrapper {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
    flex: 1 1 0;
    width: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Align content containers to the left in main area */
.main-wrapper main.container-fluid {
    padding-left: 0;
    padding-right: 0;
}

.main-wrapper main .row {
    margin-left: 0;
    margin-right: 0;
}

.main-wrapper main .col-12 {
    padding-left: 0;
    padding-right: 0;
}

.main-wrapper main .container {
    margin-left: 0 !important;
    margin-right: auto !important;
}

.container {
    margin-left: 0 !important;
    margin-right: auto !important;
}

/* Dashboard refinements */
.dashboard-filters {
    border: 1px solid rgba(27, 42, 74, 0.1);
    background: #fff;
    border-radius: var(--radius);
}

.dashboard-filters .form-label {
    font-weight: 600;
    color: #3f4a59;
}

.dashboard-page .card-title {
    font-weight: 700;
    color: #2d3b2f;
}

.summary-list {
    display: grid;
    gap: 0.75rem;
}

.summary-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.6rem 0.8rem;
    border-radius: 10px;
    background: #f7faf7;
    color: #3f4a59;
}

.chart-wrap-lg {
    min-height: 260px;
}

/* Stronger left alignment for main area */
.main-content-left .container {
    width: 100%;
    max-width: none;
    padding-left: 16px;
    padding-right: 16px;
}

@media (max-width: 768px) {
    .sidebar-permanent {
        position: fixed;
        left: -250px;
        z-index: 1000;
    }
    
    .sidebar-permanent.show {
        left: 0;
    }
    
    .main-wrapper {
        margin-left: 0 !important;
    }
}

.topbar {
    height: var(--header-height);
    background-color: #fff;
    border-bottom: 1px solid #ddd;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
}

/* Auth Pages */
.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
}

.auth-card {
    background: white;
    padding: 2.5rem;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.12);
    width: 100%;
    max-width: 420px;
}

.auth-card h2 {
    text-align: center;
    color: var(--primary);
    margin-bottom: 1.5rem;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.form-control {
    width: 100%;
    padding: 0.5rem 0.85rem;
    border: 1.5px solid #d1d5db;
    border-radius: 8px;
    box-sizing: border-box;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.6rem 1.25rem;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.2s;
    text-decoration: none;
    letter-spacing: 0;
}

.btn-primary {
    background-color: var(--primary);
    color: white;
    width: 100%;
}

.btn-primary:hover {
    background-color: var(--primary-dark);
    box-shadow: 0 2px 8px rgba(26,86,50,.2);
}

.alert {
    padding: 1rem;
    margin-bottom: 1rem;
    border-radius: 5px;
}

.alert-success {
    background-color: #d4edda;
    color: #155724;
}

.alert-danger {
    background-color: #f8d7da;
    color: #721c24;
}

.alert-stack {
    position: fixed;
    right: 16px;
    bottom: 16px;
    z-index: 1100;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-width: min(360px, 90vw);
}

.alert-toast {
    border-radius: 12px;
    padding: 0.85rem 1rem;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.15);
    border: 1px solid rgba(15, 23, 42, 0.12);
    font-weight: 600;
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    animation: toast-fade 0.4s ease 2s forwards;
}

.alert-success.alert-toast {
    border-color: rgba(22, 163, 74, 0.35);
}

.alert-danger.alert-toast {
    border-color: rgba(239, 68, 68, 0.35);
}

.alert-warning.alert-toast {
    border-color: rgba(245, 158, 11, 0.45);
}

.alert-icon {
    font-size: 1.1rem;
    line-height: 1.2;
}

@keyframes toast-fade {
    to {
        opacity: 0;
        transform: translateY(8px);
        pointer-events: none;
    }
}

/* Auth / helper styles */
.brand-badge{
    width:64px;
    height:64px;
    display:grid;
    place-items:center;
    border-radius:999px;
    background: rgba(26,86,50,0.1);
    color: var(--primary);
    margin: 0 auto 0.5rem;
}

.input-group-text{
    background: #f8fafc;
    border: 1.5px solid #d1d5db;
}

.btn-brand{
    background: var(--primary);
    border: 1px solid var(--primary);
    color: #fff;
}

.btn-brand:hover{
    filter: brightness(.92);
    box-shadow: 0 2px 8px rgba(26,86,50,.2);
}

/* Logo styling */
.navbar-logo {
    height: 45px;
    object-fit: contain;
}

#sidebarToggle {
    width: 40px;
    height: 40px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    font-size: 0.95rem;
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

.user-avatar-top {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-light);
    color: var(--primary);
    font-weight: 700;
    font-size: 0.85rem;
    border: 2px solid rgba(26,86,50,.15);
    flex-shrink: 0;
}

/* Reports page */
.report-page .report-hero {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 55%, #237a42 100%);
    color: #fff;
}

.report-page .report-stat {
    border-left: 4px solid var(--primary);
}

/* Dashboard */
.dashboard-header h1 {
    font-weight: 600;
}

.simple-stat {
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    box-shadow: none;
}

.trend-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.trend-row {
    display: grid;
    grid-template-columns: 70px 1fr 120px;
    gap: 0.75rem;
    align-items: center;
}

.trend-label {
    font-size: 0.85rem;
    color: #475569;
}

.trend-bar {
    height: 10px;
    background: #eef2f6;
    border-radius: 999px;
    overflow: hidden;
}

.trend-bar span {
    display: block;
    height: 100%;
    background: var(--primary);
    border-radius: 999px;
}

.trend-value {
    font-size: 0.85rem;
    text-align: right;
    color: #334155;
}

.scope-card {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.scope-item {
    display: grid;
    grid-template-columns: 1fr 1fr 60px;
    gap: 0.75rem;
    align-items: center;
}

.scope-meter {
    height: 8px;
    background: #f1f5f9;
    border-radius: 999px;
    overflow: hidden;
}

.scope-meter span {
    display: block;
    height: 100%;
    background: var(--primary);
}

.scope-percent {
    text-align: right;
    font-weight: 600;
    color: #0f172a;
}

.chart-wrap {
    position: relative;
    height: 220px;
}

/* GHG forms - clean white minimal */
.ghg-form-page .card,
.ghg-form-page .card-header,
.ghg-form-page .card-body {
    background: #ffffff !important;
}

.ghg-form-page .card,
.ghg-form-page .card-header {
    border-color: #e6e9ee !important;
}

.ghg-form-page .card-header.bg-primary,
.ghg-form-page .card-header.bg-success,
.ghg-form-page .card-header.bg-info {
    color: var(--primary) !important;
    background: #ffffff !important;
    border-left: 4px solid var(--primary);
}

.ghg-form-page .card-header .opacity-75 {
    color: #6b7280 !important;
}

.ghg-form-page .bg-light {
    background: #f8fafc !important;
}

.ghg-form-page .border-primary,
.ghg-form-page .border-success,
.ghg-form-page .border-info {
    border-color: var(--border-color) !important;
}

.ghg-form-page .border-start.border-4 {
    border-left-color: var(--primary) !important;
}

.ghg-form-page .badge.bg-white {
    border: 1px solid var(--border-color);
}

.ghg-form-page .badge.text-primary,
.ghg-form-page .badge.text-success,
.ghg-form-page .badge.text-info {
    color: var(--primary) !important;
}

.ghg-form-page .input-group-text.bg-primary,
.ghg-form-page .input-group-text.bg-success,
.ghg-form-page .input-group-text.bg-info {
    background: var(--primary-light) !important;
    color: var(--primary) !important;
    border-color: var(--border-color) !important;
}

.ghg-form-page .btn-primary,
.ghg-form-page .btn-success,
.ghg-form-page .btn-info {
    background: var(--primary) !important;
    border-color: var(--primary) !important;
    color: #fff !important;
}

.ghg-form-page .btn-danger {
    background: #ef4444 !important;
    border-color: #ef4444 !important;
    color: #fff !important;
}

.ghg-form-page .btn-warning {
    background: #43A047 !important;
    border-color: #43A047 !important;
    color: #fff !important;
}

.ghg-form-page .btn-link {
    color: var(--primary) !important;
}

.ghg-form-page .btn {
    border-radius: 8px;
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    font-weight: 600;
}

.ghg-form-page .btn-sm {
    padding: 0.35rem 0.7rem;
    font-size: 0.82rem;
}

.ghg-form-page .btn-outline-primary,
.ghg-form-page .btn-outline-success,
.ghg-form-page .btn-outline-info {
    color: var(--primary) !important;
    border-color: var(--primary) !important;
}

.ghg-form-page .btn-outline-primary:hover,
.ghg-form-page .btn-outline-success:hover,
.ghg-form-page .btn-outline-info:hover {
    background: var(--primary) !important;
    color: #fff !important;
}

/* Admin users page */
.admin-users-page .stat-card {
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    box-shadow: none;
}

.admin-users-page .stat-label {
    font-size: 0.85rem;
    color: #64748b;
}

.admin-users-page .stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #0f172a;
}

.admin-users-page .filter-card {
    border: 1px solid rgba(27, 42, 74, 0.12);
    background: #fff;
}

.admin-users-table thead th {
    font-weight: 600;
    color: #1f2937;
    background: #f8fafc;
}

.admin-users-table tbody tr:hover {
    background: #f8fbf8;
}

.admin-users-page .user-cell {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.admin-users-page .user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(27, 42, 74, 0.1);
    color: var(--primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}

.admin-users-page .btn-group {
    flex-wrap: wrap;
    gap: 0.35rem;
}

.admin-users-page .action-stack {
    display: flex;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.admin-users-page .action-stack .btn {
    min-width: 92px;
}

@media (max-width: 992px) {
    .admin-users-page .stat-value {
        font-size: 1.25rem;
    }

    .admin-users-page .user-avatar {
        width: 32px;
        height: 32px;
        font-size: 0.85rem;
    }

    .admin-users-table {
        min-width: 720px;
    }
}

@media (max-width: 576px) {
    .admin-users-page .card-body {
        padding: 1rem;
    }

    .admin-users-page .btn-group .btn {
        width: 100%;
    }
}


@media (max-width: 767px) {
    .trend-row {
        grid-template-columns: 60px 1fr;
        grid-template-rows: auto auto;
    }

    .trend-value {
        grid-column: 1 / -1;
        text-align: left;
    }

    .scope-item {
        grid-template-columns: 1fr;
    }

    .scope-percent {
        text-align: left;
    }
}


/* ========================================
   DARK MODE STYLES
   ======================================== */

body.dark-mode {
    background-color: #1a1a1a !important;
    color: #f0f0f0 !important;
}

body.dark-mode .sidebar-permanent {
    background-color: #2d2d2d;
    border-right: 1px solid #4a4a4a;
}

body.dark-mode .sidebar-header {
    border-bottom: 1px solid #4a4a4a;
}

body.dark-mode .sidebar-title {
    color: #ffffff;
}

body.dark-mode .sidebar-nav a {
    color: #d0d0d0;
}

body.dark-mode .sidebar-nav a:hover {
    background-color: #3a3a3a;
    color: #ffffff;
}

body.dark-mode .sidebar-nav a.active {
    background-color: #3a3a3a;
    color: #ffffff;
}

body.dark-mode .menu-group.active-group > .menu-parent {
    background-color: #3a3a3a;
    color: #ffffff;
}

body.dark-mode .sidebar-submenu {
    background: linear-gradient(to right, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.02));
    border-left: 3px solid rgba(255, 255, 255, 0.2);
}

body.dark-mode .sidebar-submenu a {
    color: #d0d0d0;
}

body.dark-mode .sidebar-submenu a:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: #ffffff;
}

body.dark-mode .sidebar-submenu a.active {
    background-color: rgba(255, 255, 255, 0.15);
    color: #ffffff;
}

body.dark-mode .navbar {
    background-color: #2d2d2d !important;
    border-bottom: 1px solid #4a4a4a !important;
}

body.dark-mode .navbar-brand,
body.dark-mode .navbar .me-2 {
    color: #f5f5f5 !important;
}

body.dark-mode .card {
    background-color: #2d2d2d;
    border-color: #4a4a4a;
    color: #f0f0f0;
}

body.dark-mode .card-header {
    background-color: #3a3a3a !important;
    border-bottom: 1px solid #4a4a4a;
    color: #ffffff !important;
}

body.dark-mode .card-body {
    color: #f0f0f0;
}

body.dark-mode .table {
    color: #f0f0f0;
    border-color: #4a4a4a;
}

body.dark-mode .table-striped tbody tr:nth-of-type(odd) {
    background-color: rgba(255, 255, 255, 0.03);
}

body.dark-mode .table-hover tbody tr:hover {
    background-color: rgba(255, 255, 255, 0.07);
}

body.dark-mode .table th,
body.dark-mode .table td {
    border-color: #4a4a4a;
}

body.dark-mode .table thead th {
    color: #ffffff;
    background-color: #3a3a3a;
}

body.dark-mode .form-control,
body.dark-mode .form-select {
    background-color: #3a3a3a;
    border-color: #555;
    color: #f0f0f0;
}

body.dark-mode .form-control::placeholder {
    color: #999;
}

body.dark-mode .form-control:focus,
body.dark-mode .form-select:focus {
    background-color: #404040;
    border-color: #777;
    color: #f5f5f5;
}

body.dark-mode .text-muted {
    color: #aaa !important;
}

body.dark-mode .border-bottom {
    border-bottom-color: #4a4a4a !important;
}

body.dark-mode .bg-white {
    background-color: #2d2d2d !important;
}

body.dark-mode h1,
body.dark-mode h2,
body.dark-mode h3,
body.dark-mode h4,
body.dark-mode h5,
body.dark-mode h6 {
    color: #ffffff;
}

body.dark-mode label {
    color: #e8e8e8;
}

body.dark-mode .alert {
    border-color: #4a4a4a;
}

body.dark-mode .btn-outline-secondary {
    color: #d0d0d0;
    border-color: #555;
}

body.dark-mode .btn-outline-secondary:hover {
    background-color: #3a3a3a;
    border-color: #666;
    color: #ffffff;
}

body.dark-mode small {
    color: #c0c0c0;
}

/* General text overrides */
body.dark-mode p,
body.dark-mode span:not(.badge),
body.dark-mode li,
body.dark-mode td,
body.dark-mode th {
    color: inherit;
}

body.dark-mode .text-dark {
    color: #e8e8e8 !important;
}

body.dark-mode .text-secondary {
    color: #b0b0b0 !important;
}

body.dark-mode .text-muted {
    color: #999 !important;
}

body.dark-mode .text-body {
    color: #f0f0f0 !important;
}

/* Badge fixes */
body.dark-mode .badge.bg-light,
body.dark-mode .badge.bg-white {
    background-color: #3a3a3a !important;
    color: #e8e8e8 !important;
    border-color: #555 !important;
}

body.dark-mode .badge.bg-warning {
    color: #1a1a1a !important;
}

/* bg-light / bg-white elements */
body.dark-mode .bg-light {
    background-color: #2d2d2d !important;
    color: #e8e8e8 !important;
}

body.dark-mode .bg-white {
    background-color: #2d2d2d !important;
    color: #f0f0f0 !important;
}

/* Card header with hardcoded dark text */
body.dark-mode .card-header.text-dark {
    color: #1a1a1a !important;
}

/* btn-outline-primary, btn-outline-danger etc. */
body.dark-mode .btn-outline-primary {
    color: #86efac;
    border-color: #86efac;
}
body.dark-mode .btn-outline-primary:hover {
    background-color: #86efac;
    color: #14532d;
}
body.dark-mode .btn-outline-danger {
    color: #fca5a5;
    border-color: #fca5a5;
}
body.dark-mode .btn-outline-danger:hover {
    background-color: #fca5a5;
    color: #1a1a1a;
}
body.dark-mode .btn-outline-warning {
    color: #fde68a;
    border-color: #fde68a;
}
body.dark-mode .btn-outline-info {
    color: #93c5fd;
    border-color: #93c5fd;
}
body.dark-mode .btn-outline-success {
    color: #86efac;
    border-color: #86efac;
}

/* Input group text */
body.dark-mode .input-group-text {
    background-color: #3a3a3a;
    border-color: #555;
    color: #d0d0d0;
}

/* List group */
body.dark-mode .list-group-item {
    background-color: #2d2d2d;
    border-color: #4a4a4a;
    color: #e8e8e8;
}

/* Modal */
body.dark-mode .modal-content {
    background-color: #2d2d2d;
    border-color: #4a4a4a;
    color: #f0f0f0;
}
body.dark-mode .modal-header {
    border-bottom-color: #4a4a4a;
}
body.dark-mode .modal-footer {
    border-top-color: #4a4a4a;
}

/* Breadcrumb */
body.dark-mode .breadcrumb-item,
body.dark-mode .breadcrumb-item a {
    color: #b0b0b0;
}
body.dark-mode .breadcrumb-item.active {
    color: #e8e8e8;
}

/* Progress */
body.dark-mode .progress {
    background-color: #3a3a3a;
}

/* Dark mode overrides all sidebar themes */
body.dark-mode[data-sidebar-theme] .sidebar-permanent {
    background-color: #2d2d2d !important;
    border-right: 1px solid #4a4a4a !important;
}

body.dark-mode[data-sidebar-theme] .sidebar-nav a,
body.dark-mode[data-sidebar-theme] .sidebar-title {
    color: #d0d0d0 !important;
}

body.dark-mode[data-sidebar-theme] .sidebar-nav a:hover {
    background-color: #3a3a3a !important;
    color: #ffffff !important;
}

body.dark-mode[data-sidebar-theme] .sidebar-nav a.active {
    background-color: #3a3a3a !important;
    color: #ffffff !important;
    box-shadow: inset 3px 0 0 #ffffff !important;
}

body.dark-mode[data-sidebar-theme] .menu-group.active-group > .menu-parent {
    background-color: #3a3a3a !important;
    color: #ffffff !important;
    box-shadow: inset 3px 0 0 #ffffff !important;
}

body.dark-mode[data-sidebar-theme] .sidebar-submenu {
    background: linear-gradient(to right, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.02)) !important;
    border-left: 3px solid rgba(255, 255, 255, 0.2) !important;
}

body.dark-mode[data-sidebar-theme] .sidebar-submenu a {
    color: #d0d0d0 !important;
}

body.dark-mode[data-sidebar-theme] .sidebar-submenu a:hover {
    background-color: rgba(255, 255, 255, 0.1) !important;
    color: #ffffff !important;
}

body.dark-mode[data-sidebar-theme] .sidebar-submenu a.active {
    background-color: rgba(255, 255, 255, 0.15) !important;
    color: #ffffff !important;
    box-shadow: inset 3px 0 0 #ffffff, 0 2px 4px rgba(0, 0, 0, 0.1) !important;
}

body.dark-mode[data-sidebar-theme] .sidebar-header {
    border-bottom: 1px solid #4a4a4a !important;
}


/* Dropdown User Menu */
.w-25px {
    width: 25px;
    display: inline-block;
}

.hover-bg-light:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

.text-dark-mode-adapt {
    color: #212529;
}

body.dark-mode .text-dark-mode-adapt {
    color: #ffffff;
}

/* ============================================================
   Dark Mode: Generic overrides for ALL custom classes
   Uses Bootstrap 5.3 CSS variables. Bootstrap handles core
   components (.form-control, .input-group-text, .form-select,
   .card, .table, .modal, .btn-outline-*) automatically when
   data-bs-theme="dark" is set on <html>.
   ============================================================ */

/* --- Generic container patterns (sections, cards, panels) --- */
[data-bs-theme="dark"] [class*="-section"]:not(.btn):not(.alert),
[data-bs-theme="dark"] [class$="-card"]:not(.btn):not(.alert):not(.card),
[data-bs-theme="dark"] [class*="-panel"]:not(.btn),
[data-bs-theme="dark"] .scope1-actions,
[data-bs-theme="dark"] .scope2-actions,
[data-bs-theme="dark"] .scope3-actions,
[data-bs-theme="dark"] .other-actions,
[data-bs-theme="dark"] .energy-actions,
[data-bs-theme="dark"] .scope1-tabs,
[data-bs-theme="dark"] .scope2-tabs,
[data-bs-theme="dark"] .scope3-tabs,
[data-bs-theme="dark"] .energy-tabs,
[data-bs-theme="dark"] .filter-card,
[data-bs-theme="dark"] .evidence-card,
[data-bs-theme="dark"] .org-page-header,
[data-bs-theme="dark"] .org-section-card,
[data-bs-theme="dark"] .role-card,
[data-bs-theme="dark"] .summary-card,
[data-bs-theme="dark"] .total-card,
[data-bs-theme="dark"] .scope-card,
[data-bs-theme="dark"] .chart-card,
[data-bs-theme="dark"] .item-card,
[data-bs-theme="dark"] .calc-section,
[data-bs-theme="dark"] .audit-page,
[data-bs-theme="dark"] .ghg-excel-container {
    background-color: var(--bs-tertiary-bg) !important;
    border-color: var(--bs-border-color) !important;
    color: var(--bs-body-color);
}

/* --- Section / panel / card title bars --- */
[data-bs-theme="dark"] [class$="-section-title"],
[data-bs-theme="dark"] [class$="-section-header"],
[data-bs-theme="dark"] [class$="-panel-header"],
[data-bs-theme="dark"] [class$="-card-header"]:not(.card-header),
[data-bs-theme="dark"] .org-section-header,
[data-bs-theme="dark"] .audit-header,
[data-bs-theme="dark"] .scope-header,
[data-bs-theme="dark"] .en-item-header,
[data-bs-theme="dark"] .activity-panel-header {
    background: var(--bs-secondary-bg) !important;
    color: var(--bs-body-color) !important;
    border-bottom-color: var(--bs-border-color) !important;
}

/* --- Custom labels --- */
[data-bs-theme="dark"] [class$="-label"]:not(.form-label):not(.badge) {
    color: var(--bs-body-color) !important;
}

/* --- Notice / info boxes (preserve accent color) --- */
[data-bs-theme="dark"] [class*="-notice"]:not(.btn) {
    background-color: var(--bs-secondary-bg) !important;
    color: var(--bs-body-color) !important;
}

/* --- Add buttons (dashed) --- */
[data-bs-theme="dark"] [class$="-add-btn"],
[data-bs-theme="dark"] .btn-add-item {
    background-color: var(--bs-secondary-bg) !important;
    color: var(--bs-link-color) !important;
    border-color: var(--bs-link-color) !important;
}
[data-bs-theme="dark"] [class$="-add-btn"]:hover,
[data-bs-theme="dark"] .btn-add-item:hover {
    background-color: var(--bs-tertiary-bg) !important;
}

/* --- Tab buttons (inactive) --- */
[data-bs-theme="dark"] .scope1-tab-btn,
[data-bs-theme="dark"] .scope2-tab-btn,
[data-bs-theme="dark"] .scope3-tab-btn,
[data-bs-theme="dark"] .energy-tab-btn,
[data-bs-theme="dark"] .tab-btn {
    color: var(--bs-secondary-color);
    background: transparent;
    border-color: var(--bs-border-color);
}
[data-bs-theme="dark"] .scope1-tab-btn:hover,
[data-bs-theme="dark"] .scope2-tab-btn:hover,
[data-bs-theme="dark"] .scope3-tab-btn:hover,
[data-bs-theme="dark"] .energy-tab-btn:hover,
[data-bs-theme="dark"] .tab-btn:hover {
    background: var(--bs-secondary-bg);
    color: var(--bs-body-color);
}

/* --- Activity timeline / list items --- */
[data-bs-theme="dark"] .activity-item,
[data-bs-theme="dark"] .activity-list li,
[data-bs-theme="dark"] .rank-item,
[data-bs-theme="dark"] .cat-row,
[data-bs-theme="dark"] .sub-row {
    color: var(--bs-body-color);
    border-color: var(--bs-border-color);
}
[data-bs-theme="dark"] .activity-item:hover,
[data-bs-theme="dark"] .rank-item:hover,
[data-bs-theme="dark"] .cat-row:hover,
[data-bs-theme="dark"] .sub-row:hover {
    background: var(--bs-secondary-bg) !important;
}
[data-bs-theme="dark"] .activity-empty,
[data-bs-theme="dark"] .activity-info .act-meta {
    color: var(--bs-secondary-color) !important;
}
[data-bs-theme="dark"] .activity-info .act-title {
    color: var(--bs-body-color) !important;
}

/* --- Upload zone (org_info, evidence) --- */
[data-bs-theme="dark"] .upload-zone {
    background-color: var(--bs-secondary-bg) !important;
    border-color: var(--bs-border-color) !important;
    color: var(--bs-body-color);
}
[data-bs-theme="dark"] .upload-zone:hover {
    background-color: var(--bs-tertiary-bg) !important;
}

/* --- Personnel / data tables --- */
[data-bs-theme="dark"] .personnel-table thead th,
[data-bs-theme="dark"] .audit-table thead th,
[data-bs-theme="dark"] .report-table thead th {
    background: var(--bs-secondary-bg) !important;
    color: var(--bs-body-color) !important;
    border-color: var(--bs-border-color) !important;
}
[data-bs-theme="dark"] .audit-table tr:hover,
[data-bs-theme="dark"] .report-table tr:hover {
    background: var(--bs-secondary-bg) !important;
}
[data-bs-theme="dark"] .formula-cell {
    background: var(--bs-secondary-bg) !important;
    color: var(--bs-body-color) !important;
}

/* --- GHG report excel-like tables --- */
[data-bs-theme="dark"] .ghg-excel thead th,
[data-bs-theme="dark"] .ghg-excel .scope-hdr td,
[data-bs-theme="dark"] .ghg-excel .group-hdr td,
[data-bs-theme="dark"] .ghg-excel .sub-hdr td,
[data-bs-theme="dark"] .ghg-excel .total-col {
    background: var(--bs-secondary-bg) !important;
    color: var(--bs-body-color) !important;
    border-color: var(--bs-border-color) !important;
}
[data-bs-theme="dark"] .ghg-excel .data-row:hover td {
    background: var(--bs-tertiary-bg) !important;
}
[data-bs-theme="dark"] .ghg-excel td {
    border-color: var(--bs-border-color) !important;
    color: var(--bs-body-color);
}

/* --- Scope-specific badges/headers (preserve identity color but readable) --- */
[data-bs-theme="dark"] .sec-badge,
[data-bs-theme="dark"] .scope-badge {
    filter: brightness(1.15);
}

/* --- Year / period toggles --- */
[data-bs-theme="dark"] .year-toggle,
[data-bs-theme="dark"] .period-toggle {
    background: var(--bs-tertiary-bg) !important;
    border-color: var(--bs-border-color) !important;
    color: var(--bs-body-color);
}

/* --- Inline light-bg utility overrides --- */
[data-bs-theme="dark"] [style*="background:#fff"],
[data-bs-theme="dark"] [style*="background: #fff"],
[data-bs-theme="dark"] [style*="background-color:#fff"],
[data-bs-theme="dark"] [style*="background-color: #fff"],
[data-bs-theme="dark"] [style*="background:#f8fafc"],
[data-bs-theme="dark"] [style*="background:#f8faf8"] {
    background-color: var(--bs-tertiary-bg) !important;
}

/* --- Generic label-like classes (NOT ending in -label) --- */
[data-bs-theme="dark"] .en-label,
[data-bs-theme="dark"] .o-label,
[data-bs-theme="dark"] .act-title,
[data-bs-theme="dark"] .act-meta,
[data-bs-theme="dark"] .subsection-title,
[data-bs-theme="dark"] .report-section-title,
[data-bs-theme="dark"] .field-name,
[data-bs-theme="dark"] .col-label,
[data-bs-theme="dark"] .upload-text,
[data-bs-theme="dark"] .activity-panel-header h6,
[data-bs-theme="dark"] .activity-info .act-title,
[data-bs-theme="dark"] .evidence-card-body .card-title,
[data-bs-theme="dark"] .sc-value,
[data-bs-theme="dark"] .sc-label,
[data-bs-theme="dark"] .calc-item .calc-value,
[data-bs-theme="dark"] .calc-item .calc-label,
[data-bs-theme="dark"] .type-bar-label,
[data-bs-theme="dark"] .type-bar-value,
[data-bs-theme="dark"] .prog-text,
[data-bs-theme="dark"] .prog-pct {
    color: var(--bs-body-color) !important;
}
[data-bs-theme="dark"] .act-meta,
[data-bs-theme="dark"] .calc-item .calc-label,
[data-bs-theme="dark"] .type-bar-label {
    color: var(--bs-secondary-color) !important;
}

/* --- Custom action buttons (back / reset / draft / row-remove) --- */
[data-bs-theme="dark"] .btn-back,
[data-bs-theme="dark"] [class*="-actions"] .btn-back {
    background: var(--bs-secondary-bg) !important;
    border-color: var(--bs-border-color) !important;
    color: var(--bs-body-color) !important;
}
[data-bs-theme="dark"] .btn-back:hover,
[data-bs-theme="dark"] [class*="-actions"] .btn-back:hover {
    background: var(--bs-tertiary-bg) !important;
    color: var(--bs-body-color) !important;
}

[data-bs-theme="dark"] .btn-reset,
[data-bs-theme="dark"] [class*="-actions"] .btn-reset,
[data-bs-theme="dark"] .elec-row-remove,
[data-bs-theme="dark"] .row-remove,
[data-bs-theme="dark"] [class$="-row-remove"] {
    background: rgba(239, 68, 68, 0.15) !important;
    border-color: rgba(239, 68, 68, 0.4) !important;
    color: #fca5a5 !important;
}
[data-bs-theme="dark"] .btn-reset:hover,
[data-bs-theme="dark"] [class*="-actions"] .btn-reset:hover,
[data-bs-theme="dark"] .elec-row-remove:hover,
[data-bs-theme="dark"] [class$="-row-remove"]:hover {
    background: rgba(239, 68, 68, 0.28) !important;
    color: #fecaca !important;
}

[data-bs-theme="dark"] .btn-draft,
[data-bs-theme="dark"] [class*="-actions"] .btn-draft {
    background: rgba(34, 197, 94, 0.15) !important;
    border-color: rgba(34, 197, 94, 0.4) !important;
    color: #86efac !important;
}
[data-bs-theme="dark"] .btn-draft:hover,
[data-bs-theme="dark"] [class*="-actions"] .btn-draft:hover {
    background: rgba(34, 197, 94, 0.28) !important;
    color: #bbf7d0 !important;
}

/* --- Activity badges --- */
[data-bs-theme="dark"] .activity-badge.submitted {
    background: rgba(34, 197, 94, 0.18) !important;
    color: #86efac !important;
}
[data-bs-theme="dark"] .activity-badge.draft {
    background: rgba(245, 158, 11, 0.18) !important;
    color: #fcd34d !important;
}

/* --- Evidence/upload chip-style buttons (custom purple) --- */
[data-bs-theme="dark"] .evidence-upload-btn,
[data-bs-theme="dark"] [style*="background:#f3e8ff"],
[data-bs-theme="dark"] [style*="background: #f3e8ff"] {
    background: rgba(168, 85, 247, 0.25) !important;
    border-color: rgba(168, 85, 247, 0.55) !important;
    color: #f3e8ff !important;
}
[data-bs-theme="dark"] .evidence-upload-btn:hover {
    background: rgba(168, 85, 247, 0.40) !important;
    color: #ffffff !important;
}
[data-bs-theme="dark"] .evidence-upload-btn.has-file {
    background: rgba(34, 197, 94, 0.25) !important;
    border-color: rgba(34, 197, 94, 0.55) !important;
    color: #dcfce7 !important;
}
[data-bs-theme="dark"] .evidence-upload-btn.has-file:hover {
    background: rgba(34, 197, 94, 0.40) !important;
    color: #ffffff !important;
}

/* --- Inline rgba()-light pill buttons commonly used --- */
[data-bs-theme="dark"] [style*="background:rgba(239,68,68,.1)"],
[data-bs-theme="dark"] [style*="background: rgba(239,68,68,.1)"] {
    background: rgba(239, 68, 68, 0.18) !important;
    color: #fca5a5 !important;
}
[data-bs-theme="dark"] [style*="background:rgba(245,158,11,.08)"],
[data-bs-theme="dark"] [style*="background: rgba(245,158,11,.08)"] {
    background: rgba(245, 158, 11, 0.18) !important;
    color: #fcd34d !important;
}
[data-bs-theme="dark"] [style*="background:rgba(26,86,50,.08)"],
[data-bs-theme="dark"] [style*="background: rgba(26,86,50,.08)"] {
    background: rgba(34, 197, 94, 0.18) !important;
    color: #86efac !important;
}

body.dark-mode .hover-bg-light:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

body.dark-mode .dropdown-menu {
    background-color: #2d2d2d;
    border: 1px solid #4a4a4a;
}

body.dark-mode .dropdown-item {
    color: #e0e0e0;
}

body.dark-mode .dropdown-item:hover {
    background-color: #3a3a3a;
    color: #ffffff;
}

body.dark-mode .dropdown-header {
    color: #a0a0a0;
}

body.dark-mode .dropdown-divider {
    border-top-color: #4a4a4a;
}


/* ========================================
   SIDEBAR THEME COLORS
   ======================================== */

/* Original Theme (Green - Default System Color) */
body[data-sidebar-theme="original"] .sidebar-permanent {
    background: linear-gradient(180deg, #1A5632 0%, #164A2C 40%, #0F3A20 100%) !important;
    border-right: none;
}

body[data-sidebar-theme="original"] .sidebar-nav a,
body[data-sidebar-theme="original"] .sidebar-title {
    color: rgba(255,255,255,.92);
}

body[data-sidebar-theme="original"] .sidebar-nav a:hover {
    background-color: rgba(255,255,255,.08);
    color: #ffffff;
}

body[data-sidebar-theme="original"] .sidebar-nav a.active {
    background: linear-gradient(135deg, rgba(76,175,80,.25), rgba(76,175,80,.12));
    color: #ffffff;
    box-shadow: inset 3px 0 0 var(--accent);
}

body[data-sidebar-theme="original"] .menu-group.active-group > .menu-parent {
    background: linear-gradient(135deg, rgba(76,175,80,.25), rgba(76,175,80,.12));
    color: #ffffff;
    box-shadow: inset 3px 0 0 var(--accent);
}

body[data-sidebar-theme="original"] .sidebar-submenu {
    background: rgba(0,0,0,.12);
    border-left: none;
}

body[data-sidebar-theme="original"] .sidebar-submenu a {
    color: rgba(255,255,255,.85);
}

body[data-sidebar-theme="original"] .sidebar-submenu a:hover {
    background-color: rgba(76,175,80,.1);
    color: #fff;
}

body[data-sidebar-theme="original"] .sidebar-submenu a.active {
    background-color: rgba(76,175,80,.18);
    color: #fff;
    box-shadow: inset 3px 0 0 var(--accent), 0 2px 4px rgba(76,175,80,.1);
}

body[data-sidebar-theme="original"] .sidebar-header {
    border-bottom: 1px solid rgba(255,255,255,.1);
}

/* Default Theme (Purple-Blue) */
body[data-sidebar-theme="default"] .sidebar-permanent {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

body[data-sidebar-theme="default"] .sidebar-nav a,
body[data-sidebar-theme="default"] .sidebar-title {
    color: rgba(255, 255, 255, 0.9);
}

body[data-sidebar-theme="default"] .sidebar-nav a:hover {
    background-color: rgba(255, 255, 255, 0.15);
    color: #ffffff;
}

body[data-sidebar-theme="default"] .sidebar-nav a.active {
    background-color: rgba(255, 255, 255, 0.2);
    color: #ffffff;
    box-shadow: inset 3px 0 0 #ffffff;
}

body[data-sidebar-theme="default"] .menu-group.active-group > .menu-parent {
    background-color: rgba(255, 255, 255, 0.2);
    color: #ffffff;
    box-shadow: inset 3px 0 0 #ffffff;
}

body[data-sidebar-theme="default"] .sidebar-submenu {
    background: linear-gradient(to right, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.04));
    border-left: 3px solid rgba(255, 255, 255, 0.3);
}

body[data-sidebar-theme="default"] .sidebar-submenu a {
    color: rgba(255, 255, 255, 0.85);
}

body[data-sidebar-theme="default"] .sidebar-submenu a:hover {
    background-color: rgba(255, 255, 255, 0.15);
    color: #ffffff;
}

body[data-sidebar-theme="default"] .sidebar-submenu a.active {
    background-color: rgba(255, 255, 255, 0.25);
    color: #ffffff;
    box-shadow: inset 3px 0 0 #ffffff, 0 2px 4px rgba(0, 0, 0, 0.1);
}

body[data-sidebar-theme="default"] .sidebar-header {
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

/* Blue Theme */
body[data-sidebar-theme="blue"] .sidebar-permanent {
    background: linear-gradient(135deg, #2196F3 0%, #1976D2 100%);
}

body[data-sidebar-theme="blue"] .sidebar-nav a,
body[data-sidebar-theme="blue"] .sidebar-title {
    color: rgba(255, 255, 255, 0.9);
}

body[data-sidebar-theme="blue"] .sidebar-nav a:hover {
    background-color: rgba(255, 255, 255, 0.15);
    color: #ffffff;
}

body[data-sidebar-theme="blue"] .sidebar-nav a.active {
    background-color: rgba(255, 255, 255, 0.2);
    color: #ffffff;
    box-shadow: inset 3px 0 0 #ffffff;
}

body[data-sidebar-theme="blue"] .menu-group.active-group > .menu-parent {
    background-color: rgba(255, 255, 255, 0.2);
    color: #ffffff;
    box-shadow: inset 3px 0 0 #ffffff;
}

body[data-sidebar-theme="blue"] .sidebar-submenu {
    background: linear-gradient(to right, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.04));
    border-left: 3px solid rgba(255, 255, 255, 0.3);
}

body[data-sidebar-theme="blue"] .sidebar-submenu a {
    color: rgba(255, 255, 255, 0.85);
}

body[data-sidebar-theme="blue"] .sidebar-submenu a:hover {
    background-color: rgba(255, 255, 255, 0.15);
    color: #ffffff;
}

body[data-sidebar-theme="blue"] .sidebar-submenu a.active {
    background-color: rgba(255, 255, 255, 0.25);
    color: #ffffff;
    box-shadow: inset 3px 0 0 #ffffff, 0 2px 4px rgba(0, 0, 0, 0.1);
}

body[data-sidebar-theme="blue"] .sidebar-header {
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

/* Green Theme */
body[data-sidebar-theme="green"] .sidebar-permanent {
    background: linear-gradient(135deg, #4CAF50 0%, #388E3C 100%);
}

body[data-sidebar-theme="green"] .sidebar-nav a,
body[data-sidebar-theme="green"] .sidebar-title {
    color: rgba(255, 255, 255, 0.9);
}

body[data-sidebar-theme="green"] .sidebar-nav a:hover {
    background-color: rgba(255, 255, 255, 0.15);
    color: #ffffff;
}

body[data-sidebar-theme="green"] .sidebar-nav a.active {
    background-color: rgba(255, 255, 255, 0.2);
    color: #ffffff;
    box-shadow: inset 3px 0 0 #ffffff;
}

body[data-sidebar-theme="green"] .menu-group.active-group > .menu-parent {
    background-color: rgba(255, 255, 255, 0.2);
    color: #ffffff;
    box-shadow: inset 3px 0 0 #ffffff;
}

body[data-sidebar-theme="green"] .sidebar-submenu {
    background: linear-gradient(to right, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.04));
    border-left: 3px solid rgba(255, 255, 255, 0.3);
}

body[data-sidebar-theme="green"] .sidebar-submenu a {
    color: rgba(255, 255, 255, 0.85);
}

body[data-sidebar-theme="green"] .sidebar-submenu a:hover {
    background-color: rgba(255, 255, 255, 0.15);
    color: #ffffff;
}

body[data-sidebar-theme="green"] .sidebar-submenu a.active {
    background-color: rgba(255, 255, 255, 0.25);
    color: #ffffff;
    box-shadow: inset 3px 0 0 #ffffff, 0 2px 4px rgba(0, 0, 0, 0.1);
}

body[data-sidebar-theme="green"] .sidebar-header {
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

/* Orange Theme */
body[data-sidebar-theme="orange"] .sidebar-permanent {
    background: linear-gradient(135deg, #FF9800 0%, #F57C00 100%);
}

body[data-sidebar-theme="orange"] .sidebar-nav a,
body[data-sidebar-theme="orange"] .sidebar-title {
    color: rgba(255, 255, 255, 0.9);
}

body[data-sidebar-theme="orange"] .sidebar-nav a:hover {
    background-color: rgba(255, 255, 255, 0.15);
    color: #ffffff;
}

body[data-sidebar-theme="orange"] .sidebar-nav a.active {
    background-color: rgba(255, 255, 255, 0.2);
    color: #ffffff;
    box-shadow: inset 3px 0 0 #ffffff;
}

body[data-sidebar-theme="orange"] .menu-group.active-group > .menu-parent {
    background-color: rgba(255, 255, 255, 0.2);
    color: #ffffff;
    box-shadow: inset 3px 0 0 #ffffff;
}

body[data-sidebar-theme="orange"] .sidebar-submenu {
    background: linear-gradient(to right, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.04));
    border-left: 3px solid rgba(255, 255, 255, 0.3);
}

body[data-sidebar-theme="orange"] .sidebar-submenu a {
    color: rgba(255, 255, 255, 0.85);
}

body[data-sidebar-theme="orange"] .sidebar-submenu a:hover {
    background-color: rgba(255, 255, 255, 0.15);
    color: #ffffff;
}

body[data-sidebar-theme="orange"] .sidebar-submenu a.active {
    background-color: rgba(255, 255, 255, 0.25);
    color: #ffffff;
    box-shadow: inset 3px 0 0 #ffffff, 0 2px 4px rgba(0, 0, 0, 0.1);
}

body[data-sidebar-theme="orange"] .sidebar-header {
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

/* Red Theme */
body[data-sidebar-theme="red"] .sidebar-permanent {
    background: linear-gradient(135deg, #F44336 0%, #D32F2F 100%);
}

body[data-sidebar-theme="red"] .sidebar-nav a,
body[data-sidebar-theme="red"] .sidebar-title {
    color: rgba(255, 255, 255, 0.9);
}

body[data-sidebar-theme="red"] .sidebar-nav a:hover {
    background-color: rgba(255, 255, 255, 0.15);
    color: #ffffff;
}

body[data-sidebar-theme="red"] .sidebar-nav a.active {
    background-color: rgba(255, 255, 255, 0.2);
    color: #ffffff;
    box-shadow: inset 3px 0 0 #ffffff;
}

body[data-sidebar-theme="red"] .menu-group.active-group > .menu-parent {
    background-color: rgba(255, 255, 255, 0.2);
    color: #ffffff;
    box-shadow: inset 3px 0 0 #ffffff;
}

body[data-sidebar-theme="red"] .sidebar-submenu {
    background: linear-gradient(to right, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.04));
    border-left: 3px solid rgba(255, 255, 255, 0.3);
}

body[data-sidebar-theme="red"] .sidebar-submenu a {
    color: rgba(255, 255, 255, 0.85);
}

body[data-sidebar-theme="red"] .sidebar-submenu a:hover {
    background-color: rgba(255, 255, 255, 0.15);
    color: #ffffff;
}

body[data-sidebar-theme="red"] .sidebar-submenu a.active {
    background-color: rgba(255, 255, 255, 0.25);
    color: #ffffff;
    box-shadow: inset 3px 0 0 #ffffff, 0 2px 4px rgba(0, 0, 0, 0.1);
}

body[data-sidebar-theme="red"] .sidebar-header {
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

/* Teal Theme */
body[data-sidebar-theme="teal"] .sidebar-permanent {
    background: linear-gradient(135deg, #009688 0%, #00796B 100%);
}

body[data-sidebar-theme="teal"] .sidebar-nav a,
body[data-sidebar-theme="teal"] .sidebar-title {
    color: rgba(255, 255, 255, 0.9);
}

body[data-sidebar-theme="teal"] .sidebar-nav a:hover {
    background-color: rgba(255, 255, 255, 0.15);
    color: #ffffff;
}

body[data-sidebar-theme="teal"] .sidebar-nav a.active {
    background-color: rgba(255, 255, 255, 0.2);
    color: #ffffff;
    box-shadow: inset 3px 0 0 #ffffff;
}

body[data-sidebar-theme="teal"] .menu-group.active-group > .menu-parent {
    background-color: rgba(255, 255, 255, 0.2);
    color: #ffffff;
    box-shadow: inset 3px 0 0 #ffffff;
}

body[data-sidebar-theme="teal"] .sidebar-submenu {
    background: linear-gradient(to right, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.04));
    border-left: 3px solid rgba(255, 255, 255, 0.3);
}

body[data-sidebar-theme="teal"] .sidebar-submenu a {
    color: rgba(255, 255, 255, 0.85);
}

body[data-sidebar-theme="teal"] .sidebar-submenu a:hover {
    background-color: rgba(255, 255, 255, 0.15);
    color: #ffffff;
}

body[data-sidebar-theme="teal"] .sidebar-submenu a.active {
    background-color: rgba(255, 255, 255, 0.25);
    color: #ffffff;
    box-shadow: inset 3px 0 0 #ffffff, 0 2px 4px rgba(0, 0, 0, 0.1);
}

body[data-sidebar-theme="teal"] .sidebar-header {
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

/* Indigo Theme */
body[data-sidebar-theme="indigo"] .sidebar-permanent {
    background: linear-gradient(135deg, #3F51B5 0%, #283593 100%);
}

body[data-sidebar-theme="indigo"] .sidebar-nav a,
body[data-sidebar-theme="indigo"] .sidebar-title {
    color: rgba(255, 255, 255, 0.9);
}

body[data-sidebar-theme="indigo"] .sidebar-nav a:hover {
    background-color: rgba(255, 255, 255, 0.15);
    color: #ffffff;
}

body[data-sidebar-theme="indigo"] .sidebar-nav a.active {
    background-color: rgba(255, 255, 255, 0.2);
    color: #ffffff;
    box-shadow: inset 3px 0 0 #ffffff;
}

body[data-sidebar-theme="indigo"] .menu-group.active-group > .menu-parent {
    background-color: rgba(255, 255, 255, 0.2);
    color: #ffffff;
    box-shadow: inset 3px 0 0 #ffffff;
}

body[data-sidebar-theme="indigo"] .sidebar-submenu {
    background: linear-gradient(to right, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.04));
    border-left: 3px solid rgba(255, 255, 255, 0.3);
}

body[data-sidebar-theme="indigo"] .sidebar-submenu a {
    color: rgba(255, 255, 255, 0.85);
}

body[data-sidebar-theme="indigo"] .sidebar-submenu a:hover {
    background-color: rgba(255, 255, 255, 0.15);
    color: #ffffff;
}

body[data-sidebar-theme="indigo"] .sidebar-submenu a.active {
    background-color: rgba(255, 255, 255, 0.25);
    color: #ffffff;
    box-shadow: inset 3px 0 0 #ffffff, 0 2px 4px rgba(0, 0, 0, 0.1);
}

body[data-sidebar-theme="indigo"] .sidebar-header {
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

/* Dark Theme */
body[data-sidebar-theme="dark"] .sidebar-permanent {
    background: linear-gradient(135deg, #424242 0%, #212121 100%);
}

body[data-sidebar-theme="dark"] .sidebar-nav a,
body[data-sidebar-theme="dark"] .sidebar-title {
    color: rgba(255, 255, 255, 0.9);
}

body[data-sidebar-theme="dark"] .sidebar-nav a:hover {
    background-color: rgba(255, 255, 255, 0.15);
    color: #ffffff;
}

body[data-sidebar-theme="dark"] .sidebar-nav a.active {
    background-color: rgba(255, 255, 255, 0.2);
    color: #ffffff;
    box-shadow: inset 3px 0 0 #ffffff;
}

body[data-sidebar-theme="dark"] .menu-group.active-group > .menu-parent {
    background-color: rgba(255, 255, 255, 0.2);
    color: #ffffff;
    box-shadow: inset 3px 0 0 #ffffff;
}

body[data-sidebar-theme="dark"] .sidebar-submenu {
    background: linear-gradient(to right, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.04));
    border-left: 3px solid rgba(255, 255, 255, 0.3);
}

body[data-sidebar-theme="dark"] .sidebar-submenu a {
    color: rgba(255, 255, 255, 0.85);
}

body[data-sidebar-theme="dark"] .sidebar-submenu a:hover {
    background-color: rgba(255, 255, 255, 0.15);
    color: #ffffff;
}

body[data-sidebar-theme="dark"] .sidebar-submenu a.active {
    background-color: rgba(255, 255, 255, 0.25);
    color: #ffffff;
    box-shadow: inset 3px 0 0 #ffffff, 0 2px 4px rgba(0, 0, 0, 0.1);
}

body[data-sidebar-theme="dark"] .sidebar-header {
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

/* ================================================
   Activity Timeline Styles
   ================================================ */
.activity-timeline {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.activity-item {
    padding: 14px 16px;
    border-radius: 12px;
    border: 1px solid transparent;
    transition: all 0.2s ease;
    color: var(--text-color, #1f2937);
    position: relative;
}

.activity-item:hover {
    background-color: #f8f9fa;
    border-color: #e2e8f0;
    transform: translateX(4px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

.activity-item:not(:last-child)::after {
    content: '';
    position: absolute;
    left: 35px;
    bottom: -1px;
    width: calc(100% - 70px);
    height: 1px;
    background: #e9ecef;
}

.activity-item:hover::after {
    display: none;
}

.activity-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
    color: #fff;
}

.activity-icon.bg-scope1 {
    background: linear-gradient(135deg, #ef4444, #f97316);
}

.activity-icon.bg-scope2 {
    background: linear-gradient(135deg, #43A047, #66BB6A);
}

.activity-icon.bg-scope3 {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
}

.activity-icon.bg-ghg {
    background: linear-gradient(135deg, #16a34a, #22c55e);
}

.activity-icon.bg-energy {
    background: linear-gradient(135deg, #2563eb, #3b82f6);
}

.activity-title {
    font-size: 0.95rem;
    color: #1f2937;
    line-height: 1.4;
}

.edit-hint {
    font-size: 0.78rem;
    color: transparent;
    font-weight: 600;
    transition: color 0.2s ease;
}

.activity-item:hover .edit-hint {
    color: #2563eb;
}

/* Clickable rows in history table */
.clickable-row {
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.clickable-row:hover {
    background-color: #e8f4ff !important;
}

.clickable-row:hover td {
    color: #1e40af;
}

/* Responsive adjustments for activity items */
@media (max-width: 768px) {
    .activity-item .d-flex.justify-content-between {
        flex-direction: column;
    }
    .activity-item .text-end {
        text-align: left !important;
        margin-left: 0 !important;
        margin-top: 8px;
    }
    .edit-hint {
        color: #2563eb;
    }
}

/* ========================================
   PROFESSIONAL POLISH & CONSISTENCY
   ======================================== */

/* Page headings */
h1, h2, h3, h4, h5, h6 {
    letter-spacing: -0.02em;
    color: inherit;
}

/* Consistent row inputs - same height on same row */
.row > [class*="col"] .form-control,
.row > [class*="col"] .form-select,
.row > [class*="col"] .input-group-text {
    height: 42px;
    font-size: 0.9rem;
}

.row > [class*="col"] textarea.form-control {
    height: auto;
    min-height: 80px;
}

/* Input group tight fit for same-row alignment */
.input-group > .form-control,
.input-group > .form-select {
    height: 42px;
}

.input-group > .input-group-text {
    height: 42px;
    padding: 0.5rem 0.65rem;
    font-size: 0.85rem;
}

/* Better table styling */
.table {
    font-size: 0.9rem;
}

.table thead th {
    background: #f8fafc;
    font-weight: 700;
    font-size: 0.82rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    border-bottom: 2px solid var(--border-color);
    padding: 0.75rem;
}

.table td {
    padding: 0.7rem 0.75rem;
    vertical-align: middle;
}

/* Badge improvements */
.badge {
    font-weight: 600;
    letter-spacing: 0.01em;
    border-radius: 6px;
    padding: 0.35rem 0.6rem;
}

/* Container padding for main content */
.main-content-left {
    padding-left: 1.5rem !important;
    padding-right: 1.5rem !important;
}

/* Smooth transitions across the board */
.card, .btn, .form-control, .form-select, .badge, .nav-link {
    transition: all 0.2s ease;
}

/* Better scrollbar for the whole page */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: #f1f5f9;
}
::-webkit-scrollbar-thumb {
    background: #c1c9d4;
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Navbar brand subtitle */
.navbar .text-muted {
    font-weight: 500;
}

/* Better alert toasts */
.alert-toast {
    border-radius: 10px;
    font-size: 0.88rem;
}

/* Print styles */
/* ── Evidence Upload Button (inline with section titles) ── */
.evidence-upload-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 13px;
    border-radius: 7px;
    background: rgba(139, 92, 246, .10);
    color: #7c3aed;
    border: 1px solid rgba(139, 92, 246, .30);
    font-size: .75rem;
    font-weight: 600;
    cursor: pointer;
    margin-left: auto;
    transition: all .2s;
    white-space: nowrap;
    flex-shrink: 0;
    line-height: 1.6;
}
.evidence-upload-btn:hover {
    background: rgba(139, 92, 246, .18);
    border-color: #7c3aed;
}
.evidence-upload-btn.has-file {
    background: rgba(34, 197, 94, .10);
    color: #16a34a;
    border-color: rgba(34, 197, 94, .30);
}
.evidence-upload-btn.has-file:hover {
    background: rgba(34, 197, 94, .18);
    border-color: #16a34a;
}

@media print {
    .sidebar-permanent,
    .navbar,
    #sidebarToggle {
        display: none !important;
    }
    .main-wrapper {
        margin-left: 0 !important;
    }
}
