/* =========================================================================
   TIBL Modern Design System v3.0
   Fully Responsive · Professional Palette · Fast & Lightweight
   ========================================================================= */

:root {
    /* ---- Color Palette: Deep Professional Greens ---- */
    --primary: #1b4d3e;
    /* Extra Dark Green   */
    --primary-light: #2d6a4f;
    /* Forest Green       */
    --primary-hover: #164032;
    --primary-dark: #081c15;
    /* Near Black Green   */
    --primary-50: #f0fdf4;
    --primary-100: #dcfce7;
    --accent: #2d6a4f;
    /* Brand Green Accent */
    --accent-light: #3f8a68;
    --accent-hover: #1b4d3e;

    /* ---- Neutral Background Palette ---- */
    --bg-main: #f8fafc;
    --bg-body: #f8fafc;
    --bg-card: #ffffff;
    --bg-sidebar: #0f172a;
    /* Slate 900           */
    --bg-sidebar-dark: #020617;
    /* Slate 950           */

    /* ---- Typography Colors ---- */
    --text-main: #1a2332;
    --text-secondary: #455a6e;
    --text-muted: #8fa3b1;
    --text-on-primary: #ffffff;

    /* ---- Borders ---- */
    --border-color: rgba(0, 0, 0, 0.06);

    /* ---- Semantic Status Colors: High Contrast ---- */
    --success: #15803d;
    --success-bg: #f0fdf4;
    --warning: #a16207;
    --warning-bg: #fefce8;
    --danger: #be123c;
    --danger-bg: #fff1f2;
    --info: #2d6a4f;
    --info-bg: #ecfdf5;

    /* ---- Glass & Depth ---- */
    --glass-bg: rgba(255, 255, 255, 0.80);
    --glass-border: rgba(255, 255, 255, 0.35);
    --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.05);
    --shadow-sm: 0 1px 4px rgba(15, 23, 42, 0.06);
    --shadow-md: 0 2px 8px rgba(15, 23, 42, 0.08);
    --shadow-lg: 0 4px 12px rgba(15, 23, 42, 0.10);
    --shadow-xl: 0 8px 18px rgba(15, 23, 42, 0.12);

    /* ---- Shape ---- */
    --radius-xs: 4px;
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-xl: 18px;
    --radius-2xl: 24px;

    /* ---- Motion ---- */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-smooth: 400ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);

    /* ---- Sidebar ---- */
    --sidebar-width: 255px;
    --sidebar-collapsed: 72px;
    --topbar-height: 64px;
}

/* ==========================================================================
   1.1 DARK THEME VARIABLES
   ========================================================================== */
[data-theme="dark"] {
    --bg-main: #0f172a;
    --bg-body: #0f172a;
    --bg-card: #1e293b;
    --bg-sidebar: #020617;
    --bg-sidebar-dark: #000000;

    --text-main: #f8fafc;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;

    --border-color: rgba(255, 255, 255, 0.08);

    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.22);
    --shadow-md: 0 2px 6px rgba(0, 0, 0, 0.26);
    --shadow-lg: 0 4px 10px rgba(0, 0, 0, 0.30);
}

[data-theme="dark"] input[type="text"],
[data-theme="dark"] input[type="number"],
[data-theme="dark"] input[type="email"],
[data-theme="dark"] input[type="password"],
[data-theme="dark"] input[type="date"],
[data-theme="dark"] input[type="time"],
[data-theme="dark"] select,
[data-theme="dark"] textarea {
    background-color: #0f172a;
    border-color: rgba(255, 255, 255, 0.1);
    color: #f8fafc;
}

[data-theme="dark"] .modern-table th {
    background: #0f172a;
    border-bottom-color: rgba(255, 255, 255, 0.1);
    color: #e2e8f0;
}

[data-theme="dark"] .modern-table td {
    border-bottom-color: rgba(255, 255, 255, 0.05);
}

[data-theme="dark"] .modern-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.03);
}

[data-theme="dark"] .topbar-search input {
    background: #0f172a;
    color: #f8fafc;
    border-color: rgba(255, 255, 255, 0.1);
}

/* Fix chart text color in dark mode handled by JS optionally */
[data-theme="dark"] .modern-table th {
    background: linear-gradient(90deg, #1e293b, #1e293b);
    color: var(--text-secondary);
    border-bottom: 2px solid rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .modern-table td {
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

/* --- DARK THEME BUTTON FIXES (Avoid black on black & flat white) --- */
[data-theme="dark"] button,
[data-theme="dark"] input[type="submit"],
[data-theme="dark"] input[type="button"] {
    color: #ffffff;
    background: var(--primary);
    border: 1px solid var(--primary-light);
}

[data-theme="dark"] .bt-primary {
    background: var(--primary-light);
    color: #ffffff !important;
}

[data-theme="dark"] .bt-secondary {
    background: #1e293b !important;
    border: 1px solid #475569 !important;
    color: #e2e8f0 !important;
}

[data-theme="dark"] .bt-secondary:hover {
    background: #334155 !important;
    color: #ffffff !important;
}

[data-theme="dark"] .bt-danger {
    background: #b91c1c !important;
    color: #ffffff !important;
}

[data-theme="dark"] .bt-cancel {
    background: transparent !important;
    border-color: #475569 !important;
    color: #cbd5e1 !important;
}

[data-theme="dark"] .bt-cancel:hover {
    background: #1e293b !important;
    border-color: #94a3b8 !important;
    color: #ffffff !important;
}

[data-theme="dark"] .bt-icon {
    background: #1e293b !important;
    border-color: #475569 !important;
    color: #cbd5e1 !important;
}

[data-theme="dark"] .bt-icon:hover {
    background: #334155 !important;
    color: #ffffff !important;
    border-color: var(--primary-light) !important;
}

/* --- DARK THEME COMPONENT FIXES --- */

/* Stat cards */
[data-theme="dark"] .stat-card {
    background: var(--bg-card) !important;
    border-color: rgba(255, 255, 255, 0.08) !important;
}

/* Table container */
[data-theme="dark"] .modern-table-container {
    background: var(--bg-card) !important;
    border-color: rgba(255, 255, 255, 0.08) !important;
}

/* Table row hover */
[data-theme="dark"] .modern-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.04) !important;
}

/* Badges */
[data-theme="dark"] .badge-success {
    background: rgba(6, 78, 59, 0.45) !important;
    color: #6ee7b7 !important;
}

[data-theme="dark"] .badge-warning {
    background: rgba(120, 53, 15, 0.45) !important;
    color: #fde68a !important;
}

[data-theme="dark"] .badge-danger {
    background: rgba(127, 29, 29, 0.45) !important;
    color: #fca5a5 !important;
}

[data-theme="dark"] .badge-info {
    background: rgba(12, 74, 110, 0.45) !important;
    color: #7dd3fc !important;
}

[data-theme="dark"] .badge-primary {
    background: rgba(6, 78, 59, 0.4) !important;
    color: #a7f3d0 !important;
}

[data-theme="dark"] .badge-neutral {
    background: #334155 !important;
    color: #cbd5e1 !important;
}

/* Detail field separators */
[data-theme="dark"] .detail-field {
    border-bottom-color: rgba(255, 255, 255, 0.07) !important;
}

[data-theme="dark"] .detail-actions {
    border-top-color: rgba(255, 255, 255, 0.07) !important;
}

/* Profile avatar box */
[data-theme="dark"] .profile-header-card .profile-avatar-box {
    background: #334155 !important;
    border-color: #475569 !important;
}

/* Confirm/delete dialog */
[data-theme="dark"] .confirm-dialog {
    background: var(--bg-card) !important;
    border-color: rgba(239, 68, 68, 0.25) !important;
}

[data-theme="dark"] .confirm-dialog .dialog-icon {
    background: rgba(127, 29, 29, 0.35) !important;
    color: #fca5a5 !important;
}

/* Alert messages */
[data-theme="dark"] .alert-success {
    background: rgba(6, 78, 59, 0.35) !important;
    border-color: #059669 !important;
    color: #6ee7b7 !important;
}

[data-theme="dark"] .alert-error {
    background: rgba(127, 29, 29, 0.35) !important;
    border-color: #dc2626 !important;
    color: #fca5a5 !important;
}

[data-theme="dark"] .alert-warning {
    background: rgba(120, 53, 15, 0.35) !important;
    border-color: #d97706 !important;
    color: #fde68a !important;
}

[data-theme="dark"] .alert-info {
    background: rgba(12, 74, 110, 0.35) !important;
    border-color: #0284c7 !important;
    color: #7dd3fc !important;
}

/* Login card */
[data-theme="dark"] .login-card {
    background: var(--bg-card) !important;
    border-color: rgba(255, 255, 255, 0.08) !important;
}

[data-theme="dark"] .landing-hero {
    background: linear-gradient(145deg, #0f172a 0%, #1e293b 100%) !important;
}

/* Modern card hover */
[data-theme="dark"] .modern-card:hover {
    border-color: rgba(255, 255, 255, 0.12) !important;
}

/* Legacy table rows */
[data-theme="dark"] tr[bgcolor="f8f9fa"],
[data-theme="dark"] tr[bgcolor="#d8f3dc"] {
    background: var(--bg-card) !important;
}

[data-theme="dark"] tr[bgcolor="f8f9fa"]:hover,
[data-theme="dark"] tr[bgcolor="#d8f3dc"]:hover {
    background: rgba(255, 255, 255, 0.04) !important;
}

[data-theme="dark"] tr[bgcolor="f8f9fa"] td,
[data-theme="dark"] tr[bgcolor="#d8f3dc"] td {
    border-bottom-color: rgba(255, 255, 255, 0.06) !important;
    color: var(--text-secondary) !important;
}

[data-theme="dark"] table[align="center"] {
    background: var(--bg-card) !important;
    border-color: rgba(255, 255, 255, 0.08) !important;
}

/* Legacy table header rows */
[data-theme="dark"] tr[bgcolor="#548c2f"] {
    background: #0f172a !important;
}

[data-theme="dark"] tr[bgcolor="#548c2f"] td {
    color: #a7f3d0 !important;
    border-bottom-color: rgba(167, 243, 208, 0.2) !important;
}

[data-theme="dark"] tr[bgcolor="#548c2f"] font {
    color: #a7f3d0 !important;
}

/* Filter bar */
[data-theme="dark"] .filter-bar {
    background: var(--bg-card) !important;
    border-color: rgba(255, 255, 255, 0.08) !important;
}

/* Form inputs (supplement existing dark input rules) */
[data-theme="dark"] input[type="file"] {
    background: #0f172a !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
    color: #f8fafc !important;
}

[data-theme="dark"] input[type="file"]:hover {
    background: #1e293b !important;
}

/* Form actions separator */
[data-theme="dark"] .form-actions {
    border-top-color: rgba(255, 255, 255, 0.07) !important;
}

/* Non-field errors */
[data-theme="dark"] .non-field-errors {
    background: rgba(127, 29, 29, 0.35) !important;
    border-color: #dc2626 !important;
    color: #fca5a5 !important;
}

/* Pagination */
[data-theme="dark"] .modern-pagination a {
    background: var(--bg-card) !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
    color: var(--text-secondary) !important;
}

[data-theme="dark"] .modern-pagination a:hover {
    background: #334155 !important;
    border-color: rgba(255, 255, 255, 0.2) !important;
    color: #ffffff !important;
}

/* Report toolbar */
[data-theme="dark"] .report-page .report-toolbar {
    background: var(--bg-card) !important;
    border-color: rgba(255, 255, 255, 0.08) !important;
}

/* =========================================================================
   1.2 ANIMATIONS & PREMIUM EFFECTS
   ========================================================================= */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes pulse-subtle {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.02);
    }

    100% {
        transform: scale(1);
    }
}

.animate-fade-in-up {
    animation: fadeInUp 0.6s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.animate-fade-in {
    animation: fadeIn 0.8s ease-out forwards;
}

.glass-card {
    background: rgba(255, 255, 255, 0.7);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

[data-theme="dark"] .glass-card {
    background: rgba(30, 41, 59, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.premium-gradient {
    background: linear-gradient(135deg, #064e3b 0%, #10b981 100%);
    position: relative;
    overflow: hidden;
}

/* ==========================================================================
   Report Layout Shared Styles
   ========================================================================== */
.report-page .report-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding: 1rem 1.2rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    background: linear-gradient(180deg, #ffffff, #f9fcfa);
}

.report-page .report-title {
    font-family: 'Inter', sans-serif;
    font-size: 1.5rem;
    color: var(--text-main);
    margin: 0;
}

.report-page .report-subtitle {
    color: var(--text-muted);
    margin: 0.35rem 0 0;
    font-size: 0.92rem;
}

.report-page .report-actions {
    display: flex;
    gap: 0.8rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.report-page .report-action {
    padding: 0.6rem 1.2rem;
    font-size: 0.9rem;
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    box-shadow: var(--shadow-sm);
}

.report-page .report-action-primary {
    background-color: var(--primary);
}

.report-page .report-action-accent {
    background-color: var(--accent);
}

.report-page .report-action-dark {
    background-color: var(--primary-dark);
}

.report-page .report-filter-card {
    margin-bottom: 2rem;
    border: 1px solid var(--border-color);
}

.report-page .report-section-title {
    margin-bottom: 1.5rem;
}

.report-page .report-filter-form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 1rem;
    align-items: flex-end;
}

.report-page .report-label {
    display: block;
    font-size: 0.8rem;
    margin-bottom: 0.4rem;
    color: var(--text-muted);
    font-weight: 600;
}

.report-page .report-input {
    width: 100%;
    padding: 0.6rem;
    border: 1px solid #ddd;
    border-radius: var(--radius-sm);
}

.report-page .report-summary-card {
    margin-bottom: 2rem;
    border: 1px solid var(--border-color);
}

.report-page .report-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
}

.report-page .report-metric {
    padding: 1rem;
    border-radius: var(--radius-sm);
    color: white;
}

.report-page .report-metric-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
}

.report-page .report-metric-accent {
    background: linear-gradient(135deg, var(--accent), #f39c12);
}

.report-page .report-metric-success {
    background: linear-gradient(135deg, #27ae60, #229954);
}

.report-page .report-metric-label {
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.report-page .report-metric-value {
    font-size: clamp(1.35rem, 2.4vw, 2rem);
    font-weight: 700;
}

.report-page .report-footer-card {
    margin-top: 2rem;
    padding: 1.5rem;
    background: linear-gradient(180deg, #f7fbf8, #eef6f1);
    border-radius: var(--radius-sm);
    border-left: 4px solid var(--primary);
}

.report-page .report-footer-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
}

.report-page .report-footer-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 0.3rem;
}

.report-page .report-footer-value {
    font-size: 1.5rem;
    font-weight: 700;
}

.report-page .report-footer-value-primary {
    color: var(--primary);
}

.report-page .report-footer-value-accent {
    color: var(--accent);
}

.report-page .report-footer-value-light {
    color: var(--text-main);
}

.report-page .report-footer-action-wrap {
    text-align: right;
}

.report-page .report-print-button {
    padding: 0.5rem 1rem;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-weight: 600;
}

.report-page .report-empty-card {
    text-align: center;
    padding: 3rem;
}

.report-page .report-empty-icon {
    font-size: 3rem;
    color: #ddd;
    margin-bottom: 1rem;
}

.report-page .report-empty-text {
    color: var(--text-muted);
}

.report-page .report-align-left {
    text-align: left;
}

.report-page .report-align-center {
    text-align: center;
}

.report-page .report-align-right {
    text-align: right;
}

.report-page .report-item-title {
    font-weight: 600;
}

.report-page .report-item-subtitle {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.report-page .report-pill {
    background: var(--primary-100);
    padding: 0.3rem 0.6rem;
    border-radius: var(--radius-sm);
    font-weight: 600;
    color: var(--primary-dark);
}

.report-page .report-value-highlight {
    font-weight: 700;
    color: var(--primary);
    font-size: 1.1rem;
}

.report-page .report-currency-label {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.report-page .report-table-action {
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
    background: var(--primary-light);
    color: white;
}

.report-page .report-total-row {
    background: #eaf4ed;
    font-weight: 700;
    border-top: 2px solid var(--primary);
}

.report-page .report-total-label {
    color: var(--text-main);
}

.report-page .report-total-value {
    text-align: right;
    color: var(--primary);
}

@media (max-width: 900px) {
    .report-page .report-toolbar,
    .report-page .report-filter-form,
    .report-page .report-summary-grid,
    .report-page .report-footer-grid {
        grid-template-columns: 1fr;
        display: grid;
    }

    .report-page .report-toolbar {
        display: block;
    }

    .report-page .report-actions {
        margin-top: 1rem;
        justify-content: flex-start;
    }

    .report-page .report-footer-action-wrap {
        text-align: left;
    }
}

@media print {
    .report-toolbar,
    .report-filter-card,
    button[onclick*="print"],
    .bt-primary {
        display: none !important;
    }

    body {
        background: white !important;
    }

    .list-container {
        box-shadow: none !important;
    }

    .modern-table {
        page-break-inside: avoid;
    }
}

.premium-gradient::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, transparent 60%);
    pointer-events: none;
}

/* =========================================================================
   1. RESET & GLOBAL
   ========================================================================= */

*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--bg-main);
    color: var(--text-main);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
    font-size: 16px;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: var(--transition-fast);
}

a:hover {
    color: var(--primary-dark);
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* Thin modern scrollbar */
::-webkit-scrollbar {
    width: 5px;
    height: 5px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #b0bec5;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: #78909c;
}

/* ---- Typography ---- */
h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: 'Playfair Display', Georgia, serif;
    font-weight: 600;
    color: var(--text-main);
    line-height: 1.3;
}

h1 {
    font-size: clamp(1.5rem, 4vw, 2.25rem);
}

h2 {
    font-size: clamp(1.25rem, 3vw, 1.75rem);
}

h3 {
    font-size: clamp(1.1rem, 2.5vw, 1.35rem);
}

h4 {
    font-size: 1.1rem;
}

/* =========================================================================
   2. LAYOUT SYSTEM
   ========================================================================= */

.modern-layout {
    display: flex;
    min-height: 100vh;
    width: 100%;
}

/* ---- Sidebar ---- */
.modern-sidebar {
    width: var(--sidebar-width);
    background: linear-gradient(175deg, var(--bg-sidebar) 0%, var(--bg-sidebar-dark) 100%);
    color: white;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    transition: width var(--transition-base), transform var(--transition-base);
    z-index: 1000;
    overflow: hidden;
    border-right: 1px solid rgba(255, 255, 255, 0.06);
    box-shadow: none;
}

.modern-sidebar:hover {
    overflow-y: auto;
}

/* Collapsed state (PC) */
.modern-sidebar.collapsed {
    width: var(--sidebar-collapsed);
}

.modern-sidebar.collapsed .logo-text,
.modern-sidebar.collapsed .nav-item span,
.modern-sidebar.collapsed .nav-section-title,
.modern-sidebar.collapsed #sidebar-collapse {
    opacity: 0;
    width: 0;
    overflow: hidden;
    pointer-events: none;
}

.modern-sidebar.collapsed .logo-container {
    justify-content: center;
    padding: 1.5rem 0.5rem;
}

.modern-sidebar.collapsed .nav-item {
    justify-content: center;
    padding: 0.85rem 0;
}

.modern-sidebar.collapsed .logo-text {
    display: none;
}

.modern-sidebar.collapsed .nav-item span {
    display: none;
}

.modern-sidebar.collapsed .nav-section-title {
    display: none;
}

/* Logo Container */
.modern-sidebar .logo-container {
    padding: 1.25rem 1.25rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.85rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
    flex-shrink: 0;
}

.modern-sidebar .logo-icon {
    width: 38px;
    height: 38px;
    flex-shrink: 0;
    background: linear-gradient(135deg, var(--primary-light), var(--primary));
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    box-shadow: none;
}

.modern-sidebar .logo-text {
    font-family: 'Inter', sans-serif;
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: -0.3px;
    background: linear-gradient(to right, #fff 60%, var(--primary-100));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    white-space: nowrap;
    flex: 1;
}

/* Sidebar nav */
.sidebar-nav {
    flex: 1;
    padding: 0.75rem 0.75rem 0;
    overflow-x: hidden;
    overflow-y: auto;
}

.nav-section-title {
    padding: 1.2rem 0.6rem 0.4rem;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: rgba(255, 255, 255, 0.35);
    white-space: nowrap;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 0.85rem;
    color: rgba(255, 255, 255, 0.75);
    /* Brighter for better contrast on dark */
    text-decoration: none;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: 600;
    /* Bolder */
    margin-bottom: 0.15rem;
    transition: var(--transition);
    white-space: nowrap;
    cursor: pointer;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.08);
    color: white;
    transform: translateX(3px);
}

.nav-item.active {
    background: rgba(255, 255, 255, 0.12);
    color: white;
    border-left: 3px solid #4ade80;
    padding-left: calc(0.85rem - 3px);
    box-shadow: none;
}

.nav-item.active:hover {
    transform: none;
    background: rgba(255, 255, 255, 0.15);
}

.nav-item i {
    width: 20px;
    text-align: center;
    font-size: 1rem;
    flex-shrink: 0;
}

/* ---- Main Content ---- */
.modern-main {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    transition: margin-left var(--transition-base);
    position: relative;
    background: var(--bg-main);
    width: calc(100% - var(--sidebar-width));
}

.modern-sidebar.collapsed+.modern-main {
    margin-left: var(--sidebar-collapsed);
    width: calc(100% - var(--sidebar-collapsed));
}

.modern-main.no-sidebar {
    margin-left: 0 !important;
    width: 100% !important;
}

.modern-main.no-sidebar .content-wrapper {
    padding: 0;
}

/* Content wrapper */
.content-wrapper {
    padding: 1.5rem 2rem 3rem;
    width: 100%;
}

/* ---- Top Bar ---- */
.modern-topbar {
    height: 70px;
    background: var(--bg-card);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    box-shadow: none;
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    color: var(--text-main);
    padding: 0.5rem;
    border-radius: var(--radius-sm);
    transition: var(--transition-fast);
    flex-shrink: 0;
}

.sidebar-toggle:hover {
    background: var(--primary-50);
    color: var(--primary);
}

.topbar-search {
    flex: 1;
    max-width: 420px;
    position: relative;
    margin: 0 1rem;
}

.topbar-search .search-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: #475569;
    /* Much darker icon */
    font-size: 0.9rem;
    pointer-events: none;
}

.topbar-search input {
    width: 100%;
    padding: 0.6rem 1rem 0.6rem 2.75rem;
    border: 1.5px solid #e8edf2;
    border-radius: 100px;
    background: #f5f8fc;
    font-size: 0.875rem;
    font-family: inherit;
    transition: var(--transition);
    outline: none;
}

.topbar-search input:focus {
    background: white;
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(46, 125, 50, 0.12);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    flex-shrink: 0;
}

.user-info>div:first-child {
    text-align: right;
}

.user-avatar {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--primary-light), var(--primary-dark));
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.875rem;
    flex-shrink: 0;
}

/* =========================================================================
   3. CARDS & CONTAINERS
   ========================================================================= */

.modern-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 1.5rem;
    box-shadow: var(--shadow-xs);
    transition: var(--transition);
}

.modern-card:hover {
    box-shadow: var(--shadow-sm);
    border-color: rgba(46, 125, 50, 0.15);
}

.stat-card {
    background: white;
    border-radius: var(--radius-xl);
    padding: 1.5rem;
    border: 1px solid #e8f0fe;
    box-shadow: var(--shadow-xs);
    transition: var(--transition-base);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: linear-gradient(180deg, var(--primary-light), var(--primary));
    border-radius: 4px 0 0 4px;
}

.stat-card:hover {
    box-shadow: var(--shadow-sm);
    transform: none;
}

.stat-card .stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 0.25rem;
}

.stat-card .stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
}

.stat-card .stat-icon {
    position: absolute;
    top: 1.25rem;
    right: 1.25rem;
    font-size: 1.75rem;
    color: var(--primary-light);
    opacity: 0.35;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 1.25rem;
    margin-bottom: 2rem;
}

.chart-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(420px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

/* =========================================================================
   4. TABLES
   ========================================================================= */

.modern-table-container {
    overflow-x: auto;
    border-radius: var(--radius-xl);
    box-shadow: none;
    background: white;
    border: 1px solid rgba(15, 23, 42, 0.08);
}

.modern-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
    min-width: 480px;
    /* prevents ugly column squeeze */
}

.modern-table th {
    background: linear-gradient(90deg, #f0f7f1, #f8fafc);
    color: var(--primary-dark);
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.68rem;
    letter-spacing: 0.1em;
    padding: 0.85rem 1rem;
    text-align: left;
    border-bottom: 2px solid var(--primary-100);
    white-space: nowrap;
    font-family: 'Inter', sans-serif;
}

.modern-table td {
    padding: 0.8rem 1rem;
    border-bottom: 1px solid #f5f8fa;
    color: var(--text-secondary);
    vertical-align: middle;
}

.modern-table tbody tr {
    transition: var(--transition-fast);
}

.modern-table tbody tr:hover {
    background: var(--primary-50);
}

.modern-table tbody tr:last-child td {
    border-bottom: none;
}

.modern-table td a {
    color: var(--text-main);
    font-weight: 500;
}

.modern-table td a:hover {
    color: var(--primary);
}

/* Legacy table compat */
table.a6 {
    border-collapse: collapse;
}

table.a6 td {
    padding: 0.6rem 0.8rem;
    font-size: 0.875rem;
}

.aa {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
}

.aa:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

/* =========================================================================
   5. BUTTONS
   ========================================================================= */

.bt-primary {
    background: var(--primary-light);
    color: white;
    border: 1px solid rgba(8, 28, 21, 0.18);
    padding: 0.65rem 1.35rem;
    border-radius: var(--radius-lg);
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    transition: var(--transition);
    text-decoration: none;
    box-shadow: none;
    white-space: nowrap;
}

.bt-primary:hover {
    transform: none;
    box-shadow: none;
    filter: brightness(1.08);
    color: white;
}

.bt-primary:active {
    transform: translateY(0);
}

.bt-secondary {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: white;
    color: var(--primary-dark);
    padding: 0.65rem 1.35rem;
    border-radius: var(--radius-md);
    border: 1.5px solid var(--primary-100);
    font-weight: 500;
    font-size: 0.875rem;
    cursor: pointer;
    transition: var(--transition-fast);
    text-decoration: none;
    font-family: inherit;
}

.bt-secondary:hover {
    background: var(--primary-50);
    border-color: var(--primary-light);
    color: var(--primary-dark);
}

.bt-danger {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--danger);
    color: white;
    padding: 0.65rem 1.35rem;
    border-radius: var(--radius-md);
    border: 1px solid rgba(136, 19, 55, 0.22);
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    transition: var(--transition-fast);
    text-decoration: none;
    font-family: inherit;
}

.bt-danger:hover {
    filter: brightness(1.1);
    transform: none;
    box-shadow: none;
    color: white;
}

.bt-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: var(--radius-md);
    border: 1.5px solid #d1d5db;
    /* Higher contrast border */
    background: white;
    color: var(--text-secondary);
    /* Darker icon */
    cursor: pointer;
    transition: var(--transition-fast);
    text-decoration: none;
}

.bt-icon:hover {
    background: #f3f4f6;
    color: var(--primary);
    border-color: var(--primary-light);
}

/* Explicit High Contrast Semantic Buttons */
.bt-info {
    background: var(--info);
    color: white !important;
    border: 1px solid rgba(8, 28, 21, 0.18);
    padding: 0.65rem 1.35rem;
    border-radius: var(--radius-lg);
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
}

.bt-success {
    background: var(--success);
    color: white !important;
    border: 1px solid rgba(20, 83, 45, 0.2);
    padding: 0.65rem 1.35rem;
    border-radius: var(--radius-lg);
    font-weight: 600;
}

/* Legacy .button compat */
.button {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--primary-light);
    color: white;
    padding: 0.5rem 1.25rem;
    border-radius: var(--radius-md);
    border: 1px solid rgba(8, 28, 21, 0.18);
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: var(--transition-fast);
    text-decoration: none;
    font-family: inherit;
}

.button:hover {
    transform: none;
    box-shadow: none;
    color: white;
}

/* =========================================================================
   6. FORMS
   ========================================================================= */

.modern-form-container {
    max-width: 800px;
    margin: 0 auto;
}

.form-group {
    margin-bottom: 1.2rem;
}

.form-label,
label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.38rem;
    letter-spacing: 0.01em;
    font-family: 'Inter', sans-serif;
}

input[type="text"],
input[type="number"],
input[type="email"],
input[type="password"],
input[type="date"],
input[type="time"],
input[type="url"],
input[type="tel"],
input[type="search"],
input[type="file"],
select,
textarea {
    width: 100%;
    padding: 0.6rem 0.875rem;
    border: 1.5px solid #cbd5e1;
    /* Higher contrast border */
    border-radius: var(--radius-md);
    background-color: white;
    font-family: inherit;
    font-size: 0.95rem;
    /* Larger for better readability */
    transition: var(--transition-fast);
    outline: none;
    color: #0f172a;
    /* Force slate 900 */
    font-weight: 500;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(27, 77, 62, 0.1);
}

input::placeholder,
textarea::placeholder {
    color: #94a3b8;
    /* Slate 400 */
}

textarea {
    min-height: 100px;
    resize: vertical;
}

select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2394a3b8' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    padding-right: 2rem;
    cursor: pointer;
}

input[type="file"] {
    padding: 0.5rem;
    border-style: dashed;
    background: #fafbfc;
    cursor: pointer;
}

input[type="file"]:hover {
    border-color: var(--primary-light);
    background: var(--primary-50);
}

.checkbox-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.4rem;
    font-size: 0.875rem;
    cursor: pointer;
}

.checkbox-item input {
    width: auto;
    cursor: pointer;
}

.field-errors,
.errorlist {
    color: var(--danger);
    font-size: 0.75rem;
    margin-top: 0.25rem;
    list-style: none;
    padding: 0;
}

.input-error {
    border-color: var(--danger) !important;
}

.help-text,
.helptext {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.3rem;
}

.non-field-errors {
    background: var(--danger-bg);
    border: 1px solid #fecaca;
    border-left: 4px solid var(--danger);
    padding: 0.875rem 1rem;
    border-radius: var(--radius-md);
    margin-bottom: 1.5rem;
    color: #991b1b;
    font-size: 0.85rem;
}

.form-actions {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid #f1f5f9;
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.bt-cancel {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background-color: transparent;
    border: 1.5px solid #e2e8f0;
    color: var(--text-muted);
    padding: 0.65rem 1.35rem;
    border-radius: var(--radius-md);
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition-fast);
    font-family: inherit;
    text-decoration: none;
}

.bt-cancel:hover {
    background-color: #f8fafc;
    color: var(--text-main);
    border-color: #cbd5e1;
}

/* =========================================================================
   7. FILTER / SEARCH BAR
   ========================================================================= */

.filter-bar {
    background: white;
    border-radius: var(--radius-xl);
    padding: 1.25rem 1.5rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid rgba(0, 0, 0, 0.05);
    margin-bottom: 1.5rem;
}

.filter-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: flex-end;
}

.filter-grid .filter-field {
    flex: 1;
    min-width: 150px;
}

.filter-grid .filter-field label {
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.09em;
    color: var(--text-muted);
    margin-bottom: 0.3rem;
}

.filter-grid .filter-field input,
.filter-grid .filter-field select {
    padding: 0.5rem 0.75rem;
    font-size: 0.85rem;
}

/* =========================================================================
   8. PAGINATION
   ========================================================================= */

.modern-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.35rem;
    padding: 1.5rem 0;
    flex-wrap: wrap;
}

.modern-pagination a,
.modern-pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 38px;
    height: 38px;
    padding: 0 0.65rem;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    transition: var(--transition-fast);
    border: 1.5px solid transparent;
}

.modern-pagination a {
    color: var(--text-secondary);
    background: white;
    border-color: #e2e8f0;
}

.modern-pagination a:hover {
    background: var(--primary-50);
    border-color: var(--primary-100);
    color: var(--primary);
}

.modern-pagination .current-page {
    background: linear-gradient(135deg, var(--primary-light), var(--primary));
    color: white;
    font-weight: 700;
    border: 1px solid rgba(8, 28, 21, 0.18);
    box-shadow: none;
}

/* =========================================================================
   9. PAGE HEADERS
   ========================================================================= */

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.page-header h2 {
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.page-header h2 i {
    color: var(--primary);
    font-size: 1.2rem;
}

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.breadcrumb a {
    color: var(--text-muted);
}

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

.breadcrumb .separator {
    color: #cbd5e1;
}

/* =========================================================================
   10. BADGES & TAGS
   ========================================================================= */

.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.2rem 0.65rem;
    border-radius: 9999px;
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
}

.badge-success {
    background: var(--success-bg);
    color: #004d40;
}

.badge-warning {
    background: var(--warning-bg);
    color: #e65100;
}

.badge-danger {
    background: var(--danger-bg);
    color: #b71c1c;
}

.badge-info {
    background: var(--info-bg);
    color: #0d47a1;
}

.badge-primary {
    background: var(--primary-50);
    color: var(--primary-dark);
}

.badge-neutral {
    background: #f1f5f9;
    color: var(--text-secondary);
}

/* =========================================================================
   11. DETAIL PAGES
   ========================================================================= */

.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(270px, 1fr));
    gap: 1.25rem;
}

.detail-field {
    padding: 0.875rem 0;
    border-bottom: 1px solid #f5f8fa;
}

.detail-field .field-label {
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.09em;
    color: var(--text-muted);
    margin-bottom: 0.3rem;
    font-weight: 600;
}

.detail-field .field-value {
    font-size: 0.95rem;
    color: var(--text-main);
    font-weight: 500;
}

.detail-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid #f1f5f9;
    flex-wrap: wrap;
}

/* ---- Profile / detail page responsive header ---- */
.profile-header-card {
    display: flex;
    gap: 2rem;
    align-items: center;
    flex-wrap: wrap;
}

.profile-header-card .profile-avatar-box {
    width: 160px;
    height: 160px;
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-xs);
    background: #eee;
    flex-shrink: 0;
    border: 4px solid white;
}

/* =========================================================================
   12. EMPTY STATE
   ========================================================================= */

.empty-state {
    text-align: center;
    padding: 3rem 2rem;
    color: var(--text-muted);
}

.empty-state i {
    font-size: 2.8rem;
    color: #cfd8dc;
    margin-bottom: 1rem;
}

.empty-state h3 {
    color: var(--text-secondary);
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}

.empty-state p {
    font-size: 0.875rem;
    margin-bottom: 1.5rem;
}

/* =========================================================================
   13. DASHBOARD SPECIFIC
   ========================================================================= */

.dashboard-welcome {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    border-radius: var(--radius-xl);
    padding: 1.75rem 2rem;
    margin-bottom: 2rem;
    position: relative;
    overflow: hidden;
}

.dashboard-welcome::after {
    content: '';
    position: absolute;
    top: -60%;
    right: -8%;
    width: 300px;
    height: 300px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 50%;
}

.dashboard-welcome::before {
    content: '';
    position: absolute;
    bottom: -40%;
    right: 18%;
    width: 180px;
    height: 180px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 50%;
}

.dashboard-welcome h2 {
    color: white;
    margin-bottom: 0.5rem;
}

.dashboard-welcome p {
    opacity: 0.82;
    font-size: 0.9rem;
}

/* =========================================================================
   14. CONFIRM / DELETE DIALOG
   ========================================================================= */

.confirm-dialog {
    background: white;
    border-radius: var(--radius-xl);
    padding: 2.5rem;
    box-shadow: var(--shadow-sm);
    max-width: 420px;
    text-align: center;
    border: 1px solid #fecaca;
    margin: 0 auto;
}

.confirm-dialog .dialog-icon {
    width: 60px;
    height: 60px;
    background: var(--danger-bg);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.25rem;
    font-size: 1.5rem;
    color: var(--danger);
}

.confirm-dialog h2 {
    color: var(--danger);
    font-size: 1.25rem;
    margin-bottom: 0.75rem;
}

.confirm-dialog p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
}

.confirm-dialog .dialog-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
    flex-wrap: wrap;
}

/* =========================================================================
   15. UTILITY CLASSES
   ========================================================================= */

.hover-lift {
    transition: all var(--transition-base);
}

.hover-lift:hover {
    transform: none;
    box-shadow: none;
    border-color: var(--primary-light) !important;
}

.hover-lift:hover div {
    transform: scale(1.1);
    background: var(--primary);
    color: white !important;
}

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

.text-muted {
    color: var(--text-muted);
}

.text-danger {
    color: var(--danger);
}

.text-success {
    color: var(--success);
}

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

.text-right {
    text-align: right;
}

.text-sm {
    font-size: 0.875rem;
}

.text-xs {
    font-size: 0.75rem;
}

.fw-bold {
    font-weight: 700;
}

.fw-600 {
    font-weight: 600;
}

.mt-1 {
    margin-top: 0.5rem;
}

.mt-2 {
    margin-top: 1rem;
}

.mt-3 {
    margin-top: 1.5rem;
}

.mb-1 {
    margin-bottom: 0.5rem;
}

.mb-2 {
    margin-bottom: 1rem;
}

.mb-3 {
    margin-bottom: 1.5rem;
}

.mr-2 {
    margin-right: 0.5rem;
}

.gap-1 {
    gap: 0.5rem;
}

.gap-2 {
    gap: 1rem;
}

.d-flex {
    display: flex;
}

.d-none {
    display: none !important;
}

.d-lg-flex {
    display: none;
}

.items-center {
    align-items: center;
}

.justify-between {
    justify-content: space-between;
}

.flex-wrap {
    flex-wrap: wrap;
}

.hidden {
    display: none !important;
}

.w-100 {
    width: 100% !important;
}

/* .list-container is a page wrapper with no extra base styles needed */

/* =========================================================================
   16. MESSAGES / ALERTS
   ========================================================================= */

.messages-container {
    margin-bottom: 1.5rem;
}

.alert {
    padding: 0.875rem 1.25rem;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
    border-left: 4px solid;
}

.alert-success {
    background: var(--success-bg);
    border-color: var(--success);
    color: #004d40;
}

.alert-error {
    background: var(--danger-bg);
    border-color: var(--danger);
    color: #b71c1c;
}

.alert-warning {
    background: var(--warning-bg);
    border-color: var(--warning);
    color: #e65100;
}

.alert-info {
    background: var(--info-bg);
    border-color: var(--info);
    color: #0c4a6e;
    /* Much darker blue for readability */
}

/* Force high contrast on any blue button found */
.btn-primary,
.btn-info,
.btn-blue,
.btn-danger,
.btn-success,
input[type="submit"] {
    color: #ffffff !important;
    font-weight: 700 !important;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* Fix generic legacy button classes */
.btn-primary,
.btn-info,
.btn-blue {
    background-color: var(--info) !important;
    border: 1px solid rgba(8, 28, 21, 0.18) !important;
    color: white !important;
}

.btn-success {
    background-color: var(--success) !important;
    border: 1px solid rgba(20, 83, 45, 0.2) !important;
    color: white !important;
}

/* =========================================================================
   17. LANDING PAGE / LOGIN
   ========================================================================= */

.landing-hero {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    width: 100%;
    padding: 2rem 1rem;
    background: linear-gradient(145deg, var(--primary-50) 0%, #e8f4fd 100%);
}

.login-card {
    width: 100%;
    max-width: 440px;
    background: white;
    border-radius: var(--radius-2xl);
    padding: 2.5rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid rgba(0, 0, 0, 0.06);
}

.login-card .login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-card .login-header img {
    width: 72px;
    height: 72px;
    object-fit: contain;
    margin: 0 auto 0.75rem;
}

.login-card .login-header i {
    font-size: 2.5rem;
    color: var(--primary);
    margin-bottom: 0.75rem;
}

.login-card .login-header h2 {
    font-size: 1.35rem;
    margin-bottom: 0.3rem;
}

.login-card .login-header p {
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* =========================================================================
   18. LEGACY COMPAT
   ========================================================================= */

font[face*="verdana"],
font[face*="arial"],
font[face*="helvetica"] {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif !important;
}

font[color="#6E684F"] {
    color: var(--text-secondary) !important;
}

font[color="#afa3a3"] {
    color: var(--text-muted) !important;
}

font[color="#FFFFFF"] {
    color: white !important;
}

tr[bgcolor="#548c2f"] {
    background: #f0f7f1 !important;
}

tr[bgcolor="#548c2f"] td {
    color: var(--primary-dark);
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.68rem;
    letter-spacing: 0.1em;
    padding: 0.75rem 0.8rem;
    border-bottom: 2px solid var(--primary-100);
}

tr[bgcolor="#548c2f"] font {
    color: var(--primary-dark) !important;
    font-size: 0.72rem !important;
}

tr[bgcolor="f8f9fa"],
tr[bgcolor="#d8f3dc"] {
    background: white !important;
    transition: var(--transition-fast);
}

tr[bgcolor="f8f9fa"]:hover,
tr[bgcolor="#d8f3dc"]:hover {
    background: var(--primary-50) !important;
}

tr[bgcolor="f8f9fa"] td,
tr[bgcolor="#d8f3dc"] td {
    padding: 0.65rem 0.8rem;
    border-bottom: 1px solid #f5f8fa;
}

table[align="center"] {
    margin: 0 auto;
    border-collapse: collapse;
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: none;
    background: white;
    border: 1px solid rgba(15, 23, 42, 0.08);
    width: 100% !important;
    max-width: 100% !important;
}

/* =========================================================================
   19. TRANSITION ANIMATIONS
   ========================================================================= */

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(12px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-12px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes pulse-dot {

    0%,
    100% {
        transform: scale(1);
        opacity: 1;
    }

    50% {
        transform: scale(1.2);
        opacity: 0.7;
    }
}

.content-wrapper>* {
    animation: fadeInUp 0.28s ease backwards;
}

.content-wrapper>*:nth-child(1) {
    animation-delay: 0.04s;
}

.content-wrapper>*:nth-child(2) {
    animation-delay: 0.08s;
}

.content-wrapper>*:nth-child(3) {
    animation-delay: 0.12s;
}

.content-wrapper>*:nth-child(4) {
    animation-delay: 0.16s;
}

/* =========================================================================
   20. RESPONSIVE BREAKPOINTS
   ========================================================================= */

/* --- Large desktop only: show sidebar-collapse button --- */
@media (min-width: 1024px) {
    .d-lg-flex {
        display: flex !important;
    }
}

/* --- Tablet & below (< 1024px) --- */
@media (max-width: 1023px) {
    .modern-sidebar {
        width: 280px;
        transform: translateX(-100%);
        box-shadow: none;
    }

    .modern-sidebar.open {
        transform: translateX(0);
        box-shadow: var(--shadow-sm);
    }

    .modern-main,
    .modern-sidebar.collapsed+.modern-main {
        margin-left: 0 !important;
        width: 100% !important;
    }

    .sidebar-toggle {
        display: flex;
    }

    .content-wrapper {
        padding: 1rem 1.25rem 2rem;
    }

    .chart-grid {
        grid-template-columns: 1fr;
    }

    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    }

    .topbar-search {
        max-width: 280px;
    }

    .user-info>div:first-child {
        display: none;
    }
}

/* --- Mobile (< 768px) --- */
@media (max-width: 767px) {
    .content-wrapper {
        padding: 0.75rem 0.875rem 2rem;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .page-header h2 {
        font-size: 1.2rem;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }

    .chart-grid {
        gap: 1rem;
    }

    .filter-grid {
        flex-direction: column;
    }

    .filter-grid .filter-field {
        min-width: 100%;
    }

    .detail-grid {
        grid-template-columns: 1fr;
    }

    .form-actions {
        flex-direction: column;
    }

    .form-actions .bt-primary,
    .form-actions .bt-cancel,
    .form-actions .bt-danger {
        width: 100%;
        justify-content: center;
    }

    .profile-header-card {
        flex-direction: column;
        text-align: center;
    }

    .profile-header-card .profile-avatar-box {
        width: 120px;
        height: 120px;
        margin: 0 auto;
    }

    .modern-topbar {
        padding: 0 0.875rem;
    }

    .topbar-search {
        display: none;
    }

    .modern-card {
        padding: 1rem;
    }

    .filter-bar {
        padding: 1rem;
    }
}

/* --- Small mobile (< 480px) --- */
@media (max-width: 479px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .modern-table {
        font-size: 0.8rem;
    }

    .modern-table th,
    .modern-table td {
        padding: 0.55rem 0.65rem;
    }

    .bt-primary,
    .bt-secondary,
    .bt-danger {
        font-size: 0.825rem;
        padding: 0.6rem 1rem;
    }

    .login-card {
        padding: 1.75rem 1.25rem;
    }

    h1 {
        font-size: 1.5rem;
    }

    h2 {
        font-size: 1.25rem;
    }
}

/* =========================================================================
   21. PRINT
   ========================================================================= */

@media print {

    .modern-sidebar,
    .modern-topbar,
    .sidebar-toggle,
    .form-actions,
    .bt-primary,
    .bt-danger,
    .bt-cancel,
    .filter-bar {
        display: none !important;
    }

    .modern-main {
        margin-left: 0 !important;
        padding: 0 !important;
    }

    .content-wrapper {
        padding: 0 !important;
        max-width: 100% !important;
    }

    .modern-card {
        box-shadow: none;
        border: 1px solid #ddd;
    }
}