/* ============================================================
   HCE Ginecológica — Design System
   Dark Mode · Glassmorphism · Purple/Pink palette
   ============================================================ */

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

/* ── TOKENS ─────────────────────────────────────────────── */
:root {
  --bg-base:        #07091a;
  --bg-surface:     #0c1030;
  --bg-card:        rgba(255,255,255,0.04);
  --bg-card-hover:  rgba(255,255,255,0.07);
  --bg-input:       rgba(255,255,255,0.06);
  --border:         rgba(255,255,255,0.08);
  --border-hover:   rgba(255,255,255,0.18);

  --primary:        #8B5CF6;
  --primary-light:  #A78BFA;
  --primary-dark:   #6D28D9;
  --primary-glow:   rgba(139,92,246,0.25);

  --accent:         #EC4899;
  --accent-light:   #F472B6;
  --accent-glow:    rgba(236,72,153,0.25);

  --teal:           #14B8A6;
  --teal-glow:      rgba(20,184,166,0.2);

  --success:        #10B981;
  --warning:        #F59E0B;
  --danger:         #EF4444;
  --info:           #3B82F6;

  --text-primary:   #F1F5F9;
  --text-secondary: #94A3B8;
  --text-muted:     #475569;

  --grad-primary:   linear-gradient(135deg, #8B5CF6 0%, #EC4899 100%);
  --grad-surface:   linear-gradient(135deg, rgba(139,92,246,0.12), rgba(236,72,153,0.08));
  --grad-teal:      linear-gradient(135deg, #14B8A6, #3B82F6);

  --radius-xs: 6px;
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;

  --shadow-sm:  0 2px 8px rgba(0,0,0,0.35);
  --shadow-md:  0 4px 24px rgba(0,0,0,0.45);
  --shadow-lg:  0 8px 48px rgba(0,0,0,0.55);
  --shadow-pri: 0 4px 24px rgba(139,92,246,0.35);
  --shadow-acc: 0 4px 24px rgba(236,72,153,0.35);

  --nav-w: 260px;
  --transition: all 0.22s cubic-bezier(0.4,0,0.2,1);
}

/* ── RESET ───────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: 'Inter', sans-serif;
  background: var(--bg-base);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; outline: none; }
input, select, textarea { font-family: inherit; outline: none; }
img { max-width: 100%; }

/* ── SCROLLBAR ───────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(139,92,246,0.4); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--primary); }

/* ── LOADING SCREEN ──────────────────────────────────────── */
.loading-screen {
  position: fixed; inset: 0;
  background: var(--bg-base);
  display: flex; align-items: center; justify-content: center;
  z-index: 9999;
}
.loading-content { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 20px; }
.loading-orb {
  width: 90px; height: 90px; border-radius: 50%;
  background: var(--grad-primary);
  filter: blur(30px);
  opacity: 0.6;
  animation: pulse-orb 2s ease-in-out infinite;
  position: absolute;
}
@keyframes pulse-orb { 0%,100% { transform: scale(1); opacity: 0.6; } 50% { transform: scale(1.4); opacity: 0.9; } }
.brand-logo { display: flex; align-items: center; gap: 12px; position: relative; }
.brand-icon { font-size: 2.4rem; }
.brand-name { font-family: 'Outfit', sans-serif; font-size: 2rem; font-weight: 800; color: var(--text-primary); }
.brand-accent { background: var(--grad-primary); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.loading-label { color: var(--text-muted); font-size: 0.9rem; }
.loading-bar-wrap { width: 180px; height: 3px; background: rgba(255,255,255,0.1); border-radius: 99px; overflow: hidden; }
.loading-bar-fill { height: 100%; width: 0; background: var(--grad-primary); border-radius: 99px; animation: load-fill 1.5s ease-out forwards; }
@keyframes load-fill { to { width: 100%; } }

/* ── APP SHELL ───────────────────────────────────────────── */
.app-shell { display: flex; min-height: 100vh; }

/* ── SIDEBAR NAV ─────────────────────────────────────────── */
.sidebar {
  width: var(--nav-w);
  background: rgba(12,16,48,0.95);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  position: fixed; top: 0; left: 0; bottom: 0;
  backdrop-filter: blur(20px);
  z-index: 100;
  transition: var(--transition);
}
.sidebar-brand {
  padding: 28px 20px 20px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px;
}
.sidebar-brand .brand-icon { font-size: 1.6rem; }
.sidebar-brand .brand-name { font-family: 'Outfit', sans-serif; font-size: 1.4rem; font-weight: 800; }
.sidebar-nav { flex: 1; padding: 16px 12px; display: flex; flex-direction: column; gap: 4px; overflow-y: auto; }
.nav-section-label {
  font-size: 0.68rem; font-weight: 600; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--text-muted);
  padding: 12px 10px 6px;
}
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 14px; border-radius: var(--radius-sm);
  color: var(--text-secondary); font-size: 0.9rem; font-weight: 500;
  cursor: pointer; transition: var(--transition); position: relative;
}
.nav-item:hover { background: var(--bg-card-hover); color: var(--text-primary); }
.nav-item.active {
  background: var(--primary-glow);
  color: var(--primary-light);
  border: 1px solid rgba(139,92,246,0.3);
}
.nav-item.active::before {
  content: ''; position: absolute; left: 0; top: 50%; transform: translateY(-50%);
  width: 3px; height: 60%; background: var(--primary); border-radius: 0 3px 3px 0;
}
.nav-item .nav-icon { font-size: 1.1rem; width: 22px; text-align: center; }
.nav-badge {
  margin-left: auto; background: var(--accent); color: white;
  font-size: 0.68rem; font-weight: 700; padding: 2px 7px; border-radius: 99px;
}
.sidebar-footer {
  padding: 16px 12px; border-top: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px;
}
.user-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--grad-primary); display: flex; align-items: center; justify-content: center;
  font-size: 0.85rem; font-weight: 700; color: white; flex-shrink: 0;
  border: 2px solid var(--primary-glow);
}
.user-info { flex: 1; min-width: 0; }
.user-name { font-size: 0.85rem; font-weight: 600; truncate: ellipsis; white-space: nowrap; overflow: hidden; }
.user-email { font-size: 0.72rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.btn-logout { background: none; color: var(--text-muted); font-size: 1rem; padding: 4px; border-radius: var(--radius-xs); transition: var(--transition); }
.btn-logout:hover { color: var(--danger); background: rgba(239,68,68,0.1); }

/* ── MAIN CONTENT ────────────────────────────────────────── */
.main-content {
  margin-left: var(--nav-w);
  flex: 1; min-height: 100vh;
  padding: 32px;
  max-width: calc(100vw - var(--nav-w));
}
.page-header { margin-bottom: 28px; }
.page-title { font-family: 'Outfit', sans-serif; font-size: 1.8rem; font-weight: 800; }
.page-subtitle { color: var(--text-secondary); font-size: 0.9rem; margin-top: 4px; }
.page-header-row { display: flex; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; gap: 16px; }

/* ── CARDS ───────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  transition: var(--transition);
  backdrop-filter: blur(10px);
}
.card:hover { border-color: var(--border-hover); }
.card-glass {
  background: var(--grad-surface);
  border: 1px solid rgba(139,92,246,0.2);
}
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  display: flex; align-items: center; gap: 16px;
  transition: var(--transition);
}
.stat-card:hover { border-color: var(--primary); transform: translateY(-2px); box-shadow: var(--shadow-pri); }
.stat-icon {
  width: 52px; height: 52px; border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem; flex-shrink: 0;
}
.stat-icon.purple { background: rgba(139,92,246,0.15); }
.stat-icon.pink   { background: rgba(236,72,153,0.15); }
.stat-icon.teal   { background: rgba(20,184,166,0.15); }
.stat-icon.amber  { background: rgba(245,158,11,0.15); }
.stat-value { font-family: 'Outfit', sans-serif; font-size: 2rem; font-weight: 800; line-height: 1; }
.stat-label { color: var(--text-secondary); font-size: 0.82rem; margin-top: 2px; }

/* ── BUTTONS ─────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 20px; border-radius: var(--radius-sm);
  font-size: 0.88rem; font-weight: 600;
  transition: var(--transition); cursor: pointer; border: none;
  white-space: nowrap;
}
.btn-primary {
  background: var(--grad-primary); color: white;
  box-shadow: var(--shadow-pri);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 30px rgba(139,92,246,0.5); }
.btn-primary:active { transform: translateY(0); }
.btn-secondary {
  background: var(--bg-card-hover); color: var(--text-primary);
  border: 1px solid var(--border);
}
.btn-secondary:hover { border-color: var(--border-hover); background: rgba(255,255,255,0.1); }
.btn-ghost { background: transparent; color: var(--text-secondary); }
.btn-ghost:hover { background: var(--bg-card-hover); color: var(--text-primary); }
.btn-danger { background: rgba(239,68,68,0.15); color: var(--danger); border: 1px solid rgba(239,68,68,0.3); }
.btn-danger:hover { background: rgba(239,68,68,0.25); }
.btn-teal { background: var(--grad-teal); color: white; box-shadow: var(--teal-glow); }
.btn-sm { padding: 7px 14px; font-size: 0.82rem; }
.btn-icon { padding: 8px; border-radius: var(--radius-sm); background: var(--bg-card); border: 1px solid var(--border); color: var(--text-secondary); transition: var(--transition); }
.btn-icon:hover { border-color: var(--primary); color: var(--primary); }
.btn-lg { padding: 14px 28px; font-size: 1rem; border-radius: var(--radius-md); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none !important; }

/* ── INPUTS ──────────────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-label { font-size: 0.82rem; font-weight: 600; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.05em; }
.form-label .required { color: var(--accent); margin-left: 3px; }
.form-control {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  color: var(--text-primary);
  font-size: 0.9rem;
  width: 100%;
  transition: var(--transition);
}
.form-control:focus { border-color: var(--primary); background: rgba(139,92,246,0.08); box-shadow: 0 0 0 3px var(--primary-glow); }
.form-control::placeholder { color: var(--text-muted); }
textarea.form-control { resize: vertical; min-height: 90px; }
select.form-control { cursor: pointer; }
select.form-control option { background: var(--bg-surface); }
.form-hint { font-size: 0.78rem; color: var(--text-muted); }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.form-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }

/* ── SEARCH BAR ──────────────────────────────────────────── */
.search-wrap { position: relative; }
.search-icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--text-muted); pointer-events: none; }
.search-input {
  background: var(--bg-input); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 11px 14px 11px 42px;
  color: var(--text-primary); font-size: 0.9rem; width: 100%; min-width: 280px;
  transition: var(--transition);
}
.search-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-glow); }
.search-input::placeholder { color: var(--text-muted); }

/* ── TABLE ───────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; border-radius: var(--radius-lg); border: 1px solid var(--border); }
.data-table { width: 100%; border-collapse: collapse; }
.data-table thead { background: rgba(139,92,246,0.08); }
.data-table th {
  padding: 13px 16px; text-align: left;
  font-size: 0.75rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--text-muted);
  border-bottom: 1px solid var(--border); white-space: nowrap;
}
.data-table td {
  padding: 14px 16px; font-size: 0.88rem;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  vertical-align: middle;
}
.data-table tbody tr { transition: var(--transition); }
.data-table tbody tr:hover { background: var(--bg-card-hover); }
.data-table tbody tr:last-child td { border-bottom: none; }

/* ── BADGES ──────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: 99px;
  font-size: 0.72rem; font-weight: 700;
}
.badge-success { background: rgba(16,185,129,0.15); color: var(--success); }
.badge-warning { background: rgba(245,158,11,0.15); color: var(--warning); }
.badge-danger  { background: rgba(239,68,68,0.15);  color: var(--danger); }
.badge-info    { background: rgba(59,130,246,0.15);  color: var(--info); }
.badge-purple  { background: rgba(139,92,246,0.15);  color: var(--primary-light); }
.badge-pink    { background: rgba(236,72,153,0.15);  color: var(--accent-light); }

/* ── TABS ────────────────────────────────────────────────── */
.tabs-nav {
  display: flex; gap: 4px; flex-wrap: wrap;
  background: rgba(255,255,255,0.03);
  border-radius: var(--radius-md);
  padding: 6px;
  border: 1px solid var(--border);
  margin-bottom: 24px;
}
.tab-btn {
  padding: 9px 16px; border-radius: var(--radius-sm);
  font-size: 0.82rem; font-weight: 600;
  color: var(--text-muted); background: transparent;
  cursor: pointer; transition: var(--transition); border: none;
  white-space: nowrap;
}
.tab-btn:hover { color: var(--text-primary); background: var(--bg-card-hover); }
.tab-btn.active { background: var(--primary-glow); color: var(--primary-light); border: 1px solid rgba(139,92,246,0.3); }
.tab-panel { display: none; }
.tab-panel.active { display: block; animation: fadeIn 0.2s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ── SECTION HEADERS ─────────────────────────────────────── */
.section-title {
  font-size: 0.9rem; font-weight: 700;
  color: var(--primary-light);
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(139,92,246,0.2);
  margin-bottom: 18px;
  display: flex; align-items: center; gap: 8px;
}
.section-title .sec-icon { font-size: 1rem; }

/* ── PATIENT CARD ────────────────────────────────────────── */
.patient-avatar {
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--grad-primary);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.85rem; font-weight: 700; color: white;
  flex-shrink: 0; border: 2px solid var(--primary-glow);
}
.patient-name { font-weight: 600; font-size: 0.92rem; }
.patient-meta { font-size: 0.78rem; color: var(--text-muted); margin-top: 1px; }
.alert-dot {
  width: 8px; height: 8px; border-radius: 50%;
  display: inline-block; margin-left: 6px;
}
.alert-dot.red    { background: var(--danger); box-shadow: 0 0 6px var(--danger); }
.alert-dot.amber  { background: var(--warning); box-shadow: 0 0 6px var(--warning); }
.alert-dot.green  { background: var(--success); box-shadow: 0 0 6px var(--success); }

/* ── FILTERS BAR ─────────────────────────────────────────── */
.filters-bar { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; margin-bottom: 20px; }
.filter-chip {
  padding: 7px 14px; border-radius: 99px;
  background: var(--bg-card); border: 1px solid var(--border);
  font-size: 0.8rem; font-weight: 500; color: var(--text-secondary);
  cursor: pointer; transition: var(--transition);
}
.filter-chip:hover { border-color: var(--primary); color: var(--primary-light); }
.filter-chip.active { background: var(--primary-glow); border-color: var(--primary); color: var(--primary-light); }

/* ── MODAL ───────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(6px);
  z-index: 900;
}
.modal-overlay.hidden { display: none; }
.modal {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%,-50%) scale(0.95);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 32px;
  width: 90%; max-width: 560px; max-height: 90vh;
  overflow-y: auto;
  z-index: 910;
  animation: modal-in 0.22s cubic-bezier(0.34,1.56,0.64,1) forwards;
}
.modal-lg { max-width: 780px; }
.modal-xl { max-width: 1000px; }
@keyframes modal-in { to { transform: translate(-50%,-50%) scale(1); opacity: 1; } }
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; }
.modal-title { font-family: 'Outfit', sans-serif; font-size: 1.3rem; font-weight: 700; }
.modal-close { background: var(--bg-card); border: 1px solid var(--border); color: var(--text-secondary); width: 34px; height: 34px; border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; cursor: pointer; font-size: 1.1rem; transition: var(--transition); }
.modal-close:hover { border-color: var(--danger); color: var(--danger); }
.modal-footer { margin-top: 24px; display: flex; justify-content: flex-end; gap: 10px; padding-top: 20px; border-top: 1px solid var(--border); }

/* ── TOAST NOTIFICATIONS ─────────────────────────────────── */
#toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 9990; display: flex; flex-direction: column; gap: 10px; pointer-events: none; }
.toast {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  display: flex; align-items: center; gap: 12px;
  min-width: 280px; max-width: 380px;
  box-shadow: var(--shadow-lg);
  animation: toast-in 0.3s ease;
  pointer-events: all;
}
.toast.removing { animation: toast-out 0.3s ease forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateY(20px) scale(0.95); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateY(20px) scale(0.95); } }
.toast-icon { font-size: 1.2rem; flex-shrink: 0; }
.toast-msg { font-size: 0.88rem; flex: 1; }
.toast.success { border-color: rgba(16,185,129,0.4); }
.toast.error   { border-color: rgba(239,68,68,0.4); }
.toast.info    { border-color: rgba(139,92,246,0.4); }
.toast.warning { border-color: rgba(245,158,11,0.4); }

/* ── SETUP / CONFIG SCREEN ───────────────────────────────── */
.setup-screen {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: var(--bg-base); padding: 24px;
}
.setup-card {
  background: var(--bg-surface);
  border: 1px solid rgba(139,92,246,0.3);
  border-radius: var(--radius-xl);
  padding: 48px;
  width: 100%; max-width: 600px;
  box-shadow: 0 0 80px rgba(139,92,246,0.12);
}
.setup-hero { text-align: center; margin-bottom: 36px; }
.setup-hero-icon { font-size: 3.5rem; margin-bottom: 16px; display: block; }
.setup-hero h1 { font-family: 'Outfit', sans-serif; font-size: 2rem; font-weight: 800; margin-bottom: 8px; }
.setup-hero p { color: var(--text-secondary); font-size: 0.95rem; }
.setup-step { background: rgba(139,92,246,0.06); border: 1px solid rgba(139,92,246,0.15); border-radius: var(--radius-md); padding: 20px; margin-bottom: 16px; }
.setup-step-header { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.step-num { width: 28px; height: 28px; border-radius: 50%; background: var(--grad-primary); color: white; font-size: 0.78rem; font-weight: 700; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.step-title { font-weight: 700; font-size: 0.92rem; }
.step-desc { font-size: 0.8rem; color: var(--text-secondary); margin-top: 2px; }
.code-block { background: rgba(0,0,0,0.4); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 14px; font-family: monospace; font-size: 0.8rem; color: var(--teal); margin-top: 8px; word-break: break-all; }

/* ── LOGIN SCREEN ────────────────────────────────────────── */
.login-screen {
  min-height: 100vh; display: flex;
  background: var(--bg-base);
}
.login-left {
  flex: 1; display: flex; align-items: center; justify-content: center;
  padding: 48px;
  background: radial-gradient(ellipse at 30% 50%, rgba(139,92,246,0.1) 0%, transparent 60%),
              radial-gradient(ellipse at 70% 80%, rgba(236,72,153,0.07) 0%, transparent 50%);
}
.login-card { width: 100%; max-width: 420px; }
.login-logo { display: flex; align-items: center; gap: 12px; margin-bottom: 40px; }
.login-logo .brand-icon { font-size: 2rem; }
.login-logo .brand-name { font-family: 'Outfit', sans-serif; font-size: 1.6rem; font-weight: 800; }
.login-title { font-family: 'Outfit', sans-serif; font-size: 2.2rem; font-weight: 800; line-height: 1.2; margin-bottom: 10px; }
.login-subtitle { color: var(--text-secondary); font-size: 0.95rem; margin-bottom: 36px; line-height: 1.6; }
.login-features { display: flex; flex-direction: column; gap: 14px; margin-bottom: 36px; }
.login-feature { display: flex; align-items: center; gap: 12px; font-size: 0.9rem; }
.login-feature .feat-icon { width: 36px; height: 36px; border-radius: var(--radius-sm); background: var(--bg-card); border: 1px solid var(--border); display: flex; align-items: center; justify-content: center; font-size: 1rem; flex-shrink: 0; }
.login-right {
  width: 460px; flex-shrink: 0;
  background: var(--grad-surface);
  border-left: 1px solid rgba(139,92,246,0.15);
  display: flex; align-items: center; justify-content: center;
  padding: 48px;
  position: relative; overflow: hidden;
}
.login-right-bg {
  position: absolute; inset: 0;
  background: radial-gradient(ellipse at center, rgba(139,92,246,0.15) 0%, transparent 70%);
}
.g-signin-btn {
  display: flex; align-items: center; justify-content: center; gap: 12px;
  width: 100%; padding: 14px 24px;
  background: white; color: #1a1a2e;
  border: none; border-radius: var(--radius-sm);
  font-size: 0.95rem; font-weight: 600; cursor: pointer;
  transition: var(--transition); box-shadow: var(--shadow-md);
}
.g-signin-btn:hover { background: #f8f8f8; transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.g-signin-btn img { width: 22px; }
.or-divider { display: flex; align-items: center; gap: 12px; color: var(--text-muted); font-size: 0.82rem; margin: 18px 0; }
.or-divider::before,.or-divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.config-link { font-size: 0.82rem; text-align: center; color: var(--text-muted); }
.config-link a { color: var(--primary-light); text-decoration: underline; cursor: pointer; }

/* ── PATIENT DETAIL HEADER ───────────────────────────────── */
.patient-header-card {
  background: var(--grad-surface);
  border: 1px solid rgba(139,92,246,0.25);
  border-radius: var(--radius-xl);
  padding: 28px 32px;
  margin-bottom: 24px;
  display: flex; align-items: center; gap: 24px; flex-wrap: wrap;
}
.patient-header-avatar {
  width: 72px; height: 72px; border-radius: 50%;
  background: var(--grad-primary);
  display: flex; align-items: center; justify-content: center;
  font-family: 'Outfit', sans-serif; font-size: 1.8rem; font-weight: 800; color: white;
  flex-shrink: 0; border: 3px solid rgba(139,92,246,0.4);
  box-shadow: 0 0 30px rgba(139,92,246,0.3);
}
.patient-header-info { flex: 1; min-width: 0; }
.patient-header-name { font-family: 'Outfit', sans-serif; font-size: 1.7rem; font-weight: 800; }
.patient-header-meta { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 6px; }
.patient-header-meta span { font-size: 0.85rem; color: var(--text-secondary); display: flex; align-items: center; gap: 5px; }
.patient-header-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.alert-banner {
  background: rgba(239,68,68,0.1); border: 1px solid rgba(239,68,68,0.3);
  border-radius: var(--radius-md); padding: 10px 16px;
  display: flex; align-items: center; gap: 10px;
  font-size: 0.85rem; color: var(--danger);
  margin-bottom: 16px;
}

/* ── EVOLUTION TIMELINE ──────────────────────────────────── */
.evolution-list { display: flex; flex-direction: column; gap: 16px; }
.evolution-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 18px;
  position: relative;
  transition: var(--transition);
}
.evolution-item:hover { border-color: var(--border-hover); }
.evolution-date {
  font-size: 0.78rem; font-weight: 700; color: var(--primary-light);
  text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 8px;
}
.evolution-motivo { font-weight: 600; font-size: 0.92rem; margin-bottom: 6px; }
.evolution-body { font-size: 0.86rem; color: var(--text-secondary); line-height: 1.6; }
.btn-add-evolucion {
  display: flex; align-items: center; gap: 8px;
  background: rgba(139,92,246,0.1); border: 1px dashed rgba(139,92,246,0.4);
  border-radius: var(--radius-md); padding: 16px;
  color: var(--primary-light); font-size: 0.88rem; font-weight: 600;
  cursor: pointer; transition: var(--transition); width: 100%;
  justify-content: center;
}
.btn-add-evolucion:hover { background: rgba(139,92,246,0.15); border-style: solid; }

/* ── ESTUDIOS TABLE ──────────────────────────────────────── */
.estudio-row {
  display: grid; grid-template-columns: 1fr 1fr 1fr 1fr;
  gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border);
  align-items: center; font-size: 0.86rem;
}
.estudio-row:last-child { border-bottom: none; }
.estudio-name { font-weight: 600; }
.estudio-date { color: var(--text-secondary); }
.estudio-result { color: var(--text-secondary); }

/* ── DRIVE FILES ─────────────────────────────────────────── */
.files-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.file-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: 16px 12px;
  text-align: center; transition: var(--transition); cursor: pointer;
}
.file-card:hover { border-color: var(--primary); transform: translateY(-2px); box-shadow: var(--shadow-pri); }
.file-icon { font-size: 2rem; margin-bottom: 8px; }
.file-name { font-size: 0.78rem; font-weight: 500; word-break: break-all; color: var(--text-secondary); }
.file-size { font-size: 0.7rem; color: var(--text-muted); margin-top: 2px; }
.upload-zone {
  border: 2px dashed rgba(139,92,246,0.4);
  border-radius: var(--radius-lg); padding: 32px;
  text-align: center; cursor: pointer; transition: var(--transition);
  background: rgba(139,92,246,0.04);
}
.upload-zone:hover,.upload-zone.drag-over { border-color: var(--primary); background: rgba(139,92,246,0.1); }
.upload-icon { font-size: 2.5rem; margin-bottom: 12px; }
.upload-label { color: var(--text-secondary); font-size: 0.9rem; }
.upload-label strong { color: var(--primary-light); }

/* ── GEMINI CHAT ─────────────────────────────────────────── */
#gemini-widget { position: fixed; bottom: 24px; right: 24px; z-index: 800; }
.gemini-toggle {
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--grad-primary);
  border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem;
  box-shadow: 0 4px 24px rgba(139,92,246,0.5), 0 0 0 0 rgba(139,92,246,0.4);
  transition: var(--transition);
  animation: pulse-chat 3s ease-in-out infinite;
}
@keyframes pulse-chat { 0%,100% { box-shadow: 0 4px 24px rgba(139,92,246,0.5), 0 0 0 0 rgba(139,92,246,0.4); } 50% { box-shadow: 0 4px 24px rgba(139,92,246,0.5), 0 0 0 10px rgba(139,92,246,0); } }
.gemini-toggle:hover { transform: scale(1.08); }
.gemini-panel {
  position: absolute; bottom: 68px; right: 0;
  width: 360px;
  background: var(--bg-surface);
  border: 1px solid rgba(139,92,246,0.3);
  border-radius: var(--radius-xl);
  box-shadow: 0 20px 60px rgba(0,0,0,0.6);
  overflow: hidden;
  display: none;
  flex-direction: column;
}
.gemini-panel.open { display: flex; animation: fadeIn 0.22s ease; }
.gemini-header {
  padding: 16px 18px;
  background: var(--grad-primary);
  display: flex; align-items: center; gap: 10px;
}
.gemini-header-icon { font-size: 1.3rem; }
.gemini-header-info .title { font-weight: 700; font-size: 0.92rem; }
.gemini-header-info .sub { font-size: 0.72rem; opacity: 0.85; }
.gemini-messages {
  flex: 1; padding: 16px;
  overflow-y: auto; max-height: 340px; min-height: 200px;
  display: flex; flex-direction: column; gap: 12px;
}
.gem-msg { max-width: 85%; }
.gem-msg.user { align-self: flex-end; }
.gem-msg.ai { align-self: flex-start; }
.gem-bubble {
  padding: 10px 14px; border-radius: 14px;
  font-size: 0.85rem; line-height: 1.5;
}
.gem-msg.user .gem-bubble { background: var(--primary); color: white; border-bottom-right-radius: 4px; }
.gem-msg.ai .gem-bubble { background: var(--bg-card); border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.gem-typing { display: flex; gap: 4px; align-items: center; padding: 10px 14px; }
.dot-bounce { width: 7px; height: 7px; border-radius: 50%; background: var(--text-muted); animation: bounce-dot 1.2s infinite; }
.dot-bounce:nth-child(2) { animation-delay: 0.15s; }
.dot-bounce:nth-child(3) { animation-delay: 0.3s; }
@keyframes bounce-dot { 0%,80%,100% { transform: scale(1); opacity: 0.6; } 40% { transform: scale(1.3); opacity: 1; } }
.gemini-input-bar {
  padding: 12px; border-top: 1px solid var(--border);
  display: flex; gap: 8px; align-items: flex-end;
}
.gemini-input {
  flex: 1; background: var(--bg-input); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 9px 12px;
  color: var(--text-primary); font-size: 0.85rem; resize: none;
  max-height: 80px; overflow-y: auto; font-family: inherit;
}
.gemini-input:focus { border-color: var(--primary); }
.btn-send { background: var(--grad-primary); border: none; color: white; padding: 9px 12px; border-radius: var(--radius-sm); cursor: pointer; font-size: 1rem; transition: var(--transition); flex-shrink: 0; }
.btn-send:hover { transform: scale(1.05); }

/* ── EMPTY STATE ─────────────────────────────────────────── */
.empty-state { text-align: center; padding: 60px 24px; }
.empty-icon { font-size: 3.5rem; margin-bottom: 16px; opacity: 0.5; }
.empty-title { font-family: 'Outfit', sans-serif; font-size: 1.2rem; font-weight: 700; margin-bottom: 6px; }
.empty-desc { color: var(--text-muted); font-size: 0.9rem; }

/* ── RESPONSIVE ──────────────────────────────────────────── */
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: none; }
  .main-content { margin-left: 0; padding: 20px 16px; max-width: 100vw; }
  .login-right { display: none; }
  .form-row-3 { grid-template-columns: 1fr 1fr; }
  .patient-header-card { padding: 20px; }
}
@media (max-width: 600px) {
  .form-row-2,.form-row-3 { grid-template-columns: 1fr; }
  .gemini-panel { width: 320px; right: -8px; }
  .setup-card { padding: 28px 20px; }
  .stat-card { padding: 16px; }
  .estudio-row { grid-template-columns: 1fr 1fr; }
}

/* ── ANIMATIONS ──────────────────────────────────────────── */
.fade-in { animation: fadeIn 0.3s ease; }
.slide-up { animation: slideUp 0.3s ease; }
@keyframes slideUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
.spin { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── UTILS ───────────────────────────────────────────────── */
.hidden { display: none !important; }
.flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.gap-24 { gap: 24px; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-sm { font-size: 0.85rem; }
.text-xs { font-size: 0.75rem; }
.font-bold { font-weight: 700; }
.w-full { width: 100%; }
.grid-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 28px; }
.content-section { margin-bottom: 32px; }

/* ── QUICK ACTIONS CHIP (dashboard) ─────────────────────── */
.quick-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 24px; }
.quick-chip {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 18px; border-radius: 99px;
  background: var(--bg-card); border: 1px solid var(--border);
  font-size: 0.85rem; font-weight: 600; color: var(--text-secondary);
  cursor: pointer; transition: var(--transition);
}
.quick-chip:hover { border-color: var(--primary); color: var(--primary-light); background: var(--primary-glow); }
