/* Navegação adaptável. Celular: barra fixa embaixo. Tablet e notebook: menu lateral escuro. */
.nav {
  position: fixed;
  inset: auto 0 0 0;
  z-index: 10;
  background: var(--color-surface);
  border-top: var(--border-width) solid var(--color-border-soft);
  box-shadow: var(--shadow-bottom-nav);
  padding-bottom: env(safe-area-inset-bottom);
}

.nav__brand, .nav__footer { display: none; }

.nav__list { display: flex; margin: 0; padding: 0; list-style: none; }
.nav__item { flex: 1; min-width: 0; }
.nav__item--wide-only { display: none; }

.nav__link {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.125rem;
  min-height: var(--bottom-nav-height);
  color: var(--color-text-muted);
  font-size: var(--font-size-small);
  font-weight: var(--font-weight-medium);
  text-decoration: none;
}

/* Ícone em "pílula", como nos apps nativos do celular */
.nav__icon-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 3.5rem;
  height: 2rem;
  border-radius: 999px;
  transition: background-color 0.15s;
}

.nav__icon { width: 1.5rem; height: 1.5rem; }

.nav__link[aria-current="page"] { color: var(--color-text); font-weight: var(--font-weight-bold); }
.nav__link[aria-current="page"] .nav__icon-wrap { background: var(--color-accent-soft); color: var(--color-accent-text); }

@media (min-width: 640px) {
  .nav {
    position: sticky;
    top: 0;
    display: flex;
    flex-direction: column;
    height: 100dvh;
    padding: var(--space-5) var(--space-3);
    border-top: 0;
    box-shadow: none;
    background: var(--color-sidebar);
    color: var(--color-sidebar-text);
  }

  .nav__brand {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: 0 var(--space-2) var(--space-5);
    margin-bottom: var(--space-4);
    border-bottom: var(--border-width) solid var(--color-sidebar-line);
  }

  .nav__logo { width: 2.5rem; height: 2.5rem; flex-shrink: 0; }
  .nav__brand-text { display: grid; min-width: 0; line-height: 1.3; }
  .nav__product { font-weight: 700; font-size: var(--font-size-large); }

  .nav__account {
    overflow: hidden;
    color: var(--color-sidebar-text);
    opacity: 0.85;
    font-size: var(--font-size-small);
    white-space: nowrap;
    text-overflow: ellipsis;
  }

  .nav__list { flex-direction: column; gap: var(--space-1); }
  .nav__item--wide-only { display: block; }

  .nav__link {
    position: relative;
    flex-direction: row;
    justify-content: flex-start;
    gap: var(--space-3);
    min-height: var(--touch-target);
    padding: 0 var(--space-3);
    border-radius: var(--radius);
    color: var(--color-sidebar-text);
    font-size: var(--font-size-base);
  }

  .nav__icon-wrap { width: auto; height: auto; background: none; }
  .nav__link:hover { background: var(--color-sidebar-hover); color: var(--color-on-primary); }

  .nav__link[aria-current="page"] { background: var(--color-sidebar-active); color: var(--color-on-primary); }
  .nav__link[aria-current="page"] .nav__icon-wrap { background: none; color: var(--color-accent); }

  /* Marca dourada na tela atual */
  .nav__link[aria-current="page"]::before {
    content: "";
    position: absolute;
    left: 0;
    top: 25%;
    bottom: 25%;
    width: 3px;
    border-radius: 3px;
    background: var(--color-accent);
  }

  .nav__footer {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    margin-top: auto;
    padding: var(--space-4) var(--space-2) 0;
    border-top: var(--border-width) solid var(--color-sidebar-line);
    color: var(--color-sidebar-text);
    text-decoration: none;
  }

  .nav__footer:hover { color: var(--color-on-primary); }
  .nav__user { display: grid; min-width: 0; line-height: 1.3; }
  .nav__user-name { font-weight: var(--font-weight-bold); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
  .nav__user-role { opacity: 0.85; }
}
