/* ===================================
   Adamus KPI - Custom Stylesheet
   Bootstrap 5 Overrides & Extensions
   Primary Color: #d2ab67 (Gold/Amber)
   =================================== */

/* -------------------------
   1. CSS Custom Properties
   ------------------------- */
:root {
    /* Primary Color Palette */
    --bs-primary: #d2ab67;
    --bs-primary-rgb: 210, 171, 103;
    --bs-primary-hover: #b8944d;
    --bs-primary-light: #f5ede0;
    --bs-primary-dark: #a58343;

    /* Extended Semantic Colors */
    --bs-success: #198754;
    --bs-danger: #dc3545;
    --bs-warning: #ffc107;
    --bs-info: #0dcaf0;

    /* Custom Design Tokens */
    --sidebar-width: 280px;
    --sidebar-bg: linear-gradient(180deg, #1a1a2e 0%, #16213e 100%);
    --sidebar-text: #e8e8e8;
    --sidebar-active: var(--bs-primary);

    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);
    --shadow-hover: 0 12px 32px rgba(210, 171, 103, 0.2);

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-normal: 250ms ease;
    --transition-slow: 350ms ease;

    /* Sidebar Mini */
    --sidebar-collapsed-width: 80px;
}

/* Custom OHS Icon */
.bi-ohs {
    display: inline-block;
    width: 1.4em;
    height: 1.4em;
    background-color: currentColor;
    -webkit-mask-image: url('../images/icon-ohs.svg');
    mask-image: url('../images/icon-ohs.svg');
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    -webkit-mask-size: contain;
    mask-size: contain;
    -webkit-mask-position: center;
    mask-position: center;
    vertical-align: -0.125em;
}

/* Custom Dump Truck Icon (Bootstrap Icons style) */
.bi-dump-truck {
    display: inline-block;
    width: 1.2em;
    height: 1.2em;
    background-color: currentColor;
    -webkit-mask-image: url('../images/icon-dump-truck.svg');
    mask-image: url('../images/icon-dump-truck.svg');
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    -webkit-mask-size: contain;
    mask-size: contain;
    -webkit-mask-position: center;
    mask-position: center;
    vertical-align: -0.125em;
}

/* Custom Crusher Icon */
.bi-crusher {
    display: inline-block;
    width: 1.4em;
    height: 1.4em;
    background-color: currentColor;
    -webkit-mask-image: url('../images/icon-crusher.svg');
    mask-image: url('../images/icon-crusher.svg');
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    -webkit-mask-size: contain;
    mask-size: contain;
    -webkit-mask-position: center;
    mask-position: center;
    vertical-align: -0.125em;
}

/* Custom Milling Icon */
.bi-milling {
    display: inline-block;
    width: 1.4em;
    height: 1.4em;
    background-color: currentColor;
    -webkit-mask-image: url('../images/icon-milling.svg');
    mask-image: url('../images/icon-milling.svg');
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    -webkit-mask-size: contain;
    mask-size: contain;
    -webkit-mask-position: center;
    mask-position: center;
    vertical-align: -0.125em;
}

/* -------------------------
   2. Typography
   ------------------------- */
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 0.9375rem;
    line-height: 1.6;
    background-color: #f5f7fa;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-weight: 600;
    color: #1a1a2e;
}

/* -------------------------
   3. Bootstrap Overrides
   ------------------------- */

/* Primary Button */
.btn-primary {
    --bs-btn-bg: var(--bs-primary);
    --bs-btn-border-color: var(--bs-primary);
    --bs-btn-hover-bg: var(--bs-primary-hover);
    --bs-btn-hover-border-color: var(--bs-primary-hover);
    --bs-btn-active-bg: var(--bs-primary-dark);
    --bs-btn-active-border-color: var(--bs-primary-dark);
    --bs-btn-disabled-bg: var(--bs-primary);
    --bs-btn-disabled-border-color: var(--bs-primary);
    color: #fff;
    font-weight: 500;
    transition: all var(--transition-normal);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-outline-primary {
    --bs-btn-color: var(--bs-primary);
    --bs-btn-border-color: var(--bs-primary);
    --bs-btn-hover-bg: var(--bs-primary);
    --bs-btn-hover-border-color: var(--bs-primary);
    --bs-btn-active-bg: var(--bs-primary-hover);
    --bs-btn-active-border-color: var(--bs-primary-hover);
}

/* All Buttons - Smooth Transitions */
.btn {
    border-radius: 8px;
    padding: 0.5rem 1.25rem;
    font-weight: 500;
    transition: all var(--transition-normal);
}

.btn:active {
    transform: scale(0.98);
}

/* Form Controls */
.form-control:focus,
.form-select:focus {
    border-color: var(--bs-primary);
    box-shadow: 0 0 0 0.25rem rgba(var(--bs-primary-rgb), 0.25);
}

.form-control,
.form-select {
    border-radius: 8px;
    padding: 0.625rem 0.875rem;
    border-color: #dee2e6;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

/* Links */
a {
    color: var(--bs-primary);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--bs-primary-hover);
}

/* -------------------------
   4. App Layout
   ------------------------- */
#app {
    display: flex;
    min-height: 100vh;
}

#app.auth-mode {
    display: block;
}

#app.auth-mode .sidebar {
    display: none !important;
}

.main-content {
    flex: 1;
    min-width: 0;
    background-color: #f5f7fa;
    padding: 1.5rem;
    margin-left: var(--sidebar-width);
    transition: margin-left var(--transition-normal), padding-left var(--transition-normal);
}

.sidebar.collapsed ~ .main-content {
    margin-left: var(--sidebar-collapsed-width);
    padding-left: 1.5rem;
}

#app.auth-mode .main-content {
    margin-left: 0;
    padding-left: 1.5rem; /* Reset padding for auth screen */
}

#app.auth-mode .main-content.auth-layout {
    padding-left: 2rem;
}

#app.auth-mode #sidebar-toggle {
    display: none !important;
}

.main-content.auth-layout {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 2rem;
    background: linear-gradient(135deg, #d2ab67 0%, #b8944d 100%);
}

/* -------------------------
   5. Sidebar Styling
   ------------------------- */
.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    padding: 1.5rem 1rem;
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1040;
    overflow-y: auto;
    overflow-x: hidden;
    flex-shrink: 0;
    display: none;
    transition: width var(--transition-normal), transform var(--transition-normal);
}

.sidebar.collapsed {
    width: var(--sidebar-collapsed-width);
    padding: 1.5rem 0.5rem;
    overflow: visible;
}

.sidebar.show {
    display: flex;
    flex-direction: column;
}

.sidebar h2 {
    color: var(--bs-primary);
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    white-space: nowrap;
}

.sidebar.collapsed h2 span,
.sidebar.collapsed .sidebar-toggle-btn span {
    display: none;
}

.sidebar.collapsed h2 {
    justify-content: center;
    gap: 0;
}

.sidebar .user-info {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.avatar-circle {
    width: 40px;
    height: 40px;
    background-color: #6c757d;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.user-details {
    display: flex;
    flex-direction: column;
    justify-content: center;
    overflow: hidden;
}

.user-name {
    color: #fff;
    font-weight: 600;
    font-size: 0.95rem;
    line-height: 1.2;
}

.user-role {
    color: #adb5bd;
    font-size: 0.8rem;
    line-height: 1.2;
}

/* Custom Dropdown Styling for Sidebar */
.sidebar .dropdown-menu-dark {
    background-color: #2d3436;
    border-color: rgba(255, 255, 255, 0.1);
}

.sidebar .dropdown-item {
    color: #e8e8e8;
}

.sidebar .dropdown-item:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: #fff;
}

/* Clean up button styles */
.sidebar .btn-link {
    text-decoration: none;
    color: #adb5bd !important;
    transition: color 0.2s;
}

.sidebar .btn-link:hover,
.sidebar .btn-link[aria-expanded="true"] {
    color: #fff !important;
}

.sidebar .nav-link {
    color: var(--sidebar-text);
    padding: 0.85rem;
    border-radius: 8px;
    margin-bottom: 0.25rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    transition: all var(--transition-normal);
    position: relative;
    white-space: nowrap;
    overflow: visible;
}

.sidebar.collapsed .nav-link {
    justify-content: center;
    padding: 0.85rem 0;
    gap: 0;
}

.sidebar.collapsed .nav-link span {
    display: none;
}

.sidebar .nav-link i {
    font-size: 1.25rem;
    width: 24px;
    text-align: center;
}

/* Tooltip for collapsed sidebar */
.sidebar.collapsed .nav-link[data-tooltip]::before {
    content: attr(data-tooltip);
    position: absolute;
    left: 100%;
    margin-left: 15px;
    background: #333;
    color: #fff;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.2s, transform 0.2s;
    transform: translateX(-10px);
    z-index: 2000;
}

.sidebar.collapsed .nav-link[data-tooltip]:hover::before {
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
}

.sidebar.collapsed .user-details {
    display: none;
}

.sidebar .nav-link:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    transform: translateX(4px);
}

.sidebar .nav-link.active {
    background: var(--bs-primary);
    color: #1a1a2e;
    font-weight: 600;
}

.sidebar .logout-link {
    color: #ef4444;
    font-size: 0.875rem;
}

.sidebar .logout-link:hover {
    color: #f87171;
}

/* -------------------------
   5. Cards & Containers
   ------------------------- */
.card {
    border: none;
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-normal);
    overflow: hidden;
}

.card:hover {
    box-shadow: var(--shadow-hover);
    transform: translateY(-4px);
}

.card-header {
    background: #fff;
    border-bottom: 1px solid #f0f0f0;
    font-weight: 600;
    padding: 1rem 1.25rem;
}

.card-body {
    padding: 1.25rem;
}

/* Dashboard Cards */
.dashboard-card {
    background: #fff;
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-normal);
}

.dashboard-card:hover {
    box-shadow: var(--shadow-hover);
    transform: translateY(-4px);
}

/* -------------------------
   6. Tables
   ------------------------- */
.table {
    background: #fff;
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 0;
    border-collapse: separate;
    border-spacing: 0;
}

.table-responsive {
    max-height: 65vh;
    overflow-y: auto;
}

.table thead th {
    background: #f8f9fa;
    border-bottom: 2px solid #e9ecef;
    font-weight: 600;
    font-size: 0.8125rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #6c757d;
    padding: 1rem;
    position: sticky;
    top: 0;
    z-index: 10;
}

.table tbody td {
    padding: 0.875rem 1rem;
    vertical-align: middle;
    border-color: #f0f0f0;
}

.table-hover tbody tr:hover {
    background-color: var(--bs-primary-light);
}

.table-striped>tbody>tr:nth-of-type(odd)>* {
    background-color: rgba(var(--bs-primary-rgb), 0.03);
}

/* -------------------------
   7. Metric Buttons (Submenu)
   ------------------------- */
.metric-btn {
    background: #fff;
    border: 1px solid #e9ecef;
    color: #495057;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all var(--transition-normal);
}

.metric-btn:hover {
    border-color: var(--bs-primary);
    color: var(--bs-primary);
    background: var(--bs-primary-light);
}

.metric-btn.active {
    background: var(--bs-primary);
    border-color: var(--bs-primary);
    color: #fff;
}

/* -------------------------
   8. Forms & Inputs
   ------------------------- */

/* KPI Form Grid */
.kpi-form-grid {
    display: grid;
    gap: 15px;
    margin-bottom: 20px;
    grid-template-columns: repeat(4, 1fr);
}

.kpi-form-grid-3 {
    display: grid;
    gap: 15px;
    margin-bottom: 20px;
    grid-template-columns: repeat(3, 1fr);
}

/* Hidden KPI fields should not take grid space */
.kpi-form-grid > .kpi-hidden-field,
.kpi-form-grid-3 > .kpi-hidden-field {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
}

/* Empty spacer divs should not take grid space */
.kpi-form-grid > div:empty,
.kpi-form-grid-3 > div:empty {
    display: none;
}

/* Date field auto-spans to fill row only when KPI field is hidden */
.kpi-form-grid > .kpi-hidden-field ~ .kpi-date-field {
    grid-column: span 4;
}
.kpi-form-grid-3 > .kpi-hidden-field ~ .kpi-date-field {
    grid-column: span 3;
}

/* Span utility classes for grid children */
.grid-span-2 {
    grid-column: span 2;
}
.grid-span-3 {
    grid-column: span 3;
}
.grid-span-4 {
    grid-column: span 4;
}

.form-floating>label {
    color: #6c757d;
}

.form-floating>.form-control:focus~label,
.form-floating>.form-control:not(:placeholder-shown)~label {
    color: var(--bs-primary);
}

.input-group-text {
    background: #f8f9fa;
    border-color: #dee2e6;
}

/* -------------------------
   9. Login/Auth Screens
   ------------------------- */
.auth-container {
    max-width: 500px;
    margin: 80px auto;
    padding: 2rem;
    background: #fff;
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
}

.auth-container h2 {
    color: var(--bs-primary);
    margin-bottom: 0.5rem;
}

.auth-container .subtitle {
    color: #6c757d;
    font-size: 0.9375rem;
    margin-bottom: 2rem;
}

.auth-logo {
    width: 80px;
    height: 80px;
    margin-bottom: 1.5rem;
}

/* -------------------------
   10. Toast Notifications
   ------------------------- */
.toast {
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
}

.toast-success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: #fff;
}

.toast-error {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: #fff;
}

.toast-info {
    background: linear-gradient(135deg, #0ea5e9 0%, #0284c7 100%);
    color: #fff;
}

.toast-warning {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: #fff;
}

/* Custom Toast (fallback) */
#toast-msg {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 1rem 1.5rem;
    border-radius: 12px;
    color: #fff;
    font-weight: 500;
    box-shadow: var(--shadow-lg);
    z-index: 1055;
    animation: slideInRight 0.3s ease;
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(100px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* -------------------------
   11. Utility Classes
   ------------------------- */
.hidden {
    display: none !important;
}

.text-primary {
    color: var(--bs-primary) !important;
}

.bg-primary {
    background-color: var(--bs-primary) !important;
}

.bg-primary-light {
    background-color: var(--bs-primary-light) !important;
}

.border-primary {
    border-color: var(--bs-primary) !important;
}

/* Hover Animations */
.hover-lift {
    transition: transform var(--transition-normal), box-shadow var(--transition-normal);
}

.hover-lift:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-hover);
}

/* Fade Animations */
.fade-in {
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* -------------------------
   12. Responsive Design
   ------------------------- */
@media (max-width: 767.98px) {
    .sidebar {
        width: 100%;
        position: fixed;
        z-index: 1050;
        transform: translateX(-100%);
        transition: transform var(--transition-normal);
    }

    .sidebar.show {
        transform: translateX(0);
    }

    .sidebar.collapsed {
        transform: translateX(-100%) !important;
    }

    .main-content {
        margin-left: 0 !important;
        padding-top: 4.5rem; /* Room for floating toggle when sidebar is naturally hidden on mobile */
        padding-left: 1.5rem !important;
    }

    #content {
        padding: 1rem;
    }

    .auth-container {
        margin: 40px 1rem;
    }
}

/* -------------------------
   13. Scrollbar Styling
   ------------------------- */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--bs-primary);
}

/* -------------------------
   14. Loading States
   ------------------------- */
.spinner-primary {
    color: var(--bs-primary);
}

.btn-loading {
    position: relative;
    pointer-events: none;
}

.btn-loading::after {
    content: '';
    position: absolute;
    width: 1rem;
    height: 1rem;
    top: 50%;
    left: 50%;
    margin-left: -0.5rem;
    margin-top: -0.5rem;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 0.75s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* -------------------------
   15. User Management Page
   ------------------------- */

/* Role Badges */
.role-badge {
    display: inline-block;
    padding: 0.2rem 0.65rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.4px;
    text-transform: capitalize;
}

.role-badge-admin {
    background: linear-gradient(135deg, #d2ab67, #a58343);
    color: #fff;
}

.role-badge-gm {
    background: linear-gradient(135deg, #7c3aed, #5b21b6);
    color: #fff;
}

.role-badge-hod {
    background: linear-gradient(135deg, #0ea5e9, #0284c7);
    color: #fff;
}

.role-badge-staff,
.role-badge-user {
    background: #e9ecef;
    color: #495057;
}

/* Status Badges */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.2rem 0.65rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

.status-badge-active {
    background: #d1fae5;
    color: #065f46;
}

.status-badge-disabled {
    background: #fee2e2;
    color: #991b1b;
}

/* Action Icon Buttons */
.action-icon-btn {
    width: 32px;
    height: 32px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    font-size: 0.875rem;
    border: 1px solid transparent;
    transition: all var(--transition-fast);
    background: transparent;
}

.action-icon-btn:hover {
    transform: translateY(-1px);
}

.action-icon-btn-edit {
    color: #0ea5e9;
    border-color: #bae6fd;
    background: #f0f9ff;
}

.action-icon-btn-edit:hover {
    background: #0ea5e9;
    color: #fff;
    border-color: #0ea5e9;
}

.action-icon-btn-reset {
    color: #f59e0b;
    border-color: #fde68a;
    background: #fffbeb;
}

.action-icon-btn-reset:hover {
    background: #f59e0b;
    color: #fff;
    border-color: #f59e0b;
}

.action-icon-btn-toggle {
    color: #10b981;
    border-color: #a7f3d0;
    background: #ecfdf5;
}

.action-icon-btn-toggle:hover {
    background: #10b981;
    color: #fff;
    border-color: #10b981;
}

.action-icon-btn-toggle.is-disabled {
    color: #6c757d;
    border-color: #dee2e6;
    background: #f8f9fa;
}

.action-icon-btn-toggle.is-disabled:hover {
    background: #6c757d;
    color: #fff;
    border-color: #6c757d;
}

/* User Avatar in Table */
.user-avatar-sm {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, #d2ab67, #a58343);
    color: #fff;
    font-weight: 700;
    font-size: 0.875rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* Profile Card */
.profile-card {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border-radius: 20px;
    padding: 2rem;
    color: #fff;
    position: relative;
    overflow: hidden;
}

.profile-card::before {
    content: '';
    position: absolute;
    top: -60px;
    right: -60px;
    width: 200px;
    height: 200px;
    background: rgba(210, 171, 103, 0.15);
    border-radius: 50%;
}

.profile-avatar-lg {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(135deg, #d2ab67, #a58343);
    color: #fff;
    font-size: 2rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 4px solid rgba(255, 255, 255, 0.2);
}

.profile-info-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid #f0f0f0;
}

.profile-info-row:last-child {
    border-bottom: none;
}

.profile-info-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: var(--bs-primary-light);
    color: var(--bs-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
}

/* Modal Styling Enhancements */
.modal-header-custom {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    color: #fff;
    border-radius: 12px 12px 0 0;
    padding: 1.25rem 1.5rem;
}

.modal-header-custom .btn-close {
    filter: invert(1) grayscale(100%) brightness(200%);
}

/* Search / Filter Bar */
.user-search-bar {
    background: #fff;
    border-radius: 12px;
    padding: 1rem 1.25rem;
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.user-search-input {
    flex: 1;
    min-width: 200px;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 0.5rem 0.875rem;
    font-size: 0.9rem;
    outline: none;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.user-search-input:focus {
    border-color: var(--bs-primary);
    box-shadow: 0 0 0 0.2rem rgba(var(--bs-primary-rgb), 0.25);
}

/* -------------------------
   16. Summary Dashboard
   ------------------------- */

/* Header bar */
.summary-header {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    color: #fff;
    border-radius: 16px;
    padding: 1rem 1.5rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
}

.summary-header-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: #d2ab67;
}

.summary-date-box {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(255,255,255,0.08);
    padding: 0.4rem 0.75rem;
    border-radius: 10px;
}

.summary-date-box label {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    color: #d2ab67;
    white-space: nowrap;
}

.summary-date-box input[type="date"] {
    background: transparent;
    border: 1px solid rgba(255,255,255,0.25);
    color: #fff;
    border-radius: 6px;
    padding: 0.2rem 0.5rem;
    font-size: 0.8rem;
    font-family: inherit;
}

.summary-date-box input[type="date"]::-webkit-calendar-picker-indicator {
    filter: invert(1);
}

/* Table wrapper */
.summary-table-wrap {
    overflow-x: auto;
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    background: #fff;
}

/* Dense spreadsheet table */
.summary-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.7rem;
    white-space: nowrap;
}

.summary-table th,
.summary-table td {
    padding: 3px 7px;
    border: 1px solid #d5d5d5;
    text-align: left;
}

.summary-table th {
    background: #f0f0f0;
    font-weight: 700;
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: #555;
    position: sticky;
    top: 0;
    z-index: 2;
}

/* Department section header row */
.summary-dept-hdr td {
    font-weight: 700;
    font-size: 0.6rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #fff;
    padding: 4px 7px;
}

/* Area cell (rowspan) */
.summary-area-cell {
    font-weight: 700;
    font-size: 0.72rem;
    vertical-align: middle;
    text-align: center;
    background: #f8f8f8;
}

/* Variance color cells */
.svar-pos { background-color: #c6efce; color: #006100; font-weight: 600; text-align: center; }
.svar-neg { background-color: #ffc7ce; color: #9c0006; font-weight: 600; text-align: center; }
.svar-zero { background-color: #ffeb9c; color: #9c5700; font-weight: 600; text-align: center; }
.svar-na { text-align: center; color: #999; }

/* Status indicator squares */
.sstatus {
    display: inline-block;
    width: 14px;
    height: 14px;
    border-radius: 3px;
    vertical-align: middle;
}

.sstatus-good { background: #22c55e; }
.sstatus-bad { background: #ef4444; }
.sstatus-warn { background: #f59e0b; }
.sstatus-na { background: #d1d5db; }

/* Data rows hover */
.summary-table tbody tr:not(.summary-dept-hdr):hover {
    background-color: #f5f5dc;
}

/* Numeric cells */
.summary-table .num-cell {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

/* Trend cell */
.summary-table .trend-cell {
    text-align: center;
    padding: 2px 4px;
}

/* Department-specific header colors */
.dept-hdr-ohs { background: #4a6741; }
.dept-hdr-milling_cil { background: #2d6a6a; }
.dept-hdr-crushing { background: #8b5e3c; }
.dept-hdr-mining { background: #3d5a3d; }
.dept-hdr-geology { background: #6b5b3e; }
.dept-hdr-engineering { background: #3d4f5f; }

/* Area cell department colors */
.area-ohs { color: #4a6741; }
.area-milling_cil { color: #2d6a6a; }
.area-crushing { color: #8b5e3c; }
.area-mining { color: #3d5a3d; }
.area-geology { color: #6b5b3e; }
.area-engineering { color: #3d4f5f; }