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

:root {
    --brand-red: #E4004B;
    --brand-orange: #ED775A;
    --brand-gold: #FAD691;
    --brand-gray: #140a6d;
    --brand-purple: #667eea;
    --brand-purple-dark: #764ba2;
    --side-bg: #ffffff;
    --body-bg: #f8f9fc;
    --text-primary: #1a1d2e;
    --text-secondary: #6b7280;
    --border-color: #e5e7eb;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.1);
    --sidebar-width: 60px;
}

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

body {
    background: var(--body-bg);
    color: var(--text-primary);
    font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* ========================================
   SIDEBAR - Compact Icon-Only Design (No Expansion)
======================================== */
.sidebar {
    width: var(--sidebar-width);
    background: var(--side-bg);
    height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    padding: 0;
    z-index: 1000;
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-md);
    overflow-y: auto;
    overflow-x: hidden;
    /* Hide horizontal scrollbar on sidebar */
}

/* Logo Section - Compact */
.logo-details {
    padding: 16px 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-bottom: 1px solid var(--border-color);
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    position: relative;
    overflow: hidden;
    min-height: 60px;
}

.logo-details::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, rgba(255, 255, 255, 0.1) 0%, transparent 100%);
    pointer-events: none;
}

.logo-details i {
    font-size: 28px;
    color: white;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
    position: relative;
    z-index: 1;
}

.logo_name {
    display: none;
}

/* Navigation List */
.nav-list {
    flex: 1;
    padding: 8px 0;
    overflow: visible;
    /* Allow tooltips to overflow */
    list-style: none;
}

.nav-list li {
    margin-bottom: 4px;
    position: relative;
}

.nav-list li a {
    color: var(--text-secondary);
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 14px 0;
    margin: 0 8px;
    border-radius: 10px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: 500;
    font-size: 14px;
    position: relative;
    overflow: visible;
    /* Allow tooltip overflow */
}

.nav-list li a i {
    font-size: 24px;
    transition: all 0.3s ease;
}

.links_name {
    display: none;
}

/* Tooltip for navigation items - Using fixed positioning */
.nav-list li a::after {
    content: attr(data-tooltip);
    position: fixed;
    /* Use fixed to escape sidebar overflow */
    left: calc(var(--sidebar-width) + 18px);
    /* Position after sidebar */
    background: var(--text-primary);
    color: white;
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 10001;
    transform: translateX(-10px);
}

.nav-list li a::before {
    content: '';
    position: fixed;
    /* Use fixed to escape sidebar overflow */
    left: calc(var(--sidebar-width) + 12px);
    /* Position arrow after sidebar */
    width: 0;
    height: 0;
    border-top: 6px solid transparent;
    border-bottom: 6px solid transparent;
    border-right: 6px solid var(--text-primary);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 10001;
}

/* Dynamic positioning will be handled via JavaScript */
.nav-list li:hover a::after {
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
}

.nav-list li:hover a::before {
    opacity: 1;
    visibility: visible;
}

.nav-list li a:hover {
    background: linear-gradient(135deg, rgba(228, 0, 75, 0.08), rgba(237, 119, 90, 0.08));
    color: var(--brand-red);
}

.nav-list li a:hover i {
    transform: scale(1.15);
}

.nav-list li a.active {
    background: linear-gradient(135deg, var(--brand-red), var(--brand-orange));
    color: white;
    box-shadow: 0 4px 15px rgba(228, 0, 75, 0.25);
}

/* Keep tooltips visible even for active items */
/* Removed: .nav-list li a.active::after, .nav-list li a.active::before { display: none; } */

/* ========================================
   PROFILE SECTION - Fixed at Bottom
======================================== */
.profile-section-bottom {
    padding: 12px;
    border-top: 1px solid var(--border-color);
    background: #fafbfc;
    display: flex;
    align-items: center;
    justify-content: center;
}

.profile-avatar-button {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.profile-avatar-button:hover {
    transform: scale(1.05);
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--brand-purple), var(--brand-purple-dark));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 14px;
    border: 2px solid var(--border-color);
    text-transform: uppercase;
    box-shadow: var(--shadow-sm);
}

/* Profile Dropdown Menu */
.profile-dropdown {
    position: fixed;
    bottom: 72px;
    left: 72px;
    background: white;
    border-radius: 12px;
    min-width: 280px;
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.15);
    border: 1px solid var(--border-color);
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 10000;
}

.profile-dropdown.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.profile-dropdown-header {
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.05), rgba(118, 75, 162, 0.05));
}

.profile-avatar-small {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--brand-purple), var(--brand-purple-dark));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 16px;
    border: 2px solid white;
    text-transform: uppercase;
    flex-shrink: 0;
    box-shadow: var(--shadow-sm);
}

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

.profile-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.profile-email {
    font-size: 12px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.profile-dropdown-divider {
    height: 1px;
    background: var(--border-color);
    margin: 4px 0;
}

.profile-dropdown-item {
    color: var(--text-primary);
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.profile-dropdown-item i {
    font-size: 18px;
    color: var(--text-secondary);
    transition: color 0.2s ease;
}

.profile-dropdown-item:hover {
    background: var(--body-bg);
    padding-left: 20px;
}

.profile-dropdown-item:hover i {
    color: var(--brand-red);
}

.profile-dropdown-item.logout-item {
    color: var(--brand-red);
}

.profile-dropdown-item.logout-item i {
    color: var(--brand-red);
}

.profile-dropdown-item.logout-item:hover {
    background: rgba(228, 0, 75, 0.05);
}

/* ========================================
   MAIN CONTENT AREA
======================================== */
.home-section {
    margin-left: var(--sidebar-width);
    width: calc(100% - var(--sidebar-width));
    min-height: 100vh;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: var(--body-bg);
}

/* Header */
header#header-section {
    background: white;
    padding: 24px 32px;
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

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

#sidebarBtn {
    font-size: 28px;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.3s ease;
    display: none;
}

#sidebarBtn:hover {
    color: var(--brand-red);
    transform: scale(1.1);
}

#page-title {
    font-family: 'Syne', sans-serif;
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.5px;
}

/* Main Container */
#main-container {
    padding: 32px;
    margin: 24px;
    background: white;
    border-radius: 16px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
}

/* Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}

/* Stat Cards */
.stat-card {
    background: white;
    padding: 24px;
    border-radius: 16px;
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 20px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-sm);
}

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

.card-icon {
    width: 64px;
    height: 64px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    flex-shrink: 0;
}

.card-icon.blue {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
}

.card-icon.green {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
}

.card-info {
    flex: 1;
}

.card-info p {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.card-info h3 {
    font-family: 'Syne', sans-serif;
    font-size: 32px;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -1px;
}

/* Chart Container */
.chart-container-wrapper {
    background: white;
    padding: 28px;
    border-radius: 16px;
    box-shadow: var(--shadow-sm);
    height: 380px;
    border: 1px solid var(--border-color);
}

/* ========================================
   PROFILE PAGE STYLING
======================================== */
.profile-section {
    max-width: 700px;
    margin: 0 auto;
}

.profile-header {
    text-align: center;
    margin-bottom: 32px;
    padding-bottom: 24px;
    border-bottom: 2px solid var(--border-color);
}

.profile-avatar-large {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--brand-purple), var(--brand-purple-dark));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 48px;
    border: 4px solid var(--border-color);
    margin: 0 auto 20px;
    text-transform: uppercase;
    box-shadow: var(--shadow-md);
}

.profile-header h2 {
    font-family: 'Syne', sans-serif;
    font-size: 28px;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.profile-header p {
    color: var(--text-secondary);
    font-size: 14px;
}

.profile-form {
    background: white;
    padding: 32px;
    border-radius: 16px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

.form-group {
    margin-bottom: 24px;
}

.form-group label {
    display: block;
    font-weight: 600;
    font-size: 14px;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.form-group input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    font-size: 14px;
    font-family: 'DM Sans', sans-serif;
    transition: all 0.3s ease;
    background: white;
}

.form-group input:focus {
    outline: none;
    border-color: var(--brand-purple);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-group input:disabled {
    background: #f5f5f5;
    color: var(--text-secondary);
    cursor: not-allowed;
}

.form-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 32px;
}

.btn-secondary {
    background: white;
    color: var(--text-primary);
    padding: 12px 24px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.3s ease;
}

.btn-secondary:hover {
    background: var(--body-bg);
    transform: translateY(-2px);
}

.btn-primary {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    padding: 12px 24px;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.btn-primary:disabled,
.btn-secondary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Password Page */
.password-section {
    max-width: 600px;
    margin: 0 auto;
}

.password-form {
    background: white;
    padding: 32px;
    border-radius: 16px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

.password-requirements {
    background: #f0f9ff;
    border: 1px solid #bfdbfe;
    border-radius: 10px;
    padding: 16px;
    margin-bottom: 24px;
}

.password-requirements h4 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.password-requirements ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.password-requirements li {
    font-size: 13px;
    color: var(--text-secondary);
    padding: 4px 0;
    padding-left: 24px;
    position: relative;
}

.password-requirements li::before {
    content: '✓';
    position: absolute;
    left: 0;
    color: #10b981;
    font-weight: bold;
}

.alert {
    padding: 16px;
    border-radius: 10px;
    margin-bottom: 24px;
    font-size: 14px;
}

.alert-success {
    background: #ecfdf5;
    border: 1px solid #10b981;
    color: #059669;
}

.alert-error {
    background: #fef2f2;
    border: 1px solid var(--brand-red);
    color: var(--brand-red);
}

/* ========================================
   TABLE STYLING
======================================== */
.table-container,
.table-responsive {
    width: 100%;
    overflow-x: auto;
    margin-top: 20px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.styled-table,
.ocr-table {
    width: 100%;
    border-collapse: collapse;
    background-color: white;
    min-width: 600px;
}

.styled-table thead tr,
.ocr-table thead {
    background: linear-gradient(135deg, #667eea, #764ba2);
}

.styled-table th,
.ocr-table th {
    padding: 16px 20px;
    text-align: left;
    font-size: 13px;
    font-weight: 600;
    color: white;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.styled-table td,
.ocr-table td {
    padding: 16px 20px;
    font-size: 14px;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-color);
}

.styled-table tbody tr:hover,
.ocr-table tbody tr:hover {
    background-color: #fef3f7;
}

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

/* Status Pill */
.status-pill {
    display: inline-block;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    background-color: var(--brand-gold);
    color: #7d5a12;
    text-align: center;
    white-space: nowrap;
}

/* Plate Number */
.plate-no {
    font-family: 'Courier New', Courier, monospace;
    font-weight: bold;
    color: var(--brand-red);
    background: #fdf2f4;
    padding: 4px 10px;
    border-radius: 6px;
}

/* ========================================
   UPLOAD BOX
======================================== */
.upload-section {
    max-width: 800px;
    margin: 0 auto;
}

.upload-box {
    text-align: center;
    padding: 48px;
    border: 2px dashed var(--brand-orange);
    border-radius: 16px;
    background: linear-gradient(135deg, rgba(237, 119, 90, 0.05), rgba(250, 214, 145, 0.05));
    transition: all 0.3s ease;
}

.upload-box:hover {
    border-color: var(--brand-red);
    background: linear-gradient(135deg, rgba(228, 0, 75, 0.05), rgba(237, 119, 90, 0.05));
    transform: scale(1.01);
}

.btn-main,
.btn-upload {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    padding: 14px 28px;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
    font-size: 15px;
    transition: all 0.3s ease;
    margin: 10px;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.btn-upload {
    background: linear-gradient(135deg, #10b981, #059669);
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
}

.btn-main:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.btn-upload:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
}

#file-preview {
    margin: 20px 0;
    font-size: 14px;
    color: var(--text-secondary);
}

/* ========================================
   PAGINATION
======================================== */
.pagination-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin-top: 28px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

.pagination-controls button {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.2);
}

.pagination-controls button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.pagination-controls button:disabled {
    background: #d1d5db;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

.pagination-controls span {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-primary);
}

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

/* Tablet (768px - 1024px) */
@media (max-width: 1024px) {
    #main-container {
        padding: 24px;
        margin: 20px;
    }

    .chart-container-wrapper {
        height: 320px;
    }
}

/* Mobile (Up to 768px) */
@media (max-width: 768px) {

    /* Show hamburger menu */
    #sidebarBtn {
        display: block;
    }

    /* Hide sidebar off-screen by default */
    .sidebar {
        left: -60px;
        box-shadow: none;
    }

    /* When sidebar is active, slide it in */
    .sidebar.active {
        left: 0;
        box-shadow: 4px 0 20px rgba(0, 0, 0, 0.15);
    }

    /* Full width content on mobile */
    .home-section {
        margin-left: 0;
        width: 100%;
    }

    /* Add overlay when sidebar is open */
    .sidebar.active::after {
        content: '';
        position: fixed;
        top: 0;
        left: 60px;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: -1;
        animation: fadeIn 0.3s ease;
    }

    /* Adjust profile dropdown position on mobile */
    .profile-dropdown {
        left: 12px;
        right: 12px;
        min-width: auto;
        max-width: calc(100vw - 24px);
    }

    /* Adjust header padding */
    header#header-section {
        padding: 20px;
    }

    #page-title {
        font-size: 20px;
    }

    /* Adjust main container */
    #main-container {
        padding: 20px;
        margin: 16px;
        border-radius: 12px;
    }

    /* Stack dashboard cards */
    .dashboard-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .chart-container-wrapper {
        height: 280px;
        padding: 20px;
    }

    /* Reduce table padding */
    .styled-table th,
    .styled-table td,
    .ocr-table th,
    .ocr-table td {
        padding: 12px 14px;
        font-size: 13px;
    }

    /* Adjust upload box */
    .upload-box {
        padding: 32px 20px;
    }

    /* Adjust buttons */
    .btn-main,
    .btn-upload {
        padding: 12px 24px;
        font-size: 14px;
        margin: 8px;
    }
}

/* Small Mobile (Up to 480px) */
@media (max-width: 480px) {
    #page-title {
        font-size: 18px;
    }

    #main-container {
        margin: 12px;
        padding: 16px;
    }

    .stat-card {
        padding: 18px;
        gap: 14px;
    }

    .card-icon {
        width: 48px;
        height: 48px;
        font-size: 22px;
    }

    .card-info h3 {
        font-size: 24px;
    }

    .chart-container-wrapper {
        padding: 16px;
        height: 250px;
    }
}

/* ========================================
   ANIMATIONS
======================================== */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* Smooth scroll */
html {
    scroll-behavior: smooth;
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

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

::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, var(--brand-red), var(--brand-orange));
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, var(--brand-orange), var(--brand-red));
}

/* Loader */
.loader-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 300px;
}

.loader-container p {
    font-size: 16px;
    color: var(--text-secondary);
    font-weight: 500;
}

/* ========================================
   DATA TABLE ENGINE  (dt- prefix, isolated)
   Does NOT override any existing styles.
======================================== */

/* ── SheetJS CDN is loaded in the HTML via a <script> tag ── */

/* Filter Bar */
.dt-filter-bar {
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 20px 22px 14px;
    margin-bottom: 18px;
    box-shadow: var(--shadow-sm);
}

.dt-filter-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 14px;
}

.dt-filter-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.dt-filter-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.dt-filter-label i {
    font-size: 14px;
    color: var(--brand-purple);
}

.dt-date-range {
    display: flex;
    align-items: center;
    gap: 6px;
}

.dt-range-sep {
    color: var(--text-secondary);
    font-size: 13px;
    flex-shrink: 0;
}

.dt-input {
    height: 36px;
    padding: 0 10px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 13px;
    font-family: 'DM Sans', sans-serif;
    color: var(--text-primary);
    background: #fafbfc;
    transition: border-color 0.2s, box-shadow 0.2s;
    width: 100%;
}

.dt-input:focus {
    outline: none;
    border-color: var(--brand-purple);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.12);
    background: #fff;
}

.dt-date-range .dt-input {
    width: calc(50% - 12px);
    min-width: 0;
}

.dt-search-wrap {
    position: relative;
}

.dt-search-icon {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    font-size: 16px;
    pointer-events: none;
}

.dt-search-input {
    padding-left: 32px;
}

.dt-amount-wrap {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-wrap: wrap;
}

.dt-select {
    height: 36px;
    padding: 0 10px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 13px;
    font-family: 'DM Sans', sans-serif;
    color: var(--text-primary);
    background: #fafbfc;
    cursor: pointer;
    transition: border-color 0.2s;
}

.dt-select:focus {
    outline: none;
    border-color: var(--brand-purple);
}

.dt-select-sm {
    height: 30px;
    font-size: 12px;
    padding: 0 8px;
}

.dt-amt-input {
    width: 90px;
}

.dt-hidden {
    display: none !important;
}

/* Action Bar */
.dt-action-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
}

.dt-results-info {
    display: flex;
    align-items: center;
    gap: 8px;
}

.dt-badge-filter,
.dt-badge-total {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.dt-badge-filter {
    background: rgba(237, 119, 90, 0.12);
    color: var(--brand-orange);
    border: 1px solid rgba(237, 119, 90, 0.3);
}

.dt-badge-total {
    background: rgba(102, 126, 234, 0.1);
    color: var(--brand-purple);
    border: 1px solid rgba(102, 126, 234, 0.2);
}

.dt-action-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.dt-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    border-radius: 8px;
    border: none;
    font-size: 13px;
    font-weight: 600;
    font-family: 'DM Sans', sans-serif;
    cursor: pointer;
    transition: all 0.2s ease;
}

.dt-btn-reset {
    background: #f3f4f6;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.dt-btn-reset:hover {
    background: #e5e7eb;
    transform: translateY(-1px);
}

.dt-btn-csv {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.25);
}

.dt-btn-csv:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.35);
}

.dt-btn-xlsx {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.25);
}

.dt-btn-xlsx:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.35);
}

/* Table */
.dt-table-wrap {
    width: 100%;
    overflow-x: auto;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

.dt-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    min-width: 680px;
}

/* Filter toggle button — hidden on desktop, shown on mobile */
.dt-filter-toggle-btn {
    display: none;
    background: #f3f4f6;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    margin-bottom: 0;
    width: 100%;
    justify-content: center;
    font-size: 14px;
    padding: 9px 14px;
}

.dt-table thead {
    position: sticky;
    top: 0;
    z-index: 10;
}

.dt-table thead tr {
    background: linear-gradient(135deg, #667eea, #764ba2);
}

.dt-table th {
    padding: 14px 18px;
    text-align: left;
    font-size: 12px;
    font-weight: 700;
    color: white;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    white-space: nowrap;
    user-select: none;
}

.dt-th-sort {
    cursor: pointer;
}

.dt-th-sort:hover {
    background: rgba(255, 255, 255, 0.12);
}

.dt-sort-icon {
    display: inline-flex;
    align-items: center;
    margin-left: 5px;
    font-size: 14px;
    vertical-align: middle;
    opacity: 0.6;
    transition: opacity 0.2s;
}

.dt-sort-icon.active {
    opacity: 1;
    color: var(--brand-gold);
}

.dt-table td {
    padding: 13px 18px;
    font-size: 13.5px;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

.dt-table tbody tr {
    transition: background 0.15s;
}

.dt-table tbody tr:hover {
    background: #f8f5ff;
}

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

.dt-vendor {
    font-weight: 500;
}

.dt-amount {
    font-family: 'DM Sans', sans-serif;
    font-weight: 600;
    color: var(--brand-gray);
    text-align: right;
}

.dt-file-cell {
    text-align: center;
}

/* File preview button */
.dt-file-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: none;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 5px 10px;
    cursor: pointer;
    transition: all 0.2s;
    font-family: 'DM Sans', sans-serif;
    font-size: 12px;
    font-weight: 600;
    color: var(--brand-purple);
}

.dt-file-btn:hover {
    border-color: var(--brand-purple);
    background: rgba(102, 126, 234, 0.07);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.dt-thumb {
    width: 28px;
    height: 28px;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid var(--border-color);
    display: block;
}

.dt-thumb-fallback {
    width: 28px;
    height: 28px;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: var(--text-secondary);
    border: 1px dashed var(--border-color);
    border-radius: 4px;
}

.dt-no-file {
    color: var(--text-secondary);
    font-size: 16px;
}

/* No data states */
.dt-no-data {
    text-align: center;
    padding: 56px 24px;
    color: var(--text-secondary);
}

.dt-no-data i {
    font-size: 48px;
    display: block;
    margin-bottom: 12px;
    opacity: 0.5;
}

.dt-no-data p {
    font-size: 15px;
    margin-bottom: 16px;
}

.dt-empty-state {
    text-align: center;
    padding: 80px 24px;
    color: var(--text-secondary);
}

.dt-empty-state i {
    font-size: 64px;
    display: block;
    margin-bottom: 16px;
    opacity: 0.4;
}

.dt-empty-state h3 {
    font-family: 'Syne', sans-serif;
    font-size: 22px;
    color: var(--text-primary);
    margin-bottom: 8px;
}

/* Pagination */
.dt-pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    padding: 16px 2px 4px;
}

.dt-pag-info {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
}

.dt-pag-controls {
    display: flex;
    align-items: center;
    gap: 4px;
}

.dt-pag-btn {
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: #fff;
    color: var(--text-primary);
    cursor: pointer;
    font-size: 16px;
    transition: all 0.2s;
}

.dt-pag-btn:hover:not(:disabled) {
    border-color: var(--brand-purple);
    color: var(--brand-purple);
    background: rgba(102, 126, 234, 0.06);
}

.dt-pag-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.dt-pag-label {
    font-size: 13px;
    color: var(--text-primary);
    padding: 0 10px;
    white-space: nowrap;
}

.dt-pag-size label {
    font-size: 13px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 500;
}

/* ── Lightbox ─────────────────────────────────────────────────── */
#dt-lightbox {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 99999;
}

#dt-lightbox.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

#dt-lb-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(10, 8, 30, 0.75);
    backdrop-filter: blur(4px);
    animation: dtFadeIn 0.2s ease;
}

#dt-lb-box {
    position: relative;
    z-index: 1;
    background: #fff;
    border-radius: 16px;
    width: min(90vw, 860px);
    height: min(88vh, 640px);
    display: flex;
    flex-direction: column;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.4);
    animation: dtSlideUp 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
    overflow: hidden;
}

#dt-lb-close {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 2;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: rgba(0, 0, 0, 0.08);
    color: var(--text-primary);
    font-size: 22px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

#dt-lb-close:hover {
    background: rgba(228, 0, 75, 0.12);
    color: var(--brand-red);
}

#dt-lb-content {
    flex: 1;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 0;
}

#dt-lb-content iframe {
    flex: 1;
    min-height: 0;
}

#dt-lb-open {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 600;
    color: var(--brand-purple);
    text-decoration: none;
    padding: 6px 12px;
    border-radius: 8px;
    border: 1px solid rgba(102, 126, 234, 0.3);
    align-self: flex-start;
    transition: all 0.2s;
}

#dt-lb-open:hover {
    background: rgba(102, 126, 234, 0.08);
    transform: translateY(-1px);
}

@keyframes dtFadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes dtSlideUp {
    from {
        opacity: 0;
        transform: translateY(24px) scale(0.97);
    }

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

/* Responsive overrides for data table */
@media (max-width: 768px) {
    .dt-filter-row {
        display: none;
    }

    .dt-filter-row.dt-filters-open {
        display: grid;
        grid-template-columns: 1fr;
        margin-top: 12px;
    }

    .dt-filter-toggle-btn {
        display: flex;
    }

    .dt-action-bar {
        flex-direction: column;
        align-items: flex-start;
    }

    .dt-pagination {
        flex-direction: column;
        align-items: flex-start;
    }

    #dt-lb-box {
        width: 96vw;
        height: 80vh;
    }
}

/* Card view for small screens — no horizontal scroll */
@media (max-width: 640px) {
    .dt-table {
        min-width: unset;
    }

    .dt-table-wrap {
        overflow-x: unset;
        border: none;
        box-shadow: none;
        border-radius: 0;
    }

    .dt-table thead {
        display: none;
    }

    .dt-table tbody tr {
        display: flex;
        flex-direction: column;
        background: #fff;
        border: 1px solid var(--border-color);
        border-radius: 12px;
        margin-bottom: 10px;
        padding: 14px 16px;
        box-shadow: var(--shadow-sm);
    }

    .dt-table tbody tr:hover {
        background: #f8f5ff;
    }

    .dt-table td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        border-bottom: none;
        padding: 5px 0;
        font-size: 13.5px;
    }

    .dt-table td::before {
        content: attr(data-label);
        font-size: 11px;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        color: var(--text-secondary);
        flex-shrink: 0;
        margin-right: 8px;
    }

    .dt-amount {
        font-size: 15px;
        font-weight: 700;
        text-align: right;
    }

    .dt-file-cell {
        justify-content: flex-end;
        padding-top: 8px;
        margin-top: 4px;
        border-top: 1px solid var(--border-color);
    }

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

@media (max-width: 480px) {
    .dt-filter-bar {
        padding: 14px;
    }
}


/* Ensure the Dev Label is invisible unless filled by JS */
.dev-label:empty {
    display: none;
}

/* Material Card Styling for your JS-generated cards */
.js-card {
    background: #ffffff;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    padding: 24px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    margin-bottom: 20px;
}