/* ZARIS Shell — layout y navegación lateral
 * Tokens exclusivamente de design-system/colors_and_type.css
 * ------------------------------------------------------- */

*, *::before, *::after { box-sizing: border-box; }

/* El body trae margin 8px default del navegador: el grid de 100vh quedaba
   corrido y la statusbar caía bajo el borde visible (había que scrollear
   para verla). El shell NUNCA scrollea — scrollean los módulos dentro del
   iframe. (Fix 2026-06-12, pedido del usuario.) */
html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
}

/* ── Raíz de la app ─────────────────────────────────────── */
.app {
  display: grid;
  grid-template-columns: 232px 1fr;
  grid-template-rows: 52px 1fr 30px;
  height: 100vh;
  overflow: hidden;
}

/* ── Topbar ─────────────────────────────────────────────── */
.topbar {
  grid-column: 1 / -1;
  grid-row: 1;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  background: rgba(242,241,237,.88);
  backdrop-filter: blur(12px) saturate(1.2);
  -webkit-backdrop-filter: blur(12px) saturate(1.2);
  border-bottom: 1px solid var(--border-primary);
  position: sticky;
  top: 0;
  z-index: 100;
}

.topbar__left {
  display: flex;
  align-items: center;
  gap: 28px;
  min-width: 0;
  flex-wrap: nowrap;
  flex-shrink: 1;
  overflow: hidden;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--fg-1);
}

.brand__mark {
  width: 26px;
  height: 26px;
  flex-shrink: 0;
  color: var(--fg-1);
}

.brand__name {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 500;
  letter-spacing: -0.8px;
  color: var(--fg-1);
  transition: color 150ms ease;
}

.brand__app {
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--fg-3);
  padding-left: 8px;
  border-left: 1px solid var(--border-primary);
  white-space: nowrap;
}

.brand:hover .brand__name { color: var(--color-error); }

.topbar__sep {
  width: 1px;
  height: 28px;
  background: var(--border-medium);
  flex-shrink: 0;
}

.muni {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

/* Selector «Operando en» del super administrador (IT-01 F3). Siempre visible para él:
   que no haya duda de en qué municipio está operando. */
.muni-selector {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: 12px;
}
.muni-selector[hidden] { display: none; }
.muni-selector__label {
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--zaris-orange);
  white-space: nowrap;
}
.muni-selector__select {
  font-family: var(--font-display);
  font-size: 12px;
  color: var(--fg-1);
  background: var(--surface-100);
  border: 1px solid var(--zaris-orange);
  border-radius: var(--radius-md);
  padding: 3px 6px;
  max-width: 220px;
}

.muni__logo {
  width: 24px;
  height: 24px;
  object-fit: contain;
  flex-shrink: 0;
  border-radius: 4px;
}

.muni__nombre {
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--fg-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (max-width: 900px) {
  .brand__app, .muni__nombre { display: none; }
}

.topbar__right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar__context {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  font-family: var(--font-display);
  font-size: 13px;
  line-height: 1.25;
  color: var(--fg-3);
}

.topbar__context strong {
  color: var(--fg-2);
  font-weight: 500;
}

/* Cargo del agente vinculado, debajo de "Nombre · Rol" (pedido 2026-06-12).
   Solo se renderiza si el usuario tiene cargo (menu.js). */
.topbar__context-cargo {
  font-size: 10.5px;
  color: var(--fg-3);
  white-space: nowrap;
}

/* Campana de notificaciones - funcional desde 2026-05-18.
   Logica en menu.js (polling 30s + dropdown click). */
.notif-menu {
  position: relative;
  flex-shrink: 0;
}

.topbar__bell {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: none;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  color: var(--fg-2);
  transition: background 150ms ease, color 150ms ease;
}

.topbar__bell:hover {
  background: rgba(38,37,30,.07);
  color: var(--fg-1);
}

.topbar__bell-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  min-width: 14px;
  height: 14px;
  padding: 0 3px;
  background: var(--color-error);
  color: #fff;
  font-size: 9px;
  font-family: var(--font-mono);
  border-radius: 99px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  pointer-events: none;
}

/* El atributo HTML `hidden` debe ganar sobre el display:flex de arriba.
   Sin esto, el badge se ve aunque el contador sea 0 (display:flex pisa hidden). */
.topbar__bell-badge[hidden] {
  display: none;
}

/* ── Botón "Alta vecino" del topbar (IT-05) ── */
.topbar__altavecino {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px 0 10px;
  background: none;
  border: 1px solid var(--border-medium);
  border-radius: 99px;
  cursor: pointer;
  color: var(--fg-2);
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 500;
  transition: background 150ms ease, color 150ms ease, border-color 150ms ease;
}
.topbar__altavecino:hover {
  background: rgba(245,78,0,.08);
  border-color: var(--zaris-orange);
  color: var(--zaris-orange);
}
.topbar__altavecino[hidden] { display: none; }
/* En pantallas angostas, dejar solo el ícono. */
@media (max-width: 720px) {
  .topbar__altavecino-label { display: none; }
  .topbar__altavecino { padding: 0; width: 32px; justify-content: center; }
}
:root[data-theme="dark"] .topbar__altavecino:hover {
  background: rgba(245,78,0,.14);
}

/* ── Modal compartir alta de vecino (IT-05) ── */
.altavecino-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(38,37,30,.45);
  backdrop-filter: blur(2px);
}
.altavecino-overlay[hidden] { display: none; }
.altavecino-modal {
  width: min(92vw, 380px);
  background: var(--surface-100);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-lg);
  box-shadow: 0 12px 40px rgba(0,0,0,.22);
  overflow: hidden;
}
.altavecino-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-primary);
}
.altavecino-modal__title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.98rem;
  color: var(--fg-1);
}
.altavecino-modal__close {
  background: none; border: none; cursor: pointer;
  font-size: 1.4rem; line-height: 1; color: var(--fg-3);
  padding: 0 4px;
}
.altavecino-modal__close:hover { color: var(--fg-1); }
.altavecino-modal__body {
  padding: 18px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.altavecino-modal__desc {
  margin: 0;
  font-size: 0.82rem;
  color: var(--fg-3);
  line-height: 1.45;
  text-align: center;
}
.altavecino-modal__qr {
  padding: 8px;
  background: #fff;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-primary);
}
.altavecino-modal__qr canvas { display: block; }
.altavecino-modal__url {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--fg-2);
  word-break: break-all;
  text-align: center;
  max-width: 100%;
}
.altavecino-modal__actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 4px;
}
/* Botones locales (el shell vanilla no carga components.css del DS — usamos
   tokens del DS con estilos locales, patrón "tokens sí, componentes locales"). */
.altavecino-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 7px 14px;
  border-radius: var(--radius-md);
  font-family: var(--font-display);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  border: 1px solid transparent;
  transition: background 150ms ease, border-color 150ms ease, color 150ms ease;
}
.altavecino-btn--primary {
  background: var(--zaris-orange);
  color: #fff;
}
.altavecino-btn--primary:hover { background: #d94500; }
.altavecino-btn--outline {
  background: transparent;
  border-color: var(--border-medium);
  color: var(--fg-1);
}
.altavecino-btn--outline:hover { border-color: var(--zaris-orange); color: var(--zaris-orange); }
.altavecino-btn--ghost {
  background: transparent;
  color: var(--fg-2);
}
.altavecino-btn--ghost:hover { background: rgba(38,37,30,.07); color: var(--fg-1); }
:root[data-theme="dark"] .altavecino-btn--ghost:hover { background: rgba(237,236,231,.08); }

.notif-menu__dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  width: 360px;
  max-height: 480px;
  overflow: hidden;
  background: var(--surface-100);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 32px rgba(0,0,0,.18);
  z-index: 200;
  display: flex;
  flex-direction: column;
}

/* El atributo HTML `hidden` debe ganar sobre el display:flex de arriba. Sin
   esto el dropdown arranca VISIBLE (el hidden inicial no aplica) y nunca se
   oculta al hacer dd.hidden=true. Mismo bug que el badge (commit 5dfe00c). */
.notif-menu__dropdown[hidden] {
  display: none;
}

.notif-menu__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-primary);
  background: var(--surface-200);
  font-family: var(--font-display);
}

.notif-menu__title {
  font-size: 13px;
  font-weight: 600;
  color: var(--fg-1);
}

/* "Marcar todas como leídas" — botón visible (2026-10-20; antes era un texto
   gris de 11px que casi no se veía). Se deshabilita sin pendientes (menu.js). */
.notif-menu__action {
  background: none;
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-pill);
  padding: 3px 10px;
  cursor: pointer;
  color: var(--fg-1);
  font-size: 11.5px;
  font-weight: 500;
  font-family: var(--font-display);
}

.notif-menu__action:hover:not(:disabled) {
  border-color: var(--zaris-orange);
  color: var(--zaris-orange);
}

.notif-menu__action:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.notif-menu__list {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.notif-menu__empty {
  margin: 0;
  padding: 24px 16px;
  color: var(--fg-3);
  font-family: var(--font-display);
  font-size: 12px;
  text-align: center;
}

/* Fila = item clickeable (navega) + botón ✓ (marca leída sin navegar). Dos
   botones hermanos: un <button> no puede contener otro. */
.notif-menu__row {
  display: flex;
  align-items: stretch;
  border-bottom: 1px solid var(--border-primary);
}

.notif-menu__row--unread {
  background: rgba(245,78,0,.04);
}

.notif-menu__item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  flex: 1;
  min-width: 0;
  padding: 10px 14px;
  border: 0;
  background: transparent;
  cursor: pointer;
  text-align: left;
  font-family: var(--font-display);
}

.notif-menu__item:hover {
  background: rgba(38,37,30,.04);
}

.notif-menu__mark {
  flex-shrink: 0;
  width: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-left: 1px solid var(--border-primary);
  background: transparent;
  color: var(--fg-3);
  cursor: pointer;
}

.notif-menu__mark:hover:not(:disabled) {
  color: var(--zaris-orange);
  background: rgba(38,37,30,.04);
}

.notif-menu__mark:disabled {
  opacity: 0.4;
  cursor: progress;
}

.notif-menu__mark--error {
  color: var(--color-error);
}

.notif-menu__item-body {
  flex: 1;
  min-width: 0;
}

.notif-menu__item-title {
  margin: 0;
  font-size: 13px;
  font-weight: 500;
  color: var(--fg-1);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.notif-menu__item-msg {
  margin: 2px 0 0;
  font-size: 11px;
  color: var(--fg-2);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.notif-menu__item-date {
  margin: 4px 0 0;
  font-size: 10px;
  color: var(--fg-3);
}

.notif-menu__dot {
  width: 8px;
  height: 8px;
  border-radius: 99px;
  background: var(--zaris-orange);
  flex-shrink: 0;
  margin-top: 6px;
}

.topbar__avatar {
  width: 28px;
  height: 28px;
  border-radius: 9999px;
  background: #dfa88f;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 500;
  /* Fijo (no var(--fg-1)): el fondo durazno es igual en ambos temas y el
     texto claro del dark mode no contrasta sobre él. */
  color: #26251e;
  flex-shrink: 0;
  text-transform: uppercase;
  overflow: hidden;
}

/* Foto de perfil del usuario (usuarios.foto_url, mig 88). El <img> llena el
   círculo; si no hay foto, el avatar muestra las iniciales como siempre. */
.topbar__avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* ── User menu dropdown ─────────────────────────────────── */
.user-menu {
  position: relative;
}

.user-menu__trigger {
  display: flex;
  align-items: center;
  gap: 10px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 8px;
  transition: background 150ms ease;
}

.user-menu__trigger:hover { background: rgba(38,37,30,.07); }

.user-menu__dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  min-width: 240px;
  background: var(--surface-100);
  border: 1px solid var(--border-medium);
  border-radius: 10px;
  box-shadow: 0 4px 20px rgba(0,0,0,.16);
  z-index: 200;
  overflow: hidden;
}

.user-menu__info {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 14px 12px;
  font-family: var(--font-display);
  cursor: pointer;                 /* lleva a «Mi perfil» (menu.js) */
  transition: background 150ms ease;
}
.user-menu__info:hover { background: rgba(38,37,30,.05); }

/* Avatar grande del panel (foto o iniciales) */
.user-menu__info-avatar {
  width: 44px;
  height: 44px;
  border-radius: 9999px;
  background: #dfa88f;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 500;
  color: #26251e;
  text-transform: uppercase;
  flex-shrink: 0;
  overflow: hidden;
}

.user-menu__info-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.user-menu__info-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--fg-1);
  margin-bottom: 2px;
}

.user-menu__info-role {
  font-size: 11.5px;
  color: var(--fg-3);
}

.user-menu__info-cargo {
  font-size: 11px;
  color: var(--fg-3);
  margin-top: 1px;
}

/* Secretaría · gestión · equipos del agente (2026-10-20), en letra chica. */
.user-menu__info-org {
  font-size: 10.5px;
  line-height: 1.35;
  color: var(--fg-3);
}
.user-menu__info-cargo + .user-menu__info-org,
.user-menu__info-role + .user-menu__info-org { margin-top: 3px; }

.user-menu__divider {
  height: 1px;
  background: var(--border-primary);
  margin: 0;
}

.user-menu__item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 10px 14px;
  background: none;
  border: none;
  font-family: var(--font-display);
  font-size: 13px;
  color: var(--fg-2);
  cursor: pointer;
  text-align: left;
  transition: background 150ms ease, color 150ms ease;
}

.user-menu__item:hover { background: rgba(38,37,30,.05); color: var(--fg-1); }

.user-menu__item--danger { color: var(--color-error); }
.user-menu__item--danger:hover { background: rgba(207,45,86,.07); color: var(--color-error); }

.user-menu__item svg { flex-shrink: 0; }

/* Switch del modo oscuro (item "Modo oscuro" del dropdown). El estado vive
   en localStorage `zaris_theme`; menu.js togglea la clase .on. */
.user-menu__switch {
  margin-left: auto;
  width: 30px;
  height: 16px;
  border-radius: 99px;
  background: var(--border-medium);
  position: relative;
  flex-shrink: 0;
  transition: background 150ms ease;
}

.user-menu__switch::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--surface-100);
  transition: transform 150ms ease;
}

.user-menu__switch.on { background: var(--zaris-orange); }
.user-menu__switch.on::after { transform: translateX(14px); background: #fff; }

/* ── Sidebar ────────────────────────────────────────────── */
.sidebar {
  grid-column: 1;
  grid-row: 2;
  background: var(--surface-300);
  border-right: 1px solid var(--border-primary);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  padding: 16px 12px 0;
}

/* .sidebar__foot eliminado: la versión vive ahora en la statusbar inferior. */

/* ── Statusbar inferior — espejo de la topbar al pie ──────── */
.statusbar {
  grid-column: 1 / -1;
  grid-row: 3;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 20px;
  background: rgba(242,241,237,.88);
  backdrop-filter: blur(12px) saturate(1.2);
  -webkit-backdrop-filter: blur(12px) saturate(1.2);
  border-top: 1px solid var(--border-primary);
  font-size: 11px;
  color: var(--fg-3);
  user-select: none;
}

.statusbar__left,
.statusbar__right {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.statusbar__center {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  min-width: 0;
}

.statusbar__clock {
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 500;
  color: var(--fg-2);
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.statusbar__api {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.statusbar__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--fg-3);          /* gris: verificando */
  flex-shrink: 0;
}

.statusbar__api.ok .statusbar__dot  { background: var(--color-success); }
.statusbar__api.err .statusbar__dot { background: var(--color-error); }
.statusbar__api.err                 { color: var(--color-error); }

.statusbar__version {
  font-family: var(--font-mono);
  font-size: 10.5px;
  white-space: nowrap;
}

@media (max-width: 700px) {
  .statusbar__version { display: none; }
}

/* ── Nav — nivel 1 ──────────────────────────────────────── */
.nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}

.nav__group { display: flex; flex-direction: column; }

.nav__title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 10px;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: var(--fg-2);
  font-family: var(--font-display);
  font-size: 13.5px;
  cursor: pointer;
  text-align: left;
  width: 100%;
  transition: color 150ms ease, background 150ms ease;
}

.nav__title:hover { color: var(--fg-1); background: rgba(38,37,30,.06); }
.nav__title--stub { opacity: .7; }
.nav__title--stub:hover { opacity: 1; }

/* caret */
.nav__caret {
  width: 10px;
  height: 10px;
  flex-shrink: 0;
  transition: transform 200ms ease;
}

.nav__group[data-open="true"] > .nav__title > .nav__caret,
.nav__group[data-open="true"] > .nav__sub  > .nav__caret {
  transform: rotate(90deg);
}

.nav__item[data-open="true"] > .nav__item-toggle > .nav__caret {
  transform: rotate(90deg);
}

/* paneles acordeón */
.nav__panel,
.nav__subpanel,
.nav__item-actions {
  display: none;
  flex-direction: column;
  padding-left: 10px;
}

.nav__group[data-open="true"] > .nav__panel,
.nav__group[data-open="true"] > .nav__subpanel,
.nav__item[data-open="true"]  > .nav__item-actions {
  display: flex;
}

/* ── Nav — nivel 2 ──────────────────────────────────────── */
.nav__sub {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 5px 10px;
  border-radius: 5px;
  border: none;
  background: transparent;
  color: var(--fg-3);
  font-family: var(--font-system);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: .05em;
  text-transform: uppercase;
  cursor: pointer;
  text-align: left;
  width: 100%;
  transition: color 150ms ease;
  margin-top: 8px;
}

.nav__sub:hover { color: var(--fg-1); }

/* ── Nav — nivel 3 ──────────────────────────────────────── */
.nav__item { display: flex; flex-direction: column; }

.nav__item-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 5px 10px;
  border-radius: 5px;
  border: none;
  background: transparent;
  color: var(--fg-2);
  font-family: var(--font-display);
  font-size: 13px;
  cursor: pointer;
  text-align: left;
  width: 100%;
  transition: color 150ms ease, background 150ms ease;
}

.nav__item-toggle:hover { color: var(--fg-1); background: rgba(38,37,30,.05); }

.nav__leaf { padding: 4px 10px; }

.nav__leaf-label {
  font-family: var(--font-display);
  font-size: 12.5px;
  color: var(--fg-3);
}

/* ── Nav link directo (Maestros) ─────────────────────────── */
.nav__link {
  display: block;
  padding: 5px 10px;
  border-radius: 5px;
  font-family: var(--font-display);
  font-size: 13px;
  color: var(--fg-2);
  text-decoration: none;
  transition: color 150ms ease, background 150ms ease;
  cursor: pointer;
}
.nav__link:hover { color: var(--fg-1); background: rgba(38,37,30,.05); }
.nav__link.active { color: var(--zaris-orange); font-weight: 600; }
.nav__link--stub { opacity: .45; cursor: default; pointer-events: none; }

/* ── Botones de acción ───────────────────────────────────── */
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 4px 10px 8px;
}

.action {
  font-family: var(--font-display);
  font-size: 12px;
  padding: 3px 9px;
  border-radius: 9999px;
  border: none;
  background: var(--surface-400);
  color: var(--fg-2);
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  transition: color 150ms ease, background 150ms ease;
}

.action:hover { background: var(--surface-500); color: var(--fg-1); }

.action[data-stub] { opacity: .6; cursor: default; }
.action[data-stub]:hover { background: var(--surface-400); color: var(--fg-2); }

/* ── Canvas (área principal) ────────────────────────────── */
.canvas {
  grid-column: 2;
  grid-row: 2;
  overflow: hidden;
  background: var(--zaris-cream);
}

#module-frame {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}

/* ── Nav plano (clon del shell React) ───────────────────── */
/* Diseño: 1 item por módulo con icono + label, sin acordeones.
   Ver web-app/src/shell/Sidebar/Sidebar.module.css para la referencia. */
.nav-flat {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  padding: 0 4px;
}

.nav-flat__item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-lg, 10px);
  font-family: var(--font-display);
  font-size: 13.5px;
  color: var(--fg-2);
  text-decoration: none;
  background: transparent;
  transition: color 150ms ease, background 150ms ease;
  white-space: nowrap;
  cursor: pointer;
}

.nav-flat__item:hover {
  background: var(--surface-400);
  color: var(--fg-1);
}

.nav-flat__item.active {
  background: var(--surface-400);
  color: var(--fg-1);
  box-shadow: inset 3px 0 0 var(--zaris-orange);
}

.nav-flat__icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  color: currentColor;
}

/* Encabezado de sección del sidebar (Atención / Supervisión / Común / Admin).
   Agrupa los ítems por rol según el nivel de acceso (CLAUDE.md §30). No es
   clickeable: solo rotula el bloque que sigue. El primero no lleva margen
   superior para no separarse del borde del sidebar. */
.nav-flat__section {
  font-family: var(--font-display);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-3);
  padding: 6px 12px 4px;
  margin-top: 10px;
  user-select: none;
}
.nav-flat__section:first-child {
  margin-top: 2px;
}
/* Si todos los ítems del bloque quedaron ocultos por permisos, el JS de
   menu.js marca la sección con [hidden] para no dejar un título huérfano. */
/* menu.js oculta con [hidden] los ítems que el usuario no tiene permitidos (§30); sin esta
   regla el `display: flex` de .nav-flat__item pisaba el hidden y se veían todos (cazado
   2026-10-25 en IT-01 F3: un nivel 4 veía ocho módulos ajenos). */
.nav-flat__item[hidden] {
  display: none;
}

.nav-flat__section[hidden] {
  display: none;
}

/* ── Dark mode — overrides de los rgba claros hardcodeados ──
   Los tokens del DS ya se invierten via [data-theme="dark"] en
   colors_and_type.css; acá solo van los valores literales del shell
   (fondos translúcidos del topbar/statusbar y hovers). */
:root[data-theme="dark"] .topbar,
:root[data-theme="dark"] .statusbar {
  background: rgba(29,28,25,.88);
}

:root[data-theme="dark"] .topbar__bell:hover,
:root[data-theme="dark"] .user-menu__trigger:hover {
  background: rgba(237,236,231,.08);
}

:root[data-theme="dark"] .user-menu__item:hover,
:root[data-theme="dark"] .user-menu__info:hover {
  background: rgba(237,236,231,.06);
}

:root[data-theme="dark"] .notif-menu__item:hover,
:root[data-theme="dark"] .notif-menu__mark:hover:not(:disabled) {
  background: rgba(237,236,231,.05);
}

:root[data-theme="dark"] .notif-menu__row--unread {
  background: rgba(245,78,0,.10);
}

/* ── Print ──────────────────────────────────────────────── */
@media print {
  .topbar, .sidebar, .statusbar { display: none !important; }
  .app { display: block; }
  .canvas { padding: 0; overflow: visible; }
}
