/* ==========================================================
   CALCULADORA DE PÉPTIDOS Y RECONSTITUCIÓN - DISEÑO CIENTÍFICO
   ========================================================== */

:root {
  /* Color Palette - Dark Mode (Default) */
  --bg-primary: #0a0f1d;
  --bg-secondary: #111827;
  --bg-card: rgba(17, 24, 39, 0.75);
  --bg-card-hover: rgba(30, 41, 59, 0.85);
  --bg-input: #1e293b;
  --bg-pill: rgba(30, 41, 59, 0.6);
  --bg-pill-hover: rgba(51, 65, 85, 0.8);
  --border-color: rgba(255, 255, 255, 0.08);
  --border-active: #06b6d4;

  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --text-accent: #38bdf8;

  --brand-primary: #06b6d4;
  --brand-hover: #0891b2;
  --brand-gradient: linear-gradient(135deg, #06b6d4 0%, #3b82f6 100%);
  --brand-glow: 0 0 25px rgba(6, 182, 212, 0.35);

  --accent-emerald: #10b981;
  --accent-amber: #f59e0b;
  --accent-rose: #f43f5e;
  --accent-indigo: #6366f1;

  --card-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.05);
  --glass-blur: blur(16px);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-xl: 24px;
  --transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

[data-theme="light"] {
  --bg-primary: #f1f5f9;
  --bg-secondary: #ffffff;
  --bg-card: rgba(255, 255, 255, 0.88);
  --bg-card-hover: #f8fafc;
  --bg-input: #f1f5f9;
  --bg-pill: #e2e8f0;
  --bg-pill-hover: #cbd5e1;
  --border-color: rgba(0, 0, 0, 0.08);
  --border-active: #0891b2;

  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --text-accent: #0284c7;

  --card-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.07), 0 0 0 1px rgba(0, 0, 0, 0.04);
}

/* Base Styles */
html {
  box-sizing: border-box;
  overflow-x: hidden;
  width: 100%;
  max-width: 100vw;
}

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

img, svg, video, canvas, audio, iframe, embed, object {
  max-width: 100%;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.5;
  background-image: 
    radial-gradient(at 10% 10%, rgba(6, 182, 212, 0.08) 0px, transparent 50%),
    radial-gradient(at 90% 90%, rgba(59, 130, 246, 0.08) 0px, transparent 50%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  width: 100%;
  max-width: 100vw;
  position: relative;
}

.app-wrapper {
  max-width: 1240px;
  width: 100%;
  margin: 0 auto;
  padding: 24px 20px 48px;
  box-sizing: border-box;
}

/* ==========================================================
   GLOBAL BRAND HEADER (Identical to Tienda mobile & desktop)
   ========================================================== */
.global-brand-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-card);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border-color);
  width: 100%;
  transition: var(--transition);
}

[data-theme="light"] .global-brand-header {
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid #e2e8f0;
}

[data-theme="dark"] .global-brand-header,
:root:not([data-theme="light"]) .global-brand-header {
  background: rgba(10, 15, 29, 0.92);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.brand-header-inner {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 72px;
  gap: 20px;
  box-sizing: border-box;
}

.brand-link {
  display: flex;
  align-items: center;
  text-decoration: none;
  flex-shrink: 0;
  max-width: 180px;
  min-width: 0;
}

.brand-logo-img {
  height: 44px;
  max-height: 44px;
  width: auto;
  max-width: 170px;
  object-fit: contain;
  display: block;
}

/* Nav links desktop */
.global-brand-header .main-nav {
  display: flex;
  align-items: center;
  gap: 22px;
}

.global-brand-header .nav-item {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 600;
  transition: var(--transition);
  position: relative;
  padding: 6px 0;
}

[data-theme="light"] .global-brand-header .nav-item {
  color: #475569;
}

.global-brand-header .nav-item:hover,
.global-brand-header .nav-item.active {
  color: #06b6d4;
}

[data-theme="light"] .global-brand-header .nav-item:hover,
[data-theme="light"] .global-brand-header .nav-item.active {
  color: #0d9488;
}

.global-brand-header .nav-item.active::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, #0d9488, #0284c7);
  border-radius: 2px;
}

.global-brand-header .nav-item.has-badge::after {
  content: 'TIENDA';
  position: absolute;
  top: -6px;
  right: -36px;
  background: #f43f5e;
  color: #ffffff;
  font-size: 0.58rem;
  font-weight: 800;
  padding: 1px 6px;
  border-radius: 9999px;
  letter-spacing: 0.04em;
}

/* Header Actions */
.global-brand-header .header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.global-brand-header .btn-header-icon {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  padding: 0;
  box-sizing: border-box;
}

[data-theme="light"] .global-brand-header .btn-header-icon {
  background: #ffffff;
  border-color: #e2e8f0;
  color: #0f172a;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.global-brand-header .btn-header-icon:hover {
  border-color: #06b6d4;
  color: #06b6d4;
  transform: translateY(-1px);
}

/* Store Shortcut Button (Cyan/Teal Gradient Pill/Square with Shopping Bag Icon) */
.global-brand-header .btn-cart-cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, #0d9488 0%, #0284c7 100%);
  color: #ffffff !important;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  border: none;
  font-weight: 700;
  font-size: 0.88rem;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(13, 148, 136, 0.35);
  transition: var(--transition);
  text-decoration: none;
  box-sizing: border-box;
}

.global-brand-header .btn-cart-cta:hover {
  transform: translateY(-1px);
  filter: brightness(1.08);
  box-shadow: 0 6px 20px rgba(13, 148, 136, 0.45);
}

/* Mobile Hamburger Button */
.global-brand-header .btn-mobile-menu {
  display: none;
  width: 42px;
  height: 42px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-primary);
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
  padding: 0;
  box-sizing: border-box;
}

[data-theme="light"] .global-brand-header .btn-mobile-menu {
  background: #ffffff;
  border-color: #e2e8f0;
  color: #0f172a;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.global-brand-header .btn-mobile-menu:hover,
.global-brand-header .btn-mobile-menu:active {
  border-color: #06b6d4;
  color: #06b6d4;
}

/* Hide legacy navigation bar globally */
.main-app-nav {
  display: none !important;
}

.mobile-brand-link {
  display: flex;
  align-items: center;
  text-decoration: none;
  max-width: 160px;
}

.mobile-brand-logo {
  height: 38px;
  max-height: 38px;
  width: auto;
  max-width: 150px;
  object-fit: contain;
  display: block;
}

/* Header */
.app-header {
  margin-bottom: 28px;
}

.header-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 20px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  background: var(--brand-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  box-shadow: var(--brand-glow);
}

.brand h1 {
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.brand .subtitle {
  font-size: 0.88rem;
  color: var(--text-secondary);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
}

.btn-icon:hover {
  background: var(--bg-card-hover);
  color: var(--brand-primary);
  border-color: var(--brand-primary);
}

[data-theme="dark"] .sun-icon { display: block; }
[data-theme="dark"] .moon-icon { display: none; }
[data-theme="light"] .sun-icon { display: none; }
[data-theme="light"] .moon-icon { display: block; }

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-primary);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}

.btn-secondary:hover {
  border-color: var(--brand-primary);
  color: var(--brand-primary);
}

/* Mode Navigation Tabs */
.mode-tabs {
  display: inline-flex;
  padding: 4px;
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  gap: 4px;
}

.tab-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 18px;
  border-radius: var(--radius-md);
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}

.tab-btn.active {
  background: var(--brand-gradient);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(6, 182, 212, 0.3);
}

.mode-caption {
  margin-top: 10px;
  font-size: 0.82rem;
  color: var(--text-muted);
}

/* Main Container Grid */
.calculator-container {
  display: grid;
  grid-template-columns: 1fr 1.15fr;
  gap: 24px;
  align-items: start;
}

@media (max-width: 960px) {
  .calculator-container {
    grid-template-columns: 1fr;
  }
}

/* Card Containers */
.calc-inputs-card,
.calc-results-card {
  background: var(--bg-card);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 24px;
  box-shadow: var(--card-shadow);
}

/* ==========================================================
   SIMPLE COMPOUND SELECTOR (Matches Minimalist Design)
   ========================================================== */
.compound-selector-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 22px;
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  margin-bottom: 24px;
  cursor: pointer;
  transition: var(--transition);
  user-select: none;
}

[data-theme="light"] .compound-selector-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03);
}

.compound-selector-card:hover {
  border-color: rgba(6, 182, 212, 0.45);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.18);
  transform: translateY(-1px);
}

[data-theme="light"] .compound-selector-card:hover {
  border-color: #cbd5e1;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
}

.compound-selector-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.compound-flask-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #10b981;
  flex-shrink: 0;
}

.compound-flask-icon svg {
  display: block;
}

.compound-text-group {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.compound-title {
  font-size: 1.18rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
  margin: 0;
  letter-spacing: -0.01em;
}

.compound-subtitle {
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 0.84rem;
  color: var(--text-muted);
  line-height: 1.25;
}

[data-theme="light"] .compound-subtitle {
  color: #64748b;
}

.compound-action-trigger {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 500;
  transition: var(--transition);
  flex-shrink: 0;
}

[data-theme="light"] .compound-action-trigger {
  color: #475569;
}

.compound-selector-card:hover .compound-action-trigger {
  color: var(--text-primary);
}

[data-theme="light"] .compound-selector-card:hover .compound-action-trigger {
  color: #0f172a;
}

.compound-action-trigger svg {
  transition: transform 0.2s ease;
}

.compound-selector-card:hover .compound-action-trigger svg {
  transform: translateY(2px);
}

/* Form Groups */
.calc-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.label-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.form-group label {
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--text-primary);
}

.info-tag {
  font-size: 0.72rem;
  color: var(--text-muted);
  background: var(--bg-input);
  padding: 2px 8px;
  border-radius: 4px;
}

.range-hint {
  font-size: 0.75rem;
  color: var(--text-accent);
  margin-left: 6px;
}

.dose-label-group {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
}

/* Unit Switcher */
.unit-switch {
  display: inline-flex;
  background: var(--bg-input);
  border-radius: 20px;
  padding: 2px;
  border: 1px solid var(--border-color);
}

.toggle-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 26px;
  line-height: 1;
  padding: 0 12px;
  border-radius: 14px;
  font-size: 0.74rem;
  font-weight: 700;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
  box-sizing: border-box;
}

.toggle-pill.active {
  background: var(--brand-primary);
  color: #ffffff;
}

/* Pills Selection */
.pill-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pill-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 36px;
  min-height: 36px;
  line-height: 1;
  padding: 0 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-pill);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  box-sizing: border-box;
  white-space: nowrap;
}

.pill-btn:hover {
  background: var(--bg-pill-hover);
  color: var(--text-primary);
  border-color: rgba(255, 255, 255, 0.15);
}

.pill-btn.active {
  background: var(--brand-primary);
  color: #ffffff;
  border-color: var(--brand-primary);
  box-shadow: 0 3px 10px rgba(6, 182, 212, 0.3);
}

.pill-group-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
  gap: 8px;
}

.form-row-dual {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

@media (max-width: 500px) {
  .form-row-dual {
    grid-template-columns: 1fr;
  }
}

/* Custom Input Wrapper */
.custom-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.form-input {
  width: 100%;
  padding: 10px 42px 10px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-input);
  color: var(--text-primary);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.95rem;
  font-weight: 600;
  transition: var(--transition);
}

.form-input:focus {
  outline: none;
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.2);
}

.input-unit {
  position: absolute;
  right: 14px;
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 600;
  pointer-events: none;
}

/* Educational Info Banner */
.info-banner {
  display: flex;
  gap: 12px;
  padding: 14px 16px;
  background: rgba(59, 130, 246, 0.08);
  border: 1px solid rgba(59, 130, 246, 0.25);
  border-radius: var(--radius-lg);
  margin-top: 24px;
  color: var(--text-secondary);
  font-size: 0.8rem;
  line-height: 1.45;
}

.info-banner svg {
  color: #38bdf8;
  flex-shrink: 0;
  margin-top: 2px;
}

.info-banner strong {
  display: block;
  color: var(--text-primary);
  margin-bottom: 2px;
}

/* ==========================================================
   RESULTS COLUMN & INTERACTIVE SYRINGE
   ========================================================== */

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

.live-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-emerald);
  box-shadow: 0 0 10px var(--accent-emerald);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 8px rgba(16, 185, 129, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.status-text {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--accent-emerald);
}

.display-unit-toggle {
  display: inline-flex;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  padding: 3px;
}

.unit-btn {
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.unit-btn.active {
  background: var(--bg-input);
  color: var(--brand-primary);
}

/* Big Hero Number Card */
.hero-output-box {
  text-align: center;
  padding: 28px 20px;
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  margin-bottom: 24px;
  position: relative;
  overflow: hidden;
}

.hero-output-box::before {
  content: '';
  position: absolute;
  top: -50%;
  left: 50%;
  transform: translateX(-50%);
  width: 200px;
  height: 200px;
  background: radial-gradient(circle, rgba(6, 182, 212, 0.2) 0%, transparent 70%);
  pointer-events: none;
}

.hero-label {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--text-muted);
}

.hero-number-wrap {
  display: flex;
  justify-content: center;
  align-items: baseline;
  gap: 10px;
  margin: 6px 0;
}

.hero-number {
  font-family: 'JetBrains Mono', monospace;
  font-size: 3.6rem;
  font-weight: 800;
  color: var(--brand-primary);
  line-height: 1;
  letter-spacing: -0.04em;
  text-shadow: 0 0 30px rgba(6, 182, 212, 0.4);
}

.hero-unit {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-primary);
}

.hero-secondary-hint {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

/* Syringe Visualizer */
.syringe-visualizer {
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  padding: 20px;
  margin-bottom: 24px;
}

.svg-syringe-wrapper {
  width: 100%;
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 8px 4px;
}

.syringe-svg {
  width: 100%;
  max-width: 100%;
  height: auto;
  display: block;
}

/* Graduaciones y números de la jeringa superpuestos a todo */
.syringe-marks {
  pointer-events: none;
}

.syringe-tick-lines line,
.syringe-marks line {
  stroke: #ffffff;
  opacity: 0.85;
}

.syringe-tick-lines line.minor-tick,
.syringe-marks line.minor-tick {
  stroke: #ffffff;
  opacity: 0.55;
}

/* Números de graduación: Totalmente blanco FFFFFF en versión oscura, superpuestos a todo con contorno */
.syringe-tick-texts text,
.syringe-marks text,
.syringe-unit-num {
  font-family: 'JetBrains Mono', -apple-system, BlinkMacSystemFont, monospace;
  font-size: 11.5px;
  font-weight: 800;
  fill: #ffffff !important;
  color: #ffffff;
  paint-order: stroke fill;
  stroke: #0a0f1d;
  stroke-width: 2.5px;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.95));
  user-select: none;
  pointer-events: none;
}

/* En versión clara (data-theme="light") */
[data-theme="light"] .syringe-tick-lines line,
[data-theme="light"] .syringe-marks line {
  stroke: #1e293b;
  opacity: 0.85;
}

[data-theme="light"] .syringe-tick-lines line.minor-tick,
[data-theme="light"] .syringe-marks line.minor-tick {
  stroke: #475569;
  opacity: 0.5;
}

[data-theme="light"] .syringe-tick-texts text,
[data-theme="light"] .syringe-marks text,
[data-theme="light"] .syringe-unit-num {
  fill: #0f172a !important;
  color: #0f172a;
  stroke: #ffffff;
  stroke-width: 2.5px;
  filter: drop-shadow(0 1px 1px rgba(255, 255, 255, 0.85));
}

.syringe-overflow-alert {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: rgba(244, 63, 94, 0.15);
  border: 1px solid rgba(244, 63, 94, 0.4);
  border-radius: var(--radius-md);
  color: #fda4af;
  font-size: 0.8rem;
  margin-bottom: 12px;
}

.syringe-legend {
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px dashed var(--border-color);
}

.syringe-legend-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  width: 100%;
}

.syringe-legend-top span {
  white-space: nowrap;
}

.badge-graduation {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(6, 182, 212, 0.12);
  border: 1px solid rgba(6, 182, 212, 0.35);
  color: #38bdf8;
  padding: 3px 10px;
  border-radius: var(--radius-sm);
  font-family: 'JetBrains Mono', -apple-system, BlinkMacSystemFont, monospace;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.2px;
}

.syringe-guidance-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(30, 41, 59, 0.65);
  border-left: 3px solid #06b6d4;
  padding: 9px 13px;
  border-radius: 4px;
  font-size: 0.82rem;
  line-height: 1.45;
  color: var(--text-primary);
  width: 100%;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

[data-theme="light"] .badge-graduation {
  background: rgba(6, 182, 212, 0.1);
  border-color: rgba(6, 182, 212, 0.4);
  color: #0284c7;
}

[data-theme="light"] .syringe-guidance-banner {
  background: #f1f5f9;
  border-left-color: #0284c7;
  color: #1e293b;
}

/* Metric Grid */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  margin-bottom: 24px;
}

.metric-card {
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  padding: 16px;
  transition: var(--transition);
}

.metric-card:hover {
  border-color: rgba(6, 182, 212, 0.3);
  transform: translateY(-2px);
}

.metric-label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.metric-val-row {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin: 4px 0 2px;
}

.metric-value {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
}

.metric-unit {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-weight: 600;
}

.metric-desc {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Vial Summary Card */
.vial-summary-card {
  display: flex;
  gap: 16px;
  padding: 18px;
  background: rgba(6, 182, 212, 0.06);
  border: 1px solid rgba(6, 182, 212, 0.25);
  border-radius: var(--radius-lg);
  margin-bottom: 20px;
}

.vial-badge-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: rgba(6, 182, 212, 0.2);
  color: var(--brand-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.vial-summary-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 4px;
}

.vial-summary-header h3 {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
}

.badge-accent {
  font-size: 0.72rem;
  font-weight: 600;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  padding: 2px 8px;
  border-radius: 999px;
  color: var(--brand-primary);
}

.vial-summary-body p {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.45;
}

/* Science Accordion */
.science-card {
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  background: var(--bg-secondary);
  overflow: hidden;
}

.science-toggle {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
}

.science-title-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-primary);
}

.science-title-wrap svg {
  color: var(--brand-primary);
}

#scienceArrow {
  transition: transform 0.2s ease;
}

.science-card.open #scienceArrow {
  transform: rotate(180deg);
}

.science-body {
  padding: 0 18px 18px;
  border-top: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.science-item {
  margin-top: 12px;
}

.science-sub {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  display: block;
  margin-bottom: 2px;
}

.science-item p {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.45;
}

.science-link-wrap {
  margin-top: 6px;
}

.link-pubmed {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  color: var(--brand-primary);
  text-decoration: none;
  font-weight: 600;
}

.link-pubmed:hover {
  text-decoration: underline;
}

/* ==========================================================
   MODAL DIALOG - SELECCIÓN DE COMPUESTOS
   ========================================================== */

.modal-backdrop,
.modal-overlay {
  position: fixed;
  inset: 0;
  width: 100vw;
  max-width: 100vw;
  height: 100%;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 9999;
  box-sizing: border-box;
  overflow-y: auto;
  overflow-x: hidden;
}

.modal-content {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 820px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7);
  overflow: hidden;
  box-sizing: border-box;
  margin: auto;
  animation: modalFadeIn 0.2s ease-out;
}

@keyframes modalFadeIn {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border-color);
  width: 100%;
  box-sizing: border-box;
  min-width: 0;
}

.modal-header h3 {
  font-size: 1.25rem;
  font-weight: 700;
}

.modal-sub {
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.modal-title-text-group {
  min-width: 0;
  overflow: hidden;
  flex: 1 1 auto;
}

.modal-close {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--bg-input);
  border: none;
  color: var(--text-secondary);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.modal-close:hover {
  background: var(--accent-rose);
  color: #ffffff;
}

.modal-search-wrap {
  position: relative;
  padding: 16px 24px;
  display: flex;
  align-items: center;
}

.modal-search-wrap svg {
  position: absolute;
  left: 38px;
  color: var(--text-muted);
}

.search-input {
  width: 100%;
  padding: 12px 16px 12px 44px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-input);
  color: var(--text-primary);
  font-size: 0.9rem;
}

.search-input:focus {
  outline: none;
  border-color: var(--brand-primary);
}

.category-filter-chips {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 24px 18px;
  min-height: 62px;
  overflow-x: auto;
  scrollbar-width: none;
}

.category-filter-chips::-webkit-scrollbar {
  display: none;
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 36px;
  min-height: 36px;
  line-height: 1;
  padding: 0 16px;
  border-radius: 999px;
  border: 1px solid var(--border-color);
  background: var(--bg-input);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: var(--transition);
  box-sizing: border-box;
  flex-shrink: 0;
  vertical-align: middle;
  -webkit-appearance: none;
  appearance: none;
}

.filter-chip:hover {
  color: var(--text-primary);
  border-color: rgba(255, 255, 255, 0.2);
}

.filter-chip.active {
  background: var(--brand-primary);
  color: #ffffff;
  border-color: var(--brand-primary);
  box-shadow: 0 3px 10px rgba(6, 182, 212, 0.3);
}

.compound-list-grid {
  padding: 12px 24px 24px;
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
}

.compound-card-btn {
  padding: 14px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  background: var(--bg-input);
  color: var(--text-primary);
  text-align: left;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.compound-card-btn:hover {
  border-color: var(--brand-primary);
  background: rgba(6, 182, 212, 0.1);
  transform: translateY(-2px);
}

.compound-card-btn.selected {
  border-color: var(--brand-primary);
  background: rgba(6, 182, 212, 0.15);
  box-shadow: 0 0 15px rgba(6, 182, 212, 0.2);
}

.card-top-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.card-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
}

.card-category {
  font-size: 0.72rem;
  color: var(--brand-primary);
}

.card-sub {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.35;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 20px;
  background: #0f172a;
  color: #ffffff;
  border: 1px solid rgba(16, 185, 129, 0.4);
  border-radius: var(--radius-lg);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
  font-size: 0.86rem;
  font-weight: 500;
  z-index: 2000;
  animation: toastPop 0.25s ease-out;
}

.toast svg {
  color: var(--accent-emerald);
}

@keyframes toastPop {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Footer */
.app-footer {
  margin-top: 40px;
  text-align: center;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.app-footer a {
  color: var(--brand-primary);
  text-decoration: none;
}

.app-footer a:hover {
  text-decoration: underline;
}

/* ==========================================================
   MOBILE SPACE OPTIMIZATION (Aprovechamiento de espacio en móvil)
   ========================================================== */
@media (max-width: 768px) {
  .app-wrapper {
    padding: 12px 14px 32px;
    width: 100%;
    max-width: 100vw;
    box-sizing: border-box;
    overflow-x: hidden;
  }

  /* Global App Navigation (Replaced by mobile hamburger menu on mobile) */
  .main-app-nav {
    display: none !important;
  }

  .btn-mobile-menu {
    display: flex !important;
  }

  .app-nav-link {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 6px;
    font-size: 0.74rem;
    font-weight: 600;
    min-width: 0;
    text-align: center;
    box-sizing: border-box;
  }

  .app-nav-link span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .brand-header-inner {
    height: 64px;
    padding: 0 16px;
  }

  .brand-logo-img {
    height: 36px;
    max-height: 36px;
    width: auto;
    max-width: 140px;
    object-fit: contain;
    display: block;
  }

  .global-brand-header .main-nav {
    display: none !important;
  }

  .global-brand-header .btn-mobile-menu {
    display: flex !important;
  }

  .global-brand-header .btn-cart-cta .cart-label {
    display: none;
  }

  .global-brand-header .btn-cart-cta {
    width: 42px;
    height: 42px;
    padding: 0;
    justify-content: center;
    border-radius: var(--radius-md);
    flex-shrink: 0;
  }

  .global-brand-header .btn-header-icon {
    width: 42px;
    height: 42px;
    flex-shrink: 0;
  }

  .global-brand-header .header-actions {
    display: flex !important;
    gap: 8px;
    align-items: center;
    flex-wrap: nowrap;
    width: auto;
  }

  .app-header {
    margin-bottom: 14px;
    width: 100%;
  }

  .header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    gap: 10px;
    width: 100%;
  }

  .brand {
    width: 100%;
  }

  .brand h1 {
    font-size: 1.35rem;
  }

  .brand p {
    font-size: 0.76rem;
  }

  .header-actions {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
  }

  .btn-icon {
    width: 38px;
    height: 38px;
    flex-shrink: 0;
  }

  .btn-primary-action,
  .btn-secondary,
  .btn-guide-action {
    flex: 1 1 calc(50% - 6px);
    justify-content: center;
    padding: 7px 8px;
    height: 38px;
    min-width: 0;
    box-sizing: border-box;
  }

  .btn-primary-action span,
  .btn-secondary span,
  .btn-guide-action span {
    font-size: 0.76rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* Navigation Tabs (Ya preparado vs Ayuda) */
  .mode-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    gap: 4px;
    padding: 3px;
  }

  .tab-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 6px;
    font-size: 0.74rem;
    font-weight: 600;
    min-width: 0;
    text-align: center;
    box-sizing: border-box;
  }

  .tab-btn span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .calculator-container {
    gap: 14px;
    width: 100%;
  }

  .calc-inputs-card,
  .calc-results-card {
    padding: 14px 12px;
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow-x: hidden;
  }

  /* Selector de compuesto en móvil */
  .compound-selector-card {
    padding: 12px 14px;
    margin-bottom: 14px;
    width: 100%;
    box-sizing: border-box;
  }

  .compound-selector-left {
    gap: 10px;
    min-width: 0;
  }

  .compound-text-group {
    min-width: 0;
  }

  .compound-title {
    font-size: 1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .compound-subtitle {
    font-size: 0.76rem;
  }

  .compound-action-trigger {
    font-size: 0.8rem;
    white-space: nowrap;
  }

  /* Formulario y pastillas */
  .calc-form {
    gap: 12px;
  }

  .pill-group {
    gap: 6px;
    margin-bottom: 6px;
    width: 100%;
  }

  .pill-btn {
    height: 32px;
    min-height: 32px;
    padding: 0 10px;
    font-size: 0.75rem;
  }

  .custom-input-wrap .form-input {
    height: 38px;
    font-size: 0.95rem;
  }

  .info-banner {
    padding: 10px 12px;
    margin-top: 12px;
    font-size: 0.74rem;
    gap: 8px;
  }

  /* Bloque de resultado Hero */
  .result-header {
    margin-bottom: 10px;
  }

  .hero-output-box {
    padding: 14px 10px;
    margin-bottom: 12px;
    width: 100%;
    box-sizing: border-box;
  }

  .hero-number {
    font-size: 2.5rem;
  }

  .hero-unit {
    font-size: 1.15rem;
  }

  .hero-secondary-hint {
    font-size: 0.78rem;
  }

  /* JERINGA VECTORIAL: MÁXIMO APROVECHAMIENTO DE ESPACIO */
  .syringe-visualizer {
    padding: 10px 8px;
    margin-bottom: 12px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow: hidden;
  }

  .svg-syringe-wrapper {
    padding: 0;
    width: 100%;
    overflow: hidden;
  }

  .syringe-svg {
    min-height: 0;
    height: auto;
    width: 100%;
    max-width: 100%;
    display: block;
  }

  .syringe-legend {
    margin-top: 8px;
    padding-top: 8px;
    font-size: 0.72rem;
    gap: 6px;
    flex-direction: column;
    align-items: flex-start;
    width: 100%;
    box-sizing: border-box;
  }

  .syringe-legend span {
    white-space: normal;
    word-break: break-word;
  }

  /* Métricas 2x2 compactas */
  .metrics-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 8px;
    margin-bottom: 12px;
    width: 100%;
    box-sizing: border-box;
  }

  .metric-card {
    padding: 10px 12px;
    border-radius: var(--radius-md);
  }

  .metric-label {
    font-size: 0.62rem;
  }

  .metric-val-row {
    margin: 2px 0;
  }

  .metric-value {
    font-size: 1.25rem;
  }

  .metric-unit {
    font-size: 0.75rem;
  }

  .metric-desc {
    font-size: 0.68rem;
  }

  /* Tarjeta de vial y ciencia */
  .vial-summary-card {
    padding: 12px;
    gap: 10px;
    margin-bottom: 12px;
    width: 100%;
    box-sizing: border-box;
  }

  .vial-summary-content h4 {
    font-size: 0.82rem;
  }

  .vial-summary-content p {
    font-size: 0.74rem;
  }

  .science-card {
    margin-bottom: 12px;
    width: 100%;
    box-sizing: border-box;
  }

  .science-card-header {
    padding: 10px 12px;
    font-size: 0.82rem;
  }

  .science-card-content {
    padding: 10px 12px;
    font-size: 0.76rem;
  }

  .protocol-actions {
    margin-bottom: 12px;
    width: 100%;
  }

  .btn-protocol-copy {
    height: 40px;
    font-size: 0.82rem;
    width: 100%;
  }

  /* Modal optimizado para pantallas táctiles */
  .modal-backdrop,
  .modal-overlay {
    padding: 8px;
    width: 100vw;
    max-width: 100vw;
    box-sizing: border-box;
    overflow-x: hidden;
  }

  .modal-content {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 auto;
    max-height: 92vh;
    border-radius: var(--radius-lg);
    box-sizing: border-box;
    overflow-x: hidden;
  }

  .modal-header {
    padding: 12px 14px;
    gap: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    box-sizing: border-box;
    min-width: 0;
  }

  .modal-title-with-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    flex: 1 1 0%;
    overflow: hidden;
  }

  .modal-title-with-badge > div {
    min-width: 0;
    overflow: hidden;
  }

  .modal-title-with-badge h3 {
    font-size: 0.95rem;
    line-height: 1.25;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .modal-sub {
    font-size: 0.72rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
  }

  .modal-header-right {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
    margin-left: auto;
  }

  .history-icon-badge {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    flex-shrink: 0;
  }

  .history-count-badge {
    font-size: 0.68rem;
    padding: 3px 6px;
    white-space: nowrap;
  }

  .modal-close {
    width: 32px;
    height: 32px;
    font-size: 1.3rem;
    flex-shrink: 0;
  }

  .history-modal-body {
    padding: 12px 10px;
    gap: 10px;
    max-height: calc(92vh - 65px);
    box-sizing: border-box;
  }

  .modal-search-wrap {
    padding: 8px 12px;
    width: 100%;
    box-sizing: border-box;
  }

  .modal-search-wrap svg {
    left: 24px;
  }

  .search-input {
    padding: 10px 12px 10px 36px;
    font-size: 0.85rem;
    width: 100%;
  }

  .category-filter-chips {
    padding: 4px 12px 10px;
    min-height: 48px;
    gap: 6px;
  }

  .filter-chip {
    height: 30px;
    min-height: 30px;
    font-size: 0.74rem;
    padding: 0 12px;
  }

  .compound-list-grid {
    padding: 6px 12px 14px;
    grid-template-columns: 1fr;
    gap: 8px;
    box-sizing: border-box;
  }

  .compound-card-btn {
    padding: 10px 12px;
  }

  .card-title {
    font-size: 0.9rem;
  }

  .card-sub {
    font-size: 0.74rem;
  }

  /* Modal Guía Completa en Móvil */
  .guide-modal-content {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 auto;
    border-radius: var(--radius-lg);
    box-sizing: border-box;
  }

  .guide-modal-header {
    padding: 12px 14px;
    flex-wrap: wrap;
    gap: 8px;
    width: 100%;
    box-sizing: border-box;
  }

  .guide-modal-title-group {
    min-width: 0;
    flex: 1 1 100%;
  }

  .guide-modal-title-group h3 {
    font-size: 0.95rem;
    line-height: 1.3;
  }

  .guide-modal-actions {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
  }

  .btn-guide-print {
    flex: 1;
    justify-content: center;
    padding: 8px 12px;
    font-size: 0.8rem;
  }

  .guide-modal-body {
    padding: 12px 8px;
    gap: 16px;
    box-sizing: border-box;
  }

  .guide-sheet {
    padding: 18px 12px;
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
  }

  .guide-prep-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .guide-inj-row {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .guide-inj-illu {
    height: 180px;
    width: 100%;
  }

  .guide-overview-grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .guide-overview-box {
    padding: 10px;
  }

  .guide-index-table {
    font-size: 0.74rem;
  }
}

@media (max-width: 440px) {
  .app-wrapper {
    padding: 10px 10px 24px;
    width: 100%;
    max-width: 100vw;
    box-sizing: border-box;
    overflow-x: hidden;
  }

  .calc-inputs-card,
  .calc-results-card {
    padding: 12px 10px;
  }

  .syringe-visualizer {
    padding: 8px 6px;
  }

  .hero-number {
    font-size: 2.2rem;
  }

  .metric-card {
    padding: 8px 8px;
  }

  .metric-value {
    font-size: 1.15rem;
  }

  .metric-label {
    font-size: 0.6rem;
  }

  .syringe-legend {
    font-size: 0.7rem;
  }
}

/* ==========================================================
   GLOBAL APP NAVIGATION (Reconstitución vs Semivida)
   ========================================================== */
.main-app-nav {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  padding: 4px;
  border-radius: var(--radius-lg);
  margin-bottom: 24px;
}

[data-theme="light"] .main-app-nav {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
}

.app-nav-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 0.86rem;
  font-weight: 600;
  text-decoration: none;
  transition: var(--transition);
}

.app-nav-link:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.04);
}

[data-theme="light"] .app-nav-link:hover {
  background: #f1f5f9;
}

.app-nav-link.active {
  background: var(--bg-input);
  color: var(--brand-primary);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

[data-theme="light"] .app-nav-link.active {
  background: #0891b2;
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(8, 145, 178, 0.25);
}

.app-nav-link svg {
  flex-shrink: 0;
}

/* ==========================================================
   MOBILE NAVIGATION DRAWER & BACKDROP (Calculators)
   ========================================================== */
.btn-mobile-menu {
  display: none;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-primary);
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
  padding: 0;
  flex-shrink: 0;
}

.btn-mobile-menu:hover {
  background: var(--bg-card-hover);
  color: var(--brand-primary);
  border-color: var(--brand-primary);
}

.mobile-nav-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 15, 29, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 990;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1),
              visibility 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.mobile-nav-overlay.open {
  opacity: 1;
  visibility: visible;
}

.mobile-nav-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(320px, 86vw);
  background: var(--bg-secondary);
  border-left: 1px solid var(--border-color);
  z-index: 995;
  box-shadow: -10px 0 40px rgba(0, 0, 0, 0.4);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.32s cubic-bezier(0.16, 1, 0.3, 1);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

[data-theme="light"] .mobile-nav-drawer {
  background: #ffffff;
  border-left: 1px solid #e2e8f0;
  box-shadow: -10px 0 40px rgba(0, 0, 0, 0.15);
}

.mobile-nav-drawer.open {
  transform: translateX(0);
}

body.mobile-nav-active {
  overflow: hidden !important;
  touch-action: none;
}

.mobile-nav-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-secondary);
  position: sticky;
  top: 0;
  z-index: 2;
}

[data-theme="light"] .mobile-nav-header {
  background: #ffffff;
  border-bottom: 1px solid #e2e8f0;
}

.mobile-brand-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 1.05rem;
  color: var(--text-primary);
}

.mobile-brand-icon {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  background: var(--brand-gradient);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-close-mobile-nav {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  cursor: pointer;
  transition: var(--transition);
}

.btn-close-mobile-nav:hover {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border-color: rgba(239, 68, 68, 0.3);
}

.mobile-nav-section-title {
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  padding: 18px 20px 8px;
}

.mobile-nav-links {
  display: flex;
  flex-direction: column;
  padding: 6px 14px;
  gap: 4px;
  flex: 1;
}

.mobile-nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 600;
  transition: var(--transition);
}

.mobile-nav-link svg {
  flex-shrink: 0;
  color: var(--text-muted);
  transition: var(--transition);
}

.mobile-nav-link:hover,
.mobile-nav-link:active {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

.mobile-nav-link:hover svg,
.mobile-nav-link:active svg {
  color: var(--brand-primary);
}

.mobile-nav-link.active {
  background: rgba(6, 182, 212, 0.12);
  color: var(--brand-primary);
  border: 1px solid rgba(6, 182, 212, 0.25);
  font-weight: 700;
}

.mobile-nav-link.active svg {
  color: var(--brand-primary);
}

[data-theme="light"] .mobile-nav-link.active {
  background: #ecfeff;
  color: #0891b2;
  border-color: #a5f3fc;
}

.mobile-badge-active {
  margin-left: auto;
  background: var(--brand-primary);
  color: #ffffff;
  font-size: 0.62rem;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 9999px;
}

.mobile-badge-pill {
  margin-left: auto;
  background: var(--accent-rose);
  color: #ffffff;
  font-size: 0.62rem;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 9999px;
}

.mobile-nav-admin-link {
  background: rgba(16, 185, 129, 0.06);
  border: 1px dashed rgba(16, 185, 129, 0.35);
  margin-top: 6px;
}

.mobile-badge-admin {
  margin-left: auto;
  background: #0f172a;
  color: #38bdf8;
  font-size: 0.62rem;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 4px;
  font-family: 'JetBrains Mono', monospace;
}

.mobile-nav-footer {
  padding: 16px 18px 24px;
  border-top: 1px solid var(--border-color);
  background: var(--bg-card);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

[data-theme="light"] .mobile-nav-footer {
  border-top: 1px solid #e2e8f0;
  background: #f8fafc;
}

.mobile-drawer-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 11px 16px;
  border-radius: var(--radius-md);
  font-size: 0.86rem;
  font-weight: 700;
  cursor: pointer;
  border: none;
  background: var(--brand-gradient);
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(6, 182, 212, 0.25);
  transition: var(--transition);
}

.mobile-drawer-btn.secondary {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  box-shadow: none;
}

[data-theme="light"] .mobile-drawer-btn.secondary {
  background: #ffffff;
  border: 1px solid #cbd5e1;
}

@media (min-width: 769px) {
  .btn-mobile-menu,
  .mobile-nav-drawer,
  .mobile-nav-overlay {
    display: none !important;
  }
}


/* ==========================================================
   CALCULADORA DE SEMIVIDA Y FARMACOCINÉTICA (semivida.html)
   ========================================================== */
.pk-calculator-main {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.pk-header-block {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.pk-research-tag {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--brand-primary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.pk-main-title {
  font-size: 2.1rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text-primary);
  line-height: 1.2;
}

.pk-main-subtitle {
  font-size: 0.95rem;
  color: var(--text-secondary);
  max-width: 820px;
  line-height: 1.5;
}

/* Selector de péptido para semivida */
.pk-selector-wrap {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pk-compound-card {
  margin-bottom: 0 !important;
}

.pk-citation-note {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.45;
  padding: 0 4px;
}

/* 4 Métricas Farmacocinéticas */
.pk-metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.pk-metric-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 120px;
  transition: var(--transition);
}

[data-theme="light"] .pk-metric-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.03);
}

.pk-metric-card:hover {
  border-color: rgba(6, 182, 212, 0.35);
  transform: translateY(-2px);
}

.pk-metric-label {
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  text-transform: uppercase;
}

.pk-metric-val {
  font-family: 'JetBrains Mono', monospace;
  font-size: 2.1rem;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.03em;
  margin: 6px 0 4px;
  line-height: 1.1;
}

.pk-metric-sub {
  font-size: 0.76rem;
  color: var(--text-secondary);
  line-height: 1.35;
}

/* Gráfico Farmacocinético Card */
.pk-chart-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  position: relative;
  overflow: hidden;
}

[data-theme="light"] .pk-chart-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
}

.pk-chart-container {
  position: relative;
  width: 100%;
  height: 380px;
  cursor: crosshair;
}

.pk-chart-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.pk-chart-tooltip {
  position: absolute;
  pointer-events: none;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: #0f172a;
  color: #ffffff;
  border: 1px solid rgba(56, 189, 248, 0.5);
  border-radius: var(--radius-md);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8rem;
  font-weight: 700;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.45);
  z-index: 50;
  white-space: nowrap;
  transform: translateY(-50%);
}

[data-theme="light"] .pk-chart-tooltip {
  background: #0f172a;
  color: #ffffff;
  border: 1px solid #38bdf8;
}

.tooltip-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #0284c7;
  color: #ffffff;
  font-size: 11px;
  font-weight: 800;
}

.tooltip-time {
  font-size: 0.72rem;
  color: #94a3b8;
  font-weight: 400;
}

/* Barra de controles: Dosis, Intervalo, Número de Dosis */
.pk-controls-bar {
  display: grid;
  grid-template-columns: 1fr 2fr 1fr;
  gap: 16px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  align-items: center;
}

[data-theme="light"] .pk-controls-bar {
  background: #ffffff;
  border: 1px solid #e2e8f0;
}

.pk-control-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.pk-control-group label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.pk-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.pk-input {
  width: 100%;
  height: 42px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0 14px;
  font-size: 0.95rem;
  color: var(--text-primary);
  font-weight: 600;
}

[data-theme="light"] .pk-input {
  background: #f8fafc;
  border: 1px solid #cbd5e1;
}

.pk-select-wrap {
  position: relative;
  width: 100%;
}

.pk-select {
  width: 100%;
  height: 42px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0 36px 0 14px;
  font-size: 0.92rem;
  color: var(--text-primary);
  font-weight: 600;
  appearance: none;
  cursor: pointer;
}

[data-theme="light"] .pk-select {
  background: #f8fafc;
  border: 1px solid #cbd5e1;
}

.pk-select:focus,
.pk-input:focus {
  outline: none;
  border-color: #0284c7;
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.2);
}

.select-chevron {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  color: var(--text-secondary);
}

.pk-source-note {
  font-size: 0.76rem;
  color: var(--text-muted);
  line-height: 1.5;
  padding: 4px 6px;
}

/* Secciones Científicas Educativas */
.pk-science-section {
  display: flex;
  flex-direction: column;
  gap: 24px;
  margin-top: 14px;
  padding-top: 24px;
  border-top: 1px solid var(--border-color);
}

.pk-science-block h2 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
  letter-spacing: -0.01em;
}

.pk-science-block p {
  font-size: 0.92rem;
  color: var(--text-secondary);
  line-height: 1.65;
}

/* Directorio de Péptidos Inferior */
.pk-directory-section {
  margin-top: 28px;
  padding-top: 28px;
  border-top: 1px solid var(--border-color);
}

.pk-dir-header {
  margin-bottom: 20px;
}

.pk-dir-header h2 {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.pk-dir-header p {
  font-size: 0.88rem;
  color: var(--text-secondary);
}

.pk-directory-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}

.pk-peptide-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

[data-theme="light"] .pk-peptide-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
}

.pk-peptide-card:hover {
  border-color: var(--brand-primary);
  background: rgba(6, 182, 212, 0.08);
  transform: translateY(-2px);
}

.pk-peptide-card.active {
  border-color: var(--brand-primary);
  background: rgba(6, 182, 212, 0.12);
  box-shadow: 0 0 12px rgba(6, 182, 212, 0.2);
}

.pk-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.pk-card-name {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
}

.pk-card-btn {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--brand-primary);
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(6, 182, 212, 0.12);
}

.pk-card-desc {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.35;
}

.pk-badge-hl {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(6, 182, 212, 0.15);
  color: var(--brand-primary);
}

/* Responsive para Calculadora de Semivida */
@media (max-width: 900px) {
  .pk-metrics-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .pk-main-title {
    font-size: 1.5rem;
  }

  .pk-metrics-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 10px;
  }

  .pk-metric-card {
    padding: 14px;
    min-height: 95px;
  }

  .pk-metric-val {
    font-size: 1.6rem;
  }

  .pk-chart-container {
    height: 280px;
  }

  .pk-controls-bar {
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 14px;
  }

  /* Legacy nav replaced by global-brand-header */
}

@media (max-width: 440px) {
  .pk-metric-card {
    padding: 10px 12px;
  }

  .pk-metric-val {
    font-size: 1.35rem;
  }

  .pk-chart-container {
    height: 240px;
  }

  .pk-directory-grid {
    grid-template-columns: 1fr;
  }
}

/* ==========================================================
   HISTORIAL DE CÁLCULOS EN LOCALSTORAGE (RECONSTITUCIÓN)
   ========================================================== */
.btn-primary-action {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  border-radius: var(--radius-md);
  border: none;
  background: var(--brand-gradient);
  color: #ffffff;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(6, 182, 212, 0.3);
  transition: var(--transition);
}

.btn-primary-action:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(6, 182, 212, 0.45);
}

.history-badge-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--brand-primary);
  color: #ffffff;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1;
  margin-left: 2px;
}

.hero-save-row {
  margin-top: 14px;
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

.btn-hero-save {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 18px;
  border-radius: 999px;
  border: 1px solid rgba(6, 182, 212, 0.4);
  background: rgba(6, 182, 212, 0.1);
  color: var(--brand-primary);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.btn-hero-save:hover {
  background: var(--brand-primary);
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(6, 182, 212, 0.35);
  transform: translateY(-1px);
}

.btn-hero-history {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 18px;
  border-radius: 999px;
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.btn-hero-history:hover {
  border-color: var(--brand-primary);
  color: var(--brand-primary);
  background: var(--bg-card-hover);
  transform: translateY(-1px);
}

/* Modal de Historial Superpuesto */
.modal-history-content {
  max-width: 780px;
  width: 100%;
  max-height: 85vh;
  box-sizing: border-box;
}

.modal-title-with-badge {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1 1 auto;
}

.modal-title-with-badge > div {
  min-width: 0;
}

.modal-header-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  margin-left: auto;
}

.history-modal-body {
  padding: 20px 24px 24px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: calc(85vh - 85px);
}

.history-modal-body::-webkit-scrollbar {
  width: 6px;
}

.history-modal-body::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 4px;
}

.history-icon-badge {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  background: rgba(6, 182, 212, 0.15);
  color: var(--brand-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.history-count-badge {
  font-size: 0.74rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--bg-input);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
}

.btn-clear-history {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(244, 63, 94, 0.3);
  background: rgba(244, 63, 94, 0.08);
  color: var(--accent-rose);
  font-size: 0.74rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.btn-clear-history:hover {
  background: var(--accent-rose);
  color: #ffffff;
}

.history-item-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  transition: var(--transition);
  position: relative;
}

.history-item-card:hover {
  border-color: rgba(6, 182, 212, 0.35);
  background: var(--bg-card-hover);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.history-item-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 10px;
}

.history-item-name {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
  display: block;
}

.history-item-date {
  font-size: 0.72rem;
  color: var(--text-muted);
  display: block;
  margin-top: 2px;
}

.history-item-hero-val {
  text-align: right;
  display: flex;
  align-items: baseline;
  gap: 4px;
}

.history-hero-num {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--brand-primary);
}

.history-hero-unit {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--brand-primary);
}

.history-hero-ml {
  font-size: 0.74rem;
  color: var(--text-muted);
  margin-left: 2px;
}

.history-item-params {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}

.history-pill {
  font-size: 0.74rem;
  padding: 3px 8px;
  border-radius: 6px;
  background: var(--bg-input);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
}

.history-pill strong {
  color: var(--text-primary);
}

.history-cost-tag {
  font-size: 0.74rem;
  padding: 3px 8px;
  border-radius: 6px;
  background: rgba(16, 185, 129, 0.12);
  color: var(--accent-emerald);
  border: 1px solid rgba(16, 185, 129, 0.25);
  font-weight: 600;
}

.history-item-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-top: 10px;
  border-top: 1px solid var(--border-color);
}

.btn-history-load {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--brand-primary);
  background: rgba(6, 182, 212, 0.1);
  color: var(--brand-primary);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.btn-history-load:hover {
  background: var(--brand-primary);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(6, 182, 212, 0.3);
}

.btn-history-copy {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-input);
  color: var(--text-secondary);
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}

.btn-history-copy:hover {
  border-color: var(--text-primary);
  color: var(--text-primary);
}

.btn-history-delete {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  margin-left: auto;
  transition: var(--transition);
}

.btn-history-delete:hover {
  color: var(--accent-rose);
  background: rgba(244, 63, 94, 0.1);
  border-color: rgba(244, 63, 94, 0.2);
}

.history-empty-state {
  text-align: center;
  padding: 32px 18px;
  color: var(--text-muted);
}

.history-empty-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--bg-input);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 12px;
  color: var(--text-muted);
}

.history-empty-state h4 {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.history-empty-state p {
  font-size: 0.82rem;
  max-width: 380px;
  margin: 0 auto 14px;
  line-height: 1.45;
}

.btn-empty-save {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--brand-primary);
  background: rgba(6, 182, 212, 0.12);
  color: var(--brand-primary);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.btn-empty-save:hover {
  background: var(--brand-primary);
  color: #ffffff;
}

.hero-loaded-highlight {
  animation: highlightPulse 1.2s ease-out;
}

@keyframes highlightPulse {
  0% {
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.6);
    border-color: var(--accent-emerald);
  }
  50% {
    box-shadow: 0 0 25px 4px rgba(16, 185, 129, 0.4);
    border-color: var(--accent-emerald);
  }
  100% {
    box-shadow: none;
    border-color: var(--border-color);
  }
}

@media (max-width: 600px) {
  .header-actions {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    justify-content: flex-start;
  }
  .btn-primary-action span,
  .btn-secondary span,
  .btn-guide-action span {
    font-size: 0.76rem;
  }
  .history-item-header {
    flex-direction: column;
    gap: 6px;
  }
  .history-item-hero-val {
    text-align: left;
  }
}

/* ==========================================================
   BOTONES Y ACCIONES DE GUÍA EN PDF
   ========================================================== */
.btn-guide-action {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: linear-gradient(135deg, #0d9488 0%, #0284c7 100%);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  font-size: 0.84rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(13, 148, 136, 0.35);
  transition: var(--transition);
}

.btn-guide-action:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(13, 148, 136, 0.5);
  filter: brightness(1.1);
}

.btn-hero-guide {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, rgba(13, 148, 136, 0.2) 0%, rgba(2, 132, 199, 0.2) 100%);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.4);
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
}

.btn-hero-guide:hover {
  background: linear-gradient(135deg, rgba(13, 148, 136, 0.35) 0%, rgba(2, 132, 199, 0.35) 100%);
  color: #ffffff;
  border-color: #38bdf8;
  transform: translateY(-1px);
}

/* ==========================================================
   MODAL DE LA GUÍA COMPLETA (READER VIEW)
   ========================================================== */
.guide-modal-content {
  max-width: 960px !important;
  width: 94vw !important;
  max-height: 94vh !important;
  display: flex;
  flex-direction: column;
  padding: 0 !important;
  overflow: hidden;
  background: #0f172a;
}

.guide-modal-header {
  padding: 16px 24px;
  background: #1e293b;
  border-bottom: 1px solid rgba(148, 163, 184, 0.2);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 10;
}

.guide-badge-pill {
  display: inline-block;
  background: rgba(13, 148, 136, 0.25);
  color: #2dd4bf;
  border: 1px solid rgba(45, 212, 191, 0.4);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  padding: 3px 8px;
  border-radius: 9999px;
  margin-bottom: 4px;
}

.guide-modal-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.btn-guide-print {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 9px 18px;
  font-size: 0.88rem;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.35);
  transition: var(--transition);
}

.btn-guide-print:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.5);
  filter: brightness(1.08);
}

.guide-modal-body {
  padding: 24px;
  overflow-y: auto;
  background: #0b1120;
  display: flex;
  flex-direction: column;
  gap: 32px;
}

/* ==========================================================
   ESTRUCTURA DE HOJA / PÁGINA IMPRESA (ESTILO CLÍNICO OFICIAL)
   ========================================================== */
.guide-sheet {
  background: #ffffff;
  color: #0f172a;
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  padding: 36px 40px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  line-height: 1.45;
  position: relative;
  box-sizing: border-box;
}

/* Encabezado superior de página */
.guide-sheet-header {
  border-bottom: 2px solid #0d9488;
  padding-bottom: 12px;
  margin-bottom: 20px;
}

.guide-sheet-topbar {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px;
}

.guide-doc-title {
  color: #0d9488;
  font-size: 1.55rem;
  font-weight: 900;
  letter-spacing: -0.01em;
  margin: 0;
}

.guide-doc-type {
  color: #0284c7;
  font-size: 1.25rem;
  font-weight: 700;
}

.guide-doc-tags {
  color: #475569;
  font-size: 0.82rem;
  font-weight: 600;
  text-align: center;
  margin-top: 6px;
  letter-spacing: 0.04em;
}

/* Tarjetas de Resumen Superior 4-Box Grid */
.guide-overview-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border: 1.5px solid #2dd4bf;
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 18px;
  background: #f0fdfa;
}

.guide-overview-box {
  padding: 12px 14px;
  border-right: 1.5px solid #2dd4bf;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  text-align: center;
}

.guide-overview-box:last-child {
  border-right: none;
}

.guide-box-header {
  color: #0d9488;
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.guide-box-body {
  font-size: 0.86rem;
  font-weight: 800;
  color: #0f172a;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 48px;
}

.guide-cycle-flow {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  font-size: 0.82rem;
}

/* Callout de calibración actual */
.guide-calib-banner {
  background: #fef3c7;
  border: 1px solid #fde68a;
  border-radius: 7px;
  padding: 10px 14px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 22px;
}

.guide-calib-banner .icon {
  color: #b45309;
  font-size: 1.2rem;
  font-weight: 900;
  line-height: 1;
}

.guide-calib-banner p {
  margin: 0;
  font-size: 0.84rem;
  color: #78350f;
  line-height: 1.4;
}

/* Tabla del Índice ("WHAT'S INSIDE THIS GUIDE") */
.guide-index-card {
  border: 1.5px solid #2dd4bf;
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 22px;
}

.guide-index-title {
  background: #f0fdfa;
  color: #0d9488;
  font-size: 0.95rem;
  font-weight: 900;
  text-align: center;
  padding: 10px;
  letter-spacing: 0.05em;
  border-bottom: 1.5px solid #2dd4bf;
}

.guide-index-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.84rem;
}

.guide-index-table tr {
  border-bottom: 1px solid #e2e8f0;
}

.guide-index-table tr:last-child {
  border-bottom: none;
}

.guide-index-num {
  width: 44px;
  text-align: center;
  font-weight: 900;
  color: #0d9488;
  font-size: 1.1rem;
  border-right: 1px solid #e2e8f0;
  padding: 8px 6px;
}

.guide-index-name {
  width: 38%;
  font-weight: 800;
  color: #0284c7;
  padding: 8px 12px;
  border-right: 1px solid #e2e8f0;
}

.guide-index-desc {
  padding: 8px 12px;
  color: #334155;
  font-weight: 500;
}

/* Banner de descargo de responsabilidad */
.guide-disclaimer-box {
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 7px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: auto;
}

.guide-disclaimer-box p {
  margin: 0;
  font-size: 0.78rem;
  color: #991b1b;
  line-height: 1.35;
}

/* Pie de página de cada hoja */
.guide-sheet-footer {
  margin-top: 24px;
  padding-top: 10px;
  border-top: 1px solid #e2e8f0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.78rem;
  color: #64748b;
  font-weight: 600;
}

/* ==========================================================
   PÁGINA 2: PREPARACIÓN DEL VIAL (PASO A PASO ILUSTRADO)
   ========================================================== */
.guide-section-banner {
  border: 1.5px solid #2dd4bf;
  border-radius: 6px;
  background: #f0fdfa;
  color: #0d9488;
  padding: 8px 14px;
  font-size: 1.05rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  margin-bottom: 20px;
}

.guide-prep-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 22px 30px;
  margin-bottom: 20px;
}

.guide-step-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.guide-step-title {
  font-size: 0.92rem;
  font-weight: 800;
  color: #0f172a;
  line-height: 1.35;
}

.guide-step-title strong {
  color: #0d9488;
}

.guide-step-illu {
  width: 100%;
  height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  overflow: hidden;
  padding: 4px;
}

.guide-real-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 6px;
  display: block;
}

.guide-step-notes {
  font-size: 0.76rem;
  color: #475569;
  line-height: 1.3;
}

/* ==========================================================
   PÁGINA 3: RECONSTITUCIÓN MATEMÁTICA Y TABLA DÍA POR DÍA
   ========================================================== */
.guide-sub-header {
  color: #0d9488;
  font-size: 0.88rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 14px 0 6px 0;
}

.guide-text-body {
  font-size: 0.86rem;
  color: #1e293b;
  margin-bottom: 12px;
  line-height: 1.45;
}

.guide-warning-box {
  background: #f5f3ff;
  border: 1.5px solid #ddd6fe;
  border-radius: 8px;
  padding: 10px 14px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 10px;
}

.guide-warning-box.danger {
  background: #fdf2f8;
  border-color: #fbcfe8;
}

.guide-warning-box svg {
  flex-shrink: 0;
  margin-top: 2px;
}

.guide-warning-box p {
  margin: 0;
  font-size: 0.82rem;
  color: #581c87;
  line-height: 1.35;
}

.guide-warning-box.danger p {
  color: #9d174d;
}

/* Tabla del protocolo de reconstitución */
.guide-table-protocol {
  width: 100%;
  border-collapse: collapse;
  border: 1.5px solid #2dd4bf;
  border-radius: 8px;
  overflow: hidden;
  margin: 14px 0 20px 0;
  font-size: 0.84rem;
}

.guide-table-protocol td {
  padding: 8px 12px;
  border-bottom: 1px solid #ccfbf1;
}

.guide-table-protocol tr:last-child td {
  border-bottom: none;
}

.guide-proto-label {
  width: 25%;
  font-weight: 900;
  color: #0d9488;
  background: #f0fdfa;
  border-right: 1.5px solid #2dd4bf;
}

.guide-proto-val {
  font-weight: 600;
  color: #1e293b;
}

/* Tabla Día a Día */
.guide-day-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
  margin-top: 10px;
  border: 1.5px solid #2dd4bf;
  border-radius: 6px;
  overflow: hidden;
}

.guide-day-table th {
  background: #f0fdfa;
  color: #0d9488;
  font-weight: 800;
  padding: 8px 10px;
  text-align: center;
  border-bottom: 1.5px solid #2dd4bf;
  border-right: 1px solid #ccfbf1;
}

.guide-day-table th:last-child {
  border-right: none;
}

.guide-day-table td {
  padding: 6px 10px;
  text-align: center;
  border-bottom: 1px solid #e2e8f0;
  border-right: 1px solid #e2e8f0;
  color: #1e293b;
  font-weight: 600;
}

.guide-day-table td:last-child {
  border-right: none;
}

.guide-day-table tr:nth-child(even) {
  background: #f8fafc;
}

.guide-day-table tr.vial-change-row {
  background: #ecfeff;
  font-weight: 800;
}

.guide-day-table tr.vial-end-row {
  background: #fef2f2;
}

.vial-badge-label {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 0.74rem;
  font-weight: 700;
}

.vial-badge-label.vial-active {
  background: #e0f2fe;
  color: #0369a1;
}

.vial-badge-label.vial-new {
  background: #dcfce7;
  color: #15803d;
}

.vial-badge-label.vial-done {
  background: #fef3c7;
  color: #b45309;
}

/* ==========================================================
   PÁGINA 4: GUÍA DE ADMINISTRACIÓN E INYECCIÓN
   ========================================================== */
.guide-injections-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 10px;
}

.guide-inj-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  align-items: center;
}

.guide-inj-text {
  font-size: 0.88rem;
  line-height: 1.4;
  color: #1e293b;
}

.guide-inj-text strong {
  color: #0d9488;
}

.guide-inj-illu {
  height: 160px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  overflow: hidden;
  padding: 4px;
}

/* ==========================================================
   ESTILOS DE IMPRESIÓN OFICIALES (@MEDIA PRINT)
   ========================================================== */
.guide-print-area {
  display: none;
}

@media print {
  /* Ocultar interfaz de la aplicación completa */
  html, body {
    background: #ffffff !important;
    color: #000000 !important;
    margin: 0 !important;
    padding: 0 !important;
    width: 100% !important;
  }

  body * {
    visibility: hidden;
  }

  .app-header,
  .mode-tabs,
  .mode-caption,
  .calculator-container,
  .app-footer,
  .modal-backdrop,
  .toast {
    display: none !important;
  }

  /* Mostrar exclusivamente el área de impresión de la guía */
  #guidePrintArea,
  #guidePrintArea * {
    visibility: visible !important;
  }

  #guidePrintArea {
    display: block !important;
    position: absolute !important;
    left: 0 !important;
    top: 0 !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    background: #ffffff !important;
  }

  .guide-sheet {
    box-shadow: none !important;
    border: none !important;
    padding: 12mm 15mm !important;
    margin: 0 !important;
    width: 100% !important;
    min-height: 275mm !important;
    page-break-after: always !important;
    break-after: page !important;
    box-sizing: border-box !important;
    background: #ffffff !important;
  }

  .guide-sheet:last-child {
    page-break-after: auto !important;
    break-after: auto !important;
  }

  @page {
    size: A4 portrait;
    margin: 0;
  }
}

