/* =====================================================================
   Layout: menu lateral, barra do celular e página
   ===================================================================== */

/* ---------- Menu lateral ---------- */
.sidebar {
  position: fixed; top: 0; bottom: 0; left: 0; z-index: var(--z-sidebar);
  display: flex; flex-direction: column;
  width: var(--sidebar-w);
  padding: 20px 14px 14px;
  background: var(--sidebar);
  border-right: 1px solid var(--divider);
  overflow-y: auto;
}

.brand { display: flex; align-items: center; gap: 12px; padding: 0 6px 22px; text-decoration: none; color: inherit; }
.brand:hover { text-decoration: none; }
.brand__logo {
  display: grid; place-items: center; flex: none;
  width: 36px; height: 36px; border-radius: var(--r-sm);
  background: var(--primary); color: var(--on-primary);
  font-size: 14px; font-weight: 800; letter-spacing: -0.02em;
}
.brand__name { font-size: 15px; font-weight: 800; letter-spacing: -0.01em; line-height: 1.2; }
.brand__sub { font-size: var(--fs-xs); color: var(--text-muted); line-height: 1.3; }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav__section {
  padding: 18px 12px 6px;
  font-size: 11px; font-weight: 700; color: var(--placeholder);
  text-transform: uppercase; letter-spacing: 0.06em;
}
.nav__item {
  display: flex; align-items: center; gap: 12px;
  height: 40px; padding: 0 12px;
  border-radius: var(--r-sm);
  color: var(--text-2);
  font-size: 14px; font-weight: 600;
  text-decoration: none;
  transition: background-color var(--dur) var(--ease), color var(--dur) var(--ease);
}
.nav__item:hover { background: var(--surface-subtle); color: var(--text); text-decoration: none; }
.nav__item[aria-current='page'] { background: var(--primary); color: var(--on-primary); }
.nav__item[aria-current='page'] .count { background: rgba(255, 255, 255, 0.2); color: var(--on-primary); }
.nav__label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.sidebar__footer { margin-top: auto; padding-top: 16px; }
.user-card {
  display: flex; align-items: center; gap: 10px;
  padding: 10px;
  background: var(--surface-subtle);
  border-radius: var(--r-lg);
}
.user-card__name { font-size: 14px; font-weight: 700; line-height: 1.25; }
.user-card__role { font-size: var(--fs-xs); color: var(--text-muted); line-height: 1.3; }
.user-card .menu { bottom: calc(100% + 8px); right: 0; }

/* ---------- Área principal ---------- */
.app-main { margin-left: var(--sidebar-w); min-height: 100vh; }

.page {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: var(--page-pad-y) var(--page-pad-x) 64px;
}
.page--wide { max-width: none; }
.page:focus { outline: none; }

.page-header {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 16px 24px;
  flex-wrap: wrap;
  margin-bottom: 28px;
}
.page-eyebrow { font-size: var(--fs-small); color: var(--text-muted); font-weight: 500; margin-bottom: 4px; }
.page-title { font-size: var(--fs-page-title); font-weight: 800; letter-spacing: -0.02em; line-height: 1.15; }
.page-subtitle { margin-top: 6px; color: var(--text-muted); }
.page-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.section { margin-top: 28px; }
.section-title { font-size: var(--fs-card-title); font-weight: 700; margin-bottom: 14px; }

/* ---------- Barra do celular ---------- */
.mobile-bar {
  display: none;
  position: sticky; top: 0; z-index: 30;
  align-items: center; gap: 12px;
  height: 60px; padding: 0 12px;
  background: var(--sidebar);
  border-bottom: 1px solid var(--divider);
}
.sidebar-backdrop {
  position: fixed; inset: 0; z-index: calc(var(--z-sidebar) - 1);
  background: rgba(5, 5, 7, 0.68);
}

@media (max-width: 960px) {
  .sidebar {
    transform: translateX(-100%);
    visibility: hidden; /* fora da tela não recebe foco */
    transition: transform 220ms var(--ease), visibility 0s linear 220ms;
    box-shadow: var(--shadow-overlay);
    width: min(280px, 86vw);
  }
  .sidebar.is-open { transform: none; visibility: visible; transition: transform 220ms var(--ease); }
  .app-main { margin-left: 0; }
  .mobile-bar { display: flex; }
  .page { padding: 20px 16px 48px; }
  .page-title { font-size: 26px; }
}

/* ---------- Tela de configuração/erro de boot ---------- */
.boot {
  min-height: 100vh; display: grid; place-items: center; padding: 24px;
}

/* ---------- Login ---------- */
.auth {
  min-height: 100vh;
  display: grid; place-items: center;
  padding: 24px 16px;
}
.auth__card { width: min(420px, 100%); }
.auth__brand { display: flex; align-items: center; gap: 12px; margin-bottom: 28px; justify-content: center; }
.auth__title { font-size: 24px; font-weight: 800; letter-spacing: -0.02em; }
.auth__subtitle { color: var(--text-muted); margin-top: 4px; margin-bottom: 22px; }
.auth__alert {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 12px 14px; margin-bottom: 16px;
  border-radius: var(--r-md);
  background: var(--danger-bg); color: var(--danger);
  font-size: var(--fs-small);
}
.auth__alert--ok { background: var(--success-bg); color: var(--success); }
.auth__links { display: flex; justify-content: center; margin-top: 16px; }
.link-btn {
  border: 0; background: none; padding: 6px 8px; border-radius: var(--r-xs);
  color: var(--accent); font-weight: 600; font-size: var(--fs-small);
}
.link-btn:hover { text-decoration: underline; }
