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

/* ============================================================
   Toca y Avanza v2 — Rediseño visual moderno
   Archivo: backend/assets/css/style-v2.css
   ============================================================ */

/* ── 1. VARIABLES ACTUALIZADAS ─────────────────────────────── */
:root {
  --primary:        #6D65AD;
  --primary-light:  #8f89c4;
  --primary-dark:   #4f4a8a;
  --primary-subtle: #f0effe;
  --success:        #10b981;
  --success-subtle: #ecfdf5;
  --warning:        #f59e0b;
  --warning-subtle: #fffbeb;
  --danger:         #ef4444;
  --danger-subtle:  #fef2f2;
  --info:           #3b82f6;
  --info-subtle:    #eff6ff;

  --bg:             #f5f5f7;
  --card:           #ffffff;
  --border:         #e5e7eb;
  --border-strong:  #d1d5db;

  --text:           #111827;
  --text-muted:     #6b7280;
  --text-subtle:    #9ca3af;

  --sidebar-border: #f3f4f6;

  --radius-sm:  6px;
  --radius-md:  8px;
  --radius-lg:  12px;
  --radius-xl:  16px;

  --shadow-sm:  0 1px 2px rgba(0,0,0,0.05);
  --shadow-md:  0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-lg:  0 4px 6px rgba(0,0,0,0.05), 0 2px 4px rgba(0,0,0,0.04);

  --font: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;

  --transition: 150ms ease;
}

/* ── 2. BASE ───────────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
}

body {
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ── 3. ACCESIBILIDAD — FOCUS VISIBLE ─────────────────────── */

/* Elimina el outline en click de ratón; lo restaura sólo en navegación por teclado */
:focus:not(:focus-visible) { outline: none; }

/* Anillo global para navegación por teclado — captura todo lo no sobreescrito */
:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* Los inputs usan border+shadow en lugar de outline */
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: none;
  border-radius: var(--radius-md); /* restaurar el radio correcto */
}

/* ── 4. SIDEBAR ────────────────────────────────────────────── */
.sidebar {
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  box-shadow: none;
}

.sidebar-logo {
  padding: 20px 16px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.02em;
}

.sidebar-logo span,
.sidebar-logo .logo-text {
  color: var(--primary);
}

.sidebar-section-title {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-subtle);
  padding: 16px 16px 6px;
}

.sidebar-item,
.sidebar nav a,
.sidebar a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  margin: 1px 8px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 400;
  color: var(--sidebar-text);
  text-decoration: none;
  transition: background var(--transition), color var(--transition);
  cursor: pointer;
}

.sidebar-item:hover,
.sidebar nav a:hover {
  background: var(--bg);
  color: var(--text);
}

.sidebar-item.active,
.sidebar nav a.active,
.sidebar-item[data-active="true"] {
  background: var(--primary-subtle);
  color: var(--primary);
  font-weight: 500;
}

.sidebar-item .icon,
.sidebar-item-icon {
  font-size: 15px;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
}

/* Admin badge en sidebar */
.sidebar-item .admin-badge,
.admin-only-badge {
  margin-left: auto;
  font-size: 9px;
  font-weight: 600;
  background: var(--primary-subtle);
  color: var(--primary);
  padding: 1px 5px;
  border-radius: 20px;
}

/* ── 5. TOPBAR / HEADER ────────────────────────────────────── */
.topbar,
.main-header,
header.app-header {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: 12px 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: none;
}

.topbar-title,
.page-title,
h1.section-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
}

/* ── 6. LAYOUT PRINCIPAL ───────────────────────────────────── */
.main-content,
#content,
.content-area {
  padding: 24px;
}

/* ── 7. CARDS ──────────────────────────────────────────────── */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

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

.card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.card-body {
  padding: 20px;
}

/* ── 8. MÉTRICAS / STATS ───────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  box-shadow: var(--shadow-sm);
}

.stat-card .stat-value {
  font-size: 28px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.stat-card .stat-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

.stat-card .stat-delta {
  font-size: 11px;
  color: var(--success);
  margin-top: 4px;
  font-weight: 500;
}

/* ── 9. BOTONES ────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 500;
  font-family: var(--font);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  white-space: nowrap;
  line-height: 1.4;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.btn-primary:hover {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
}

.btn-secondary,
.btn-ghost {
  background: var(--card);
  color: var(--text);
  border-color: var(--border-strong);
}

.btn-secondary:hover,
.btn-ghost:hover {
  background: var(--bg);
  border-color: var(--border-strong);
}

.btn-success {
  background: var(--success);
  color: #fff;
  border-color: var(--success);
}

.btn-success:hover {
  background: #059669;
}

.btn-danger {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
}

.btn-danger:hover {
  background: #dc2626;
}

.btn-sm {
  padding: 4px 10px;
  font-size: 12px;
}

.btn-lg {
  padding: 10px 20px;
  font-size: 14px;
}

.btn-icon {
  padding: 7px;
  aspect-ratio: 1;
}

/* ── 10. TABLAS ────────────────────────────────────────────── */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-lg);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

thead tr {
  border-bottom: 1px solid var(--border);
}

thead th {
  padding: 10px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  background: transparent;
  white-space: nowrap;
}

tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
}

tbody tr:last-child {
  border-bottom: none;
}

tbody tr:hover {
  background: var(--bg);
}

tbody td {
  padding: 11px 16px;
  color: var(--text);
  vertical-align: middle;
}

/* ── 11. FORMULARIOS ───────────────────────────────────────── */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}

.form-group label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text);
  letter-spacing: 0.01em;
}

input[type="text"],
input[type="email"],
input[type="tel"],
input[type="number"],
input[type="date"],
input[type="time"],
input[type="month"],
input[type="password"],
input[type="search"],
select,
textarea {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  font-size: 13px;
  font-family: var(--font);
  color: var(--text);
  background: var(--card);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
  appearance: none;
  -webkit-appearance: none;
}

input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(109, 101, 173, 0.12);
}

input::placeholder,
textarea::placeholder {
  color: var(--text-subtle);
}

select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7280' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 32px;
}

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

.form-grid .full {
  grid-column: 1 / -1;
}

/* ── 12. BADGES ────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
}

.badge-green,
.badge-success  { background: var(--success-subtle); color: #065f46; }
.badge-red,
.badge-danger   { background: var(--danger-subtle);  color: #991b1b; }
.badge-yellow,
.badge-warning  { background: var(--warning-subtle); color: #92400e; }
.badge-blue,
.badge-info     { background: var(--info-subtle);    color: #1e40af; }
.badge-gray     { background: var(--bg);             color: var(--text-muted); border: 1px solid var(--border); }
.badge-purple   { background: var(--primary-subtle); color: var(--primary-dark); }

/* ── 13. MODALES ───────────────────────────────────────────── */
.modal-bg {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(2px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: fadeIn 150ms ease;
}

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

.modal {
  background: var(--card);
  border-radius: var(--radius-xl);
  box-shadow: 0 20px 40px rgba(0,0,0,0.15), 0 4px 8px rgba(0,0,0,0.08);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  animation: slideUp 200ms ease;
}

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

.modal-header {
  padding: 18px 20px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.modal-header h3 {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin: 0;
}

.modal-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-shrink: 0;
}

.close-btn {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-md);
  border: none;
  background: var(--bg);
  color: var(--text-muted);
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
  line-height: 1;
}

.close-btn:hover {
  background: var(--border);
  color: var(--text);
}

/* ── 14. SECTION TITLES EN MODALES ────────────────────────── */
.section-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  margin: 20px 0 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

/* ── 15. SEARCH BAR / TOOLBAR ──────────────────────────────── */
.search-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.search-bar input[type="text"],
.search-bar input[type="search"] {
  max-width: 260px;
}

.spacer {
  flex: 1;
}

/* ── 16. TOASTS ────────────────────────────────────────────── */
#toast-container {
  position: fixed;
  bottom: var(--space-6);
  right: var(--space-6);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  align-items: flex-end;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--border);
  border-left: 4px solid var(--text-muted);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-lg);
  font-size: var(--text-sm);
  font-weight: var(--fw-medium);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: var(--space-2);
  max-width: 360px;
  min-width: 220px;
  animation: toastIn 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.toast-icon  { font-size: var(--text-md); flex-shrink: 0; line-height: 1; }
.toast-body  { flex: 1; line-height: 1.4; }
.toast-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-subtle);
  font-size: 16px;
  padding: 0 0 0 var(--space-1);
  line-height: 1;
  flex-shrink: 0;
  transition: color 0.1s;
}
.toast-close:hover { color: var(--text); }

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

@keyframes toastIn {
  from { opacity: 0; transform: translateX(12px); }
  to   { opacity: 1; transform: translateX(0); }
}

.toast-out {
  animation: toastOut 0.2s ease forwards;
}
@keyframes toastOut {
  to { opacity: 0; transform: translateX(12px); }
}

/* ── 17. AVATARES ──────────────────────────────────────────── */
.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--primary-subtle);
  color: var(--primary);
  font-size: 12px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  text-transform: uppercase;
}

.avatar-sm { width: 24px; height: 24px; font-size: 10px; }
.avatar-lg { width: 40px; height: 40px; font-size: 15px; }

/* ── 18. EMPTY STATE ───────────────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: var(--space-12) var(--space-6);
  text-align: center;
  gap: var(--space-2);
  animation: emptyFadeIn 0.3s ease;
}

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

.empty-state .icon {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 30px;
  margin-bottom: var(--space-2);
  flex-shrink: 0;
}

.empty-state-title {
  font-size: var(--text-md);
  font-weight: var(--fw-semibold);
  color: var(--text);
}

.empty-state p,
.empty-state-desc {
  font-size: var(--text-sm);
  color: var(--text-muted);
  max-width: 320px;
  line-height: 1.5;
  margin: 0;
}

.empty-state-action { margin-top: var(--space-2); }

/* ── 19. PROFESIONAL DOTS (calendario) ─────────────────────── */
.prof-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

/* ── 20. PILLS DE ESTADO ───────────────────────────────────── */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 500;
}

.status-pill::before {
  content: '';
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  display: block;
}

/* ── 21. TABS ──────────────────────────────────────────────── */
.tabs {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
}

.tab-btn {
  padding: 9px 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  border: none;
  background: none;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: all var(--transition);
  font-family: var(--font);
}

.tab-btn:hover {
  color: var(--text);
}

.tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

/* ── 22. CALENDAR PILLS ────────────────────────────────────── */
.cal-event {
  border-radius: var(--radius-sm);
  padding: 3px 7px;
  font-size: 11px;
  font-weight: 500;
  border-left: 3px solid currentColor;
  cursor: pointer;
  transition: opacity var(--transition);
}

.cal-event:hover {
  opacity: 0.85;
}

/* ── 23. TUTOR BLOCKS ──────────────────────────────────────── */
.tutor-block {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px;
  margin-bottom: 10px;
  position: relative;
}

.remove-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 24px;
  height: 24px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--card);
  color: var(--text-muted);
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
}

.remove-btn:hover {
  background: var(--danger-subtle);
  color: var(--danger);
  border-color: var(--danger);
}

/* ── 24. SCROLLBAR ─────────────────────────────────────────── */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-subtle);
}

/* ── 25. RESPONSIVE ────────────────────────────────────────── */
@media (max-width: 768px) {
  .main-content,
  #content,
  .content-area {
    padding: 16px;
  }

  .modal {
    max-width: 100%;
    max-height: 95vh;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    margin: 0;
  }

  .modal-bg {
    align-items: flex-end;
    padding: 0;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  table thead {
    display: none;
  }

  tbody td {
    display: block;
    padding: 6px 16px;
  }

  tbody td:first-child {
    padding-top: 12px;
    font-weight: 500;
  }

  tbody td:last-child {
    padding-bottom: 12px;
  }

  tbody tr {
    display: block;
    border-bottom: 1px solid var(--border);
  }

  .search-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .search-bar input {
    max-width: 100%;
  }

  #toast-container {
    left: var(--space-4);
    right: var(--space-4);
    bottom: var(--space-4);
    align-items: stretch;
  }
  .toast { min-width: unset; max-width: 100%; }
}

/* ── CALENDARIO ────────────────────────────────────────────── */

/* Toolbar */
.cal-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
  padding: 14px 16px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.cal-week-nav {
  display: flex;
  align-items: center;
  gap: 4px;
}

.cal-week-label {
  font-size: 15px;
  font-weight: 600;
  min-width: 210px;
  text-align: center;
  color: var(--text);
  letter-spacing: -0.01em;
}

/* Tabs semana/día/sala */
.tabs {
  display: flex;
  background: var(--bg);
  border-radius: var(--radius-md);
  padding: 3px;
  gap: 2px;
  border: 1px solid var(--border);
}

.tab {
  padding: 5px 14px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  color: var(--text-muted);
  transition: all 0.15s;
  border: none;
  background: none;
  white-space: nowrap;
}

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

.tab.active {
  background: var(--card);
  color: var(--primary);
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* Leyenda de profesionales */
.cal-legend {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 14px;
  padding: 8px 12px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.cal-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
}

.cal-legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

/* Grid */
.cal-week-grid,
.cal-room-grid {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--card);
  font-size: 12px;
  min-width: 600px;
  box-shadow: var(--shadow-sm);
}

/* Cabecera de días */
.cal-header-cell {
  background: var(--bg);
  padding: 12px 6px 10px;
  text-align: center;
  font-weight: 600;
  font-size: 11px;
  border-bottom: 2px solid var(--border);
  border-right: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.cal-header-cell .cal-header-num {
  display: block;
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
  line-height: 1.1;
  margin-top: 2px;
}

.cal-header-cell.today {
  background: var(--primary-subtle);
  color: var(--primary);
}

.cal-header-cell.today .cal-header-num {
  color: var(--primary);
}

.cal-header-cell:last-child { border-right: none; }

/* Columna de horas */
.cal-time-cell {
  background: var(--bg);
  border-right: 1px solid var(--border);
  padding: 0 8px;
  font-size: 10px;
  font-weight: 500;
  color: var(--text-subtle);
  display: flex;
  align-items: flex-start;
  padding-top: 5px;
  justify-content: flex-end;
  min-width: 48px;
}

/* Celdas de día */
.cal-day-cell {
  border-right: 1px solid var(--border);
  border-bottom: 1px solid #f3f4f6;
  position: relative;
  min-height: 50px;
}

.cal-day-cell.today-col {
  background: #fdfcff;
}

.cal-day-cell:last-child { border-right: none; }

/* Bloques de sesión */
.cal-slot-block {
  position: absolute;
  left: 2px;
  right: 2px;
  border-radius: 6px;
  padding: 3px 6px;
  cursor: pointer;
  overflow: hidden;
  border-left: 3px solid;
  transition: box-shadow 0.15s, transform 0.1s;
  z-index: 5;
  font-size: 11px;
}

.cal-slot-block:hover {
  box-shadow: 0 3px 10px rgba(0,0,0,0.2);
  transform: translateX(1px) scale(1.01);
  z-index: 20;
}

.cal-slot-block .slot-patient {
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 11px;
}

.cal-slot-block .slot-info {
  font-size: 10px;
  opacity: 0.75;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Banner de conflictos */
.cal-conflict-banner {
  background: #fff7ed;
  border: 1px solid #fed7aa;
  border-radius: var(--radius-md);
  padding: 10px 14px;
  margin-bottom: 12px;
  font-size: 13px;
  color: #9a3412;
}

/* Tabs de días (vista día) */
.cal-day-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.cal-day-tab {
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text-muted);
  transition: all 0.15s;
}

.cal-day-tab:hover { background: var(--bg); color: var(--text); }

.cal-day-tab.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

/* Línea de hora actual */
.cal-now-line {
  position: absolute;
  width: 100%;
  height: 2px;
  background: var(--danger);
  z-index: 8;
  left: 0;
  pointer-events: none;
  opacity: 0.8;
}

.cal-now-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--danger);
  position: absolute;
  left: -4px;
  top: -3px;
}

/* ── DASHBOARD / PANEL GENERAL ─────────────────────────────── */

/* Stats grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.15s;
}

.stat-card:hover {
  box-shadow: var(--shadow-md);
}

.stat-card .label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.stat-card .value {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1;
  margin-bottom: 6px;
}

.stat-card .sub {
  font-size: 12px;
  color: var(--text-subtle);
}

/* Alertas */
.alert {
  border-radius: var(--radius-md);
  padding: 12px 16px;
  margin-bottom: 12px;
  font-size: 13px;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  border: 1px solid;
}

.alert-warning {
  background: #fffbeb;
  border-color: #fde68a;
  color: #92400e;
}

.alert-info {
  background: #eff6ff;
  border-color: #bfdbfe;
  color: #1e40af;
}

.alert-danger {
  background: var(--danger-subtle);
  border-color: #fecaca;
  color: #991b1b;
}

/* Grid de citas hoy/mañana */
.dash-citas-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 12px;
}

/* Contenedor genérico de cards del dashboard */
.dash-chart-wrap {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  margin-bottom: 12px;
  box-shadow: var(--shadow-sm);
}

.dash-chart-wrap .card-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

/* Canvas de gráficos */
.dash-chart-canvas {
  height: 220px;
  position: relative;
}

/* Tarjetas de citas */
.dash-cita-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-md);
  font-size: 13px;
  transition: background 0.1s;
  border-bottom: 1px solid var(--border);
}

.dash-cita-card:last-child {
  border-bottom: none;
}

.dash-cita-card:hover {
  background: var(--bg);
}

.dash-cita-card.past {
  opacity: 0.45;
}

.dash-cita-card.next {
  background: var(--primary-subtle);
  border-left: 3px solid var(--primary);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

/* Tabla de morosos */
.dash-morosos-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.dash-morosos-table th {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  text-align: center;
}

.dash-morosos-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.dash-morosos-table tr:last-child td {
  border-bottom: none;
}

.dash-morosos-table tr:hover td {
  background: var(--bg);
}

/* Responsive dashboard */
@media (max-width: 1024px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .stats-grid {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .stat-card .value {
    font-size: 22px;
  }

  .dash-citas-grid {
    grid-template-columns: 1fr;
  }
}

/* ── PACIENTES — botones de acción en tabla ────────────────── */

/* Contenedor de botones de acción en cada fila */
td:last-child {
  white-space: nowrap;
}

/* Unificar botones inline hardcodeados en patients.js */
.btn[style*="background:#e0f2fe"],
.btn[style*="background: #e0f2fe"] {
  background: var(--info-subtle) !important;
  color: var(--info) !important;
  border-color: #93c5fd !important;
}

.btn[style*="background:#fee2e2"],
.btn[style*="background: #fee2e2"] {
  background: var(--danger-subtle) !important;
  color: var(--danger) !important;
  border-color: #fca5a5 !important;
}

/* Badge de advertencia en ficha */
span[style*="background:#fef3c7"] {
  background: var(--warning-subtle) !important;
  color: #92400e !important;
  border-color: #fde68a !important;
  border-radius: var(--radius-sm) !important;
  font-size: 10px !important;
  font-weight: 600 !important;
  padding: 2px 6px !important;
}

/* Fila con datos incompletos */
tr[style*="background:#fffbeb"] {
  background: #fffdf0 !important;
}

tr[style*="background:#fffbeb"]:hover td {
  background: #fffbeb !important;
}

/* Nombre del paciente */
.patient-name {
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
}
