/* Blazor system styles - essential for application functionality */
/* All other styling will use Tailwind classes */

#blazor-error-ui {
    color-scheme: light only;
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    box-sizing: border-box;
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

    #blazor-error-ui .dismiss {
        cursor: pointer;
        position: absolute;
        right: 0.75rem;
        top: 0.5rem;
    }

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2LjYxNyA5OUwyNDAuMzgzIDk5QzIzNy45NjMgOTkgMjM2IDk3LjA2NTEgMjM2IDk0LjY3ODIgMjM2IDk0LjM3OTkgMjM2LjAzMSA5NC4wODg2IDIzNi4wODkgOTMuODA3MkwyMzYuMzM4IDkzLjAxNjIgMjM2Ljg1OCA5Mi4xMzE0IDI1OS40NzMgNTMuNjI5NCAyNTkuOTYxIDUyLjc5ODUgMjYwLjQwNyA1Mi4yNjU4QzI2MS4yIDUxLjQ4MzcgMjYyLjI5NiA1MSAyNjMuNTA2IDUxWk0yNjMuNTg2IDY2LjAxODNDMjYwLjczNyA2Ni4wMTgzIDI1OS4zMTMgNjcuMTI0NSAyNTkuMzEzIDY5LjMzNyAyNTkuMzEzIDY5LjYxMDIgMjU5LjMzMiA2OS44NjA4IDI1OS4zNzEgNzAuMDg4N0wyNjEuNzk1IDg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

    .blazor-error-boundary::after {
        content: "An error has occurred."
    }

/* Page Header Styles */
.page-header {
    padding: 1.5rem 2rem;
    background: #FDFDFF;
    margin-bottom: 2rem;
}

.page-header-container {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.page-header-back-button {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    color: #64748b;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 0.375rem;
    cursor: pointer;
    transition: all 0.2s;
}

    .page-header-back-button:hover {
        color: #1D0C67;
        background: #f8fafc;
        border-color: #e2e8f0;
    }

.page-header-title-section {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 1;
}

.page-header-icon {
    font-size: 1.5rem;
    color: #1D0C67;
}

.page-header-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1a202c;
    margin: 0;
}

.page-header-badge {
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 9999px;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

    .page-header-badge.badge-default {
        background: #f1f5f9;
        color: #64748b;
    }

    .page-header-badge.badge-success {
        background: #dcfce7;
        color: #16a34a;
    }

    .page-header-badge.badge-warning {
        background: #fed7aa;
        color: #ea580c;
    }

    .page-header-badge.badge-error {
        background: #fee2e2;
        color: #dc2626;
    }

.page-header-subtitle {
    font-size: 0.875rem;
    color: #64748b;
    margin-left: 0.5rem;
}

.page-header-actions {
    display: flex;
    gap: 0.75rem;
}

.page-header-breadcrumbs {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.75rem;
    font-size: 0.875rem;
}

.breadcrumb-link {
    color: #64748b;
    text-decoration: none;
    transition: color 0.2s;
}

    .breadcrumb-link:hover {
        color: #1D0C67;
    }

.breadcrumb-separator {
    color: #cbd5e0;
}

.breadcrumb-current {
    color: #1a202c;
    font-weight: 500;
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .page-header {
        background: #1a202c;
        border-color: #2d3748;
    }

    .page-header-title {
        color: #f7fafc;
    }

    .page-header-back-button:hover {
        background: #2d3748;
        border-color: #4a5568;
    }
}

.loading-progress {
    position: relative;
    display: block;
    width: 8rem;
    height: 8rem;
    margin: 20vh auto 1rem auto;
}

    .loading-progress circle {
        fill: none;
        stroke: #e0e0e0;
        stroke-width: 0.6rem;
        transform-origin: 50% 50%;
        transform: rotate(-90deg);
    }

        .loading-progress circle:last-child {
            stroke: #1b6ec2;
            stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * 0.8), 500%;
            transition: stroke-dasharray 0.05s ease-in-out;
        }

.loading-progress-text {
    position: absolute;
    text-align: center;
    font-weight: bold;
    inset: calc(20vh + 3.25rem) 0 auto 0.2rem;
}

    .loading-progress-text:after {
        content: var(--blazor-load-percentage-text, "Loading");
    }

code {
    color: #c02d76;
}

.form-floating > .form-control-plaintext::placeholder,
.form-floating > .form-control::placeholder {
    color: var(--bs-secondary-color);
    text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder,
.form-floating > .form-control:focus::placeholder {
    text-align: start;
}

/* Data Table Layout Styles */
.data-table-layout {
    padding: 24px;
    transition: background-color 0.2s, color 0.2s;
}


/* Expanded Data Table Layout */
.data-table-layout.expanded {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 50;
    padding: 8px;
    background: #ffffff;
    overflow: auto;
    transition: all 0.3s ease;
}


/* Hide sidebar when expanded */
.data-table-layout.expanded ~ .sidebar {
    display: none;
}

/* Adjust expanded table content */
.data-table-layout.expanded .table-header {
    margin-bottom: 12px;
}

.data-table-layout.expanded .table-title {
    font-size: 32px;
}

.data-table-layout.expanded .table-container {
    max-height: calc(100vh - 200px);
    overflow: auto;
}

/* Header Section */
.table-header {
    margin-bottom: 24px;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.table-title {
    font-size: 28px;
    font-weight: 600;
    color: #1f2937;
    margin: 0;
    transition: color 0.2s;
}

.dark .table-title {
    color: #f3f4f6;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}
.primary-background-color {
    background-color: var(--primary-color, #1D0C67);
    color: white;
}
.primary-color{
    color: var(--primary-color, #1D0C67);
}
.border-primary {
    border-color: var(--primary-color, #1D0C67) !important;
}
/* Primary Action Button */
.primary-action-btn {
    background: var(--primary-color, #1D0C67);
    border: none;
    color: white;
    padding: 10px 16px;
    border-radius: 8px;
    font-weight: 500;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background-color 0.2s;
}

    .primary-action-btn:hover {
        background: var(--primary-color-dark, #150A55);
        color: white;
    }

/* Branding-aware button styles */
.btn-primary-action {
    background-color: var(--primary-color, #1D0C67) !important;
    color: white !important;
    border: none !important;
    padding: 0.5rem 1rem !important;
    border-radius: 0.375rem !important;
    font-weight: 500 !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    gap: 0.5rem !important;
    transition: background-color 0.2s !important;
    text-decoration: none !important;
}

    .btn-primary-action:hover {
        background-color: var(--primary-color-dark, #150A55) !important;
        color: white !important;
        text-decoration: none !important;
    }

/* Settings form button - wider and taller */
.btn-primary-form {
    background-color: var(--primary-color, #1D0C67) !important;
    color: white !important;
    border: none !important;
    padding: 0.5rem 1rem !important;
    border-radius: 0.375rem !important;
    font-weight: 500 !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 0.5rem !important;
    transition: background-color 0.2s !important;
    text-decoration: none !important;
    min-width: 200px !important;
    padding-top: 0.5rem !important;
    padding-bottom: 0.5rem !important;
}

    .btn-primary-form:hover {
        background-color: var(--primary-color-dark, #150A55) !important;
        color: white !important;
        text-decoration: none !important;
    }

    .btn-primary-form:disabled {
        opacity: 0.5 !important;
        cursor: not-allowed !important;
    }

/* Secondary action button */
.btn-secondary-action {
    background-color: var(--secondary-color, #33C6E4) !important;
    color: white !important;
    border: none !important;
    padding: 0.5rem 1rem !important;
    border-radius: 0.75rem !important;
    font-weight: 500 !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 0.5rem !important;
    transition: background-color 0.2s !important;
    text-decoration: none !important;
}

    .btn-secondary-action:hover {
        background-color: var(--secondary-color-dark, #2BA8C7) !important;
        color: white !important;
        text-decoration: none !important;
    }

/* Checkbox with branding colors */
.checkbox-primary {
    accent-color: var(--primary-color, #1D0C67) !important;
}

.dark .primary-action-btn {
    background: var(--primary-color, #1D0C67);
}

    .dark .primary-action-btn:hover {
        background: #6d28d9;
    }

/* Filter Button */
.filter-btn {
    background: transparent;
    border: 1px solid #d1d5db;
    color: #374151;
    padding: 10px 16px;
    border-radius: 8px;
    font-weight: 500;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
}

.dark .filter-btn {
    border-color: #4b5563;
    color: #d1d5db;
}

.filter-btn:hover {
    background: #f9fafb;
    border-color: #9ca3af;
}

.dark .filter-btn:hover {
    background: #374151;
    border-color: #6b7280;
}

/* Toolbar */
.table-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding: 16px 0;
}

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

.toolbar-right {
    display: flex;
    align-items: center;
}

/* Card container for toolbar + table (Figma-like) */
.table-card {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    box-shadow: 0 1px 2px rgba(16, 24, 40, 0.05);
    overflow: hidden;
    /* ensures rounded corners clip children (table, toolbar) */
}

.dark .table-card {
    background: #111827;
    border-color: #374151;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}

/* Toolbar row inside card */
.table-toolbar-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: #ffffff;
    border-bottom: 1px solid #e5e7eb;
}

.dark .table-toolbar-row {
    background: #111827;
    border-bottom-color: #374151;
}

/* Optional filters panel just under toolbar, subtle background */
.filters-panel {
    padding: 12px 16px;
    background: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
}

.dark .filters-panel {
    background: #1f2937;
    border-bottom-color: #374151;
}

/* When table-container is inside the card, remove its borders so the card provides the chrome */
.table-card .table-container {
    border: 0;
    border-radius: 0;
}

/* Settings Button */
.settings-btn {
    background: transparent;
    border: none;
    padding: 8px;
    border-radius: 6px;
    color: #6b7280;
    transition: all 0.2s;
}

    .settings-btn:hover {
        background: #f3f4f6;
        color: #374151;
    }

/* Search Container */
.search-container {
    position: relative;
    width: 240px;
}

.search-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.search-icon {
    position: absolute;
    left: 12px;
    color: #9ca3af;
    font-size: 14px;
    z-index: 1;
}

.search-input {
    width: 100%;
    padding: 8px 12px 8px 36px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    background: #ffffff;
    color: #374151;
    transition: border-color 0.2s, background-color 0.2s, color 0.2s;
}

.dark .search-input {
    background: #374151;
    border-color: #4b5563;
    color: #f3f4f6;
}

.search-input:focus {
    outline: none;
    border-color: var(--primary-color, #1D0C67);
    box-shadow: 0 0 0 1px var(--primary-color, #1D0C67);
}

.dark .search-input:focus {
    border-color: var(--primary-color, #1D0C67);
    box-shadow: 0 0 0 1px var(--primary-color, #1D0C67);
}

.search-input::placeholder {
    color: #9ca3af;
}

.dark .search-input::placeholder {
    color: #6b7280;
}

/* Toolbar Actions */
.toolbar-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.row-count {
    font-size: 14px;
    color: #6b7280;
    margin-right: 8px;
    transition: color 0.2s;
}

.dark .row-count {
    color: #9ca3af;
}

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

.btn-icon {
    background: transparent;
    border: none;
    padding: 8px;
    border-radius: 6px;
    color: #6b7280;
    transition: all 0.2s;
    cursor: pointer;
}

    .btn-icon:hover:not(:disabled) {
        background: #f3f4f6;
        color: #374151;
    }

.dark .btn-icon {
    color: #9ca3af;
}

    .dark .btn-icon:hover:not(:disabled) {
        background: #374151;
        color: #d1d5db;
    }

.btn-icon:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Table Container */
.table-container {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    overflow-x: auto;
    overflow-y: hidden;
    transition: background-color 0.2s, border-color 0.2s;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 #f1f5f9;
}

    .table-container::-webkit-scrollbar {
        height: 8px;
    }

    .table-container::-webkit-scrollbar-track {
        background: #f1f5f9;
        border-radius: 4px;
    }

    .table-container::-webkit-scrollbar-thumb {
        background: #cbd5e1;
        border-radius: 4px;
        transition: background-color 0.2s;
    }

        .table-container::-webkit-scrollbar-thumb:hover {
            background: #94a3b8;
        }

.dark .table-container {
    background: #1f2937;
    border-color: #374151;
    scrollbar-color: #4b5563 #374151;
}

    /* Dark theme scrollbar for webkit browsers */
    .dark .table-container::-webkit-scrollbar-track {
        background: #374151;
    }

    .dark .table-container::-webkit-scrollbar-thumb {
        background: #4b5563;
    }

        .dark .table-container::-webkit-scrollbar-thumb:hover {
            background: #6b7280;
        }

/* Table Wrapper */
.table-wrapper {
    position: relative;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
}

.data-table {
    min-width: max-content;
}

.table-header-cell,
.table-cell {
    min-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Custom scrollbar for table wrapper */
.table-wrapper::-webkit-scrollbar {
    height: 8px;
}

.table-wrapper::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 4px;
}

.dark .table-wrapper::-webkit-scrollbar-track {
    background: #374151;
}

.table-wrapper::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.dark .table-wrapper::-webkit-scrollbar-thumb {
    background: #6b7280;
}

.table-wrapper::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

.dark .table-wrapper::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

/* Scroll indicator */
.scroll-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    margin-bottom: 16px;
    font-size: 14px;
    color: #64748b;
}

.dark .scroll-indicator {
    background: #1f2937;
    border-color: #374151;
    color: #9ca3af;
}

.scroll-indicator i {
    color: #3b82f6;
}

.dark .scroll-indicator i {
    color: #2A1A75;
}

/* Legacy Data Table Support - Consolidated with Figma styles */
.data-table {
    width: 100%;
    margin: 0;
    border-collapse: collapse;
    min-width: max-content;
    background: #ffffff;
}

.dark .data-table {
    background: #1f2937;
}

.data-table thead {
    background: #f9fafb;
    transition: background-color 0.2s;
}

.dark .data-table thead {
    background: #374151;
}

.table-header-cell {
    padding: 12px 16px;
    font-weight: 500;
    font-size: 14px;
    color: #374151;
    text-align: left;
    border-bottom: 1px solid #e5e7eb;
    white-space: nowrap;
    transition: color 0.2s, border-color 0.2s, background-color 0.2s;
    min-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dark .table-header-cell {
    color: #d1d5db;
    border-bottom-color: #4b5563;
}

.table-header-cell.sortable {
    cursor: pointer;
    user-select: none;
}

    .table-header-cell.sortable:hover {
        background: #f3f4f6;
    }

.dark .table-header-cell.sortable:hover {
    background: #4b5563;
}

.sort-indicator {
    margin-left: 4px;
    font-size: 12px;
    color: #6b7280;
    transition: color 0.2s;
}

.dark .sort-indicator {
    color: #9ca3af;
}

.table-row {
    transition: background-color 0.2s;
    background: #ffffff !important;
}

.dark .table-row {
    background: #1f2937 !important;
}

.table-row:hover {
    background: #f9fafb !important;
}

.dark .table-row:hover {
    background: #374151 !important;
}

.table-cell {
    padding: 12px 16px;
    font-size: 14px;
    color: #374151;
    border-bottom: 1px solid #f3f4f6;
    vertical-align: middle;
    transition: color 0.2s, border-color 0.2s;
    min-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dark .table-cell {
    color: #d1d5db;
    border-bottom-color: #374151;
}

.actions-column {
    width: 80px;
    text-align: center;
}

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

.actions-menu-btn {
    background: transparent;
    border: none;
    padding: 4px 8px;
    border-radius: 4px;
    color: #6b7280;
    transition: all 0.2s;
}

    .actions-menu-btn:hover {
        background: #f3f4f6;
        color: #374151;
    }

.dark .actions-menu-btn {
    color: #9ca3af;
}

    .dark .actions-menu-btn:hover {
        background: #374151;
        color: #d1d5db;
    }

/* Status Indicators */
.status-indicator {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 500;
}

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

.status-pending .status-dot {
    background: #f59e0b;
}

.status-completed .status-dot {
    background: #10b981;
}

.status-cancelled .status-dot {
    background: #ef4444;
}

/* Amount Values */
.amount-value {
    font-weight: 500;
    color: #374151;
}

/* Dropdown Menu Styles - Enhanced for Better Positioning */
.dropdown {
    position: relative;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    z-index: 1000;
    display: none !important;
    min-width: 160px;
    max-height: 300px;
    overflow-y: auto;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    padding: 4px 0;
    margin-top: 4px;
    transition: all 0.2s;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
}

    .dropdown-menu.show {
        display: block !important;
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
    }

/* Smart positioning for dropdowns in table rows */
.figma-table-row:nth-last-child(-n+3) .dropdown-menu,
.table-row:nth-last-child(-n+3) .dropdown-menu {
    top: auto;
    bottom: 100%;
    margin-top: 0;
    margin-bottom: 4px;
    transform: translateY(10px);
}

    .figma-table-row:nth-last-child(-n+3) .dropdown-menu.show,
    .table-row:nth-last-child(-n+3) .dropdown-menu.show {
        transform: translateY(0);
    }

/* Ensure dropdown stays within viewport - moved to main dropdown-menu selector to avoid duplication */

/* Enhanced positioning for small tables (less than 5 rows) */
.figma-table tbody:has(tr:nth-child(-n+5)) .figma-table-row:nth-last-child(-n+2) .dropdown-menu,
.data-table tbody:has(tr:nth-child(-n+5)) .table-row:nth-last-child(-n+2) .dropdown-menu {
    top: auto;
    bottom: 100%;
    margin-top: 0;
    margin-bottom: 4px;
    transform: translateY(10px);
}

    .figma-table tbody:has(tr:nth-child(-n+5)) .figma-table-row:nth-last-child(-n+2) .dropdown-menu.show,
    .data-table tbody:has(tr:nth-child(-n+5)) .table-row:nth-last-child(-n+2) .dropdown-menu.show {
        transform: translateY(0);
    }

.dark .dropdown-menu {
    background: #374151;
    border-color: #4b5563;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
}

.dropdown-item {
    padding: 8px 16px;
    font-size: 14px;
    color: #374151;
    border: none;
    background: transparent;
    width: 100%;
    text-align: left;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s;
}

.dark .dropdown-item {
    color: #d1d5db;
}

.dropdown-item:hover:not(:disabled) {
    background: #f3f4f6;
    color: #374151;
}

.dark .dropdown-item:hover:not(:disabled) {
    background: #4b5563;
    color: #f3f4f6;
}

.dropdown-item:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.dropdown-item.text-danger {
    color: #dc2626;
}

.dark .dropdown-item.text-danger {
    color: #f87171;
}

.dropdown-item.text-danger:hover:not(:disabled) {
    background: #fef2f2;
    color: #dc2626;
}

.dark .dropdown-item.text-danger:hover:not(:disabled) {
    background: #7f1d1d;
    color: #f87171;
}

/* Sidebar Dropdown Styles */
.sidebar-dropdown {
    position: relative;
}

.dropdown-toggle {
    background: none;
    border: none;
    width: 100%;
    text-align: left;
    position: relative;
    transition: all 0.2s ease;
}

    .dropdown-toggle.sidebar-link {
        display: flex;
        align-items: center;
        justify-content: flex-start;
        gap: 12px;
    }

.dropdown-arrow {
    font-size: 12px;
    transition: transform 0.2s ease;
    color: #6b7280;
}

.dropdown-toggle.open .dropdown-arrow {
    transform: rotate(180deg);
}

.sidebar-submenu {
    background: rgba(0, 0, 0, 0.05);
    border-left: 2px solid #1D0C67;
    margin-left: 20px;
    padding-left: 8px;
    margin-top: 4px;
    animation: slideDown 0.2s ease-out;
}

.dark .sidebar-submenu {
    background: rgba(255, 255, 255, 0.05);
    border-left-color: #1D0C67;
}

/* RTL: flip submenu indent from left to right edge */
[dir="rtl"] .sidebar-submenu {
    border-left: none;
    border-right: 2px solid #1D0C67;
    margin-left: 0;
    margin-right: 20px;
    padding-left: 0;
    padding-right: 8px;
}

[dir="rtl"] .dark .sidebar-submenu {
    border-right-color: #1D0C67;
}

.sidebar-sublink {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    color: #6b7280;
    text-decoration: none;
    border-radius: 8px;
    margin: 2px 0;
    transition: all 0.2s ease;
    font-size: 14px;
    position: relative;
}

    .sidebar-sublink:hover {
        background: rgba(29, 12, 103, 0.1);
        color: #1D0C67;
        text-decoration: none;
    }

.dark .sidebar-toggle img {
    filter: brightness(0) invert(1);
}

.dark .btn-icon img {
    filter: brightness(0) invert(1);
}

/* Force header background in dark mode */
.dark .header {
    background-color: #1f2937 !important;
    background: #1f2937 !important;
}

/* The invoicing module (.inv-root) and the shared wallet (.dcm-wallet-host) are light-only, the dispatch board (.dsp) and the KPI
   dashboard (.kpi-root) bring their own dark tokens (dispatch-board.css, kpi-dashboard.css), and .light-only marks anything else that
   must stay light (the email editor's canvas and preview): the generic dark rules below leave them all alone.
   :where() keeps their specificity as it was for the rest of the dashboard. */
.dark header:not(:where(.dsp *, .inv-root *, .dcm-wallet-host *, .kpi-root *, .light-only, .light-only *)) {
    background-color: #1f2937 !important;
    background: #1f2937 !important;
}

    /* Force header title text color in dark mode */
    .dark header h1:not(:where(.dsp *, .inv-root *, .dcm-wallet-host *, .kpi-root *, .light-only, .light-only *)) {
        color: #ffffff !important;
    }

.dark .header h1 {
    color: #ffffff !important;
}

.dark h1.text-xl:not(:where(.dsp *, .inv-root *, .dcm-wallet-host *, .kpi-root *, .light-only, .light-only *)) {
    color: #ffffff !important;
}

/* Nuclear option - override all h1 in dark mode */
.dark h1:not(:where(.dsp *, .inv-root *, .dcm-wallet-host *, .kpi-root *, .light-only, .light-only *)) {
    color: #ffffff !important;
}

/* Override Tailwind classes specifically */
.dark .text-gray-900:not(:where(.dsp *, .inv-root *, .dcm-wallet-host *, .kpi-root *, .light-only, .light-only *)) {
    color: #ffffff !important;
}

/* Force dropdown menu background in dark mode */
.dark .dropdown-menu {
    background-color: #1f2937 !important;
    background: #1f2937 !important;
}

/* Settings components dark mode text colors - more specific selectors */
.dark main h2:not(:where(.dsp *, .inv-root *, .dcm-wallet-host *, .kpi-root *, .light-only, .light-only *)) {
    color: #ffffff !important;
}

/* Remove padding from main content to eliminate gap */
main {
    padding: 0 !important;
}

/* Add padding back to content inside main */
.data-table-layout,
.settings-container,
.page-content {
    padding: 1rem !important;
}

/* Fix create pages background in dark mode */
.dark .min-h-screen:not(:where(.dsp *, .inv-root *, .dcm-wallet-host *, .kpi-root *, .light-only, .light-only *)) {
    background-color: #1f2937 !important;
}

.dark .bg-white:not(:where(.dsp *, .inv-root *, .dcm-wallet-host *, .kpi-root *, .light-only, .light-only *)) {
    background-color: #374151 !important;
}

.dark .bg-gray-50:not(:where(.dsp *, .inv-root *, .dcm-wallet-host *, .kpi-root *, .light-only, .light-only *)) {
    background-color: #1f2937 !important;
}

/* Fix text colors in create pages for dark mode */
.dark .text-gray-900:not(:where(.dsp *, .inv-root *, .dcm-wallet-host *, .kpi-root *, .light-only, .light-only *)) {
    color: #f3f4f6 !important;
}

.dark .text-gray-700:not(:where(.dsp *, .inv-root *, .dcm-wallet-host *, .kpi-root *, .light-only, .light-only *)) {
    color: #d1d5db !important;
}

.dark .text-black:not(:where(.dsp *, .inv-root *, .dcm-wallet-host *, .kpi-root *, .light-only, .light-only *)) {
    color: #ffffff !important;
}

/* Fix borders in dark mode */
.dark .border-gray-200:not(:where(.dsp *, .inv-root *, .dcm-wallet-host *, .kpi-root *, .light-only, .light-only *)) {
    border-color: #4b5563 !important;
}

.dark .border-gray-300:not(:where(.dsp *, .inv-root *, .dcm-wallet-host *, .kpi-root *, .light-only, .light-only *)) {
    border-color: #6b7280 !important;
}

.dark .border-gray-100:not(:where(.dsp *, .inv-root *, .dcm-wallet-host *, .kpi-root *, .light-only, .light-only *)) {
    border-color: #374151 !important;
}

/* Fix input fields in dark mode */
.dark input[type="text"]:not(:where(.dsp *, .inv-root *, .dcm-wallet-host *, .kpi-root *, .light-only, .light-only *)),
.dark input[type="email"]:not(:where(.dsp *, .inv-root *, .dcm-wallet-host *, .kpi-root *, .light-only, .light-only *)),
.dark input[type="password"]:not(:where(.dsp *, .inv-root *, .dcm-wallet-host *, .kpi-root *, .light-only, .light-only *)),
.dark input[type="number"]:not(:where(.dsp *, .inv-root *, .dcm-wallet-host *, .kpi-root *, .light-only, .light-only *)),
.dark input[type="date"]:not(:where(.dsp *, .inv-root *, .dcm-wallet-host *, .kpi-root *, .light-only, .light-only *)),
.dark input[type="time"]:not(:where(.dsp *, .inv-root *, .dcm-wallet-host *, .kpi-root *, .light-only, .light-only *)),
.dark input:not([type]):not(:where(.dsp *, .inv-root *, .dcm-wallet-host *, .kpi-root *, .light-only, .light-only *)),
.dark input[type="search"]:not(:where(.dsp *, .inv-root *, .dcm-wallet-host *, .kpi-root *, .light-only, .light-only *)),
.dark input[type="tel"]:not(:where(.dsp *, .inv-root *, .dcm-wallet-host *, .kpi-root *, .light-only, .light-only *)),
.dark input[type="url"]:not(:where(.dsp *, .inv-root *, .dcm-wallet-host *, .kpi-root *, .light-only, .light-only *)),
.dark input[type="datetime-local"]:not(:where(.dsp *, .inv-root *, .dcm-wallet-host *, .kpi-root *, .light-only, .light-only *)),
.dark select:not(:where(.dsp *, .inv-root *, .dcm-wallet-host *, .kpi-root *, .light-only, .light-only *)),
.dark textarea:not(:where(.dsp *, .inv-root *, .dcm-wallet-host *, .kpi-root *, .light-only, .light-only *)) {
    background-color: #374151 !important;
    border-color: #6b7280 !important;
    color: #f3f4f6 !important;
}

    .dark input[type="text"]:focus:not(:where(.dsp *, .inv-root *, .dcm-wallet-host *, .kpi-root *, .light-only, .light-only *)),
    .dark input[type="email"]:focus:not(:where(.dsp *, .inv-root *, .dcm-wallet-host *, .kpi-root *, .light-only, .light-only *)),
    .dark input[type="password"]:focus:not(:where(.dsp *, .inv-root *, .dcm-wallet-host *, .kpi-root *, .light-only, .light-only *)),
    .dark input[type="number"]:focus:not(:where(.dsp *, .inv-root *, .dcm-wallet-host *, .kpi-root *, .light-only, .light-only *)),
    .dark input[type="date"]:focus:not(:where(.dsp *, .inv-root *, .dcm-wallet-host *, .kpi-root *, .light-only, .light-only *)),
    .dark input[type="time"]:focus:not(:where(.dsp *, .inv-root *, .dcm-wallet-host *, .kpi-root *, .light-only, .light-only *)),
    .dark input:not([type]):focus:not(:where(.dsp *, .inv-root *, .dcm-wallet-host *, .kpi-root *, .light-only, .light-only *)),
    .dark input[type="search"]:focus:not(:where(.dsp *, .inv-root *, .dcm-wallet-host *, .kpi-root *, .light-only, .light-only *)),
    .dark input[type="tel"]:focus:not(:where(.dsp *, .inv-root *, .dcm-wallet-host *, .kpi-root *, .light-only, .light-only *)),
    .dark input[type="url"]:focus:not(:where(.dsp *, .inv-root *, .dcm-wallet-host *, .kpi-root *, .light-only, .light-only *)),
    .dark input[type="datetime-local"]:focus:not(:where(.dsp *, .inv-root *, .dcm-wallet-host *, .kpi-root *, .light-only, .light-only *)),
    .dark select:focus:not(:where(.dsp *, .inv-root *, .dcm-wallet-host *, .kpi-root *, .light-only, .light-only *)),
    .dark textarea:focus:not(:where(.dsp *, .inv-root *, .dcm-wallet-host *, .kpi-root *, .light-only, .light-only *)) {
        border-color: var(--primary-color, #1D0C67) !important;
        background-color: #374151 !important;
    }

/* Fix column configuration modal styling */
.dark .column-config-dropdown {
    background: #374151 !important;
    border-color: #4b5563 !important;
}

.dark .dropdown-header {
    background-color: #4b5563 !important;
    border-bottom-color: #6b7280 !important;
}

.dark .dropdown-title {
    color: #f3f4f6 !important;
}

.dark .dropdown-footer {
    background-color: #4b5563 !important;
    border-top-color: #6b7280 !important;
}

.dark .columns-list {
    background-color: #374151 !important;
}

.dark .column-row {
    background-color: #374151 !important;
    border-bottom-color: #4b5563 !important;
}

    .dark .column-row:hover {
        background-color: #4b5563 !important;
    }

.dark .form-check-label:not(:where(.dsp *, .inv-root *, .dcm-wallet-host *, .kpi-root *, .light-only, .light-only *)) {
    color: #f3f4f6 !important;
}

.dark .dot {
    background-color: #9ca3af !important;
}

.dark .drag-handle:hover .dot {
    background-color: #d1d5db !important;
}

/* Fix settings button styling in light mode */
.settings-btn {
    background-color: #f9fafb !important;
    border-color: #d1d5db !important;
    color: #374151 !important;
}

    .settings-btn:hover {
        background-color: #f3f4f6 !important;
        border-color: #9ca3af !important;
    }

    .settings-btn img {
        filter: none !important;
        opacity: 0.7 !important;
    }

    .settings-btn:hover img {
        opacity: 1 !important;
    }

/* Dark mode settings button */
.dark .settings-btn {
    background-color: #374151 !important;
    border-color: #4b5563 !important;
}

    .dark .settings-btn:hover {
        background-color: #4b5563 !important;
        border-color: #6b7280 !important;
    }

    .dark .settings-btn img {
        filter: brightness(0) invert(1) !important;
    }

/* Fix checkbox colors to use primary color */
input[type="checkbox"]:checked {
    background-color: var(--primary-color, #1D0C67) !important;
    border-color: var(--primary-color, #1D0C67) !important;
}

input[type="checkbox"]:focus {
    border-color: var(--primary-color, #1D0C67) !important;
    box-shadow: 0 0 0 0.25rem rgba(29, 12, 103, 0.25) !important;
}

.form-check-input:checked {
    background-color: var(--primary-color, #1D0C67) !important;
    border-color: var(--primary-color, #1D0C67) !important;
}

.form-check-input:focus {
    border-color: var(--primary-color, #1D0C67) !important;
    box-shadow: 0 0 0 0.25rem rgba(29, 12, 103, 0.25) !important;
}

/* The blanket p / span colours below skip text that already has its own colour: white on coloured buttons,
   palette and arbitrary colours (token-start match, so hover: / md: variants don't count), brand colour. */
.dark main p:not(:where(.dsp *, .inv-root *, .dcm-wallet-host *, .kpi-root *, .light-only, .light-only *)):not(:where(.text-white, .text-white *, .primary-background-color *, [class*="dark:text-"], [class^="text-[#"], [class*=" text-[#"], [class^="text-[var("], [class*=" text-[var("], [class^="text-[rgba("], [class*=" text-[rgba("], [class^="text-green-"], [class*=" text-green-"], [class^="text-red-"], [class*=" text-red-"], [class^="text-amber-"], [class*=" text-amber-"], [class^="text-yellow-"], [class*=" text-yellow-"], [class^="text-orange-"], [class*=" text-orange-"], [class^="text-blue-"], [class*=" text-blue-"], [class^="text-sky-"], [class*=" text-sky-"], [class^="text-indigo-"], [class*=" text-indigo-"], [class^="text-purple-"], [class*=" text-purple-"], [class^="text-violet-"], [class*=" text-violet-"], [class^="text-emerald-"], [class*=" text-emerald-"], [class^="text-teal-"], [class*=" text-teal-"], [class^="text-rose-"], [class*=" text-rose-"], [class^="text-pink-"], [class*=" text-pink-"], [class^="text-cyan-"], [class*=" text-cyan-"], .primary-color, .brand-tint-chip, .brand-tint-chip *)) {
    color: #d1d5db !important;
}

.dark main label:not(:where(.dsp *, .inv-root *, .dcm-wallet-host *, .kpi-root *, .light-only, .light-only *)) {
    color: #ffffff !important;
}

.dark main span:not(.text-gray-900):not(.dark\:text-white):not(:where(.dsp *, .inv-root *, .dcm-wallet-host *, .kpi-root *, .light-only, .light-only *)):not(:where(.text-white, .text-white *, .primary-background-color *, [class*="dark:text-"], [class^="text-[#"], [class*=" text-[#"], [class^="text-[var("], [class*=" text-[var("], [class^="text-[rgba("], [class*=" text-[rgba("], [class^="text-green-"], [class*=" text-green-"], [class^="text-red-"], [class*=" text-red-"], [class^="text-amber-"], [class*=" text-amber-"], [class^="text-yellow-"], [class*=" text-yellow-"], [class^="text-orange-"], [class*=" text-orange-"], [class^="text-blue-"], [class*=" text-blue-"], [class^="text-sky-"], [class*=" text-sky-"], [class^="text-indigo-"], [class*=" text-indigo-"], [class^="text-purple-"], [class*=" text-purple-"], [class^="text-violet-"], [class*=" text-violet-"], [class^="text-emerald-"], [class*=" text-emerald-"], [class^="text-teal-"], [class*=" text-teal-"], [class^="text-rose-"], [class*=" text-rose-"], [class^="text-pink-"], [class*=" text-pink-"], [class^="text-cyan-"], [class*=" text-cyan-"], .primary-color, .brand-tint-chip, .brand-tint-chip *)) {
    color: #d1d5db !important;
}

.dark .sidebar-sublink:hover {
    background: rgba(29, 12, 103, 0.1);
    color: #2A1A75;
}

.sidebar-sublink.active {
    background: #1D0C67;
    color: white;
}

.dark .sidebar-sublink.active {
    background: #1D0C67;
    color: white;
}

/* Collapsed sidebar adjustments */
.sidebar.collapsed .sidebar-submenu {
    display: none;
}

.sidebar.collapsed .dropdown-arrow {
    display: block;
    transform: rotate(90deg);
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

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

/* Drag and Drop Column Reordering Styles */
.column-header-content {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
}

.drag-handle {
    opacity: 0;
    cursor: grab;
    color: #9ca3af;
    font-size: 12px;
    transition: opacity 0.2s;
    padding: 2px;
}

.table-header-cell:hover .drag-handle {
    opacity: 1;
}

.drag-handle:active {
    cursor: grabbing;
}

.column-title {
    flex: 1;
}

/* Dragging state */
.table-header-cell.dragging {
    opacity: 0.5;
    background: #f3f4f6 !important;
    transform: scale(0.98);
    transition: all 0.2s;
}

.dark .table-header-cell.dragging {
    background: #4b5563 !important;
}

/* Drag over state */
.table-header-cell.drag-over {
    background: #dbeafe !important;
    border-left: 3px solid #1D0C67;
    transform: translateX(2px);
    transition: all 0.2s;
}

.dark .table-header-cell.drag-over {
    background: #1e3a8a !important;
    border-left-color: #3b82f6;
}

/* Prevent text selection during drag */
.table-header-cell[draggable="true"] {
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

/* Enhanced visual feedback for sortable columns with drag handles */
.table-header-cell.sortable .column-title {
    cursor: pointer;
}

.table-header-cell.sortable:hover .column-title {
    color: #1D0C67;
}

.dark .table-header-cell.sortable:hover .column-title {
    color: #3b82f6;
}

/* ========================== */
/* Form Validation Styles     */
/* ========================== */

/* Invalid input field styling */
.validation-error,
input.invalid,
select.invalid,
textarea.invalid,
.invalid-field {
    border-color: #ef4444 !important;
    background-color: #fef2f2 !important;
}

.dark .validation-error,
.dark input.invalid,
.dark select.invalid,
.dark textarea.invalid,
.dark .invalid-field {
    border-color: #dc2626 !important;
    background-color: rgba(239, 68, 68, 0.1) !important;
}

/* Focus state for invalid fields */
input.invalid:focus,
select.invalid:focus,
textarea.invalid:focus {
    outline: none !important;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.2) !important;
    border-color: #dc2626 !important;
}

.dark input.invalid:focus,
.dark select.invalid:focus,
.dark textarea.invalid:focus {
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.3) !important;
}

/* Validation message styling */
.validation-message {
    color: #dc2626;
    font-size: 0.875rem;
    margin-top: 0.25rem;
    display: block;
}

.dark .validation-message {
    color: #ef4444;
}

/* Validation summary styling */
.validation-summary-errors {
    background-color: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 0.375rem;
    padding: 1rem;
    margin-bottom: 1rem;
}

.dark .validation-summary-errors {
    background-color: rgba(239, 68, 68, 0.1);
    border-color: #dc2626;
}

.validation-summary-errors ul {
    margin: 0;
    padding-left: 1.5rem;
    color: #dc2626;
}

.dark .validation-summary-errors ul {
    color: #ef4444;
}

/* Required field indicator */
.required-field::after {
    content: " *";
    color: #dc2626;
}

.dark .required-field::after {
    color: #ef4444;
}

/* Valid field indicator (optional) */
.valid-field {
    border-color: #10b981 !important;
}

.dark .valid-field {
    border-color: #059669 !important;
}


/* ===========================
   Dark mode polish
   ===========================
   What the generic dark rules above miss: the hard-coded light surfaces and
   text colours used across the pages, tinted status chips and alerts,
   brand-coloured text and borders, links, and the data-table cells.
   An element with its own dark: variant keeps it, and the light-only
   modules and the KPI dashboard are left alone. */

/* Page-level backgrounds: the layout root and full-page wrappers */
.dark.bg-\[\#FDFDFF\]:not([class*="dark:bg-"]),
.dark :is(.bg-\[\#FDFDFF\], .bg-\[\#FCFBFF\], .bg-\[\#F7F7FB\], .bg-\[\#f8f8fb\],
    .bg-\[\#F8FAFC\], .bg-\[\#F9FAFB\], .bg-\[\#F8F9FA\]):not([class*="dark:bg-"]):not(:where(.dsp *, .inv-root *, .dcm-wallet-host *, .kpi-root *, .light-only, .light-only *)) {
    background-color: #1f2937;
}

/* Card surfaces: the same tone as .bg-white above */
.dark :is(.bg-\[\#FFFFFF\], .bg-\[\#F5F5F5\], .bg-\[\#F6F6F6\], .bg-\[\#F6F6F7\]):not([class*="dark:bg-"]):not(:where(.dsp *, .inv-root *, .dcm-wallet-host *, .kpi-root *, .light-only, .light-only *)) {
    background-color: #374151;
}

/* Subtle fills (tabs, label cells, inner panels): a light veil over whatever is behind them */
.dark :is(.bg-\[\#FAFAFA\], .bg-\[\#fafafa\], .bg-\[\#F4F4F4\], .bg-\[\#F3F3F3\],
    .bg-\[\#F2F2F2\], .bg-\[\#f2f2f4\], .bg-\[\#EEF2FF\], .bg-\[\#ECEEF2\],
    .bg-\[\#E8ECEF\], .bg-gray-100):not([class*="dark:bg-"]):not(:where(.dsp *, .inv-root *, .dcm-wallet-host *, .kpi-root *, .light-only, .light-only *)) {
    background-color: rgba(255, 255, 255, 0.06);
}

.dark :is(.bg-\[\#E1E1E1\], .bg-\[\#dbdde2\], .bg-gray-200):not([class*="dark:bg-"]):not(:where(.dsp *, .inv-root *, .dcm-wallet-host *, .kpi-root *, .light-only, .light-only *)) {
    background-color: #4b5563;
}

/* Hard-coded dark text */
.dark :is(.text-\[\#000\], .text-\[\#111827\], .text-\[\#171717\], .text-\[\#1A1A1A\],
    .text-\[\#1b1b1f\], .text-\[\#202020\], .text-\[\#22232a\], .text-\[\#262832\],
    .text-\[\#2F384C\], .text-\[\#303030\], .text-\[\#35353A\], .text-\[\#444444\],
    .text-\[\#474b53\], .text-gray-800):not([class*="dark:text-"]):not(:where(.dsp *, .inv-root *, .dcm-wallet-host *, .kpi-root *, .light-only, .light-only *)) {
    color: #f3f4f6 !important;
}

.dark :is(.text-\[\#4b5563\], .text-\[\#5f636d\], .text-\[\#6A6A6A\], .text-\[\#6b7280\],
    .text-\[\#6B7280\], .text-\[\#747780\], .text-\[\#787878\], .text-\[\#7a808b\],
    .text-\[\#7b818d\], .text-\[\#7C8595\], .text-\[\#8a8f99\], .text-\[\#8F96A3\],
    .text-\[\#8f8f97\], .text-gray-500, .text-gray-600):not([class*="dark:text-"]):not(:where(.dsp *, .inv-root *, .dcm-wallet-host *, .kpi-root *, .light-only, .light-only *)) {
    color: #9ca3af !important;
}

.dark .dark\:text-white:not(:where(.dsp *, .inv-root *, .dcm-wallet-host *, .kpi-root *, .light-only, .light-only *)) {
    color: #ffffff !important;
}

/* Brand-coloured text and outlines: the brand purple is unreadable on the dark
   surfaces, so they use a light tint of it (it still follows the transporter branding). */
.dark :is(.primary-color, .text-\[\#1D0C67\]):not([class*="dark:text-"]):not(:where(.dsp *, .inv-root *, .dcm-wallet-host *, .kpi-root *, .light-only, .light-only *)) {
    color: color-mix(in srgb, var(--primary-color, #1D0C67) 30%, #ffffff) !important;
}

.dark :is(.border-primary, .\!border-primary):not([class*="dark:border-"]):not(:where(.dsp *, .inv-root *, .dcm-wallet-host *, .kpi-root *, .light-only, .light-only *)) {
    border-color: color-mix(in srgb, var(--primary-color, #1D0C67) 45%, #ffffff) !important;
}

/* White text on brand / coloured buttons stays white (the blanket span rule above skips it) */
.dark .text-white:not(:where(.dsp *, .inv-root *, .dcm-wallet-host *, .kpi-root *, .light-only, .light-only *)),
.dark .text-white *:not([class*="text-"]):not(:where(.dsp *, .inv-root *, .dcm-wallet-host *, .kpi-root *, .light-only, .light-only *)) {
    color: #ffffff !important;
}

/* Links */
.dark :is(.text-\[\#175AE4\], .text-blue-600, .text-indigo-600):not([class*="dark:text-"]):not(:where(.dsp *, .inv-root *, .dcm-wallet-host *, .kpi-root *, .light-only, .light-only *)) {
    color: #93b4ff !important;
}

/* Data tables: DynamicDataTable.razor.css hard-codes near-black th / td */
.dark main :is(th, td):not(:where(.dsp *, .inv-root *, .dcm-wallet-host *, .kpi-root *, .light-only, .light-only *)) {
    color: #e5e7eb;
}

/* Tinted status chips, badges and alerts: keep the hue, drop the pastel fill */
.dark :is(.bg-green-50, .bg-green-100):not([class*="dark:bg-"]):not(:where(.dsp *, .inv-root *, .dcm-wallet-host *, .kpi-root *, .light-only, .light-only *)) { background-color: rgba(34, 197, 94, 0.16); }
.dark :is(.border-green-100, .border-green-200, .border-green-300):not([class*="dark:border-"]):not(:where(.dsp *, .inv-root *, .dcm-wallet-host *, .kpi-root *, .light-only, .light-only *)) { border-color: rgba(34, 197, 94, 0.45); }
.dark :is(.text-green-600, .text-green-700, .text-green-800, .text-green-900):not([class*="dark:text-"]):not(:where(.dsp *, .inv-root *, .dcm-wallet-host *, .kpi-root *, .light-only, .light-only *)) { color: #86efac !important; }

.dark :is(.bg-emerald-50, .bg-emerald-100):not([class*="dark:bg-"]):not(:where(.dsp *, .inv-root *, .dcm-wallet-host *, .kpi-root *, .light-only, .light-only *)) { background-color: rgba(16, 185, 129, 0.16); }
.dark :is(.border-emerald-100, .border-emerald-200, .border-emerald-300):not([class*="dark:border-"]):not(:where(.dsp *, .inv-root *, .dcm-wallet-host *, .kpi-root *, .light-only, .light-only *)) { border-color: rgba(16, 185, 129, 0.45); }
.dark :is(.text-emerald-600, .text-emerald-700, .text-emerald-800, .text-emerald-900):not([class*="dark:text-"]):not(:where(.dsp *, .inv-root *, .dcm-wallet-host *, .kpi-root *, .light-only, .light-only *)) { color: #6ee7b7 !important; }

.dark :is(.bg-teal-50, .bg-teal-100):not([class*="dark:bg-"]):not(:where(.dsp *, .inv-root *, .dcm-wallet-host *, .kpi-root *, .light-only, .light-only *)) { background-color: rgba(20, 184, 166, 0.16); }
.dark :is(.border-teal-100, .border-teal-200, .border-teal-300):not([class*="dark:border-"]):not(:where(.dsp *, .inv-root *, .dcm-wallet-host *, .kpi-root *, .light-only, .light-only *)) { border-color: rgba(20, 184, 166, 0.45); }
.dark :is(.text-teal-600, .text-teal-700, .text-teal-800, .text-teal-900):not([class*="dark:text-"]):not(:where(.dsp *, .inv-root *, .dcm-wallet-host *, .kpi-root *, .light-only, .light-only *)) { color: #5eead4 !important; }

.dark :is(.bg-red-50, .bg-red-100):not([class*="dark:bg-"]):not(:where(.dsp *, .inv-root *, .dcm-wallet-host *, .kpi-root *, .light-only, .light-only *)) { background-color: rgba(239, 68, 68, 0.16); }
.dark :is(.border-red-100, .border-red-200, .border-red-300):not([class*="dark:border-"]):not(:where(.dsp *, .inv-root *, .dcm-wallet-host *, .kpi-root *, .light-only, .light-only *)) { border-color: rgba(239, 68, 68, 0.45); }
.dark :is(.text-red-600, .text-red-700, .text-red-800, .text-red-900):not([class*="dark:text-"]):not(:where(.dsp *, .inv-root *, .dcm-wallet-host *, .kpi-root *, .light-only, .light-only *)) { color: #fca5a5 !important; }

.dark :is(.bg-rose-50, .bg-rose-100):not([class*="dark:bg-"]):not(:where(.dsp *, .inv-root *, .dcm-wallet-host *, .kpi-root *, .light-only, .light-only *)) { background-color: rgba(244, 63, 94, 0.16); }
.dark :is(.border-rose-100, .border-rose-200, .border-rose-300):not([class*="dark:border-"]):not(:where(.dsp *, .inv-root *, .dcm-wallet-host *, .kpi-root *, .light-only, .light-only *)) { border-color: rgba(244, 63, 94, 0.45); }
.dark :is(.text-rose-600, .text-rose-700, .text-rose-800, .text-rose-900):not([class*="dark:text-"]):not(:where(.dsp *, .inv-root *, .dcm-wallet-host *, .kpi-root *, .light-only, .light-only *)) { color: #fda4af !important; }

.dark :is(.bg-orange-50, .bg-orange-100):not([class*="dark:bg-"]):not(:where(.dsp *, .inv-root *, .dcm-wallet-host *, .kpi-root *, .light-only, .light-only *)) { background-color: rgba(249, 115, 22, 0.16); }
.dark :is(.border-orange-100, .border-orange-200, .border-orange-300):not([class*="dark:border-"]):not(:where(.dsp *, .inv-root *, .dcm-wallet-host *, .kpi-root *, .light-only, .light-only *)) { border-color: rgba(249, 115, 22, 0.45); }
.dark :is(.text-orange-600, .text-orange-700, .text-orange-800, .text-orange-900):not([class*="dark:text-"]):not(:where(.dsp *, .inv-root *, .dcm-wallet-host *, .kpi-root *, .light-only, .light-only *)) { color: #fdba74 !important; }

.dark :is(.bg-amber-50, .bg-amber-100):not([class*="dark:bg-"]):not(:where(.dsp *, .inv-root *, .dcm-wallet-host *, .kpi-root *, .light-only, .light-only *)) { background-color: rgba(245, 158, 11, 0.16); }
.dark :is(.border-amber-100, .border-amber-200, .border-amber-300):not([class*="dark:border-"]):not(:where(.dsp *, .inv-root *, .dcm-wallet-host *, .kpi-root *, .light-only, .light-only *)) { border-color: rgba(245, 158, 11, 0.45); }
.dark :is(.text-amber-600, .text-amber-700, .text-amber-800, .text-amber-900):not([class*="dark:text-"]):not(:where(.dsp *, .inv-root *, .dcm-wallet-host *, .kpi-root *, .light-only, .light-only *)) { color: #fcd34d !important; }

.dark :is(.bg-yellow-50, .bg-yellow-100):not([class*="dark:bg-"]):not(:where(.dsp *, .inv-root *, .dcm-wallet-host *, .kpi-root *, .light-only, .light-only *)) { background-color: rgba(234, 179, 8, 0.16); }
.dark :is(.border-yellow-100, .border-yellow-200, .border-yellow-300):not([class*="dark:border-"]):not(:where(.dsp *, .inv-root *, .dcm-wallet-host *, .kpi-root *, .light-only, .light-only *)) { border-color: rgba(234, 179, 8, 0.45); }
.dark :is(.text-yellow-600, .text-yellow-700, .text-yellow-800, .text-yellow-900):not([class*="dark:text-"]):not(:where(.dsp *, .inv-root *, .dcm-wallet-host *, .kpi-root *, .light-only, .light-only *)) { color: #fde047 !important; }

.dark :is(.bg-blue-50, .bg-blue-100):not([class*="dark:bg-"]):not(:where(.dsp *, .inv-root *, .dcm-wallet-host *, .kpi-root *, .light-only, .light-only *)) { background-color: rgba(59, 130, 246, 0.16); }
.dark :is(.border-blue-100, .border-blue-200, .border-blue-300):not([class*="dark:border-"]):not(:where(.dsp *, .inv-root *, .dcm-wallet-host *, .kpi-root *, .light-only, .light-only *)) { border-color: rgba(59, 130, 246, 0.45); }
.dark :is(.text-blue-600, .text-blue-700, .text-blue-800, .text-blue-900):not([class*="dark:text-"]):not(:where(.dsp *, .inv-root *, .dcm-wallet-host *, .kpi-root *, .light-only, .light-only *)) { color: #93c5fd !important; }

.dark :is(.bg-sky-50, .bg-sky-100):not([class*="dark:bg-"]):not(:where(.dsp *, .inv-root *, .dcm-wallet-host *, .kpi-root *, .light-only, .light-only *)) { background-color: rgba(14, 165, 233, 0.16); }
.dark :is(.border-sky-100, .border-sky-200, .border-sky-300):not([class*="dark:border-"]):not(:where(.dsp *, .inv-root *, .dcm-wallet-host *, .kpi-root *, .light-only, .light-only *)) { border-color: rgba(14, 165, 233, 0.45); }
.dark :is(.text-sky-600, .text-sky-700, .text-sky-800, .text-sky-900):not([class*="dark:text-"]):not(:where(.dsp *, .inv-root *, .dcm-wallet-host *, .kpi-root *, .light-only, .light-only *)) { color: #7dd3fc !important; }

.dark :is(.bg-indigo-50, .bg-indigo-100):not([class*="dark:bg-"]):not(:where(.dsp *, .inv-root *, .dcm-wallet-host *, .kpi-root *, .light-only, .light-only *)) { background-color: rgba(99, 102, 241, 0.16); }
.dark :is(.border-indigo-100, .border-indigo-200, .border-indigo-300):not([class*="dark:border-"]):not(:where(.dsp *, .inv-root *, .dcm-wallet-host *, .kpi-root *, .light-only, .light-only *)) { border-color: rgba(99, 102, 241, 0.45); }
.dark :is(.text-indigo-600, .text-indigo-700, .text-indigo-800, .text-indigo-900):not([class*="dark:text-"]):not(:where(.dsp *, .inv-root *, .dcm-wallet-host *, .kpi-root *, .light-only, .light-only *)) { color: #a5b4fc !important; }

.dark :is(.bg-purple-50, .bg-purple-100):not([class*="dark:bg-"]):not(:where(.dsp *, .inv-root *, .dcm-wallet-host *, .kpi-root *, .light-only, .light-only *)) { background-color: rgba(168, 85, 247, 0.16); }
.dark :is(.border-purple-100, .border-purple-200, .border-purple-300):not([class*="dark:border-"]):not(:where(.dsp *, .inv-root *, .dcm-wallet-host *, .kpi-root *, .light-only, .light-only *)) { border-color: rgba(168, 85, 247, 0.45); }
.dark :is(.text-purple-600, .text-purple-700, .text-purple-800, .text-purple-900):not([class*="dark:text-"]):not(:where(.dsp *, .inv-root *, .dcm-wallet-host *, .kpi-root *, .light-only, .light-only *)) { color: #d8b4fe !important; }

.dark :is(.bg-violet-50, .bg-violet-100):not([class*="dark:bg-"]):not(:where(.dsp *, .inv-root *, .dcm-wallet-host *, .kpi-root *, .light-only, .light-only *)) { background-color: rgba(139, 92, 246, 0.16); }
.dark :is(.border-violet-100, .border-violet-200, .border-violet-300):not([class*="dark:border-"]):not(:where(.dsp *, .inv-root *, .dcm-wallet-host *, .kpi-root *, .light-only, .light-only *)) { border-color: rgba(139, 92, 246, 0.45); }
.dark :is(.text-violet-600, .text-violet-700, .text-violet-800, .text-violet-900):not([class*="dark:text-"]):not(:where(.dsp *, .inv-root *, .dcm-wallet-host *, .kpi-root *, .light-only, .light-only *)) { color: #c4b5fd !important; }

.dark :is(.bg-pink-50, .bg-pink-100):not([class*="dark:bg-"]):not(:where(.dsp *, .inv-root *, .dcm-wallet-host *, .kpi-root *, .light-only, .light-only *)) { background-color: rgba(236, 72, 153, 0.16); }
.dark :is(.border-pink-100, .border-pink-200, .border-pink-300):not([class*="dark:border-"]):not(:where(.dsp *, .inv-root *, .dcm-wallet-host *, .kpi-root *, .light-only, .light-only *)) { border-color: rgba(236, 72, 153, 0.45); }
.dark :is(.text-pink-600, .text-pink-700, .text-pink-800, .text-pink-900):not([class*="dark:text-"]):not(:where(.dsp *, .inv-root *, .dcm-wallet-host *, .kpi-root *, .light-only, .light-only *)) { color: #f9a8d4 !important; }

/* Required-field asterisks and inline errors */
.dark .text-red-500:not([class*="dark:text-"]):not(:where(.dsp *, .inv-root *, .dcm-wallet-host *, .kpi-root *, .light-only, .light-only *)) {
    color: #f87171 !important;
}

/* Inline-styled pieces: the sticky create / edit trip action bar fades to white,
   and the pickup-point chip on trip details is a pale brand tint with brand text. */
.dark .sticky-cta-bar {
    background: linear-gradient(181deg, rgba(31, 41, 55, 0.30) -28.83%, #1f2937 75.36%) !important;
}

.dark .brand-tint-chip {
    background-color: color-mix(in srgb, var(--primary-color, #1D0C67) 35%, transparent) !important;
    color: color-mix(in srgb, var(--primary-color, #1D0C67) 30%, #ffffff) !important;
}

/* Dark-filled icon images (assets/svg): CSS colour cannot reach an <img>, so invert them;
   the hue rotation keeps the two-tone ones (amounts, print / expand / download) readable. */
.dark img:is([src$="/go-back-arrow.svg"], [src$="/luggage.svg"], [src$="/export.svg"], [src$="/contractor_amount.svg"],
    [src$="/driver_amount.svg"], [src$="/book-icon.svg"], [src$="/printer-icon.svg"], [src$="/pen-icon.svg"],
    [src$="/configuration.svg"], [src$="/user-count-black.svg"], [src$="/client-count.svg"], [src$="/calculator.svg"],
    [src$="/file-icon.svg"], [src$="/print.svg"], [src$="/expand.svg"], [src$="/download.svg"]):not(:where(.dsp *, .inv-root *, .dcm-wallet-host *, .kpi-root *, .light-only, .light-only *)) {
    filter: invert(0.9) hue-rotate(180deg);
}

/* Range sliders on the trip forms paint their unfilled track with var(--slider-track) */
.dark .client-slider:not(:where(.dsp *, .inv-root *, .dcm-wallet-host *, .kpi-root *, .light-only, .light-only *)) {
    --slider-track: #4b5563;
}

/* More hard-coded light pieces: translucent white cards, faint grey veils, brand-tinted
   fills and text (Tailwind arbitrary values such as bg-[color-mix(...,white)] and
   text-[var(--primary-color,...)]), light hex borders. The token-start selectors match the
   utility itself and not its hover: / focus: / dark: variants. */
.dark :is(.bg-white\/95, .bg-white\/90, .bg-white\/80, .bg-white\/70,
    .bg-white\/60):not([class*="dark:bg-"]):not(:where(.dsp *, .inv-root *, .dcm-wallet-host *, .kpi-root *, .light-only, .light-only *)),
.dark [class*=" bg-[linear-gradient(180deg,rgba(255,255,255"]:not(:where(.dsp *, .inv-root *, .dcm-wallet-host *, .kpi-root *, .light-only, .light-only *)) {
    background-color: #374151;
    background-image: none;
}

.dark :is(.bg-gray-50\/30, .bg-gray-50\/50, .bg-gray-50\/60, .bg-gray-50\/70,
    .bg-gray-50\/75, .bg-gray-50\/80, .bg-slate-50\/50, .bg-gray-100\/30,
    .bg-gray-200\/70, .bg-cyan-50\/10, .bg-cyan-50\/20):not([class*="dark:bg-"]):not(:where(.dsp *, .inv-root *, .dcm-wallet-host *, .kpi-root *, .light-only, .light-only *)) {
    background-color: rgba(255, 255, 255, 0.04);
}

.dark :is(.bg-slate-100, .bg-cyan-50):not([class*="dark:bg-"]):not(:where(.dsp *, .inv-root *, .dcm-wallet-host *, .kpi-root *, .light-only, .light-only *)) {
    background-color: rgba(255, 255, 255, 0.06);
}

.dark :is(.bg-gray-300, .bg-slate-300):not([class*="dark:bg-"]):not(:where(.dsp *, .inv-root *, .dcm-wallet-host *, .kpi-root *, .light-only, .light-only *)) {
    background-color: #4b5563;
}

.dark :is([class^="bg-[color-mix(in_srgb,var(--primary-color"], [class*=" bg-[color-mix(in_srgb,var(--primary-color"]):not([class*="dark:bg-"]):not(:where(.dsp *, .inv-root *, .dcm-wallet-host *, .kpi-root *, .light-only, .light-only *)) {
    background-color: color-mix(in srgb, var(--primary-color, #1D0C67) 24%, #374151);
}

.dark :is([class^="text-[var(--primary-color"], [class*=" text-[var(--primary-color"],
    [class^="text-[rgba(29,12,103"], [class*=" text-[rgba(29,12,103"]):not([class*="dark:text-"]):not(:where(.dsp *, .inv-root *, .dcm-wallet-host *, .kpi-root *, .light-only, .light-only *)) {
    color: color-mix(in srgb, var(--primary-color, #1D0C67) 30%, #ffffff) !important;
}

.dark :is([class^="border-[var(--primary-color"], [class*=" border-[var(--primary-color"],
    [class^="border-[color-mix(in_srgb,var(--primary-color"], [class*=" border-[color-mix(in_srgb,var(--primary-color"],
    [class^="border-[rgba(29,12,103"], [class*=" border-[rgba(29,12,103"]):not([class*="dark:border-"]):not([class*="bg-[var(--primary-color"]):not(:where(.dsp *, .inv-root *, .dcm-wallet-host *, .kpi-root *, .light-only, .light-only *)) {
    border-color: color-mix(in srgb, var(--primary-color, #1D0C67) 45%, #ffffff);
}

.dark :is(.border-\[\#D5DCE6\], .border-\[\#d8dce3\], .border-\[\#C2C2C2\], .border-\[\#c8ccd4\],
    .border-\[\#d8dde5\], .border-\[\#cfd4dc\], .border-\[\#E6E7EB\], .border-\[\#E3E3E4\],
    .border-\[\#CFCFCF\], .border-\[\#dedede\], .border-\[\#d9d9d9\], .border-\[\#EFEFEF\],
    .border-\[\#D1D1D1\], .border-\[\#C5C5C7\], .border-\[\#D7D1F5\], .border-slate-200):not([class*="dark:border-"]):not(:where(.dsp *, .inv-root *, .dcm-wallet-host *, .kpi-root *, .light-only, .light-only *)) {
    border-color: #4b5563;
}

.dark .border-white:not([class*="dark:border-"]):not(:where(.dsp *, .inv-root *, .dcm-wallet-host *, .kpi-root *, .light-only, .light-only *)) {
    border-color: rgba(255, 255, 255, 0.08);
}

.dark :is(.text-slate-950, .text-slate-900, .text-slate-800, .text-gray-950):not([class*="dark:text-"]):not(:where(.dsp *, .inv-root *, .dcm-wallet-host *, .kpi-root *, .light-only, .light-only *)) {
    color: #f3f4f6 !important;
}

.dark :is(.text-slate-600, .text-slate-500):not([class*="dark:text-"]):not(:where(.dsp *, .inv-root *, .dcm-wallet-host *, .kpi-root *, .light-only, .light-only *)) {
    color: #9ca3af !important;
}

.dark :is(.text-cyan-600, .text-cyan-700, .text-cyan-800, .text-cyan-900):not([class*="dark:text-"]):not(:where(.dsp *, .inv-root *, .dcm-wallet-host *, .kpi-root *, .light-only, .light-only *)) { color: #67e8f9 !important; }
.dark :is(.border-cyan-100, .border-cyan-200, .border-cyan-300):not([class*="dark:border-"]):not(:where(.dsp *, .inv-root *, .dcm-wallet-host *, .kpi-root *, .light-only, .light-only *)) { border-color: rgba(6, 182, 212, 0.45); }

/* Native scrollbars, date / time pickers and other browser-drawn controls follow the theme;
   the light-only modules keep the light ones. */
html.dark {
    color-scheme: dark;
}

.dark :is(.inv-root, .dcm-wallet-host, .light-only) {
    color-scheme: light;
}

/* .light-only sets no text colour of its own (the other islands do), so give it the light theme's
   instead of inheriting the dark one; :where() keeps it below any text-* class on the element. */
:where(.dark .light-only) {
    color: #212529;
}
