/* ============================================================
   Layout — Grid principal (sidebar + header + main)
   ============================================================ */
.app {
  display: grid;
  grid-template-columns: 240px 1fr;
  grid-template-rows: 64px 1fr;
  grid-template-areas:
    "sidebar header"
    "sidebar main";
  min-height: 100vh;
}

/* ============================================================
   Sidebar
   ============================================================ */
.sidebar {
  grid-area: sidebar;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  padding: 22px 0;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 20px 22px;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 16px;
}
.brand-logo {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  display: grid;
  place-items: center;
  background: var(--bg-tertiary);
  flex-shrink: 0;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-name {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 800;
  color: var(--accent);
  letter-spacing: -0.02em;
}
.brand-sub {
  font-size: 11px;
  color: var(--text-tertiary);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-top: 2px;
}

.nav { flex: 1; display: flex; flex-direction: column; gap: 2px; padding: 0 10px; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  transition: var(--tx-fast);
  text-align: left;
}
.nav-item:hover { background: var(--bg-tertiary); color: var(--text-primary); }
.nav-item.active {
  background: rgba(19, 151, 200, 0.10);
  color: var(--accent);
  font-weight: 600;
}
.nav-icon { width: 18px; text-align: center; opacity: 0.8; }
.nav-item.active .nav-icon { opacity: 1; }

.sidebar-footer {
  padding: 14px 22px 0;
  border-top: 1px solid var(--border-subtle);
}
.build-tag {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* ============================================================
   Header
   ============================================================ */
.header {
  grid-area: header;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-subtle);
  position: sticky;
  top: 0;
  z-index: 10;
}
.header-title h1 {
  font-size: 18px;
  font-weight: 700;
  line-height: 1.1;
}
.header-sub {
  font-size: 11px;
  color: var(--text-tertiary);
  font-weight: 500;
}

.header-stats { display: flex; align-items: center; gap: 22px; }
.header-stat { display: flex; flex-direction: column; align-items: flex-end; gap: 1px; }
.header-stat-label {
  font-size: 9.5px;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 600;
}
.header-stat-value { font-size: 13px; font-weight: 700; color: var(--text-primary); }

.btn-refresh {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-default);
  color: var(--text-secondary);
  display: grid;
  place-items: center;
  transition: var(--tx-med);
}
.btn-refresh:hover {
  background: var(--bg-elevated);
  color: var(--accent);
  border-color: var(--accent);
}
.btn-refresh.spinning svg { animation: spin 0.85s linear infinite; }

/* ============================================================
   Main
   ============================================================ */
.main {
  grid-area: main;
  padding: 24px 28px 60px;
  overflow-x: hidden;
}

.tab-content {
  display: none;
  animation: fadeIn 0.32s ease;
}
.tab-content.active { display: block; }

/* ============================================================
   Bottom nav (mobile)
   ============================================================ */
.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-default);
  padding: 6px 4px max(6px, env(safe-area-inset-bottom)) 4px;
  z-index: 20;
}
.bn-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 4px;
  color: var(--text-tertiary);
  font-size: 9.5px;
  font-weight: 600;
  border-radius: var(--radius-sm);
}
.bn-item.active { color: var(--accent); }
.bn-icon { font-size: 18px; line-height: 1; }

/* Divisória entre abas principais e abas de sistema (Ajuda/Sobre/Config) */
.nav-divider {
  height: 1px;
  background: var(--border);
  margin: 10px 12px;
  opacity: 0.7;
}
