/* ── ECP Dashboard v2 — Components ── */

/* ── Page Header ── */
.page-header {
    margin-bottom: 28px;
}
.page-title {
    font-size: 1.85rem;
    font-weight: 800;
    color: var(--text);
    margin-bottom: 4px;
    letter-spacing: -0.01em;
}
.page-subtitle {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* ── Section ── */
/* Section spacing + headers — bumped up per feedback #51 / project #79 so the
   page hierarchy reads more clearly. Sections after the first get a subtle
   top divider for a clear visual break between blocks. */
.section {
    margin-bottom: 28px;
    padding-top: 4px;
}
.section + .section {
    border-top: 1px solid var(--border, rgba(148,163,184,0.18));
    padding-top: 20px;
    margin-top: 4px;
}
.section-title {
    font-size: 1.05rem;
    font-weight: 700;
    text-transform: none;
    letter-spacing: -0.005em;
    color: var(--text);
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    line-height: 1.25;
}
.section-title .badge {
    background: var(--red);
    color: white;
    font-size: 0.65rem;
    padding: 2px 7px;
    border-radius: 10px;
    font-weight: 600;
}
.section-title .badge-warn { background: var(--orange); }
.section-title .badge-info { background: var(--blue); }

/* ── KPI Card Grid ── */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 10px;
    margin-bottom: 16px;
}
.kpi-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius);
    padding: 14px 16px;
    position: relative;
    transition: border-color 0.15s, box-shadow 0.15s;
    cursor: default;
}
.kpi-card:hover {
    border-color: var(--teal);
    box-shadow: 0 2px 8px rgba(0,212,170,0.1);
}
.kpi-card.expandable { cursor: pointer; }
.kpi-card .kpi-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--text-muted);
    font-weight: 600;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 4px;
}
.kpi-card .kpi-value {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--text);
    line-height: 1.1;
}
.kpi-card .kpi-delta {
    font-size: 0.75rem;
    font-weight: 600;
    margin-top: 3px;
}
.kpi-card .kpi-sub {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 2px;
}
.delta-up { color: var(--green); }
.delta-down { color: var(--red); }
.delta-flat { color: var(--text-muted); }

/* ── KPI Card Expansion ── */
.kpi-detail {
    display: none;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--card-border);
    font-size: 0.82rem;
}
.kpi-card.expanded .kpi-detail { display: block; }
.kpi-card.expanded {
    border-color: var(--teal);
    box-shadow: 0 4px 16px rgba(0,212,170,0.12);
}
.detail-row {
    display: flex;
    justify-content: space-between;
    padding: 3px 0;
    color: var(--text-secondary);
}
.detail-row .label { font-weight: 500; }
.detail-row .value { font-weight: 700; color: var(--text); }
.detail-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 3px 0;
}
.detail-bar .bar-label {
    font-size: 0.78rem;
    color: var(--text-secondary);
    min-width: 90px;
}
.detail-bar .bar-fill {
    height: 6px;
    border-radius: 3px;
    background: var(--teal);
    transition: width 0.3s;
}
.detail-bar .bar-track {
    flex: 1;
    height: 6px;
    border-radius: 3px;
    background: #f1f5f9;
}
.detail-bar .bar-value {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text);
    min-width: 50px;
    text-align: right;
}
.detail-link {
    display: inline-block;
    margin-top: 8px;
    color: var(--teal-dark);
    font-weight: 600;
    font-size: 0.8rem;
    text-decoration: none;
}
.detail-link:hover { text-decoration: underline; }

/* ── Action Cards ── */
.action-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.action-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius);
    padding: 12px 16px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    transition: border-color 0.15s;
}
.action-card:hover { border-color: var(--teal); }
.action-severity {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-top: 6px;
    flex-shrink: 0;
}
.severity-high { background: var(--red); box-shadow: 0 0 6px rgba(239,68,68,0.3); }
.severity-medium { background: var(--orange); }
.severity-low { background: var(--blue); }
.action-content { flex: 1; min-width: 0; }
.action-title {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 2px;
}
.action-meta {
    font-size: 0.78rem;
    color: var(--text-muted);
}
.action-link {
    color: var(--teal-dark);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.8rem;
    white-space: nowrap;
    align-self: center;
}
.action-link:hover { text-decoration: underline; }

/* ── Citation Button ── */
.cite-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #e8ecf0;
    color: #94a3b8;
    font-size: 9px;
    font-weight: 800;
    cursor: pointer;
    border: none;
    vertical-align: middle;
    font-style: normal;
    line-height: 1;
    transition: all 0.15s;
    flex-shrink: 0;
}
.cite-btn:hover { background: var(--teal); color: white; }

/* ── Citation Tooltip ── */
.cite-tooltip {
    position: fixed;
    background: var(--sidebar-bg);
    color: #e2e8f0;
    padding: 14px 18px;
    border-radius: 10px;
    font-size: 0.78rem;
    line-height: 1.6;
    max-width: 340px;
    z-index: 2000;
    box-shadow: 0 8px 24px rgba(0,0,0,0.25);
    pointer-events: auto;
}
.cite-tooltip.hidden { display: none; }
.cite-tooltip .cite-title {
    font-weight: 700;
    color: var(--teal);
    margin-bottom: 6px;
    font-size: 0.82rem;
}
.cite-tooltip .cite-formula {
    background: rgba(255,255,255,0.08);
    padding: 6px 10px;
    border-radius: 6px;
    font-family: 'SF Mono', Menlo, monospace;
    font-size: 0.72rem;
    margin: 6px 0;
    color: #cbd5e1;
}
.cite-tooltip .cite-meta {
    color: #94a3b8;
    font-size: 0.72rem;
    margin-top: 6px;
}
.cite-tooltip .cite-fresh {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.cite-tooltip .cite-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--green);
    display: inline-block;
}

/* ── Collapsible Sections ── */
.collapsible { margin-bottom: 12px; }
.collapsible-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius);
    cursor: pointer;
    user-select: none;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    transition: all 0.15s;
}
.collapsible-header:hover { border-color: var(--teal); color: var(--text); }
.collapse-arrow {
    transition: transform 0.2s;
    color: var(--text-muted);
    font-size: 0.8em;
}
.collapsible.collapsed .collapse-arrow { transform: rotate(-90deg); }
.collapsible-body {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-top: none;
    border-radius: 0 0 var(--radius) var(--radius);
    padding: 16px;
    transition: all 0.2s;
}
.collapsible.collapsed .collapsible-body { display: none; }
.collapsible.collapsed .collapsible-header {
    border-radius: var(--radius);
}

/* ── Tab Groups ── */
.tab-group { margin-bottom: 16px; }
.tab-nav {
    display: flex;
    gap: 0;
    background: #f1f5f9;
    border-radius: 8px;
    padding: 3px;
    margin-bottom: 12px;
    width: fit-content;
    overflow-x: auto;
}
.tab-btn {
    padding: 6px 16px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 500;
    transition: all 0.15s;
    white-space: nowrap;
    min-height: 32px;
}
.tab-btn:hover { color: var(--text); }
.tab-btn.active { background: white; color: var(--teal-dark); font-weight: 600; box-shadow: 0 1px 3px rgba(0,0,0,0.08); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── Card (generic container) ── */
.card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 12px;
}
.card-title {
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* ── Schedule Strip ── */
.schedule-strip {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.schedule-row {
    display: flex;
    align-items: center;
    padding: 10px 14px;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius);
    gap: 12px;
    font-size: 0.85rem;
}
.schedule-row .icon { font-size: 1.2em; flex-shrink: 0; }
.schedule-row .desc { flex: 1; }
.schedule-row .status {
    font-weight: 600;
    font-size: 0.78rem;
    padding: 3px 10px;
    border-radius: 20px;
    white-space: nowrap;
}
.status-done { background: #dcfce7; color: #166534; }
.status-active { background: #dbeafe; color: #1d4ed8; }
.status-queued { background: #f1f5f9; color: #64748b; }
.status-none { background: #f8fafc; color: #cbd5e1; }

/* ── Sparkline Bar Chart (inline) ── */
.spark-bars {
    display: flex;
    align-items: flex-end;
    gap: 3px;
    height: 40px;
}
.spark-bar {
    flex: 1;
    border-radius: 2px 2px 0 0;
    min-width: 8px;
    transition: height 0.3s;
}
.spark-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.65rem;
    color: var(--text-muted);
    margin-top: 2px;
}

/* ── Narrative Card ── */
.narrative {
    background: #f8fffe;
    border: 1px solid #d1fae5;
    border-radius: var(--radius);
    padding: 14px 18px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.7;
    margin-bottom: 12px;
}

/* ── Data Table ── */
.data-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border: 1px solid var(--card-border);
    border-radius: var(--radius);
    background: var(--card-bg);
}
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
}
.data-table th {
    background: #f8fafb;
    padding: 10px 12px;
    text-align: left;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--text-muted);
    font-weight: 700;
    border-bottom: 2px solid var(--card-border);
    white-space: nowrap;
    position: sticky;
    top: 0;
    z-index: 1;
}
.data-table td {
    padding: 10px 12px;
    border-bottom: 1px solid #f1f5f9;
    white-space: nowrap;
}
.data-table tr:hover { background: #f8fffe; }
.data-table .num { text-align: right; font-family: 'SF Mono', Menlo, monospace; font-size: 0.82rem; }
.health-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 4px;
}
.ar-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.72rem;
    font-weight: 600;
}
.ar-badge-ok { background: #dcfce7; color: #166534; }
.ar-badge-warn { background: #fef3c7; color: #92400e; }
.ar-badge-danger { background: #fef2f2; color: #991b1b; }

/* ── Funnel Strip ── */
.funnel {
    display: flex;
    gap: 2px;
    margin-bottom: 16px;
    overflow-x: auto;
}
.funnel-stage {
    flex: 1;
    min-width: 90px;
    padding: 10px 12px;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius);
    text-align: center;
    position: relative;
}
.funnel-stage .stage-label {
    font-size: 0.65rem;
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.3px;
    margin-bottom: 2px;
}
.funnel-stage .stage-count {
    font-size: 1.2rem;
    font-weight: 800;
}
.funnel-stage .stage-value {
    font-size: 0.72rem;
    color: var(--text-muted);
}
.funnel-arrow {
    display: flex;
    align-items: center;
    color: var(--card-border);
    font-size: 0.9em;
    flex-shrink: 0;
}

/* ── Progress Bar ── */
.progress {
    height: 6px;
    background: #f1f5f9;
    border-radius: 3px;
    overflow: hidden;
    margin: 4px 0;
}
.progress-fill {
    height: 100%;
    border-radius: 3px;
    background: var(--teal);
    transition: width 0.4s;
}

/* ── Sidebar Actions dot ──
 * Red badge shown next to "Actions" in the sidebar when there are unactioned
 * order triggers (#50). Populated globally on every page load by
 * `refreshSidebarActionBadge()` so you can see it from any page.
 */
.sidebar-action-dot {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-left: 6px;
    min-width: 18px;
    height: 16px;
    padding: 0 5px;
    border-radius: 8px;
    background: var(--red, #ef4444);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    line-height: 1;
    vertical-align: middle;
}

/* ── Sub-page pills (mobile-only fallback nav) ──
 * Per-section tabs (Revenue / Performance / Accounts / etc.) rendered at the
 * top of each page. The sidebar already shows the full sub-nav on desktop, so
 * these are redundant there — hidden on desktop, shown on mobile where the
 * sidebar is collapsed behind the hamburger.
 */
.sub-pills {
    display: none;
    flex-wrap: wrap;
    gap: 6px;
    overflow-x: auto;
    padding: 0 0 12px;
    -webkit-overflow-scrolling: touch;
}
.sub-pill {
    padding: 6px 16px;
    background: #f1f5f9;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-muted);
    text-decoration: none;
    white-space: nowrap;
    min-height: 32px;
    display: flex;
    align-items: center;
}
.sub-pill.active { background: var(--teal); color: white; }

/* ── Chart placeholder ── */
.chart-placeholder {
    background: #f8fafb;
    border: 2px dashed var(--card-border);
    border-radius: var(--radius);
    height: 240px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-bottom: 12px;
}

/* ── Responsive overrides ── */
@media (max-width: 768px) {
    .kpi-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
    .kpi-card { padding: 12px; }
    .kpi-card .kpi-value { font-size: 1.3rem; }
    .funnel { flex-wrap: wrap; }
    .funnel-stage { min-width: calc(50% - 4px); }
    .funnel-arrow { display: none; }
    .sub-pills { display: flex; }
    .tab-nav { width: 100%; }
    .tab-btn { flex: 1; text-align: center; }
    .page-title { font-size: 1.5rem; }
    .section-title { font-size: 0.95rem; margin-bottom: 12px; }
    .section { margin-bottom: 22px; }
    .section + .section { padding-top: 16px; }
}
@media (max-width: 480px) {
    .kpi-card .kpi-value { font-size: 1.15rem; }
    .kpi-card .kpi-label { font-size: 0.65rem; }
    .action-card { padding: 10px 12px; }
}
/* ── Hero card mobile ── */
@media (max-width: 768px) {
    .card [style*="font-size:2.8rem"] { font-size: 1.8rem !important; }
    .card [style*="font-size:1.8rem"] { font-size: 1.3rem !important; }
    .card [style*="display:flex"][style*="justify-content:space-between"] { flex-direction: column !important; }
}
@media (pointer: coarse) {
    .kpi-card { min-height: 44px; }
    .tab-btn { min-height: 44px; }
    .schedule-row { min-height: 48px; }
    .action-card { min-height: 48px; }
    .collapsible-header { min-height: 48px; }
}

/* ── Email Triage: Original Email Body ── */
.email-original-body {
    background: var(--bg-sidebar, #f8f9fa);
    border-left: 3px solid var(--border, #dee2e6);
    padding: 12px 16px;
    max-height: 300px;
    overflow-y: auto;
    white-space: pre-wrap;
    font-size: 0.875rem;
    line-height: 1.5;
    color: var(--text-secondary, #495057);
    border-radius: 4px;
    margin-bottom: 12px;
}
.email-thread-separator {
    color: var(--text-muted, #adb5bd);
    border-top: 1px solid var(--border, #e9ecef);
    padding-top: 8px;
    margin-top: 8px;
    font-weight: 600;
    font-size: 0.8rem;
}
.email-section-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted, #6c757d);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

/* ═════════════════════════════════════════════════════════════════════
   v7 Collections Tab — pixel-match to mockup (2026-05-11)
   Spec: docs/specs/v7-collections-tab-ui-detail-2026-05-11.md
   Reference: claude-code-handoff/v7-collections-tab-mockup.html
   Scoped under .v7-collections-light so the dark v2 app theme doesn't bleed.
   ═════════════════════════════════════════════════════════════════════ */

.v7-collections-light {
    /* Light-theme tokens (mockup §2) */
    --v7-ecp-green: #00d4aa;
    --v7-ecp-green-dark: #00a886;
    --v7-ecp-bg: #f4f6f8;
    --v7-ecp-card: #ffffff;
    --v7-ecp-text: #2c3e50;
    --v7-ecp-text-muted: #7f8c8d;
    --v7-ecp-border: #e1e8ed;
    --v7-tier1: #3498db;
    --v7-tier2: #f39c12;
    --v7-tier3: #e67e22;
    --v7-tier4: #e74c3c;
    --v7-tier5: #c0392b;
    --v7-tier6: #8e44ad;
    --v7-edit-bg: #fffceb;
    --v7-edit-border: #f3e8ad;
    --v7-edit-focus: #00754A;
    --v7-settle-on: #00754A;
    --v7-settle-off: #95a5a6;
    --v7-shane-yellow: #fff3cd;
    --v7-table-header-bg: #1F3A5F;
    --v7-table-header-divider: #2d4a73;
    --v7-status-blocked: #e74c3c;
    background: var(--v7-ecp-bg);
    color: var(--v7-ecp-text);
    font-size: 13px;
    border-radius: 8px;
    padding: 1px 0;  /* prevents margin collapse */
}
.v7-collections-light, .v7-collections-light * {
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* ── KPI row (5 cards) ──────────────────────────────────────────── */
.v7-collections-light .v7c-kpis {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px;
    padding: 16px 20px;
}
.v7-collections-light .v7c-kpi {
    background: var(--v7-ecp-card);
    border-radius: 10px;
    padding: 16px 18px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    border-left: 4px solid var(--v7-ecp-green);
}
.v7-collections-light .v7c-kpi.tier5 { border-left-color: var(--v7-tier5); }
.v7-collections-light .v7c-kpi.tier34 { border-left-color: var(--v7-tier3); }
.v7-collections-light .v7c-kpi.tier12 { border-left-color: var(--v7-tier2); }
.v7-collections-light .v7c-kpi.blocked { border-left-color: var(--v7-status-blocked); }
.v7-collections-light .v7c-kpi-label {
    font-size: 11px;
    color: var(--v7-ecp-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
    margin-bottom: 5px;
}
.v7-collections-light .v7c-kpi-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--v7-ecp-text);
    line-height: 1.1;
}
.v7-collections-light .v7c-kpi-sub {
    font-size: 11px;
    color: var(--v7-ecp-text-muted);
    margin-top: 3px;
}

/* ── Action bar ──────────────────────────────────────────────── */
.v7-collections-light .v7c-action-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    background: var(--v7-ecp-card);
    border-top: 1px solid var(--v7-ecp-border);
    border-bottom: 1px solid var(--v7-ecp-border);
    flex-wrap: wrap;
    font-size: 12px;
}
.v7-collections-light .v7c-action-bar label {
    display: flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
}
.v7-collections-light .v7c-count-badge {
    background: var(--v7-ecp-green);
    color: white;
    padding: 3px 9px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
}
.v7-collections-light .v7c-btn {
    padding: 6px 12px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    transition: all 0.15s;
}
.v7-collections-light .v7c-btn-primary { background: var(--v7-ecp-green-dark); color: white; }
.v7-collections-light .v7c-btn-primary:hover { background: var(--v7-ecp-green); }
.v7-collections-light .v7c-btn-primary:disabled { background: #bdc3c7; cursor: not-allowed; }
.v7-collections-light .v7c-btn-secondary {
    background: white; color: var(--v7-ecp-text); border: 1px solid var(--v7-ecp-border);
}
.v7-collections-light .v7c-btn-secondary:hover { background: #f8f9fa; }
.v7-collections-light .v7c-btn-hold {
    background: #fff3cd; color: #856404; border: 1px solid #ffc107;
}
.v7-collections-light .v7c-btn-hold:hover { background: #ffe69c; }

/* ── Sub-tabs ────────────────────────────────────────────────── */
.v7-collections-light .v7c-subtabs {
    display: flex;
    padding: 0 20px;
    background: var(--v7-ecp-card);
    border-bottom: 1px solid var(--v7-ecp-border);
    gap: 0;
}
.v7-collections-light .v7c-subtab {
    padding: 10px 16px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    color: var(--v7-ecp-text-muted);
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
}
.v7-collections-light .v7c-subtab.active {
    color: var(--v7-ecp-green-dark);
    border-bottom-color: var(--v7-ecp-green-dark);
}
.v7-collections-light .v7c-subtab .v7c-tab-count {
    display: inline-block;
    background: #ecf0f1;
    color: var(--v7-ecp-text);
    padding: 1px 6px;
    border-radius: 8px;
    font-size: 10px;
    margin-left: 5px;
    font-weight: 600;
}
.v7-collections-light .v7c-subtab.active .v7c-tab-count {
    background: var(--v7-ecp-green);
    color: white;
}

/* ── Filter bar ──────────────────────────────────────────────── */
.v7-collections-light .v7c-filter-bar {
    display: flex;
    gap: 8px;
    padding: 10px 20px;
    flex-wrap: wrap;
    align-items: center;
    background: var(--v7-ecp-bg);
}
.v7-collections-light .v7c-filter-bar select,
.v7-collections-light .v7c-filter-bar input {
    padding: 6px 10px;
    border: 1px solid var(--v7-ecp-border);
    border-radius: 5px;
    font-size: 12px;
    background: white;
    color: var(--v7-ecp-text);
}
.v7-collections-light .v7c-filter-bar input[type="search"] { min-width: 220px; }

/* ── Table ──────────────────────────────────────────────────── */
.v7-collections-light .v7c-table-wrap {
    margin: 0 20px 20px;
    background: var(--v7-ecp-card);
    border-radius: 8px;
    overflow: auto;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    border: 1px solid var(--v7-ecp-border);
    max-height: 70vh;
}
.v7-collections-light table.v7c-queue {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
    min-width: 1280px;
}
.v7-collections-light table.v7c-queue thead th {
    background: var(--v7-table-header-bg);
    color: white;
    padding: 10px 8px;
    text-align: left;
    font-weight: 600;
    font-size: 10.5px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    border-right: 1px solid var(--v7-table-header-divider);
    position: sticky;
    top: 0;
    z-index: 2;
    white-space: nowrap;
}
.v7-collections-light table.v7c-queue thead th:last-child { border-right: none; }
.v7-collections-light table.v7c-queue thead th.v7c-right { text-align: right; }
.v7-collections-light table.v7c-queue thead th.v7c-center { text-align: center; }
.v7-collections-light table.v7c-queue tbody td {
    padding: 8px 8px;
    border-bottom: 1px solid #f0f2f5;
    vertical-align: top;
    color: var(--v7-ecp-text);
}
.v7-collections-light table.v7c-queue tbody tr:hover td { background: #fafbfc; }
.v7-collections-light table.v7c-queue tbody tr.v7c-shane-held { background: var(--v7-shane-yellow); }
.v7-collections-light table.v7c-queue tbody tr.v7c-shane-held:hover td { background: #fff0a8; }
.v7-collections-light table.v7c-queue tbody tr.v7c-selected td { background: #e8f8f5; }
.v7-collections-light td.v7c-right { text-align: right; }
.v7-collections-light td.v7c-center { text-align: center; }

/* Column widths */
.v7-collections-light table.v7c-queue thead th.v7c-col-check    { width: 32px; }
.v7-collections-light table.v7c-queue thead th.v7c-col-status   { width: 90px; }
.v7-collections-light table.v7c-queue thead th.v7c-col-account  { min-width: 220px; }
.v7-collections-light table.v7c-queue thead th.v7c-col-pastdue  { width: 90px; }
.v7-collections-light table.v7c-queue thead th.v7c-col-aging    { width: 80px; }
.v7-collections-light table.v7c-queue thead th.v7c-col-days     { width: 56px; }
.v7-collections-light table.v7c-queue thead th.v7c-col-open     { width: 60px; }
.v7-collections-light table.v7c-queue thead th.v7c-col-avgpay   { width: 72px; }
.v7-collections-light table.v7c-queue thead th.v7c-col-risk     { width: 56px; }
.v7-collections-light table.v7c-queue thead th.v7c-col-suggest  { width: 66px; }
.v7-collections-light table.v7c-queue thead th.v7c-col-tier     { width: 110px; }
.v7-collections-light table.v7c-queue thead th.v7c-col-settle   { width: 130px; }
.v7-collections-light table.v7c-queue thead th.v7c-col-buyer    { min-width: 190px; }
.v7-collections-light table.v7c-queue thead th.v7c-col-ar       { min-width: 190px; }
.v7-collections-light table.v7c-queue thead th.v7c-col-history  { min-width: 160px; }
.v7-collections-light table.v7c-queue thead th.v7c-col-actions  { width: 130px; }

/* ── Status badges ─────────────────────────────────────────── */
.v7-collections-light .v7c-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 9px;
    border-radius: 12px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    white-space: nowrap;
}
.v7-collections-light .v7c-badge.ready    { background: #d4f4dd; color: #155724; }
.v7-collections-light .v7c-badge.review   { background: #fff3cd; color: #856404; }
.v7-collections-light .v7c-badge.no_email { background: #ffe0cc; color: #c46b13; }
.v7-collections-light .v7c-badge.no_llmatch { background: #ffe0cc; color: #c46b13; }
.v7-collections-light .v7c-badge.skip     { background: #e8d8ff; color: #5b21b6; }
.v7-collections-light .v7c-badge.sent     { background: #d4f4dd; color: #155724; }
.v7-collections-light .v7c-badge.held     { background: #fff3cd; color: #856404; }
.v7-collections-light .v7c-badge.approved { background: #c1e8d8; color: #0d5e3f; }

/* Account cell sub-text */
.v7-collections-light .v7c-acct-name { font-weight: 600; }
.v7-collections-light .v7c-acct-sub {
    font-size: 11px;
    color: var(--v7-ecp-text-muted);
    margin-top: 2px;
    display: block;
}

/* Risk pill */
.v7-collections-light .v7c-risk-pill {
    display: inline-block;
    font-size: 11px;
    padding: 3px 8px;
    border-radius: 10px;
    font-weight: 700;
    min-width: 38px;
    text-align: center;
}
.v7-collections-light .v7c-risk-pill.low  { background: #d4f4dd; color: #155724; }
.v7-collections-light .v7c-risk-pill.mid  { background: #fff3cd; color: #856404; }
.v7-collections-light .v7c-risk-pill.high { background: #ffd4d4; color: #842029; }

/* Tier label (read-only, "Suggest" column) */
.v7-collections-light .v7c-tier-label {
    display: inline-block;
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 600;
    background: #ecf0f1;
    color: var(--v7-ecp-text);
}
.v7-collections-light .v7c-tier-label.bump {
    background: #fde8d3;
    color: #c46b13;
    font-style: italic;
}

/* Tier dropdown (editable, "Tier to Send" column) */
.v7-collections-light .v7c-tier-select {
    width: 100%;
    padding: 5px 8px;
    border: 1.5px solid var(--v7-edit-focus);
    border-radius: 5px;
    background: var(--v7-edit-bg);
    font-size: 12px;
    font-weight: 700;
    color: var(--v7-ecp-text);
    cursor: pointer;
}
.v7-collections-light .v7c-tier-select:focus {
    outline: 2px solid var(--v7-ecp-green);
    outline-offset: -1px;
}
.v7-collections-light .v7c-tier-select:disabled {
    background: #f5f5f5;
    color: #888;
    border-color: var(--v7-ecp-border);
    cursor: not-allowed;
}

/* Settlement toggle */
.v7-collections-light .v7c-settle-cell {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}
.v7-collections-light .v7c-settle-toggle {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    user-select: none;
    background: var(--v7-edit-bg);
    border: 1.5px solid var(--v7-edit-focus);
    border-radius: 14px;
    padding: 2px 8px 2px 4px;
    font-size: 11px;
    font-weight: 600;
}
.v7-collections-light .v7c-settle-toggle input { margin: 0; cursor: pointer; }
.v7-collections-light .v7c-settle-toggle .label-on { color: var(--v7-settle-on); }
.v7-collections-light .v7c-settle-toggle .label-off { color: var(--v7-settle-off); }
.v7-collections-light .v7c-settle-toggle.disabled {
    background: #f5f5f5;
    border-color: var(--v7-ecp-border);
    cursor: not-allowed;
    opacity: 0.5;
}
.v7-collections-light .v7c-settle-amount {
    font-size: 11px;
    font-weight: 600;
    color: var(--v7-settle-on);
}
.v7-collections-light .v7c-settle-amount-detail {
    font-size: 10px;
    color: var(--v7-ecp-text-muted);
}

/* Inline edit text input */
.v7-collections-light .v7c-inline-edit {
    padding: 4px 7px;
    border: 1px dashed var(--v7-ecp-border);
    border-radius: 4px;
    background: var(--v7-edit-bg);
    font-size: 12px;
    width: 100%;
    cursor: text;
    color: var(--v7-ecp-text);
    transition: border 0.15s;
}
.v7-collections-light .v7c-inline-edit:hover { border-color: var(--v7-edit-focus); }
.v7-collections-light .v7c-inline-edit:focus {
    outline: none;
    border-color: var(--v7-edit-focus);
    border-style: solid;
    background: white;
}
.v7-collections-light .v7c-inline-edit.empty {
    color: #999;
    font-style: italic;
}

/* Contact cell (two-line: name + email) */
.v7-collections-light .v7c-contact-block {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.v7-collections-light .v7c-contact-name {
    font-size: 11px;
    color: var(--v7-ecp-text-muted);
}
.v7-collections-light .v7c-contact-email {
    font-size: 12px;
    font-weight: 500;
    color: var(--v7-ecp-text);
    cursor: pointer;
}
.v7-collections-light .v7c-contact-email:hover { text-decoration: underline; text-decoration-style: dashed; text-decoration-color: var(--v7-edit-focus); }

/* Domain tag (small pill next to email) */
.v7-collections-light .v7c-domain-tag {
    display: inline-block;
    font-size: 9.5px;
    padding: 1px 6px;
    border-radius: 8px;
    margin-left: 4px;
    font-weight: 600;
    vertical-align: 1px;
}
.v7-collections-light .v7c-domain-tag.pass        { background: #d4f4dd; color: #155724; }
.v7-collections-light .v7c-domain-tag.personal    { background: #fff3cd; color: #856404; }
.v7-collections-light .v7c-domain-tag.no_overlap  { background: #fff3cd; color: #856404; }
.v7-collections-light .v7c-domain-tag.missing     { background: #ffd4d4; color: #842029; }
.v7-collections-light .v7c-domain-tag.internal    { background: #c0392b; color: white; font-weight: 700; }

/* Prior Letters cell */
.v7-collections-light .v7c-history {
    font-size: 11px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.v7-collections-light .v7c-hist-line {
    display: flex;
    gap: 6px;
    align-items: baseline;
}
.v7-collections-light .v7c-hist-tier {
    font-weight: 700;
    font-size: 9.5px;
    padding: 1px 5px;
    border-radius: 3px;
    color: white;
}
.v7-collections-light .v7c-hist-tier.t1 { background: var(--v7-tier1); }
.v7-collections-light .v7c-hist-tier.t2 { background: var(--v7-tier2); }
.v7-collections-light .v7c-hist-tier.t3 { background: var(--v7-tier3); }
.v7-collections-light .v7c-hist-tier.t4 { background: var(--v7-tier4); }
.v7-collections-light .v7c-hist-tier.t5 { background: var(--v7-tier5); }
.v7-collections-light .v7c-hist-date { color: var(--v7-ecp-text-muted); }
.v7-collections-light .v7c-hist-status { font-size: 10px; color: var(--v7-ecp-text-muted); }
.v7-collections-light .v7c-history .empty-msg {
    color: var(--v7-ecp-text-muted);
    font-style: italic;
    font-size: 11px;
}

/* Action buttons (column 14) */
.v7-collections-light .v7c-actions {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}
.v7-collections-light .v7c-action-btn {
    padding: 4px 8px;
    border: 1px solid var(--v7-ecp-border);
    border-radius: 4px;
    background: white;
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    color: var(--v7-ecp-text);
}
.v7-collections-light .v7c-action-btn:hover { background: #f8f9fa; border-color: #c8d0d8; }
.v7-collections-light .v7c-action-btn.primary {
    background: var(--v7-ecp-green-dark);
    color: white;
    border-color: var(--v7-ecp-green-dark);
}
.v7-collections-light .v7c-action-btn.primary:hover { background: var(--v7-ecp-green); }

/* Expand row (settlement detail) */
.v7-collections-light tr.v7c-expand td {
    background: #f8f9fa;
    padding: 12px 20px 18px;
}
.v7-collections-light .v7c-expand h4 {
    font-size: 13px;
    margin-bottom: 8px;
    color: var(--v7-ecp-text);
}
.v7-collections-light .v7c-invoice-math {
    width: 100%;
    border-collapse: collapse;
    font-size: 11px;
}
.v7-collections-light .v7c-invoice-math th,
.v7-collections-light .v7c-invoice-math td {
    padding: 5px 10px;
    border-bottom: 1px solid var(--v7-ecp-border);
    text-align: left;
}
.v7-collections-light .v7c-invoice-math th {
    background: white;
    font-weight: 600;
    color: var(--v7-ecp-text-muted);
    text-transform: uppercase;
    font-size: 10px;
}
.v7-collections-light .v7c-invoice-math td.v7c-right { text-align: right; }
.v7-collections-light .v7c-invoice-math tr.total td {
    font-weight: 700;
    border-top: 2px solid var(--v7-ecp-text);
    background: #ecf0f1;
}

/* Save state visual cues */
.v7-collections-light .v7c-edit-pending {
    display: inline-block;
    width: 8px; height: 8px;
    border: 2px solid var(--v7-edit-focus);
    border-top-color: transparent;
    border-radius: 50%;
    animation: v7cSpin 0.6s linear infinite;
    margin-left: 4px;
    vertical-align: middle;
}
@keyframes v7cSpin { to { transform: rotate(360deg); } }
.v7-collections-light .v7c-edit-success { animation: v7cFlash 0.8s; }
@keyframes v7cFlash { 0% { background: #c1e8d8 !important; } 100% { background: transparent !important; } }

/* Legend at bottom */
.v7-collections-light .v7c-legend {
    padding: 14px 20px;
    background: var(--v7-ecp-card);
    border-top: 1px solid var(--v7-ecp-border);
    font-size: 11px;
    color: var(--v7-ecp-text-muted);
    line-height: 1.6;
}
.v7-collections-light .v7c-legend strong { color: var(--v7-ecp-text); }

/* Loading / error states */
.v7-collections-light .v7c-loading,
.v7-collections-light .v7c-empty,
.v7-collections-light .v7c-error {
    padding: 50px 20px;
    text-align: center;
    color: var(--v7-ecp-text-muted);
}
.v7-collections-light .v7c-spinner {
    display: inline-block;
    width: 36px; height: 36px;
    border: 3px solid var(--v7-ecp-border);
    border-top-color: var(--v7-ecp-green);
    border-radius: 50%;
    animation: v7cSpin 0.8s linear infinite;
    margin-bottom: 12px;
}

/* Recent Edits sub-tab table (different layout from main queue) */
.v7-collections-light .v7c-recent-edits {
    background: var(--v7-ecp-card);
    margin: 0 20px 20px;
    padding: 14px;
    border-radius: 8px;
    border: 1px solid var(--v7-ecp-border);
}
.v7-collections-light .v7c-recent-edits h4 {
    font-size: 13px;
    margin-bottom: 8px;
    color: var(--v7-ecp-text);
}
.v7-collections-light .v7c-recent-edits table {
    width: 100%;
    border-collapse: collapse;
    font-size: 11px;
}
.v7-collections-light .v7c-recent-edits th {
    background: var(--v7-table-header-bg);
    color: white;
    padding: 6px 8px;
    text-align: left;
    font-size: 10px;
    text-transform: uppercase;
}
.v7-collections-light .v7c-recent-edits td {
    padding: 5px 8px;
    border-bottom: 1px solid #f0f2f5;
    color: var(--v7-ecp-text);
}
.v7-collections-light .v7c-recent-edits code {
    background: #ecf0f1;
    padding: 1px 4px;
    border-radius: 2px;
    font-size: 10px;
}

/* ── Past-due drilldown drawer (Matt 2026-05-11 ask: invoices + LL deep links + LL name resolution) ── */
.v7-collections-light .v7c-pd-clickable { transition: background 0.15s; }
.v7-collections-light .v7c-pd-clickable:hover { background: #f0f7ff !important; }
.v7-collections-light .v7c-ll-link { color: var(--v7-ecp-green-dark); text-decoration: none; font-weight: 500; }
.v7-collections-light .v7c-ll-link:hover { text-decoration: underline; }

.v7-collections-light .v7c-ll-resolve {
    background: white;
    border: 1px solid var(--v7-ecp-border);
    border-radius: 6px;
    padding: 12px 14px;
    font-size: 11px;
}
.v7-collections-light .v7c-ll-resolve.focus {
    border-color: var(--v7-edit-focus);
    background: var(--v7-edit-bg);
    box-shadow: 0 0 0 3px rgba(0, 117, 74, 0.08);
}
.v7-collections-light .v7c-ll-resolve-title {
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--v7-ecp-text);
}
.v7-collections-light .v7c-ll-resolve-current {
    color: var(--v7-ecp-text);
    margin-bottom: 8px;
    line-height: 1.5;
    word-break: break-word;
}
.v7-collections-light .v7c-ll-resolve-actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}
.v7-collections-light .v7c-ll-edit-panel {
    margin-top: 10px;
    padding: 8px;
    background: white;
    border: 1px solid var(--v7-ecp-border);
    border-radius: 5px;
}
.v7-collections-light .v7c-ll-suggestions {
    max-height: 180px;
    overflow-y: auto;
    border: 1px solid var(--v7-ecp-border);
    border-radius: 4px;
    margin-top: 6px;
    background: white;
}
.v7-collections-light .v7c-ll-suggestion {
    padding: 5px 8px;
    font-size: 11px;
    cursor: pointer;
    border-bottom: 1px solid #f0f2f5;
    color: var(--v7-ecp-text);
}
.v7-collections-light .v7c-ll-suggestion:last-child { border-bottom: none; }
.v7-collections-light .v7c-ll-suggestion:hover { background: #e8f8f5; }

/* ── Two-line Account cell: QB + LL names side-by-side for visual verification ── */
.v7-collections-light .v7c-acct-ll-wrap {
    position: relative;
    display: block;
}
.v7-collections-light .v7c-acct-qb-line {
    font-size: 12px;
    color: var(--v7-ecp-text);
    line-height: 1.3;
    margin-bottom: 2px;
}
.v7-collections-light .v7c-acct-qb-line strong { font-weight: 700; }
.v7-collections-light .v7c-acct-ll-line {
    display: flex;
    align-items: baseline;
    gap: 6px;
    font-size: 11.5px;
    line-height: 1.3;
    padding: 2px 6px;
    border-radius: 4px;
    cursor: pointer;
    transition: box-shadow 0.15s, background 0.15s;
}
.v7-collections-light .v7c-acct-ll-line.matched   { background: #e8f5ed; color: #155724; }
.v7-collections-light .v7c-acct-ll-line.proposed  { background: #fff5d6; color: #856404; }
.v7-collections-light .v7c-acct-ll-line.unmatched { background: #fde2e2; color: #842029; }
.v7-collections-light .v7c-acct-ll-line.excluded  { background: #f0eafa; color: #5b21b6; }
.v7-collections-light .v7c-acct-ll-line:hover { box-shadow: 0 0 0 2px rgba(0,117,74,0.2); }
.v7-collections-light .v7c-acct-ll-line.open  { box-shadow: 0 0 0 2px var(--v7-edit-focus); }
.v7-collections-light .v7c-ll-icon {
    font-weight: 700;
    font-size: 12px;
    flex-shrink: 0;
    width: 14px;
    text-align: center;
}
.v7-collections-light .v7c-ll-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* "QB" / "LL" tags so the system source is unambiguous */
.v7-collections-light .v7c-name-tag {
    display: inline-block;
    font-size: 8.5px;
    padding: 1px 5px;
    border-radius: 3px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: white;
    flex-shrink: 0;
}
.v7-collections-light .v7c-name-tag.qb { background: #4a6da7; }
.v7-collections-light .v7c-name-tag.ll { background: #00754A; }

.v7-collections-light .v7c-acct-ll-popover {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    z-index: 200;
    background: white;
    border: 1.5px solid var(--v7-edit-focus);
    border-radius: 8px;
    padding: 12px;
    box-shadow: 0 6px 18px rgba(0,0,0,0.15);
    min-width: 360px;
    max-width: 480px;
}
.v7-collections-light .v7c-acct-ll-popover .v7c-ll-suggestions {
    max-height: 200px;
}
