/* === Header === */
.header {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--header-h);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  height: 100%;
  padding: 0 24px;
  display: grid;
  grid-template-columns: var(--sidebar-w) auto 1fr auto;
  gap: 24px;
  align-items: center;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}
.brand-logo { width: 32px; height: 32px; flex-shrink: 0; }
.brand-logo-full { height: 58px; width: auto; display: block; flex-shrink: 0; }
.brand-stack { flex-direction: column; align-items: center; gap: 0; }
.brand-text { display: flex; flex-direction: column; line-height: 1; }
.brand-name { font-size: 17px; font-weight: 500; color: var(--cn-azul); letter-spacing: -0.02em; }
.brand-name b { font-weight: 800; }
.brand-tag {
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.12em;
  color: var(--text-3);
  text-transform: uppercase;
  margin-top: 3px;
}

.role-switcher {
  display: inline-flex;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  padding: 3px;
  gap: 2px;
}
.role-pill {
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
  border-radius: var(--r-pill);
  transition: all 0.2s var(--ease);
  white-space: nowrap;
}
.role-pill.active {
  background: var(--cn-azul);
  color: white;
  box-shadow: var(--sh-1);
}
.role-pill:not(.active):hover { color: var(--text); background: var(--bg); }

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-self: end;
}
.search-box {
  position: relative;
  width: 280px;
}
.search-box input {
  width: 100%;
  height: 36px;
  padding: 0 12px 0 36px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  font-size: 13px;
  transition: all 0.2s var(--ease);
}
.search-box input:focus { outline: none; border-color: var(--cn-azul); background: var(--bg); box-shadow: 0 0 0 3px rgba(27,107,138,0.1); }
.search-box svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--text-3); pointer-events: none; }

.icon-btn {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  color: var(--text-2);
  background: var(--bg);
  position: relative;
  transition: all 0.2s var(--ease);
}
.icon-btn:hover { color: var(--text); border-color: var(--border-strong); }
.icon-btn .dot {
  position: absolute;
  top: 7px; right: 7px;
  width: 7px; height: 7px;
  background: var(--alert);
  border-radius: 50%;
  border: 2px solid var(--bg);
}
.user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 12px 4px 4px;
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  font-size: 13px;
  font-weight: 600;
  background: var(--bg);
  transition: all 0.2s var(--ease);
}
.user-chip:hover { border-color: var(--border-strong); }
.user-avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--cn-azul);
  color: white;
  font-size: 11px;
  font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
  font-family: 'JetBrains Mono', monospace;
}

/* === Layout === */
.layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: calc(100dvh - var(--header-h));
}

/* Portal de apoderados: sin barra lateral ni pendientes → el horario ocupa todo
   el ancho (así entra la semana completa, incluido el viernes). */
body.role-padres .layout { grid-template-columns: 1fr; }
body.role-padres .sidebar,
body.role-padres .nav-toggle,
body.role-padres .sidebar-backdrop { display: none; }

/* === Sidebar === */
.sidebar {
  background: var(--bg);
  border-right: 1px solid var(--border);
  padding: 20px 14px 20px;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: var(--header-h);
  height: calc(100dvh - var(--header-h));
  overflow-y: auto;
}
.nav-section {
  margin-bottom: 18px;
  position: relative;
  padding-left: 6px;
}
.nav-section::before {
  content: '';
  position: absolute;
  left: 0;
  top: 22px;
  bottom: 6px;
  width: 3px;
  border-radius: 3px;
  background: var(--border-strong);
  opacity: 0.55;
}
.nav-section[data-section="op"]::before  { background: var(--cn-azul); opacity: 0.85; }
.nav-section[data-section="rec"]::before { background: var(--cn-mostaza); opacity: 0.85; }
.nav-section[data-section="sys"]::before { background: var(--text-3); opacity: 0.55; }
.nav-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--text-3);
  text-transform: uppercase;
  padding: 0 12px 8px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 12px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-2);
  border-radius: var(--r-md);
  cursor: pointer;
  transition: all 0.18s var(--ease);
  position: relative;
  margin-bottom: 1px;
}
.nav-item svg { width: 17px; height: 17px; flex-shrink: 0; color: var(--text-3); transition: color 0.18s var(--ease); }
.nav-item:hover { background: var(--bg-soft); color: var(--text); }
.nav-item:hover svg { color: var(--text-2); }
.nav-item.active {
  background: var(--cn-azul-bg);
  color: var(--cn-azul-deep);
  font-weight: 600;
}
.nav-item.active svg { color: var(--cn-azul); }
.nav-item.active::before {
  content: '';
  position: absolute;
  left: -14px;
  top: 8px;
  bottom: 8px;
  width: 3px;
  background: var(--cn-azul);
  border-radius: 0 3px 3px 0;
}
.nav-count {
  margin-left: auto;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-3);
  font-family: 'JetBrains Mono', monospace;
}
.nav-item.active .nav-count { color: var(--cn-azul); }

.pendientes {
  margin-top: 12px;
  background: var(--bg-soft);
  border-radius: var(--r-md);
  padding: 12px;
}
.pendientes-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.pendientes-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-2);
}
.pendientes-count {
  font-size: 10px;
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
  color: var(--alert);
  animation: pulseSoft 2s infinite;
}
.pendiente-item {
  font-size: 12px;
  color: var(--text-2);
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
  display: flex;
  gap: 6px;
  line-height: 1.35;
}
.pendiente-item:last-child { border-bottom: none; }
.pendiente-item { cursor: pointer; transition: background 0.15s var(--ease); border-radius: 4px; padding: 6px; margin: 0 -6px; }
.pendiente-item:hover { background: var(--bg); }
.pendiente-item .dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; margin-top: 5px; }
.pendiente-item .dot.alert { background: var(--alert); }
.pendiente-item .dot.warn { background: var(--cn-mostaza); }
.pendiente-item .dot.ok { background: var(--success); }

.sidebar-cta {
  margin-top: auto;
  padding-top: 16px;
}
.btn-cta {
  width: 100%;
  height: 44px;
  background: var(--cn-mostaza);
  color: white;
  font-weight: 700;
  font-size: 13.5px;
  border-radius: var(--r-md);
  box-shadow: var(--sh-mostaza);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.22s var(--ease);
}
.btn-cta:hover { background: var(--cn-mostaza-bright); transform: translateY(-1px); }
.btn-cta:active { transform: translateY(0); }
.btn-cta svg { transition: transform 0.3s var(--ease); }
.btn-cta:hover svg { transform: rotate(90deg); }

/* === Main === */
.main {
  padding: 28px 32px 60px;
  min-width: 0;
}

/* === Navegación móvil/tablet === */
.nav-toggle {
  display: none;
  width: 38px; height: 38px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  color: var(--text-2);
  background: var(--bg);
  transition: all 0.2s var(--ease);
}
.nav-toggle:hover { color: var(--text); border-color: var(--border-strong); }
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: var(--header-h) 0 0 0;
  background: rgba(10,16,24,0.42);
  z-index: 55;
}

@media (max-width: 1100px) {
  .layout { grid-template-columns: 1fr; }
  .nav-toggle { display: inline-flex; }
  .sidebar {
    position: fixed;
    left: 0;
    top: var(--header-h);
    width: var(--sidebar-w);
    height: calc(100dvh - var(--header-h));
    z-index: 60;
    transform: translateX(-100%);
    transition: transform 0.26s var(--ease);
    box-shadow: var(--sh-3);
  }
  body.sidebar-open .sidebar { transform: translateX(0); }
  body.sidebar-open .sidebar-backdrop { display: block; }
  .header-inner { grid-template-columns: auto 1fr auto; }
  .header-inner .brand { display: none; }
  .search-box { width: 200px; }
  .main { padding: 18px 16px 40px; }
}

/* === Teléfono === */
@media (max-width: 640px) {
  .header-inner { padding: 0 12px; gap: 10px; }
  .search-box { display: none; }               /* la búsqueda no cabe en el header del teléfono */
  .role-switcher { padding: 2px; max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .role-pill { padding: 5px 10px; font-size: 11px; }
  .header-actions { gap: 6px; }
  .user-chip { padding: 3px; }
  .user-chip #userName { display: none; }        /* solo el avatar en el chip */
  .main { padding: 14px 12px 44px; }
  .nav-toggle { width: 36px; height: 36px; }
}
