/* Facility Gestão v0.9 — reparos reais de layout em telas pequenas.
 * Aplicação isolada à loja TechCell: catálogo e painel administrativo.
 * Carregado DEPOIS dos estilos existentes para evitar substituí-los.
 */
@media (max-width: 767px) {
  html, body { width: 100%; max-width: 100%; overflow-x: clip; }
  body.theme-techcell #app,
  body.theme-techcell .layout,
  body.theme-techcell .layout-techcell,
  body.theme-techcell .main,
  body.theme-techcell .content,
  body.theme-techcell .shop,
  body.theme-techcell .shop-v2 {
    width: 100%; max-width: 100%; min-width: 0;
  }
  body.theme-techcell .layout-techcell { display: block; }
  body.theme-techcell .layout-techcell .sidebar {
    position: relative; width: 100%; max-width: 100%; min-width: 0;
    height: auto; overflow: visible; padding: 12px;
    display: grid; grid-template-columns: minmax(0,1fr) auto;
    gap: 8px; align-items: center;
  }
  body.theme-techcell .layout-techcell .techcell-sidebar-brand {
    grid-column: 1 / -1; width: 100%; padding: 0 0 8px;
  }
  body.theme-techcell .layout-techcell .techcell-sidebar-brand .techcell-logo {
    width: min(152px,100%); height: 78px; max-width: 100%;
  }
  body.theme-techcell .layout-techcell .store-select {
    grid-column: 1; display: block; width: 100%; max-width: 100%;
    min-width: 0; margin: 0;
  }
  body.theme-techcell .layout-techcell .store-select select { min-width: 0; max-width: 100%; }
  body.theme-techcell .layout-techcell .mobile-menu {
    grid-column: 2; display: inline-flex; float: none; margin: 0;
    min-height: 44px; white-space: nowrap;
  }
  body.theme-techcell .layout-techcell .sidebar-nav {
    grid-column: 1 / -1; width: 100%; max-width: 100%; min-width: 0;
  }
  body.theme-techcell .layout-techcell .sidebar-foot { display: none; }
  body.theme-techcell .layout-techcell .topbar {
    width: 100%; max-width: 100%; min-width: 0;
    position: relative; display: flex; flex-wrap: wrap; align-items: flex-start;
    padding: 11px 14px; gap: 10px;
  }
  body.theme-techcell .layout-techcell .topbar > .flex {
    display: flex; flex: 1 1 100%; width: 100%; min-width: 0;
    max-width: 100%; flex-wrap: wrap; gap: 7px 10px;
  }
  body.theme-techcell .layout-techcell .topbar > .flex b {
    flex: 1 1 180px; min-width: 0; overflow-wrap: anywhere;
    font-size: 14px; line-height: 1.35;
  }
  body.theme-techcell .layout-techcell .topbar > .flex:last-child {
    justify-content: flex-start; gap: 8px;
  }
  body.theme-techcell .layout-techcell .topbar .btn {
    min-height: 38px; max-width: 100%; white-space: normal; text-align: center;
    font-size: 12px; line-height: 1.3;
  }
  body.theme-techcell .layout-techcell .content {
    padding: 16px 12px 70px; margin: 0 auto;
  }
  body.theme-techcell .layout-techcell .content *,
  body.theme-techcell .layout-techcell .modal * { box-sizing: border-box; }
  body.theme-techcell .layout-techcell .content :is(.panel,.ordercard,.page-title,.section-card,.filterbar,.formgrid,.grid2,.grid3,.grid4,.ordergrid,.tbl-scroll,.os-section,.os-item) {
    min-width: 0; max-width: 100%;
  }
  body.theme-techcell .layout-techcell .content :is(.grid2,.grid3,.grid4,.ordergrid,.formgrid) {
    grid-template-columns: minmax(0,1fr);
  }
  body.theme-techcell .layout-techcell .content :is(.grid2,.grid3,.grid4,.formgrid) > * {
    min-width: 0; max-width: 100%;
  }
  body.theme-techcell .layout-techcell .content .span2,
  body.theme-techcell .layout-techcell .content .formgrid .full { grid-column: auto; }
  body.theme-techcell .layout-techcell .content .page-title {
    flex-wrap: wrap; align-items: flex-start; gap: 12px;
  }
  body.theme-techcell .layout-techcell .content .page-title > * { min-width: 0; max-width: 100%; }
  body.theme-techcell .layout-techcell .content .page-title h1 { font-size: clamp(22px,6vw,29px); }
  body.theme-techcell .layout-techcell :is(input,textarea,select) { max-width: 100%; min-width: 0; }
  body.theme-techcell .layout-techcell .content :is(.tbl-scroll,.scrollbox) {
    overflow-x: auto; overscroll-behavior-inline: contain;
  }
  body.theme-techcell .layout-techcell .content :is(.filterbar,.between,.kpis) {
    min-width: 0; max-width: 100%; flex-wrap: wrap;
  }
  body.theme-techcell .layout-techcell .content .filterbar > * { max-width: 100%; }
  body.theme-techcell .layout-techcell .os-item {
    display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr);
  }
  body.theme-techcell .layout-techcell .os-item > :first-child { grid-column: 1 / -1; }
  body.theme-techcell .layout-techcell .os-item .btn { grid-column: 1 / -1; }
  body.theme-techcell .layout-techcell .tc-admin-heading {
    display: flex; flex-direction: column; align-items: flex-start; gap: 12px;
  }
  body.theme-techcell .layout-techcell .tc-dashboard-stats { grid-template-columns: repeat(2,minmax(0,1fr)); }
  body.theme-techcell .layout-techcell .tc-dashboard-lower { grid-template-columns: minmax(0,1fr); }
  body.theme-techcell .layout-techcell .tc-actions-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }

  /* Catálogo: nenhum contêiner pode ampliar o documento além da tela. */
  body.theme-techcell .shop-v2 { padding-top: 8px; min-width: 0; }
  body.theme-techcell .shop-v2 .tc-showcase {
    box-sizing: border-box; width: calc(100% - 20px); max-width: calc(100% - 20px);
    min-width: 0; margin: 0 auto 20px; border-radius: 16px;
  }
  body.theme-techcell .shop-v2 .tc-showcase .shop-head-inner {
    box-sizing: border-box; width: 100%; max-width: 100%; min-width: 0;
    display: grid; grid-template-columns: minmax(0,1fr) auto;
    align-items: center; padding: 10px 10px 2px; gap: 5px 6px;
  }
  body.theme-techcell .shop-v2 .tc-showcase .shop-logo { min-width: 0; max-width: 100%; }
  body.theme-techcell .shop-v2 .tc-showcase .techcell-shop-logo,
  body.theme-techcell .shop-v2 .catalog-custom-logo {
    width: auto; max-width: min(145px,100%); height: 62px; object-fit: contain;
  }
  body.theme-techcell .shop-v2 .tc-showcase .tc-header-actions {
    display: flex; align-items: center; flex-wrap: nowrap; gap: 1px; min-width: 0;
  }
  body.theme-techcell .shop-v2 .tc-showcase .tc-header-icon {
    width: 35px; height: 38px; min-width: 35px; min-height: 38px;
    padding: 6px; flex: 0 0 auto;
  }
  body.theme-techcell .shop-v2 .tc-showcase .tc-store-nav {
    grid-column: 1 / -1; grid-row: 2; display: flex;
    width: 100%; min-width: 0; max-width: 100%;
    align-items: stretch; justify-content: space-between;
    gap: 0; overflow-x: auto; overflow-y: hidden;
    padding: 4px 0 10px; scrollbar-width: none;
  }
  body.theme-techcell .shop-v2 .tc-showcase .tc-store-nav::-webkit-scrollbar { display: none; }
  body.theme-techcell .shop-v2 .tc-showcase .tc-store-nav a {
    flex: 0 1 auto; min-width: 0; font-size: clamp(10px,2.7vw,12px);
    padding: 9px 5px; line-height: 1.2; white-space: nowrap;
  }
  body.theme-techcell .shop-v2 .tc-showcase .tc-search-overlay {
    top: 67px; right: 8px; width: calc(100% - 16px); max-width: calc(100% - 16px);
  }
  body.theme-techcell .shop-v2 .tc-showcase .shop-main {
    min-width: 0; max-width: 100%; padding: 0 9px 15px;
  }
  body.theme-techcell .shop-v2 .tc-showcase .shop-intro {
    box-sizing: border-box; width: 100%; max-width: 100%; min-width: 0;
    margin: 0 0 16px !important; overflow: hidden;
  }
  /* Banner HTML personalizável: evita sobra/área escura abaixo do botão. */
  body.theme-techcell .shop-v2.catalog-banner-editable .tc-showcase .shop-intro {
    display: block !important; height: auto !important; min-height: 0 !important;
    aspect-ratio: auto !important; padding: 0 !important;
  }
  body.theme-techcell .shop-v2.catalog-banner-editable .tc-showcase .catalog-custom-hero {
    display: flex; height: auto; min-height: 0 !important;
    max-width: 100%; align-items: center; overflow: hidden;
  }
  body.theme-techcell .shop-v2.catalog-banner-editable .tc-showcase .catalog-banner-bg {
    width: 100%; height: 100%; max-width: 100%; object-fit: cover;
    object-position: 66% center; opacity: .35;
  }
  body.theme-techcell .shop-v2.catalog-banner-editable .tc-showcase .catalog-custom-hero:after {
    background: linear-gradient(90deg,rgba(9,11,16,.92),rgba(9,11,16,.55) 70%,rgba(9,11,16,.17));
  }
  body.theme-techcell .shop-v2.catalog-banner-editable .tc-showcase .catalog-custom-hero-content {
    position: relative; z-index: 2; width: 100%; max-width: 100%;
    min-width: 0; padding: 16px 15px 18px;
  }
  body.theme-techcell .shop-v2.catalog-banner-editable .tc-showcase .catalog-kicker {
    font-size: 10px; line-height: 1.25; letter-spacing: .09em;
  }
  body.theme-techcell .shop-v2.catalog-banner-editable .tc-showcase .catalog-custom-hero-content h1 {
    font-size: clamp(22px,5.6vw,27px); line-height: 1.08;
    letter-spacing: -.5px; margin: 9px 0;
    overflow-wrap: break-word; text-wrap: balance;
  }
  body.theme-techcell .shop-v2.catalog-banner-editable .tc-showcase .catalog-custom-hero-content p {
    font-size: 12px; line-height: 1.4; max-width: 93%; margin: 5px 0;
  }
  body.theme-techcell .shop-v2.catalog-banner-editable .tc-showcase .catalog-cta {
    display: inline-flex; max-width: 100%; white-space: normal;
    margin-top: 12px; padding: 11px 14px; font-size: 13px;
    min-height: 42px; align-items: center; justify-content: center;
  }
  /* Banner de arte inteira (não editável): exibe como peça única, sem contêiner vazio. */
  body.theme-techcell .shop-v2:not(.catalog-banner-editable) .tc-showcase .shop-intro {
    display: block !important; height: auto !important; min-height: 0 !important;
    aspect-ratio: 1.85 !important; padding: 0 !important;
  }
  body.theme-techcell .shop-v2:not(.catalog-banner-editable) .tc-reference-banner {
    position: relative; height: 100%; width: 100%; aspect-ratio: 1.85;
    overflow: hidden;
  }
  body.theme-techcell .shop-v2:not(.catalog-banner-editable) .tc-reference-banner-image {
    position: absolute; width: 100%; height: 100%; inset: 0;
    object-fit: cover; object-position: 26% center;
  }
  body.theme-techcell .shop-v2:not(.catalog-banner-editable) .tc-reference-banner-action {
    left: 5%; top: 67%; height: 24%; width: 48%; max-width: 48%;
  }
  body.theme-techcell .shop-v2 .tc-showcase .tc-featured { min-width: 0; max-width: 100%; }
  body.theme-techcell .shop-v2 .tc-showcase .tc-featured-heading { flex-wrap: wrap; gap: 6px; }
  body.theme-techcell .shop-v2 .tc-showcase .tc-featured-grid {
    display: flex; gap: 9px; max-width: 100%; min-width: 0;
    overflow-x: auto; overscroll-behavior-inline: contain;
    scroll-snap-type: x proximity; padding-bottom: 10px;
  }
  body.theme-techcell .shop-v2 .tc-showcase .tc-featured-item {
    flex: 0 0 115px; min-width: 115px; max-width: 115px;
    display: grid; scroll-snap-align: start;
    grid-template-rows: 110px auto;
  }
  body.theme-techcell .shop-v2 .tc-products-area,
  body.theme-techcell .shop-v2 .shop-results,
  body.theme-techcell .shop-v2 .shop-catalog-layout,
  body.theme-techcell .shop-v2 .shop-results-head { min-width: 0; max-width: 100%; }
  body.theme-techcell .shop-v2 .tc-products-area { padding: 15px 12px 120px; }
  body.theme-techcell .shop-v2 .shop-results-head {
    display: flex; flex-direction: column; align-items: stretch; gap: 12px;
  }
  body.theme-techcell .shop-v2 .shop-results-head > * { min-width: 0; max-width: 100%; }
  body.theme-techcell .shop-v2 .shop-results-head h2 { font-size: 23px; line-height: 1.15; }
  body.theme-techcell .shop-v2 .shop-sort-controls {
    width: 100%; max-width: 100%; display: flex; align-items: center;
    flex-wrap: wrap; justify-content: space-between; gap: 8px;
  }
  body.theme-techcell .shop-v2 .shop-sort-controls .shop-sort { min-width: 135px; max-width: 100%; }
  body.theme-techcell .shop-v2 .shop-grid {
    display: grid; grid-template-columns: repeat(2,minmax(0,1fr));
    gap: 10px; max-width: 100%;
  }
  body.theme-techcell .shop-v2 .shop-card { min-width: 0; max-width: 100%; }
  body.theme-techcell .shop-v2 .shop-card-actions { min-width: 0; }
  body.theme-techcell .shop-v2 .shop-card-actions button {
    max-width: 100%; white-space: normal; overflow-wrap: anywhere;
  }
  /* Carrinho: CTA acessível e clicável, com espaço reservado no conteúdo. */
  body.theme-techcell .shop-v2 .shop-floating {
    position: fixed !important; z-index: 85 !important;
    box-sizing: border-box; left: 12px !important; right: 12px !important;
    bottom: calc(10px + env(safe-area-inset-bottom,0px)) !important;
    width: calc(100% - 24px) !important; max-width: calc(100vw - 24px);
    min-height: 49px; padding: 11px 13px; margin: 0;
    display: inline-flex; align-items: center; justify-content: center;
    text-align: center; white-space: normal; line-height: 1.25;
  }
  body.theme-techcell #toast {
    left: 12px; right: 12px; bottom: calc(78px + env(safe-area-inset-bottom,0px));
    width: auto; max-width: none; pointer-events: none; z-index: 1300;
  }
  body.theme-techcell .cart-overlay { z-index: 1100; }
  body.theme-techcell .cart-drawer {
    width: 100vw; max-width: 100vw; min-width: 0; height: 100dvh;
    max-height: 100dvh; box-sizing: border-box;
    padding: 17px 14px calc(20px + env(safe-area-inset-bottom,0px));
    overflow-y: auto; overscroll-behavior-y: contain;
  }
  body.theme-techcell .cart-entry { flex-wrap: wrap; min-width: 0; }
  body.theme-techcell .cart-entry > div:first-child { flex: 1 1 100% !important; min-width: 0; }
  body.theme-techcell .cart-entry > * { max-width: 100%; }
  body.theme-techcell .modal-shade { z-index: 1200; }
  body.theme-techcell .modal { max-width: 100%; max-height: 92dvh; padding: 17px; }
}
@media (max-width: 360px) {
  body.theme-techcell .shop-v2 .tc-showcase .tc-header-icon {
    width: 30px; min-width: 30px; padding: 4px;
  }
  body.theme-techcell .shop-v2 .tc-showcase .tc-store-nav a { font-size: 10px; padding: 8px 3px; }
  body.theme-techcell .shop-v2 .tc-showcase .techcell-shop-logo { max-width: 116px; }
  body.theme-techcell .layout-techcell .tc-dashboard-stats { grid-template-columns: minmax(0,1fr); }
}
