/* =====================================================
   Finance Management System - Main Stylesheet
   Modern, Professional Theme with Dark/Light Mode
   ===================================================== */

/* CSS Variables - Dark Theme (Default) */
:root {
    /* Colors */
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #818cf8;
    --secondary: #64748b;
    --success: #22c55e;
    --warning: #f97316;
    --danger: #ef4444;
    --info: #0ea5e9;

    /* Dark Theme Colors */
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;
    --bg-card: #1e293b;
    --bg-hover: #334155;

    /* Text */
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;

    /* Borders */
    --border-color: #334155;
    --border-light: #475569;

    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.3);
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.3), 0 2px 4px -2px rgb(0 0 0 / 0.3);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.3), 0 4px 6px -4px rgb(0 0 0 / 0.3);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.3), 0 8px 10px -6px rgb(0 0 0 / 0.3);

    /* Spacing */
    --sidebar-width: 260px;
    --sidebar-collapsed-width: 70px;
    --header-height: 64px;

    /* Transitions */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: 250ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 350ms cubic-bezier(0.4, 0, 0.2, 1);

    /* Border Radius */
    --radius-sm: 8px;
    --radius: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;

    /* Glassmorphism & Modern Design */
    --glass-bg: rgba(30, 41, 59, 0.7);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-blur: 12px;
    --grad-primary: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
    --grad-surface: linear-gradient(180deg, rgba(30, 41, 59, 0.4) 0%, rgba(15, 23, 42, 0) 100%);
    --mobile-modal-bottom-offset: calc(100px + env(safe-area-inset-bottom, 0px));
    --mobile-modal-max-height: 92dvh;
}

/* Light Theme */
[data-theme="light"] {
    --bg-primary: #f8fafc;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f1f5f9;
    --bg-card: #ffffff;
    --bg-hover: #e2e8f0;

    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #4a5568;
    --secondary: #475569;

    --border-color: #e2e8f0;
    --border-light: #cbd5e1;

    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);

    /* Glassmorphism Light */
    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(0, 0, 0, 0.05);
}

/* Reset & Base */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    transition: background var(--transition-normal), color var(--transition-normal);
}

a {
    color: var(--primary-light);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--primary);
}

[data-theme="light"] a {
    color: var(--primary);
}

[data-theme="light"] a:hover {
    color: var(--primary-dark);
}

/* Ensure buttons maintain their color regardless of theme */
a.btn,
a.btn:hover,
a.btn:visited {
    color: inherit;
}

[data-theme="light"] a.btn-primary,
[data-theme="light"] a.btn-primary:hover,
[data-theme="light"] a.btn-success,
[data-theme="light"] a.btn-success:hover,
[data-theme="light"] a.btn-danger,
[data-theme="light"] a.btn-danger:hover,
[data-theme="light"] a.btn-warning,
[data-theme="light"] a.btn-warning:hover {
    color: white !important;
}

/* Layout */
.app-wrapper {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: linear-gradient(180deg, var(--bg-secondary) 0%, var(--bg-primary) 100%);
    border-right: 1px solid var(--border-color);
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 100;
    transition: width var(--transition-normal), transform var(--transition-normal);
    display: flex;
    flex-direction: column;
    box-shadow: 10px 0 30px rgba(0, 0, 0, 0.2);
}

/* Collapsed Sidebar */
.sidebar.collapsed {
    width: var(--sidebar-collapsed-width);
}

.sidebar.collapsed .sidebar-title,
.sidebar.collapsed .sidebar-subtitle,
.sidebar.collapsed .nav-section-title,
.sidebar.collapsed .nav-item span,
.sidebar.collapsed .sidebar-footer-text {
    opacity: 0;
    visibility: hidden;
    width: 0;
}

.sidebar.collapsed .sidebar-header {
    justify-content: center;
    padding: 1.5rem 0.5rem;
}

.sidebar.collapsed .nav-item {
    justify-content: center;
    padding: 0.75rem;
}

.sidebar.collapsed .nav-item i {
    font-size: 1.2rem;
}

.sidebar.collapsed .nav-section {
    padding: 0.5rem;
}

.sidebar.collapsed .sidebar-footer {
    padding: 0.75rem;
}

.sidebar.collapsed .sidebar-footer .nav-item {
    padding: 0.75rem;
}

/* Sidebar Toggle Button */
.sidebar-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 50%;
    color: var(--text-secondary);
    cursor: pointer;
    position: absolute;
    right: -14px;
    top: 72px;
    z-index: 101;
    transition: all var(--transition-fast);
}

.sidebar-toggle:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.sidebar.collapsed .sidebar-toggle {
    transform: rotate(180deg);
}

.sidebar-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.sidebar-logo {
    width: 40px;
    height: 40px;
    background: white;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    color: var(--primary);
    overflow: hidden;
}

.sidebar-logo .logo-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 2px;
}

.sidebar-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.sidebar-subtitle {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.sidebar-nav {
    padding: 1rem 0;
}

.nav-section {
    padding: 0.5rem 1.5rem;
    margin-top: 1rem;
}

.nav-section-title {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.875rem 1.5rem;
    color: var(--text-secondary);
    font-size: 0.95rem;
    font-weight: 500;
    transition: all var(--transition-fast);
    border-left: 4px solid transparent;
    margin: 0.25rem 0.75rem;
    border-radius: var(--radius-sm);
}

.nav-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    transform: translateX(5px);
}

.nav-item.active {
    background: var(--grad-primary);
    color: white !important;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.nav-item i {
    width: 24px;
    text-align: center;
    font-size: 1.1rem;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: margin-left var(--transition-normal);
}

.sidebar.collapsed+.main-content,
body.sidebar-collapsed .main-content {
    margin-left: var(--sidebar-collapsed-width);
}

/* Sidebar Footer */
.sidebar-footer {
    margin-top: auto;
    padding: 1rem 0;
    border-top: 1px solid var(--border-color);
}

.sidebar-footer .nav-item {
    border-left: none;
}

/* Theme Toggle */
.theme-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.theme-toggle:hover {
    background: var(--bg-hover);
    color: var(--primary);
    border-color: var(--primary);
}

.theme-toggle i {
    font-size: 1.1rem;
}

/* Header */
.header {
    height: var(--header-height);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    position: sticky;
    top: 0;
    z-index: 50;
    backdrop-filter: blur(8px);
}

.header-title {
    font-size: 1.25rem;
    font-weight: 600;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.mobile-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 1.5rem;
    cursor: pointer;
}

/* Page Content */
.page-content {
    flex: 1;
    padding: 2rem;
}

/* Cards */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: all var(--transition-normal);
    position: relative;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--glass-border), transparent);
}

.card:hover {
    border-color: var(--primary-light);
    box-shadow: var(--shadow-xl);
    transform: translateY(-4px);
}

.card-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.card-body {
    padding: 1.5rem;
}

.card-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-color);
    background: rgba(0, 0, 0, 0.1);
}

/* Stat Cards */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 1.75rem;
    display: flex;
    align-items: center;
    gap: 1.25rem;
    transition: all var(--transition-normal);
}

.stat-card:hover {
    transform: translateY(-6px) scale(1.02);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.2);
    border-color: var(--primary);
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    box-shadow: 0 8px 16px -4px rgba(0, 0, 0, 0.1);
}

.stat-icon.primary {
    background: rgba(99, 102, 241, 0.15);
    color: var(--primary-light);
}

.stat-icon.success {
    background: rgba(34, 197, 94, 0.15);
    color: var(--success);
}

.stat-icon.warning {
    background: rgba(249, 115, 22, 0.15);
    color: var(--warning);
}

.stat-icon.danger {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger);
}

.stat-info {
    flex: 1;
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.stat-change {
    font-size: 0.8rem;
    margin-top: 0.5rem;
}

.stat-change.positive {
    color: var(--success);
}

.stat-change.negative {
    color: var(--danger);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    font-size: 0.9rem;
    font-weight: 500;
    border-radius: var(--radius);
    border: none;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Ensure button text is always visible in both themes */
.btn-primary,
.btn-success,
.btn-danger,
.btn-warning {
    color: white !important;
}

.btn-primary *,
.btn-success *,
.btn-danger *,
.btn-warning * {
    color: white !important;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white !important;
}

.btn-primary:hover:not(:disabled) {
    background: linear-gradient(135deg, var(--primary-light) 0%, var(--primary) 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
    color: white !important;
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--bg-hover);
    border-color: var(--border-light);
}

.btn-success {
    background: linear-gradient(135deg, var(--success) 0%, #16a34a 100%);
    color: white !important;
}

.btn-success:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(34, 197, 94, 0.4);
    color: white !important;
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger) 0%, #dc2626 100%);
    color: white !important;
}

.btn-danger:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
    color: white !important;
}

.btn-warning {
    background: linear-gradient(135deg, var(--warning) 0%, #ea580c 100%);
    color: white !important;
}

.btn-warning:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(249, 115, 22, 0.4);
    color: white !important;
}

.btn-sm {
    padding: 0.4rem 0.75rem;
    font-size: 0.8rem;
}

.btn-lg {
    padding: 0.875rem 1.75rem;
    font-size: 1rem;
}

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: var(--radius);
}

/* Forms */
.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.form-label.required::after {
    content: '*';
    color: var(--danger);
    margin-left: 0.25rem;
}

.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
    font-family: inherit;
    color: var(--text-primary);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    transition: all var(--transition-fast);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.form-control::placeholder {
    color: var(--text-muted);
}

.form-control:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 1rem;
    padding-right: 2.5rem;
}

textarea.form-control {
    min-height: 100px;
    resize: vertical;
}

.form-text {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.375rem;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

/* Tables */
.table-container {
    overflow-x: auto;
    border-radius: var(--radius-lg);
    -webkit-overflow-scrolling: touch;
    margin-bottom: 1rem;
    position: relative;
    border: 1px solid var(--border-color);
}

/* Scroll indicator hint for mobile */
@media (max-width: 768px) {
    .table-container::after {
        content: '';
        position: absolute;
        top: 0;
        right: 0;
        bottom: 0;
        width: 15px;
        background: linear-gradient(to right, transparent, rgba(0, 0, 0, 0.1));
        pointer-events: none;
    }
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.table th,
.table td {
    padding: 1rem 1.25rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.table th {
    background: var(--bg-tertiary);
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    white-space: nowrap;
}

.table tbody tr {
    transition: background var(--transition-fast);
}

.table tbody tr:hover {
    background: rgba(99, 102, 241, 0.05);
}

.table tbody tr:last-child td {
    border-bottom: none;
}

/* Status Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 9999px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.badge-paid,
.badge-success {
    background: rgba(34, 197, 94, 0.15);
    color: var(--success);
}

.badge-unpaid,
.badge-danger {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger);
}

.badge-partial,
.badge-warning {
    background: rgba(249, 115, 22, 0.15);
    color: var(--warning);
}

.badge-draft,
.badge-secondary {
    background: rgba(100, 116, 139, 0.15);
    color: var(--secondary);
}

.badge-sent,
.badge-info {
    background: rgba(14, 165, 233, 0.15);
    color: var(--info);
}

.badge-accepted,
.badge-primary {
    background: rgba(99, 102, 241, 0.15);
    color: var(--primary-light);
}

.badge-rejected {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger);
}

/* Action Buttons */
.action-buttons {
    display: flex;
    gap: 0.5rem;
}

/* Pagination */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1rem 0;
}

.pagination-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    color: var(--text-secondary);
    font-size: 0.875rem;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.pagination-btn:hover:not(:disabled) {
    background: var(--bg-hover);
    border-color: var(--primary);
    color: var(--primary-light);
}

.pagination-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.pagination-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Search & Filters */
.filters-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
}

.search-box {
    position: relative;
    flex: 1;
    min-width: 250px;
}

.search-box input {
    padding-left: 2.5rem;
}

.search-box i {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1040 !important;  /* Backdrop behind modal but above dashboard content */
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-normal);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* =====================================================
   MODAL STYLING — Mobile-Optimized with Safe Area Support
   ===================================================== */

.modal,
.modal-content,
.bottom-sheet {
    max-height: var(--mobile-modal-max-height) !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
    scroll-padding-bottom: var(--mobile-modal-bottom-offset);
}

.modal {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    width: 90%;
    max-width: 600px;
    display: flex;
    flex-direction: column;
    overflow: hidden !important;
    transform: scale(0.9) translateY(20px);
    transition: transform var(--transition-normal);
}

.modal-overlay.active .modal {
    transform: scale(1) translateY(0);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    background: var(--bg-card);
    z-index: 10;  /* Keep header visible while scrolling */
}

.modal-title {
    font-size: 1.1rem;
    font-weight: 600;
}

.modal-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: var(--radius);
    transition: all var(--transition-fast);
}

.modal-close:hover {
    background: var(--bg-tertiary);
    color: var(--danger);
}

.modal-body {
    padding: 1.5rem;
    flex: 1;
    overflow-y: auto;
    padding-bottom: calc(1.5rem + var(--mobile-modal-bottom-offset));
}

.modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 1.25rem 1.5rem;
    padding-bottom: calc(1.25rem + var(--mobile-modal-bottom-offset));
    border-top: 1px solid var(--border-color);
    background: rgba(0, 0, 0, 0.1);
    position: sticky;
    bottom: 0;
    z-index: 10;  /* Keep footer visible while scrolling */
}

.modal-backdrop {
    z-index: 1040 !important;
}

/* Invoice/Quotation Items */
.items-table {
    margin-top: 1rem;
}

.items-table input {
    background: var(--bg-primary);
}

.items-table td {
    vertical-align: middle;
}

.items-table .item-name {
    min-width: 200px;
}

.items-table .item-qty,
.items-table .item-price,
.items-table .item-subtotal {
    width: 120px;
}

.items-table .item-actions {
    width: 50px;
    text-align: center;
}

.add-item-btn {
    margin-top: 1rem;
}

/* Summary Box */
.summary-box {
    background: var(--bg-tertiary);
    border-radius: var(--radius);
    padding: 1.25rem;
    margin-top: 1.5rem;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    font-size: 0.9rem;
}

.summary-row.total {
    border-top: 2px solid var(--border-light);
    margin-top: 0.5rem;
    padding-top: 1rem;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary-light);
}

/* Charts */
.chart-container {
    position: relative;
    height: 300px;
    padding: 1rem;
}

.chart-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem 1.5rem;
    color: var(--text-secondary);
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 1rem;
    color: var(--text-muted);
}

.empty-state h3 {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.empty-state p {
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
}

/* Alerts */
.alert {
    padding: 1rem 1.25rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

.alert i {
    margin-top: 0.125rem;
}

.alert-success {
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid rgba(34, 197, 94, 0.3);
    color: var(--success);
}

.alert-danger {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: var(--danger);
}

.alert-warning {
    background: rgba(249, 115, 22, 0.1);
    border: 1px solid rgba(249, 115, 22, 0.3);
    color: var(--warning);
}

.alert-info {
    background: rgba(14, 165, 233, 0.1);
    border: 1px solid rgba(14, 165, 233, 0.3);
    color: var(--info);
}

/* Loading Spinner */
.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

/* Print Styles */
@media print {
    @page {
        margin: 12mm;
    }

    html,
    body {
        background: #ffffff !important;
        color: #000000 !important;
        font-family: 'Inter', 'Public Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif !important;
    }

    body * {
        color: #000000 !important;
        text-shadow: none !important;
        box-shadow: none !important;
    }

    body * {
        background: #ffffff !important;
        background-image: none !important;
    }

    .sidebar,
    .sidebar-toggle,
    .header,
    .topnav,
    .mobile-app-header,
    .mobile-sidebar,
    .mobile-sidebar-overlay,
    .navbar,
    .bottom-nav,
    .mobile-bottom-nav,
    .mobile-overlay,
    .mobile-toggle,
    .notification-bell-wrapper,
    .topnav-actions,
    .topnav-user-profile,
    .btn,
    .action-buttons,
    .settings-btn,
    .floating-action-btn,
    .floating-action-button,
    .floating-actions,
    .fab,
    .theme-toggle,
    .no-print,
    .print-hide {
        display: none !important;
    }

    .main-content {
        margin-left: 0 !important;
        padding-top: 0 !important;
        background: #ffffff !important;
    }

    .app-wrapper > header,
    body.topnav-layout > .app-wrapper > header,
    body.topnav-layout .mobile-app-header,
    body.topnav-layout .topnav {
        display: none !important;
    }

    .page-content {
        padding: 0 !important;
        margin: 0 !important;
        background: #ffffff !important;
    }

    .card,
    .table-container,
    .summary-box,
    .report-wrapper,
    .project-print-wrapper {
        border: none !important;
        border-radius: 0 !important;
    }

    table {
        width: 100% !important;
        border-collapse: collapse !important;
    }

    thead {
        display: table-header-group !important;
    }

    tfoot {
        display: table-footer-group !important;
    }

    tr,
    td,
    th,
    img,
    .card,
    .report-section,
    .project-print-section,
    .project-print-log-entry {
        page-break-inside: avoid !important;
        break-inside: avoid !important;
    }

    a,
    a:visited {
        color: #000000 !important;
        text-decoration: none !important;
    }
}

html[data-theme="light"] .text-muted,
html[data-theme="light"] .form-text,
html[data-theme="light"] small,
html[data-theme="light"] .table th,
html[data-theme="light"] .table td,
html[data-theme="light"] .stat-label {
    color: #4a5568 !important;
}

html[data-theme="light"] .badge-secondary,
html[data-theme="light"] .badge-draft {
    background: #edf2f7 !important;
    color: #2d3748 !important;
    border-color: #cbd5e0 !important;
}

html[data-theme="light"] .badge-primary,
html[data-theme="light"] .badge-accepted {
    background: #ebf4ff !important;
    color: #2c5282 !important;
    border-color: #bee3f8 !important;
}

html[data-theme="light"] .badge-info,
html[data-theme="light"] .badge-warning,
html[data-theme="light"] .badge-success,
html[data-theme="light"] .badge-danger {
    filter: saturate(1.05);
}

/* Responsive */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }

    .mobile-toggle {
        display: block;
    }

    .mobile-overlay {
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 99;
        opacity: 0;
        visibility: hidden;
        transition: all var(--transition-normal);
    }

    .mobile-overlay.active {
        opacity: 1;
        visibility: visible;
    }
}

@media (max-width: 768px) {
    .page-content {
        padding: 1rem;
    }

    .stat-grid {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
        gap: 1rem;
    }

    .chart-grid {
        grid-template-columns: 1fr;
    }

    .filters-bar {
        flex-direction: column;
        padding: 0.75rem;
    }

    .search-box {
        width: 100%;
        min-width: 100%;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .table th,
    .table td {
        padding: 0.75rem 0.5rem;
        min-width: 120px;
        /* Ensure columns don't collapse too much */
    }

    .table td strong {
        display: block;
        max-width: 150px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .header {
        padding: 0 1rem;
    }

    .header-actions span {
        display: none;
        /* Hide date on small screens */
    }
}

/* Utilities */
.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.text-left {
    text-align: left;
}

.text-muted {
    color: var(--text-muted);
}

.text-primary {
    color: var(--primary-light);
}

.text-success {
    color: var(--success);
}

.text-danger {
    color: var(--danger);
}

.text-warning {
    color: var(--warning);
}

/* User Profile & Dropdown - Updated */
.nav-user-profile {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    gap: 0.75rem;
    padding: 0.4rem 0.75rem;
    border-radius: var(--radius-lg);
    cursor: pointer;
    position: relative;
    transition: all var(--transition-fast);
    background: transparent;
}

.nav-user-profile:hover {
    background: var(--bg-secondary);
}

.nav-user-profile .user-info {
    text-align: left;
    display: flex !important;
    flex-direction: column;
    justify-content: center;
    line-height: 1.2;
    min-width: 0;
    flex: 1;
}

.nav-user-profile .user-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 150px;
    display: block !important;
}

.nav-user-profile .user-role {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: capitalize;
    display: block !important;
}

.user-avatar {
    width: 32px;
    height: 32px;
    min-width: 32px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    border-radius: 50% !important;
    display: flex !important;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: white;
    font-size: 0.8rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.dropdown-arrow {
    font-size: 0.7rem;
    color: var(--text-muted);
    transition: transform var(--transition-fast);
}

.nav-user-profile:hover .dropdown-arrow {
    transform: rotate(180deg);
}

.nav-user-dropdown {
    position: absolute;
    top: calc(100% + 5px);
    right: 0;
    width: 200px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    padding: 0.5rem;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all var(--transition-normal);
    z-index: 1000;
}

.nav-user-profile:hover .nav-user-dropdown,
.nav-user-profile.active .nav-user-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-header {
    padding: 0.5rem 0.75rem;
    display: flex;
    flex-direction: column;
}

.dropdown-header strong {
    font-size: 0.85rem;
    color: var(--text-primary);
}

.dropdown-header span {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.dropdown-divider {
    height: 1px;
    background: var(--border-color);
    margin: 0.5rem 0;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.75rem;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.85rem;
    border-radius: var(--radius);
    transition: all var(--transition-fast);
}

.dropdown-item:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

@media (max-width: 992px) {
    .hide-tablet {
        display: none !important;
    }
}

@media (max-width: 640px) {
    .nav-user-profile .user-info {
        display: none !important;
    }

    .nav-user-profile {
        padding: 0.4rem;
    }

    /* Filters Bar Responsive */
    .d-flex.justify-between.align-center {
        flex-direction: column;
        align-items: stretch !important;
        gap: 1rem;
    }

    .filters-bar form {
        flex-direction: column;
        gap: 0.75rem !important;
    }

    .filters-bar form select,
    .filters-bar form .search-box {
        width: 100% !important;
    }

    .d-flex.gap-2 {
        justify-content: space-between;
    }

    .d-flex.gap-2 a,
    .d-flex.gap-2 button {
        flex: 1;
    }
}

.mt-1 {
    margin-top: 0.5rem;
}

.mt-2 {
    margin-top: 1rem;
}

.mt-3 {
    margin-top: 1.5rem;
}

.mt-4 {
    margin-top: 2rem;
}

.mb-1 {
    margin-bottom: 0.5rem;
}

.mb-2 {
    margin-bottom: 1rem;
}

.mb-3 {
    margin-bottom: 1.5rem;
}

.mb-4 {
    margin-bottom: 2rem;
}

.d-flex {
    display: flex;
}

.align-center {
    align-items: center;
}

.justify-between {
    justify-content: space-between;
}

.gap-1 {
    gap: 0.5rem;
}

.gap-2 {
    gap: 1rem;
}

.w-100 {
    width: 100%;
}

.hidden {
    display: none;
}

/* ==========================================
   Responsive Visibility Utilities
   ========================================== */
/* Hide on mobile (≤768px), show on desktop */
.d-none-mobile {
    display: block;
}
/* Hide on desktop, show on mobile */
.d-none-desktop {
    display: none;
}

@media (max-width: 768px) {
    .d-none-mobile {
        display: none !important;
    }
    .d-none-desktop {
        display: block !important;
    }
}

/* ==========================================
   Inventory Mobile Card Styles
   ========================================== */
.mobile-card-grid {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 1rem;
}

.inventory-mobile-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.inventory-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.5rem;
}

.inventory-card-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    flex: 1;
}

.inventory-card-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    background: var(--bg-tertiary);
    border-radius: var(--radius);
    padding: 0.75rem;
}

.inventory-stat-item {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.inventory-stat-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    font-weight: 600;
}

.inventory-stat-value {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
}

.inventory-card-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
}

.justify-end {
    justify-content: flex-end;
}

.cursor-pointer {
    cursor: pointer;
}

/* =====================================================
   DASHBOARD OVERRIDES — Glassmorphism Dark Mode
   ===================================================== */

/* ── Section Labels ── */
.section-label {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.section-label::before {
    content: '';
    display: inline-block;
    width: 3px;
    height: 14px;
    border-radius: 2px;
    background: var(--grad-primary);
}

/* ── Dashboard Header ── */
[data-page="dashboard"] .dashboard-header {
    padding-bottom: 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    margin-bottom: 2rem;
}

[data-page="dashboard"] .dashboard-header h1 {
    font-size: 1.85rem;
    font-weight: 800;
    line-height: 1.2;
    background: linear-gradient(135deg, #f8fafc 0%, #94a3b8 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.02em;
}

[data-page="dashboard"] .dashboard-header .text-muted {
    font-size: 0.95rem;
    color: var(--text-muted);
    margin-top: 0.35rem;
    line-height: 1.6;
}

.dashboard-meta {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    margin-top: 0.75rem;
    flex-wrap: wrap;
}

.dashboard-meta-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.82rem;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 20px;
    padding: 0.3rem 0.75rem;
}

.dashboard-meta-item i {
    font-size: 0.75rem;
    color: var(--primary-light);
}

/* ── Dashboard Section Spacing ── */
.dashboard-section {
    margin-bottom: 2rem;
}

/* ── Stat Grid Overrides ── */
[data-page="dashboard"] .stat-grid {
    gap: 1.25rem;
    margin-bottom: 1.75rem;
}

/* ── Glass Stat Cards ── */
[data-page="dashboard"] .stat-card {
    background: rgba(30, 41, 59, 0.55);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    padding: 1.5rem 1.75rem;
    position: relative;
    overflow: hidden;
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1),
                box-shadow 0.25s cubic-bezier(0.4, 0, 0.2, 1),
                border-color 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-page="dashboard"] .stat-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.12), transparent);
}

[data-page="dashboard"] .stat-card:hover {
    transform: translateY(-5px) scale(1.015);
    box-shadow: 0 16px 40px -8px rgba(0, 0, 0, 0.45);
    border-color: rgba(99, 102, 241, 0.35);
}

/* ── Accent Colors — Emerald / Amber / Rose ── */
[data-page="dashboard"] .stat-icon.success {
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
    box-shadow: 0 0 20px -4px rgba(16, 185, 129, 0.3);
}

[data-page="dashboard"] .stat-icon.warning {
    background: rgba(245, 158, 11, 0.15);
    color: #f59e0b;
    box-shadow: 0 0 20px -4px rgba(245, 158, 11, 0.3);
}

[data-page="dashboard"] .stat-icon.danger {
    background: rgba(244, 63, 94, 0.15);
    color: #f43f5e;
    box-shadow: 0 0 20px -4px rgba(244, 63, 94, 0.3);
}

[data-page="dashboard"] .stat-icon.primary {
    background: rgba(99, 102, 241, 0.15);
    color: #818cf8;
    box-shadow: 0 0 20px -4px rgba(99, 102, 241, 0.3);
}

[data-page="dashboard"] .stat-icon.info {
    background: rgba(6, 182, 212, 0.15);
    color: #06b6d4;
    box-shadow: 0 0 20px -4px rgba(6, 182, 212, 0.3);
}

[data-page="dashboard"] .stat-change.positive {
    color: #10b981;
}

[data-page="dashboard"] .stat-change.negative {
    color: #f43f5e;
}

/* ── Chart Grid Layout ── */
[data-page="dashboard"] .chart-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
    margin-bottom: 1.75rem;
}

@media (max-width: 900px) {
    [data-page="dashboard"] .chart-grid {
        grid-template-columns: 1fr;
    }
}

/* ── Glass Cards (chart/table cards) ── */
[data-page="dashboard"] .card {
    background: rgba(30, 41, 59, 0.6);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    overflow: hidden;
    position: relative;
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1),
                box-shadow 0.25s cubic-bezier(0.4, 0, 0.2, 1),
                border-color 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-page="dashboard"] .card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.12), transparent);
    pointer-events: none;
}

[data-page="dashboard"] .card:hover {
    transform: translateY(-3px);
    box-shadow: 0 20px 40px -12px rgba(0, 0, 0, 0.5),
                0 0 0 1px rgba(99, 102, 241, 0.15);
    border-color: rgba(99, 102, 241, 0.2);
}

[data-page="dashboard"] .card-header {
    padding: 1.1rem 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    background: rgba(255, 255, 255, 0.02);
}

[data-page="dashboard"] .card-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

[data-page="dashboard"] .card-title i {
    color: var(--primary-light);
    font-size: 0.9rem;
}

/* ── Modernized Tables ── */
[data-page="dashboard"] .table-container {
    border: none;
    border-radius: 0;
    margin-bottom: 0;
}

[data-page="dashboard"] .table {
    font-size: 0.875rem;
}

[data-page="dashboard"] .table th {
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-muted);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 0.85rem 1.25rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

[data-page="dashboard"] .table td {
    padding: 0.9rem 1.25rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    color: var(--text-primary);
    vertical-align: middle;
}

[data-page="dashboard"] .table tbody tr:nth-child(even) {
    background: rgba(255, 255, 255, 0.02);
}

[data-page="dashboard"] .table tbody tr:last-child td {
    border-bottom: none;
}

[data-page="dashboard"] .table tbody tr {
    transition: background 0.15s ease;
}

[data-page="dashboard"] .table tbody tr:hover {
    background: rgba(99, 102, 241, 0.07) !important;
}

[data-page="dashboard"] .table a {
    color: var(--primary-light);
    font-weight: 500;
    transition: color 0.15s ease;
}

[data-page="dashboard"] .table a:hover {
    color: #c7d2fe;
}

/* ── Badge Overrides ── */
[data-page="dashboard"] .badge-success {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.25);
}

[data-page="dashboard"] .badge-warning {
    background: rgba(245, 158, 11, 0.15);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.25);
}

[data-page="dashboard"] .badge-danger {
    background: rgba(244, 63, 94, 0.15);
    color: #fb7185;
    border: 1px solid rgba(244, 63, 94, 0.25);
}

[data-page="dashboard"] .badge-primary {
    background: rgba(99, 102, 241, 0.15);
    color: #a5b4fc;
    border: 1px solid rgba(99, 102, 241, 0.25);
}

[data-page="dashboard"] .badge-secondary {
    background: rgba(100, 116, 139, 0.2);
    color: #94a3b8;
    border: 1px solid rgba(100, 116, 139, 0.25);
}

/* mt-3 / mt-4 utility inside dashboard */
[data-page="dashboard"] .mt-3 {
    margin-top: 1.75rem;
}

/* ── Light Theme Adjustments ── */
[data-theme="light"] [data-page="dashboard"] .stat-card {
    background: rgba(255, 255, 255, 0.72);
    border-color: rgba(0, 0, 0, 0.07);
}

[data-theme="light"] [data-page="dashboard"] .card {
    background: rgba(255, 255, 255, 0.8);
    border-color: rgba(0, 0, 0, 0.07);
}

[data-theme="light"] [data-page="dashboard"] .table th {
    background: rgba(0, 0, 0, 0.03);
    color: #64748b;
    border-bottom-color: rgba(0, 0, 0, 0.08);
}

[data-theme="light"] [data-page="dashboard"] .table td {
    border-bottom-color: rgba(0, 0, 0, 0.05);
    color: #0f172a;
}

[data-theme="light"] [data-page="dashboard"] .table tbody tr:nth-child(even) {
    background: rgba(0, 0, 0, 0.02);
}

[data-theme="light"] [data-page="dashboard"] .table tbody tr:hover {
    background: rgba(99, 102, 241, 0.05) !important;
}

[data-theme="light"] [data-page="dashboard"] .dashboard-meta-item {
    background: rgba(0, 0, 0, 0.04);
    border-color: rgba(0, 0, 0, 0.07);
}

[data-theme="light"] [data-page="dashboard"] .card-header {
    background: rgba(0, 0, 0, 0.02);
    border-bottom-color: rgba(0, 0, 0, 0.07);
}

[data-theme="light"] [data-page="dashboard"] .dashboard-header h1 {
    background: linear-gradient(135deg, #0f172a 0%, #475569 100%);
    -webkit-background-clip: text;
    background-clip: text;
}

/* ── Responsive ── */
@media (max-width: 640px) {
    [data-page="dashboard"] .stat-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    [data-page="dashboard"] .stat-card {
        padding: 1.25rem;
    }

    [data-page="dashboard"] .dashboard-meta {
        gap: 0.75rem;
    }
}

/* =====================================================
   SIDEBAR & HEADER — Glassmorphism Overrides
   ===================================================== */

/* ── Core Sidebar Shell ── */
.sidebar {
    background: rgba(10, 15, 30, 0.82);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border-right: 1px solid rgba(255, 255, 255, 0.07);
    box-shadow: 4px 0 32px rgba(0, 0, 0, 0.35);
}

/* ── Sidebar Header (Logo Area) ── */
.sidebar-header {
    padding: 1.4rem 1.25rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(255, 255, 255, 0.025);
}

.sidebar-logo {
    width: 38px;
    height: 38px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.25), rgba(79, 70, 229, 0.35));
    border: 1px solid rgba(99, 102, 241, 0.35);
    border-radius: 10px;
    box-shadow: 0 0 18px -4px rgba(99, 102, 241, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #818cf8;
    font-size: 1.1rem;
}

.sidebar-title {
    font-size: 1.0rem;
    font-weight: 700;
    color: #f1f5f9;
    letter-spacing: -0.01em;
}

.sidebar-subtitle {
    font-size: 0.7rem;
    color: rgba(148, 163, 184, 0.7);
    letter-spacing: 0.04em;
    text-transform: uppercase;
    font-weight: 500;
}

/* ── Section Titles (e.g. "Finance", "Vault") ── */
.nav-section-title {
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: rgba(100, 116, 139, 0.75);
    padding-left: 0.25rem;
}

.nav-section {
    padding: 0.4rem 1.5rem;
    margin-top: 0.75rem;
}

/* ── Nav Items ── */
.nav-item {
    gap: 0.875rem;
    padding: 0.75rem 1.25rem;
    color: rgba(148, 163, 184, 0.85);
    font-size: 0.9rem;
    font-weight: 500;
    margin: 0.15rem 0.625rem;
    border-radius: 10px;
    border-left: none;
    position: relative;
    transition: background 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.nav-item i {
    width: 20px;
    font-size: 1rem;
    text-align: center;
    flex-shrink: 0;
    transition: color 0.18s ease;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.055);
    color: #f1f5f9;
    transform: translateX(3px);
}

.nav-item:hover i {
    color: #818cf8;
}

/* ── Active Nav Item — Gradient Glow ── */
.nav-item.active {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.28) 0%, rgba(79, 70, 229, 0.2) 100%);
    color: #e0e7ff !important;
    border-left: none;
    border-radius: 10px;
    box-shadow:
        inset 0 0 0 1px rgba(99, 102, 241, 0.3),
        0 0 18px -4px rgba(99, 102, 241, 0.4),
        0 4px 12px -4px rgba(0, 0, 0, 0.3);
    position: relative;
}

.nav-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 20%;
    bottom: 20%;
    width: 3px;
    background: linear-gradient(180deg, #818cf8, #6366f1);
    border-radius: 0 3px 3px 0;
    box-shadow: 0 0 8px rgba(99, 102, 241, 0.7);
}

.nav-item.active i {
    color: #a5b4fc;
    filter: drop-shadow(0 0 6px rgba(99, 102, 241, 0.5));
}

/* ── Sidebar Toggle Button ── */
.sidebar-toggle {
    background: rgba(30, 41, 59, 0.7);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.09);
    color: rgba(148, 163, 184, 0.8);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
    transition: all 0.2s ease;
}

.sidebar-toggle:hover {
    background: rgba(99, 102, 241, 0.25);
    border-color: rgba(99, 102, 241, 0.4);
    color: #a5b4fc;
    box-shadow: 0 0 14px -2px rgba(99, 102, 241, 0.35);
}

/* ── Sidebar Footer ── */
.sidebar-footer {
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(255, 255, 255, 0.015);
    padding: 0.75rem 0;
}

.sidebar-footer .nav-item {
    border-left: none;
}

/* ── Top Header Bar ── */
.header {
    background: rgba(15, 23, 42, 0.75);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
    box-shadow: 0 1px 24px rgba(0, 0, 0, 0.25);
}

/* ── Light Theme Adjustments ── */
[data-theme="light"] .sidebar {
    background: rgba(248, 250, 252, 0.88);
    border-right-color: rgba(0, 0, 0, 0.07);
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .sidebar-header {
    background: rgba(0, 0, 0, 0.02);
    border-bottom-color: rgba(0, 0, 0, 0.07);
}

[data-theme="light"] .sidebar-logo {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.12), rgba(79, 70, 229, 0.18));
    border-color: rgba(99, 102, 241, 0.2);
}

[data-theme="light"] .sidebar-title {
    color: #0f172a;
}

[data-theme="light"] .sidebar-subtitle {
    color: rgba(100, 116, 139, 0.8);
}

[data-theme="light"] .nav-section-title {
    color: rgba(100, 116, 139, 0.6);
}

[data-theme="light"] .nav-item {
    color: rgba(71, 85, 105, 0.9);
}

[data-theme="light"] .nav-item:hover {
    background: rgba(99, 102, 241, 0.07);
    color: #0f172a;
}

[data-theme="light"] .nav-item.active {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.15) 0%, rgba(79, 70, 229, 0.1) 100%);
    color: #4f46e5 !important;
    box-shadow:
        inset 0 0 0 1px rgba(99, 102, 241, 0.2),
        0 0 14px -4px rgba(99, 102, 241, 0.2);
}

[data-theme="light"] .nav-item.active i {
    color: #6366f1;
    filter: none;
}

[data-theme="light"] .sidebar-toggle {
    background: rgba(241, 245, 249, 0.9);
    border-color: rgba(0, 0, 0, 0.1);
    color: #64748b;
}

[data-theme="light"] .sidebar-toggle:hover {
    background: rgba(99, 102, 241, 0.12);
    border-color: rgba(99, 102, 241, 0.25);
    color: #4f46e5;
}

[data-theme="light"] .sidebar-footer {
    border-top-color: rgba(0, 0, 0, 0.07);
    background: rgba(0, 0, 0, 0.015);
}

[data-theme="light"] .header {
    background: rgba(255, 255, 255, 0.88);
    border-bottom-color: rgba(0, 0, 0, 0.07);
    box-shadow: 0 1px 16px rgba(0, 0, 0, 0.07);
}

/* ── Mobile Sidebar Overlay ── */
@media (max-width: 768px) {
    .mobile-overlay {
        background: rgba(0, 0, 0, 0.55);
        backdrop-filter: blur(4px);
        -webkit-backdrop-filter: blur(4px);
    }

    .sidebar {
        background: rgba(10, 15, 30, 0.95);
    }
}

/* =====================================================
   VISUAL ELEVATION — Rich Background + Premium Cards
   ===================================================== */

/* ── Rich Gradient Mesh Background (makes backdrop-filter visible) ── */
body {
    background-color: #060c1a;
    background-image:
        radial-gradient(ellipse 80% 60% at 20% 10%, rgba(99, 102, 241, 0.18) 0%, transparent 60%),
        radial-gradient(ellipse 60% 50% at 80% 85%, rgba(139, 92, 246, 0.14) 0%, transparent 55%),
        radial-gradient(ellipse 50% 40% at 55% 50%, rgba(16, 185, 129, 0.07) 0%, transparent 60%),
        radial-gradient(ellipse 70% 50% at 10% 80%, rgba(6, 182, 212, 0.08) 0%, transparent 55%);
    background-attachment: fixed;
}

/* ── Subtle animated orb behind main content ── */
.main-content::before {
    content: '';
    position: fixed;
    top: -200px;
    right: -100px;
    width: 700px;
    height: 700px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.1) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
    animation: orb-drift 18s ease-in-out infinite alternate;
}

.main-content::after {
    content: '';
    position: fixed;
    bottom: -150px;
    left: 200px;
    width: 500px;
    height: 500px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(16, 185, 129, 0.07) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
    animation: orb-drift 24s ease-in-out infinite alternate-reverse;
}

@keyframes orb-drift {
    0%   { transform: translate(0, 0); }
    100% { transform: translate(40px, 30px); }
}

/* Page content sits above orbs */
.page-content {
    position: relative;
    z-index: 1;
}

/* ── Scrollbar Theme ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: rgba(255,255,255,0.03); }
::-webkit-scrollbar-thumb { background: rgba(99, 102, 241, 0.35); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: rgba(99, 102, 241, 0.6); }

/* ── Premium Stat Cards ── */
[data-page="dashboard"] .stat-card {
    background: rgba(15, 23, 42, 0.65);
    border: 1px solid rgba(255, 255, 255, 0.09);
    border-top: none;
    border-radius: 16px;
    overflow: visible;
    padding-top: 1.75rem;
    position: relative;
}

/* Colorful top accent bar per stat type */
[data-page="dashboard"] .stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    border-radius: 16px 16px 0 0;
    background: linear-gradient(90deg, rgba(99,102,241,0.6), rgba(139,92,246,0.4));
}

[data-page="dashboard"] .stat-card:has(.stat-icon.success)::before {
    background: linear-gradient(90deg, #10b981, rgba(16,185,129,0.3));
}
[data-page="dashboard"] .stat-card:has(.stat-icon.danger)::before {
    background: linear-gradient(90deg, #f43f5e, rgba(244,63,94,0.3));
}
[data-page="dashboard"] .stat-card:has(.stat-icon.warning)::before {
    background: linear-gradient(90deg, #f59e0b, rgba(245,158,11,0.3));
}
[data-page="dashboard"] .stat-card:has(.stat-icon.info)::before {
    background: linear-gradient(90deg, #06b6d4, rgba(6,182,212,0.3));
}

/* Bigger, bolder stat values */
[data-page="dashboard"] .stat-value {
    font-size: 2rem;
    font-weight: 800;
    color: #f1f5f9;
    letter-spacing: -0.03em;
    line-height: 1.1;
}

[data-page="dashboard"] .stat-label {
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

[data-page="dashboard"] .stat-change {
    font-size: 0.78rem;
    margin-top: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

/* ── Premium Chart Grid Cards ── */
[data-page="dashboard"] .card {
    background: rgba(10, 18, 36, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.07);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
}

[data-page="dashboard"] .card-header {
    background: rgba(255, 255, 255, 0.03);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    padding: 1rem 1.5rem;
}

[data-page="dashboard"] .card-title {
    font-size: 0.88rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    color: #cbd5e1;
}

/* ── Dashboard Header Elevated ── */
[data-page="dashboard"] .dashboard-header h1 {
    font-size: 2rem;
    font-weight: 800;
    background: linear-gradient(135deg, #f8fafc 0%, var(--primary-light) 60%, #818cf8 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ── Section Label Elevated ── */
.section-label {
    color: rgba(148, 163, 184, 0.7);
    margin-bottom: 1.25rem;
    margin-top: 0.5rem;
}

/* ── Table Rows Elevated ── */
[data-page="dashboard"] .table td {
    color: #cbd5e1;
}

[data-page="dashboard"] .table a {
    color: #a5b4fc;
}

/* ── Sidebar even more pronounced ── */
.sidebar {
    background: rgba(6, 10, 22, 0.88);
}

/* Light theme: turn off orbs + restore clean bg */
[data-theme="light"] body {
    background-color: #f0f4ff;
    background-image:
        radial-gradient(ellipse 80% 60% at 20% 10%, rgba(99, 102, 241, 0.08) 0%, transparent 60%),
        radial-gradient(ellipse 60% 50% at 80% 85%, rgba(139, 92, 246, 0.06) 0%, transparent 55%);
}

[data-theme="light"] .main-content::before,
[data-theme="light"] .main-content::after {
    display: none;
}

[data-theme="light"] [data-page="dashboard"] .stat-card {
    background: rgba(255, 255, 255, 0.8);
    border-color: rgba(0, 0, 0, 0.06);
}

[data-theme="light"] [data-page="dashboard"] .stat-value {
    color: #0f172a;
}

[data-theme="light"] [data-page="dashboard"] .card {
    background: rgba(255, 255, 255, 0.85);
    border-color: rgba(0, 0, 0, 0.07);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

[data-theme="light"] [data-page="dashboard"] .table td {
    color: #1e293b;
}

[data-theme="light"] ::-webkit-scrollbar-thumb {
    background: rgba(99, 102, 241, 0.25);
}

/* =====================================================
   PREMIUM SPACE-DARK GLOBAL OVERRIDE
   ===================================================== */
html[data-theme="dark"] {
    --primary: #6633fb;
    --primary-dark: #4b1ff2;
    --primary-light: #c4b5fd;
    --secondary: #8f9bb3;
    --success: #00d2ff;
    --warning: #f59e0b;
    --danger: #f53c6e;
    --info: #1572ff;

    --bg-primary: #0b0e19;
    --bg-secondary: #101525;
    --bg-tertiary: #161b30;
    --bg-card: #161b30;
    --bg-hover: rgba(255, 255, 255, 0.05);

    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --text-muted: #8f9bb3;

    --border-color: rgba(255, 255, 255, 0.08);
    --border-light: rgba(255, 255, 255, 0.14);

    --shadow-sm: 0 12px 24px rgba(0, 0, 0, 0.22);
    --shadow: 0 20px 40px rgba(0, 0, 0, 0.32);
    --shadow-lg: 0 20px 40px rgba(0, 0, 0, 0.4);
    --shadow-xl: 0 24px 48px rgba(0, 0, 0, 0.48);

    --radius-sm: 16px;
    --radius: 16px;
    --radius-lg: 16px;
    --radius-xl: 16px;

    --glass-bg: #161b30;
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-blur: 15px;
    --grad-primary: linear-gradient(135deg, #6633fb 0%, #e044ff 100%);
    --grad-blue: linear-gradient(135deg, #1572ff 0%, #00d2ff 100%);
    --grad-magenta: linear-gradient(135deg, #f53c6e 0%, #ff64b4 100%);
}

html[data-theme="dark"] body {
    background-color: #0b0e19;
    color: var(--text-primary);
}

html[data-theme="dark"] body {
    background-image:
        radial-gradient(circle at top left, rgba(102, 51, 251, 0.18), transparent 28%),
        radial-gradient(circle at top right, rgba(21, 114, 255, 0.14), transparent 24%),
        linear-gradient(180deg, #0b0e19 0%, #0b0e19 100%);
}

html[data-theme="dark"] .app-wrapper,
html[data-theme="dark"] .main-content,
html[data-theme="dark"] .page-content,
html[data-theme="dark"] .dashboard-header,
html[data-theme="dark"] .content-wrapper,
html[data-theme="dark"] .content-area {
    background: transparent;
}

html[data-theme="dark"] .card,
html[data-theme="dark"] .container,
html[data-theme="dark"] .container-fluid,
html[data-theme="dark"] .modal-content,
html[data-theme="dark"] .portal-card,
html[data-theme="dark"] .inventory-mobile-card {
    background: #161b30;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
}

html[data-theme="dark"] .card::before,
html[data-theme="dark"] .portal-card::before {
    display: none;
}

html[data-theme="dark"] .card-header,
html[data-theme="dark"] .card-footer,
html[data-theme="dark"] .modal-header,
html[data-theme="dark"] .modal-footer {
    background: transparent;
    border-color: rgba(255, 255, 255, 0.08);
}

html[data-theme="dark"] .card-title,
html[data-theme="dark"] .modal-title,
html[data-theme="dark"] .portal-card-title {
    color: #ffffff;
}

html[data-theme="dark"] .btn {
    border-radius: 16px;
    font-weight: 600;
    transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease, background 0.22s ease, color 0.22s ease;
}

html[data-theme="dark"] .btn:hover:not(:disabled) {
    transform: translateY(-2px);
}

html[data-theme="dark"] .btn-primary {
    background: var(--grad-primary);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 12px 28px rgba(102, 51, 251, 0.35);
}

html[data-theme="dark"] .btn-primary:hover:not(:disabled) {
    background: linear-gradient(135deg, #7c4dff 0%, #f05dff 100%);
    box-shadow: 0 16px 34px rgba(102, 51, 251, 0.42);
}

html[data-theme="dark"] .btn-secondary,
html[data-theme="dark"] .btn-outline-secondary {
    background: rgba(255, 255, 255, 0.03);
    color: #e6ecff;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

html[data-theme="dark"] .btn-secondary:hover:not(:disabled),
html[data-theme="dark"] .btn-outline-secondary:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.07);
    color: #ffffff;
    border-color: rgba(102, 51, 251, 0.35);
    box-shadow: 0 14px 28px rgba(0, 0, 0, 0.28);
}

html[data-theme="dark"] .btn-success {
    background: var(--grad-blue);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 12px 28px rgba(21, 114, 255, 0.32);
}

html[data-theme="dark"] .btn-success:hover:not(:disabled) {
    box-shadow: 0 16px 34px rgba(21, 114, 255, 0.4);
}

html[data-theme="dark"] .btn-danger {
    background: var(--grad-magenta);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 12px 28px rgba(245, 60, 110, 0.32);
}

html[data-theme="dark"] .btn-danger:hover:not(:disabled) {
    box-shadow: 0 16px 34px rgba(245, 60, 110, 0.42);
}

html[data-theme="dark"] .btn-warning {
    background: linear-gradient(135deg, #f59e0b 0%, #fb7185 100%);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 12px 28px rgba(245, 158, 11, 0.3);
}

html[data-theme="dark"] .form-control,
html[data-theme="dark"] input:not([type="checkbox"]):not([type="radio"]),
html[data-theme="dark"] select,
html[data-theme="dark"] textarea {
    background: #101525;
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

html[data-theme="dark"] .form-control:focus,
html[data-theme="dark"] input:not([type="checkbox"]):not([type="radio"]):focus,
html[data-theme="dark"] select:focus,
html[data-theme="dark"] textarea:focus {
    border-color: rgba(102, 51, 251, 0.7);
    box-shadow: 0 0 0 4px rgba(102, 51, 251, 0.14);
    outline: none;
}

html[data-theme="dark"] .form-control::placeholder,
html[data-theme="dark"] input::placeholder,
html[data-theme="dark"] textarea::placeholder {
    color: #8f9bb3;
}

html[data-theme="dark"] .form-label,
html[data-theme="dark"] label {
    color: #cbd5e1;
}

html[data-theme="dark"] .stat-card {
    position: relative;
    overflow: hidden;
    color: #ffffff;
    border: none;
    border-radius: 16px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}

html[data-theme="dark"] .stat-grid .stat-card:nth-child(3n + 1) {
    background: linear-gradient(135deg, #6633fb 0%, #e044ff 100%);
}

html[data-theme="dark"] .stat-grid .stat-card:nth-child(3n + 2) {
    background: linear-gradient(135deg, #1572ff 0%, #00d2ff 100%);
}

html[data-theme="dark"] .stat-grid .stat-card:nth-child(3n + 3) {
    background: linear-gradient(135deg, #f53c6e 0%, #ff64b4 100%);
}

html[data-theme="dark"] .stat-card,
html[data-theme="dark"] .stat-card *,
html[data-theme="dark"] .stat-card .stat-label,
html[data-theme="dark"] .stat-card .stat-value,
html[data-theme="dark"] .stat-card .stat-change {
    color: #ffffff !important;
}

html[data-theme="dark"] .stat-icon,
html[data-theme="dark"] .stat-card .stat-icon {
    background: rgba(255, 255, 255, 0.14);
    color: #ffffff !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

html[data-theme="dark"] .table-container {
    background: transparent;
    border: none;
    overflow: visible;
}

html[data-theme="dark"] .table {
    border-collapse: separate;
    border-spacing: 0 10px;
}

html[data-theme="dark"] .table th {
    background: transparent;
    border: none;
    color: #8f9bb3;
    font-size: 0.74rem;
    letter-spacing: 0.08em;
    padding-top: 0;
    padding-bottom: 0.55rem;
}

html[data-theme="dark"] .table td {
    background: rgba(255, 255, 255, 0.02);
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    color: #e2e8f0;
}

html[data-theme="dark"] .table tbody td:first-child {
    border-left: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 16px 0 0 16px;
}

html[data-theme="dark"] .table tbody td:last-child {
    border-right: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 0 16px 16px 0;
}

html[data-theme="dark"] .table tbody tr {
    background: transparent;
}

html[data-theme="dark"] .table tbody tr:hover td {
    background: rgba(255, 255, 255, 0.05);
    transition: background 0.3s ease;
}

html[data-theme="dark"] .badge {
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.05);
    color: #ffffff;
}

html[data-theme="dark"] .alert {
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

/* =====================================================
   MOBILE UX FOUNDATION
   ===================================================== */

.mobile-bottom-nav {
    display: none;
    z-index: 1060 !important;
}

.mobile-options-trigger {
    display: none;
}

.mobile-actions-shell .mobile-action-menu {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.chart-container canvas {
    max-width: 100%;
}

@media (min-width: 769px) {
    .mobile-actions-shell {
        display: contents;
    }

    .mobile-action-menu {
        display: flex !important;
    }
}

@media (max-width: 768px) {
    .chart-container {
        height: 260px !important;
        padding: 0.75rem !important;
    }

    .chart-container canvas {
        width: 100% !important;
        height: 100% !important;
    }

    .mobile-actions-shell {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 0.65rem;
    }

    .mobile-options-trigger {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 0.45rem;
        min-width: 44px;
        min-height: 44px;
        padding: 0.7rem 0.95rem;
        border-radius: 14px;
        border: 1px solid var(--border-color);
        background: var(--bg-tertiary);
        color: var(--text-primary);
        font-size: 0.85rem;
        font-weight: 600;
        cursor: pointer;
    }

    .mobile-actions-shell .mobile-action-menu {
        display: none;
    }

    .mobile-actions-shell.is-open .mobile-action-menu {
        display: flex;
    }

    .mobile-action-menu .btn,
    .mobile-action-menu .btn-sm,
    .mobile-action-menu .btn-icon,
    .action-buttons .btn,
    .action-buttons .btn-sm,
    .action-buttons .btn-icon {
        min-width: 44px;
        min-height: 44px;
    }

    .form-group.mobile-floating-group {
        position: relative;
    }

    .form-group.mobile-floating-group > .form-label {
        position: absolute;
        top: 0.5rem;
        left: 1rem;
        margin: 0;
        font-size: 0.72rem;
        font-weight: 700;
        letter-spacing: 0.08em;
        text-transform: uppercase;
        color: var(--text-muted);
        pointer-events: none;
        z-index: 1;
    }

    .form-group.mobile-floating-group > .form-control,
    .form-group.mobile-floating-group > input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="file"]),
    .form-group.mobile-floating-group > select,
    .form-group.mobile-floating-group > textarea {
        min-height: 56px;
        padding: 1.65rem 1rem 0.75rem !important;
        font-size: 16px;
    }

    .form-group.mobile-floating-group > textarea {
        min-height: 120px;
        padding-top: 1.9rem !important;
    }

    .modal-overlay {
        align-items: flex-end !important;
        padding: 12px 12px var(--mobile-modal-bottom-offset) !important;
    }

    .modal {
        width: 100% !important;
        max-width: none !important;
        max-height: 90dvh !important;
        margin: 0 !important;
        border-radius: 22px 22px 0 0 !important;
        transform: translateY(100%) !important;
    }

    .modal::before {
        content: '';
        display: block;
        width: 42px;
        height: 5px;
        border-radius: 999px;
        background: rgba(148, 163, 184, 0.45);
        margin: 10px auto 0;
    }

    .modal-overlay.active .modal {
        transform: translateY(0) !important;
    }

    .modal-header {
        padding: 14px 16px !important;
    }

    .modal-body {
        padding: 14px 16px calc(14px + var(--mobile-modal-bottom-offset)) !important;
    }

    .modal-footer {
        padding: 14px 16px calc(14px + var(--mobile-modal-bottom-offset)) !important;
    }

    .modal-footer {
        flex-direction: column-reverse !important;
    }

    .modal-footer .btn {
        width: 100%;
        min-height: 48px;
    }

    .modal-content,
    .bottom-sheet,
    .payroll-modal-content,
    .announcement-modal-content {
        max-height: 90dvh !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
    }

    .modal-content,
    .payroll-modal-content,
    .announcement-modal-content {
        padding-bottom: calc(16px + var(--mobile-modal-bottom-offset)) !important;
    }

    .modal-backdrop,
    .payroll-modal-backdrop,
    .announcement-modal,
    .announcement-modal.show {
        align-items: flex-end !important;
        justify-content: center !important;
        padding: 12px 12px var(--mobile-modal-bottom-offset) !important;
    }
}
