/* ═══════════════════════════════════════════════════════════════════════════
   RNI Clinical Scribe Beta — scribe.css
   Light-theme surface. Matches cockpit.css design patterns exactly.
   Heebo font per portal spec.
   ═══════════════════════════════════════════════════════════════════════════ */

/* Scoped for embedding inside Clinical Portal's #page-scribe -- box-sizing
   reset and global body styling both dropped (portal already sets these
   platform-wide); body's font/color/background folded into .sc-wrap so
   the section carries its own look without touching the host page. */
.page-content#page-scribe .sc-wrap {
  font-family: 'Heebo', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: #1C1C2E;
  background: #F7F8FA;
  -webkit-font-smoothing: antialiased;
  max-width: 900px;
  margin: 0 auto;
  padding: 24px 24px 48px;
}

/* ── Header ──────────────────────────────────────────────────────────────── */

.sc-hdr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 16px;
  border-bottom: 0.5px solid rgba(28,28,46,0.08);
  margin-bottom: 32px;
}

.sc-hdr-left { display: flex; align-items: center; gap: 14px; }

.sc-hdr-ekg {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
}

.sc-hdr-title {
  font-size: 17px;
  font-weight: 600;
  line-height: 1.2;
  color: #1C1C2E;
}

.sc-hdr-sub {
  font-size: 12px;
  color: #8B92A1;
  font-style: italic;
  margin-top: 2px;
}

.sc-beta-tag {
  font-size: 11px;
  font-weight: 500;
  color: #43DBA3;
  background: rgba(67,219,163,0.10);
  border: 1px solid rgba(67,219,163,0.25);
  border-radius: 4px;
  padding: 3px 8px;
  letter-spacing: 0.03em;
}

/* ── Access gate ─────────────────────────────────────────────────────────── */

.sc-gate {
  background: #FFFFFF;
  border: 0.5px solid rgba(28,28,46,0.08);
  border-radius: 12px;
  padding: 40px 32px;
  max-width: 420px;
  margin: 60px auto;
  text-align: center;
}

.sc-gate-title {
  font-size: 16px;
  font-weight: 600;
  color: #1C1C2E;
  margin-bottom: 6px;
}

.sc-gate-sub {
  font-size: 13px;
  color: #5A6472;
  margin-bottom: 24px;
}

.sc-gate-row {
  display: flex;
  gap: 8px;
}

.sc-gate-input {
  flex: 1;
  padding: 10px 14px;
  font-family: 'Heebo', sans-serif;
  font-size: 14px;
  color: #1C1C2E;
  background: #F7F8FA;
  border: 1px solid rgba(28,28,46,0.15);
  border-radius: 8px;
  outline: none;
  transition: border-color 0.15s;
}

.sc-gate-input:focus {
  border-color: #43DBA3;
}

.sc-gate-error {
  margin-top: 10px;
  font-size: 12px;
  color: #E24B4A;
  display: none;
}

.sc-gate-error.visible { display: block; }

/* ── Buttons ─────────────────────────────────────────────────────────────── */

.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  font-family: 'Heebo', sans-serif;
  font-size: 14px;
  font-weight: 500;
  color: #FFFFFF;
  background: #43DBA3;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
  white-space: nowrap;
}

.btn-primary:hover { background: #35c491; }
.btn-primary:disabled { opacity: 0.45; cursor: not-allowed; }

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  font-family: 'Heebo', sans-serif;
  font-size: 14px;
  font-weight: 500;
  color: #1C1C2E;
  background: transparent;
  border: 1px solid rgba(28,28,46,0.18);
  border-radius: 8px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.btn-secondary:hover {
  border-color: #43DBA3;
  background: rgba(67,219,163,0.06);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
}

.btn-icon {
  padding: 7px 10px;
  font-size: 13px;
}

/* ── Workspace ───────────────────────────────────────────────────────────── */

.sc-workspace { display: none; }
.sc-workspace.visible { display: block; }

/* ── Form sections ───────────────────────────────────────────────────────── */

.sc-section {
  background: #FFFFFF;
  border: 0.5px solid rgba(28,28,46,0.08);
  border-radius: 12px;
  padding: 20px 22px;
  margin-bottom: 16px;
  position: relative;
  overflow: hidden;
}

.sc-section::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 3px;
  height: 100%;
  background: #43DBA3;
  border-radius: 0;
}

.sc-section-label {
  font-size: 12px;
  font-weight: 500;
  color: #5A6472;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 12px;
}

/* ── Role selector ───────────────────────────────────────────────────────── */

.sc-role-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.sc-role-btn {
  padding: 8px 16px;
  font-family: 'Heebo', sans-serif;
  font-size: 13px;
  font-weight: 500;
  color: #5A6472;
  background: #F7F8FA;
  border: 1px solid rgba(28,28,46,0.12);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s;
}

.sc-role-btn:hover {
  border-color: #43DBA3;
  color: #1C1C2E;
}

.sc-role-btn.active {
  background: rgba(67,219,163,0.10);
  border-color: #43DBA3;
  color: #1C1C2E;
}

/* ── Toggle ──────────────────────────────────────────────────────────────── */

.sc-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.sc-toggle-label {
  font-size: 14px;
  color: #1C1C2E;
}

.sc-toggle {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 22px;
  flex-shrink: 0;
}

.sc-toggle input { opacity: 0; width: 0; height: 0; }

.sc-toggle-slider {
  position: absolute;
  inset: 0;
  background: rgba(28,28,46,0.12);
  border-radius: 22px;
  cursor: pointer;
  transition: background 0.2s;
}

.sc-toggle-slider::before {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  background: #FFFFFF;
  border-radius: 50%;
  left: 3px;
  top: 3px;
  transition: transform 0.2s;
}

.sc-toggle input:checked + .sc-toggle-slider { background: #43DBA3; }
.sc-toggle input:checked + .sc-toggle-slider::before { transform: translateX(18px); }

.sc-toggle-hint {
  font-size: 12px;
  color: #8B92A1;
  margin-top: 8px;
  display: none;
}

.sc-toggle-hint.visible { display: block; }

/* ── Textareas ───────────────────────────────────────────────────────────── */

.sc-textarea-wrap { position: relative; }

.sc-textarea-label {
  font-size: 13px;
  font-weight: 500;
  color: #5A6472;
  margin-bottom: 8px;
  display: block;
}

.sc-textarea {
  width: 100%;
  padding: 12px 14px;
  font-family: 'Heebo', sans-serif;
  font-size: 13px;
  line-height: 1.55;
  color: #1C1C2E;
  background: #F7F8FA;
  border: 1px solid rgba(28,28,46,0.12);
  border-radius: 8px;
  resize: vertical;
  outline: none;
  transition: border-color 0.15s;
}

.sc-textarea:focus { border-color: #43DBA3; }

.sc-textarea-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 10px;
  gap: 8px;
}

/* ── Countdown indicator ─────────────────────────────────────────────────── */

.sc-countdown {
  display: none;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: #5A6472;
}

.sc-countdown.visible { display: flex; }

.sc-countdown-text { font-variant-numeric: tabular-nums; }

/* ── Scorecard ───────────────────────────────────────────────────────────── */

.sc-scorecard {
  display: none;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}

.sc-scorecard.visible { display: grid; }

.sc-metric {
  background: #FFFFFF;
  border: 0.5px solid rgba(28,28,46,0.08);
  border-radius: 10px;
  padding: 14px 14px 12px;
  position: relative;
  overflow: hidden;
}

.sc-metric::before {
  content: '';
  position: absolute;
  top: 0;
  left: 14px;
  width: 20px;
  height: 2px;
  background: #43DBA3;
}

.sc-metric-label {
  font-size: 11px;
  color: #5A6472;
  margin: 6px 0 8px;
}

.sc-metric-val {
  font-size: 22px;
  font-weight: 500;
  color: #1C1C2E;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.sc-metric-val.muted { color: #8B92A1; font-weight: 400; }
.sc-metric-val.green { color: #1D9E75; }
.sc-metric-val.amber { color: #EF9F27; }
.sc-metric-val.red   { color: #E24B4A; }

.sc-metric-sub {
  font-size: 11px;
  color: #8B92A1;
  margin-top: 6px;
}

/* ── Note output ─────────────────────────────────────────────────────────── */

.sc-note-wrap {
  display: none;
  position: relative;
}

.sc-note-wrap.visible { display: block; }

.sc-note-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.sc-note-title {
  font-size: 13px;
  font-weight: 500;
  color: #5A6472;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.sc-note-output {
  width: 100%;
  padding: 14px 16px;
  font-family: 'Heebo', sans-serif;
  font-size: 13px;
  line-height: 1.65;
  color: #1C1C2E;
  background: #F7F8FA;
  border: 1px solid rgba(28,28,46,0.12);
  border-radius: 8px;
  resize: vertical;
  min-height: 280px;
  outline: none;
}

.sc-note-output:focus { border-color: #43DBA3; }

/* ── Confidence dots ─────────────────────────────────────────────────────── */

.sc-confidence-legend {
  display: flex;
  gap: 16px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.sc-conf-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #5A6472;
}

.sc-conf-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.sc-conf-dot.green { background: #43DBA3; }
.sc-conf-dot.amber { background: #EF9F27; }
.sc-conf-dot.red   { background: #E24B4A; }

/* ── Evidence panel (Phase 2 — gated, shell only) ────────────────────────── */
/* See index.html's H. comment + scribe.js EVIDENCE_TAB_ENABLED for the gate. */

.sc-evidence {
  display: none;
  background: #FFFFFF;
  border: 0.5px solid rgba(28,28,46,0.08);
  border-radius: 12px;
  margin-top: 16px;
  overflow: hidden;
}

.sc-evidence.visible { display: block; }

.sc-evidence-head {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 14px 18px;
  font-family: 'Heebo', sans-serif;
  background: transparent;
  border: none;
  cursor: pointer;
  text-align: left;
}

.sc-evidence-mark {
  width: 2px;
  height: 14px;
  border-radius: 1px;
  background: #43DBA3;
  flex-shrink: 0;
}

.sc-evidence-label {
  font-size: 13px;
  font-weight: 500;
  color: #1C1C2E;
}

.sc-evidence-chevron {
  margin-left: auto;
  color: #43DBA3;
  font-size: 13px;
  transition: transform 0.15s ease;
}

.sc-evidence.collapsed .sc-evidence-chevron { transform: rotate(-90deg); }
.sc-evidence.collapsed .sc-evidence-body { display: none; }

.sc-evidence-body {
  padding: 0 18px 16px;
}

.sc-evidence-skel {
  height: 11px;
  border-radius: 6px;
  background: linear-gradient(90deg, #F1F3F5, #E5E7EB, #F1F3F5);
  background-size: 200% 100%;
  animation: sc-evidence-shimmer 1.2s ease-in-out infinite;
  margin-bottom: 8px;
}

@keyframes sc-evidence-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.sc-evidence-empty {
  font-size: 12px;
  color: #8B92A1;
  line-height: 1.55;
}

/* ── Sign button + post-sign ─────────────────────────────────────────────── */

.sc-sign-row {
  display: none;
  margin-top: 20px;
  text-align: center;
}

.sc-sign-row.visible { display: block; }

.sc-signed-msg {
  display: none;
  font-size: 14px;
  font-weight: 500;
  color: #1D9E75;
  margin-top: 12px;
  text-align: center;
}

.sc-signed-msg.visible { display: block; }

/* ── Feedback form ───────────────────────────────────────────────────────── */

.sc-feedback {
  display: none;
  background: #FFFFFF;
  border: 0.5px solid rgba(28,28,46,0.08);
  border-radius: 12px;
  padding: 20px 22px;
  margin-top: 16px;
}

.sc-feedback.visible { display: block; }

.sc-feedback-title {
  font-size: 13px;
  font-weight: 600;
  color: #1C1C2E;
  margin-bottom: 16px;
}

.sc-feedback-q {
  margin-bottom: 14px;
}

.sc-feedback-q-label {
  font-size: 13px;
  color: #1C1C2E;
  margin-bottom: 8px;
}

.sc-fb-row {
  display: flex;
  gap: 8px;
}

.sc-fb-btn {
  padding: 7px 18px;
  font-family: 'Heebo', sans-serif;
  font-size: 13px;
  font-weight: 500;
  color: #5A6472;
  background: #F7F8FA;
  border: 1px solid rgba(28,28,46,0.12);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s;
}

.sc-fb-btn:hover { border-color: #43DBA3; color: #1C1C2E; }
.sc-fb-btn.selected { background: rgba(67,219,163,0.10); border-color: #43DBA3; color: #1C1C2E; }

.sc-feedback-done {
  display: none;
  font-size: 13px;
  color: #1D9E75;
  font-weight: 500;
  margin-top: 12px;
  text-align: center;
}

.sc-feedback-done.visible { display: block; }

/* ── Loading state ───────────────────────────────────────────────────────── */

.sc-generating {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 24px;
  font-size: 13px;
  color: #5A6472;
}

.sc-generating.visible { display: flex; }

.sc-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(67,219,163,0.3);
  border-top-color: #43DBA3;
  border-radius: 50%;
  animation: sc-spin 0.7s linear infinite;
}

@keyframes sc-spin { to { transform: rotate(360deg); } }

/* ── Demo label ──────────────────────────────────────────────────────────── */

.sc-demo-label {
  display: none;
  font-size: 12px;
  color: #8B92A1;
  font-style: italic;
  margin-top: 6px;
}

.sc-demo-label.visible { display: block; }

/* ── Footer ──────────────────────────────────────────────────────────────── */

.sc-footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 6px;
  font-size: 11px;
  color: #8B92A1;
  padding-top: 20px;
  border-top: 0.5px solid rgba(28,28,46,0.08);
  margin-top: 40px;
}

.sc-footer-ekg {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
}

.sc-footer-dot {
  width: 4px;
  height: 4px;
  background: #43DBA3;
  border-radius: 50%;
}

.sc-footer-wm { font-weight: 500; color: #5A6472; letter-spacing: 0.02em; }
.sc-footer-tag { font-style: italic; color: #5A6472; }

.sc-footer-beta {
  color: #8B92A1;
  font-size: 11px;
}

/* ── Responsive ──────────────────────────────────────────────────────────── */

@media (max-width: 700px) {
  .sc-scorecard { grid-template-columns: repeat(2, 1fr); }
  .sc-hdr { flex-wrap: wrap; gap: 8px; }
  .sc-gate { padding: 28px 18px; margin: 32px auto; }
  .sc-gate-row { flex-direction: column; }
}
