/* ═══════════════════════════════════════════════════════
   REVESTE v7.1 — Layout Mobile
   Compatível: celular pequeno (320px), médio (360-390px),
               grande (412-480px) e tablet Android (601-900px)
   Touch-first · Safe-area · Bottom Nav · Proporcional
═══════════════════════════════════════════════════════ */

/* ─────────────────────────────────────────────────────
   0. VARIÁVEIS MOBILE GLOBAIS
───────────────────────────────────────────────────── */
:root {
  --bottom-nav-h:   64px;
  --safe-bottom:    env(safe-area-inset-bottom, 0px);
  --safe-top:       env(safe-area-inset-top, 0px);
  --touch-min:      44px;   /* mínimo toque Android */
}

/* ─────────────────────────────────────────────────────
   0b. MENU MOBILE — visível em TODOS os breakpoints
   móveis (≤900px). Fora dos @media para que .open
   funcione tanto no celular quanto no tablet.
───────────────────────────────────────────────────── */
#nav-mobile {
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 56px; left: 0; right: 0; bottom: 0;
  background: var(--bg);
  border-top: 1px solid var(--border);
  padding: 16px 14px 20px;
  z-index: 850;
  overflow-y: auto;
  gap: 2px;
  /* Fechado por padrão via visibility para permitir animação */
  visibility: hidden;
  pointer-events: none;
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity .22s ease, transform .22s ease, visibility 0s linear .22s;
}
#nav-mobile.open {
  visibility: visible;
  pointer-events: auto;
  opacity: 1;
  transform: translateY(0);
  transition: opacity .22s ease, transform .22s ease, visibility 0s linear 0s;
}
@media (min-width: 901px) {
  #nav-mobile { display: none !important; }
  /* Garante que a sidebar nunca vire drawer no desktop */
  .filtros-sidebar {
    display: block !important;
    position: sticky !important;
    transform: none !important;
    top: 88px;
    max-height: calc(100vh - 108px);
    visibility: visible !important;
    pointer-events: auto !important;
  }
  .filtros-sidebar-overlay { display: none !important; }
  .filtros-sidebar-close { display: none !important; }
  .filtros-sidebar-actions { display: none !important; }
}
/* ── Conteúdo interno do menu mobile (vale para phone e tablet) ── */
#nav-mobile .nm-search-wrap { position: relative; margin-bottom: 12px; }
#nav-mobile .nm-search {
  background: var(--surface2);
  border: 1.5px solid var(--border);
  border-radius: 30px;
  padding: 11px 18px 11px 44px;
  color: var(--text); font-size: .9rem; outline: none; width: 100%;
}
#nav-mobile .nm-search-icon {
  position: absolute; left: 16px; top: 50%;
  transform: translateY(-50%); color: var(--text3);
}
#nav-mobile a,
#nav-mobile button {
  display: flex; align-items: center;
  min-height: 44px;
  padding: 10px 14px;
  border-radius: 6px;
  font-size: .93rem; color: var(--text2);
  transition: background .15s;
  border: none; text-align: left; width: 100%; background: none;
  cursor: pointer;
}
#nav-mobile a:hover,
#nav-mobile button:hover { background: var(--surface2); color: var(--text); }
#nav-mobile svg          { flex-shrink: 0; color: var(--text3); }
#nav-mobile .nm-divider  { height: 1px; background: var(--border); margin: 6px 0; }
#nav-mobile .nm-logout   { color: var(--danger); }


/* ─────────────────────────────────────────────────────
   1. BREAKPOINT LARGO — até 900px
   Tablet portrait + celulares grandes
───────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .detalhe          { grid-template-columns: 1fr; gap: 24px; }
  .detalhe__galeria { position: static; }
  .home-layout      { grid-template-columns: 1fr; }
  .filtros-sidebar  { display: none; }

  /* Sidebar como drawer mobile */
  .filtros-sidebar-overlay {
    position: fixed; inset: 0; z-index: 1000;
    background: rgba(0,0,0,.45);
    opacity: 0; transition: opacity .28s;
    pointer-events: none;
  }
  .filtros-sidebar-overlay.open { opacity: 1; pointer-events: auto; }
  .filtros-sidebar {
    display: block !important;
    position: fixed; top: 0; left: 0; bottom: 0; z-index: 1001;
    width: min(320px, 88vw);
    max-height: 100dvh; overflow-y: auto;
    border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
    transform: translateX(-110%);
    transition: transform .32s cubic-bezier(.4,0,.2,1);
    padding-top: calc(28px + var(--safe-top));
    padding-bottom: calc(28px + var(--safe-bottom));
    align-self: unset;
  }
  .filtros-sidebar.drawer-open { transform: translateX(0); }
  .filtros-sidebar-close {
    display: flex; align-items: center; justify-content: flex-end;
    margin-bottom: 16px; padding: 0 4px;
  }
  .filtros-sidebar-close button {
    background: none; border: none; cursor: pointer;
    color: var(--text2); padding: 4px;
    display: flex; align-items: center; gap: 6px; font-size: .85rem;
  }
  .filtros-sidebar-actions { display: flex; gap: 10px; margin-top: 8px; }
  .filtros-sidebar-actions .btn-filtros-limpar { flex: 1; }
  .filtros-sidebar-actions .btn-primary { flex: 2; }
  .form-row-3       { grid-template-columns: 1fr 1fr; }
  .auth-page__left  { display: none; }
  .auth-page__right { padding: 40px 28px; }
}

/* ─────────────────────────────────────────────────────
   2. CELULAR — até 600px
   Cobre 320 · 360 · 390 · 412 · 480px
───────────────────────────────────────────────────── */
@media (max-width: 600px) {

  /* ── Corpo geral ──────────────────────────────── */
  body {
    /* reserva espaço para a bottom nav */
    padding-bottom: calc(var(--bottom-nav-h) + var(--safe-bottom));
  }

  .container { padding: 0 14px; }

  /* ── Navbar topo ──────────────────────────────── */
  .navbar { height: 56px; }
  .navbar__inner {
    padding: 0 14px;
    gap: 10px;
    height: 56px;
    max-width: 100%;
  }
  .navbar__search { display: none; }
  .navbar__logo-text { font-size: 1.3rem; letter-spacing: .1em; }

  /* Hamburger (toque fácil) */
  .nav-hamburger {
    display: flex;
    flex-direction: column;
    gap: 5px;
    width: var(--touch-min);
    height: var(--touch-min);
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
  }
  .nav-hamburger span {
    display: block;
    width: 22px; height: 2px;
    background: var(--text);
    border-radius: 2px;
    transition: all .28s;
  }
  .nav-hamburger[aria-expanded="true"] span:nth-child(1) { transform: rotate(45deg)  translate(5px, 5px);  }
  .nav-hamburger[aria-expanded="true"] span:nth-child(2) { opacity: 0; transform: translateX(-6px);        }
  .nav-hamburger[aria-expanded="true"] span:nth-child(3) { transform: rotate(-45deg) translate(5px, -5px); }

  /* ── Menu overlay mobile — visibilidade gerenciada no bloco global acima ── */
  body.mobile-menu-open    { overflow: hidden; touch-action: none; }

  /* ── Bottom Navigation Bar ────────────────────── */
  .bottom-nav {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    height: calc(var(--bottom-nav-h) + var(--safe-bottom));
    padding-bottom: var(--safe-bottom);
    background: var(--navbar-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid var(--border);
    display: flex;
    align-items: stretch;
    z-index: 900;
  }
  .bottom-nav__item {
    flex: 1;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    gap: 3px;
    color: var(--text3);
    font-size: .6rem; font-weight: 500;
    letter-spacing: .03em; text-transform: uppercase;
    transition: color .18s;
    text-decoration: none;
    min-height: var(--touch-min);
    border: none; background: none;
    cursor: pointer; padding: 8px 4px 4px;
    position: relative;
  }
  .bottom-nav__item svg { width: 22px; height: 22px; flex-shrink: 0; }
  .bottom-nav__item.active,
  .bottom-nav__item:hover { color: var(--accent); }
  .bottom-nav__badge {
    position: absolute; top: 6px; right: 50%;
    transform: translateX(10px);
    background: var(--danger); color: #fff;
    font-size: .58rem; font-weight: 700;
    min-width: 16px; height: 16px;
    border-radius: 8px; padding: 0 4px;
    display: flex; align-items: center; justify-content: center;
    line-height: 1;
  }

  /* ── Page main ────────────────────────────────── */
  .page-main {
    min-height: calc(100dvh - 56px);
    padding: 18px 0 32px;
  }

  /* ── Hero home ────────────────────────────────── */
  .home-hero      { padding: 28px 0 20px; max-width: 100%; }
  .home-hero__eyebrow { font-size: .66rem; margin-bottom: 10px; }
  .home-hero h1   { font-size: clamp(1.8rem, 7.5vw, 2.6rem); margin-bottom: 10px; }
  .home-hero p    { font-size: .92rem; margin-bottom: 20px; }
  .home-hero__btns { gap: 10px; }
  .home-hero__btns .btn-primary,
  .home-hero__btns .btn-ghost {
    min-height: var(--touch-min);
    padding: 11px 20px;
    font-size: .875rem;
  }

  /* ── Grid produtos — 2 colunas ────────────────── */
  .produtos-grid,
  .favoritos-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }
  .pcard          { border-radius: var(--radius); overflow: hidden; }
  .pcard__img     { padding-top: 118%; }    /* proporção retrato, sem distorção */
  .pcard__body    { padding: 9px 9px 11px; }
  .pcard__cat     { font-size: .64rem; margin-bottom: 4px; }
  .pcard__nome    { font-size: .9rem;  margin-bottom: 7px; min-height: calc(.9rem * 1.3 * 2); }
  .pcard__tags    { gap: 4px; margin-bottom: 7px; }
  .pcard__preco   { font-size: .95rem; }
  .pcard__loja    { font-size: .68rem; }
  .pcard__fav     { width: 34px; height: 34px; } /* toque fácil */

  /* ── Filtros — botão FAB discreto (canto direito) ────────── */
  .filtros-mobile-btn {
    position: fixed;
    bottom: calc(var(--bottom-nav-h) + var(--safe-bottom) + 12px);
    right: 14px;
    left: auto;
    transform: none;
    z-index: 800;
    display: flex; align-items: center; gap: 6px;
    background: var(--surface);
    color: var(--text2);
    border: 1px solid var(--border);
    padding: 10px 16px;
    border-radius: 30px;
    font-size: .8rem; font-weight: 500;
    box-shadow: var(--shadow-md);
    white-space: nowrap;
    min-height: var(--touch-min);
    transition: background .18s, color .18s, border-color .18s, box-shadow .18s;
  }
  .filtros-mobile-btn:active {
    background: var(--surface2);
    color: var(--text);
    border-color: var(--border2);
  }
  /* Badge de filtros ativos */
  .filtros-mobile-badge {
    background: var(--accent);
    color: #fff;
    font-size: .6rem; font-weight: 700;
    min-width: 16px; height: 16px;
    border-radius: 8px; padding: 0 4px;
    display: flex; align-items: center; justify-content: center;
    line-height: 1;
  }



  /* ── Seções ───────────────────────────────────── */
  .section        { margin-bottom: 36px; }
  .section-header { margin-bottom: 14px; padding-bottom: 10px; }
  .section-title  { font-size: 1.3rem; }

  /* ── Detalhe produto ──────────────────────────── */
  .detalhe        { grid-template-columns: 1fr; gap: 0; }
  .detalhe__preco { font-size: 1.8rem; }
  .detalhe__specs { grid-template-columns: 1fr 1fr; gap: 10px; }
  .detalhe__acoes { flex-wrap: wrap; gap: 10px; }
  .btn-interesse  { flex: 1 0 100%; min-height: var(--touch-min); }
  .btn-oferta-produto { flex: 1; min-height: var(--touch-min); justify-content: center; }
  .detalhe__info .breadcrumb { font-size: .7rem; }

  /* ── Auth ─────────────────────────────────────── */
  .auth-page          { align-items: flex-start; }
  .auth-page__right   { width: 100%; padding: 28px 14px; align-items: flex-start; }
  .auth-card          { max-width: 100%; }
  .auth-card__title   { font-size: 1.5rem; }

  /* ── Forms / Inputs ───────────────────────────── */
  .form-row, .form-row-3 { grid-template-columns: 1fr; }
  .form-produto-layout   { padding: 14px 0 calc(80px + var(--safe-bottom)); }

  /* font-size: 16px evita zoom automático no Android */
  .input-field, .input-sm {
    font-size: 16px !important;
    min-height: var(--touch-min);
    padding: 10px 13px;
  }
  select.input-field   { min-height: var(--touch-min); }
  textarea.input-field { min-height: 96px; font-size: 15px !important; }

  /* Botões touch-friendly */
  .btn-primary, .btn-secondary,
  .btn-ghost,   .btn-accent, .btn-danger {
    min-height: var(--touch-min);
  }
  .btn-primary-sm, .btn-secondary-sm,
  .btn-ghost-sm,   .btn-danger-sm {
    min-height: 38px; padding: 8px 14px;
  }

  /* ── Perfil ───────────────────────────────────── */
  .perfil-layout  { padding: 18px 0 calc(80px + var(--safe-bottom)); }
  .perfil-header  {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 12px;
    padding: 20px 16px;
  }
  .perfil-avatares {
    justify-content: center;
    align-items: flex-end;
    gap: 24px;
    width: 100%;
  }
  .perfil-avatar-slot { align-items: center; }
  #pf-avatar, #pf-avatar-loja { width: 68px; height: 68px; }
  .perfil-header__info {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    width: 100%;
  }
  .perfil-header__info h2 { font-size: 1.2rem; }
  .perfil-header a.btn-ghost-sm { margin-left: 0; align-self: center; }
  .pf-tabs        { overflow-x: auto; -webkit-overflow-scrolling: touch; padding-bottom: 2px; }
  .pf-tab         { white-space: nowrap; min-height: var(--touch-min); }
  .pf-panel       { padding: 18px 14px; }

  /* ── Meus Produtos ────────────────────────────── */
  .meu-card       { flex-direction: column; }
  .meu-card img   { width: 100%; height: 150px; object-fit: cover; }
  .meu-card__acoes { flex-wrap: wrap; }
  .meu-card__acoes .btn-secondary-sm,
  .meu-card__acoes .btn-danger-sm  { flex: 1; justify-content: center; }

  /* ── Lojas ────────────────────────────────────── */
  .lojas-grid     { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .lojas-filtros  { flex-direction: column; gap: 8px; }
  .lojas-filtros .input-field--sm { width: 100%; min-width: 0; }
  #grid-lojas-home { grid-template-columns: repeat(2, 1fr); gap: 10px; }

  /* ── Chat ─────────────────────────────────────── */
  .chat-page {
    height: calc(100dvh - 56px - var(--bottom-nav-h) - var(--safe-bottom));
    flex-direction: column;
  }
  .chat-lista {
    width: 100%; max-width: 100%;
    border-right: none; border-bottom: 1px solid var(--border);
    flex-shrink: 0; max-height: 44dvh;
  }
  /* Quando uma conversa está aberta: oculta a lista */
  .chat-page.conversa-aberta .chat-lista { display: none; }
  .chat-page.conversa-aberta .chat-main  { flex: 1; }
  .chat-lista__header   { padding: 12px 14px; }
  .chat-lista__titulo   { font-size: 1.15rem; }
  .chat-input-wrap      { padding-bottom: max(12px, var(--safe-bottom)); }
  .chat-header__back    {
    display: flex; min-width: var(--touch-min); min-height: var(--touch-min);
    align-items: center; justify-content: center;
  }

  /* ── Modal genérico (bottom sheet) ───────────── */
  .modal-overlay  { align-items: flex-end; }
  .modal-inner {
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    padding: 22px 14px calc(22px + var(--safe-bottom));
    width: 100%; max-height: 92dvh; overflow-y: auto;
  }
  .modal-ser-vendedor__inner { padding: 22px 14px; }

  /* ── Miscelânea ───────────────────────────────── */
  .btn-tema-float   { display: none; } /* tema fica no menu mobile */
  .footer__inner    { flex-direction: column; gap: 12px; text-align: center; }
  .footer__links    { flex-wrap: wrap; gap: 12px; justify-content: center; }
  .footer           { padding-bottom: calc(var(--bottom-nav-h) + var(--safe-bottom) + 12px); }
  .promo-calc__grid { grid-template-columns: 1fr; }
  #rv-ob-tooltip    { width: calc(100vw - 28px); }
  .tipo-selector    { flex-direction: column; gap: 8px; }
  .tipo-selector > *{ width: 100%; min-height: var(--touch-min); }
  .breadcrumb       { flex-wrap: wrap; gap: 4px; }
  .tag              { font-size: .68rem; padding: 3px 8px; }
  .resultado-count  { font-size: .74rem; }
  .config-layout    { padding: 18px 0 calc(80px + var(--safe-bottom)); }
  .pf-tabs          { scrollbar-width: none; }
  .pf-tabs::-webkit-scrollbar { display: none; }

  /* Carrossel de categorias — scroll horizontal suave */
  .cat-quick-grid {
    display: flex; overflow-x: auto; gap: 10px; padding-bottom: 6px;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .cat-quick-grid::-webkit-scrollbar { display: none; }
  .cat-quick-grid > * { flex-shrink: 0; scroll-snap-align: start; }
}

/* ─────────────────────────────────────────────────────
   3. TELAS MUITO PEQUENAS — até 360px
   Moto E · Galaxy A03 · telefones básicos Android
───────────────────────────────────────────────────── */
@media (max-width: 360px) {
  .container        { padding: 0 10px; }
  .navbar__logo-text{ font-size: 1.2rem; }
  .produtos-grid,
  .favoritos-grid   { gap: 8px; }
  .pcard__body      { padding: 7px 7px 9px; }
  .pcard__nome      { font-size: .82rem; }
  .pcard__preco     { font-size: .88rem; }
  .home-hero h1     { font-size: clamp(1.65rem, 7vw, 2rem); }
  .detalhe__preco   { font-size: 1.55rem; }
  .lojas-grid,
  #grid-lojas-home  { grid-template-columns: 1fr 1fr; gap: 8px; }
  .section-title    { font-size: 1.2rem; }
  .auth-card__title { font-size: 1.4rem; }
  .pf-panel         { padding: 14px 10px; }
  #pf-avatar, #pf-avatar-loja { width: 60px; height: 60px; }
}

/* ─────────────────────────────────────────────────────
   4. TELAS MUITO PEQUENAS — até 320px
   Dispositivos antigos / relíquias
───────────────────────────────────────────────────── */
@media (max-width: 320px) {
  .container        { padding: 0 8px; }
  .bottom-nav__item { font-size: .55rem; }
  .bottom-nav__item svg { width: 20px; height: 20px; }
  .pcard__img       { padding-top: 110%; }
  .home-hero h1     { font-size: 1.5rem; }
  .navbar__logo-text{ font-size: 1.1rem; }
}

/* ─────────────────────────────────────────────────────
   5. TABLET ANDROID — 601px a 900px
   Samsung Tab A7 · Galaxy Tab S6 · Tab A8 (portrait)
───────────────────────────────────────────────────── */
@media (min-width: 601px) and (max-width: 900px) {

  .container    { padding: 0 24px; }
  .navbar       { height: 60px; }
  .navbar__inner{ padding: 0 24px; height: 60px; max-width: 100%; }
  .nav-hamburger{ display: flex; }

  /* Sem bottom nav no tablet — usa hamburger */
  .bottom-nav { display: none; }
  body        { padding-bottom: 0; }
  .footer     { padding-bottom: 0; }
  .btn-tema-float { bottom: 24px; right: 20px; }
  .filtros-mobile-btn {
    bottom: 24px;
    right: 20px;
    left: auto;
    transform: none;
  }
  /* No tablet a navbar tem 60px → ajusta posição do menu */
  #nav-mobile { top: 60px; }

  /* 3 colunas no tablet */
  .produtos-grid,
  .favoritos-grid { grid-template-columns: repeat(3, 1fr); gap: 16px; }
  .lojas-grid,
  #grid-lojas-home { grid-template-columns: repeat(3, 1fr); gap: 14px; }

  .home-hero h1 { font-size: clamp(2.2rem, 4.5vw, 3rem); }

  /* Chat lado a lado no tablet */
  .chat-page    { flex-direction: row; height: calc(100dvh - 60px); }
  .chat-lista   { max-height: none; width: 300px; border-right: 1px solid var(--border); border-bottom: none; }
  .chat-page.conversa-aberta .chat-lista { display: flex; }

  /* Auth tablet */
  .auth-page__right { padding: 48px 44px; }
  .auth-card        { max-width: 420px; }

  /* Forms tablet */
  .form-row   { grid-template-columns: 1fr 1fr; }
  .form-row-3 { grid-template-columns: 1fr 1fr 1fr; }
  .form-produto-layout { padding: 24px 0 80px; }
  .tipo-selector    { flex-direction: row; }

  /* Page main */
  .page-main  { padding: 28px 0 60px; }

  /* Perfil tablet */
  .perfil-layout { padding: 28px 0 60px; }
  #pf-avatar     { width: 80px; height: 80px; }

  .meu-card { flex-direction: row; }
  .meu-card img { width: 110px; height: auto; }

  /* Inputs tablet — volta ao tamanho normal */
  .input-field, .input-sm { font-size: .9rem !important; }
}

/* Tablet landscape: 2 colunas no detalhe */
@media (min-width: 601px) and (max-width: 900px) and (orientation: landscape) {
  .detalhe        { grid-template-columns: 1fr 1fr; gap: 36px; }
  .detalhe__galeria{ position: sticky; top: 80px; }
  .produtos-grid,
  .favoritos-grid { grid-template-columns: repeat(4, 1fr); }
}

/* ─────────────────────────────────────────────────────
   6. UTILITÁRIOS MOBILE
───────────────────────────────────────────────────── */

/* Scroll horizontal suave */
.scroll-x {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.scroll-x::-webkit-scrollbar { display: none; }

/* Visibilidade condicional */
@media (max-width: 600px) {
  .hide-mobile { display: none !important; }
  .show-mobile { display: revert !important; }
  .nav-desktop-only { display: none !important; }
}
@media (min-width: 601px) {
  .show-mobile { display: none !important; }
}

/* ─────────────────────────────────────────────────────
   7. CORREÇÕES DE SCROLL LATERAL (overflow-x)
   Previne scroll horizontal em dispositivos pequenos/antigos
───────────────────────────────────────────────────── */
@media (max-width: 600px) {

  /* Garante que nenhum elemento filho vaze a tela */
  .page-main,
  .container,
  .perfil-layout,
  .config-layout,
  .form-produto-layout,
  .auth-page,
  .detalhe,
  .chat-page,
  .home-layout {
    max-width: 100vw;
    overflow-x: hidden;
  }

  /* Cards de produto — sem extrapolação */
  .pcard {
    min-width: 0;
    max-width: 100%;
  }

  /* Perfil info grid — colapsa em 1 coluna, sem vazar */
  .perfil-info-grid {
    grid-template-columns: 1fr;
  }

  /* Histórico tabs — cabe na tela */
  .historico-tabs {
    flex-wrap: wrap;
    gap: 2px;
  }
  .historico-tab {
    flex: 1;
    min-width: 0;
    text-align: center;
    font-size: .75rem;
    padding: 5px 8px;
  }

  /* Histórico card — texto não vaza */
  .historico-card {
    min-width: 0;
    overflow: hidden;
  }
  .historico-card__nome {
    font-size: .82rem;
  }
  .historico-card__meta {
    font-size: .7rem;
    gap: 6px;
  }
  .historico-card__preco {
    font-size: .85rem;
  }

  /* Métricas de vendedor — 3 col. em telas ≥ 360, 1 col. abaixo */
  .historico-metricas {
    gap: 8px;
  }
  .historico-metrica {
    padding: 10px 12px;
    min-width: 0;
  }

  /* Sections title — sem overflow */
  .section-title,
  .historico-section__title {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
  }

  /* Detalhe specs — garante que não vaze */
  .detalhe__specs {
    grid-template-columns: 1fr 1fr;
    overflow: hidden;
  }

  /* Tabela-like rows no perfil */
  .perfil-info-row strong {
    max-width: 55vw;
    word-break: break-word;
    white-space: normal;
    text-align: right;
  }

  /* Stats do perfil — sem scroll lateral */
  .perfil-stats {
    overflow-x: hidden;
    flex-wrap: wrap;
  }
  .perfil-stat {
    flex: 1;
    min-width: calc(50% - 8px);
    padding: 12px 10px;
  }

  /* Toast — fica dentro da tela */
  #toast-wrap {
    bottom: calc(var(--bottom-nav-h) + var(--safe-bottom) + 12px);
  }

  /* Onboarding tooltip — não vaza */
  #rv-ob-tooltip {
    max-width: calc(100vw - 28px);
    left: 14px !important;
    right: 14px !important;
    width: auto !important;
  }

  /* Imagens em geral */
  img { max-width: 100%; height: auto; }

  /* Pre / code — scroll dentro do elemento, não na página */
  pre, code {
    max-width: 100%;
    overflow-x: auto;
    word-break: break-all;
  }
}

@media (max-width: 360px) {
  /* Em telas muito pequenas, metricas em 1 coluna */
  .historico-metrica { min-width: 100%; }
  .historico-metricas { flex-direction: column; }

  /* Perfil stat ocupa linha inteira */
  .perfil-stat { min-width: 100%; }

  /* Texto do histórico ainda menor */
  .historico-card__nome  { font-size: .78rem; }
  .historico-card__preco { font-size: .8rem; }
}
