/*
 * DGGI CdZU Management Tool - World-Class Design System
 * ======================================================
 * Inspired by: Palantir, Stripe, Bloomberg, GovTech Singapore
 * Version: 2.0
 */

/* ==========================================================================
   DESIGN TOKENS - Foundation Layer
   ========================================================================== */

:root {
    /* Primary Palette - Deep Navy (Authority & Trust) */
    --primary: #1E3A5F;
    --primary-hover: #152C4A;
    --primary-light: #2D4A6F;
    --primary-lighter: #3D5A7F;
    
    /* Secondary - Slate (Neutral & Professional) */
    --secondary: #64748B;
    --secondary-hover: #475569;
    --secondary-light: #94A3B8;
    --secondary-lighter: #CBD5E1;
    
    /* Accent - Teal (Modern & Distinctive) */
    --accent: #0D9488;
    --accent-hover: #0F766E;
    --accent-light: #14B8A6;
    --accent-bg: rgba(13, 148, 136, 0.1);
    
    /* Status Colors - Semantic */
    --status-open: #3B82F6;
    --status-open-bg: #EFF6FF;
    --status-progress: #F59E0B;
    --status-progress-bg: #FFFBEB;
    --status-pending: #8B5CF6;
    --status-pending-bg: #F5F3FF;
    --status-overdue: #DC2626;
    --status-overdue-bg: #FEF2F2;
    --status-success: #10B981;
    --status-success-bg: #ECFDF5;
    --status-closed: #475569;
    --status-closed-bg: #F1F5F9;
    
    /* Backgrounds & Surfaces */
    --bg-page: #F8FAFC;
    --bg-card: #FFFFFF;
    --bg-sidebar: linear-gradient(180deg, #1E3A5F 0%, #152C4A 100%);
    --bg-header: #F1F5F9;
    --bg-zebra: #FAFBFC;
    --bg-hover: #F1F5F9;
    
    /* Borders */
    --border-light: #E2E8F0;
    --border-medium: #CBD5E1;
    --border-dark: #94A3B8;
    
    /* Text Colors */
    --text-primary: #1E293B;
    --text-secondary: #64748B;
    --text-muted: #94A3B8;
    --text-inverse: #FFFFFF;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 4px 6px rgba(0, 0, 0, 0.07), 0 2px 4px rgba(0, 0, 0, 0.06);
    --shadow-xl: 0 10px 15px rgba(0, 0, 0, 0.1), 0 4px 6px rgba(0, 0, 0, 0.05);
    --shadow-card-hover: 0 4px 12px rgba(0, 0, 0, 0.08);
    
    /* Spacing Scale */
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 20px;
    --space-6: 24px;
    --space-8: 32px;
    --space-10: 40px;
    --space-12: 48px;
    
    /* Border Radius */
    --radius-sm: 4px;
    --radius-md: 6px;
    --radius-lg: 8px;
    --radius-xl: 12px;
    --radius-full: 9999px;
    
    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-normal: 200ms ease;
    --transition-slow: 300ms ease;
    
    /* Z-Index Scale */
    --z-dropdown: 100;
    --z-sticky: 200;
    --z-modal: 500;
    --z-tooltip: 600;
    --z-sidebar: 1000;
}

/* ==========================================================================
   TYPOGRAPHY - Inter Font Stack
   ========================================================================== */

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-primary);
    background-color: var(--bg-page);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Heading Hierarchy */
h1, .h1 { font-size: 28px; font-weight: 700; line-height: 1.3; letter-spacing: -0.02em; }
h2, .h2 { font-size: 22px; font-weight: 600; line-height: 1.35; letter-spacing: -0.01em; }
h3, .h3 { font-size: 18px; font-weight: 600; line-height: 1.4; }
h4, .h4 { font-size: 16px; font-weight: 600; line-height: 1.4; }
h5, .h5 { font-size: 14px; font-weight: 600; line-height: 1.5; }
h6, .h6 { font-size: 12px; font-weight: 600; line-height: 1.5; text-transform: uppercase; letter-spacing: 0.05em; }

.text-sm { font-size: 12px; }
.text-xs { font-size: 11px; }
.text-lg { font-size: 16px; }

/* Numeric Data - Tabular Figures */
.numeric, .amount, .stat-value, .stat-value-lg, .stat-value-sm {
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum";
}

/* ==========================================================================
   LAYOUT - App Wrapper & Sidebar
   ========================================================================== */

.app-wrapper {
    display: flex;
    min-height: 100vh;
    background-color: var(--bg-page);
}

/* Sidebar - Deep Navy Authority */
.sidebar {
    width: 260px;
    min-height: 100vh;
    background: var(--bg-sidebar);
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: var(--z-sidebar);
    display: flex;
    flex-direction: column;
    transition: transform var(--transition-slow);
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar-header {
    padding: var(--space-5) var(--space-5);
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    color: var(--text-inverse);
    text-decoration: none;
    font-weight: 700;
    font-size: 16px;
    letter-spacing: -0.01em;
}

.sidebar-brand i {
    font-size: 24px;
    margin-right: var(--space-3);
    color: var(--accent-light);
}

.sidebar-brand:hover {
    color: var(--text-inverse);
}

.sidebar-toggle {
    background: none;
    border: none;
    color: var(--text-inverse);
    font-size: 20px;
    cursor: pointer;
    padding: var(--space-1);
    opacity: 0.7;
    transition: opacity var(--transition-fast);
}

.sidebar-toggle:hover {
    opacity: 1;
}

/* User Info Section */
.sidebar-user {
    padding: var(--space-4) var(--space-5);
    display: flex;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(0, 0, 0, 0.15);
}

.user-avatar {
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: var(--space-3);
    border: 2px solid rgba(255, 255, 255, 0.15);
}

.user-avatar i {
    font-size: 20px;
    color: var(--text-inverse);
}

.user-info {
    flex: 1;
    min-width: 0;
}

.user-name {
    color: var(--text-inverse);
    font-weight: 600;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role {
    color: rgba(255, 255, 255, 0.5);
    font-size: 12px;
    font-weight: 500;
}

/* Navigation */
.sidebar-nav {
    flex: 1;
    padding: var(--space-4) 0;
}

.nav-menu {
    list-style: none;
    padding: 0;
    margin: 0;
}

.nav-item {
    margin: 2px var(--space-3);
}

.nav-section-title {
    padding: var(--space-4) var(--space-4) var(--space-2);
    color: rgba(255, 255, 255, 0.35);
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-top: var(--space-2);
}

.nav-link {
    display: flex;
    align-items: center;
    padding: var(--space-3) var(--space-4);
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 500;
    transition: all var(--transition-fast);
    position: relative;
}

.nav-link i {
    width: 20px;
    margin-right: var(--space-3);
    font-size: 16px;
    text-align: center;
    flex-shrink: 0;
}

.nav-link:hover {
    color: var(--text-inverse);
    background: rgba(255, 255, 255, 0.08);
}

.nav-link.active {
    color: var(--text-inverse);
    background: rgba(13, 148, 136, 0.25);
    border-left: 3px solid var(--accent-light);
    margin-left: -3px;
    padding-left: calc(var(--space-4) + 3px);
}

.nav-link-danger {
    color: rgba(255, 120, 120, 0.85) !important;
}

.nav-link-danger:hover {
    background: rgba(220, 38, 38, 0.15) !important;
    color: #ff8080 !important;
}

/* Dropdown Navigation */
.nav-dropdown-toggle .dropdown-icon {
    margin-left: auto;
    font-size: 12px;
    transition: transform var(--transition-fast);
    opacity: 0.5;
}

.nav-dropdown-toggle[aria-expanded="true"] .dropdown-icon {
    transform: rotate(180deg);
}

.nav-dropdown-menu {
    list-style: none;
    padding: var(--space-1) 0 var(--space-1) var(--space-6);
    margin: 0;
}

.nav-dropdown-menu .nav-link {
    padding: var(--space-2) var(--space-3);
    font-size: 13px;
}

.nav-sub-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.06);
    margin: var(--space-2) 0;
}

/* Sidebar Footer */
.sidebar-footer {
    padding: var(--space-4) var(--space-5);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    text-align: center;
}

.sidebar-footer small {
    color: rgba(255, 255, 255, 0.3);
    font-size: 11px;
}

/* ==========================================================================
   MAIN CONTENT AREA
   ========================================================================== */

.main-content {
    flex: 1;
    margin-left: 260px;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Content Header */
.content-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-4) var(--space-6);
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-light);
    position: sticky;
    top: 0;
    z-index: var(--z-sticky);
}

.header-left {
    display: flex;
    align-items: center;
}

.sidebar-toggle-btn {
    color: var(--secondary);
    padding: var(--space-1) var(--space-2);
    margin-right: var(--space-2);
    border: none;
    background: none;
}

.sidebar-toggle-btn i {
    font-size: 24px;
}

.header-date {
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
}

/* Content Body */
.content-body {
    flex: 1;
    padding: var(--space-6);
}

.flash-container {
    margin-bottom: var(--space-5);
}

/* Content Footer */
.content-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-4) var(--space-6);
    background: var(--bg-card);
    border-top: 1px solid var(--border-light);
    font-size: 12px;
    color: var(--text-secondary);
}

/* ==========================================================================
   CARDS - Elevated Surfaces
   ========================================================================== */

.card {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    transition: box-shadow var(--transition-normal);
}

.card:hover {
    box-shadow: var(--shadow-md);
}

.card-header {
    padding: var(--space-4) var(--space-5);
    background: var(--bg-header);
    border-bottom: 1px solid var(--border-light);
    font-weight: 600;
    font-size: 14px;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.card-body {
    padding: var(--space-5);
}

.card-footer {
    padding: var(--space-4) var(--space-5);
    background: var(--bg-header);
    border-top: 1px solid var(--border-light);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* KPI / Stats Cards */
.stat-card {
    border-left: 4px solid transparent;
    transition: all var(--transition-normal);
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-card-hover);
}

.stat-card .card-body {
    padding: var(--space-5);
}

.stat-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    margin-bottom: var(--space-2);
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.stat-value-lg {
    font-size: 32px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.1;
}

.stat-value-sm {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
}

/* Stat Card Color Variants */
.stat-card-investigation,
.stat-card.primary {
    border-left-color: var(--status-success);
}

.stat-card-investigation .stat-icon,
.stat-icon-investigation {
    background: var(--status-success-bg);
    color: var(--status-success);
}

.stat-card-summons,
.stat-card-info {
    border-left-color: var(--status-open);
}

.stat-card-summons .stat-icon,
.stat-icon-summons,
.stat-icon-info {
    background: var(--status-open-bg);
    color: var(--status-open);
}

.stat-card-scn {
    border-left-color: var(--status-pending);
}

.stat-card-scn .stat-icon,
.stat-icon-scn {
    background: var(--status-pending-bg);
    color: var(--status-pending);
}

.stat-card-court {
    border-left-color: var(--status-progress);
}

.stat-card-court .stat-icon,
.stat-icon-court {
    background: var(--status-progress-bg);
    color: var(--status-progress);
}

.stat-card-warning {
    border-left-color: var(--status-progress);
}

.stat-icon-warning {
    background: var(--status-progress-bg);
    color: var(--status-progress);
}

.stat-card-success {
    border-left-color: var(--status-success);
}

.stat-icon-success {
    background: var(--status-success-bg);
    color: var(--status-success);
}

.stat-card-danger {
    border-left-color: var(--status-overdue);
}

.stat-icon-danger {
    background: var(--status-overdue-bg);
    color: var(--status-overdue);
}

.stat-card-dark {
    border-left-color: var(--primary);
}

.stat-icon-dark {
    background: rgba(30, 58, 95, 0.1);
    color: var(--primary);
}

/* Section Headers */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-3) 0;
    border-bottom: 2px solid var(--border-light);
}

.section-header h5 {
    margin: 0;
    font-weight: 600;
    display: flex;
    align-items: center;
}

.section-header h5 i {
    margin-right: var(--space-2);
    opacity: 0.7;
}

.section-header-investigation {
    border-bottom-color: var(--status-success);
}

.section-header-summons {
    border-bottom-color: var(--status-open);
}

.section-header-scn {
    border-bottom-color: var(--status-pending);
}

.section-header-court {
    border-bottom-color: var(--status-progress);
}

/* Card Headers with Colors */
.card-header-investigation {
    background: linear-gradient(90deg, var(--status-success-bg) 0%, var(--bg-header) 100%);
    border-left: 3px solid var(--status-success);
}

.card-header-summons {
    background: linear-gradient(90deg, var(--status-open-bg) 0%, var(--bg-header) 100%);
    border-left: 3px solid var(--status-open);
}

.card-header-scn {
    background: linear-gradient(90deg, var(--status-pending-bg) 0%, var(--bg-header) 100%);
    border-left: 3px solid var(--status-pending);
}

.card-header-court {
    background: linear-gradient(90deg, var(--status-progress-bg) 0%, var(--bg-header) 100%);
    border-left: 3px solid var(--status-progress);
}

/* ==========================================================================
   TABLES - Data Dense yet Scannable
   ========================================================================== */

.table {
    margin-bottom: 0;
    font-size: 13px;
}

.table thead th {
    background: var(--bg-header);
    border-bottom: 2px solid var(--border-light);
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    padding: var(--space-3) var(--space-4);
    white-space: nowrap;
    position: sticky;
    top: 0;
    z-index: 1;
}

.table tbody td {
    padding: var(--space-3) var(--space-4);
    vertical-align: middle;
    border-bottom: 1px solid var(--border-light);
    color: var(--text-primary);
}

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

/* Zebra Striping */
.table-striped tbody tr:nth-of-type(odd) {
    background-color: var(--bg-zebra);
}

/* Hover State */
.table-hover tbody tr {
    transition: background-color var(--transition-fast);
}

.table-hover tbody tr:hover {
    background-color: var(--bg-hover);
}

/* Table Primary Column (First data column emphasis) */
.table td:first-child,
.table .col-primary {
    font-weight: 500;
}

/* Table Links */
.table a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
}

.table a:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

/* Sortable Headers */
.table th.sortable {
    cursor: pointer;
    user-select: none;
    transition: background-color var(--transition-fast);
}

.table th.sortable:hover {
    background-color: var(--border-light);
}

.table th.sortable i {
    margin-left: var(--space-1);
    opacity: 0.4;
    font-size: 10px;
}

.table th.sortable.sorted-asc i,
.table th.sortable.sorted-desc i {
    opacity: 1;
    color: var(--accent);
}

/* Compact Table */
.table-sm td,
.table-sm th {
    padding: var(--space-2) var(--space-3);
}

/* Table Responsive */
.table-responsive {
    border-radius: var(--radius-lg);
}

/* Row Priority Indicators */
.table tr.priority-critical {
    border-left: 3px solid var(--status-overdue);
}

.table tr.priority-high {
    border-left: 3px solid var(--status-progress);
}

/* ==========================================================================
   BADGES & STATUS PILLS
   ========================================================================== */

.badge {
    font-weight: 500;
    font-size: 11px;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    letter-spacing: 0.02em;
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
}

/* Status Badge Variants */
.badge.bg-primary,
.badge-primary {
    background: rgba(30, 58, 95, 0.1) !important;
    color: var(--primary) !important;
}

.badge.bg-success,
.badge-success {
    background: var(--status-success-bg) !important;
    color: var(--status-success) !important;
}

.badge.bg-warning,
.badge-warning {
    background: var(--status-progress-bg) !important;
    color: #B45309 !important;
}

.badge.bg-danger,
.badge-danger {
    background: var(--status-overdue-bg) !important;
    color: var(--status-overdue) !important;
}

.badge.bg-info,
.badge-info {
    background: var(--status-open-bg) !important;
    color: var(--status-open) !important;
}

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

.badge.bg-dark {
    background: rgba(30, 41, 59, 0.1) !important;
    color: var(--text-primary) !important;
}

/* Status Specific Badges */
.badge-open { background: var(--status-open-bg) !important; color: var(--status-open) !important; }
.badge-in-progress { background: var(--status-progress-bg) !important; color: #B45309 !important; }
.badge-pending { background: var(--status-pending-bg) !important; color: var(--status-pending) !important; }
.badge-overdue { background: var(--status-overdue-bg) !important; color: var(--status-overdue) !important; }
.badge-closed { background: var(--status-closed-bg) !important; color: var(--status-closed) !important; }
.badge-complied { background: var(--status-success-bg) !important; color: var(--status-success) !important; }

/* ==========================================================================
   BUTTONS
   ========================================================================== */

.btn {
    font-size: 14px;
    font-weight: 500;
    padding: var(--space-2) var(--space-5);
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    line-height: 1.5;
    border: 1px solid transparent;
}

.btn:focus {
    box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.2);
}

/* Primary Button - Teal Accent */
.btn-primary {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--text-inverse);
}

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

/* Secondary Button */
.btn-secondary {
    background: var(--bg-card);
    border-color: var(--border-medium);
    color: var(--text-primary);
}

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

/* Outline Variants */
.btn-outline-primary {
    background: transparent;
    border-color: var(--accent);
    color: var(--accent);
}

.btn-outline-primary:hover {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--text-inverse);
}

.btn-outline-secondary {
    background: transparent;
    border-color: var(--border-medium);
    color: var(--text-secondary);
}

.btn-outline-secondary:hover {
    background: var(--bg-hover);
    border-color: var(--border-dark);
    color: var(--text-primary);
}

/* Success Button */
.btn-success {
    background: var(--status-success);
    border-color: var(--status-success);
    color: var(--text-inverse);
}

.btn-success:hover {
    background: #059669;
    border-color: #059669;
    color: var(--text-inverse);
}

.btn-outline-success {
    background: transparent;
    border-color: var(--status-success);
    color: var(--status-success);
}

.btn-outline-success:hover {
    background: var(--status-success);
    color: var(--text-inverse);
}

/* Danger Button */
.btn-danger {
    background: var(--status-overdue);
    border-color: var(--status-overdue);
    color: var(--text-inverse);
}

.btn-danger:hover {
    background: #B91C1C;
    border-color: #B91C1C;
    color: var(--text-inverse);
}

.btn-outline-danger {
    background: transparent;
    border-color: var(--status-overdue);
    color: var(--status-overdue);
}

.btn-outline-danger:hover {
    background: var(--status-overdue);
    color: var(--text-inverse);
}

/* Warning Button */
.btn-warning {
    background: var(--status-progress);
    border-color: var(--status-progress);
    color: #1E293B;
}

.btn-warning:hover {
    background: #D97706;
    border-color: #D97706;
}

/* Info Button */
.btn-info {
    background: var(--status-open);
    border-color: var(--status-open);
    color: var(--text-inverse);
}

.btn-info:hover {
    background: #2563EB;
    border-color: #2563EB;
}

/* Ghost/Link Button */
.btn-link {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: var(--space-2);
}

.btn-link:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

/* Button Sizes */
.btn-sm {
    font-size: 12px;
    padding: var(--space-1) var(--space-3);
}

.btn-lg {
    font-size: 16px;
    padding: var(--space-3) var(--space-6);
}

/* Button Groups */
.btn-group .btn {
    border-radius: 0;
}

.btn-group .btn:first-child {
    border-radius: var(--radius-md) 0 0 var(--radius-md);
}

.btn-group .btn:last-child {
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

/* ==========================================================================
   FORMS
   ========================================================================== */

.form-label {
    font-weight: 500;
    font-size: 13px;
    color: var(--text-primary);
    margin-bottom: var(--space-2);
}

.form-control,
.form-select {
    font-size: 14px;
    padding: var(--space-2) var(--space-3);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
    background-color: var(--bg-card);
    color: var(--text-primary);
}

.form-control:focus,
.form-select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.15);
    outline: none;
}

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

/* Form Text/Helper */
.form-text {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: var(--space-1);
}

/* Validation States */
.form-control.is-invalid,
.form-select.is-invalid {
    border-color: var(--status-overdue);
}

.form-control.is-invalid:focus {
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.15);
}

.invalid-feedback {
    font-size: 12px;
    color: var(--status-overdue);
}

.form-control.is-valid,
.form-select.is-valid {
    border-color: var(--status-success);
}

/* Form Sections */
.form-section {
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: var(--space-5);
    margin-bottom: var(--space-6);
    background-color: var(--bg-header);
}

.form-section-title {
    font-weight: 600;
    font-size: 15px;
    color: var(--primary);
    margin-bottom: var(--space-4);
    padding-bottom: var(--space-3);
    border-bottom: 1px solid var(--border-light);
}

/* Input Group */
.input-group .form-control {
    border-radius: 0;
}

.input-group .form-control:first-child {
    border-radius: var(--radius-md) 0 0 var(--radius-md);
}

.input-group .form-control:last-child {
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

.input-group-text {
    background: var(--bg-header);
    border-color: var(--border-medium);
    color: var(--text-secondary);
    font-size: 14px;
}

/* ==========================================================================
   ALERTS
   ========================================================================== */

.alert {
    border-radius: var(--radius-md);
    border: none;
    border-left: 4px solid;
    padding: var(--space-4);
    font-size: 14px;
    display: flex;
    align-items: flex-start;
}

.alert i {
    margin-right: var(--space-3);
    font-size: 18px;
    flex-shrink: 0;
}

.alert-success {
    background: var(--status-success-bg);
    border-left-color: var(--status-success);
    color: #065F46;
}

.alert-danger {
    background: var(--status-overdue-bg);
    border-left-color: var(--status-overdue);
    color: #991B1B;
}

.alert-warning {
    background: var(--status-progress-bg);
    border-left-color: var(--status-progress);
    color: #92400E;
}

.alert-info {
    background: var(--status-open-bg);
    border-left-color: var(--status-open);
    color: #1E40AF;
}

.alert .btn-close {
    margin-left: auto;
}

/* ==========================================================================
   MODALS
   ========================================================================== */

.modal-content {
    border: none;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
}

.modal-header {
    padding: var(--space-5) var(--space-6);
    border-bottom: 1px solid var(--border-light);
}

.modal-title {
    font-weight: 600;
    font-size: 18px;
}

.modal-body {
    padding: var(--space-6);
}

.modal-footer {
    padding: var(--space-4) var(--space-6);
    border-top: 1px solid var(--border-light);
    gap: var(--space-3);
}

/* ==========================================================================
   PAGINATION
   ========================================================================== */

.pagination {
    margin: 0;
    gap: var(--space-1);
}

.page-link {
    color: var(--text-primary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    padding: var(--space-2) var(--space-3);
    font-size: 13px;
    font-weight: 500;
    margin: 0;
    transition: all var(--transition-fast);
}

.page-link:hover {
    background: var(--bg-hover);
    border-color: var(--border-medium);
    color: var(--text-primary);
}

.page-item.active .page-link {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--text-inverse);
}

.page-item.disabled .page-link {
    background: var(--bg-header);
    color: var(--text-muted);
}

/* ==========================================================================
   BREADCRUMB
   ========================================================================== */

.breadcrumb {
    background: transparent;
    padding: 0;
    margin: 0;
    font-size: 13px;
}

.breadcrumb-item {
    color: var(--text-secondary);
}

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

.breadcrumb-item a:hover {
    text-decoration: underline;
}

.breadcrumb-item.active {
    color: var(--text-primary);
    font-weight: 500;
}

.breadcrumb-item + .breadcrumb-item::before {
    color: var(--text-muted);
}

/* ==========================================================================
   FILTER PANEL
   ========================================================================== */

.filter-panel {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: var(--space-5);
    margin-bottom: var(--space-5);
}

.filter-panel .form-label {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--text-secondary);
}

/* ==========================================================================
   EMPTY STATES
   ========================================================================== */

.empty-state {
    text-align: center;
    padding: var(--space-12) var(--space-6);
    color: var(--text-secondary);
}

.empty-state i {
    font-size: 48px;
    opacity: 0.3;
    margin-bottom: var(--space-4);
}

.empty-state h5 {
    color: var(--text-primary);
    margin-bottom: var(--space-2);
}

.empty-state p {
    color: var(--text-secondary);
    margin-bottom: var(--space-5);
}

/* ==========================================================================
   FILE UPLOAD
   ========================================================================== */

.file-upload-area {
    border: 2px dashed var(--border-medium);
    border-radius: var(--radius-lg);
    padding: var(--space-10) var(--space-6);
    text-align: center;
    cursor: pointer;
    transition: all var(--transition-normal);
    background: var(--bg-header);
}

.file-upload-area:hover,
.file-upload-area.dragover {
    border-color: var(--accent);
    background: var(--accent-bg);
}

.file-upload-area i {
    font-size: 40px;
    color: var(--text-muted);
    margin-bottom: var(--space-3);
}

/* ==========================================================================
   DOCUMENT LIST
   ========================================================================== */

.document-item {
    display: flex;
    align-items: center;
    padding: var(--space-3) var(--space-4);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-2);
    transition: all var(--transition-fast);
}

.document-item:hover {
    background: var(--bg-hover);
    border-color: var(--border-medium);
}

.document-icon {
    font-size: 24px;
    margin-right: var(--space-4);
    color: var(--status-overdue);
}

/* ==========================================================================
   AUDIT LOG
   ========================================================================== */

.audit-log-item {
    border-left: 2px solid var(--border-light);
    padding-left: var(--space-4);
    margin-bottom: var(--space-4);
    position: relative;
}

.audit-log-item::before {
    content: '';
    position: absolute;
    left: -5px;
    top: 6px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--border-medium);
}

.audit-log-item:last-child {
    margin-bottom: 0;
}

/* ==========================================================================
   AGING COLORS
   ========================================================================== */

.aging-green,
.text-aging-green {
    color: var(--status-success) !important;
}

.aging-yellow,
.text-aging-yellow {
    color: var(--status-progress) !important;
}

.aging-red,
.text-aging-red {
    color: var(--status-overdue) !important;
}

.bg-aging-green {
    background-color: var(--status-success-bg) !important;
}

.bg-aging-yellow {
    background-color: var(--status-progress-bg) !important;
}

.bg-aging-red {
    background-color: var(--status-overdue-bg) !important;
}

.timeline-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.timeline-indicator.green { background: var(--status-success); }
.timeline-indicator.yellow { background: var(--status-progress); }
.timeline-indicator.red { background: var(--status-overdue); }

/* ==========================================================================
   LOADING & SPINNERS
   ========================================================================== */

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.spinner-border {
    color: var(--accent);
}

/* ==========================================================================
   AUTH LAYOUT
   ========================================================================== */

.auth-layout {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--bg-sidebar);
}

.auth-card {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    padding: var(--space-8);
    max-width: 420px;
    width: 100%;
    margin: auto;
}

/* ==========================================================================
   MOBILE SIDEBAR
   ========================================================================== */

.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: calc(var(--z-sidebar) - 1);
}

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */

@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.active {
        transform: translateX(0);
    }
    
    .sidebar-overlay.active {
        display: block;
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .content-body {
        padding: var(--space-4);
    }
}

@media (max-width: 768px) {
    .stat-value {
        font-size: 22px;
    }
    
    .stat-value-lg {
        font-size: 26px;
    }
    
    .table {
        font-size: 12px;
    }
    
    .btn-group-responsive {
        flex-direction: column;
        width: 100%;
    }
    
    .btn-group-responsive .btn {
        margin-bottom: var(--space-2);
    }
}

/* ==========================================================================
   PRINT
   ========================================================================== */

@media print {
    .sidebar,
    .content-header,
    .content-footer,
    .btn,
    .pagination,
    .filter-panel {
        display: none !important;
    }
    
    .main-content {
        margin-left: 0 !important;
    }
    
    .card {
        border: 1px solid #000 !important;
        box-shadow: none !important;
    }
    
    body {
        background-color: #fff !important;
    }
}

/* ==========================================================================
   CUSTOM SCROLLBAR
   ========================================================================== */

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-header);
}

::-webkit-scrollbar-thumb {
    background: var(--border-medium);
    border-radius: var(--radius-sm);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--border-dark);
}

.sidebar::-webkit-scrollbar {
    width: 6px;
}

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

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: var(--radius-sm);
}

/* ==========================================================================
   ANIMATIONS
   ========================================================================== */

.fade-in {
    animation: fadeIn var(--transition-normal);
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Card hover lift effect */
.card-hover-lift {
    transition: transform var(--transition-normal), box-shadow var(--transition-normal);
}

.card-hover-lift:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

/* ==========================================================================
   UTILITY CLASSES
   ========================================================================== */

.text-primary { color: var(--primary) !important; }
.text-secondary { color: var(--text-secondary) !important; }
.text-muted { color: var(--text-muted) !important; }
.text-success { color: var(--status-success) !important; }
.text-danger { color: var(--status-overdue) !important; }
.text-warning { color: var(--status-progress) !important; }
.text-info { color: var(--status-open) !important; }

.bg-primary { background-color: var(--primary) !important; }
.bg-light { background-color: var(--bg-header) !important; }

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

.min-vh-75 { min-height: 75vh !important; }
.min-vh-50 { min-height: 50vh !important; }

/* Shadow utilities */
.shadow-sm { box-shadow: var(--shadow-sm) !important; }
.shadow { box-shadow: var(--shadow-md) !important; }
.shadow-lg { box-shadow: var(--shadow-lg) !important; }

/* Quick Actions */
.quick-actions-menu {
    min-width: 200px;
}

/* Search Highlight */
.search-highlight {
    background-color: rgba(245, 158, 11, 0.25);
    padding: 0 var(--space-1);
    border-radius: var(--radius-sm);
}

/* Dashboard Section */
.dashboard-section {
    margin-bottom: var(--space-8);
}

/* Form Group Spacing */
.form-group,
.mb-3 {
    margin-bottom: var(--space-4) !important;
}

/* Row spacing fix for stats */
.row.mb-3 > [class*="col-"] {
    margin-bottom: 0;
}

/* ==========================================================================
   PAGE HEADER IMPROVEMENTS
   ========================================================================== */

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-6);
    padding-bottom: var(--space-4);
    border-bottom: 1px solid var(--border-light);
}

.page-header h1,
.page-header .h4 {
    margin-bottom: 0;
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.page-header h1 i,
.page-header .h4 i {
    color: var(--accent);
    opacity: 0.8;
}

/* ==========================================================================
   DROPDOWN IMPROVEMENTS
   ========================================================================== */

.dropdown-menu {
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-lg);
    border-radius: var(--radius-lg);
    padding: var(--space-2);
}

.dropdown-item {
    padding: var(--space-2) var(--space-4);
    border-radius: var(--radius-md);
    font-size: 14px;
    color: var(--text-primary);
    transition: all var(--transition-fast);
}

.dropdown-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.dropdown-item.active,
.dropdown-item:active {
    background: var(--accent-bg);
    color: var(--accent);
}

.dropdown-divider {
    border-color: var(--border-light);
    margin: var(--space-2) 0;
}

/* ==========================================================================
   TOOLTIP IMPROVEMENTS
   ========================================================================== */

.tooltip {
    font-size: 12px;
}

.tooltip-inner {
    background: var(--primary);
    border-radius: var(--radius-md);
    padding: var(--space-2) var(--space-3);
}

/* ==========================================================================
   TAB IMPROVEMENTS
   ========================================================================== */

.nav-tabs {
    border-bottom: 2px solid var(--border-light);
    gap: var(--space-1);
}

.nav-tabs .nav-link {
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    color: var(--text-secondary);
    font-weight: 500;
    padding: var(--space-3) var(--space-4);
    transition: all var(--transition-fast);
}

.nav-tabs .nav-link:hover {
    border-color: var(--border-medium);
    color: var(--text-primary);
}

.nav-tabs .nav-link.active {
    border-color: var(--accent);
    color: var(--accent);
    background: transparent;
}

/* ==========================================================================
   PROGRESS BAR
   ========================================================================== */

.progress {
    height: 8px;
    border-radius: var(--radius-full);
    background: var(--bg-header);
}

.progress-bar {
    background: var(--accent);
    border-radius: var(--radius-full);
}

.progress-bar.bg-success { background: var(--status-success) !important; }
.progress-bar.bg-warning { background: var(--status-progress) !important; }
.progress-bar.bg-danger { background: var(--status-overdue) !important; }

/* ==========================================================================
   LIST GROUP
   ========================================================================== */

.list-group-item {
    border: none;
    border-bottom: 1px solid var(--border-light);
    padding: var(--space-4);
    transition: background-color var(--transition-fast);
}

.list-group-item:last-child {
    border-bottom: none;
}

.list-group-item:hover {
    background: var(--bg-hover);
}

.list-group-item.active {
    background: var(--accent-bg);
    color: var(--accent);
    border-color: var(--border-light);
}

/* ==========================================================================
   NAVBAR (For consistency if used elsewhere)
   ========================================================================== */

.navbar {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-light);
    padding: var(--space-3) var(--space-6);
}

.navbar-brand {
    font-weight: 700;
    color: var(--primary);
}

/* ==========================================================================
   STATS GRID IMPROVEMENTS
   ========================================================================== */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--space-4);
}

.stats-grid .stat-card {
    margin-bottom: 0;
}

/* ==========================================================================
   ACTION BAR
   ========================================================================== */

.action-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: var(--space-3);
    margin-bottom: var(--space-5);
    padding: var(--space-4);
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
}

.action-bar-left,
.action-bar-right {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

/* ==========================================================================
   DETAIL PAGE IMPROVEMENTS
   ========================================================================== */

.detail-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: var(--space-6);
    padding-bottom: var(--space-5);
    border-bottom: 2px solid var(--border-light);
}

.detail-title {
    margin-bottom: var(--space-2);
}

.detail-meta {
    display: flex;
    gap: var(--space-4);
    color: var(--text-secondary);
    font-size: 13px;
}

.detail-section {
    margin-bottom: var(--space-8);
}

.detail-section-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-4);
    padding-bottom: var(--space-3);
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.detail-section-title i {
    color: var(--accent);
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: var(--space-4);
}

.detail-item {
    padding: var(--space-3);
    background: var(--bg-header);
    border-radius: var(--radius-md);
}

.detail-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    margin-bottom: var(--space-1);
}

.detail-value {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
}

/* ==========================================================================
   CARD GRID FOR DASHBOARD
   ========================================================================== */

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: var(--space-5);
}

/* ==========================================================================
   TIMELINE IMPROVEMENTS
   ========================================================================== */

.timeline {
    position: relative;
    padding-left: var(--space-8);
}

.timeline::before {
    content: '';
    position: absolute;
    left: 12px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--border-light);
}

.timeline-item {
    position: relative;
    padding-bottom: var(--space-5);
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: calc(-1 * var(--space-8) + 8px);
    top: 4px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--accent);
    border: 2px solid var(--bg-card);
}

.timeline-item:last-child {
    padding-bottom: 0;
}

.timeline-date {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: var(--space-1);
}

.timeline-content {
    background: var(--bg-header);
    padding: var(--space-4);
    border-radius: var(--radius-md);
}

/* ==========================================================================
   NOTIFICATION BADGE
   ========================================================================== */

.notification-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    background: var(--status-overdue);
    color: var(--text-inverse);
    font-size: 10px;
    font-weight: 600;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ==========================================================================
   SKELETON LOADING
   ========================================================================== */

.skeleton {
    background: linear-gradient(90deg, var(--bg-header) 25%, var(--bg-hover) 50%, var(--bg-header) 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: var(--radius-md);
}

@keyframes skeleton-loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.skeleton-text {
    height: 16px;
    margin-bottom: var(--space-2);
}

.skeleton-title {
    height: 24px;
    width: 60%;
    margin-bottom: var(--space-3);
}

.skeleton-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
}
