body {
  height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  display: flex;
}

.header {
  display: none;
}

.layout {
  display: flex;
  flex: 1;
  justify-content: center;
  padding: 20px;
  column-gap: 16px;
  overflow: hidden;
  height: 100vh;
}

/* ===== Sidebar ===== */
.sidebar {
  background: var(--surface);
  border: 1px solid var(--border);
  height: 100%;
  width: 260px;
  flex-shrink: 0;
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
}

.perfil {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 36px 20px 24px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}

.perfil .logo {
  width: 60px;
  margin-bottom: 12px;
}

.info {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  width: 100%;
  min-width: 0;
}

.info h2 {
  font-size: 16px;
  font-weight: 600;
}

.info p {
  font-size: 13px;
  color: var(--text-secondary);
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.menu {
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

.menu button {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  font-size: 15px;
  font-family: var(--font);
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 12px 14px;
  border-radius: var(--radius);
  cursor: pointer;
  text-align: left;
  transition: background 0.15s ease, color 0.15s ease;
}

.menu button svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.menu button:hover {
  background: var(--surface-2);
  color: var(--text);
}

/* Grupo com submenu (Cadastro → Categorias/Contas) */
.menu-grupo {
  display: flex;
  flex-direction: column;
}

.menu-grupo .menu-seta {
  margin-left: auto;
  width: 16px !important;
  height: 16px !important;
  transition: transform 0.2s ease;
}

.menu-grupo.aberto .menu-seta {
  transform: rotate(180deg);
}

.menu-grupo .submenu {
  display: none;
  flex-direction: column;
  gap: 4px;
  padding-left: 22px;
  margin-top: 4px;
}

.menu-grupo.aberto .submenu {
  display: flex;
}

.menu-grupo .submenu button {
  font-size: 14px;
  padding: 10px 12px;
}

.menu-grupo .submenu button svg {
  width: 17px;
  height: 17px;
}

#logout-button {
  margin-top: auto;
  color: var(--negative);
}

#logout-button:hover {
  background: var(--danger-soft);
  color: var(--negative);
}

/* ===== Área de conteúdo ===== */
#app {
  flex: 1;
  display: flex;
  min-height: 0;
}

.content-wrapper {
  width: 100%;
  flex: 1;
  min-height: 0;
  display: flex;
  background: transparent;
}

.overlay {
  display: none;
}

/* Cabeçalho de página + filtro de mês */
.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

.page-head .page-title {
  margin-bottom: 0;
}

.month-select {
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  cursor: pointer;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.month-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

/* ===== Responsivo ===== */
@media (max-width: 1000px) {
  /* No celular a página rola normalmente (em vez do scroll interno do desktop) */
  body {
    height: auto;
    min-height: 100vh;
  }

  .layout {
    flex-direction: column;
    gap: 12px;
    padding: 12px;
    height: auto;
    overflow: visible;
  }

  /* Topo sempre visível ao rolar — o ☰ nunca some */
  .header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: var(--radius);
    position: sticky;
    top: 8px;
    z-index: 500;
    box-shadow: var(--shadow-sm);
  }

  .logo_header {
    display: flex;
    align-items: center;
    gap: 8px;
  }

  .logo_header h2 {
    font-size: 18px;
  }

  .logo_header img {
    width: 40px;
  }

  .menu-toggle {
    background: var(--surface-2);
    padding: 10px 14px;
    font-size: 20px;
    line-height: 1;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    cursor: pointer;
  }

  .menu-toggle:hover {
    background: var(--accent-soft);
    color: var(--accent-strong);
  }

  .content-wrapper {
    width: 100%;
    flex: 1;
    min-width: 0;
    /* trava: conteúdo largo demais é cortado em vez de alargar a página
       (era isso que causava o zoom-out e o arrastar lateral no celular) */
    overflow-x: hidden;
  }

  .layout {
    min-width: 0;
  }

  .sidebar {
    position: fixed;
    top: 0;
    bottom: 0; /* ancora nas duas pontas — 100vh falha no Safari iOS (barra dinâmica) */
    left: -100%;
    width: 256px;
    height: auto;
    overflow-y: auto;
    z-index: 1000;
    transition: left 0.3s ease;
    border-radius: 0;
  }

  .sidebar.active {
    left: 0;
  }

  .overlay {
    display: block; /* a base tem display:none — sem isso o clique fora nunca fechava */
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 900;
  }

  .overlay.active {
    opacity: 1;
    pointer-events: all;
  }
}

@media (max-width: 480px) {
  .sidebar {
    width: 76%;
  }
}
