/*mle-baked*/
/* MLE Billing Dashboard Styles — extracted from billing dashboard */

/* ── Full-page loading overlay ─────────────────────────────────────────── */
#mle-page-loading {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(255, 255, 255, 0.92);
    z-index: 9999;
    display: flex; align-items: center; justify-content: center;
    animation: mleOverlayIn 0.2s ease-out;
}
@keyframes mleOverlayIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* Animated pulse dots */
.mle-loader { display: flex; gap: 8px; justify-content: center; margin-bottom: 16px; }
.mle-loader span {
    width: 12px; height: 12px; border-radius: 50%;
    background: var(--primary, #007bff);
    animation: mlePulse 1.4s ease-in-out infinite both;
}
.mle-loader span:nth-child(1) { animation-delay: -0.32s; }
.mle-loader span:nth-child(2) { animation-delay: -0.16s; }
.mle-loader span:nth-child(3) { animation-delay: 0s; }
@keyframes mlePulse {
    0%, 80%, 100% { transform: scale(0.4); opacity: 0.3; }
    40%           { transform: scale(1);   opacity: 1; }
}

/* Loading bar that sweeps across the top */
.mle-loading-bar {
    position: absolute; top: 0; left: 0; height: 3px; width: 100%;
    overflow: hidden;
}
.mle-loading-bar::after {
    content: '';
    position: absolute; top: 0; left: -40%; height: 100%; width: 40%;
    background: linear-gradient(90deg, transparent, var(--primary, #007bff), transparent);
    animation: mleBarSweep 1.2s ease-in-out infinite;
}
@keyframes mleBarSweep {
    0%   { left: -40%; }
    100% { left: 100%; }
}

/* ── Deferred subtab placeholder (skeleton pulse) ─────────────────────── */
.mle-subtab-deferred {
    text-align: center; padding: 48px 24px; color: var(--gray-500, #6c757d);
}
.mle-subtab-deferred .mle-skeleton {
    display: flex; flex-direction: column; gap: 10px; max-width: 600px; margin: 0 auto;
}
.mle-skeleton-row {
    height: 14px; border-radius: 4px;
    background: linear-gradient(90deg, #e9ecef 25%, #f3f4f6 50%, #e9ecef 75%);
    background-size: 200% 100%;
    animation: mleShimmer 1.5s ease-in-out infinite;
}
.mle-skeleton-row:nth-child(odd) { width: 100%; }
.mle-skeleton-row:nth-child(even) { width: 75%; }
.mle-skeleton-row:last-child { width: 50%; }
@keyframes mleShimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* --- Report containment: prevent AI-generated HTML from shrinking the dashboard --- */
#reportContainer { overflow: hidden; width: 100%; box-sizing: border-box; }
#reportBody.report-rendered {
    overflow-x: auto;       /* horizontal scroll for oversized tables/charts */
    overflow-y: visible;
    min-width: 0;           /* allow flex/grid children to shrink properly */
    max-width: 100%;
    word-wrap: break-word;
    overflow-wrap: break-word;
}
/* Contain all report child elements within the report body */
#reportBody.report-rendered > * { max-width: 100%; box-sizing: border-box; }
#reportBody.report-rendered table { width: 100%; table-layout: auto; overflow-wrap: break-word; word-break: normal; }
#reportBody.report-rendered img { max-width: 100%; height: auto; }
#reportBody.report-rendered pre:not(.mermaid) { overflow-x: auto; max-width: 100%; white-space: pre-wrap; }
/* Mermaid chart containment */
#reportBody pre.mermaid { overflow: visible; max-width: 100%; }
#reportBody pre.mermaid svg,
#reportBody .mermaid svg { max-width: 100%; width: 100% !important; height: auto; overflow: visible; }
#reportBody .mermaid svg text,
#reportBody pre.mermaid svg text { overflow: visible; }
#reportBody .mermaid svg .legend text { font-size: 12px; }
#reportBody .mermaid svg { overflow: visible !important; }
/* Prevent report from collapsing the Analytics tab pane */
#analytics { min-width: 0; overflow: hidden; }
#analytics > * { min-width: 0; }

:root {
    --primary: #2563eb; --success: #059669; --warning: #d97706; --danger: #dc2626; --purple: #7c3aed;
    --gray-50: #f9fafb; --gray-100: #f3f4f6; --gray-200: #e5e7eb; --gray-500: #6b7280; --gray-700: #374151; --gray-900: #111827;
    /* N-ABLE Colors */
    --nable-cyan: #00D4FF; --nable-cyan-dark: #00B8E6; --nable-orange: #FF8C00; --nable-orange-light: #FFB347;
}
body { background: var(--gray-100); }
.dashboard-container { padding: 24px; max-width: 1600px; margin: 0 auto; }
.dashboard-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; }
.dashboard-header h2 { margin: 0; color: var(--gray-900); font-weight: 600; }
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card { background: white; border-radius: 12px; padding: 20px; box-shadow: 0 1px 3px rgba(0,0,0,0.1); border-left: 4px solid var(--primary); }
.stat-card.warning { border-left-color: var(--warning); }
.stat-card.nable { border-left-color: var(--nable-cyan); }
.stat-card.danger { border-left-color: var(--danger); }
.stat-card.success { border-left-color: var(--success); }
.stat-card.purple { border-left-color: var(--purple); }
.stat-card h3 { margin: 0 0 8px 0; font-size: 12px; font-weight: 500; color: var(--gray-500); text-transform: uppercase; }
.stat-card .value { font-size: 28px; font-weight: 700; color: var(--gray-900); }
.stat-card .value.warning { color: var(--warning); }
.stat-card .value.danger { color: var(--danger); }
.stat-card .value.success { color: var(--success); }
.stat-card .value.purple { color: var(--purple); }
.stat-card .subtext { font-size: 13px; color: var(--gray-500); margin-top: 6px; }
.nav-tabs { border-bottom: 2px solid var(--gray-200); margin-bottom: 0; }
.nav-tabs .nav-link { border: none; border-bottom: 3px solid transparent; border-radius: 0; padding: 12px 20px; font-weight: 500; color: var(--gray-500); margin-bottom: -2px; }
.nav-tabs .nav-link:hover { color: var(--primary); }
.nav-tabs .nav-link.active { color: var(--primary); border-bottom-color: var(--primary); background: transparent; }
.tab-content { background: white; border-radius: 0 0 12px 12px; box-shadow: 0 1px 3px rgba(0,0,0,0.1); }
.tab-pane { padding: 24px; }
.table { margin-bottom: 0; }
.table thead th { background: var(--gray-50); border-bottom: 2px solid var(--gray-200); font-weight: 600; font-size: 12px; text-transform: uppercase; color: var(--gray-700); padding: 12px 16px; }
.table tbody td { padding: 12px 16px; vertical-align: middle; border-bottom: 1px solid var(--gray-100); }
.table tbody tr:hover { background: var(--gray-50); }
.empty-state { text-align: center; padding: 48px 24px; color: var(--gray-500); }
.empty-state i { font-size: 48px; margin-bottom: 16px; opacity: 0.3; }
/* Self-Pay purple styling */
.text-purple { color: #8b5cf6 !important; }
.text-orange { color: #f97316 !important; }
.badge-purple { background-color: #8b5cf6 !important; color: white !important; }

/* Statement rows that need action */
.needs-statement-row {
    background-color: #fef9c3 !important;
    border-left: 4px solid #eab308 !important;
}
.needs-statement-row:hover {
    background-color: #fef08a !important;
}
.needs-statement-row td {
    padding-top: 10px !important;
    padding-bottom: 10px !important;
}

/* Email toggle styling */
#statementsTable .custom-switch {
    min-height: 1.2rem;
}
#statementsTable .custom-control-label::before {
    width: 2rem;
    height: 1rem;
}
#statementsTable .custom-control-label::after {
    width: 0.75rem;
    height: 0.75rem;
}
#statementsTable .custom-control-input:checked ~ .custom-control-label::before {
    background-color: #3b82f6;
    border-color: #3b82f6;
}
.btn-outline-purple { color: #8b5cf6; border-color: #8b5cf6; background: transparent; }
.btn-outline-purple:hover { background-color: #8b5cf6 !important; color: white !important; border-color: #8b5cf6 !important; }
.age-badge { font-size: 11px; padding: 2px 6px; border-radius: 4px; font-weight: 500; }
.age-badge.fresh { background: #d1fae5; color: #065f46; }
.age-badge.aging { background: #fef3c7; color: #92400e; }
.age-badge.old { background: #fee2e2; color: #991b1b; }
.attention-item { display: flex; align-items: center; justify-content: space-between; padding: 16px; border-radius: 8px; margin-bottom: 8px; background: var(--gray-50); border-left: 4px solid var(--warning); }
.attention-item.critical { border-left-color: var(--danger); background: #fef2f2; }
.attention-item .patient-info { flex: 1; }
.attention-item .patient-name { font-weight: 600; color: var(--gray-900); }
.attention-item .reason { font-size: 13px; color: var(--gray-500); margin-top: 2px; }
.chart-container { background: white; border-radius: 12px; padding: 20px; box-shadow: 0 1px 3px rgba(0,0,0,0.1); margin-bottom: 16px; }
.chart-container h4 { margin: 0 0 16px 0; font-size: 14px; font-weight: 600; color: var(--gray-700); }
.two-col { display: grid; grid-template-columns: 2fr 1fr; gap: 24px; }
@media (max-width: 1200px) { .two-col { grid-template-columns: 1fr; } }
a.patient-link { color: var(--primary); text-decoration: none; cursor: pointer; }
a.patient-link:hover { text-decoration: underline; }
.era-actions { display: flex; gap: 12px; margin-bottom: 20px; align-items: center; }
.denial-card { background: var(--gray-50); border-radius: 8px; padding: 16px; margin-bottom: 12px; border-left: 4px solid var(--danger); }
.denial-card.clickable:hover { background: var(--gray-100); transform: translateY(-1px); box-shadow: 0 2px 4px rgba(0,0,0,0.1); transition: all 0.15s ease; }
.denial-card .code { font-weight: 700; font-size: 18px; color: var(--danger); }
.denial-card .reason { color: var(--gray-700); margin: 4px 0; }
.denial-card .stats { font-size: 13px; color: var(--gray-500); }

/* Modal Overlay Styles */
.modal-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.5); z-index: 9999; display: flex; align-items: center; justify-content: center; }
.modal-content { background: white; border-radius: 12px; box-shadow: 0 20px 60px rgba(0,0,0,0.3); max-width: 800px; width: 90%; max-height: 85vh; display: flex; flex-direction: column; }
.modal-content.modal-lg { max-width: 1000px; }

/* Quick Charge Entry — floating panel mode (no blocking overlay) */
#chargeEntryOverlay.panel-mode {
    background: transparent;
    pointer-events: none;
    align-items: flex-start;
    justify-content: flex-end;
}
#chargeEntryOverlay.panel-mode > .modal-content {
    pointer-events: all;
    position: absolute;
    top: 2vh; right: 1vw;
    width: 56vw; max-width: 900px;
    height: 92vh; max-height: 92vh;
    border-radius: 10px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.25);
    font-size: 13px;
    transition: width 0.25s ease, height 0.25s ease, top 0.2s ease, left 0.2s ease;
}
#chargeEntryOverlay.panel-mode > .modal-content.panel-expanded {
    width: 95vw !important; max-width: 95vw !important;
    height: 95vh !important; max-height: 95vh !important;
    top: 2.5vh !important; left: 2.5vw !important; right: auto !important;
}
#chargeEntryOverlay.panel-mode > .modal-content.panel-dragging {
    transition: none;
}
/* Compact spacing in panel mode */
#chargeEntryOverlay.panel-mode .modal-header { padding: 10px 14px; }
#chargeEntryOverlay.panel-mode .modal-body { padding: 14px; }
#chargeEntryOverlay.panel-mode .modal-footer { padding: 10px 14px; }
#chargeEntryOverlay.panel-mode .charge-patient-info { padding: 8px 12px; }
#chargeEntryOverlay.panel-mode .charge-patient-info .patient-name { font-size: 14px; }
#chargeEntryOverlay.panel-mode .stat-card .value { font-size: 22px; }
/* Per-charge self-pay row */
.row-selfpay { background: #fefce8 !important; }
.row-selfpay td { opacity: 0.75; }
.row-selfpay .charge-billable { opacity: 1; }
/* Drag handle cursor */
#chargeEntryOverlay.panel-mode .modal-header { cursor: move; user-select: none; }
#chargeEntryOverlay.panel-mode .modal-header button,
#chargeEntryOverlay.panel-mode .modal-header a { cursor: pointer; }
/* Panel header controls */
.panel-header-controls { display: flex; gap: 6px; align-items: center; }
.panel-header-controls button { background: none; border: none; color: white; cursor: pointer; font-size: 14px; padding: 4px 6px; border-radius: 4px; opacity: 0.85; }
.panel-header-controls button:hover { opacity: 1; background: rgba(255,255,255,0.2); }
.modal-header { padding: 16px 20px; border-bottom: 1px solid #e5e7eb; display: flex; justify-content: space-between; align-items: center; border-radius: 12px 12px 0 0; }
.modal-header.bg-primary { background: var(--nable-cyan); }
.modal-close { background: none; border: none; font-size: 18px; cursor: pointer; color: #6b7280; padding: 4px 8px; border-radius: 4px; }
.modal-close:hover { background: #f3f4f6; color: #111827; }
.modal-close-light { color: white; }
.modal-close-light:hover { background: rgba(255,255,255,0.2); color: white; }
.modal-body { padding: 20px; overflow-y: auto; flex: 1; }
.pagination-controls { display: flex; justify-content: center; align-items: center; gap: 12px; padding: 16px 0 0 0; border-top: 1px solid #e5e7eb; margin-top: 16px; }
.pagination-controls button { padding: 6px 14px; border: 1px solid #d1d5db; background: white; border-radius: 6px; cursor: pointer; font-size: 13px; }
.pagination-controls button:hover:not(:disabled) { background: #f3f4f6; }
.pagination-controls button:disabled { opacity: 0.5; cursor: not-allowed; }
.pagination-controls .page-info { font-size: 13px; color: #6b7280; }
.modal-filters { display: flex; gap: 10px; padding: 12px 20px; background: #f9fafb; border-bottom: 1px solid #e5e7eb; flex-wrap: wrap; align-items: center; }
.modal-filters select, .modal-filters input[type="text"] { padding: 6px 10px; border: 1px solid #d1d5db; border-radius: 6px; font-size: 13px; }
.modal-filters select { min-width: 130px; }
.modal-filters input[type="text"] { min-width: 140px; flex: 1; max-width: 180px; }
.modal-filters .filter-btn { padding: 6px 12px; border: 1px solid var(--nable-cyan); background: var(--nable-cyan); color: white; border-radius: 6px; cursor: pointer; font-size: 13px; display: flex; align-items: center; gap: 4px; }
.modal-filters .filter-btn:hover { background: var(--nable-cyan-dark); }
.modal-filters .filter-clear { background: white; color: #6b7280; border-color: #d1d5db; }
.modal-filters .filter-clear:hover { background: #f3f4f6; color: #111827; }
.modal-footer { padding: 16px 20px; border-top: 1px solid #e5e7eb; display: flex; justify-content: flex-end; gap: 10px; }

/* Quick Charge Entry Styles */
.charge-patient-info { background: #f0f9ff; border: 1px solid #bae6fd; border-radius: 8px; padding: 12px 16px; }
.charge-patient-info .patient-name { font-weight: 600; font-size: 16px; color: #0369a1; }
.charge-patient-info .encounter-info { font-size: 13px; color: #6b7280; }
/* Insurance info badges in patient header */
.insurance-info-line { margin-top: 6px; display: flex; gap: 6px; flex-wrap: wrap; }
.ins-badge { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; padding: 2px 8px; border-radius: 12px; }
.ins-badge i { font-size: 10px; }
.ins-badge small { opacity: 0.8; }
.ins-badge.ins-primary { background: #dbeafe; color: #1e40af; border: 1px solid #93c5fd; }
.ins-badge.ins-secondary { background: #f3e8ff; color: #6b21a8; border: 1px solid #c4b5fd; }
.ins-badge.ins-selfpay { background: #fef3c7; color: #92400e; border: 1px solid #fcd34d; }

.benefits-banner { background: linear-gradient(135deg, #f0fdf4 0%, #ecfdf5 100%); border: 1px solid #86efac; border-radius: 8px; padding: 8px 12px; }
.benefits-grid { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.benefit-item { display: flex; flex-direction: column; min-width: 80px; }
.benefit-label { font-size: 10px; text-transform: uppercase; letter-spacing: 0.5px; color: #6b7280; font-weight: 600; }
.benefit-value { font-size: 14px; font-weight: 600; color: #15803d; }
.benefit-estimate { border-left: 2px solid #22c55e; padding-left: 12px; margin-left: auto; }
.benefit-value-highlight { font-size: 16px; color: #0369a1; }

/* NPI search results */
.npi-result-item { padding: 8px 12px; cursor: pointer; border-bottom: 1px solid #f3f4f6; }
.npi-result-item:hover { background: #f0f9ff; }
.npi-result-item:last-child { border-bottom: none; }

.charge-search-row { display: flex; gap: 10px; }
.charge-search-box { flex: 1; position: relative; }
.code-search-results { position: absolute; top: 100%; left: 0; right: 0; background: white; border: 1px solid #d1d5db; border-radius: 0 0 8px 8px; box-shadow: 0 4px 12px rgba(0,0,0,0.15); max-height: 300px; overflow-y: auto; z-index: 100; }
.code-result-item { padding: 10px 14px; cursor: pointer; border-bottom: 1px solid #f3f4f6; display: flex; justify-content: space-between; align-items: center; }
.code-result-item:hover { background: #f0f9ff; }
.code-result-item:last-child { border-bottom: none; }
.code-result-item .code-info { flex: 1; }
.code-result-item .code-num { font-weight: 600; color: var(--nable-cyan); }
.code-result-item .code-desc { font-size: 13px; color: #6b7280; }
.code-result-item .code-fee { font-weight: 600; color: #059669; }
.favorites-panel { background: #fffbeb; border: 1px solid #fcd34d; border-radius: 8px; padding: 12px; }
.favorites-header { margin-bottom: 8px; font-size: 13px; }
.favorites-list { display: flex; flex-wrap: wrap; gap: 8px; }
.favorite-chip { background: white; border: 1px solid #d1d5db; border-radius: 20px; padding: 5px 12px; font-size: 12px; cursor: pointer; transition: all 0.15s; display: inline-flex; align-items: center; gap: 6px; }
.favorite-chip:hover { background: var(--nable-cyan); color: white; border-color: var(--nable-cyan); }
.favorite-chip .chip-code { font-weight: 600; }
.favorite-chip .chip-name { font-size: 11px; color: #6b7280; white-space: nowrap; }
.favorite-chip .chip-fee { font-size: 11px; font-weight: 600; color: #059669; }
.favorite-chip:hover .chip-name, .favorite-chip:hover .chip-fee { color: rgba(255,255,255,0.85); }
.favorite-chip .fav-remove { opacity: 0; transition: opacity .15s; }
.favorite-chip:hover .fav-remove { opacity: 1; color: rgba(255,255,255,0.7); }
.favorite-chip .fav-remove:hover { color: #fca5a5 !important; }
/* ── SALT Panel ─────────────────────────────────────────────────── */
.salt-panel { background: #ecfeff; border: 1px solid #67e8f9; border-radius: 8px; padding: 12px; }
.salt-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; font-size: 13px; }
.salt-list { display: flex; flex-wrap: wrap; gap: 10px; }
.salt-card { background: white; border: 1px solid #d1d5db; border-radius: 8px; padding: 10px 14px; cursor: pointer; transition: all 0.15s; flex: 1 1 200px; min-width: 200px; max-width: 340px; }
.salt-card:hover { border-color: #06b6d4; box-shadow: 0 2px 8px rgba(6,182,212,0.18); transform: translateY(-1px); }
.salt-card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.salt-date { font-size: 12px; font-weight: 600; color: #0891b2; }
.salt-total { font-size: 12px; font-weight: 700; color: #059669; }
.salt-card-codes { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 4px; }
.salt-code-chip { background: #e0f2fe; color: #0369a1; font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 12px; }
.salt-card-dx { font-size: 11px; color: #6b7280; }
.salt-card-onset { font-size: 11px; color: #6b7280; margin-top: 2px; }
/* ── Onset Date Panel ──────────────────────────────────────────── */
.onset-panel { background: #eff6ff; border: 1px solid #93c5fd; border-radius: 8px; padding: 10px 14px; }
.onset-row label { font-size: 13px; margin-bottom: 4px; display: block; }
.onset-input-group { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.onset-input-group input[type="date"] { font-size: 13px; padding: 4px 8px; }
.onset-input-group select { font-size: 12px; }
.charge-table-container { max-height: 250px; overflow-y: auto; border: 1px solid #e5e7eb; border-radius: 8px; }
#chargeEntryTable { margin-bottom: 0; }
#chargeEntryTable thead { position: sticky; top: 0; background: #f9fafb; }
#chargeEntryTable input { padding: 4px 8px; font-size: 13px; }
#chargeEntryTable input.charge-units { width: 55px; text-align: center; }
#chargeEntryTable input.charge-fee { width: 75px; text-align: right; }
#chargeEntryTable input.charge-mod { width: 55px; text-align: center; }
#chargeEntryTable select.charge-dx { padding: 4px 6px; font-size: 13px; width: 50px; text-align: center; }
#chargeEntryTable .btn-remove { color: #dc2626; background: none; border: none; cursor: pointer; }
#chargeEntryTable .btn-remove:hover { color: #991b1b; }
.charge-row { transition: background 0.15s; }
.charge-drop-target { background: #dbeafe; outline: 2px dashed #3b82f6; }
.charge-drag-handle { color: #94a3b8; }
.charge-drag-handle:hover { color: #475569; }
.dx-section { background: #f9fafb; border-radius: 8px; padding: 12px; }
.dx-search-row { position: relative; }
#dxEntryTable { background: white; border-radius: 6px; }
#dxEntryTable .dx-row { background: #dbeafe; transition: background 0.15s; }
#dxEntryTable .dx-row.dx-primary-row { background: #bfdbfe; border-left: 3px solid #2563eb; }
#dxEntryTable .dx-row td { padding: 8px 10px; vertical-align: middle; }
#dxEntryTable .dx-row.dx-drop-target { background: #93c5fd; border-top: 2px solid #2563eb; }
#dxEntryTable .dx-drag-handle { cursor: grab; opacity: 0.5; }
#dxEntryTable .dx-drag-handle:hover { opacity: 1; }
#dxEntryTable .btn-remove { color: #dc2626; background: none; border: none; cursor: pointer; padding: 4px 8px; }
#dxEntryTable .btn-remove:hover { color: #991b1b; }
#dxEntryTable .btn-set-primary { background: none; border: none; cursor: pointer; padding: 4px; }
#dxEntryTable .btn-set-primary:hover i { color: #f59e0b !important; }
.dx-list { display: flex; flex-wrap: wrap; gap: 8px; }
.dx-chip { background: #dbeafe; color: #1e40af; border-radius: 20px; padding: 4px 10px; font-size: 12px; display: inline-flex; align-items: center; gap: 6px; }
.dx-chip .dx-remove { cursor: pointer; opacity: 0.6; }
.dx-chip .dx-remove:hover { opacity: 1; }
.dx-favorite-item, .patient-dx-item { padding: 8px 10px; border-bottom: 1px solid #e5e7eb; cursor: pointer; transition: background 0.15s; }
.dx-favorite-item:hover, .patient-dx-item:hover { background: #dbeafe; }
.dx-favorite-item:last-child, .patient-dx-item:last-child { border-bottom: none; }
#dxTabs .nav-link { padding: 4px 10px; font-size: 12px; }
#dxTabs { border-bottom: 1px solid #dee2e6; margin-bottom: 8px; }
.patient-dx-item .badge-source { font-size: 9px; padding: 2px 5px; }
.copay-panel { background: #ecfdf5; border: 1px solid #6ee7b7; border-radius: 8px; padding: 12px 16px; }
.copay-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.copay-row label { margin: 0; white-space: nowrap; }
.copay-input-group { display: flex; align-items: center; gap: 8px; flex: 1; max-width: 400px; }
.copay-input-group .copay-currency { font-weight: 600; color: #059669; }
.copay-input-group input { max-width: 100px; }
.copay-input-group select { max-width: 130px; }
.copay-default-hint { font-size: 12px; color: #6b7280; font-weight: normal; margin-left: 8px; }

/* Encounter Summary Panel */
.encounter-summary-panel { background: #f0f9ff; border: 1px solid #bae6fd; border-radius: 8px; padding: 12px; }
.encounter-summary-panel .summary-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; color: #0369a1; font-size: 13px; cursor: pointer; user-select: none; }
.encounter-summary-panel .summary-header:hover { color: #0c4a6e; }
.encounter-summary-panel .summary-header .summary-chevron { transition: transform 0.15s ease; margin-right: 4px; }
.encounter-summary-panel:not(.summary-collapsed) .summary-header .summary-chevron { transform: rotate(90deg); }
.encounter-summary-panel.summary-collapsed .summary-header { margin-bottom: 0; }
.encounter-summary-panel.summary-collapsed .summary-content { display: none; }
.encounter-summary-panel .summary-source { font-size: 11px; background: #fef3c7; color: #92400e; padding: 2px 8px; border-radius: 10px; }
.encounter-summary-panel .summary-content { font-size: 12px; color: #374151; line-height: 1.5; }
.encounter-summary-panel .summary-section { margin-bottom: 6px; }
.encounter-summary-panel .summary-label { font-weight: 600; color: #1e40af; }

/* AI Suggestions Panel */
.suggestions-panel { background: #fffbeb; border: 1px solid #fcd34d; border-radius: 8px; padding: 12px; }
.suggestions-panel .suggestions-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; font-size: 13px; }
.suggestions-panel .suggestions-list { display: flex; flex-direction: column; gap: 6px; }

/* Individual Suggestion Item */
.suggestion-item { display: flex; align-items: center; gap: 10px; padding: 8px 12px; background: white; border: 1px dashed #d1d5db; border-radius: 6px; transition: all 0.2s; }
.suggestion-item:hover { border-color: #10b981; background: #f0fdf4; }
.suggestion-item .suggestion-confidence { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.suggestion-item .confidence-high { background: #22c55e; }
.suggestion-item .confidence-medium { background: #eab308; }
.suggestion-item .confidence-low { background: #f87171; }
.suggestion-item .suggestion-code { font-weight: 600; color: #1e40af; min-width: 60px; }
.suggestion-item .suggestion-desc { flex: 1; font-size: 12px; color: #4b5563; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.suggestion-item .suggestion-fee { font-weight: 500; color: #059669; min-width: 60px; text-align: right; }
.suggestion-item .suggestion-reason { font-size: 10px; color: #9ca3af; max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#suggestionsRow .suggestion-item .suggestion-reason { display: none; }
#suggestionsRow .suggestion-item .suggestion-code { min-width: 50px; font-size: 12px; }
#suggestionsRow .suggestion-item { padding: 6px 10px; gap: 8px; }
.suggestion-item .suggestion-actions { display: flex; gap: 4px; }
.suggestion-item .btn-accept { background: #10b981; color: white; border: none; padding: 4px 10px; border-radius: 4px; font-size: 11px; cursor: pointer; }
.suggestion-item .btn-accept:hover { background: #059669; }
.suggestion-item .btn-reject { background: #f3f4f6; color: #6b7280; border: none; padding: 4px 8px; border-radius: 4px; font-size: 11px; cursor: pointer; }
.suggestion-item .btn-reject:hover { background: #e5e7eb; color: #374151; }
.suggestion-item.accepted { opacity: 0.5; border-style: solid; border-color: #10b981; background: #dcfce7; }
.suggestion-item.rejected { opacity: 0.5; background: #fee2e2; border-color: #fca5a5; text-decoration: line-through; }
.suggestion-item.rejected .btn-accept { display: inline-block; }
.suggestion-item.rejected .btn-reject { display: none; }
.kw-highlight { padding: 1px 3px; border-radius: 3px; cursor: help; position: relative; font-weight: 500; }
.kw-highlight.kw-high { background: rgba(34,197,94,0.2); border-bottom: 2px solid #22c55e; }
.kw-highlight.kw-medium { background: rgba(234,179,8,0.2); border-bottom: 2px solid #eab308; }
.kw-highlight.kw-low { background: rgba(248,113,113,0.2); border-bottom: 2px solid #f87171; }
.kw-tooltip { display: none; position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%); background: #1f2937; color: white; padding: 6px 10px; border-radius: 6px; font-size: 11px; white-space: nowrap; z-index: 100; box-shadow: 0 4px 12px rgba(0,0,0,0.2); }
.kw-tooltip::after { content: ''; position: absolute; top: 100%; left: 50%; transform: translateX(-50%); border: 5px solid transparent; border-top-color: #1f2937; }
.kw-highlight:hover .kw-tooltip { display: block; }

/* Confidence tooltip */
.confidence-tooltip { position: relative; cursor: help; }
.confidence-tooltip:hover::after { content: attr(data-tooltip); position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%); background: #1f2937; color: white; padding: 4px 8px; border-radius: 4px; font-size: 10px; white-space: nowrap; z-index: 10; }

/* MLE Billing Styles */
.nav-tabs .nav-link.mle-tab { background: linear-gradient(135deg, var(--nable-cyan) 0%, var(--nable-cyan-dark) 100%); color: white; border-radius: 8px 8px 0 0; margin-right: 4px; }
.nav-tabs .nav-link.mle-tab:hover { background: linear-gradient(135deg, var(--nable-cyan-dark) 0%, #009EC8 100%); color: white; }
.nav-tabs .nav-link.mle-tab.active { background: linear-gradient(135deg, var(--nable-cyan) 0%, var(--nable-cyan-dark) 100%); color: white; border-bottom-color: var(--nable-cyan); box-shadow: 0 2px 8px rgba(0,212,255,0.3); }
.mle-header { background: linear-gradient(135deg, var(--nable-cyan) 0%, var(--nable-cyan-dark) 100%); color: white; padding: 8px 12px; border-radius: 6px; margin-bottom: 10px; display: flex; align-items: center; gap: 10px; }
.mle-header .mle-logo { width: 28px; height: 28px; background: white; border-radius: 6px; display: flex; align-items: center; justify-content: center; font-weight: bold; color: var(--nable-cyan); font-size: 12px; }
.mle-header h3 { margin: 0; font-size: 14px; font-weight: 600; }
.mle-header p { margin: 0; opacity: 0.9; font-size: 11px; }
.mle-chat-container { display: grid; grid-template-columns: 1fr 280px; gap: 12px; min-height: 400px; }
@media (max-width: 1200px) { .mle-chat-container { grid-template-columns: 1fr; } }
.mle-chat { background: white; border-radius: 12px; box-shadow: 0 1px 3px rgba(0,0,0,0.1); display: flex; flex-direction: column; height: 100%; overflow: hidden; }
.mle-chat-messages { flex: 1; overflow-y: auto; padding: 12px; }
.mle-message { margin-bottom: 12px; display: flex; gap: 10px; }
.mle-message.user { flex-direction: row-reverse; }
.mle-message-avatar { width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0; font-size: 12px; }
.mle-message.assistant .mle-message-avatar { background: linear-gradient(135deg, var(--nable-cyan) 0%, var(--nable-cyan-dark) 100%); color: white; }
.mle-message.user .mle-message-avatar { background: var(--gray-200); color: var(--gray-700); }
.mle-message-content { max-width: 85%; padding: 10px 14px; border-radius: 10px; font-size: 13px; line-height: 1.4; }
.mle-message.assistant .mle-message-content { background: var(--gray-50); color: var(--gray-700); border-bottom-left-radius: 4px; }
.mle-message.user .mle-message-content { background: var(--nable-cyan); color: white; border-bottom-right-radius: 4px; }
.mle-message-content a.mle-link { color: var(--nable-cyan); text-decoration: underline; font-weight: 500; }
.mle-message-content a.mle-link:hover { color: var(--nable-cyan-dark); }
.mle-chat-input { padding: 10px 12px; border-top: 1px solid var(--gray-200); display: flex; gap: 10px; }
.mle-chat-input input { flex: 1; border: 1px solid var(--gray-200); border-radius: 8px; padding: 10px 14px; font-size: 14px; }
.mle-chat-input input:focus { outline: none; border-color: var(--nable-cyan); box-shadow: 0 0 0 3px rgba(0,212,255,0.1); }
.mle-chat-input button { background: linear-gradient(135deg, var(--nable-cyan) 0%, var(--nable-cyan-dark) 100%); color: white; border: none; border-radius: 8px; padding: 10px 16px; font-weight: 500; cursor: pointer; transition: all 0.2s; }
.mle-chat-input button:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,212,255,0.3); }
.mle-insights { background: white; border-radius: 12px; box-shadow: 0 1px 3px rgba(0,0,0,0.1); display: flex; flex-direction: column; height: 100%; }
.mle-insights-header { padding: 16px 20px; border-bottom: 1px solid var(--gray-200); font-weight: 600; color: var(--gray-700); display: flex; align-items: center; gap: 8px; }
.mle-insights-header i { color: var(--nable-orange); }
.mle-insights-list { flex: 1; overflow-y: auto; }
.mle-insight { padding: 16px 20px; border-bottom: 1px solid var(--gray-100); transition: background 0.15s; }
.mle-insight:hover { background: var(--gray-50); }
.mle-insight:last-child { border-bottom: none; }
.mle-insight-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 8px; }
.mle-insight-type { font-size: 11px; text-transform: uppercase; font-weight: 600; padding: 2px 8px; border-radius: 4px; }
.mle-insight-type.info { background: #dbeafe; color: #1e40af; }
.mle-insight-type.warning { background: #fef3c7; color: #92400e; }
.mle-insight-type.critical { background: #fee2e2; color: #991b1b; }
.mle-insight-type.success { background: #d1fae5; color: #065f46; }
.mle-insight-title { font-weight: 600; color: var(--gray-900); font-size: 14px; margin-bottom: 4px; }
.mle-insight-content { font-size: 13px; color: var(--gray-600); line-height: 1.5; }
.mle-insight-actions { display: flex; gap: 8px; margin-top: 12px; }
.mle-insight-actions button { background: none; border: 1px solid var(--gray-200); border-radius: 6px; padding: 6px 12px; font-size: 12px; color: var(--gray-600); cursor: pointer; transition: all 0.15s; }
.mle-insight-actions button:hover { border-color: var(--nable-cyan); color: var(--nable-cyan); }
.mle-insight-actions button.rate-up:hover { border-color: var(--success); color: var(--success); }
.mle-insight-actions button.rate-down:hover { border-color: var(--danger); color: var(--danger); }
.mle-insight-actions button.rated { background: var(--gray-100); }
.mle-quick-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--gray-200); }
.mle-quick-action { background: var(--gray-50); border: 1px solid var(--gray-200); border-radius: 20px; padding: 6px 14px; font-size: 12px; color: var(--gray-600); cursor: pointer; transition: all 0.15s; }
.mle-quick-action:hover { background: var(--nable-cyan); color: white; border-color: var(--nable-cyan); }

/* Watchdog Alerts Panel */
.mle-alerts-panel { background: white; border-radius: 10px; box-shadow: 0 1px 3px rgba(0,0,0,0.1); display: flex; flex-direction: column; height: 100%; overflow: hidden; }
.mle-alerts-header { padding: 10px 12px; border-bottom: 1px solid #e5e7eb; font-weight: 600; font-size: 13px; display: flex; align-items: center; gap: 6px; }
.mle-alerts-header i { color: var(--nable-orange); font-size: 12px; }
.mle-alerts-list { flex: 1; overflow-y: auto; padding: 8px; }
.mle-alert-empty { text-align: center; padding: 20px 12px; color: #6b7280; font-size: 0.85rem; }
.mle-alert-item { display: flex; align-items: flex-start; gap: 8px; padding: 8px; border-radius: 6px; cursor: pointer; transition: background 0.15s; margin-bottom: 6px; border-left: 3px solid transparent; }
.mle-alert-item:hover { background: #f9fafb; }
.mle-alert-item.selected { background: #eff6ff; border-left-color: var(--nable-cyan); }
.mle-alert-item.critical { border-left-color: #dc2626; background: #fef2f2; }
.mle-alert-item.high { border-left-color: #f59e0b; background: #fffbeb; }
.mle-alert-item.medium { border-left-color: #eab308; }
.mle-alert-item.low { border-left-color: #6b7280; }
.mle-alert-severity { font-size: 0.85rem; line-height: 1; }
.mle-alert-content { flex: 1; min-width: 0; }
.mle-alert-title { font-weight: 500; font-size: 0.8rem; color: #111827; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mle-alert-meta { font-size: 0.7rem; color: #6b7280; margin-top: 1px; }
.mle-alert-actions { opacity: 0; transition: opacity 0.15s; }
.mle-alert-actions .btn-sm { padding: 2px 6px; font-size: 0.7rem; }
.mle-alert-item:hover .mle-alert-actions { opacity: 1; }
.mle-alerts-footer { padding: 8px 12px; border-top: 1px solid #e5e7eb; text-align: center; }
.mle-alerts-footer a { color: var(--nable-cyan); font-size: 0.75rem; text-decoration: none; }

/* Claim Timeline */
.claim-timeline { padding: 16px 20px; background: #f8f9fa; border-top: 1px solid #e9ecef; }
.claim-timeline-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; padding-bottom: 8px; border-bottom: 1px solid #dee2e6; }
.claim-timeline-header h5 { margin: 0; font-size: 13px; font-weight: 600; color: #333; }
.claim-timeline-header .timeline-meta { font-size: 11px; color: #888; }
.timeline-events { position: relative; padding-left: 24px; }
.timeline-events::before { content: ''; position: absolute; left: 8px; top: 8px; bottom: 8px; width: 2px; background: #dee2e6; }
.timeline-event { position: relative; margin-bottom: 14px; }
.timeline-event:last-child { margin-bottom: 0; }
.timeline-dot { position: absolute; left: -20px; top: 3px; width: 14px; height: 14px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 9px; line-height: 1; background: #fff; border: 2px solid currentColor; z-index: 1; }
.timeline-event-content { padding-left: 4px; }
.timeline-event-title { font-size: 12px; font-weight: 600; color: #333; }
.timeline-event-detail { font-size: 11px; color: #666; margin-top: 1px; }
.timeline-event-time { font-size: 10px; color: #aaa; margin-top: 1px; }
.timeline-event-time .time-gap { background: #f0f0f0; padding: 1px 5px; border-radius: 3px; margin-left: 6px; }
.timeline-next { position: relative; margin-top: 14px; padding: 8px 0 0 4px; border-top: 1px dashed #dee2e6; }
.timeline-next-dot { position: absolute; left: -20px; top: 11px; width: 14px; height: 14px; border-radius: 50%; border: 2px dashed #ccc; background: #fff; z-index: 1; }
.timeline-next-label { font-size: 11px; color: #aaa; font-style: italic; }
.timeline-loading { text-align: center; padding: 20px; color: #888; font-size: 12px; }
tr.timeline-expanded { background: #fafbfc !important; }
tr.timeline-row td { padding: 0 !important; border-top: none !important; }

/* ═══════════════════════════════════════════════════════════════
   QUICK CHARGE — WIDE VIEW MODE
   Activates only when the existing .panel-expanded class is on
   AND viewport is ≥ 1280px. Reflows the modal-body into a
   3-column grid so the extra horizontal space is actually used.
   Below 1280px (laptops, tablets), expanded mode falls back to
   the original full-width vertical stack — no behavior change.
   Per-user persistence is handled in JS via localStorage.

   Rule: NO horizontal scroll anywhere. NO internal vertical
   scroll on any section EXCEPT the selected-charges table
   (which scrolls vertically only — no horizontal).
   ═══════════════════════════════════════════════════════════════ */
@media (min-width: 1280px) {
    /* Modal body becomes a 2-column grid when expanded.
       Row 1: patient banner (full width). Row 2: encounter summary (full width,
       collapsed by default — when expanded it pushes everything below down).
       Row 3+: charges workflow (col 1) and diagnoses workflow (col 2). */
    #chargeEntryOverlay.panel-mode > .modal-content.panel-expanded .modal-body {
        display: grid;
        grid-template-columns: 1fr 1fr;
        grid-auto-rows: min-content;
        column-gap: 14px;
        row-gap: 10px;
        align-content: start;
        overflow-x: hidden;       /* belt-and-suspenders: never scroll horizontally */
    }

    /* Patient banner spans the full width across the top */
    #chargeEntryOverlay.panel-mode > .modal-content.panel-expanded .modal-body > #chargePatientInfo {
        grid-column: 1 / -1;
        min-width: 0;
    }

    /* Encounter summary sits on row 2, full width. Collapsed by default
       (per JS reset on every open). When user expands it, the natural-height
       content pushes the rest of the grid downward. */
    #chargeEntryOverlay.panel-mode > .modal-content.panel-expanded .modal-body > #encounterSummaryPanel {
        grid-column: 1 / -1;
        min-width: 0;
        max-height: none;
        overflow: visible;
    }

    /* COL 1 — Charges workflow */
    #chargeEntryOverlay.panel-mode > .modal-content.panel-expanded .modal-body > #suggestedChargesPanel,
    #chargeEntryOverlay.panel-mode > .modal-content.panel-expanded .modal-body > .charge-search-row,
    #chargeEntryOverlay.panel-mode > .modal-content.panel-expanded .modal-body > #copayPanel,
    #chargeEntryOverlay.panel-mode > .modal-content.panel-expanded .modal-body > #favoritesPanel,
    #chargeEntryOverlay.panel-mode > .modal-content.panel-expanded .modal-body > .charge-table-container {
        grid-column: 1;
        min-width: 0;             /* lets the column shrink instead of pushing siblings */
    }

    /* COL 2 — Diagnoses workflow */
    #chargeEntryOverlay.panel-mode > .modal-content.panel-expanded .modal-body > #suggestedDxPanel,
    #chargeEntryOverlay.panel-mode > .modal-content.panel-expanded .modal-body > .dx-section {
        grid-column: 2;
        min-width: 0;
    }

    /* Suggestions panels: kill any internal scroll, let the list be its full natural height */
    #chargeEntryOverlay.panel-mode > .modal-content.panel-expanded .modal-body > #suggestedChargesPanel,
    #chargeEntryOverlay.panel-mode > .modal-content.panel-expanded .modal-body > #suggestedChargesPanel .suggestions-list,
    #chargeEntryOverlay.panel-mode > .modal-content.panel-expanded .modal-body > #suggestedDxPanel,
    #chargeEntryOverlay.panel-mode > .modal-content.panel-expanded .modal-body > #suggestedDxPanel .suggestions-list {
        max-height: none;
        overflow: visible;
    }

    /* Suggestion items: stop truncating descriptions with ellipsis — let them wrap.
       In wide mode the column is wide enough; truncation just hides info. */
    #chargeEntryOverlay.panel-mode > .modal-content.panel-expanded .modal-body .suggestion-item {
        flex-wrap: wrap;
        align-items: flex-start;
    }
    #chargeEntryOverlay.panel-mode > .modal-content.panel-expanded .modal-body .suggestion-item .suggestion-desc {
        white-space: normal;
        overflow: visible;
        text-overflow: clip;
        min-width: 0;
        line-height: 1.35;
    }
    #chargeEntryOverlay.panel-mode > .modal-content.panel-expanded .modal-body .suggestion-item .suggestion-reason {
        white-space: normal;
        overflow: visible;
        text-overflow: clip;
        max-width: none;
    }

    /* Charges table: keep vertical scroll (long lists are fine), kill horizontal scroll */
    #chargeEntryOverlay.panel-mode > .modal-content.panel-expanded .modal-body > .charge-table-container {
        max-height: 60vh;
        overflow-x: hidden;
    }
    #chargeEntryOverlay.panel-mode > .modal-content.panel-expanded .modal-body > .charge-table-container table {
        width: 100%;
        table-layout: fixed;      /* respect declared col widths instead of pushing wider */
    }
    /* Tighten fixed-width columns at the 1280px boundary so the description column
       always has breathing room and the table fits without horizontal scroll. */
    #chargeEntryOverlay.panel-mode > .modal-content.panel-expanded .modal-body #chargeEntryTable th:nth-child(1),
    #chargeEntryOverlay.panel-mode > .modal-content.panel-expanded .modal-body #chargeEntryTable td:nth-child(1) { width: 72px; }
    #chargeEntryOverlay.panel-mode > .modal-content.panel-expanded .modal-body #chargeEntryTable th:nth-child(3),
    #chargeEntryOverlay.panel-mode > .modal-content.panel-expanded .modal-body #chargeEntryTable td:nth-child(3) { width: 50px; }
    #chargeEntryOverlay.panel-mode > .modal-content.panel-expanded .modal-body #chargeEntryTable th:nth-child(4),
    #chargeEntryOverlay.panel-mode > .modal-content.panel-expanded .modal-body #chargeEntryTable td:nth-child(4) { width: 50px; }
    #chargeEntryOverlay.panel-mode > .modal-content.panel-expanded .modal-body #chargeEntryTable th:nth-child(5),
    #chargeEntryOverlay.panel-mode > .modal-content.panel-expanded .modal-body #chargeEntryTable td:nth-child(5) { width: 70px; }
    #chargeEntryOverlay.panel-mode > .modal-content.panel-expanded .modal-body #chargeEntryTable th:nth-child(6),
    #chargeEntryOverlay.panel-mode > .modal-content.panel-expanded .modal-body #chargeEntryTable td:nth-child(6) { width: 80px; min-width: 80px; }
    #chargeEntryOverlay.panel-mode > .modal-content.panel-expanded .modal-body #chargeEntryTable th:nth-child(7),
    #chargeEntryOverlay.panel-mode > .modal-content.panel-expanded .modal-body #chargeEntryTable td:nth-child(7) { width: 32px; }
    /* Description column wraps instead of overflowing */
    #chargeEntryOverlay.panel-mode > .modal-content.panel-expanded .modal-body #chargeEntryTable td:nth-child(2) {
        word-break: break-word;
        white-space: normal;
    }
    /* Inputs inside cells shrink to fit cell */
    #chargeEntryOverlay.panel-mode > .modal-content.panel-expanded .modal-body #chargeEntryTable input,
    #chargeEntryOverlay.panel-mode > .modal-content.panel-expanded .modal-body #chargeEntryTable select {
        width: 100%;
        max-width: 100%;
        min-width: 0;
        box-sizing: border-box;
    }

    /* Dx section: kill internal scrolls in the tab panes (override inline styles with !important) */
    #chargeEntryOverlay.panel-mode > .modal-content.panel-expanded .modal-body .dx-section #dxFavorites .dx-favorites-list,
    #chargeEntryOverlay.panel-mode > .modal-content.panel-expanded .modal-body .dx-section #dxPatient #patientDxList {
        max-height: none !important;
        overflow: visible !important;
    }
    /* Dx entry table also gets fixed layout + horizontal-scroll guard */
    #chargeEntryOverlay.panel-mode > .modal-content.panel-expanded .modal-body .dx-section {
        overflow-x: hidden;
    }
    #chargeEntryOverlay.panel-mode > .modal-content.panel-expanded .modal-body #dxEntryTable {
        table-layout: fixed;
        width: 100%;
    }
    #chargeEntryOverlay.panel-mode > .modal-content.panel-expanded .modal-body #dxEntryTable td {
        word-break: break-word;
        white-space: normal;
    }

    /* Drop bottom margin on grid items — the grid's row-gap handles spacing now */
    #chargeEntryOverlay.panel-mode > .modal-content.panel-expanded .modal-body > .mb-3,
    #chargeEntryOverlay.panel-mode > .modal-content.panel-expanded .modal-body > .mb-2 {
        margin-bottom: 0;
    }
}

/* ---- Claim Tracker: Pending tab pipeline tracking ---- */
.mle-pstat-chip { background: #fff; border: 1px solid #d1d5db; border-radius: 20px; padding: 4px 12px; font-size: 12px; color: #374151; display: inline-flex; align-items: center; gap: 6px; text-decoration: none; transition: all 0.15s; }
.mle-pstat-chip:hover { border-color: var(--nable-cyan); color: var(--nable-cyan); text-decoration: none; }
.mle-pstat-chip.active { background: var(--nable-cyan); border-color: var(--nable-cyan); color: #fff; }
.mle-pstat-chip .cnt { font-weight: 700; }
.mle-pstat-warn { background: #fef2f2; border: 1px solid #fecaca; color: #b91c1c; border-radius: 20px; padding: 4px 12px; font-size: 12px; font-weight: 600; display: inline-flex; align-items: center; gap: 6px; }

.mle-pipe { display: inline-flex; align-items: center; }
.mle-pipe-dot { width: 20px; height: 20px; border-radius: 50%; border: 2px solid #d1d5db; color: #9ca3af; background: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: 8px; flex-shrink: 0; }
.mle-pipe-dot.done { border-color: #059669; color: #059669; background: #ecfdf5; }
.mle-pipe-dot.next { border-color: #93c5fd; color: #3b82f6; background: #eff6ff; }
.mle-pipe-dot.review { border-color: #f59e0b; color: #b45309; background: #fffbeb; }
.mle-pipe-line { width: 12px; height: 2px; background: #e5e7eb; flex-shrink: 0; }
.mle-pipe-line.done { background: #059669; }
.mle-pipe-label { font-size: 10px; color: #6b7280; margin-top: 2px; white-space: nowrap; }

/* Pending tab: classified response labels */
.mle-resp { display: inline-block; font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 10px; max-width: 230px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: middle; }
.mle-resp-success { background: #ecfdf5; color: #047857; }
.mle-resp-info    { background: #eff6ff; color: #1d4ed8; }
.mle-resp-warn    { background: #fffbeb; color: #b45309; }
.mle-resp-danger  { background: #fef2f2; color: #b91c1c; }
.mle-resp-muted   { background: #f3f4f6; color: #6b7280; }
.mle-resp-facts { font-size: 10px; color: #9ca3af; margin-top: 2px; }

/* ── Back-to-top button (single continuous tables) ── */
#mleBackToTop {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 1050;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    background: #1e3a5f;
    color: #fff;
    font-size: 16px;
    box-shadow: 0 2px 8px rgba(0,0,0,.25);
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s ease;
}
#mleBackToTop.visible { opacity: .85; pointer-events: auto; }
#mleBackToTop:hover { opacity: 1; }

/* ── ERA fetch: indeterminate progress (reassurance that it's working) ── */
#eraFetchProgress {
    border: 1px solid #dbeafe;
    background: #f8fbff;
    border-radius: 8px;
    padding: 12px 14px;
    margin-bottom: 12px;
}
#eraFetchProgress .efp-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    color: #1e3a5f;
    margin-bottom: 8px;
}
#eraFetchProgress .efp-phase { font-weight: 600; }
#eraFetchProgress .efp-phase i { margin-right: 7px; color: #2563eb; }
#eraFetchProgress .efp-timer { font-variant-numeric: tabular-nums; color: #6b7280; font-size: 12px; }
#eraFetchProgress .efp-track {
    height: 8px;
    border-radius: 6px;
    background: #e5edf7;
    overflow: hidden;
    position: relative;
}
#eraFetchProgress .efp-bar {
    position: absolute;
    top: 0; left: 0; bottom: 0;
    width: 35%;
    border-radius: 6px;
    background: linear-gradient(90deg, #3b82f6, #60a5fa);
    animation: efpSlide 1.15s ease-in-out infinite;
}
@keyframes efpSlide {
    0%   { left: -35%; width: 35%; }
    50%  { width: 55%; }
    100% { left: 100%; width: 35%; }
}
