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

/* ============ SIDEBAR ============ */
.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  padding: var(--sp-4) var(--sp-3);
  position: fixed;
  top: 0; left: 0; bottom: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
  z-index: 20;
}

.sidebar .marca {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sp-3) var(--sp-2);
  margin-bottom: var(--sp-3);
}
.sidebar .marca img {
  max-width: 100%;
  max-height: 56px;
  object-fit: contain;
}

.sidebar .nav-grupo {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.sidebar .nav-grupo-titulo {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-mute);
  padding: var(--sp-3) var(--sp-3) var(--sp-2);
}

.sidebar .nav-item {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: 10px var(--sp-3);
  border-radius: var(--radius-sm);
  color: var(--text-soft);
  font-size: var(--fs-sm);
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
}
.sidebar .nav-item:hover {
  background: var(--dourado-soft-2);
  color: var(--azul-rrgk);
}
.sidebar .nav-item.active {
  background: var(--dourado-soft);
  color: var(--azul-rrgk);
  font-weight: 600;
  position: relative;
}
.sidebar .nav-item.active::before {
  content: "";
  position: absolute;
  left: 0; top: 8px; bottom: 8px;
  width: 3px;
  background: var(--dourado);
  border-radius: 0 3px 3px 0;
}
.sidebar .nav-item .icon {
  color: var(--dourado-3);
  font-size: 1.1rem;
  width: 18px; text-align: center;
}

/* ============ MAIN AREA ============ */
.main {
  flex: 1;
  margin-left: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  height: var(--topbar-h);
  border-bottom: 1px solid var(--border);
  background: var(--topbar-bg);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--sp-5);
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar .titulo-pagina {
  font-size: var(--fs-lg);
  font-weight: 600;
  color: var(--azul-rrgk);
}

.topbar .info-usuario {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  font-size: var(--fs-sm);
  color: var(--text-soft);
}

.topbar .info-usuario .badge-perfil {
  font-size: var(--fs-xs);
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--dourado-soft);
  color: var(--dourado-3);
  font-weight: 600;
}

.content { padding: var(--sp-5); flex: 1; }

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--sp-3);
  margin-bottom: var(--sp-5);
  flex-wrap: wrap;
}
.page-head .titulo-bloco {
  display: flex; flex-direction: column; gap: 4px;
}
.page-head h1 { margin: 0; }
.page-head .sub {
  color: var(--text-dim);
  font-size: var(--fs-sm);
}
.page-head .acoes {
  display: flex; gap: var(--sp-2); flex-wrap: wrap;
}

/* ============ GRID/COLUNAS ============ */
.row { display: grid; gap: var(--sp-4); }
.row-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.row-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.row-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1100px) {
  .row-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .row-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
  .row-2, .row-3, .row-4 { grid-template-columns: 1fr; }
}

/* ============ TELA PUBLICA (LOGIN) ============ */
.tela-publica {
  background: linear-gradient(135deg, var(--azul-rrgk) 0%, var(--azul-rrgk-2) 100%);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sp-4);
  color: var(--text);
}

/* ============ MOBILE - sidebar como gaveta ============ */
.menu-toggle { display: none; background: none; border: none; cursor: pointer; }
@media (max-width: 900px) {
  .menu-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px; height: 36px;
    border-radius: var(--radius-sm);
    color: var(--azul-rrgk);
    font-size: 1.4rem;
  }
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.25s;
    box-shadow: var(--shadow-lg);
  }
  body.sidebar-aberta .sidebar { transform: translateX(0); }
  .main { margin-left: 0; }
  body.sidebar-aberta::after {
    content: "";
    position: fixed; inset: 0;
    background: rgba(27, 42, 74, 0.45);
    z-index: 15;
  }
}
