/* Reset, tipografia e estrutura geral (menu lateral + conteúdo) */
*, *::before, *::after { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  line-height: var(--lh);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary-text); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { margin: 0; line-height: 1.25; font-weight: var(--fw-semibold); }
h1 { font-size: var(--fs-xl); }
h2 { font-size: var(--fs-lg); }
h3 { font-size: var(--fs-base); }
p { margin: 0 0 var(--sp-3); }

code, .mono { font-family: var(--font-mono); font-size: 0.9em; }

:focus-visible { outline: none; box-shadow: var(--focus-ring); border-radius: var(--radius-sm); }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

[hidden] { display: none !important; }

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

.sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  background: var(--bg-elevated);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 40;
}

.sidebar__brand {
  display: flex; align-items: center; gap: var(--sp-3);
  height: var(--header-height);
  padding: 0 var(--sp-5);
  border-bottom: 1px solid var(--border);
  color: var(--text);
  font-weight: var(--fw-semibold);
}
.sidebar__brand:hover { text-decoration: none; }
.sidebar__brand img { width: 28px; height: 28px; }
.sidebar__brand small { display: block; color: var(--text-muted); font-weight: 400; font-size: var(--fs-xs); }

.sidebar__nav { flex: 1; padding: var(--sp-4) var(--sp-3); overflow-y: auto; }
.sidebar__section {
  color: var(--text-faint); font-size: var(--fs-xs); text-transform: uppercase;
  letter-spacing: 0.06em; padding: var(--sp-4) var(--sp-3) var(--sp-2);
}

.nav-link {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-2) var(--sp-3);
  margin-bottom: 2px;
  border-radius: var(--radius);
  color: var(--text-muted);
  font-size: var(--fs-base);
  width: 100%;
  background: none; border: 0; cursor: pointer; text-align: left; font-family: inherit;
  transition: background var(--transition), color var(--transition);
}
.nav-link svg { width: 18px; height: 18px; flex-shrink: 0; }
.nav-link:hover { background: var(--surface); color: var(--text); text-decoration: none; }
.nav-link.is-active { background: var(--primary-soft); color: var(--primary-text); }

.sidebar__footer { padding: var(--sp-3); border-top: 1px solid var(--border); }

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

.topbar {
  height: var(--header-height);
  display: flex; align-items: center; gap: var(--sp-4);
  padding: 0 var(--sp-6);
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  position: sticky; top: 0; z-index: 30;
}
.topbar__title { font-size: var(--fs-lg); font-weight: var(--fw-semibold); flex: 1; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar__user { display: flex; align-items: center; gap: var(--sp-3); color: var(--text-muted); font-size: var(--fs-sm); }
.avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--primary-soft); color: var(--primary-text);
  display: grid; place-items: center; font-weight: var(--fw-semibold); font-size: var(--fs-sm);
}
.menu-toggle { display: none; }

.content { padding: var(--sp-6); max-width: 1400px; width: 100%; }

.sidebar-backdrop { display: none; }

/* ------------------------------------------------------------ responsivo */
@media (max-width: 900px) {
  .sidebar {
    position: fixed; left: 0; top: 0;
    transform: translateX(-100%);
    transition: transform 160ms ease;
  }
  .sidebar.is-open { transform: translateX(0); box-shadow: var(--shadow-lg); }
  .sidebar-backdrop.is-open {
    display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, 0.5); z-index: 35;
  }
  .menu-toggle { display: inline-flex; }
  .topbar { padding: 0 var(--sp-4); }
  .content { padding: var(--sp-4); }
  .topbar__user .topbar__name { display: none; }
}
