/* ============================================
   CLÍNICA SANTA LUCÍA - Estilos Globales
   ============================================ */

/* --- Reset & Variables --- */
:root {
  --primary: #0a7e8c;
  --primary-dark: #065a64;
  --primary-light: #0cb8cc;
  --secondary: #2ecc71;
  --accent: #6c5ce7;
  --dark: #1a1a2e;
  --dark-soft: #2d2d44;
  --light: #f0f9ff;
  --white: #ffffff;
  --gray: #6b7280;
  --gray-light: #e5e7eb;
  --danger: #e74c3c;
  --warning: #f39c12;
  --success: #27ae60;
  --info: #3498db;
  --font-main: 'Poppins', sans-serif;
  --font-display: 'Montserrat', sans-serif;
  --shadow: 0 4px 20px rgba(0,0,0,0.08);
  --shadow-lg: 0 10px 40px rgba(0,0,0,0.12);
  --radius: 12px;
  --radius-lg: 20px;
  --transition: all 0.3s ease;
}

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

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: var(--font-main);
  color: var(--dark);
  background: var(--light);
  line-height: 1.6;
  overflow-x: hidden;
}

a { text-decoration: none; color: inherit; }
ul { list-style: none; }
img { max-width: 100%; display: block; }

.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

/* --- Scrollbar --- */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--light); }
::-webkit-scrollbar-thumb { background: var(--primary); border-radius: 4px; }

/* ============================================
   HEADER / NAVBAR
   ============================================ */
.navbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 1000;
  background: rgba(255,255,255,0.97);
  backdrop-filter: blur(10px);
  box-shadow: 0 2px 20px rgba(0,0,0,0.06);
  transition: var(--transition);
}

.navbar .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 75px;
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.3rem;
  color: var(--primary-dark);
}

.navbar-brand .logo-icon {
  width: 48px;
  height: 48px;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 1.4rem;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-links a {
  padding: 8px 18px;
  border-radius: 8px;
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--dark-soft);
  transition: var(--transition);
}

.nav-links a:hover,
.nav-links a.active {
  background: var(--primary);
  color: var(--white);
}

.nav-links .btn-sistema {
  background: linear-gradient(135deg, var(--secondary), #27ae60);
  color: white;
  font-weight: 600;
  padding: 10px 22px;
  border-radius: 25px;
  margin-left: 8px;
}

.nav-links .btn-sistema:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(46,204,113,0.4);
}

.nav-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--primary-dark);
  cursor: pointer;
}

/* --- Emergency Bar --- */
.emergency-bar {
  background: linear-gradient(90deg, var(--danger), #c0392b);
  color: white;
  text-align: center;
  padding: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.5px;
  position: fixed;
  top: 75px; left: 0; right: 0;
  z-index: 999;
  animation: pulse-bar 2s ease-in-out infinite;
}

.emergency-bar i { margin-right: 8px; }

@keyframes pulse-bar {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.85; }
}

/* ============================================
   HERO SECTION
   ============================================ */
.hero {
  margin-top: 110px;
  padding: 80px 0 60px;
  background: linear-gradient(135deg, #e0f7fa 0%, #b2ebf2 30%, #e8f5e9 70%, #f0f9ff 100%);
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  width: 500px; height: 500px;
  background: radial-gradient(circle, rgba(10,126,140,0.08), transparent 70%);
  top: -100px; right: -100px;
  border-radius: 50%;
}

.hero .container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 60px;
  align-items: center;
}

.hero-content h1 {
  font-family: var(--font-display);
  font-size: 3rem;
  font-weight: 800;
  line-height: 1.15;
  color: var(--primary-dark);
  margin-bottom: 18px;
}

.hero-content h1 span {
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-content p {
  font-size: 1.1rem;
  color: var(--gray);
  margin-bottom: 30px;
  max-width: 480px;
}

.hero-buttons {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 28px;
  border-radius: 30px;
  font-weight: 600;
  font-size: 0.95rem;
  border: none;
  cursor: pointer;
  transition: var(--transition);
  font-family: var(--font-main);
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: white;
  box-shadow: 0 4px 15px rgba(10,126,140,0.3);
}

.btn-primary:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 25px rgba(10,126,140,0.4);
}

.btn-secondary {
  background: white;
  color: var(--primary);
  border: 2px solid var(--primary);
}

.btn-secondary:hover {
  background: var(--primary);
  color: white;
  transform: translateY(-3px);
}

.btn-whatsapp {
  background: #25D366;
  color: white;
  box-shadow: 0 4px 15px rgba(37,211,102,0.3);
}

.btn-whatsapp:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 25px rgba(37,211,102,0.4);
}

/* Chronometer */
.hero-chronometer {
  background: white;
  border-radius: var(--radius-lg);
  padding: 30px;
  box-shadow: var(--shadow-lg);
  text-align: center;
  position: relative;
}

.hero-chronometer::before {
  content: '';
  position: absolute;
  top: -3px; left: -3px; right: -3px; bottom: -3px;
  background: linear-gradient(135deg, var(--primary), var(--secondary), var(--primary-light));
  border-radius: 23px;
  z-index: -1;
}

.chrono-title {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  color: var(--primary-dark);
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-bottom: 6px;
}

.chrono-subtitle {
  font-size: 0.85rem;
  color: var(--gray);
  margin-bottom: 20px;
}

.chrono-display {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

.chrono-unit {
  background: linear-gradient(135deg, var(--primary-dark), var(--primary));
  color: white;
  border-radius: 12px;
  padding: 12px 10px;
  min-width: 72px;
  text-align: center;
}

.chrono-unit .number {
  font-family: 'JetBrains Mono', 'Courier New', monospace;
  font-size: 1.8rem;
  font-weight: 700;
  display: block;
  line-height: 1.2;
}

.chrono-unit .label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  opacity: 0.85;
  margin-top: 4px;
  display: block;
}

.chrono-since {
  margin-top: 16px;
  font-size: 0.82rem;
  color: var(--gray);
}

.chrono-since strong {
  color: var(--primary);
}

/* ============================================
   SERVICES SECTION
   ============================================ */
.services {
  padding: 80px 0;
  background: var(--white);
}

.section-header {
  text-align: center;
  margin-bottom: 50px;
}

.section-header .badge {
  display: inline-block;
  background: rgba(10,126,140,0.1);
  color: var(--primary);
  padding: 6px 18px;
  border-radius: 20px;
  font-size: 0.82rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 12px;
}

.section-header h2 {
  font-family: var(--font-display);
  font-size: 2.2rem;
  font-weight: 800;
  color: var(--primary-dark);
  margin-bottom: 10px;
}

.section-header p {
  color: var(--gray);
  max-width: 600px;
  margin: 0 auto;
}

.services-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
}

.service-card {
  background: white;
  border: 1px solid var(--gray-light);
  border-radius: var(--radius);
  padding: 30px 24px;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.service-card::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), var(--primary-light));
  transform: scaleX(0);
  transition: var(--transition);
}

.service-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-lg);
  border-color: transparent;
}

.service-card:hover::after {
  transform: scaleX(1);
}

.service-card .icon {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  margin-bottom: 18px;
  color: white;
}

.service-card h3 {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--dark);
}

.service-card p {
  font-size: 0.9rem;
  color: var(--gray);
  line-height: 1.6;
}

/* Icon backgrounds */
.icon-medicina { background: linear-gradient(135deg, #3498db, #2980b9); }
.icon-gineco { background: linear-gradient(135deg, #e91e63, #c2185b); }
.icon-trauma { background: linear-gradient(135deg, #ff9800, #f57c00); }
.icon-cirugia { background: linear-gradient(135deg, #9c27b0, #7b1fa2); }
.icon-farmacia { background: linear-gradient(135deg, #4caf50, #388e3c); }
.icon-lab { background: linear-gradient(135deg, #00bcd4, #0097a7); }
.icon-emergencia { background: linear-gradient(135deg, #f44336, #d32f2f); }
.icon-interna { background: linear-gradient(135deg, #607d8b, #455a64); }

/* ============================================
   ABOUT SECTION
   ============================================ */
.about {
  padding: 80px 0;
  background: linear-gradient(135deg, #f8fdff, #eef9f0);
}

.about .container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 60px;
  align-items: center;
}

.about-content .badge {
  display: inline-block;
  background: rgba(10,126,140,0.1);
  color: var(--primary);
  padding: 6px 18px;
  border-radius: 20px;
  font-size: 0.82rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 12px;
}

.about-content h2 {
  font-family: var(--font-display);
  font-size: 2.2rem;
  font-weight: 800;
  color: var(--primary-dark);
  margin-bottom: 18px;
}

.about-content p {
  color: var(--gray);
  margin-bottom: 16px;
  line-height: 1.7;
}

.about-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-top: 24px;
}

.stat-box {
  background: white;
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
  box-shadow: var(--shadow);
}

.stat-box .number {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 800;
  color: var(--primary);
  display: block;
}

.stat-box .label {
  font-size: 0.82rem;
  color: var(--gray);
  margin-top: 4px;
}

.about-visual {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.about-card {
  background: white;
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  text-align: center;
}

.about-card i {
  font-size: 2.5rem;
  color: var(--primary);
  margin-bottom: 12px;
}

.about-card h4 {
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 6px;
}

.about-card p {
  font-size: 0.8rem;
  color: var(--gray);
}

.about-card.highlight {
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: white;
  grid-column: span 2;
}

.about-card.highlight i,
.about-card.highlight p { color: rgba(255,255,255,0.9); }
.about-card.highlight h4 { color: white; }

/* ============================================
   SURGERY SECTION
   ============================================ */
.surgery {
  padding: 80px 0;
  background: var(--white);
}

.surgery-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 30px;
}

.surgery-card {
  background: linear-gradient(135deg, #f0f9ff, #e8f5e9);
  border-radius: var(--radius-lg);
  padding: 36px;
  border-left: 4px solid var(--primary);
}

.surgery-card h3 {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--primary-dark);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.surgery-card h3 i { color: var(--primary); }

.surgery-card p {
  color: var(--gray);
  font-size: 0.92rem;
  line-height: 1.7;
}

.surgery-card .tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.surgery-card .tag {
  background: rgba(10,126,140,0.1);
  color: var(--primary-dark);
  padding: 4px 12px;
  border-radius: 15px;
  font-size: 0.78rem;
  font-weight: 500;
}

/* ============================================
   CONTACT SECTION
   ============================================ */
.contact {
  padding: 80px 0;
  background: linear-gradient(135deg, var(--primary-dark), var(--primary));
  color: white;
}

.contact .section-header .badge {
  background: rgba(255,255,255,0.15);
  color: white;
}

.contact .section-header h2 { color: white; }
.contact .section-header p { color: rgba(255,255,255,0.8); }

.contact-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
}

.contact-card {
  background: rgba(255,255,255,0.1);
  backdrop-filter: blur(10px);
  border-radius: var(--radius);
  padding: 30px 24px;
  text-align: center;
  transition: var(--transition);
  border: 1px solid rgba(255,255,255,0.15);
}

.contact-card:hover {
  background: rgba(255,255,255,0.18);
  transform: translateY(-3px);
}

.contact-card i {
  font-size: 2rem;
  margin-bottom: 14px;
  color: var(--secondary);
}

.contact-card h4 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.contact-card p {
  font-size: 0.9rem;
  opacity: 0.9;
  line-height: 1.6;
}

.contact-card a {
  color: var(--secondary);
  font-weight: 600;
}

/* ============================================
   MAP SECTION
   ============================================ */
.map-section {
  padding: 0;
}

.map-section iframe {
  width: 100%;
  height: 350px;
  border: none;
  display: block;
}

/* ============================================
   FOOTER
   ============================================ */
.footer {
  background: var(--dark);
  color: rgba(255,255,255,0.7);
  padding: 40px 0 20px;
}

.footer-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 20px;
}

.footer-brand {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  color: white;
}

.footer-social {
  display: flex;
  gap: 12px;
}

.footer-social a {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255,255,255,0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  font-size: 1.1rem;
  color: rgba(255,255,255,0.7);
}

.footer-social a:hover {
  background: var(--primary);
  color: white;
  transform: translateY(-2px);
}

.footer-bottom {
  text-align: center;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid rgba(255,255,255,0.08);
  font-size: 0.82rem;
}

/* ============================================
   CTA Sistema
   ============================================ */
.cta-sistema {
  padding: 60px 0;
  background: linear-gradient(135deg, #e8f5e9, #e0f7fa);
  text-align: center;
}

.cta-sistema h2 {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 800;
  color: var(--primary-dark);
  margin-bottom: 12px;
}

.cta-sistema p {
  color: var(--gray);
  max-width: 600px;
  margin: 0 auto 24px;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 992px) {
  .hero .container {
    grid-template-columns: 1fr;
    text-align: center;
  }
  .hero-content p { margin: 0 auto 30px; }
  .hero-buttons { justify-content: center; }
  .hero-chronometer { max-width: 450px; margin: 0 auto; }
  .about .container { grid-template-columns: 1fr; }
  .about-visual { grid-template-columns: 1fr 1fr; }
  .surgery-grid { grid-template-columns: 1fr; }
  .contact-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 768px) {
  .nav-links { 
    display: none;
    position: absolute;
    top: 75px; left: 0; right: 0;
    background: white;
    flex-direction: column;
    padding: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    z-index: 1001;
  }
  .nav-links.active { display: flex; }
  .nav-toggle { display: block; }
  .hero { margin-top: 100px; padding: 50px 0 40px; }
  .hero-content h1 { font-size: 2.2rem; }
  .hero-content p { font-size: 1rem; }
  .chrono-unit { min-width: 60px; padding: 10px 8px; }
  .chrono-unit .number { font-size: 1.4rem; }
  .section-header h2 { font-size: 1.8rem; }
  .about-stats { grid-template-columns: 1fr 1fr; }
  .about-visual { grid-template-columns: 1fr; gap: 12px; }
  .about-card.highlight { grid-column: span 1; }
  .services-grid { grid-template-columns: 1fr; }
  .contact-grid { grid-template-columns: 1fr; }
  .surgery-card { padding: 24px; }
  .cta-sistema h2 { font-size: 1.5rem; }
  .footer-content { flex-direction: column; text-align: center; }
  .map-section iframe { height: 250px; }
  .btn { padding: 12px 22px; font-size: 0.9rem; }
  .emergency-bar { font-size: 0.75rem; padding: 6px 10px; }
  .container { padding: 0 16px; }
  .services, .about, .surgery, .contact { padding: 50px 0; }
}

@media (max-width: 480px) {
  .navbar .container { height: 60px; }
  .navbar-brand { font-size: 1.1rem; gap: 8px; }
  .navbar-brand img { height: 36px !important; width: 36px !important; }
  .emergency-bar { top: 60px; font-size: 0.7rem; }
  .hero { margin-top: 90px; padding: 30px 0; }
  .hero-content h1 { font-size: 1.6rem; }
  .hero-buttons { flex-direction: column; align-items: stretch; }
  .hero-buttons .btn { justify-content: center; }
  .chrono-display { gap: 4px; }
  .chrono-unit { min-width: 46px; padding: 8px 4px; }
  .chrono-unit .number { font-size: 1.1rem; }
  .chrono-unit .label { font-size: 0.55rem; }
  .hero-chronometer { padding: 20px 12px; }
  .section-header h2 { font-size: 1.5rem; }
  .section-header p { font-size: 0.88rem; }
  .about-stats { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat-box { padding: 14px; }
  .stat-box .number { font-size: 1.5rem; }
  .contact-card { padding: 20px 16px; }
  .btn-whatsapp-float { width: 50px !important; height: 50px !important; font-size: 1.5rem !important; bottom: 16px !important; right: 16px !important; }
}

/* ============================================
   SISTEMA - LOGIN & DASHBOARD
   ============================================ */

/* --- Login Page: Two-panel layout --- */
.sys-login-page {
  min-height: 100vh;
  display: flex;
  background: var(--light);
}

/* Brand panel (left) */
.login-brand-panel {
  flex: 0 0 45%;
  background: linear-gradient(160deg, #065a64 0%, #0a7e8c 40%, #0cb8cc 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  padding: 40px;
}

.login-brand-content {
  position: relative;
  z-index: 2;
  text-align: center;
  color: white;
}

.login-brand-icon {
  width: 120px; height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 28px;
  animation: loginFloatIcon 3s ease-in-out infinite;
}
.login-brand-icon img {
  width: 100%; height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 4px 15px rgba(0,0,0,0.2));
}

@keyframes loginFloatIcon {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

.login-brand-panel h1 {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 2rem;
  margin-bottom: 8px;
  letter-spacing: -0.5px;
}

.login-brand-tagline {
  font-size: 1.05rem;
  opacity: 0.85;
  margin-bottom: 24px;
  font-weight: 400;
}

.login-brand-divider {
  width: 40px;
  height: 2px;
  background: rgba(255,255,255,0.25);
  margin: 0 auto 24px;
}

.login-brand-features {
  display: flex;
  gap: 32px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 32px;
}

.login-brand-sub {
  font-size: 0.78rem;
  opacity: 0.45;
  letter-spacing: 0.5px;
}

.login-feature {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  opacity: 0.9;
}

.login-feature i {
  width: 42px; height: 42px;
  background: rgba(255,255,255,0.12);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
}

/* Decorative circles */
.login-brand-decoration {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.login-circle {
  position: absolute;
  border-radius: 50%;
  background: rgba(255,255,255,0.06);
}

.login-circle-1 {
  width: 300px; height: 300px;
  top: -80px; right: -60px;
  animation: loginPulse 6s ease-in-out infinite;
}

.login-circle-2 {
  width: 200px; height: 200px;
  bottom: -40px; left: -50px;
  animation: loginPulse 8s ease-in-out infinite 1s;
}

.login-circle-3 {
  width: 120px; height: 120px;
  bottom: 30%; right: 10%;
  background: rgba(255,255,255,0.04);
  animation: loginPulse 5s ease-in-out infinite 2s;
}

@keyframes loginPulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.08); opacity: 0.7; }
}

/* Form panel (right) */
.login-form-panel {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
}

.sys-login-card {
  background: white;
  border-radius: var(--radius-lg);
  padding: 48px 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.08);
  animation: loginCardIn 0.5s ease-out;
}

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

.login-card-header {
  margin-bottom: 32px;
}

.sys-login-card h2 {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.7rem;
  color: var(--dark);
  margin-bottom: 6px;
}

.sys-login-card .subtitle {
  color: var(--gray);
  font-size: 0.92rem;
  margin-bottom: 0;
}

/* login inputs with icon */
.login-fg label {
  display: none;
}

.login-input-wrap {
  position: relative;
}

.login-input-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--gray);
  font-size: 0.9rem;
  transition: var(--transition);
  pointer-events: none;
}

.login-input-wrap input {
  padding-left: 46px !important;
  height: 52px;
  border: 2px solid var(--gray-light);
  border-radius: 14px;
  font-size: 0.95rem;
  background: var(--light);
  transition: var(--transition);
}

.login-input-wrap input:focus {
  background: white;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(10,126,140,0.1);
}

.login-input-wrap input:focus + .login-input-icon,
.login-input-wrap input:focus ~ .login-input-icon {
  color: var(--primary);
}

/* icon is before input in DOM, so we use the sibling approach via parent */
.login-input-wrap:focus-within .login-input-icon {
  color: var(--primary);
}

.login-btn {
  height: 52px;
  border-radius: 14px;
  font-size: 1rem;
  font-weight: 700;
  margin-top: 8px;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  border: none;
  color: white;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: 0 4px 16px rgba(10,126,140,0.3);
}

.login-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(10,126,140,0.4);
}

.login-btn:active {
  transform: translateY(0);
}

/* Login footer */
.login-footer {
  margin-top: 28px;
  text-align: center;
}

.login-hint {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  color: var(--gray);
  background: var(--light);
  padding: 8px 16px;
  border-radius: 10px;
  margin-bottom: 12px;
}

.login-hint i {
  color: var(--primary);
}

.login-back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  color: var(--primary);
  font-weight: 500;
  transition: var(--transition);
}

.login-back-link:hover {
  color: var(--primary-dark);
  gap: 8px;
}

/* Responsive: stack on mobile */
@media (max-width: 900px) {
  .sys-login-page {
    flex-direction: column;
  }
  .login-brand-panel {
    flex: none;
    padding: 48px 24px 36px;
  }
  .login-brand-panel h1 { font-size: 1.5rem; }
  .login-brand-tagline { margin-bottom: 28px; font-size: 0.92rem; }
  .login-brand-features { gap: 20px; }
  .login-form-panel { padding: 32px 20px 48px; }
  .sys-login-card {
    padding: 36px 28px;
    box-shadow: 0 -8px 40px rgba(0,0,0,0.06);
    margin-top: -24px;
    border-radius: 24px 24px var(--radius-lg) var(--radius-lg);
    position: relative;
    z-index: 3;
  }
}

@media (max-width: 480px) {
  .login-brand-features { gap: 14px; }
  .login-feature { font-size: 0.75rem; }
  .login-feature i { width: 36px; height: 36px; font-size: 0.88rem; }
  .sys-login-card { padding: 30px 22px; }
}

.form-group {
  margin-bottom: 18px;
  text-align: left;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--dark-soft);
  margin-bottom: 6px;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid var(--gray-light);
  border-radius: 10px;
  font-size: 0.92rem;
  font-family: var(--font-main);
  transition: var(--transition);
  background: white;
  color: var(--dark);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(10,126,140,0.1);
}

.btn-block {
  width: 100%;
  padding: 14px;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 700;
}

/* --- Dashboard Layout --- */
.sys-wrapper {
  display: flex;
  min-height: 100vh;
}

.sys-sidebar {
  width: 260px;
  background: linear-gradient(180deg, #1a1a2e 0%, #16213e 100%);
  color: white;
  padding: 24px 0;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  overflow-y: auto;
  z-index: 100;
  transition: transform 0.3s cubic-bezier(.4,0,.2,1), box-shadow 0.3s ease;
}

/* Collapsed main sidebar */
.sys-wrapper.sidebar-hidden .sys-sidebar {
  transform: translateX(-100%);
}
.sys-wrapper.sidebar-hidden .sys-sidebar.floating-open {
  transform: translateX(0);
  box-shadow: 6px 0 30px rgba(0,0,0,0.3);
}
.sys-wrapper.sidebar-hidden .sys-main {
  margin-left: 0;
}
/* Floating menu toggle button */
.main-sidebar-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: 1px solid var(--gray-light);
  background: #fff;
  color: var(--primary-dark);
  cursor: pointer;
  font-size: 1.1rem;
  transition: all 0.2s;
  margin-right: 10px;
  flex-shrink: 0;
}
.main-sidebar-toggle:hover {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  box-shadow: 0 2px 8px rgba(10,126,140,0.25);
}
.sys-wrapper.sidebar-hidden .main-sidebar-toggle {
  display: flex;
}
/* Overlay when floating sidebar is open */
.sidebar-floating-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.3);
  z-index: 99;
}
.sys-wrapper.sidebar-hidden .sidebar-floating-overlay.active {
  display: block;
}

.sys-sidebar .brand {
  padding: 0 16px 24px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sys-sidebar .brand .brand-logo {
  max-width: 180px;
  width: 100%;
  height: auto;
  object-fit: contain;
  filter: brightness(0) invert(1);
  opacity: 0.92;
  transition: opacity 0.2s;
}

.sys-sidebar .brand .brand-logo:hover {
  opacity: 1;
}

.sys-sidebar nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 24px;
  color: rgba(255,255,255,0.6);
  font-size: 0.9rem;
  font-weight: 500;
  transition: var(--transition);
  border-left: 3px solid transparent;
}

.sys-sidebar nav a:hover,
.sys-sidebar nav a.active {
  background: rgba(255,255,255,0.05);
  color: white;
  border-left-color: var(--primary-light);
}

.sys-sidebar nav a i { width: 20px; text-align: center; }

.sys-sidebar .sidebar-section {
  padding: 12px 24px 6px;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: rgba(255,255,255,0.3);
  font-weight: 600;
}

.sys-main {
  margin-left: 260px;
  flex: 1;
  padding: 30px;
  background: var(--light);
}

.sys-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
  padding-bottom: 20px;
  border-bottom: 1px solid rgba(0,0,0,0.06);
}

.sys-topbar h1 {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--primary-dark);
}

.sys-topbar .user-info {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.85rem;
  color: var(--gray);
}

.sys-topbar .user-avatar {
  width: 62px; height: 62px;
  min-width: 62px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 1.3rem;
  box-shadow: 0 2px 8px rgba(10,126,140,0.3);
  cursor: pointer;
}

/* Stats Cards */
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}

.stat-card {
  background: white;
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 16px;
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(0,0,0,0.03);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0,0,0,0.1);
}

.stat-card-bg {
  position: absolute;
  right: -8px;
  bottom: -8px;
  font-size: 4.5rem;
  opacity: 0.04;
  pointer-events: none;
  line-height: 1;
}

.stat-card--total  .stat-card-bg { color: var(--primary); }
.stat-card--hosp   .stat-card-bg { color: #f39c12; }
.stat-card--cirugia .stat-card-bg { color: #e74c3c; }
.stat-card--consulta .stat-card-bg { color: #3498db; }
.stat-card--alta   .stat-card-bg { color: #27ae60; }

.stat-card--total  { border-left: 3px solid var(--primary); }
.stat-card--hosp   { border-left: 3px solid #f39c12; }
.stat-card--cirugia { border-left: 3px solid #e74c3c; }
.stat-card--consulta { border-left: 3px solid #3498db; }
.stat-card--alta   { border-left: 3px solid #27ae60; }

.stat-card .icon-box {
  width: 50px; height: 50px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  color: white;
  flex-shrink: 0;
}

.stat-card .info h3 {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 800;
}

.stat-card .info p {
  font-size: 0.82rem;
  color: var(--gray);
}

/* Dashboard Welcome Banner */
.dash-welcome-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 50%, var(--primary-light) 100%);
  color: white;
  padding: 28px 32px;
  border-radius: var(--radius-lg);
  margin-bottom: 28px;
  position: relative;
  overflow: hidden;
}

.dash-welcome-banner::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -10%;
  width: 300px;
  height: 300px;
  border-radius: 50%;
  background: rgba(255,255,255,0.06);
}

.dash-welcome-banner::after {
  content: '';
  position: absolute;
  bottom: -40%;
  right: 15%;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  background: rgba(255,255,255,0.04);
}

.dash-welcome-text h2 {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.dash-welcome-text p {
  font-size: 0.88rem;
  opacity: 0.8;
}

.dash-welcome-icon {
  font-size: 3rem;
  opacity: 0.25;
  position: absolute;
  right: 25%;
  top: 50%;
  transform: translateY(-50%);
  z-index: 1;
}

/* Welcome Overlay */
.welcome-overlay {
  position: fixed;
  inset: 0;
  background: linear-gradient(160deg, rgba(6,90,100,0.97), rgba(10,126,140,0.97));
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: welcomeFadeIn 0.4s ease-out;
}

.welcome-overlay.welcome-fade-out {
  animation: welcomeFadeOut 0.6s ease-in forwards;
}

@keyframes welcomeFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes welcomeFadeOut {
  from { opacity: 1; transform: scale(1); }
  to { opacity: 0; transform: scale(1.05); }
}

.welcome-card {
  text-align: center;
  color: white;
  animation: welcomeCardIn 0.5s ease-out 0.1s both;
}

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

.welcome-avatar {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: rgba(255,255,255,0.15);
  backdrop-filter: blur(10px);
  border: 3px solid rgba(255,255,255,0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 24px;
  font-size: 2.2rem;
  font-family: var(--font-display);
  font-weight: 800;
  letter-spacing: 1px;
  overflow: hidden;
}

.welcome-card h2 {
  font-family: var(--font-display);
  font-size: 1.8rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.welcome-role {
  font-size: 0.95rem;
  opacity: 0.7;
  margin-bottom: 20px;
}

.welcome-line {
  width: 40px;
  height: 2px;
  background: rgba(255,255,255,0.3);
  margin: 0 auto 16px;
}

.welcome-clinic {
  font-size: 0.85rem;
  opacity: 0.5;
  letter-spacing: 0.5px;
}

/* Data Table */
.data-panel {
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.data-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid var(--gray-light);
  flex-wrap: wrap;
  gap: 12px;
}

.data-panel-header h3 {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--dark);
}

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

.search-box {
  display: flex;
  align-items: center;
  background: var(--light);
  border-radius: 8px;
  padding: 8px 14px;
  gap: 8px;
}

.search-box input {
  border: none;
  background: transparent;
  outline: none;
  font-size: 0.88rem;
  font-family: var(--font-main);
  width: 180px;
}

.search-box i { color: var(--gray); font-size: 0.9rem; }

.filter-select {
  padding: 8px 14px;
  border: 1px solid var(--gray-light);
  border-radius: 8px;
  font-size: 0.88rem;
  font-family: var(--font-main);
  background: white;
  color: var(--dark);
  cursor: pointer;
}

.btn-sm {
  padding: 8px 18px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
}

table {
  width: 100%;
  border-collapse: collapse;
}

table thead th {
  text-align: left;
  padding: 14px 16px;
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: var(--gray);
  background: var(--light);
  border-bottom: 1px solid var(--gray-light);
}

table tbody td {
  padding: 14px 16px;
  font-size: 0.9rem;
  border-bottom: 1px solid var(--gray-light);
  color: var(--dark-soft);
}

table tbody tr:hover { background: rgba(10,126,140,0.03); }

.badge-status {
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  display: inline-block;
}

.badge-hospitalizado { background: #fff3cd; color: #856404; }
.badge-cirugia { background: #f8d7da; color: #721c24; }
.badge-consulta { background: #d1ecf1; color: #0c5460; }
.badge-alta { background: #d4edda; color: #155724; }
.badge-warning { background: #fff3cd; color: #856404; }
.badge-info { background: #d1ecf1; color: #0c5460; }
.badge-success { background: #d4edda; color: #155724; }

.badge {
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
  display: inline-block;
}

.action-btns {
  display: flex;
  gap: 6px;
}

.action-btn {
  width: 32px; height: 32px;
  border-radius: 8px;
  border: 1px solid var(--gray-light);
  background: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
  font-size: 0.85rem;
  color: var(--gray);
}

.action-btn:hover { border-color: var(--primary); color: var(--primary); }
.action-btn.delete:hover { border-color: var(--danger); color: var(--danger); }

/* Empty state */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--gray);
}

.empty-state i {
  font-size: 3rem;
  margin-bottom: 16px;
  opacity: 0.3;
}

.empty-state p { font-size: 0.95rem; }

/* --- Modal --- */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  padding: 20px;
}

.modal-overlay.active { display: flex; }

.modal,
.modal-box {
  background: white;
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}

.modal-header {
  padding: 24px 28px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--gray-light);
}

.modal-header h3 {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--dark);
}

.modal-close {
  width: 36px; height: 36px;
  border-radius: 50%;
  border: none;
  background: var(--light);
  cursor: pointer;
  font-size: 1.2rem;
  color: var(--gray);
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-close:hover { background: var(--danger); color: white; }

.modal-body { padding: 24px 28px; }
.modal-footer {
  padding: 16px 28px 24px;
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

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

.emerg-contact-section {
  margin-top: 8px;
  padding: 16px;
  border: 1px solid var(--gray-light);
  border-radius: var(--radius-md);
  background: #fef2f2;
}
.emerg-contact-label {
  display: block;
  font-weight: 600;
  color: var(--dark);
  margin-bottom: 12px;
  font-size: 0.95rem;
}

/* Historia Clínica Detail */
.hc-detail {
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.hc-section {
  margin-bottom: 28px;
}

.hc-section h4 {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--primary-dark);
  margin-bottom: 14px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--gray-light);
  display: flex;
  align-items: center;
  gap: 8px;
}

.hc-field-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
}

.hc-field {
  background: var(--light);
  border-radius: 8px;
  padding: 12px 16px;
}

.hc-field .field-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--gray);
  font-weight: 600;
}

.hc-field .field-value {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--dark);
  margin-top: 2px;
}

.notes-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.note-item {
  background: var(--light);
  border-radius: 10px;
  padding: 16px;
  border-left: 3px solid var(--primary);
}

.note-item .note-date {
  font-size: 0.78rem;
  color: var(--gray);
  margin-bottom: 4px;
}

.note-item .note-text {
  font-size: 0.9rem;
  color: var(--dark-soft);
}

/* Pagination */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  padding: 20px;
}

.pagination button {
  width: 36px; height: 36px;
  border-radius: 8px;
  border: 1px solid var(--gray-light);
  background: white;
  cursor: pointer;
  font-family: var(--font-main);
  font-size: 0.88rem;
  transition: var(--transition);
  color: var(--dark-soft);
}

.pagination button.active,
.pagination button:hover {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

/* Toast notifications */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  background: white;
  border-radius: 10px;
  padding: 14px 20px;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 280px;
  animation: slideInRight 0.3s ease;
  border-left: 4px solid var(--primary);
}

.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--danger); }
.toast.warning { border-left-color: var(--warning); }

.toast-message { font-size: 0.9rem; color: var(--dark); }

@keyframes slideInRight {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* Sidebar toggle for mobile */
.sidebar-toggle {
  display: none;
  position: fixed;
  top: 16px; left: 16px;
  z-index: 200;
  width: 44px; height: 44px;
  border-radius: 12px;
  background: var(--primary);
  color: white;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  box-shadow: var(--shadow);
}

@media (max-width: 1024px) {
  .sys-main { padding: 24px 20px; }
  .stats-row { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }
  .data-panel-header { flex-direction: column; align-items: flex-start; }
  .data-panel-header .actions { width: 100%; }
}

@media (max-width: 768px) {
  .sys-sidebar {
    transform: translateX(-100%);
  }
  .sys-sidebar.open { transform: translateX(0); }
  .sys-main { margin-left: 0; padding: 20px 14px; padding-top: 70px; }
  .sidebar-toggle { display: flex; align-items: center; justify-content: center; }
  .form-row { grid-template-columns: 1fr; }
  .stats-row { grid-template-columns: 1fr 1fr; gap: 12px; }
  .stat-card { padding: 16px; gap: 12px; }
  .stat-card .icon-box { width: 42px; height: 42px; font-size: 1.1rem; }
  .stat-card .info h3 { font-size: 1.2rem; }
  .stat-card-bg { font-size: 3rem; }
  .dash-welcome-banner { padding: 20px; border-radius: var(--radius); margin-bottom: 20px; }
  .dash-welcome-text h2 { font-size: 1.15rem; }
  .dash-welcome-text p { font-size: 0.82rem; }
  .dash-welcome-icon { font-size: 1.8rem; }
  .sys-topbar { flex-direction: column; align-items: flex-start; gap: 8px; margin-bottom: 20px; }
  .sys-topbar h1 { font-size: 1.3rem; }
  .sys-topbar .user-info { font-size: 0.8rem; }
  table { font-size: 0.82rem; }
  table thead th, table tbody td { padding: 10px 8px; }
  .action-btns { gap: 4px; }
  .action-btn { width: 28px; height: 28px; font-size: 0.78rem; }
  .data-panel-header .actions { flex-direction: column; width: 100%; }
  .search-box { width: 100%; }
  .search-box input { width: 100%; }
  .filter-select { width: 100%; }
  .hc-field-grid { grid-template-columns: 1fr; }
  .hc-section h4 { font-size: 0.95rem; flex-direction: column; gap: 10px; }
  .modal { margin: 10px; max-height: 95vh; }
  .modal-body { padding: 18px; }
  .modal-header { padding: 18px; }
  .modal-footer { padding: 14px 18px; }
}

@media (max-width: 480px) {
  .stats-row { grid-template-columns: 1fr; }
  .stat-card { flex-direction: row; }
  .sys-topbar h1 { font-size: 1.1rem; }
  .note-item { padding: 12px; }
  .pagination button { width: 30px; height: 30px; font-size: 0.78rem; }
  .btn-sm { padding: 6px 14px; font-size: 0.8rem; }
}

/* View toggle for detail/list */
.view-detail { display: none; }
.view-detail.active { display: block; }
.view-list.active { display: block; }

/* Print header - hidden on screen */
.print-header { display: none; }

/* ============================================
   PRINT STYLES - Historias Clínicas
   ============================================ */
@media print {
  /* Reset page */
  * { -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important; }

  body { background: white !important; font-size: 11pt; line-height: 1.4; }

  /* Hide UI elements - only when NOT in prescription print mode */
  body:not(.printing-prescription) .sys-sidebar,
  body:not(.printing-prescription) .sys-topbar,
  body:not(.printing-prescription) .sidebar-toggle,
  body:not(.printing-prescription) .action-btns,
  body:not(.printing-prescription) .btn,
  body:not(.printing-prescription) button,
  body:not(.printing-prescription) .toast-container,
  body:not(.printing-prescription) .modal-overlay,
  body:not(.printing-prescription) .pagination,
  body:not(.printing-prescription) .search-box,
  body:not(.printing-prescription) .filter-select,
  body:not(.printing-prescription) .data-panel-header .actions,
  body:not(.printing-prescription) #viewDashboard,
  body:not(.printing-prescription) #viewList {
    display: none !important;
  }

  /* Layout reset */
  body:not(.printing-prescription) .sys-wrapper { display: block !important; }
  body:not(.printing-prescription) .sys-main { margin-left: 0 !important; padding: 0 !important; background: white !important; }

  /* Print header for HC */
  .hc-detail::before {
    content: '';
    display: block;
    text-align: center;
    padding: 20px 0 15px;
    border-bottom: 3px solid #0a7e8c;
    margin-bottom: 0;
    font-family: 'Montserrat', sans-serif;
  }

  /* HC Detail */
  .hc-detail {
    box-shadow: none !important;
    border: 1px solid #ddd;
  }

  .detail-sidebar {
    background: #0a7e8c !important;
    color: white !important;
    padding: 20px !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  .detail-tabs-nav {
    display: none !important;
  }

  .detail-tab-pane {
    display: block !important;
    opacity: 1 !important;
  }

  .dsec-body {
    display: block !important;
  }

  .hc-section {
    page-break-inside: avoid;
    margin-bottom: 18px;
  }

  .hc-section h4 {
    font-size: 11pt;
    color: #065a64 !important;
    border-bottom: 2px solid #0a7e8c !important;
    padding-bottom: 5px;
    margin-bottom: 10px;
  }

  .hc-field-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 8px !important;
  }

  .hc-field {
    background: #f5f5f5 !important;
    padding: 8px 12px !important;
    border: 1px solid #e0e0e0;
    border-radius: 4px !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  .hc-field .field-label {
    font-size: 7pt;
    color: #666 !important;
  }

  .hc-field .field-value {
    font-size: 10pt;
    color: #111 !important;
  }

  /* Status badge */
  .badge-status {
    border: 1px solid #999;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  .badge-hospitalizado { background: #fff3cd !important; color: #856404 !important; -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important; }
  .badge-cirugia { background: #f8d7da !important; color: #721c24 !important; -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important; }
  .badge-consulta { background: #d1ecf1 !important; color: #0c5460 !important; -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important; }
  .badge-alta { background: #d4edda !important; color: #155724 !important; -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important; }

  /* Notes */
  .note-item {
    page-break-inside: avoid;
    border-left: 3px solid #0a7e8c !important;
    background: #f9f9f9 !important;
    padding: 10px !important;
    margin-bottom: 8px;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  .note-item .note-date { font-size: 8pt; color: #666 !important; }
  .note-item .note-text { font-size: 10pt; color: #222 !important; }

  /* Page settings */
  @page {
    margin: 1.5cm;
    size: A4;
  }

  /* Back button area - hide */
  #viewDetail > div:first-child {
    display: none !important;
  }

  /* Footer for print */
  .detail-tab-content::after {
    content: 'Clínica Santa Lucía — Sucre y Santa Rosa esq., Machala, El Oro, Ecuador — Tel: 0992834462 / 2931236';
    display: block;
    text-align: center;
    font-size: 8pt;
    color: #999;
    border-top: 1px solid #ddd;
    padding-top: 15px;
    margin-top: 25px;
  }

  /* Bottom action buttons in detail */
  .sid-actions {
    display: none !important;
  }

  /* Links */
  a { color: inherit !important; text-decoration: none !important; }

  /* Print header injected by JS */
  .print-header {
    display: block !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  /* Override the ::before since we now use JS header */
  .hc-detail::before { display: none !important; }

  /* Hide prescription actions (print/delete buttons) in HC print */
  .rx-actions { display: none !important; }
  .prescription-card { break-inside: avoid; }
}

/* ======================================
   PRESCRIPTION / RECETA STYLES
   ====================================== */

/* === Prescription Cards in Detail View === */
.prescriptions-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.prescription-card {
  background: #fff;
  border-radius: 12px;
  border: 1px solid #e5e7eb;
  overflow: hidden;
  transition: box-shadow 0.2s;
}

.prescription-card:hover {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}

.rx-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 14px 18px;
  background: linear-gradient(135deg, #f0f4ff, #e8f5e9);
  border-bottom: 1px solid #e5e7eb;
  gap: 12px;
  flex-wrap: wrap;
}

.rx-header-info {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  font-size: 0.85rem;
}

.rx-header-info span {
  display: flex;
  align-items: center;
  gap: 5px;
}

.rx-date { font-weight: 600; color: #065a64; }
.rx-doctor { color: #6b7280; }
.rx-diag { color: #374151; font-style: italic; }

.rx-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.rx-medications {
  padding: 14px 18px;
}

.rx-med-item {
  display: flex;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px dashed #e5e7eb;
  align-items: flex-start;
}

.rx-med-item:last-child {
  border-bottom: none;
}

.rx-med-num {
  width: 28px;
  height: 28px;
  min-width: 28px;
  background: linear-gradient(135deg, #0a7e8c, #065a64);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  margin-top: 2px;
}

.rx-med-info {
  flex: 1;
}

.rx-med-info strong {
  color: #1f2937;
  font-size: 0.93rem;
}

.rx-generic {
  color: #6b7280;
  font-style: italic;
  font-size: 0.85rem;
  margin-left: 4px;
}

.rx-presentation {
  color: #9ca3af;
  font-size: 0.83rem;
}

.rx-med-details {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 6px;
  font-size: 0.82rem;
  color: #4b5563;
}

.rx-med-details span {
  display: flex;
  align-items: center;
  gap: 4px;
  background: #f3f4f6;
  padding: 2px 10px;
  border-radius: 12px;
}

.rx-med-details span i {
  color: #0a7e8c;
  font-size: 0.75rem;
}

.rx-indications {
  margin-top: 6px;
  font-size: 0.82rem;
  color: #6b7280;
  font-style: italic;
}

.rx-indications i {
  color: #f39c12;
}

.rx-obs {
  padding: 10px 18px;
  background: #fffbeb;
  border-top: 1px solid #fef3c7;
  font-size: 0.85rem;
  color: #92400e;
}

.rx-obs i {
  margin-right: 4px;
}

/* === Medication Rows in Modal === */
.medication-row {
  background: #f8fafc;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 12px;
  transition: opacity 0.2s, transform 0.2s;
  position: relative;
}

.medication-row:hover {
  border-color: #0a7e8c;
}

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

.med-row-num {
  font-size: 0.8rem;
  font-weight: 700;
  color: #065a64;
  background: #e0f7fa;
  padding: 2px 12px;
  border-radius: 12px;
}

.btn-remove-med {
  background: #fee2e2;
  border: none;
  color: #e74c3c;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  transition: all 0.2s;
}

.btn-remove-med:hover {
  background: #e74c3c;
  color: #fff;
}

/* === Prescription Print Styles === */
.rx-print-container {
  font-family: 'Poppins', Arial, sans-serif;
  max-width: 700px;
  margin: 0 auto;
  padding: 20px;
  color: #1f2937;
}

.rx-print-header {
  text-align: center;
  padding-bottom: 12px;
  border-bottom: 3px solid #0a7e8c;
  margin-bottom: 16px;
}

.rx-print-patient-info {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  padding: 8px 12px;
  margin-bottom: 12px;
  font-size: 0.85rem;
  line-height: 1.5;
}

.rx-patient-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 2px 16px;
}

.rx-patient-grid span strong {
  color: #374151;
}

.rx-patient-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 4px;
  padding-top: 4px;
  border-top: 1px dashed #e5e7eb;
  font-size: 0.84rem;
}

.rx-alergy-badge {
  background: #fff3cd;
  color: #856404;
  padding: 1px 8px;
  border-radius: 4px;
  border: 1px solid #ffc107;
}

.rx-cie10-badge {
  background: #e0f2fe;
  color: #0369a1;
  padding: 1px 8px;
  border-radius: 4px;
  border: 1px solid #7dd3fc;
  font-size: 0.88em;
}

.rx-print-row {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  margin-bottom: 4px;
}

.rx-print-row:last-child { margin-bottom: 0; }

.rx-print-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 16px;
  font-size: 0.85rem;
}

.rx-print-table th {
  background: #065a64;
  color: #fff;
  padding: 8px 10px;
  text-align: left;
  font-weight: 600;
  font-size: 0.8rem;
}

.rx-print-table th:first-child { border-radius: 6px 0 0 0; }
.rx-print-table th:last-child { border-radius: 0 6px 0 0; }

.rx-print-table td {
  padding: 8px 10px;
  border-bottom: 1px solid #e5e7eb;
  vertical-align: top;
}

.rx-print-table tr:nth-child(even) td {
  background: #f9fafb;
}

.rx-print-obs {
  background: #fffbeb;
  border: 1px solid #fef3c7;
  border-radius: 6px;
  padding: 10px 14px;
  margin-bottom: 20px;
  font-size: 0.88rem;
  color: #92400e;
}

.rx-print-footer {
  margin-top: 40px;
}

.rx-print-signature {
  display: flex;
  justify-content: flex-end;
  margin-top: 50px;
}

/* === Print mode for individual prescription === */
@media print {
  body.printing-prescription > *:not(#prescriptionPrintView):not(#rgPrintView) {
    display: none !important;
  }

  body.printing-prescription #prescriptionPrintView,
  body.printing-prescription #rgPrintView {
    display: block !important;
    position: static !important;
    width: 100%;
    margin: 0;
    padding: 0;
    background: #fff;
    overflow: visible !important;
  }

  body.printing-prescription #prescriptionPrintView *,
  body.printing-prescription #rgPrintView * {
    visibility: visible !important;
  }

  body.printing-prescription {
    margin: 0 !important;
    padding: 0 !important;
    overflow: visible !important;
    height: auto !important;
  }

  /* Landscape A4 two-page layout */
  @page {
    size: A4 landscape;
    margin: 4mm 5mm;
  }

  body.printing-prescription .rxp-landscape-wrapper {
    display: flex !important;
    width: 100%;
    gap: 0;
    page-break-after: avoid;
    page-break-inside: avoid;
    overflow: visible !important;
    height: auto !important;
  }

  body.printing-prescription .rxp-page {
    width: 50%;
    box-sizing: border-box;
    padding: 0 8px;
    page-break-inside: avoid;
    overflow: visible !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  body.printing-prescription .rxp-page-left {
    border-right: 1.5px dashed #ccc;
    padding-right: 10px;
  }

  body.printing-prescription .rxp-page-right {
    padding-left: 10px;
  }

  body.printing-prescription .rxp-clinic-header {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  body.printing-prescription .rxp-title-badge {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  body.printing-prescription .rxp-table th {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  body.printing-prescription .rxp-table tr:nth-child(even) td {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  body.printing-prescription .rxp-patient-block,
  body.printing-prescription .rxp-alergy,
  body.printing-prescription .rxp-cie10,
  body.printing-prescription .rxp-indic-num,
  body.printing-prescription .rxp-indic-note,
  body.printing-prescription .rxp-important-box,
  body.printing-prescription .rxp-num-receta {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
}

/* ===== Landscape Prescription Print Styles (screen preview + print) ===== */
.rxp-landscape-wrapper {
  display: flex;
  width: 100%;
  font-family: 'Inter', Arial, sans-serif;
  font-size: 8.5pt;
  line-height: 1.25;
  color: #1f2937;
}

.rxp-page {
  width: 50%;
  box-sizing: border-box;
  padding: 0 6px;
  display: flex;
  flex-direction: column;
}

.rxp-page-left {
  border-right: 1.5px dashed #d1d5db;
  padding-right: 8px;
}

.rxp-page-right {
  padding-left: 8px;
}

/* Clinic header */
.rxp-clinic-header {
  text-align: center;
  margin-bottom: 3px;
  padding-bottom: 2px;
  border-bottom: 1.5px solid #0a7e8c;
  position: relative;
}

.rxp-num-receta {
  position: absolute;
  top: 0;
  right: 0;
  font-family: 'Courier New', monospace;
  font-size: 9pt;
  font-weight: 700;
  color: #dc2626;
  letter-spacing: 0.5px;
}

.rxp-clinic-name {
  font-family: 'Montserrat', sans-serif;
  font-size: 11pt;
  font-weight: 800;
  color: #065a64;
  margin: 0;
  line-height: 1.2;
}

.rxp-clinic-subtitle {
  font-size: 8pt;
  color: #374151;
  margin: 0;
  line-height: 1.2;
  font-weight: 600;
}

.rxp-clinic-banner {
  font-size: 7.5pt;
  font-weight: 700;
  color: #fff;
  background: #0a7e8c;
  display: inline-block;
  padding: 0px 10px;
  border-radius: 2px;
  margin: 1px 0;
  letter-spacing: 0.5px;
}

.rxp-clinic-info {
  font-size: 7pt;
  color: #6b7280;
  margin: 0;
  line-height: 1.2;
}

.rxp-title-badge {
  display: inline-block;
  margin-top: 2px;
  padding: 1px 12px;
  background: linear-gradient(135deg, #0a7e8c, #065a64);
  color: #fff;
  border-radius: 3px;
  font-size: 8pt;
  font-weight: 700;
  letter-spacing: 0.8px;
}

/* Patient block */
.rxp-patient-block {
  border: 1px solid #d1d5db;
  border-radius: 4px;
  padding: 2px 6px;
  margin-bottom: 3px;
  background: #f9fafb;
}

.rxp-prow {
  font-size: 8pt;
  line-height: 1.3;
  margin-bottom: 0;
  position: relative;
}

.rxp-pright {
  float: right;
}

.rxp-prow-alert {
  background: #fff3cd;
  color: #856404;
  padding: 0 4px;
  border-radius: 2px;
  border: 1px solid #ffc107;
  margin-top: 1px;
}

/* Receta table (left page) */
.rxp-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 8.5pt;
  margin-bottom: 2px;
  flex: 1;
}

.rxp-table th {
  background: #0a7e8c;
  color: #fff;
  padding: 2px 4px;
  text-align: left;
  font-size: 7.5pt;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.rxp-table th:first-child {
  border-radius: 3px 0 0 0;
  text-align: center;
}

.rxp-table th:last-child {
  border-radius: 0 3px 0 0;
}

.rxp-table td {
  padding: 1.5px 4px;
  border-bottom: 1px solid #e5e7eb;
  vertical-align: top;
}

.rxp-table tr:nth-child(even) td {
  background: #f9fafb;
}

.rxp-td-num {
  text-align: center;
  font-weight: 700;
  color: #065a64;
  width: 18px;
}

.rxp-td-med {
  font-size: 8.5pt;
  line-height: 1.2;
}

.rxp-generic {
  color: #6b7280;
  font-size: 7pt;
}

.rxp-td-pres {
  font-size: 7.5pt;
  color: #4b5563;
}

.rxp-td-cant {
  text-align: center;
  font-weight: 600;
  width: 35px;
}

/* Indication cards (right page) */
.rxp-indic-list {
  margin-bottom: 3px;
  flex: 1;
}

.rxp-indic-card {
  display: flex;
  gap: 4px;
  padding: 2px 4px;
  margin-bottom: 2px;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  background: #fff;
  align-items: flex-start;
}

.rxp-indic-card:nth-child(even) {
  background: #f0fdfa;
}

.rxp-indic-num {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #0a7e8c;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 7pt;
  margin-top: 1px;
}

.rxp-indic-body {
  flex: 1;
  min-width: 0;
}

.rxp-indic-name {
  font-weight: 700;
  font-size: 8.5pt;
  color: #1f2937;
  line-height: 1.2;
}

.rxp-indic-pres {
  font-weight: 400;
  color: #6b7280;
  font-size: 7pt;
}

.rxp-indic-details {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 8px;
  font-size: 8pt;
}

.rxp-indic-details span {
  white-space: nowrap;
}

.rxp-indic-note {
  margin-top: 1px;
  font-size: 7.5pt;
  color: #92400e;
  background: #fffbeb;
  padding: 1px 4px;
  border-radius: 2px;
  border: 1px solid #fde68a;
}

/* Important line (condensed) */
.rxp-important-line {
  margin-top: 3px;
  padding: 2px 6px;
  border: 1px solid #fca5a5;
  border-radius: 3px;
  background: #fef2f2;
  font-size: 7pt;
  color: #7f1d1d;
  line-height: 1.3;
}

/* Shared elements */
.rxp-obs {
  margin: 2px 0;
  padding: 2px 6px;
  background: #f3f4f6;
  border-radius: 3px;
  font-size: 7.5pt;
  border: 1px solid #e5e7eb;
}

.rxp-signature {
  display: flex;
  justify-content: flex-end;
  margin-top: 8px;
}

.rxp-sig-block {
  width: 200px;
  text-align: center;
}

.rxp-sig-space {
  height: 22px;
}

.rxp-sig-line {
  border-top: 1px solid #374151;
  padding-top: 1px;
  text-align: center;
  font-size: 7.5pt;
  font-weight: 600;
  line-height: 1.1;
}

.rxp-sig-line small {
  font-weight: 400;
  font-size: 6.5pt;
  color: #6b7280;
  display: block;
  line-height: 1.1;
  margin: 0;
}

.rxp-footer {
  text-align: center;
  font-size: 7pt;
  color: #9ca3af;
  margin-top: 6px;
}

/* === Responsive adjustments for prescription modal === */
@media (max-width: 768px) {
  .rx-header {
    flex-direction: column;
  }

  .rx-header-info {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }

  .rx-med-details {
    flex-direction: column;
    gap: 4px;
  }

  .medication-row .form-row {
    flex-direction: column;
  }

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

  .rx-print-row {
    flex-direction: column;
    gap: 4px;
  }

  .rx-print-table {
    font-size: 0.75rem;
  }

  .rx-print-table th,
  .rx-print-table td {
    padding: 5px 6px;
  }
}

/* ======================================
   CIE-10 AUTOCOMPLETE
   ====================================== */

.cie10-search-wrapper {
  position: relative;
}

.cie10-input-row {
  display: flex;
  gap: 8px;
}

.cie10-input-row input:first-child {
  flex: 1;
}

.cie10-code-display {
  width: 90px !important;
  text-align: center;
  font-weight: 700;
  color: #065a64 !important;
  background: #f0fdfa !important;
  border: 1px solid #99f6e4 !important;
}

.cie10-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: #fff;
  border: 1px solid #d1d5db;
  border-top: none;
  border-radius: 0 0 8px 8px;
  max-height: 220px;
  overflow-y: auto;
  z-index: 1000;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
}

.cie10-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  cursor: pointer;
  transition: background 0.15s;
  font-size: 0.85rem;
  border-bottom: 1px solid #f3f4f6;
}

.cie10-item:last-child { border-bottom: none; }
.cie10-item:hover, .cie10-item.active {
  background: #ecfdf5;
}

.cie10-code {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  font-size: 0.82rem;
  color: #065a64;
  background: #f0fdfa;
  border: 1px solid #a7f3d0;
  border-radius: 4px;
  padding: 2px 8px;
  white-space: nowrap;
  min-width: 55px;
  text-align: center;
}

.cie10-desc {
  flex: 1;
  color: #374151;
}

.cie10-cat {
  font-size: 0.72rem;
  color: #9ca3af;
  white-space: nowrap;
}

.cie10-no-results {
  padding: 12px;
  text-align: center;
  color: #9ca3af;
  font-size: 0.85rem;
}

.cie10-selected-tag {
  margin-top: 6px;
}

.cie10-tag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, #ecfdf5, #f0fdfa);
  border: 1px solid #6ee7b7;
  border-radius: 6px;
  padding: 5px 10px;
  font-size: 0.85rem;
  color: #065a64;
  margin: 2px;
}

.cie10-tags-container {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.cie10-item-disabled {
  opacity: 0.5;
  cursor: default !important;
  pointer-events: none;
}

.cie10-tag strong {
  font-family: 'JetBrains Mono', monospace;
}

.cie10-tag-remove {
  background: none;
  border: none;
  cursor: pointer;
  color: #ef4444;
  font-size: 0.8rem;
  padding: 2px;
  line-height: 1;
  border-radius: 50%;
  transition: background 0.15s;
}

.cie10-tag-remove:hover {
  background: #fee2e2;
}

.cie10-detail-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, #ecfdf5, #f0fdfa);
  border: 1px solid #6ee7b7;
  border-radius: 6px;
  padding: 4px 12px;
  font-size: 0.85rem;
  color: #065a64;
}

.cie10-detail-badge strong {
  font-family: 'JetBrains Mono', monospace;
}

.cie10-detail-badge i {
  color: #0a7e8c;
}

/* ======================================
   SIGNOS VITALES - FORM SECTION
   ====================================== */

.sv-section {
  background: linear-gradient(135deg, #f0fdfa, #f0f9ff);
  border: 1px solid #99f6e4;
  border-radius: 10px;
  padding: 14px 16px;
  margin: 8px 0 12px;
}

.sv-title {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 700;
  color: #065a64;
  margin: 0 0 10px 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.sv-title i {
  color: #0a7e8c;
  font-size: 1rem;
}

.sv-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 8px;
}

.sv-field {
  display: flex;
  flex-direction: column;
}

.sv-field label {
  font-size: 0.75rem;
  font-weight: 600;
  color: #374151;
  margin-bottom: 3px;
}

.sv-field label small {
  font-weight: 400;
  color: #6b7280;
}

.sv-field input {
  padding: 6px 8px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 0.85rem;
  text-align: center;
  background: #fff;
  transition: border-color 0.2s, box-shadow 0.2s;
  width: 100%;
}

.sv-field input:focus {
  outline: none;
  border-color: #0a7e8c;
  box-shadow: 0 0 0 3px rgba(10, 126, 140, 0.1);
}

.sv-field input[readonly] {
  background: #e5e7eb;
  color: #065a64;
  font-weight: 700;
  cursor: default;
}

/* Signos Vitales - Detail view */
.sv-detail-grid {
  grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)) !important;
  gap: 8px !important;
}

.sv-detail-item {
  background: linear-gradient(135deg, #f0fdfa, #ecfdf5);
  border: 1px solid #a7f3d0;
  border-radius: 8px;
  padding: 8px 10px !important;
  text-align: center;
}

.sv-detail-item .field-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #6b7280;
}

.sv-detail-item .field-value {
  font-size: 1.05rem;
  font-weight: 700;
  color: #065a64;
}

.sv-detail-item .field-value small {
  font-weight: 400;
  font-size: 0.7rem;
  color: #6b7280;
}

@media (max-width: 768px) {
  .sv-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  .sv-detail-grid {
    grid-template-columns: repeat(3, 1fr) !important;
  }
}

/* ======================================
   CLINICAL RECORDS STYLES
   ====================================== */

.clinical-records-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.cr-card {
  background: #fff;
  border-radius: 12px;
  border: 1px solid #e5e7eb;
  overflow: hidden;
  transition: box-shadow 0.2s, border-color 0.2s;
}

.cr-card:hover {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}

.cr-card.cr-urgente {
  border-left: 4px solid #e74c3c;
  background: linear-gradient(to right, #fff5f5, #fff);
}

.cr-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: #f9fafb;
  border-bottom: 1px solid #e5e7eb;
  flex-wrap: wrap;
}

.cr-type-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 12px;
  border-radius: 16px;
  color: #fff;
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
}

.cr-priority {
  font-size: 0.78rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 4px;
}

.cr-card-actions {
  margin-left: auto;
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.cr-card-body {
  padding: 14px 16px;
}

.cr-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: #1f2937;
  margin: 0 0 6px;
}

.cr-description {
  font-size: 0.87rem;
  color: #4b5563;
  line-height: 1.6;
  white-space: pre-wrap;
  margin-bottom: 10px;
  padding: 8px 12px;
  background: #f8fafc;
  border-radius: 8px;
  border-left: 3px solid #e5e7eb;
}

.cr-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  font-size: 0.8rem;
  color: #6b7280;
}

.cr-meta span {
  display: flex;
  align-items: center;
  gap: 5px;
}

.cr-meta i {
  color: #0a7e8c;
  font-size: 0.75rem;
}

/* Print for clinical records */
@media print {
  body.printing-clinical-record * {
    visibility: hidden !important;
  }

  body.printing-clinical-record #clinicalRecordPrintView,
  body.printing-clinical-record #clinicalRecordPrintView * {
    visibility: visible !important;
  }

  body.printing-clinical-record #clinicalRecordPrintView {
    display: block !important;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 999999;
    background: #fff;
  }

  body.printing-clinical-record .rx-print-container {
    max-width: 100%;
    padding: 10px 20px;
  }

  body.printing-clinical-record .rx-print-header,
  body.printing-clinical-record .rx-print-patient-info {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  /* Hide actions in HC print too */
  .cr-card-actions { display: none !important; }
  .cr-card { break-inside: avoid; }
}

@media (max-width: 768px) {
  .cr-card-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }

  .cr-card-actions {
    margin-left: 0;
  }

  .cr-meta {
    flex-direction: column;
    gap: 4px;
  }
}

/* ===== Prescription Frequency Buttons ===== */
.freq-buttons-row {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 8px;
}

.freq-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 10px;
  border-radius: 8px;
  border: 1.5px solid var(--primary);
  background: white;
  color: var(--primary-dark);
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  font-family: var(--font-main);
  white-space: nowrap;
}

.freq-btn:hover {
  background: var(--primary);
  color: white;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(10,126,140,0.25);
}

.freq-btn:active {
  transform: translateY(0);
}

.freq-btn-active {
  background: var(--primary) !important;
  color: white !important;
  box-shadow: 0 2px 8px rgba(10,126,140,0.3);
}

.freq-btn-custom {
  border-color: #e67e22;
  color: #e67e22;
}

.freq-btn-custom:hover {
  background: #e67e22;
  color: white;
  box-shadow: 0 2px 8px rgba(230,126,34,0.25);
}

.freq-custom-input {
  display: flex;
  gap: 6px;
  margin-top: 6px;
  align-items: center;
}

.freq-custom-input input {
  flex: 1;
  padding: 6px 10px;
  border: 1.5px solid #e67e22;
  border-radius: 8px;
  font-size: 0.82rem;
  font-family: var(--font-main);
  outline: none;
  transition: var(--transition);
}

.freq-custom-input input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(10,126,140,0.1);
}

.freq-btn-apply {
  border-color: var(--success);
  color: var(--success);
  padding: 5px 12px;
}

.freq-btn-apply:hover {
  background: var(--success);
  color: white;
  box-shadow: 0 2px 8px rgba(39,174,96,0.25);
}

@media (max-width: 480px) {
  .freq-buttons-row {
    gap: 4px;
  }
  .freq-btn {
    font-size: 0.68rem;
    padding: 4px 7px;
  }
}

/* ===== Treatment Items (Patient Form) ===== */
.treatment-items-list {
  min-height: 20px;
  margin-bottom: 4px;
}

/* ===== Treatment Medication Cards (Patient Form) ===== */
.treatment-med-card {
  background: #f8fffe;
  border: 1.5px solid #b2dfdb;
  border-radius: 10px;
  padding: 10px 14px;
  margin-bottom: 10px;
  transition: var(--transition);
}

.treatment-med-card:hover {
  border-color: var(--primary);
  box-shadow: 0 2px 8px rgba(10,126,140,0.1);
}

.treatment-med-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.treatment-med-num {
  font-weight: 700;
  font-size: 0.82rem;
  color: var(--primary-dark);
  display: flex;
  align-items: center;
  gap: 5px;
}

.treat-form-row {
  display: flex;
  gap: 6px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}

.treat-form-row:last-child {
  margin-bottom: 0;
}

.treat-form-row input,
.treat-form-row select {
  flex: 1;
  min-width: 0;
  padding: 6px 10px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 0.82rem;
  font-family: inherit;
  transition: var(--transition);
  background: white;
}

.treat-form-row input:focus,
.treat-form-row select:focus {
  border-color: var(--primary);
  outline: none;
  box-shadow: 0 0 0 2px rgba(10,126,140,0.15);
}

.treat-form-row .treat-nombre {
  flex: 2;
  min-width: 150px;
}

.treat-form-row .treat-presentacion {
  flex: 1.5;
  min-width: 120px;
}

.treat-form-row .treat-cantidad {
  flex: 0.8;
  min-width: 80px;
}

.treat-form-row .treat-dosis {
  flex: 1;
  min-width: 90px;
}

.treat-form-row .treat-frecuencia {
  flex: 1;
  min-width: 100px;
}

/* Treatment frequency quick-fill buttons */
.treat-freq-wrapper {
  flex: 1.8;
  min-width: 180px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.treat-freq-wrapper .treat-frecuencia {
  flex: none;
  width: 100%;
  padding: 6px 10px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 0.82rem;
  font-family: inherit;
  transition: var(--transition);
  background: white;
}

.treat-freq-wrapper .treat-frecuencia:focus {
  border-color: var(--primary);
  outline: none;
  box-shadow: 0 0 0 2px rgba(10,126,140,0.15);
}

.treat-freq-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
}

.tfreq-btn {
  background: #f0fdfa;
  border: 1px solid #99f6e4;
  color: #0f766e;
  padding: 1px 7px;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  line-height: 1.6;
  font-family: inherit;
  white-space: nowrap;
}

.tfreq-btn:hover {
  background: #0a7e8c;
  color: #fff;
  border-color: #0a7e8c;
}

.tfreq-btn i {
  font-size: 0.6rem;
  margin-right: 1px;
}

.treat-form-row .treat-duracion {
  flex: 0.8;
  min-width: 80px;
}

.treat-form-row .treat-via {
  flex: 0 0 95px;
  min-width: 95px;
}

.treat-form-row .treat-indicaciones {
  flex: 1;
  min-width: 200px;
}

.treat-form-row input::placeholder {
  color: #adb5bd;
  font-size: 0.78rem;
}

.treatment-item-remove {
  background: none;
  border: none;
  color: #e74c3c;
  cursor: pointer;
  font-size: 0.85rem;
  padding: 4px 6px;
  border-radius: 6px;
  transition: var(--transition);
  opacity: 0.5;
}

.treatment-item-remove:hover {
  opacity: 1;
  background: #fee2e2;
}

/* ===== Treatment Items in Prescription Modal ===== */
.rx-treatment-items {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.rx-treat-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: white;
  border: 1.5px solid #b2dfdb;
  border-radius: 8px;
  cursor: pointer;
  transition: var(--transition);
  user-select: none;
}

.rx-treat-item:hover {
  border-color: var(--primary);
  background: #e0f7fa;
  transform: translateX(4px);
  box-shadow: 0 2px 8px rgba(10,126,140,0.15);
}

.rx-treat-item:active {
  transform: translateX(2px);
}

.rx-treat-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  font-size: 0.75rem;
  font-weight: 700;
  flex-shrink: 0;
}

.rx-treat-text {
  flex: 1;
  font-size: 0.85rem;
  color: var(--dark);
  font-weight: 500;
}

.rx-treat-arrow {
  color: var(--primary);
  font-size: 0.8rem;
  opacity: 0;
  transition: var(--transition);
}

.rx-treat-item:hover .rx-treat-arrow {
  opacity: 1;
}

/* ===== Medication Autocomplete Dropdown ===== */
.med-autocomplete-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 9999;
  background: white;
  border: 1.5px solid #b2dfdb;
  border-top: none;
  border-radius: 0 0 10px 10px;
  max-height: 260px;
  overflow-y: auto;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
}

.med-autocomplete-item {
  padding: 8px 12px;
  cursor: pointer;
  border-bottom: 1px solid #f0f0f0;
  transition: background 0.15s;
}

.med-autocomplete-item:last-child {
  border-bottom: none;
}

.med-autocomplete-item:hover {
  background: #e0f7fa;
}

.med-ac-name {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
}

.med-ac-name strong {
  color: var(--dark);
}

.med-ac-atc {
  font-size: 0.7rem;
  color: #888;
  background: #f5f5f5;
  padding: 1px 6px;
  border-radius: 4px;
  font-family: monospace;
}

.med-ac-otc {
  font-size: 0.65rem;
  color: #2e7d32;
  background: #e8f5e9;
  padding: 1px 6px;
  border-radius: 4px;
  font-weight: 600;
}

.med-ac-origen {
  font-size: 0.63rem;
  color: #5d4037;
  background: #efebe9;
  padding: 1px 5px;
  border-radius: 4px;
}

.med-ac-desc {
  font-size: 0.73rem;
  color: #666;
  margin-top: 2px;
}

.med-ac-via {
  font-size: 0.7rem;
  color: var(--primary);
  margin-top: 1px;
}

.med-ac-via i {
  font-size: 0.65rem;
  margin-right: 2px;
}

/* ===== PATIENT PHOTO UPLOAD ===== */
.patient-photo-section {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px;
  margin-bottom: 16px;
  background: linear-gradient(135deg, #f0f9ff, #e0f7fa);
  border-radius: 12px;
  border: 1px solid #bae6fd;
}

.patient-photo-preview {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: #e5e7eb;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
  border: 3px solid #0a7e8c;
}

.patient-photo-preview i {
  font-size: 3rem;
  color: #94a3b8;
}

.patient-photo-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.patient-photo-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* ===== PRESCRIPTION EXAMS SECTION ===== */
.rx-exams-section {
  background: linear-gradient(135deg, #f0f9ff, #ede9fe);
  border-radius: 10px;
  padding: 14px 16px;
  border-left: 4px solid #8e44ad;
}

.rx-exams-grid {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.rx-exam-item {
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}

.rx-exam-item .rx-exam-check {
  border: none;
  border-radius: 0;
  width: 100%;
  padding: 8px 12px;
}

.rx-exam-check {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: #fff;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 500;
  transition: all 0.2s;
}

.rx-exam-check:hover {
  border-color: #8e44ad;
  background: #faf5ff;
}

.rx-exam-check input[type="checkbox"] {
  accent-color: #8e44ad;
  width: 16px;
  height: 16px;
}

.rx-exam-check input[type="checkbox"]:checked + i {
  color: #8e44ad;
}

.rx-exam-check i {
  color: #9ca3af;
  font-size: 0.9rem;
}

.rx-exam-suboptions {
  background: #f8fafc;
  border-top: 1px solid #e5e7eb;
  animation: slideDown 0.2s ease;
}

.rx-exam-sub-label {
  padding: 3px 8px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  transition: all 0.15s;
  user-select: none;
}

.rx-exam-sub-label:hover {
  border-color: #8e44ad;
  background: #faf5ff;
}

.rx-exam-sub-label input[type="checkbox"] {
  accent-color: #8e44ad;
  width: 14px;
  height: 14px;
}

@keyframes slideDown {
  from { opacity: 0; max-height: 0; }
  to { opacity: 1; max-height: 300px; }
}

/* Exams display in prescription card */
.rx-exams-display {
  padding: 10px 14px;
  margin-top: 8px;
  background: #f9fafb;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
}

.rx-exams-title {
  font-size: 0.8rem;
  font-weight: 700;
  color: #065a64;
  margin-bottom: 6px;
}

.rx-exams-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.rx-exam-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 12px;
  color: #fff;
  font-size: 0.75rem;
  font-weight: 600;
}

.rx-exam-badge i {
  font-size: 0.7rem;
}

.rx-exams-details {
  margin-top: 6px;
  font-size: 0.82rem;
  color: #374151;
  font-style: italic;
}

/* ===== PATIENT IMAGES GALLERY ===== */
.patient-images-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px;
}

.img-gallery-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  overflow: hidden;
  transition: all 0.2s;
  position: relative;
}

.img-gallery-card:hover {
  border-color: #0a7e8c;
  box-shadow: 0 4px 12px rgba(10, 126, 140, 0.12);
}

.img-gallery-thumb {
  width: 100%;
  height: 140px;
  background: #f3f4f6;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  overflow: hidden;
}

.img-gallery-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s;
}

.img-gallery-thumb:hover img {
  transform: scale(1.05);
}

.img-gallery-info {
  padding: 8px 10px;
}

.img-type-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 8px;
  border-radius: 10px;
  color: #fff;
  font-size: 0.7rem;
  font-weight: 600;
}

.img-type-badge i {
  font-size: 0.65rem;
}

.img-title {
  font-size: 0.82rem;
  font-weight: 600;
  color: #1f2937;
  margin-top: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.img-meta {
  font-size: 0.72rem;
  color: #9ca3af;
  margin-top: 2px;
}

.img-delete-btn {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(231, 76, 60, 0.85);
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s;
  font-size: 0.75rem;
}

.img-gallery-card:hover .img-delete-btn {
  opacity: 1;
}

.img-delete-btn:hover {
  background: #c0392b;
}

.img-file-input {
  width: 100%;
  padding: 10px;
  border: 2px dashed #d1d5db;
  border-radius: 8px;
  background: #f9fafb;
  cursor: pointer;
  font-size: 0.85rem;
}

.img-file-input:hover {
  border-color: #0a7e8c;
  background: #f0fdfa;
}

/* Image viewer modal */
#imageViewerModal .modal {
  background: transparent !important;
  box-shadow: none !important;
  max-width: 95vw !important;
}

@media (max-width: 768px) {
  .patient-images-gallery {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 8px;
  }

  .img-gallery-thumb {
    height: 100px;
  }

  .rx-exams-grid {
    gap: 6px;
  }

  .rx-exam-check {
    font-size: 0.78rem;
    padding: 4px 8px;
  }

  .patient-photo-section {
    flex-direction: column;
    text-align: center;
  }
}

/* ===== NURSE ROLE RESTRICTIONS ===== */
body.role-enfermeria .sys-sidebar nav a[data-action="export"] {
  display: none !important;
}

/* Patient exams toggle */
.pex-toggle-label {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-weight: 600;
}

.pex-toggle-label input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
  cursor: pointer;
}

.pex-panel {
  margin-top: 8px;
  padding: 12px 14px;
  background: #f5f3ff;
  border: 1.5px solid #c4b5fd;
  border-left: 3px solid #8b5cf6;
  border-radius: 8px;
  animation: fadeIn 0.2s ease;
}

/* ===== PENDING PATIENTS MODAL ===== */
.pending-patient-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  margin-bottom: 8px;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s;
  background: #fff;
}

.pending-patient-card:hover {
  border-color: #0a7e8c;
  background: #f0fdf4;
  box-shadow: 0 2px 8px rgba(10, 126, 140, 0.12);
  transform: translateY(-1px);
}

.pending-patient-main {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
}

.pending-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0a7e8c, #0d9488);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.95rem;
  flex-shrink: 0;
}

.pending-info {
  flex: 1;
}

.pending-name {
  font-weight: 600;
  font-size: 0.95rem;
  color: #1f2937;
  margin-bottom: 3px;
}

.pending-details {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 0.8rem;
  color: #6b7280;
}

.pending-details i {
  color: #9ca3af;
  margin-right: 3px;
}

.pending-vitals {
  font-size: 0.78rem;
  color: #059669;
  margin-top: 3px;
}

.pending-vitals i {
  color: #10b981;
  margin-right: 3px;
}

.pending-date {
  font-size: 0.75rem;
  color: #9ca3af;
  white-space: nowrap;
  margin-left: 12px;
}

.pending-date i {
  margin-right: 3px;
}

#pendingPatientsEmpty {
  text-align: center;
  padding: 40px 20px;
  color: #9ca3af;
}

#pendingPatientsEmpty i {
  font-size: 2.5rem;
  margin-bottom: 12px;
  display: block;
  color: #d1d5db;
}

#pendingPatientsList {
  max-height: 420px;
  overflow-y: auto;
  padding: 4px;
}

.pending-header-info {
  padding: 10px 16px;
  margin-bottom: 10px;
  background: #ecfdf5;
  border-radius: 8px;
  font-size: 0.82rem;
  color: #065f46;
  border: 1px solid #a7f3d0;
}

.pending-header-info i {
  margin-right: 6px;
}

/* ===== EMBARAZO / PREGNANCY CONTROL ===== */
.emb-section {
  margin-top: 14px;
  padding: 14px 16px;
  background: linear-gradient(135deg, #fdf2f8, #fce7f3);
  border: 1.5px solid #f9a8d4;
  border-radius: 12px;
}
.emb-toggle-header {
  display: flex;
  align-items: center;
  gap: 8px;
}
.emb-toggle-label {
  font-weight: 700;
  font-size: 0.95rem;
  color: #be185d;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
}
.emb-toggle-label input[type="checkbox"] {
  accent-color: #e91e8c;
  width: 16px;
  height: 16px;
}
.emb-fields {
  display: none;
  margin-top: 12px;
}
.emb-subsection {
  margin-bottom: 14px;
}
.emb-subtitle {
  font-weight: 700;
  font-size: 0.85rem;
  color: #9d174d;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.emb-doctor-badge {
  background: #8b5cf6;
  color: #fff;
  font-size: 0.65rem;
  padding: 1px 7px;
  border-radius: 8px;
  font-weight: 600;
  letter-spacing: 0.3px;
}
.emb-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 8px 12px;
  margin-bottom: 6px;
}
.emb-row .form-group {
  margin-bottom: 0;
}
.emb-row label {
  font-size: 0.78rem;
  color: #9d174d;
  font-weight: 600;
}
.emb-row input,
.emb-row select,
.emb-row textarea {
  font-size: 0.85rem;
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid #f9a8d4;
  width: 100%;
  background: #fff;
}
.emb-row textarea {
  resize: vertical;
  min-height: 48px;
}

/* Detail view pregnancy */
.emb-detail-section {
  background: linear-gradient(135deg, #fdf2f8, #fce7f3);
  border: 1.5px solid #f9a8d4;
  border-radius: 12px;
  padding: 18px;
}
.emb-detail-section h4 {
  color: #be185d;
}
.emb-detail-grid {
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)) !important;
}
.emb-detail-textblock {
  background: #fff;
  border: 1px solid #f9a8d4;
  border-radius: 8px;
  padding: 10px 14px;
  margin-top: 8px;
  font-size: 0.88rem;
  white-space: pre-wrap;
}

/* Pregnancy controls table */
.emb-controls-table-wrap {
  overflow-x: auto;
  margin-top: 8px;
  border-radius: 10px;
  border: 1px solid #f9a8d4;
}
.emb-controls-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
  min-width: 900px;
}
.emb-controls-table th {
  background: linear-gradient(135deg, #ec4899, #db2777);
  color: #fff;
  padding: 6px 7px;
  text-align: center;
  font-weight: 700;
  font-size: 0.72rem;
  white-space: nowrap;
}
.emb-controls-table td {
  padding: 5px 6px;
  border-bottom: 1px solid #fce7f3;
  text-align: center;
  font-size: 0.78rem;
}
.emb-controls-table tbody tr:nth-child(even) {
  background: #fdf2f8;
}
.emb-controls-table .emb-new-row {
  background: #fffbeb;
}
.emb-controls-table .emb-new-row input {
  font-size: 0.76rem;
  padding: 3px 4px;
  border: 1px solid #f9a8d4;
  border-radius: 6px;
}
.btn-icon-danger {
  background: none;
  border: none;
  color: #e74c3c;
  cursor: pointer;
  font-size: 0.85rem;
  padding: 2px 5px;
  border-radius: 4px;
  transition: background 0.2s;
}
.btn-icon-danger:hover {
  background: #fee2e2;
}

/* ===== CIRUGÍA SEGURA CHECKLIST (CVCS) ===== */
.cvcs-header-info {
  margin-bottom: 14px;
}
.cvcs-header-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 8px;
}
/* Phases */
.cvcs-phase {
  border: 1.5px solid #d1d5db;
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 12px;
  transition: all 0.2s;
}
.cvcs-phase.collapsed .cvcs-phase-body {
  display: none;
}
.cvcs-phase.collapsed .cvcs-chevron {
  transform: rotate(-90deg);
}
.cvcs-phase-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  cursor: pointer;
  font-weight: 700;
  font-size: 0.92rem;
  user-select: none;
}
.cvcs-phase-header small {
  font-weight: 400;
  font-size: 0.75rem;
  opacity: 0.8;
}
.cvcs-chevron {
  font-size: 0.8rem;
  transition: transform 0.2s;
}
.cvcs-ph-entrada {
  background: linear-gradient(135deg, #0d9488, #14b8a6);
  color: #fff;
  border-bottom: 2px solid #0f766e;
}
.cvcs-ph-pausa {
  background: linear-gradient(135deg, #2563eb, #3b82f6);
  color: #fff;
  border-bottom: 2px solid #1d4ed8;
}
.cvcs-ph-salida {
  background: linear-gradient(135deg, #7c3aed, #8b5cf6);
  color: #fff;
  border-bottom: 2px solid #6d28d9;
}
.cvcs-phase-body {
  padding: 12px 14px;
  background: #f9fafb;
}
/* Fieldsets */
.cvcs-group {
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 8px 12px 10px;
  margin-bottom: 8px;
  background: #fff;
}
.cvcs-group legend {
  font-weight: 600;
  font-size: 0.82rem;
  color: #374151;
  padding: 0 6px;
}
.cvcs-checks-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 4px;
}
.cvcs-radio-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.82rem;
  padding: 3px 0;
  border-bottom: 0.5px dotted #e5e7eb;
}
.cvcs-radio-label:last-child {
  border-bottom: none;
}
.cvcs-radio-pair {
  display: inline-flex;
  gap: 10px;
  white-space: nowrap;
}
.cvcs-radio-pair label,
.cvcs-radio-pair-wide label {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 0.8rem;
  cursor: pointer;
  font-weight: 500;
}
.cvcs-radio-pair-wide {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  padding: 4px 0;
}
.cvcs-radio-pair input[type="radio"],
.cvcs-radio-pair-wide input[type="radio"] {
  accent-color: #0d9488;
  margin: 0;
}
/* Inline fields */
.cvcs-inline-fields {
  display: flex;
  gap: 12px;
  margin-bottom: 8px;
}
.cvcs-inline-fields .form-group {
  flex: 1;
}
/* Muestras grid */
.cvcs-muestras-grid {
  display: grid;
  gap: 6px;
}
.cvcs-muestras-grid > div {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  flex-wrap: wrap;
}
.cvcs-muestras-grid label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 500;
  white-space: nowrap;
}
.cvcs-muestras-grid input[type="checkbox"] {
  accent-color: #7c3aed;
}
.cvcs-mini-input {
  width: 50px !important;
  font-size: 0.8rem;
  padding: 3px 6px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
}
.cvcs-med-input {
  width: 130px;
  font-size: 0.8rem;
  padding: 3px 6px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
}
/* Firmas */
.cvcs-firmas {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 2px solid #e5e7eb;
}
.cvcs-firmas-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
}
/* Cards in detail view */
.cvcs-detail-section h4 {
  color: #0f766e;
}
.cvcs-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.cvcs-card {
  background: #fff;
  border: 1.5px solid #99f6e4;
  border-radius: 10px;
  padding: 12px 14px;
  transition: box-shadow 0.2s;
}
.cvcs-card:hover {
  box-shadow: 0 2px 12px rgba(13,148,136,0.12);
}
.cvcs-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}
.cvcs-card-header strong {
  font-size: 0.92rem;
  color: #0f766e;
}
.cvcs-card-meta {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 4px;
  font-size: 0.78rem;
  color: #6b7280;
}
.cvcs-card-meta i {
  margin-right: 3px;
  color: #0d9488;
}
.cvcs-card-actions {
  display: flex;
  gap: 5px;
  flex-shrink: 0;
}
.cvcs-card-phases {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}
.cvcs-phase-badge {
  font-size: 0.72rem;
  padding: 2px 10px;
  border-radius: 12px;
  font-weight: 600;
}
.cvcs-badge-entrada {
  background: #ccfbf1;
  color: #0f766e;
}
.cvcs-badge-pausa {
  background: #dbeafe;
  color: #1d4ed8;
}
.cvcs-badge-salida {
  background: #ede9fe;
  color: #6d28d9;
}
@media (max-width: 768px) {
  .cvcs-header-row { grid-template-columns: 1fr; }
  .cvcs-firmas-grid { grid-template-columns: 1fr; }
  .cvcs-inline-fields { flex-direction: column; }
  .cvcs-card-header { flex-direction: column; }
}
/* ===== PROTOCOLO OPERATORIO ===== */
.pop-section { margin-bottom: 18px; }
.pop-section-title {
  font-weight: 700; font-size: 1rem; color: #7c3aed;
  margin-bottom: 8px; display: flex; align-items: center; gap: 6px;
  border-bottom: 2px solid #ede9fe; padding-bottom: 4px;
}
.pop-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pop-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
.pop-cards { display: flex; flex-direction: column; gap: 10px; }
.pop-card {
  border: 1px solid #e5e7eb; border-radius: 10px;
  overflow: hidden; background: #fff;
  box-shadow: 0 1px 4px rgba(124,58,237,.08);
}
.pop-card-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 14px; background: linear-gradient(135deg, #f5f3ff, #ede9fe);
  border-bottom: 1px solid #e5e7eb;
}
.pop-card-header strong { color: #5b21b6; font-size: 0.95rem; }
.pop-card-date {
  display: inline-block; margin-left: 10px; font-size: 0.82rem;
  color: #7c3aed; background: #ede9fe; padding: 2px 8px; border-radius: 8px;
}
.pop-card-cir {
  display: inline-block; margin-left: 8px; font-size: 0.82rem; color: #6b7280;
}
.pop-card-body { padding: 8px 14px; display: flex; flex-wrap: wrap; gap: 6px; }
.pop-tag {
  display: inline-block; font-size: 0.82rem; background: #f9fafb;
  border: 1px solid #e5e7eb; border-radius: 6px; padding: 2px 8px;
}
.pop-detail-section { }
@media (max-width: 768px) {
  .pop-grid-2 { grid-template-columns: 1fr; }
  .pop-grid-3 { grid-template-columns: 1fr; }
  .pop-card-header { flex-direction: column; gap: 6px; }
}
/* ===== SOLICITUD COMPONENTES SANGUÍNEOS ===== */
.scs-section { margin-bottom: 18px; }
.scs-section-title {
  font-weight: 700; font-size: 1rem; color: #dc2626;
  margin-bottom: 8px; display: flex; align-items: center; gap: 6px;
  border-bottom: 2px solid #fecaca; padding-bottom: 4px;
}
.scs-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.scs-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
.scs-grid-4 { display: grid; grid-template-columns: 1fr 1fr 1fr 1fr; gap: 10px; }
.scs-span-2 { grid-column: span 2; }
.scs-comp-col { }
.scs-comp-table {
  width: 100%; border-collapse: collapse; font-size: 0.82rem;
}
.scs-comp-table th {
  background: #fef2f2; color: #991b1b; font-size: 0.78rem;
  padding: 4px 6px; border: 1px solid #fecaca; text-align: left;
}
.scs-comp-table td {
  padding: 3px 4px; border: 1px solid #fecaca; vertical-align: middle;
}
.scs-comp-table td small { color: #9ca3af; }
.scs-comp-table input[type="number"],
.scs-comp-table input[type="text"] {
  width: 100%; padding: 2px 4px; border: 1px solid #e5e7eb; border-radius: 4px;
  font-size: 0.82rem;
}
.scs-cards { display: flex; flex-direction: column; gap: 10px; }
.scs-card {
  border: 1px solid #fecaca; border-radius: 10px; overflow: hidden;
  background: #fff; box-shadow: 0 1px 4px rgba(220,38,38,.08);
}
.scs-card-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 14px; background: linear-gradient(135deg, #fef2f2, #fecaca);
  border-bottom: 1px solid #fecaca;
}
.scs-card-header strong { color: #991b1b; font-size: 0.95rem; }
.scs-card-date {
  display: inline-block; margin-left: 10px; font-size: 0.82rem;
  color: #dc2626; background: #fef2f2; padding: 2px 8px; border-radius: 8px;
}
.scs-card-prio {
  display: inline-block; margin-left: 8px; font-size: 0.75rem; font-weight: 700;
  padding: 2px 8px; border-radius: 8px;
}
.scs-prio-emergencia { background: #dc2626; color: #fff; }
.scs-prio-urgencia { background: #f59e0b; color: #fff; }
.scs-prio-rutina { background: #10b981; color: #fff; }
.scs-prio-alistar { background: #6366f1; color: #fff; }
.scs-card-body { padding: 8px 14px; display: flex; flex-wrap: wrap; gap: 6px; }
.scs-tag {
  display: inline-block; font-size: 0.82rem; background: #fef2f2;
  border: 1px solid #fecaca; border-radius: 6px; padding: 2px 8px;
}
@media (max-width: 768px) {
  .scs-grid-2, .scs-grid-3, .scs-grid-4 { grid-template-columns: 1fr; }
  .scs-card-header { flex-direction: column; gap: 6px; }
  .scs-span-2 { grid-column: span 1; }
}

/* ===== CONTROL HOSPITALARIO ===== */
.ch-section { margin-bottom: 16px; }
.ch-section-title {
  font-weight: 700; font-size: 0.9rem; color: #0891b2;
  border-bottom: 2px solid #06b6d4; padding-bottom: 4px; margin-bottom: 10px;
  display: flex; align-items: center; gap: 6px;
}
.ch-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 8px; }
.ch-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; margin-bottom: 8px; }
.ch-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.ch-table th { background: linear-gradient(135deg, #0891b2, #06b6d4); color: #fff; padding: 8px 6px; font-size: 0.8rem; text-align: center; }
.ch-table td { padding: 6px; border-bottom: 1px solid #e5e7eb; text-align: center; font-size: 0.82rem; }
.ch-table tbody tr:hover { background: #f0fdfa; }
.ch-turno-badge {
  display: inline-block; padding: 2px 8px; border-radius: 10px;
  font-size: 0.75rem; font-weight: 700;
}
.ch-turno-M { background: #fef3c7; color: #92400e; }
.ch-turno-T { background: #dbeafe; color: #1e40af; }
.ch-turno-N { background: #e0e7ff; color: #3730a3; }
.ch-detail-section { border-left: 4px solid #06b6d4; }

/* ===== ADMIN MEDICAMENTOS HOSP ===== */
.adm-detail-section { border-left: 4px solid #10b981; }
.adm-card {
  background: #fff; border: 1px solid #d1fae5; border-radius: 10px;
  margin-bottom: 10px; overflow: hidden; transition: box-shadow 0.2s;
}
.adm-card:hover { box-shadow: 0 2px 10px rgba(16,185,129,0.12); }
.adm-card-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 14px; background: linear-gradient(135deg, #ecfdf5, #d1fae5);
  gap: 8px;
}
.adm-via-badge {
  display: inline-block; background: #059669; color: #fff;
  padding: 1px 6px; border-radius: 6px; font-size: 0.75rem; font-weight: 600;
}
.adm-history { padding: 0 12px 10px; }
.adm-table { width: 100%; border-collapse: collapse; font-size: 0.8rem; }
.adm-table th {
  background: #ecfdf5; color: #065f46; padding: 4px 8px;
  font-size: 0.75rem; text-align: center; border-bottom: 2px solid #a7f3d0;
}
.adm-table td { padding: 4px 8px; border-bottom: 1px solid #e5e7eb; text-align: center; font-size: 0.8rem; }
.adm-table tbody tr:hover { background: #f0fdf4; }
@media (max-width: 768px) {
  .ch-grid-2, .ch-grid-3 { grid-template-columns: 1fr; }
  .adm-card-header { flex-direction: column; align-items: flex-start; }
}

/* ===== CONSENTIMIENTO INFORMADO CIRUGÍA ===== */
.cc-section { margin-bottom: 16px; }
.cc-section-title {
  font-weight: 700; font-size: 0.9rem; color: #b45309;
  border-bottom: 2px solid #d97706; padding-bottom: 4px; margin-bottom: 10px;
  display: flex; align-items: center; gap: 6px;
}
.cc-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 8px; }
.cc-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; margin-bottom: 8px; }
.cc-grid-4 { display: grid; grid-template-columns: 1fr 1fr 1fr 1fr; gap: 10px; margin-bottom: 8px; }
.cc-detail-section { border-left: 4px solid #d97706; }
.cc-card {
  background: #fff; border: 1px solid #fed7aa; border-radius: 10px;
  margin-bottom: 10px; overflow: hidden; transition: box-shadow 0.2s;
}
.cc-card:hover { box-shadow: 0 2px 10px rgba(180,83,9,0.12); }
.cc-card-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 14px; background: linear-gradient(135deg, #fffbeb, #fef3c7);
  gap: 8px;
}
.cc-tipo-badge {
  display: inline-block; background: #b45309; color: #fff;
  padding: 1px 8px; border-radius: 6px; font-size: 0.72rem; font-weight: 600;
}
.cc-alert {
  background: #fffbeb; border: 1px solid #f59e0b; border-radius: 8px;
  padding: 10px 14px; font-size: 0.85rem; color: #92400e; margin-bottom: 12px;
  display: flex; align-items: center; gap: 8px; font-weight: 500;
}
.cc-consent-list { display: flex; flex-direction: column; gap: 6px; }
.cc-consent-item {
  display: flex; align-items: flex-start; gap: 8px; padding: 6px 10px;
  background: #fefce8; border: 1px solid #fef08a; border-radius: 8px;
  font-size: 0.85rem; cursor: pointer; transition: background 0.2s;
}
.cc-consent-item:hover { background: #fef9c3; }
.cc-consent-item input[type="checkbox"] { margin-top: 3px; accent-color: #b45309; transform: scale(1.15); }
/* Collapsible sections */
.cc-collapsible .cc-collapse-body { display: none; }
.cc-collapsible.cc-open .cc-collapse-body { display: block; }
.cc-toggle { cursor: pointer; user-select: none; }
.cc-chevron { margin-left: auto; transition: transform 0.3s; font-size: 0.75rem; }
.cc-collapsible.cc-open .cc-chevron { transform: rotate(180deg); }
@media (max-width: 768px) {
  .cc-grid-2, .cc-grid-3, .cc-grid-4 { grid-template-columns: 1fr; }
  .cc-card-header { flex-direction: column; gap: 6px; }
}

/* ===== DETAIL TABS REDESIGN ===== */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}
.detail-layout {
  display: flex;
  gap: 0;
  min-height: 70vh;
  position: relative;
}
.detail-sidebar {
  width: 280px;
  flex-shrink: 0;
  background: var(--light);
  border-right: 1px solid var(--gray-light);
  padding: 24px 18px;
  overflow-y: auto;
  transition: width 0.3s ease, padding 0.3s ease, opacity 0.3s ease;
}
/* Sidebar collapse toggle */
.sidebar-toggle-btn {
  position: absolute;
  top: 12px;
  left: 268px;
  z-index: 20;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid var(--gray-light);
  background: #fff;
  color: var(--gray);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
  transition: all 0.3s ease;
}
.sidebar-toggle-btn:hover {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.detail-layout.sidebar-collapsed .detail-sidebar {
  width: 0;
  min-width: 0;
  padding: 0;
  overflow: hidden;
  opacity: 0;
  border-right: none;
}
.detail-layout.sidebar-collapsed .sidebar-toggle-btn {
  left: 8px;
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  width: 36px;
  height: 36px;
  font-size: 0.85rem;
  box-shadow: 0 4px 12px rgba(10,126,140,0.3);
}
.detail-sidebar .sid-photo {
  text-align: center;
  margin-bottom: 16px;
}
.detail-sidebar .sid-photo .avatar {
  width: 80px; height: 80px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  font-weight: 700;
  box-shadow: 0 4px 15px rgba(0,0,0,0.15);
}
.detail-sidebar .sid-name {
  text-align: center;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.1rem;
  color: var(--dark);
  margin-bottom: 2px;
}
.detail-sidebar .sid-hc {
  text-align: center;
  font-size: 0.78rem;
  color: var(--gray);
  margin-bottom: 16px;
}
.detail-sidebar .sid-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
  margin-bottom: 16px;
}
.detail-sidebar .sid-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 20px;
  background: var(--primary);
  color: #fff;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.detail-sidebar .sid-badge.badge-alert {
  background: #e74c3c;
}
.detail-sidebar .sid-badge.badge-blood {
  background: #9b59b6;
}
.sid-section {
  margin-bottom: 14px;
}
.sid-section-title {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--gray);
  font-weight: 700;
  margin-bottom: 6px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--gray-light);
}
.sid-field {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 4px 0;
  font-size: 0.82rem;
  border-bottom: 1px dotted rgba(0,0,0,0.06);
}
.sid-field:last-child { border-bottom: none; }
.sid-field .sid-label {
  color: var(--gray);
  font-weight: 500;
  font-size: 0.75rem;
}
.sid-field .sid-val {
  font-weight: 600;
  color: var(--dark);
  text-align: right;
  max-width: 55%;
  word-break: break-word;
}
.sid-actions {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.sid-actions .btn { font-size: 0.78rem; border-radius: 8px; }

/* SV mini grid in sidebar */
.sid-sv-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
.sid-sv-item {
  background: #fff;
  border-radius: 8px;
  padding: 6px 8px;
  text-align: center;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.sid-sv-item .sv-lbl {
  font-size: 0.6rem;
  text-transform: uppercase;
  color: var(--gray);
  font-weight: 600;
}
.sid-sv-item .sv-val {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--primary-dark);
}
.sid-sv-item .sv-unit {
  font-size: 0.6rem;
  color: var(--gray);
}

.sid-antec {
  margin-bottom: 6px;
}
.sid-antec-label {
  display: block;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--dark);
  margin-bottom: 2px;
}
.sid-antec-label i { margin-right: 4px; font-size: 0.65rem; }
.sid-antec-val {
  display: block;
  font-size: 0.78rem;
  color: var(--gray-dark, #4b5563);
  background: #fff;
  border-radius: 6px;
  padding: 4px 8px;
  line-height: 1.3;
  word-break: break-word;
}

/* Sidebar clinical alerts */
.sid-alerts-section {
  background: linear-gradient(135deg, #fef2f2, #fff1f2) !important;
  border: 1px solid #fecaca !important;
  border-radius: 10px !important;
  padding: 10px !important;
}
.sid-alert {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 8px;
  margin-bottom: 4px;
  font-size: 0.78rem;
}
.sid-alert:last-child { margin-bottom: 0; }
.sid-alert i { font-size: 0.85rem; flex-shrink: 0; }
.sid-alert-content { display: flex; flex-direction: column; }
.sid-alert-label { font-weight: 600; color: #1f2937; line-height: 1.2; }
.sid-alert-val { font-size: 0.72rem; color: #6b7280; }
.sid-alert-warning {
  background: #fffbeb;
  border: 1px solid #fde68a;
}
.sid-alert-critical {
  background: #fef2f2;
  border: 1px solid #fca5a5;
  animation: alertPulse 2s ease-in-out infinite;
}
@keyframes alertPulse {
  0%, 100% { box-shadow: none; }
  50% { box-shadow: 0 0 0 2px rgba(220, 38, 38, 0.2); }
}

/* SV summary cards in detail tab */
.sv-summary-item {
  background: linear-gradient(135deg, #f0fdfa, #e0f7f5);
  border-radius: 10px;
  padding: 10px 12px;
  text-align: center;
  border: 1px solid #ccfbf1;
  transition: transform 0.15s;
}
.sv-summary-item:hover { transform: translateY(-2px); }
.sv-summary-label {
  font-size: 0.68rem;
  text-transform: uppercase;
  font-weight: 700;
  color: #0d9488;
  letter-spacing: 0.3px;
  margin-bottom: 2px;
}
.sv-summary-value {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--primary-dark);
}
.sv-summary-value small {
  font-size: 0.65rem;
  font-weight: 500;
  color: var(--gray);
}

/* Main content area */
.detail-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* Tabs nav */
.detail-tabs-nav {
  display: flex;
  background: #f8f9fa;
  border-bottom: 2px solid var(--gray-light);
  overflow-x: auto;
  scrollbar-width: none;
  flex-shrink: 0;
}
.detail-tabs-nav::-webkit-scrollbar { display: none; }
.dtab {
  padding: 12px 20px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--gray);
  cursor: pointer;
  white-space: nowrap;
  border-bottom: 3px solid transparent;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 6px;
  user-select: none;
}
.dtab:hover { color: var(--primary); background: rgba(0,0,0,0.02); }
.dtab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  background: #fff;
}
.dtab .dtab-count {
  background: var(--gray-light);
  color: var(--gray);
  font-size: 0.65rem;
  padding: 1px 6px;
  border-radius: 10px;
  font-weight: 700;
}
.dtab.active .dtab-count {
  background: var(--primary);
  color: #fff;
}

/* Tab content */
.detail-tab-content {
  flex: 1;
  padding: 24px;
  overflow-y: auto;
}
.detail-tab-pane {
  display: none;
}
.detail-tab-pane.active {
  display: block;
  animation: fadeIn 0.2s ease;
}

/* Collapsible detail sections */
.dsec {
  margin-bottom: 18px;
  border: 1px solid var(--gray-light);
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
}
.dsec-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  cursor: pointer;
  user-select: none;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.92rem;
  color: var(--primary-dark);
  background: var(--light);
  transition: background 0.2s;
}
.dsec-header:hover { background: #e8ecf1; }
.dsec-header i.dsec-icon { font-size: 1rem; width: 20px; text-align: center; }
.dsec-header .dsec-chevron {
  margin-left: auto;
  transition: transform 0.3s;
  font-size: 0.7rem;
  color: var(--gray);
}
.dsec.open .dsec-chevron { transform: rotate(180deg); }
.dsec-header .dsec-actions {
  margin-left: auto;
  display: flex;
  gap: 6px;
}
.dsec-body {
  display: none;
  padding: 18px;
  border-top: 1px solid var(--gray-light);
}
.dsec.open .dsec-body { display: block; }

/* Clinical info card */
.clin-card {
  background: var(--light);
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 12px;
}
.clin-card-title {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--gray);
  font-weight: 700;
  margin-bottom: 6px;
}
.clin-card-body {
  font-size: 0.92rem;
  color: var(--dark);
  font-weight: 500;
  white-space: pre-wrap;
  line-height: 1.5;
}
.clin-card.alert-card {
  background: #fff3cd;
  border: 1px solid #ffc107;
}
.clin-card.alert-card .clin-card-body { color: #856404; font-weight: 600; }

/* Emergency contact card */
.emerg-card {
  background: linear-gradient(135deg, #fee2e2, #fecaca);
  border: 1px solid #fca5a5;
  border-radius: 10px;
  padding: 14px 16px;
}
.emerg-card .emerg-title {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: #b91c1c;
  font-weight: 700;
  margin-bottom: 6px;
}

/* Responsive: collapse sidebar on mobile */
@media (max-width: 900px) {
  .detail-layout {
    flex-direction: column;
  }
  .detail-sidebar {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--gray-light);
    padding: 16px;
    max-height: none;
  }
  .sid-sv-grid { grid-template-columns: repeat(4, 1fr); }
  .detail-tab-content { padding: 16px; }
  .dtab { padding: 10px 14px; font-size: 0.78rem; }
}
@media (max-width: 600px) {
  .sid-sv-grid { grid-template-columns: 1fr 1fr; }
  .detail-tab-content { padding: 12px; }
  .dsec-header { padding: 10px 14px; font-size: 0.85rem; }
  .dsec-body { padding: 12px; }
}

/* ===== AVATAR DROPDOWN ===== */
.avatar-dropdown-wrap {
  position: relative;
}
.user-avatar {
  cursor: pointer;
  position: relative;
  overflow: hidden;
}
.avatar-dropdown {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 260px;
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.18), 0 0 0 1px rgba(0,0,0,0.04);
  z-index: 9999;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px) scale(0.97);
  transition: all 0.2s cubic-bezier(.4,0,.2,1);
  overflow: hidden;
}
.avatar-dropdown.avd-open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}
.avd-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #fff;
}
.avd-header strong {
  display: block;
  font-size: 0.88rem;
  font-weight: 700;
}
.avd-header small {
  font-size: 0.72rem;
  opacity: 0.85;
}
.avd-photo {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1rem;
  flex-shrink: 0;
  overflow: hidden;
}
.avd-divider {
  height: 1px;
  background: #f0f0f0;
  margin: 0;
}
.avatar-dropdown a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  font-size: 0.82rem;
  color: var(--text);
  text-decoration: none;
  transition: background 0.15s;
}
.avatar-dropdown a:hover {
  background: #f0f9ff;
}
.avatar-dropdown a i {
  width: 18px;
  text-align: center;
  color: var(--primary);
  font-size: 0.85rem;
}

/* ===== ADMIN PANEL ===== */
.admin-tabs {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin-bottom: 20px;
  background: #f8fafc;
  padding: 6px;
  border-radius: 14px;
  border: 1px solid #e5e7eb;
}
.adm-tab {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  border: none;
  background: none;
  border-radius: 10px;
  font-size: 0.82rem;
  font-weight: 600;
  color: #6b7280;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}
.adm-tab:hover { background: #e0f2fe; color: var(--primary); }
.adm-tab.active {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 2px 8px rgba(10,126,140,0.25);
}
.adm-tab i { font-size: 0.9rem; }
.admin-tab-content { animation: fadeIn 0.3s ease; }

.adm-card {
  background: #fff;
  border-radius: 14px;
  border: 1px solid #e5e7eb;
  padding: 24px;
  margin-bottom: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.adm-card h3 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.adm-card h3 i { color: var(--primary); }

/* Profile Grid */
.adm-profile-grid {
  display: flex;
  gap: 32px;
  align-items: flex-start;
}
.adm-profile-photo-area {
  display: flex;
  flex-direction: column;
  align-items: center;
}
.adm-avatar-big {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.2rem;
  font-weight: 700;
  color: #fff;
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(10,126,140,0.3);
}
.adm-avatar-big img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}
.adm-profile-info { flex: 1; }
.adm-info-row {
  display: flex;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid #f0f0f0;
}
.adm-info-row label {
  font-weight: 600;
  color: var(--gray);
  font-size: 0.82rem;
  width: 100px;
  flex-shrink: 0;
}
.adm-info-row span {
  font-size: 0.9rem;
  font-weight: 500;
}

/* Users Grid */
.adm-users-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.adm-user-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  background: #f8fafc;
  border-radius: 12px;
  border: 1px solid #e5e7eb;
  transition: all 0.2s;
}
.adm-user-card:hover {
  border-color: var(--primary-light);
  box-shadow: 0 2px 8px rgba(10,126,140,0.08);
}
.adm-user-inactive { opacity: 0.55; }
.adm-user-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 1.1rem;
  flex-shrink: 0;
  overflow: hidden;
}
.adm-user-info {
  flex: 1;
  min-width: 0;
}
.adm-user-info strong {
  display: block;
  font-size: 0.88rem;
}
.adm-user-info small {
  display: block;
  margin-top: 2px;
}
.adm-role-badge {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
  color: #fff;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.adm-user-actions {
  display: flex;
  gap: 6px;
}

/* Permissions */
.adm-perm-group {
  margin-bottom: 20px;
  background: #fff;
  border-radius: 12px;
  padding: 16px;
  border: 1px solid #e5e7eb;
}
.adm-perm-group h4 {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--primary-dark);
  margin: 0 0 10px;
  padding-bottom: 8px;
  border-bottom: 2px solid #e5e7eb;
  display: flex;
  align-items: center;
  text-transform: uppercase;
  letter-spacing: 0.8px;
}
.adm-perm-items {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 8px;
}
.adm-perm-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 10px;
  border: 1px solid #e5e7eb;
  background: #f8fafc;
  font-size: 0.82rem;
  cursor: pointer;
  transition: all 0.2s;
}
.adm-perm-item:hover { border-color: var(--primary-light); }
.adm-perm-active {
  background: #e0f9f1;
  border-color: #6ee7b7;
}
.adm-perm-inherited {
  border-style: dashed;
}
.adm-perm-item input[type="checkbox"] { accent-color: var(--primary); }
.adm-perm-item i { color: var(--primary); width: 16px; text-align: center; }

/* Tasks */
.adm-task-card {
  padding: 14px 18px;
  background: #f8fafc;
  border-radius: 12px;
  border: 1px solid #e5e7eb;
  margin-bottom: 10px;
  transition: all 0.2s;
}
.adm-task-card:hover {
  border-color: var(--primary-light);
}
.adm-task-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}
.adm-task-status {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 12px;
  color: #fff;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Audit Table */
.adm-audit-table {
  overflow-x: auto;
  border-radius: 10px;
  border: 1px solid #e5e7eb;
}
.adm-audit-table table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}
.adm-audit-table th {
  background: #f0f9ff;
  font-weight: 700;
  text-align: left;
  padding: 10px 14px;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--primary-dark);
  border-bottom: 2px solid #e5e7eb;
}
.adm-audit-table td {
  padding: 8px 14px;
  border-bottom: 1px solid #f0f0f0;
}
.adm-audit-table tr:hover { background: #f8fafc; }
.adm-audit-action {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 6px;
  background: #e0f2fe;
  color: var(--primary-dark);
}

/* Reports */
.adm-report-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.adm-report-stat {
  text-align: center;
  padding: 16px;
  background: linear-gradient(135deg, #f0f9ff, #e0f9f1);
  border-radius: 12px;
  border: 1px solid #e5e7eb;
}
.adm-report-stat i {
  font-size: 1.4rem;
  color: var(--primary);
  display: block;
  margin-bottom: 6px;
}
.adm-report-stat span {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--text);
  display: block;
}
.adm-report-stat small {
  font-size: 0.72rem;
  color: var(--gray);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.adm-report-user-card {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px;
  background: #f8fafc;
  border-radius: 12px;
  border: 1px solid #e5e7eb;
}

/* Admin responsive */
@media (max-width: 768px) {
  .adm-profile-grid { flex-direction: column; align-items: center; text-align: center; }
  .adm-info-row { flex-direction: column; gap: 2px; }
  .adm-info-row label { width: auto; }
  .admin-tabs { gap: 2px; padding: 4px; }
  .adm-tab { padding: 8px 12px; font-size: 0.75rem; }
  .adm-tab span { display: none; }
  .adm-perm-items { grid-template-columns: 1fr; }
  .adm-card { padding: 16px; }
  .adm-report-summary { grid-template-columns: repeat(2, 1fr); }
  .avatar-dropdown { width: 240px; right: -10px; }
  .adm-user-card { flex-wrap: wrap; gap: 10px; padding: 12px; }
  .adm-user-info { flex: 1; min-width: 120px; }
  .adm-user-actions { width: 100%; display: flex; justify-content: flex-end; gap: 6px; }
  .adm-task-card { padding: 12px; }
  .adm-task-header { flex-direction: column; align-items: flex-start; gap: 6px; }
  .adm-report-user-card { flex-direction: column; align-items: center; text-align: center; }
  .adm-audit-table th, .adm-audit-table td { padding: 6px 8px; font-size: 0.75rem; }
  .ch-table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .scs-comp-table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .sys-topbar .user-avatar { width: 48px; height: 48px; min-width: 48px; font-size: 1.1rem; }
}

@media (max-width: 480px) {
  .admin-tabs { gap: 1px; padding: 3px; border-radius: 10px; }
  .adm-tab { padding: 8px 10px; min-height: 40px; }
  .adm-tab i { font-size: 1rem; }
  .adm-users-grid { gap: 8px; }
  .adm-user-card { padding: 10px; }
  .adm-user-avatar { width: 36px; height: 36px; font-size: 0.85rem; }
  .adm-perm-group { padding: 12px; }
  .adm-perm-item { padding: 6px 10px; font-size: 0.78rem; }
  .adm-report-summary { grid-template-columns: 1fr 1fr; gap: 8px; }
  .adm-report-stat { padding: 12px; }
  .adm-card { padding: 12px; border-radius: 10px; }
  .adm-card h3 { font-size: 0.95rem; }
  .avatar-dropdown { width: calc(100vw - 20px); right: -60px; max-width: 280px; }
  .avd-header { padding: 14px; }
  .modal { margin: 6px; border-radius: 12px; }
  .modal-body { padding: 14px; }
  .modal-header { padding: 14px; }
  .modal-footer { padding: 10px 14px; }
  .dash-welcome-banner { padding: 16px; }
  .dash-welcome-text h2 { font-size: 1rem; }
  .dash-welcome-icon { font-size: 1.5rem; right: 10%; }
  .sys-topbar .user-avatar { width: 42px; height: 42px; min-width: 42px; font-size: 1rem; }
}

/* ===== TAB NAVIGATION ARROWS ===== */
.tab-nav-arrows {
  display: flex;
  justify-content: space-between;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.tab-nav-arrows .tab-nav-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}
.tab-nav-arrows .tab-nav-btn:hover {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(37,99,235,0.2);
}

/* ===== TRIAJE CLASSIFICATION COLORS ===== */
.triaje-badge-1 { background: #dc2626; color: #fff; }
.triaje-badge-2 { background: #f97316; color: #fff; }
.triaje-badge-3 { background: #eab308; color: #000; }
.triaje-badge-4 { background: #22c55e; color: #fff; }
.triaje-badge-5 { background: #3b82f6; color: #fff; }

/* ===== AUTOSAVE INDICATOR ===== */
.modal-footer .autosave-indicator {
  flex: 1;
  text-align: left;
}
.modal-footer {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ===== TIMELINE ===== */
.tl-container {
  position: relative;
  padding-left: 32px;
}
.tl-container::before {
  content: '';
  position: absolute;
  left: 11px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: linear-gradient(180deg, var(--primary) 0%, #cbd5e1 100%);
}
.tl-item {
  position: relative;
  margin-bottom: 18px;
  animation: tlFadeIn 0.3s ease;
}
@keyframes tlFadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.tl-item::before {
  content: '';
  position: absolute;
  left: -27px;
  top: 18px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #94a3b8;
  border: 2px solid #fff;
  box-shadow: 0 0 0 2px #cbd5e1;
  z-index: 1;
}
.tl-item:first-child::before {
  background: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.2);
  width: 14px;
  height: 14px;
  left: -28px;
  top: 17px;
}
.tl-item.tl-triaje::before { background: #dc2626; box-shadow: 0 0 0 2px #fecaca; }
.tl-item.tl-nota::before { background: #8b5cf6; box-shadow: 0 0 0 2px #ede9fe; }
.tl-item.tl-receta::before { background: #0891b2; box-shadow: 0 0 0 2px #cffafe; }
.tl-item.tl-registro::before { background: #059669; box-shadow: 0 0 0 2px #d1fae5; }
.tl-item.tl-lab::before { background: #0d9488; box-shadow: 0 0 0 2px #ccfbf1; }
.tl-item.tl-referencia::before { background: #7c3aed; box-shadow: 0 0 0 2px #ede9fe; }
.tl-item.tl-certificado::before { background: #059669; box-shadow: 0 0 0 2px #d1fae5; }
.tl-item.tl-cirugia::before { background: #be185d; box-shadow: 0 0 0 2px #fce7f3; }

.tl-date {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  color: #64748b;
  font-weight: 600;
  margin-bottom: 6px;
  flex-wrap: wrap;
}
.tl-date i { font-size: 0.72rem; }
.tl-badge {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 10px;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.tl-card {
  background: #fff;
  border-radius: 10px;
  padding: 14px 16px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
  border: 1px solid #e2e8f0;
  transition: box-shadow 0.2s;
}
.tl-card:hover {
  box-shadow: 0 3px 12px rgba(0,0,0,0.1);
}
.tl-item:first-child .tl-card {
  border-left: 3px solid var(--primary);
  background: #f8faff;
}
.tl-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}
.tl-card-body {
  margin-top: 8px;
  font-size: 0.88rem;
  line-height: 1.5;
}
.tl-field {
  margin-bottom: 6px;
}
.tl-field-label {
  font-weight: 600;
  color: #475569;
  font-size: 0.8rem;
}
.tl-sv-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 4px 12px;
  margin-top: 4px;
  font-size: 0.83rem;
}
.tl-actions {
  display: flex;
  gap: 4px;
  margin-left: 8px;
  flex-shrink: 0;
}
@media (max-width: 600px) {
  .tl-container { padding-left: 24px; }
  .tl-container::before { left: 7px; }
  .tl-item::before { left: -21px; width: 10px; height: 10px; }
  .tl-item:first-child::before { left: -22px; width: 12px; height: 12px; }
  .tl-card { padding: 10px 12px; }
}

/* ================================================
   CONSULTA MODAL - Two Column Layout
   ================================================ */
.consulta-body {
  display: flex;
  gap: 0;
  min-height: 500px;
}
.consulta-patient-panel {
  width: 340px;
  min-width: 300px;
  max-width: 380px;
  background: #f8fafc;
  border-right: 1px solid #e2e8f0;
  padding: 18px;
  overflow-y: auto;
  max-height: 70vh;
}
.consulta-form-area {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
  max-height: 70vh;
}
/* Patient Panel Styles */
.cpanel-alert {
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 0.78rem;
  color: #dc2626;
  margin-bottom: 10px;
}
.cpanel-alert-danger {
  background: #fef2f2;
  border-color: #f87171;
  color: #b91c1c;
  font-weight: 600;
}
.cpanel-alert i { margin-right: 4px; }
.cpanel-alert-item {
  font-size: 0.78rem;
  padding: 3px 0;
  color: #374151;
}
.cpanel-alert-item i { margin-right: 5px; }
.cpanel-section {
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid #e2e8f0;
}
.cpanel-section:last-child {
  border-bottom: none;
  margin-bottom: 0;
}
.cpanel-title {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #64748b;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.cpanel-sv-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
.cpanel-sv {
  display: flex;
  align-items: baseline;
  gap: 4px;
  font-size: 0.78rem;
  background: #fff;
  border-radius: 6px;
  padding: 4px 8px;
  border: 1px solid #f1f5f9;
}
.cpanel-sv-l { color: #64748b; font-weight: 600; min-width: 40px; }
.cpanel-sv-v { color: #1e293b; font-weight: 700; }
.cpanel-sv-u { color: #94a3b8; font-size: 0.7rem; }
.cpanel-field {
  margin-bottom: 6px;
  font-size: 0.8rem;
}
.cpanel-fl {
  display: block;
  color: #64748b;
  font-weight: 600;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  margin-bottom: 2px;
}
.cpanel-fv { color: #374151; line-height: 1.4; }
/* Medication card in panel */
.cpanel-med-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 8px 10px;
  margin-bottom: 6px;
}
.cpanel-med-name {
  font-weight: 700;
  font-size: 0.78rem;
  color: #1e293b;
  margin-bottom: 3px;
}
.cpanel-med-detail {
  font-size: 0.72rem;
  color: #64748b;
  line-height: 1.5;
}
.cpanel-med-detail span {
  display: inline-block;
  margin-right: 8px;
}

/* Consulta CIE-10 styles */
.consulta-cie10-container { position: relative; }
.consulta-cie10-container .cie10-dropdown {
  position: absolute; z-index: 100; top: 100%; left: 0; right: 0;
  max-height: 200px; overflow-y: auto;
  background: #fff; border: 1px solid #cbd5e1; border-radius: 8px;
  box-shadow: 0 8px 25px rgba(0,0,0,.15);
}

/* Consulta Rx Section */
.consulta-rx-section {
  border: 1px solid #e9d5ff;
  border-radius: 10px;
  padding: 14px;
  background: linear-gradient(135deg, #faf5ff 0%, #f5f3ff 100%);
  margin-top: 12px;
}
.consulta-rx-section .consulta-rx-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.consulta-rx-section .consulta-rx-header h4 {
  margin: 0;
  font-size: 0.95rem;
  color: #7c3aed;
}
.consulta-med-row {
  background: #fff;
  border: 1px solid #e9d5ff;
  border-radius: 8px;
  padding: 10px;
  margin-bottom: 8px;
}
.consulta-med-row .form-row {
  display: flex;
  margin-bottom: 6px;
}
.consulta-med-row .form-control {
  font-size: 0.82rem;
  padding: 6px 10px;
}
.btn-remove-med {
  background: none;
  border: none;
  color: #ef4444;
  cursor: pointer;
  font-size: 0.85rem;
  padding: 2px 6px;
  border-radius: 4px;
}
.btn-remove-med:hover { background: #fef2f2; }

/* Responsive: stack on smaller screens */
@media (max-width: 900px) {
  .consulta-body { flex-direction: column; }
  .consulta-patient-panel {
    width: 100%;
    max-width: 100%;
    min-width: 100%;
    max-height: 200px;
    border-right: none;
    border-bottom: 1px solid #e2e8f0;
  }
  .consulta-form-area { max-height: none; }
}
