/* ARCHITECTURE: Inline Problem Approval UI (Phase 1)
   WHY: Replaces blocking modal with integrated workflow in the right column
   NOTE: Styles adapted from previous modal implementation */

/* FIX #2 (2025-11-29): Fixed scrolling with absolute positioning
   BUG: height: 100% didn't work because parent (.column-content) had no explicit height
   SYMPTOM: Container grew to fit content; footer pushed below viewport; no scrolling
   ROOT CAUSE: Flex height chain broken - height: 100% needs explicit parent height
   FIX: Use position: absolute; inset: 0 to get concrete height from parent's computed size
   DEPENDS: .column-content must have position: relative (added in layout.css) */
.problem-approval-container {
    position: absolute;
    inset: 0;  /* Fills parent's computed dimensions */
    display: flex;
    flex-direction: column;
    min-height: 0;  /* Critical: allows flex children to shrink below content size */
    background: var(--bg-secondary, #0f172a);
    border-radius: 16px;
    overflow: hidden;  /* Children handle their own scrolling */
    border: 1px solid var(--border-color, rgba(148, 163, 184, 0.2));
    z-index: 10;  /* Above sibling elements in .column-content */
}

.problem-approval-container.hidden {
    display: none;
}

/* When modal is visible, prevent parent from scrolling (modal handles its own scrolling) */
.column-content:has(.problem-approval-container:not(.hidden)) {
    overflow: hidden;
}

.problem-approval-header {
    flex-shrink: 0;  /* Never shrink - always visible */
    padding: 20px 24px;
    background: var(--bg-primary, #1e293b);
    border-bottom: 1px solid var(--border-color, rgba(148, 163, 184, 0.2));
}

.problem-approval-header h3 {
    margin: 4px 0 8px;
    font-size: 20px;
    color: var(--text-primary, #e2e8f0);
}

.problem-approval-header p {
    margin: 0;
    color: var(--text-secondary, #94a3b8);
    font-size: 14px;
    line-height: 1.5;
}

.problem-modal-eyebrow {
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-size: 11px;
    color: var(--text-tertiary, #94a3b8);
}

.problem-modal-metrics {
    display: flex;
    gap: 12px;
    margin-top: 16px;
    flex-wrap: wrap;
}

.problem-metric-card {
    background: var(--bg-tertiary, rgba(15, 23, 42, 0.5));
    border: 1px solid var(--border-color, rgba(148, 163, 184, 0.2));
    border-radius: 12px;
    padding: 10px 14px;
    flex: 1;
    min-width: 100px;
}

.problem-metric-card span {
    display: block;
    font-size: 11px;
    color: var(--text-secondary, #94a3b8);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 4px;
}

.problem-metric-card strong {
    display: block;
    font-size: 20px;
    color: var(--text-primary, #f8fafc);
    line-height: 1.2;
}

.problem-metric-card .problem-metric-value strong {
    display: inline-flex;
    margin-top: 0;
}

.problem-metric-value {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 6px;
}

.metric-processing {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--brand-primary, #a5b4fc);
    background: rgba(79, 70, 229, 0.18);
    border-radius: 999px;
    padding: 2px 10px;
    text-transform: none;
    letter-spacing: 0;
}

.metric-processing-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor;
    animation: metricPulse 1.2s ease-in-out infinite;
}

@keyframes metricPulse {
    0% {
        opacity: 0.3;
        transform: scale(0.8);
    }
    50% {
        opacity: 1;
        transform: scale(1);
    }
    100% {
        opacity: 0.3;
        transform: scale(0.8);
    }
}

/* Phase 1 Completion Indicator */
.phase1-status {
    margin-top: 16px;
}

.phase1-status.hidden {
    display: none;
}

.phase1-complete-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: rgba(34, 197, 94, 0.12);
    color: #22c55e;
    border: 1px solid rgba(34, 197, 94, 0.25);
    border-radius: 10px;
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0.01em;
}

.problem-approval-body {
    flex: 1;
    min-height: 0;  /* Critical: enables overflow-y to work in flex container */
    overflow: hidden;  /* FIX (2025-12-10): Changed from auto to hidden - children handle scroll */
    padding: 16px;
    background: var(--bg-secondary, #0f172a);
}

/* NOTE: .problem-modal-content grid layout is defined in Phase 2 section below (line ~1424)
   flex-direction and gap are now on .approval-main-content child element */

.problem-section {
    background: rgba(15, 23, 42, 0.55);
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 20px;
    padding: 16px 18px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.problem-section--subtle {
    background: rgba(15, 23, 42, 0.4);
}

.problem-section-header {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
    color: var(--text-primary, #e2e8f0);
}

.problem-section-header h4 {
    margin: 4px 0;
    font-size: 20px;
}

.problem-section-description {
    font-size: 13px;
    color: var(--text-secondary, #94a3b8);
}

.problem-section-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.problem-count-pill {
    padding: 6px 14px;
    background: rgba(79, 70, 229, 0.15);
    border-radius: 999px;
    font-size: 13px;
    color: var(--brand-primary, #a5b4fc);
}

/* NOTE: #merge-selected-btn removed from UI (2025-12-09)
   Merge functionality now via context menu on individual problems */

/* FIX (2025-12-09): Removed overflow-y: auto to eliminate nested scroll
   Parent .problem-approval-body handles all scrolling for single-scroll UX
   PREVIOUS FIX (2025-11-29): Removed fixed 55vh cap for flex layout */
.problem-list-scroll {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.problem-card {
    border-radius: 16px;
    border: 1px solid rgba(148, 163, 184, 0.25);
    padding: 14px 18px;
    background: rgba(15, 23, 42, 0.8);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.problem-card.is-selected {
    border-color: var(--brand-primary, #6366f1);
    box-shadow: 0 10px 24px rgba(79, 70, 229, 0.25);
}

.problem-card-header {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 14px;
}

.problem-card-header input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.problem-card-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    color: var(--text-primary, #f8fafc);
}

.problem-origin-pill {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.3);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.problem-origin-pill.ai {
    background: rgba(79, 70, 229, 0.2);
    color: #c7d2fe;
}

.problem-origin-pill.manual {
    background: rgba(56, 189, 248, 0.2);
    color: #bae6fd;
}

.confidence-chip {
    font-size: 12px;
    color: var(--text-secondary, #cbd5f5);
}

.problem-card-body {
    margin-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.problem-merge-flag {
    font-size: 12px;
    padding: 6px 10px;
    border-radius: 10px;
    background: rgba(14, 165, 233, 0.2);
    color: #bae6fd;
}

.problem-merge-flag.ai {
    background: rgba(52, 211, 153, 0.2);
    color: #bbf7d0;
}

.problem-meta-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    font-size: 12px;
    color: var(--text-secondary, #a5b4fc);
}

.trend-pill {
    text-transform: capitalize;
    padding: 4px 10px;
    border-radius: 999px;
    font-weight: 600;
    background: rgba(248, 250, 252, 0.05);
}

.trend-pill.trend-worsening {
    color: #fecdd3;
    background: rgba(248, 113, 113, 0.18);
}

.trend-pill.trend-improving {
    color: #bbf7d0;
    background: rgba(74, 222, 128, 0.18);
}

.trend-pill.trend-stable {
    color: #fde68a;
    background: rgba(251, 191, 36, 0.18);
}

.problem-quote {
    padding: 12px 14px;
    border-radius: 12px;
    background: rgba(15, 118, 110, 0.2);
    color: #99f6e4;
    font-style: italic;
    font-size: 13px;
}

.problem-key-data {
    list-style: disc;
    margin: 0 0 0 18px;
    padding: 0;
    color: var(--text-secondary, #cbd5f5);
    font-size: 13px;
}

/* FIX (2025-12-09): Removed overflow-y: auto to eliminate nested scroll
   Parent .problem-approval-body handles all scrolling for single-scroll UX
   PREVIOUS FIX (2025-11-29): Removed fixed 32vh cap for inline container layout */
#consolidations-list {
    display: flex;
    flex-direction: column;
    gap: 8px;  /* Compact: was 14px */
}

.consolidation-card {
    border-radius: 12px;  /* Compact: was 16px */
    border: 1px solid rgba(148, 163, 184, 0.3);
    padding: 10px 14px;  /* Compact: was 16px 18px */
    background: rgba(30, 41, 59, 0.75);
    display: flex;
    flex-direction: column;
    gap: 6px;  /* Compact: was 10px */
}

.consolidation-card-header {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    color: var(--text-primary, #f8fafc);
}

.consolidation-members {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.consolidation-member-pill {
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.7);
    color: var(--text-secondary, #cbd5f5);
    font-size: 12px;
    border: 1px solid rgba(148, 163, 184, 0.3);
}

.consolidation-rationale {
    font-size: 12px;  /* Compact: was 13px */
    color: var(--text-secondary, #cbd5f5);
    margin: 0;
    line-height: 1.3;  /* Compact: was 1.4 */
}

.consolidation-actions {
    display: flex;
    justify-content: flex-end;
    gap: 6px;  /* Compact spacing between buttons */
}

.apply-consolidation-btn {
    border: none;
    background: linear-gradient(120deg, #4f46e5, #7c3aed);
    color: #fff;
    padding: 5px 12px;  /* Compact: was 8px 16px */
    border-radius: 8px;  /* Compact: was 12px */
    font-size: 12px;  /* Compact */
    font-weight: 600;
    cursor: pointer;
}

.problem-manual-add {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.problem-manual-add input {
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid rgba(148, 163, 184, 0.3);
    background: rgba(15, 23, 42, 0.8);
    color: var(--text-primary, #f8fafc);
}

.problem-manual-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.problem-manual-actions button {
    padding: 10px 18px;
    border-radius: 12px;
    border: none;
    font-weight: 600;
    cursor: pointer;
}

.problem-approval-footer {
    flex-shrink: 0;  /* Never shrink - always visible */
    padding: 16px 24px 24px;  /* Extra bottom padding to ensure button fully visible */
    background: var(--bg-primary, #1e293b);
    border-top: 1px solid var(--border-color, rgba(148, 163, 184, 0.2));
    border-radius: 0 0 16px 16px;  /* Match container corners */
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}

.problem-footer-info {
    color: var(--text-secondary, #94a3b8);
    font-size: 13px;
}

.problem-footer-actions {
    display: flex;
    gap: 12px;
}

.problem-footer-actions button {
    border-radius: 999px;
    padding: 12px 22px;
    font-weight: 600;
    cursor: pointer;
    border: none;
}

.problem-footer-secondary {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary, #f8fafc);
    border: 1px solid rgba(148, 163, 184, 0.3);
}

.problem-footer-primary {
    background: linear-gradient(120deg, #4f46e5, #7c3aed);
    color: #fff;
}

.problem-modal-state {
    text-align: center;
    color: var(--text-primary, #e2e8f0);
    padding: 80px 20px;
}

.problem-modal-state--error {
    border: 1px solid rgba(248, 113, 113, 0.4);
    border-radius: 16px;
    background: rgba(248, 113, 113, 0.1);
}

.problem-modal-state--error strong {
    display: block;
    margin-bottom: 8px;
}

/* ========== RESPONSIVE BREAKPOINTS (FIX 2025-12-09) ========== */
/* BUG: Only one breakpoint at 1200px, mobile/tablet unusable */
/* ROOT CAUSE: Missing responsive design for smaller screens */
/* FIX: Add breakpoints for tablet (768px), mobile (480px), small desktop (900px) */

/* Large tablet / small desktop */
@media (max-width: 1200px) {
    .problem-modal-metrics {
        flex-wrap: wrap;
    }

    .problem-metric-card {
        min-width: 45%;
    }
}

/* Small desktop */
@media (max-width: 900px) {
    .problem-approval-header {
        padding: 16px;
    }

    .problem-modal-metrics {
        gap: 8px;
    }

    .problem-metric-card {
        min-width: 100%;
        padding: 12px;
    }

    .problem-approval-body {
        padding: 12px;
    }

    .problem-card {
        padding: 12px;
    }
}

/* Tablet */
@media (max-width: 768px) {
    .problem-approval-header h3 {
        font-size: 18px;
    }

    .problem-approval-footer {
        flex-direction: column;
        gap: 12px;
        padding: 12px;
    }

    .problem-footer-actions {
        width: 100%;
        flex-direction: column;
    }

    .problem-footer-actions button {
        width: 100%;
        justify-content: center;
    }

    .problem-card-header {
        flex-wrap: wrap;
        gap: 8px;
    }

    .problem-card-title {
        font-size: 14px;
    }

    .suggestion-card {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .suggestion-card .suggestion-actions {
        width: 100%;
        display: flex;
        justify-content: flex-end;
    }

    .unified-merge-card {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .unified-merge-card .merge-actions {
        width: 100%;
        justify-content: flex-end;
    }
}

/* Mobile */
@media (max-width: 480px) {
    .problem-approval-container {
        border-radius: 0;
    }

    .problem-approval-header {
        padding: 12px;
    }

    .problem-approval-header h3 {
        font-size: 16px;
    }

    .problem-approval-body {
        padding: 8px;
    }

    .problem-card {
        padding: 10px;
        border-radius: 8px;
    }

    .problem-metric-card {
        padding: 10px;
    }

    .problem-metric-value {
        font-size: 20px;
    }

    .severity-group-header {
        padding: 10px 12px;
        font-size: 13px;
    }

    .problem-footer-actions button {
        padding: 12px 16px;
        font-size: 14px;
    }
}

/* ========== PHASE 4-5: CONSOLIDATION REDESIGN STYLES ========== */

/* Suggested Actions Section */
.suggested-actions-section {
    background: linear-gradient(135deg, rgba(251, 191, 36, 0.08), rgba(251, 191, 36, 0.04));
    border: 1px solid rgba(251, 191, 36, 0.3);
    border-radius: 16px;
    padding: 16px;
    margin-bottom: 16px;
}

.suggested-actions-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
    color: #fde68a;
    font-weight: 600;
}

.suggested-actions-header i {
    font-size: 18px;
}

.suggestion-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    background: rgba(15, 23, 42, 0.6);
    border-radius: 12px;
    margin-bottom: 8px;
    border: 1px solid rgba(148, 163, 184, 0.2);
}

.suggestion-card:last-child {
    margin-bottom: 0;
}

.suggestion-card.is-processing {
    opacity: 0.7;
}

.suggestion-card.is-complete {
    opacity: 0.55;
    border-style: dashed;
}

.suggestion-card.has-error {
    border-color: rgba(248, 113, 113, 0.5);
}

.suggestion-info {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
}

.suggestion-icon {
    font-size: 16px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
}

.suggestion-icon.merge {
    background: rgba(79, 70, 229, 0.2);
    color: #a5b4fc;
}

.suggestion-icon.duplicate {
    background: rgba(251, 191, 36, 0.2);
    color: #fde68a;
}

.suggestion-text {
    font-size: 13px;
    color: var(--text-primary, #e2e8f0);
}

.suggestion-text .child-name {
    color: #fbbf24;
    font-weight: 600;
}

.suggestion-text .parent-name {
    color: #a5b4fc;
    font-weight: 600;
}

.suggestion-actions {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
}

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

.suggestion-btn {
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
}

.suggestion-btn.accept {
    background: rgba(52, 211, 153, 0.2);
    color: #6ee7b7;
}

.suggestion-btn.accept:hover {
    background: rgba(52, 211, 153, 0.35);
}

.suggestion-btn.dismiss {
    background: rgba(148, 163, 184, 0.15);
    color: #94a3b8;
}

.suggestion-btn.dismiss:hover {
    background: rgba(148, 163, 184, 0.25);
}

.suggestion-btn[disabled],
.suggestion-btn[aria-disabled="true"] {
    opacity: 0.4;
    cursor: not-allowed;
}

.suggestion-status {
    font-size: 12px;
    color: #a5b4fc;
    min-height: 16px;
}

.suggestion-status[data-variant="success"] {
    color: #34d399;
}

.suggestion-status[data-variant="error"] {
    color: #f87171;
}

/* Severity Group Sections */
.severity-group {
    margin-bottom: 12px;
    border-radius: 16px;
    overflow: hidden;
}

.severity-group-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    cursor: pointer;
    transition: background 0.2s;
}

.severity-group-header:hover {
    filter: brightness(1.1);
}

.severity-group-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    font-size: 14px;
}

.severity-group-count {
    font-size: 12px;
    padding: 2px 8px;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.2);
}

.severity-group-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
}

/* Critical/Worsening - Red */
.severity-group.critical {
    background: rgba(248, 113, 113, 0.12);
    border: 1px solid rgba(248, 113, 113, 0.35);
}

.severity-group.critical .severity-group-header {
    background: rgba(248, 113, 113, 0.15);
    color: #fecdd3;
}

.severity-group.critical .severity-group-icon {
    color: #f87171;
}

/* Improving - Green */
.severity-group.improving {
    background: rgba(52, 211, 153, 0.12);
    border: 1px solid rgba(52, 211, 153, 0.35);
}

.severity-group.improving .severity-group-header {
    background: rgba(52, 211, 153, 0.15);
    color: #bbf7d0;
}

.severity-group.improving .severity-group-icon {
    color: #34d399;
}

/* Active - Blue */
.severity-group.active {
    background: rgba(56, 189, 248, 0.12);
    border: 1px solid rgba(56, 189, 248, 0.35);
}

.severity-group.active .severity-group-header {
    background: rgba(56, 189, 248, 0.15);
    color: #bae6fd;
}

.severity-group.active .severity-group-icon {
    color: #38bdf8;
}

/* Stable Chronic - Yellow/Amber */
.severity-group.chronic {
    background: rgba(251, 191, 36, 0.08);
    border: 1px solid rgba(251, 191, 36, 0.25);
}

.severity-group.chronic .severity-group-header {
    background: rgba(251, 191, 36, 0.12);
    color: #fde68a;
}

.severity-group.chronic .severity-group-icon {
    color: #fbbf24;
}

/* Labs - Purple */
.severity-group.labs {
    background: rgba(139, 92, 246, 0.08);
    border: 1px solid rgba(139, 92, 246, 0.25);
}

.severity-group.labs .severity-group-header {
    background: rgba(139, 92, 246, 0.12);
    color: #ddd6fe;
}

.severity-group.labs .severity-group-icon {
    color: #a78bfa;
}

/* Findings - Gray */
.severity-group.findings {
    background: rgba(148, 163, 184, 0.08);
    border: 1px solid rgba(148, 163, 184, 0.2);
}

.severity-group.findings .severity-group-header {
    background: rgba(148, 163, 184, 0.1);
    color: #cbd5e1;
}

.severity-group.findings .severity-group-icon {
    color: #94a3b8;
}

/* Resolved - Muted */
.severity-group.resolved {
    background: rgba(100, 116, 139, 0.08);
    border: 1px solid rgba(100, 116, 139, 0.2);
}

.severity-group.resolved .severity-group-header {
    background: rgba(100, 116, 139, 0.1);
    color: #94a3b8;
}

.severity-group-body {
    padding: 8px 12px 12px;
}

.severity-group-body.collapsed {
    display: none;
}

/* Auto-bundle Toggle Switch */
.auto-bundle-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
}

.toggle-switch {
    position: relative;
    width: 36px;
    height: 20px;
    background: rgba(148, 163, 184, 0.3);
    border-radius: 999px;
    cursor: pointer;
    transition: background 0.2s;
}

.toggle-switch.active {
    background: rgba(52, 211, 153, 0.5);
}

.toggle-switch::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.2s;
}

.toggle-switch.active::after {
    transform: translateX(16px);
}

.toggle-label {
    font-size: 12px;
    color: var(--text-secondary, #94a3b8);
}

/* Compact Problem Item (for bundled groups) */
.problem-item-compact {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: rgba(15, 23, 42, 0.5);
    border-radius: 10px;
    margin-bottom: 6px;
}

.problem-item-compact:last-child {
    margin-bottom: 0;
}

.problem-item-compact input[type="checkbox"] {
    width: 16px;
    height: 16px;
}

.problem-item-compact .problem-name {
    flex: 1;
    font-size: 13px;
    color: var(--text-primary, #e2e8f0);
}

.problem-item-compact .problem-status-badge {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 999px;
}

/* Preview Section */
.preview-section {
    background: rgba(79, 70, 229, 0.08);
    border: 1px solid rgba(79, 70, 229, 0.25);
    border-radius: 12px;
    padding: 12px 16px;
    margin-top: 12px;
}

.preview-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.preview-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary, #e2e8f0);
}

.preview-count {
    font-size: 20px;
    font-weight: 700;
    color: #a5b4fc;
}

.preview-breakdown {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.preview-item {
    font-size: 12px;
    padding: 4px 10px;
    border-radius: 8px;
    background: rgba(15, 23, 42, 0.5);
    color: var(--text-secondary, #cbd5e1);
}

.preview-item .count {
    font-weight: 600;
    margin-right: 4px;
}

/* Lab Bundle Info */
.lab-bundle-info {
    font-size: 12px;
    padding: 8px 12px;
    background: rgba(139, 92, 246, 0.1);
    border-radius: 8px;
    color: #ddd6fe;
    margin-bottom: 8px;
}

.lab-bundle-info strong {
    color: #a78bfa;
}

/* Findings Info */
.findings-info {
    font-size: 12px;
    padding: 8px 12px;
    background: rgba(148, 163, 184, 0.1);
    border-radius: 8px;
    color: #94a3b8;
    margin-bottom: 8px;
    font-style: italic;
}

/* ========== UNIFIED MERGE SYSTEM (BUG-006 FIX) ========== */

/* Unified merge card */
.unified-merge-card {
    position: relative;
}

/* Source badges - Rules vs AI */
.merge-source-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    margin-right: 8px;
}

.merge-source-badge.ontology {
    background: rgba(96, 165, 250, 0.2);
    color: #93c5fd;
    border: 1px solid rgba(96, 165, 250, 0.3);
}

.merge-source-badge.llm {
    background: rgba(167, 139, 250, 0.2);
    color: #c4b5fd;
    border: 1px solid rgba(167, 139, 250, 0.3);
}

.merge-source-badge.user {
    background: rgba(52, 211, 153, 0.2);
    color: #6ee7b7;
    border: 1px solid rgba(52, 211, 153, 0.3);
}

/* FIX (2025-12-09): Duplicate badge for unified merge UI */
.merge-source-badge.duplicate {
    background: rgba(251, 191, 36, 0.2);
    color: #fde68a;
    border: 1px solid rgba(251, 191, 36, 0.3);
}

/* Conflict indicator */
.conflict-indicator {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    background: rgba(251, 146, 60, 0.2);
    color: #fdba74;
    border: 1px solid rgba(251, 146, 60, 0.4);
    animation: conflict-pulse 2s ease-in-out infinite;
}

@keyframes conflict-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* Merge card with conflict gets warning border */
.unified-merge-card[data-has-conflict="true"],
.consolidation-card:has(.conflict-indicator) {
    border-color: rgba(251, 146, 60, 0.4);
    background: rgba(251, 146, 60, 0.05);
}

/* Child and parent name styling in merge suggestions */
.unified-merge-card .child-name {
    color: #fbbf24;
    font-weight: 600;
}

.unified-merge-card .parent-name {
    color: #a5b4fc;
    font-weight: 600;
}

/* Rejected count notice */
.rejected-count-notice {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: #94a3b8;
    padding: 4px 10px;
    background: rgba(148, 163, 184, 0.1);
    border-radius: 6px;
    margin-left: 12px;
}

.rejected-count-notice::before {
    content: "🚫";
    font-size: 11px;
}

/* ========== ACCESSIBILITY: FOCUS STYLES (FIX 2025-12-09) ========== */
/* BUG: No focus styles made keyboard navigation impossible to see */
/* ROOT CAUSE: Relying on browser defaults which are invisible in dark theme */
/* FIX: Add explicit focus-visible styles for all interactive elements */

/* Checkbox focus */
.problem-card-header input[type="checkbox"]:focus-visible {
    outline: 2px solid #60a5fa;
    outline-offset: 2px;
    border-radius: 4px;
}

/* Button focus */
.problem-approval-footer button:focus-visible,
.apply-consolidation-btn:focus-visible,
.accept-merge-btn:focus-visible,
.dismiss-merge-btn:focus-visible,
.problem-manual-add button:focus-visible {
    outline: 2px solid #60a5fa;
    outline-offset: 2px;
    box-shadow: 0 0 0 4px rgba(96, 165, 250, 0.2);
}

/* Collapsible group header focus */
.severity-group-header:focus-visible,
.suggested-actions-header:focus-visible {
    outline: 2px solid #60a5fa;
    outline-offset: 2px;
    border-radius: 8px;
}

/* Problem card focus (when used as clickable) */
.problem-card:focus-within {
    outline: 2px solid rgba(96, 165, 250, 0.5);
    outline-offset: 1px;
}

/* Suggestion card focus */
.suggestion-card:focus-visible,
.unified-merge-card:focus-visible {
    outline: 2px solid #60a5fa;
    outline-offset: 2px;
}

/* Input field focus */
.problem-manual-add input:focus-visible {
    outline: 2px solid #60a5fa;
    outline-offset: 0;
    border-color: #60a5fa;
}

/* Link focus */
.problem-approval-container a:focus-visible {
    outline: 2px solid #60a5fa;
    outline-offset: 2px;
    border-radius: 2px;
}

/* ==========================================
   UI/UX REDESIGN (2025-12-09)
   ========================================== */

/* Smart Suggestions Section - Promoted to top */
.smart-suggestions-section {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.08), rgba(99, 102, 241, 0.04));
    border: 1px solid rgba(99, 102, 241, 0.25);
    border-radius: 16px;
    margin-bottom: 16px;
}

.smart-suggestions-section .problem-section-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
}

.suggestion-count-badge {
    background: rgba(99, 102, 241, 0.3);
    color: #a5b4fc;
    padding: 4px 12px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 600;
}

/* Checkbox hint text */
.checkbox-hint {
    font-size: 12px;
    color: var(--text-tertiary, #64748b);
    font-style: italic;
    margin-top: 4px;
}

/* Collapsible Add Problem Section */
.add-problem-details {
    background: rgba(15, 23, 42, 0.4);
    border: 1px dashed rgba(148, 163, 184, 0.2);
    border-radius: 12px;
    margin-top: 16px;
}

.add-problem-trigger {
    padding: 14px 18px;
    cursor: pointer;
    color: var(--text-secondary, #94a3b8);
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    list-style: none;
    transition: color 0.2s;
}

.add-problem-trigger:hover {
    color: var(--text-primary, #e2e8f0);
}

.add-problem-trigger::-webkit-details-marker {
    display: none;
}

.add-problem-trigger i {
    font-size: 18px;
}

.add-problem-details[open] .add-problem-trigger {
    border-bottom: 1px solid rgba(148, 163, 184, 0.15);
}

.add-problem-details[open] .problem-manual-add {
    padding: 14px 18px;
}

/* Problem Menu Button (context menu trigger) */
.problem-menu-btn {
    background: transparent;
    border: none;
    color: var(--text-tertiary, #64748b);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    opacity: 0;
    transition: opacity 0.15s, background 0.15s, color 0.15s;
    flex-shrink: 0;
}

.problem-item-compact:hover .problem-menu-btn {
    opacity: 1;
}

.problem-menu-btn:hover {
    background: rgba(148, 163, 184, 0.15);
    color: var(--text-primary, #e2e8f0);
}

.problem-menu-btn:focus-visible {
    opacity: 1;
    outline: 2px solid #60a5fa;
    outline-offset: 0;
}

.problem-menu-btn i {
    font-size: 16px;
}

/* Context Menu */
.problem-context-menu {
    position: absolute;
    background: var(--bg-primary, #1e293b);
    border: 1px solid rgba(148, 163, 184, 0.25);
    border-radius: 10px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3), 0 4px 10px rgba(0, 0, 0, 0.2);
    min-width: 160px;
    z-index: 1000;
    overflow: hidden;
}

.problem-context-menu.hidden {
    display: none;
}

.context-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 14px;
    background: transparent;
    border: none;
    color: var(--text-primary, #e2e8f0);
    font-size: 13px;
    cursor: pointer;
    text-align: left;
    transition: background 0.15s;
}

.context-menu-item:hover {
    background: rgba(148, 163, 184, 0.1);
}

.context-menu-item i {
    font-size: 16px;
    color: var(--text-secondary, #94a3b8);
}

.context-menu-item--danger {
    color: #f87171;
}

.context-menu-item--danger i {
    color: #f87171;
}

.context-menu-item--danger:hover {
    background: rgba(248, 113, 113, 0.1);
}

/* ==========================================
   PHASE 2: GRID LAYOUT + PROBLEM TREE SIDEBAR (2025-12-10)
   ========================================== */

/* Grid layout for main content + sidebar */
.problem-modal-content {
    display: grid;
    grid-template-columns: 1fr 200px;
    gap: 0;
    min-height: 0;
    height: 100%;  /* Fill parent height for scroll to work */
}

.approval-main-content {
    overflow-y: auto;
    min-height: 0;
    padding-right: 12px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Problem Tree Sidebar */
.problem-tree-sidebar {
    background: rgba(15, 23, 42, 0.6);
    border-left: 1px solid rgba(148, 163, 184, 0.15);
    padding: 12px;
    overflow-y: auto;
    min-height: 0;
}

/* Responsive: Hide sidebar on small screens */
@media (max-width: 768px) {
    .problem-modal-content {
        grid-template-columns: 1fr;
    }

    .problem-tree-sidebar {
        display: none;  /* Hide on mobile - too cramped */
    }

    .approval-main-content {
        padding-right: 0;
    }
}

/* Responsive: Wider sidebar on large screens */
@media (min-width: 1200px) {
    .problem-modal-content {
        grid-template-columns: 1fr 240px;
    }
}

.problem-tree-sidebar h5 {
    font-size: 10px;
    text-transform: uppercase;
    color: var(--text-tertiary, #64748b);
    margin: 0 0 10px 0;
    letter-spacing: 0.5px;
    font-weight: 600;
}

/* Tree severity groups */
.tree-severity-group {
    margin-bottom: 10px;
}

.tree-severity-label {
    font-size: 10px;
    font-weight: 600;
    color: var(--text-secondary, #94a3b8);
    display: flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 4px;
}

.tree-severity-label .tree-icon {
    font-size: 10px;
}

.tree-severity-label .tree-count {
    color: var(--text-tertiary, #64748b);
    font-weight: 400;
}

/* Tree problem row wrapper (Phase 2 enhancement) */
.tree-problem-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2px;
    padding-left: 10px;
    margin-bottom: 1px;
}

.tree-problem-row:hover {
    background: rgba(148, 163, 184, 0.06);
}

/* Tree problem items */
.tree-problem-item {
    font-size: 11px;
    padding: 3px 4px;
    color: var(--text-primary, #e2e8f0);
    border-left: 2px solid transparent;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, opacity 0.15s;
    display: flex;
    align-items: center;
    gap: 5px;
    flex: 1;
    min-width: 0;
    border-radius: 3px;
}

.tree-problem-item:hover {
    background: rgba(148, 163, 184, 0.1);
    border-left-color: rgba(99, 102, 241, 0.6);
}

.tree-problem-item.has-merges {
    border-left-color: rgba(99, 102, 241, 0.5);
}

.tree-problem-item.is-unchecked {
    opacity: 0.45;
}

.tree-problem-item.is-unchecked .tree-problem-title {
    text-decoration: line-through;
}

/* Tree problem title span */
.tree-problem-title {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Trend icons in tree (Phase 2 enhancement) */
.tree-trend-icon {
    font-size: 10px;
    flex-shrink: 0;
    line-height: 1;
}

.tree-trend-icon.worsening { color: #f87171; }
.tree-trend-icon.improving { color: #4ade80; }
.tree-trend-icon.stable { color: #fbbf24; }
.tree-trend-icon.resolved { color: #34d399; }

/* Tree menu button (hidden by default, shows on hover) */
.tree-menu-btn {
    background: transparent;
    border: none;
    color: var(--text-tertiary, #64748b);
    padding: 2px 4px;
    border-radius: 3px;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.15s, background 0.15s, color 0.15s;
    font-size: 11px;
    flex-shrink: 0;
    line-height: 1;
}

.tree-problem-row:hover .tree-menu-btn {
    opacity: 1;
}

.tree-menu-btn:hover {
    background: rgba(148, 163, 184, 0.15);
    color: var(--text-primary, #e2e8f0);
}

/* Key data snippet below problem (Phase 2 enhancement) */
.tree-key-snippet {
    font-size: 9px;
    padding: 0 0 3px 22px;
    color: var(--text-tertiary, #64748b);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    opacity: 0.65;
    transition: opacity 0.15s;
    line-height: 1.3;
}

.tree-problem-row:hover + .tree-key-snippet,
.tree-key-snippet:hover {
    opacity: 1;
}

/* Empty state */
.tree-empty-state {
    color: var(--text-tertiary, #64748b);
    font-size: 11px;
    padding: 12px 8px;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

/* Merged child items */
.tree-merged-child {
    font-size: 10px;
    color: var(--text-tertiary, #64748b);
    padding: 1px 0 1px 18px;
    display: flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tree-merged-child::before {
    content: "└";
    color: rgba(148, 163, 184, 0.4);
    flex-shrink: 0;
}

.tree-merged-child .merge-source {
    font-size: 9px;
    padding: 1px 4px;
    border-radius: 3px;
    flex-shrink: 0;
}

.tree-merged-child .merge-source.ai {
    background: rgba(167, 139, 250, 0.2);
    color: #c4b5fd;
}

.tree-merged-child .merge-source.rules {
    background: rgba(96, 165, 250, 0.2);
    color: #93c5fd;
}

.tree-merged-child .merge-source.user {
    background: rgba(52, 211, 153, 0.2);
    color: #6ee7b7;
}

/* Strikethrough merged items */
.tree-problem-item.was-merged {
    color: var(--text-tertiary, #64748b);
    opacity: 0.6;
    cursor: default;
    padding-left: 10px;
}

.tree-problem-item.was-merged .tree-problem-title {
    text-decoration: line-through;
}

.tree-problem-item.was-merged .merge-arrow {
    font-size: 9px;
    color: rgba(167, 139, 250, 0.7);
    margin-left: 4px;
    font-weight: 500;
    text-decoration: none;
}
