/* AttestFlow SaaS UI Components System */

/* ============================================================ */
/* MODAL SYSTEM                                                   */
/* ============================================================ */

/* Backdrop — hidden by default, covers the full screen */
.modal-backdrop, .modal-overlay, .modal {
    display: none;           /* HIDDEN by default — JS adds .active to show */
    position: fixed;
    inset: 0;
    background-color: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 9000;
    align-items: center;
    justify-content: center;
    padding: 20px;
    overflow-y: auto;
    animation: modalFadeIn 0.18s ease;
}

/* Show when .active is applied by JS */
.modal-backdrop.active, .modal-overlay.active, .modal.active {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

@keyframes modalFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* Modal content box — always centered in the window */
.modal-content, .modal-dialog {
    background: var(--bg-modal);
    color: var(--text-main);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: var(--shadow-modal);
    width: 100%;
    max-width: 640px;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    position: relative;
    margin: auto !important; /* Strictly centered horizontally and vertically */
    animation: modalSlideUp 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalSlideUp {
    from { transform: translateY(16px); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
}

/* Modal structural sections */
.modal-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background: var(--bg-modal-header);
    border-radius: 10px 10px 0 0;
}

.modal-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-main);
    margin: 0;
}

.modal-close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    transition: background 0.15s, color 0.15s;
}
.modal-close:hover {
    background: var(--bg-card-hover);
    color: var(--text-main);
}

.modal-body {
    padding: 20px;
    color: var(--text-main);
}

.modal-footer {
    padding: 14px 20px;
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    background: var(--bg-modal-footer);
    border-radius: 0 0 10px 10px;
}

/* ============================================================ */
/* CARDS & SECTION CARDS                                        */
/* ============================================================ */
.card, .section-card, .table-card, .form-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-subtle);
    margin-bottom: 20px;
    overflow: hidden;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.card-header, .section-header {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background-color: var(--bg-card);
}

.card-title, .section-title {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--text-main);
    letter-spacing: -0.01em;
}

.card-subtitle, .section-subtitle {
    font-size: 11.5px;
    color: var(--text-muted);
}

.card-body, .section-body {
    padding: 16px;
    color: var(--text-main);
}

.card-footer, .section-footer {
    padding: 12px 16px;
    border-top: 1px solid var(--border-color);
    background-color: var(--bg-subtle);
}

/* ============================================================ */
/* GLOBAL KPI / STATISTIC CARDS                                 */
/* ============================================================ */
.kpi-card, .metric-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-card);
    padding: 12px 14px;
    box-shadow: var(--shadow-subtle);
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 74px;
    text-decoration: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    min-width: 0;
    overflow: hidden;
}

.kpi-card:hover, .metric-card:hover {
    border-color: var(--border-input);
    box-shadow: var(--shadow-sm);
}

.kpi-icon-box, .metric-icon-box {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.kpi-icon-box svg, .metric-icon-box svg {
    width: 18px;
    height: 18px;
    stroke-width: 2;
}

/* Restrained Pastel Semantic Palettes */
.icon-blue    { background-color: var(--info-light); color: var(--info); }
.icon-green   { background-color: var(--success-light); color: var(--success); }
.icon-emerald { background-color: var(--success-light); color: var(--success); }
.icon-purple  { background-color: var(--purple-light); color: var(--purple); }
.icon-orange  { background-color: var(--warning-light); color: var(--warning); }
.icon-amber   { background-color: var(--warning-light); color: var(--warning); }
.icon-red     { background-color: var(--danger-light); color: var(--danger); }
.icon-rose    { background-color: var(--danger-light); color: var(--danger); }
.icon-teal    { background-color: var(--teal-light); color: var(--teal); }
.icon-gray    { background-color: var(--bg-subtle); color: var(--text-muted); }
.icon-indigo  { background-color: var(--primary-light); color: var(--primary); }

[data-theme="dark"] .icon-blue    { background-color: rgba(59, 130, 246, 0.16); color: #60A5FA; }
[data-theme="dark"] .icon-green   { background-color: rgba(34, 197, 94, 0.16); color: #4ADE80; }
[data-theme="dark"] .icon-emerald { background-color: rgba(34, 197, 94, 0.16); color: #4ADE80; }
[data-theme="dark"] .icon-purple  { background-color: rgba(168, 85, 247, 0.16); color: #C084FC; }
[data-theme="dark"] .icon-orange  { background-color: rgba(245, 158, 11, 0.16); color: #FBBF24; }
[data-theme="dark"] .icon-amber   { background-color: rgba(245, 158, 11, 0.16); color: #FBBF24; }
[data-theme="dark"] .icon-red     { background-color: rgba(239, 68, 68, 0.16); color: #F87171; }
[data-theme="dark"] .icon-rose    { background-color: rgba(239, 68, 68, 0.16); color: #F87171; }
[data-theme="dark"] .icon-teal    { background-color: rgba(20, 184, 166, 0.16); color: #2DD4BF; }
[data-theme="dark"] .icon-gray    { background-color: rgba(148, 163, 184, 0.16); color: #94A3B8; }
[data-theme="dark"] .icon-indigo  { background-color: rgba(99, 102, 241, 0.16); color: #818CF8; }

.kpi-info, .metric-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1;
}

.kpi-label, .metric-label {
    font-size: 10.5px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 2px;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.kpi-value, .metric-value {
    font-size: 19px;
    font-weight: 700;
    color: var(--text-main);
    letter-spacing: -0.02em;
    line-height: 1.2;
}

.kpi-subtext, .metric-subtext, .metric-desc {
    font-size: 11px;
    color: var(--text-subtle);
    margin-top: 2px;
    line-height: 1.2;
    display: flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.kpi-subtext.positive, .metric-subtext.positive {
    color: var(--success);
    font-weight: 500;
}

.kpi-subtext.warning, .metric-subtext.warning {
    color: var(--warning);
    font-weight: 500;
}

.kpi-subtext.danger, .metric-subtext.danger {
    color: var(--danger);
    font-weight: 500;
}

/* Strict 6 Cards in Single Row Grid */
.grid-cols-6, .grid-metrics.grid-cols-6 {
    display: grid !important;
    grid-template-columns: repeat(6, 1fr) !important;
    gap: 12px !important;
}
@media (max-width: 1200px) {
    .grid-cols-6, .grid-metrics.grid-cols-6 {
        grid-template-columns: repeat(3, 1fr) !important;
    }
}
@media (max-width: 768px) {
    .grid-cols-6, .grid-metrics.grid-cols-6, .grid-metrics, .kpi-grid {
        display: grid !important;
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 8px !important;
    }

    /* First 2 cards stay 2 columns (Card 1 and Card 2) */
    .grid-metrics > .metric-card:nth-child(1),
    .grid-metrics > .metric-card:nth-child(2),
    .kpi-grid > .metric-card:nth-child(1),
    .kpi-grid > .metric-card:nth-child(2) {
        grid-column: span 1 !important;
    }

    /* All subsequent cards (Card 3, 4, 5...) are 1 card per row (full-width) */
    .grid-metrics > .metric-card:nth-child(n+3),
    .kpi-grid > .metric-card:nth-child(n+3) {
        grid-column: span 2 !important;
    }

    .grid-metrics .metric-card,
    .kpi-grid .metric-card {
        padding: 9px 12px !important;
        min-width: 0 !important;
        gap: 10px !important;
    }

    .grid-metrics .metric-icon-box,
    .kpi-grid .metric-icon-box {
        width: 34px !important;
        height: 34px !important;
        min-width: 34px !important;
        border-radius: 8px !important;
    }

    .grid-metrics .metric-icon-box svg,
    .kpi-grid .metric-icon-box svg {
        width: 16px !important;
        height: 16px !important;
    }

    .grid-metrics .metric-info,
    .kpi-grid .metric-info {
        min-width: 0 !important;
        flex: 1 !important;
    }

    .grid-metrics .metric-label,
    .kpi-grid .metric-label {
        font-size: 10.5px !important;
        line-height: 1.2 !important;
    }

    .grid-metrics .metric-value,
    .kpi-grid .metric-value {
        font-size: 14px !important;
        line-height: 1.25 !important;
    }

    .grid-metrics .metric-subtext,
    .kpi-grid .metric-subtext {
        font-size: 10px !important;
        line-height: 1.2 !important;
    }

    /* Specific sizing for full-width cards (cards 3+) */
    .grid-metrics > .metric-card:nth-child(n+3) .metric-value,
    .kpi-grid > .metric-card:nth-child(n+3) .metric-value {
        font-size: 16px !important;
    }

    .grid-metrics > .metric-card:nth-child(n+3) .metric-label,
    .kpi-grid > .metric-card:nth-child(n+3) .metric-label {
        font-size: 11px !important;
    }

    .grid-metrics > .metric-card:nth-child(n+3) .metric-subtext,
    .kpi-grid > .metric-card:nth-child(n+3) .metric-subtext {
        font-size: 10.5px !important;
    }
}

/* Filter Bar */
.filter-bar {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 12px 16px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    box-shadow: var(--shadow-sm);
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    flex: 1;
}

.filter-input, .filter-select {
    height: 34px;
    padding: 0 10px;
    border: 1px solid var(--border-input);
    border-radius: var(--radius-sm);
    font-size: 12.5px;
    color: var(--text-main);
    background-color: var(--bg-input);
    outline: none;
    transition: border-color 0.15s ease, background-color 0.15s ease, color 0.15s ease;
}

.filter-input:focus, .filter-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px var(--primary-focus);
}

.filter-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 12.5px;
    font-weight: 500;
    height: 34px;
    padding: 0 14px;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    cursor: pointer;
    text-decoration: none;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
    white-space: nowrap;
}

.btn svg {
    width: 15px;
    height: 15px;
    stroke-width: 2;
}

.btn-sm {
    height: 28px;
    padding: 0 10px;
    font-size: 11.5px;
}

.btn-primary {
    background-color: var(--primary);
    color: #FFFFFF;
    border-color: var(--primary);
}
.btn-primary:hover {
    background-color: var(--primary-hover);
    border-color: var(--primary-hover);
    color: #FFFFFF;
}

.btn-secondary {
    background-color: var(--bg-card);
    color: var(--text-main);
    border-color: var(--border-input);
}
.btn-secondary:hover {
    background-color: var(--bg-card-hover);
    border-color: var(--text-subtle);
    color: var(--text-main);
}

.btn-outline {
    background-color: transparent;
    color: var(--text-main);
    border-color: var(--border-input);
}
.btn-outline:hover {
    background-color: var(--bg-card-hover);
    border-color: var(--text-subtle);
    color: var(--text-main);
}

.btn-danger {
    background-color: var(--danger-light);
    color: var(--danger);
    border-color: var(--danger-border);
}
.btn-danger:hover {
    background-color: rgba(239, 68, 68, 0.25);
}

.btn-link {
    background: transparent;
    border: none;
    color: var(--primary);
    padding: 0;
    height: auto;
    font-weight: 500;
    text-decoration: none;
    box-shadow: none !important;
}
.btn-link:hover {
    color: var(--primary-hover);
    text-decoration: underline;
    background: transparent;
}

.btn-icon {
    padding: 0;
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
}

/* Status Badges */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: var(--radius-pill);
    line-height: 1.4;
    white-space: nowrap;
}

.badge-success { background-color: var(--success-light); color: var(--success-text); }
.badge-info { background-color: var(--info-light); color: var(--info-text); }
.badge-warning { background-color: var(--warning-light); color: var(--warning-text); }
.badge-danger { background-color: var(--danger-light); color: var(--danger-text); }
.badge-secondary { background-color: var(--gray-badge-bg); color: var(--gray-badge-text); }

/* Tables */
.table-container, .table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.data-table, .table, table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    text-align: left;
}

.data-table th, .table th, table th {
    background-color: var(--bg-table-th);
    padding: 12px 16px;
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
    text-align: left;
    vertical-align: middle;
}

.data-table td, .table td, table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-subtle);
    color: var(--text-main);
    vertical-align: middle;
    text-align: left;
}

.data-table tbody tr, .table tbody tr, table tbody tr {
    transition: background-color 0.1s ease;
}

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

.table-cell-title {
    font-weight: 600;
    color: var(--text-main);
}

.table-cell-sub {
    font-size: 11px;
    color: var(--text-muted);
}

/* Pagination */
.pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 18px;
    border-top: 1px solid var(--border-color);
    font-size: 12px;
    color: var(--text-muted);
}

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

.pagination-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 28px;
    padding: 0 6px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    background-color: var(--bg-card);
    color: var(--text-main);
    font-size: 12px;
    cursor: pointer;
}

.pagination-link:hover {
    background-color: var(--bg-card-hover);
}

.pagination-link.active {
    background-color: var(--primary);
    border-color: var(--primary);
    color: #FFFFFF;
    font-weight: 600;
}

/* Timeline Stepper */
.timeline-stepper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
    padding: 20px 10px;
    margin-bottom: 24px;
    overflow-x: auto;
}

.timeline-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    z-index: 2;
    min-width: 100px;
    text-align: center;
}

.step-node {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background-color: var(--bg-card);
    border: 2px solid var(--border-color);
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    margin-bottom: 8px;
    transition: all 0.2s ease;
}

.timeline-step.completed .step-node {
    background-color: var(--primary);
    border-color: var(--primary);
    color: #FFFFFF;
}

.timeline-step.current .step-node {
    background-color: var(--bg-card);
    border-color: var(--primary);
    color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-light);
}

.step-title {
    font-size: 11.5px;
    font-weight: 600;
    color: var(--text-muted);
    line-height: 1.2;
}

.timeline-step.current .step-title {
    color: var(--primary);
}

.timeline-step.completed .step-title {
    color: var(--text-main);
}

.step-date {
    font-size: 10px;
    color: var(--text-subtle);
    margin-top: 3px;
}

/* Activity Feed */
.activity-list {
    list-style: none;
    position: relative;
    padding-left: 24px;
}

.activity-list::before {
    content: '';
    position: absolute;
    top: 6px;
    bottom: 6px;
    left: 8px;
    width: 2px;
    background-color: var(--border-color);
}

.activity-item {
    position: relative;
    margin-bottom: 18px;
}

.activity-dot {
    position: absolute;
    left: -20px;
    top: 4px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: var(--primary);
    border: 2px solid var(--bg-card);
    box-shadow: 0 0 0 2px var(--border-color);
}

.activity-meta {
    font-size: 11px;
    color: var(--text-subtle);
    margin-bottom: 2px;
}

.activity-desc {
    font-size: 12.5px;
    color: var(--text-main);
}
/* ============================================================ */
/* GLOBAL TABS & STATUS FILTER TABS                             */
/* ============================================================ */
.status-tabs-wrapper, .filter-tabs-wrapper, .tab-bar-wrapper {
    background: var(--bg-tab-wrapper);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 4px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    max-width: 100%;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    margin-bottom: 20px;
}

.status-tabs-wrapper::-webkit-scrollbar,
.filter-tabs-wrapper::-webkit-scrollbar,
.tab-bar-wrapper::-webkit-scrollbar {
    display: none;
}

.status-tab, .tab-pill, .filter-tab {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    font-size: 12.5px;
    font-weight: 500;
    color: var(--text-muted);
    border-radius: 8px;
    text-decoration: none;
    background: transparent;
    border: none;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.15s ease;
    line-height: 1.3;
}

.status-tab:hover, .tab-pill:hover, .filter-tab:hover {
    color: var(--text-main);
    background: var(--bg-card-hover);
}

.status-tab.active, .tab-pill.active, .filter-tab.active {
    background: var(--primary);
    color: var(--primary-text);
    font-weight: 600;
    box-shadow: 0 1px 2px rgba(37, 99, 235, 0.2);
}

.status-tab .tab-icon, .tab-pill .tab-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
}

.status-tab .tab-count, .tab-pill .tab-count, .filter-tab .tab-count {
    font-size: 11px;
    padding: 1px 6px;
    border-radius: 10px;
    background: var(--bg-tab-pill);
    color: var(--text-muted);
    font-weight: 600;
    line-height: 1.2;
    transition: all 0.15s ease;
}

.status-tab.active .tab-count, .tab-pill.active .tab-count, .filter-tab.active .tab-count {
    background: rgba(255, 255, 255, 0.25);
    color: #FFFFFF;
}

/* Classic Underline Nav Tabs (Secondary) */
.nav-tabs {
    display: flex;
    border-bottom: 1px solid var(--border-color);
    gap: 4px;
    margin-bottom: 20px;
    overflow-x: auto;
}

.tab-item {
    padding: 8px 14px;
    font-size: 12.5px;
    font-weight: 500;
    color: var(--text-muted);
    border-bottom: 2px solid transparent;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.15s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.tab-item:hover {
    color: var(--text-main);
}

.tab-item.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    font-weight: 600;
}

.tab-item .tab-count {
    font-size: 10.5px;
    padding: 1px 6px;
    border-radius: 10px;
    background: var(--bg-subtle);
    color: var(--text-muted);
}
.tab-item.active .tab-count {
    background: var(--primary-light);
    color: var(--primary);
}

/* Form Elements */
.form-group {
    margin-bottom: 14px;
}

.form-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 5px;
}

.form-control, .form-select, .form-textarea, .form-input {
    width: 100%;
    height: 36px;
    padding: 0 12px;
    border: 1px solid var(--border-input);
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-family: inherit;
    color: var(--text-main);
    background-color: var(--bg-input);
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease, color 0.15s ease;
}

.form-textarea, textarea.form-input, textarea.form-control {
    height: 76px;
    padding: 8px 12px;
    resize: vertical;
}

.form-control:focus, .form-select:focus, .form-textarea:focus, .form-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-focus);
}

.form-row {
    display: flex;
    gap: 14px;
}
.form-row > * {
    flex: 1;
}

/* Modal */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background-color: var(--bg-backdrop);
    z-index: 100;
    align-items: center;
    justify-content: center;
    padding: 16px;
    backdrop-filter: blur(2px);
}

.modal-overlay.active {
    display: flex;
}

.modal-dialog {
    background-color: var(--bg-modal);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    width: 100%;
    max-width: 580px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-modal);
    animation: modalIn 0.15s ease-out;
}

.modal-dialog.modal-lg {
    max-width: 780px;
}

@keyframes modalIn {
    from { opacity: 0; transform: translateY(8px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-header {
    padding: 14px 20px;
    border-bottom: 1px solid var(--border-color);
    background-color: var(--bg-modal-header);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-main);
}

.modal-close {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    font-size: 18px;
    line-height: 1;
}
.modal-close:hover {
    color: var(--text-main);
}

.modal-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
    color: var(--text-main);
}

.modal-footer {
    padding: 12px 20px;
    border-top: 1px solid var(--border-color);
    background-color: var(--bg-modal-footer);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    border-bottom-left-radius: var(--radius);
    border-bottom-right-radius: var(--radius);
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 150;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    background: var(--bg-toast);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    font-size: 13px;
    box-shadow: var(--shadow-md);
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 280px;
    max-width: 420px;
    color: var(--text-main);
    animation: toastIn 0.2s ease-out;
}

.toast-success { border-left: 4px solid var(--success); }
.toast-error { border-left: 4px solid var(--danger); }
.toast-info { border-left: 4px solid var(--primary); }

@keyframes toastIn {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Empty States */
.empty-state {
    padding: 48px 20px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.empty-icon {
    width: 48px;
    height: 48px;
    color: var(--text-subtle);
    margin-bottom: 12px;
}

.empty-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 4px;
}

.empty-desc {
    font-size: 12.5px;
    color: var(--text-muted);
    max-width: 360px;
    margin-bottom: 16px;
}

/* Progress Bar */
.progress-bar-container {
    width: 100%;
    height: 8px;
    background-color: var(--bg-subtle);
    border-radius: var(--radius-pill);
    overflow: hidden;
    margin: 8px 0;
}

.progress-bar-fill {
    height: 100%;
    background-color: var(--primary);
    border-radius: var(--radius-pill);
    transition: width 0.4s ease;
}

.progress-bar-fill.warning { background-color: var(--warning); }
.progress-bar-fill.danger { background-color: var(--danger); }

/* Unified Finance SaaS Navigation Tabs Bar */
.finance-nav-wrapper {
    margin-bottom: 20px;
    width: 100%;
}

.finance-nav-bar {
    display: flex;
    align-items: center;
    gap: 4px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 6px;
    overflow-x: auto;
    box-shadow: var(--shadow-sm);
    scrollbar-width: thin;
}

.finance-nav-bar::-webkit-scrollbar {
    height: 4px;
}

.finance-nav-bar::-webkit-scrollbar-thumb {
    background: var(--border-input);
    border-radius: 4px;
}

.finance-nav-tab {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: 6px;
    white-space: nowrap;
    transition: all 0.15s ease-in-out;
}

.finance-nav-tab .tab-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.finance-nav-tab svg {
    width: 15px;
    height: 15px;
    stroke-width: 2;
    color: var(--text-subtle);
    transition: color 0.15s ease-in-out;
}

.finance-nav-tab:hover {
    color: var(--text-main);
    background: var(--bg-card-hover);
}

.finance-nav-tab:hover svg {
    color: var(--text-main);
}

.finance-nav-tab.active {
    color: #FFFFFF;
    background: var(--primary);
    font-weight: 600;
    box-shadow: 0 1px 2px rgba(37, 99, 235, 0.2);
}

.finance-nav-tab.active svg {
    color: #FFFFFF;
}

/* ============================================================ */
/* SKELETON / LOADING STATES                                    */
/* ============================================================ */
@keyframes skeletonPulse {
    0% { background-color: var(--skeleton-base); }
    50% { background-color: var(--skeleton-pulse); }
    100% { background-color: var(--skeleton-base); }
}

.skeleton {
    animation: skeletonPulse 1.5s ease-in-out infinite;
    border-radius: var(--radius-sm);
}

.skeleton-kpi {
    height: 74px;
    border-radius: var(--radius-card);
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    padding: 12px 14px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.skeleton-kpi .sk-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    animation: skeletonPulse 1.5s ease-in-out infinite;
}

.skeleton-kpi .sk-text {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.skeleton-kpi .sk-line-sm {
    height: 10px;
    width: 60%;
    border-radius: 4px;
    animation: skeletonPulse 1.5s ease-in-out infinite;
}

.skeleton-kpi .sk-line-lg {
    height: 18px;
    width: 40%;
    border-radius: 4px;
    animation: skeletonPulse 1.5s ease-in-out infinite;
}

.skeleton-card {
    height: 180px;
    border-radius: var(--radius-card);
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    padding: 16px;
    animation: skeletonPulse 1.5s ease-in-out infinite;
}

/* ============================================================ */
/* REUSABLE RESPONSIVE TABLE & CARD CONTAINER                   */
/* ============================================================ */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--radius);
    margin-bottom: 12px;
}
.table-responsive::-webkit-scrollbar {
    height: 6px;
}

/* Multi-Service Modal & Sub-Modal Z-index Layering */
#modalAddServiceToDoc, .service-picker-modal, #modalAddServiceToDocDetail, #editDocServiceSimpleModal {
    z-index: 10050 !important;
}

/* Mobile Modal Enhancements */
@media (max-width: 768px) {
    .modal-backdrop, .modal-overlay, .modal {
        padding: 8px !important;
        align-items: flex-end !important;
    }
    .modal-content, .modal-dialog {
        max-width: 100% !important;
        width: 100% !important;
        max-height: calc(100vh - 16px) !important;
        margin: 0 auto !important;
        border-radius: 16px 16px 0 0 !important;
    }
    .modal-header {
        padding: 12px 16px;
        position: sticky;
        top: 0;
        z-index: 5;
    }
    .modal-body {
        padding: 16px;
        -webkit-overflow-scrolling: touch;
    }
    .modal-footer {
        padding: 12px 16px;
        position: sticky;
        bottom: 0;
        z-index: 5;
        background: var(--bg-modal-footer);
    }

    /* Touch target comfort */
    .btn {
        min-height: 36px;
    }
    .form-control, .form-select {
        min-height: 38px;
        font-size: 14px; /* Prevents auto-zoom on iOS Safari */
    }

    /* Tabs Horizontal Scrolling */
    .status-tabs-wrapper, .filter-tabs-wrapper, .finance-nav-bar, .timeline-stepper {
        display: flex !important;
        width: 100% !important;
        box-sizing: border-box !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
        white-space: nowrap;
        scrollbar-width: none;
        padding-bottom: 6px;
    }
    .status-tabs-wrapper::-webkit-scrollbar,
    .filter-tabs-wrapper::-webkit-scrollbar,
    .finance-nav-bar::-webkit-scrollbar,
    .timeline-stepper::-webkit-scrollbar {
        display: none;
    }

    /* Utility classes */
    .hide-on-mobile {
        display: none !important;
    }
    .show-on-mobile {
        display: block !important;
    }
    .mobile-stack {
        flex-direction: column !important;
        align-items: stretch !important;
    }
}

/* ============================================================ */
/* RESPONSIVE MOBILE TAB DROPDOWN SYSTEM                         */
/* ============================================================ */
.mobile-tab-dropdown-wrapper {
    display: none;
    width: 100%;
    margin-bottom: 16px;
    position: relative;
    box-sizing: border-box;
}

.mobile-tab-dropdown-label {
    display: block;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.05em;
    margin-bottom: 6px;
}

.mobile-tab-dropdown {
    position: relative;
    width: 100%;
    box-sizing: border-box;
}

.mobile-tab-dropdown-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    min-height: 44px;
    padding: 10px 14px;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    color: var(--text-main);
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    text-align: left;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    box-sizing: border-box;
}

.mobile-tab-dropdown-trigger:hover {
    border-color: var(--border-input);
    background-color: var(--bg-card-hover, var(--bg-card));
}

.mobile-tab-dropdown-trigger:focus,
.mobile-tab-dropdown-trigger.open {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-focus, rgba(37, 99, 235, 0.18));
}

.mobile-tab-current-info {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    flex: 1;
}

.mobile-tab-current-label {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 13.5px;
    font-weight: 600;
    color: var(--text-main);
}

.mobile-tab-current-badge {
    font-size: 11px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 10px;
    background: var(--bg-subtle);
    color: var(--text-muted);
    flex-shrink: 0;
}

.mobile-tab-chevron {
    width: 16px;
    height: 16px;
    color: var(--text-muted);
    flex-shrink: 0;
    transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    margin-left: 8px;
}

.mobile-tab-dropdown-trigger.open .mobile-tab-chevron {
    transform: rotate(180deg);
    color: var(--primary);
}

.mobile-tab-dropdown-menu {
    display: none;
    position: absolute;
    top: calc(100% + 5px);
    left: 0;
    right: 0;
    z-index: 1050;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.2), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    max-height: 290px;
    overflow-y: auto;
    padding: 6px;
    animation: tabDropdownOpen 0.14s cubic-bezier(0.16, 1, 0.3, 1);
    box-sizing: border-box;
}

.mobile-tab-dropdown-menu.show {
    display: block;
}

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

.mobile-tab-dropdown-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    min-height: 40px;
    padding: 9px 12px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-main);
    text-decoration: none;
    cursor: pointer;
    border: none;
    background: transparent;
    box-sizing: border-box;
    transition: background-color 0.12s ease, color 0.12s ease;
    text-align: left;
    -webkit-tap-highlight-color: transparent;
}

.mobile-tab-dropdown-item:hover,
.mobile-tab-dropdown-item:focus {
    background-color: var(--bg-card-hover, var(--bg-subtle));
    color: var(--text-main);
    outline: none;
}

.mobile-tab-dropdown-item.active {
    background-color: var(--primary-light, rgba(37, 99, 235, 0.12));
    color: var(--primary, #2563EB);
    font-weight: 700;
}

.mobile-tab-item-content {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    flex: 1;
}

.mobile-tab-item-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mobile-tab-check {
    color: var(--primary, #2563EB);
    font-weight: 800;
    font-size: 14px;
    margin-left: 8px;
    flex-shrink: 0;
}

/* Tablet & Mobile Media Queries for Dropdowns */
@media (max-width: 1023px) {
    .finance-nav-wrapper .finance-nav-bar {
        display: none !important;
    }
    .finance-nav-wrapper .mobile-tab-dropdown-wrapper {
        display: block !important;
    }
}

/* Tablet adaptive mode (768px - 1023px) when tabs overflow or cannot fit */
@media (min-width: 768px) and (max-width: 1023px) {
    .filter-tabs-wrapper.tablet-dropdown,
    .status-tabs-wrapper.tablet-dropdown,
    .tab-bar-wrapper.tablet-dropdown,
    .tabs-container.tablet-dropdown {
        display: none !important;
    }
    .mobile-tab-dropdown-wrapper.tablet-dropdown {
        display: block !important;
    }
}

/* Mobile mode (< 768px) */
@media (max-width: 767.98px) {
    /* Hide all horizontal tab bars on mobile */
    .filter-tabs-wrapper:not(.keep-horizontal-tabs),
    .status-tabs-wrapper:not(.keep-horizontal-tabs),
    .tab-bar-wrapper:not(.keep-horizontal-tabs),
    .nav-tabs:not(.keep-horizontal-tabs),
    .tabs-container.tab-bar-wrapper,
    .tabs-container > .filter-tabs-wrapper,
    .tabs-container > [style*="border-bottom"] {
        display: none !important;
    }

    /* Show responsive tab dropdowns on mobile */
    .mobile-tab-dropdown-wrapper {
        display: block !important;
    }
}

.mobile-card-expand-btn {
    display: none !important;
}

/* ============================================================ */
/* UNIVERSAL RESPONSIVE DATA TABLE TO MOBILE CARD SYSTEM        */
/* ============================================================ */

/* Tablet adaptive card layout (768px - 1023px) when tables overflow */
@media (min-width: 768px) and (max-width: 1023px) {
    .table-container.tablet-card-container,
    .table-responsive.tablet-card-container {
        overflow-x: visible !important;
    }

    table.tablet-card-view thead {
        display: none !important;
    }

    table.tablet-card-view,
    table.tablet-card-view tbody {
        display: flex !important;
        flex-direction: column !important;
        width: 100% !important;
        background: transparent !important;
        border: none !important;
        gap: 12px !important;
    }

    table.tablet-card-view tbody tr:not(.mobile-row-empty) {
        display: flex !important;
        flex-direction: column !important;
        background-color: var(--bg-card) !important;
        border: 1px solid var(--border-color) !important;
        border-radius: 12px !important;
        padding: 14px 16px !important;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05) !important;
        box-sizing: border-box !important;
        width: 100% !important;
    }
}

/* Mobile Card Layout (< 768px) */
@media (max-width: 767.98px) {
    .table-container,
    .table-responsive {
        overflow-x: visible !important;
        width: 100% !important;
        min-width: 0 !important;
    }

    table.responsive-card-table,
    table.data-table,
    table.table,
    .table-container > table,
    .table-responsive > table {
        display: block !important;
        width: 100% !important;
        min-width: 0 !important;
        border: none !important;
        background: transparent !important;
    }

    table.responsive-card-table thead,
    table.data-table thead,
    table.table thead,
    .table-container > table thead,
    .table-responsive > table thead {
        display: none !important;
    }

    table.responsive-card-table tbody,
    table.data-table tbody,
    table.table tbody,
    .table-container > table tbody,
    .table-responsive > table tbody {
        display: flex !important;
        flex-direction: column !important;
        gap: 10px !important;
        width: 100% !important;
        padding: 0 !important;
    }

    /* Individual Card Representation - Compact SaaS Card */
    table.responsive-card-table tbody tr:not(.mobile-row-empty):not(.work-services-accordion-row):not(.accordion-row):not([id*="ServicesRow"]):not([id*="workServicesRow-"]):not(.inv-card-row):not(.work-card-row),
    table.data-table tbody tr:not(.mobile-row-empty):not(.work-services-accordion-row):not(.accordion-row):not([id*="ServicesRow"]):not([id*="workServicesRow-"]):not(.inv-card-row):not(.work-card-row),
    table.table tbody tr:not(.mobile-row-empty):not(.work-services-accordion-row):not(.accordion-row):not([id*="ServicesRow"]):not([id*="workServicesRow-"]):not(.inv-card-row):not(.work-card-row),
    table.tablet-card-view tbody tr:not(.mobile-row-empty):not(.work-services-accordion-row):not(.accordion-row):not([id*="ServicesRow"]):not([id*="workServicesRow-"]):not(.inv-card-row):not(.work-card-row),
    .table-container > table tbody tr:not(.mobile-row-empty):not(.work-services-accordion-row):not(.accordion-row):not([id*="ServicesRow"]):not([id*="workServicesRow-"]):not(.inv-card-row):not(.work-card-row),
    .table-responsive > table tbody tr:not(.mobile-row-empty):not(.work-services-accordion-row):not(.accordion-row):not([id*="ServicesRow"]):not([id*="workServicesRow-"]):not(.inv-card-row):not(.work-card-row) {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: wrap !important;
        align-items: stretch !important;
        background-color: var(--bg-card) !important;
        border: 1px solid var(--border-color) !important;
        border-radius: 10px !important;
        padding: 9px 12px !important;
        margin-bottom: 0 !important;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04) !important;
        box-sizing: border-box !important;
        width: 100% !important;
        height: auto !important;
        min-height: unset !important;
        transition: border-color 0.15s ease, box-shadow 0.15s ease;
        position: relative !important;
    }

    table.responsive-card-table tbody tr:not(.mobile-row-empty):not(.inv-card-row):not(.work-card-row):hover,
    table.data-table tbody tr:not(.mobile-row-empty):not(.inv-card-row):not(.work-card-row):hover,
    table.table tbody tr:not(.mobile-row-empty):not(.inv-card-row):not(.work-card-row):hover {
        border-color: var(--border-input, #CBD5E1) !important;
    }

    /* Checkbox Cell - Floated to Top Right Corner of Card (0 vertical row footprint) */
    .mobile-cell-checkbox {
        position: absolute !important;
        top: 9px !important;
        right: 12px !important;
        width: auto !important;
        height: auto !important;
        padding: 0 !important;
        border: none !important;
        z-index: 2 !important;
        display: flex !important;
        align-items: center !important;
        justify-content: flex-end !important;
        background: transparent !important;
    }

    .mobile-cell-checkbox::before {
        display: none !important;
        content: none !important;
    }

    .mobile-cell-checkbox input[type="checkbox"] {
        width: 16px !important;
        height: 16px !important;
        cursor: pointer !important;
        accent-color: var(--primary, #2563EB) !important;
        margin: 0 !important;
    }

    /* Card Header / Primary Identifier (Work ID, Invoice #, Customer ID, Envelope Code) */
    .mobile-cell-primary {
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
        width: 100% !important;
        flex: 0 0 100% !important;
        padding: 0 28px 5px 0 !important; /* 28px right clearance prevents overlap with absolute checkbox */
        border-bottom: 1.5px solid var(--border-color, #E2E8F0) !important;
        margin-bottom: 3px !important;
        font-size: 13px !important;
        font-weight: 700 !important;
        color: var(--text-main) !important;
        text-align: left !important;
        box-sizing: border-box !important;
        word-break: break-word !important;
    }

    .mobile-cell-primary::before {
        display: none !important;
        content: none !important;
    }

    .mobile-cell-primary a {
        color: var(--primary, #2563EB) !important;
        text-decoration: none !important;
        font-weight: 700 !important;
    }

    /* Standard Full-Width Data Row Cells */
    table.responsive-card-table tbody tr:not(.work-services-accordion-row):not(.accordion-row):not(.inv-card-row):not(.work-card-row) td:not(.mobile-cell-primary):not(.mobile-cell-checkbox):not(.mobile-cell-actions):not([colspan]):not(.mobile-col-half),
    table.data-table tbody tr:not(.work-services-accordion-row):not(.accordion-row):not(.inv-card-row):not(.work-card-row) td:not(.mobile-cell-primary):not(.mobile-cell-checkbox):not(.mobile-cell-actions):not([colspan]):not(.mobile-col-half),
    table.table tbody tr:not(.work-services-accordion-row):not(.accordion-row):not(.inv-card-row):not(.work-card-row) td:not(.mobile-cell-primary):not(.mobile-cell-checkbox):not(.mobile-cell-actions):not([colspan]):not(.mobile-col-half),
    table.tablet-card-view tbody tr:not(.work-services-accordion-row):not(.accordion-row):not(.inv-card-row):not(.work-card-row) td:not(.mobile-cell-primary):not(.mobile-cell-checkbox):not(.mobile-cell-actions):not([colspan]):not(.mobile-col-half),
    .table-responsive > table tbody tr:not(.work-services-accordion-row):not(.accordion-row):not(.inv-card-row):not(.work-card-row) td:not(.mobile-cell-primary):not(.mobile-cell-checkbox):not(.mobile-cell-actions):not([colspan]):not(.mobile-col-half) {
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
        width: 100% !important;
        flex: 0 0 100% !important;
        padding: 3.5px 0 !important;
        border: none !important;
        border-bottom: 1px dashed var(--border-subtle, #F1F5F9) !important;
        font-size: 12px !important;
        line-height: 1.35 !important;
        color: var(--text-main) !important;
        box-sizing: border-box !important;
        text-align: right !important;
        gap: 8px !important;
        word-break: break-word !important;
    }

    table.responsive-card-table tbody tr:not(.work-services-accordion-row):not(.accordion-row):not(.inv-card-row):not(.work-card-row) td:not(.mobile-cell-primary):not(.mobile-cell-checkbox):not(.mobile-cell-actions):not([colspan]):not(.mobile-col-half)::before,
    table.data-table tbody tr:not(.work-services-accordion-row):not(.accordion-row):not(.inv-card-row):not(.work-card-row) td:not(.mobile-cell-primary):not(.mobile-cell-checkbox):not(.mobile-cell-actions):not([colspan]):not(.mobile-col-half)::before,
    table.table tbody tr:not(.work-services-accordion-row):not(.accordion-row):not(.inv-card-row):not(.work-card-row) td:not(.mobile-cell-primary):not(.mobile-cell-checkbox):not(.mobile-cell-actions):not([colspan]):not(.mobile-col-half)::before,
    table.tablet-card-view tbody tr:not(.work-services-accordion-row):not(.accordion-row):not(.inv-card-row):not(.work-card-row) td:not(.mobile-cell-primary):not(.mobile-cell-checkbox):not(.mobile-cell-actions):not([colspan]):not(.mobile-col-half)::before,
    .table-responsive > table tbody tr:not(.work-services-accordion-row):not(.accordion-row):not(.inv-card-row):not(.work-card-row) td:not(.mobile-cell-primary):not(.mobile-cell-checkbox):not(.mobile-cell-actions):not([colspan]):not(.mobile-col-half)::before {
        content: attr(data-label);
        font-size: 10px !important;
        font-weight: 700 !important;
        text-transform: uppercase !important;
        color: var(--text-muted, #64748B) !important;
        letter-spacing: 0.04em !important;
        text-align: left !important;
        flex-shrink: 0 !important;
        max-width: 48% !important;
    }

    /* 2-Column Half-Width Grid Cells (Reduces vertical height by 50% for metric pairs) */
    table.responsive-card-table tbody tr:not(.inv-card-row):not(.work-card-row) td.mobile-col-half,
    table.data-table tbody tr:not(.inv-card-row):not(.work-card-row) td.mobile-col-half,
    table.table tbody tr:not(.inv-card-row):not(.work-card-row) td.mobile-col-half,
    .table-responsive > table tbody tr:not(.inv-card-row):not(.work-card-row) td.mobile-col-half {
        width: 50% !important;
        flex: 0 0 50% !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: flex-start !important;
        justify-content: center !important;
        padding: 3px 6px 3px 0 !important;
        border: none !important;
        border-bottom: 1px dashed var(--border-subtle, #F1F5F9) !important;
        box-sizing: border-box !important;
        text-align: left !important;
        min-width: 0 !important;
    }

    table.responsive-card-table tbody tr:not(.inv-card-row):not(.work-card-row) td.mobile-col-half:nth-of-type(even),
    table.data-table tbody tr:not(.inv-card-row):not(.work-card-row) td.mobile-col-half:nth-of-type(even),
    table.table tbody tr:not(.inv-card-row):not(.work-card-row) td.mobile-col-half:nth-of-type(even),
    .table-responsive > table tbody tr:not(.inv-card-row):not(.work-card-row) td.mobile-col-half:nth-of-type(even) {
        padding: 3px 0 3px 8px !important;
        border-left: 1px dashed var(--border-subtle, #F1F5F9) !important;
    }

    table.responsive-card-table tbody tr:not(.inv-card-row):not(.work-card-row) td.mobile-col-half::before,
    table.data-table tbody tr:not(.inv-card-row):not(.work-card-row) td.mobile-col-half::before,
    table.table tbody tr:not(.inv-card-row):not(.work-card-row) td.mobile-col-half::before,
    .table-responsive > table tbody tr:not(.inv-card-row):not(.work-card-row) td.mobile-col-half::before {
        content: attr(data-label);
        font-size: 9.5px !important;
        font-weight: 700 !important;
        text-transform: uppercase !important;
        color: var(--text-muted, #64748B) !important;
        letter-spacing: 0.04em !important;
        margin-bottom: 1px !important;
        max-width: 100% !important;
        text-align: left !important;
    }

    /* Financial Amounts */
    .mobile-cell-amount {
        font-variant-numeric: tabular-nums !important;
        font-weight: 700 !important;
    }
    .mobile-cell-amount.amount-total {
        color: var(--text-main, #0F172A) !important;
    }
    .mobile-cell-amount.amount-paid {
        color: var(--success, #16A34A) !important;
    }
    .mobile-cell-amount.amount-balance {
        color: var(--danger, #DC2626) !important;
    }

    /* Nested Details / Accordion Rows (Documents, Services, Drilldowns) */
    tr.work-services-accordion-row,
    tr.accordion-row,
    tr[id*="ServicesRow"],
    tr[id*="workServicesRow-"],
    tr:has(> td[colspan]) {
        background: transparent !important;
        border: none !important;
        box-shadow: none !important;
        padding: 0 !important;
        margin-top: -6px !important;
        margin-bottom: 6px !important;
        width: 100% !important;
        height: auto !important;
        min-height: unset !important;
    }

    tr.work-services-accordion-row.is-open,
    tr.accordion-row.is-open,
    tr[id*="ServicesRow"][style*="block"],
    tr[id*="ServicesRow"][style*="table-row"],
    tr[id*="workServicesRow-"][style*="block"],
    tr[id*="workServicesRow-"][style*="table-row"] {
        display: block !important;
    }

    tr.work-services-accordion-row > td,
    tr.accordion-row > td,
    tr[id*="ServicesRow"] > td,
    tr[id*="workServicesRow-"] > td,
    table.table tbody tr td[colspan],
    table.data-table tbody tr td[colspan],
    .table-container > table tbody tr td[colspan],
    .table-responsive > table tbody tr td[colspan] {
        display: block !important;
        width: 100% !important;
        padding: 0 !important;
        border: none !important;
        text-align: left !important;
        box-sizing: border-box !important;
    }

    tr.work-services-accordion-row > td::before,
    tr.accordion-row > td::before,
    tr[id*="ServicesRow"] > td::before,
    tr[id*="workServicesRow-"] > td::before,
    table.table tbody tr td[colspan]::before,
    table.data-table tbody tr td[colspan]::before,
    .table-container > table tbody tr td[colspan]::before,
    .table-responsive > table tbody tr td[colspan]::before {
        display: none !important;
        content: none !important;
    }

    /* Nested Document Cards & Services */
    .work-doc-nested-card {
        background: #F8FAFC !important;
        border: 1px solid var(--border-color, #E2E8F0) !important;
        border-radius: 8px !important;
        padding: 8px 10px !important;
        margin-bottom: 6px !important;
        box-sizing: border-box !important;
        width: 100% !important;
    }
    .work-service-item-card {
        display: flex !important;
        flex-direction: column !important;
        gap: 4px !important;
        padding: 6px 8px !important;
        background: #FFFFFF !important;
        border: 1px solid var(--border-subtle, #F1F5F9) !important;
        border-radius: 6px !important;
        font-size: 11.5px !important;
        box-sizing: border-box !important;
        width: 100% !important;
    }
    .work-service-item-card .service-top-row,
    .work-service-item-card .service-bottom-row {
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
        flex-wrap: wrap !important;
        gap: 4px !important;
        width: 100% !important;
    }

    /* Action Cell at bottom of card - Clean, aligned, compact */
    .mobile-cell-actions {
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
        gap: 6px !important;
        flex-wrap: nowrap !important;
        padding: 7px 0 0 0 !important;
        border: none !important;
        border-top: 1px solid var(--border-color, #E2E8F0) !important;
        margin-top: 3px !important;
        width: 100% !important;
        flex: 0 0 100% !important;
        box-sizing: border-box !important;
    }

    .mobile-cell-actions::before {
        display: none !important;
        content: none !important;
    }

    .mobile-cell-actions .btn,
    .mobile-cell-actions button,
    .mobile-cell-actions a.btn {
        min-height: 28px !important;
        height: 28px !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        padding: 0 10px !important;
        font-size: 11.5px !important;
        font-weight: 600 !important;
        border-radius: 6px !important;
        box-sizing: border-box !important;
        white-space: nowrap !important;
    }

    .mobile-cell-actions .btn-icon {
        width: 28px !important;
        height: 28px !important;
        min-height: 28px !important;
        padding: 0 !important;
        flex-shrink: 0 !important;
    }

    /* Expandable Secondary Fields (Hidden by default, revealed when tr has .is-expanded) */
    table tbody tr:not(.is-expanded) td.mobile-cell-secondary {
        display: none !important;
    }

    table tbody tr.is-expanded td.mobile-cell-secondary {
        display: flex !important;
        animation: mobileCardExpandFade 0.14s ease-out;
    }

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

    /* View More / View Less Toggle Button */
    .mobile-toggle-btn {
        display: inline-flex !important;
        align-items: center !important;
        gap: 4px !important;
        background: transparent !important;
        border: 1px solid var(--border-color, #E2E8F0) !important;
        color: var(--primary, #2563EB) !important;
        font-size: 11px !important;
        font-weight: 600 !important;
        padding: 0 8px !important;
        height: 28px !important;
        border-radius: 6px !important;
        cursor: pointer !important;
        flex-shrink: 0 !important;
        white-space: nowrap !important;
        transition: all 0.15s ease !important;
    }

    .mobile-toggle-btn:hover {
        background: var(--bg-subtle, #F8FAFC) !important;
        border-color: var(--primary, #2563EB) !important;
    }

    .mobile-toggle-icon {
        transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
    }

    tr.is-expanded .mobile-toggle-icon {
        transform: rotate(180deg) !important;
    }

    /* Empty state rows */
    .mobile-row-empty {
        display: block !important;
        background: var(--bg-card) !important;
        border: 1px dashed var(--border-color) !important;
        border-radius: 12px !important;
        padding: 24px 16px !important;
        text-align: center !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }

    .mobile-row-empty td {
        display: block !important;
        padding: 0 !important;
        border: none !important;
        text-align: center !important;
    }

    .mobile-row-empty td::before {
        display: none !important;
    }

    /* Mobile Controls (Search, Filters, Pagination) */
    .pagination {
        flex-direction: column !important;
        gap: 12px !important;
        align-items: center !important;
        text-align: center !important;
        padding: 16px 12px !important;
    }

    .pagination-controls {
        display: flex !important;
        flex-wrap: wrap !important;
        justify-content: center !important;
        gap: 6px !important;
    }

    /* Forms and search bars on mobile */
    form[action*="/operations"],
    form[action*="/customers"],
    form[action*="/invoices"],
    form[action*="/receipts"],
    form[action*="/payments"],
    form[action*="/expenses"],
    form[action*="/couriers"],
    form[action*="/documents"],
    form[action*="/services"],
    form[action*="/finance"],
    form[action*="/reports"],
    form[action*="/team-members"],
    form[action*="/staff"],
    .filter-bar {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 10px !important;
    }

    form[action*="/operations"] > div,
    form[action*="/customers"] > div,
    form[action*="/invoices"] > div,
    form[action*="/receipts"] > div,
    form[action*="/payments"] > div,
    form[action*="/expenses"] > div,
    form[action*="/couriers"] > div,
    form[action*="/documents"] > div,
    form[action*="/services"] > div,
    form[action*="/finance"] > div,
    form[action*="/reports"] > div,
    .filter-group {
        width: 100% !important;
        min-width: 0 !important;
        flex: 1 1 100% !important;
    }

    /* Bulk action toolbars on mobile */
    .bulk-toolbar,
    [id*="bulkToolbar"],
    [id*="BulkToolbar"] {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 8px !important;
        padding: 12px 14px !important;
    }

    [id*="bulkToolbar"] button,
    [id*="BulkToolbar"] button {
        width: 100% !important;
        justify-content: center !important;
        min-height: 38px !important;
    }
}

/* ============================================================ */
/* CLEAN & COMPACT MOBILE INVOICE CARDS                         */
/* ============================================================ */

/* Desktop Display (>= 768px): Hide mobile card cells, preserve desktop table cells */
@media (min-width: 768px) {
    table.data-table tbody tr.inv-card-row td.inv-mobile-card-cell,
    table.data-table tbody tr td.inv-mobile-card-cell,
    td.inv-mobile-card-cell {
        display: none !important;
    }
    table.data-table tbody tr.inv-card-row td.inv-desktop-cell,
    table.data-table tbody tr td.inv-desktop-cell,
    td.inv-desktop-cell {
        display: table-cell !important;
    }
}

/* Mobile Display (< 768px): Hide desktop cells, show clean 4-section compact card */
@media (max-width: 767.98px) {
    table.data-table tbody tr.inv-card-row td.inv-desktop-cell,
    table.data-table tbody tr td.inv-desktop-cell,
    td.inv-desktop-cell {
        display: none !important;
    }

    table.data-table tbody tr.inv-card-row,
    tr.inv-card-row {
        display: block !important;
        background: transparent !important;
        border: none !important;
        padding: 0 !important;
        margin: 0 0 10px 0 !important;
        box-shadow: none !important;
        width: 100% !important;
    }

    table.data-table tbody tr.inv-card-row td.inv-mobile-card-cell,
    table.data-table tbody tr td.inv-mobile-card-cell,
    td.inv-mobile-card-cell {
        display: block !important;
        width: 100% !important;
        padding: 0 !important;
        border: none !important;
        background: transparent !important;
        box-sizing: border-box !important;
    }

    table.data-table tbody tr.inv-card-row td.inv-mobile-card-cell::before,
    td.inv-mobile-card-cell::before {
        display: none !important;
        content: none !important;
    }

    /* Section Wrapper: Compact SaaS Card */
    .inv-card {
        background-color: var(--bg-card, #FFFFFF);
        border: 1px solid var(--border-color, #E2E8F0);
        border-radius: 12px;
        padding: 12px 14px;
        box-shadow: var(--shadow-subtle, 0 1px 3px rgba(0, 0, 0, 0.04));
        box-sizing: border-box;
        width: 100%;
        position: relative;
        transition: border-color 0.15s ease, box-shadow 0.15s ease;
    }

    .inv-card:hover {
        border-color: var(--border-input, #CBD5E1);
    }

    /* Section A: Compact Header */
    .inv-card-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 8px;
        width: 100%;
    }

    .inv-header-left {
        display: flex;
        align-items: center;
        gap: 8px;
        flex-wrap: wrap;
        min-width: 0;
    }

    .inv-number-link {
        font-size: 15px;
        font-weight: 700;
        color: #2563EB;
        text-decoration: none;
        letter-spacing: -0.01em;
        line-height: 1.25;
    }

    .inv-number-link:hover {
        text-decoration: underline;
    }

    .inv-cb-touch-label {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-width: 44px;
        min-height: 44px;
        margin: -10px -10px -10px 0;
        cursor: pointer;
    }

    .inv-select-checkbox {
        width: 18px;
        height: 18px;
        cursor: pointer;
        accent-color: var(--primary, #2563EB);
        border-radius: 4px;
        margin: 0;
    }

    /* Section B: Customer Information */
    .inv-card-customer {
        margin-top: 5px;
        margin-bottom: 2px;
        text-align: left;
    }

    .inv-customer-name {
        font-size: 13.5px;
        font-weight: 700;
        color: var(--text-main, #0F172A);
        line-height: 1.35;
        word-break: break-word;
        text-transform: uppercase;
        letter-spacing: 0.01em;
    }

    .inv-customer-type {
        font-size: 12px;
        color: var(--text-muted, #64748B);
        font-weight: 400;
        margin-top: 1px;
    }

    /* Section C: Essential Invoice Details (3 Columns / Stacked) */
    .inv-card-details {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 8px 10px;
        background-color: var(--bg-subtle, #F8FAFC);
        border: 1px solid var(--border-color, #E2E8F0);
        border-radius: 10px;
        padding: 9px 12px;
        margin: 10px 0;
        box-sizing: border-box;
    }

    .inv-detail-col {
        display: flex;
        flex-direction: column;
        justify-content: center;
        min-width: 0;
        text-align: left;
    }

    .inv-detail-label {
        display: flex;
        align-items: center;
        gap: 5px;
        font-size: 11px;
        font-weight: 500;
        color: var(--text-muted, #64748B);
        line-height: 1.2;
        margin-bottom: 3px;
        white-space: nowrap;
    }

    .inv-detail-icon {
        width: 15px;
        height: 15px;
        color: var(--text-muted, #64748B);
        flex-shrink: 0;
    }

    .inv-detail-val {
        font-size: 13px;
        font-weight: 700;
        color: var(--text-main, #0F172A);
        line-height: 1.25;
        word-break: break-word;
        font-variant-numeric: tabular-nums;
    }

    .inv-detail-total {
        color: var(--text-main, #0F172A);
    }

    .inv-due-indicator {
        color: var(--danger, #DC2626);
        font-size: 11px;
        font-weight: 700;
        margin-left: 3px;
        display: inline-block;
    }

    .inv-op-link {
        color: var(--text-main, #0F172A);
        text-decoration: none;
        font-weight: 700;
    }
    .inv-op-link:hover {
        color: #2563EB;
        text-decoration: underline;
    }

    /* Section D: Compact Footer */
    .inv-card-footer {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 8px;
        border-top: 1px solid var(--border-color, #E2E8F0);
        padding-top: 9px;
        margin-top: 2px;
        width: 100%;
        box-sizing: border-box;
    }

    .inv-footer-status {
        display: flex;
        align-items: center;
        gap: 6px;
        flex-shrink: 0;
    }

    .inv-status-label {
        font-size: 12px;
        font-weight: 500;
        color: var(--text-muted, #64748B);
    }

    .inv-footer-actions {
        display: flex;
        align-items: center;
        gap: 6px;
        flex-wrap: nowrap;
        margin-left: auto;
    }

    .inv-btn-action {
        min-height: 32px !important;
        height: 32px !important;
        padding: 0 12px !important;
        font-size: 12px !important;
        font-weight: 600 !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 5px !important;
        border-radius: 8px !important;
        box-sizing: border-box !important;
        white-space: nowrap !important;
        background: var(--bg-card, #FFFFFF) !important;
        border: 1px solid var(--border-color, #CBD5E1) !important;
        color: var(--text-main, #0F172A) !important;
        cursor: pointer !important;
        transition: all 0.15s ease !important;
        text-decoration: none !important;
    }

    .inv-btn-action:hover {
        background: var(--bg-subtle, #F1F5F9) !important;
        border-color: var(--border-input, #94A3B8) !important;
    }

    .inv-btn-action.btn-icon {
        width: 32px !important;
        min-width: 32px !important;
        padding: 0 !important;
    }
}

/* Narrow Mobile Viewport (< 431px): Stack details vertically */
@media (max-width: 430.98px) {
    .inv-card {
        padding: 10px 12px;
    }

    .inv-card-details {
        display: flex;
        flex-direction: column;
        gap: 7px;
        padding: 8px 10px;
    }

    .inv-detail-col {
        flex-direction: column;
        align-items: flex-start;
        gap: 2px;
    }

    .inv-detail-val {
        padding-left: 20px;
        font-size: 13px;
    }
}

@media (min-width: 768px) {
    .mobile-toggle-btn {
        display: none !important;
    }
}

/* ============================================================ */
/* CLEAN & COMPACT MOBILE WORK REGISTER CARDS                  */
/* ============================================================ */

/* Desktop Display (>= 768px): Hide mobile card cells, preserve desktop table cells */
@media (min-width: 768px) {
    table.data-table tbody tr.work-card-row td.work-mobile-card-cell,
    table.data-table tbody tr td.work-mobile-card-cell,
    td.work-mobile-card-cell {
        display: none !important;
    }
    table.data-table tbody tr.work-card-row td.work-desktop-cell,
    table.data-table tbody tr td.work-desktop-cell,
    td.work-desktop-cell {
        display: table-cell !important;
    }
}

/* Mobile Display (< 768px): Hide desktop cells, show clean 3-section compact card */
@media (max-width: 767.98px) {
    table.data-table tbody tr.work-card-row td.work-desktop-cell,
    table.data-table tbody tr td.work-desktop-cell,
    td.work-desktop-cell,
    tr.work-desktop-accordion-row {
        display: none !important;
    }

    table.data-table tbody tr.work-card-row,
    tr.work-card-row {
        display: block !important;
        background: transparent !important;
        border: none !important;
        padding: 0 !important;
        margin: 0 0 10px 0 !important;
        box-shadow: none !important;
        width: 100% !important;
    }

    table.data-table tbody tr.work-card-row td.work-mobile-card-cell,
    table.data-table tbody tr td.work-mobile-card-cell,
    td.work-mobile-card-cell {
        display: block !important;
        width: 100% !important;
        padding: 0 !important;
        border: none !important;
        background: transparent !important;
        box-sizing: border-box !important;
    }

    table.data-table tbody tr.work-card-row td.work-mobile-card-cell::before,
    td.work-mobile-card-cell::before {
        display: none !important;
        content: none !important;
    }

    /* Main Card Container */
    .work-card {
        background-color: var(--bg-card, #FFFFFF);
        border: 1px solid var(--border-color, #E2E8F0);
        border-radius: 12px;
        padding: 10px 12px;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
        box-sizing: border-box;
        width: 100%;
        position: relative;
        transition: border-color 0.15s ease, box-shadow 0.15s ease;
    }

    .work-card:hover {
        border-color: var(--border-input, #CBD5E1);
    }

    /* Section A: Card Header */
    .work-card-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 6px;
        width: 100%;
        margin-bottom: 8px;
    }

    .work-header-left {
        display: flex;
        align-items: center;
        gap: 6px;
        flex-wrap: nowrap;
        min-width: 0;
    }

    .work-id-link {
        font-size: 14.5px;
        font-weight: 700;
        color: #2563EB;
        text-decoration: none;
        letter-spacing: -0.01em;
        line-height: 1.25;
        white-space: nowrap;
    }

    .work-id-link:hover {
        text-decoration: underline;
    }

    .work-stage-badge {
        border-radius: 9999px;
        padding: 1.5px 7px;
        font-size: 10.5px;
        font-weight: 600;
        display: inline-flex;
        align-items: center;
        white-space: nowrap;
    }

    .work-header-right {
        display: flex;
        align-items: center;
        gap: 4px;
        flex-shrink: 0;
    }

    .work-cb-touch-label {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-width: 28px;
        min-height: 28px;
        cursor: pointer;
    }

    .work-select-checkbox {
        width: 17px;
        height: 17px;
        cursor: pointer;
        accent-color: var(--primary, #2563EB);
        border-radius: 4px;
        margin: 0;
    }

    .work-menu-btn {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 28px;
        height: 28px;
        background: transparent;
        border: none;
        color: var(--text-muted, #64748B);
        border-radius: 6px;
        cursor: pointer;
        padding: 0;
        transition: all 0.15s ease;
    }

    .work-menu-btn:hover {
        background: var(--bg-subtle, #F1F5F9);
        color: var(--text-main, #0F172A);
    }

    /* Section B: Customer Information Row */
    .work-customer-row {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 8px;
        padding-bottom: 8px;
        margin-bottom: 8px;
        border-bottom: 1px solid var(--border-color, #F1F5F9);
    }

    .work-customer-left {
        display: flex;
        align-items: flex-start;
        gap: 6px;
        min-width: 0;
        flex: 1;
    }

    .work-customer-icon {
        width: 14px;
        height: 14px;
        color: var(--text-muted, #64748B);
        flex-shrink: 0;
        margin-top: 2px;
    }

    .work-customer-details {
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        min-width: 0;
        flex: 1;
    }

    .work-customer-name {
        font-size: 13px;
        font-weight: 700;
        color: var(--text-main, #0F172A);
        line-height: 1.3;
        text-transform: uppercase;
        letter-spacing: 0.01em;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 100%;
    }

    .work-customer-tag-wrap {
        margin-top: 2px;
        display: flex;
        align-items: center;
    }

    .work-customer-tag {
        display: inline-flex;
        align-items: center;
        gap: 4px;
        border: 1px solid #DBEAFE;
        background: #EFF6FF;
        color: #1D4ED8;
        font-size: 10px;
        font-weight: 600;
        border-radius: 4px;
        padding: 1px 6px;
        white-space: nowrap;
        max-width: 160px;
        overflow: hidden;
        text-overflow: ellipsis;
        line-height: 1.3;
        cursor: default;
    }

    .work-customer-tag svg {
        flex-shrink: 0;
    }

    .work-customer-right {
        display: flex;
        align-items: center;
        gap: 5px;
        flex-shrink: 0;
    }

    .work-phone-icon {
        width: 13px;
        height: 13px;
        color: var(--text-muted, #64748B);
        flex-shrink: 0;
    }

    .work-customer-phone {
        font-size: 12.5px;
        font-weight: 700;
        color: var(--text-main, #0F172A);
        text-decoration: none;
        white-space: nowrap;
    }

    .work-customer-phone:hover {
        color: #2563EB;
        text-decoration: underline;
    }

    /* Section C: Essential Information Grid */
    .work-info-grid {
        display: flex;
        flex-direction: column;
        gap: 0;
        width: 100%;
    }

    .work-grid-row-1 {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 6px 8px;
        padding-bottom: 8px;
        margin-bottom: 8px;
        border-bottom: 1px solid var(--border-color, #F1F5F9);
    }

    .work-grid-row-2 {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 6px 8px;
        padding-bottom: 8px;
        margin-bottom: 8px;
        border-bottom: 1px solid var(--border-color, #F1F5F9);
    }

    .work-grid-item {
        display: flex;
        align-items: center;
        gap: 6px;
        min-width: 0;
    }

    .work-grid-icon {
        width: 16px;
        height: 16px;
        color: var(--text-muted, #64748B);
        flex-shrink: 0;
    }

    .work-grid-text {
        display: flex;
        flex-direction: column;
        min-width: 0;
    }

    .work-grid-label {
        font-size: 10.5px;
        font-weight: 500;
        color: var(--text-muted, #64748B);
        line-height: 1.2;
        margin-bottom: 1px;
        white-space: nowrap;
    }

    .work-grid-val {
        font-size: 12px;
        font-weight: 700;
        color: var(--text-main, #0F172A);
        line-height: 1.25;
        white-space: nowrap;
        font-variant-numeric: tabular-nums;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .work-grid-val.text-success {
        color: #16A34A !important;
    }

    .work-grid-val.text-danger {
        color: #DC2626 !important;
    }

    .work-docs-pill-btn {
        display: inline-flex;
        align-items: center;
        gap: 4px;
        background: #EFF6FF;
        color: #2563EB;
        border: 1px solid #DBEAFE;
        border-radius: 9999px;
        padding: 2px 7px;
        font-size: 11px;
        font-weight: 600;
        cursor: pointer;
        transition: all 0.15s ease;
        width: fit-content;
        text-decoration: none;
    }

    .work-docs-pill-btn:hover {
        background: #DBEAFE;
    }

    /* Section D: Card Action Footer */
    .work-action-footer {
        display: flex;
        align-items: center;
        width: 100%;
        padding-top: 4px;
    }

    .work-btn-view {
        width: 100% !important;
        min-height: 36px !important;
        height: 36px !important;
        padding: 0 14px !important;
        font-size: 12.5px !important;
        font-weight: 600 !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 6px !important;
        border-radius: 8px !important;
        background: var(--bg-card, #FFFFFF) !important;
        border: 1px solid var(--border-color, #CBD5E1) !important;
        color: #2563EB !important;
        cursor: pointer !important;
        transition: all 0.15s ease !important;
        text-decoration: none !important;
    }

    .work-btn-view:hover {
        background: #EFF6FF !important;
        border-color: #93C5FD !important;
        color: #1D4ED8 !important;
    }

    /* Attached Documents Section (Collapsible under Main Card) */
    .work-attached-docs-section {
        background-color: var(--bg-card, #FFFFFF);
        border: 1px solid var(--border-color, #E2E8F0);
        border-radius: 12px;
        margin-top: 8px;
        padding: 9px 11px;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
        box-sizing: border-box;
        animation: fadeIn 0.18s ease;
    }

    .work-attached-docs-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        cursor: pointer;
        user-select: none;
        padding: 2px 0;
    }

    .work-attached-docs-title {
        display: flex;
        align-items: center;
        gap: 7px;
        font-size: 13px;
        font-weight: 700;
        color: var(--text-main, #0F172A);
    }

    .work-attached-docs-chevron-btn {
        background: transparent;
        border: none;
        color: var(--text-muted, #64748B);
        display: inline-flex;
        align-items: center;
        justify-content: center;
        padding: 3px;
        cursor: pointer;
    }

    .work-docs-chevron-icon {
        transition: transform 0.2s ease;
    }

    .work-attached-docs-section.is-open .work-docs-chevron-icon {
        transform: rotate(180deg);
    }

    .work-attached-docs-body {
        display: flex;
        flex-direction: column;
        gap: 7px;
        margin-top: 8px;
        padding-top: 8px;
        border-top: 1px solid var(--border-color, #F1F5F9);
    }

    .work-doc-item-card {
        background: var(--bg-subtle, #FAFBFD);
        border: 1px solid var(--border-color, #E2E8F0);
        border-radius: 8px;
        padding: 8px 10px;
    }

    .work-doc-item-top {
        display: flex;
        align-items: center;
        gap: 8px;
    }

    .work-doc-icon-box {
        width: 26px;
        height: 26px;
        border-radius: 6px;
        background: #EFF6FF;
        display: flex;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
    }

    .work-doc-title-box {
        display: flex;
        flex-direction: column;
        min-width: 0;
        flex: 1;
    }

    .work-doc-name {
        font-size: 12px;
        font-weight: 700;
        color: var(--text-main, #0F172A);
        line-height: 1.25;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .work-doc-cand {
        font-size: 10.5px;
        color: var(--text-muted, #64748B);
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        margin-top: 1px;
    }

    .work-doc-badge-box {
        display: flex;
        align-items: center;
        gap: 5px;
        flex-shrink: 0;
    }

    .work-doc-badge {
        font-size: 10px;
        font-weight: 600;
        padding: 1.5px 6px;
        border-radius: 9999px;
        white-space: nowrap;
    }

    .work-doc-badge.badge-success,
    .work-doc-badge.badge-primary {
        background: #DCFCE7;
        color: #16A34A;
        border: 1px solid #BBF7D0;
    }

    .work-doc-chevron-link {
        color: var(--text-muted, #94A3B8);
        display: inline-flex;
        align-items: center;
        text-decoration: none;
    }

    .work-doc-chevron-link:hover {
        color: #2563EB;
    }

    .work-doc-meta-strip {
        display: flex;
        align-items: center;
        gap: 10px;
        flex-wrap: wrap;
        margin-top: 7px;
        padding-top: 6px;
        border-top: 1px solid var(--border-color, #F1F5F9);
    }

    .work-doc-meta-item {
        display: inline-flex;
        align-items: center;
        gap: 3.5px;
        font-size: 10.5px;
        color: var(--text-muted, #64748B);
        font-weight: 500;
    }

    .work-doc-meta-item svg {
        color: var(--text-muted, #94A3B8);
        flex-shrink: 0;
    }
}

/* Narrow Mobile Viewport (< 431px) */
@media (max-width: 430.98px) {
    .work-card {
        padding: 10px 11px;
    }
    .work-customer-name {
        font-size: 12px;
    }
    .work-customer-phone {
        font-size: 11.5px;
    }
    .work-grid-val {
        font-size: 11.5px;
    }
    .work-doc-meta-strip {
        gap: 6px 8px;
    }
}

/* ============================================================ */
/* WORK REGISTER RESPONSIVE SEARCH & FILTER BAR                 */
/* ============================================================ */

.work-filter-card {
    margin-bottom: 20px;
    padding: 12px 16px;
    background: #FFFFFF;
    border: 1px solid #E2E8F0;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.02);
}

.work-filter-form {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    width: 100%;
}

.work-filter-search {
    position: relative;
    flex: 1 1 240px;
    min-width: 200px;
}

.work-filter-search input {
    padding-left: 36px !important;
    height: 36px;
    font-size: 12.5px;
    border: 1px solid #CBD5E1;
    border-radius: 6px;
    width: 100%;
}

.work-filter-selects-grid {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.work-filter-item {
    width: 135px;
}

.work-filter-item select {
    height: 36px;
    font-size: 12.5px;
    border: 1px solid #CBD5E1;
    border-radius: 6px;
    width: 100%;
    background-color: #FFFFFF;
}

.work-filter-actions {
    display: flex;
    gap: 6px;
    align-items: center;
}

.work-filter-btn {
    height: 36px;
    padding: 0 14px;
    font-size: 12.5px;
    font-weight: 600;
    border-radius: 6px;
    white-space: nowrap;
}

.work-filter-clear-btn {
    height: 36px;
    padding: 0 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted, #64748B);
    font-size: 12px;
    border-radius: 6px;
    white-space: nowrap;
    text-decoration: none;
}

/* Tablet view (768px - 1024px) */
@media (min-width: 768px) and (max-width: 1024px) {
    .work-filter-search {
        flex: 1 1 100%;
        width: 100%;
        margin-bottom: 2px;
    }
    .work-filter-selects-grid {
        flex: 1 1 auto;
        display: flex;
        gap: 8px;
    }
    .work-filter-item {
        flex: 1 1 0;
        min-width: 105px;
    }
}

/* Mobile View (< 768px): Symmetrical 2x2 grid for filters + full width actions */
@media (max-width: 767.98px) {
    .work-filter-card {
        padding: 12px 14px !important;
        margin-bottom: 16px !important;
    }

    .work-filter-form {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 10px !important;
        width: 100% !important;
    }

    .work-filter-search {
        width: 100% !important;
        min-width: 0 !important;
        flex: none !important;
    }

    .work-filter-search svg {
        left: 10px !important;
        top: 12px !important;
    }

    .work-filter-search input {
        height: 38px !important;
        font-size: 12.5px !important;
        width: 100% !important;
        padding-left: 32px !important;
        padding-right: 8px !important;
        text-overflow: ellipsis !important;
    }

    .work-filter-selects-grid {
        display: grid !important;
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 6px !important;
        width: 100% !important;
    }

    .work-filter-item {
        width: 100% !important;
        min-width: 0 !important;
    }

    .work-filter-item select {
        height: 38px !important;
        font-size: 12px !important;
        width: 100% !important;
        padding: 0 6px !important;
        border-radius: 6px !important;
        text-overflow: ellipsis !important;
    }

    .work-filter-actions {
        display: flex !important;
        gap: 6px !important;
        width: 100% !important;
        margin-top: 2px !important;
    }

    .work-filter-actions .work-filter-btn {
        flex: 1 1 0% !important;
        width: 100% !important;
        height: 38px !important;
        font-size: 13px !important;
        font-weight: 600 !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
    }

    .work-filter-actions .work-filter-clear-btn {
        flex: 1 1 0% !important;
        height: 38px !important;
        font-size: 13px !important;
        font-weight: 500 !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
    }
}

/* ============================================================ */
/* WORK REGISTER TABLE HEADER                                   */
/* ============================================================ */

.work-table-card-header {
    padding: 14px 20px;
    border-bottom: 1px solid #E2E8F0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #FAFBFD;
    gap: 12px;
}

.work-table-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.work-table-header-title {
    font-size: 14px;
    font-weight: 700;
    color: #1E293B;
}

.work-table-header-badge {
    background: #E2E8F0;
    color: #475569;
    font-size: 11.5px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 12px;
}

.work-table-header-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.work-btn-register {
    font-size: 12.5px;
    font-weight: 600;
    padding: 6px 14px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #2563EB;
    border-color: #2563EB;
    border-radius: 6px;
    color: #FFFFFF;
}

/* Mobile Table Header (< 768px) */
@media (max-width: 767.98px) {
    .work-table-card-header {
        padding: 12px 14px !important;
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 10px !important;
    }

    .work-table-header-left {
        width: 100% !important;
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
    }

    .work-table-header-right {
        width: 100% !important;
    }

    .work-table-header-right .work-btn-register {
        width: 100% !important;
        height: 38px !important;
        justify-content: center !important;
        font-size: 13px !important;
    }
}


