/* ND169 — acabamento comercial, proposta em linha única e robustez responsiva. */

/* Propostas: todos os controles permanecem na MESMA linha sem ultrapassar o card. */
.proposal-items-box{max-width:100%!important;min-width:0!important;overflow:hidden!important}
.proposal-items-box .nb-proposal-items{min-width:0!important;max-width:100%!important}
body.nf-redesign .proposal-items-box .nb-proposal-item.proposal-row-v29,
.proposal-items-box .nb-proposal-item.proposal-row-v29{
  display:grid!important;
  grid-template-columns:minmax(0,1.35fr) minmax(0,1.65fr) minmax(0,.52fr) minmax(0,.78fr) minmax(0,.72fr) 42px!important;
  grid-template-areas:"product description qty price discount remove"!important;
  gap:clamp(6px,.7vw,11px)!important;
  align-items:end!important;
  width:100%!important;max-width:100%!important;min-width:0!important;
  padding:clamp(10px,1vw,14px)!important;box-sizing:border-box!important;overflow:hidden!important;
}
.proposal-items-box .proposal-row-v29>label:nth-of-type(1){grid-area:product!important}
.proposal-items-box .proposal-row-v29>label:nth-of-type(2){grid-area:description!important}
.proposal-items-box .proposal-row-v29>label:nth-of-type(3){grid-area:qty!important}
.proposal-items-box .proposal-row-v29>label:nth-of-type(4){grid-area:price!important}
.proposal-items-box .proposal-row-v29>.proposal-item-discount{grid-area:discount!important;grid-column:auto!important;grid-row:auto!important}
.proposal-items-box .proposal-row-v29>.proposal-remove{grid-area:remove!important;grid-column:auto!important;grid-row:auto!important;width:42px!important;min-width:42px!important;max-width:42px!important;height:48px!important;margin:0!important;align-self:end!important}
.proposal-items-box .proposal-row-v29>*{min-width:0!important;max-width:100%!important;margin:0!important}
.proposal-items-box .proposal-row-v29 label{min-width:0!important;width:100%!important}
.proposal-items-box .proposal-row-v29 label>span{display:block!important;min-width:0!important;white-space:nowrap!important;overflow:hidden!important;text-overflow:ellipsis!important}
.proposal-items-box .proposal-row-v29 :is(input,select){width:100%!important;min-width:0!important;max-width:100%!important;box-sizing:border-box!important}
.proposal-items-box .proposal-add-item{width:100%!important;min-height:44px!important;margin-top:10px!important}
@container proposalItems (max-width:760px){
  body.nf-redesign .proposal-items-box .nb-proposal-item.proposal-row-v29,.proposal-items-box .nb-proposal-item.proposal-row-v29{
    grid-template-columns:minmax(0,1.25fr) minmax(0,1.45fr) minmax(0,.48fr) minmax(0,.72fr) minmax(0,.65fr) 38px!important;
    grid-template-areas:"product description qty price discount remove"!important;gap:5px!important;padding:9px!important
  }
  .proposal-items-box .proposal-row-v29 label>span{font-size:.68rem!important}
  .proposal-items-box .proposal-row-v29 :is(input,select){padding-left:7px!important;padding-right:7px!important;font-size:.78rem!important}
  .proposal-items-box .proposal-row-v29>.proposal-remove{width:38px!important;min-width:38px!important;max-width:38px!important}
}
@container proposalItems (max-width:470px){
  body.nf-redesign .proposal-items-box .nb-proposal-item.proposal-row-v29,.proposal-items-box .nb-proposal-item.proposal-row-v29{
    grid-template-columns:minmax(0,1.15fr) minmax(0,1.25fr) minmax(0,.42fr) minmax(0,.65fr) minmax(0,.58fr) 34px!important;
    grid-template-areas:"product description qty price discount remove"!important;gap:4px!important;padding:8px!important
  }
  .proposal-items-box .proposal-row-v29 label>span{font-size:.6rem!important}
  .proposal-items-box .proposal-row-v29 :is(input,select){min-height:42px!important;padding:6px 4px!important;font-size:.7rem!important}
  .proposal-items-box .proposal-row-v29>.proposal-remove{width:34px!important;min-width:34px!important;max-width:34px!important;height:42px!important;padding:0!important}
}

/* Polimento profissional global: consistência, foco, contenção e toque. */
:where(html,body){max-width:100%;overflow-x:hidden}
:where(.page-stack,.surface-card,.card,.nb-panel,.center-modal-card,.nb-modal-v30__panel,.table-wrap,form,fieldset){min-width:0;max-width:100%;box-sizing:border-box}
:where(input,select,textarea,button,.btn){font:inherit}
:where(input,select,textarea){min-width:0;max-width:100%;box-sizing:border-box}
:where(button,.btn,a[role="button"]){touch-action:manipulation}
:where(a,button,input,select,textarea,[tabindex]):focus-visible{outline:3px solid color-mix(in srgb,var(--nf-primary,#1861f1) 28%,transparent);outline-offset:2px}
:where(.surface-card,.card,.quote-builder-section,.proposal-items-box){overflow-wrap:anywhere}
.table-wrap{overflow:auto!important;overscroll-behavior-inline:contain;-webkit-overflow-scrolling:touch}
.table-wrap table{width:100%;max-width:100%}
img,svg,video,canvas{max-width:100%}
.btn,.icon-btn{transition:transform .14s ease,box-shadow .14s ease,background-color .14s ease,border-color .14s ease}
@media (hover:hover){.btn:not(:disabled):hover,.icon-btn:not(:disabled):hover{transform:translateY(-1px)}}
.btn:disabled,.icon-btn:disabled{cursor:not-allowed;opacity:.62}
@media(max-width:760px){
  .form-footer,.button-row,.nb-row-actions{gap:8px!important}
  .center-modal-card,.nb-modal-v30__panel{max-width:calc(100vw - 20px)!important}
  .page-head,.section-heading{min-width:0}
}
@media(prefers-reduced-motion:reduce){*,*::before,*::after{scroll-behavior:auto!important;transition-duration:.01ms!important;animation-duration:.01ms!important;animation-iteration-count:1!important}}

/* White-label: classes internas/nomes de arquivos jamais viram conteúdo visível; mantém identidade herdada. */
.nf-whitelabel-experience [data-platform-brand="nowdev"]{display:none!important}

/* ND170 — PWA/mobile: nenhum botão flutuante pode ficar atrás da barra inferior. */
:root{
  --nb-pwa-bottom-nav-height:84px;
  --nb-pwa-safe-bottom:max(8px, env(safe-area-inset-bottom, 0px));
  --nb-pwa-floating-base:calc(var(--nb-pwa-bottom-nav-height) + var(--nb-pwa-safe-bottom) + 14px);
}
@media(max-width:900px){
  body.nf-redesign.has-floating-assistants .support-fab{
    right:14px!important;
    bottom:var(--nb-pwa-floating-base)!important;
    z-index:1300!important;
  }
  body.nf-redesign.has-floating-assistants .contextual-intelligence{
    right:14px!important;
    bottom:calc(var(--nb-pwa-floating-base) + 56px)!important;
    z-index:1305!important;
  }
  body.nf-redesign.has-floating-assistants .page-help-fab{
    right:14px!important;
    bottom:calc(var(--nb-pwa-floating-base) + 112px)!important;
    z-index:1300!important;
  }
  body.nf-redesign.has-floating-assistants .content{
    padding-bottom:calc(var(--nb-pwa-bottom-nav-height) + var(--nb-pwa-safe-bottom) + 190px)!important;
    scroll-padding-bottom:calc(var(--nb-pwa-bottom-nav-height) + var(--nb-pwa-safe-bottom) + 190px)!important;
  }
  .nf-mobile-bottom-nav{
    min-height:var(--nb-pwa-bottom-nav-height)!important;
    padding-bottom:calc(8px + env(safe-area-inset-bottom, 0px))!important;
    z-index:1200!important;
  }
  .nf-quick-create-sheet,
  .route-stop-form{
    bottom:calc(var(--nb-pwa-bottom-nav-height) + var(--nb-pwa-safe-bottom) + 8px)!important;
    max-height:calc(100dvh - var(--nb-pwa-bottom-nav-height) - var(--nb-pwa-safe-bottom) - 24px)!important;
  }
}
@media(max-width:560px){
  body.nf-redesign.has-floating-assistants .support-fab{right:12px!important}
  body.nf-redesign.has-floating-assistants .contextual-intelligence{right:12px!important}
  body.nf-redesign.has-floating-assistants .page-help-fab{right:12px!important}
  body.nf-redesign.has-floating-assistants .contextual-intelligence-panel{
    max-height:calc(100dvh - var(--nb-pwa-bottom-nav-height) - var(--nb-pwa-safe-bottom) - 150px)!important;
  }
}
@media(display-mode:standalone){
  body{padding-bottom:env(safe-area-inset-bottom, 0px)}
  .nf-mobile-bottom-nav{padding-bottom:calc(8px + env(safe-area-inset-bottom, 0px))!important}
}

/* ND170 PWA — dock inferior, folha do + e safe-area testados como uma única composição. */
@media(max-width:900px){
  .nf-quick-create{overflow:hidden!important}
  .nf-quick-create-sheet{
    display:flex!important;
    flex-direction:column!important;
    overflow:hidden!important;
    box-sizing:border-box!important;
  }
  .nf-quick-create-sheet header{flex:0 0 auto!important}
  .nf-quick-create-grid{
    flex:1 1 auto!important;
    min-height:0!important;
    overflow-y:auto!important;
    overscroll-behavior:contain!important;
    -webkit-overflow-scrolling:touch!important;
    padding-bottom:8px!important;
  }
  .nf-mobile-nav-item,.nf-mobile-nav-create{min-width:0!important;max-width:100%!important}
  .nf-mobile-nav-item>span:last-child,.nf-mobile-nav-create small{max-width:100%!important;overflow:hidden!important;text-overflow:ellipsis!important;white-space:nowrap!important}
}
@media(max-width:390px){
  .nf-mobile-bottom-nav{grid-template-columns:1fr 1fr 70px 1fr 1fr!important;padding-left:6px!important;padding-right:6px!important}
  .nf-mobile-nav-item{font-size:10px!important}
  .nf-mobile-nav-create>span{width:60px!important;height:60px!important;border-radius:20px!important}
  .nf-quick-create-grid{grid-template-columns:1fr!important}
}
@media(max-height:650px) and (max-width:900px){
  .nf-quick-create-grid{grid-template-columns:1fr!important}
  .nf-quick-create-sheet h2{font-size:19px!important}
}


/* ND171 - PWA sidebar: backdrop real + toque fora fecha sem bloquear o dock */
.sidebar-backdrop{display:none;border:0;padding:0;margin:0;background:rgba(4,14,31,.46);backdrop-filter:blur(2px);-webkit-backdrop-filter:blur(2px)}
@media(max-width:900px){
  .nf-redesign .sidebar{z-index:252!important}
  .nf-redesign .sidebar-backdrop{position:fixed;inset:0;z-index:251;display:block;opacity:0;visibility:hidden;pointer-events:none;transition:opacity .18s ease,visibility .18s ease}
  .nf-redesign .app-shell.sidebar-open .sidebar-backdrop{opacity:1;visibility:visible;pointer-events:auto}
  .nf-redesign .app-shell.sidebar-open{overflow:visible}
}
