/* ═══════════════════════════════════════════════════
   EGCinmuno-App — Design System
   Dark mode · Glassmorphism · Científico/Premium
   ═══════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500&display=swap');

/* ──────────────────────────────
   CSS VARIABLES / TOKENS
────────────────────────────── */
:root {
  --bg-base:        #0a0d14;
  --bg-surface:     #10141f;
  --bg-card:        #151a28;
  --bg-glass:       rgba(21, 26, 40, 0.75);
  --bg-glass-hover: rgba(30, 38, 58, 0.85);

  --border:         rgba(255,255,255,0.07);
  --border-active:  rgba(99,102,241,0.6);

  --primary:        #6366f1;
  --primary-light:  #818cf8;
  --primary-glow:   rgba(99,102,241,0.25);
  --accent:         #8b5cf6;
  --accent-light:   #a78bfa;

  --success:        #10b981;
  --warning:        #f59e0b;
  --danger:         #ef4444;
  --info:           #3b82f6;

  --text-primary:   #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted:     #64748b;

  --radius-sm:      6px;
  --radius-md:      10px;
  --radius-lg:      16px;
  --radius-xl:      24px;

  --shadow-sm:      0 2px 8px rgba(0,0,0,0.3);
  --shadow-md:      0 4px 20px rgba(0,0,0,0.4);
  --shadow-glow:    0 0 30px rgba(99,102,241,0.15);

  --transition:     0.2s ease;
  --transition-slow:0.4s ease;
}

/* ──────────────────────────────
   LIGHT MODE OVERRIDES
────────────────────────────── */
:root[data-theme="light"] {
  --bg-base:        #f8fafc;
  --bg-surface:     #ffffff;
  --bg-card:        #f1f5f9;
  --bg-glass:       rgba(255, 255, 255, 0.75);
  --bg-glass-hover: rgba(241, 245, 249, 0.85);

  --border:         rgba(0, 0, 0, 0.08);
  --border-active:  rgba(99, 102, 241, 0.7);

  --primary:        #4f46e5;
  --primary-light:  #6366f1;
  --primary-glow:   rgba(99, 102, 241, 0.12);
  --accent:         #7c3aed;
  --accent-light:   #8b5cf6;

  --text-primary:   #0f172a;
  --text-secondary: #475569;
  --text-muted:     #475569;
}

:root[data-theme="light"] body::before {
  background:
    radial-gradient(ellipse 80% 50% at 20% 0%, rgba(99,102,241,0.04) 0%, transparent 60%),
    radial-gradient(ellipse 60% 40% at 80% 100%, rgba(139,92,246,0.03) 0%, transparent 60%);
}

/* Theme Toggle Button Style */
.btn-theme-toggle {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  transition: all var(--transition);
  outline: none;
}
.btn-theme-toggle:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--primary-light);
  color: var(--text-primary);
}
:root[data-theme="light"] .btn-theme-toggle:hover {
  background: rgba(0, 0, 0, 0.04);
}

/* Light mode specific component overrides */
:root[data-theme="light"] .free-query-input,
:root[data-theme="light"] .form-group input,
:root[data-theme="light"] .form-group select,
:root[data-theme="light"] .form-group textarea,
:root[data-theme="light"] .input-group input,
:root[data-theme="light"] .study-select {
  background: #ffffff;
  color: var(--text-primary);
  border: 1px solid rgba(0, 0, 0, 0.12);
}
:root[data-theme="light"] .free-query-input:focus,
:root[data-theme="light"] .form-group input:focus,
:root[data-theme="light"] .form-group select:focus,
:root[data-theme="light"] .form-group textarea:focus,
:root[data-theme="light"] .input-group input:focus,
:root[data-theme="light"] .study-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

:root[data-theme="light"] .result-card.found .result-text {
  color: var(--text-primary);
  background: #ffffff;
}

:root[data-theme="light"] .result-text {
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.08);
}

:root[data-theme="light"] .study-tab.active {
  background: var(--tab-color);
  color: #ffffff;
}

:root[data-theme="light"] .btn-request {
  background: var(--btn-color);
  color: #ffffff;
  border-color: var(--btn-color);
}

:root[data-theme="light"] .parse-warning {
  color: #d97706;
}

:root[data-theme="light"] .free-parse-card.followup {
  background: rgba(99, 102, 241, 0.05);
  border-color: rgba(99, 102, 241, 0.2);
}

:root[data-theme="light"] .free-parse-card.confirm {
  background: rgba(16, 185, 129, 0.05);
  border-color: rgba(16, 185, 129, 0.2);
}

:root[data-theme="light"] .free-parse-card.error {
  background: rgba(239, 68, 68, 0.04);
  border-color: rgba(239, 68, 68, 0.15);
}

:root[data-theme="light"] .result-admin-item {
  background: #ffffff;
  border-color: rgba(0, 0, 0, 0.08);
}

:root[data-theme="light"] .admin-table tr:hover td {
  background: rgba(0, 0, 0, 0.015);
}

/* ──────────────────────────────
   RESET & BASE
────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

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

body {
  font-family: 'Inter', system-ui, sans-serif;
  background-color: var(--bg-base);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* Animated background */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 50% at 20% 0%, rgba(99,102,241,0.08) 0%, transparent 60%),
    radial-gradient(ellipse 60% 40% at 80% 100%, rgba(139,92,246,0.06) 0%, transparent 60%);
  pointer-events: none;
  z-index: 0;
}

/* ──────────────────────────────
   TYPOGRAPHY
────────────────────────────── */
h1 { font-size: 2rem; font-weight: 800; letter-spacing: -0.03em; }
h2 { font-size: 1.4rem; font-weight: 700; letter-spacing: -0.02em; }
h3 { font-size: 1.1rem; font-weight: 600; }
p  { color: var(--text-secondary); }

code, pre {
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 0.85em;
}

/* ──────────────────────────────
   LOGIN PAGE
────────────────────────────── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  position: relative;
  z-index: 1;
}

.login-card {
  background: var(--bg-glass);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 3rem;
  width: 100%;
  max-width: 440px;
  box-shadow: var(--shadow-md), var(--shadow-glow);
  animation: fadeInUp 0.5s ease;
}

.login-brand {
  text-align: center;
  margin-bottom: 2.5rem;
}

.login-logo {
  font-size: 3rem;
  margin-bottom: 0.75rem;
  display: block;
  filter: drop-shadow(0 0 16px rgba(99,102,241,0.5));
}

.login-logo-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 78px;
  height: 78px;
  background: #ffffff;
  border-radius: 18px;
  padding: 8px;
  margin-bottom: 1.25rem;
  box-shadow: 0 8px 24px rgba(99, 102, 241, 0.2), 0 2px 8px rgba(0, 0, 0, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s ease;
  overflow: hidden;
}

[data-theme="dark"] .login-logo-badge {
  background: #ffffff;
  border-color: rgba(255, 255, 255, 0.15);
  box-shadow: 0 8px 30px rgba(139, 92, 246, 0.35), 0 0 15px rgba(255, 255, 255, 0.05);
}

[data-theme="light"] .login-logo-badge {
  background: #ffffff;
  border-color: rgba(0, 0, 0, 0.08);
  box-shadow: 0 8px 24px rgba(99, 102, 241, 0.12), 0 2px 6px rgba(0, 0, 0, 0.06);
}

.login-logo-badge:hover {
  transform: translateY(-3px) scale(1.05);
  box-shadow: 0 12px 32px rgba(139, 92, 246, 0.45);
}

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

.login-brand h1 {
  font-size: 1.6rem;
  background: linear-gradient(135deg, var(--primary-light), var(--accent-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.login-brand p {
  font-size: 0.95rem;
  color: var(--text-secondary);
  margin-top: 0.25rem;
  font-weight: 500;
}

.login-form .form-group {
  margin-bottom: 1.25rem;
}

.login-form label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

.login-form input {
  width: 100%;
  padding: 0.875rem 1rem;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 1rem;
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}

.login-form input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.btn-login {
  width: 100%;
  padding: 0.875rem;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: white;
  border: none;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity var(--transition), transform var(--transition), box-shadow var(--transition);
  letter-spacing: 0.01em;
  margin-top: 0.5rem;
  position: relative;
  overflow: hidden;
}

.btn-login::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.15), transparent);
  opacity: 0;
  transition: opacity var(--transition);
}

.btn-login:hover { opacity: 0.92; transform: translateY(-1px); box-shadow: 0 8px 24px rgba(99,102,241,0.4); }
.btn-login:hover::after { opacity: 1; }
.btn-login:active { transform: translateY(0); }

.login-error {
  background: rgba(239,68,68,0.12);
  border: 1px solid rgba(239,68,68,0.3);
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
  color: #fca5a5;
  font-size: 0.875rem;
  margin-top: 1rem;
  display: none;
  animation: shake 0.3s ease;
}

.login-hint {
  margin-top: 1.5rem;
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.login-hint a {
  color: var(--primary-light);
  text-decoration: none;
}

/* ──────────────────────────────
   EXAM PAGE LAYOUT
────────────────────────────── */
.exam-layout {
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-height: 100vh;
}

/* Logo Banner Footer */
.logo-banner {
  width: 100%;
  padding: 1.25rem 2rem;
  background: var(--bg-surface);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 3rem;
  flex-wrap: wrap;
  z-index: 10;
  box-shadow: 0 -4px 20px rgba(0,0,0,0.15);
}

.logo-banner img {
  height: 38px;
  max-width: 140px;
  object-fit: contain;
  opacity: 0.9;
  background: #ffffff;
  padding: 3px 8px;
  border-radius: 6px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.1);
  transition: opacity var(--transition), transform var(--transition), box-shadow var(--transition);
}

[data-theme="light"] .logo-banner img {
  background: transparent;
  padding: 0;
  box-shadow: none;
  mix-blend-mode: multiply;
}

.logo-banner img:hover {
  opacity: 1;
  transform: scale(1.05);
}


/* Header */
.exam-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-surface);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  padding: 0 1.5rem;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.header-logo {
  font-size: 1.5rem;
  filter: drop-shadow(0 0 8px rgba(99,102,241,0.6));
}

.header-logo-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 36px;
  width: 36px;
  min-width: 36px;
  background: #ffffff;
  border-radius: 9px;
  padding: 3px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.15);
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
  flex-shrink: 0;
}

[data-theme="dark"] .header-logo-badge {
  background: #ffffff;
  border-color: rgba(255, 255, 255, 0.15);
  box-shadow: 0 0 10px rgba(139, 92, 246, 0.25), 0 2px 6px rgba(0, 0, 0, 0.4);
}

[data-theme="light"] .header-logo-badge {
  background: #ffffff;
  border-color: rgba(0, 0, 0, 0.08);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.header-logo-badge:hover {
  transform: scale(1.06);
}

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

.header-title {
  font-size: 1.1rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--primary-light), var(--accent-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.header-student {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.header-student strong {
  color: var(--text-primary);
}

.token-badge {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(99,102,241,0.15);
  border: 1px solid rgba(99,102,241,0.3);
  border-radius: 2rem;
  padding: 0.35rem 0.85rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--primary-light);
  transition: all var(--transition);
}

.token-badge.warning {
  background: rgba(245,158,11,0.15);
  border-color: rgba(245,158,11,0.3);
  color: #fbbf24;
}

.token-badge.critical {
  background: rgba(239,68,68,0.15);
  border-color: rgba(239,68,68,0.3);
  color: #f87171;
  animation: pulse 1.5s ease infinite;
}

.btn-lang-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: rgba(99, 102, 241, 0.1);
  border: 1px solid var(--border-active);
  color: var(--primary-light);
  padding: 0.35rem 0.75rem;
  border-radius: 2rem;
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition);
  box-shadow: 0 0 10px rgba(99, 102, 241, 0.15);
}

.btn-lang-toggle:hover {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
  transform: translateY(-1px);
  box-shadow: 0 0 14px rgba(99, 102, 241, 0.35);
}

.btn-theme-toggle {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 0.35rem 0.65rem;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  cursor: pointer;
  transition: all var(--transition);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-theme-toggle:hover {
  border-color: var(--primary);
  color: var(--primary-light);
  background: rgba(255, 255, 255, 0.04);
}

.btn-logout {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 0.35rem 0.85rem;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all var(--transition);
}

.btn-logout:hover { border-color: var(--danger); color: #f87171; }

/* ──────────────────────────────
   EXAM BODY (2 columns)
────────────────────────────── */
.exam-body {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 0;
  position: relative;
  z-index: 1;
}

/* Sidebar */
.cases-sidebar {
  border-right: 1px solid var(--border);
  padding: 1.5rem;
  overflow-y: auto;
  height: calc(100vh - 64px);
  position: sticky;
  top: 64px;
}

.sidebar-title {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.case-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1rem;
  margin-bottom: 0.75rem;
  cursor: pointer;
  transition: all var(--transition);
}

.case-card:hover {
  border-color: rgba(99,102,241,0.3);
  transform: translateX(2px);
  background: var(--bg-glass-hover);
}

.case-card.active {
  border-color: var(--border-active);
  background: rgba(99,102,241,0.08);
  box-shadow: 0 0 0 1px var(--border-active), inset 0 0 0 1px var(--border-active);
}

.case-card-header {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.case-icon { font-size: 1.1rem; flex-shrink: 0; margin-top: 1px; }

.case-name {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.3;
}

.case-card.active .case-name { color: var(--primary-light); }

.case-desc {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.4;
  margin: 0;
}

/* ──────────────────────────────
   MAIN EXAM AREA
────────────────────────────── */
.exam-main {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.no-case-msg {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  color: var(--text-muted);
  padding: 2rem;
  overflow-y: auto;
}

.no-case-msg .no-case-icon { font-size: 3rem; opacity: 0.4; }
.no-case-msg p { font-size: 0.95rem; text-align: center; }

/* ── Welcome Panel (Mesa de Entrada) ── */
.welcome-container {
  max-width: 800px;
  width: 100%;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 2rem;
  padding: 1rem;
  animation: fadeInUp 0.4s ease;
}

.welcome-header {
  text-align: center;
}

.welcome-logo {
  font-size: 3.5rem;
  margin-bottom: 0.5rem;
  display: inline-block;
  filter: drop-shadow(0 0 16px rgba(99,102,241,0.4));
}

.welcome-header h2 {
  font-size: 1.8rem;
  background: linear-gradient(135deg, var(--primary-light), var(--accent-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 0.5rem;
}

.welcome-header p {
  font-size: 0.95rem;
  color: var(--text-secondary);
}

.welcome-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.25rem;
}

.welcome-card-step {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  position: relative;
  transition: all var(--transition);
  text-align: center;
}

.welcome-card-step:hover {
  border-color: rgba(99,102,241,0.3);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
  background: var(--bg-glass-hover);
}

.step-num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: white;
  font-weight: 700;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.welcome-card-step h3 {
  font-size: 1rem;
  color: var(--text-primary);
}

.welcome-card-step p {
  font-size: 0.82rem;
  line-height: 1.5;
  color: var(--text-secondary);
}

.welcome-footer-hint {
  text-align: center;
  background: rgba(99, 102, 241, 0.05);
  border: 1px solid rgba(99, 102, 241, 0.15);
  padding: 1rem;
  border-radius: var(--radius-md);
}

.welcome-footer-hint p {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--primary-light);
}

:root[data-theme="light"] .welcome-card-step {
  background: #ffffff;
  border-color: rgba(0, 0, 0, 0.08);
}
:root[data-theme="light"] .welcome-card-step:hover {
  background: #f8fafc;
}
:root[data-theme="light"] .welcome-footer-hint {
  background: rgba(99, 102, 241, 0.03);
}

.admin-header a {
  color: var(--text-secondary) !important;
  transition: color var(--transition);
}
.admin-header a:hover {
  color: var(--text-primary) !important;
}

/* Study panel */
.study-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 1.5rem;
  gap: 1.5rem;
  overflow-y: auto;
}

.study-panel-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.current-case-icon { font-size: 1.3rem; }

#current-case-name {
  font-size: 1rem;
  font-weight: 600;
  color: var(--primary-light);
}

/* Study tabs */
.study-tabs {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.study-tab {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 2rem;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
}

.study-tab:hover {
  border-color: var(--tab-color);
  color: var(--text-primary);
}

.study-tab.active {
  background: color-mix(in srgb, var(--tab-color) 15%, transparent);
  border-color: var(--tab-color);
  color: white;
}

/* Study panels */
.study-panels { position: relative; }

.study-panel-content { display: none; }
.study-panel-content.active { display: block; animation: fadeIn 0.2s ease; }

.study-form-header {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.study-icon { font-size: 2rem; }
.study-form-header h3 { font-size: 1rem; margin-bottom: 0.2rem; }
.study-form-header p { font-size: 0.8rem; color: var(--text-muted); margin: 0; }

.study-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.input-group label {
  display: block;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 0.4rem;
}

.input-group input {
  width: 100%;
  padding: 0.75rem 1rem;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.9rem;
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}

.input-group input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.btn-request {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  background: color-mix(in srgb, var(--btn-color) 20%, transparent);
  border: 1px solid color-mix(in srgb, var(--btn-color) 50%, transparent);
  border-radius: var(--radius-md);
  color: white;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  align-self: flex-start;
}

.btn-request:hover {
  background: color-mix(in srgb, var(--btn-color) 35%, transparent);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px color-mix(in srgb, var(--btn-color) 30%, transparent);
}

.token-cost {
  font-size: 0.75rem;
  opacity: 0.7;
  margin-left: auto;
  background: rgba(0,0,0,0.2);
  padding: 0.1rem 0.4rem;
  border-radius: 1rem;
}

/* ──────────────────────────────
   RESULTS HISTORY
────────────────────────────── */
.history-section { border-top: 1px solid var(--border); padding-top: 1.5rem; }

.history-title {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

#history-empty {
  color: var(--text-muted);
  font-size: 0.875rem;
  text-align: center;
  padding: 2rem;
}

.result-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 1rem;
  transition: all var(--transition);
}

.result-card.new { animation: slideInResult 0.4s ease; }

.result-card.found { border-left: 3px solid var(--success); }
.result-card.not-found { border-left: 3px solid var(--text-muted); }

.result-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.875rem 1rem;
  border-bottom: 1px solid var(--border);
  gap: 1rem;
}

.result-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.result-study-icon { font-size: 1.1rem; }
.result-study-name { font-size: 0.8rem; color: var(--text-muted); font-weight: 500; }

.result-target {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
  background: rgba(255,255,255,0.06);
  padding: 0.1rem 0.5rem;
  border-radius: var(--radius-sm);
}

.result-status {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.25rem 0.75rem;
  border-radius: 2rem;
  white-space: nowrap;
}

.status-found { background: rgba(16,185,129,0.15); color: #34d399; border: 1px solid rgba(16,185,129,0.25); }
.status-missing { background: rgba(71,85,105,0.2); color: var(--text-muted); border: 1px solid var(--border); }

.result-body { padding: 1rem; }

.result-text {
  white-space: pre-wrap;
  word-break: break-word;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.82rem;
  line-height: 1.7;
  color: var(--text-secondary);
  background: rgba(0,0,0,0.2);
  padding: 1rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}

.result-card.found .result-text { color: #e2e8f0; }

.result-footer {
  display: flex;
  justify-content: space-between;
  padding: 0.5rem 1rem;
  border-top: 1px solid var(--border);
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* ──────────────────────────────
   PROCESSING OVERLAY
────────────────────────────── */
.processing-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10,13,20,0.7);
  backdrop-filter: blur(8px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.processing-overlay.visible {
  opacity: 1;
  pointer-events: all;
}

.processing-spinner {
  width: 56px;
  height: 56px;
  border: 3px solid rgba(99,102,241,0.2);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.processing-label {
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-family: 'JetBrains Mono', monospace;
}

/* ──────────────────────────────
   TOAST NOTIFICATIONS
────────────────────────────── */
#toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.toast {
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 500;
  opacity: 0;
  transform: translateX(20px);
  transition: all 0.3s ease;
  backdrop-filter: blur(12px);
}

.toast.show { opacity: 1; transform: translateX(0); }
.toast-info    { background: rgba(59,130,246,0.85); color: white; }
.toast-warning { background: rgba(245,158,11,0.85); color: white; }
.toast-error   { background: rgba(239,68,68,0.85);  color: white; }

/* ──────────────────────────────
   ADMIN PAGE
────────────────────────────── */
.admin-page {
  min-height: 100vh;
  position: relative;
  z-index: 1;
}

#admin-login {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.admin-login-card {
  background: var(--bg-glass);
  backdrop-filter: blur(24px);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 2.5rem;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow-md);
  animation: fadeInUp 0.5s ease;
}

.admin-login-card .admin-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent-light);
  background: rgba(139,92,246,0.15);
  border: 1px solid rgba(139,92,246,0.3);
  padding: 0.25rem 0.75rem;
  border-radius: 2rem;
  margin-bottom: 1.25rem;
}

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

.admin-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(10,13,20,0.9);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  padding: 0 1.5rem;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.admin-header-left { display: flex; align-items: center; gap: 1rem; }
.admin-header-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--accent-light);
}

.admin-body {
  display: flex;
  flex: 1;
}

.admin-sidebar {
  width: 220px;
  border-right: 1px solid var(--border);
  padding: 1.5rem 0;
  position: sticky;
  top: 64px;
  height: calc(100vh - 64px);
}

#admin-nav { display: flex; flex-direction: column; gap: 0.25rem; padding: 0 1rem; }

.admin-nav-btn {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.625rem 1rem;
  background: transparent;
  border: none;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
}

.admin-nav-btn:hover { background: rgba(255,255,255,0.05); color: var(--text-primary); }
.admin-nav-btn.active { background: rgba(139,92,246,0.15); color: var(--accent-light); }

#admin-content { flex: 1; padding: 2rem; overflow-y: auto; }

.admin-section { max-width: 1100px; }

.admin-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.admin-stats {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1rem 1.5rem;
  text-align: center;
  min-width: 100px;
}

.stat-num { display: block; font-size: 2rem; font-weight: 800; color: var(--primary-light); }
.stat-label { font-size: 0.75rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }

.admin-toolbar {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
  align-items: center;
}

.admin-toolbar input {
  padding: 0.5rem 1rem;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.875rem;
  outline: none;
  flex: 1;
  min-width: 200px;
  transition: border-color var(--transition);
}

.admin-toolbar input:focus { border-color: var(--primary); }

.btn-group { display: flex; gap: 0.5rem; flex-wrap: wrap; }

/* Admin Buttons */
.btn-admin-primary {
  padding: 0.5rem 1.25rem;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: white;
  border: none;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity var(--transition), transform var(--transition);
}

.btn-admin-primary:hover { opacity: 0.88; transform: translateY(-1px); }
.btn-admin-primary.full-width { width: 100%; padding: 0.75rem; }

.btn-admin-secondary {
  padding: 0.5rem 1rem;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.875rem;
  cursor: pointer;
  transition: all var(--transition);
}

.btn-admin-secondary:hover { background: rgba(255,255,255,0.1); color: var(--text-primary); }
.btn-admin-secondary.danger { color: #f87171; }
.btn-admin-secondary.danger:hover { border-color: var(--danger); background: rgba(239,68,68,0.1); }

/* Admin Table */
.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.admin-table th {
  text-align: left;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
}

.admin-table td {
  padding: 0.875rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  color: var(--text-secondary);
}

.admin-table tr:hover td { background: rgba(255,255,255,0.02); }
.admin-table td strong { color: var(--text-primary); }

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

.token-pill {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 2rem;
  font-size: 0.78rem;
  font-weight: 600;
  font-family: 'JetBrains Mono', monospace;
}

.token-pill.ok     { background: rgba(16,185,129,0.15); color: #34d399; }
.token-pill.low    { background: rgba(245,158,11,0.15);  color: #fbbf24; }
.token-pill.empty  { background: rgba(239,68,68,0.1);    color: #f87171; }

.actions-cell { display: flex; gap: 0.4rem; }

.btn-icon-sm {
  padding: 0.35rem 0.5rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-active);
  color: var(--text-primary);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.85rem;
  transition: all var(--transition);
  line-height: 1;
}

.btn-icon-sm:hover {
  background: var(--primary-glow);
  transform: scale(1.05);
}

.btn-icon-sm.danger {
  border-color: rgba(239, 68, 68, 0.4);
}

.btn-case-order {
  padding: 1px 4px;
  font-size: 0.58rem;
  line-height: 1;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-case-order:hover:not(:disabled) {
  background: var(--primary);
  border-color: var(--primary-light);
  color: white;
  transform: scale(1.1);
}

.btn-case-order:disabled {
  opacity: 0.2;
  cursor: not-allowed;
}

.btn-icon-sm.danger:hover {
  background: rgba(239, 68, 68, 0.15);
  border-color: var(--danger);
}

.empty-row { text-align: center; color: var(--text-muted); font-style: italic; }

/* Case admin cards */
.case-admin-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 1.25rem;
}

.case-admin-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.case-admin-header h3 { color: var(--text-primary); margin-bottom: 0.25rem; }
.case-admin-header p { font-size: 0.85rem; margin: 0; }

.results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 0.75rem;
}

.result-admin-item {
  background: rgba(0,0,0,0.2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.875rem;
}

.result-admin-key {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.4rem;
  font-size: 0.8rem;
  font-weight: 600;
}

.result-type-badge {
  background: rgba(99,102,241,0.15);
  color: var(--primary-light);
  padding: 0.1rem 0.4rem;
  border-radius: var(--radius-sm);
  font-size: 0.72rem;
  font-family: 'JetBrains Mono', monospace;
}

.result-preview {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin: 0.25rem 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.result-admin-actions {
  display: flex;
  gap: 0.4rem;
  margin-top: 0.5rem;
}

.empty-msg { color: var(--text-muted); font-size: 0.875rem; font-style: italic; }

/* Badge Log */
.badge-found   { background: rgba(16,185,129,0.12); color: #34d399; padding: 0.15rem 0.5rem; border-radius: 1rem; font-size: 0.75rem; }
.badge-missing { background: rgba(100,116,139,0.15); color: var(--text-muted); padding: 0.15rem 0.5rem; border-radius: 1rem; font-size: 0.75rem; }

/* ──────────────────────────────
   MODALS
────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 500;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
  padding: 1rem;
}

.modal-overlay.open { opacity: 1; pointer-events: all; }

.modal {
  background: var(--bg-surface);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius-xl);
  padding: 2rem;
  width: 100%;
  max-width: 480px;
  box-shadow: var(--shadow-md);
  transform: scale(0.95);
  transition: transform 0.25s ease;
}

.modal-overlay.open .modal { transform: scale(1); }
.modal.modal-lg { max-width: 620px; }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}

.modal-close {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
}

.modal-close:hover { border-color: var(--danger); color: #f87171; }

.form-group { margin-bottom: 1.25rem; }

.form-group label {
  display: block;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 0.4rem;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 0.75rem 1rem;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.875rem;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
  resize: vertical;
}

.form-group select option { background: var(--bg-surface); }

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.form-hint { font-size: 0.78rem; color: var(--text-muted); margin-bottom: 0.5rem; }
.form-hint code { background: rgba(255,255,255,0.08); padding: 0.1rem 0.3rem; border-radius: 3px; }

.success-msg { color: var(--success); font-size: 0.875rem; margin-top: 1rem; }
.bulk-result { margin-top: 1rem; }

/* Admin Toast */
.admin-toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 9999;
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 500;
  opacity: 0;
  transform: translateY(8px);
  transition: all 0.3s ease;
  backdrop-filter: blur(12px);
}

.admin-toast.show { opacity: 1; transform: translateY(0); }
.admin-toast.toast-success { background: rgba(16,185,129,0.85); color: white; }
.admin-toast.toast-error   { background: rgba(239,68,68,0.85);  color: white; }

/* ──────────────────────────────
   ANIMATIONS
────────────────────────────── */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

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

@keyframes slideInResult {
  from { opacity: 0; transform: translateY(-12px); }
  to   { opacity: 1; transform: translateY(0); }
}

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

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-6px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

/* ──────────────────────────────
   RESPONSIVE
────────────────────────────── */
@media (max-width: 768px) {
  .exam-body { grid-template-columns: 1fr; }
  .cases-sidebar { height: auto; position: static; border-right: none; border-bottom: 1px solid var(--border); max-height: 220px; overflow-y: auto; }
  .admin-body { flex-direction: column; }
  .admin-sidebar { width: 100%; height: auto; position: static; border-right: none; border-bottom: 1px solid var(--border); padding: 0.75rem; }
  #admin-nav { flex-direction: row; flex-wrap: wrap; }
  .admin-nav-btn { text-align: center; font-size: 0.8rem; }
  .case-admin-header { flex-direction: column; }
  .results-grid { grid-template-columns: 1fr; }
  .case-actions-group { flex-wrap: wrap; }
  .free-query-form { flex-direction: column; }
}

/* ══════════════════════════════════════════
   V2.1 — NUEVOS ESTILOS
══════════════════════════════════════════ */

/* ── Barra consulta libre ── */
.free-query-bar {
  background: linear-gradient(135deg, rgba(99,102,241,0.08), rgba(139,92,246,0.06));
  border: 1px solid rgba(99,102,241,0.25);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  position: relative;
  overflow: hidden;
}
.free-query-bar::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
}
.free-query-header { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 0.875rem; }
.free-query-badge {
  font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--primary-light); background: rgba(99,102,241,0.15); border: 1px solid rgba(99,102,241,0.3);
  padding: 0.2rem 0.6rem; border-radius: 2rem; white-space: nowrap;
}
.free-query-hint { font-size: 0.8rem; color: var(--text-muted); }
.free-query-form { display: flex; gap: 0.75rem; }
.free-query-input {
  flex: 1; padding: 0.75rem 1rem;
  background: rgba(0,0,0,0.25); border: 1px solid rgba(99,102,241,0.3);
  border-radius: var(--radius-md); color: var(--text-primary);
  font-family: inherit; font-size: 0.9rem; outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.free-query-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-glow); }
.free-query-input:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-free-query {
  padding: 0.75rem 1.25rem;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: white; border: none; border-radius: var(--radius-md);
  font-family: inherit; font-size: 0.875rem; font-weight: 600; cursor: pointer; white-space: nowrap;
  transition: opacity var(--transition), transform var(--transition);
}
.btn-free-query:hover { opacity: 0.88; transform: translateY(-1px); }

/* ── Tarjetas del parser ── */
.free-parse-card { margin-top: 1rem; border-radius: var(--radius-md); padding: 1rem 1.25rem; animation: fadeInUp 0.25s ease; }
.free-parse-card.confirm { background: rgba(16,185,129,0.08); border: 1px solid rgba(16,185,129,0.25); }
.free-parse-card.error { background: rgba(245,158,11,0.08); border: 1px solid rgba(245,158,11,0.2); }
.free-parse-card.followup { background: rgba(99,102,241,0.08); border: 1px solid rgba(99,102,241,0.25); }
.parse-card-title { font-size: 0.85rem; font-weight: 700; margin-bottom: 0.75rem; color: var(--text-primary); }
.parse-card-body { margin-bottom: 0.875rem; }
.parse-row { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 0.4rem; font-size: 0.875rem; }
.parse-label { color: var(--text-muted); font-size: 0.8rem; min-width: 130px; }
.parse-value { color: var(--text-primary); font-weight: 600; }
.parse-target { font-family: 'JetBrains Mono', monospace; background: rgba(255,255,255,0.07); padding: 0.1rem 0.5rem; border-radius: var(--radius-sm); }
.parse-warning { font-size: 0.78rem; color: #fbbf24; margin-top: 0.4rem; }
.parse-hints { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.5rem; }
.parse-hint-tag { font-size: 0.75rem; background: rgba(255,255,255,0.06); border: 1px solid var(--border); border-radius: 1rem; padding: 0.2rem 0.6rem; color: var(--text-secondary); }
.parse-actions { display: flex; gap: 0.75rem; flex-wrap: wrap; }
.btn-parse-confirm {
  padding: 0.5rem 1.25rem; background: rgba(16,185,129,0.2); border: 1px solid rgba(16,185,129,0.4);
  border-radius: var(--radius-md); color: #34d399; font-family: inherit; font-size: 0.875rem; font-weight: 600;
  cursor: pointer; transition: all var(--transition);
}
.btn-parse-confirm:hover { background: rgba(16,185,129,0.3); }

/* Botón continuar */
.btn-parse-continue {
  padding: 0.5rem 1.25rem; background: rgba(99,102,241,0.15); border: 1px solid rgba(99,102,241,0.3);
  border-radius: var(--radius-md); color: var(--primary-light); font-family: inherit; font-size: 0.875rem; font-weight: 600;
  cursor: pointer; transition: all var(--transition);
}
.btn-parse-continue:hover { background: rgba(99,102,241,0.25); }

.btn-parse-cancel {
  padding: 0.5rem 1rem; background: transparent; border: 1px solid var(--border);
  border-radius: var(--radius-md); color: var(--text-muted); font-family: inherit; font-size: 0.875rem;
  cursor: pointer; transition: all var(--transition);
}
.btn-parse-cancel:hover { border-color: var(--danger); color: #f87171; }

/* Sobreescritura tema claro */
:root[data-theme="light"] .btn-parse-confirm {
  background: #10b981;
  border-color: #059669;
  color: #ffffff !important;
}
:root[data-theme="light"] .btn-parse-confirm:hover {
  background: #059669;
}
:root[data-theme="light"] .btn-parse-continue {
  background: var(--primary);
  border-color: var(--primary-light);
  color: #ffffff !important;
}
:root[data-theme="light"] .btn-parse-continue:hover {
  background: var(--primary-light);
}
:root[data-theme="light"] .parse-hint-tag {
  background: rgba(0, 0, 0, 0.04);
  color: var(--text-secondary);
  border-color: rgba(0, 0, 0, 0.08);
}
.parse-hint-tag.clickable-hint {
  cursor: pointer;
  transition: all var(--transition);
}
.parse-hint-tag.clickable-hint:hover {
  background: var(--primary-glow);
  border-color: var(--primary-light);
  color: var(--text-primary);
}

/* ── Separador guiado ── */
.guided-separator {
  display: flex; align-items: center; gap: 1rem;
  font-size: 0.75rem; color: var(--text-muted); text-align: center;
}
.guided-separator::before, .guided-separator::after { content: ''; flex: 1; height: 1px; background: var(--border); }

/* ── Study select ── */
.study-select {
  width: 100%; padding: 0.75rem 2.5rem 0.75rem 1rem;
  background: rgba(255,255,255,0.04) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E") no-repeat right 0.875rem center;
  border: 1px solid var(--border); border-radius: var(--radius-md); color: var(--text-primary);
  font-family: inherit; font-size: 0.9rem; outline: none; cursor: pointer; appearance: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.study-select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-glow); }
.study-select option { background: #151a28; }

/* ── Admin: estado del caso ── */
.case-title-row { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; margin-bottom: 0.25rem; }
.status-badge { font-size: 0.72rem; font-weight: 700; padding: 0.2rem 0.65rem; border-radius: 2rem; letter-spacing: 0.03em; white-space: nowrap; }
.status-published { background: rgba(16,185,129,0.15); color: #34d399; border: 1px solid rgba(16,185,129,0.3); }
.status-draft { background: rgba(100,116,139,0.15); color: var(--text-muted); border: 1px solid var(--border); }
.case-draft { opacity: 0.75; border-style: dashed; }
.btn-status-toggle { padding: 0.4rem 0.9rem; border-radius: var(--radius-md); font-family: inherit; font-size: 0.8rem; font-weight: 600; cursor: pointer; transition: all var(--transition); white-space: nowrap; }
.toggle-publish { background: rgba(16,185,129,0.15); border: 1px solid rgba(16,185,129,0.3); color: #34d399; }
.toggle-publish:hover { background: rgba(16,185,129,0.25); }
.toggle-unpublish { background: rgba(100,116,139,0.12); border: 1px solid var(--border); color: var(--text-muted); }
.toggle-unpublish:hover { background: rgba(239,68,68,0.1); border-color: rgba(239,68,68,0.3); color: #f87171; }
.patient-summary { font-size: 0.78rem; color: var(--text-muted); margin-top: 0.25rem; margin-bottom: 0; }
.case-actions-group { display: flex; gap: 0.5rem; align-items: flex-start; flex-wrap: wrap; }

/* ── Settings tab ── */
.settings-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 1.5rem; }
.settings-card h3 { margin-bottom: 0.5rem; }
.settings-card.danger-card { border-color: rgba(239,68,68,0.2); }
.mode-options { display: flex; flex-direction: column; gap: 0.75rem; }
.mode-option {
  display: flex; align-items: flex-start; gap: 0;
  border: 1px solid var(--border); border-radius: var(--radius-md); padding: 1rem;
  cursor: pointer; transition: all var(--transition); position: relative;
}
.mode-option input[type="radio"] { position: absolute; opacity: 0; pointer-events: none; }
.mode-option:hover { border-color: rgba(99,102,241,0.3); background: rgba(99,102,241,0.04); }
.mode-option.active { border-color: var(--primary); background: rgba(99,102,241,0.08); }
.mode-option-content { display: flex; flex-direction: column; gap: 0.2rem; }
.mode-icon { font-size: 1.5rem; margin-bottom: 0.25rem; }
.mode-option strong { color: var(--text-primary); font-size: 0.95rem; }
.mode-option p { font-size: 0.8rem; color: var(--text-muted); margin: 0; }

/* ── Form select arrow ── */
.form-group select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 0.875rem center; padding-right: 2.5rem; cursor: pointer;
}

/* ── Case info banner ── */
.case-info-banner {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  background: rgba(99,102,241,0.06);
  border: 1px solid rgba(99,102,241,0.18);
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
  animation: fadeInUp 0.2s ease;
}

.case-info-pill {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  flex: 1;
  min-width: 100px;
}

.cip-label {
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--primary-light);
  opacity: 0.8;
}

.cip-value {
  font-size: 0.82rem;
  color: var(--text-secondary);
  font-weight: 500;
}

/* ══════════════════════════════════════════
   MAPA CORPORAL INTERACTIVO
   ══════════════════════════════════════════ */
.case-info-banner {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  gap: 1.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  height: 400px;
  box-shadow: var(--shadow-sm);
  transition: background var(--transition), border-color var(--transition);
}

.body-map-column {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.75rem;
  position: relative;
  width: 200px;
  flex-shrink: 0;
  height: 100%;
  overflow-y: auto;
}

:root[data-theme="light"] .body-map-column {
  background: rgba(0, 0, 0, 0.02);
}

.body-map-title {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--primary-light);
  margin-bottom: 0.75rem;
  text-align: center;
}

.body-map-wrapper {
  position: relative;
  width: 140px;
  height: 220px;
}

.body-silhouette-svg {
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 0 10px rgba(99, 102, 241, 0.15));
}

/* Glowing Indicator Dots */
.body-marker {
  position: absolute;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  cursor: pointer;
  z-index: 10;
  transform: translate(-50%, -50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform var(--transition), box-shadow var(--transition);
}

.body-marker::before {
  content: '';
  position: absolute;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--marker-color, var(--primary));
  opacity: 0.8;
  transition: transform var(--transition), background-color var(--transition);
  z-index: 1;
}

.body-marker.active::after {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid var(--marker-color, var(--primary));
  animation: pulse-ring 1.8s cubic-bezier(0.215, 0.61, 0.355, 1) infinite;
  pointer-events: none;
  z-index: 0;
}

.body-marker:hover::before {
  transform: scale(1.4);
}

.body-marker:hover {
  box-shadow: 0 0 12px var(--marker-color, var(--primary));
  background: rgba(255, 255, 255, 0.08);
}

.body-marker.inactive {
  cursor: default;
  opacity: 0.15;
  pointer-events: none;
}

.body-marker.inactive::after {
  display: none;
}

/* Specific anatomical marker colors */
.body-marker[data-region="head"] { --marker-color: var(--warning); }
.body-marker[data-region="lungs"] { --marker-color: var(--info); }
.body-marker[data-region="abdomen"] { --marker-color: var(--success); }
.body-marker[data-region="skin"] { --marker-color: #ec4899; }
.body-marker[data-region="joints"] { --marker-color: var(--accent-light); }
.body-marker[data-region="systemic"] { --marker-color: var(--primary-light); }

/* Findings Side Column */
.body-findings-column {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  overflow-y: auto;
  height: 100%;
  padding-right: 0.5rem;
}

.findings-group {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
  transition: all var(--transition-slow);
}

.findings-group.highlighted {
  border-color: var(--border-active);
  background: rgba(99, 102, 241, 0.06);
  box-shadow: 0 0 10px rgba(99, 102, 241, 0.1);
}

.findings-group-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.4rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.2rem;
}

.findings-group-title {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-primary);
}

.findings-group-text {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.5;
  white-space: pre-wrap;
}

/* Animations */
@keyframes pulse-ring {
  0% { transform: scale(0.33); opacity: 0; }
  40% { opacity: 0.6; }
  100% { transform: scale(1.3); opacity: 0; }
}

@media (max-width: 768px) {
  .case-info-banner {
    flex-direction: column;
  }
  .body-map-column {
    width: 100%;
    height: 240px;
  }
  .body-findings-column {
    max-height: none;
  }
}

.special-studies-silhouette {
  margin-top: 1rem;
  width: 100%;
  border-top: 1px dashed var(--border);
  padding-top: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  align-items: center;
}

.special-studies-title {
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.special-studies-tags {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  width: 100%;
}

.special-study-tag {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.3rem 0.5rem;
  font-size: 0.72rem;
  cursor: pointer;
  transition: all var(--transition);
  color: var(--text-secondary);
}

.special-study-tag:hover {
  background: rgba(99, 102, 241, 0.08);
  border-color: var(--border-active);
  color: var(--text-primary);
}

.special-study-icon {
  font-size: 0.85rem;
}

.special-study-label {
  font-size: 0.65rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ──────────────────────────────────────────────
 * CATEGORÍAS PRECARGADAS VACÍAS & SLOTS EN ADMIN
 * ────────────────────────────────────────────── */

.result-admin-item.empty-slot {
  border: 1px dashed var(--border);
  background: rgba(255, 255, 255, 0.008);
  opacity: 0.88;
  transition: all var(--transition);
}

.result-admin-item.empty-slot:hover {
  border-color: var(--primary);
  background: rgba(139, 92, 246, 0.04);
  opacity: 1;
}

.empty-slot-badge {
  font-size: 0.65rem;
  font-weight: 600;
  padding: 0.12rem 0.4rem;
  border-radius: 4px;
  background: rgba(148, 163, 184, 0.12);
  color: var(--text-muted);
}

.btn-quick-add {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.28rem 0.65rem;
  border-radius: var(--radius-md);
  background: var(--primary-glow);
  color: var(--primary-light);
  border: 1px solid var(--primary);
  cursor: pointer;
  transition: all var(--transition);
}

.btn-quick-add:hover {
  background: var(--primary);
  color: #ffffff;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(139, 92, 246, 0.3);
}

.category-block-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.4rem;
}
