@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;500;600;700;800;900&family=Plus+Jakarta+Sans:wght@800&display=swap');

/* ══════════════════════════════════════════════════════════
   VARIABLES — theme-light.css + theme-dark.css (17/6/2026)
══════════════════════════════════════════════════════════ */
:root {
  --bg:           #dde4ea;
  --sh-l:         #f6f8fa;
  --sh-d:         #abbccb;
  --grd-l:        #f6f8fa;
  --grd-m:        #d0dae2;
  --primary:      #5979a1;
  --prim-d:       #476080;
  --prim-l:       #7f98b8;
  --text:         #2d3748;
  --text-muted:   #718096;
  --danger:       #e05252;
  --success:      #3aaf8a;
  --radius:       7px;
  --dist:         3px;
  --blur:         4px;
  --drop:         3px 3px 4px #abbccb, -3px -3px 4px #f6f8fa;
  --inset:        inset 3px 3px 4px #abbccb, inset -3px -3px 4px #f6f8fa;

  /* aliases de compatibilidad con los templates */
  --white:          var(--bg);
  --sidebar-bg:     #1e2a3a;
  --sidebar-hover:  rgba(255,255,255,.12);
  --primary-light:  rgba(89,121,161,.12);
  --primary-dark:   #476080;
  --border:         rgba(0,0,0,0);
  --card-shadow:    var(--drop);
}

[data-theme="dark"] {
  --bg:           #2f4146;
  --sh-l:         #3f585e;
  --sh-d:         #1f2a2e;
  --grd-l:        #3f585e;
  --grd-m:        #27363a;
  --primary:      #5979a1;
  --prim-d:       #476080;
  --prim-l:       #7f98b8;
  --accent:       #223144;
  --accent2:      #6285ac;
  --text:         #c4d4da;
  --text-muted:   #5e7a84;
  --danger:       #F87171;
  --success:      #34D399;
  --radius:       7px;
  --dist:         3px;
  --blur:         4px;
  --drop:         3px 3px 4px #1a2428, -3px -3px 4px #455f66;
  --inset:        inset 3px 3px 4px #1a2428, inset -3px -3px 4px #455f66;

  --white:          #2f4146;
  --sidebar-bg:     #1e2d31;
  --sidebar-hover:  rgba(255,255,255,.1);
  --primary-light:  rgba(89,121,161,.15);
  --primary-dark:   #476080;
  --border:         rgba(0,0,0,0);
  --card-shadow:    var(--drop);
}

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

body {
  font-family: 'Nunito', sans-serif;
  background: var(--bg);
  color: var(--text);
  display: flex;
  height: 100vh;
  overflow: hidden;
  transition: background .3s, color .3s;
}

/* ══════════════════════════════════════════════════════════
   SIDEBAR
══════════════════════════════════════════════════════════ */
.sidebar {
  width: 240px;
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: relative;
  overflow-y: auto;
  overflow-x: hidden;
  box-shadow: 4px 0 20px rgba(0,0,0,.25);
}

.sidebar-logo {
  padding: 28px 24px 24px;
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.logo-container {
  display: flex; align-items: center; gap: 10px;
}
.logo-isotipo {
  width: 34px; height: 34px;
  object-fit: contain; flex-shrink: 0;
}
.logo-text {
  font-family: 'Plus Jakarta Sans', sans-serif; font-weight: 800;
  font-size: 18px; font-weight: 600;
  color: #fff; letter-spacing: -0.3px;
}
.logo-text span { color: rgba(255,255,255,.5); }
.logo-zhluk {
  width: 70%; height: auto;
  object-fit: contain;
  display: block; margin: 0 auto;
}

.sidebar-nav { padding: 16px 12px; flex: 0 0 auto; }

.nav-label {
  font-size: 10px; text-transform: uppercase;
  letter-spacing: 1px; color: rgba(255,255,255,.25);
  padding: 0 12px; margin-bottom: 8px; margin-top: 16px; font-weight: 500;
}

.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; border-radius: 12px;
  cursor: pointer; transition: all .18s ease;
  margin-bottom: 2px; color: rgba(255,255,255,.45);
  font-size: 14px; font-weight: 400;
  text-decoration: none;
}
.nav-item:hover {
  background: rgba(255,255,255,.07);
  color: rgba(255,255,255,.8);
}
.nav-item.active {
  background: linear-gradient(135deg, rgba(var(--_pr),.22), rgba(var(--_pr),.1));
  background: rgba(255,255,255,.1);
  color: var(--prim-l);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.08);
  font-weight: 600;
}
.nav-icon { width: 18px; height: 18px; flex-shrink: 0; }

.sidebar-footer {
  padding: 16px 12px;
  border-top: 1px solid rgba(255,255,255,.06);
}
.btn-footer {
  display: flex; align-items: center; gap: 8px;
  width: 100%; padding: 9px 12px; border-radius: 10px;
  border: none; background: rgba(255,255,255,.05);
  color: rgba(255,255,255,.5); font-size: 13px;
  cursor: pointer; font-family: 'Nunito', sans-serif;
  transition: all .15s; margin-bottom: 6px; text-decoration: none;
}
.btn-footer:hover { background: rgba(255,255,255,.1); color: rgba(255,255,255,.8); }
.btn-footer.danger { color: #fca5a5; }
.btn-footer.danger:hover { background: rgba(239,68,68,.15); }

.sidebar-profile {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 16px;
  border-top: 1px solid rgba(255,255,255,.06);
}
.sidebar-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: linear-gradient(145deg, var(--primary), var(--prim-d));
  box-shadow: 3px 3px 8px rgba(0,0,0,.3), -2px -2px 5px rgba(255,255,255,.04);
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-size: 15px; font-weight: 700; flex-shrink: 0;
}
.sidebar-profile-info { min-width: 0; }
.sidebar-profile-name {
  font-size: 12px; font-weight: 600; color: rgba(255,255,255,.8);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sidebar-profile-role {
  font-size: 10px; color: rgba(255,255,255,.35);
  text-transform: uppercase; letter-spacing: .8px; font-weight: 500;
}

/* Mini-calendarios */
.sidebar-mini-cals {
  padding: 0 8px 8px;
  display: flex; flex-direction: column; gap: 12px;
}
.mini-cal-wrap {
  background: rgba(255,255,255,.04);
  border-radius: 12px; padding: 8px;
  box-shadow: inset 2px 2px 6px rgba(0,0,0,.2), inset -1px -1px 4px rgba(255,255,255,.03);
}
.mini-cal-header {
  text-align: center; color: #fff; font-size: 11px; font-weight: 600;
  margin-bottom: 6px; letter-spacing: .3px;
}
.mini-cal-grid {
  display: grid; grid-template-columns: repeat(7, 1fr);
  gap: 1px; text-align: center;
}
.mini-cal-grid span {
  font-size: 10px; color: rgba(255,255,255,.5);
  padding: 3px 0; border-radius: 4px; cursor: default;
}
.mini-cal-grid .mc-head { color: rgba(255,255,255,.25); font-weight: 600; font-size: 9px; }
.mini-cal-grid .mc-today {
  background: var(--primary); color: #fff !important;
  font-weight: 700; border-radius: 50%;
}
.mini-cal-grid .mc-day:hover { background: rgba(255,255,255,.1); cursor: pointer; }

.sidebar-clocks-section { padding: 0 8px 8px; }
.sidebar-clocks-label {
  font-size: 10px; text-transform: uppercase; letter-spacing: 1px;
  color: rgba(255,255,255,.3); font-weight: 600;
  margin-bottom: 8px; padding: 0 4px;
}
.sidebar-clocks-grid {
  background: rgba(0,0,0,.2);
  border-radius: 12px; padding: 10px 6px;
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px;
  box-shadow: inset 2px 2px 8px rgba(0,0,0,.3);
}
.clock-item { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.clock-item canvas { display: block; }
.clock-city { font-size: 9px; color: rgba(255,255,255,.65); font-weight: 600; text-align: center; line-height: 1.1; }
.clock-offset { font-size: 8px; color: rgba(255,255,255,.3); text-align: center; }

/* ══════════════════════════════════════════════════════════
   MAIN
══════════════════════════════════════════════════════════ */
.main {
  flex: 1; overflow-y: auto;
  padding: 40px 48px;
  background: var(--bg);
}
.main::-webkit-scrollbar { width: 5px; }
.main::-webkit-scrollbar-track { background: transparent; }
.main::-webkit-scrollbar-thumb { background: var(--sh-d); border-radius: 3px; }

.page-header { margin-bottom: 32px; }
.page-title {
  font-family: 'Plus Jakarta Sans', sans-serif; font-weight: 800;
  font-size: 28px; font-weight: 600;
  color: var(--text); letter-spacing: -.5px; margin-bottom: 4px;
}
.page-subtitle { font-size: 14px; color: var(--text-muted); }

/* ── TABS ───────────────────────────────────────────────── */
.tabs {
  display: flex; gap: 4px;
  margin-bottom: 32px;
  background: var(--bg);
  padding: 6px;
  border-radius: calc(var(--radius) + 4px);
  box-shadow: var(--inset);
  width: fit-content;
}
.tab {
  padding: 9px 22px;
  font-size: 13px; font-weight: 500;
  color: var(--text-muted); cursor: pointer;
  border-radius: var(--radius);
  background: none; border: none;
  font-family: 'Nunito', sans-serif;
  transition: all .2s;
}
.tab:hover { color: var(--text); }
.tab.active {
  color: var(--text);
  font-weight: 600;
  background: linear-gradient(145deg, var(--grd-l), var(--grd-m));
  box-shadow: var(--drop);
}
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ══════════════════════════════════════════════════════════
   CARDS
══════════════════════════════════════════════════════════ */
.card {
  background: linear-gradient(145deg, var(--grd-l), var(--grd-m));
  border-radius: var(--radius);
  padding: 32px;
  box-shadow: var(--drop);
  border: none;
}
.card-title {
  font-size: 16px; font-weight: 600; color: var(--text); margin-bottom: 24px;
}

/* ── GRUPOS GRID ────────────────────────────────────────── */
.grupos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 18px; max-width: 960px;
}

.grupo-card {
  background: linear-gradient(145deg, var(--grd-l), var(--grd-m));
  border-radius: var(--radius);
  padding: 20px 22px;
  border: none;
  box-shadow: var(--drop);
  cursor: pointer;
  transition: box-shadow .25s, transform .2s;
}
.grupo-card:hover {
  transform: translateY(-2px);
  box-shadow:
    calc(var(--dist) + 3px) calc(var(--dist) + 3px) calc(var(--blur) + 6px) var(--sh-d),
    calc(-1*(var(--dist) + 3px)) calc(-1*(var(--dist) + 3px)) calc(var(--blur) + 6px) var(--sh-l);
}
.grupo-card.selected {
  box-shadow: var(--inset);
  transform: translateY(0);
}

.grupo-header {
  display: flex; align-items: center;
  justify-content: space-between; margin-bottom: 12px;
}
.grupo-icon {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: var(--bg);
  box-shadow: var(--drop);
  display: flex; align-items: center; justify-content: center;
}
.grupo-badge {
  font-size: 11px; font-weight: 600;
  padding: 3px 10px; border-radius: 20px;
  background: var(--bg); box-shadow: var(--inset);
  color: var(--primary);
}
.grupo-badge.inactivo { color: var(--danger); }

.grupo-nombre { font-size: 15px; font-weight: 600; color: var(--text); margin-bottom: 4px; }
.grupo-desc   { font-size: 12px; color: var(--text-muted); line-height: 1.5; margin-bottom: 14px; }
.grupo-meta   { display: flex; align-items: center; gap: 14px; font-size: 12px; color: var(--text-muted); }
.grupo-meta span { display: flex; align-items: center; gap: 4px; }

.grupo-add-card {
  background: var(--bg);
  box-shadow: var(--inset);
  border: none;
  display: flex; align-items: center; justify-content: center;
  flex-direction: column; gap: 8px; min-height: 160px;
  color: var(--text-muted); border-radius: var(--radius);
  cursor: pointer; transition: all .2s;
}
.grupo-add-card:hover { color: var(--primary); }

/* ── DETAIL PANEL ───────────────────────────────────────── */
.detail-panel {
  background: linear-gradient(145deg, var(--grd-l), var(--grd-m));
  border-radius: var(--radius);
  border: none;
  box-shadow: var(--drop);
  margin-top: 24px; max-width: 960px;
  overflow: hidden;
}
.detail-header {
  padding: 20px 28px;
  border-bottom: 1px solid rgba(0,0,0,.06);
  display: flex; align-items: center; justify-content: space-between;
}
[data-theme="dark"] .detail-header { border-bottom-color: rgba(255,255,255,.05); }
.detail-title { font-size: 17px; font-weight: 600; color: var(--text); }
.detail-body  { padding: 24px 28px; }

/* ── PACIENTES TABLE ────────────────────────────────────── */
.pacientes-table { width: 100%; border-collapse: collapse; font-size: 14px; margin-bottom: 20px; }
.pacientes-table th {
  text-align: left; font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .6px;
  color: var(--text-muted); padding: 0 12px 10px;
  border-bottom: 1px solid rgba(0,0,0,.07);
}
[data-theme="dark"] .pacientes-table th { border-bottom-color: rgba(255,255,255,.06); }
.pacientes-table td {
  padding: 12px;
  border-bottom: 1px solid rgba(0,0,0,.05);
}
[data-theme="dark"] .pacientes-table td { border-bottom-color: rgba(255,255,255,.04); }
.pacientes-table tr:last-child td { border-bottom: none; }
.pacientes-table tr:hover td { background: rgba(0,0,0,.025); }
[data-theme="dark"] .pacientes-table tr:hover td { background: rgba(255,255,255,.025); }

.badge {
  display: inline-flex; align-items: center;
  padding: 4px 12px; border-radius: var(--radius);
  font-size: 11px; font-weight: 600;
  background: var(--bg); box-shadow: var(--inset);
}
.badge.activo   { color: var(--success); }
.badge.inactivo { color: var(--danger);  }

.tag-grupo {
  display: inline-block;
  font-size: 12px; font-weight: 500;
  padding: 4px 12px; border-radius: var(--radius);
  background: var(--bg);
  box-shadow: var(--inset);
  color: var(--primary);
}

/* ── FORMS ──────────────────────────────────────────────── */
.form-group { margin-bottom: 20px; }
.form-label {
  display: block; font-size: 13px; font-weight: 500;
  color: var(--text); margin-bottom: 7px;
}
.form-label .optional { color: var(--text-muted); font-weight: 400; font-size: 12px; margin-left: 4px; }

.form-input {
  width: 100%; padding: 11px 16px;
  border: none; border-radius: var(--radius);
  font-size: 14px; font-family: 'Nunito', sans-serif;
  color: var(--text); background: var(--bg);
  box-shadow: var(--inset);
  transition: box-shadow .2s; outline: none;
}
.form-input:focus {
  box-shadow: var(--inset), 0 0 0 2px color-mix(in srgb, var(--primary) 25%, transparent);
}
.form-input::placeholder { color: var(--text-muted); opacity: .6; }
textarea.form-input { resize: vertical; min-height: 90px; border-radius: var(--radius); }
select.form-input    { cursor: pointer; }

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

/* ── BUTTONS ─────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 22px; border-radius: var(--radius);
  font-size: 14px; font-weight: 600;
  font-family: 'Nunito', sans-serif;
  cursor: pointer; border: none;
  transition: box-shadow .15s, transform .1s;
  white-space: nowrap;
  background: var(--bg);
  color: var(--text);
  box-shadow: var(--inset);
}
.btn:active { box-shadow: var(--drop); transform: scale(.98); }

.btn-primary {
  background: linear-gradient(145deg, var(--primary), var(--prim-d));
  color: #fff;
  box-shadow: var(--drop);
}
.btn-primary:active { box-shadow: var(--inset); transform: scale(.98); }

.btn-secondary {
  background: var(--bg);
  color: var(--text);
  box-shadow: var(--inset);
}
.btn-secondary:active { box-shadow: var(--drop); }

.btn-sm { padding: 6px 16px; font-size: 12px; }

.btn-ghost {
  background: none; border: none; color: var(--text-muted);
  cursor: pointer; padding: 6px 14px; border-radius: var(--radius);
  font-family: 'Nunito', sans-serif; font-size: 13px;
  transition: box-shadow .15s; white-space: nowrap;
}
.btn-ghost:hover { background: var(--bg); box-shadow: var(--inset); color: var(--text); }

.btn-danger {
  background: var(--bg);
  color: var(--danger);
  box-shadow: var(--inset);
}
.btn-danger:active { box-shadow: var(--drop); }

/* ── PREGUNTA BUILDER ───────────────────────────────────── */
.pregunta-item {
  display: flex; align-items: center; gap: 8px; margin-bottom: 8px;
}
.pregunta-item input { flex: 1; }
.pregunta-remove {
  background: none; border: none; color: var(--text-muted);
  cursor: pointer; padding: 6px; border-radius: 6px; transition: all .15s;
}
.pregunta-remove:hover { color: var(--danger); }

/* ── SESIONES TABLE ─────────────────────────────────────── */
.sesiones-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.sesiones-table th {
  text-align: left; font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .6px;
  color: var(--text-muted); padding: 10px 12px;
  border-bottom: 1px solid rgba(0,0,0,.07);
  vertical-align: middle;
}
[data-theme="dark"] .sesiones-table th { border-bottom-color: rgba(255,255,255,.06); }
.scroll-list { overflow-y: scroll; }
.scroll-list::-webkit-scrollbar { width: 5px; }
.scroll-list::-webkit-scrollbar-track { background: var(--bg); }
.scroll-list::-webkit-scrollbar-thumb { background: var(--sh-d); border-radius: 3px; }
.sesiones-table td {
  padding: 14px 12px;
  border-bottom: 1px solid rgba(0,0,0,.05);
  vertical-align: middle;
}
[data-theme="dark"] .sesiones-table td { border-bottom-color: rgba(255,255,255,.04); }
.sesiones-table tr:last-child td { border-bottom: none; }
.sesiones-table tr:hover td { background: rgba(0,0,0,.025); }
[data-theme="dark"] .sesiones-table tr:hover td { background: rgba(255,255,255,.025); }

/* ── HISTORIAL ──────────────────────────────────────────── */
.historial-card {
  background: linear-gradient(145deg, var(--grd-l), var(--grd-m));
  border-radius: var(--radius);
  border: none;
  margin-bottom: 12px;
  overflow: hidden;
  box-shadow: var(--drop);
  transition: box-shadow .2s;
}
.historial-card-header {
  padding: 16px 20px; cursor: pointer;
  display: flex; align-items: center; justify-content: space-between;
}
.historial-card-header:hover { opacity: .9; }
.historial-card-body {
  padding: 20px;
  border-top: 1px solid rgba(0,0,0,.06);
}
[data-theme="dark"] .historial-card-body { border-top-color: rgba(255,255,255,.05); }
.historial-textarea {
  width: 100%; min-height: 200px; padding: 14px;
  border: none; border-radius: calc(var(--radius) * 0.7);
  font-family: 'Nunito', sans-serif; font-size: 14px;
  color: var(--text); background: var(--bg);
  box-shadow: var(--inset);
  resize: vertical; outline: none;
}
.historial-textarea:focus {
  box-shadow: var(--inset), 0 0 0 2px color-mix(in srgb, var(--primary) 25%, transparent);
}

/* ── NOTAS LOG ──────────────────────────────────────────── */
.nota-entry {
  padding: 12px 0;
  border-bottom: 1px solid rgba(0,0,0,.05);
}
[data-theme="dark"] .nota-entry { border-bottom-color: rgba(255,255,255,.04); }
.nota-entry:last-child { border-bottom: none; }
.nota-fecha { font-size: 11px; color: var(--text-muted); margin-bottom: 4px; font-weight: 500; }
.nota-texto { font-size: 14px; color: var(--text); line-height: 1.6; }

/* ── ALERTS ─────────────────────────────────────────────── */
.alert {
  padding: 12px 16px; border-radius: calc(var(--radius) * .7);
  font-size: 14px; margin-bottom: 16px;
  display: flex; align-items: center; gap: 8px;
  box-shadow: var(--inset);
  background: var(--bg);
}
.alert-success { color: var(--success); }
.alert-error   { color: var(--danger);  }
.alert-info    { color: var(--primary); }

/* ── MODAL ──────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.3); backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center;
  z-index: 100; opacity: 0; pointer-events: none; transition: opacity .2s;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal {
  background: linear-gradient(145deg, var(--grd-l), var(--grd-m));
  border-radius: calc(var(--radius) * 1.4);
  padding: 36px; width: 100%; max-width: 480px;
  box-shadow:
    12px 12px 28px var(--sh-d),
    -8px -8px 20px var(--sh-l);
  transform: translateY(14px) scale(.97); transition: transform .2s;
}
.modal-overlay.open .modal { transform: translateY(0) scale(1); }
.modal-title {
  font-family: 'Plus Jakarta Sans', sans-serif; font-weight: 800; font-size: 20px; margin-bottom: 24px;
}
.modal-actions { display: flex; gap: 12px; justify-content: flex-end; margin-top: 24px; }

/* ── TOKENS LIST ────────────────────────────────────────── */
.token-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid rgba(0,0,0,.05);
  font-size: 13px;
}
[data-theme="dark"] .token-row { border-bottom-color: rgba(255,255,255,.04); }
.token-row:last-child { border-bottom: none; }
.token-link {
  font-size: 11px; color: var(--primary); word-break: break-all;
  max-width: 300px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* ── SPINNER ─────────────────────────────────────────────── */
@keyframes spin { to { transform: rotate(360deg); } }
.spinner {
  width: 18px; height: 18px;
  border: 2px solid rgba(255,255,255,.25);
  border-top-color: #fff; border-radius: 50%;
  animation: spin .6s linear infinite;
  display: none;
}
.spinner.visible { display: inline-block; }

/* ── LOGIN ──────────────────────────────────────────────── */
.login-wrap {
  min-height: 100vh; width: 100%;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg);
}
.login-card {
  background: linear-gradient(145deg, var(--grd-l), var(--grd-m));
  border-radius: calc(var(--radius) * 1.6);
  padding: 48px 40px; width: 400px;
  box-shadow: 12px 12px 28px var(--sh-d), -8px -8px 20px var(--sh-l);
  border: none;
}
.login-logo {
  font-family: 'Plus Jakarta Sans', sans-serif; font-weight: 800; font-size: 22px;
  color: var(--text); margin-bottom: 32px; text-align: center;
}
.login-logo span { color: var(--primary); }

/* ── FORMULARIO PÚBLICO ─────────────────────────────────── */
.form-publ-wrap {
  min-height: 100vh; background: var(--bg);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 48px 20px;
}
.form-publ-card {
  background: linear-gradient(145deg, var(--grd-l), var(--grd-m));
  border-radius: calc(var(--radius) * 1.4);
  padding: 40px; width: 100%; max-width: 640px;
  box-shadow: var(--drop); border: none;
}

/* ── TOAST ──────────────────────────────────────────────── */
#toast {
  position: fixed; bottom: 24px; right: 24px;
  background: linear-gradient(145deg, var(--grd-l), var(--grd-m));
  color: var(--text);
  padding: 12px 20px; border-radius: 20px;
  font-size: 14px;
  box-shadow: 8px 8px 20px var(--sh-d), -4px -4px 12px var(--sh-l);
  transform: translateY(80px); opacity: 0;
  transition: all .3s ease; z-index: 200;
}
#toast.show    { transform: translateY(0); opacity: 1; }
#toast.success {
  background: linear-gradient(145deg, var(--primary), var(--prim-d));
  color: #fff; box-shadow: var(--drop), 0 4px 16px rgba(0,0,0,.2);
}
#toast.error   {
  background: linear-gradient(145deg, #e05252, #c43c3c);
  color: #fff; box-shadow: var(--drop);
}

/* ── THEME TOGGLE ───────────────────────────────────────── */
.theme-toggle {
  width: 40px; height: 40px; border-radius: 12px;
  border: none;
  background: rgba(255,255,255,.07);
  box-shadow: inset 2px 2px 5px rgba(0,0,0,.2), inset -1px -1px 4px rgba(255,255,255,.04);
  color: rgba(255,255,255,.75);
  display: grid; place-items: center; cursor: pointer;
  transition: background .2s, transform .15s;
  position: relative; margin-bottom: 8px; flex-shrink: 0;
}
.theme-toggle:hover {
  background: rgba(255,255,255,.12);
  transform: translateY(-1px);
}
.theme-toggle .t-icon {
  position: absolute;
  width: 16px; height: 16px;
  stroke: currentColor; fill: none;
  stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
  transition: opacity .25s, transform .25s;
}
.t-moon { opacity: 1;  transform: scale(1) rotate(0deg); }
.t-sun  { opacity: 0;  transform: scale(.6) rotate(90deg); }
[data-theme="dark"] .t-moon { opacity: 0;  transform: scale(.6) rotate(-90deg); }
[data-theme="dark"] .t-sun  { opacity: 1;  transform: scale(1) rotate(0deg); }

/* ── RESPONSIVE ─────────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar { display: none; }
  .main    { padding: 24px 20px; }
  .grupos-grid { grid-template-columns: 1fr; }
  .form-row    { grid-template-columns: 1fr; }
  .dash-stats  { grid-template-columns: 1fr 1fr; gap: .75rem; }
  .dash-grid   { grid-template-columns: 1fr; }
}

/* ── DASHBOARD ─────────────────────────────────────────────── */
.dash-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.25rem;
  margin-bottom: 1.75rem;
}

.dash-stat-card {
  background: linear-gradient(145deg, var(--grd-l), var(--grd-m));
  border-radius: calc(var(--radius) + 4px);
  padding: 1.4rem 1.6rem;
  display: flex;
  align-items: center;
  gap: 1.1rem;
  box-shadow: var(--drop);
  border-left: 4px solid transparent;
  transition: transform .2s, box-shadow .2s;
}
.dash-stat-card:hover {
  transform: translateY(-2px);
  box-shadow:
    calc(var(--dist) + 3px) calc(var(--dist) + 3px) calc(var(--blur) + 6px) var(--sh-d),
    calc(-1*(var(--dist) + 3px)) calc(-1*(var(--dist) + 3px)) calc(var(--blur) + 6px) var(--sh-l);
}
.dash-stat-card:nth-child(1) { border-left-color: #6366f1; }
.dash-stat-card:nth-child(2) { border-left-color: #10b981; }
.dash-stat-card:nth-child(3) { border-left-color: #f59e0b; }
.dash-stat-card:nth-child(4) { border-left-color: #ef4444; }
.dash-stat-alert             { border-left-color: #ef4444 !important; }

.dash-stat-icon {
  width: 52px; height: 52px;
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  box-shadow: var(--inset);
}
.dash-stat-body { display: flex; flex-direction: column; }
.dash-stat-value {
  font-size: 2rem; font-weight: 800; line-height: 1;
  color: var(--text);
}
.dash-stat-label {
  font-size: .8rem; color: var(--text-muted);
  margin-top: .3rem; font-weight: 500;
}

/* ── Cuadrícula principal ── */
.dash-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}
.dash-card {
  background: linear-gradient(145deg, var(--grd-l), var(--grd-m));
  border-radius: calc(var(--radius) + 4px);
  padding: 1.6rem;
  box-shadow: var(--drop);
}
.dash-card-header {
  display: flex; align-items: center; justify-content: space-between;
  padding-bottom: .9rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid rgba(0,0,0,.06);
}
[data-theme="dark"] .dash-card-header { border-bottom-color: rgba(255,255,255,.06); }
.dash-card-title {
  font-size: 1rem; font-weight: 700; color: var(--text);
  letter-spacing: -.2px;
}
.dash-card-link {
  font-size: .8rem; color: var(--primary); text-decoration: none;
  font-weight: 600; opacity: .85;
  transition: opacity .15s;
}
.dash-card-link:hover { opacity: 1; text-decoration: underline; }

/* ── Lista de eventos ── */
.dash-event-list {
  list-style: none; display: flex; flex-direction: column; gap: .55rem;
}
.dash-event-item {
  display: flex; align-items: center; gap: 1rem;
  padding: .75rem 1rem;
  border-radius: var(--radius);
  box-shadow: var(--inset);
  background: var(--bg);
  transition: transform .15s;
}
.dash-event-item:hover { transform: translateX(3px); }

.dash-event-date {
  display: flex; flex-direction: column; align-items: center;
  min-width: 34px;
  background: linear-gradient(145deg, var(--grd-l), var(--grd-m));
  box-shadow: var(--drop);
  border-radius: 8px;
  padding: 6px 4px;
}
.dash-event-day {
  font-size: 1.05rem; font-weight: 800; color: var(--primary); line-height: 1;
}
.dash-event-month {
  font-size: .65rem; color: var(--text-muted);
  text-transform: uppercase; font-weight: 600; letter-spacing: .5px;
}
.dash-event-info { flex: 1; min-width: 0; }
.dash-event-title {
  font-size: .88rem; font-weight: 700; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.dash-event-meta {
  font-size: .76rem; color: var(--text-muted); margin-top: 2px;
}

.dash-event-badge {
  font-size: .68rem; font-weight: 700; padding: 3px 10px;
  border-radius: 20px; white-space: nowrap; flex-shrink: 0;
  box-shadow: var(--drop);
}
.dash-badge-sesion       { background: rgba(16,185,129,.18); color: #10b981; }
.dash-badge-recordatorio { background: rgba(245,158,11,.18);  color: #d97706; }
.dash-badge-pasada       { background: rgba(100,116,139,.15); color: var(--text-muted); }

.dash-empty {
  color: var(--text-muted); font-size: .88rem;
  padding: 1.5rem 0; text-align: center;
}

/* ── Filas placeholder cuando no hay datos ── */
.dash-event-empty {
  opacity: .45;
  pointer-events: none;
}
.dash-ph-date {
  display: flex; flex-direction: column; align-items: center;
  min-width: 34px;
  background: linear-gradient(145deg, var(--grd-l), var(--grd-m));
  box-shadow: var(--drop);
  border-radius: 8px;
  padding: 6px 4px;
}
.dash-ph-bar {
  display: block;
  background: var(--sh-d);
  border-radius: 4px;
  opacity: .5;
}
