/* Curai Platform — minimal styles */
:root {
    --primary: #2563eb;
    --danger: #dc2626;
    --bg: #f8fafc;
    --text: #1e293b;
    --border: #e2e8f0;
    --radius: 6px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; background: var(--bg); color: var(--text); line-height: 1.6; }
.navbar { display: flex; align-items: center; justify-content: space-between; padding: 0.75rem 1.5rem; background: #fff; border-bottom: 1px solid var(--border); }
.nav-brand { font-weight: 700; font-size: 1.25rem; color: var(--primary); text-decoration: none; }
.nav-links { display: flex; gap: 1rem; align-items: center; }
.nav-links a { color: var(--text); text-decoration: none; font-size: 0.9rem; }
.nav-links a:hover { color: var(--primary); }
.nav-user { font-size: 0.85rem; color: #64748b; }
.container { max-width: 1400px; margin: 1rem auto; padding: 0 1rem; }
h2 { margin-bottom: 1rem; }
h3 { margin: 1.5rem 0 0.5rem; }
input[type="text"], input[type="email"], input[type="password"] { padding: 0.5rem; border: 1px solid var(--border); border-radius: var(--radius); width: 100%; max-width: 400px; margin-bottom: 0.75rem; display: block; }
label { display: block; font-weight: 500; margin-bottom: 0.25rem; }
.btn { padding: 0.5rem 1rem; background: var(--primary); color: #fff; border: none; border-radius: var(--radius); cursor: pointer; font-size: 0.9rem; }
.btn:hover { opacity: 0.9; }
.btn-danger { background: var(--danger); }
.btn-link { background: none; border: none; color: var(--primary); cursor: pointer; text-decoration: underline; font-size: inherit; }
.error { color: var(--danger); margin-bottom: 1rem; }
.login-box { max-width: 360px; margin: 4rem auto; padding: 2rem; background: #fff; border-radius: var(--radius); border: 1px solid var(--border); }
.patient-list { list-style: none; }
.patient-list li { padding: 0.5rem 0; border-bottom: 1px solid var(--border); }
.summary-box, .soap-box, .coding-box, .transcript-box { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; white-space: pre-wrap; font-size: 0.85rem; max-height: 400px; overflow-y: auto; margin-bottom: 1rem; }
.job-card { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; margin-bottom: 0.75rem; }
.encounter-actions { margin-bottom: 1rem; }
.inline-form { display: inline-block; margin-right: 0.5rem; }
.recording-controls { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 0.5rem; }
.card { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; margin-bottom: 1rem; }
.muted { color: #64748b; font-size: 0.9rem; }
.success { color: #16a34a; margin-bottom: 0.5rem; }
.panel { margin: 0.5rem 0; }
.search-tabs { display: flex; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
textarea { padding: 0.5rem; border: 1px solid var(--border); border-radius: var(--radius); }
select { padding: 0.5rem; border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 0.75rem; display: block; }

/* Scorecard */
.scorecard { padding: 0.5rem 0; }
.scorecard-header { display: flex; gap: 2rem; margin-bottom: 1rem; }
.scorecard-em, .scorecard-revenue { text-align: center; }
.em-level { font-size: 2rem; font-weight: 700; color: var(--primary); display: block; }
.revenue-amount { font-size: 1.5rem; font-weight: 700; color: #16a34a; display: block; }
.scorecard-elements { display: flex; flex-direction: column; gap: 0.5rem; }
.scorecard-element { display: flex; align-items: flex-start; gap: 0.75rem; padding: 0.4rem 0; border-bottom: 1px solid var(--border); }
.status-dot { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; margin-top: 4px; }
.status-green { background: #22c55e; }
.status-yellow { background: #eab308; }
.status-red { background: #ef4444; }
.upgrade-alert { background: #fef3c7; border: 1px solid #f59e0b; border-radius: var(--radius); padding: 0.75rem; margin-bottom: 1rem; }
.upgrade-alert ul { margin: 0.25rem 0 0 1.25rem; }
.scorecard-gaps { margin-top: 0.75rem; }
.scorecard-gaps ul { margin: 0.25rem 0 0 1.25rem; }
.scorecard-modifiers { margin-top: 0.5rem; }
.tag { display: inline-block; background: #e0e7ff; color: #3730a3; padding: 2px 8px; border-radius: 12px; font-size: 0.8rem; margin: 2px; }
.tag-muted { background: #f1f5f9; color: #475569; }
/* Brief */
.brief-card { padding: 0.5rem 0; }
.brief-snapshot { font-size: 1rem; margin-bottom: 0.75rem; }
.brief-section { margin-bottom: 0.75rem; }
.brief-section ul { margin: 0.25rem 0 0 1.25rem; }
.brief-em { margin-top: 0.5rem; padding: 0.5rem; background: #f0fdf4; border-radius: var(--radius); }
/* HTMX indicator */
.htmx-indicator { display: none; }
.htmx-request .htmx-indicator { display: inline; }

/* Loading spinner */
.spinner { display: none; width: 18px; height: 18px; border: 3px solid #e2e8f0; border-top-color: #2563eb; border-radius: 50%; animation: spin 0.6s linear infinite; vertical-align: middle; margin-left: 8px; }
@keyframes spin { to { transform: rotate(360deg); } }
form.loading .spinner { display: inline-block; }
form.loading button[type="submit"] { opacity: 0.5; pointer-events: none; }
.htmx-request .spinner { display: inline-block; }

/* Summary formatting */
.summary-formatted { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; line-height: 1.8; font-size: 0.9rem; max-height: 500px; overflow-y: auto; }
.summary-formatted strong, .summary-formatted b { color: var(--primary); }

/* Compact scorecard — designed for 2-second glance mid-encounter */
.sc-topbar { display: flex; align-items: center; gap: 1rem; margin-bottom: 0.5rem; }
.sc-em { font-size: 2.2rem; font-weight: 800; color: var(--primary); line-height: 1; }
.sc-money { font-size: 1.4rem; font-weight: 700; color: #16a34a; }
.sc-upgrade { font-size: 1.1rem; font-weight: 700; color: #f59e0b; background: #fffbeb; padding: 2px 10px; border-radius: 12px; }
.sc-dots { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 0.5rem; }
.sc-dot-wrap { display: flex; flex-direction: column; align-items: center; cursor: help; }
.sc-dot { width: 16px; height: 16px; border-radius: 50%; }
.sc-green { background: #22c55e; }
.sc-yellow { background: #eab308; }
.sc-red { background: #ef4444; }
.sc-label { font-size: 0.6rem; color: #94a3b8; text-transform: uppercase; margin-top: 2px; }
.sc-gaps { margin: 0.4rem 0; }
.sc-gap { font-size: 0.85rem; color: #dc2626; padding: 1px 0; }
.sc-nudge { font-size: 0.85rem; background: #fffbeb; border-left: 3px solid #f59e0b; padding: 6px 10px; margin: 0.4rem 0; border-radius: 0 4px 4px 0; }
.sc-action { display: block; color: #92400e; }
.sc-mods { margin-top: 0.3rem; }
.sc-mod { display: inline-block; background: #e0e7ff; color: #3730a3; padding: 1px 8px; border-radius: 10px; font-size: 0.75rem; margin-right: 4px; }

/* Scorecard split layout */
.sc-split { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.sc-left, .sc-right { min-width: 0; }
.sc-section-title { font-size: 0.75rem; font-weight: 700; text-transform: uppercase; color: #64748b; margin: 0.4rem 0 0.2rem; }
.sc-clinical { font-size: 0.85rem; color: #1e40af; padding: 2px 0; }
/* Collapsible cards */
.card-details { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 0.75rem 1rem; margin-bottom: 0.75rem; }
.card-details summary { cursor: pointer; user-select: none; }
.card-details summary h3 { margin: 0; }
@media (max-width: 768px) { .sc-split { grid-template-columns: 1fr; } }

/* Structured summary — clinical dashboard density */
.sum-snapshot { font-size: 0.8rem; line-height: 1.4; margin-bottom: 0.4rem; padding: 0.3rem 0.5rem; background: #f0f9ff; border-radius: 4px; border-left: 3px solid #2563eb; }
.sum-badge { display: inline-block; font-size: 0.7rem; font-weight: 700; border: 1.5px solid; padding: 1px 8px; border-radius: 10px; margin-bottom: 0.3rem; }
.sum-alerts { margin-bottom: 0.3rem; }
.sum-alert { font-size: 0.75rem; color: #dc2626; background: #fef2f2; padding: 2px 6px; border-radius: 3px; margin-bottom: 2px; font-weight: 600; }
.sum-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0.4rem; margin-bottom: 0.3rem; }
.sum-col { min-width: 0; background: #fafafa; border-radius: 4px; padding: 0.3rem 0.4rem; }
.sum-title { font-size: 0.65rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.5px; color: #475569; margin-bottom: 0.15rem; border-bottom: 1px solid #e2e8f0; padding-bottom: 1px; }
.sum-item { font-size: 0.75rem; padding: 1px 0; line-height: 1.3; }
.sum-code { font-size: 0.6rem; color: #6366f1; background: #eef2ff; padding: 0px 4px; border-radius: 2px; margin-left: 2px; font-weight: 600; }
.sum-status-green { color: #22c55e; font-size: 0.6rem; }
.sum-status-yellow { color: #eab308; font-size: 0.6rem; }
.sum-status-red { color: #ef4444; font-size: 0.6rem; }
.sum-med-class { font-size: 0.65rem; font-weight: 800; color: var(--primary); margin-top: 0.15rem; text-transform: uppercase; letter-spacing: 0.3px; }
.sum-med { font-size: 0.75rem; padding-left: 0.3rem; line-height: 1.3; }
.sum-section { margin-top: 0.3rem; background: #fafafa; border-radius: 4px; padding: 0.3rem 0.4rem; }
@media (max-width: 768px) { .sum-grid { grid-template-columns: 1fr; } }

/* Recording bar */
.rec-bar { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 0.4rem 0.75rem; margin-bottom: 0.5rem; position: sticky; top: 0; z-index: 10; }
.rec-top { display: flex; align-items: center; gap: 0.5rem; }
.rec-status { font-size: 0.8rem; font-weight: 600; white-space: nowrap; }
.rec-meter { flex: 1; height: 4px; }
.rec-controls { display: flex; gap: 0.3rem; align-items: center; margin-top: 0.3rem; flex-wrap: wrap; }
.btn-rec { background: #dc2626; color: #fff; font-size: 0.8rem; padding: 3px 10px; }
.btn-cp { font-size: 0.75rem; padding: 3px 8px; }
/* Three pillars */
.pillars { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0.5rem; margin-bottom: 0.5rem; }
.pillar { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.pillar-header { display: flex; justify-content: space-between; align-items: center; padding: 0.3rem 0.5rem; background: #f8fafc; border-bottom: 1px solid var(--border); }
.pillar-title { font-size: 0.7rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.5px; color: #475569; }
.pillar-btn { background: none; border: 1px solid var(--border); border-radius: 3px; font-size: 0.7rem; padding: 1px 6px; cursor: pointer; color: var(--primary); }
.pillar-btn:hover { background: #eef2ff; }
.pillar-body { padding: 0.4rem 0.5rem; max-height: 400px; overflow-y: auto; font-size: 0.78rem; }
@media (max-width: 900px) { .pillars { grid-template-columns: 1fr; } }

/* ═══ Streaming Transcription Styles ═══ */
.lang-badge { display: inline-block; font-size: 0.65rem; font-weight: 700; background: #e0e7ff; color: #3730a3; padding: 1px 8px; border-radius: 10px; margin-right: 4px; }
.processed-result { font-size: 0.8rem; }
.soap-section { margin-bottom: 0.5rem; }
.soap-header { font-weight: 700; color: var(--primary); font-size: 0.7rem; text-transform: uppercase; margin-bottom: 2px; }
.soap-content { padding: 4px 6px; background: #f8fafc; border-radius: 3px; white-space: pre-wrap; border-left: 3px solid var(--primary); font-size: 0.8rem; line-height: 1.5; }
.coding-hint { font-size: 0.75rem; background: #f0fdf4; padding: 3px 8px; border-radius: 3px; margin-top: 0.3rem; color: #166534; font-weight: 600; }
.coding-hint-dx { font-size: 0.75rem; color: #475569; padding-left: 0.5rem; }
#live-transcript { transition: all 0.2s ease; }

/* ═══ Chat-style Diarized Transcript ═══ */
.chat-bubble {
    max-width: 75%;
    padding: 6px 10px;
    border-radius: 12px;
    font-size: 0.78rem;
    line-height: 1.4;
    margin-bottom: 4px;
    position: relative;
    word-wrap: break-word;
}
.chat-row { display: flex; margin-bottom: 2px; align-items: flex-end; gap: 6px; }
.chat-row-left { justify-content: flex-start; }
.chat-row-right { justify-content: flex-end; }
.chat-bubble-left {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-bottom-left-radius: 4px;
    color: #1e3a5f;
}
.chat-bubble-right {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-bottom-right-radius: 4px;
    color: #14532d;
}
.chat-bubble-unknown {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    color: #475569;
    max-width: 90%;
}
.chat-spk-icon {
    font-size: 0.65rem;
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}
.chat-spk-icon-left { background: #dbeafe; color: #1d4ed8; }
.chat-spk-icon-right { background: #dcfce7; color: #16a34a; }
.chat-interim {
    max-width: 75%;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-style: italic;
    color: #94a3b8;
    background: #f8fafc;
    border: 1px dashed #e2e8f0;
    margin-bottom: 4px;
}
.chat-interim-left { margin-right: auto; }
.chat-interim-right { margin-left: auto; }
.spk-tag {
    font-size: 0.65rem;
    padding: 1px 8px;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
}
.spk-tag:hover { opacity: 0.8; }
.spk-tag-left { background: #dbeafe; color: #1d4ed8; }
.spk-tag-right { background: #dcfce7; color: #16a34a; }
