/*
 * Camada responsiva canônica.
 * Todas as regras deste arquivo são exclusivas para telas pequenas para que
 * ajustes mobile não alterem a geometria consolidada do desktop.
 */
.gp-scrap-mobile-row { display:none; }

@media screen and (max-width: 767px) {
  .gp-mobile-center-notification-text{
    display:block!important;
    width:100%!important;
    text-align:center!important;
  }
  html body .gp-email-report-slot,
  html body .gp-email-report-actions{
    width:100%!important;
    max-width:100%!important;
    min-width:0!important;
    box-sizing:border-box!important;
  }
  html body .gp-email-report-slot :is(vaadin-combo-box,vaadin-time-picker,vaadin-text-field,vaadin-multi-select-combo-box){
    min-width:0!important;
    max-width:100%!important;
  }
  html body .gp-content,
  html body .gp-content .gp-summary-page,
  html body .gp-content .gp-refugo-page,
  html body .gp-content .gp-refugo-chart-line,
  html body .gp-content .gp-refugo-chart{
    margin-left:0!important;
    margin-right:0!important;
    width:100%!important;
    max-width:100%!important;
    box-sizing:border-box!important;
  }
  html body .gp-content{padding-top:0!important}
  html body .gp-content .gp-tab-controls{margin-top:2px!important;margin-bottom:8px!important}
  :root {
    --gp-mobile-edge: 12px;
    --gp-mobile-gap: 10px;
    --gp-mobile-control: 44px;
  }

  html:has(.gp-login-page){scrollbar-gutter:auto!important}
  html body .gp-root:has(.gp-login-page),
  html body .gp-shell:has(>.gp-login-page){
    min-height:100dvh!important;height:auto!important;padding:0!important;margin:0!important;
    box-sizing:border-box!important;
  }
  html body .gp-login-page{
    min-height:100dvh!important;height:auto!important;box-sizing:border-box!important;
    padding:max(16px,env(safe-area-inset-top)) 16px max(16px,env(safe-area-inset-bottom))!important;
    overflow:visible!important;flex:1 0 auto!important;
  }
  html body:has(.gp-login-page){margin:0!important;min-height:100dvh!important}
  html body .gp-login-card{margin:auto!important;max-width:100%!important}
  html body .gp-content .gp-page-controls{
    display:flex!important;flex-wrap:nowrap!important;align-items:flex-end!important;
    width:100%!important;min-height:68px!important;margin:0 0 10px!important;gap:6px!important;
  }
  html body .gp-content .gp-page-controls>vaadin-text-field{
    flex:1 1 0!important;width:0!important;min-width:0!important;max-width:none!important;
    padding:0!important;margin:0!important;
  }
  html body .gp-content .gp-page-controls>vaadin-text-field::part(label){
    font-size:14px!important;line-height:20px!important;padding:0 0 4px!important;
  }
  html body .gp-mobile-icon-button,
  html body .gp-content .gp-page-controls>vaadin-button{
    flex:0 0 44px!important;width:44px!important;min-width:44px!important;max-width:44px!important;
    height:44px!important;min-height:44px!important;max-height:44px!important;
    margin:0!important;padding:0!important;font-size:0!important;
    top:0!important;transform:none!important;
  }
  /* Em botões somente com ícone, o desenho ocupa o slot da label. */
  html body .gp-mobile-icon-button:not([theme~="icon"])::part(label){display:none!important}
  html body .gp-mobile-icon-button::part(prefix){margin:0!important}
  html body .gp-mobile-icon-button vaadin-icon{width:20px!important;height:20px!important;margin:0!important}
  html body .gp-content .gp-page-controls.gp-launch-toolbar-v045.gp-search-filter-toolbar-v044>.gp-order-summary-button{
    transform:translate(-3px,2px)!important;
  }
  html body .gp-content .gp-factory-launch-toolbar>.gp-factory-day-summary-button{margin-right:0!important}
  html body .gp-content .gp-original-metrics{
    display:grid!important;grid-template-columns:repeat(2,minmax(0,1fr))!important;
    width:100%!important;gap:12px!important;transform:none!important;margin-inline:0!important;
  }
  html body .gp-content .gp-summary-secondary-toolbar{
    min-height:56px!important;margin-bottom:10px!important;
  }
  html body .gp-content .gp-original-metrics>.gp-kpi{
    width:100%!important;grid-column:auto!important;padding:8px!important;box-sizing:border-box!important;
    display:flex;flex-direction:column;justify-content:space-between;
  }
  html body .gp-content .gp-original-metrics .gp-kpi-label{font-size:13px!important;line-height:1.3!important}
  html body .gp-content .gp-original-metrics .gp-kpi-value{font-size:20px!important;line-height:1.2!important;overflow-wrap:anywhere}

  html {
    overflow-x: hidden;
    scrollbar-gutter: auto;
  }

  body,
  .gp-root,
  .gp-shell {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow-x: hidden;
  }

  html body .gp-root {min-height:100dvh!important}
  html body .gp-shell {
    min-height: 100dvh!important;
    padding: 0 var(--gp-mobile-edge) 12px !important;
  }

  /* Cabeçalho e navegação */
  .gp-main-header {
    grid-template-columns: minmax(0, 1fr) auto !important;
    min-height: 58px !important;
    padding-top: 10px !important;
    column-gap: 10px !important;
  }

  html body .gp-main-title {
    max-width:none!important;
    min-width:0!important;
    white-space:nowrap!important;
    font-size:clamp(11px, 3.3vw, 17px)!important;
    line-height: 1.12 !important;
  }

  .gp-logo {
    width:clamp(80px, 24vw, 110px)!important;
  }

  html body .gp-navigation {
    margin-top:8px!important;
    width:100%;min-width:0;overflow-x:auto;scrollbar-width:none;
  }

  html body .gp-main-tabs {
    display:flex!important;
    justify-content:flex-start!important;
    width:max-content!important;
    min-width:100%!important;
    max-width:none!important;
    min-height: 46px !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    scrollbar-width: none;
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
  }

  .gp-main-tabs::-webkit-scrollbar {
    display: none;
  }

  .gp-main-tabs.gp-factory-navigation {
    justify-content: flex-start !important;
  }
  .gp-main-tabs.gp-factory-navigation > vaadin-menu-bar-button.gp-main-navigation-root {
    flex: 0 0 auto !important;
    margin-left: 0 !important;
    margin-right:0!important;
  }
  .gp-factory-new-heading > span {
    display: block;
  }
  .gp-factory-day-summary-date {
    display: block !important;
    text-align: left !important;
    font-size: 1.25rem !important;
    margin: 0 !important;
  }
  .gp-factory-day-summary-grid {
    height: min(42svh, 430px) !important;
  }
  .gp-factory-day-summary-footer > .gp-factory-day-summary-totals {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 210px), 1fr));
    margin: .3rem 0 .6rem;
  }
  .gp-factory-day-summary-totals > .gp-factory-day-summary-total {
    font-size: 16px !important;
    white-space: nowrap;
  }

  html body .gp-main-tabs > vaadin-menu-bar-button.gp-main-navigation-root {
    flex:0 0 auto!important;
    margin-inline:0!important;
    min-width: max-content !important;
    min-height: 46px !important;
    padding-inline: 9px !important;
    font-size: .84rem !important;
    white-space: nowrap !important;
  }

  html body .gp-main-tabs > vaadin-menu-bar-button.gp-system-menu-root {
    margin-left:0!important;
    transform:translateY(2.5px)!important;
    flex: 0 0 38px !important;
    width: 38px !important;
    min-width: 38px !important;
    max-width: 38px !important;
    min-height: 46px !important;
  }

  .gp-main-tabs vaadin-menu-bar-button.gp-navigation-active::after {
    width: 22px !important;
  }

  /* Estrutura das páginas */
  .gp-title-row,
  .gp-title-row-static,
  .gp-section-title {
    min-width: 0;
    font-size: clamp(1.15rem, 5vw, 1.42rem) !important;
    line-height: 1.15 !important;
    white-space: normal !important;
  }

  .gp-tab-controls {
    min-height: 0 !important;
    margin: 6px 0 12px !important;
  }

  .gp-search-filter-toolbar-v044,
  .gp-launch-toolbar-v045,
  .gp-refugo-search-toolbar-v074,
  .gp-scrap-report-toolbar-v116 {
    display: flex !important;
    flex-flow: row wrap !important;
    align-items: flex-end !important;
    gap: 8px !important;
    width: 100% !important;
    transform: none !important;
  }

  .gp-search-filter-toolbar-v044 > vaadin-text-field,
  .gp-launch-toolbar-v045 > vaadin-text-field,
  .gp-scrap-report-toolbar-v116 > vaadin-text-field {
    flex: 1 1 210px !important;
    width: auto !important;
    min-width: 0 !important;
  }

  .gp-content vaadin-text-field::part(input-field),
  .gp-content vaadin-password-field::part(input-field),
  .gp-content vaadin-integer-field::part(input-field),
  .gp-content vaadin-number-field::part(input-field),
  .gp-content vaadin-date-picker::part(input-field),
  .gp-content vaadin-select::part(input-field),
  .gp-content vaadin-combo-box::part(input-field),
  .gp-content vaadin-multi-select-combo-box::part(input-field),
  .gp-period-field {
    min-height: var(--gp-mobile-control) !important;
    height: var(--gp-mobile-control) !important;
    max-height: var(--gp-mobile-control) !important;
    box-sizing: border-box !important;
    border-radius: 8px !important;
  }

  .gp-filter-button,
  .gp-search-filter-button-v044,
  .gp-launch-new-inline-v045 {
    flex: 0 0 var(--gp-mobile-control) !important;
    width: var(--gp-mobile-control) !important;
    min-width: var(--gp-mobile-control) !important;
    max-width: var(--gp-mobile-control) !important;
    height: var(--gp-mobile-control) !important;
    min-height: var(--gp-mobile-control) !important;
    max-height: var(--gp-mobile-control) !important;
    margin: 0 !important;
    top: auto !important;
    transform: none !important;
  }

  .gp-content vaadin-button:not(.gp-action-icon):not(.gp-chart-menu-button):not(.gp-filter-button):not(.gp-dialog-close) {
    min-height: var(--gp-mobile-control);
    border-radius: 8px;
  }

  /* Alvos de toque compactos, porém confortáveis para os botões só de ícone. */
  .gp-action-icon,
  .gp-dialog-close {
    width: 40px !important;
    min-width: 40px !important;
    max-width: 40px !important;
    height: 40px !important;
    min-height: 40px !important;
    max-height: 40px !important;
  }

  .gp-action-icon vaadin-icon,
  .gp-dialog-close vaadin-icon {
    width: 24px !important;
    height: 24px !important;
  }

  .gp-show-more {
    width: 100% !important;
    min-height: var(--gp-mobile-control) !important;
    margin-top: 10px !important;
  }

  .gp-content vaadin-button:focus-visible,
  .gp-content vaadin-tab:focus-visible,
  .gp-content vaadin-context-menu-item:focus-visible {
    outline: 2px solid color-mix(in srgb, var(--gp-red) 75%, white) !important;
    outline-offset: 2px !important;
  }

  .gp-filter-popover::part(overlay) {
    width: min(94vw, 390px) !important;
    max-width: calc(100vw - 16px) !important;
    max-height: min(82svh, 650px) !important;
    border-radius: 10px !important;
  }

  .gp-filter-popover::part(content) {
    max-height: min(82svh, 650px) !important;
  }

  .gp-filter-dropdown,
  .gp-filter-dropdown-refugo {
    max-height: min(78svh, 610px) !important;
    padding: 12px !important;
  }

  .gp-filter-dropdown-grid {
    gap: 4px !important;
  }

  vaadin-context-menu-overlay::part(overlay),
  vaadin-combo-box-overlay::part(overlay),
  vaadin-select-overlay::part(overlay) {
    max-width: calc(100vw - 16px) !important;
    border-radius: 10px !important;
  }

  vaadin-context-menu-item,
  vaadin-combo-box-item,
  vaadin-select-item {
    min-height: 44px !important;
  }

  /* Formulários e diálogos */
  .gp-launch-row,
  .gp-launch-row-2,
  .gp-launch-row-3,
  .gp-launch-row-4,
  .gp-admin-form,
  .gp-admin-toolbar {
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 12px !important;
  }

  vaadin-dialog.gp-modal-v053::part(overlay) {
    width: calc(100vw - 16px) !important;
    max-width: calc(100vw - 16px) !important;
    max-height: calc(100svh - 16px) !important;
    border-radius: 12px !important;
  }

  vaadin-dialog.gp-modal-v053::part(header),
  vaadin-dialog.gp-modal-v053::part(content),
  vaadin-dialog.gp-modal-v053::part(footer) {
    padding-inline: 14px !important;
  }

  .gp-launch-dialog-actions {
    display: flex !important;
    flex-wrap: wrap !important;
    justify-content: flex-end !important;
    gap: 12px !important;
  }

  .gp-launch-dialog-actions > vaadin-button {
    flex: 1 1 140px !important;
    min-height: 38px !important;
  }

  /* O botão novo continua compacto na barra, mas mantém o sinal de adição visível. */
  .gp-launch-toolbar-v045 > .gp-launch-new-inline-v045 {
    flex: 0 0 var(--gp-mobile-control) !important;
    width: var(--gp-mobile-control) !important;
    min-width: var(--gp-mobile-control) !important;
    max-width: var(--gp-mobile-control) !important;
    height: var(--gp-mobile-control) !important;
    min-height: var(--gp-mobile-control) !important;
    max-height: var(--gp-mobile-control) !important;
    padding: 0 !important;
    font-size: 0 !important;
  }

  .gp-launch-toolbar-v045 > .gp-launch-new-inline-v045 vaadin-icon {
    display: inline-flex !important;
    width: 20px !important;
    height: 20px !important;
    min-width: 20px !important;
    min-height: 20px !important;
    color: var(--gp-text) !important;
    -webkit-text-fill-color: var(--gp-text) !important;
    --vaadin-icon-color: var(--gp-text);
    fill: currentColor !important;
    margin: 0 !important;
  }

  /* KPIs e áreas de resumo */
  .gp-kpis,
  .gp-original-metrics,
  .gp-original-metrics-5,
  .gp-detail-kpis {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 8px !important;
    width: 100% !important;
  }

  .gp-kpi {
    min-width: 0 !important;
    padding: 10px !important;
    border-radius: 10px;
    background: color-mix(in srgb, var(--gp-text) 3.5%, transparent);
    box-sizing: border-box !important;
  }

  .gp-kpi > span {
    font-size: .78rem !important;
    line-height: 1.15 !important;
  }

  .gp-kpi > h3 {
    margin-top: 4px !important;
    font-size: clamp(1.08rem, 5vw, 1.35rem) !important;
    line-height: 1.1 !important;
    overflow-wrap: anywhere !important;
    white-space: normal !important;
  }

  .gp-kpis > .gp-kpi:last-child,
  .gp-refugo-kpis-v056 > .gp-kpi:last-child,
  .gp-scrap-report-kpis-v116 > .gp-kpi:last-child {
    grid-column: 1 / -1 !important;
  }

  /* Abas internas roláveis e tocáveis */
  .gp-inner-tabs {
    width: 100% !important;
    margin: 4px 0 10px !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }

  .gp-inner-tabs::-webkit-scrollbar {
    display: none;
  }

  .gp-inner-tabs vaadin-tab {
    flex: 0 0 auto !important;
    min-height: 42px !important;
    padding-inline: 12px !important;
    font-size: .88rem !important;
    white-space: nowrap !important;
  }

  /* Refugo: gráfico legível e rolável, sem comprimir quinze categorias. */
  .gp-refugo-page {
    width: 100% !important;
    min-width: 0 !important;
    padding-bottom: 16px !important;
  }

  .gp-refugo-page > .gp-refugo-kpis-v056 {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 8px !important;
    margin: 4px 0 12px !important;
  }

  .gp-refugo-page > .gp-refugo-kpis-v056 > .gp-kpi {
    min-height: 78px !important;
    padding: 10px 8px !important;
  }

  .gp-refugo-analysis,
  .gp-refugo-details,
  .gp-refugo-recent {
    width: 100% !important;
    min-width: 0 !important;
  }

  html body .gp-content .gp-refugo-page.gp-refugo-page-v070 .gp-refugo-chart-line {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    column-gap: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    overflow: visible !important;
  }

  .gp-refugo-chart-line > .gp-chart-menu-button {
    width: var(--gp-mobile-control) !important;
    min-width: var(--gp-mobile-control) !important;
    max-width: var(--gp-mobile-control) !important;
    height: var(--gp-mobile-control) !important;
    min-height: var(--gp-mobile-control) !important;
    max-height: var(--gp-mobile-control) !important;
    margin-top: 0 !important;
  }

  /* Mobile: categorias empilhadas, com barras horizontais e nomes legíveis. */
  html body .gp-refugo-chart { width:100%!important; min-width:0!important; overflow:visible!important; }
  html body .gp-refugo-chart-frame,
  html body .gp-refugo-chart-canvas,
  html body .gp-refugo-chart-plot {
    position:relative!important; inset:auto!important; display:block!important;
    width:100%!important; min-width:0!important; height:auto!important;
    min-height:0!important; padding:0!important;margin:0!important;transform:none!important; box-sizing:border-box!important;
  }
  html body .gp-refugo-page.gp-refugo-page-v070 .gp-refugo-chart-line .gp-refugo-chart-title {
    position:static!important;inset:auto!important;transform:none!important;
    display:block!important;justify-content:flex-start!important;
    width:100%!important; height:auto!important;
    min-height:0!important; margin:0 0 12px!important; font-size:16px!important;
    padding-left:5px!important; box-sizing:border-box!important;
    white-space:normal!important; text-align:left!important;
  }
  html body .gp-refugo-y-axis, html body .gp-refugo-y-title,
  html body .gp-refugo-grid-area { display:none!important; }
  html body .gp-refugo-bar-column {
    display:block!important; width:100%!important; min-width:0!important;
    height:auto!important; min-height:0!important; padding:12px 0!important;
    box-sizing:border-box!important; border-bottom:1px solid var(--gp-border);
  }
  html body .gp-refugo-bar-column>.gp-refugo-bar-area,
  html body .gp-refugo-bar-column>.gp-refugo-bar-label {display:none!important}
  html body .gp-scrap-mobile-row {display:block}
  .gp-scrap-mobile-heading {
    display:flex; align-items:baseline; justify-content:space-between; gap:12px;
    margin-bottom:8px; font-size:14px; line-height:1.4; color:var(--gp-text);
  }
  .gp-scrap-mobile-heading>span:first-child {min-width:0;padding-left:5px;overflow-wrap:anywhere}
  .gp-scrap-mobile-value {flex-shrink:0;white-space:nowrap;font-weight:600;font-variant-numeric:tabular-nums}
  .gp-scrap-mobile-track {width:100%;height:14px;border-radius:4px;background:color-mix(in srgb,var(--gp-refugo-blue) 8%,transparent)}
  .gp-scrap-mobile-bar {height:100%;border-radius:4px;background:var(--gp-refugo-blue);opacity:.92}
  .gp-refugo-bar-selected .gp-scrap-mobile-bar {background:var(--gp-refugo-blue-selected);opacity:1}
  .gp-refugo-has-selection .gp-refugo-bar-column:not(.gp-refugo-bar-selected) .gp-scrap-mobile-bar {opacity:.45}

  .gp-refugo-pagination {
    justify-content: space-between !important;
    gap: 6px !important;
    padding: 8px 0 12px !important;
  }

  .gp-refugo-pagination vaadin-button {
    min-height: var(--gp-mobile-control) !important;
    padding-inline: 8px !important;
    font-size: .78rem !important;
  }

  .gp-refugo-pagination span {
    font-size: .76rem !important;
  }

  .gp-ranking-row,
  .gp-period-ranking-row {
    grid-template-columns: 32px minmax(0, 1fr) !important;
    gap: 7px !important;
    padding: 9px 6px !important;
    font-size: .78rem !important;
    line-height: 1.25 !important;
  }

  .gp-refugo-page .gp-comparison-kpis {
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 8px !important;
  }

  .gp-refugo-recent-grid,
  .gp-admin-grid,
  .gp-summary-grid,
  .gp-month-entries-grid,
  .gp-launch-grid-wrapper-v115,
  .gp-order-production-grid-v110 {
    max-width: 100% !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
  }

  /* Relatório de refugo na tela mobile; impressão permanece no CSS desktop. */
  html body .gp-scrap-report-toolbar-v116 {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) var(--gp-mobile-control) !important;
    gap: 8px !important;
    width: 100% !important;
  }

  html body .gp-scrap-report-toolbar-v116 > vaadin-text-field {
    grid-column: 1 !important;
    width: 100% !important;
    min-width: 0 !important;
  }

  html body .gp-scrap-report-toolbar-v116 > .gp-filter-button {
    grid-column: 2 !important;
    align-self: end !important;
  }

  html body .gp-scrap-report-toolbar-v116 > .gp-scrap-report-export-v117 {
    grid-column: 1 / -1 !important;
    width: 100% !important;
    margin-top: 2px !important;
  }

  html body .gp-scrap-report-kpis-v116 {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 8px !important;
  }

  html body .gp-scrap-report-kpis-v116 > .gp-kpi:last-child {
    grid-column: 1 / -1 !important;
  }

  html body .gp-scrap-reason-cards-v116 {
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 10px !important;
  }

  .gp-scrap-reason-card-v116 {
    padding: 10px !important;
  }

  html body .gp-scrap-report-month-bars-v130 {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 12px 8px !important;
    height: auto !important;
    min-height: 0 !important;
    padding: 12px 8px !important;
  }

  html body .gp-scrap-report-month-column-v130 {
    grid-template-rows: 36px 128px 28px 28px !important;
    min-width: 0 !important;
  }

  html body .gp-scrap-report-month-track-v130 {
    width: min(64%, 52px) !important;
    height: 128px !important;
  }

  html body .gp-scrap-report-month-value-v130,
  html body .gp-scrap-report-month-label-v130,
  html body .gp-scrap-report-month-difference-v130 {
    font-size: .68rem !important;
  }

  .gp-footer {
    padding: 20px 0 8px !important;
    font-size: .76rem !important;
  }

  .gp-footer-signature {
    display: none !important;
  }
}

@media screen and (max-width: 420px) {
  .gp-main-tabs > vaadin-menu-bar-button.gp-main-navigation-root {
    padding-inline: 7px !important;
    font-size: .79rem !important;
  }

  html body .gp-scrap-report-month-bars-v130 {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  .gp-kpi > h3 {
    font-size: 1.05rem !important;
  }
}

/* Fechamento mobile: remove deslocamentos herdados do gráfico desktop. */
@media screen and (max-width: 767px) {
  html body .gp-main-header{
    min-height:48px!important;
    padding-top:4px!important;
    column-gap:6px!important;
  }
  html body .gp-main-title{
    font-size:clamp(16px,4.8vw,22px)!important;
  }
  html body .gp-navigation{margin-top:0!important}
  html body .gp-main-tabs{
    width:100%!important;
    min-width:100%!important;
  }
  html body .gp-main-tabs>vaadin-menu-bar-button.gp-system-menu-root{
    margin-left:auto!important;
    transform:translateY(2.5px)!important;
  }
  html body .gp-content .gp-original-metrics,
  html body .gp-content .gp-original-metrics-5,
  html body .gp-summary-page .gp-original-metrics{
    position:relative!important;
    left:10px!important;
  }
  html body .gp-refugo-page,
  html body .gp-refugo-page .gp-refugo-chart-line,
  html body .gp-refugo-page .gp-refugo-chart {
    margin-left:0!important;
    margin-right:0!important;
    width:100%!important;
    max-width:100%!important;
    transform:none!important;
  }
  html body .gp-refugo-page .gp-refugo-chart-line{overflow:visible!important}
  html body .gp-refugo-page .gp-refugo-chart-title,
  html body .gp-refugo-page .gp-scrap-mobile-heading{
    position:relative!important;left:0!important;
    margin-left:0!important;width:100%!important;
  }
  html body .gp-refugo-page .gp-subsection-title,
  html body .gp-refugo-page .gp-refugo-sector-detail-title{
    position:relative!important;left:0!important;
  }
  html body .gp-content .gp-original-metrics,
  html body .gp-content .gp-original-metrics-5,
  html body .gp-summary-page .gp-original-metrics{
    left:0!important;
    margin-left:0!important;
    margin-right:0!important;
    width:100%!important;
  }
  html body .gp-content .gp-launch-toolbar-v045.gp-factory-launch-toolbar{
    display:flex!important;
    flex-flow:row nowrap!important;
    align-items:center!important;
    justify-content:flex-end!important;
    width:100%!important;
    min-height:44px!important;
    height:auto!important;
    margin:0 0 12px!important;
    padding:0!important;
    gap:6px!important;
    position:relative!important;
    z-index:1!important;
    overflow:visible!important;
  }
  html body .gp-factory-day-summary-button,
  html body .gp-factory-toolbar-share,
  html body .gp-content .gp-launch-toolbar-v045.gp-factory-launch-toolbar>.gp-factory-day-summary-button,
  html body .gp-content .gp-launch-toolbar-v045.gp-factory-launch-toolbar>.gp-factory-toolbar-share,
  html body .gp-content .gp-launch-toolbar-v045.gp-factory-launch-toolbar>.gp-launch-new-inline-v045{
    position:relative!important;
    flex:0 0 var(--gp-mobile-control)!important;
    width:var(--gp-mobile-control)!important;
    min-width:var(--gp-mobile-control)!important;
    max-width:var(--gp-mobile-control)!important;
    height:var(--gp-mobile-control)!important;
    min-height:var(--gp-mobile-control)!important;
    max-height:var(--gp-mobile-control)!important;
    margin:0!important;
    top:auto!important;
    left:auto!important;
    right:auto!important;
    transform:none!important;
  }
  html body vaadin-grid.gp-factory-launch-grid{
    display:block!important;
    position:relative!important;
    clear:both!important;
    margin-top:0!important;
    z-index:0!important;
  }
  html body .gp-content .gp-filter-title-row>.gp-filter-button{
    position:relative!important;
    top:auto!important;
    margin:0!important;
    transform:translateY(2.5px)!important;
  }
  html body .gp-content .gp-launch-toolbar-v045.gp-factory-launch-toolbar>.gp-factory-day-summary-button,
  html body .gp-content .gp-launch-toolbar-v045.gp-factory-launch-toolbar>.gp-factory-toolbar-share{
    transform:translateX(-14px)!important;
  }
}

/* Formulários mobile reutilizam a geometria de Novo Lançamento. */
@media(max-width:700px){
  html body vaadin-dialog.gp-modal-v053.gp-modal-v053 :is(.gp-admin-form,.gp-admin-form-grid,.gp-admin-user-form,.gp-launch-form-python,.gp-launch-row,.gp-launch-shift-column,.gp-password-form){
    gap:12px!important;padding:0!important;
  }
  html body vaadin-dialog.gp-modal-v053.gp-modal-v053 :is(vaadin-text-field,vaadin-password-field,vaadin-number-field,vaadin-integer-field,vaadin-combo-box,vaadin-multi-select-combo-box,vaadin-date-picker,vaadin-select,vaadin-time-picker):not(.gp-period-month):not(.gp-period-year):not([auto-expand-vertically])::part(input-field){
    height:38px!important;min-height:38px!important;max-height:38px!important;
  }
  html body vaadin-dialog.gp-modal-v053.gp-modal-v053 :is(vaadin-text-field,vaadin-password-field,vaadin-number-field,vaadin-integer-field,vaadin-combo-box,vaadin-multi-select-combo-box,vaadin-date-picker,vaadin-select,vaadin-time-picker,vaadin-text-area):not(.gp-period-month):not(.gp-period-year)::part(label),
  html body vaadin-dialog.gp-modal-v053.gp-modal-v053 .gp-period-label{
    font-size:16px!important;line-height:20px!important;padding:0 0 2px!important;margin:0!important;color:var(--gp-text)!important;
  }
  html body vaadin-dialog.gp-modal-v053.gp-modal-v053 .gp-period-field{
    height:38px!important;min-height:38px!important;max-height:38px!important;
  }
  html body vaadin-dialog.gp-modal-v053.gp-modal-v053 .gp-launch-dialog-actions{
    gap:12px!important;
  }
  html body vaadin-dialog.gp-modal-v053.gp-modal-v053 .gp-launch-item-description-v094:empty,
  html body vaadin-dialog.gp-modal-v053.gp-modal-v053 .gp-scrap-entry-form > span:empty{display:none!important;}
}

/* Uma grade real garante que o intervalo comum funcione em todos os cadastros. */
@media(max-width:700px){
  html body vaadin-dialog.gp-modal-v053.gp-modal-v053 :is(.gp-admin-form,.gp-admin-form-grid,.gp-admin-user-form,.gp-password-form){
    display:grid!important;grid-template-columns:minmax(0,1fr)!important;gap:12px!important;
  }
  html body vaadin-dialog.gp-modal-v053.gp-modal-v053 :is(.gp-admin-form,.gp-admin-form-grid,.gp-admin-user-form,.gp-password-form) > *{
    grid-column:1 / -1!important;min-width:0;
  }
  html body vaadin-dialog.gp-modal-v053.gp-modal-v053 :is(vaadin-text-field,vaadin-password-field,vaadin-number-field,vaadin-integer-field,vaadin-combo-box,vaadin-multi-select-combo-box,vaadin-date-picker,vaadin-select,vaadin-time-picker,vaadin-text-area):not(.gp-period-month):not(.gp-period-year){
    margin-block:0!important;padding-block:0!important;height:auto!important;min-height:0!important;
  }
  html body .gp-content:has(>.gp-refugo-page){padding-bottom:0!important;}
  html body .gp-shell:has(>.gp-content>.gp-refugo-page) > .gp-footer{padding-top:4px!important;}
}

/* Barra mobile: 20px entre desenhos, sem caixas laterais ou fundo nos ícones. */
@layer gp-mobile-toolbar {
@media screen and (max-width:700px) {
  html body .gp-shell>.gp-compact-navigation+.gp-content.gp-content
      :is(.gp-page-controls,.gp-title-row) {
    gap:20px!important;
  }
  html body .gp-shell>.gp-compact-navigation+.gp-content.gp-content
      :is(.gp-page-controls,.gp-title-row)>vaadin-button:where(.gp-header-icon-button,.gp-filter-button,.gp-mobile-icon-button) {
    width:var(--gp-toolbar-icon-width,16px)!important;
    min-width:var(--gp-toolbar-icon-width,16px)!important;
    max-width:var(--gp-toolbar-icon-width,16px)!important;
    flex:0 0 var(--gp-toolbar-icon-width,16px)!important;
    padding-inline:0!important;margin-inline:0!important;transform:none!important;
  }
  html body .gp-shell>.gp-compact-navigation+.gp-content.gp-content
      :is(.gp-page-controls,.gp-title-row)>.gp-filter-button {
    --gp-toolbar-icon-width:18px;
  }
  html body .gp-shell>.gp-compact-navigation+.gp-content.gp-content
      :is(.gp-page-controls,.gp-title-row)>vaadin-button.gp-mobile-icon-button:not(.gp-header-icon-button) {
    --gp-toolbar-icon-width:20px;
  }
  html body .gp-shell>.gp-compact-navigation+.gp-content.gp-content
      :is(.gp-page-controls,.gp-title-row) .gp-summary-glyph,
  html body .gp-shell>.gp-compact-navigation+.gp-content.gp-content
      :is(.gp-page-controls,.gp-title-row) .gp-summary-glyph>svg,
  html body .gp-shell>.gp-compact-navigation+.gp-content.gp-content
      :is(.gp-page-controls,.gp-title-row)>vaadin-button.gp-header-icon-button vaadin-icon {
    width:16px!important;min-width:16px!important;height:16px!important;
    flex:0 0 16px!important;padding:0!important;
  }

  html body .gp-shell>.gp-compact-navigation+.gp-content.gp-content
      :is(.gp-page-controls,.gp-title-row)>vaadin-button.gp-mobile-icon-button {
    background:transparent!important;border:0!important;box-shadow:none!important;
    outline:none!important;color:var(--gp-text)!important;
    -webkit-text-fill-color:var(--gp-text)!important;
    --vaadin-button-background:transparent;--vaadin-button-text-color:var(--gp-text);
  }
  html body .gp-shell>.gp-compact-navigation+.gp-content.gp-content
      :is(.gp-page-controls,.gp-title-row)>vaadin-button.gp-mobile-icon-button::before,
  html body .gp-shell>.gp-compact-navigation+.gp-content.gp-content
      :is(.gp-page-controls,.gp-title-row)>vaadin-button.gp-mobile-icon-button::after {
    background:transparent!important;box-shadow:none!important;opacity:0!important;
  }
  html body .gp-shell>.gp-compact-navigation+.gp-content.gp-content
      :is(.gp-page-controls,.gp-title-row)>vaadin-button.gp-mobile-icon-button:not(.gp-header-icon-button) vaadin-icon {
    width:20px!important;height:20px!important;padding:0!important;margin:0!important;
  }
  html body .gp-navigation.gp-compact-navigation {padding-inline:calc(.75rem - 4px)!important;}
  html body .gp-shell>.gp-compact-navigation+.gp-content.gp-content
      :is(.gp-page-controls,.gp-title-row):has(> :is(vaadin-button,.gp-page-search-action)) {
    left:calc(.75rem - 4px)!important;right:var(--gp-mobile-toolbar-right,15px)!important;
  }
  html body .gp-shell>.gp-compact-navigation+.gp-content.gp-content
      :is(.gp-page-controls,.gp-title-row)>.gp-page-search-action,
  html body .gp-shell>.gp-compact-navigation+.gp-content.gp-content
      :is(.gp-page-controls,.gp-title-row) .gp-page-search-button {
    width:16px!important;min-width:16px!important;max-width:16px!important;
    flex:0 0 16px!important;padding-inline:0!important;
  }
  html body .gp-shell>.gp-compact-navigation+.gp-content.gp-content
      :is(.gp-page-controls,.gp-title-row) .gp-page-search-button vaadin-icon {
    width:16px!important;height:16px!important;padding:0!important;
  }

}
}

/* Toque não depende de hover: ícones ativos usam a cor integral do tema. */
@layer gp-mobile-toolbar {
  @media screen and (max-width:700px) {
    html body vaadin-icon,
    html body vaadin-button:not([disabled]) :is(svg,.gp-summary-glyph,.gp-search-filter-funnel-v044,.gp-filter-funnel-icon),
    html body vaadin-button:not([disabled]):is(.gp-action-icon,.gp-dialog-close,.gp-main-menu,.gp-menu-button,.gp-chart-menu-button,.gp-filter-button,.gp-header-icon-button,.gp-page-search-button,.gp-mobile-icon-button) {
      opacity:1!important;
    }
  }
}

/* Todas as barras mobile terminam na mesma margem direita. */
@layer gp-mobile-toolbar {
  @media screen and (max-width:700px) {
    html body {--gp-mobile-toolbar-right:15px;}
    html body .gp-shell>.gp-compact-navigation+.gp-content.gp-content
        :is(.gp-page-controls,.gp-title-row):has(> :is(vaadin-button,.gp-page-search-action)),
    html body .gp-shell>.gp-compact-navigation+.gp-content.gp-content
        .gp-title-row:has(>.gp-summary-filter-kpi) {
      right:var(--gp-mobile-toolbar-right)!important;
    }
  }
}

/* Traços do menu: 16px de extensão + 1,8px das pontas, dentro do botão de 38px. */
@layer gp-mobile-toolbar {
  @media screen and (max-width:700px) {
    html body .gp-navigation.gp-compact-navigation {column-gap:0!important;}
    html body .gp-navigation.gp-compact-navigation>.gp-navigation-title {
      padding-left:calc(14px - (38px - 17.8px) / 2)!important;
    }
    html body vaadin-button.gp-main-menu {
      background:transparent!important;border:0!important;outline:none!important;
      box-shadow:none!important;color:var(--gp-text)!important;opacity:1!important;
    }
    html body vaadin-button.gp-main-menu::before,
    html body vaadin-button.gp-main-menu::after {
      background:transparent!important;border:0!important;box-shadow:none!important;opacity:0!important;
    }
    html body vaadin-button.gp-main-menu svg {color:var(--gp-text)!important;opacity:1!important;}
  }
}

/* Caixa de cada ação acompanha os limites reais do desenho, mantendo sua escala. */
@layer gp-mobile-toolbar {
  @media screen and (max-width:700px) {
    html body .gp-shell>.gp-compact-navigation+.gp-content.gp-content.gp-content.gp-content
        :is(.gp-page-controls,.gp-title-row) :is(vaadin-icon,.gp-summary-glyph,.gp-search-filter-funnel-v044),
    html body .gp-shell>.gp-compact-navigation+.gp-content.gp-content.gp-content.gp-content
        :is(.gp-page-controls,.gp-title-row) :is(.gp-summary-glyph,.gp-search-filter-funnel-v044)>svg {
      width:var(--gp-icon-drawing-width,var(--gp-toolbar-icon-width,16px))!important;
      min-width:var(--gp-icon-drawing-width,var(--gp-toolbar-icon-width,16px))!important;
      height:var(--gp-icon-drawing-height,var(--gp-toolbar-icon-width,16px))!important;
      flex-basis:var(--gp-icon-drawing-width,var(--gp-toolbar-icon-width,16px))!important;
      padding:0!important;
    }
    html body .gp-shell>.gp-compact-navigation+.gp-content.gp-content.gp-content.gp-content
        :is(.gp-page-controls,.gp-title-row) .gp-page-search-action:has(>.gp-page-search-button) {
      width:auto!important;min-width:0!important;max-width:none!important;flex-basis:auto!important;
    }
    html body .gp-shell>.gp-compact-navigation+.gp-content.gp-content.gp-content.gp-content
        :is(.gp-page-controls,.gp-title-row) .gp-page-search-button {
      width:var(--gp-toolbar-icon-width,16px)!important;
      min-width:var(--gp-toolbar-icon-width,16px)!important;
      max-width:var(--gp-toolbar-icon-width,16px)!important;
      flex-basis:var(--gp-toolbar-icon-width,16px)!important;
    }
  }
}

/* Títulos mobile: páginas e modais usam 17px sem alterar o peso ou alinhamento. */
@layer gp-mobile-titles {
  @media screen and (max-width:700px) {
    html body :is(vaadin-dialog,vaadin-dialog-overlay,vaadin-confirm-dialog,vaadin-confirm-dialog-overlay) {
      --vaadin-dialog-title-font-size:17px!important;
    }
    html body .gp-navigation.gp-compact-navigation>.gp-navigation-title,
    html body vaadin-dialog>h2[slot="title"],
    html body vaadin-confirm-dialog>[slot="header"],
    html body vaadin-dialog::part(title),
    html body vaadin-dialog-overlay::part(title),
    html body vaadin-confirm-dialog::part(header),
    html body vaadin-confirm-dialog-overlay::part(header),
    html body .gp-factory-new-heading,
    html body .gp-summary-secondary-toolbar .gp-summary-filter-kpi>h3 {
      font-size:17px!important;
    }
  }
}

/* Cabeçalhos das tabelas mobile preservam a geometria comum. */
@layer gp-mobile-tables {
  @media screen and (max-width:700px) {
    html body vaadin-grid::part(header-cell),
    html body table thead th,
    html body .gp-period-ranking-row:first-child>span {
      font-size:15px!important;
      font-weight:600!important;
    }
  }
}

/* Factory launches: expandable records on phones; desktop keeps the grid. */
.gp-factory-mobile-cards { display: none; }
@media screen and (max-width: 700px) {
  html body vaadin-grid.gp-factory-launch-grid { display: none !important; }
  .gp-factory-mobile-cards { display: grid; gap: 12px; color: var(--gp-text); }
  vaadin-details.gp-factory-card { margin: 0; border: 1px solid var(--gp-border); border-radius: 6px; overflow: hidden; }
  .gp-factory-card vaadin-details-summary { padding: 12px; background: var(--gp-table-stripe); color: var(--gp-text); }
  vaadin-details.gp-factory-card::part(content) { padding: 12px; }
  .gp-factory-card-summary { display: grid; width: 100%; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 4px 12px; font-size: 16px; font-weight: 600; font-variant-numeric: tabular-nums; }
  .gp-factory-card-summary > span { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .gp-factory-card-summary > span:nth-child(2) { text-align: center; }
  .gp-factory-card-code { grid-column: 3; text-align: right; }
  .gp-factory-card-section { display: grid; gap: 2px; }
  .gp-factory-card-section > span { color: var(--gp-text); }
  .gp-factory-card-editing-actions { justify-content: flex-end; gap: 12px; }
  .gp-factory-card-body, .gp-factory-card-occurrences { display: grid; gap: 12px; font-size: 16px; }
  .gp-factory-card-production { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; font-variant-numeric: tabular-nums; }
  .gp-factory-card-occurrences { gap: 12px; white-space: normal; overflow-wrap: anywhere; }
}

@media screen and (max-width: 700px) {
  html body .gp-compact-navigation + .gp-content:has(> .gp-factory-mobile-cards) { padding-top: 8px !important; }
  .gp-factory-card-field { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 8px; min-width: 0; }
  .gp-factory-card-field > vaadin-text-field { min-width: 0; margin: 0; }
  .gp-factory-card-footer { display: flex; align-items: center; justify-content: flex-end; height: 38px; min-height: 38px; }
  .gp-factory-card-footer > * { margin: 0 !important; }
  .gp-factory-card-field > span { grid-column: 1; grid-row: 1; align-self: center; white-space: nowrap; }
  .gp-factory-card-field > vaadin-text-field { grid-column: 2; grid-row: 1; align-self: center; white-space: normal; }
  .gp-factory-card-occurrences > span { white-space: pre-wrap; }
  html body vaadin-dialog.gp-modal-v053.gp-factory-delete-confirmation::part(overlay),
  html body vaadin-dialog-overlay[theme~="gp-modal-v053"][theme~="gp-factory-delete-confirmation"]::part(overlay) {
    width: min(320px, calc(100vw - 48px)) !important;
    max-width: min(320px, calc(100vw - 48px)) !important;
  }
  html body vaadin-dialog.gp-modal-v053.gp-factory-delete-confirmation::part(content),
  html body vaadin-dialog-overlay[theme~="gp-modal-v053"][theme~="gp-factory-delete-confirmation"]::part(content) {
    display: flex; align-items: center; justify-content: center; text-align: center;
  }
  html body vaadin-dialog.gp-modal-v053.gp-factory-delete-confirmation::part(footer),
  html body vaadin-dialog-overlay[theme~="gp-modal-v053"][theme~="gp-factory-delete-confirmation"]::part(footer) {
    align-items: center !important; justify-content: center !important;
  }
  html body .gp-factory-card-actions.gp-action-buttons { align-items: center !important; justify-content: flex-end !important; gap: var(--gp-card-icon-gap,20px) !important; }
  html body .gp-factory-card-actions.gp-action-buttons > vaadin-button.gp-action-icon:not([hidden]):not([slot="suffix"]) {
    padding: 0 !important; margin: 0 !important; background: transparent !important; border: 0 !important;
  }
}

/* Commercial registries share the Factory card layout on phones. */
@media screen and (max-width: 700px) {
  html body vaadin-grid.gp-business-registry-grid { display: none !important; }
}
