/* LEGAL-PIE-3-001 -- copia VERBATIM de shell/src/ui/Wordmark.css + Navbar.css para las páginas legales estáticas (el shell no se publica como fuente).
   No editar a mano: tools/test/legal-topbar-parity.test.js falla si se desincroniza. Regenerar: node tools/gen-legal-topbar-css.cjs */
/* Texturina se carga desde el <link> de Google Fonts de shell.html (SHELL-GOOGLE-FONTS-001).
   Métricas en em para que escale con el font-size que le fije cada contenedor. */
.shell-wordmark {
  display: inline-block;
  color: var(--wordmark-crema);
  font-family: Texturina, "Texturina Fallback", Georgia, "Times New Roman", serif;
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.05em;
  white-space: nowrap;
  text-shadow: 0 1px 10px rgba(0, 0, 0, 0.28);
  /* Corrección óptica: Texturina deja más peso debajo de su caja que la serif del nav. */
  transform: translateY(-0.055em);
}

.shell-wordmark-i {
  color: var(--accent-primary);
}

/* Texturina (wordmark) se carga desde el <link> de Google Fonts de shell.html (SHELL-GOOGLE-FONTS-001), no con @import. */

/* SHELL-NAVBAR-COMPONENT-20260914 -- traslada la geometría Levla del visual lab a Preact.
   Los colores quedan encapsulados porque el shell usa tokens verdes para sus pantallas y esta
   navbar pertenece a la exploración Playground y usa el token verde actual del shell. */
.shell-topnav.shell-navbar {
  --shell-navbar-accent: var(--accent-primary);
  --shell-navbar-accent-rgb: 147, 242, 41;
  --shell-navbar-ink: var(--texto-nav);
  --shell-navbar-muted: var(--texto-nav-gris);
  position: relative;
  z-index: 5;
  display: block;
  height: 96px;
  min-height: 96px;
  padding: 0;
  overflow: visible;
  background: transparent;
  border: 0;
}

.shell-navbar-inner {
  display: flex;
  align-items: center;
  gap: 0;
  width: 100%;
  max-width: 1500px;
  height: 100%;
  margin: 0 auto;
  padding: 24px 48px;
}

.shell-navbar-brand {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  width: 154px;
  margin: 0 auto 0 0;
  color: var(--shell-navbar-ink);
  text-decoration: none;
}

/* Base del logo en ui/Wordmark.css; acá solo el tamaño y las métricas en px de la nav. Dos
   clases para ganarle a la base sin depender del orden en que se inyectan las hojas. */
.shell-navbar-brand .shell-navbar-wordmark {
  font-size: 36px;
  letter-spacing: -1.8px;
  transform: translateY(-2px);
}

.shell-navbar-primary {
  display: flex;
  flex: 1 1 auto;
  align-items: center;
  justify-content: center;
  gap: 44px;
  min-width: 0;
  overflow: visible;
}

.shell-navbar-link {
  position: relative;
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 8px;
  min-height: 27px;
  padding: 0;
  color: color-mix(in srgb, var(--shell-navbar-ink) 88%, transparent);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 18px;
  font-weight: 400;
  line-height: 1.5;
  text-decoration: none;
  text-shadow: 0 1px 10px rgba(0, 0, 0, 0.35);
  white-space: nowrap;
}

.shell-navbar-link svg {
  display: none;
}

.shell-navbar-link::after {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 2px;
  background: var(--shell-navbar-accent);
  border-radius: 999px;
  box-shadow: 0 0 12px rgba(var(--shell-navbar-accent-rgb), 0.42);
  content: "";
  opacity: 0;
  transform: scaleX(0.35);
  transition:
    opacity 0.16s ease,
    transform 0.16s ease;
}

.shell-navbar-link:focus-visible,
.shell-navbar-link.is-active {
  color: var(--shell-navbar-accent);
}

@media (hover: hover) {
  .shell-navbar-link:hover {
    color: var(--shell-navbar-accent);
  }
}

.shell-navbar-link.is-active::after,
.shell-navbar-link:focus-visible::after {
  opacity: 1;
  transform: scaleX(1);
}

.shell-navbar-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 18px;
  margin-left: 32px;
}

.shell-navbar-language {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 3px 0;
  color: color-mix(in srgb, var(--shell-navbar-ink) 88%, transparent);
  font-family: var(--font-family-body);
  font-size: var(--font-size-xs);
  white-space: nowrap;
}

.shell-navbar-language-toggle {
  position: relative;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-width: 42px;
  min-height: 30px;
  padding: 3px 5px;
}

.shell-navbar-caret {
  display: block;
  width: 5px;
  height: 5px;
  margin-top: -3px;
  border-right: 1px solid currentColor;
  border-bottom: 1px solid currentColor;
  opacity: 0.78;
  transform: rotate(45deg);
  transition:
    transform 0.16s ease,
    opacity 0.16s ease;
}

.shell-navbar-language.is-open .shell-navbar-caret,
.shell-navbar-more.is-open .shell-navbar-caret {
  margin-top: 3px;
  opacity: 1;
  transform: rotate(225deg);
}

.shell-navbar-language-toggle:focus-visible,
.shell-navbar-language.is-open .shell-navbar-language-toggle {
  border-color: rgba(243, 245, 247, 0.34);
}

@media (hover: hover) {
  .shell-navbar-language-toggle:hover {
    border-color: rgba(243, 245, 247, 0.34);
  }
}

.shell-navbar-language-menu {
  min-width: 206px;
}

.shell-navbar-language-option {
  align-items: center;
  color: var(--shell-navbar-ink);
  font-family: var(--font-family-body);
  font-size: var(--font-size-xs);
  text-align: left;
}

.shell-navbar-language-option img {
  display: block;
  width: 20px;
  height: 14px;
  border-radius: 2px;
  object-fit: cover;
}

.shell-navbar-language-option span {
  display: block;
}

.shell-navbar-language-option::after {
  display: none;
}

.shell-navbar-language-option:focus-visible {
  border-color: rgba(243, 245, 247, 0.22);
}

@media (hover: hover) {
  .shell-navbar-language-option:hover:not(.active) {
    border-color: rgba(243, 245, 247, 0.22);
  }
}

.shell-navbar-language-option.active {
  border-color: var(--shell-navbar-accent);
  cursor: default;
}

.shell-navbar-login {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 30px;
  padding: 3px 0;
  color: color-mix(in srgb, var(--shell-navbar-ink) 88%, transparent);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 18px;
  font-weight: 400;
  line-height: 1.5;
  cursor: pointer;
  background: transparent;
  border: 0;
  white-space: nowrap;
}

/* SHELL-NAVBAR-MID-WIDTH-20260925 -- "Más" (ver MoreMenu en Navbar.jsx). Oculto por default:
   solo el tramo 821–1023px de abajo lo muestra. El botón reusa .shell-navbar-link para heredar
   tipografía, color y subrayado activo; acá solo se le saca el look de <button>. */
.shell-navbar-more {
  position: relative;
  display: none;
  flex: 0 0 auto;
}

.shell-navbar-more-toggle {
  gap: 7px;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.shell-navbar-more-menu {
  position: absolute;
  top: calc(100% + 16px);
  left: 50%;
  z-index: 12;
  display: grid;
  gap: 2px;
  min-width: 180px;
  padding: 8px;
  background: rgba(4, 7, 11, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 7px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
  transform: translateX(-50%);
}

/* El panel siempre está en el DOM (aria-controls tiene que apuntar a algo): el display:grid de
   arriba le ganaría al [hidden] nativo sin esta regla. */
.shell-navbar-more-menu[hidden] {
  display: none;
}

.shell-navbar-more-menu .shell-navbar-link {
  min-height: 40px;
  padding: 0 12px;
  font-size: 16px;
}

.shell-navbar-more-menu .shell-navbar-link::after {
  right: 12px;
  bottom: 6px;
  left: 12px;
}

.shell-navbar-login-dot {
  width: 6px;
  height: 6px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--shell-navbar-accent);
}
/* Estado de la nube (cloudSyncTone): verde al día, amarillo pausada / sin conexión, rojo error. */
.shell-navbar-login-dot.is-warning {
  background: var(--status-warning);
}
.shell-navbar-login-dot.is-danger {
  background: var(--status-danger);
}

.shell-navbar-menu-trigger {
  display: none;
  width: 42px;
  height: 42px;
  padding: 10px;
  border: 0;
  border-radius: 7px;
  color: var(--shell-navbar-ink);
  background: transparent;
  cursor: pointer;
}

.shell-navbar-menu-trigger span,
.shell-navbar-menu-trigger::before,
.shell-navbar-menu-trigger::after {
  display: block;
  width: 20px;
  height: 2px;
  margin: 4px auto;
  border-radius: 2px;
  background: currentColor;
  content: "";
}

.shell-navbar-mobile-drawer {
  position: absolute;
  top: 76px;
  right: 20px;
  left: 20px;
  z-index: 10;
  display: grid;
  gap: 4px;
  padding: 12px 16px;
  background: rgba(4, 7, 11, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 7px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
}

.shell-navbar-mobile-drawer .shell-navbar-link {
  min-height: 40px;
  padding: 0 8px;
  font-size: 18px;
}

.shell-navbar-debug {
  position: absolute;
  top: 70px;
  right: 48px;
  z-index: 11;
  color: var(--shell-navbar-muted);
  font-family: var(--font-family-body);
  font-size: var(--font-size-xs);
}

.shell-navbar-debug summary {
  cursor: pointer;
  list-style: none;
  white-space: nowrap;
}

.shell-navbar-debug summary::-webkit-details-marker {
  display: none;
}
.shell-navbar-debug summary::after {
  content: " +";
  color: rgba(255, 255, 255, 0.46);
}
.shell-navbar-debug[open] summary::after {
  content: " −";
}

.shell-navbar-debug-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  display: grid;
  min-width: 180px;
  padding: 8px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: 8px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5);
}

.shell-navbar-debug-menu .shell-navbar-link {
  min-height: 34px;
  padding: 0 8px;
  color: var(--shell-navbar-muted);
  font-family: var(--font-family-body);
  font-size: var(--font-size-xs);
}

.shell-navbar-debug-menu .shell-navbar-link::after {
  right: 8px;
  left: 8px;
}

.shell-navbar-link:focus-visible,
.shell-navbar-brand:focus-visible,
.shell-navbar-menu-trigger:focus-visible,
.shell-navbar-more-toggle:focus-visible,
.shell-navbar-debug summary:focus-visible {
  outline: 2px solid var(--shell-navbar-accent);
  outline-offset: 3px;
}

/* SHELL-NAVBAR-MID-WIDTH-20260925 -- tramo intermedio (821–1279px). Antes había un solo
   ajuste hasta 1100px que solo bajaba gap/fuente: a ~900px los 7 links medían más que el hueco
   entre logo y acciones, y como la lista va centrada desbordaba para los dos lados ("Inicio"
   encima del logo, "Inventario" debajo de la bandera); y entre 1101 y ~1230 volvía el gap de
   44px de desktop, con "Inicio" pisando el logo. Ahora son dos escalones:
   - 1024–1279: los 7 links, con gap y fuente más chicos (desde 1280 entra el layout de
     desktop tal cual, con margen de sobra).
   - 821–1023: los links `overflow` pasan a "Más" (ver MoreMenu).
   En los dos, la lista deja un margen fijo contra logo y acciones en vez de depender de que
   el centrado sobre. Debajo de 821 sigue la hamburguesa de siempre. */
@media (max-width: 1279px) and (min-width: 821px) {
  .shell-navbar-inner {
    padding-right: 28px;
    padding-left: 28px;
  }
  .shell-navbar-brand {
    width: auto;
  }
  .shell-navbar-primary {
    gap: 24px;
    margin: 0 20px;
  }
  .shell-navbar-link {
    font-size: 16px;
  }
  .shell-navbar-actions {
    gap: 12px;
    margin-left: 0;
  }
  .shell-navbar-login {
    font-size: 16px;
  }
  .shell-navbar-login span:last-child {
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}

@media (max-width: 1023px) and (min-width: 821px) {
  .shell-navbar-inner {
    padding-right: 24px;
    padding-left: 24px;
  }
  .shell-navbar-brand .shell-navbar-wordmark {
    font-size: 34px;
  }
  .shell-navbar-primary {
    gap: 20px;
    margin: 0 16px;
  }
  .shell-navbar-primary > .shell-navbar-link.is-overflowable {
    display: none;
  }
  .shell-navbar-more {
    display: block;
  }
}

@media (max-width: 820px) {
  .shell-topnav.shell-navbar {
    height: 76px;
    min-height: 76px;
  }

  .shell-navbar-inner {
    padding: 18px 20px;
  }
  .shell-navbar-brand {
    width: 142px;
    margin-right: auto;
  }
  .shell-navbar-brand .shell-navbar-wordmark {
    font-size: 34px;
  }
  .shell-navbar-primary {
    display: none;
  }
  .shell-navbar-actions {
    gap: 4px;
    margin-left: 12px;
  }
  .shell-navbar-language {
    justify-content: center;
    min-width: 34px;
    padding: 5px;
  }
  /* LANG-DROPDOWN-MOBILE-001 -- el menú medía 206px fijos (min-width de escritorio) pero el ítem más
     largo ocupa ~140px: sobraba una franja vacía a la derecha de las 4 opciones. Se ajusta al contenido. */
  .shell-navbar-language-menu {
    min-width: 0;
    width: max-content;
  }
  .shell-navbar-login {
    display: none;
  }
  /* SHELL-MOBILE-QA-001 -- la copia del botón de cuenta que vive DENTRO del drawer sí se ve
     (la de .shell-navbar-actions sigue oculta): sin esto no hay login posible en mobile. */
  .shell-navbar-mobile-drawer .shell-navbar-login-mobile {
    display: inline-flex;
    min-height: 44px;
    margin-top: 8px;
    padding: 8px 8px 0;
    border-top: 1px solid rgba(243, 245, 247, 0.14);
  }
  .shell-navbar-menu-trigger {
    display: block;
  }
  .shell-navbar-debug {
    top: 64px;
    right: 20px;
  }
}

@media (max-width: 380px) {
  .shell-navbar-brand {
    width: 132px;
  }
  .shell-navbar-brand .shell-navbar-wordmark {
    font-size: 32px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .shell-navbar-link::after,
  .shell-navbar-caret {
    transition: none;
  }
}

/* SHELL-LOGOUT-001 -- menú de la cuenta (Ver perfil / Cerrar sesión) y su confirmación. Mismo
   panel que "Más", alineado a la derecha para no salirse de la pantalla. */
.shell-navbar-account {
  position: relative;
  display: inline-flex;
}
/* Abierto: mismo giro que idioma y "Más" (el caret es un borde a 45°; rotarlo 180° a secas lo
   dejaba como una esquina, "⌐"). */
.shell-navbar-account.is-open .shell-navbar-caret {
  margin-top: 3px;
  opacity: 1;
  transform: rotate(225deg);
}
.shell-navbar-account-menu {
  position: absolute;
  top: calc(100% + 12px);
  right: 0;
  z-index: 12;
  display: grid;
  gap: 2px;
  min-width: 190px;
  padding: 8px;
  background: rgba(4, 7, 11, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 7px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
}
.shell-navbar-account-menu[hidden] {
  display: none;
}
.shell-navbar-account-item {
  min-height: 40px;
  padding: 0 12px;
  color: color-mix(in srgb, var(--shell-navbar-ink) 88%, transparent);
  font-family: var(--font-family-body);
  font-size: 15px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  background: transparent;
  border: 0;
  border-radius: 5px;
}
.shell-navbar-account-item:focus-visible {
  background: rgba(255, 255, 255, 0.08);
}
@media (hover: hover) {
  .shell-navbar-account-item:hover {
    background: rgba(255, 255, 255, 0.08);
  }
}
.shell-navbar-account-item.is-signout {
  color: var(--status-danger);
}
/* Primera línea del menú de cuenta: cómo está la nube (no es un botón). */
.shell-navbar-account-cloud {
  margin: 0 0 4px;
  padding: 8px 12px;
  color: var(--ui-text-muted);
  font-family: var(--font-family-body);
  font-size: var(--font-size-base);
  border-bottom: 1px solid var(--border-default);
}
.shell-navbar-account-cloud.is-warning {
  color: var(--status-warning);
}
.shell-navbar-account-cloud.is-danger {
  color: var(--status-danger);
}
.shell-cloud-sync-status .ui-badge-leading {
  margin-right: 4px;
  vertical-align: -2px;
}
.shell-cloud-sync-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.shell-navbar-account-mobile {
  display: none;
}
.shell-logout-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
}
.shell-logout-actions button {
  min-height: 40px;
  padding: 8px 14px;
  color: var(--ui-text-primary);
  font-weight: 600;
  cursor: pointer;
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md, 8px);
}
.shell-logout-actions .shell-logout-confirm {
  color: var(--color-white);
  background: var(--status-danger);
  border-color: transparent;
}
.shell-logout-actions button:disabled {
  opacity: 0.6;
  cursor: progress;
}
@media (max-width: 820px) {
  .shell-navbar-account {
    display: none;
  }
  .shell-navbar-mobile-drawer .shell-navbar-account-mobile {
    display: grid;
    gap: 2px;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid rgba(243, 245, 247, 0.14);
  }
  .shell-navbar-mobile-drawer .shell-navbar-account-mobile .shell-navbar-login-mobile {
    margin-top: 0;
    padding-top: 0;
    border-top: 0;
  }
}

/* MOBILE-BOTTOM-NAV-001 -- menos aire entre la barra de arriba y el contenido en mobile. La barra de arriba pasa de 76 a
   52 px (logo + idioma; el menú vive ahora en la barra de abajo) y el contenido arranca 8 px más cerca. Escritorio y 761-820 px
   no cambian. */
@media (max-width: 760px) {
  .shell-topnav.shell-navbar {
    height: 52px;
    min-height: 52px;
  }
  .shell-navbar-inner {
    padding: 8px 16px;
  }
  .shell-navbar-brand {
    width: 118px;
    min-height: var(--control-height-lg);
  }
  /* A11Y-BASE-001: 44 para tocar; el margen deja la bandera donde estaba. */
  .shell-navbar-language-toggle {
    min-width: var(--control-height-lg);
    min-height: var(--control-height-lg);
    margin-block: -7px;
  }
  .shell-navbar-brand .shell-navbar-wordmark {
    font-size: 28px;
  }
}
