/* ehr.css — Light clinical EHR theme (EPIC-style chart view) */

#ehr-container {
  position: absolute; inset: 44px 0 0 0; z-index: 5;
  display: none; flex-direction: row;
  background: #f5f6fa; color: #1a1a2e;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* ── Patient List Sidebar ─────────────────────── */
.ehr-sidebar {
  width: 260px; min-width: 260px;
  background: #fff; border-right: 1px solid #e0e3eb;
  overflow-y: auto; flex-shrink: 0;
}

.ehr-sidebar-header {
  padding: 14px 16px 10px;
  font-size: 10px; font-weight: 700;
  letter-spacing: 1.5px; text-transform: uppercase;
  color: #6b7280; border-bottom: 1px solid #e0e3eb;
}

.ehr-patient-item {
  padding: 10px 16px; cursor: pointer;
  border-bottom: 1px solid #f0f1f5;
  transition: background 0.15s;
}
.ehr-patient-item:hover { background: #f0f4ff; }
.ehr-patient-item.active { background: #e8eeff; border-left: 3px solid #2563eb; }

.ehr-patient-item .name { font-size: 13px; font-weight: 600; color: #1e293b; }
.ehr-patient-item .meta { font-size: 11px; color: #6b7280; margin-top: 2px; }
.ehr-patient-item .needs-badge {
  display: inline-block; font-size: 10px; font-weight: 600;
  padding: 1px 6px; border-radius: 10px; margin-top: 4px;
}
.ehr-patient-item .needs-badge.has-needs { background: #fef3c7; color: #92400e; }
.ehr-patient-item .needs-badge.no-needs { background: #d1fae5; color: #065f46; }

/* ── Main Content Area ────────────────────────── */
.ehr-main {
  flex: 1; display: flex; flex-direction: column;
  overflow: hidden;
}

/* ── Patient Banner ───────────────────────────── */
.ehr-banner {
  background: linear-gradient(135deg, #1a5276, #2980b9);
  color: #fff; padding: 14px 24px;
  display: flex; align-items: center; gap: 24px;
  flex-shrink: 0;
}
.ehr-banner-name { font-size: 20px; font-weight: 700; }
.ehr-banner-detail { font-size: 12px; opacity: 0.85; }
.ehr-banner-detail span { margin-right: 16px; }
.ehr-banner-actions { margin-left: auto; display: flex; gap: 8px; }
.ehr-banner-btn {
  background: rgba(255,255,255,0.15); border: 1px solid rgba(255,255,255,0.3);
  color: #fff; padding: 6px 14px; border-radius: 6px;
  font-size: 11px; cursor: pointer; font-weight: 600;
  transition: background 0.15s;
}
.ehr-banner-btn:hover { background: rgba(255,255,255,0.25); }

/* ── Navigator + Content Split ────────────────── */
.ehr-body {
  flex: 1; display: flex; overflow: hidden;
}

.ehr-nav {
  width: 200px; min-width: 200px;
  background: #fff; border-right: 1px solid #e0e3eb;
  overflow-y: auto; padding: 8px 0; flex-shrink: 0;
}
.ehr-nav-item {
  padding: 8px 16px; font-size: 12px; cursor: pointer;
  color: #475569; transition: all 0.15s;
  border-left: 3px solid transparent;
}
.ehr-nav-item:hover { background: #f8f9fc; color: #1e293b; }
.ehr-nav-item.active {
  background: #eff6ff; color: #2563eb; font-weight: 600;
  border-left-color: #2563eb;
}

.ehr-content {
  flex: 1; overflow-y: auto; padding: 20px 28px;
  background: #fafbfc;
}

/* ── Empty / Placeholder State ────────────────── */
.ehr-empty {
  display: flex; align-items: center; justify-content: center;
  height: 100%; color: #94a3b8; font-size: 14px;
}

/* ── Section Tables ───────────────────────────── */
.ehr-table {
  width: 100%; border-collapse: collapse; font-size: 12px;
  margin-bottom: 20px;
}
.ehr-table th {
  text-align: left; padding: 8px 12px;
  background: #e8ecf2; color: #475569;
  font-size: 10px; font-weight: 700;
  letter-spacing: 0.5px; text-transform: uppercase;
  border-bottom: 2px solid #d1d5db;
}
.ehr-table td {
  padding: 8px 12px; border-bottom: 1px solid #e5e7eb;
  color: #334155; vertical-align: top;
}
.ehr-table tr:nth-child(even) td { background: #f8f9fc; }
.ehr-table tr:hover td { background: #eff6ff; }
.ehr-table .code { font-family: 'SF Mono', 'Fira Code', monospace; font-size: 11px; color: #6366f1; }
.ehr-table .status-active { color: #dc2626; font-weight: 600; }
.ehr-table .status-completed,
.ehr-table .status-resolved { color: #16a34a; font-weight: 600; }
.ehr-table .status-pending { color: #d97706; font-weight: 600; }

/* ── SOAP Progress Notes ──────────────────────── */
.ehr-note {
  background: #fff; border: 1px solid #d1d5db;
  border-radius: 8px; margin-bottom: 16px;
  overflow: hidden;
}
.ehr-note-header {
  background: #f1f5f9; padding: 12px 16px;
  border-bottom: 1px solid #d1d5db;
  display: flex; justify-content: space-between; align-items: center;
}
.ehr-note-title { font-size: 13px; font-weight: 700; color: #1e293b; }
.ehr-note-meta { font-size: 11px; color: #64748b; }
.ehr-note-body { padding: 16px; }

.ehr-soap-section { margin-bottom: 14px; }
.ehr-soap-section:last-child { margin-bottom: 0; }
.ehr-soap-label {
  font-size: 10px; font-weight: 700; letter-spacing: 1px;
  text-transform: uppercase; color: #2563eb;
  margin-bottom: 4px; padding-bottom: 4px;
  border-bottom: 1px solid #e5e7eb;
}
.ehr-soap-content { font-size: 12px; line-height: 1.6; color: #334155; }
.ehr-soap-content .transcript-line { margin: 3px 0; }
.ehr-soap-content .speaker-robot { color: #2563eb; font-weight: 600; }
.ehr-soap-content .speaker-patient { color: #7c3aed; font-weight: 600; }

.ehr-escalation {
  background: #fef2f2; border: 1px solid #fca5a5;
  border-radius: 6px; padding: 8px 12px; margin-top: 8px;
  font-size: 12px; color: #991b1b;
}
.ehr-escalation::before { content: '\26A0\FE0F '; }

.ehr-action-item {
  display: inline-block; background: #eff6ff; border: 1px solid #bfdbfe;
  border-radius: 4px; padding: 3px 8px; margin: 2px;
  font-size: 11px; color: #1e40af;
}

/* ── Summary Cards ────────────────────────────── */
.ehr-summary-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px; margin-bottom: 20px;
}
.ehr-summary-card {
  background: #fff; border: 1px solid #e0e3eb;
  border-radius: 8px; padding: 14px;
}
.ehr-summary-card .label {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.5px; color: #6b7280; margin-bottom: 4px;
}
.ehr-summary-card .value {
  font-size: 20px; font-weight: 700; color: #1e293b;
}
.ehr-summary-card .sub { font-size: 11px; color: #94a3b8; margin-top: 2px; }

.ehr-condition-chip {
  display: inline-block; background: #f1f5f9; border: 1px solid #cbd5e1;
  border-radius: 16px; padding: 4px 12px; margin: 3px;
  font-size: 11px; color: #334155;
}
.ehr-condition-chip .code {
  font-family: 'SF Mono', 'Fira Code', monospace; font-size: 10px; color: #6366f1;
}

/* ── Print section headings (only visible during full-record print) ── */
.ehr-print-section-title {
  display: none; /* hidden on screen */
}
.ehr-print-divider {
  display: none;
}

/* ── Print Styles ─────────────────────────────── */
@media print {
  .ehr-print-section-title {
    display: block; font-size: 16px; font-weight: 700; color: #1a5276;
    margin: 20px 0 8px; padding-bottom: 4px; border-bottom: 2px solid #2980b9;
    break-after: avoid;
  }
  .ehr-print-divider {
    display: block; border: none; border-top: 1px solid #e0e3eb;
    margin: 16px 0;
  }
  body { background: #fff !important; overflow: visible !important; }
  .top-bar, .ehr-sidebar, .ehr-nav, .ehr-banner-actions,
  .mission-panel, .command-center, .records-panel, .pip-frame, .pip-label { display: none !important; }
  #ehr-container {
    position: static !important; display: block !important;
    background: #fff !important;
  }
  .ehr-main { display: block !important; }
  .ehr-banner {
    background: #1a5276 !important; -webkit-print-color-adjust: exact;
    color-adjust: exact; print-color-adjust: exact;
  }
  .ehr-body { display: block !important; }
  .ehr-content { padding: 16px 0 !important; overflow: visible !important; }
  .ehr-note { break-inside: avoid; }
  .ehr-table { font-size: 10px; }
}
