/* ==================== RESET & BASE ==================== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* Scrollbars finos y sutiles */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }
* { scrollbar-width: thin; scrollbar-color: #cbd5e1 transparent; }

:root {
  --bg-primary: #f8fafc;
  --bg-secondary: #ffffff;
  --bg-hover: #f1f5f9;
  --text-primary: #1e293b;
  --text-secondary: #64748b;
  --text-muted: #94a3b8;
  --border: #e2e8f0;
  --border-focus: #3b82f6;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --danger: #ef4444;
  --danger-hover: #dc2626;
  --success: #10b981;
  --warning: #f59e0b;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -2px rgba(0,0,0,0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -4px rgba(0,0,0,0.1);
  --radius: 8px;
  --radius-sm: 4px;
  --sidebar-width: 280px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  height: 100vh;
  overflow: hidden;
}

/* ==================== TOP NAV ==================== */
.top-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 24px;
  background: white;
  border-bottom: 1px solid var(--border);
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  height: 53px;
}
.top-nav .nav-left {
  display: flex;
  align-items: center;
  gap: 20px;
}
.top-nav .nav-logo {
  height: 32px;
}
.top-nav .nav-link {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  transition: background 0.15s, color 0.15s;
}
.top-nav .nav-link:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}
.top-nav .nav-link.active {
  color: var(--accent);
  font-weight: 700;
  background: #eff6ff;
}
.top-nav .nav-right {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  color: var(--text-secondary);
}
.nav-user-name {
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: background 0.15s, color 0.15s;
}
.nav-user-name:hover {
  background: var(--bg-hover);
  color: var(--accent);
}

/* ==================== LAYOUT ==================== */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  padding: 10px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  position: fixed;
  top: 53px;
  left: 0;
  bottom: 0;
  z-index: 15;
  transition: width 0.25s ease, padding 0.25s ease, opacity 0.2s ease;
}

.app-layout {
  position: fixed;
  top: 53px;
  left: var(--sidebar-width);
  right: 0;
  bottom: 0;
  transition: left 0.25s ease;
}

.app-layout.sidebar-hidden {
  left: 0;
}

.main-content {
  width: 100%;
  height: 100%;
  padding: 20px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* ==================== SIDEBAR ==================== */
.sidebar-logo {
  font-size: 18px;
  font-weight: 700;
  color: var(--accent);
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
  text-align: center;
}

.sidebar-logo-img {
  max-width: 160px;
  height: auto;
  display: block;
  margin: 0 auto 4px;
}

.sidebar-logo small {
  display: block;
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 400;
  margin-top: 2px;
}

.sidebar-section h3 {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.filter-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 12px;
  transition: background 0.15s;
  border: none;
  background: none;
  text-align: left;
  width: 100%;
  color: var(--text-primary);
  flex-wrap: wrap;
}

.filter-chip .chip-fechas {
  display: block;
  width: 100%;
  font-size: 10px;
  color: var(--text-secondary);
  margin-top: -2px;
}

.filter-chip.active .chip-fechas {
  color: rgba(255,255,255,0.75);
}

.filter-chip:hover {
  background: var(--bg-hover);
}

.filter-chip.active {
  background: var(--accent);
  color: white;
}

.filter-chip .color-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.filter-chip .chip-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Multi-select professor checkboxes */
.filter-check {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 12px;
  transition: background 0.15s;
  width: 100%;
  color: var(--text-primary);
}
.filter-check:hover {
  background: var(--bg-hover);
}
.filter-check input[type="checkbox"] {
  accent-color: var(--accent);
  flex-shrink: 0;
}
.filter-check .chip-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.conflict-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: var(--danger);
  color: white;
  padding: 3px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: background 0.15s;
}

.conflict-badge:hover {
  background: var(--danger-hover);
}

.conflict-badge.hidden {
  display: none;
}

.sin-profesor-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: var(--warning);
  color: white;
  padding: 3px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: background 0.15s;
}

.sin-profesor-badge:hover {
  background: #d97706;
}

.sin-profesor-badge.hidden {
  display: none;
}

.sidebar-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
  border: 1px solid var(--border);
  background: var(--bg-secondary);
  color: var(--text-primary);
  transition: all 0.15s;
  width: 100%;
}

.sidebar-btn:hover {
  background: var(--bg-hover);
  border-color: var(--accent);
}

/* ==================== SIDEBAR GROUPS ==================== */
.sidebar-menu-section {
  border-top: 1px solid var(--border);
  padding-top: 8px;
}
.sidebar-group { margin-bottom: 2px; }
.sidebar-group-title {
  display: flex; align-items: center; justify-content: space-between;
  padding: 7px 12px; font-size: 12px; font-weight: 600; color: var(--text);
  cursor: pointer; border-radius: var(--radius-sm); transition: background 0.15s;
}
.sidebar-group-title:hover { background: var(--bg-hover); }
.sidebar-group-title.active { background: #eff6ff; color: var(--accent); }
.group-arrow { font-size: 11px; color: var(--text-light); }
.sidebar-group-items { padding-left: 8px; }
.sidebar-group-items .sidebar-btn { margin-top: 1px; font-size: 11px; padding: 5px 10px; }

/* Sugerencia button */
.sidebar-sugerencia {
  border-top: 1px solid var(--border);
  padding: 12px;
  margin-top: auto;
}
.sidebar-btn-sugerencia {
  background: #fefce8 !important;
  border-color: #fbbf24 !important;
  color: #92400e !important;
  font-weight: 600;
}
.sidebar-btn-sugerencia:hover {
  background: #fef3c7 !important;
  border-color: #f59e0b !important;
}

/* ==================== SIDEBAR USER ==================== */
.sidebar-user {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.user-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.user-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-role {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.user-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

/* ==================== SUPERVISOR ROLE ==================== */
.role-supervisor .header-actions,
.role-supervisor .sidebar-section:last-child,
.role-supervisor .admin-only-field {
  display: none;
}

/* ==================== PROFESOR ROLE ==================== */
/* Profesor users: hide centro filter (they see all centros for their actions) */
/* Hide management buttons section */
.role-profesor .sidebar-section:last-child,
.role-profesor .admin-only-field {
  display: none;
}

.role-profesor .admin-only-link {
  display: none;
}

/* ==================== HEADER ==================== */
.calendar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  flex-shrink: 0;
  flex-wrap: wrap;
  gap: 6px;
}

.calendar-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.calendar-nav h2 {
  font-size: 22px;
  font-weight: 700;
  min-width: 180px;
  text-align: center;
  text-transform: capitalize;
}

.nav-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-secondary);
  cursor: pointer;
  color: var(--text-primary);
  font-size: 18px;
  transition: all 0.15s;
}

.nav-btn:hover {
  background: var(--bg-hover);
  border-color: var(--accent);
}

.header-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}
.btn-cursos-header {
  background: #7c3aed;
  color: white;
  text-decoration: none;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  transition: background 0.15s;
}
.btn-cursos-header:hover { background: #6d28d9; }

.search-box {
  display: flex;
  align-items: center;
  position: relative;
}
.search-toggle {
  background: none;
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 36px;
  height: 36px;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, border-color 0.2s;
}
.search-toggle:hover {
  background: #eff6ff;
  border-color: var(--accent);
}
.search-box input {
  padding: 8px 12px;
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  font-size: 14px;
  width: 0;
  opacity: 0;
  color: var(--text-primary);
  background: var(--bg-primary);
  transition: width 0.3s ease, opacity 0.3s ease, padding 0.3s ease;
  pointer-events: none;
  margin-left: 0;
}
.search-box.open input {
  width: 280px;
  opacity: 1;
  pointer-events: auto;
  padding: 8px 12px;
  margin-left: 8px;
}
.search-box.open .search-toggle {
  background: var(--accent);
  border-color: var(--accent);
  filter: brightness(1.1);
}
.search-box input:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(59,130,246,0.2);
}

/* Day cell tooltip */
.cell-tooltip {
  display: none;
  position: fixed;
  z-index: 9999;
  background: white;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 16px;
  width: 260px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.15);
  font-size: 13px;
  pointer-events: none;
}
.cell-tooltip-header {
  font-weight: 700;
  font-size: 14px;
  color: var(--text-primary);
  margin-bottom: 8px;
}
.cell-tooltip-row {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}
.cell-tooltip-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
}
.cell-tooltip-badge.morning {
  background: #fef3c7;
  color: #b45309;
}
.cell-tooltip-badge.afternoon {
  background: #e0e7ff;
  color: #4338ca;
}
.cell-tooltip-section {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 2px;
  margin-top: 6px;
}
.cell-tooltip-list {
  font-size: 12px;
  color: var(--text-primary);
  line-height: 1.4;
}

/* Dashboard */
.dashboard {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 6px 12px;
  margin-bottom: 8px;
}
.dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0;
}
.dashboard-header h3 {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin: 0;
}
.dashboard-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-top: 6px;
}
.dashboard-cards.hidden {
  display: none;
}
.dash-toggle {
  display: inline-block;
  font-size: 10px;
  margin-right: 3px;
}
.dash-card {
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 8px 12px;
}
.dash-card-num {
  font-size: 20px;
  font-weight: 800;
  color: var(--accent);
  line-height: 1;
}
.dash-card-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-primary);
  margin-top: 2px;
}
.dash-card-detail {
  font-size: 10px;
  color: var(--text-secondary);
  margin-top: 2px;
}
.dash-card[data-dtip] { cursor: pointer; }

/* Dashboard HTML tooltip */
.dash-tooltip {
  display: none;
  position: fixed;
  z-index: 9999;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,.15);
  padding: 14px 16px;
  min-width: 240px;
  max-height: 55vh;
  overflow-y: auto;
  max-width: 380px;
  font-size: 13px;
  color: var(--text-primary);
  line-height: 1.5;
}
.dtip-title {
  font-weight: 700;
  font-size: 13px;
  margin-bottom: 6px;
}
.dtip-sub-title {
  font-weight: 600;
  font-size: 12px;
  color: var(--accent);
  margin-bottom: 4px;
}
.dtip-section { margin-bottom: 10px; }
.dtip-section:last-child { margin-bottom: 0; }
.dtip-row {
  padding: 3px 0;
  border-bottom: 1px solid #f1f5f9;
  font-size: 12px;
}
.dtip-row:last-child { border-bottom: none; }
.dtip-sub {
  font-size: 11px;
  color: var(--text-secondary);
}
.dtip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.dtip-badge {
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  padding: 2px 8px;
  font-size: 12px;
  font-weight: 500;
}
.dtip-empty {
  color: var(--text-secondary);
  font-style: italic;
  font-size: 12px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius);
  border: none;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-primary {
  background: var(--accent);
  color: white;
}

.btn-primary:hover {
  background: var(--accent-hover);
}

.btn-secondary {
  background: var(--bg-secondary);
  color: var(--text-primary);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: var(--bg-hover);
}

.btn-danger {
  background: var(--danger);
  color: white;
}

.btn-danger:hover {
  background: var(--danger-hover);
}

.btn-warning {
  background: #f59e0b;
  color: white;
}

.btn-warning:hover {
  background: #d97706;
}

.btn-success {
  background: #25D366;
  color: white;
}

.btn-success:hover {
  background: #1da851;
}

.btn-sm {
  padding: 4px 10px;
  font-size: 12px;
}

.btn-today {
  padding: 6px 14px;
  font-size: 13px;
}

.date-picker {
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px;
  color: var(--text-primary);
  background: var(--bg-primary);
  cursor: pointer;
  margin-left: 8px;
}

.date-picker:hover {
  border-color: var(--primary);
}

/* ==================== CALENDAR GRID ==================== */
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow-y: auto;
  background: var(--bg-secondary);
  flex: 1;
  min-height: 0;
  box-shadow: var(--shadow-sm);
}

.calendar-weekday {
  padding: 10px 8px;
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border);
}

.calendar-cell {
  min-height: 160px;
  padding: 4px;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  position: relative;
  cursor: pointer;
  transition: background 0.15s;
  vertical-align: top;
}

.calendar-cell:nth-child(7n) {
  border-right: none;
}

.calendar-cell:hover {
  background: var(--bg-hover);
}

.calendar-cell.other-month {
  background: #f9fafb;
  opacity: 0.5;
}

.calendar-cell.today {
  background: #eff6ff;
}

.calendar-cell.today .cell-date {
  background: var(--accent);
  color: white;
  border-radius: 50%;
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cell-date {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  padding: 2px 4px;
  margin-bottom: 2px;
}

.cell-events {
  display: flex;
  flex-direction: column;
  gap: 3px;
  overflow-y: auto;
  max-height: calc(160px - 30px);
}

/* Centro group inside calendar cell */
.cell-centro-group {
  border-left: 3px solid var(--border);
  padding-left: 4px;
  margin-bottom: 2px;
  cursor: pointer;
}

.cell-centro-group:hover {
  border-left-color: var(--accent);
}

.cell-centro-group.has-conflict-group {
}

.cell-centro-label {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-secondary);
  line-height: 1.2;
  margin-bottom: 1px;
}

.cell-centro-count {
  font-weight: 400;
  color: var(--accent);
}

.cell-centro-item {
  display: flex;
  align-items: center;
  gap: 3px;
  font-size: 10px;
  line-height: 1.3;
  cursor: pointer;
  padding: 1px 0;
  white-space: nowrap;
  overflow: hidden;
}

.cell-centro-item:hover {
  background: var(--bg-hover);
  border-radius: 2px;
}

.cell-centro-item.has-conflict {
}

.cell-centro-item.is-practicas {
  outline: 1.5px solid var(--danger);
  outline-offset: -1px;
  border-radius: 2px;
}

.cell-centro-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.cell-centro-time {
  font-weight: 600;
  color: var(--text-primary);
  flex-shrink: 0;
}

.cell-centro-name {
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  min-width: 0;
}

.cell-centro-prof {
  font-weight: 600;
  color: var(--text-primary);
  flex-shrink: 0;
  font-size: 9px;
  opacity: 0.7;
}

.cell-centro-more {
  font-size: 11px;
  color: white;
  background: var(--accent);
  padding: 2px 6px;
  cursor: pointer;
  font-weight: 600;
  border-radius: 8px;
  text-align: center;
  margin-top: 2px;
  display: inline-block;
}

/* Weekend columns */
.calendar-cell.weekend {
  background: #fefce8;
}

.calendar-cell.weekend.other-month {
  background: #fefce8;
  opacity: 0.4;
}

/* Festivos (holidays) */
.calendar-cell.festivo {
  background: #fef2f2;
}

.calendar-cell.festivo.other-month {
  background: #fef2f2;
  opacity: 0.4;
}

.cell-festivo-label {
  font-size: 9px;
  color: #dc2626;
  font-weight: 500;
  padding: 0 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wk-festivo-label {
  font-size: 9px;
  color: #dc2626;
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wk-day-header.festivo {
  background: #fef2f2;
}
.wk-cell-nolaboral {
  background: #fef2f2 !important;
}

.day-festivo-banner {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #dc2626;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 8px;
}

/* ==================== MODAL ==================== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s;
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: var(--bg-secondary);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  width: 95%;
  max-width: 720px;
  max-height: 90vh;
  overflow-y: auto;
  transform: translateY(20px);
  transition: transform 0.2s;
}

.modal-overlay.active .modal {
  transform: translateY(0);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.modal-header h3 {
  font-size: 18px;
  font-weight: 600;
}

.modal-close {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  border: none;
  background: none;
  cursor: pointer;
  font-size: 20px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-close:hover {
  background: var(--bg-hover);
}

.modal-body {
  padding: 20px;
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 16px 20px;
  border-top: 1px solid var(--border);
}

/* ==================== FORM ==================== */
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 12px;
}

.form-row.full {
  grid-template-columns: 1fr;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.form-group label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
}

.form-group input,
.form-group select,
.form-group textarea {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--text-primary);
  background: var(--bg-secondary);
  transition: border-color 0.15s;
  font-family: inherit;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(59,130,246,0.1);
}

.form-group textarea {
  resize: vertical;
  min-height: 60px;
}

/* Weekday picker */
.weekday-picker {
  display: flex;
  gap: 4px;
}
.weekday-chip {
  cursor: pointer;
}
.weekday-chip input {
  display: none;
}
.weekday-chip span {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-primary);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  transition: all 0.15s;
}
.weekday-chip input:checked + span {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}
.weekday-chip:hover span {
  border-color: var(--accent);
}
.repeat-info {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 4px;
  padding: 4px 8px;
  background: #eff6ff;
  border-radius: var(--radius-sm);
}

.conflict-warning {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 12px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: var(--radius-sm);
  color: var(--danger);
  font-size: 13px;
  margin-bottom: 12px;
}

.conflict-warning.hidden {
  display: none;
}

/* ==================== REPEAT SECTION ==================== */
.repeat-section {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
  margin-bottom: 12px;
  background: var(--bg-primary);
}

.repeat-section h4 {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text-secondary);
}

.repeat-days {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.repeat-day {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-secondary);
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.repeat-day:hover {
  border-color: var(--accent);
}

.repeat-day.selected {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

.repeat-week-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

.repeat-week-nav span {
  font-size: 12px;
  color: var(--text-secondary);
}

/* ==================== CONFLICTS PANEL ==================== */
.conflicts-panel {
  position: fixed;
  right: 0;
  top: 0;
  bottom: 0;
  width: 380px;
  background: var(--bg-secondary);
  box-shadow: var(--shadow-lg);
  z-index: 50;
  transform: translateX(100%);
  transition: transform 0.3s;
  display: flex;
  flex-direction: column;
}

.conflicts-panel.active {
  transform: translateX(0);
}

.conflicts-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.conflicts-panel-header h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--danger);
}

.conflicts-panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}

.conflict-item {
  padding: 12px;
  border: 1px solid #fecaca;
  border-radius: var(--radius-sm);
  background: #fef2f2;
  margin-bottom: 8px;
}

.conflict-item .conflict-type {
  font-size: 11px;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--danger);
  margin-bottom: 4px;
}

.conflict-item .conflict-date {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 4px;
}

.conflict-item .conflict-resource {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.conflict-item .conflict-actions {
  font-size: 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.conflict-item .conflict-action-name {
  padding: 4px 8px;
  background: white;
  border-radius: 3px;
  border: 1px solid #fecaca;
}

/* ==================== PROFESORES MODAL ==================== */
.profesor-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.profesor-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

/* Color palette for acciones */
.color-swatch-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  border: 2px solid var(--border);
  cursor: pointer;
  transition: transform 0.1s;
}
.color-swatch-btn:hover {
  transform: scale(1.1);
}
.color-palette-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  z-index: 100;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg, 0 10px 25px rgba(0,0,0,.15));
  padding: 8px;
  width: 230px;
  display: none;
}
.color-palette-dropdown.open {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 3px;
}
.color-palette-dropdown .cp-swatch {
  width: 19px;
  height: 19px;
  border-radius: 3px;
  cursor: pointer;
  border: 2px solid transparent;
  transition: transform 0.1s;
}
.color-palette-dropdown .cp-swatch:hover {
  transform: scale(1.25);
  z-index: 1;
}
.color-palette-dropdown .cp-swatch.selected {
  border-color: #1e293b;
  box-shadow: 0 0 0 1px white inset;
}

.profesor-item .color-picker-wrapper {
  position: relative;
}

.profesor-item input[type="color"] {
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  padding: 0;
}

.profesor-item .prof-name {
  flex: 1;
  font-size: 14px;
}

.profesor-item .prof-actions {
  display: flex;
  gap: 4px;
}

.profesor-item.inactive {
  opacity: 0.5;
}

/* ==================== STATUS BADGES ==================== */
.status-badge {
  display: inline-flex;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 500;
}

.status-planificada {
  background: #dbeafe;
  color: #1d4ed8;
}

.status-en_curso {
  background: #dcfce7;
  color: #15803d;
}

.status-completada {
  background: #f3f4f6;
  color: #6b7280;
}

.status-cancelada {
  background: #fee2e2;
  color: #dc2626;
}

/* ==================== LOADING ==================== */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  color: var(--text-muted);
}

.spinner {
  width: 24px;
  height: 24px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  margin-right: 8px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ==================== TOAST ==================== */
.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  padding: 12px 20px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  font-size: 14px;
  color: white;
  animation: slideIn 0.3s ease-out;
  max-width: 350px;
}

.toast.success {
  background: var(--success);
}

.toast.error {
  background: var(--danger);
}

.toast.info {
  background: var(--accent);
}

.toast.warning {
  background: var(--danger);
}

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

.toast-undo {
  display: flex;
  align-items: center;
  gap: 12px;
}

.toast-undo-btn {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.7);
  color: white;
  padding: 4px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s;
}

.toast-undo-btn:hover {
  background: rgba(255,255,255,0.2);
}

/* ==================== DAY DETAIL MODAL ==================== */
.day-detail-centro-group {
  margin-bottom: 16px;
}

.day-detail-centro-group:last-child {
  margin-bottom: 0;
}

.day-detail-centro-header {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  padding: 6px 0 4px;
  border-bottom: 2px solid var(--border);
  margin-bottom: 8px;
}

.day-detail-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.day-detail-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s;
}

.day-detail-item:hover {
  border-color: var(--accent);
  background: var(--bg-hover);
}

.day-detail-item .color-bar {
  width: 4px;
  min-height: 40px;
  border-radius: 2px;
  flex-shrink: 0;
}

.day-detail-item .detail-info {
  flex: 1;
}

.day-detail-item .detail-name {
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 2px;
}

.day-detail-item .detail-meta {
  font-size: 12px;
  color: var(--text-secondary);
}

.day-detail-item.is-practicas {
  outline: 2px solid var(--danger);
  outline-offset: -1px;
  border-radius: var(--radius-sm);
}

/* ==================== EMPTY STATE ==================== */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
}

.empty-state svg {
  width: 48px;
  height: 48px;
  margin-bottom: 12px;
  opacity: 0.5;
}

.empty-state p {
  font-size: 14px;
}

/* ==================== VIEW SWITCHER ==================== */
.view-switcher {
  display: flex;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-left: 12px;
}

.view-btn {
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 500;
  border: none;
  background: var(--bg-secondary);
  cursor: pointer;
  color: var(--text-primary);
  transition: all 0.15s;
  border-right: 1px solid var(--border);
}

.view-btn:last-child {
  border-right: none;
}

.view-btn.active {
  background: var(--accent);
  color: white;
}

.view-btn:hover:not(.active) {
  background: var(--bg-hover);
}

.view-switcher.compact .view-btn {
  padding: 4px 10px;
  font-size: 12px;
}

.btn-practicas {
  padding: 2px 10px;
  font-size: 11px;
  font-weight: 500;
  line-height: 1.2;
  text-align: center;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-secondary);
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.15s;
}

.btn-practicas:hover {
  background: var(--bg-hover);
}

/* ==================== WEEK VIEW (Compact cards) ==================== */
.week-grid {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-secondary);
  box-shadow: var(--shadow-sm);
  overflow-x: hidden;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
  max-height: calc(100vh - 100px);
}

.wk-header {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  border-bottom: 2px solid var(--border);
  background: var(--bg-primary);
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 3;
}

.wk-day-header {
  padding: 4px 4px 3px;
  text-align: center;
  border-right: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.15s;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.wk-day-header:last-child {
  border-right: none;
}

.wk-day-header:hover {
  background: var(--bg-hover);
}

.wk-day-header.today {
  background: #eff6ff;
}

.wk-day-header.weekend {
  background: #fefce8;
}

.wk-day-name {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-secondary);
}

.wk-day-num {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1;
}

.wk-day-num.today-num {
  background: var(--accent);
  color: white;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}

.wk-columns {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  align-items: stretch;
}

.wk-course-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  align-items: stretch;
}


.wk-cell {
  border-right: 1px solid var(--border);
  border-bottom: 1px solid color-mix(in srgb, var(--border) 40%, transparent);
  padding: 3px;
  min-height: 28px;
  min-width: 0;
  overflow: hidden;
}

.wk-cell:nth-child(7n) {
  border-right: none;
}

.wk-cell-weekend {
  background: #fefce8;
}

.wk-cell-today {
  background: #eff6ff;
}

.wk-centro-row-header {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #1e40af;
  background: #dbeafe;
  padding: 6px 12px;
  border-top: 2px solid #93c5fd;
  border-bottom: 1px solid #93c5fd;
  position: sticky;
  top: 0;
  z-index: 2;
}

.wk-empty-centro {
  min-height: 20px;
}

.wk-time-divider-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 3px 12px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #64748b;
}
.wk-time-divider-row::before,
.wk-time-divider-row::after {
  content: '';
  flex: 1;
  height: 1px;
  background: #cbd5e1;
}

.wk-column {
  border-right: 1px solid var(--border);
  padding: 4px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.wk-column:last-child {
  border-right: none;
}

.wk-column.weekend {
  background: #fefce8;
}

.wk-column.today {
  background: #eff6ff;
}

.wk-section-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  padding: 6px 4px 3px;
  border-bottom: 1px solid var(--border);
  margin-top: 2px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.wk-section-label:first-child {
  margin-top: 0;
  padding-top: 2px;
}

.wk-section-count {
  font-size: 9px;
  background: var(--text-muted);
  color: white;
  border-radius: 8px;
  padding: 0 5px;
  font-weight: 600;
  line-height: 16px;
}

.wk-time-divider {
  display: flex;
  align-items: center;
  gap: 4px;
  margin: 4px 0 2px;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #64748b;
}

.wk-time-divider::before {
  content: '';
  flex: 1;
  height: 1px;
  background: #cbd5e1;
}

.wk-time-divider span {
  flex-shrink: 0;
}

.wk-time-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: #cbd5e1;
}

.wk-event {
  padding: 4px 6px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s;
  overflow: hidden;
  max-width: 100%;
  box-sizing: border-box;
}

.wk-event:hover {
  box-shadow: var(--shadow-md);
  filter: brightness(0.93);
}

.wk-event.wk-conflict {
}

/* Icono de advertencia de conflicto */
.conflict-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 16px;
  width: 16px;
  height: 16px;
  background: var(--danger);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  border-radius: 50%;
  pointer-events: none;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
  flex-shrink: 0;
}
.conflict-icon-abs {
  position: absolute;
  top: 3px;
  right: 3px;
  z-index: 2;
}
.conflict-icon-sm {
  min-width: 12px;
  width: 12px;
  height: 12px;
  font-size: 8px;
}

.wk-event.is-practicas {
  outline: 2px solid var(--danger);
  outline-offset: -1px;
}

.practicas-tag {
  display: inline-block;
  background: var(--danger);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 3px;
  margin-left: 4px;
  vertical-align: middle;
  letter-spacing: 0.02em;
}

.practicas-tag-sm {
  display: inline-block;
  background: var(--danger);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  padding: 0 3px;
  border-radius: 2px;
  margin-left: 3px;
  vertical-align: middle;
  letter-spacing: 0.02em;
  line-height: 14px;
}

.wk-event-time {
  font-size: 10px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.01em;
}

.wk-event-name {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.wk-event-detail {
  font-size: 10px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
}

.wk-empty {
  color: var(--text-muted);
  font-size: 12px;
  text-align: center;
  padding: 20px 4px;
  font-style: italic;
}

/* ==================== TIME GRID (Day view) ==================== */
.time-grid {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-secondary);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Header row */
.tg-header {
  display: flex;
  border-bottom: 2px solid var(--border);
  background: var(--bg-primary);
  flex-shrink: 0;
}

.tg-corner {
  width: 60px;
  flex-shrink: 0;
  border-right: 1px solid var(--border);
  padding: 10px 4px;
}

.tg-day-header {
  flex: 1;
  padding: 10px 4px 8px;
  text-align: center;
  border-right: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.15s;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.tg-day-header:last-child {
  border-right: none;
}

.tg-day-header:hover {
  background: var(--bg-hover);
}

.tg-day-header.today {
  background: #eff6ff;
}

.tg-day-header.weekend {
  background: #fefce8;
}

.tg-day-header.weekend.today {
  background: #eff6ff;
}

.tg-day-name {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
}

.tg-day-num {
  font-size: 20px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1;
}

.tg-day-num.today-num {
  background: var(--accent);
  color: white;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}

/* Body (scrollable area) */
.tg-body {
  display: flex;
  position: relative;
  overflow-y: auto;
  max-height: calc(100vh - 140px);
  -webkit-overflow-scrolling: touch;
}

/* Gutter (hour labels) */
.tg-gutter {
  width: 60px;
  flex-shrink: 0;
  border-right: 1px solid var(--border);
  background: var(--bg-primary);
}

.tg-hour {
  height: 60px;
  position: relative;
  border-bottom: 1px solid var(--border);
}

.tg-hour:last-child {
  border-bottom: none;
}

.tg-hour span {
  position: absolute;
  top: -8px;
  right: 8px;
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
  background: var(--bg-secondary);
  padding: 0 2px;
}

/* Day columns */
.tg-column {
  flex: 1;
  position: relative;
  border-right: 1px solid var(--border);
  min-height: 900px; /* (HOUR_END - HOUR_START) * HOUR_HEIGHT = 15 * 60 */
  cursor: pointer;
}

.tg-column:last-of-type {
  border-right: none;
}

.tg-column.weekend {
  background: #fefce8;
}

.tg-column.today {
  background: #eff6ff;
}

/* Hour lines */
.tg-line {
  position: absolute;
  left: 0;
  right: 0;
  border-top: 1px solid var(--border);
  pointer-events: none;
}

.tg-line.tg-line-half {
  border-top: 1px dashed #e8ecf0;
}

/* Event blocks */
.time-event {
  position: absolute;
  border-radius: 5px;
  padding: 3px 6px;
  font-size: 11px;
  overflow: hidden;
  cursor: pointer;
  z-index: 1;
  transition: box-shadow 0.15s, z-index 0s;
  backdrop-filter: blur(2px);
}

.time-event:hover {
  z-index: 3;
  box-shadow: var(--shadow-lg);
  filter: brightness(0.92);
}

.time-event .event-title {
  font-weight: 700;
  font-size: 11px;
  line-height: 1.3;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.time-event .event-meta {
  font-size: 10px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.4;
  font-weight: 500;
}

.time-event.has-conflict {
}

.time-event.is-practicas {
  outline: 2px solid var(--danger);
  outline-offset: -1px;
}

/* Now line */
.now-line {
  position: absolute;
  left: 60px;
  right: 0;
  height: 2px;
  background: var(--danger);
  z-index: 5;
  pointer-events: none;
}

.now-line::before {
  content: '';
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--danger);
  position: absolute;
  left: -5px;
  top: -4px;
}

/* ==================== DAY VIEW (single day, week-style) ==================== */
.day-single-grid {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-secondary);
  box-shadow: var(--shadow-sm);
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

.day-single-events {
  padding: 6px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.day-single-event {
  padding: 8px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: box-shadow 0.15s;
}
.day-single-event:hover {
  box-shadow: 0 2px 8px rgba(0,0,0,.1);
}
.day-single-event.wk-conflict {
}
.day-single-event.is-practicas {
  outline: 2px solid var(--danger);
  outline-offset: -1px;
}
.day-single-event-header {
  display: flex;
  align-items: baseline;
  gap: 10px;
}
.day-single-event-time {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
}
.day-single-event-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}
.day-single-event-detail {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}
.day-single-event-obs {
  font-size: 10px;
  color: var(--text-muted);
  font-style: italic;
  margin-top: 2px;
}

/* ==================== DAY VIEW MOBILE (card list) ==================== */
.day-mobile-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 8px;
  max-height: calc(100vh - 130px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.day-mobile-empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
  font-size: 14px;
}

.day-mobile-hour {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  padding: 12px 4px 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 6px;
}

.day-mobile-hour:first-child {
  padding-top: 4px;
}

.day-mobile-card {
  border-radius: var(--radius);
  padding: 10px 12px;
  margin-bottom: 6px;
  cursor: pointer;
  transition: box-shadow 0.15s;
}

.day-mobile-card:active {
  box-shadow: var(--shadow-md);
}

.day-mobile-card.has-conflict {
}

.day-mobile-card.is-practicas {
  outline: 2px solid var(--danger);
  outline-offset: -1px;
}

.day-mobile-card-title {
  font-weight: 700;
  font-size: 14px;
  color: var(--text-primary);
  line-height: 1.3;
  margin-bottom: 2px;
}

.day-mobile-card-time {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 2px;
}

.day-mobile-card-details {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.4;
}

.day-mobile-card-obs {
  font-size: 11px;
  color: var(--text-muted);
  font-style: italic;
  margin-top: 3px;
  line-height: 1.3;
}

/* ==================== APP FOOTER ==================== */
.app-footer {
  position: fixed;
  bottom: 0;
  right: 0;
  padding: 4px 12px;
  font-size: 11px;
  color: var(--text-muted);
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
  border-left: 1px solid var(--border);
  border-radius: var(--radius-sm) 0 0 0;
  z-index: 1;
}

/* ==================== SIDEBAR OVERLAY (mobile) ==================== */
.sidebar-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.4);
  z-index: 9;
}

.sidebar-overlay.active {
  display: block;
}

/* Hamburger visible en todas las pantallas */
.hamburger-btn {
  display: flex;
  font-size: 20px;
}

/* Vista movil semanal - agrupada por dia */
.wk-mobile-view {
  display: none;
}
.wk-mob-day {
  margin-bottom: 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}
.wk-mob-day-header {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  color: #1e40af;
  background: #eff6ff;
  padding: 8px 12px;
  border-bottom: 1px solid #dbeafe;
}
.wk-mob-today {
  border-color: var(--accent);
}
.wk-mob-today .wk-mob-day-header {
  background: var(--accent);
  color: white;
}
.wk-mob-weekend {
  border-color: #fde68a;
}
.wk-mob-weekend .wk-mob-day-header {
  background: #fefce8;
  color: #92400e;
}
.wk-mob-day .wk-event {
  padding: 8px 12px;
  border-bottom: 1px solid #f1f5f9;
}
.wk-mob-day .wk-event:last-child {
  border-bottom: none;
}

/* Sidebar collapse en desktop */
.sidebar {
  transition: width 0.25s ease, padding 0.25s ease, opacity 0.2s ease;
}
.sidebar.collapsed {
  width: 0;
  padding: 0;
  overflow: hidden;
  border-right: none;
  opacity: 0;
}

/* ==================== RESPONSIVE: TABLET ==================== */
@media (max-width: 1024px) {
  .tg-day-name, .wk-day-name {
    font-size: 10px;
  }

  .tg-day-num, .wk-day-num {
    font-size: 16px;
  }

  .time-event {
    font-size: 10px;
  }

  .time-event .event-meta {
    font-size: 9px;
  }

  .wk-event-name {
    font-size: 10px;
  }

  .wk-event-detail {
    font-size: 9px;
  }

  .view-switcher {
    margin-left: 8px;
  }

  .view-btn {
    padding: 4px 10px;
    font-size: 12px;
  }
}

/* ==================== RESPONSIVE: MOBILE ==================== */
@media (max-width: 768px) {
  /* Top nav compact */
  .top-nav { padding: 6px 12px; height: 44px; }
  .top-nav .nav-logo { height: 24px; }
  .top-nav .nav-left { gap: 10px; }
  .top-nav .nav-link { font-size: 12px; padding: 4px 8px; }
  .top-nav .nav-right { gap: 8px; font-size: 12px; }
  .nav-user-name { font-size: 12px; }
  .app-layout { top: 44px; }

  /* Sidebar: slide-in overlay */
  .sidebar {
    position: fixed;
    top: 44px;
    left: 0;
    bottom: 0;
    width: var(--sidebar-width);
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    z-index: 20;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar.collapsed {
    transform: translateX(-100%);
  }

  .app-layout {
    left: 0;
  }

  .main-content {
    padding: 8px;
  }

  .sidebar-overlay.active {
    top: 44px;
  }

  /* Header compact */
  .calendar-header {
    flex-wrap: wrap;
    gap: 4px;
  }

  .calendar-nav {
    gap: 4px;
    flex-wrap: wrap;
    width: 100%;
    align-items: center;
  }

  .calendar-nav h2 {
    font-size: 14px;
    min-width: 0;
  }

  .btn-today {
    padding: 3px 8px;
    font-size: 11px;
  }

  #centro-switcher {
    display: none !important;
  }

  .btn-practicas {
    display: none;
  }

  .view-switcher {
    margin-left: 0 !important;
  }

  .date-picker {
    margin-left: 0;
    padding: 3px 6px;
    font-size: 11px;
  }

  .view-btn {
    padding: 4px 8px;
    font-size: 11px;
  }

  .header-actions {
    width: 100%;
    justify-content: flex-end;
  }

  .header-actions .btn {
    padding: 5px 10px;
    font-size: 11px;
  }

  /* Month view: smaller cells */
  .calendar-cell {
    min-height: 80px;
    padding: 2px;
  }

  .cell-events {
    max-height: calc(80px - 22px);
  }

  .cell-date {
    font-size: 11px;
  }

  .calendar-weekday {
    padding: 6px 2px;
    font-size: 10px;
  }

  .cell-centro-label {
    font-size: 8px;
  }

  .cell-centro-item {
    font-size: 9px;
  }

  .cell-centro-time {
    display: none;
  }

  .cell-centro-prof {
    display: none;
  }

  .cell-centro-more {
    font-size: 9px;
    padding: 1px 4px;
  }

  /* Week view: vertical stack on mobile */
  .wk-header {
    display: flex;
    overflow-x: auto;
    gap: 0;
  }

  .wk-day-header {
    flex: 1;
    min-width: 0;
    padding: 6px 2px;
  }

  .wk-day-name {
    font-size: 10px;
  }

  .wk-day-num {
    font-size: 14px;
  }

  .wk-columns {
    display: flex;
    flex-direction: column;
    overflow-x: visible;
  }

  /* Ocultar vista desktop de semana en movil */
  .wk-course-grid,
  .wk-centro-row-header,
  .wk-time-divider-row,
  .wk-header,
  .wk-columns {
    display: none !important;
  }

  /* Mostrar vista movil agrupada por dia */
  .wk-mobile-view {
    display: block !important;
  }

  .wk-column {
    min-height: auto;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  .wk-event {
    margin-bottom: 4px;
  }

  .wk-event-name {
    font-size: 12px;
    -webkit-line-clamp: 3;
  }

  .wk-event-time {
    font-size: 11px;
  }

  .wk-event-detail {
    font-size: 11px;
  }

  .wk-section-label {
    font-size: 10px;
  }

  .wk-centro-row-header {
    font-size: 12px;
    padding: 8px 12px;
  }

  /* Day view: mobile optimizations */
  .tg-body {
    max-height: calc(100vh - 200px);
  }

  .tg-gutter {
    width: 40px;
  }

  .tg-hour span {
    font-size: 9px;
    right: 3px;
  }

  .tg-corner {
    width: 40px;
  }

  .tg-day-header {
    padding: 6px 4px;
  }

  .time-event {
    padding: 4px 6px;
    border-left-width: 3px;
  }

  .time-event .event-title {
    font-size: 12px;
    white-space: normal;
    line-height: 1.2;
  }

  .time-event .event-meta {
    font-size: 10px;
    white-space: normal;
    line-height: 1.3;
  }

  .now-line {
    left: 40px;
  }

  /* Modals: full-width */
  .modal {
    width: 100%;
    max-width: 100%;
    max-height: 100vh;
    border-radius: 0;
    height: 100vh;
  }

  .modal-body {
    padding: 12px;
  }

  .modal-header {
    padding: 12px 16px;
  }

  .modal-header h3 {
    font-size: 16px;
  }

  .modal-footer {
    padding: 10px 16px;
    flex-wrap: wrap;
    gap: 6px;
  }

  .modal-footer .btn {
    font-size: 12px;
    padding: 6px 12px;
  }

  /* Form: stack rows on mobile */
  .form-row {
    grid-template-columns: 1fr;
  }

  .form-group input,
  .form-group select,
  .form-group textarea {
    font-size: 16px; /* prevents iOS zoom on focus */
  }

  /* Conflicts panel full-width */
  .conflicts-panel {
    width: 100%;
  }

  /* Toast: centered bottom */
  .toast-container {
    left: 10px;
    right: 10px;
    bottom: 10px;
  }

  .toast {
    max-width: 100%;
  }
}

/* ==================== RESPONSIVE: SMALL PHONES ==================== */
@media (max-width: 400px) {
  .calendar-nav h2 {
    font-size: 14px;
  }

  .nav-btn {
    width: 30px;
    height: 30px;
    font-size: 14px;
  }

  .view-btn {
    padding: 4px 8px;
    font-size: 11px;
  }

  .calendar-cell {
    min-height: 60px;
  }

  .cell-events {
    max-height: calc(60px - 20px);
  }

  .cell-centro-group {
    border-left-width: 2px;
    padding-left: 2px;
  }

  .cell-centro-name {
    max-width: 50px;
  }

  /* Day view: small phones */
  .tg-body {
    max-height: calc(100vh - 220px);
  }

  .tg-gutter {
    width: 36px;
  }

  .tg-corner {
    width: 36px;
  }

  .tg-hour span {
    font-size: 8px;
    right: 2px;
  }

  .time-event {
    padding: 3px 4px;
  }

  .time-event .event-title {
    font-size: 11px;
  }

  .time-event .event-meta {
    font-size: 9px;
  }

  .now-line {
    left: 36px;
  }
}

/* ==================== AULA VIRTUAL (cyan) ==================== */
.cell-centro-item.is-aula-virtual {
  outline: 1.5px solid #06b6d4;
  outline-offset: -1px;
  border-radius: 2px;
}
.day-detail-item.is-aula-virtual {
  outline: 2px solid #06b6d4;
  outline-offset: -1px;
  border-radius: var(--radius-sm);
}
.wk-event.is-aula-virtual {
  outline: 2px solid #06b6d4;
  outline-offset: -1px;
}
.time-event.is-aula-virtual {
  outline: 2px solid #06b6d4;
  outline-offset: -1px;
}
.day-single-event.is-aula-virtual {
  outline: 2px solid #06b6d4;
  outline-offset: -1px;
}
.day-mobile-card.is-aula-virtual {
  outline: 2px solid #06b6d4;
  outline-offset: -1px;
}

/* ==================== TAREA ESPECIAL (fucsia) ==================== */
.cell-centro-item.is-tarea-especial {
  outline: 1.5px solid #d946ef;
  outline-offset: -1px;
  border-radius: 2px;
}
.day-detail-item.is-tarea-especial {
  outline: 2px solid #d946ef;
  outline-offset: -1px;
  border-radius: var(--radius-sm);
}
.wk-event.is-tarea-especial {
  outline: 2px solid #d946ef;
  outline-offset: -1px;
}
.time-event.is-tarea-especial {
  outline: 2px solid #d946ef;
  outline-offset: -1px;
}
.day-single-event.is-tarea-especial {
  outline: 2px solid #d946ef;
  outline-offset: -1px;
}
.day-mobile-card.is-tarea-especial {
  outline: 2px solid #d946ef;
  outline-offset: -1px;
}

/* Reserva de aula */
.cell-centro-item.is-reserva-aula {
  outline: 2px solid #f59e0b;
  outline-offset: -1px;
  background: #fffbeb !important;
}
.day-detail-item.is-reserva-aula {
  outline: 2px solid #f59e0b;
  outline-offset: -1px;
}
.wk-event.is-reserva-aula {
  outline: 2px solid #f59e0b;
  outline-offset: -1px;
  background: #fffbeb !important;
}
.time-event.is-reserva-aula {
  outline: 2px solid #f59e0b;
  outline-offset: -1px;
  background: #fffbeb !important;
}
.day-single-event.is-reserva-aula {
  outline: 2px solid #f59e0b;
  outline-offset: -1px;
}
.day-mobile-card.is-reserva-aula {
  outline: 2px solid #f59e0b;
  outline-offset: -1px;
}
