/* ===================================================================
   ReadTrack — Layout
   =================================================================== */

.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  min-height: 100vh;
}

/* ---- Sidebar ---- */
.sidebar {
  background: var(--wine-950);
  color: var(--paper-100);
  padding: var(--sp-6) var(--sp-4);
  display: flex;
  flex-direction: column;
  gap: var(--sp-8);
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: 0 var(--sp-2);
}

.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-md);
  background: linear-gradient(155deg, var(--wine-500), var(--wine-800));
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.brand-mark svg { width: 18px; height: 18px; }

.brand-name {
  font-family: var(--font-display);
  font-size: var(--fs-md);
  font-weight: 600;
  color: var(--paper-50);
  letter-spacing: 0.01em;
}

.nav-group {
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
}

.nav-label {
  font-size: var(--fs-2xs);
  color: var(--wine-300);
  padding: 0 var(--sp-3);
  margin-bottom: var(--sp-2);
  letter-spacing: 0.04em;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-3);
  border-radius: var(--radius-md);
  color: var(--wine-150);
  font-size: var(--fs-sm);
  font-weight: 500;
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}

.nav-item svg {
  width: 17px; height: 17px;
  opacity: 0.8;
  flex-shrink: 0;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--white);
}

.nav-item.is-active {
  background: var(--wine-800);
  color: var(--white);
}

.nav-item.is-active svg { opacity: 1; }

.sidebar-footer {
  margin-top: auto;
  padding: var(--sp-3);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  font-size: var(--fs-2xs);
  color: var(--wine-300);
}

/* ---- Conteúdo principal ---- */
.main {
  min-width: 0;
  padding: var(--sp-7) var(--sp-8) var(--sp-10);
}

.main-inner {
  max-width: var(--content-max-width);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: var(--sp-7);
}

.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--sp-4);
  flex-wrap: wrap;
}

.page-header h1 {
  font-size: var(--fs-2xl);
}

.page-subtitle {
  margin-top: var(--sp-1);
  color: var(--color-text-muted);
  font-size: var(--fs-sm);
}

.page-header-actions {
  display: flex;
  gap: var(--sp-3);
}

/* ---- Grids reutilizáveis ---- */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--sp-4);
}

.two-col {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: var(--sp-6);
  align-items: start;
}

.book-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: var(--sp-5);
}

@media (max-width: 1000px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    position: relative;
    height: auto;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
  .nav-group.is-primary { flex-direction: row; }
  .sidebar { flex-wrap: wrap; gap: var(--sp-4); }
  .sidebar-footer { width: 100%; margin-top: 0; }
  .main { padding: var(--sp-5); }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .two-col { grid-template-columns: 1fr; }
}
