/* ==================== APP DOCTOR ==================== */
.doctor-container {
    display: flex;
    height: calc(100vh - 60px);
    gap: 0;
}

.doctor-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.doctor-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.doctor-msg {
    display: flex;
    gap: 0.75rem;
    max-width: 85%;
    animation: doctorFadeIn 0.2s ease;
}

@keyframes doctorFadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

.doctor-msg-user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.doctor-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 700;
    flex-shrink: 0;
}

.doctor-msg-assistant .doctor-avatar {
    background: var(--accent-primary, #3b82f6);
    color: #fff;
}

.doctor-msg-user .doctor-avatar {
    background: var(--bg-tertiary, #374151);
    color: var(--text-primary);
}

.doctor-msg-body {
    background: var(--bg-secondary, #1e293b);
    border-radius: var(--radius-md, 8px);
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    line-height: 1.5;
}

.doctor-msg-user .doctor-msg-body {
    background: var(--accent-primary, #3b82f6);
    color: #fff;
}

.doctor-msg-body p { margin: 0 0 0.5rem; }
.doctor-msg-body p:last-child { margin: 0; }

.doctor-msg-body pre {
    background: var(--bg-tertiary, #0f172a);
    padding: 0.5rem;
    border-radius: 4px;
    overflow-x: auto;
    font-size: 0.8rem;
}

.doctor-quick-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
    flex-wrap: wrap;
}

/* Input area */
.doctor-input-container {
    display: flex;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border-top: 1px solid var(--border-color, #334155);
    background: var(--bg-primary, #0f172a);
}

.doctor-input-container textarea {
    flex: 1;
    resize: none;
    padding: 0.6rem 0.75rem;
    border-radius: var(--radius-sm, 6px);
    border: 1px solid var(--border-color, #334155);
    background: var(--bg-input, #1e293b);
    color: var(--text-primary);
    font-size: 0.875rem;
    font-family: inherit;
    line-height: 1.5;
    min-height: 38px;
    max-height: calc(1.5em * 10 + 1.2rem);  /* ~10 lines + padding */
    overflow-y: auto;
}

.doctor-input-container textarea:focus {
    outline: none;
    border-color: var(--accent-primary, #3b82f6);
}

/* Sidebar */
.doctor-sidebar {
    width: 300px;
    border-left: 1px solid var(--border-color, #334155);
    overflow-y: auto;
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    background: var(--bg-secondary, #1e293b);
}

.doctor-status-card {
    background: var(--bg-primary, #0f172a);
    border-radius: var(--radius-sm, 6px);
    padding: 0.75rem;
}

.doctor-status-card h4 {
    margin: 0 0 0.5rem;
    font-size: 0.8rem;
    color: var(--text-secondary, #94a3b8);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Health badge */
.doctor-health-badge {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    font-weight: 600;
}

.health-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}

.health-dot.health-unknown { background: #6b7280; }
.health-dot.health-healthy { background: #22c55e; }
.health-dot.health-degraded { background: #f59e0b; }
.health-dot.health-unhealthy { background: #ef4444; }

/* Probe list */
.doctor-probe-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0;
    font-size: 0.8rem;
    border-bottom: 1px solid var(--border-color, #334155);
}

.doctor-probe-item:last-child { border-bottom: none; }

.probe-status {
    font-size: 0.7rem;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 3px;
    min-width: 36px;
    text-align: center;
}

.probe-status-pass { background: #166534; color: #bbf7d0; }
.probe-status-fail { background: #991b1b; color: #fecaca; }
.probe-status-warning { background: #92400e; color: #fde68a; }
.probe-status-error { background: #991b1b; color: #fecaca; }
.probe-status-skip { background: #374151; color: #9ca3af; }

/* Repair list */
.doctor-repair-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.4rem 0;
    border-bottom: 1px solid var(--border-color, #334155);
    font-size: 0.8rem;
}

.doctor-repair-item:last-child { border-bottom: none; }

.repair-btn {
    padding: 2px 8px;
    font-size: 0.7rem;
    border-radius: 3px;
    border: none;
    cursor: pointer;
    background: var(--accent-primary, #3b82f6);
    color: #fff;
}

.repair-btn:hover { opacity: 0.85; }
.repair-btn:disabled { opacity: 0.4; cursor: not-allowed; }

.repair-btn-done {
    background: #166534;
    cursor: default;
}

/* Escalation levels */
.doctor-escalation-levels {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.esc-level {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    color: var(--text-secondary, #94a3b8);
    padding: 0.25rem 0;
}

.esc-level.esc-level-active { color: var(--text-primary); font-weight: 600; }
.esc-level.esc-level-done { color: #22c55e; }
.esc-level.esc-level-blocked { color: #ef4444; }

.esc-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--border-color, #334155);
}

.esc-level-active .esc-dot { background: var(--accent-primary, #3b82f6); }
.esc-level-done .esc-dot { background: #22c55e; }
.esc-level-blocked .esc-dot { background: #ef4444; }

/* Platform action banner */
.doctor-platform-banner {
    background: #92400e;
    color: #fde68a;
    padding: 0.5rem 0.75rem;
    border-radius: 4px;
    font-size: 0.8rem;
    margin-bottom: 0.5rem;
}

.doctor-platform-banner strong { color: #fbbf24; }

/* History items */
.doctor-history-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.35rem 0;
    border-bottom: 1px solid var(--border-color, #334155);
    cursor: pointer;
    font-size: 0.75rem;
}

.doctor-history-item:hover { color: var(--accent-primary); }
.doctor-history-item:last-child { border-bottom: none; }

/* Consent modal */
.doctor-consent-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.doctor-consent-card {
    background: var(--bg-secondary, #1e293b);
    border-radius: var(--radius-md, 8px);
    padding: 1.5rem;
    max-width: 480px;
    width: 90%;
    border: 1px solid var(--border-color, #334155);
}

.doctor-consent-card h3 { margin: 0 0 1rem; }

.doctor-consent-card p {
    font-size: 0.85rem;
    line-height: 1.5;
    color: var(--text-secondary);
    margin: 0 0 0.75rem;
}

.doctor-consent-card ul {
    font-size: 0.8rem;
    margin: 0 0 1rem;
    padding-left: 1.25rem;
    color: var(--text-secondary);
}

.doctor-consent-footer {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
}

/* Findings inline */
.doctor-finding {
    padding: 0.4rem 0.5rem;
    border-left: 3px solid var(--border-color);
    margin: 0.4rem 0;
    font-size: 0.8rem;
    background: var(--bg-tertiary, #0f172a);
    border-radius: 0 4px 4px 0;
}

.doctor-finding-critical { border-left-color: #ef4444; }
.doctor-finding-high { border-left-color: #f97316; }
.doctor-finding-medium { border-left-color: #f59e0b; }
.doctor-finding-low { border-left-color: #3b82f6; }
.doctor-finding-info { border-left-color: #6b7280; }

/* L2 Session (Claude Code Interactive) */
.doctor-msg-l2 { background: rgba(139, 92, 246, 0.04); }
.doctor-avatar-l2 {
    background: linear-gradient(135deg, #7c3aed, #a78bfa);
    color: #fff;
    font-weight: 700;
    font-size: 0.65rem;
    letter-spacing: 0.5px;
}
.l2-session-banner {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: linear-gradient(90deg, rgba(124,58,237,0.12), rgba(167,139,250,0.08));
    border-bottom: 1px solid rgba(124,58,237,0.2);
    font-size: 0.78rem;
    color: var(--text-color);
}
.l2-badge {
    display: inline-block;
    background: #7c3aed;
    color: #fff;
    font-weight: 700;
    font-size: 0.6rem;
    padding: 2px 6px;
    border-radius: 4px;
    letter-spacing: 0.5px;
}

/* Responsive */
@media (max-width: 900px) {
    .doctor-container { flex-direction: column; }
    .doctor-sidebar {
        width: 100%;
        border-left: none;
        border-top: 1px solid var(--border-color);
        max-height: 300px;
        flex-direction: row;
        flex-wrap: wrap;
    }
    .doctor-status-card { flex: 1; min-width: 200px; }
}
