/* CrediFlex | Interface para WebView Android/iOS.
 * Mobile-first: rolagem vertical única, áreas seguras, teclado, navegação e acessibilidade.
 * Nunca fixa o body ou impede a rolagem dos conteúdos financeiros.
 */
:root { color-scheme: light; --native-safe-bottom: env(safe-area-inset-bottom, 0px); --native-safe-top: env(safe-area-inset-top, 0px); }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
html, body { min-width: 0; }
body.seller-app, body.portal-body, body.catalog-body, body.auth-body {
  -webkit-tap-highlight-color: transparent;
  touch-action: auto;
}
body.seller-app, body.portal-body, body.catalog-body { min-height: 100vh; min-height: 100dvh; }
body.seller-app :where(button, a, input, select, textarea),
body.portal-body :where(button, a, input, select, textarea),
body.catalog-body :where(button, a, input, select, textarea),
body.auth-body :where(button, a, input, select, textarea) { -webkit-tap-highlight-color: rgba(31,83,180,.12); }
body.seller-app :where(input, textarea, select),
body.portal-body :where(input, textarea, select),
body.catalog-body :where(input, textarea, select),
body.auth-body :where(input, textarea, select) { font-size: 16px !important; max-width: 100%; }
body.seller-app :where(input, textarea, select):focus-visible,
body.portal-body :where(input, textarea, select):focus-visible,
body.catalog-body :where(input, textarea, select):focus-visible,
body.auth-body :where(input, textarea, select):focus-visible { outline: 2px solid #5287e2; outline-offset: 2px; }
:where(body.seller-app, body.portal-body, body.catalog-body, body.auth-body) :where(img,video,svg,canvas) { max-width: 100%; }
:where(body.seller-app, body.portal-body, body.catalog-body, body.auth-body) :where(p,h1,h2,h3,h4,strong,small) { overflow-wrap: anywhere; }
:where(body.seller-app, body.portal-body, body.catalog-body, body.auth-body) :where(main,article,section,form) { min-width: 0; }
:where(body.seller-app, body.portal-body, body.catalog-body, body.auth-body) :where(button,a):focus-visible { outline: 2px solid #5287e2; outline-offset: 3px; }

/* Mensagens reais de rede, sem barra visual de carregamento. */
.native-webview-network {
  position: fixed; inset-inline: max(10px, env(safe-area-inset-left, 0px)) max(10px, env(safe-area-inset-right, 0px));
  top: calc(8px + var(--native-safe-top)); z-index: 12000;
  display: flex; align-items: center; justify-content: center; gap: 12px;
  padding: 12px 14px; background: #fff7ed; color: #8d3b0d;
  border: 1px solid #fed7aa; border-radius: 14px; box-shadow: 0 12px 36px #142a4b25;
  font: 500 12px/1.5 system-ui,sans-serif;
}
.native-webview-network[hidden] { display: none !important; }
.native-webview-network button { flex-shrink:0; border: 1px solid #f6b67a; border-radius: 10px; background: #fff; color: #8d3b0d; padding: 10px 12px; font: inherit; font-weight:700; min-height: 44px; }

/* Área do vendedor: menu inferior sempre alcançável, conteúdo solto no viewport. */
body.seller-app { overflow-x: clip !important; overflow-y: visible !important; }
body.seller-app .seller-content {
  width: 100%; max-width: 1160px; height: auto !important; overflow-y: visible !important;
  padding-bottom: calc(112px + var(--native-safe-bottom)) !important;
}
body.seller-app .seller-bottom-nav { padding-bottom: max(8px,var(--native-safe-bottom)); }
body.seller-app .seller-bottom-nav a { touch-action: manipulation; min-height: 48px; }
body.seller-app .seller-bottom-nav a:active { background: #eef4ff; }
body.seller-app .seller-account-card, body.seller-app .seller-flow-hero,
body.seller-app .seller-welcome, body.seller-app .seller-profile { background-image: none !important; }
body.seller-app .seller-flow-section[hidden], body.seller-app [data-wizard-step][hidden],
body.seller-app [data-qty-add][hidden],body.seller-app [data-wizard-quantity][hidden],
body.seller-app .seller-flow-back[hidden],body.seller-app .seller-flow-next[hidden],
body.seller-app .seller-flow-submit[hidden] { display: none !important; }
body.seller-app .seller-flow-error:not([hidden]) { scroll-margin: 95px; }
body.seller-app .seller-flow-actionbar { background: #fff !important; backdrop-filter: none !important; }
body.seller-app .seller-flow-chips { -webkit-overflow-scrolling: touch; scrollbar-width: none; }
body.seller-app .seller-flow-chips::-webkit-scrollbar { display:none; }
body.seller-app .seller-flow-customer-grid { overscroll-behavior-y: auto !important; -webkit-overflow-scrolling: touch; }
body.seller-app .seller-trend-card svg { max-width: 100%; }
body.seller-app .seller-account-card::after,body.seller-app .seller-flow-hero::after { display: none !important; content: none !important; }
body.seller-app .seller-flow-hero__mark { border:0 !important; background: transparent !important; box-shadow:none !important; width:auto !important; height:auto !important; flex:0 0 auto !important; padding:0 !important; border-radius:0 !important; }

/* Portal do cliente: preservar cabeçalhos e resumo, aumentar as áreas tocáveis. */
body.portal-body { overflow-x: clip !important; overflow-y: visible !important; }
body.portal-body .portal-shell { max-width:100%; min-width:0; padding-bottom:calc(100px + var(--native-safe-bottom)); }
body.portal-body .portal-content { max-width:100%; min-width:0; }
body.portal-body .portal-nav { padding-bottom:max(8px,var(--native-safe-bottom)) !important; }
body.portal-body .portal-nav a { min-width:0; touch-action:manipulation; }
body.portal-body .portal-nav a:active { background:#eef4ff; }
body.portal-body :where(.portal-invoice-action,.portal-purchase-action,.portal-filter-pill,.portal-quick-link,.portal-store-favorites-link) { min-height:44px; }
body.portal-body :where(.portal-invoice-card,.portal-purchase-card,.portal-card,.portal-store-product-card) { min-width:0; }
body.portal-body :where(.portal-invoice-list,.portal-purchase-list,.portal-store-grid) { min-width:0; max-width:100%; }
body.portal-body .portal-store-product-card--clean form button { min-height:44px !important; }
body.portal-body :where(.portal-invoice-filters,.portal-purchase-filters,.portal-store-categories--clean) { -webkit-overflow-scrolling:touch; }

/* Catálogo público dentro do app: cards compactos e menu seguro nas bordas. */
body.catalog-body { overflow-x:clip !important; overflow-y:visible !important; }
body.catalog-body .catalog-mobile-nav { padding-bottom:max(8px,var(--native-safe-bottom)); }
body.catalog-body .catalog-mobile-nav a { min-height:48px; touch-action:manipulation; }
body.catalog-body :where(.catalog-product,.catalog-product__picture,.catalog-wrap) { min-width:0; }
body.catalog-body :where(input,select,textarea) { min-height:44px; }

@media (max-width: 719px) {
  /* Cabeçalho do vendedor permanece visível no celular. */
  body.seller-app .seller-content {
    padding: calc(14px + var(--native-safe-top)) max(12px,env(safe-area-inset-right,0px)) calc(105px + var(--native-safe-bottom)) max(12px,env(safe-area-inset-left,0px)) !important;
  }
  body.seller-app .seller-home-dashboard, body.seller-app .seller-flow-shell { min-width:0; }
  body.seller-app .seller-flow-progress { gap:4px; }
  body.seller-app .seller-flow-progress button { min-height:46px !important; touch-action:manipulation; }
  body.seller-app .seller-flow-progress button small { white-space:normal !important; font-size:clamp(9px,2.7vw,11px); }
  body.seller-app .seller-flow-section { padding:clamp(12px,3.7vw,18px) !important; }
  body.seller-app .seller-flow-product-grid { grid-template-columns:repeat(2,minmax(0,1fr)) !important; gap:clamp(7px,2.5vw,12px); }
  body.seller-app .seller-shop-product__photo { min-width:0; }
  body.seller-app .seller-shop-product__details h3 { min-width:0; line-height:1.35; }
  body.seller-app .seller-shop-product__qty button { min-width:44px; min-height:44px; }
  body.seller-app .seller-flow-next,body.seller-app .seller-flow-submit,body.seller-app .seller-flow-back { min-height:48px; }
  body.seller-app .seller-flow-actionbar {
    bottom: calc(70px + var(--native-safe-bottom));
    margin-bottom:10px; border-radius:15px; z-index:38;
  }
  body.seller-app .seller-bottom-nav { min-height:62px; }
  body.seller-app .seller-bottom-nav a { min-height:48px; }
  body.seller-app .seller-flow-customer-grid { max-height:none !important; overflow-y:visible !important; }

  body.portal-body .portal-content { padding-inline:max(12px,env(safe-area-inset-left,0px)) !important; }
  body.portal-body .portal-nav { width:100%; left:0; right:0; }
  body.portal-body .portal-nav a { font-size:clamp(9px,2.65vw,11px) !important; line-height:1.2; }
  body.portal-body .portal-nav a span { min-height:27px !important; }
  body.portal-body .portal-nav a svg { height:24px !important; width:24px !important; }
  body.portal-body .portal-nav a .bi { font-size:23px !important; }
  body.portal-body .portal-home-list__item { min-height:58px; }
  body.portal-body .portal-store-grid--clean { grid-template-columns:repeat(2,minmax(0,1fr)) !important; }
  body.portal-body .portal-store-search--header input { font-size:16px !important; }

  body.catalog-body .catalog-header { max-width:100%; }
  body.catalog-body :where(.catalog-header__nav a,.catalog-mobile-nav a) { touch-action:manipulation; }
}
@media (max-width: 340px) {
  body.seller-app .seller-content { padding-inline:10px !important; }
  body.seller-app .seller-flow-section { padding:10px !important; }
  body.seller-app .seller-account-card__actions { gap:6px !important; }
  body.seller-app .seller-account-card__actions a { font-size:10px !important; }
  body.seller-app .seller-flow-actionbar { flex-wrap:wrap; }
  body.seller-app .seller-flow-actionbar__total { flex-basis:100%; }
  body.portal-body .portal-nav a { font-size:9px !important; }
}
/* Compact landscape devices: save vertical room for content. */
@media (max-height:490px) and (orientation:landscape) and (max-width:950px) {
  body.seller-app .seller-bottom-nav a { min-height:42px; }
  body.seller-app .seller-bottom-nav a i { font-size:18px; }
  body.seller-app .seller-content { padding-bottom:88px !important; }
  body.portal-body .portal-nav a svg { height:20px !important; width:20px !important; }
  body.portal-body .portal-nav a { font-size:9px !important; }
}
/* Keyboard: free the viewport, hide bottom bars temporarily, no clipped inputs. */
@media (max-width: 950px) {
  body.native-keyboard-open.portal-body .portal-nav,
  body.native-keyboard-open.catalog-body .catalog-mobile-nav { display:none !important; }
  body.native-keyboard-open.seller-app .seller-flow-actionbar { position:relative !important; bottom:auto !important; }
  body.native-keyboard-open.seller-app .seller-content { padding-bottom:24px !important; }
  body.native-keyboard-open.portal-body .portal-shell { padding-bottom:20px !important; }
}
@media (prefers-reduced-motion: reduce) {
  body.seller-app *,body.portal-body *,body.catalog-body * { scroll-behavior:auto !important; }
}

/* Painel administrativo no telefone/WebView: conteúdo flexível e tabelas com rolagem local. */
body.admin-app { overflow-x:clip; min-height:100dvh; }
body.admin-app .app-shell,body.admin-app .main,body.admin-app .content { min-width:0; }
body.admin-app .content :where(.panel,.card,.table-responsive,.responsive-table,.grid,.toolbar) { min-width:0; max-width:100%; }
body.admin-app .content :where(.table-responsive,.table-scroll) { overflow-x:auto; -webkit-overflow-scrolling:touch; }
body.admin-app .content img { max-width:100%; height:auto; }
body.admin-app :where(input,textarea,select) { font-size:16px !important; }
@media (max-width: 719px) {
  body.admin-app .content { padding:16px max(12px,env(safe-area-inset-left,0px)) calc(106px + var(--native-safe-bottom)) !important; }
  body.admin-app .mobile-nav { padding-bottom:max(8px,var(--native-safe-bottom)); }
  body.admin-app .mobile-nav :where(a,button) { min-height:48px; }
  body.admin-app .mobile-more-drawer { max-height:calc(100dvh - var(--native-safe-top)); overflow-y:auto; padding-bottom:calc(20px + var(--native-safe-bottom)); }
  body.admin-app .mobile-more-drawer__nav a { min-height:46px; }
  body.admin-app :where(.page-title,.toolbar,.report-toolbar) { flex-wrap:wrap; }
  body.admin-app :where(.form-grid,.grid.cols-3,.grid.cols-4) { min-width:0; }
}
@media (max-width:950px) { body.native-keyboard-open.admin-app .mobile-nav { display:none !important; } }

/* Login e formulários públicos: campos grandes, sem zoom involuntário no Android/iOS. */
body.auth-body :where(.auth-card,.portal-login-card,.auth-form,.portal-login-form) { max-width:min(100%,460px); min-width:0; }
body.auth-body :where(button[type="submit"],.portal-login-submit) { min-height:48px; }
body.auth-body :where(.field input,.field select,.field textarea) { min-height:48px; }
body.privacy-app :where(input,select,textarea) { font-size:16px !important; }
@media(max-width:540px) {
  body.auth-body { min-height:100dvh; overflow-x:clip; padding-left:max(12px,env(safe-area-inset-left,0px)); padding-right:max(12px,env(safe-area-inset-right,0px)); padding-bottom:calc(22px + var(--native-safe-bottom)); }
  body.auth-body :where(.auth-card,.portal-login-card) { width:100%; margin-inline:auto; }
}

/* Controles de navegação no TOP BAR do aplicativo (não no rodapé).
 * A barra participa do fluxo da página e fica presa ao alto ao rolar,
 * sem cobrir o cabeçalho, menus ou campos de formulário. */
.native-history-bar { display: none; }
@media (max-width: 950px) {
  body.seller-app > .native-history-bar {
    display: flex !important;
    align-items: center;
    justify-content: center;
    gap: 8px;
    position: sticky;
    top: 0;
    z-index: 1100;
    width: 100%;
    min-height: calc(46px + var(--native-safe-top));
    padding: calc(4px + var(--native-safe-top)) max(12px, env(safe-area-inset-right, 0px)) 4px max(12px, env(safe-area-inset-left, 0px));
    box-sizing: border-box;
    transform: none;
    border: 0;
    border-bottom: 1px solid #dbe6f8;
    border-radius: 0;
    background: #fff;
    color: #1456c7;
    box-shadow: 0 1px 6px rgba(10,37,85,.07);
  }
  .native-history-bar button {
    display: inline-flex; align-items: center; justify-content: center; gap: 7px;
    flex: 0 1 130px; min-width: 0; min-height: 38px;
    padding: 7px 12px; border: 0; border-radius: 9px;
    background: transparent; font: 600 13px/1 system-ui,sans-serif;
    color: inherit; touch-action: manipulation;
  }
  .native-history-bar button:disabled { opacity: .35; cursor: default; }
  .native-history-bar button:not(:disabled):active { background: #edf4ff; }
  .native-history-bar button:focus-visible { outline: 2px solid #2563eb; outline-offset: -3px; }
  .native-history-separator { width: 1px; height: 20px; align-self: center; background: #dae4f4; }
  /* Barra superior continua visível no preenchimento de formulários. */
}
