/* Bien Estar — GUI web alineada a app desktop PyQt6 */

:root {
  color-scheme: dark;
  --bg: #061A23;
  --bg-panel: #0B222D;
  --bg-input: #081F2A;
  --bg-summary: #0C303B;
  --bg-detail: #0B4D57;
  --border: #164D58;
  --border-strong: #1A6370;
  --ink: #EAF7F4;
  --ink-soft: #D9F8EE;
  --muted: #B8D6D2;
  --accent: #A7E85A;
  --btn: #0B4D57;
  --btn-hover: #106B78;
  --btn-primary: #12A3A8;
  --btn-primary-hover: #18BEC4;
  --btn-sign: #A7E85A;
  --btn-sign-hover: #BCFF72;
  --ok: #A7E85A;
  --amber: #FFD27A;
  --bad: #FF8A8A;
  --neutral: #7A9A94;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  font-size: 13px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink-soft);
}

button, input, select, textarea { font: inherit; }

.app-shell {
  max-width: 1680px;
  margin: 0 auto;
  padding: 8px max(10px, env(safe-area-inset-right)) calc(72px + env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left));
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.card {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 14px;
}

/* Menú */
.menubar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 20px;
  padding: 6px 10px;
  background: #081F2A;
  border: 1px solid var(--border);
  border-radius: 10px;
}

.menu-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.menu-title {
  font-weight: 800;
  color: var(--accent);
  margin-right: 4px;
}

.menu-link, .btn-ghost {
  background: transparent;
  border: 0;
  color: var(--ink);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  font-weight: 600;
}

.menu-link:hover, .btn-ghost:hover { background: #0B4D57; }

.menubar-favicon {
  display: block;
  width: 28px;
  height: 28px;
  object-fit: contain;
  border-radius: 8px;
  flex-shrink: 0;
  box-shadow: 0 0 0 1px rgba(167, 232, 90, 0.25);
}

.menubar-logo-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px;
  margin: 0;
  background: transparent;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  color: inherit;
}

.menubar-logo-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.menubar-version {
  display: none;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}

.menubar-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.menubar-toggle {
  display: none;
  min-height: 44px;
  padding: 8px 14px;
  font-weight: 800;
}

.menubar-nav {
  display: contents;
}

.badge {
  padding: 4px 10px;
  border-radius: 999px;
  background: #082833;
  border: 1px solid var(--border-strong);
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
}

.badge.offline { color: var(--bad); border-color: var(--bad); }

/* Header */
.hero-header {
  display: grid;
  grid-template-columns: auto 1fr minmax(220px, 320px);
  gap: 14px;
  align-items: center;
  padding: 10px 14px;
  background: linear-gradient(90deg, #071A24 0%, #0B4D57 48%, #061A23 100%);
  border-color: var(--border-strong);
  position: relative;
}

.hero-header-close {
  display: none;
}

.hero-logo {
  width: 80px;
  height: 80px;
  object-fit: contain;
  display: block;
  background: transparent;
}

.mark {
  width: 64px;
  height: 64px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, #0B4D57, var(--accent));
  color: #051920;
  font-weight: 900;
  font-size: 22px;
}

.hero-header h1 {
  margin: 0;
  font-size: 24px;
  font-weight: 900;
  color: #fff;
}

.subtitle { margin: 2px 0 0; color: var(--muted); font-size: 13px; }

.hero-pro {
  text-align: right;
  font-size: 12px;
  line-height: 1.45;
  color: var(--ink);
}

/* Group boxes */
.group-box { padding: 10px 12px 12px; }

.group-title {
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 800;
  color: var(--accent);
}

.panel-title {
  margin: 0 0 6px;
  font-size: 12px;
  font-weight: 800;
  color: var(--accent);
}

.panel-box-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}

.panel-box-head .panel-title {
  margin: 0;
  flex: 1 1 200px;
  min-width: 0;
}

.viewer-mobile-toggle {
  display: none;
  flex-shrink: 0;
  white-space: nowrap;
}

/* Botones desktop */
.btn {
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  padding: 8px 12px;
  background: var(--btn);
  color: #fff;
  font-weight: 800;
  cursor: pointer;
  min-height: 38px;
  transition: background 0.12s;
}

.btn:hover { background: var(--btn-hover); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

label.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  text-align: center;
}

.btn-primary {
  background: var(--btn-primary);
  color: #051920;
  border-color: #18BEC4;
}

.btn-primary:hover { background: var(--btn-primary-hover); }

.btn-sign {
  background: var(--btn-sign);
  color: #051920;
  border-color: #BCFF72;
  font-size: 15px;
  min-height: 48px;
}

.btn-sign:hover { background: var(--btn-sign-hover); }

.btn-sm { min-height: 34px; padding: 6px 8px; font-size: 12px; }

/* Ficha paciente */
.patient-grid {
  display: grid;
  grid-template-columns: auto 1fr auto 1fr auto 1fr auto 1fr auto auto auto;
  gap: 6px 8px;
  align-items: center;
}

.patient-grid label {
  font-weight: 700;
  color: var(--ink-soft);
  white-space: nowrap;
}

.patient-grid .span-3 { grid-column: span 3; }
.patient-grid .span-7 { grid-column: span 7; }

.patient-grid select {
  min-height: 40px;
}

.patient-db-label {
  grid-column: span 4;
  margin: 0;
  padding: 6px;
  font-size: 12px;
  color: var(--amber);
  background: #071A24;
  border: 1px solid var(--border);
  border-radius: 10px;
}

.patient-db-label.saved { color: var(--accent); }

input, select, textarea {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  padding: 8px;
  color: #fff;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  outline: none;
}

/* Barra de trabajo */
.actions-box {
  position: relative;
}

.import-hint {
  margin: 0 0 8px;
  font-size: 12px;
  color: var(--muted);
}

#import-drop-zone.import-drop-active {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(167, 232, 90, 0.2);
}

.file-input-offscreen {
  position: absolute;
  left: -10000px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0.001;
  pointer-events: none;
}

.camera-batch-bar {
  margin: 10px 0 12px;
  padding: 12px 14px;
  border: 1px solid rgba(78, 203, 255, 0.45);
  border-radius: 12px;
  background: linear-gradient(160deg, rgba(8, 28, 58, 0.95), rgba(4, 14, 32, 0.92));
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
}

.camera-batch-bar.is-highlight {
  animation: batch-bar-pulse 1.4s ease-out;
  border-color: rgba(126, 232, 255, 0.85);
}

@keyframes batch-bar-pulse {
  0% { box-shadow: 0 0 0 0 rgba(126, 232, 255, 0.45); }
  70% { box-shadow: 0 0 0 12px rgba(126, 232, 255, 0); }
  100% { box-shadow: 0 0 0 0 rgba(126, 232, 255, 0); }
}

.camera-batch-actions .btn-primary#camera-batch-more {
  font-weight: 700;
}

.camera-batch-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 8px;
}

.camera-batch-hint {
  font-size: 11px;
  color: var(--muted);
}

.camera-batch-list {
  list-style: none;
  margin: 0 0 10px;
  padding: 0;
  display: grid;
  gap: 6px;
  max-height: 140px;
  overflow-y: auto;
}

.camera-batch-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.22);
  font-size: 12px;
}

.camera-batch-remove {
  border: 0;
  background: transparent;
  color: #ff8a8a;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
}

.camera-batch-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.camera-batch-quality {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.camera-batch-quality.quality-excellent { color: #5dffb0; border-color: rgba(93, 255, 176, 0.45); }
.camera-batch-quality.quality-good { color: #7ee8ff; border-color: rgba(126, 232, 255, 0.4); }
.camera-batch-quality.quality-fair { color: #ffd27a; border-color: rgba(255, 210, 122, 0.4); }
.camera-batch-quality.quality-poor { color: #ff9a8a; border-color: rgba(255, 154, 138, 0.45); }

.camera-batch-summary {
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 6px;
}

.camera-guide-dialog {
  padding: 0;
  border: 0;
  width: 100vw;
  max-width: 100vw;
  height: 100dvh;
  max-height: 100dvh;
  background: transparent;
  overflow: hidden;
}

.camera-guide-dialog::backdrop {
  background: rgba(2, 8, 20, 0.92);
  backdrop-filter: blur(6px);
}

.camera-guide-shell {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  max-height: 100dvh;
  background: #02060d;
  overflow: hidden;
}

.camera-guide-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-bottom: 1px solid rgba(78, 203, 255, 0.15);
  flex-shrink: 0;
}

.camera-guide-header-text {
  flex: 1;
  min-width: 0;
}

.camera-guide-kicker {
  margin: 0;
  font-size: 9px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(126, 232, 255, 0.75);
}

.camera-guide-device-summary {
  margin: 2px 0 0;
  font-size: 10px;
  color: rgba(180, 220, 240, 0.8);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.camera-guide-score-badge {
  font-size: 13px;
  font-weight: 700;
  color: #7ee8ff;
  padding: 4px 8px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(78, 203, 255, 0.3);
}

.camera-guide-score-badge.quality-excellent { color: #5dffb0; border-color: rgba(93, 255, 176, 0.45); }
.camera-guide-score-badge.quality-good { color: #7ee8ff; }
.camera-guide-score-badge.quality-fair { color: #ffd27a; border-color: rgba(255, 210, 122, 0.4); }
.camera-guide-score-badge.quality-poor { color: #ff9a8a; border-color: rgba(255, 138, 122, 0.4); }

.camera-guide-close {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border: 1px solid rgba(78, 203, 255, 0.35);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.35);
  color: #e8f6ff;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.camera-guide-close:active {
  transform: scale(0.96);
}

.camera-guide-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.camera-guide-viewport {
  position: relative;
  flex: 1;
  min-height: 0;
  width: 100%;
  background: #000;
  overflow: hidden;
  transition: box-shadow 0.35s ease;
}

.camera-guide-tip-compact {
  margin: 0;
  padding: 6px 12px;
  font-size: 11px;
  color: #c8e4f5;
  flex-shrink: 0;
  border-top: 1px solid rgba(78, 203, 255, 0.1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.camera-guide-details {
  flex-shrink: 0;
  max-height: 28dvh;
  overflow-y: auto;
  padding: 0 12px 8px;
  border-top: 1px solid rgba(78, 203, 255, 0.12);
}

.camera-guide-details.hidden {
  display: none;
}

.camera-guide-footer {
  flex-shrink: 0;
  padding: 8px 12px calc(8px + env(safe-area-inset-bottom, 0px));
  background: linear-gradient(180deg, rgba(2, 10, 22, 0.94), #02060d);
  border-top: 1px solid rgba(78, 203, 255, 0.2);
}

.camera-guide-footer-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
  margin-bottom: 8px;
}

.camera-guide-footer-main {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  margin-bottom: 8px;
}

.camera-capture-btn {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: 4px solid rgba(126, 232, 255, 0.9);
  background: rgba(78, 203, 255, 0.15);
  padding: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 24px rgba(78, 203, 255, 0.25);
}

.camera-capture-inner {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: linear-gradient(145deg, #5ee0ff, #2a9fd4);
}

.camera-capture-btn:active:not(:disabled) .camera-capture-inner {
  transform: scale(0.94);
}

.camera-capture-btn.is-locked {
  opacity: 0.45;
  border-color: rgba(255, 255, 255, 0.25);
  box-shadow: none;
  cursor: not-allowed;
}

.camera-capture-btn.is-locked .camera-capture-inner {
  background: linear-gradient(145deg, #6a7a88, #4a5560);
}

.camera-capture-btn.is-ready:not(:disabled) {
  border-color: rgba(93, 255, 176, 0.9);
  box-shadow: 0 0 28px rgba(93, 255, 176, 0.28);
}

.camera-capture-btn.is-pulse {
  animation: capture-btn-pulse 0.42s ease-out;
}

@keyframes capture-btn-pulse {
  0% { transform: scale(1); }
  40% { transform: scale(1.06); }
  100% { transform: scale(1); }
}

.camera-guide-shot-stats {
  margin: 0 0 6px;
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  color: #b8e8ff;
  letter-spacing: 0.02em;
}

.camera-capture-label {
  font-size: 11px;
  font-weight: 600;
  color: #e8f6ff;
}

.camera-guide-footer-sub {
  display: flex;
  gap: 6px;
  justify-content: center;
  flex-wrap: wrap;
}

.camera-tool-flash.is-on {
  background: rgba(255, 220, 120, 0.25);
  border-color: rgba(255, 220, 120, 0.75);
  color: #ffe9a8;
}

.camera-tool-flash:disabled {
  opacity: 0.35;
}

.camera-guide-frame {
  position: absolute;
  left: 7%;
  top: 10%;
  width: 86%;
  height: 76%;
  border: 2px solid rgba(126, 232, 255, 0.75);
  border-radius: 8px;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.42);
  pointer-events: none;
}

.camera-guide-frame.manual {
  pointer-events: auto;
  cursor: move;
  border-style: dashed;
}

.camera-guide-frame.paper-locked {
  border-color: rgba(93, 255, 176, 0.9);
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.48), 0 0 0 2px rgba(93, 255, 176, 0.35);
  transition: left 0.25s ease, top 0.25s ease, width 0.25s ease, height 0.25s ease, border-color 0.25s ease;
}

.camera-guide-handle {
  display: none;
  position: absolute;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #4ecbff;
  border: 2px solid #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.45);
  pointer-events: auto;
  touch-action: none;
}

.camera-guide-frame.manual .camera-guide-handle {
  display: block;
}

.camera-guide-handle[data-crop-handle="tl"] { top: -11px; left: -11px; cursor: nwse-resize; }
.camera-guide-handle[data-crop-handle="tr"] { top: -11px; right: -11px; cursor: nesw-resize; }
.camera-guide-handle[data-crop-handle="bl"] { bottom: -11px; left: -11px; cursor: nesw-resize; }
.camera-guide-handle[data-crop-handle="br"] { bottom: -11px; right: -11px; cursor: nwse-resize; }

.camera-guide-frame-label {
  position: absolute;
  left: 50%;
  bottom: -22px;
  transform: translateX(-50%);
  margin: 0;
  font-size: 10px;
  color: rgba(230, 245, 255, 0.92);
  white-space: nowrap;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.85);
  pointer-events: none;
}

.camera-guide-quality-panel {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 72px;
  height: 72px;
  pointer-events: none;
}

.camera-guide-score {
  font-size: 16px;
}

.camera-guide-header h2 {
  display: none;
}

.camera-guide-actions {
  display: none;
}

.camera-guide-toolbar {
  display: none;
}

.camera-guide-tips {
  display: none;
}

@media (min-width: 521px) {
  .camera-guide-dialog {
    width: min(480px, 100vw);
    height: min(92dvh, 820px);
    max-height: 92dvh;
    margin: auto;
  }

  .camera-guide-shell {
    height: 100%;
    max-height: 92dvh;
    border-radius: 16px;
    border: 1px solid rgba(78, 203, 255, 0.35);
  }
}

.camera-guide-viewport.is-ready {
  box-shadow: 0 0 0 2px rgba(93, 255, 176, 0.55), 0 0 28px rgba(93, 255, 176, 0.18);
}

.camera-guide-viewport.is-ready-pulse {
  animation: camera-ready-pulse 0.52s ease-out;
}

@keyframes camera-ready-pulse {
  0% { box-shadow: 0 0 0 0 rgba(93, 255, 176, 0.65); }
  70% { box-shadow: 0 0 0 14px rgba(93, 255, 176, 0); }
  100% { box-shadow: 0 0 0 0 rgba(93, 255, 176, 0); }
}

.camera-guide-viewport.is-ready .camera-guide-frame {
  border-color: rgba(93, 255, 176, 0.75);
}

.camera-guide-viewport.is-ready .camera-guide-corner {
  border-color: #5dffb0;
}

.camera-guide-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.camera-guide-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.camera-guide-overlay.can-tap-focus {
  pointer-events: auto;
  cursor: crosshair;
}

.camera-guide-quality-panel {
  pointer-events: none;
}

.camera-guide-focus-reticle {
  position: absolute;
  width: 56px;
  height: 56px;
  margin: -28px 0 0 -28px;
  border: 2px solid rgba(126, 232, 255, 0.95);
  border-radius: 50%;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.4);
  z-index: 4;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.camera-guide-focus-reticle.pulse {
  animation: focus-reticle-pulse 0.7s ease-out;
}

@keyframes focus-reticle-pulse {
  0% { transform: scale(1.35); opacity: 0.35; }
  100% { transform: scale(1); opacity: 1; }
}

.camera-guide-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 16px 0;
}

.camera-tool {
  border: 1px solid rgba(78, 203, 255, 0.35);
  background: rgba(0, 0, 0, 0.25);
  color: #d8f4ff;
  border-radius: 999px;
  padding: 7px 12px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}

.camera-tool.is-active {
  background: rgba(78, 203, 255, 0.22);
  border-color: rgba(126, 232, 255, 0.75);
  color: #fff;
}

.camera-tool:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.camera-lens-select {
  flex: 1 1 100%;
  min-width: 0;
  max-width: 100%;
  border: 1px solid rgba(78, 203, 255, 0.45);
  background: rgba(0, 0, 0, 0.35);
  color: #e8f6ff;
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 11px;
  font-weight: 600;
}

.camera-lens-select.hidden {
  display: none;
}

.camera-guide-device-summary {
  margin: 8px 16px 0;
  font-size: 11px;
  color: rgba(180, 220, 240, 0.85);
}

.camera-guide-device-status {
  margin: 4px 16px 0;
  font-size: 11px;
  color: var(--muted);
  min-height: 1.2em;
}

.camera-guide-device-status.ok { color: #5dffb0; }
.camera-guide-device-status.warn { color: #ffd27a; }

.camera-guide-manual-focus {
  padding: 8px 16px 0;
}

.camera-guide-manual-focus label {
  display: block;
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 4px;
}

.camera-guide-manual-focus input[type="range"] {
  width: 100%;
}

.camera-guide-enhance {
  margin: 10px 16px 0;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(78, 203, 255, 0.25);
  background: rgba(0, 0, 0, 0.22);
}

.camera-enhance-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.camera-feature-chip {
  font-size: 10px;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(78, 203, 255, 0.12);
  border: 1px solid rgba(78, 203, 255, 0.28);
  color: #b8e8ff;
}

.camera-feature-chip.muted {
  color: var(--muted);
  border-color: rgba(255, 255, 255, 0.1);
}

.camera-enhance-rows {
  display: grid;
  gap: 10px;
}

.camera-enhance-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: #e8f6ff;
  cursor: pointer;
}

.camera-enhance-slider label {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 4px;
}

.camera-enhance-slider input[type="range"] {
  width: 100%;
}

.camera-enhance-note {
  margin: 4px 0 0;
  font-size: 10px;
  color: var(--muted);
  line-height: 1.4;
}

.camera-guide-ring-svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.camera-guide-ring-bg {
  fill: none;
  stroke: rgba(255, 255, 255, 0.12);
  stroke-width: 7;
}

.camera-guide-ring-progress {
  fill: none;
  stroke: #4ecbff;
  stroke-width: 7;
  stroke-linecap: round;
  stroke-dasharray: 339.292;
  stroke-dashoffset: 339.292;
  transition: stroke-dashoffset 0.35s ease, stroke 0.35s ease;
}

.camera-guide-ring-progress.quality-excellent { stroke: #5dffb0; }
.camera-guide-ring-progress.quality-good { stroke: #4ecbff; }
.camera-guide-ring-progress.quality-fair { stroke: #ffd27a; }
.camera-guide-ring-progress.quality-poor { stroke: #ff8a7a; }

.camera-guide-score-wrap {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding-top: 4px;
}

.camera-guide-score {
  font-size: 20px;
  font-weight: 700;
  color: #fff;
  line-height: 1.1;
}

.camera-guide-level {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.camera-guide-level.quality-excellent { color: #5dffb0; }
.camera-guide-level.quality-good { color: #7ee8ff; }
.camera-guide-level.quality-fair { color: #ffd27a; }
.camera-guide-level.quality-poor { color: #ff9a8a; }

.camera-guide-score-caption {
  font-size: 8px;
  color: rgba(255, 255, 255, 0.55);
  margin-top: 2px;
}

.camera-guide-tips {
  padding: 12px 16px 8px;
  border-top: 1px solid rgba(78, 203, 255, 0.12);
}

.camera-guide-tip-main {
  margin: 0 0 6px;
  font-size: 13px;
  color: #e8f6ff;
  line-height: 1.45;
}

.camera-guide-tip-list {
  margin: 0;
  padding-left: 18px;
  color: rgba(200, 225, 240, 0.85);
  font-size: 11px;
  line-height: 1.4;
}

.camera-guide-checklist {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 16px 12px;
}

.camera-guide-check {
  font-size: 10px;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: rgba(220, 235, 245, 0.75);
  background: rgba(0, 0, 0, 0.2);
  transition: border-color 0.25s, color 0.25s, background 0.25s;
}

.camera-guide-check i { font-style: normal; margin-right: 4px; opacity: 0.85; }

.camera-guide-check.ok {
  color: #5dffb0;
  border-color: rgba(93, 255, 176, 0.45);
  background: rgba(93, 255, 176, 0.08);
}

.camera-guide-check.fair {
  color: #ffd27a;
  border-color: rgba(255, 210, 122, 0.4);
  background: rgba(255, 210, 122, 0.08);
}

.camera-guide-check.bad {
  color: #ff9a8a;
  border-color: rgba(255, 154, 138, 0.4);
  background: rgba(255, 154, 138, 0.08);
}

.camera-guide-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 0 16px 16px;
}

.camera-guide-actions .btn-primary:last-of-type {
  grid-column: span 2;
}

@media (max-width: 520px) {
  .camera-guide-dialog {
    width: 100vw;
    height: 100dvh;
    max-height: 100dvh;
  }

  .camera-guide-shell {
    border-radius: 0;
    min-height: 100dvh;
  }

  .camera-guide-viewport {
    max-height: none;
    flex: 1;
    aspect-ratio: auto;
    min-height: 48dvh;
  }
}

.workbar-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
}

.workbar-row .span-2 { grid-column: span 2; }

.ocr-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
  flex-wrap: wrap;
}

.ocr-chk { margin: 0; white-space: nowrap; }

.ocr-status {
  flex: 1;
  font-size: 12px;
  font-weight: 800;
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid #185A65;
  background: #061A23;
  min-height: 28px;
}

.ocr-status.ok { color: var(--accent); border-color: var(--accent); }
.ocr-status.amber { color: var(--amber); }
.ocr-status.cloud { color: var(--muted); }
.ocr-status.bad { color: var(--bad); border-color: rgba(232, 90, 90, 0.45); }

.more-actions { position: relative; }
.more-actions[open] { z-index: 220; }
.more-actions summary { list-style: none; }
.more-actions summary::-webkit-details-marker { display: none; }

.actions-box:has(.more-actions[open]) {
  z-index: 210;
}

.more-menu {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  z-index: 221;
  min-width: 220px;
  background: #081F2A;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.55);
  max-height: min(70dvh, 360px);
  overflow-y: auto;
}

.more-menu button {
  text-align: left;
  border: 0;
  background: transparent;
  color: var(--ink);
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
}

.more-menu button:hover { background: #0B4D57; }

/* Panel revisión */
.summary-label {
  margin: 0 0 8px;
  padding: 7px;
  font-size: 14px;
  font-weight: 800;
  color: var(--ink-soft);
  background: var(--bg-summary);
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  line-height: 1.45;
}

.review-toolbar {
  display: grid;
  grid-template-columns: auto 140px auto 1fr;
  gap: 8px;
  align-items: center;
  margin-bottom: 6px;
}

.review-toolbar .span-search { grid-column: span 1; }
.review-toolbar .span-param { grid-column: span 1; }

.help-label, .field-title {
  margin: 4px 0;
  font-size: 12px;
  color: var(--muted);
  background: #071A24;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 6px;
}

.field-title {
  background: transparent;
  border: 0;
  padding: 2px 0 0 2px;
  font-weight: 900;
  color: var(--ink);
}

.status-bar {
  padding: 0;
  color: inherit;
  font-size: 12px;
  min-height: 0;
}

.activity-panel {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: linear-gradient(180deg, #0e3a44 0%, var(--bg-summary) 100%);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  min-height: 48px;
  position: sticky;
  top: 4px;
  z-index: 50;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.activity-panel.busy {
  border-color: var(--btn-primary);
  box-shadow: 0 0 0 1px rgba(18, 163, 168, 0.35), 0 4px 18px rgba(6, 26, 35, 0.45);
  background: linear-gradient(180deg, #0f4a52 0%, #0c303b 100%);
}

.activity-panel.busy .activity-label {
  background: rgba(167, 232, 90, 0.14);
  border: 1px solid rgba(167, 232, 90, 0.35);
  border-radius: 999px;
  padding: 2px 10px;
}

.activity-status-indicators {
  position: relative;
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.activity-status-indicators .activity-traffic-light {
  width: 14px;
  height: 14px;
}

.activity-content {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
  min-width: 0;
  flex: 1;
}

.activity-label {
  font-weight: 800;
  color: var(--accent);
  font-size: 12px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  white-space: nowrap;
}

.activity-sep {
  color: var(--neutral);
  font-weight: 700;
  line-height: 1;
}

.activity-panel:not(.busy) .activity-sep {
  display: none;
}

.activity-message {
  color: var(--ink);
  flex: 1;
  min-width: 10rem;
  line-height: 1.4;
  font-size: 13px;
}

.activity-panel.busy .activity-message {
  color: var(--ink-soft);
}

.activity-panel.error .activity-label,
.activity-panel.error .activity-message,
.status-bar.error { color: var(--bad); }

.activity-panel.success .activity-label,
.activity-panel.success .activity-message,
.status-bar.success { color: var(--accent); }

.activity-panel.amber .activity-label,
.activity-panel.amber .activity-message,
.status-bar.amber { color: var(--amber); }

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

.btn.btn-busy,
label.btn.btn-busy {
  position: relative;
  pointer-events: none;
  opacity: 0.9;
  padding-right: 34px;
}

.btn.btn-busy::before,
label.btn.btn-busy::before {
  content: "";
  position: absolute;
  right: 10px;
  top: 50%;
  width: 16px;
  height: 16px;
  margin-top: -8px;
  border: 2px solid rgba(255, 255, 255, 0.45);
  border-top-color: #fff;
  border-radius: 50%;
  animation: activity-spin 0.65s linear infinite;
  z-index: 2;
}

.btn-primary.btn-busy,
label.btn-primary.btn-busy {
  filter: brightness(1.05);
  box-shadow: inset 0 0 0 1px rgba(167, 232, 90, 0.25);
}

.btn-primary.btn-busy::before,
label.btn-primary.btn-busy::before {
  border-color: rgba(255, 255, 255, 0.55);
  border-top-color: var(--accent);
}

/* Spinner en ::before para no pisar tooltips (::after). */
.btn.btn-busy::after,
label.btn.btn-busy::after {
  content: none;
  animation: none;
}

.workflow-loading-row td {
  padding: 18px 12px !important;
  text-align: center;
  color: var(--accent);
  font-weight: 600;
}

.workflow-loading-row .inline-spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  margin-right: 8px;
  vertical-align: -2px;
  border: 2px solid rgba(167, 232, 90, 0.25);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: activity-spin 0.7s linear infinite;
}

/* ── Import / OCR full-screen overlay ── */
body.import-overlay-open {
  overflow: hidden;
  position: fixed;
  width: 100%;
  touch-action: none;
}

body.import-overlay-open .app-shell,
body.import-overlay-open .connectivity-bar {
  pointer-events: none;
  user-select: none;
}

.import-overlay {
  position: fixed;
  inset: 0;
  width: 100vw;
  min-height: 100vh;
  min-height: 100dvh;
  z-index: 10050;
  display: grid;
  place-items: center;
  touch-action: none;
  overscroll-behavior: contain;
  padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right))
    max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
}

.import-overlay:not(.hidden) {
  display: grid !important;
}

.import-overlay.hidden {
  display: none !important;
}

.import-overlay-backdrop {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 60% at 50% 38%, rgba(18, 163, 168, 0.22) 0%, transparent 62%),
    linear-gradient(165deg, #040d12 0%, #061a23 42%, #0a2a33 100%);
  backdrop-filter: blur(10px);
}

.import-overlay-backdrop::after {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 3px,
    rgba(92, 225, 230, 0.03) 3px,
    rgba(92, 225, 230, 0.03) 4px
  );
  pointer-events: none;
  opacity: 0.55;
}

.import-overlay-card {
  position: relative;
  z-index: 1;
  width: min(420px, 100%);
  text-align: center;
  padding: 28px 24px 26px;
  border-radius: 24px;
  border: 1px solid rgba(92, 225, 230, 0.28);
  background: linear-gradient(165deg, rgba(8, 28, 36, 0.94) 0%, rgba(6, 20, 28, 0.98) 100%);
  box-shadow:
    0 28px 80px rgba(0, 0, 0, 0.55),
    0 0 0 1px rgba(167, 232, 90, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
  color: #e8f6f4;
}

.import-overlay-logo-wrap {
  position: relative;
  width: 96px;
  height: 96px;
  margin: 0 auto 14px;
}

.import-overlay-logo {
  position: relative;
  z-index: 2;
  width: 96px;
  height: 96px;
  object-fit: contain;
  filter: drop-shadow(0 10px 24px rgba(0, 0, 0, 0.35));
  animation: import-logo-float 2.8s ease-in-out infinite;
}

.import-overlay-ring {
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 2px solid transparent;
  border-top-color: #a7e85a;
  border-right-color: rgba(18, 163, 168, 0.85);
  animation: import-ring-spin 1.4s linear infinite;
}

.import-overlay-ring::after {
  content: "";
  position: absolute;
  inset: 8px;
  border-radius: 50%;
  border: 1px solid rgba(92, 225, 230, 0.2);
  animation: import-ring-pulse 2s ease-in-out infinite;
}

@keyframes import-logo-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

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

@keyframes import-ring-pulse {
  0%, 100% { opacity: 0.45; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.04); }
}

.import-overlay-kicker {
  margin: 0 0 6px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #a7e85a;
}

.import-overlay-card h2 {
  margin: 0 0 6px;
  font-size: clamp(18px, 4.5vw, 22px);
  line-height: 1.25;
  color: #f0fffc;
}

.import-overlay-subtitle {
  margin: 0 0 4px;
  font-size: 13px;
  color: #7aabb4;
}

.import-overlay-file {
  margin: 0 0 18px;
  font-size: 12px;
  color: #5ce1e6;
  word-break: break-word;
}

.import-progress-track {
  height: 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
  border: 1px solid rgba(92, 225, 230, 0.15);
  margin-bottom: 10px;
}

.import-progress-bar {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, #12a3a8 0%, #a7e85a 55%, #5ce1e6 100%);
  box-shadow: 0 0 18px rgba(167, 232, 90, 0.45);
  transition: width 0.35s ease;
}

.import-progress-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
}

#import-progress-pct {
  color: #a7e85a;
  font-size: 20px;
  font-variant-numeric: tabular-nums;
}

#import-overlay-step {
  color: #7aabb4;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.import-overlay-message {
  margin: 0;
  font-size: 13px;
  line-height: 1.45;
  color: #d9f8ee;
  min-height: 2.9em;
}

.activity-panel.success {
  border-color: rgba(167, 232, 90, 0.45);
}

.activity-panel.error {
  border-color: rgba(255, 138, 138, 0.55);
}

.activity-panel.amber {
  border-color: rgba(232, 196, 90, 0.5);
  box-shadow: 0 0 0 1px rgba(232, 196, 90, 0.2), 0 4px 18px rgba(6, 26, 35, 0.35);
}

.menu-link.btn-busy::before {
  right: 4px;
}

.activity-panel + .tabs-wrap {
  margin-top: 2px;
}

/* Tabs */
.tabs-wrap { padding: 0; overflow: hidden; }

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  background: #081F2A;
  border-bottom: 1px solid var(--border);
}

.tab {
  border: 0;
  background: #081F2A;
  color: var(--muted);
  padding: 10px 14px;
  font-weight: 800;
  cursor: pointer;
  border-right: 1px solid var(--border);
}

.tab.active {
  background: var(--bg-panel);
  color: var(--accent);
  border-bottom: 2px solid var(--accent);
}

.tab-panel { display: none; padding: 8px; }
.tab-panel.active { display: block; }

.tab-short { display: none; }

.review-box-in-tab {
  margin-bottom: 10px;
  padding: 8px 10px;
  background: #082833;
  border: 1px solid var(--border);
  border-radius: 12px;
}

.review-box-in-tab .group-title {
  margin: 0 0 6px;
  font-size: 14px;
}

.param-action-row,
.patient-action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.patient-collapse {
  border: 0;
  margin: 0;
  padding: 0;
}

.patient-collapse summary {
  list-style: none;
  cursor: default;
}

.patient-collapse summary::-webkit-details-marker {
  display: none;
}

.title-short { display: none; }

/* Flujo de trabajo */
.workflow-stepper {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 10px;
}

.wf-step {
  flex: 1 1 auto;
  min-width: 120px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-input);
  color: var(--muted);
  padding: 8px 12px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.wf-step:hover { background: var(--btn); color: var(--ink); }
.wf-step.active { background: var(--btn-primary); color: #fff; border-color: var(--btn-primary-hover); }
.wf-step.done { border-color: var(--accent); color: var(--accent); }

.intel-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  margin-bottom: 8px;
  border-radius: 12px;
  border: 1px solid var(--border-strong);
  background: linear-gradient(135deg, #082833 0%, #0B4D57 100%);
}

.intel-banner-text {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-width: 720px;
}

.intel-banner-text strong { color: var(--accent); font-size: 13px; }
.intel-banner-text span { color: var(--muted); font-size: 12px; line-height: 1.4; }

.intel-notice {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 10px;
  background: #0A3540;
  border: 1px solid var(--border);
  font-size: 12px;
  color: var(--muted);
}

.intel-badge {
  flex-shrink: 0;
  background: var(--accent);
  color: #061A23;
  font-weight: 800;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  padding: 3px 8px;
  border-radius: 999px;
}

.detail-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.detail-semaforo {
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 999px;
  text-transform: uppercase;
}

.detail-semaforo.ok { background: rgba(167, 232, 90, 0.2); color: var(--ok); }
.detail-semaforo.amber { background: rgba(255, 210, 122, 0.15); color: var(--amber); }
.detail-semaforo.bad { background: rgba(255, 138, 138, 0.15); color: var(--bad); }
.detail-semaforo.neutral { background: rgba(122, 154, 148, 0.2); color: var(--neutral); }

.detail-sources {
  font-size: 11px;
  color: var(--muted);
  padding: 6px 8px;
  border-radius: 8px;
  background: #071E28;
  border: 1px solid var(--border);
  line-height: 1.45;
}

.detail-sources-label { font-weight: 800; color: var(--accent); margin-right: 4px; }
.detail-sources-text a { color: #6ECFDB; }

.field-title em { font-weight: 500; color: var(--muted); font-style: normal; font-size: 11px; }

.verdict-panel, .sources-panel { padding: 4px 2px; }

.verdict-intro h3 {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 16px;
}

.verdict-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.verdict-check {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  background: #0A3540;
  border: 1px solid var(--border-strong);
}

.sources-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.sources-list li {
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #082833;
}

.sources-list .src-area {
  display: block;
  font-weight: 800;
  color: var(--accent);
  font-size: 12px;
  margin-bottom: 4px;
}

.sources-list a {
  color: #6ECFDB;
  text-decoration: none;
  font-size: 12px;
}

.sources-list a:hover { text-decoration: underline; }

.sources-list .src-meta {
  display: block;
  margin-top: 4px;
  font-size: 11px;
  color: var(--muted);
}

.modalities-workspace { padding: 4px 2px; }
.modality-toolbar { display:flex; flex-wrap:wrap; gap:8px; margin-bottom:12px; }
.modality-categories { display:grid; gap:14px; }
.modality-category {
  border:1px solid var(--border); border-radius:14px; padding:12px; background:#082833;
}
.modality-category-title {
  margin:0 0 10px; font-size:13px; font-weight:800; color:var(--accent);
  text-transform:uppercase; letter-spacing:.4px;
}
.modality-grid {
  display:grid; grid-template-columns:repeat(auto-fill,minmax(240px,1fr)); gap:8px;
}
.modality-option {
  display:flex; align-items:flex-start; gap:8px; padding:10px 12px;
  border-radius:12px; border:1px solid var(--border); background:#071E28;
  cursor:pointer; transition:border-color .15s, background .15s;
}
.modality-option:hover { border-color:var(--border-strong); background:#0A3540; }
.modality-option.selected { border-color:var(--accent); background:#0B3D48; }
.modality-option input { margin-top:2px; }
.modality-option strong { display:block; font-size:13px; color:var(--ink-soft); }
.modality-option small { display:block; margin-top:3px; font-size:11px; color:var(--muted); line-height:1.35; }
.modality-readiness-panel { margin-top:14px; display:grid; gap:10px; }
.modality-status-card {
  border:1px solid var(--border); border-radius:14px; padding:12px 14px; background:#082833;
}
.modality-status-head { display:flex; justify-content:space-between; align-items:center; gap:10px; margin-bottom:8px; }
.modality-status-head h4 { margin:0; font-size:14px; color:var(--ink-soft); }
.modality-badge {
  font-size:10px; font-weight:800; text-transform:uppercase; padding:4px 10px; border-radius:999px;
}
.modality-badge.ready { background:rgba(167,232,90,.2); color:var(--ok); }
.modality-badge.review { background:rgba(255,210,122,.15); color:var(--amber); }
.modality-badge.partial { background:rgba(255,210,122,.15); color:var(--amber); }
.modality-badge.pending { background:rgba(255,138,138,.15); color:var(--bad); }
.modality-study-list { list-style:none; margin:0; padding:0; display:grid; gap:4px; }
.modality-study-list li {
  display:grid; grid-template-columns:1fr auto auto; gap:8px; font-size:12px;
  padding:6px 8px; border-radius:8px; background:#071E28;
}
.modality-study-list .missing { color:var(--bad); font-weight:700; }
.modality-study-list .loaded { color:var(--amber); font-weight:700; }
.modality-study-list .complete { color:var(--ok); font-weight:700; }
.lab-row.study-highlight td { background:rgba(167,232,90,.08); outline:1px solid var(--accent); }

.agenda-turn-banner {
  grid-column: 1 / -1;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--accent);
  background: linear-gradient(135deg, #0A3540 0%, #0B4D57 100%);
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.45;
}
.agenda-turn-banner strong { color: var(--accent); display:block; margin-bottom:4px; }

.testing-mode-banner {
  margin: 0 0 12px;
  padding: 12px 16px;
  border-radius: 12px;
  border: 1px solid #e6b84d;
  background: linear-gradient(135deg, #3d2f08 0%, #4a3a0c 100%);
  color: #ffe8a8;
  font-size: 13px;
  line-height: 1.45;
}
.testing-mode-banner.hidden { display: none; }
.testing-mode-banner strong {
  color: #ffd76a;
  display: block;
  margin-bottom: 4px;
  font-size: 14px;
}

.btn.secondary {
  background: #164D58;
  border: 1px solid var(--border-strong);
}

.btn.secondary:hover { background: #1A6370; }

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

/* Revisión 3 columnas */
.revision-split {
  display: grid;
  grid-template-columns: minmax(240px, 28%) 1fr minmax(260px, 30%);
  gap: 8px;
  min-height: 520px;
  transition: grid-template-columns 0.2s ease;
}

.revision-split.viewer-collapsed {
  grid-template-columns: minmax(72px, 88px) 1fr minmax(260px, 30%);
}

.viewer-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.viewer-panel-head .panel-title {
  margin: 0;
  flex: 1;
  min-width: 0;
}

.viewer-toggle-btn {
  flex-shrink: 0;
  min-height: 30px;
  padding: 4px 8px;
  font-size: 11px;
}

.revision-split.viewer-collapsed .viewer-panel-body {
  display: none;
}

.revision-split.viewer-collapsed .viewer-panel-head {
  flex-direction: column;
  align-items: stretch;
}

.revision-split.viewer-collapsed .viewer-panel-head .panel-title {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  text-align: center;
  font-size: 11px;
  line-height: 1.2;
  max-height: 180px;
  margin: 0 auto;
}

.panel-box {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 8px;
  background: #082833;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 0;
}

.table-box {
  min-height: 0;
}

.detail-panel textarea {
  min-height: 88px;
  resize: vertical;
}

#detail-guidance {
  min-height: 100px;
}

#detail-opinion {
  min-height: 120px;
}

.photo-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 92px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.photo-list li {
  padding: 6px 8px;
  cursor: pointer;
  font-size: 12px;
  border-bottom: 1px solid var(--border);
}

.photo-list li.active, .photo-list li:hover {
  background: #0B4D57;
  color: var(--accent);
}

.photo-list .muted {
  color: var(--muted);
  font-size: 11px;
}

.viewer-import-btn {
  display: inline-flex;
  margin: 0 0 10px;
  min-height: 42px;
}

.source-viewer .viewer-import-btn {
  width: 100%;
  justify-content: center;
}

.viewer-stage {
  position: relative;
  flex: 1;
  min-height: 320px;
  background: #050f14;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: auto;
  display: flex;
  justify-content: center;
}

.viewer-stage img {
  max-width: 100%;
  transform-origin: center top;
  transition: transform 0.1s;
}

.viewer-overlays {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  pointer-events: none;
}

.ocr-box {
  position: absolute;
  border: 2px solid var(--amber);
  background: rgba(255, 210, 122, 0.22);
  border-radius: 2px;
}

.viewer-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.viewer-file-meta {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  background: #0a2230;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.viewer-file-meta.hidden {
  display: none;
}

.viewer-file-name {
  font-weight: 700;
  color: var(--accent);
  word-break: break-word;
}

.viewer-file-details {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.45;
}

.viewer-file-status {
  font-size: 12px;
  line-height: 1.4;
}

.viewer-file-status.ok {
  color: var(--accent);
}

.viewer-file-status.warn {
  color: var(--amber);
}

.viewer-file-status.bad {
  color: var(--bad);
}

.viewer-file-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.lab-table-wrap {
  flex: 1;
  max-height: 560px;
  overflow: auto;
  background: #082833;
  border-radius: 8px;
  scrollbar-color: #1A6370 #082833;
}

.lab-table-wrap::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

.lab-table-wrap::-webkit-scrollbar-track {
  background: #082833;
}

.lab-table-wrap::-webkit-scrollbar-thumb {
  background: #1A6370;
  border-radius: 5px;
  border: 2px solid #082833;
}

.lab-table-wrap::-webkit-scrollbar-corner {
  background: #082833;
}

.lab-table-wrap .lab-table {
  border-collapse: separate;
  border-spacing: 0;
}

.lab-table-wrap .lab-table thead {
  position: sticky;
  top: 0;
  z-index: 3;
}

.lab-table-wrap .lab-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  background-color: #081F2A;
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  box-shadow: 0 1px 0 var(--border);
}

.lab-table-wrap .lab-table th:last-child {
  min-width: 56px;
  background-color: #081F2A;
}

table { width: 100%; border-collapse: collapse; font-size: 12px; }

th, td {
  text-align: left;
  padding: 8px;
  border-bottom: 1px solid var(--border);
}

th {
  position: sticky;
  top: 0;
  background: #081F2A;
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  z-index: 1;
}

.table-wrap.compact {
  max-height: 480px;
  overflow: auto;
  background: #082833;
  border-radius: 8px;
  scrollbar-color: #1A6370 #082833;
}

.table-wrap.compact::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

.table-wrap.compact::-webkit-scrollbar-track {
  background: #082833;
}

.table-wrap.compact::-webkit-scrollbar-thumb {
  background: #1A6370;
  border-radius: 5px;
  border: 2px solid #082833;
}

.table-wrap.compact::-webkit-scrollbar-corner {
  background: #082833;
}

.table-wrap.compact table {
  border-collapse: separate;
  border-spacing: 0;
}

.table-wrap.compact thead {
  position: sticky;
  top: 0;
  z-index: 2;
}

.table-wrap.compact th {
  background-color: #081F2A;
  box-shadow: 0 1px 0 var(--border);
}

.lab-row { cursor: pointer; }

.lab-row.level-ok td { background: #103b2a; color: #dfffea; }
.lab-row.level-amber td { background: #3c3212; color: #fff3c4; }
.lab-row.level-red td { background: #461d22; color: #ffe6e6; }
.lab-row.level-missing td { background: #102833; color: #9fb5b9; }
.lab-row.level-neutral td { background: #0d3140; color: #d8f7ff; }

.lab-row.level-ok .muted-cell { color: rgba(223, 255, 234, 0.72); }
.lab-row.level-amber .muted-cell { color: rgba(255, 243, 196, 0.72); }
.lab-row.level-red .muted-cell { color: rgba(255, 230, 230, 0.72); }
.lab-row.level-missing .muted-cell { color: rgba(159, 181, 185, 0.9); }
.lab-row.level-neutral .muted-cell { color: rgba(216, 247, 255, 0.72); }

.lab-row.row-active td {
  box-shadow: inset 0 0 0 1px rgba(167, 232, 90, 0.55);
}

.section-row td {
  background: rgba(11, 77, 87, 0.35);
  padding: 4px 6px;
}

.section-toggle {
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  color: var(--accent);
  font-weight: 800;
  cursor: pointer;
  padding: 4px;
}

.muted-cell { color: var(--muted); }

.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 4px;
}

.status-dot.ok { background: var(--ok); }
.status-dot.amber { background: var(--amber); }
.status-dot.bad { background: var(--bad); }
.status-dot.neutral { background: var(--neutral); }

.btn-link {
  background: none;
  border: 0;
  color: var(--accent);
  cursor: pointer;
  font-weight: 700;
  padding: 0;
}

.detail-title {
  margin: 0;
  padding: 9px;
  font-size: 14px;
  font-weight: 900;
  color: #fff;
  background: var(--bg-detail);
  border: 1px solid var(--border-strong);
  border-radius: 14px;
}

.detail-checks { display: flex; gap: 16px; flex-wrap: wrap; }

.lab-kbd-hint {
  margin: 8px 0 0;
  font-size: 0.78rem;
  color: var(--muted, #8aa4ad);
  line-height: 1.5;
}

.lab-kbd {
  display: inline-block;
  min-width: 1.15em;
  padding: 0.1em 0.35em;
  margin: 0 0.1em;
  font-size: 0.72em;
  font-family: inherit;
  line-height: 1.2;
  text-align: center;
  border-radius: 4px;
  border: 1px solid rgba(126, 249, 255, 0.35);
  background: rgba(0, 40, 55, 0.65);
  color: #b8f4ff;
  vertical-align: middle;
}

.lab-row:focus {
  outline: 2px solid rgba(126, 249, 255, 0.75);
  outline-offset: -2px;
}

.lab-table-wrap:focus {
  outline: 2px solid rgba(126, 249, 255, 0.45);
  outline-offset: 2px;
}

.detail-workflow {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  background: linear-gradient(135deg, #082833 0%, #0B4D57 100%);
}

.detail-workflow-hint {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.45;
}

.detail-workflow-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.detail-workflow-actions .btn {
  min-height: 40px;
  font-size: 12px;
  font-weight: 700;
  white-space: normal;
  line-height: 1.25;
  text-align: center;
  padding: 8px 10px;
}

.check-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  color: var(--ink-soft);
}

.check-row input { width: auto; margin-top: 2px; }

.raw-text, .indices-display {
  width: 100%;
  min-height: 360px;
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  padding: 12px;
  background: var(--bg-input);
  color: var(--ink);
  font-family: ui-monospace, monospace;
  font-size: 12px;
  white-space: pre-wrap;
}

.plan-grid { display: grid; gap: 6px; margin-bottom: 8px; }

/* Firma */
.signature-profile-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(8, 31, 42, 0.45);
}

.signature-profile-preview-wrap {
  flex: 1 1 180px;
  min-height: 52px;
  display: flex;
  align-items: center;
}

.signature-profile-preview {
  display: block;
  max-height: 56px;
  max-width: 220px;
  width: auto;
  height: auto;
  object-fit: contain;
}

.signature-profile-empty {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
}

.signature-profile-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.signature-settings-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.signature-pad-dialog {
  max-width: 640px;
}

.signature-pad-wrap {
  border: 1px dashed rgba(167, 232, 90, 0.45);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.96);
  padding: 8px;
  touch-action: none;
}

#signature-pad-canvas {
  display: block;
  width: 100%;
  height: 180px;
  border-radius: 8px;
  cursor: crosshair;
  touch-action: none;
}

.signature-grid {
  display: grid;
  grid-template-columns: auto 1fr auto 1fr;
  gap: 8px;
  align-items: center;
}

.signature-grid .span-3 { grid-column: span 3; }
.signature-grid .span-4 { grid-column: span 4; }
.signature-grid .span-2 { grid-column: span 2; }
.confirm-row { grid-column: 1 / -1; }

.target-modes { display: flex; gap: 8px; }

.footer-note {
  padding: 10px 12px;
  color: var(--muted);
  font-size: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-panel);
}

.hidden { display: none !important; }

/* Diálogos */
.lab-dialog, .patient-dialog, .settings-dialog {
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  padding: 0;
  background: var(--bg-panel);
  color: var(--ink);
  max-width: 560px;
  width: calc(100% - 24px);
}

.lab-dialog::backdrop, .patient-dialog::backdrop, .settings-dialog::backdrop { background: rgba(0,0,0,0.6); }

.lab-dialog form, .patient-dialog form, .settings-dialog form {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.lab-dialog h3, .patient-dialog h3, .settings-dialog h3 { margin: 0; color: var(--accent); }

.dialog-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  flex-wrap: wrap;
  margin-top: 8px;
}

/* Cámara remota tablet ↔ teléfono */
.remote-cam-link-dialog {
  max-width: 420px;
}
.remote-cam-qr {
  display: flex;
  justify-content: center;
  margin: 8px 0 4px;
}
.remote-cam-qr-frame {
  width: 200px;
  height: 200px;
  padding: 10px;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  display: grid;
  place-items: center;
}
.remote-cam-qr-frame svg,
.remote-cam-qr-canvas {
  width: 180px;
  height: 180px;
  display: block;
}
.remote-cam-qr-img {
  width: 180px;
  height: 180px;
  display: block;
}
.remote-cam-qr-loading {
  margin: 0;
  font-size: 0.85rem;
  color: #0a2a36;
  text-align: center;
}
.remote-cam-qr-fallback {
  width: 180px;
  height: 180px;
  display: grid;
  place-items: center;
  border: 2px dashed rgba(126, 232, 255, 0.45);
  border-radius: 16px;
  background:
    linear-gradient(135deg, rgba(6, 26, 35, 0.9), rgba(12, 58, 72, 0.85)),
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 11px,
      rgba(126, 232, 255, 0.06) 11px,
      rgba(126, 232, 255, 0.06) 12px
    );
}
.remote-cam-qr-code {
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: 0.28em;
  color: #7ee8ff;
  padding-left: 0.28em;
}
.remote-cam-code-label {
  margin: 8px 0 0;
  font-size: 0.75rem;
  opacity: 0.75;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.remote-cam-code {
  margin: 2px 0 0;
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  font-size: 2.2rem;
  font-weight: 700;
  letter-spacing: 0.35em;
  color: var(--accent, #7ee8ff);
  text-align: center;
  padding-left: 0.35em;
}
.remote-cam-url {
  margin: 2px 0 0;
  font-size: 0.8rem;
  word-break: break-all;
  opacity: 0.9;
  max-height: 4.5em;
  overflow: auto;
}
.remote-cam-status {
  margin: 10px 0 0;
  font-size: 0.9rem;
  min-height: 1.3em;
}
.remote-cam-status[data-level="success"] { color: #5dffb0; }
.remote-cam-status[data-level="error"] { color: #ff9a8a; }
.remote-cam-status[data-level="amber"] { color: #ffd27a; }

.remote-cam-wait-bar {
  margin: 0.75rem 0 1rem;
  padding: 0.85rem 1rem;
  border-radius: 12px;
  border: 1px solid rgba(126, 232, 255, 0.35);
  background: linear-gradient(135deg, rgba(6, 40, 55, 0.92), rgba(8, 28, 40, 0.88));
}
.remote-cam-wait-bar.hidden { display: none; }
.remote-cam-wait-head {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-size: 0.95rem;
}
.remote-cam-wait-pulse {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: #5dffb0;
  box-shadow: 0 0 0 0 rgba(93, 255, 176, 0.55);
  animation: remote-wait-pulse 1.4s ease-out infinite;
}
@keyframes remote-wait-pulse {
  0% { box-shadow: 0 0 0 0 rgba(93, 255, 176, 0.5); }
  70% { box-shadow: 0 0 0 10px rgba(93, 255, 176, 0); }
  100% { box-shadow: 0 0 0 0 rgba(93, 255, 176, 0); }
}
.remote-cam-wait-status {
  margin: 0.45rem 0 0.7rem;
  color: rgba(210, 232, 240, 0.9);
  font-size: 0.9rem;
}
.remote-cam-wait-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.remote-cam-pair-panel {
  margin: 12px 0 4px;
}
.remote-cam-pair-box {
  display: grid;
  gap: 10px;
  padding: 12px;
  border-radius: 12px;
  background: rgba(255, 210, 122, 0.1);
  border: 1px solid rgba(255, 210, 122, 0.35);
}
.remote-cam-pair-item {
  display: grid;
  gap: 6px;
}
.remote-cam-pair-label {
  margin: 0;
  font-weight: 700;
  color: #ffd27a;
}
.remote-cam-pair-meta {
  margin: 0;
  font-size: 0.85rem;
  opacity: 0.85;
  word-break: break-word;
}
.remote-cam-pair-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.remote-cam-body {
  margin: 0;
  min-height: 100dvh;
  background: radial-gradient(120% 80% at 50% 0%, #0c3a48 0%, #061a23 55%, #041119 100%);
  color: #e8f4f7;
}
.remote-cam-page {
  max-width: 480px;
  margin: 0 auto;
  padding: 24px 18px 48px;
}
.remote-cam-page-header {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 12px;
}
.remote-cam-page-header h1 {
  margin: 0;
  font-size: 1.35rem;
}
.remote-cam-kicker {
  margin: 0;
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  opacity: 0.7;
}
.remote-cam-room-status {
  margin: 0 0 8px;
  font-weight: 600;
}
.remote-cam-ttl {
  margin: 0 0 0.35rem;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #8fd6c8;
  font-variant-numeric: tabular-nums;
}
.remote-cam-ttl[data-level="amber"] { color: #ffd27a; }
.remote-cam-ttl[data-level="error"] { color: #ff9a8a; }
.remote-cam-ttl[data-level="success"] { color: #5dffb0; }
.remote-cam-room-status[data-level="success"] { color: #5dffb0; }
.remote-cam-room-status[data-level="error"] { color: #ff9a8a; }
.remote-cam-room-status[data-level="amber"] { color: #ffd27a; }
.remote-cam-help {
  margin: 0 0 16px;
  opacity: 0.85;
  line-height: 1.45;
}
.remote-cam-upload-progress {
  margin: 0 0 14px;
  padding: 0.7rem 0.85rem;
  border-radius: 10px;
  border: 1px solid rgba(126, 232, 255, 0.28);
  background: rgba(6, 40, 55, 0.7);
}
.remote-cam-upload-progress.hidden { display: none; }
.remote-cam-upload-track {
  height: 0.55rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  overflow: hidden;
}
.remote-cam-upload-bar {
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, #3ec7ff, #5dffb0);
  transition: width 0.15s ease-out;
}
.remote-cam-upload-label {
  margin: 0.45rem 0 0;
  font-size: 0.85rem;
  color: rgba(210, 232, 240, 0.92);
}
.remote-cam-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
}
.remote-cam-uploads {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.remote-cam-uploads li {
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  font-size: 0.85rem;
}
.remote-cam-uploads li.is-err {
  color: #ff9a8a;
}
.remote-cam-uploads li.is-ok {
  color: #5dffb0;
}

.patient-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 280px;
  overflow-y: auto;
}

.app-update-banner {
  position: fixed;
  inset: 0;
  z-index: 250;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: max(10px, env(safe-area-inset-top)) 16px 16px;
  background: rgba(4, 14, 20, 0.62);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.app-update-banner.hidden {
  display: none !important;
}

.app-update-banner-card {
  width: min(720px, 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px 14px;
  padding: 12px 16px;
  background: linear-gradient(180deg, rgba(32, 58, 48, 0.98), rgba(18, 38, 32, 0.98));
  border: 1px solid rgba(167, 232, 90, 0.35);
  border-radius: 12px;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.38);
  color: var(--text);
  font-size: 14px;
}

.app-update-banner-title {
  display: none;
  margin: 0;
  width: 100%;
  font-size: 15px;
  font-weight: 800;
  color: var(--accent);
}

.app-update-banner-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

body.has-update-banner {
  overflow: hidden;
}

body.has-update-banner .app-shell {
  padding-top: 8px;
}

body.has-update-banner.login-body .login-card {
  margin-top: 0;
}

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

.connectivity-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px max(20px, env(safe-area-inset-right)) calc(10px + env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left));
  background: linear-gradient(180deg, rgba(10, 22, 19, 0.92), rgba(6, 14, 12, 0.98));
  border-top: 1px solid rgba(138, 184, 165, 0.22);
  box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.28);
}

.traffic-light {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--neutral);
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.25);
  transition: background 0.25s ease, box-shadow 0.25s ease;
}

.traffic-light.ok {
  background: #a7e85a;
  box-shadow:
    0 0 0 2px rgba(0, 0, 0, 0.2),
    0 0 12px rgba(167, 232, 90, 0.75);
}

.traffic-light.bad {
  background: #e85a5a;
  box-shadow:
    0 0 0 2px rgba(0, 0, 0, 0.2),
    0 0 12px rgba(232, 90, 90, 0.55);
}

.traffic-light.amber {
  background: #e8c45a;
  box-shadow:
    0 0 0 2px rgba(0, 0, 0, 0.2),
    0 0 12px rgba(232, 196, 90, 0.55);
}

.traffic-light.neutral {
  background: #5a6e68;
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.2);
}

.traffic-light.off {
  background: #1e2a28;
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.35);
  opacity: 0.42;
}

.system-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid rgba(167, 232, 90, 0.45);
  background: rgba(13, 77, 67, 0.55);
  color: #a7e85a;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
}

.connectivity-sep {
  color: var(--muted);
  opacity: 0.7;
}

.connectivity-text {
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.patient-list li {
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  border: 1px solid transparent;
  margin-bottom: 4px;
}

.patient-list li:hover, .patient-list li.active {
  background: #0B4D57;
  border-color: var(--border-strong);
}

.patient-list li.empty { cursor: default; color: var(--muted); }

/* Timeline (conservado) */
.timeline-section { padding: 16px; margin-top: 6px; }
.timeline-header { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.timeline-select { width: min(280px, 100%); }
.timeline-rail-wrap { overflow-x: auto; padding-bottom: 12px; }
.timeline-rail { display: flex; gap: 12px; min-width: max-content; padding-top: 16px; }
.timeline-node {
  min-width: 120px;
  border: 1px solid var(--border);
  background: var(--bg-input);
  border-radius: 12px;
  padding: 24px 10px 10px;
  position: relative;
  cursor: pointer;
  text-align: center;
  color: var(--ink);
}
.timeline-dot {
  position: absolute; top: 10px; left: 50%; transform: translateX(-50%);
  width: 14px; height: 14px; border-radius: 50%; background: var(--accent);
}
.timeline-chart { padding: 12px; border: 1px solid var(--border); border-radius: 10px; }
.sparkline { display: flex; align-items: flex-end; gap: 8px; min-height: 100px; }
.spark-bar { min-width: 48px; background: linear-gradient(180deg, var(--btn-primary), var(--btn)); border-radius: 6px; text-align: center; font-size: 10px; font-weight: 700; padding-bottom: 4px; }
.timeline-empty { color: var(--muted); text-align: center; padding: 16px; }

/* Login */
.login-body { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: var(--bg); }
.login-card { width: min(400px, 100%); padding: 28px; text-align: center; background: var(--bg-panel); border-radius: 14px; border: 1px solid var(--border); }
.login-card .mark { margin: 0 auto 16px; }
.login-card h1 { font-size: 22px; margin: 0; color: #fff; }
.login-card form { display: flex; flex-direction: column; gap: 10px; margin-top: 20px; text-align: left; }
.password-field {
  position: relative;
  display: flex;
  align-items: center;
}
.password-field input {
  width: 100%;
  padding-right: 44px;
}
.password-toggle {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: rgba(255, 255, 255, 0.72);
  cursor: pointer;
  display: grid;
  place-items: center;
  padding: 0;
}
.password-toggle:hover,
.password-toggle:focus-visible {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
  outline: none;
}
.password-toggle[aria-pressed="true"] {
  color: #5dffb0;
}
.password-toggle svg {
  display: block;
}
.login-error { color: var(--bad); font-size: 13px; margin-top: 12px; }
.login-logo { display: block; margin: 0 auto 12px; object-fit: contain; background: transparent; }
.register-title { font-size: 16px; margin: 0 0 8px; color: var(--accent); text-align: left; }
.link-btn { background: none; border: none; color: var(--accent); cursor: pointer; text-decoration: underline; padding: 0; font: inherit; }

.user-badge { background: #0B4D57; color: var(--accent); max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.settings-dialog { max-width: 760px; max-height: 90vh; overflow: hidden; }
.settings-dialog form { max-height: 90vh; overflow: auto; }
.settings-grid {
  display: grid;
  grid-template-columns: 140px 1fr 1fr 1fr;
  gap: 8px 10px;
  align-items: center;
}
.settings-grid .span-3 { grid-column: span 3; }
.asset-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.admin-dialog { max-width: 820px; }
.admin-section { margin-top: 14px; padding-top: 10px; border-top: 1px solid var(--border); }
.admin-subtitle { margin: 0 0 8px; color: var(--accent); font-size: 14px; }
.admin-pro-list { list-style: none; margin: 0 0 10px; padding: 0; max-height: 160px; overflow-y: auto; }
.admin-pro-list li { padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; margin-bottom: 6px; font-size: 13px; display: flex; justify-content: space-between; gap: 8px; align-items: center; flex-wrap: wrap; }
.admin-pro-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.admin-pro-actions .btn { font-size: 11px; padding: 4px 8px; }
.admin-create-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.admin-create-grid .btn-primary { grid-column: span 2; }
.share-targets { display: grid; gap: 6px; max-height: 180px; overflow-y: auto; padding: 8px; border: 1px solid var(--border); border-radius: 8px; }
.share-targets label { display: flex; gap: 8px; align-items: center; font-size: 13px; }
.patient-shared-badge { color: var(--accent); font-size: 11px; margin-left: 6px; }
.patient-readonly .patient-grid input,
.patient-readonly .patient-grid button#save-patient { opacity: 0.65; pointer-events: none; }
.asset-preview {
  max-height: 64px;
  max-width: 180px;
  object-fit: contain;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  padding: 4px;
}

@media (max-width: 1200px) {
  .revision-split {
    grid-template-columns: 1fr;
    min-height: 0;
  }

  .revision-split .table-box {
    order: 1;
  }

  .revision-split .detail-panel {
    order: 2;
  }

  .revision-split .source-viewer {
    order: 3;
  }

  .revision-split.viewer-collapsed .source-viewer {
    display: none;
  }

  .workbar-row { grid-template-columns: repeat(2, 1fr); }
  .workbar-row .span-2 { grid-column: span 2; }
  .patient-grid { grid-template-columns: auto 1fr auto 1fr; }
  .patient-grid .span-3, .patient-grid .span-7 { grid-column: span 3; }
  .hero-header { grid-template-columns: 1fr; text-align: center; }
  .hero-pro { text-align: center; }
}

/* Tooltips discretos: aparecen tras ~0,55 s al posar el cursor (no molestan). */
.has-tip[data-tip]:not([data-tip=""]) {
  position: relative;
  cursor: help;
}

.has-tip[data-tip]:not([data-tip=""])::after {
  content: attr(data-tip);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 10px);
  transform: translateX(-50%);
  z-index: 300;
  width: max-content;
  max-width: min(300px, 88vw);
  padding: 8px 11px;
  border-radius: 8px;
  border: 1px solid var(--border-strong);
  background: rgba(6, 20, 24, 0.97);
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.45;
  text-align: left;
  white-space: normal;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.38);
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.12s ease, visibility 0s linear 0.12s;
  transition-delay: 0s;
}

.has-tip[data-tip]:not([data-tip=""]):hover::after {
  opacity: 1;
  visibility: visible;
  transition-delay: 0.55s;
}

/* Botones: sin tooltip al foco (evita recuadro pegado en móvil tras tocar). */
.btn.has-tip[data-tip]:focus-visible::after,
label.btn.has-tip[data-tip]:focus-visible::after,
.menu-link.has-tip[data-tip]:focus-visible::after {
  opacity: 0;
  visibility: hidden;
}

.workbar-row .has-tip[data-tip]::after {
  left: 0;
  right: auto;
  transform: none;
  max-width: min(280px, 92vw);
}

.connectivity-bar .has-tip[data-tip]::after {
  bottom: calc(100% + 10px);
}

.activity-panel .has-tip[data-tip]::after {
  bottom: auto;
  top: calc(100% + 10px);
}

/* ── Móvil y pantallas táctiles ── */
@media (max-width: 1200px) and (min-width: 901px) {
  .detail-workflow-actions {
    grid-template-columns: 1fr 1fr;
  }

  .detail-workflow-actions .btn:first-child {
    grid-column: 1 / -1;
  }
}

@media (min-width: 901px) {
  .patient-collapse summary {
    display: none;
  }

  .patient-action-row {
    display: contents;
  }
}

@media (max-width: 900px) {
  .app-update-banner {
    align-items: flex-end;
    padding: 12px max(12px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
  }

  .app-update-banner-card {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    padding: 16px;
    border-radius: 16px 16px 12px 12px;
  }

  .app-update-banner-title {
    display: block;
  }

  #app-update-banner-text {
    line-height: 1.45;
    font-size: 14px;
  }

  .app-update-banner-actions {
    width: 100%;
  }

  .app-update-banner-actions .btn {
    flex: 1 1 auto;
    min-height: 44px;
    justify-content: center;
  }

  .app-shell {
    gap: 10px;
    padding-top: 4px;
  }

  .hero-header,
  .workflow-stepper {
    display: none;
  }

  .app-shell.mobile-hero-open .hero-header {
    display: grid;
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto;
    text-align: center;
    padding: 18px 14px 14px;
    gap: 10px;
    background: linear-gradient(90deg, #071A24 0%, #0B4D57 48%, #061A23 100%);
    border-color: var(--border-strong);
  }

  .app-shell.mobile-hero-open .hero-header-close {
    display: inline-flex;
    position: absolute;
    top: 8px;
    right: 8px;
    min-width: 36px;
    min-height: 36px;
    align-items: center;
    justify-content: center;
    padding: 4px 10px;
    z-index: 2;
  }

  .app-shell.mobile-hero-open .hero-logo {
    width: 72px;
    height: 72px;
    margin: 0 auto;
    grid-row: 1;
  }

  .app-shell.mobile-hero-open .hero-center {
    text-align: center;
    grid-row: 2;
  }

  .app-shell.mobile-hero-open .hero-pro {
    display: block;
    text-align: center;
    grid-row: 3;
    color: var(--ink);
    font-size: 12px;
    line-height: 1.5;
  }

  .app-shell.mobile-hero-open .hero-header h1 {
    font-size: 22px;
  }

  .app-shell.mobile-hero-open .subtitle {
    font-size: 12px;
  }

  .menubar-version {
    display: inline-flex;
  }

  .menubar-logo-btn {
    grid-column: 1;
    grid-row: 1;
  }

  .activity-panel {
    position: sticky;
    top: 52px;
    z-index: 115;
    margin-bottom: 2px;
  }

  .tab-long,
  .title-long {
    display: none;
  }

  .tab-short,
  .title-short {
    display: inline;
  }

  .tab {
    padding: 12px 14px;
    font-size: 13px;
  }

  .tabs-wrap {
    order: 0;
  }

  .review-box-in-tab {
    margin-bottom: 8px;
    padding: 8px;
  }

  .review-box-in-tab .review-help {
    display: none;
  }

  .review-toolbar-param {
    gap: 8px;
  }

  .param-action-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-column: 1 / -1;
  }

  .param-action-row .btn {
    width: 100%;
    min-height: 44px;
  }

  .patient-collapse summary {
    cursor: pointer;
    min-height: 48px;
    display: flex;
    align-items: center;
    padding: 4px 0;
  }

  .patient-collapse summary::after {
    content: "▾";
    margin-left: auto;
    color: var(--accent);
    font-size: 14px;
    transition: transform 0.15s ease;
  }

  .patient-collapse[open] summary::after {
    transform: rotate(180deg);
  }

  .patient-action-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-column: 1 / -1;
    gap: 8px;
  }

  .patient-action-row .btn {
    width: 100%;
    min-height: 44px;
  }

  .patient-grid select {
    min-height: 48px;
    font-size: 16px;
  }

  .panel-box-head {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .panel-box-head .panel-title {
    font-size: 14px;
    line-height: 1.35;
    flex: 0 0 auto;
  }

  .panel-box-head .viewer-mobile-toggle {
    width: 100%;
    min-height: 44px;
    flex: 0 0 auto;
  }

  .panel-box-head {
    flex: 0 0 auto;
  }

  .signature-box .group-title {
    font-size: 14px;
  }

  .menubar {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 8px;
    position: sticky;
    top: 0;
    z-index: 120;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
  }

  .menubar-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    justify-self: end;
    grid-column: 2;
    grid-row: 1;
  }

  .menubar-favicon {
    width: 28px;
    height: 28px;
  }

  .menubar-right {
    grid-column: 1 / -1;
    grid-row: 2;
    margin-left: 0;
    width: 100%;
    justify-content: center;
    text-align: center;
    flex-wrap: wrap;
    gap: 8px;
  }

  .menubar-nav {
    display: none;
    grid-column: 1 / -1;
    grid-row: 3;
    flex-direction: column;
    gap: 10px;
    width: 100%;
    padding-top: 4px;
    border-top: 1px solid var(--border);
  }

  .menubar.menubar-open .menubar-nav {
    display: flex;
  }

  .menu-group {
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
  }

  .menu-link {
    min-height: 44px;
    padding: 10px 12px;
    text-align: left;
    border-radius: 10px;
    background: #071E28;
  }

  .tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    gap: 0;
  }

  .tabs::-webkit-scrollbar {
    display: none;
  }

  .tab {
    flex: 0 0 auto;
    min-height: 44px;
    padding: 12px 16px;
    white-space: nowrap;
  }

  .workflow-stepper {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 4px;
  }

  .workflow-stepper::-webkit-scrollbar {
    display: none;
  }

  .wf-step {
    flex: 0 0 auto;
    min-width: 132px;
    min-height: 44px;
  }

  .patient-grid {
    grid-template-columns: 1fr;
  }

  .patient-grid label,
  .patient-grid input,
  .patient-grid select,
  .patient-grid button,
  .patient-grid .span-3,
  .patient-grid .span-7,
  .patient-db-label,
  .agenda-turn-banner {
    grid-column: 1 / -1;
  }

  .review-toolbar {
    grid-template-columns: 1fr;
  }

  .review-toolbar label {
    margin-top: 4px;
  }

  .workbar-row {
    grid-template-columns: 1fr;
  }

  .workbar-row .span-2,
  .workbar-row label.btn,
  .workbar-row button,
  .workbar-row details {
    grid-column: 1 / -1;
  }

  .ocr-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .ocr-bar .btn,
  .ocr-bar .ocr-status {
    width: 100%;
    min-height: 44px;
  }

  .intel-banner {
    flex-direction: column;
    align-items: stretch;
  }

  .intel-banner .btn {
    width: 100%;
    min-height: 44px;
  }

  .signature-grid {
    grid-template-columns: 1fr;
  }

  .signature-grid .span-2,
  .signature-grid .span-3,
  .signature-grid .span-4,
  .confirm-row {
    grid-column: 1 / -1;
  }

  .signature-grid .btn {
    width: 100%;
    min-height: 48px;
  }

  .signature-profile-preview-wrap {
    width: 100%;
    min-height: 56px;
  }

  .signature-profile-preview {
    max-height: 72px;
    max-width: min(100%, 300px);
    min-height: 40px;
  }

  .signature-profile-actions {
    width: 100%;
  }

  .signature-profile-actions .btn {
    flex: 1 1 auto;
    min-height: 44px;
  }

  .activity-panel {
    position: relative;
    top: auto;
    z-index: 1;
  }

  .revision-split {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 0;
  }

  .revision-split .table-box {
    order: 1;
    flex: 0 0 auto;
    min-height: 0;
  }

  .revision-split .detail-panel {
    order: 2;
    flex: 0 0 auto;
  }

  .revision-split .source-viewer {
    order: 3;
    flex: 0 0 auto;
  }

  .revision-split.viewer-collapsed .source-viewer {
    display: none;
    min-height: 0;
    margin: 0;
    padding: 0;
  }

  .revision-split.viewer-collapsed {
    grid-template-columns: 1fr;
  }

  .viewer-mobile-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
  }

  .source-viewer .viewer-toggle-btn {
    display: none;
  }

  .revision-split:not(.viewer-collapsed) .source-viewer {
    order: 3;
  }

  .table-box .lab-table-wrap {
    flex: 0 1 auto;
    max-height: min(52dvh, 520px);
    height: auto;
    margin-top: 0;
  }

  .lab-table-wrap .lab-table {
    min-width: 640px;
  }

  .lab-table-wrap th,
  .lab-table-wrap td {
    padding: 10px 8px;
    font-size: 13px;
  }

  .detail-header {
    flex-direction: column;
    align-items: stretch;
  }

  .detail-title {
    font-size: 13px;
    line-height: 1.45;
    word-break: break-word;
    padding: 10px 12px;
  }

  .intel-notice {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .intel-notice > span:last-child {
    font-size: 12px;
    line-height: 1.45;
  }

  .detail-workflow-actions {
    grid-template-columns: 1fr;
  }

  .detail-workflow-actions .btn {
    width: 100%;
    min-height: 48px;
    font-size: 14px;
  }

  .detail-panel .field-title {
    font-size: 12px;
    line-height: 1.4;
  }

  .viewer-stage {
    min-height: 200px;
    max-height: 38dvh;
  }

  .viewer-hint {
    font-size: 12px;
    line-height: 1.45;
  }

  .user-badge {
    max-width: min(220px, 72vw);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: center;
  }

  .menubar-right .badge,
  .menubar-right .btn {
    text-align: center;
  }

  .connectivity-bar {
    justify-content: center;
    flex-wrap: wrap;
    text-align: center;
    gap: 8px;
  }

  .connectivity-text {
    flex: 1 1 100%;
    text-align: center;
    max-width: 100%;
  }

  .actions-box .import-hint {
    display: none;
  }

  .workbar-row .has-tip[data-tip]::after,
  .workbar-row .has-tip[data-tip]:hover::after {
    display: none !important;
  }

  .btn-link {
    min-height: 44px;
    padding: 8px 4px;
    display: inline-flex;
    align-items: center;
  }

  .viewer-tools {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
  }

  .viewer-tools .btn {
    width: 100%;
    min-height: 44px;
  }

  .dialog-actions {
    flex-direction: column-reverse;
  }

  .dialog-actions .btn {
    width: 100%;
    min-height: 48px;
  }

  .lab-dialog,
  .patient-dialog,
  .settings-dialog {
    width: calc(100vw - 16px);
    max-width: none;
    max-height: calc(100dvh - 24px);
  }

  .lab-dialog form,
  .patient-dialog form,
  .settings-dialog form {
    max-height: calc(100dvh - 48px);
    overflow: auto;
  }

  .console-grid-text {
    grid-template-columns: 1fr;
  }

  .ai-console-header {
    grid-template-columns: 1fr;
  }

  .system-status-badge {
    justify-self: start;
  }

  .menubar-right .btn,
  .menubar-right .badge {
    min-height: 40px;
    font-size: 10px;
    padding: 6px 10px;
  }
}

@media (max-width: 480px) {
  .app-shell {
    padding-top: 6px;
    gap: 8px;
  }

  .group-box {
    padding: 12px 10px;
  }

  .tab-panel {
    padding: 10px 6px;
  }

  .connectivity-text {
    font-size: 11px;
    line-height: 1.35;
  }
}

@media (hover: none) and (pointer: coarse) {
  .btn,
  .tab,
  .wf-step,
  .section-toggle {
    touch-action: manipulation;
    -webkit-tap-highlight-color: rgba(167, 232, 90, 0.15);
  }

  .has-tip[data-tip]:not([data-tip=""])::after,
  .has-tip[data-tip]:not([data-tip=""]):hover::after,
  .has-tip[data-tip]:not([data-tip=""]):focus-visible::after {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
  }

  input,
  select,
  textarea {
    font-size: 16px;
  }
}

/* Mapa holográfico 3D — estilo MEDI-AI (modo prueba) */
.hologram-panel-wrap {
  padding: 0;
  overflow: hidden;
  background: #040a14;
  border: 1px solid rgba(46, 140, 255, 0.35);
  box-shadow: 0 0 40px rgba(0, 120, 255, 0.08) inset;
}

.hologram-body-root {
  min-height: 640px;
}

.holo-beta-toolbar {
  padding: 14px 16px 8px;
  border-bottom: 1px solid rgba(46, 140, 255, 0.22);
  background: rgba(6, 20, 40, 0.65);
}

.holo-beta-intro {
  margin: 0 0 10px;
  font-size: 13px;
  color: rgba(200, 230, 255, 0.88);
  line-height: 1.45;
}

.holo-beta-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.hologram-placeholder {
  margin: 0;
  padding: 48px 24px;
  text-align: center;
  color: var(--muted);
}

.holo-medi-shell {
  display: flex;
  flex-direction: column;
  min-height: 620px;
  background:
    radial-gradient(ellipse 80% 50% at 50% 45%, rgba(20, 80, 160, 0.18) 0%, transparent 60%),
    linear-gradient(180deg, #050d18 0%, #030810 100%);
}

.holo-topbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 18px;
  border-bottom: 1px solid rgba(46, 140, 255, 0.35);
  background: linear-gradient(90deg, rgba(8, 30, 60, 0.95), rgba(4, 16, 36, 0.9));
}

.holo-topbar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.holo-topbar-logo {
  font-size: 22px;
  color: #4ecbff;
  text-shadow: 0 0 12px #4ecbff;
}

.holo-topbar-title {
  margin: 0;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: #e8f4ff;
  text-transform: uppercase;
}

.holo-topbar-sub {
  margin: 2px 0 0;
  font-size: 10px;
  color: rgba(140, 200, 255, 0.75);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.holo-topbar-patient {
  font-size: 12px;
  color: #9fd4ff;
  padding: 6px 12px;
  border: 1px solid rgba(78, 203, 255, 0.3);
  border-radius: 8px;
  background: rgba(8, 40, 80, 0.5);
}

.holo-dashboard {
  display: grid;
  grid-template-columns: minmax(140px, 180px) 1fr minmax(140px, 200px);
  gap: 0;
  flex: 1;
  min-height: 480px;
}

.holo-sidebar {
  padding: 14px 12px;
  border-right: 1px solid rgba(46, 140, 255, 0.2);
  background: rgba(4, 14, 28, 0.85);
}

.holo-sidebar-right {
  border-right: 0;
  border-left: 1px solid rgba(46, 140, 255, 0.2);
}

.holo-sidebar-title {
  margin: 0 0 12px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.1em;
  color: #5eb8ff;
  text-transform: uppercase;
}

.holo-workflow {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}

.holo-wf-step {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  padding: 8px;
  border-radius: 8px;
  border: 1px solid rgba(46, 140, 255, 0.15);
  background: rgba(8, 24, 48, 0.6);
  font-size: 11px;
  color: rgba(180, 220, 255, 0.7);
}

.holo-wf-step.active {
  border-color: rgba(78, 203, 255, 0.55);
  background: rgba(12, 50, 100, 0.55);
  color: #dff4ff;
  box-shadow: 0 0 16px rgba(46, 140, 255, 0.2);
}

.holo-wf-step.done .holo-wf-num {
  background: rgba(46, 140, 255, 0.35);
  color: #9fd4ff;
}

.holo-wf-num {
  flex: 0 0 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 800;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(200, 230, 255, 0.8);
}

.holo-wf-body strong {
  display: block;
  font-size: 11px;
  margin-bottom: 4px;
}

.holo-wf-bar {
  height: 4px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
  margin-bottom: 2px;
}

.holo-wf-bar span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #1a8cff, #4ecbff);
  border-radius: 4px;
}

.holo-wf-body small {
  font-size: 9px;
  color: rgba(140, 200, 255, 0.65);
}

.holo-patient-card {
  text-align: center;
  padding: 12px 8px;
  border-radius: 10px;
  border: 1px solid rgba(46, 140, 255, 0.25);
  background: rgba(8, 30, 60, 0.55);
}

.holo-patient-avatar {
  width: 48px;
  height: 48px;
  margin: 0 auto 8px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 800;
  color: #dff4ff;
  background: linear-gradient(135deg, #1a6fff, #4ecbff);
  box-shadow: 0 0 16px rgba(46, 140, 255, 0.35);
}

.holo-patient-name {
  display: block;
  font-size: 14px;
  color: #e8f4ff;
  margin-bottom: 4px;
}

.holo-patient-meta,
.holo-patient-study,
.holo-patient-note {
  margin: 0 0 6px;
  font-size: 11px;
  color: rgba(160, 210, 255, 0.75);
}

.holo-patient-note {
  font-size: 10px;
  font-style: italic;
  opacity: 0.8;
}

.hologram-stage-inner {
  position: relative;
  min-height: 560px;
  max-height: min(82vh, 900px);
  overflow: hidden;
}

.holo-has-organ-focus .hologram-stage {
  filter: none;
}

.holo-has-organ-focus .hologram-panels-layer .holo-panel-muted,
.holo-has-organ-focus .beta-panels-layer .beta-panel.holo-panel-muted {
  opacity: 0.22;
  transform: scale(0.94);
  filter: saturate(0.45) blur(0.4px);
  pointer-events: none;
}

.holo-panel.holo-panel-expanded,
.beta-panel.holo-panel-expanded {
  z-index: 30 !important;
  width: min(320px, 36%) !important;
  padding: 12px 14px !important;
  border-color: rgba(94, 249, 255, 0.75) !important;
  background: linear-gradient(165deg, rgba(10, 36, 68, 0.98), rgba(6, 18, 38, 0.96)) !important;
  box-shadow:
    0 0 0 2px rgba(94, 249, 255, 0.55),
    0 16px 42px rgba(0, 0, 0, 0.55),
    0 0 28px rgba(46, 140, 255, 0.22) !important;
  backdrop-filter: blur(12px);
}

.holo-panel-expanded .holo-panel-head h4,
.beta-panel.holo-panel-expanded h3 {
  font-size: 13px;
}

.holo-panel-expanded .holo-metric,
.beta-panel.holo-panel-expanded .metric {
  font-size: 12px;
  padding: 8px 9px;
}

.holo-panel-expanded .holo-metric-value,
.beta-panel.holo-panel-expanded .metric-value {
  font-size: 13px;
}

.holo-panel-expanded .holo-metric-sub,
.beta-panel.holo-panel-expanded .metric-sub {
  font-size: 10px;
}

.holo-connector-active {
  stroke-width: 2.6 !important;
  stroke-dasharray: none !important;
  opacity: 1 !important;
  animation: holo-connector-pulse 1.8s ease-in-out infinite;
}

.holo-connector-dot-active {
  filter: drop-shadow(0 0 10px rgba(126, 249, 255, 1));
}

@keyframes holo-connector-pulse {
  0%, 100% { opacity: 0.75; }
  50% { opacity: 1; }
}

.hologram-connectors {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 4;
}

.holo-connector {
  stroke: rgba(78, 203, 255, 0.55);
  stroke-width: 1.6;
  fill: none;
  filter: drop-shadow(0 0 4px rgba(78, 203, 255, 0.65));
  stroke-dasharray: 6 4;
  animation: holo-pulse-line 2.5s ease-in-out infinite;
}

.holo-connector-red { stroke: rgba(255, 100, 120, 0.85); filter: drop-shadow(0 0 5px rgba(255, 80, 100, 0.75)); }
.holo-connector-amber { stroke: rgba(255, 200, 87, 0.8); filter: drop-shadow(0 0 5px rgba(255, 180, 60, 0.65)); }
.holo-connector-ok { stroke: rgba(100, 255, 180, 0.55); filter: drop-shadow(0 0 4px rgba(80, 255, 170, 0.5)); }

.holo-connector-dot {
  fill: rgba(126, 249, 255, 0.95);
  filter: drop-shadow(0 0 6px rgba(78, 203, 255, 0.9));
}
.holo-connector-dot-red { fill: rgba(255, 90, 110, 0.95); filter: drop-shadow(0 0 6px rgba(255, 70, 90, 0.9)); }
.holo-connector-dot-amber { fill: rgba(255, 200, 87, 0.95); filter: drop-shadow(0 0 6px rgba(255, 180, 60, 0.85)); }
.holo-connector-dot-ok { fill: rgba(100, 255, 180, 0.9); filter: drop-shadow(0 0 5px rgba(80, 255, 170, 0.75)); }
.holo-connector-dot-panel { opacity: 0.75; }

@keyframes holo-pulse-line {
  0%, 100% { opacity: 0.45; }
  50% { opacity: 1; }
}

.hologram-stage {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 2;
  width: min(420px, 56vw);
  perspective: 1000px;
}

.hologram-body-3d {
  position: relative;
  width: 100%;
  transform-style: preserve-3d;
  animation: holo-body-idle 8s ease-in-out infinite;
}

@keyframes holo-body-idle {
  0%, 100% { transform: rotateY(-6deg); }
  50% { transform: rotateY(6deg); }
}

.hologram-body-3d:has(.hologram-three-mount) {
  animation: none;
}

.holo-mode-chip {
  position: absolute;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 6;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  pointer-events: none;
}

.holo-mode-chip.holo-mode-3d {
  color: #5dffb0;
  border: 1px solid rgba(93, 255, 176, 0.45);
  background: rgba(6, 30, 24, 0.85);
  box-shadow: 0 0 12px rgba(93, 255, 176, 0.25);
}

.holo-mode-chip.holo-reset-flash {
  animation: holo-reset-flash 0.45s ease-out;
  border-color: rgba(126, 232, 255, 0.9);
  color: #e8f6ff;
}

@keyframes holo-reset-flash {
  0% { transform: translateX(-50%) scale(1); box-shadow: 0 0 0 0 rgba(126, 232, 255, 0.5); }
  40% { transform: translateX(-50%) scale(1.06); box-shadow: 0 0 0 10px rgba(126, 232, 255, 0); }
  100% { transform: translateX(-50%) scale(1); box-shadow: 0 0 0 0 rgba(126, 232, 255, 0); }
}

.holo-mode-chip.holo-mode-svg {
  color: #ffc857;
  border: 1px solid rgba(255, 200, 87, 0.45);
  background: rgba(40, 28, 6, 0.88);
}

.holo-focus-bar {
  position: absolute;
  top: 6px;
  left: 6px;
  right: 6px;
  z-index: 6;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  justify-content: center;
  pointer-events: auto;
}

.holo-focus-btn {
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 4px 9px;
  border-radius: 999px;
  cursor: pointer;
  border: 1px solid rgba(78, 203, 255, 0.35);
  background: rgba(4, 20, 36, 0.88);
  color: #b8e8ff;
}

.holo-focus-btn:hover,
.holo-focus-btn.active {
  border-color: #5ef9ff;
  background: rgba(20, 70, 100, 0.92);
  color: #fff;
}

.holo-panel.holo-panel-focused {
  box-shadow:
    0 0 0 2px rgba(94, 249, 255, 0.65),
    0 0 20px rgba(46, 140, 255, 0.35);
  z-index: 5;
}

.holo-panel[data-anchor],
.beta-panel[data-anchor] {
  cursor: pointer;
  transition:
    opacity 0.28s ease,
    transform 0.28s ease,
    box-shadow 0.28s ease,
    top 0.32s ease,
    width 0.32s ease;
}

.hologram-body-3d .hologram-three-mount {
  padding-top: 44px;
  box-sizing: border-box;
}

.hologram-three-mount {
  width: 100%;
  height: min(580px, 68vh);
  min-height: 440px;
  position: relative;
  z-index: 3;
  cursor: grab;
}

.hologram-three-mount:active {
  cursor: grabbing;
}

.hologram-three-canvas {
  cursor: grab;
  width: 100% !important;
  height: 100% !important;
  display: block;
  touch-action: none;
  filter: drop-shadow(0 0 28px rgba(46, 140, 255, 0.55));
}

.holo-model-loading {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 3.5rem 1rem 1rem;
  text-align: center;
  pointer-events: none;
  background: radial-gradient(ellipse at center, rgba(0, 18, 36, 0.55), transparent 70%);
}

.hologram-placeholder.hologram-loading {
  color: rgba(126, 249, 255, 0.9);
  animation: holo-pulse-line 2s ease-in-out infinite;
}

.hologram-body-svg {
  width: 100%;
  height: auto;
  display: block;
  filter: drop-shadow(0 0 24px rgba(46, 140, 255, 0.5));
}

.hologram-ring {
  position: absolute;
  left: 50%;
  bottom: 4%;
  border: 1px solid rgba(78, 203, 255, 0.35);
  border-radius: 50%;
  transform: translate(-50%, 0) rotateX(75deg);
  pointer-events: none;
}

.holo-ring-1 {
  width: 130%;
  height: 28%;
  animation: holo-ring-spin 12s linear infinite;
}

.holo-ring-2 {
  width: 155%;
  height: 34%;
  animation: holo-ring-spin 18s linear infinite reverse;
  opacity: 0.45;
}

.holo-ring-3 {
  width: 180%;
  height: 40%;
  opacity: 0.25;
  animation: holo-ring-spin 24s linear infinite;
}

@keyframes holo-ring-spin {
  from { transform: translate(-50%, 0) rotateX(75deg) rotateZ(0deg); }
  to { transform: translate(-50%, 0) rotateX(75deg) rotateZ(360deg); }
}

.hologram-panels-layer {
  position: absolute;
  inset: 48px 8px 10px;
  z-index: 3;
  pointer-events: none;
  display: grid;
  grid-template-columns: minmax(190px, 27%) 1fr minmax(190px, 27%);
  grid-template-rows: 1fr;
  gap: 0 10px;
  overflow: hidden;
  min-height: 0;
}

.holo-panels-scroll {
  grid-row: 1;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 2px 6px 6px 2px;
  pointer-events: auto;
  max-height: 100%;
  scrollbar-width: thin;
  scrollbar-color: rgba(78, 203, 255, 0.45) rgba(0, 0, 0, 0.2);
}

.holo-panels-scroll::-webkit-scrollbar {
  width: 6px;
}

.holo-panels-scroll::-webkit-scrollbar-thumb {
  background: rgba(78, 203, 255, 0.4);
  border-radius: 999px;
}

.holo-panels-col-left {
  grid-column: 1;
}

.holo-panels-col-right {
  grid-column: 3;
}

.holo-panel {
  position: relative;
  width: 100%;
  padding: 9px 11px;
  border-radius: 10px;
  border: 1px solid rgba(46, 140, 255, 0.35);
  background: linear-gradient(160deg, rgba(8, 28, 58, 0.94), rgba(4, 14, 32, 0.92));
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.45), 0 0 20px rgba(46, 140, 255, 0.08);
  backdrop-filter: blur(8px);
  pointer-events: auto;
}

.panel-tone-red { border-color: rgba(255, 90, 90, 0.5); box-shadow: 0 0 18px rgba(255, 60, 60, 0.12); }
.panel-tone-amber { border-color: rgba(255, 200, 87, 0.45); }
.panel-tone-ok { border-color: rgba(78, 203, 255, 0.35); }

.holo-panel-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(46, 140, 255, 0.2);
}

.holo-panel-icon {
  width: 18px;
  height: 18px;
  color: #4ecbff;
  flex-shrink: 0;
}

.holo-panel-icon svg {
  width: 100%;
  height: 100%;
}

.holo-panel-head h4 {
  margin: 0;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #b8e4ff;
}

.holo-panel-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 6px;
}

.holo-metric {
  padding: 6px 7px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.22);
  font-size: 11px;
}

.holo-metric.level-red { border-left: 2px solid #ff5a5a; }
.holo-metric.level-amber { border-left: 2px solid #ffc857; }
.holo-metric.level-ok { border-left: 2px solid #5dffb0; }
.holo-metric.level-neutral { border-left: 2px solid rgba(150, 200, 230, 0.3); }

.holo-metric-main {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.holo-metric-name {
  color: rgba(180, 220, 255, 0.85);
  font-weight: 600;
}

.holo-metric-value {
  color: #f0f8ff;
  font-weight: 800;
  flex: 1;
}

.holo-metric-sub {
  display: flex;
  justify-content: space-between;
  gap: 6px;
  margin-top: 2px;
  padding-left: 2px;
  font-size: 9px;
  color: rgba(140, 190, 230, 0.75);
}

.holo-metric-status {
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.holo-sym { font-size: 10px; line-height: 1; }
.holo-sym-ok { color: #5dffb0; }
.holo-sym-amber { color: #ffc857; }
.holo-sym-red { color: #ff6b6b; }
.holo-sym-alert { color: #ff4444; font-size: 9px; }
.holo-sym-neutral { color: rgba(180, 200, 220, 0.5); }

.holo-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 16px;
  border-top: 1px solid rgba(46, 140, 255, 0.25);
  background: rgba(4, 12, 24, 0.95);
  font-size: 10px;
  color: rgba(160, 200, 240, 0.8);
}

.holo-footer-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.holo-footer-legend strong {
  color: #8ec8ff;
  margin-right: 4px;
}

.legend-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  margin-right: 4px;
  vertical-align: middle;
}

.legend-dot.ok { background: #5dffb0; box-shadow: 0 0 6px #5dffb0; }
.legend-dot.amber { background: #ffc857; box-shadow: 0 0 6px #ffc857; }
.legend-dot.red { background: #ff6b6b; box-shadow: 0 0 6px #ff6b6b; }

.legend-tri.red {
  display: inline-block;
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-bottom: 7px solid #ff5555;
  margin-right: 4px;
  vertical-align: middle;
}

.holo-status-ok { color: #5dffb0; }

.holo-footer-meta {
  display: flex;
  gap: 16px;
  align-items: center;
}

body.testing-mode-active .testing-only.hidden {
  display: none !important;
}

@media (max-width: 1100px) {
  .holo-dashboard {
    grid-template-columns: 1fr;
  }

  .holo-sidebar-left,
  .holo-sidebar-right {
    border: 0;
    border-bottom: 1px solid rgba(46, 140, 255, 0.2);
  }

  .holo-workflow {
    grid-template-columns: repeat(2, 1fr);
  }

  .hologram-stage-inner {
    min-height: 720px;
  }
}

@media (max-width: 700px) {
  .hologram-stage {
    width: min(92vw, 380px);
  }

  .hologram-panels-layer {
    position: relative;
    inset: auto;
    display: grid;
    gap: 10px;
    padding: 12px;
    margin-top: 12px;
  }

  .holo-panel {
    position: relative;
    top: auto !important;
    left: auto !important;
    right: auto !important;
    bottom: auto !important;
    width: 100%;
  }

  .hologram-connectors {
    display: none;
  }

  .hologram-stage {
    position: relative;
    left: auto;
    top: auto;
    transform: none;
    margin: 0 auto 8px;
  }

  .hologram-stage-inner {
    display: flex;
    flex-direction: column;
    min-height: auto;
  }

  .hologram-three-mount {
    min-height: min(58vh, 520px) !important;
    height: min(58vh, 520px) !important;
  }
}
