/* ==========================================================================
   RAPIDOLAUDO - CLEAN INDUSTRIAL MEDICAL WORKSTATION (PLATINUM & TITANIUM)
   Layout Espaçoso, Sem Poluição Visual, Foco no Laudo + Pop-up DICOM Integrado
   ========================================================================== */

:root {
  /* Paleta Base: Cinza Industrial Claro, Platina e Aço Cirúrgico */
  --chassis-bg: #e2e8f0;          /* Fundo base cinza metálico neutro */
  --chassis-panel: #edf2f7;       /* Painéis de alumínio anodizado */
  --chassis-surface: #ffffff;     /* Superfícies de cartões e inputs */
  --chassis-border: #cbd5e1;      /* Linhas de precisão */
  --chassis-border-active: #0284c7;

  /* Tipografia Industrial */
  --text-main: #0f172a;           /* Titânio escuro de alta legibilidade */
  --text-sub: #334155;            /* Grafite médico */
  --text-muted: #64748b;          /* Aço neutro */
  --font-mono: "JetBrains Mono", "SF Mono", "Courier New", monospace;
  --font-sans: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, sans-serif;

  /* Cores de Instrumentação e LED */
  --instrument-cyan: #0284c7;
  --instrument-cyan-light: #e0f2fe;
  --instrument-emerald: #059669;
  --instrument-emerald-light: #d1fae5;
  --instrument-amber: #d97706;
  --instrument-amber-light: #fef3c7;
  --instrument-ruby: #dc2626;

  /* Acabamento Tátil */
  --hardware-bevel: inset 0 1px 0 #ffffff, 0 1px 3px rgba(15, 23, 42, 0.08);
  --hardware-shadow: 0 2px 0 #94a3b8, 0 3px 6px rgba(15, 23, 42, 0.1);
  --hardware-inset: inset 0 1.5px 3px rgba(15, 23, 42, 0.08);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
}

body {
  background-color: var(--chassis-bg);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  overflow-y: auto; /* Permite rolagem geral se a janela for baixa */
}

/* ==========================================================================
   SCROLLBAR INDUSTRIAL VISÍVEL E CONFORTÁVEL
   ========================================================================== */
::-webkit-scrollbar {
  width: 14px;
  height: 14px;
}

::-webkit-scrollbar-track {
  background: #cbd5e1;
  border-left: 1px solid #94a3b8;
}

::-webkit-scrollbar-thumb {
  background: #64748b;
  border-radius: 4px;
  border: 2px solid #cbd5e1;
}

::-webkit-scrollbar-thumb:hover {
  background: #334155;
}

/* Suporte padrão para Firefox */
* {
  scrollbar-width: thin;
  scrollbar-color: #64748b #cbd5e1;
}

/* ==========================================================================
   BARRA SUPERIOR (NAVBAR INDUSTRIAL LIMPA)
   ========================================================================== */
.navbar {
  background: linear-gradient(180deg, #ffffff 0%, #edf2f7 100%);
  border-bottom: 1.5px solid var(--chassis-border);
  height: 54px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  z-index: 50;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.06);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: var(--text-main);
}

.brand-radar-icon {
  width: 38px;
  height: 38px;
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  border: 1.5px solid #0284c7;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(2, 132, 199, 0.35);
  flex-shrink: 0;
  transition: transform 0.2s ease;
}

.brand:hover .brand-radar-icon {
  transform: scale(1.04);
}

.brand-text-block {
  display: flex;
  flex-direction: column;
}

.brand-name {
  font-size: 1.25rem;
  font-weight: 900;
  letter-spacing: 0.5px;
  color: #0f172a;
  line-height: 1.1;
  display: flex;
  align-items: center;
  gap: 2px;
}

.brand-name-voxel {
  color: #0f172a;
}

.brand-name-med {
  color: #0284c7;
  position: relative;
}

.brand-sub {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.5px;
  color: #475569;
  text-transform: uppercase;
  font-weight: 700;
  margin-top: 2px;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.nav-link-industrial {
  text-decoration: none;
  color: var(--text-sub);
  font-size: 0.85rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.75rem;
  border-radius: 6px;
  border: 1px solid var(--chassis-border);
  background: #ffffff;
  box-shadow: var(--hardware-bevel);
  transition: all 0.15s ease;
}

.nav-link-industrial:hover, .nav-link-industrial.active {
  color: var(--instrument-cyan);
  border-color: #0284c7;
  background: #f0f9ff;
}

.station-telemetry {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: #e2e8f0;
  padding: 0.3rem 0.85rem;
  border-radius: 6px;
  border: 1px solid #cbd5e1;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: #1e293b;
  font-weight: 700;
}

.telemetry-led {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.led-green {
  background-color: var(--instrument-emerald);
  box-shadow: 0 0 6px rgba(5, 150, 105, 0.8);
}

.led-cyan {
  background-color: var(--instrument-cyan);
  box-shadow: 0 0 6px rgba(2, 132, 199, 0.8);
}

/* ==========================================================================
   APP CONTAINER (LAYOUT LIMPO: SIDEBAR COMPACTA + STUDIO ESPAÇOSO)
   ========================================================================== */
.app-container {
  display: flex;
  flex: 1;
  min-height: calc(100vh - 54px);
  background-color: var(--chassis-bg);
}

/* 1. SIDEBAR DE EXAMES (COMPACTA E ORGANIZADA) */
.worklist-panel {
  width: 320px;
  background: var(--chassis-panel);
  border-right: 1.5px solid var(--chassis-border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  height: calc(100vh - 54px);
  position: sticky;
  top: 54px;
}

.worklist-header {
  padding: 0.75rem 0.85rem;
  background: #e2e8f0;
  border-bottom: 1.5px solid var(--chassis-border);
}

.worklist-hud-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}

.hud-title {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--text-main);
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.hud-badge {
  background-color: #0f172a;
  color: #ffffff;
  padding: 0.1rem 0.45rem;
  border-radius: 4px;
  font-size: 0.7rem;
  font-family: var(--font-mono);
  font-weight: 800;
}

.search-input-tactical {
  width: 100%;
  background: #ffffff;
  border: 1.5px solid var(--chassis-border);
  color: var(--text-main);
  padding: 0.45rem 0.75rem;
  border-radius: 6px;
  font-size: 0.82rem;
  font-weight: 600;
  outline: none;
  box-shadow: var(--hardware-inset);
  transition: all 0.15s ease;
}

.search-input-tactical:focus {
  border-color: var(--instrument-cyan);
  box-shadow: 0 0 0 2px rgba(2, 132, 199, 0.2);
}

.generator-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.35rem;
  margin-top: 0.5rem;
}

.btn-tactical {
  background: linear-gradient(180deg, #ffffff 0%, #f1f5f9 100%);
  border: 1px solid #94a3b8;
  color: var(--text-main);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.35rem 0.5rem;
  border-radius: 5px;
  cursor: pointer;
  text-align: center;
  transition: all 0.12s ease;
  box-shadow: 0 1.5px 0 #cbd5e1;
}

.btn-tactical:hover {
  background: #ffffff;
  color: var(--instrument-cyan);
  border-color: var(--instrument-cyan);
}

.btn-tactical-hero {
  grid-column: span 2;
  background: linear-gradient(180deg, #0284c7 0%, #0369a1 100%);
  border-color: #0369a1;
  color: #ffffff;
  box-shadow: 0 2px 0 #075985;
}

.btn-tactical-hero:hover {
  background: linear-gradient(180deg, #0369a1 0%, #075985 100%);
  color: #ffffff;
}

.exam-list {
  flex: 1;
  overflow-y: auto;
  list-style: none;
  padding: 0.5rem;
}

.exam-card-industrial {
  background: #ffffff;
  border: 1.5px solid var(--chassis-border);
  border-radius: 8px;
  padding: 0.75rem 0.85rem;
  margin-bottom: 0.45rem;
  cursor: pointer;
  transition: all 0.15s ease;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.05);
}

.exam-card-industrial:hover {
  border-color: #64748b;
  transform: translateY(-1px);
}

.exam-card-industrial.selected {
  background: linear-gradient(180deg, #f0f9ff 0%, #e0f2fe 100%);
  border: 2px solid var(--instrument-cyan);
  box-shadow: 0 2px 8px rgba(2, 132, 199, 0.2);
}

.exam-card-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.2rem;
}

.patient-title-tactical {
  font-size: 0.9rem;
  font-weight: 800;
  color: var(--text-main);
}

.protocol-tag-tactical {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 700;
  color: #0369a1;
  background: #e0f2fe;
  padding: 1px 5px;
  border-radius: 4px;
}

.study-desc-tactical {
  font-size: 0.78rem;
  color: #475569;
  font-weight: 600;
  margin-bottom: 0.35rem;
}

.card-status-pill {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 800;
  padding: 1px 6px;
  border-radius: 4px;
  text-transform: uppercase;
}

.status-green {
  background: var(--instrument-emerald-light);
  color: #065f46;
  border: 1px solid #a7f3d0;
}

.status-amber {
  background: var(--instrument-amber-light);
  color: #92400e;
  border: 1px solid #fde68a;
}

/* ==========================================================================
   2. LAUDO STUDIO PRINCIPAL (ESPAÇOSO, LIMPO E SEM APERTO)
   ========================================================================== */
.report-editor-panel-clean {
  flex: 1;
  background: #f1f5f9;
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 54px);
  padding-bottom: 2rem;
}

/* Topbar do Exame Selecionado */
.editor-header-clean {
  padding: 1rem 1.75rem;
  background: #ffffff;
  border-bottom: 1.5px solid var(--chassis-border);
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.05);
  flex-shrink: 0;
}

.patient-hud-grid-clean {
  display: grid;
  grid-template-columns: repeat(4, 1fr) auto;
  gap: 0.75rem;
  background: #f8fafc;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  border: 1.5px solid var(--chassis-border);
  margin-top: 0.75rem;
  align-items: center;
}

.hud-item {
  display: flex;
  flex-direction: column;
}

.hud-label {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--text-muted);
  text-transform: uppercase;
  font-weight: 800;
}

.hud-val {
  font-size: 0.9rem;
  font-weight: 800;
  color: var(--text-main);
}

/* DECK RÁPIDO DE IMAGENS DICOM (SUBSTITUI A TELA PRETA PESADA NO MEIO) */
.dicom-quick-strip {
  margin: 1rem 1.75rem 0.25rem 1.75rem;
  background: #ffffff;
  border: 1.5px solid var(--chassis-border);
  border-radius: 10px;
  padding: 0.75rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  box-shadow: var(--hardware-bevel);
}

.quick-strip-left {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  overflow-x: auto;
  flex: 1;
}

.quick-thumb-card {
  height: 58px;
  width: 82px;
  border-radius: 6px;
  overflow: hidden;
  border: 1.5px solid #94a3b8;
  cursor: pointer;
  flex-shrink: 0;
  position: relative;
  background: #000;
  transition: all 0.15s ease;
}

.quick-thumb-card:hover {
  border-color: var(--instrument-cyan);
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(2, 132, 199, 0.25);
}

.quick-thumb-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.btn-inspect-modal {
  background: linear-gradient(180deg, #0284c7 0%, #0369a1 100%);
  color: #ffffff;
  border: 1px solid #075985;
  padding: 0.6rem 1.25rem;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 800;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  white-space: nowrap;
  box-shadow: var(--hardware-shadow);
  transition: all 0.15s ease;
}

.btn-inspect-modal:hover {
  background: linear-gradient(180deg, #0369a1 0%, #075985 100%);
  transform: translateY(-1px);
}

/* BOX DA IA LIMPO */
.ai-advisor-clean {
  margin: 0.75rem 1.75rem 0.25rem 1.75rem;
  background: #ffffff;
  border: 1.5px solid #86efac;
  border-radius: 10px;
  padding: 0.85rem 1.25rem;
  box-shadow: 0 1px 4px rgba(16, 185, 129, 0.1);
}

.ai-hud-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.4rem;
}

.ai-core-chip {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 800;
  color: #065f46;
  text-transform: uppercase;
}

.ai-alert-box {
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 6px;
  padding: 0.6rem 0.85rem;
  font-size: 0.82rem;
  color: #92400e;
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
}

/* CORPO DO LAUDO ESPAÇOSO */
.editor-body-clean {
  padding: 0.75rem 1.75rem 1.5rem 1.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  max-width: 1200px;
  width: 100%;
}

.dictation-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #ffffff;
  padding: 0.55rem 0.85rem;
  border-radius: 8px;
  border: 1.5px solid var(--chassis-border);
  box-shadow: var(--hardware-bevel);
  flex-wrap: wrap;
  gap: 0.5rem;
}

.btn-mic-tactical {
  background: linear-gradient(180deg, #ef4444 0%, #dc2626 100%);
  color: #ffffff;
  border: 1px solid #b91c1c;
  padding: 0.4rem 0.8rem;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  box-shadow: 0 1.5px 0 #991b1b;
  transition: all 0.12s ease;
}

.btn-mic-tactical.recording {
  background: linear-gradient(180deg, #10b981 0%, #059669 100%);
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.6);
}

.form-label-tactical {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--text-sub);
  text-transform: uppercase;
  margin-bottom: 0.3rem;
  display: block;
}

.textarea-tactical {
  width: 100%;
  background: #ffffff;
  border: 1.5px solid var(--chassis-border);
  border-radius: 8px;
  padding: 0.75rem 0.95rem;
  font-size: 0.92rem;
  color: var(--text-main);
  line-height: 1.55;
  outline: none;
  resize: vertical;
  box-shadow: var(--hardware-inset);
  transition: all 0.15s ease;
}

.textarea-tactical:focus {
  border-color: var(--instrument-cyan);
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15);
}

.textarea-conclusion-glow {
  background: #f0f9ff;
  border: 2px solid #38bdf8;
  color: #0c4a6e;
  font-weight: 700;
}

/* RODAPÉ DO LAUDO (BOTÃO DE HOMOLOGAÇÃO EM 1 CLIQUE) */
.editor-footer-clean {
  padding: 1rem 1.75rem;
  background: #ffffff;
  border-top: 1.5px solid var(--chassis-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  bottom: 0;
  z-index: 20;
  box-shadow: 0 -2px 6px rgba(15, 23, 42, 0.04);
}

.btn-hero-sign {
  background: linear-gradient(180deg, #059669 0%, #047857 100%);
  color: #ffffff;
  border: 1px solid #065f46;
  padding: 0.85rem 2rem;
  border-radius: 8px;
  font-size: 0.98rem;
  font-weight: 900;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  box-shadow: 0 2.5px 0 #064e3b, 0 4px 10px rgba(5, 150, 105, 0.25);
  transition: all 0.15s ease;
}

.btn-hero-sign:hover {
  background: linear-gradient(180deg, #10b981 0%, #059669 100%);
  transform: translateY(-1px);
}

.btn-action-outline {
  background: linear-gradient(180deg, #ffffff 0%, #f1f5f9 100%);
  border: 1.5px solid var(--chassis-border);
  color: var(--text-main);
  padding: 0.65rem 1.15rem;
  border-radius: 8px;
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  text-decoration: none;
  box-shadow: var(--hardware-bevel);
  transition: all 0.15s ease;
}

.btn-action-outline:hover {
  border-color: var(--instrument-cyan);
  color: var(--instrument-cyan);
}

/* ==========================================================================
   POP-UP MODAL DICOM (VISUALIZADOR TELA CHEIA QUANDO O MÉDICO DESEJAR)
   ========================================================================== */
.dicom-lightbox-modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(6px);
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.dicom-lightbox-modal.open {
  display: flex;
}

.dicom-lightbox-window {
  background: #111827;
  border: 2px solid #374151;
  border-radius: 12px;
  max-width: 1100px;
  width: 95vw;
  height: 88vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
  position: relative;
}

.lightbox-header {
  padding: 0.75rem 1.25rem;
  background: #1f2937;
  border-bottom: 1.5px solid #374151;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: white;
}

.lightbox-viewport-area {
  flex: 1;
  background: #000000;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  user-select: none;
}

.lightbox-img {
  max-width: 96%;
  max-height: 94%;
  object-fit: contain;
  pointer-events: none;
}

.lightbox-footer-strip {
  height: 90px;
  background: #111827;
  border-top: 1.5px solid #1f2937;
  display: flex;
  align-items: center;
  padding: 0.5rem 1.25rem;
  gap: 0.75rem;
  overflow-x: auto;
}

/* PORTAL DO PACIENTE E MODAL HISTÓRICO */
.patient-app-wrapper {
  max-width: 1050px;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem 1.5rem;
}

.patient-hero-chassis {
  background: #ffffff;
  border: 1.5px solid var(--chassis-border);
  border-radius: 12px;
  padding: 1.75rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--hardware-bevel);
}

.kpi-chassis-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 1.75rem;
}

.kpi-chassis-card {
  background: #ffffff;
  border: 1.5px solid var(--chassis-border);
  border-radius: 8px;
  padding: 1rem 1.25rem;
  box-shadow: var(--hardware-bevel);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.modal-backdrop.open {
  display: flex;
}

.modal-window-industrial {
  background: #ffffff;
  border: 1.5px solid var(--chassis-border);
  border-radius: 12px;
  max-width: 800px;
  width: 100%;
  max-height: 82vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 16px 36px rgba(15, 23, 42, 0.2);
}

.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #0f172a;
  color: #ffffff;
  padding: 0.75rem 1.25rem;
  border-radius: 8px;
  font-size: 0.88rem;
  font-weight: 600;
  border: 1.5px solid #38bdf8;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
  display: flex;
  align-items: center;
  gap: 0.65rem;
  z-index: 9999;
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.25s ease;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}
[hidden] {
  display: none !important;
}

.login-page {
  display: grid;
  place-items: start center;
  padding: clamp(24px, 9vh, 96px) 16px 40px;
  background: #edf2f6;
}

.login-card {
  width: min(100%, 420px);
  padding: clamp(20px, 5vw, 36px);
  background: #fff;
  border: 1px solid #d7e0e8;
  border-radius: 16px;
  box-shadow: 0 8px 28px #22354b12;
}

.login-brand {
  color: #075d82;
  font-weight: 800;
  margin-bottom: 16px;
}

.login-card h1 {
  margin: 0 0 8px;
  font-size: clamp(1.4rem, 4vw, 1.85rem);
  line-height: 1.2;
}

.login-card form {
  display: grid;
  gap: 8px;
  margin-top: 22px;
}

.login-card label {
  font-weight: 600;
}

.login-card input {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid #8294a5;
  border-radius: 6px;
  font: inherit;
  margin-bottom: 6px;
}

.login-card button[type="submit"],
.patient-download {
  justify-content: center;
  min-height: 44px;
  margin-top: 6px;
  text-transform: none;
}

.login-card [role="status"]:empty {
  display: none;
}

.login-card a:not(.btn-hero-sign) {
  display: inline-block;
  color: #075d82;
  margin-top: 16px;
}

.patient-card {
  width: min(100%, 560px);
}

.patient-status {
  color: #075d82;
  margin: 0 0 10px;
  font-weight: 700;
}

.patient-download {
  display: flex;
  margin: 18px 0 24px;
}

.patient-photos {
  margin: 24px 0;
}

.patient-photos h2 {
  font-size: 1.1rem;
  margin-bottom: 8px;
}

#patient-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 112px), 1fr));
  gap: 8px;
}

#patient-gallery button {
  padding: 0;
  border: 1px solid #ccd7e0;
  background: #101820;
  border-radius: 6px;
  overflow: hidden;
  cursor: pointer;
}

#patient-gallery img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: contain;
}

.clinical-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.06fr);
  gap: 18px;
  padding: 16px;
}

.clinical-images, .clinical-report {
  min-width: 0;
  align-self: start;
}

.clinical-section-heading, .clinical-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.clinical-section-heading {
  min-height: 34px;
  margin-bottom: 8px;
}

.clinical-section-heading h3 {
  margin: 0;
  font-size: 1rem;
}

.clinical-preview {
  display: grid;
  place-items: center;
  min-height: 240px;
  aspect-ratio: 4 / 3;
  color: #e2e8f0;
  background: #101820;
  border-radius: 8px;
  overflow: hidden;
}

.clinical-preview p {
  margin: 16px;
  text-align: center;
}

.clinical-preview img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.clinical-images .quick-strip-left {
  margin-top: 8px;
}

.clinical-report .editor-body-clean {
  padding: 12px;
  background: #fff;
  border: 1px solid #d8e3ec;
  border-radius: 8px;
}

.clinical-footer {
  gap: 12px;
  flex-wrap: wrap;
}

.clinical-dialog {
  margin: auto;
  width: min(92vw, 440px);
  padding: 24px;
  border: 1px solid #d7e0e8;
  border-radius: 12px;
  background: #fff;
  color: #132338;
}

.clinical-dialog p {
  margin: 9px 0 14px;
}

.clinical-dialog::backdrop {
  background: #091720aa;
}

.patient-image-dialog {
  width: min(92vw, 850px);
}

.patient-image-dialog img {
  display: block;
  max-width: 100%;
  max-height: 75vh;
  margin: 12px auto 0;
}

.import-summary {
  padding: 8px 12px;
  font-size: 0.8rem;
}

#catalog-fields {
  display: grid;
  gap: 10px;
  margin: 14px 0;
}

#catalog-fields label {
  display: grid;
  gap: 4px;
  font-weight: 600;
}

:focus-visible {
  outline: 2px solid #0870a3;
  outline-offset: 3px;
}

@media (max-width: 1050px) {
  .clinical-workspace {
    grid-template-columns: minmax(0, 1fr);
  }

  .clinical-preview {
    height: clamp(240px, 42vh, 410px);
    aspect-ratio: auto;
  }
}
