/**
 * 2D Problem Space Styles
 *
 * ARCHITECTURE: Styling for novel 2D problem visualization
 * DESIGN: Dark theme, gradient background, clinical-grade aesthetics
 *
 * Layout:
 * - Main canvas with deteriorating→improving gradient
 * - Axis labels for orientation
 * - Magnetic zone indicators
 * - Background strip for chronic/monitoring
 *
 * REFERENCE: /root/.claude/plans/radiant-riding-dove.md
 */

/* ========== CONTAINER ========== */

.problem-space-container {
    display: flex;
    flex-direction: column;
    min-height: 800px;           /* MVP: large canvas for 2D visualization */
    height: calc(100vh - 180px); /* Near full viewport */
    max-height: 1200px;          /* Allow very tall on large screens */
    background: var(--sol-bg-primary, #0a0c10);
    border-radius: 8px;
    overflow: hidden;
}

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

/* ========== HEADER ========== */

.problem-space-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: var(--sol-bg-secondary, #0f1219);
    border-bottom: 1px solid var(--sol-border, #1f2937);
}

.space-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--sol-text-primary, #e5e7eb);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.day-toggle {
    display: flex;
    gap: 4px;
}

.toggle-btn {
    padding: 4px 12px;
    font-size: 12px;
    background: transparent;
    border: 1px solid var(--sol-border, #374151);
    color: var(--sol-text-secondary, #9ca3af);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.toggle-btn:hover {
    background: var(--sol-bg-tertiary, #1f2937);
}

.toggle-btn.active {
    background: var(--sol-accent-cyan, #06b6d4);
    border-color: var(--sol-accent-cyan, #06b6d4);
    color: #000;
}

/* ========== MAIN 2D SPACE ========== */

.problem-space-main {
    flex: 1;
    position: relative;
    min-height: 750px;           /* MVP: large canvas for problem cards */
    height: calc(100vh - 230px); /* Near full viewport */
    max-height: 1150px;          /* Allow tall on large screens */
    padding: 40px 50px 30px 50px;
}

/* Axis labels */
.axis-label-y {
    position: absolute;
    left: 8px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 120px;
    writing-mode: vertical-rl;
    text-orientation: mixed;
    transform: rotate(180deg) translateY(50%);
}

.axis-label-y span {
    font-size: 10px;
    color: var(--sol-text-muted, #6b7280);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.axis-label-x {
    position: absolute;
    bottom: 8px;
    left: 50px;
    right: 50px;
    display: flex;
    justify-content: space-between;
}

.axis-label-x span {
    font-size: 10px;
    color: var(--sol-text-muted, #6b7280);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.axis-center {
    font-weight: 600;
}

/* 2D Canvas */
.problem-space-canvas {
    position: absolute;
    top: 40px;      /* Below header padding */
    left: 50px;     /* Match .problem-space-main padding */
    right: 50px;
    bottom: 30px;   /* Match .problem-space-main padding */
    border-radius: 8px;
    overflow: hidden;

    /* Gradient: red (deteriorating) → amber (stable) → green (improving) */
    background: linear-gradient(
        to right,
        rgba(239, 68, 68, 0.12),   /* Red tint */
        rgba(245, 158, 11, 0.06),  /* Amber tint */
        rgba(34, 197, 94, 0.12)    /* Green tint */
    );

    /* Grid overlay */
    background-image:
        linear-gradient(
            to right,
            rgba(239, 68, 68, 0.12),
            rgba(245, 158, 11, 0.06),
            rgba(34, 197, 94, 0.12)
        ),
        linear-gradient(var(--sol-border, #1f2937) 1px, transparent 1px),
        linear-gradient(90deg, var(--sol-border, #1f2937) 1px, transparent 1px);
    background-size: 100% 100%, 20% 20%, 20% 20%;
}

/* Zone indicators */
.zone-indicators {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 24px;
    display: flex;
    pointer-events: none;
}

.zone-marker {
    position: absolute;
    bottom: 0;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.zone-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--sol-text-muted, #6b7280);
    opacity: 0.5;
}

.zone-label {
    font-size: 9px;
    color: var(--sol-text-muted, #6b7280);
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.2s;
}

.problem-space-canvas:hover .zone-label {
    opacity: 1;
}

/* Cards container */
.problem-cards-container {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
}

/* ========== PROBLEM CARDS ========== */

.problem-card-2d {
    position: absolute;
    width: 200px;
    padding: 10px 12px;
    background: linear-gradient(
        145deg,
        var(--sol-bg-secondary, #0f1219) 0%,
        var(--sol-bg-tertiary, #151a24) 100%
    );
    border: 1px solid var(--sol-border, #1f2937);
    border-radius: 10px;
    box-shadow:
        0 4px 12px rgba(0, 0, 0, 0.3),
        0 2px 4px rgba(0, 0, 0, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
    transform: translate(-50%, -50%);
    cursor: grab;
    transition:
        transform 0.2s cubic-bezier(0.22, 0.61, 0.36, 1),
        box-shadow 0.2s cubic-bezier(0.22, 0.61, 0.36, 1),
        border-color 0.2s ease;
    z-index: 1;
}

/* Glow layer for hover effect - uses ::before to avoid conflict with pinned/nudged ::after */
.problem-card-2d::before {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: inherit;
    background: radial-gradient(
        ellipse 120% 80% at 30% 10%,
        rgba(6, 182, 212, 0.15),
        transparent 60%
    );
    opacity: 0;
    z-index: -1;
    pointer-events: none;
    transition: opacity 0.2s ease, filter 0.2s ease;
}

.problem-card-2d:hover {
    transform: translate(-50%, -50%) translateY(-4px) scale(1.02);
    box-shadow:
        0 12px 32px rgba(0, 0, 0, 0.45),
        0 6px 16px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.08);
    border-color: var(--sol-accent-cyan, #06b6d4);
    z-index: 10;
}

.problem-card-2d:hover::before {
    opacity: 1;
    filter: blur(8px);
}

.problem-card-2d:focus {
    outline: none;
    box-shadow:
        0 0 0 2px rgba(6, 182, 212, 0.5),
        0 4px 12px rgba(0, 0, 0, 0.3);
}

.problem-card-2d.selected {
    border-color: var(--sol-accent-cyan, #06b6d4);
    box-shadow:
        0 0 0 2px rgba(6, 182, 212, 0.3),
        0 8px 24px rgba(6, 182, 212, 0.15);
}

.problem-card-2d.selected::before {
    opacity: 1;
    filter: blur(12px);
}

.problem-card-2d.dragging {
    opacity: 0.85;
    cursor: grabbing;
    transform: translate(-50%, -50%) rotate(2deg) scale(1.04);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5);
    z-index: 100;
}

/* Severity-based left border with glow */
.problem-card-2d[data-severity="critical"] {
    border-left: 3px solid var(--sol-error, #ef4444);
}

.problem-card-2d[data-severity="critical"]::before {
    background: radial-gradient(
        ellipse 120% 80% at 0% 50%,
        rgba(239, 68, 68, 0.25),
        transparent 50%
    );
}

.problem-card-2d[data-severity="severe"] {
    border-left: 3px solid var(--sol-warning, #f97316);
}

.problem-card-2d[data-severity="severe"]::before {
    background: radial-gradient(
        ellipse 120% 80% at 0% 50%,
        rgba(249, 115, 22, 0.2),
        transparent 50%
    );
}

.problem-card-2d[data-severity="moderate"] {
    border-left: 2px solid var(--sol-caution, #eab308);
}

.problem-card-2d[data-severity="mild"] {
    border-left: 2px solid var(--sol-stable, #22c55e);
}

/* ========== CARD HEADER - Two Rows ========== */

.card-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin-bottom: 8px;
}

.card-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--sol-text-primary, #e5e7eb);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    min-width: 0;
    line-height: 1.3;
}

/* Signal badge integrated with title */
.problem-signal-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    font-size: 11px;
    font-weight: 700;
    flex-shrink: 0;
}

.problem-signal-badge.signal-critical {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.4);
}

.problem-signal-badge.signal-warning {
    background: rgba(245, 158, 11, 0.2);
    color: #f59e0b;
    border: 1px solid rgba(245, 158, 11, 0.4);
}

.problem-signal-badge.signal-info {
    background: rgba(59, 130, 246, 0.2);
    color: #3b82f6;
    border: 1px solid rgba(59, 130, 246, 0.4);
}

/* Priority bar inline */
.priority-bar {
    width: 32px;
    height: 4px;
    background: var(--sol-bg-tertiary, #1f2937);
    border-radius: 2px;
    overflow: hidden;
    flex-shrink: 0;
}

.priority-fill {
    height: 100%;
    background: linear-gradient(
        to right,
        var(--sol-accent-cyan, #06b6d4),
        var(--sol-accent-magenta, #d946ef)
    );
    border-radius: 2px;
}

/* ========== CARD BODY - Always Visible ========== */

.card-timeline {
    height: 8px;
    margin-bottom: 8px;
    border-radius: 4px;
    overflow: hidden;
    background: var(--sol-bg-tertiary, #1f2937);
}

/* Timeline band segments */
.timeline-band {
    display: flex;
    height: 100%;
    position: relative;
}

.timeline-segment {
    height: 100%;
    min-width: 2px;
}

.timeline-segment.severity-critical {
    background: var(--sol-error, #ef4444);
}

.timeline-segment.severity-severe,
.timeline-segment.severity-moderate {
    background: var(--sol-warning, #f59e0b);
}

.timeline-segment.severity-mild {
    background: var(--sol-stable, #22c55e);
}

.timeline-segment.inactive {
    background: var(--sol-text-muted, #6b7280);
    opacity: 0.4;
}

/* Card metrics - always visible when present */
.card-metrics {
    margin-bottom: 6px;
    min-height: 20px;
}

.card-metrics:empty {
    display: none;
}

.lab-metric {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: var(--sol-text-secondary, #9ca3af);
    font-family: var(--sol-font-mono, monospace);
    background: var(--sol-bg-tertiary, #1f2937);
    padding: 2px 8px;
    border-radius: 4px;
}

.lab-metric .trend-arrow {
    font-size: 10px;
}

.lab-metric.abnormal {
    color: var(--sol-warning, #f97316);
    background: rgba(249, 115, 22, 0.1);
}

.lab-metric.critical {
    color: var(--sol-error, #ef4444);
    background: rgba(239, 68, 68, 0.15);
    font-weight: 600;
}

/* ========== CARD FOOTER - Grouped Actions ========== */

.card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 6px;
    border-top: 1px solid var(--sol-border, #1f2937);
    margin-top: 4px;
}

.recency {
    font-size: 11px;
    color: var(--sol-text-muted, #6b7280);
}

/* Action button group */
.card-actions {
    display: flex;
    align-items: center;
    gap: 2px;
}

.card-pin-btn,
.card-explain-btn,
.card-detail-btn {
    padding: 4px 6px;
    font-size: 12px;
    background: transparent;
    border: none;
    color: var(--sol-text-muted, #6b7280);
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.15s ease;
    line-height: 1;
}

.card-pin-btn:hover,
.card-explain-btn:hover,
.card-detail-btn:hover {
    background: var(--sol-bg-tertiary, #1f2937);
    color: var(--sol-text-primary, #e5e7eb);
}

.card-explain-btn {
    font-weight: 600;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--sol-border, #374151);
    border-radius: 50%;
}

.card-explain-btn:hover {
    background: var(--sol-accent-cyan, #06b6d4);
    border-color: var(--sol-accent-cyan, #06b6d4);
    color: #000;
}

/* ========== BACKGROUND STRIP ========== */

.background-strip {
    display: flex;
    gap: 8px;
    padding: 12px 16px;
    background: var(--sol-bg-secondary, #0f1219);
    border-top: 1px solid var(--sol-border, #1f2937);
    flex-wrap: wrap;
}

.background-category {
    flex: 1;
    min-width: 150px;
}

.category-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 8px 12px;
    background: var(--sol-bg-tertiary, #1f2937);
    border: 1px solid var(--sol-border, #374151);
    border-radius: 6px;
    color: var(--sol-text-secondary, #9ca3af);
    font-size: 12px;
    cursor: pointer;
    transition: background 0.15s;
}

.category-toggle:hover {
    background: var(--sol-bg-quaternary, #374151);
}

.category-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.category-label {
    flex: 1;
    text-align: left;
}

.category-count {
    font-weight: 600;
    color: var(--sol-text-primary, #e5e7eb);
}

.category-chevron {
    font-size: 10px;
    transition: transform 0.2s;
}

.category-toggle[aria-expanded="true"] .category-chevron {
    transform: rotate(180deg);
}

/* Category content */
.category-content {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 8px;
    max-height: 150px;
    overflow-y: auto;
}

.category-content.collapsed {
    display: none;
}

/* Background cards */
.background-card {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    background: var(--sol-bg-secondary, #0f1219);
    border: 1px solid var(--sol-border, #1f2937);
    border-radius: 4px;
    cursor: grab;
}

.background-card:hover {
    border-color: var(--sol-border-hover, #4b5563);
}

.background-card.selected {
    border-color: var(--sol-accent-cyan, #06b6d4);
}

.background-card .card-name {
    font-size: 11px;
    color: var(--sol-text-secondary, #9ca3af);
}

.activate-btn {
    padding: 2px 4px;
    font-size: 12px;
    background: transparent;
    border: none;
    color: var(--sol-text-muted, #6b7280);
    cursor: pointer;
    border-radius: 2px;
}

.activate-btn:hover {
    background: var(--sol-bg-tertiary, #1f2937);
    color: var(--sol-accent-cyan, #06b6d4);
}

/* ========== EMPTY STATE ========== */

.problem-cards-container .empty-state {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: var(--sol-text-muted, #6b7280);
}

.empty-state p {
    font-size: 14px;
    margin: 0;
}

/* ========== DROP ZONE FEEDBACK ========== */

.problem-space-canvas.drag-over {
    background-color: rgba(6, 182, 212, 0.05);
}

.background-category.drag-over {
    border-color: var(--sol-accent-cyan, #06b6d4);
    background: rgba(6, 182, 212, 0.1);
}

/* ========== RESPONSIVE ========== */

@media (max-width: 1400px) {
    .problem-space-container {
        min-height: 700px;
        height: calc(100vh - 200px);
    }
    
    .problem-space-main {
        min-height: 650px;
        height: calc(100vh - 250px);
    }
}

@media (max-width: 1200px) {
    .problem-space-container {
        min-height: 600px;
        height: calc(100vh - 220px);
    }
    
    .problem-space-main {
        min-height: 550px;
        height: calc(100vh - 270px);
        padding: 35px 40px 25px 40px;
    }

    .problem-card-2d {
        width: 160px;
        padding: 8px 10px;
    }

    .card-title {
        font-size: 12px;
    }
}

@media (max-width: 900px) {
    .problem-space-container {
        min-height: 500px;
        height: calc(100vh - 200px);
    }
    
    .problem-space-main {
        min-height: 450px;
        height: calc(100vh - 250px);
        padding: 30px 30px 20px 30px;
    }

    .background-strip {
        flex-direction: column;
    }

    .background-category {
        min-width: 100%;
    }
}

@media (max-width: 768px) {
    .problem-space-container {
        min-height: 450px;
        height: calc(100vh - 180px);
    }
    
    .problem-space-main {
        min-height: 400px;
        height: calc(100vh - 220px);
        padding: 25px 20px 15px 20px;
    }
    
    .problem-card-2d {
        width: 140px;
        padding: 6px 8px;
    }
}

/* ========== ANIMATIONS ========== */

@keyframes cardPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(6, 182, 212, 0.4); }
    50% { box-shadow: 0 0 0 4px rgba(6, 182, 212, 0.2); }
}

.problem-card-2d.highlight {
    animation: cardPulse 1s ease-in-out 2;
}

/* Respects reduced motion preference */
@media (prefers-reduced-motion: reduce) {
    .problem-card-2d,
    .category-chevron,
    .toggle-btn {
        transition: none;
    }

    .problem-card-2d.highlight {
        animation: none;
        box-shadow: 0 0 0 2px var(--sol-accent-cyan, #06b6d4);
    }
}

/* ========== POSITION MODE (2025-12-15) ========== */

.card-mode-indicator {
    font-size: 10px;
    margin-left: 4px;
    opacity: 0.8;
    cursor: help;
}

.card-pin-btn {
    padding: 2px 4px;
    font-size: 10px;
    background: transparent;
    border: 1px solid var(--sol-border, #374151);
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.15s ease;
    line-height: 1;
}

.card-pin-btn:hover {
    background: var(--sol-bg-tertiary, #1f2937);
    border-color: var(--sol-text-muted, #6b7280);
}

/* Pinned card styling */
.problem-card-2d[data-position-mode="pinned"] {
    border-color: var(--sol-accent-amber, #f59e0b) !important;
    box-shadow: 0 0 8px rgba(245, 158, 11, 0.3);
}

.problem-card-2d[data-position-mode="pinned"]::after {
    content: '';
    position: absolute;
    top: -3px;
    right: -3px;
    width: 8px;
    height: 8px;
    background: var(--sol-accent-amber, #f59e0b);
    border-radius: 50%;
}

/* Manual mode (dragged) card styling */
.problem-card-2d[data-position-mode="manual"] {
    border-style: dashed;
}

/* ========== ROLE BADGES (2025-12-15) ========== */

.card-role-badge {
    font-size: 9px;
    font-weight: 700;
    padding: 1px 4px;
    border-radius: 3px;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    margin-left: 4px;
}

.card-role-badge.role-red {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.4);
}

.card-role-badge.role-orange {
    background: rgba(245, 158, 11, 0.2);
    color: #f59e0b;
    border: 1px solid rgba(245, 158, 11, 0.4);
}

.card-role-badge.role-blue {
    background: rgba(59, 130, 246, 0.2);
    color: #3b82f6;
    border: 1px solid rgba(59, 130, 246, 0.4);
}

.card-role-badge.role-cyan {
    background: rgba(6, 182, 212, 0.2);
    color: #06b6d4;
    border: 1px solid rgba(6, 182, 212, 0.4);
}

.card-role-badge.role-purple {
    background: rgba(139, 92, 246, 0.2);
    color: #8b5cf6;
    border: 1px solid rgba(139, 92, 246, 0.4);
}

.card-role-badge.role-violet {
    background: rgba(168, 85, 247, 0.2);
    color: #a855f7;
    border: 1px solid rgba(168, 85, 247, 0.4);
}

.card-role-badge.role-gray {
    background: rgba(100, 116, 139, 0.2);
    color: #64748b;
    border: 1px solid rgba(100, 116, 139, 0.4);
}

/* Role-based card border colors */
.problem-card-2d[data-role="acute_secondary"] {
    border-left: 3px solid var(--sol-accent-amber, #f59e0b);
}

.problem-card-2d[data-role="diagnostic_workup"] {
    border-left: 3px solid #8b5cf6;
}

.problem-card-2d[data-role="dispo_social"] {
    border-left: 3px solid #a855f7;
}

/* ========== OCCLUSION HANDLING (2025-12-15) ========== */

/* Cards that were nudged to avoid overlap */
.problem-card-2d.nudged {
    /* Subtle indicator - slight offset shadow */
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3), 3px 3px 0 rgba(100, 116, 139, 0.2);
}

/* Tooltip for nudged cards */
.problem-card-2d.nudged::after {
    content: '↗';
    position: absolute;
    bottom: -4px;
    right: -4px;
    width: 12px;
    height: 12px;
    font-size: 8px;
    color: var(--sol-text-muted, #6b7280);
    opacity: 0.6;
}

/* ========== CONFIDENCE INDICATORS (2025-12-15) ========== */

/* High confidence (0.7+): Full opacity, subtle glow */
.problem-card-2d[data-confidence^="0.7"],
.problem-card-2d[data-confidence^="0.8"],
.problem-card-2d[data-confidence^="0.9"],
.problem-card-2d[data-confidence="1.00"] {
    opacity: 1;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3), 0 0 12px rgba(6, 182, 212, 0.15);
}

/* Medium confidence (0.4-0.69): Slight transparency */
.problem-card-2d[data-confidence^="0.4"],
.problem-card-2d[data-confidence^="0.5"],
.problem-card-2d[data-confidence^="0.6"] {
    opacity: 0.9;
}

/* Low confidence (0-0.39): More transparent, dashed border hint */
.problem-card-2d[data-confidence^="0.0"],
.problem-card-2d[data-confidence^="0.1"],
.problem-card-2d[data-confidence^="0.2"],
.problem-card-2d[data-confidence^="0.3"] {
    opacity: 0.75;
    border-style: dotted;
}

/* Low confidence indicator badge */
/* Low confidence indicator removed - dotted border style suffices.
   ::before pseudo-element reserved for glow effect. */

/* ========== EXPLAIN PANEL (2025-12-15) ========== */

.card-explain-btn {
    padding: 2px 6px;
    font-size: 12px;
    font-weight: 600;
    background: transparent;
    border: 1px solid var(--sol-text-muted, #6b7280);
    color: var(--sol-text-muted, #6b7280);
    cursor: pointer;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
}

.card-explain-btn:hover {
    background: var(--sol-accent-cyan, #06b6d4);
    border-color: var(--sol-accent-cyan, #06b6d4);
    color: #000;
}

.card-explain-panel {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 4px;
    background: var(--sol-bg-secondary, #0f1219);
    border: 1px solid var(--sol-border, #1f2937);
    border-radius: 8px;
    padding: 12px;
    z-index: 50;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
    min-width: 220px;
}

.card-explain-panel.hidden {
    display: none;
}

.explain-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--sol-border, #1f2937);
}

.explain-title {
    font-size: 11px;
    font-weight: 600;
    color: var(--sol-text-secondary, #9ca3af);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.explain-close {
    background: none;
    border: none;
    color: var(--sol-text-muted, #6b7280);
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    padding: 2px;
}

.explain-close:hover {
    color: var(--sol-text-primary, #e5e7eb);
}

/* Factor bars */
.explain-factors {
    margin-bottom: 12px;
}

.explain-factor {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.factor-name {
    font-size: 10px;
    color: var(--sol-text-muted, #6b7280);
    width: 70px;
    flex-shrink: 0;
}

.factor-bar {
    flex: 1;
    height: 4px;
    background: var(--sol-bg-tertiary, #1f2937);
    border-radius: 2px;
    overflow: hidden;
}

.factor-fill {
    height: 100%;
    background: linear-gradient(
        to right,
        var(--sol-accent-cyan, #06b6d4),
        var(--sol-accent-magenta, #d946ef)
    );
    border-radius: 2px;
    transition: width 0.3s ease;
}

.factor-value {
    font-size: 10px;
    color: var(--sol-text-secondary, #9ca3af);
    width: 28px;
    text-align: right;
    font-family: var(--sol-font-mono, monospace);
}

/* Triggers */
.explain-triggers {
    margin-bottom: 10px;
}

.triggers-label {
    font-size: 10px;
    color: var(--sol-text-muted, #6b7280);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: block;
    margin-bottom: 4px;
}

.triggers-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.trigger-item {
    font-size: 11px;
    color: var(--sol-text-primary, #e5e7eb);
    padding: 2px 0;
    border-left: 2px solid var(--sol-accent-cyan, #06b6d4);
    padding-left: 8px;
    margin-bottom: 2px;
}

.trigger-empty {
    font-size: 11px;
    color: var(--sol-text-muted, #6b7280);
    font-style: italic;
}

/* Confidence */
.explain-confidence {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}

.confidence-label {
    font-size: 10px;
    color: var(--sol-text-muted, #6b7280);
    width: 70px;
}

.confidence-value {
    font-size: 10px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 3px;
}

.confidence-value.high {
    background: rgba(34, 197, 94, 0.2);
    color: var(--sol-success, #22c55e);
}

.confidence-value.medium {
    background: rgba(245, 158, 11, 0.2);
    color: var(--sol-warning, #f59e0b);
}

.confidence-value.low {
    background: rgba(239, 68, 68, 0.2);
    color: var(--sol-error, #ef4444);
}

.confidence-bar {
    flex: 1;
    height: 4px;
    background: var(--sol-bg-tertiary, #1f2937);
    border-radius: 2px;
    overflow: hidden;
}

.confidence-fill {
    height: 100%;
    background: var(--sol-accent-cyan, #06b6d4);
    border-radius: 2px;
}

/* Data coverage */
.explain-coverage {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.coverage-label {
    font-size: 10px;
    color: var(--sol-text-muted, #6b7280);
    width: 70px;
}

.coverage-badge {
    font-size: 9px;
    padding: 2px 6px;
    border-radius: 3px;
    font-weight: 500;
}

.coverage-badge.has {
    background: rgba(34, 197, 94, 0.15);
    color: var(--sol-success, #22c55e);
    border: 1px solid rgba(34, 197, 94, 0.3);
}

.coverage-badge.missing {
    background: rgba(107, 114, 128, 0.15);
    color: var(--sol-text-muted, #6b7280);
    border: 1px solid rgba(107, 114, 128, 0.3);
}

.explain-empty {
    font-size: 11px;
    color: var(--sol-text-muted, #6b7280);
    font-style: italic;
    text-align: center;
    padding: 8px;
}
