/* ==========================================================================
   Painel administrativo — layout (padrão "Beer")
   Desktop: menu lateral fixo (230px, recolhível para 68px) + barra do topo.
   Abaixo de 900px: o menu vira gaveta aberta pelo botão da barra do topo.
   ========================================================================== */
body.admin {
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
  overflow-x: hidden;
}

body.admin * {
  scrollbar-width: thin;
  scrollbar-color: var(--border2) transparent;
}

body.admin *::-webkit-scrollbar { width: 10px; height: 10px; }
body.admin *::-webkit-scrollbar-track { background: transparent; }
body.admin *::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 999px; }
body.admin *::-webkit-scrollbar-thumb:hover { background: var(--text3); }

body.admin h1,
body.admin h2,
body.admin h3,
body.admin h4 {
  font-weight: 600;
  letter-spacing: -.2px;
  color: var(--text);
}

.app {
  min-height: 100vh;
  min-height: 100dvh;
}

/* -------------------------------------------------------------- menu lateral */
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 90;
  width: 230px;
}

/* Wrapper que rola e carrega o fundo: no menu recolhido só ele alarga no
   hover, flutuando por cima do conteúdo, sem empurrar a página. */
.sidebar-scroll {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  background: var(--surface);
  border-right: 1px solid var(--border);
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 70px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--divider);
  text-decoration: none;
  color: var(--text);
}

.logo-mark {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  flex: none;
  overflow: hidden;
  border-radius: 50%;
  background: var(--blue-bg);
  color: var(--blue-text);
  font-size: 13px;
  font-weight: 700;
}

.logo-mark img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.logo-text {
  display: grid;
  min-width: 0;
  line-height: 1.2;
}

.logo-title {
  overflow: hidden;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -.2px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.logo-sub {
  font-size: 11px;
  color: var(--text3);
}

.nav {
  flex: 1;
  padding: 10px 10px 0;
}

.nav-label {
  padding: 16px 12px 6px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .7px;
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--text3);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  margin-bottom: 2px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  text-align: left;
  text-decoration: none;
  white-space: nowrap;
  color: var(--text2);
  transition: background-color .12s, color .12s;
}

.nav-item svg {
  width: 18px;
  height: 18px;
  flex: none;
}

.nav-item:hover {
  background: var(--surface2);
  color: var(--text);
}

.nav-item[aria-current='page'] {
  background: var(--blue-bg);
  color: var(--blue-text);
  font-weight: 500;
}

.sidebar-footer {
  margin-top: 8px;
  padding: 10px 10px 16px;
  border-top: 1px solid var(--border);
}

.sidebar-collapse-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  white-space: nowrap;
  color: var(--text3);
  transition: background-color .12s, color .12s;
}

.sidebar-collapse-btn:hover {
  background: var(--surface2);
  color: var(--text);
}

.sidebar-collapse-btn svg {
  width: 16px;
  height: 16px;
  flex: none;
}

.sidebar-backdrop {
  display: none;
}

/* -------------------------------------------------------------- coluna principal */
.main-col {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 100vh;
  min-height: 100dvh;
  margin-left: 230px;
}

/* -------------------------------------------------------------- barra do topo */
.topbar {
  position: sticky;
  top: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  gap: 12px;
  height: 56px;
  padding: 0 16px 0 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.tb-title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  font-size: 16px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tb-page-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.tb-page-actions:empty {
  display: none;
}

.tb-acoes {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  padding-left: 8px;
  border-left: 1px solid var(--divider);
}

.tb-page-actions:empty + .tb-acoes {
  padding-left: 0;
  border-left: 0;
}

.tb-drop {
  position: relative;
}

.tb-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  flex: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text2);
}

.tb-btn:hover {
  background: var(--surface2);
  color: var(--text);
}

.tb-btn svg {
  width: 18px;
  height: 18px;
}

.tb-menu-btn {
  display: none;
}

.tb-user {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 10px 0 4px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text2);
}

.tb-user:hover {
  background: var(--surface2);
}

.tb-user > svg {
  width: 14px;
  height: 14px;
}

.su-avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--blue-bg);
  color: var(--blue-text);
  font-size: 12px;
  font-weight: 700;
}

.tb-user-info {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1.15;
}

.su-nome {
  max-width: 140px;
  overflow: hidden;
  font-size: 13px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
}

.su-role {
  font-size: 10px;
  color: var(--text3);
}

.tb-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 50;
  display: none;
  min-width: 220px;
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0, 0, 0, .18);
}

.tb-menu.open {
  display: block;
}

.tb-menu-head {
  padding: 6px 10px 8px;
  font-size: 12px;
  color: var(--text3);
  overflow-wrap: anywhere;
}

.tb-menu-head strong {
  display: block;
  font-size: 13px;
  color: var(--text);
}

.tb-menu a,
.tb-menu button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  text-align: left;
  text-decoration: none;
  color: var(--text);
}

.tb-menu a:hover,
.tb-menu button:hover {
  background: var(--surface2);
}

.tb-menu svg {
  width: 17px;
  height: 17px;
  color: var(--text3);
}

.tb-menu hr {
  margin: 6px 0;
  border: none;
  border-top: 1px solid var(--border);
}

.tb-menu .tb-sair,
.tb-menu .tb-sair svg {
  color: var(--red);
}

/* -------------------------------------------------------------- conteúdo */
.admin-main {
  flex: 1;
  width: 100%;
  max-width: 1720px;
  margin: 0 auto;
  padding: 28px 36px 40px;
}

.admin-main:focus {
  outline: none;
}

.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.page-head__title {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -.3px;
}

.page-head__subtitle {
  margin-top: 3px;
  font-size: 13px;
  color: var(--text3);
}

/* -------------------------------------------------------------- menu recolhido (desktop) */
@media (min-width: 900px) {
  .menu-recolhido .sidebar { width: 68px; }
  .menu-recolhido .main-col { margin-left: 68px; }

  .menu-recolhido .sidebar-scroll {
    position: absolute;
    top: 0;
    left: 0;
    width: 68px;
    transition: width .15s ease-out;
  }

  .menu-recolhido .logo { justify-content: center; padding-inline: 16px; }
  .menu-recolhido .nav-item,
  .menu-recolhido .sidebar-collapse-btn { justify-content: center; padding-inline: 6px; }
  .menu-recolhido .logo-text,
  .menu-recolhido .nav-item span,
  .menu-recolhido .sidebar-collapse-btn span { display: none; }
  .menu-recolhido .nav-label { height: 1px; margin: 10px 14px; padding: 0; font-size: 0; background: var(--border); }

  /* Passar o mouse reexibe os nomes, por cima do conteúdo */
  .menu-recolhido .sidebar:hover .sidebar-scroll {
    width: 230px;
    box-shadow: 4px 0 16px rgba(0, 0, 0, .18);
  }

  .menu-recolhido .sidebar:hover .logo { justify-content: flex-start; padding-inline: 18px; }
  .menu-recolhido .sidebar:hover .nav-item,
  .menu-recolhido .sidebar:hover .sidebar-collapse-btn { justify-content: flex-start; padding-inline: 10px; }
  .menu-recolhido .sidebar:hover .logo-text { display: grid; }
  .menu-recolhido .sidebar:hover .nav-item span,
  .menu-recolhido .sidebar:hover .sidebar-collapse-btn span { display: inline; }
  .menu-recolhido .sidebar:hover .nav-label { height: auto; margin: 0; padding: 16px 12px 6px; font-size: 10.5px; background: none; }
}

/* -------------------------------------------------------------- gaveta (telas menores) */
@media (max-width: 899px) {
  .sidebar {
    z-index: 120;
    width: 250px;
    max-width: 82vw;
    transform: translateX(-100%);
    transition: transform .22s ease;
  }

  .sidebar.is-open {
    transform: none;
    box-shadow: 2px 0 16px rgba(0, 0, 0, .2);
  }

  .sidebar-collapse-btn {
    display: none;
  }

  .sidebar-backdrop.is-open {
    position: fixed;
    inset: 0;
    z-index: 110;
    display: block;
    background: rgba(0, 0, 0, .45);
  }

  .main-col {
    margin-left: 0;
  }

  .tb-menu-btn {
    display: flex;
  }

  .topbar {
    padding: 0 10px;
    gap: 8px;
  }

  .admin-main {
    padding: 18px 16px 96px;
  }
}

@media (max-width: 640px) {
  .tb-user-info,
  .tb-user > svg {
    display: none;
  }

  .tb-user {
    padding: 0 3px;
  }

  .tb-acoes {
    padding-left: 0;
    border-left: 0;
  }
}

/* -------------------------------------------------------------- login */
.login {
  display: grid;
  place-items: center;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 24px 16px;
  background: var(--bg);
}

.login__card {
  width: 100%;
  max-width: 380px;
  padding: 28px 24px;
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.login__brand {
  display: grid;
  justify-items: center;
  gap: 6px;
  margin-bottom: 20px;
  text-align: center;
}

.login__brand .brand__mark {
  width: 48px;
  height: 48px;
}

.login__title {
  font-size: 20px;
}

.password-field {
  position: relative;
}

.password-field .input {
  padding-right: 44px;
}

.password-field .icon-btn {
  position: absolute;
  top: 50%;
  right: 2px;
  transform: translateY(-50%);
}

/* -------------------------------------------------------------- aviso de e-mail não confirmado */
.verify-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 10px 24px;
  background: var(--amber-bg);
  color: var(--amber-text);
  font-size: 13px;
  border-bottom: 1px solid var(--divider);
}

.verify-banner > svg {
  width: 18px;
  height: 18px;
  flex: none;
}

.verify-banner > span {
  flex: 1 1 260px;
}

.verify-banner--red {
  background: var(--red-bg);
  color: var(--red-text);
}

/* ==========================================================================
   Linha de título da página: título à esquerda, botões da página à direita
   ========================================================================== */
.tb-spacer {
  flex: 1;
}

.page-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  max-width: 1720px;
  margin: 0 auto;
  padding: 24px 36px 0;
}

.page-bar__title {
  min-width: 0;
  margin: 0;
  overflow: hidden;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -.01em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.page-bar__actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.page-bar + .admin-main {
  padding-top: 16px;
}

@media (max-width: 899px) {
  .page-bar { padding: 16px 16px 0; }
  .page-bar__title { font-size: 19px; }
  .page-bar + .admin-main { padding-top: 12px; }
}

/* ==========================================================================
   Padrão "Oficina Ultra": grupos do menu que abrem e fecham, abas das
   páginas abertas na barra do topo e botão de perfil compacto.
   ========================================================================== */

/* -------------------------------------------------------------- grupos do menu */
.nav-group {
  margin-bottom: 2px;
}

.nav-group-header {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  text-align: left;
  white-space: nowrap;
  color: var(--text2);
  transition: background-color .12s, color .12s;
}

.nav-group-header:hover {
  background: var(--surface2);
  color: var(--text);
}

.nav-group-header > svg {
  width: 18px;
  height: 18px;
  flex: none;
}

.nav-group-header > span {
  flex: 1;
}

.nav-group-header > svg:last-child {
  width: 14px;
  height: 14px;
  transition: transform .2s;
}

.nav-group.open .nav-group-header > svg:last-child {
  transform: rotate(90deg);
}

.nav-group.has-active .nav-group-header {
  color: var(--blue);
  font-weight: 500;
}

.nav-group-items {
  overflow: hidden;
  max-height: 0;
  transition: max-height .25s ease;
}

.nav-group.open .nav-group-items {
  max-height: 400px;
}

.nav-item.nav-sub {
  padding-left: 30px;
  font-size: 13px;
}

.nav-item.nav-sub svg {
  width: 16px;
  height: 16px;
}

.nav-item[aria-current='page'] {
  background: var(--blue-bg);
  color: var(--blue);
}

@media (min-width: 900px) {
  .menu-recolhido .nav-group-header { justify-content: center; padding-inline: 6px; }
  .menu-recolhido .nav-group-header > span,
  .menu-recolhido .nav-group-header > svg:last-child { display: none; }
  .menu-recolhido .nav-item.nav-sub { padding-left: 6px; }

  .menu-recolhido .sidebar:hover .nav-group-header { justify-content: flex-start; padding-inline: 10px; }
  .menu-recolhido .sidebar:hover .nav-group-header > span,
  .menu-recolhido .sidebar:hover .nav-group-header > svg:last-child { display: inline; }
  .menu-recolhido .sidebar:hover .nav-item.nav-sub { padding-left: 30px; }
}

/* -------------------------------------------------------------- abas do topo */
.topbar {
  gap: 0;
  height: auto;
  min-height: 50px;
  padding: 0;
  border-bottom-color: var(--divider);
}

.tabs-bar-wrapper {
  display: flex;
  flex: 1;
  align-items: center;
  gap: 6px;
  min-width: 0;
  padding: 6px 10px;
}

.tabs-bar {
  display: flex;
  flex: 1;
  align-items: center;
  gap: 4px;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: thin;
}

.tabs-bar-close-all {
  flex-shrink: 0;
  min-height: 28px;
  padding: 0 8px;
}

.tabs-bar-close-all:hover:not(:disabled) {
  background: var(--red-bg);
  border-color: var(--red-mid);
  color: var(--red);
}

.tab-item {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  gap: 6px;
  max-width: 220px;
  padding: 6px 8px 6px 12px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: var(--surface2);
  font-size: 12.5px;
  font-weight: 500;
  white-space: nowrap;
  color: var(--text2);
  cursor: pointer;
  transition: background-color .12s, border-color .12s;
}

.tab-item:hover {
  background: var(--surface3);
}

.tab-item:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 1px;
}

.tab-item.tab-active {
  border-color: var(--blue-mid);
  background: var(--blue-bg);
  color: var(--blue-text);
}

.tab-item > svg {
  width: 14px;
  height: 14px;
  flex: none;
}

.tab-item.tab-active > svg {
  color: var(--blue);
}

.tab-label {
  overflow: hidden;
  text-overflow: ellipsis;
}

.tab-close {
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  flex: none;
  border-radius: 4px;
  color: var(--text3);
}

.tab-close:hover {
  background: var(--red-bg);
  color: var(--red);
}

.tab-close svg {
  width: 12px;
  height: 12px;
}

.tb-acoes {
  padding: 8px 16px;
  border-left: 0;
}

/* -------------------------------------------------------------- botões do topo */
.tb-btn {
  width: 34px;
  height: 34px;
  background: var(--surface2);
  color: var(--text3);
}

.tb-btn:hover {
  background: var(--blue-bg);
  color: var(--blue);
}

.tb-btn svg {
  width: 16px;
  height: 16px;
}

.tb-user {
  gap: 8px;
  max-width: 220px;
  height: 34px;
  padding: 0 12px 0 10px;
  background: var(--surface2);
  font-size: 13px;
  font-weight: 500;
}

.tb-user:hover {
  background: var(--surface3);
  color: var(--text);
}

.tb-user > svg {
  width: 17px;
  height: 17px;
  flex: none;
  color: var(--text3);
}

.tb-user .su-nome {
  font-size: 13px;
  font-weight: 500;
  color: var(--text2);
}

.tb-user-chevron {
  display: grid;
  color: var(--text3);
  transition: transform .15s ease;
}

.tb-user-chevron svg {
  width: 13px;
  height: 13px;
}

.tb-user[aria-expanded='true'] .tb-user-chevron {
  transform: rotate(180deg);
}

.tb-menu {
  border: 0;
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 32px rgba(0, 0, 0, .25);
}

.tb-menu a,
.tb-menu button {
  font-size: 13.5px;
  color: var(--text2);
}

.tb-menu a:hover,
.tb-menu button:hover {
  color: var(--text);
}

.tb-menu .tb-sair:hover {
  background: var(--red-bg);
}

/* -------------------------------------------------------------- título da página */
.page-bar {
  padding: 32px 36px 0;
}

.page-bar__title {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -.3px;
}

.page-bar + .admin-main {
  padding-top: 20px;
}

/* -------------------------------------------------------------- celular */
@media (max-width: 899px) {
  .topbar { padding-left: 10px; }
  .page-bar { padding: 16px 16px 0; }
  .page-bar__title { font-size: 19px; }
  .page-bar + .admin-main { padding-top: 12px; }
}

@media (max-width: 640px) {
  .tabs-bar-wrapper { visibility: hidden; padding: 0; }
  .tb-acoes { padding: 8px 12px; }
  .tb-user .su-nome,
  .tb-user-chevron { display: none; }
  .tb-user { padding: 0; width: 34px; justify-content: center; }
  .tb-user > svg { display: block; }
}
