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

:root {
  --bg: #F5F4F0;
  --surface: #FFFFFF;
  --sidebar: #111118;
  --sidebar-hover: rgba(255,255,255,0.06);
  --sidebar-active: rgba(255,255,255,0.1);
  --accent: #7C5CFC;
  --accent-light: #EEE9FF;
  --accent-dark: #5B3FD4;
  --text: #111118;
  --text-2: #6B6B80;
  --text-3: #9999AA;
  --border: #E8E7E3;
  --green: #22C55E;
  --green-light: #DCFCE7;
  --font-display: 'Fraunces', serif;
  --font-body: 'Inter', sans-serif;
  --radius: 12px;
  --radius-lg: 16px;
  --shadow: 0 1px 4px rgba(0,0,0,0.06), 0 4px 16px rgba(0,0,0,0.04);
}

body { font-family: var(--font-body); background: var(--bg); color: var(--text); min-height: 100vh; -webkit-font-smoothing: antialiased; }

/* ─── SCREENS ─────────────────────────────────────── */
.screen { display: none; min-height: 100vh; }
.screen.active { display: flex; }
.hidden { display: none !important; }

/* ─── AUTH SPLIT ──────────────────────────────────── */
.auth-left {
  width: 480px;
  min-height: 100vh;
  background: #111118;
  display: flex;
  flex-direction: column;
  padding: 48px;
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
}
.auth-left::before {
  content: '';
  position: absolute;
  width: 400px; height: 400px;
  background: radial-gradient(circle, rgba(124,92,252,0.2) 0%, transparent 70%);
  top: -100px; right: -100px;
  pointer-events: none;
}
.auth-left::after {
  content: '';
  position: absolute;
  width: 300px; height: 300px;
  background: radial-gradient(circle, rgba(124,92,252,0.1) 0%, transparent 70%);
  bottom: 0; left: -50px;
  pointer-events: none;
}
.register-left { background: #0D1117; }

.auth-left-inner { position: relative; z-index: 1; display: flex; flex-direction: column; height: 100%; justify-content: center; }

.auth-logo { display: flex; align-items: baseline; gap: 1px; margin-bottom: 48px; }
.auth-logo-img { width: 180px; height: auto; object-fit: contain; }
.auth-logo-img-sm { width: 200px; height: auto; object-fit: contain; margin: 0 auto 8px auto; display: block; }
.logo-mark { font-family: var(--font-display); font-size: 32px; font-weight: 600; color: #A78BFA; line-height: 1; }
.logo-text { font-family: var(--font-display); font-size: 28px; font-weight: 300; color: #FFFFFF; line-height: 1; }
.logo-mark.sm { font-size: 22px; }
.logo-text.sm { font-size: 20px; }

.auth-hero { margin-bottom: 32px; }
.auth-hero h2 { font-family: var(--font-display); font-size: 28px; font-weight: 400; color: #FFFFFF; line-height: 1.3; margin-bottom: 14px; }
.auth-hero p { font-size: 14px; color: rgba(255,255,255,0.45); line-height: 1.7; font-weight: 300; }

.auth-features { display: flex; flex-direction: column; gap: 10px; margin-bottom: 32px; }
.auth-feature { display: flex; align-items: center; gap: 10px; font-size: 13px; color: rgba(255,255,255,0.5); }
.feature-dot { width: 6px; height: 6px; border-radius: 50%; background: #7C5CFC; flex-shrink: 0; }

.auth-image-placeholder {
  flex: 1;
  border: 1px dashed rgba(255,255,255,0.1);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.02);
  min-height: 200px;
}
.placeholder-inner { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.placeholder-inner svg { width: 36px; height: 36px; color: rgba(255,255,255,0.15); }
.placeholder-inner span { font-size: 12px; color: rgba(255,255,255,0.2); }

.auth-right {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px;
  background: var(--surface);
}

.auth-form-wrap { width: 100%; max-width: 400px; }
.auth-form-logo { display: flex; align-items: baseline; gap: 1px; margin-bottom: 12px; }
.auth-form-logo .logo-mark { color: var(--accent); }
.auth-form-logo .logo-text { color: var(--text); }

.auth-form-title { font-family: var(--font-display); font-size: 26px; font-weight: 400; color: var(--text); margin-bottom: 6px; }
.auth-form-sub { font-size: 14px; color: var(--text-2); margin-bottom: 28px; }

.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 12px; font-weight: 500; color: var(--text-2); margin-bottom: 6px; letter-spacing: 0.02em; }
.form-group input, .form-group textarea, .form-group select {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.form-group input:focus, .form-group textarea:focus, .form-group select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(124,92,252,0.12);
  background: white;
}
.form-group textarea { resize: vertical; min-height: 90px; }
.form-group select { appearance: none; cursor: pointer; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.btn-primary {
  padding: 12px 20px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 8px;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.btn-primary:hover { background: var(--accent-dark); transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }
.btn-primary.full { width: 100%; margin-top: 4px; }

.btn-ghost {
  padding: 11px 20px;
  background: transparent;
  color: var(--text-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 400;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-ghost:hover { background: var(--bg); color: var(--text); }
.btn-ghost:disabled { opacity: 0.35; cursor: not-allowed; }

.auth-divider { text-align: center; margin: 20px 0; position: relative; }
.auth-divider::before { content: ''; position: absolute; top: 50%; left: 0; right: 0; height: 1px; background: var(--border); }
.auth-divider span { background: white; padding: 0 12px; font-size: 12px; color: var(--text-3); position: relative; }

.auth-switch { text-align: center; margin-top: 18px; font-size: 13px; color: var(--text-2); }
.auth-switch a { color: var(--accent); text-decoration: none; font-weight: 500; }
.auth-switch a:hover { text-decoration: underline; }
.auth-help { text-align: center; margin-top: 10px; font-size: 12px; color: var(--text-3); }
.auth-help a { color: var(--text-2); text-decoration: none; }

.form-error {
  background: #FEF2F2;
  border: 1px solid #FECACA;
  color: #DC2626;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 14px;
}

/* ─── DASHBOARD LAYOUT ────────────────────────────── */
#dashboard-screen { flex-direction: row; }

.sidebar {
  width: 220px;
  min-height: 100vh;
  background: var(--sidebar);
  display: flex;
  flex-direction: column;
  padding: 24px 12px 0 12px;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
}

.sidebar-logo { display: flex; align-items: baseline; gap: 1px; padding: 0 10px; margin-bottom: 32px; }
.sidebar-logo .logo-mark { font-size: 24px; }
.sidebar-logo .logo-text { font-size: 20px; }

.sidebar-nav { flex: 1; display: flex; flex-direction: column; gap: 2px; }

.nav-label { font-size: 10px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: rgba(255,255,255,0.25); padding: 0 10px; margin-bottom: 6px; margin-top: 4px; display: block; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 10px;
  border-radius: 8px;
  color: rgba(255,255,255,0.45);
  font-size: 13.5px;
  font-weight: 400;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s;
  position: relative;
}
.nav-item svg { width: 16px; height: 16px; flex-shrink: 0; }
.nav-item:hover { background: var(--sidebar-hover); color: rgba(255,255,255,0.8); }
.nav-item.active { background: var(--sidebar-active); color: #FFFFFF; }

.nav-pill {
  margin-left: auto;
  background: rgba(124,92,252,0.25);
  color: #A78BFA;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 10px;
}

.sidebar-bottom {
  border-top: 1px solid rgba(255,255,255,0.06);
  padding: 10px 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex-shrink: 0;
}
.sidebar-user-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  min-width: 0;
}
.sidebar-avatar { width: 28px; height: 28px; border-radius: 8px; background: var(--accent); display: flex; align-items: center; justify-content: center; color: white; font-size: 11px; font-weight: 600; flex-shrink: 0; }
.sidebar-user-name { flex: 1; font-size: 12px; color: rgba(255,255,255,0.4); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.logout-btn { background: none; border: none; color: rgba(255,255,255,0.2); cursor: pointer; padding: 4px; border-radius: 6px; transition: all 0.15s; display: flex; flex-shrink: 0; }
.logout-btn svg { width: 15px; height: 15px; }
.logout-btn:hover { background: rgba(239,68,68,0.1); color: #FCA5A5; }

/* ─── MAIN CONTENT ────────────────────────────────── */
.main-content { margin-left: 220px; flex: 1; padding: 36px 40px; min-height: 100vh; }

.content-section { display: none; animation: fadeUp 0.25s ease; }
.content-section.active { display: block; }

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

.page-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 28px; }
.page-eyebrow { font-size: 12px; color: var(--text-3); margin-bottom: 4px; text-transform: capitalize; }
.page-title { font-family: var(--font-display); font-size: 26px; font-weight: 400; color: var(--text); }
.page-title span { color: var(--accent); }
.page-sub { font-size: 13px; color: var(--text-2); margin-top: 3px; }

.status-chip { display: flex; align-items: center; gap: 7px; padding: 7px 14px; background: var(--surface); border: 1px solid var(--border); border-radius: 20px; font-size: 12px; font-weight: 500; color: var(--text-2); box-shadow: var(--shadow); }
.chip-dot { width: 7px; height: 7px; border-radius: 50%; }
.chip-dot.pending { background: #F59E0B; }
.chip-dot.active { background: var(--green); }

/* Metrics */
.metrics-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 20px; }

.metric-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.metric-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.metric-label { font-size: 12px; font-weight: 500; color: var(--text-2); letter-spacing: 0.02em; }
.metric-icon { width: 32px; height: 32px; border-radius: 8px; display: flex; align-items: center; justify-content: center; }
.metric-icon svg { width: 16px; height: 16px; }
.metric-icon.neutral { background: #F3F4F6; color: var(--text-2); }
.metric-icon.accent { background: var(--accent-light); color: var(--accent); }
.metric-icon.green { background: var(--green-light); color: #16A34A; }
.metric-value { font-family: var(--font-display); font-size: 24px; font-weight: 400; color: var(--text); margin-bottom: 4px; }
.metric-sub { font-size: 11px; color: var(--text-3); }
.metric-progress-bar { height: 3px; background: var(--border); border-radius: 2px; margin-top: 10px; overflow: hidden; }
.metric-progress-bar div { height: 100%; background: var(--accent); border-radius: 2px; transition: width 0.5s ease; width: 0%; }

/* CTA Banner */
.cta-banner { background: var(--text); border-radius: var(--radius-lg); padding: 28px 32px; display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-bottom: 20px; }
.cta-eyebrow { font-size: 11px; font-weight: 500; letter-spacing: 0.06em; text-transform: uppercase; color: rgba(255,255,255,0.35); margin-bottom: 8px; }
.cta-banner h3 { font-family: var(--font-display); font-size: 18px; font-weight: 400; color: white; margin-bottom: 6px; }
.cta-banner p { font-size: 13px; color: rgba(255,255,255,0.45); line-height: 1.5; max-width: 440px; }
.cta-banner .btn-primary { background: white; color: var(--text); flex-shrink: 0; }
.cta-banner .btn-primary:hover { background: #F5F4F0; }

/* Info cards */
.info-cards { display: grid; grid-template-columns: repeat(3,1fr); gap: 14px; }
.info-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.info-icon { width: 36px; height: 36px; background: var(--accent-light); border-radius: 9px; display: flex; align-items: center; justify-content: center; margin-bottom: 14px; }
.info-icon svg { width: 18px; height: 18px; color: var(--accent); }
.info-card h4 { font-size: 14px; font-weight: 600; color: var(--text); margin-bottom: 8px; }
.info-card p { font-size: 13px; color: var(--text-2); line-height: 1.6; font-weight: 300; }

/* ─── CONFIG SECTION ──────────────────────────────── */
.step-badge { background: var(--accent-light); color: var(--accent); font-size: 12px; font-weight: 600; padding: 6px 14px; border-radius: 20px; }

.step-tabs { display: flex; gap: 4px; margin-bottom: 20px; overflow-x: auto; padding-bottom: 2px; }
.step-tab {
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-3);
  background: var(--surface);
  border: 1px solid var(--border);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
}
.step-tab:hover { color: var(--text-2); }
.step-tab.done { background: var(--green-light); color: #16A34A; border-color: #BBF7D0; }
.step-tab.current { background: var(--accent); color: white; border-color: var(--accent); }

.step-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 32px 36px; margin-bottom: 16px; box-shadow: var(--shadow); min-height: 380px; }

.step-panel { display: none; animation: fadeUp 0.2s ease; }
.step-panel.active { display: block; }
.step-eyebrow { font-size: 11px; font-weight: 600; letter-spacing: 0.07em; text-transform: uppercase; color: var(--accent); margin-bottom: 10px; }
.step-panel h2 { font-family: var(--font-display); font-size: 20px; font-weight: 400; color: var(--text); margin-bottom: 6px; }
.step-panel .step-desc { font-size: 13px; color: var(--text-2); margin-bottom: 28px; line-height: 1.5; }

.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.field-row.full { grid-template-columns: 1fr; }

/* Tratamientos */
.item-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 14px; }
.list-item { background: var(--bg); border: 1px solid var(--border); border-radius: 9px; padding: 14px 16px; display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.list-item-text h5 { font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 3px; }
.list-item-text p { font-size: 12px; color: var(--text-2); }
.list-item-remove { background: none; border: none; color: var(--text-3); cursor: pointer; font-size: 18px; line-height: 1; padding: 2px 6px; border-radius: 5px; transition: all 0.15s; flex-shrink: 0; }
.list-item-remove:hover { background: #FEE2E2; color: #DC2626; }

.btn-add { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; padding: 10px; border: 1px dashed var(--border); border-radius: 9px; background: none; font-family: var(--font-body); font-size: 13px; color: var(--text-2); cursor: pointer; transition: all 0.15s; }
.btn-add:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-light); }

.empty-list { text-align: center; padding: 24px; font-size: 13px; color: var(--text-3); }

/* Step Nav */
.step-nav { display: flex; align-items: center; justify-content: space-between; }

/* Resumen */
.resumen-grid { display: grid; gap: 14px; }
.resumen-block { background: var(--bg); border: 1px solid var(--border); border-radius: 9px; padding: 16px; }
.resumen-block-title { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-2); margin-bottom: 12px; }
.resumen-row { display: flex; gap: 12px; padding: 6px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.resumen-row:last-child { border-bottom: none; }
.resumen-key { color: var(--text-3); min-width: 140px; flex-shrink: 0; }
.resumen-val { color: var(--text); }
.resumen-confirm { background: var(--text); border-radius: 10px; padding: 22px; text-align: center; }
.resumen-confirm p { color: rgba(255,255,255,0.5); font-size: 13px; margin-bottom: 14px; }

/* ─── PROFILE ─────────────────────────────────────── */
.profile-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.card-section-title { font-size: 14px; font-weight: 600; color: var(--text); margin-bottom: 18px; }
.profile-row { display: flex; justify-content: space-between; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.profile-row:last-child { border-bottom: none; }
.profile-label { color: var(--text-2); font-size: 13px; }
.step-card .btn-primary { margin-top: 6px; }

#pass-message { padding: 10px 14px; border-radius: 8px; font-size: 13px; margin-bottom: 10px; }
#pass-message.success { background: var(--green-light); color: #16A34A; }
#pass-message.error { background: #FEF2F2; color: #DC2626; }

/* ─── MÉTRICAS ─────────────────────────────────────── */
.date-filter-bar { display:flex; align-items:center; gap:16px; background:var(--surface); border:1px solid var(--border); border-radius:var(--radius); padding:14px 20px; margin-bottom:20px; flex-wrap:wrap; box-shadow:var(--shadow); }
.date-filter-label { font-size:12px; font-weight:600; color:var(--text-2); text-transform:uppercase; letter-spacing:0.05em; }
.date-btns { display:flex; gap:6px; }
.date-btn { padding:6px 14px; border-radius:20px; border:1px solid var(--border); background:none; font-family:var(--font-body); font-size:12px; font-weight:500; color:var(--text-2); cursor:pointer; transition:all 0.15s; }
.date-btn:hover { border-color:var(--accent); color:var(--accent); }
.date-btn.active { background:var(--accent); color:white; border-color:var(--accent); }
.date-custom { display:flex; align-items:center; gap:8px; margin-left:auto; }
.date-custom input { padding:7px 12px; border:1px solid var(--border); border-radius:8px; font-family:var(--font-body); font-size:13px; color:var(--text); background:var(--bg); outline:none; }
.date-custom input:focus { border-color:var(--accent); }
.date-custom span { color:var(--text-3); font-size:13px; }

.charts-grid { display:grid; grid-template-columns:1fr 1fr; gap:16px; margin-top:20px; }
.chart-card { background:var(--surface); border:1px solid var(--border); border-radius:var(--radius); padding:22px 24px; box-shadow:var(--shadow); }
.chart-title { font-size:13px; font-weight:600; color:var(--text); margin-bottom:16px; }

/* ─── TRATAMIENTOS / FAQs ──────────────────────────── */
.items-list { display:flex; flex-direction:column; gap:12px; }
.item-card { background:var(--surface); border:1px solid var(--border); border-radius:var(--radius); padding:20px 24px; display:flex; align-items:flex-start; justify-content:space-between; gap:16px; box-shadow:var(--shadow); }
.item-card-body { flex:1; }
.item-card-body h4 { font-size:15px; font-weight:600; color:var(--text); margin-bottom:6px; }
.item-card-body p { font-size:13px; color:var(--text-2); line-height:1.5; margin-bottom:4px; }
.item-card-body .item-meta { font-size:12px; color:var(--text-3); margin-top:6px; display:flex; gap:12px; }
.item-card-actions { display:flex; gap:8px; flex-shrink:0; }
.btn-icon { background:none; border:1px solid var(--border); border-radius:8px; padding:7px 10px; cursor:pointer; font-size:12px; color:var(--text-2); transition:all 0.15s; }
.btn-icon:hover { border-color:var(--accent); color:var(--accent); }
.btn-icon.danger:hover { border-color:#DC2626; color:#DC2626; background:#FEF2F2; }
.empty-state { text-align:center; padding:48px; color:var(--text-3); }
.empty-state svg { width:40px; height:40px; margin:0 auto 16px; display:block; opacity:0.3; }
.empty-state p { font-size:14px; }

/* ─── MODALES ───────────────────────────────────────── */
.modal { position:fixed; inset:0; background:rgba(0,0,0,0.5); display:flex; align-items:center; justify-content:center; z-index:300; animation:fadeIn 0.2s ease; }
.modal-card { background:var(--surface); border-radius:var(--radius-lg); padding:32px; width:100%; max-width:520px; box-shadow:0 20px 60px rgba(0,0,0,0.2); }
.modal-header { display:flex; align-items:center; justify-content:space-between; margin-bottom:24px; }
.modal-header h3 { font-family:var(--font-display); font-size:18px; font-weight:400; color:var(--text); }
.modal-header button { background:none; border:none; font-size:24px; color:var(--text-3); cursor:pointer; line-height:1; padding:0 4px; }
.modal-header button:hover { color:var(--text); }
.modal-footer { display:flex; gap:10px; justify-content:flex-end; margin-top:24px; }
.modal .form-group { margin-bottom:14px; }

/* ─── SOFÍA ─────────────────────────────────────────── */
.sofia-grid { display:grid; grid-template-columns:1fr 1fr; gap:16px; }

/* ─── RECURSOS ──────────────────────────────────────── */
.recursos-grid { display:flex; flex-direction:column; gap:32px; }
.recurso-category-header { display:flex; align-items:center; gap:12px; margin-bottom:16px; }
.recurso-icon { width:40px; height:40px; border-radius:10px; display:flex; align-items:center; justify-content:center; flex-shrink:0; }
.recurso-icon svg { width:20px; height:20px; }
.recurso-category-header h3 { font-family:var(--font-display); font-size:18px; font-weight:400; color:var(--text); }
.recurso-cards { display:grid; grid-template-columns:repeat(3,1fr); gap:14px; }
.recurso-card { background:var(--surface); border:1px solid var(--border); border-radius:var(--radius); padding:20px; cursor:pointer; transition:all 0.2s; box-shadow:var(--shadow); }
.recurso-card:hover { border-color:var(--accent); transform:translateY(-2px); box-shadow:0 6px 20px rgba(124,92,252,0.12); }
.recurso-card-tag { display:inline-block; background:var(--accent-light); color:var(--accent-dark); font-size:10px; font-weight:600; padding:3px 10px; border-radius:20px; letter-spacing:0.04em; text-transform:uppercase; margin-bottom:10px; }
.recurso-card h4 { font-size:14px; font-weight:600; color:var(--text); margin-bottom:8px; line-height:1.4; }
.recurso-card p { font-size:12px; color:var(--text-2); line-height:1.6; margin-bottom:12px; }
.recurso-link { font-size:12px; font-weight:600; color:var(--accent); }

/* Recurso content */
#recurso-content h2 { font-family:var(--font-display); font-size:20px; font-weight:400; margin-bottom:16px; color:var(--text); }
#recurso-content h3 { font-size:15px; font-weight:600; margin:20px 0 8px; color:var(--text); }
#recurso-content p { margin-bottom:12px; }
#recurso-content ul { padding-left:20px; margin-bottom:12px; }
#recurso-content li { margin-bottom:6px; }
#recurso-content .tip { background:var(--accent-light); border-left:3px solid var(--accent); padding:14px 16px; border-radius:0 8px 8px 0; margin:16px 0; font-size:13px; color:var(--accent-dark); }

/* ─── RESPONSIVE ────────────────────────────────────── */

/* Tablet — 768px a 1024px */
@media (max-width: 1024px) {
  .auth-left { width: 340px; padding: 36px 32px; }
  .auth-hero h2 { font-size: 22px; }
  .main-content { padding: 28px 24px; }
  .metrics-grid { grid-template-columns: repeat(2, 1fr); }
  .info-cards { grid-template-columns: repeat(2, 1fr); }
  .recurso-cards { grid-template-columns: repeat(2, 1fr); }
  .charts-grid { grid-template-columns: 1fr; }
  .sofia-grid { grid-template-columns: 1fr; }
  .profile-grid { grid-template-columns: 1fr; }
}

/* Mobile — hasta 768px */
@media (max-width: 768px) {

  /* ── Auth ── */
  .auth-left { display: none; }
  .auth-right { padding: 32px 24px; align-items: flex-start; padding-top: 48px; }
  .auth-form-wrap { max-width: 100%; }
  .form-row { grid-template-columns: 1fr; }

  /* ── Sidebar mobile ── */
  .sidebar {
    width: 100%;
    min-height: auto;
    height: 60px;
    bottom: 0;
    top: auto;
    left: 0;
    right: 0;
    flex-direction: row;
    padding: 0 12px;
    padding-bottom: env(safe-area-inset-bottom);
    z-index: 200;
    overflow: hidden;
  }

  .sidebar-logo { display: none; }
  .sidebar-nav {
    flex-direction: row;
    flex: 1;
    gap: 0;
    justify-content: space-around;
    align-items: center;
    height: 100%;
    overflow-x: auto;
  }

  .nav-label { display: none; }
  .nav-item {
    flex-direction: column;
    gap: 3px;
    padding: 6px 10px;
    font-size: 9px;
    border-radius: 6px;
    min-width: 52px;
    align-items: center;
    text-align: center;
  }
  .nav-item svg { width: 18px; height: 18px; }
  .nav-pill { display: none; }

  .sidebar-bottom { display: none; }

  /* ── Main content ── */
  .main-content {
    margin-left: 0;
    padding: 20px 16px;
    padding-bottom: 80px; /* espacio para nav bottom */
    min-height: 100vh;
  }

  /* ── Page header ── */
  .page-header {
    flex-direction: column;
    gap: 12px;
    align-items: flex-start;
    margin-bottom: 20px;
  }
  .page-header .btn-primary { width: 100%; text-align: center; }
  .page-title { font-size: 22px; }

  /* ── Metrics ── */
  .metrics-grid { grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
  .metric-card { padding: 14px; }
  .metric-value { font-size: 20px; }

  /* ── CTA Banner ── */
  .cta-banner {
    flex-direction: column;
    align-items: flex-start;
    padding: 20px;
    gap: 16px;
  }
  .cta-banner .btn-primary { width: 100%; text-align: center; }

  /* ── Info cards ── */
  .info-cards { grid-template-columns: 1fr; gap: 10px; }

  /* ── Config wizard ── */
  .step-card { padding: 20px 18px; min-height: auto; }
  .step-tabs { gap: 6px; }
  .step-tab { padding: 5px 10px; font-size: 11px; }
  .field-row { grid-template-columns: 1fr; }
  .step-nav { gap: 10px; }
  .step-nav .btn-ghost,
  .step-nav .btn-primary { flex: 1; text-align: center; }

  /* ── Charts ── */
  .charts-grid { grid-template-columns: 1fr; gap: 12px; }
  .date-filter-bar { flex-direction: column; align-items: flex-start; gap: 10px; padding: 12px 14px; }
  .date-custom { margin-left: 0; width: 100%; justify-content: space-between; }
  .date-btns { flex-wrap: wrap; }

  /* ── Tratamientos / Items ── */
  .item-card { flex-direction: column; gap: 12px; }
  .item-card-actions { width: 100%; justify-content: flex-end; }

  /* ── Mi Clínica / Sofia grid ── */
  .sofia-grid { grid-template-columns: 1fr; gap: 12px; }
  .sofia-grid .step-card[style*="grid-column"] { grid-column: 1 !important; }

  /* ── Recursos ── */
  .recurso-cards { grid-template-columns: 1fr; gap: 10px; }

  /* ── Profile ── */
  .profile-grid { grid-template-columns: 1fr; }

  /* ── Modales ── */
  .modal { align-items: flex-end; }
  .modal-card {
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    max-height: 90vh;
    overflow-y: auto;
    padding: 24px 20px;
    padding-bottom: calc(24px + env(safe-area-inset-bottom));
  }

  /* ── Metricas cards home ── */
  #metricas-cards { grid-template-columns: 1fr 1fr; }
}

/* Mobile chico — hasta 480px */
@media (max-width: 480px) {
  .metrics-grid { grid-template-columns: 1fr; }
  #metricas-cards { grid-template-columns: 1fr; }
  .nav-item { min-width: 44px; font-size: 8px; padding: 6px 6px; }
  .main-content { padding: 16px 12px; padding-bottom: 80px; }
}

/* ─── BOT SWITCH ─────────────────────────────────────── */
.bot-switch-row { display:flex; align-items:center; justify-content:center; gap:10px; padding:8px 10px; border-bottom:1px solid rgba(255,255,255,0.06); margin-bottom:8px; }
.bot-switch-label { display:flex; align-items:center; gap:7px; }
.bot-switch-dot { width:7px; height:7px; border-radius:50%; background:#EF4444; flex-shrink:0; transition:background 0.3s; }
.bot-switch-dot.active { background:var(--green); }
#bot-switch-text { font-size:12px; color:rgba(255,255,255,0.5); font-weight:500; }

.toggle-switch { position:relative; display:inline-block; width:36px; height:20px; flex-shrink:0; }
.toggle-switch input { opacity:0; width:0; height:0; }
.toggle-slider { position:absolute; cursor:pointer; inset:0; background:rgba(255,255,255,0.15); border-radius:20px; transition:0.3s; }
.toggle-slider::before { content:''; position:absolute; width:14px; height:14px; left:3px; top:50%; transform:translateY(-50%); background:white; border-radius:50%; transition:0.3s; }
.toggle-switch input:checked + .toggle-slider { background:var(--green); }
.toggle-switch input:checked + .toggle-slider::before { transform:translateY(-50%) translateX(16px); }

/* ── CONSULTAS / TURNOS TABLES ── */
.table-container { width:100%; overflow-x:auto; }
.data-table { width:100%; border-collapse:collapse; font-size:13px; }
.data-table thead tr { background:var(--surface-2, #f5f5f8); }
.data-table th { padding:10px 14px; text-align:left; font-weight:600; color:var(--text-2); white-space:nowrap; border-bottom:1px solid var(--border); }
.data-table td { padding:10px 14px; border-bottom:1px solid var(--border); color:var(--text); vertical-align:middle; max-width:220px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.data-table tbody tr:hover { background:var(--surface-2, #f9f9fc); }
.loading-text { text-align:center; padding:48px; color:var(--text-3); font-size:14px; }

/* Badges */
.badge { display:inline-block; padding:2px 8px; border-radius:20px; font-size:11px; font-weight:600; white-space:nowrap; }
.badge-green  { background:#dcfce7; color:#16a34a; }
.badge-yellow { background:#fef9c3; color:#ca8a04; }
.badge-red    { background:#fee2e2; color:#dc2626; }
.badge-gray   { background:#f1f5f9; color:#64748b; }
.badge-blue   { background:#dbeafe; color:#2563eb; }

/* ── INFORMES ── */
.informes-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 20px; }
.informe-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); }
.informe-card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.informe-card-header h3 { font-size: 17px; font-weight: 600; color: var(--text); }
.informe-meta { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--text-2); margin-bottom: 20px; }
.informe-actions { display: flex; gap: 10px; }

/* Badge notificación sidebar */
.nav-badge { background: #7c3aed; color: white; font-size: 10px; font-weight: 700; padding: 2px 7px; border-radius: 20px; margin-left: auto; }
