/* Shell autenticado: sidebar, topbar, campana, tarjetas de resumen y calendario mensual.
   Reutiliza las variables de color/espaciado/tipografía definidas en site.css. */

.app-shell {
  display: flex;
  min-height: 100vh;
  min-height: 100dvh;
}

/* Foco del shell: el anillo rosa global (#ef92ad sobre blanco, ~2.3:1) no llega a los 3:1 que pide WCAG 1.4.11 para componentes de interfaz.
   Verde oscuro (~9:1 sobre blanco y sobre los fondos suaves) con separación del borde: visible en todos los estados y fondos del shell. */
.app-shell :focus-visible {
  outline: 3px solid var(--color-green-dark);
  outline-offset: 2px;
}

/* Enlace para saltar el menú: invisible hasta que recibe foco con el teclado. */
.skip-link {
  position: absolute;
  top: var(--space-2);
  left: var(--space-2);
  z-index: 100;
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  color: var(--color-green-dark);
  font-weight: 700;
  transform: translateY(-200%);
}

.skip-link:focus-visible {
  transform: none;
  outline: 3px solid var(--color-green-dark);
  outline-offset: 2px;
}

/* El sidebar ocupa el alto de la ventana y se queda fijo: la lista de enlaces scrollea por dentro y "Cerrar sesión" siempre está a la vista,
   también en pantallas bajas y con páginas largas. */
.app-sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  width: 16rem;
  height: 100vh;
  height: 100dvh;
  flex-shrink: 0;
  align-self: flex-start;
  padding: var(--space-5) var(--space-4) var(--space-4);
  padding-top: calc(var(--space-5) + env(safe-area-inset-top, 0px));
  padding-bottom: calc(var(--space-4) + env(safe-area-inset-bottom, 0px));
  padding-left: calc(var(--space-4) + env(safe-area-inset-left, 0px));
  background: var(--color-surface);
  border-right: var(--border);
}

.app-sidebar__brand {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-5);
  font-family: var(--font-display);
  font-size: 1.4rem;
  color: var(--color-green-dark);
  text-decoration: none;
}

.app-sidebar__brand:hover {
  color: var(--color-green-dark);
}

.app-sidebar__flower {
  flex-shrink: 0;
  color: var(--color-pink);
}

/* El padding/margin de 4px deja lugar al anillo de foco: un contenedor con scroll recorta lo que se sale de su caja. */
.app-nav {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: var(--space-1);
  min-height: 0;
  margin: -4px;
  padding: 4px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--color-border) transparent;
  /* Sombras de scroll (solo aparecen si hay más enlaces arriba o abajo): la lista de un perfil con muchos roles no entra en pantallas bajas. */
  background:
    linear-gradient(var(--color-surface) 30%, rgb(255 255 255 / 0%)) top / 100% 1.5rem no-repeat local,
    linear-gradient(rgb(255 255 255 / 0%), var(--color-surface) 70%) bottom / 100% 1.5rem no-repeat local,
    radial-gradient(farthest-side at 50% 0, rgb(39 48 34 / 14%), rgb(39 48 34 / 0%)) top / 100% 0.5rem no-repeat scroll,
    radial-gradient(farthest-side at 50% 100%, rgb(39 48 34 / 14%), rgb(39 48 34 / 0%)) bottom / 100% 0.5rem no-repeat scroll;
}

.app-nav__list {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  margin: 0;
  padding: 0;
  list-style: none;
}

.app-nav__group {
  margin-top: var(--space-2);
}

/* Encabezado de sección. Sin JavaScript es un rótulo; sidebar-nav.js lo convierte en botón (.app-nav__toggle) y recién ahí aparece el chevron. */
.app-nav__heading {
  color: var(--color-muted);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.app-nav:not(.is-enhanced) .app-nav__heading {
  padding: var(--space-2) var(--space-3);
}

.app-nav:not(.is-enhanced) .app-nav__chevron {
  display: none;
}

.app-nav__group[data-nav-active="true"] .app-nav__heading {
  color: var(--color-green-dark);
}

.app-nav__toggle {
  display: flex;
  width: 100%;
  min-height: 2.5rem;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  border: 0;
  border-radius: var(--radius-md);
  color: inherit;
  background: transparent;
  font: inherit;
  font-weight: inherit;
  letter-spacing: inherit;
  text-align: left;
  text-transform: inherit;
}

.app-nav__toggle:hover {
  color: inherit;
  background: transparent;
}

.app-nav__toggle:active {
  transform: none;
  background: var(--color-cream-deep);
}

@media (hover: hover) and (pointer: fine) {
  .app-nav__toggle:hover {
    background: var(--color-cream-deep);
    color: var(--color-green-dark);
  }
}

.app-nav__chevron {
  flex-shrink: 0;
}

.app-nav__group[data-open="false"] .app-nav__chevron {
  transform: rotate(-90deg);
}

/* Panel plegable. Solo con JavaScript activo (.is-enhanced); sin él todo queda abierto. Se anima grid-template-rows 1fr ↔ 0fr (sin medir alturas
   en JS) más opacity: 200 ms ease-out, el chevron en 170 ms. Al cerrar, visibility:hidden (tras la transición) saca los enlaces del orden de
   tabulación y de los lectores de pantalla. */
.app-nav.is-enhanced .app-nav__panel {
  display: grid;
  grid-template-rows: 1fr;
  opacity: 1;
  visibility: visible;
}

.app-nav.is-enhanced .app-nav__group[data-open="false"] .app-nav__panel {
  grid-template-rows: 0fr;
  opacity: 0;
  visibility: hidden;
}

.app-nav__panel-inner {
  min-height: 0;
  margin: -4px;
  padding: 4px;
  overflow: hidden;
}

.app-nav.is-ready .app-nav__panel {
  transition:
    grid-template-rows 200ms var(--ease-out),
    opacity 200ms var(--ease-out),
    visibility 0s linear 0s;
}

.app-nav.is-ready .app-nav__group[data-open="false"] .app-nav__panel {
  transition:
    grid-template-rows 200ms var(--ease-out),
    opacity 200ms var(--ease-out),
    visibility 0s linear 200ms;
}

.app-nav.is-ready .app-nav__chevron {
  transition: transform 170ms var(--ease-out);
}

.app-nav__link {
  display: flex;
  min-height: 2.5rem;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  border-left: 3px solid transparent;
  border-radius: var(--radius-md);
  color: var(--color-ink);
  font-weight: 600;
  text-decoration: none;
  transition: background 160ms var(--ease-out), color 160ms var(--ease-out), border-color 160ms var(--ease-out);
}

.app-nav__link.is-active {
  border-left-color: var(--color-pink);
  background: var(--color-green-soft);
  color: var(--color-green-dark);
}

.app-nav__link .icon {
  width: 1.2rem;
  height: 1.2rem;
  flex-shrink: 0;
}

@media (hover: hover) and (pointer: fine) {
  .app-nav__link:hover {
    background: var(--color-cream-deep);
    color: var(--color-green-dark);
  }

  .app-nav__link.is-active:hover {
    background: var(--color-green-soft);
  }

  .app-nav__link:hover .icon {
    transform: translateX(2px);
    transition: transform 160ms var(--ease-out);
  }
}

@media (pointer: coarse) {
  .app-nav__link,
  .app-nav__toggle {
    min-height: 2.75rem;
  }
}

.app-sidebar__footer {
  flex-shrink: 0;
  margin-top: var(--space-3);
  padding-top: var(--space-3);
  border-top: var(--border);
}

.app-sidebar__footer form {
  margin: 0;
}

/* "Cerrar sesión": misma forma, ritmo y tamaño de icono que un enlace del menú. Se define completo (y no sobre el botón genérico) para que
   ningún estilo heredado de `button` —relleno oscuro, pill, escala al presionar— lo desfigure. El icono lo dimensiona `.icon` (site.css). */
.app-sidebar__logout {
  display: flex;
  width: 100%;
  min-height: 2.75rem;
  align-items: center;
  justify-content: flex-start;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  border: 0;
  border-left: 3px solid transparent;
  border-radius: var(--radius-md);
  color: var(--color-ink);
  background: transparent;
  font-weight: 600;
  line-height: 1.55;
  text-align: left;
}

.app-sidebar__logout .icon {
  width: 1.2rem;
  height: 1.2rem;
  flex-shrink: 0;
}

.app-sidebar__logout:hover {
  border-color: transparent;
  color: var(--color-ink);
  background: transparent;
}

.app-sidebar__logout:active {
  background: var(--color-cream-deep);
  transform: none;
}

@media (hover: hover) and (pointer: fine) {
  .app-sidebar__logout:hover {
    border-left-color: transparent;
    color: var(--color-danger);
    background: var(--color-danger-soft);
  }
}

.app-main {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}

.app-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-5);
  padding-top: calc(var(--space-3) + env(safe-area-inset-top, 0px));
  padding-right: calc(var(--space-5) + env(safe-area-inset-right, 0px));
  padding-left: calc(var(--space-5) + env(safe-area-inset-left, 0px));
  background: var(--color-surface);
  border-bottom: var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}

.app-topbar__menu-toggle {
  display: none;
  background: transparent;
  border: var(--border);
  border-radius: var(--radius-sm);
  padding: var(--space-2);
  color: var(--color-ink);
  cursor: pointer;
}

.app-topbar__menu-toggle,
.app-topbar__menu-toggle:hover,
.app-topbar__menu-toggle:active {
  min-width: 2.75rem;
  background: transparent;
  color: var(--color-ink);
}

.app-topbar__menu-toggle:active {
  background: var(--color-cream-deep);
  transform: none;
}

@media (hover: hover) and (pointer: fine) {
  .app-topbar__menu-toggle:hover {
    background: var(--color-cream-deep);
  }
}

.app-topbar__menu-toggle .icon {
  width: 1.3rem;
  height: 1.3rem;
}

.app-topbar__actions {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.app-topbar__actions--end {
  margin-left: auto;
}

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

.app-user__avatar {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: var(--pill);
  background: var(--color-green-soft);
  color: var(--color-green-dark);
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
}

.app-user__text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
  text-align: right;
}

.app-user__name {
  font-weight: 700;
}

.app-user__role {
  max-width: 14rem;
  overflow: hidden;
  font-size: 0.78rem;
  color: var(--color-muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Escala tipográfica del área de trabajo: títulos más contenidos que en el sitio público (herramienta de uso diario). */
.app-content h1 {
  margin-bottom: var(--space-3);
  font-size: clamp(1.85rem, 3vw, 2.4rem);
}

.app-content h2 {
  margin-bottom: var(--space-3);
  font-size: clamp(1.3rem, 2.2vw, 1.65rem);
}

.app-content h3 {
  font-size: 1.15rem;
}

.app-content {
  flex: 1;
  padding: var(--space-5);
  padding-bottom: calc(var(--space-5) + env(safe-area-inset-bottom, 0px));
  padding-right: calc(var(--space-5) + env(safe-area-inset-right, 0px));
  padding-left: calc(var(--space-5) + env(safe-area-inset-left, 0px));
}

/* Destino del enlace "Saltar al contenido": recibe foco por programa, no es una parada de tabulación, así que no necesita anillo. */
.app-content:focus {
  outline: none;
}

/* Campana de avisos */
.notification-bell {
  position: relative;
}

.notification-bell__toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.4rem;
  height: 2.4rem;
  border-radius: var(--pill);
  border: var(--border);
  color: var(--color-ink);
  background: var(--color-surface);
  cursor: pointer;
  transition: border-color 160ms var(--ease-out), background 160ms var(--ease-out);
}

.notification-bell__toggle:hover,
.notification-bell__toggle:active {
  border-color: var(--color-border);
  background: var(--color-surface);
  color: var(--color-ink);
}

.notification-bell__toggle:active {
  background: var(--color-cream-deep);
  transform: none;
}

.notification-bell__toggle[aria-expanded="true"] {
  border-color: var(--color-green);
}

@media (hover: hover) and (pointer: fine) {
  .notification-bell__toggle:hover {
    border-color: var(--color-green);
  }
}

@media (pointer: coarse) {
  .notification-bell__toggle {
    width: 2.75rem;
    height: 2.75rem;
  }
}

.notification-bell__toggle .icon {
  width: 1.2rem;
  height: 1.2rem;
  flex-shrink: 0;
}

.notification-bell__count {
  position: absolute;
  top: -0.3rem;
  right: -0.3rem;
  min-width: 1.2rem;
  height: 1.2rem;
  padding: 0 0.3rem;
  border-radius: 999px;
  background: var(--color-pink);
  color: var(--color-ink);
  font-size: 0.68rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
}

.notification-bell__panel {
  position: absolute;
  right: 0;
  top: calc(100% + 0.5rem);
  width: 22rem;
  max-width: calc(100vw - 2rem);
  max-height: min(30rem, calc(100dvh - 5rem));
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--color-surface);
  border: var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  z-index: 20;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(-6px) scale(0.98);
  transform-origin: top right;
  transition:
    opacity 180ms var(--ease-out),
    transform 180ms var(--ease-out),
    visibility 0s linear 180ms;
}

.notification-bell__panel.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: none;
  transition:
    opacity 180ms var(--ease-out),
    transform 180ms var(--ease-out);
}

.notification-bell__header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-bottom: var(--border);
}

.notification-bell__title {
  font-weight: 700;
}

.notification-bell__unread {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--color-green-dark);
}

.notification-bell__list {
  margin: 0;
  padding: 0;
  list-style: none;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--color-border) transparent;
}

.notification-item {
  position: relative;
  display: block;
  padding: var(--space-3) var(--space-4);
  border-bottom: var(--border);
  text-decoration: none;
  color: var(--color-ink);
  transition: background-color 160ms var(--ease-out);
}

.notification-bell__list li:last-child .notification-item {
  border-bottom: none;
}

/* Sin leer: fondo suave, título en negrita y el texto oculto "Sin leer. " para lectores de pantalla (no depende del color). */
.notification-item.is-unread {
  background: var(--color-unread);
}

.notification-item:focus-visible {
  outline: 2px solid var(--color-green-dark);
  outline-offset: -2px;
}

@media (hover: hover) and (pointer: fine) {
  .notification-item:hover {
    background: var(--color-cream-deep);
  }
}

.notification-item__title {
  display: block;
  font-weight: 600;
  font-size: 0.88rem;
}

.notification-item.is-unread .notification-item__title {
  font-weight: 800;
}

.notification-item__meta {
  display: block;
  margin-top: 0.15rem;
  font-size: 0.8rem;
  line-height: 1.4;
  color: var(--color-muted);
  overflow-wrap: anywhere;
}

.notification-item__time {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.74rem;
  color: var(--color-muted);
}

.notification-bell__empty {
  margin: 0;
  padding: var(--space-4);
  color: var(--color-muted);
  font-size: 0.85rem;
}

.notification-bell__footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2) var(--space-4);
  padding: var(--space-3) var(--space-4);
  border-top: var(--border);
  background: var(--color-surface);
}

.notification-bell__footer form {
  margin: 0;
}

.notification-bell__all,
.notification-bell__mark-all {
  min-height: 2.75rem;
  padding: 0;
  border: 0;
  background: none;
  color: var(--color-green-dark);
  font-size: 0.82rem;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 0.2em;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
}

.notification-bell__mark-all:hover {
  background: none;
  color: var(--color-danger);
}

.notification-bell__all:focus-visible,
.notification-bell__mark-all:focus-visible {
  outline: 2px solid var(--color-green-dark);
  outline-offset: 2px;
}

/* En pantallas angostas el panel ocupa el ancho disponible: anclado al botón se saldría por la izquierda. */
@media (max-width: 640px) {
  .notification-bell {
    position: static;
  }

  .notification-bell__panel {
    position: fixed;
    top: calc(4.25rem + env(safe-area-inset-top, 0px));
    right: calc(var(--space-3) + env(safe-area-inset-right, 0px));
    left: calc(var(--space-3) + env(safe-area-inset-left, 0px));
    width: auto;
    max-width: none;
    max-height: calc(100dvh - 5.5rem - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
  }
}

/* Tarjetas de resumen del dashboard */
.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}

/* Seis indicadores: tres por fila desde tablet, sin tarjeta huérfana. */
@media (min-width: 48rem) {
  .summary-grid--thirds {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.summary-card {
  padding: var(--space-4) var(--space-5);
  background: var(--color-surface);
  border: var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  animation: sakura-rise 300ms var(--ease-out) both;
}

.summary-grid .summary-card:nth-child(2) {
  animation-delay: 50ms;
}

.summary-grid .summary-card:nth-child(3) {
  animation-delay: 100ms;
}

.summary-grid .summary-card:nth-child(4) {
  animation-delay: 150ms;
}

.summary-card__value--sm {
  font-size: 1.3rem;
}

.summary-card__value--xs {
  font-size: 1.1rem;
}

.summary-card__label {
  display: block;
  color: var(--color-muted);
  font-size: 0.85rem;
}

.summary-card__value {
  display: block;
  margin-top: var(--space-1);
  font-family: var(--font-display);
  font-size: 2rem;
  color: var(--color-green-dark);
}

.summary-card__action {
  display: inline-flex;
  min-height: 2.75rem;
  align-items: center;
  margin-top: var(--space-1);
  font-size: 0.85rem;
  font-weight: 700;
}

.dashboard-columns {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr));
  gap: var(--space-5);
}

.dashboard-panel {
  padding: var(--space-4) var(--space-5);
  background: var(--color-surface);
  border: var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.dashboard-panel h2 {
  margin-top: 0;
}

.dashboard-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.dashboard-list li {
  padding-bottom: var(--space-3);
  border-bottom: var(--border);
}

.dashboard-list li:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

/* Calendario mensual */
.month-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

.month-toolbar__title {
  font-family: var(--font-display);
  font-size: 1.5rem;
  color: var(--color-green-dark);
  margin: 0;
}

.month-toolbar__nav {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

/* Calendario: una tabla HTML real (encabezados de columna <th scope="col">, una fila por semana, un enlace por día). border-spacing da el aire
   entre días sin romper la semántica; el margen negativo compensa el aire exterior para que la grilla siga alineada con la barra de arriba. */
.month-grid {
  width: calc(100% + var(--space-2) * 2);
  margin: calc(var(--space-2) * -1);
  border-collapse: separate;
  border-spacing: var(--space-2);
  table-layout: fixed;
}

.month-grid th {
  padding: 0;
  text-align: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--color-muted);
  text-transform: uppercase;
}

.month-grid td {
  height: 4.5rem;
  padding: 0;
  vertical-align: top;
}

.month-day {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  height: 100%;
  min-height: 4.5rem;
  padding: var(--space-2);
  background: var(--color-surface);
  border: var(--border);
  border-radius: var(--radius-md);
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  color: var(--color-ink);
  font: inherit;
  transition: border-color 160ms var(--ease-out), background 160ms var(--ease-out);
}

.month-day:hover {
  color: var(--color-ink);
}

@media (hover: hover) and (pointer: fine) {
  .month-day:hover {
    border-color: var(--color-green);
  }
}

.month-day:active {
  background: var(--color-cream-deep);
}

.month-day--selected:active {
  background: var(--color-green-soft);
}

/* Antes era opacity:0.4, que atenuaba el texto junto con todo lo demás y bajaba el contraste
   del número de día a 2.28:1 (falla WCAG AA). Un color fijo de bajo contraste intencional, en vez
   de opacidad, permite atenuar visualmente el día sin perder legibilidad. */
.month-day--outside {
  background: var(--color-cream-deep);
}

.month-day--outside .month-day__number {
  color: var(--color-muted);
}

.month-day--today .month-day__number {
  position: relative;
}

.month-day--today .month-day__number::after {
  content: "";
  display: inline-block;
  width: 0.35rem;
  height: 0.35rem;
  margin-left: 0.3rem;
  border-radius: var(--pill);
  background: var(--color-pink);
  vertical-align: middle;
}

.month-day--selected {
  background: var(--color-green-soft);
  border-color: var(--color-green);
  border-width: 2px;
}

.month-day__number {
  font-weight: 700;
}

.month-day__badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem;
}

.month-day__badge {
  font-size: 0.68rem;
  font-weight: 800;
  padding: 0.05rem 0.35rem;
  border-radius: 999px;
}

.month-day__badge--pending {
  background: var(--color-warning-soft);
  color: #6f4a07;
}

.month-day__badge--confirmed {
  background: var(--color-info-soft);
  color: #254955;
}

/* Turno rápido de Spa sin vincular: el mismo tono del Spa, con borde punteado (nunca solo color: lleva texto). */
.month-day__badge--unlinked {
  border: 1px dashed var(--color-pink-ink);
  background: var(--color-pink-soft);
  color: var(--color-pink-ink);
}

.day-panel {
  margin-top: var(--space-5);
  padding: var(--space-4) var(--space-5);
  background: var(--color-surface);
  border: var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  animation: sakura-rise 300ms var(--ease-out) both;
}

/* Tablet y móvil. Sin JavaScript (o si sidebar-drawer.js no llegó a cargar) el sidebar queda apilado arriba con TODOS los enlaces visibles y el botón de menú no se
   muestra. Cuando sidebar-drawer.js está operativo marca <html class="drawer-ready"> y recién entonces el sidebar pasa a ser un drawer fuera de pantalla. */
@media (max-width: 960px) {
  .app-shell {
    flex-direction: column;
  }

  .app-sidebar {
    position: static;
    width: 100%;
    height: auto;
    border-right: 0;
    border-bottom: var(--border);
  }

  .app-nav {
    overflow-y: visible;
  }

  .app-user__role {
    display: none;
  }

  .drawer-ready .app-shell {
    flex-direction: row;
  }

  .drawer-ready .app-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 30;
    width: min(18rem, calc(100vw - 3rem));
    height: 100vh;
    height: 100dvh;
    border-right: var(--border);
    border-bottom: 0;
    transform: translateX(-100%);
    transition: transform 220ms var(--ease-out), visibility 0s linear 220ms;
    visibility: hidden;
    box-shadow: var(--shadow-md);
  }

  .drawer-ready .app-nav {
    overflow-y: auto;
  }

  .drawer-ready .app-shell.nav-open .app-sidebar {
    transform: translateX(0);
    transition: transform 220ms var(--ease-out);
    visibility: visible;
  }

  /* Velo detrás del drawer: oscurece el contenido y, al tocarlo, cierra el menú (ver sidebar-drawer.js). */
  .drawer-ready .app-shell::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 25;
    background: rgb(39 48 34 / 35%);
    opacity: 0;
    pointer-events: none;
    transition: opacity 200ms var(--ease-out);
  }

  .drawer-ready .app-shell.nav-open::before {
    opacity: 1;
    pointer-events: auto;
  }

  .drawer-ready .app-topbar__menu-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
}

@media (max-width: 640px) {
  .app-content {
    padding: var(--space-4);
    padding-bottom: calc(var(--space-4) + env(safe-area-inset-bottom, 0px));
    padding-right: calc(var(--space-4) + env(safe-area-inset-right, 0px));
    padding-left: calc(var(--space-4) + env(safe-area-inset-left, 0px));
  }

  .month-grid {
    width: calc(100% + var(--space-1) * 2);
    margin: calc(var(--space-1) * -1);
    border-spacing: var(--space-1);
  }

  .month-grid td {
    height: 3.4rem;
  }

  .month-day {
    min-height: 3.4rem;
    min-width: 0;
    padding: 0.15rem 0.2rem;
  }

  /* Columnas de ~43px: los conteos se apilan, más chicos y sin salirse de la celda (el nombre accesible no cambia: dice "pendiente"/"confirmado"). */
  .month-day__badges {
    flex-direction: column;
    flex-wrap: nowrap;
    gap: 0.15rem;
    min-width: 0;
  }

  .month-day__badge {
    min-width: 0;
    padding: 0.05rem 0.1rem;
    overflow: hidden;
    font-size: 0.6rem;
    letter-spacing: -0.01em;
    text-align: center;
    white-space: nowrap;
  }

  .month-day__number {
    font-size: 0.85rem;
  }

  .app-user__text {
    text-align: left;
  }
}

/* A los ~480px el nombre completo (variable, puede ser largo) empuja el topbar a scroll
   horizontal junto con el carrito + campana + menú. El avatar con inicial ya identifica a la
   persona sin ese ancho; el nombre completo vuelve a aparecer desde los 640px, donde ya hay
   lugar real. */
@media (max-width: 480px) {
  .app-user__name {
    display: none;
  }
}

/* Movimiento reducido: el bloque global de site.css ya cancela transiciones y animaciones; acá se deja explícito para el shell, donde los
   paneles del sidebar, el chevron, el drawer, el velo y el panel de avisos son lo único que se mueve. */
@media (prefers-reduced-motion: reduce) {
  .app-nav .app-nav__panel,
  .app-nav .app-nav__chevron,
  .app-sidebar,
  .app-shell::before,
  .notification-bell__panel,
  .app-nav__link .icon,
  .app-sidebar__cta,
  .app-nav__sublink {
    transition: none !important;
  }
}

/* Indicador discreto de cobros pendientes junto a «Cobros». Lleva el número en texto (y un nombre accesible completo); el color solo refuerza. */
.app-nav__badge {
  margin-left: auto;
  min-width: 1.5rem;
  padding: 0 0.45rem;
  border-radius: var(--pill);
  color: #fff;
  background: var(--color-pink-ink);
  font-size: var(--text-xs);
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  line-height: 1.5rem;
  text-align: center;
}

/* ===== Menú modular (PR #47): acceso rápido, módulos y destinos del módulo actual. ===== */
.app-sidebar__cta {
  display: flex;
  flex-shrink: 0;
  min-height: 2.75rem;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--pill);
  background: var(--color-pink-ink);
  color: #fff;
  font-weight: 700;
  text-decoration: none;
  transition: background 160ms var(--ease-out), transform 160ms var(--ease-out);
}

.app-sidebar__cta .icon {
  width: 1.1rem;
  height: 1.1rem;
}

.app-sidebar__cta:active {
  transform: scale(0.97);
}

@media (hover: hover) and (pointer: fine) {
  .app-sidebar__cta:hover {
    background: #7f2447;
    color: #fff;
  }
}

.app-nav__module {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.app-nav__link--module {
  min-height: 2.75rem;
}

.app-nav__sublist {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 2px 0 var(--space-2) calc(var(--space-3) + 0.6rem);
  padding: 0 0 0 var(--space-3);
  border-inline-start: 1px solid var(--color-border);
  list-style: none;
}

.app-nav__sublink {
  display: flex;
  min-height: 2.25rem;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-md);
  color: var(--color-muted);
  font-size: var(--text-sm);
  font-weight: 600;
  text-decoration: none;
  transition: background 160ms var(--ease-out), color 160ms var(--ease-out);
}

.app-nav__sublink.is-active {
  background: var(--color-pink-soft);
  color: var(--color-pink-ink);
}

@media (hover: hover) and (pointer: fine) {
  .app-nav__sublink:hover {
    background: var(--color-cream-deep);
    color: var(--color-green-dark);
  }
}

@media (pointer: coarse) {
  .app-nav__sublink {
    min-height: 2.75rem;
  }
}
