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

/* ─── DESIGN TOKENS ─────────────────────────────────────────────────────────── */
:root {
  /* Institutional colors sampled from the Salesianos identity */
  --sidebar-bg:        #344B5E;
  --sidebar-active:    #253B4D;
  --sidebar-hover:     rgba(255,255,255,0.07);
  --sidebar-text:      rgba(255,255,255,0.72);
  --sidebar-text-active: #FFFFFF;
  --sidebar-accent:    #CC3D46;

  --primary:           #CC3D46;
  --primary-light:     #FFF1F0;
  --primary-dark:      #A92F38;

  --bg:                #F5F6FA;
  --card:              #FFFFFF;
  --card-border:       #E8ECF4;
  --fg:                #1E293B;
  --muted:             #64748B;
  --muted-light:       #94A3B8;
  --border:            #E2E8F0;

  /* Status colors */
  --green:             #22C55E;
  --green-bg:          #DCFCE7;
  --green-text:        #15803D;
  --orange:            #F97316;
  --orange-bg:         #FFF7ED;
  --orange-text:       #C2410C;
  --red:               #EF4444;
  --red-bg:            #FEF2F2;
  --red-text:          #DC2626;
  --blue:              #3B82F6;
  --blue-bg:           #EFF6FF;
  --blue-text:         #1D4ED8;
  --purple:            #8B5CF6;
  --purple-bg:         #F5F3FF;
  --purple-text:       #6D28D9;

  /* Stat card accent colors */
  --stat1-bg:          #EEF2FF;
  --stat1-icon:        #4B6CF7;
  --stat2-bg:          #ECFDF5;
  --stat2-icon:        #22C55E;
  --stat3-bg:          #F5F3FF;
  --stat3-icon:        #8B5CF6;
  --stat4-bg:          #FFF7ED;
  --stat4-icon:        #F97316;
  --stat5-bg:          #EFF6FF;
  --stat5-icon:        #3B82F6;

  /* Typography */
  --font-display:      'Nunito', sans-serif;
  --font-body:         'Inter', sans-serif;

  /* Spacing */
  --space-1:  4px;
  --space-2:  8px;
  --space-3:  12px;
  --space-4:  16px;
  --space-5:  20px;
  --space-6:  24px;
  --space-8:  32px;

  /* Radius */
  --radius-sm:  8px;
  --radius-md:  12px;
  --radius-lg:  16px;
  --radius-xl:  20px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-card: 0 1px 4px rgba(0,0,0,0.06), 0 4px 16px rgba(0,0,0,0.05);
  --shadow-card-hover: 0 4px 12px rgba(204,61,70,0.15), 0 8px 24px rgba(0,0,0,0.08);
  --shadow-sidebar: 4px 0 24px rgba(52,75,94,0.18);

  /* Transitions */
  --transition: 200ms ease;
  --transition-slow: 350ms cubic-bezier(0.4,0,0.2,1);

  /* Sidebar width */
  --sidebar-w: 220px;
  --sidebar-collapsed-w: 64px;
}

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

html {
  width: 100%;
  max-width: 100%;
  overflow-x: clip;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--fg);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  width: 100%;
  max-width: 100%;
  min-height: 100vh;
  display: flex;
  overflow-x: clip;
}

h1,h2,h3,h4,h5,h6 { font-family: var(--font-display); }

a { text-decoration: none; color: inherit; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
ul { list-style: none; }
img { display: block; max-width: 100%; }

/* ─── SCROLLBAR ─────────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: var(--radius-full); }
::-webkit-scrollbar-thumb:hover { background: var(--muted-light); }

/* ─── SIDEBAR ────────────────────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  position: fixed;
  left: 0; top: 0; bottom: 0;
  z-index: 100;
  box-shadow: var(--shadow-sidebar);
  transition: width var(--transition-slow);
  overflow: hidden;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: var(--space-4) var(--space-3) var(--space-5);
  border-bottom: 1px solid rgba(255,255,255,0.08);
  min-height: 78px;
}

.sidebar-logo-icon {
  width: 50px;
  height: 50px;
  border-radius: 12px;
  background: #fff;
  object-fit: contain;
  padding: 3px;
  flex-shrink: 0;
  box-shadow: 0 5px 14px rgba(21, 35, 47, 0.28);
}

.sidebar-logo-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}

.sidebar-logo-text .school-name {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 15px;
  color: #fff;
  line-height: 1.1;
  letter-spacing: 0.2px;
}

.sidebar-logo-text .school-sub {
  max-width: 130px;
  margin-top: 4px;
  font-size: 9px;
  line-height: 1.18;
  color: rgba(255,255,255,0.7);
  font-weight: 500;
}

/* Nav sections */
.sidebar-nav {
  flex: 1;
  padding: var(--space-4) 0;
  overflow-y: auto;
  overflow-x: hidden;
}

.nav-section-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.35);
  padding: var(--space-5) var(--space-4) var(--space-2);
  white-space: nowrap;
  overflow: hidden;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 10px var(--space-4);
  margin: 1px var(--space-2);
  border-radius: var(--radius-md);
  color: var(--sidebar-text);
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
  white-space: nowrap;
  overflow: hidden;
  position: relative;
}

.nav-item:hover {
  background: var(--sidebar-hover);
  color: #fff;
}

.nav-item.active {
  background: var(--primary);
  color: #fff;
  font-weight: 600;
}

.nav-item .nav-icon {
  width: 18px; height: 18px;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}

.nav-item .nav-icon svg { width: 18px; height: 18px; }

.nav-item .nav-label {
  font-size: 13px;
  font-weight: 500;
  transition: opacity var(--transition);
}

.nav-item .nav-badge {
  margin-left: auto;
  background: var(--orange);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  border-radius: var(--radius-full);
  min-width: 18px;
  height: 18px;
  display: flex; align-items: center; justify-content: center;
  padding: 0 5px;
}

/* Sidebar bottom promo */
.sidebar-promo {
  margin: var(--space-4);
  background: linear-gradient(135deg, var(--primary) 0%, #6366F1 100%);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  color: #fff;
  overflow: hidden;
  position: relative;
}

.sidebar-promo::before {
  content: '';
  position: absolute;
  top: -20px; right: -20px;
  width: 80px; height: 80px;
  background: rgba(255,255,255,0.1);
  border-radius: 50%;
}

.sidebar-promo-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 13px;
  line-height: 1.3;
  margin-bottom: var(--space-1);
}

.sidebar-promo-sub {
  font-size: 11px;
  opacity: 0.8;
  margin-bottom: var(--space-3);
}

.sidebar-promo-btn {
  background: rgba(255,255,255,0.2);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  cursor: pointer;
  transition: background var(--transition);
  display: inline-block;
  border: 1px solid rgba(255,255,255,0.3);
}

.sidebar-promo-btn:hover { background: rgba(255,255,255,0.3); }

/* ─── MAIN LAYOUT ────────────────────────────────────────────────────────────── */
.main-wrapper {
  flex: 1;
  width: calc(100% - var(--sidebar-w));
  min-width: 0;
  max-width: 100%;
  margin-left: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: margin-left var(--transition-slow);
}

/* ─── HEADER ─────────────────────────────────────────────────────────────────── */
.header {
  background: var(--card);
  border-bottom: 1px solid var(--card-border);
  height: 64px;
  display: flex;
  align-items: center;
  padding: 0 var(--space-6);
  gap: var(--space-4);
  position: sticky;
  top: 0;
  z-index: 50;
}

.header-menu-btn {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-md);
  color: var(--muted);
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
}

.header-menu-btn:hover {
  background: var(--bg);
  color: var(--fg);
}

.header-menu-btn svg { width: 20px; height: 20px; }

.search-bar {
  flex: 1;
  max-width: 480px;
  position: relative;
}

.search-bar input {
  width: 100%;
  padding: 8px var(--space-4) 8px 38px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-full);
  background: var(--bg);
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--fg);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}

.search-bar input::placeholder { color: var(--muted-light); }

.search-bar input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(75,108,247,0.12);
}

.search-bar .search-icon {
  position: absolute;
  left: 12px; top: 50%;
  transform: translateY(-50%);
  color: var(--muted-light);
  width: 16px; height: 16px;
  pointer-events: none;
}

.header-right {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-left: auto;
}

.header-icon-btn {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-md);
  color: var(--muted);
  cursor: pointer;
  position: relative;
  transition: background var(--transition), color var(--transition);
}

.header-icon-btn:hover { background: var(--bg); color: var(--fg); }
.header-icon-btn svg { width: 20px; height: 20px; }

.notif-badge {
  position: absolute;
  top: 4px; right: 4px;
  width: 16px; height: 16px;
  background: var(--red);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  border-radius: var(--radius-full);
  display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--card);
}

.header-divider { width: 1px; height: 24px; background: var(--border); }

.header-user {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  cursor: pointer;
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-md);
  transition: background var(--transition);
}

.header-user:hover { background: var(--bg); }

.header-avatar {
  width: 34px; height: 34px;
  border-radius: var(--radius-full);
  background: var(--primary);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display);
  font-weight: 700;
  color: #fff;
  font-size: 13px;
  overflow: hidden;
  border: 2px solid var(--primary-light);
}

.header-avatar img { width: 100%; height: 100%; object-fit: cover; }

.header-user-info { display: flex; flex-direction: column; }

.header-user-name {
  font-weight: 600;
  font-size: 13px;
  line-height: 1.2;
  color: var(--fg);
}

.header-user-role {
  font-size: 11px;
  color: var(--muted);
  line-height: 1;
}

.header-chevron { color: var(--muted); width: 14px; height: 14px; }

/* ─── CONTENT AREA ───────────────────────────────────────────────────────────── */
.content {
  flex: 1;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  padding: var(--space-6);
  overflow-y: auto;
}

/* Pages */
.page {
  display: none;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  animation: fadeIn 0.25s ease;
}
.page.active { display: block; }

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

/* Page header */
.page-header { margin-bottom: var(--space-6); }

.brand-cover {
  min-height: 230px;
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(280px, 0.8fr);
  align-items: center;
  overflow: hidden;
  position: relative;
  padding: 34px 42px;
  border-radius: 26px;
  background:
    radial-gradient(circle at 82% 18%, rgba(238, 181, 144, 0.36), transparent 34%),
    linear-gradient(135deg, #344b5e 0%, #273d4f 55%, #213646 100%);
  box-shadow: 0 18px 42px rgba(39, 61, 79, 0.2);
}

.brand-cover::before {
  content: '';
  position: absolute;
  width: 230px;
  height: 230px;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 50%;
  left: -80px;
  bottom: -150px;
}

.brand-cover-copy {
  position: relative;
  z-index: 1;
  max-width: 650px;
}

.brand-cover-eyebrow {
  display: inline-flex;
  margin-bottom: 12px;
  padding: 6px 11px;
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: var(--radius-full);
  color: #f1c5a8;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1.4px;
  text-transform: uppercase;
}

.brand-cover .page-greeting {
  max-width: 620px;
  margin: 0;
  color: #fff;
  font-size: clamp(26px, 3vw, 42px);
  line-height: 1.05;
  letter-spacing: -0.8px;
}

.brand-cover .page-subtitle {
  max-width: 560px;
  margin-top: 14px;
  color: rgba(255,255,255,0.72);
  font-size: 14px;
}

.brand-cover-art {
  position: relative;
  z-index: 1;
  justify-self: end;
  width: min(100%, 330px);
  padding: 12px;
  border-radius: 22px;
  background: rgba(255,255,255,0.98);
  box-shadow: 0 18px 35px rgba(16, 30, 41, 0.25);
  transform: rotate(1.5deg);
}

.brand-cover-art img {
  width: 100%;
  border-radius: 14px;
}

.page-greeting {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 800;
  color: var(--fg);
  margin-bottom: 2px;
}

.page-greeting span { margin-left: 6px; }

.page-subtitle { font-size: 13px; color: var(--muted); }

/* ─── STAT CARDS ─────────────────────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}

.stat-card {
  background: var(--card);
  border: 1.5px solid var(--card-border);
  border-radius: var(--radius-lg);
  padding: var(--space-4) var(--space-5);
  box-shadow: var(--shadow-card);
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-card-hover);
  border-color: var(--primary);
}

.stat-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: var(--space-3);
}

.stat-icon {
  width: 40px; height: 40px;
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
}

.stat-icon svg { width: 20px; height: 20px; }

.stat-icon-1 { background: var(--stat1-bg); color: var(--stat1-icon); }
.stat-icon-2 { background: var(--stat2-bg); color: var(--stat2-icon); }
.stat-icon-3 { background: var(--stat3-bg); color: var(--stat3-icon); }
.stat-icon-4 { background: var(--stat4-bg); color: var(--stat4-icon); }
.stat-icon-5 { background: var(--stat5-bg); color: var(--stat5-icon); }

.stat-value {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 800;
  color: var(--fg);
  line-height: 1;
}

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

.stat-link {
  font-size: 12px;
  color: var(--primary);
  font-weight: 600;
  margin-top: var(--space-3);
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  transition: color var(--transition);
}

.stat-link:hover { color: var(--primary-dark); }
.stat-link svg { width: 12px; height: 12px; }

/* ─── SECTION GRID ───────────────────────────────────────────────────────────── */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-5);
  margin-bottom: var(--space-5);
}

.dashboard-grid-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: var(--space-5);
}

/* ─── SECTION CARD ───────────────────────────────────────────────────────────── */
.section-card {
  background: var(--card);
  border: 1.5px solid var(--card-border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  box-shadow: var(--shadow-card);
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-4);
}

.section-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 15px;
  color: var(--fg);
}

.section-action {
  font-size: 12px;
  color: var(--primary);
  font-weight: 600;
  cursor: pointer;
  display: flex; align-items: center; gap: 4px;
  transition: color var(--transition);
}

.section-action:hover { color: var(--primary-dark); }
.section-action svg { width: 14px; height: 14px; }

/* ─── APPOINTMENT ROWS ───────────────────────────────────────────────────────── */
.appointment-list { display: flex; flex-direction: column; gap: var(--space-3); }

.appointment-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3);
  border-radius: var(--radius-md);
  transition: background var(--transition);
  cursor: pointer;
}

.appointment-row:hover { background: var(--bg); }

.appt-date {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 36px;
}

.appt-month {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--primary);
  line-height: 1;
}

.appt-day {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 800;
  color: var(--fg);
  line-height: 1;
}

.appt-info { flex: 1; min-width: 0; }

.appt-time {
  font-size: 11px;
  color: var(--muted);
  font-weight: 500;
  margin-bottom: 1px;
}

.appt-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--fg);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.appt-who {
  font-size: 11px;
  color: var(--muted);
}

/* ─── BADGES ─────────────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
  flex-shrink: 0;
}

.badge-confirmed  { background: var(--green-bg);  color: var(--green-text); }
.badge-pending    { background: var(--orange-bg); color: var(--orange-text); }
.badge-cancelled  { background: var(--red-bg);    color: var(--red-text); }
.badge-high       { background: var(--red-bg);    color: var(--red-text); }
.badge-medium     { background: var(--orange-bg); color: var(--orange-text); }
.badge-low        { background: var(--blue-bg);   color: var(--blue-text); }
.badge-event      { background: var(--purple-bg); color: var(--purple-text); }
.badge-allday     { background: var(--green-bg);  color: var(--green-text); }

/* Estilos de badges interactivos (selectores) */
select.badge {
  border: none;
  font-family: inherit;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  padding-right: 20px !important;
  background-repeat: no-repeat;
  background-position: right 6px center;
  background-size: 8px 8px;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

select.badge:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(0,0,0,0.08);
  filter: brightness(0.97);
}

select.badge:focus {
  box-shadow: 0 0 0 2px var(--muted-light);
}

select.badge option {
  background-color: var(--card);
  color: var(--fg);
  font-weight: 500;
}

select.badge-high, select.badge-cancelled {
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23DC2626' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
}

select.badge-medium, select.badge-pending {
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23C2410C' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
}

select.badge-low {
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231D4ED8' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
}

select.badge-confirmed, select.badge-allday {
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2315803D' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
}

/* ─── TASK ROWS ──────────────────────────────────────────────────────────────── */
.task-list { display: flex; flex-direction: column; gap: var(--space-3); }

.task-row {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-3);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background var(--transition);
}

.task-row:hover { background: var(--bg); }

.task-priority-line {
  width: 3px;
  min-height: 40px;
  border-radius: var(--radius-full);
  flex-shrink: 0;
}
.priority-high   { background: var(--red); }
.priority-medium { background: var(--orange); }
.priority-low    { background: var(--blue); }

.task-info { flex: 1; min-width: 0; }

.task-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--fg);
  margin-bottom: 2px;
}

.task-assignee {
  font-size: 11px;
  color: var(--muted);
}

.task-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: var(--space-1);
  flex-shrink: 0;
}

.task-due {
  font-size: 11px;
  color: var(--muted);
}

/* ─── DONUT CHART ────────────────────────────────────────────────────────────── */
.chart-area {
  display: flex;
  align-items: center;
  gap: var(--space-6);
}

.donut-wrap {
  position: relative;
  flex-shrink: 0;
}

.donut-wrap svg { width: 120px; height: 120px; }

.donut-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.donut-total {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 800;
  color: var(--fg);
  line-height: 1;
}

.donut-total-label {
  font-size: 10px;
  color: var(--muted);
  font-weight: 500;
}

.chart-legend { flex: 1; display: flex; flex-direction: column; gap: 10px; }

.legend-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.legend-dot {
  width: 10px; height: 10px;
  border-radius: var(--radius-full);
  flex-shrink: 0;
}

.legend-label { font-size: 12px; color: var(--muted); flex: 1; }

.legend-value {
  font-size: 12px;
  font-weight: 700;
  color: var(--fg);
}

.legend-pct {
  font-size: 11px;
  color: var(--muted-light);
  margin-left: 2px;
}

/* ─── ACTIVITIES ─────────────────────────────────────────────────────────────── */
.activity-list { display: flex; flex-direction: column; gap: var(--space-3); }

.activity-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background var(--transition);
}

.activity-row:hover { background: var(--bg); }

.activity-date {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 36px;
}

.activity-month {
  font-size: 9px;
  font-weight: 700;
  color: var(--primary);
  text-transform: uppercase;
  line-height: 1;
}

.activity-day {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 800;
  color: var(--fg);
  line-height: 1;
}

.activity-info { flex: 1; min-width: 0; }

.activity-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--fg);
  margin-bottom: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.activity-place {
  font-size: 11px;
  color: var(--muted);
}

/* ─── COMUNICADOS ────────────────────────────────────────────────────────────── */
.comunicado-list { display: flex; flex-direction: column; gap: var(--space-4); }

.comunicado-item {
  display: flex;
  gap: var(--space-3);
  padding-bottom: var(--space-4);
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}

.comunicado-item:last-child { border-bottom: none; padding-bottom: 0; }

.comunicado-icon {
  width: 36px; height: 36px;
  border-radius: var(--radius-md);
  background: var(--primary-light);
  color: var(--primary);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.comunicado-icon svg { width: 18px; height: 18px; }

.comunicado-info { flex: 1; min-width: 0; }

.comunicado-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--fg);
  margin-bottom: 2px;
}

.comunicado-author-time {
  font-size: 11px;
  color: var(--primary);
  font-weight: 600;
  margin-bottom: 4px;
}

.comunicado-body {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ─── EMPTY / ALT PAGES ──────────────────────────────────────────────────────── */
.alt-page-header {
  margin-bottom: var(--space-6);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.alt-page-title {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 800;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 9px var(--space-4);
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  border: none;
  font-family: var(--font-body);
}

.btn-primary {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 2px 8px rgba(75,108,247,0.3);
}

.btn-primary:hover {
  background: var(--primary-dark);
  box-shadow: 0 4px 12px rgba(75,108,247,0.4);
  transform: translateY(-1px);
}

.btn svg { width: 16px; height: 16px; }

/* Full table */
.data-table-wrap {
  background: var(--card);
  border: 1.5px solid var(--card-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th {
  padding: 12px var(--space-4);
  background: var(--bg);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  text-align: left;
  border-bottom: 1.5px solid var(--border);
}

.data-table td {
  padding: 12px var(--space-4);
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  color: var(--fg);
  vertical-align: middle;
}

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

.data-table tbody tr {
  cursor: pointer;
  transition: background var(--transition);
}

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

/* Filter bar */
.filter-bar {
  display: flex;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
  flex-wrap: wrap;
}

.filter-btn {
  padding: 6px 14px;
  border-radius: var(--radius-full);
  border: 1.5px solid var(--border);
  background: var(--card);
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  transition: all var(--transition);
}

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

/* Mobile appointment cards */
.appointment-card-list { display: none; }

.appointment-card {
  overflow: hidden;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
}

.appointment-card-toggle {
  width: 100%;
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto 18px;
  align-items: center;
  gap: var(--space-3);
  padding: 14px;
  color: var(--fg);
  text-align: left;
}

.appointment-card-toggle:focus-visible {
  outline: 3px solid rgba(204,61,70,0.22);
  outline-offset: -3px;
}

.appointment-card-date {
  min-height: 48px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  background: var(--primary-light);
  color: var(--primary-dark);
  line-height: 1;
}

.appointment-card-day {
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 800;
}

.appointment-card-month {
  margin-top: 4px;
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.appointment-card-summary { min-width: 0; }

.appointment-card-time {
  display: block;
  margin-bottom: 2px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.appointment-card-title {
  overflow: hidden;
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 800;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.appointment-card-chevron {
  width: 18px;
  height: 18px;
  color: var(--muted-light);
  transition: transform var(--transition);
}

.appointment-card.is-open .appointment-card-chevron { transform: rotate(180deg); }

.appointment-card-details {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3);
  padding: 0 14px 14px 74px;
  border-top: 1px solid var(--border);
}

.appointment-card-detail { padding-top: var(--space-3); }

.appointment-card-detail-label {
  display: block;
  margin-bottom: 3px;
  color: var(--muted-light);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.appointment-card-detail-value {
  color: var(--fg);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.35;
}

.task-card-high .task-card-date {
  background: var(--red-bg);
  color: var(--red-text);
}

.task-card-medium .task-card-date {
  background: var(--orange-bg);
  color: var(--orange-text);
}

.task-card-low .task-card-date {
  background: var(--blue-bg);
  color: var(--blue-text);
}

/* ─── RESPONSIVE ─────────────────────────────────────────────────────────────── */
@media (max-width: 1280px) {
  .stats-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 1024px) {
  :root { --sidebar-w: var(--sidebar-collapsed-w); }

  .sidebar-logo-text,
  .nav-label,
  .nav-badge,
  .nav-section-label,
  .sidebar-promo { display: none; }

  .sidebar-logo { justify-content: center; padding: var(--space-3) var(--space-2) var(--space-5); }
  .sidebar-logo-icon { width: 44px; height: 44px; }
  .nav-item { justify-content: center; padding: 10px; }
  .nav-item .nav-icon { margin: 0; }

  .brand-cover { grid-template-columns: minmax(0, 1fr) 240px; padding: 30px; }
  .dashboard-grid-3 { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 768px) {
  :root { --sidebar-w: 0px; }
  .sidebar {
    width: min(82vw, 280px);
    transform: translateX(-105%);
    transition: transform var(--transition-slow);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar.open .sidebar-logo-text,
  .sidebar.open .nav-badge { display: flex; }
  .sidebar.open .nav-label { display: inline-block; }
  .sidebar.open .nav-section-label { display: block; }
  .sidebar.open .sidebar-promo { display: block; }
  .sidebar.open .sidebar-logo { justify-content: flex-start; padding: var(--space-4) var(--space-3) var(--space-5); }
  .sidebar.open .sidebar-logo-icon { width: 50px; height: 50px; }
  .sidebar.open .nav-item { justify-content: flex-start; padding: 10px var(--space-4); }
  .sidebar.open .nav-badge { margin-left: auto; }
  .main-wrapper { width: 100%; margin-left: 0; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .dashboard-grid-3 { grid-template-columns: 1fr; }
  .brand-cover { grid-template-columns: 1fr 210px; padding: 26px; }
  .content { padding: var(--space-4); }
  .header { padding: 0 var(--space-4); }
  .header-user-info { display: none; }
  .alt-page-header { align-items: flex-start; gap: var(--space-3); }
  .data-table-wrap {
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    -webkit-overflow-scrolling: touch;
  }
  .data-table { min-width: 680px; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .search-bar { display: none; }
  .form-row { grid-template-columns: 1fr; }
  .modal-overlay { align-items: flex-end; }
  .modal-content {
    width: 100%;
    max-width: none;
    max-height: calc(100dvh - 20px);
    overflow-y: auto;
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  }
  .modal-header { padding: var(--space-4); }
  .modal-form { padding: var(--space-4); }
  .modal-footer .btn { flex: 1; }
}

/* Focus styles */
*:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ─── MODAL FORMULARIO ────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(13, 27, 75, 0.4);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition);
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.modal-content {
  background: var(--card);
  border-radius: var(--radius-xl);
  width: 90%;
  max-width: 480px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
  transform: translateY(20px) scale(0.95);
  transition: transform 300ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-overlay.open .modal-content {
  transform: translateY(0) scale(1);
}

.modal-header {
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  color: var(--fg);
}

.modal-close {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  background: var(--bg);
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
}

.modal-close:hover {
  background: var(--red-bg);
  color: var(--red);
}

.modal-close svg { width: 18px; height: 18px; }

.modal-form {
  padding: var(--space-6);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4);
}

.form-group label {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}

.form-group input {
  padding: 10px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--fg);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}

.form-group input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(75, 108, 247, 0.12);
}

.modal-footer {
  margin-top: var(--space-2);
  display: flex;
  justify-content: flex-end;
  gap: var(--space-3);
}

.btn-secondary {
  background: var(--bg);
  color: var(--muted);
  border: 1.5px solid var(--border);
}

.btn-secondary:hover {
  background: var(--border);
  color: var(--fg);
}

/* ─── MOBILE APP LAYOUT (Max 480px) ────────────────────────────────────────── */
.mobile-header, .mobile-quick-actions, .bottom-nav {
  display: none;
}

@media (max-width: 480px) {
  /* Hide desktop header and sidebar */
  .header { display: none !important; }
  .stats-grid { display: none !important; }
  
  /* Reset padding for full-bleed mobile feel */
  .content {
    padding: 0;
    padding-bottom: calc(82px + env(safe-area-inset-bottom));
    background: var(--bg);
  }

  .page:not(#page-dashboard) {
    padding: var(--space-4);
  }
  
  /* Mobile Header */
  .mobile-header {
    display: flex;
    width: 100%;
    min-width: 0;
    min-height: 66px;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: calc(10px + env(safe-area-inset-top)) 14px 10px;
    background: var(--sidebar-bg);
    color: #fff;
    margin-bottom: 0;
  }

  .mobile-brand {
    display: flex;
    flex: 1;
    align-items: center;
    gap: 10px;
    min-width: 0;
  }

  .mobile-brand-logo {
    width: 42px;
    height: 42px;
    object-fit: contain;
    padding: 3px;
    border-radius: 10px;
    background: #fff;
    flex-shrink: 0;
  }

  .mobile-brand-copy {
    display: flex;
    flex: 1;
    flex-direction: column;
    min-width: 0;
  }

  .mobile-brand-name {
    color: #fff;
    font-family: var(--font-display);
    font-size: 14px;
    font-weight: 800;
    line-height: 1.1;
  }

  .mobile-brand-sub {
    display: block;
    width: 100%;
    max-width: none;
    color: rgba(255,255,255,0.68);
    font-size: clamp(7px, 2.2vw, 9px);
    line-height: 1.2;
    letter-spacing: -0.12px;
    white-space: nowrap;
  }
  
  .mobile-header-user {
    display: flex;
    flex-shrink: 0;
    align-items: center;
    gap: var(--space-3);
  }
  
  .mobile-header .header-user-name {
    color: #fff;
    font-size: 15px;
  }
  
  .mobile-header .header-user-role {
    color: rgba(255,255,255,0.7);
  }
  
  .mobile-notif-btn {
    position: relative;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    flex-shrink: 0;
    border-radius: var(--radius-full);
    transition: background var(--transition), transform var(--transition);
  }

  .mobile-notif-btn:active { background: rgba(255,255,255,0.12); transform: scale(0.94); }
  
  .mobile-notif-btn svg { width: 22px; height: 22px; }
  
  /* Quick Actions Grid */
  .mobile-quick-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--space-3);
    padding: 0 var(--space-4);
    margin-bottom: var(--space-5);
    position: relative;
    z-index: 10;
  }
  
  .mobile-action-btn {
    background: var(--card);
    border-radius: var(--radius-lg);
    padding: var(--space-3) var(--space-1);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-2);
    box-shadow: var(--shadow-card);
    transition: transform var(--transition);
    text-align: center;
    min-width: 0;
  }
  
  .mobile-action-btn:active { transform: scale(0.95); }
  
  .mobile-action-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
  }
  
  .mobile-action-icon svg { width: 24px; height: 24px; }
  
  .mobile-action-btn span {
    font-size: 10px;
    font-weight: 600;
    color: var(--fg);
    line-height: 1.1;
    word-break: break-word;
  }
  
  /* Adjust Dashboard Grid for Mobile */
  .dashboard-grid {
    width: 100%;
    min-width: 0;
    padding: 0 var(--space-4);
    gap: var(--space-4);
  }
  .dashboard-grid-3 {
    width: 100%;
    min-width: 0;
    padding: 0 var(--space-4);
    gap: var(--space-4);
  }

  .dashboard-grid > *,
  .dashboard-grid-3 > * {
    min-width: 0;
  }

  .alt-page-header {
    flex-direction: column;
    margin-bottom: var(--space-4);
  }

  .alt-page-header .btn { width: 100%; }

  .section-card {
    min-width: 0;
    padding: var(--space-4);
    border-radius: var(--radius-lg);
  }

  .section-header {
    min-width: 0;
    gap: var(--space-3);
  }

  .section-title { min-width: 0; }

  .section-action {
    flex-shrink: 0;
    white-space: nowrap;
  }

  .appointment-row {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr);
    grid-template-areas:
      "date info"
      "date status";
    align-items: center;
    column-gap: var(--space-3);
    row-gap: 6px;
    padding: 10px 8px;
  }

  .appointment-row .appt-date { grid-area: date; }
  .appointment-row .appt-info { grid-area: info; }
  .appointment-row > .badge {
    grid-area: status;
    justify-self: start;
  }

  .appt-title {
    line-height: 1.3;
    white-space: normal;
  }

  .task-row {
    display: grid;
    grid-template-columns: 3px minmax(0, 1fr);
    grid-template-areas:
      "priority info"
      "priority meta";
    gap: 6px var(--space-3);
    padding: 10px 8px;
  }

  .task-priority-line {
    grid-area: priority;
    height: 100%;
    min-height: 56px;
  }

  .task-info { grid-area: info; }

  .task-meta {
    grid-area: meta;
    min-width: 0;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-2);
  }

  .task-due {
    min-width: 0;
    text-align: right;
  }

  .data-table-wrap {
    margin-inline: calc(var(--space-4) * -1);
    border-radius: 0;
    border-left: 0;
    border-right: 0;
  }

  #page-citas .data-table-wrap,
  #page-tareas .data-table-wrap { display: none; }

  .appointment-card-list {
    display: grid;
    gap: var(--space-3);
  }

  .appointment-card { min-width: 0; }

  .appointment-card-toggle {
    grid-template-columns: 60px minmax(0, 1fr) 20px;
    grid-template-areas:
      "date summary chevron"
      "date status chevron";
    gap: 6px var(--space-3);
    padding: 14px;
  }

  .appointment-card-date {
    grid-area: date;
    min-height: 64px;
  }

  .appointment-card-summary { grid-area: summary; }

  .appointment-card-toggle > .badge {
    grid-area: status;
    justify-self: start;
  }

  .appointment-card-title {
    line-height: 1.3;
    white-space: normal;
  }

  .appointment-card-chevron {
    grid-area: chevron;
    align-self: center;
  }

  .appointment-card-details {
    padding: 0 14px 14px 86px;
  }
  
  /* Institutional cover on mobile dashboard */
  #page-dashboard .page-header {
    display: grid;
  }

  .brand-cover {
    width: 100%;
    min-height: 0;
    grid-template-columns: 1fr;
    gap: 20px;
    margin: 0 0 var(--space-5);
    padding: 28px 22px 22px;
    border-radius: 0;
  }

  .brand-cover .page-greeting {
    font-size: 27px;
  }

  .brand-cover .page-subtitle {
    font-size: 12px;
  }

  .brand-cover-art {
    justify-self: stretch;
    width: 100%;
    max-height: 190px;
    padding: 8px;
    transform: none;
  }

  .brand-cover-art img {
    width: 100%;
    max-height: 174px;
    object-fit: contain;
  }
  
  /* Bottom Nav */
  .bottom-nav {
    display: flex;
    align-items: center;
    justify-content: space-around;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--card);
    padding: 10px 0 calc(10px + env(safe-area-inset-bottom));
    box-shadow: 0 -4px 20px rgba(0,0,0,0.06);
    z-index: 100;
    border-top: 1px solid var(--border);
  }
  
  .bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    color: var(--muted-light);
    width: 64px;
    min-height: 44px;
    justify-content: center;
  }
  
  .bottom-nav-item svg { width: 22px; height: 22px; }
  
  .bottom-nav-item span {
    font-size: 10px;
    font-weight: 600;
  }
  
  .bottom-nav-item.active {
    color: var(--primary);
  }
}

@media (max-width: 360px) {
  .mobile-header { gap: 8px; padding-inline: var(--space-3); }
  .mobile-brand { gap: 8px; }
  .mobile-brand-logo { width: 40px; height: 40px; }
  .mobile-brand-name { font-size: 13px; }
  .mobile-brand-sub { max-width: none; font-size: 7px; }
  .mobile-quick-actions { gap: 8px; padding-inline: var(--space-3); }
  .mobile-action-icon { width: 42px; height: 42px; }
  .brand-cover { margin-inline: 0; padding: 24px 18px 20px; }
  .brand-cover .page-greeting { font-size: 24px; }
  .dashboard-grid, .dashboard-grid-3 { padding-inline: var(--space-3); }
  .bottom-nav-item { width: 58px; }
  .bottom-nav-item span { font-size: 9px; }
}

/* ─── CALENDARIO ─────────────────────────────────────────────────────────── */
.calendar-page-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}

.calendar-eyebrow {
  display: block;
  margin-bottom: 5px;
  color: #18826f;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.calendar-notification-btn,
.calendar-today-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 15px;
  border: 1px solid #dce6eb;
  border-radius: 12px;
  background: #fff;
  color: #344b5e;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.calendar-notification-btn svg { width: 17px; height: 17px; }
.calendar-notification-btn:hover,
.calendar-today-btn:hover { transform: translateY(-1px); border-color: #96c7bd; box-shadow: 0 8px 24px rgba(37, 74, 83, 0.09); }
.calendar-notification-btn.is-active { color: #0f7665; border-color: #86cbbd; background: #ecfbf7; }
.calendar-notification-btn:disabled { cursor: not-allowed; opacity: 0.58; transform: none; }

.calendar-app {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  min-height: 680px;
  overflow: hidden;
  border: 1px solid #dfe8ed;
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 22px 60px rgba(32, 61, 73, 0.10);
}

.calendar-side-panel {
  position: relative;
  padding: 24px 20px;
  overflow: hidden;
  color: #fff;
  background:
    radial-gradient(circle at 15% 12%, rgba(51, 196, 165, 0.34), transparent 28%),
    linear-gradient(155deg, #153f58 0%, #102f49 48%, #0b263d 100%);
}

.calendar-side-panel::after {
  content: "";
  position: absolute;
  right: -90px;
  bottom: -100px;
  width: 230px;
  height: 230px;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 50%;
  box-shadow: 0 0 0 28px rgba(255,255,255,0.025), 0 0 0 62px rgba(255,255,255,0.018);
  pointer-events: none;
}

.calendar-new-event {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: 46px;
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 13px;
  background: #29a98e;
  color: #fff;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 12px 26px rgba(0,0,0,0.16);
  transition: transform 180ms ease, background 180ms ease;
}

.calendar-new-event span { font-size: 1.35rem; font-weight: 400; line-height: 1; }
.calendar-new-event:hover { transform: translateY(-2px); background: #31b99c; }

.mini-calendar { position: relative; z-index: 1; margin-top: 28px; }
.mini-calendar-header { display: grid; grid-template-columns: 30px 1fr 30px; align-items: center; margin-bottom: 15px; }
.mini-calendar-header strong { text-align: center; font-size: 0.86rem; text-transform: capitalize; }
.mini-calendar-header button {
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: rgba(255,255,255,0.78);
  font-size: 1.3rem;
  cursor: pointer;
}
.mini-calendar-header button:hover { background: rgba(255,255,255,0.1); color: #fff; }
.mini-calendar-weekdays,
.mini-calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); }
.mini-calendar-weekdays { margin-bottom: 6px; color: rgba(255,255,255,0.5); font-size: 0.62rem; font-weight: 700; text-align: center; }
.mini-calendar-grid button {
  position: relative;
  aspect-ratio: 1;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: rgba(255,255,255,0.82);
  font: inherit;
  font-size: 0.68rem;
  cursor: pointer;
}
.mini-calendar-grid button:hover { background: rgba(255,255,255,0.1); }
.mini-calendar-grid button.is-outside { color: rgba(255,255,255,0.26); }
.mini-calendar-grid button.is-today { outline: 1px solid rgba(255,255,255,0.65); }
.mini-calendar-grid button.is-selected { background: #2ec4a4; color: #fff; font-weight: 800; }
.mini-calendar-grid button.has-event::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 3px;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: #ffd56a;
  transform: translateX(-50%);
}

.upcoming-panel { position: relative; z-index: 1; margin-top: 30px; padding-top: 21px; border-top: 1px solid rgba(255,255,255,0.11); }
.upcoming-panel-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 13px; font-size: 0.75rem; font-weight: 800; letter-spacing: 0.05em; text-transform: uppercase; }
.upcoming-count { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 8px; background: rgba(255,255,255,0.1); color: #8ce1cf; }
.upcoming-list { display: grid; gap: 9px; }
.upcoming-item {
  display: grid;
  grid-template-columns: 7px 1fr;
  gap: 10px;
  width: 100%;
  padding: 10px 9px;
  border: 0;
  border-radius: 10px;
  background: rgba(255,255,255,0.055);
  color: #fff;
  text-align: left;
  cursor: pointer;
  transition: background 180ms ease, transform 180ms ease;
}
.upcoming-item:hover { background: rgba(255,255,255,0.11); transform: translateX(2px); }
.upcoming-item-dot { width: 7px; height: 7px; margin-top: 5px; border-radius: 50%; background: #42cdb0; }
.upcoming-item strong { display: block; overflow: hidden; font-size: 0.72rem; text-overflow: ellipsis; white-space: nowrap; }
.upcoming-item small { display: block; margin-top: 3px; color: rgba(255,255,255,0.54); font-size: 0.62rem; }
.upcoming-empty { padding: 15px 4px; color: rgba(255,255,255,0.48); font-size: 0.72rem; line-height: 1.5; }

.calendar-main-panel { position: relative; min-width: 0; background: #fff; }
.calendar-toolbar {
  display: grid;
  grid-template-columns: minmax(170px, 260px) 1fr auto;
  align-items: center;
  gap: 22px;
  min-height: 84px;
  padding: 17px 22px;
  border-bottom: 1px solid #e8eef1;
}
.calendar-search { display: flex; align-items: center; gap: 9px; height: 40px; padding: 0 12px; border: 1px solid #dae4e9; border-radius: 11px; background: #f9fbfc; }
.calendar-search:focus-within { border-color: #55b8a4; box-shadow: 0 0 0 3px rgba(46, 169, 143, 0.11); }
.calendar-search svg { flex: 0 0 auto; width: 16px; height: 16px; color: #80919c; }
.calendar-search input { width: 100%; border: 0; outline: 0; background: transparent; color: #263f50; font: inherit; font-size: 0.79rem; }
.calendar-month-controls { display: flex; align-items: center; justify-content: center; gap: 7px; }
.calendar-month-controls button { width: 36px; height: 36px; border: 0; border-radius: 10px; background: transparent; color: #617783; font-size: 1.1rem; cursor: pointer; }
.calendar-month-controls button:hover { background: #eef7f5; color: #17806e; }
.calendar-month-controls h2 { min-width: 190px; margin: 0 8px; color: #315567; font-size: 1.23rem; font-weight: 500; text-align: center; text-transform: capitalize; }
.calendar-weekdays { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-bottom: 1px solid #e7edf0; background: #fbfcfd; }
.calendar-weekdays span { padding: 12px 8px; color: #7b8d98; font-size: 0.69rem; font-weight: 700; text-align: center; }
.calendar-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); grid-template-rows: repeat(6, minmax(92px, 1fr)); min-height: 590px; }
.calendar-day {
  min-width: 0;
  padding: 9px 7px 6px;
  overflow: hidden;
  border-right: 1px solid #e7edf0;
  border-bottom: 1px solid #e7edf0;
  background: #fff;
  cursor: pointer;
  transition: background 160ms ease;
}
.calendar-day:nth-child(7n) { border-right: 0; }
.calendar-day:hover { background: #f6fbfa; }
.calendar-day.is-outside { background: #fbfcfd; }
.calendar-day.is-selected { background: #f1faf8; box-shadow: inset 0 0 0 1px #b7e2d8; }
.calendar-day-number { display: grid; place-items: center; width: 25px; height: 25px; margin: 0 0 5px auto; border-radius: 9px; color: #61727d; font-size: 0.72rem; font-weight: 700; }
.calendar-day.is-outside .calendar-day-number { color: #bac4ca; }
.calendar-day.is-today .calendar-day-number { background: #168a74; color: #fff; box-shadow: 0 5px 12px rgba(22, 138, 116, 0.24); }
.calendar-day-events { display: grid; gap: 3px; }
.calendar-event-chip {
  display: block;
  width: 100%;
  padding: 4px 6px;
  overflow: hidden;
  border: 0;
  border-left: 3px solid currentColor;
  border-radius: 4px 7px 7px 4px;
  background: #e8f7f3;
  color: #16876f;
  font: inherit;
  font-size: 0.62rem;
  font-weight: 750;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}
.calendar-event-chip:hover { filter: brightness(0.97); }
.calendar-event-chip[data-category="reunion"] { color: #2671a7; background: #eaf4fb; }
.calendar-event-chip[data-category="academico"] { color: #a26b0c; background: #fff5da; }
.calendar-event-chip[data-category="personal"] { color: #8552a5; background: #f4ebfa; }
.calendar-more-events { padding: 1px 5px; color: #7d8c95; font-size: 0.58rem; font-weight: 700; }
.calendar-empty-filter { grid-column: 1 / -1; align-self: center; justify-self: center; color: #83949d; font-size: 0.85rem; }
.calendar-loading { position: absolute; inset: 84px 0 0; z-index: 4; display: flex; align-items: center; justify-content: center; gap: 7px; background: rgba(255,255,255,0.88); }
.calendar-loading span { width: 8px; height: 8px; border-radius: 50%; background: #2cab91; animation: calendarPulse 900ms ease-in-out infinite alternate; }
.calendar-loading span:nth-child(2) { animation-delay: 150ms; }
.calendar-loading span:nth-child(3) { animation-delay: 300ms; }
.calendar-loading.is-hidden { display: none; }
@keyframes calendarPulse { to { opacity: 0.3; transform: translateY(-5px); } }

.calendar-event-modal { max-width: 620px; }
.calendar-event-modal textarea,
.calendar-event-modal select { width: 100%; border: 1px solid var(--border, #dce5e9); border-radius: 9px; background: #fff; color: var(--text, #263f50); font: inherit; }
.calendar-event-modal textarea { min-height: 92px; padding: 11px 13px; resize: vertical; }
.calendar-event-modal select { height: 42px; padding: 0 11px; }
.calendar-event-modal textarea:focus,
.calendar-event-modal select:focus { border-color: #35a88f; outline: 0; box-shadow: 0 0 0 3px rgba(53,168,143,0.12); }
.calendar-form-error { display: none; margin: -3px 0 0; color: #c83e4d; font-size: 0.75rem; }
.calendar-form-error.is-visible { display: block; }
.calendar-modal-footer { flex-wrap: wrap; }
.calendar-modal-spacer { flex: 1; }
.calendar-delete-btn { display: none; border: 0; background: transparent; color: #c33f4d; font: inherit; font-size: 0.78rem; font-weight: 700; cursor: pointer; }
.calendar-delete-btn.is-visible { display: inline-flex; }

@media (max-width: 1120px) {
  .calendar-app { grid-template-columns: 218px minmax(0, 1fr); }
  .calendar-toolbar { grid-template-columns: 1fr auto; gap: 12px; }
  .calendar-search { grid-column: 1 / -1; grid-row: 2; max-width: none; }
  .calendar-month-controls { justify-content: flex-start; }
  .calendar-grid { grid-template-rows: repeat(6, minmax(88px, 1fr)); }
  .calendar-weekdays span { font-size: 0; }
  .calendar-weekdays span::first-letter { font-size: 0.7rem; }
}

@media (max-width: 760px) {
  .calendar-page-heading { align-items: center; }
  .calendar-notification-btn span { display: none; }
  .calendar-notification-btn { width: 42px; padding: 0; }
  .calendar-app { display: block; min-height: 0; overflow: visible; border: 0; border-radius: 0; background: transparent; box-shadow: none; }
  .calendar-side-panel { padding: 18px; border-radius: 18px; }
  .mini-calendar { margin-top: 20px; }
  .upcoming-panel { display: none; }
  .calendar-main-panel { margin-top: 14px; overflow: hidden; border: 1px solid #dfe8ed; border-radius: 18px; box-shadow: 0 15px 38px rgba(32, 61, 73, 0.08); }
  .calendar-toolbar { display: grid; grid-template-columns: 1fr auto; min-height: 0; padding: 14px; }
  .calendar-search { display: none; }
  .calendar-month-controls { justify-content: flex-start; gap: 2px; }
  .calendar-month-controls h2 { min-width: 0; margin: 0 5px; font-size: 1rem; }
  .calendar-month-controls button { width: 32px; }
  .calendar-today-btn { min-height: 36px; padding: 0 12px; }
  .calendar-weekdays span { padding: 10px 2px; font-size: 0; }
  .calendar-weekdays span::first-letter { font-size: 0.65rem; }
  .calendar-grid { grid-template-rows: repeat(6, minmax(64px, 1fr)); min-height: 410px; }
  .calendar-day { padding: 5px 3px; }
  .calendar-day-number { width: 22px; height: 22px; margin: 0 auto 4px; font-size: 0.65rem; }
  .calendar-event-chip { height: 7px; padding: 0; border: 0; border-radius: 5px; color: transparent; font-size: 0; }
  .calendar-more-events { display: none; }
  .calendar-loading { inset: 64px 0 0; }
  .calendar-event-modal .form-row { grid-template-columns: 1fr; }
  .calendar-modal-footer { gap: 8px; }
  .calendar-modal-spacer { display: none; }
  .calendar-delete-btn { margin-right: auto; }
}

/* ─── CENTRO DE NOTIFICACIONES Y MENSAJES ───────────────────────────────── */
.panel-eyebrow {
  display: block;
  margin-bottom: 4px;
  color: #18826f;
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.notification-panel {
  position: fixed;
  top: 72px;
  right: 24px;
  z-index: 190;
  width: min(390px, calc(100vw - 32px));
  max-height: min(650px, calc(100vh - 96px));
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid #dce6eb;
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(26, 48, 60, 0.22);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-10px) scale(0.98);
  transform-origin: top right;
  transition: opacity 180ms ease, transform 180ms ease;
}

.notification-panel.is-open { opacity: 1; pointer-events: auto; transform: translateY(0) scale(1); }
.notification-panel-header { display: flex; align-items: center; justify-content: space-between; padding: 20px 20px 14px; }
.notification-panel-header h2 { margin: 0; color: var(--fg); font-size: 1.22rem; }
.panel-close-btn { display: grid; place-items: center; width: 34px; height: 34px; border: 0; border-radius: 10px; background: #f3f6f8; color: #647984; font-size: 1.4rem; cursor: pointer; }
.notification-panel-actions,
.message-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 20px; border-top: 1px solid #edf1f3; border-bottom: 1px solid #edf1f3; background: #f9fbfc; color: #73858f; font-size: 0.72rem; }
.notification-panel-actions button,
.message-toolbar button { border: 0; background: transparent; color: #c6414e; font: inherit; font-weight: 750; cursor: pointer; }
.notification-panel-actions button:disabled,
.message-toolbar button:disabled { opacity: 0.4; cursor: default; }
.notification-list { overflow-y: auto; }
.notification-item { position: relative; display: grid; grid-template-columns: 38px minmax(0, 1fr) 32px; gap: 11px; padding: 15px 16px; border-bottom: 1px solid #edf1f3; background: #fff; transition: background 160ms ease; }
.notification-item.is-unread { background: #f3faf8; }
.notification-item:hover { background: #f8fbfc; }
.notification-icon { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px; background: #e9f7f3; color: #17866f; }
.notification-icon svg { width: 18px; height: 18px; }
.notification-copy { min-width: 0; cursor: pointer; }
.notification-copy strong { display: flex; align-items: center; gap: 7px; color: #2b4453; font-size: 0.78rem; }
.notification-copy p { margin: 4px 0 5px; color: #6e808a; font-size: 0.7rem; line-height: 1.42; }
.notification-copy time { color: #9aa8af; font-size: 0.62rem; }
.unread-marker { width: 7px; height: 7px; border-radius: 50%; background: #d13f4a; }
.icon-delete-button { display: grid; place-items: center; align-self: start; width: 30px; height: 30px; border: 0; border-radius: 9px; background: transparent; color: #9aabb3; cursor: pointer; }
.icon-delete-button:hover { background: #fff0f1; color: #cb3d49; }
.icon-delete-button svg { width: 15px; height: 15px; }
.inbox-empty { padding: 54px 24px; color: #85959d; text-align: center; }
.inbox-empty svg { width: 38px; height: 38px; margin-bottom: 12px; color: #afbec5; }
.inbox-empty strong { display: block; margin-bottom: 5px; color: #516773; font-size: 0.88rem; }
.inbox-empty p { margin: 0; font-size: 0.72rem; line-height: 1.5; }
.notif-badge.is-empty,
.nav-badge.is-empty { display: none; }

.message-toolbar { margin-bottom: 14px; border: 1px solid #e5ecef; border-radius: 13px; }
.message-list { display: grid; gap: 10px; }
.message-item { overflow: hidden; border: 1px solid #e0e9ed; border-radius: 16px; background: #fff; box-shadow: 0 7px 24px rgba(31, 59, 72, 0.055); }
.message-item.is-unread { border-left: 4px solid #cf3f49; }
.message-item-header { display: grid; grid-template-columns: minmax(0, 1fr) 34px; align-items: center; gap: 13px; width: 100%; padding: 16px 17px; border: 0; background: transparent; text-align: left; }
.message-avatar { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 14px; background: linear-gradient(145deg, #36566a, #233e50); color: #fff; font-size: 0.72rem; font-weight: 800; }
.message-heading { min-width: 0; }
.message-heading strong { display: flex; align-items: center; gap: 7px; color: #263f50; font-size: 0.82rem; }
.message-heading span { display: block; margin-top: 3px; overflow: hidden; color: #6f818b; font-size: 0.73rem; text-overflow: ellipsis; white-space: nowrap; }
.message-time { color: #98a6ad; font-size: 0.66rem; white-space: nowrap; }
.message-body { padding: 0 75px 18px; color: #5f737e; font-size: 0.77rem; line-height: 1.65; }
.message-body[hidden] { display: none; }
.message-item .icon-delete-button { margin-right: 12px; }
.message-item-empty { border: 1px dashed #d9e4e9; border-radius: 18px; background: #fbfcfd; }

.table-actions-heading { width: 95px; text-align: right !important; }
.table-action-cell { text-align: right; }
.table-delete-btn { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 0 10px; border: 1px solid #f0d7da; border-radius: 9px; background: #fff7f8; color: #c23d49; font: inherit; font-size: 0.7rem; font-weight: 700; cursor: pointer; }
.table-delete-btn:hover { background: #c9404b; color: #fff; border-color: #c9404b; }
.table-loading-state { padding: 44px !important; color: #82939c !important; text-align: center; }
.compact-record-modal { max-width: 570px; }
.compact-record-modal textarea { width: 100%; min-height: 110px; padding: 11px 13px; border: 1px solid var(--border); border-radius: 9px; color: var(--fg); font: inherit; resize: vertical; }
.compact-record-modal textarea:focus { border-color: #35a88f; outline: 0; box-shadow: 0 0 0 3px rgba(53,168,143,0.12); }

@media (max-width: 768px) {
  .notification-panel { top: 70px; right: 10px; width: calc(100vw - 20px); max-height: calc(100vh - 88px); }
  .message-item-header { grid-template-columns: minmax(0, 1fr) 30px; gap: 10px; padding: 14px 12px; }
  .message-avatar { width: 40px; height: 40px; }
  .message-time { display: none; }
  .message-body { padding: 0 62px 16px; }
  .message-item .icon-delete-button { margin-right: 7px; }
  .table-delete-btn span { display: none; }
}

.notification-copy,
.message-open-button {
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.message-open-button {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  align-items: center;
  gap: 13px;
  width: 100%;
}

@media (max-width: 768px) {
  .message-open-button { grid-template-columns: 40px minmax(0, 1fr); gap: 10px; }
}

/* ─── REGISTROS ADMINISTRABLES ───────────────────────────────────────────── */
#recordFields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

#recordFields .record-field-wide,
#recordFields .form-group:nth-last-child(1):nth-child(odd) { grid-column: 1 / -1; }

#recordFields select,
#recordFields textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: #fff;
  color: var(--fg);
  font: inherit;
}

#recordFields select { height: 42px; padding: 0 11px; }
#recordFields textarea { min-height: 120px; padding: 11px 13px; resize: vertical; }
#recordFields select:focus,
#recordFields textarea:focus { border-color: #35a88f; outline: 0; box-shadow: 0 0 0 3px rgba(53,168,143,0.12); }

.card-delete-btn {
  width: 100%;
  margin-top: 12px;
  padding: 9px 12px;
  border: 1px solid #f0d7da;
  border-radius: 9px;
  background: #fff7f8;
  color: #c23d49;
  font: inherit;
  font-size: 0.72rem;
  font-weight: 750;
  cursor: pointer;
}

.card-delete-btn:hover { background: #c9404b; border-color: #c9404b; color: #fff; }
.managed-announcement { position: relative; grid-template-columns: 38px minmax(0, 1fr) 34px; }
.announcement-delete { align-self: start; }

@media (max-width: 560px) {
  #recordFields { grid-template-columns: 1fr; }
  #recordFields .record-field-wide,
  #recordFields .form-group:nth-last-child(1):nth-child(odd) { grid-column: auto; }
}
