:root {
  --navy: #0f172a;
  --navy2: #1e293b;
  --navy3: #334155;
  --blue-lt: #e0f2fe;
  --blue-md: #bae6fd;
  --bg: #e2e8f0;
  --surface: #ffffff;
  --border: rgba(203, 213, 225, 0.4);
  --border2: rgba(203, 213, 225, 0.6);
  --text: #0f172a;
  --text2: #334155;
  --text3: #64748b;
  --text4: #94a3b8;
  --warn: #ef4444;
  --warn-bg: #fee2e2;
  --amber: #d97706;
  --amb-bg: #fef3c7;
  --green: #10b981;
  --grn-bg: #d1fae5;
  --r: 20px;
  --r-sm: 10px;
  --shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.04), 0 8px 10px -6px rgba(0, 0, 0, 0.01);
  --shadow-hover: 0 20px 25px -5px rgba(0, 0, 0, 0.08), 0 8px 10px -6px rgba(0, 0, 0, 0.02);
  --font-ui: 'Inter', -apple-system, 'Helvetica Neue', sans-serif;
  --font-serif: 'Outfit', Georgia, serif;
  --sidebar: 200px;
  --topbar: 72px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0
}

html,
body {
  height: 100%;
  overflow: hidden
}

body {
  font-family: var(--font-ui);
  background: var(--bg);
  color: var(--text);
  font-size: 14px
}

button {
  cursor: pointer;
  font-family: var(--font-ui)
}

input,
textarea,
select {
  font-family: var(--font-ui)
}

#app {
  display: flex;
  flex-direction: column;
  height: 100vh
}

/* ── Topbar paciente ── */
#topbar {
  height: var(--topbar);
  min-height: var(--topbar);
  background: var(--navy);
  color: white;
  display: none;
  align-items: center;
  gap: 14px;
  padding: 0 20px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .25);
  z-index: 100
}

#topbar-logo {
  font-family: var(--font-serif);
  font-size: 22px;
  font-weight: 600;
  flex: 1
}

#topbar-logo span {
  color: rgba(255, 255, 255, .4);
  font-size: 11px;
  font-weight: 400;
  margin-left: 8px
}

#topbar-patient {
  text-align: right;
  display: none
}

#topbar-patient strong {
  display: block;
  font-size: 13px;
  font-weight: 500
}

#topbar-patient span {
  font-size: 11px;
  color: rgba(255, 255, 255, .5)
}

#btn-home {
  background: rgba(255, 255, 255, .12);
  border: 0.5px solid rgba(255, 255, 255, .25);
  color: rgba(255, 255, 255, .85);
  padding: 6px 12px;
  border-radius: var(--r-sm);
  font-size: 12px;
  display: none
}

/* ── Layout ── */
#body {
  display: flex;
  flex: 1;
  overflow: hidden
}

#sidebar {
  width: var(--sidebar);
  min-width: var(--sidebar);
  background: linear-gradient(180deg, #0c1e29 0%, #103a5e 100%); /* Degradado azul profundo */
  border-right: none;
  display: none;
  flex-direction: column;
  overflow-y: auto;
  box-shadow: 4px 0 15px rgba(0,0,0,0.15);
}

.btn:active {
  transform: scale(.97)
}

.btn-dictating {
  background: #fee2e2 !important;
  color: #dc2626 !important;
  border-color: #fca5a5 !important;
  animation: pulse-red 1.5s infinite;
}

@keyframes pulse-red {
  0% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.4); }
  70% { box-shadow: 0 0 0 4px rgba(220, 38, 38, 0); }
  100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0); }
}

.field-lbl {
  padding: 5px 16px 3px;
  font-size: 10px;
  font-weight: 600;
  color: var(--text4);
  text-transform: uppercase;
  letter-spacing: .08em
}

.s-section {
  padding: 8px 0 4px
}

.s-lbl {
  padding: 12px 16px 6px;
  font-size: 10px;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: .08em;
  opacity: 0.8;
}

.sitem {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  font-size: 13px;
  color: #94a3b8;
  cursor: pointer;
  border-left: 3px solid transparent;
  transition: all .2s cubic-bezier(0.4, 0, 0.2, 1);
}

.sitem:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #f1f5f9;
}

.sitem.active {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
  border-left-color: #10b981; /* Acento verde brillante */
  font-weight: 600;
}

/* Utilities */
.ml-8 { margin-left: 8px; }
.mt-14 { margin-top: 14px; }
.gap-6 { gap: 6px; }
.gap-8 { gap: 8px; }

.content-section {
  display: none;
}

.btn-group-row {
  margin-top: 12px;
  display: flex;
  gap: 8px;
}

.btn-gradient-indigo {
  background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
  color: white;
  border: none;
}

.btn-gradient-green {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: white;
  border: none;
}

.flex-between {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.section-title-sm {
  font-size: 15px;
  font-weight: 600;
  color: var(--navy2);
}

.btn-scribe {
  background: #10b981 !important;
  color: white !important;
  border-color: #10b981 !important;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.chart-ref-text {
  font-size: 12px;
  color: var(--text4);
  margin-top: 8px;
}

.logo-img-sm {
  width: 32px;
  height: 32px;
  object-fit: contain;
}

.sitem-ic {
  font-size: 14px;
  width: 18px;
  text-align: center
}

.sitem-badge {
  margin-left: auto;
  font-size: 10px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 10px;
  min-width: 18px;
  text-align: center;
  line-height: 1.4;
}

#main {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  background: var(--bg)
}

/* ══ HOME SCREEN — CLARO ══ */
#screen-home {
  display: flex;
  flex-direction: column;
  height: 100vh;
  background: var(--bg)
}

/* Topbar del home */
.home-topbar {
  height: var(--topbar);
  background: var(--navy);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 12px;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .2)
}

.home-topbar-logo {
  font-family: var(--font-serif);
  color: white;
  font-size: 22px;
  font-weight: 600;
  flex: 1
}

.home-topbar-logo em {
  color: rgba(255, 255, 255, .4);
  font-size: 11px;
  font-weight: 400;
  font-style: normal;
  margin-left: 8px
}

.home-clock {
  font-size: 12px;
  color: rgba(255, 255, 255, .45)
}

/* Splash card */
.home-body {
  flex: 1;
  display: flex;
  gap: 0;
  overflow: hidden
}

/* Panel izquierdo — splash */
.splash-panel {
  width: 400px;
  flex-shrink: 0;
  background: linear-gradient(160deg, #071729 0%, #0c2340 40%, #1a3a8f 100%);
  border-right: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 32px;
  box-shadow: 6px 0 32px rgba(7, 23, 41, .35);
  position: relative;
  overflow: hidden;
}
.splash-panel::before {
  content: '';
  position: absolute;
  top: -80px; right: -80px;
  width: 260px; height: 260px;
  background: rgba(255,255,255,.04);
  border-radius: 50%;
}
.splash-panel::after {
  content: '';
  position: absolute;
  bottom: -100px; left: -60px;
  width: 320px; height: 320px;
  background: rgba(26,58,143,.15);
  border-radius: 50%;
}


.splash-caricatura {
  width: 170px;
  object-fit: contain;
  margin-bottom: 16px;
  position: relative;
  z-index: 1;
  filter: drop-shadow(0 6px 20px rgba(0,0,0,0.5));
}

.splash-name {
  font-family: var(--font-serif);
  font-size: 24px;
  font-weight: 700;
  color: white;
  text-align: center;
  margin-bottom: 4px;
  position: relative;
  z-index: 1;
}

.splash-line {
  width: 55%;
  height: 1px;
  background: rgba(255,255,255,0.25);
  margin: 10px auto 14px;
  position: relative;
  z-index: 1;
}

.splash-info {
  text-align: center;
  font-size: 12px;
  color: rgba(255,255,255,0.6);
  line-height: 1.85;
  position: relative;
  z-index: 1;
}

.splash-info strong {
  color: rgba(255,255,255,0.92);
  font-size: 13px;
}

.splash-specs {
  margin-top: 18px;
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: center;
  width: 100%;
  position: relative;
  z-index: 1;
}

.splash-spec {
  font-size: 11px;
  color: rgba(255,255,255,0.85);
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.15);
  padding: 4px 12px;
  border-radius: 20px;
  letter-spacing: .02em;
}

.splash-spec::after {
  display: none;
}

/* Panel derecho — búsqueda */
.search-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 24px 30px;
  overflow-y: auto
}

.search-greeting {
  font-size: 13px;
  color: var(--text3);
  margin-bottom: 4px
}

.search-title {
  font-family: var(--font-serif);
  font-size: 28px;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 22px;
  letter-spacing: -.01em
}

.hsearch-wrap {
  position: relative;
  margin-bottom: 8px
}

.hsearch-input {
  width: 100%;
  padding: 15px 18px 15px 50px;
  font-size: 16px;
  border: 1.5px solid var(--border2);
  border-radius: 12px;
  background: white;
  color: var(--text);
  outline: none;
  box-shadow: 0 2px 12px rgba(12, 35, 64, .07)
}

.hsearch-input:focus {
  border-color: var(--navy2);
  box-shadow: 0 0 0 3px rgba(26, 58, 143, .1)
}

.hsearch-ic {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 19px;
  color: var(--text4)
}

.home-hint {
  font-size: 12px;
  color: var(--text4);
  margin-bottom: 24px;
  padding-left: 2px
}

/* Recientes */
.hsec-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--text4);
  text-transform: uppercase;
  letter-spacing: .1em;
  margin-bottom: 10px
}

.recents-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 24px
}

.recent-card {
  background: white;
  border: 0.5px solid var(--border);
  border-radius: var(--r);
  padding: 12px 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: all .15s;
  min-width: 0;
  box-shadow: var(--shadow)
}

.recent-card:hover {
  border-color: var(--navy2);
  box-shadow: 0 3px 14px rgba(26, 58, 143, .12);
  transform: translateY(-1px)
}

.recent-card-empty {
  font-size: 13px;
  color: var(--text4);
  font-style: italic;
  padding: 8px 0;
  grid-column: 1/-1
}

.rc-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis
}

.rc-meta {
  font-size: 11px;
  color: var(--text3);
  margin-top: 2px
}

.rc-time {
  font-size: 10px;
  color: var(--text4);
  margin-top: 2px
}

/* Acciones rápidas */
.quick-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 20px
}

.quick-card {
  background: white;
  border: 0.5px solid var(--border);
  border-radius: var(--r);
  padding: 14px 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: all .15s;
  box-shadow: var(--shadow)
}

.quick-card:hover {
  border-color: var(--navy2);
  box-shadow: 0 3px 14px rgba(26, 58, 143, .12);
  transform: translateY(-1px)
}

.quick-icon {
  width: 38px;
  height: 38px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0
}

.qi-blue {
  background: #dbeafe
}

.qi-amber {
  background: #fef3c7
}

.qi-purple {
  background: #ede9fe
}

.quick-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--navy2);
  margin-bottom: 1px
}

.quick-sub {
  font-size: 11px;
  color: var(--text4);
  line-height: 1.3
}

/* Resultados búsqueda */
#search-results-wrap {
  display: none
}

.home-pac-list {
  background: white;
  border: 0.5px solid var(--border);
  border-radius: var(--r);
  overflow: hidden;
  box-shadow: var(--shadow);
  max-height: 320px;
  overflow-y: auto
}

.home-pac-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 16px;
  border-bottom: 0.5px solid var(--border);
  cursor: pointer;
  transition: background .1s
}

.home-pac-item:last-child {
  border-bottom: none
}

.home-pac-item:hover {
  background: var(--bg)
}

.home-pac-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text)
}

.home-pac-meta {
  font-size: 12px;
  color: var(--text3);
  margin-top: 2px
}

.hav {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--blue-lt);
  color: var(--navy3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
  border: 1.5px solid var(--blue-md)
}

.hav.f {
  background: #fce7f3;
  color: #831843;
  border-color: #fbcfe8
}

/* ══ PACIENTE ══ */
#screen-paciente {
  display: none
}

.pac-hdr {
  background: linear-gradient(135deg, var(--navy) 0%, #1e3a8a 100%);
  padding: 20px 28px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.pac-av-lg {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: rgba(255,255,255,0.15);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 700;
  flex-shrink: 0;
  border: 2px solid rgba(255,255,255,0.3);
}

.pac-av-lg.f {
  background: rgba(251,207,232,0.2);
  color: #fbcfe8;
  border-color: rgba(251,207,232,0.4);
}

.pac-hdr-name {
  font-family: var(--font-serif);
  font-size: 22px;
  font-weight: 700;
  color: white;
  letter-spacing: -.01em;
}

.pac-hdr-meta {
  font-size: 13px;
  color: rgba(255,255,255,0.6);
  margin-top: 3px;
}

.pac-hdr .badge {
  background: rgba(255,255,255,0.15);
  color: rgba(255,255,255,0.9);
  border: 0.5px solid rgba(255,255,255,0.2);
}

.pac-hdr .btn {
  background: rgba(255,255,255,0.12);
  color: rgba(255,255,255,0.9);
  border-color: rgba(255,255,255,0.25);
}
.pac-hdr .btn:hover {
  background: rgba(255,255,255,0.2);
}

.pac-hdr-badges {
  margin-left: auto;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end
}

/* Tab content */
.tab-body {
  padding: 18px 22px
}

.card {
  background: var(--surface);
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: var(--r);
  padding: 20px 22px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.card:hover {
  box-shadow: var(--shadow-hover);
  transform: translateY(-2px);
}

.card-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--navy2);
  text-transform: uppercase;
  letter-spacing: .08em;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1.5px solid #e0e8f8;
  display: flex;
  align-items: center;
  gap: 8px;
}
.card-title::before {
  content: '';
  width: 3px;
  height: 14px;
  background: var(--navy2);
  border-radius: 2px;
  flex-shrink: 0;
}

.row2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 14px
}

.fl {
  display: flex;
  margin-bottom: 8px;
  gap: 10px;
  align-items: baseline
}

.fl-lbl {
  font-size: 12px;
  color: var(--text4);
  width: 90px;
  flex-shrink: 0;
  font-weight: 500
}

.fl-val {
  font-size: 14px;
  color: var(--text2);
  flex: 1;
  font-weight: 500
}

.contact-link {
  color: var(--primary);
  text-decoration: none;
  font-weight: 500;
  transition: opacity 0.2s;
}

.contact-link:hover {
  text-decoration: underline;
  opacity: 0.8;
}

.wa-link {
  color: #16a34a;
  background: rgba(22, 163, 74, 0.1);
  padding: 2px 6px;
  border-radius: 4px;
  margin-left: 6px;
  font-size: 12px;
  font-weight: 600;
}

.wa-link:hover {
  background: #16a34a;
  color: white;
  text-decoration: none;
}

.field-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 10px
}

.field-lbl {
  font-size: 12px;
  font-weight: 600;
  color: var(--text4)
}

.field-input {
  font-size: 14px;
  padding: 12px 14px;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  background: #f1f5f9;
  color: var(--text);
  outline: none;
  width: 100%;
  transition: all 0.2s ease;
}

.field-input:focus {
  background: var(--surface);
  border-color: #0ea5e9;
  box-shadow: 0 0 0 4px rgba(14, 165, 233, 0.15);
}

textarea.field-input {
  resize: vertical;
  min-height: 90px;
  line-height: 1.6
}

select.field-input {
  cursor: pointer
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1
}

.b-blue {
  background: var(--blue-lt);
  color: var(--navy3)
}

.b-amber {
  background: var(--amb-bg);
  color: var(--amber)
}

.b-green {
  background: var(--grn-bg);
  color: var(--green)
}

.b-red {
  background: var(--warn-bg);
  color: var(--warn)
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--r-sm);
  font-size: 13px;
  font-weight: 500;
  border: 1px solid var(--border2);
  background: var(--surface);
  color: var(--text2);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
}

.btn:hover {
  background: var(--bg);
  border-color: var(--text4);
}

.btn-primary {
  background: linear-gradient(135deg, #0ea5e9 0%, #0284c7 100%);
  color: white;
  border: none;
  box-shadow: 0 4px 12px rgba(14, 165, 233, 0.3);
  font-weight: 600;
}

.btn-primary:hover {
  box-shadow: 0 6px 16px rgba(14, 165, 233, 0.4);
  transform: translateY(-1px);
}

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

.btn-icon {
  background: none;
  border: 0.5px solid var(--border);
  border-radius: var(--r-sm);
  padding: 4px 8px;
  font-size: 12px;
  color: var(--text3);
  cursor: pointer
}

/* Notas */
.nota {
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-left: 3px solid var(--navy2);
  border-radius: 0 var(--r) var(--r) 0;
  padding: 13px 16px;
  margin-bottom: 10px;
  box-shadow: var(--shadow)
}

.nota-hdr {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px
}

.nota-fecha {
  font-size: 12px;
  font-weight: 700;
  color: var(--navy2);
  text-transform: uppercase;
  letter-spacing: .04em
}

.nota-peso {
  font-size: 12px;
  color: var(--text3);
  background: var(--bg);
  padding: 2px 8px;
  border-radius: 4px
}

.nota-text {
  font-size: 14px;
  color: var(--text2);
  line-height: 1.7;
  white-space: pre-wrap
}

.nota-actions {
  margin-left: auto;
  display: flex;
  gap: 6px
}

/* Historia */
.hc-section {
  margin-bottom: 14px
}

.hc-section-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--navy2);
  margin-bottom: 6px;
  padding-bottom: 5px;
  border-bottom: 1px solid #e0e8f8
}

.hc-text {
  font-size: 14px;
  color: var(--text2);
  line-height: 1.7;
  white-space: pre-wrap
}

.hc-empty {
  font-size: 13px;
  color: var(--text4);
  font-style: italic
}

/* Diagnósticos */
.dx-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 0.5px solid #e8edf8
}

.dx-item:last-child {
  border-bottom: none
}

.dx-num {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--navy2);
  color: white;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 1px
}

.dx-text {
  font-size: 14px;
  color: var(--text);
  font-weight: 500
}

.dx-date {
  font-size: 11px;
  color: var(--text4);
  margin-top: 2px
}

/* Laboratorio */
.lab-wrap {
  overflow-x: auto
}

.lab-t {
  border-collapse: collapse;
  width: 100%;
  font-size: 12px
}

.lab-t th {
  background: #f0f4fc;
  padding: 7px 10px;
  font-weight: 700;
  color: var(--navy2);
  border: 0.5px solid var(--border);
  white-space: nowrap;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.lab-t th.pc {
  text-align: left;
  position: sticky;
  left: 0;
  z-index: 2
}

.lab-t td {
  padding: 6px 10px;
  border: 0.5px solid var(--border);
  text-align: center;
  color: var(--text2);
  font-size: 13px;
  font-weight: 500
}

.lab-t td.pc {
  text-align: left;
  color: var(--text3);
  font-weight: 600;
  background: #f8fafc;
  position: sticky;
  left: 0;
  font-size: 12px
}

.lab-t tr:nth-child(even) td {
  background: #fafbff
}

.lab-t tr:nth-child(even) td.pc {
  background: #f3f6fb
}

.lab-hi {
  color: var(--warn);
  font-weight: 700
}

.lab-lo {
  color: var(--navy2);
  font-weight: 700
}

.param-btns {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 12px
}

.param-btn {
  padding: 5px 12px;
  border-radius: 20px;
  border: 0.5px solid var(--border2);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  background: var(--surface);
  color: var(--text3);
  transition: all .12s
}

.param-btn.active {
  background: var(--navy2);
  color: white;
  border-color: var(--navy2)
}

.chart-wrap {
  position: relative;
  height: 210px;
  margin-top: 10px
}

.lab-view-btn {
  padding: 6px 14px;
  border-radius: var(--r-sm);
  border: 0.5px solid var(--border2);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  background: var(--surface);
  color: var(--text3)
}

.lab-view-btn.active {
  background: var(--navy2);
  color: white;
  border-color: var(--navy2)
}

/* Exploración */
.ef-note {
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: var(--r);
  padding: 14px 18px;
  margin-bottom: 12px;
  box-shadow: var(--shadow)
}

.ef-hdr {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px
}

.ef-fecha {
  font-size: 13px;
  font-weight: 700;
  color: var(--navy2)
}

.ef-dato {
  font-size: 12px;
  color: var(--text3);
  background: var(--bg);
  padding: 2px 8px;
  border-radius: 4px
}

.ef-secciones {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px
}

.ef-sec-lbl {
  font-size: 11px;
  font-weight: 700;
  color: var(--text4);
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-bottom: 2px
}

.ef-sec-val {
  font-size: 13px;
  color: var(--text2);
  line-height: 1.5
}

/* Calculadoras */
.calc-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 16px
}

.calc-btn {
  padding: 12px 8px;
  border: 0.5px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface);
  cursor: pointer;
  text-align: center;
  font-size: 13px;
  font-weight: 500;
  color: var(--text3);
  transition: all .12s;
  line-height: 1.3
}

.calc-btn:hover,
.calc-btn.active {
  background: #edf2fc;
  color: var(--navy2);
  border-color: var(--navy2)
}

.calc-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px
}

.calc-lbl {
  font-size: 13px;
  color: var(--text3);
  width: 150px;
  flex-shrink: 0;
  font-weight: 500
}

.calc-input {
  width: 90px;
  padding: 6px 10px;
  border: 0.5px solid var(--border2);
  border-radius: var(--r-sm);
  font-size: 14px;
  background: var(--bg);
  text-align: right;
  outline: none
}

.calc-input:focus {
  border-color: var(--navy2);
  background: var(--surface)
}

.calc-unit {
  font-size: 12px;
  color: var(--text4);
  min-width: 40px
}

.calc-result {
  background: #edf2fc;
  border: 0.5px solid #c5d5f0;
  border-radius: var(--r);
  padding: 14px 18px;
  margin-top: 14px
}

.calc-result pre {
  font-family: var(--font-ui);
  font-size: 14px;
  white-space: pre-wrap;
  color: var(--navy2);
  font-weight: 500;
  line-height: 1.7
}

.calc-result.warn {
  background: var(--warn-bg);
  border-color: #fca5a5
}

.calc-result.warn pre {
  color: var(--warn)
}

/* Recursos */
.rec-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 8px
}

.rec-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px 8px;
  border: 0.5px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface);
  font-size: 13px;
  font-weight: 500;
  color: var(--text3);
  cursor: pointer;
  text-align: center;
  line-height: 1.3;
  transition: all .12s;
  min-height: 48px
}

.rec-btn:hover {
  background: #edf2fc;
  color: var(--navy2);
  border-color: var(--navy2)
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(12, 35, 64, .45);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px
}

.modal {
  background: var(--surface);
  border-radius: var(--r);
  padding: 22px;
  width: 100%;
  max-width: 560px;
  box-shadow: 0 8px 32px rgba(12, 35, 64, .2);
  max-height: 90vh;
  overflow-y: auto
}

.modal-title {
  font-family: var(--font-serif);
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 16px
}

.modal-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 0.5px solid var(--border)
}

.fields-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px
}

.empty {
  text-align: center;
  padding: 40px;
  color: var(--text4);
  font-size: 14px
}

.spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid var(--border);
  border-top-color: var(--navy2);
  border-radius: 50%;
  animation: spin .7s linear infinite
}

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

.fade-in {
  animation: fadeIn .18s ease
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(4px)
  }

  to {
    opacity: 1;
    transform: none
  }
}

.pac-list {
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: var(--r);
  overflow: hidden;
  box-shadow: var(--shadow)
}

.pac-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 16px;
  border-bottom: 0.5px solid var(--border);
  cursor: pointer;
  transition: background .1s
}

.pac-item:last-child {
  border-bottom: none
}

.pac-item:hover {
  background: var(--bg)
}

.pac-item-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text)
}

.pac-item-meta {
  font-size: 12px;
  color: var(--text3);
  margin-top: 2px
}

.pac-av {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--blue-lt);
  color: var(--navy3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
  border: 1.5px solid var(--blue-md)
}

.pac-av.f {
  background: #fce7f3;
  color: #831843;
  border-color: #fbcfe8
}

@media(max-width:900px) {
  .splash-panel {
    display: none
  }

  .row2,
  .fields-grid {
    grid-template-columns: 1fr
  }

  .calc-grid {
    grid-template-columns: 1fr 1fr
  }

  .recents-row {
    grid-template-columns: 1fr
  }

  .quick-grid {
    grid-template-columns: 1fr 1fr
  }
}

@media print {

  #topbar,
  #sidebar,
  .btn,
  .btn-primary,
  .btn-sm,
  .btn-icon,
  .modal-overlay,
  .pac-hdr-badges,
  .nota-actions,
  #btn-home {
    display: none !important
  }

  body {
    background: white !important
  }

  .card {
    box-shadow: none !important
  }
}
#btn-ai-scribe {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  border: none;
  color: white;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.4);
  transition: transform 0.2s;
}
#btn-ai-scribe:hover { transform: scale(1.05); }

/* Dashboard Stats Integrated */
.dash-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
  margin-top: 16px;
  margin-bottom: 24px;
}

.dash-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 12px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  height: 280px;
  width: 100%;
  max-width: 320px;
  margin: 0 auto;
}

.dash-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.dash-title-icon {
  font-size: 14px;
}

.chart-container {
  flex: 1;
  position: relative;
  min-height: 0;
}

/* Calendar Widget */
.dash-cal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2px;
}
.dash-cal-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--navy1);
}
.dash-cal-nav {
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  background: var(--bg);
  font-size: 12px;
  user-select: none;
}
.dash-cal-nav:hover { background: var(--border); }
.dash-cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
  width: 100%;
  max-width: 240px;
  margin: 0 auto;
}
.dash-cal-day-label {
  text-align: center;
  font-size: 10px;
  font-weight: 800;
  color: var(--text4);
  padding: 2px 0;
}
.dash-cal-day {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  border-radius: 50%;
  cursor: pointer;
  margin: 1px auto;
  transition: all 0.2s;
}
.dash-cal-day.other-month {
  color: #cbd5e1;
  font-weight: 400;
}
.dash-cal-day.today {
  background: var(--navy) !important;
  color: white !important;
  font-weight: 800;
  width: 28px !important;
  height: 28px !important;
  display: flex !important;
  align-items: center;
  justify-content: center;
}
.dash-cal-day:hover:not(.today) {
  background: #f1f5f9;
}

/* Labs List */
.dash-labs-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
  flex: 1;
}
.dash-lab-item {
  font-size: 12px;
  padding: 10px;
  border-radius: var(--r-sm);
  background: var(--bg);
  display: flex;
  justify-content: space-between;
  border: 0.5px solid var(--border);
  transition: all 0.2s;
}
.dash-lab-item:hover {
  border-color: var(--navy2);
  background: var(--surface);
}
.dash-lab-name { font-weight: 600; color: var(--navy1); }
.dash-lab-param { font-size: 10px; color: var(--text4); }
.dash-lab-val { font-weight: 700; color: var(--blue-dk); }
.dash-lab-date { font-size: 9px; color: var(--text4); }

/* ── PRINT STYLES ────────────────────────────────────────── */
.print-only { display: none; }

@media print {
  body { 
    background: white !important; 
    color: black !important; 
    overflow: visible !important; 
    height: auto !important; 
    padding: 0 !important;
    margin: 0 !important;
  }
  #app { height: auto !important; overflow: visible !important; display: block !important; }
  #main { 
    overflow: visible !important; 
    height: auto !important; 
    background: white !important; 
    padding: 0 !important;
    margin: 0 !important;
  }
  #sidebar, #topbar, .pac-hdr, .btn, .btn-icon, .modal-overlay, .pac-hdr-badges, #btn-home, .sitem-badge, .dash-cal-nav {
    display: none !important;
  }
  .print-only { display: block !important; }
  .card { 
    box-shadow: none !important; 
    border: none !important; 
    padding: 0 !important; 
    margin: 0 !important;
    background: transparent !important;
  }
  .nota { 
    border: none !important; 
    box-shadow: none !important; 
    padding: 0 !important; 
    margin-bottom: 30px !important;
  }
  .nota-hdr { border-bottom: 1px solid #eee; padding-bottom: 5px; margin-bottom: 10px; }
  .nota-actions { display: none !important; }
  
  /* Single Note Print Mode */
  body.printing-note .nota:not(.to-print) { display: none !important; }
  body.printing-note .card:not(.has-note-to-print) { display: none !important; }
  body.printing-note #print-patient-info, 
  body.printing-summary #print-patient-info,
  body.printing-ai-summary #print-patient-info { display: block !important; border: 1px solid #eee; margin-bottom: 20px; }

  body.printing-ai-summary #temp-print-div { display: block !important; }
  body.printing-ai-summary .card, body.printing-ai-summary .nota { display: none !important; }

  /* Typography for print */
  .nota-text { font-size: 12pt; line-height: 1.5; color: black; }
  h1, h2, h3 { color: black !important; }
}


/* Utilities */
.ml-8 { margin-left: 8px; }
.mt-14 { margin-top: 14px; }
.gap-6 { gap: 6px; }
.gap-8 { gap: 8px; }

.content-section {
  display: none;
}

.btn-group-row {
  margin-top: 12px;
  display: flex;
  gap: 8px;
}

.btn-gradient-indigo {
  background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
  color: white;
  border: none;
}

.btn-gradient-green {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: white;
  border: none;
}

.flex-between {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.section-title-sm {
  font-size: 15px;
  font-weight: 600;
  color: var(--navy2);
}

.btn-scribe {
  background: #10b981 !important;
  color: white !important;
  border-color: #10b981 !important;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.chart-ref-text {
  font-size: 12px;
  color: var(--text4);
  margin-top: 8px;
}

.logo-img-sm {
  width: 32px;
  height: 32px;
  object-fit: contain;
}
