/* ==========================================================
   rb-global.css — Checkup IRPF
   Função:
   - container padrão
   - RB-HUBNAV
   - topbar global
   - marca
   - toggle visual
   - footer padrão
   - componentes estruturais compartilhados
   - responsividade compartilhada

   NÃO colocar aqui:
   - layout específico de S-R
   - layout específico de G-E
   - hero específico
   - sidebar específica
   - office box específico da ATD
   ========================================================== */

/* ==========================================================
   1) CONTAINER PADRÃO
   ========================================================== */
.wrap {
  width: min(100%, var(--rb-wrap-max));
  margin-inline: auto;
  padding-inline: 18px;
}

/* ==========================================================
   2) RB-HUBNAV
   ========================================================== */
#rb-hubnav {
  position: sticky;
  top: 10px;
  z-index: 50;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.7rem;
  width: min(calc(100% - 36px), var(--rb-wrap-max));
  margin: 10px auto 0;
  padding: 10px 12px;
  border: 1px solid var(--rb-border);
  border-radius: var(--rb-radius-pill);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  background: color-mix(in srgb, var(--rb-overlay) 88%, transparent);
  box-shadow: var(--rb-shadow-sm);
}

#rb-hubnav a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0.58rem 0.9rem;
  border: 1px solid var(--rb-border);
  border-radius: var(--rb-radius-pill);
  background: color-mix(in srgb, var(--rb-bg-elev) 84%, transparent);
  color: var(--rb-text);
  font-size: 0.92rem;
  font-weight: 650;
  line-height: 1;
  text-decoration: none;
  transition:
    background-color 0.15s ease,
    border-color 0.15s ease,
    color 0.15s ease,
    transform 0.15s ease,
    box-shadow 0.15s ease;
}

#rb-hubnav a:hover {
  color: var(--rb-text);
  border-color: var(--rb-border-strong);
  box-shadow: var(--rb-shadow-sm);
  transform: translateY(-1px);
}

/* ==========================================================
   3) TOPBAR GLOBAL
   ========================================================== */
.rb-topbar {
  padding-top: var(--rb-space-5);
}

.rb-topbar-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--rb-space-4);
  padding: var(--rb-space-4) var(--rb-space-5);
  border: 1px solid var(--rb-border);
  border-radius: var(--rb-radius-xl);
  background:
    linear-gradient(
      180deg,
      color-mix(in srgb, var(--rb-bg-elev) 86%, transparent),
      color-mix(in srgb, var(--rb-brand-1) 5%, transparent)
    ),
    var(--rb-surface);
  box-shadow: var(--rb-shadow-sm);
}

.rb-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.8rem;
  min-width: 0;
  color: var(--rb-text);
  text-decoration: none;
  font-weight: 800;
}

.rb-brand:hover {
  color: var(--rb-text);
}

.rb-brand img {
  width: 44px;
  height: 44px;
  object-fit: contain;
  flex: 0 0 auto;
}

.rb-brand span {
  display: block;
  line-height: 1.05;
  letter-spacing: -0.03em;
  font-size: clamp(1.55rem, 2vw, 1.9rem);
  word-break: break-word;
}

/* ==========================================================
   4) TOGGLE VISUAL DO TEMA
   - suporta uso inline no topo
   - suporta uso flutuante no canto inferior direito
   ========================================================== */
.rb-theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  flex: 0 0 auto;
  min-height: 42px;
  padding: 0.68rem 1rem;
  border: 1px solid var(--rb-toggle-border);
  border-radius: var(--rb-radius-pill);
  background: var(--rb-toggle-bg);
  color: var(--rb-toggle-text);
  font-size: 0.92rem;
  font-weight: 750;
  line-height: 1;
  text-decoration: none;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.04),
    var(--rb-shadow-sm);
  cursor: pointer;
  transition:
    transform 0.16s ease,
    box-shadow 0.16s ease,
    border-color 0.16s ease,
    background-color 0.16s ease;
}

.rb-theme-toggle:hover {
  border-color: var(--rb-border-strong);
  transform: translateY(-1px);
}

.rb-theme-toggle:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--rb-brand-3) 56%, white);
  outline-offset: 2px;
}

.rb-theme-toggle .rb-theme-icon {
  font-size: 1rem;
  line-height: 1;
}

.rb-theme-toggle .rb-theme-label {
  line-height: 1;
}

/* Versão flutuante pequena, só com ícone */
.rb-theme-toggle.rb-theme-floating,
.rb-theme-floating {
  position: fixed;
  right: max(12px, env(safe-area-inset-right));
  bottom: max(12px, env(safe-area-inset-bottom));
  z-index: 120;
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  background: color-mix(in srgb, var(--rb-toggle-bg) 88%, transparent);
  box-shadow:
    0 12px 24px rgba(0, 0, 0, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.rb-theme-toggle.rb-theme-floating .rb-theme-label,
.rb-theme-floating .rb-theme-label {
  display: none !important;
}

.rb-theme-toggle.rb-theme-floating .rb-theme-icon,
.rb-theme-floating .rb-theme-icon {
  font-size: 1rem;
  line-height: 1;
}

/* ==========================================================
   5) ESTRUTURA PADRÃO DE BLOCOS
   ========================================================== */
.card > :last-child,
.rb-cta-box > :last-child {
  margin-bottom: 0;
}

/* ==========================================================
   6) CTA STACK GLOBAL
   ========================================================== */
.rb-hero-cta,
.rb-hero-cta-dual {
  display: flex;
  flex-wrap: wrap;
  gap: var(--rb-space-3);
  margin-top: var(--rb-space-5);
}

.rb-sidebar-cta-stack {
  display: grid;
  gap: var(--rb-space-3);
  margin-top: var(--rb-space-4);
}

/* ==========================================================
   7) FOOTER PADRÃO
   Compatível com:
   - footer antigo
   - footer novo
   ========================================================== */
#rb-footer {
  padding-block: var(--rb-space-6) var(--rb-space-7);
}

#rb-footer .wrap {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--rb-space-3);
  border: 1px solid var(--rb-border);
  border-radius: var(--rb-radius-xl);
  background:
    linear-gradient(
      180deg,
      color-mix(in srgb, var(--rb-bg-elev) 82%, transparent),
      color-mix(in srgb, var(--rb-brand-1) 4%, transparent)
    ),
    var(--rb-footer-bg);
  box-shadow: var(--rb-shadow-sm);
  padding: clamp(16px, 2vw, 24px);
}

#rb-footer .wrap > * {
  min-width: 0;
}

#rb-footer strong {
  color: var(--rb-text);
}

/* ---------- Estrutura antiga ---------- */
.rb-footer-main {
  display: grid;
  grid-template-columns: minmax(260px, 0.92fr) minmax(0, 1.08fr);
  gap: clamp(14px, 2vw, 24px);
}

.rb-footer-notice,
.rb-footer-links,
.rb-footer-office {
  min-width: 0;
}

.rb-footer-office {
  display: none !important;
}

.rb-footer-notice strong,
.rb-footer-links > strong,
.rb-footer-office strong {
  display: block;
  margin: 0 0 0.45rem;
  font-size: 0.94rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--rb-text);
}

.rb-footer-notice p,
.rb-footer-office p {
  margin: 0;
  color: var(--rb-footer-text);
  font-size: 0.92rem;
  line-height: 1.52;
}

.rb-footer-notice p + p,
.rb-footer-office p + p {
  margin-top: 0.18rem;
}

.rb-footer-links ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.42rem;
}

.rb-footer-links li {
  margin: 0;
  padding: 0;
}

.rb-footer-links a {
  display: block;
  width: 100%;
  max-width: none;
  color: var(--rb-text);
  text-decoration: none;
  font-size: 0.92rem;
  line-height: 1.35;
  white-space: normal;
  overflow-wrap: break-word;
}

.rb-footer-links a:hover {
  color: var(--rb-link);
  text-decoration: underline;
}

/* ---------- Estrutura nova ---------- */
.rb-footer-grid {
  display: grid;
  grid-template-columns: minmax(260px, 0.92fr) minmax(0, 1.08fr);
  align-items: start;
  gap: clamp(14px, 2vw, 24px);
}

.rb-footer-project,
.rb-footer-nav {
  min-width: 0;
}

.rb-footer-nav {
  justify-self: stretch;
  width: 100%;
  min-width: 0;
}

.rb-footer-project h2,
.rb-footer-nav h3 {
  margin: 0 0 0.45rem;
  font-size: 0.94rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--rb-text);
}

.footer-note {
  margin: 0;
  color: var(--rb-footer-text);
  font-size: 0.92rem;
  line-height: 1.52;
}

.footer-note + .footer-note {
  margin-top: 0.18rem;
}

.footer-note.small-muted {
  color: var(--rb-text-muted);
  font-size: 0.88rem;
  line-height: 1.58;
}

.footer-links {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.42rem;
}

.footer-links li {
  margin: 0;
  padding: 0;
}

.footer-links a {
  display: block;
  width: 100%;
  max-width: none;
  color: var(--rb-text);
  text-decoration: none;
  font-size: 0.92rem;
  line-height: 1.35;
  white-space: normal;
  overflow-wrap: break-word;
}

.footer-links a:hover {
  color: var(--rb-link);
  text-decoration: underline;
}

.rb-footer-company-line {
  grid-column: 1 / -1;
  border-top: 1px solid var(--rb-border);
  padding-top: var(--rb-space-3);
  color: var(--rb-text-muted);
  font-size: 0.88rem;
  line-height: 1.5;
  text-align: center;
}

.rb-footer-company-line strong {
  color: var(--rb-text);
}

.rb-footer-company-line span {
  display: inline;
}

.rb-footer-company-line span + span::before {
  content: " ";
}

/* ---------- Responsivo ---------- */
@media (max-width: 980px) {
  .rb-footer-main,
  .rb-footer-grid {
    grid-template-columns: 1fr;
    gap: var(--rb-space-3);
  }

  .rb-footer-company-line {
    text-align: left;
  }
}

@media (max-width: 640px) {
  #rb-footer {
    padding-block: var(--rb-space-5) var(--rb-space-6);
  }

  #rb-footer .wrap {
    padding: var(--rb-space-4);
  }

  .rb-footer-links ul,
  .footer-links {
    gap: 0.34rem;
  }

  .rb-footer-notice p,
  .rb-footer-office p,
  .footer-note,
  .rb-footer-links a,
  .footer-links a {
    font-size: 0.9rem;
  }

  .rb-footer-company-line {
    font-size: 0.86rem;
    line-height: 1.6;
  }
}


/* ==========================================================
   8) BLOCO DE FAQ SHARED
   ========================================================== */
.rb-sr-faq .card,
.rb-ge-faq .card,
.rb-sr-atd-faq .card {
  display: grid;
  gap: var(--rb-space-3);
}

/* ==========================================================
   9) BLOCO DE RELACIONADOS SHARED
   ========================================================== */
.rb-sr-related .card,
.rb-ge-cluster-pages.card,
.rb-sr-atd-related .card,
.rb-ge-sidebar-related.card,
.rb-ge-sources.card {
  display: grid;
  gap: var(--rb-space-3);
}

/* ==========================================================
   10) LISTAS DE SUMÁRIO SHARED
   ========================================================== */
.rb-ge-toc ul {
  margin: 0;
  padding-left: 1rem;
}

.rb-ge-toc li + li {
  margin-top: var(--rb-space-2);
}

/* ==========================================================
   11) HOTFIXES MOBILE COMPARTILHADOS
   ========================================================== */
@media (max-width: 980px) {
  #rb-footer .wrap {
    gap: var(--rb-space-3);
  }

  .rb-footer-grid {
    grid-template-columns: 1fr;
  }

  .rb-footer-nav {
    padding-top: 2px;
  }
}

@media (max-width: 640px) {
  .wrap {
    padding-inline: 14px;
  }

  #rb-hubnav {
    top: 8px;
    width: calc(100% - 28px);
    flex-direction: column;
    align-items: stretch;
    gap: 0.55rem;
    padding-inline: 12px;
  }

  #rb-hubnav a {
    width: 100%;
  }

  .rb-topbar-row {
    flex-direction: column;
    align-items: flex-start;
    padding: var(--rb-space-4);
  }

  .rb-brand {
    width: 100%;
  }

  .rb-brand span {
    white-space: normal;
    overflow-wrap: anywhere;
    font-size: 1.5rem;
  }

  .rb-theme-toggle {
    width: 100%;
  }

  .rb-theme-toggle.rb-theme-floating,
  .rb-theme-floating {
    width: 42px;
    height: 42px;
    min-width: 42px;
    min-height: 42px;
    right: max(10px, env(safe-area-inset-right));
    bottom: max(10px, env(safe-area-inset-bottom));
    padding: 0;
  }

  .rb-hero-cta,
  .rb-hero-cta-dual {
    display: grid;
    grid-template-columns: 1fr;
  }

  .rb-footer-grid {
    padding: var(--rb-space-4);
  }

  .rb-footer-company-line {
    font-size: 0.88rem;
    line-height: 1.7;
  }
}


/* ==========================================================
   HOTFIX FINAL — TOPBAR DISCRETO + FOOTER NOVO
   ========================================================== */

/* ---------- TOPBAR ---------- */
.rb-brand-copy {
  display: grid;
  gap: 0.18rem;
  min-width: 0;
}

.rb-brand-title {
  display: block;
  color: var(--rb-text);
  font-size: clamp(1.02rem, 1.15vw, 1.2rem);
  line-height: 1.08;
  letter-spacing: -0.03em;
}

.rb-brand-copy .rb-muted {
  display: block;
  margin: 0;
  font-size: 0.82rem;
  line-height: 1.25;
}

.rb-topbar-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  flex: 0 0 auto;
  padding: 0.62rem 0.92rem;
  border: 1px solid var(--rb-border-accent);
  border-radius: var(--rb-radius-pill);
  background: color-mix(in srgb, var(--rb-brand-3) 10%, transparent);
  color: var(--rb-text);
  font-size: 0.88rem;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
}

/* neutraliza o span gigante antigo */
.rb-brand > span:not(.rb-brand-copy) {
  display: block;
  line-height: 1.05;
  letter-spacing: -0.03em;
  font-size: clamp(1.12rem, 1.3vw, 1.28rem);
  word-break: break-word;
}

/* ---------- FOOTER NOVO ---------- */
.rb-footer-grid {
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  align-items: start;
  gap: clamp(28px, 4vw, 56px);
}

.rb-footer-project,
.rb-footer-nav {
  min-width: 0;
}

.rb-footer-project {
  max-width: 44rem;
}

.footer-note {
  margin: 0;
}

.footer-note + .footer-note {
  margin-top: 0.38rem;
}

.footer-links {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.32rem;
}

.footer-links li {
  margin: 0;
  padding: 0;
}

.footer-links a {
  display: inline;
  width: auto;
  max-width: none;
  line-height: 1.28;
}

.rb-footer-nav {
  justify-self: start;
}

.rb-footer-company-line {
  margin-top: 0;
}

@media (max-width: 980px) {
  .rb-footer-grid {
    grid-template-columns: 1fr;
    gap: var(--rb-space-4);
  }
}

@media (max-width: 640px) {
  .rb-brand-title {
    font-size: 1.08rem;
  }

  .rb-topbar-pill {
    width: auto;
    max-width: 100%;
    white-space: normal;
  }
}