/**
 * 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;
    /* FIX (2026-05-12): Wave 2 — tighten 4px top/bottom + 4px sides to reduce
       chrome above the canvas. The problem cards should visually dominate. */
    padding: 8px 12px;
    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);
    /* WHY: 12px (--sol-radius-lg) is the canonical card-frame radius (26.1-03). Previously 10px. */
    border-radius: var(--sol-radius-lg, 12px);
    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%) scale(var(--card-scale, 1));
    transform-origin: center center;
    cursor: grab;
    transition:
        transform 0.3s var(--dr-easing, cubic-bezier(0.22, 0.61, 0.36, 1)),
        box-shadow 0.3s ease-out,
        opacity 0.3s ease-out,
        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(calc(var(--card-scale, 1) * 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(calc(var(--card-scale, 1) * 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(--severity-critical, var(--sol-error, #ef4444));
}

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

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

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

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

.problem-card-2d[data-severity="mild"] {
    border-left: 2px solid var(--severity-stable, 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;
}

/* ========== SCRATCH LINE - Inline working assessment ========== */

.card-scratch {
    padding: 4px 0 2px;
}

.scratch-input {
    width: 100%;
    background: transparent;
    border: none;
    border-bottom: 1px solid transparent;
    color: var(--sol-text-primary, #e5e7eb);
    font-size: 11px;
    font-family: inherit;
    padding: 2px 0;
    outline: none;
    transition: border-color 0.15s ease;
    box-sizing: border-box;
}

.scratch-input::placeholder {
    color: var(--sol-text-muted, #6b7280);
    font-style: italic;
}

.scratch-input:focus {
    border-bottom-color: var(--dr-ion, #22d3ee);
}

/* ========== 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,
.card-rt-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,
.card-rt-btn:hover {
    background: var(--sol-bg-tertiary, #1f2937);
    color: var(--sol-text-primary, #e5e7eb);
}

/* RT V3 per-card button (2026-05-12): subtle teal hint when this problem
   has a matching reasoning-tree node on the patient's most recent saved
   note. Same size envelope as the other card-actions buttons so the row
   stays balanced. */
.card-rt-btn {
    color: var(--sol-accent-teal, var(--sol-accent-cyan, #06b6d4));
    opacity: 0.75;
}

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

.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;
}

/* Board-dominant mode: problem space fills available flex space
   FIX (2026-04-04): Removed min-height constraints that forced overflow.
   Container is now fully flexible — shrinks to fit viewport. */
.sol-clinical-grid-container[data-board-mode="space"] .problem-space-container {
    min-height: 0;
    height: 100%;
    max-height: none;
    flex: 1;
    overflow: hidden;
}

.sol-clinical-grid-container[data-board-mode="space"] .problem-space-main {
    min-height: 0;
    height: 100%;
    max-height: none;
    flex: 1;
    overflow: auto;
}

/* Note rail expanded + board mode on narrow screens: rail overlays */
@media (max-width: 1200px) {
    .sol-clinical-workspace:has(.note-rail.expanded) .sol-clinical-grid-container[data-board-mode="space"] {
        /* Board keeps its width, rail overlays */
    }
}


/* ========== COMPILE PIN — Include/Exclude from Note (2026-03-29) ========== */

/* Pin toggle button in card header */
.ps-card-pin {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    padding: 0;
    margin-right: 4px;
    background: transparent;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    color: var(--sol-text-muted, #6b7280);
    font-size: 12px;
    line-height: 1;
    transition: color 0.15s ease, background 0.15s ease;
    flex-shrink: 0;
}

.ps-card-pin:hover {
    background: var(--sol-bg-tertiary, #1f2937);
    color: var(--sol-text-secondary, #9ca3af);
}

.ps-card-pin--active {
    color: var(--term-gold, #d4a574);
}

.ps-card-pin--active:hover {
    color: var(--term-gold-bright, #e8c49a);
}

/* ── Triage Strip: "Not Today" ephemeral deferral (2026-04-03) ─────────
   WHY: Doctor drags a problem here during rounds to defer it for today.
   Ephemeral — resets at day boundary. Compact single-row layout. */

.triage-strip {
    display: flex;
    align-items: center;
    gap: 8px;
    /* FIX (2026-05-12): Wave 2 — tighter padding + min-height. Strip is a drag
       drop target so we keep it visible (faded) when empty; we only shrink the
       resting footprint. 30px is still a comfortable drop target (≥24px floor). */
    padding: 4px 10px;
    margin-top: 4px;
    border: 1px dashed var(--term-border, rgba(6, 182, 212, 0.15));
    border-radius: 6px;
    background: var(--severity-worsening-bg, rgba(194, 95, 144, 0.04));
    min-height: 30px;
    transition: background 0.2s ease, border-color 0.2s ease;
}

.triage-strip--empty {
    opacity: 0.4;
}

.triage-strip--dragover {
    background: var(--severity-worsening-bg, rgba(194, 95, 144, 0.12));
    border-color: var(--severity-worsening, #C25F90);
    box-shadow: inset 0 0 8px var(--severity-worsening-bg, rgba(194, 95, 144, 0.15));
}

.triage-header {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.triage-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--severity-worsening, #C25F90);
    opacity: 0.7;
}

.triage-count {
    font-size: 10px;
    min-width: 16px;
    height: 16px;
    line-height: 16px;
    text-align: center;
    border-radius: 8px;
    background: var(--severity-worsening-bg, rgba(194, 95, 144, 0.2));
    color: var(--severity-worsening, #C25F90);
}

.triage-cards {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    flex: 1;
}

.triage-card {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border: 1px solid var(--severity-worsening, rgba(194, 95, 144, 0.25));
    border-radius: 4px;
    background: var(--severity-worsening-bg, rgba(194, 95, 144, 0.08));
    font-size: 12px;
    color: var(--term-text-dim, #9ca3af);
    opacity: 0.7;
}

.triage-card-name {
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.triage-restore-btn {
    background: none;
    border: none;
    color: var(--sol-accent-cyan, #06b6d4);
    cursor: pointer;
    font-size: 12px;
    padding: 0 2px;
    opacity: 0.6;
    transition: opacity 0.15s ease;
}

.triage-restore-btn:hover {
    opacity: 1;
}

/* ── Unscored strip: data-driven deferral (2026-04-22, W2-5) ───────────
   WHY: Problems with no scoreable severity signal previously collapsed to
   canvas center at (0, 0.43), visually lying "moderate." This strip makes
   the "we don't know" state explicit. Sibling of .triage-strip (doctor-
   deferred) — same aesthetic, different semantics, neutral palette so it
   doesn't compete with the worsening-orange triage tone.

   The hatched ring border marker communicates "signal unavailable" without
   borrowing any severity color. A doctor scanning the board sees immediately
   which problems need labs/grading rather than which are actually mild. */

.problem-space-strip-unscored {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    margin-top: 4px;
    border: 1px dashed rgba(148, 163, 184, 0.25);
    border-radius: 6px;
    background: rgba(30, 41, 59, 0.25);
    min-height: 36px;
    transition: background 0.2s ease, border-color 0.2s ease;
}

.problem-space-strip-unscored.unscored-strip--empty {
    /* FIX (2026-05-12): Wave 2 — Unscored is data-driven (severity_score===null
       from the scorer), not a drop target. When no problems are unscored, hide
       it completely instead of fading — saves ~40-50px of vertical chrome above
       the background strip. The existing class toggle at problem-space.js:521-522
       already fires whenever unscoredProblems.length transitions between 0 and N,
       so re-materializing on add is automatic. */
    display: none;
}

.unscored-header {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.unscored-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--sol-text-muted, #6b7280);
    opacity: 0.85;
}

.unscored-count {
    font-size: 10px;
    min-width: 16px;
    height: 16px;
    line-height: 16px;
    text-align: center;
    border-radius: 8px;
    background: rgba(148, 163, 184, 0.18);
    color: var(--sol-text-secondary, #9ca3af);
}

.unscored-cards {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    flex: 1;
}

/* Individual unscored card — smaller than canvas cards, neutral-hatched ring.
   Uses a repeating-linear-gradient on the border-image so the ring reads as
   "inconclusive" without borrowing severity colors. */
.unscored-card {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 8px;
    border: 1px solid transparent;
    border-radius: 4px;
    background:
        /* inner background */
        linear-gradient(rgba(15, 18, 25, 0.8), rgba(15, 18, 25, 0.8)) padding-box,
        /* hatched ring */
        repeating-linear-gradient(
            45deg,
            rgba(148, 163, 184, 0.4) 0,
            rgba(148, 163, 184, 0.4) 3px,
            transparent 3px,
            transparent 6px
        ) border-box;
    font-size: 11.5px;
    color: var(--sol-text-secondary, #9ca3af);
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease, transform 0.15s ease;
    max-width: 200px;
}

.unscored-card:hover {
    color: var(--sol-text-primary, #e5e7eb);
    transform: translateY(-1px);
}

.unscored-card:focus {
    outline: 2px solid var(--sol-accent-cyan, #06b6d4);
    outline-offset: 2px;
}

.unscored-card.selected,
.unscored-card.ps-card--focused {
    color: var(--sol-text-primary, #e5e7eb);
    background:
        linear-gradient(rgba(15, 18, 25, 0.9), rgba(15, 18, 25, 0.9)) padding-box,
        repeating-linear-gradient(
            45deg,
            var(--sol-accent-cyan, #06b6d4) 0,
            var(--sol-accent-cyan, #06b6d4) 3px,
            transparent 3px,
            transparent 6px
        ) border-box;
    box-shadow: 0 0 0 1px rgba(6, 182, 212, 0.2);
}

.unscored-card.ps-card--dimmed {
    opacity: 0.35;
    transition: opacity 0.3s ease-out;
}

.unscored-card-glyph {
    font-size: 12px;
    font-weight: 700;
    color: var(--sol-text-muted, #6b7280);
    width: 14px;
    height: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(148, 163, 184, 0.35);
    border-radius: 50%;
    flex-shrink: 0;
}

.unscored-card-name {
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.unscored-card-trajectory {
    font-size: 12px;
    line-height: 1;
    color: #94a3b8;
    flex-shrink: 0;
}

/* Low-confidence canvas card marker (2026-04-22, W2-5).
   Applied when severity_confidence < 0.5 OR trajectory_confidence < 0.5.
   Non-breaking: card still shows all its content, the dashed outer marker
   just signals "the scorer is guessing here, verify before acting." */
.problem-card-2d.ps-card--low-confidence {
    /* Outline instead of border-style so we don't conflict with severity
       left-border or manual-mode dashed border. */
    outline: 2px dashed rgba(148, 163, 184, 0.55);
    outline-offset: 2px;
}

/* Flat-line trajectory glyph (2026-04-22, W2-5).
   When trajectory_score is null the card renders an em dash in place of the
   trend arrow. This class lets the em-dash match the other trend-arrow
   sizes (10px via .trend-arrow) while reading visually as "flat/unknown"
   rather than "stable". */
.card-trajectory-flat {
    /* WHY: flat/unknown trajectory glyphs sit on dark problem cards; slate-400
       keeps the "unknown" state readable instead of dark-on-dark, independent
       of theme bridge color remapping. */
    color: #94a3b8;
    opacity: 1;
    letter-spacing: 0;
    font-weight: 400;
}

/* When a whole card is flagged as flat-trajectory, the badge tooltip already
   explains it — no additional cosmetic change needed at card level beyond
   the em-dash glyph the renderer injects. Reserved hook in case future
   design wants a subtle X-axis tick. */
.problem-card-2d.card-trajectory-flat-container {
    /* no-op: placeholder for future styling tied to flat trajectory */
}

/* ── Explain panel axis breakdowns (2026-04-22, W2-5) ──────────────────
   Rewritten panel shows severity + trajectory as two rows with source
   badges, driver strings, and per-axis confidence bars. Replaces the old
   4-factor abnormality/trend/activity/recency composite. */

.explain-axis {
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--sol-border, #1f2937);
}

.explain-axis:last-child {
    border-bottom: none;
    margin-bottom: 6px;
}

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

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

.explain-axis-value {
    font-family: var(--sol-font-mono, monospace);
    font-size: 12px;
    font-weight: 600;
    color: var(--sol-text-primary, #e5e7eb);
    flex-shrink: 0;
}

.explain-axis-source {
    font-size: 9px;
    padding: 2px 6px;
    border-radius: 3px;
    background: rgba(100, 116, 139, 0.2);
    color: var(--sol-text-muted, #9ca3af);
    border: 1px solid rgba(100, 116, 139, 0.3);
    text-transform: uppercase;
    letter-spacing: 0.02em;
    font-weight: 500;
    margin-left: auto;
}

.explain-axis-driver {
    font-size: 11px;
    color: var(--sol-text-primary, #e5e7eb);
    padding: 4px 0 0;
    font-family: var(--sol-font-mono, monospace);
    word-break: break-word;
}

.explain-axis-null {
    font-size: 11px;
    color: var(--sol-text-muted, #6b7280);
    font-style: italic;
    padding: 4px 0;
}

/* Inline confidence variant — tighter than the original standalone
   .explain-confidence block because we now render one per axis. */
.explain-confidence--inline {
    margin-top: 6px;
    margin-bottom: 0;
    gap: 6px;
}

.explain-confidence--inline .confidence-label {
    width: 60px;
    font-size: 9px;
}

.explain-confidence--inline .confidence-value {
    font-size: 9px;
    padding: 1px 4px;
}

/* Trajectory bar visualizes signed -1..+1 range — center marker shows
   the "stable" anchor. fill starts at 0% and extends right, but because
   the DTO maps -1..+1 → 0..100%, a value of 0 lands the fill at exactly
   50%, which looks correct visually (extends to center but no further). */
.factor-bar--centered {
    position: relative;
}

.factor-bar-center {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    width: 1px;
    background: var(--sol-text-muted, #6b7280);
    opacity: 0.5;
    z-index: 1;
}

/* ── Two-state focus: click card to expand, others dim (2026-04-03) ────
   WHY: Reduces visual noise during per-problem reasoning. Focused card
   scales up slightly; all others fade to 30% opacity. Transition matches
   existing card animation timing. */

.ps-card--focused {
    z-index: 20 !important;
    transform: translate(-50%, -50%) scale(calc(var(--card-scale, 1) * 1.08));
}

.ps-card--dimmed {
    opacity: 0.25 !important;
    filter: grayscale(0.2);
    pointer-events: auto;
    transition:
        opacity 0.3s ease-out,
        filter 0.3s ease-out,
        transform 0.3s var(--dr-easing, cubic-bezier(0.22, 0.61, 0.36, 1));
}

/* Dimmed cards should still be clickable (to switch focus) but mute hover */
.ps-card--dimmed:hover {
    transform: translate(-50%, -50%) scale(var(--card-scale, 1));
    opacity: 0.4 !important;
}

.ps-card--dimmed::before {
    opacity: 0 !important;
}

/* Unpinned cards: dimmed, dashed border — excluded from compiled note */
.ps-card--unpinned {
    opacity: 0.45;
    border-style: dashed !important;
    transition: opacity 0.2s ease, border-style 0.15s ease;
}

.ps-card--unpinned .card-header,
.ps-card--unpinned .card-timeline,
.ps-card--unpinned .card-metrics,
.ps-card--unpinned .card-footer {
    filter: grayscale(0.3);
}

/* Keep pin button fully visible on unpinned cards so it's easy to re-pin */
.ps-card--unpinned .ps-card-pin {
    opacity: 1;
    filter: none;
}

/* FIX (2026-03-31): ADV-002 — resolved + unpinned = invisible card with floating
   pin icon. Hide pin on resolved cards since they're excluded by default and the
   card body is at 0.35 opacity + grayscale, making the problem name unreadable. */
.problem-card-2d[data-severity="resolved"] .ps-card-pin {
    display: none;
}


/* ── Variable Weight + Environmental Responsiveness (2026-03-30) ──────────
   WHY: A crashing sepsis patient and a stable discharge patient should not
   look the same. Card size scales with priority. Workspace color shifts
   with patient acuity. The board expresses the clinical picture. */

/* Severity-driven card glows — Dark Roast tokens with fallbacks */
.problem-space-card[data-severity="critical"],
.problem-card-2d[data-severity="critical"] {
    box-shadow: var(--severity-critical-glow, 0 0 14px rgba(207, 88, 88, 0.55));
    border-color: var(--severity-critical, #CF5858);
}

.problem-space-card[data-severity="worsening"],
.problem-card-2d[data-severity="worsening"],
.problem-space-card[data-severity="severe"],
.problem-card-2d[data-severity="severe"] {
    box-shadow: var(--severity-worsening-glow, 0 0 8px rgba(194, 95, 144, 0.40));
    border-color: var(--severity-worsening, #C25F90);
}

.problem-space-card[data-severity="stable"],
.problem-card-2d[data-severity="stable"] {
    box-shadow: none;
    border-color: var(--severity-stable, #879A39);
    opacity: 0.85;
}

.problem-space-card[data-severity="improving"],
.problem-card-2d[data-severity="improving"] {
    box-shadow: var(--severity-improving-glow, 0 0 6px rgba(212, 160, 64, 0.30));
    border-color: var(--severity-improving, #D4A040);
}

.problem-space-card[data-severity="resolved"],
.problem-card-2d[data-severity="resolved"] {
    box-shadow: none;
    border-color: var(--severity-resolved, #4CC4B4);
    opacity: 0.35;
    filter: grayscale(0.3);
}

/* Environmental color: workspace background shifts with patient acuity.
   Uses ::before pseudo-element to LAYER on top of the existing red→amber→green
   gradient + grid lines, not replace them. */
.problem-space-canvas[data-env-severity]::before {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    border-radius: inherit;
    transition: opacity 0.5s ease-out;
}

.problem-space-canvas[data-env-severity="critical"]::before {
    background: radial-gradient(ellipse at center, var(--severity-critical-bg, rgba(207, 88, 88, 0.08)) 0%, transparent 70%);
}

.problem-space-canvas[data-env-severity="worsening"]::before,
.problem-space-canvas[data-env-severity="severe"]::before {
    background: radial-gradient(ellipse at center, var(--severity-worsening-bg, rgba(194, 95, 144, 0.06)) 0%, transparent 70%);
}

.problem-space-canvas[data-env-severity="improving"]::before {
    background: radial-gradient(ellipse at center, var(--severity-improving-bg, rgba(212, 160, 64, 0.04)) 0%, transparent 70%);
}

/* Default/stable/resolved: no environmental overlay — clean workspace */
.problem-space-canvas[data-env-severity="stable"]::before,
.problem-space-canvas[data-env-severity="resolved"]::before {
    background: transparent;
}

/* ========== WORKSPACE PRIME — Primed Card Sections (2026-04-02) ========== */
/*
 * WHY: Slot containers inside each problem card hold clinical data from the
 *   prime endpoint (yesterday A&P, lab deltas, consult recs, context badges).
 *   These styles keep primed content visually subordinate to the doctor's
 *   working content (scratch line, annotations) while providing clear
 *   provenance.
 *
 * ARCHITECTURE: Uses --sol-* tokens (board palette), not --term-* (drawer).
 *   Primed sections live inside cards, so they inherit the card's visual
 *   language. The only --term-* crossover is pin button gold.
 */

/* -- Slot container -- */
.card-prime-slots {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 0;
}

/* Hide empty slots — no visual noise for unpopulated sections */
.card-prime-context:empty,
.card-prime-yesterday:empty,
.card-prime-labs:empty,
.card-prime-consults:empty {
    display: none;
}

/* -- Loading state: thin animated accent line -- */
/* WHY: Avoids ::before/::after (taken by glow + pin/nudge indicators).
   Uses background-image animation on the slots container instead. */
.problem-card-2d.ps-card--loading .card-prime-slots {
    border-top: 1px solid transparent;
    background-image: linear-gradient(
        90deg, transparent 0%, var(--sol-accent-cyan, #06b6d4) 50%, transparent 100%
    );
    background-size: 200% 1px;
    background-repeat: no-repeat;
    background-position: top;
    animation: prime-loading 1.5s ease-in-out infinite;
}

@keyframes prime-loading {
    0%   { background-position: top 0 right 100%; }
    100% { background-position: top 0 left 100%; }
}

/* -- Section headers -- */
.card-prime-section-header {
    font-size: 10px;
    font-weight: 500;
    color: var(--sol-text-muted, #6b7280);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 4px 0 2px;
    border-top: 1px solid var(--sol-border, #1f2937);
}

.card-prime-author {
    font-weight: 400;
    font-style: italic;
    text-transform: none;
    letter-spacing: normal;
}

/* -- Yesterday section — faded, subordinate to working content -- */
.card-prime-section--yesterday {
    opacity: 0.6;
}

.card-prime-assessment {
    font-size: 11px;
    color: var(--sol-text-secondary, #9ca3af);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* -- Plan chips (inline, not bulleted) -- */
.card-prime-plan-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 3px;
    margin-top: 3px;
}

.card-prime-chip {
    font-size: 10px;
    padding: 1px 5px;
    border-radius: 3px;
    background: var(--sol-bg-tertiary, #1f2937);
    color: var(--sol-text-secondary, #9ca3af);
    white-space: nowrap;
}

/* -- Seeded indicator — ephemeral, disappears on first edit -- */
.card-prime-seeded {
    font-size: 10px;
    color: var(--sol-text-muted, #6b7280);
    font-style: italic;
    padding: 2px 0;
    text-align: right;
}

/* -- Context badge (AKI 1, SOFA 8, etc.) -- */
.card-prime-badge {
    font-size: 10px;
    font-family: var(--sol-font-mono, monospace);
    padding: 1px 5px;
    border-radius: 3px;
    background: rgba(6, 182, 212, 0.12);
    color: var(--sol-accent-cyan, #06b6d4);
    white-space: nowrap;
    display: inline-block;
    margin-top: 2px;
}

/* -- Lab deltas — inline monospace badges -- */
.card-prime-lab-row {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 2px 0;
}

.card-prime-lab-row .lab-metric small {
    opacity: 0.7;
}

/* -- Empty state message (manual data model) -- */
.card-prime-empty-msg {
    font-size: 10px;
    color: var(--sol-text-muted, #6b7280);
    font-style: italic;
}

/* -- Consult recs -- */
.card-prime-consult-badge {
    font-size: 10px;
    font-weight: 600;
    color: var(--sol-text-secondary, #9ca3af);
}

.card-prime-section--consults {
    font-size: 11px;
    color: var(--sol-text-secondary, #9ca3af);
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ========== Content Tiers — responsive visibility by card scale ========== */
/* WHY: At low --card-scale (priority < 0.17), primed sections render as
   unreadable clutter. Text stays at native px size — sections hide/show
   based on tier instead of being shrunk by CSS transform.

   Tier assignment via data-prime-tier attribute set by _applyPrimeData():
     minimal   (scale < 0.85) — collapse yesterday + labs section headers
     normal    (0.85 ≤ scale ≤ 1.3) — default: show everything
     prominent (scale > 1.3)  — more lines of assessment visible */

/* Tier 1: Minimal — collapse yesterday and labs details */
.problem-card-2d[data-prime-tier="minimal"] .card-prime-yesterday {
    display: none;
}

.problem-card-2d[data-prime-tier="minimal"] .card-prime-labs {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-height: 18px;
}

.problem-card-2d[data-prime-tier="minimal"] .card-prime-section-header {
    display: none;
}

/* Tier 3: Prominent — more visible assessment text */
.problem-card-2d[data-prime-tier="prominent"] .card-prime-assessment {
    -webkit-line-clamp: 4;
}

.problem-card-2d[data-prime-tier="prominent"] .card-prime-section-header {
    font-size: 12px;
}

/* ==========================================================================
   Shared selection-bus visual contract (2026-05-12, U2)

   `.selected-problem` is the one CSS class three views share — Problem Space,
   Reasoning Tree, and Problem Board — when a problem is the current
   `CensusState.selectedProblemId` cursor. Each component toggles the class
   on its own element from its `selectedProblemId` subscriber. Avoids the
   pre-bus pattern of three views each rendering their own focus halo
   inconsistently.

   The class is opt-in and additive — existing component-local rules
   (e.g. `.problem-card-2d.selected`) stay until explicitly retired.
   ========================================================================== */
.selected-problem {
    box-shadow:
        0 0 0 2px var(--dr-accent, currentColor),
        0 8px 24px color-mix(in srgb, var(--dr-accent, currentColor) 18%, transparent);
    border-color: var(--dr-accent, currentColor);
}

.selected-problem:focus-visible {
    outline: 2px solid var(--dr-accent, currentColor);
    outline-offset: 2px;
}
