/* ============================================================
   🌿 DIGITAL GREENHOUSE — Design System CSS
   ERP Hoa Linh — Creative North Star: "The Digital Greenhouse"
   
   Transforms rigid ERP into an organic, breathable workspace
   through tonal layering, editorial typography, and atmospheric depth.
   ============================================================ */

/* ===== 1. DESIGN TOKENS ===== */
:root {
    /* ── Surface Hierarchy (Tonal Architecture) ── */
    --gh-bg: #f6faff;                          /* Canvas / Background */
    --gh-surface: #f0f5f1;                     /* Base surface */
    --gh-surface-low: #e8f0e9;                 /* Secondary areas (sidebar) */
    --gh-surface-highest: #dce8dd;             /* High-priority interactive */
    --gh-surface-lowest: #ffffff;              /* Floating cards / active paper */
    --gh-surface-tint: rgba(0, 107, 50, 0.05);/* Subtle brand presence */

    /* ── Primary (Forest Green) ── */
    --gh-primary: #006b32;
    --gh-primary-container: #008740;
    --gh-primary-fixed: #78fc9c;
    --gh-on-primary: #ffffff;
    --gh-on-primary-container: #e0ffe8;

    /* ── Secondary (Sage) ── */
    --gh-secondary: #4e6354;
    --gh-secondary-container: rgba(196, 216, 199, 0.3);
    --gh-on-secondary-container: #0c1f12;

    /* ── Tertiary (Mint-Teal) ── */
    --gh-tertiary: #3a6568;
    --gh-tertiary-container: #bcebee;
    --gh-on-tertiary-container: #002022;

    /* ── Error ── */
    --gh-error: #ba1a1a;
    --gh-error-container: #ffdad6;
    --gh-on-error: #ffffff;

    /* ── Text / Content ── */
    --gh-on-surface: #0d1d27;
    --gh-on-surface-variant: #40484c;
    --gh-text-muted: #6b7a80;

    /* ── Outline (Ghost Borders) ── */
    --gh-outline: #70787c;
    --gh-outline-variant: rgba(188, 202, 187, 0.15); /* 15% opacity — RULE */

    /* ── Typography ── */
    --gh-font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

    /* ── Spacing & Radius ── */
    --gh-radius-sm: 4px;
    --gh-radius: 8px;
    --gh-radius-md: 12px;
    --gh-radius-lg: 16px;
    --gh-radius-xl: 24px;
    --gh-spacing-1: 0.25rem;
    --gh-spacing-2: 0.5rem;
    --gh-spacing-3: 0.75rem;
    --gh-spacing-4: 1rem;
    --gh-spacing-5: 1.25rem;
    --gh-spacing-6: 1.5rem;

    /* ── Elevation (Ambient Shadows) ── */
    --gh-shadow-sm: 0 2px 8px rgba(13, 29, 39, 0.04);
    --gh-shadow: 0 8px 32px rgba(13, 29, 39, 0.06);
    --gh-shadow-lg: 0 16px 48px rgba(13, 29, 39, 0.10);
    --gh-shadow-hover: 0 12px 40px rgba(13, 29, 39, 0.09);

    /* ── Glassmorphism ── */
    --gh-glass-bg: rgba(255, 255, 255, 0.60);
    --gh-glass-blur: blur(20px);
    --gh-glass-border: 1px solid rgba(255, 255, 255, 0.25);

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

/* ===== 2. TYPOGRAPHY SCALE ===== */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* Display — Dashboard summaries */
.gh-display-md { font-size: 2.25rem; font-weight: 700; line-height: 1.15; letter-spacing: -0.5px; color: var(--gh-on-surface); }
.gh-display-sm { font-size: 1.75rem; font-weight: 700; line-height: 1.2; letter-spacing: -0.25px; color: var(--gh-on-surface); }

/* Headline — Section headers */
.gh-headline-lg { font-size: 1.5rem; font-weight: 700; line-height: 1.3; color: var(--gh-on-surface); }
.gh-headline-md { font-size: 1.25rem; font-weight: 600; line-height: 1.35; color: var(--gh-on-surface); }

/* Title — Data anchors */
.gh-title-lg { font-size: 1.125rem; font-weight: 600; line-height: 1.4; color: var(--gh-on-surface); }
.gh-title-md { font-size: 1rem; font-weight: 600; line-height: 1.4; color: var(--gh-on-surface); }
.gh-title-sm { font-size: 0.875rem; font-weight: 600; line-height: 1.4; color: var(--gh-on-surface); }

/* Body — Workhorse */
.gh-body-lg { font-size: 1rem; font-weight: 400; line-height: 1.6; }
.gh-body-md { font-size: 0.875rem; font-weight: 400; line-height: 1.6; }
.gh-body-sm { font-size: 0.8125rem; font-weight: 400; line-height: 1.5; }

/* Label — Metadata, micro-copy */
.gh-label-lg { font-size: 0.8125rem; font-weight: 600; line-height: 1.4; letter-spacing: 0.3px; }
.gh-label-md { font-size: 0.75rem; font-weight: 600; line-height: 1.4; letter-spacing: 0.3px; }
.gh-label-sm { font-size: 0.6875rem; font-weight: 500; line-height: 1.3; letter-spacing: 0.4px; text-transform: uppercase; }

/* ===== 3. ANIMATIONS ===== */
@keyframes ghFadeIn {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes ghSlideUp {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes ghPulseGlow {
    0%, 100% { box-shadow: 0 0 0 0 rgba(0, 107, 50, 0.15); }
    50%      { box-shadow: 0 0 0 8px rgba(0, 107, 50, 0); }
}
@keyframes ghShimmer {
    0%   { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

.gh-animate { animation: ghFadeIn 0.4s cubic-bezier(0.22, 1, 0.36, 1) both; }
.gh-animate-d1 { animation-delay: 0.05s; }
.gh-animate-d2 { animation-delay: 0.10s; }
.gh-animate-d3 { animation-delay: 0.15s; }
.gh-animate-d4 { animation-delay: 0.20s; }
.gh-animate-d5 { animation-delay: 0.25s; }
.gh-animate-d6 { animation-delay: 0.30s; }

/* ===== 4. BOOTSTRAP 5 OVERRIDES ===== */

/* ── 4a. Base Resets ── */
body {
    font-family: var(--gh-font);
    color: var(--gh-on-surface);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a { color: var(--gh-primary); transition: color var(--gh-transition-fast); }
a:hover { color: var(--gh-primary-container); }

::selection { background: rgba(0, 107, 50, 0.15); color: var(--gh-on-surface); }

/* ── 4b. Buttons ── */
.btn {
    border-radius: var(--gh-radius);
    font-weight: 600;
    font-size: 0.85rem;
    padding: 0.5rem 1.15rem;
    transition: all var(--gh-transition);
    border: none;
    letter-spacing: 0.2px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--gh-primary) 0%, var(--gh-primary-container) 100%);
    color: var(--gh-on-primary);
    box-shadow: 0 2px 8px rgba(0, 107, 50, 0.2);
}
.btn-primary:hover, .btn-primary:focus {
    background: linear-gradient(135deg, var(--gh-primary-container) 0%, var(--gh-primary) 100%);
    box-shadow: var(--gh-shadow);
    transform: translateY(-1px);
    color: var(--gh-on-primary);
}
.btn-primary:active { transform: translateY(0); box-shadow: var(--gh-shadow-sm); }

.btn-outline-primary {
    background: transparent;
    border: 1.5px solid var(--gh-primary);
    color: var(--gh-primary);
}
.btn-outline-primary:hover {
    background: var(--gh-primary);
    color: var(--gh-on-primary);
    box-shadow: 0 4px 12px rgba(0, 107, 50, 0.2);
}

.btn-secondary {
    background: var(--gh-glass-bg);
    backdrop-filter: var(--gh-glass-blur);
    -webkit-backdrop-filter: var(--gh-glass-blur);
    color: var(--gh-on-surface);
    border: var(--gh-glass-border);
}
.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.8);
    color: var(--gh-on-surface);
    box-shadow: var(--gh-shadow-sm);
}

.btn-success {
    background: linear-gradient(135deg, #10b981 0%, #34d399 100%);
    color: #fff;
    border: none;
}
.btn-success:hover { box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3); transform: translateY(-1px); }

.btn-danger {
    background: linear-gradient(135deg, var(--gh-error) 0%, #dc2626 100%);
    color: #fff;
    border: none;
}
.btn-danger:hover { box-shadow: 0 4px 12px rgba(186, 26, 26, 0.3); transform: translateY(-1px); }

.btn-warning {
    background: linear-gradient(135deg, #f59e0b 0%, #fbbf24 100%);
    color: #1a1a1a;
    border: none;
}

.btn-info {
    background: linear-gradient(135deg, #0e7490 0%, #0891b2 100%);
    color: #fff;
    border: none;
}
.btn-info:hover { box-shadow: 0 4px 12px rgba(14, 116, 144, 0.3); transform: translateY(-1px); }

.btn-light {
    background: var(--gh-surface-lowest);
    color: var(--gh-on-surface);
    border: 1px solid var(--gh-outline-variant);
}
.btn-light:hover { background: var(--gh-surface); }

.btn-sm { font-size: 0.78rem; padding: 0.35rem 0.85rem; border-radius: var(--gh-radius-sm); }
.btn-lg { font-size: 0.95rem; padding: 0.65rem 1.5rem; border-radius: var(--gh-radius-md); }

/* ── 4c. Form Controls ── */
.form-control, .form-select {
    background-color: var(--gh-surface-highest);
    border: none;
    border-bottom: 2px solid var(--gh-outline-variant);
    border-radius: var(--gh-radius) var(--gh-radius) 0 0;
    color: var(--gh-on-surface);
    font-size: 0.875rem;
    padding: 0.6rem 0.85rem;
    transition: border-color var(--gh-transition), box-shadow var(--gh-transition);
}
.form-control:focus, .form-select:focus {
    background-color: var(--gh-surface-highest);
    border-bottom-color: var(--gh-primary);
    box-shadow: 0 2px 0 0 var(--gh-primary);
    color: var(--gh-on-surface);
}
.form-control::placeholder { color: var(--gh-text-muted); opacity: 0.7; }

.form-label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--gh-on-surface-variant);
    letter-spacing: 0.3px;
    margin-bottom: 0.35rem;
}

.input-group-text {
    background-color: var(--gh-surface-highest);
    border: none;
    border-bottom: 2px solid var(--gh-outline-variant);
    color: var(--gh-on-surface-variant);
    border-radius: var(--gh-radius) 0 0 0;
}
.input-group .form-control { border-radius: 0 var(--gh-radius) 0 0; }

.form-check-input:checked {
    background-color: var(--gh-primary);
    border-color: var(--gh-primary);
}
.form-check-input:focus { box-shadow: 0 0 0 3px rgba(0, 107, 50, 0.15); }

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

/* ── 4d. Cards ── */
.card {
    background: var(--gh-surface-lowest);
    border: none;
    border-radius: var(--gh-radius-md);
    box-shadow: var(--gh-shadow-sm);
    transition: box-shadow var(--gh-transition), transform var(--gh-transition);
}
.card:hover { box-shadow: var(--gh-shadow); }

.card-header {
    background: var(--gh-surface);
    border-bottom: 1px solid var(--gh-outline-variant);
    border-radius: var(--gh-radius-md) var(--gh-radius-md) 0 0 !important;
    padding: 1rem 1.25rem;
    font-weight: 600;
    color: var(--gh-on-surface);
}

.card-body { padding: 1.25rem; }

.card-footer {
    background: var(--gh-surface);
    border-top: 1px solid var(--gh-outline-variant);
    border-radius: 0 0 var(--gh-radius-md) var(--gh-radius-md) !important;
}

/* ── 4e. Tables ── */
.table { color: var(--gh-on-surface); font-size: 0.84rem; }

.table > thead > tr > th {
    background: var(--gh-surface);
    color: var(--gh-on-surface-variant);
    font-weight: 700;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--gh-outline-variant) !important;
    padding: 0.75rem 0.85rem;
    vertical-align: middle;
    white-space: nowrap;
}

.table > tbody > tr > td {
    padding: 0.65rem 0.85rem;
    border-bottom: 1px solid var(--gh-outline-variant);
    vertical-align: middle;
}

.table > tbody > tr {
    transition: background-color var(--gh-transition-fast);
}
.table > tbody > tr:hover {
    background-color: var(--gh-secondary-container) !important;
}

/* table-dark is applied TO the <thead>, not a parent wrapper */
thead.table-dark > tr > th,
.table-dark > thead > tr > th {
    background: var(--gh-on-surface);
    color: var(--gh-surface-lowest);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
    padding: 0.65rem 0.85rem;
    vertical-align: middle;
    border-bottom: none !important;
}

/* Contextual thead overrides */
thead.table-warning > tr > th {
    background: rgba(245, 158, 11, 0.12);
    color: #92400e;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid rgba(245, 158, 11, 0.2) !important;
}

thead.table-danger > tr > th {
    background: rgba(186, 26, 26, 0.08);
    color: #7f1d1d;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid rgba(186, 26, 26, 0.15) !important;
}

.table-striped > tbody > tr:nth-of-type(odd) > td {
    background-color: rgba(0, 107, 50, 0.02);
}

/* Sticky table headers (used with .table-container scrollable wrapper) */
.table-sticky thead th {
    position: sticky;
    top: 0;
    z-index: 10;
}

/* ── 4f. Modals ── */
.modal-content {
    background: var(--gh-glass-bg);
    backdrop-filter: var(--gh-glass-blur);
    -webkit-backdrop-filter: var(--gh-glass-blur);
    border: var(--gh-glass-border);
    border-radius: var(--gh-radius-lg);
    box-shadow: var(--gh-shadow-lg);
}

.modal-header {
    background: transparent;
    border-bottom: 1px solid var(--gh-outline-variant);
    padding: 1.15rem 1.5rem;
}
.modal-header .modal-title { font-weight: 700; color: var(--gh-on-surface); }
.modal-header .btn-close { opacity: 0.6; }
.modal-header .btn-close:hover { opacity: 1; }

.modal-body { padding: 1.5rem; }

.modal-footer {
    background: transparent;
    border-top: 1px solid var(--gh-outline-variant);
    padding: 1rem 1.5rem;
}

.modal-backdrop.show { backdrop-filter: blur(4px); }

/* ── 4g. Badges & Chips ── */
.badge {
    font-weight: 600;
    font-size: 0.72rem;
    padding: 0.35rem 0.65rem;
    border-radius: var(--gh-radius);
    letter-spacing: 0.3px;
}

.badge.bg-primary { background: var(--gh-primary) !important; }
.badge.bg-success { background: linear-gradient(135deg, #10b981, #34d399) !important; }
.badge.bg-danger { background: var(--gh-error) !important; }
.badge.bg-warning { background: linear-gradient(135deg, #f59e0b, #fbbf24) !important; color: #1a1a1a !important; }
.badge.bg-info { background: linear-gradient(135deg, #0e7490, #0891b2) !important; color: #fff !important; }
.badge.bg-secondary { background: var(--gh-on-surface-variant) !important; }

/* Badge tinted variants (bg-X bg-opacity-10 text-X) — ensure readability */
.badge.bg-info.bg-opacity-10 {
    background: rgba(14, 116, 144, 0.12) !important;
    color: #0e7490 !important;
}
.badge.bg-primary.bg-opacity-10 {
    background: rgba(0, 107, 50, 0.1) !important;
    color: var(--gh-primary) !important;
}
.badge.bg-success.bg-opacity-10 {
    background: rgba(16, 185, 129, 0.1) !important;
    color: #059669 !important;
}
.badge.bg-danger.bg-opacity-10 {
    background: rgba(186, 26, 26, 0.08) !important;
    color: var(--gh-error) !important;
}
.badge.bg-warning.bg-opacity-10 {
    background: rgba(245, 158, 11, 0.1) !important;
    color: #b45309 !important;
}
.badge.bg-secondary.bg-opacity-10 {
    background: rgba(64, 72, 76, 0.08) !important;
    color: var(--gh-on-surface-variant) !important;
}

/* Status Chips — high chroma for dense tables */
.gh-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 0.3rem 0.7rem;
    border-radius: var(--gh-radius);
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.2px;
}
.gh-chip-success { background: var(--gh-tertiary-container); color: var(--gh-on-tertiary-container); }
.gh-chip-error   { background: var(--gh-error-container); color: var(--gh-error); }
.gh-chip-warning { background: #fef3c7; color: #92400e; }
.gh-chip-info    { background: #e0f2fe; color: #075985; }
.gh-chip-neutral { background: var(--gh-surface); color: var(--gh-on-surface-variant); }

/* ── 4h. Alerts ── */
.alert {
    border: none;
    border-radius: var(--gh-radius-md);
    font-size: 0.85rem;
    padding: 1rem 1.25rem;
}
.alert-success { background: rgba(16, 185, 129, 0.1); color: #065f46; }
.alert-danger  { background: rgba(186, 26, 26, 0.08); color: #7f1d1d; }
.alert-warning { background: rgba(245, 158, 11, 0.1); color: #78350f; }
.alert-info    { background: rgba(8, 145, 178, 0.08); color: #164e63; }
.alert-primary { background: rgba(0, 107, 50, 0.08); color: #003d1c; }

/* ── 4i. Dropdowns ── */
.dropdown-menu {
    background: var(--gh-glass-bg);
    backdrop-filter: var(--gh-glass-blur);
    -webkit-backdrop-filter: var(--gh-glass-blur);
    border: var(--gh-glass-border);
    border-radius: var(--gh-radius-md);
    box-shadow: var(--gh-shadow);
    padding: 0.5rem;
}

.dropdown-item {
    border-radius: var(--gh-radius);
    font-size: 0.85rem;
    padding: 0.5rem 0.85rem;
    color: var(--gh-on-surface);
    transition: background var(--gh-transition-fast);
}
.dropdown-item:hover, .dropdown-item:focus {
    background: var(--gh-secondary-container);
    color: var(--gh-on-surface);
}
.dropdown-item.active, .dropdown-item:active {
    background: var(--gh-primary);
    color: var(--gh-on-primary);
}
.dropdown-divider { border-color: var(--gh-outline-variant); }

/* ── 4j. Nav Tabs & Pills ── */
.nav-tabs {
    border-bottom: 2px solid var(--gh-outline-variant);
}
.nav-tabs .nav-link {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--gh-on-surface-variant);
    border: none;
    border-bottom: 2px solid transparent;
    padding: 0.65rem 1.15rem;
    margin-bottom: -2px;
    transition: all var(--gh-transition-fast);
    border-radius: 0;
}
.nav-tabs .nav-link:hover {
    color: var(--gh-primary);
    border-bottom-color: rgba(0, 107, 50, 0.3);
    background: transparent;
}
.nav-tabs .nav-link.active {
    color: var(--gh-primary);
    border-bottom-color: var(--gh-primary);
    background: transparent;
    font-weight: 700;
}

.nav-pills .nav-link {
    border-radius: var(--gh-radius);
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--gh-on-surface-variant);
    padding: 0.5rem 1rem;
}
.nav-pills .nav-link.active {
    background: var(--gh-primary);
    color: var(--gh-on-primary);
}

/* ── 4k. Pagination ── */
.pagination { gap: 4px; }
.page-link {
    border: none;
    border-radius: var(--gh-radius) !important;
    color: var(--gh-on-surface-variant);
    font-weight: 600;
    font-size: 0.82rem;
    padding: 0.45rem 0.75rem;
    transition: all var(--gh-transition-fast);
    background: transparent;
}
.page-link:hover { background: var(--gh-secondary-container); color: var(--gh-primary); }
.page-item.active .page-link {
    background: var(--gh-primary);
    color: var(--gh-on-primary);
    box-shadow: 0 2px 6px rgba(0, 107, 50, 0.2);
}
.page-item.disabled .page-link { color: var(--gh-text-muted); opacity: 0.5; }

/* ── 4l. Tooltips & Popovers ── */
.tooltip-inner {
    background: var(--gh-on-surface);
    border-radius: var(--gh-radius);
    font-size: 0.78rem;
    padding: 0.45rem 0.85rem;
}

/* ── 4m. Progress Bars ── */
.progress {
    border-radius: var(--gh-radius);
    background: var(--gh-surface);
    height: 8px;
}
.progress-bar {
    background: linear-gradient(90deg, var(--gh-primary), var(--gh-primary-fixed));
    border-radius: var(--gh-radius);
}

/* ── 4n. List Groups ── */
.list-group-item {
    border: none;
    border-bottom: 1px solid var(--gh-outline-variant);
    color: var(--gh-on-surface);
    padding: 0.75rem 1rem;
    transition: background var(--gh-transition-fast);
}
.list-group-item:hover { background: var(--gh-secondary-container); }
.list-group-item.active {
    background: var(--gh-primary);
    border-color: var(--gh-primary);
    color: var(--gh-on-primary);
}

/* ── 4o. Breadcrumbs ── */
.breadcrumb {
    font-size: 0.78rem;
    color: var(--gh-text-muted);
    margin-bottom: 0;
}
.breadcrumb-item + .breadcrumb-item::before { color: var(--gh-text-muted); }
.breadcrumb-item.active { color: var(--gh-on-surface-variant); }

/* ── 4p. Bootstrap Contextual Text Color Overrides ── */
.text-primary { color: var(--gh-primary) !important; }
.text-info { color: #0e7490 !important; }
.text-success { color: #059669 !important; }
.text-danger { color: var(--gh-error) !important; }
.text-warning { color: #b45309 !important; }
.text-secondary { color: var(--gh-on-surface-variant) !important; }
.text-dark { color: var(--gh-on-surface) !important; }
.text-muted { color: var(--gh-text-muted) !important; }

/* ── 4q. Bootstrap Contextual BG Overrides ── */
/* Use --bs-*-rgb to preserve bg-opacity-* support */
.bg-primary { --bs-primary-rgb: 0, 107, 50; background-color: rgba(var(--bs-primary-rgb), var(--bs-bg-opacity, 1)) !important; }
.bg-info    { --bs-info-rgb: 14, 116, 144;  background-color: rgba(var(--bs-info-rgb), var(--bs-bg-opacity, 1)) !important; }
.bg-success { --bs-success-rgb: 5, 150, 105; background-color: rgba(var(--bs-success-rgb), var(--bs-bg-opacity, 1)) !important; }
.bg-danger  { --bs-danger-rgb: 186, 26, 26;  background-color: rgba(var(--bs-danger-rgb), var(--bs-bg-opacity, 1)) !important; }
.bg-light   { background-color: var(--gh-surface) !important; }
.bg-dark    { background-color: var(--gh-on-surface) !important; }

/* ===== 5. UTILITY CLASSES ===== */

/* Surface utilities */
.gh-surface      { background: var(--gh-surface); }
.gh-surface-low  { background: var(--gh-surface-low); }
.gh-surface-high { background: var(--gh-surface-highest); }
.gh-surface-card { background: var(--gh-surface-lowest); }
.gh-surface-tint { background: var(--gh-surface-tint); }

/* Glass panel (for floating elements) */
.gh-glass {
    background: var(--gh-glass-bg);
    backdrop-filter: var(--gh-glass-blur);
    -webkit-backdrop-filter: var(--gh-glass-blur);
    border: var(--gh-glass-border);
}

/* Ghost border (accessibility fallback) */
.gh-ghost-border { border: 1px solid var(--gh-outline-variant) !important; }

/* Ambient shadow */
.gh-shadow    { box-shadow: var(--gh-shadow); }
.gh-shadow-sm { box-shadow: var(--gh-shadow-sm); }
.gh-shadow-lg { box-shadow: var(--gh-shadow-lg); }

/* Text colors */
.gh-text-primary { color: var(--gh-primary) !important; }
.gh-text-muted   { color: var(--gh-text-muted) !important; }
.gh-text-surface { color: var(--gh-on-surface) !important; }

/* Gradient text */
.gh-gradient-text {
    background: linear-gradient(135deg, var(--gh-primary), var(--gh-primary-container));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ===== 6. CUSTOM SCROLLBAR ===== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    background: rgba(0, 107, 50, 0.15);
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover { background: rgba(0, 107, 50, 0.25); }

/* ===== 7. SELECT2 OVERRIDES ===== */
.select2-container--bootstrap-5 .select2-selection {
    background-color: var(--gh-surface-highest) !important;
    border: none !important;
    border-bottom: 2px solid var(--gh-outline-variant) !important;
    border-radius: var(--gh-radius) var(--gh-radius) 0 0 !important;
    min-height: 38px;
}
.select2-container--bootstrap-5 .select2-selection--single:focus,
.select2-container--bootstrap-5.select2-container--focus .select2-selection {
    border-bottom-color: var(--gh-primary) !important;
    box-shadow: 0 2px 0 0 var(--gh-primary) !important;
}
.select2-container--bootstrap-5 .select2-dropdown {
    border: var(--gh-glass-border);
    border-radius: var(--gh-radius-md);
    box-shadow: var(--gh-shadow);
}
.select2-container--bootstrap-5 .select2-results__option--highlighted {
    background-color: var(--gh-secondary-container) !important;
    color: var(--gh-on-surface) !important;
}
.select2-container--bootstrap-5 .select2-results__option--selected {
    background-color: var(--gh-primary) !important;
    color: var(--gh-on-primary) !important;
}

/* ===== 8. SWEETALERT2 OVERRIDES ===== */
.swal2-popup {
    border-radius: var(--gh-radius-lg) !important;
    font-family: var(--gh-font) !important;
}
.swal2-confirm {
    background: linear-gradient(135deg, var(--gh-primary), var(--gh-primary-container)) !important;
    border-radius: var(--gh-radius) !important;
}
.swal2-cancel {
    border-radius: var(--gh-radius) !important;
}

/* ===== 8b. DASHBOARD UTILITIES ===== */

/* Stat Card V2 — icon circle left, metric right */
.stat-card-v2 {
    border: 1px solid transparent;
    border-radius: var(--gh-radius-lg);
    transition: all var(--gh-transition-fast);
}
.stat-card-v2:hover {
    border-color: var(--gh-primary-container);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 107, 50, 0.08);
}
.stat-icon {
    width: 48px; height: 48px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
    color: #fff;
}
/* Stat-icon color variants — explicit backgrounds, no dependency on bg-opacity */
.stat-icon.bg-primary.bg-opacity-10    { background: rgba(0, 107, 50, 0.12) !important;  color: var(--gh-primary) !important; }
.stat-icon.bg-success.bg-opacity-10    { background: rgba(5, 150, 105, 0.12) !important;  color: #059669 !important; }
.stat-icon.bg-danger.bg-opacity-10     { background: rgba(186, 26, 26, 0.12) !important;  color: var(--gh-error) !important; }
.stat-icon.bg-warning.bg-opacity-10    { background: rgba(217, 119, 6, 0.12) !important;  color: #b45309 !important; }
.stat-icon.bg-info.bg-opacity-10       { background: rgba(14, 116, 144, 0.12) !important;  color: #0e7490 !important; }
.stat-icon.bg-secondary.bg-opacity-10  { background: rgba(108, 117, 125, 0.12) !important; color: #6c757d !important; }
.stat-trend {
    font-size: 0.72rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    margin-top: 0.15rem;
}

/* Feature Card — dark green surface (mockup "HR Daily Focus") */
.feature-card-dark {
    background: linear-gradient(135deg, var(--gh-primary) 0%, #004d23 100%);
    color: #fff;
    border-radius: var(--gh-radius-lg);
    position: relative;
    overflow: hidden;
}
.feature-card-dark::before {
    content: '';
    position: absolute; inset: 0;
    background: repeating-linear-gradient(
        90deg, transparent, transparent 19px,
        rgba(255,255,255,0.03) 19px, rgba(255,255,255,0.03) 20px
    ),
    repeating-linear-gradient(
        0deg, transparent, transparent 19px,
        rgba(255,255,255,0.03) 19px, rgba(255,255,255,0.03) 20px
    );
    pointer-events: none;
}
.feature-card-dark .card-body { position: relative; z-index: 1; }
.feature-card-dark .task-item {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: var(--gh-radius);
    padding: 0.75rem 1rem;
    margin-bottom: 0.5rem;
}
.feature-card-dark .task-item:last-child { margin-bottom: 0; }
.feature-card-dark .task-progress {
    height: 4px; width: 100%;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
    overflow: hidden;
    margin-top: 0.5rem;
}
.feature-card-dark .task-progress-bar {
    height: 100%;
    background: var(--gh-primary-fixed, #78fc9c);
    border-radius: 2px;
    transition: width 0.6s ease;
}

/* Dashboard Section spacing */
.dashboard-section { margin-bottom: 2rem; }
.dashboard-section-title {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--gh-on-surface);
    margin-bottom: 0.25rem;
}
.dashboard-section-sub {
    font-size: 0.8rem;
    color: var(--gh-on-surface-variant);
}

/* Card with left accent border */
.card-accent-left {
    border-left: 4px solid var(--gh-primary) !important;
}
.card-accent-left.accent-danger { border-left-color: #ba1a1a !important; }
.card-accent-left.accent-warning { border-left-color: #b45309 !important; }
.card-accent-left.accent-info { border-left-color: #0e7490 !important; }


/* ===== 9. RESPONSIVE — Comprehensive Breakpoints ===== */

/* ── 9a. Large Desktop / Tablet Landscape (≤1200px) ── */
@media (max-width: 1200px) {
    .btn { font-size: 0.82rem; padding: 0.45rem 1rem; }
    .card-body { padding: 1.1rem; }

    /* Action button groups — allow wrapping */
    .card-header .d-flex,
    .d-flex.justify-content-between,
    .d-flex.gap-2 {
        flex-wrap: wrap;
    }
}

/* ── 9b. Tablet Portrait / Small Laptop (≤992px) ── */
@media (max-width: 992px) {
    .btn { font-size: 0.8rem; padding: 0.4rem 0.85rem; }
    .btn-sm { font-size: 0.72rem; padding: 0.3rem 0.65rem; }
    .card-body { padding: 1rem; }
    .card-header { padding: 0.75rem 1rem; }
    .modal-body { padding: 1.15rem; }
    
    /* Tables: horizontal scroll wrapper */
    .table-responsive,
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    /* Filter rows — wrap into multiple lines */
    .row.g-2,
    .row.g-3,
    .d-flex.gap-2,
    .d-flex.gap-3 {
        flex-wrap: wrap !important;
    }
    
    /* Filter input/select minimum widths */
    .form-control,
    .form-select {
        min-width: 0;
        font-size: 0.82rem;
    }
    
    /* Card headers with action buttons — stack on narrow */
    .card-header .d-flex.justify-content-between {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    /* Action button groups — flex-wrap */
    .card-header .btn-group,
    .card-header .d-flex.gap-2,
    .card-header .ms-auto {
        flex-wrap: wrap;
        gap: 0.35rem !important;
    }

    /* Stat cards responsive */
    .stat-card-v2 { margin-bottom: 0.5rem; }
    .stat-icon { width: 40px; height: 40px; font-size: 1.1rem; }

    /* Feature card (dark) */
    .feature-card-dark .d-flex.align-items-center.justify-content-between {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 0.75rem;
    }
}

/* ── 9c. Mobile (≤768px) ── */
@media (max-width: 768px) {
    .btn { font-size: 0.78rem; padding: 0.4rem 0.8rem; }
    .btn-sm { font-size: 0.7rem; padding: 0.28rem 0.5rem; }
    .btn-lg { font-size: 0.85rem; padding: 0.5rem 1.1rem; }
    .card-body { padding: 0.85rem; }
    .card-header { padding: 0.7rem 0.85rem; }
    .modal-body { padding: 1rem; }
    
    /* Typography scale down */
    .gh-display-md { font-size: 1.5rem; }
    .gh-display-sm { font-size: 1.25rem; }
    .gh-headline-lg { font-size: 1.25rem; }
    .gh-headline-md { font-size: 1.1rem; }
    
    /* Filter rows — stack vertically */
    .row.g-2 > [class*="col-"],
    .row.g-3 > [class*="col-"] {
        flex: 0 0 100%;
        max-width: 100%;
    }
    
    /* Preserve 2-col for col-6 items (stat cards) */
    .row.g-3 > .col-6 {
        flex: 0 0 50%;
        max-width: 50%;
    }
    
    /* Tables: smaller font, tighter padding */
    .table { font-size: 0.78rem; }
    .table > thead > tr > th { font-size: 0.68rem; padding: 0.5rem 0.6rem; }
    .table > tbody > tr > td { padding: 0.5rem 0.6rem; }
    
    /* Hide less important table columns on mobile */
    .table .d-none-mobile { display: none !important; }
    
    /* Breadcrumb compact */
    .breadcrumb { font-size: 0.7rem; }

    /* Pagination compact */
    .page-link { padding: 0.35rem 0.6rem; font-size: 0.75rem; }
    
    /* Card header action buttons — stack fully */
    .card-header .d-flex.justify-content-between {
        flex-direction: column;
        align-items: stretch !important;
        gap: 0.5rem;
    }
    .card-header .btn-group,
    .card-header .d-flex.gap-2 {
        justify-content: flex-start;
        flex-wrap: wrap;
    }
    
    /* Select2 compact */
    .select2-container--bootstrap-5 .select2-selection { min-height: 34px; }
    
    /* Nav tabs — scroll horizontal */
    .nav-tabs {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    .nav-tabs .nav-link {
        white-space: nowrap;
        font-size: 0.78rem;
        padding: 0.5rem 0.85rem;
    }
}

/* ── 9d. Small Mobile (≤576px) ── */
@media (max-width: 576px) {
    .btn { font-size: 0.75rem; padding: 0.35rem 0.7rem; }
    
    /* All flex containers should wrap */
    .d-flex { flex-wrap: wrap; }
    
    /* Modal full-width on small screens */
    .modal-dialog { margin: 0.5rem; max-width: calc(100% - 1rem); }
    
    .gh-display-md { font-size: 1.25rem; }
    .gh-display-sm { font-size: 1.1rem; }
    
    /* Cards - reduce radius for edge-to-edge feel */
    .card { border-radius: var(--gh-radius); }
    
    /* Stat cards — more compact */
    .stat-card-v2  .card-body { padding: 0.75rem; }
    .stat-icon { width: 36px; height: 36px; font-size: 1rem; }
}
