/* Somente diferenças do navegador/web. Nada deste arquivo é carregado pelo desktop. */
html[data-runtime='web'],
html[data-runtime='web'] body,
html[data-runtime='web'] #root {
  min-width: 0;
  width: 100%;
  max-width: 100%;
}

html[data-runtime='web'] body {
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}

html[data-runtime='web'] .app-shell {
  min-width: 0;
  min-height: 100dvh;
  height: 100dvh;
}

html[data-runtime='web'] .workspace,
html[data-runtime='web'] .content-scroll,
html[data-runtime='web'] .page,
html[data-runtime='web'] .panel {
  min-width: 0;
}

html[data-runtime='web'] .busy-indicator::first-letter {
  text-transform: uppercase;
}

html[data-runtime='web'] .data-table-wrap,
html[data-runtime='web'] .spreadsheet-wrap,
html[data-runtime='web'] .table-scroll {
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* Tablet: reduz a densidade antes de chegar ao layout de celular. */
@media (max-width: 1024px) {
  html[data-runtime='web'] .page {
    padding-right: 18px;
    padding-left: 18px;
  }

  html[data-runtime='web'] .topbar {
    padding-right: 18px;
    padding-left: 18px;
  }

  html[data-runtime='web'] .page-header {
    min-height: 112px;
    padding: 20px 22px;
  }
}

/* Aplicativo web no celular. A navegação lateral vira um dock inferior rolável. */
@media (max-width: 820px) {
  html[data-runtime='web'] body {
    min-width: 0 !important;
    overflow: hidden;
    font-size: 14px;
  }

  html[data-runtime='web'] .app-shell,
  html[data-runtime='web'] .app-shell.sidebar-collapsed {
    display: grid;
    grid-template-columns: minmax(0, 1fr) !important;
    grid-template-rows: minmax(0, 1fr) auto;
    height: 100dvh;
    min-height: 100dvh;
  }

  html[data-runtime='web'] .workspace {
    grid-column: 1;
    grid-row: 1;
    min-height: 0;
    grid-template-rows: 62px minmax(0, 1fr);
  }

  html[data-runtime='web'] .sidebar {
    position: relative;
    z-index: 90;
    grid-column: 1;
    grid-row: 2;
    display: flex;
    width: 100%;
    min-width: 0;
    height: calc(70px + env(safe-area-inset-bottom));
    flex-direction: row;
    align-items: stretch;
    border: 0;
    border-top: 1px solid #dedfe2;
    background: rgb(255 255 255 / 97%);
    color: #34373c;
    box-shadow: 0 -8px 24px rgb(20 24 31 / 8%);
    backdrop-filter: blur(12px);
    overflow: hidden;
    padding-bottom: env(safe-area-inset-bottom);
  }

  html[data-runtime='web'] .sidebar .brand,
  html[data-runtime='web'] .sidebar .nav-label,
  html[data-runtime='web'] .sidebar .nav-spacer,
  html[data-runtime='web'] .sidebar .local-status,
  html[data-runtime='web'] .sidebar .sidebar-toggle {
    display: none !important;
  }

  html[data-runtime='web'] .sidebar-navigation {
    display: flex;
    min-width: 0;
    flex: 1 1 auto;
    align-items: stretch;
    overflow-x: auto;
    overflow-y: hidden;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }

  html[data-runtime='web'] .sidebar-navigation::-webkit-scrollbar {
    display: none;
  }

  html[data-runtime='web'] .sidebar-navigation .nav-group {
    display: contents;
  }

  html[data-runtime='web'] .sidebar .main-nav,
  html[data-runtime='web'] .sidebar-collapsed .main-nav {
    display: flex;
    flex: 0 0 auto;
    flex-direction: row;
    gap: 2px;
    padding: 5px 4px;
  }

  html[data-runtime='web'] .sidebar .nav-secondary {
    flex: 0 0 auto;
    border-left: 1px solid #ececee;
    background: #fff;
  }

  html[data-runtime='web'] .sidebar .main-nav button,
  html[data-runtime='web'] .sidebar-collapsed .main-nav button {
    display: flex;
    width: 72px;
    min-width: 72px;
    height: 58px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 5px 3px;
    border-radius: 10px;
    color: #5e646d;
    text-align: center;
  }

  html[data-runtime='web'] .sidebar .main-nav button svg {
    width: 20px;
    height: 20px;
  }

  html[data-runtime='web'] .sidebar .main-nav button span,
  html[data-runtime='web'] .sidebar-collapsed .main-nav button span {
    display: block;
    width: 100%;
    flex: 0 0 auto;
    overflow: hidden;
    color: inherit;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.1;
    text-overflow: clip;
    white-space: normal;
  }

  html[data-runtime='web'] .sidebar .main-nav button em {
    position: absolute;
    margin: -30px 0 0 31px;
    min-width: 17px;
    height: 17px;
    padding: 0 4px;
    font-size: 8px;
  }

  html[data-runtime='web'] .sidebar .main-nav button.active {
    background: #fff0f1;
    color: #cc1720;
    box-shadow: none;
  }

  html[data-runtime='web'] .sidebar .main-nav button.active svg {
    color: #ed1f27;
  }

  html[data-runtime='web'] .topbar {
    min-width: 0;
    height: 62px;
    padding: 0 12px 0 15px;
  }

  html[data-runtime='web'] .topbar-context {
    min-width: 0;
  }

  html[data-runtime='web'] .topbar-context span {
    display: none;
  }

  html[data-runtime='web'] .topbar-context strong {
    max-width: min(52vw, 260px);
    margin: 0;
    overflow: hidden;
    font-size: 15px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  html[data-runtime='web'] .topbar-actions {
    gap: 4px;
  }

  html[data-runtime='web'] .topbar-account > div {
    display: none;
  }

  html[data-runtime='web'] .topbar .icon-button,
  html[data-runtime='web'] .topbar button {
    min-width: 40px;
    min-height: 40px;
  }

  html[data-runtime='web'] .topbar-popover,
  html[data-runtime='web'] .notification-popover,
  html[data-runtime='web'] .account-popover {
    position: fixed;
    z-index: 120;
    top: 67px;
    right: 10px;
    left: 10px;
    width: auto;
    max-width: none;
    max-height: calc(100dvh - 150px);
  }

  html[data-runtime='web'] .content-scroll {
    min-width: 0;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior-y: contain;
    -webkit-overflow-scrolling: touch;
  }

  html[data-runtime='web'] .page {
    width: 100%;
    max-width: none;
    min-width: 0;
    padding: 14px 12px 26px;
  }

  html[data-runtime='web'] .page-header {
    min-height: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 16px;
    margin-bottom: 14px;
    padding: 19px 17px;
    border-radius: 14px;
  }

  html[data-runtime='web'] .page-header::after {
    right: -30px;
    bottom: -98px;
    opacity: .75;
  }

  html[data-runtime='web'] .page-header h1 {
    font-size: clamp(25px, 8vw, 31px);
  }

  html[data-runtime='web'] .page-header p {
    max-width: none;
    font-size: 14px;
  }

  html[data-runtime='web'] .page-actions {
    width: 100%;
    flex-wrap: wrap;
    gap: 8px;
  }

  html[data-runtime='web'] .page-actions .button {
    min-height: 44px;
    flex: 1 1 140px;
  }

  html[data-runtime='web'] .button {
    min-height: 44px;
  }

  html[data-runtime='web'] .icon-button {
    width: 40px;
    height: 40px;
    flex-basis: 40px;
  }

  html[data-runtime='web'] input,
  html[data-runtime='web'] select,
  html[data-runtime='web'] textarea {
    max-width: 100%;
    font-size: 16px;
  }

  html[data-runtime='web'] .field input,
  html[data-runtime='web'] .field select,
  html[data-runtime='web'] .field textarea {
    min-height: 46px;
  }

  html[data-runtime='web'] .panel,
  html[data-runtime='web'] .stat-card {
    max-width: 100%;
  }

  /* Grids de dashboard e formulários viram uma coluna no telefone. */
  html[data-runtime='web'] .dashboard-grid,
  html[data-runtime='web'] .stat-grid,
  html[data-runtime='web'] .metric-grid,
  html[data-runtime='web'] .category-grid,
  html[data-runtime='web'] .goal-grid,
  html[data-runtime='web'] .alerts-layout,
  html[data-runtime='web'] .sales-analysis-grid,
  html[data-runtime='web'] .cash-current-layout,
  html[data-runtime='web'] .inventory-grid,
  html[data-runtime='web'] .purchase-grid,
  html[data-runtime='web'] .form-grid,
  html[data-runtime='web'] .form-grid-two,
  html[data-runtime='web'] .form-grid-three,
  html[data-runtime='web'] .product-form-grid,
  html[data-runtime='web'] .ai-workspace {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  html[data-runtime='web'] .period-filter,
  html[data-runtime='web'] .sales-toolbar {
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 8px;
  }

  html[data-runtime='web'] .period-filter .button,
  html[data-runtime='web'] .sales-toolbar .button,
  html[data-runtime='web'] .period-filter select,
  html[data-runtime='web'] .sales-toolbar select,
  html[data-runtime='web'] .sales-toolbar input {
    width: 100%;
  }

  /* Tabelas continuam completas, mas rolam dentro do próprio bloco. */
  html[data-runtime='web'] .data-table-wrap {
    margin-right: -4px;
    margin-left: -4px;
    padding-right: 4px;
    padding-left: 4px;
  }

  html[data-runtime='web'] .data-table {
    min-width: 680px;
  }

  /* Linhas complexas de edição não estouram a viewport. */
  html[data-runtime='web'] .product-option-main,
  html[data-runtime='web'] .product-option-recipe-row,
  html[data-runtime='web'] .purchase-batch-fields,
  html[data-runtime='web'] .preparation-recipe-row,
  html[data-runtime='web'] .reconciliation-origin {
    grid-template-columns: minmax(0, 1fr) !important;
    padding-left: 11px;
  }

  html[data-runtime='web'] .product-option-main > *,
  html[data-runtime='web'] .product-option-recipe-row > *,
  html[data-runtime='web'] .purchase-batch-fields > *,
  html[data-runtime='web'] .preparation-recipe-row > * {
    grid-column: auto !important;
  }

  html[data-runtime='web'] .production-order {
    min-width: 620px;
  }

  /* Modais ocupam quase a tela inteira e preservam o rodapé de ações. */
  html[data-runtime='web'] .modal-backdrop {
    z-index: 130;
    align-items: flex-end;
    padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
  }

  html[data-runtime='web'] .modal,
  html[data-runtime='web'] .modal-large {
    width: 100%;
    max-width: none;
    max-height: calc(100dvh - 16px - env(safe-area-inset-bottom));
    border-radius: 14px 14px 8px 8px;
    box-shadow: 0 -12px 44px rgb(0 0 0 / 22%);
  }

  html[data-runtime='web'] .modal-header {
    gap: 10px;
    padding: 17px 16px;
  }

  html[data-runtime='web'] .modal-body {
    padding: 16px;
    -webkit-overflow-scrolling: touch;
  }

  html[data-runtime='web'] .modal-footer {
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px 16px;
  }

  html[data-runtime='web'] .modal-footer .button {
    flex: 1 1 130px;
  }

  /* IA: no celular ela vira uma folha alta, sem cobrir a navegação inferior. */
  html[data-runtime='web'] .assistant-launcher {
    right: 13px;
    bottom: calc(82px + env(safe-area-inset-bottom));
  }

  html[data-runtime='web'] .assistant-drawer {
    right: 8px;
    bottom: calc(78px + env(safe-area-inset-bottom));
    left: 8px;
    width: auto;
    height: min(720px, calc(100dvh - 94px - env(safe-area-inset-bottom)));
    max-height: none;
    border-radius: 14px 14px 8px 8px;
    box-shadow: 0 12px 42px rgb(0 0 0 / 24%);
    transform-origin: center bottom;
  }

  html[data-runtime='web'] .assistant-drawer-head {
    min-height: 62px;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 9px;
    padding: 9px 11px;
  }

  html[data-runtime='web'] .assistant-drawer-body {
    -webkit-overflow-scrolling: touch;
  }

  /* Login/cadastro: uma coluna, marca compacta e formulário imediatamente visível. */
  html[data-runtime='web'] .auth-screen {
    display: block;
    width: 100%;
    height: 100dvh;
    min-height: 100dvh;
    overflow-y: auto;
    background: #f0f0ed;
    font-family: var(--font-retro);
    -webkit-overflow-scrolling: touch;
  }

  html[data-runtime='web'] .auth-brand-panel {
    display: grid;
    min-height: 0;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    padding: 17px 17px 15px;
    border: 0;
    border-bottom: 1px solid #111;
  }

  html[data-runtime='web'] .auth-brand-copy {
    display: none;
  }

  html[data-runtime='web'] .auth-brand-lockup {
    min-width: 0;
  }

  html[data-runtime='web'] .auth-brand-lockup strong {
    font-size: 17px;
  }

  html[data-runtime='web'] .auth-security-line {
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
  }

  html[data-runtime='web'] .auth-security-line span {
    display: none;
  }

  html[data-runtime='web'] .auth-entry-panel {
    display: flex;
    min-height: calc(100dvh - 76px);
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 18px 12px calc(28px + env(safe-area-inset-bottom));
  }

  html[data-runtime='web'] .auth-window {
    width: 100%;
    max-width: 520px;
    margin: 0;
    box-shadow: 5px 5px 0 #111;
  }

  html[data-runtime='web'] .auth-window-titlebar {
    min-height: 38px;
    padding-left: 12px;
  }

  html[data-runtime='web'] .auth-card {
    padding: 22px 17px 20px;
  }

  html[data-runtime='web'] .auth-card h1 {
    font-size: clamp(29px, 9vw, 40px);
    line-height: .98;
  }

  html[data-runtime='web'] .auth-description {
    font-size: 14px;
    line-height: 1.55;
  }

  html[data-runtime='web'] .auth-form {
    gap: 14px;
  }

  html[data-runtime='web'] .auth-field > div {
    min-height: 48px;
  }

  html[data-runtime='web'] .auth-field input {
    min-width: 0;
    min-height: 46px;
    font-size: 16px;
  }

  html[data-runtime='web'] .auth-primary-button,
  html[data-runtime='web'] .auth-secondary-button {
    min-height: 48px;
  }

  html[data-runtime='web'] .auth-version {
    position: static;
    min-width: 0;
    width: 100%;
    max-width: 520px;
    padding: 10px 2px 0;
    font-size: 12px;
  }
}

@media (max-width: 420px) {
  html[data-runtime='web'] .sidebar .main-nav button,
  html[data-runtime='web'] .sidebar-collapsed .main-nav button {
    width: 67px;
    min-width: 67px;
  }

  html[data-runtime='web'] .page {
    padding-right: 10px;
    padding-left: 10px;
  }

  html[data-runtime='web'] .page-header {
    padding: 17px 15px;
  }

  html[data-runtime='web'] .auth-entry-panel {
    padding-right: 9px;
    padding-left: 9px;
  }

  html[data-runtime='web'] .auth-card {
    padding-right: 14px;
    padding-left: 14px;
  }

  html[data-runtime='web'] .topbar-context strong {
    max-width: 44vw;
  }
}

/* Os painéis e os editores de itens também precisam abandonar as colunas do desktop. */
@media screen and (max-width: 1024px) {
  html[data-runtime='web'] :is(.dashboard-columns, .lower-columns, .welcome-panel, .products-layout, .settings-layout, .supplier-manager, .category-manager-grid, .public-menu-import, .cloud-account-grid, .preparation-grid, .report-pack, .intelligence-hero) {
    grid-template-columns: minmax(0, 1fr);
    min-width: 0;
  }

  html[data-runtime='web'] .pricing-history-panel {
    position: static;
    width: 100%;
    min-width: 0;
  }

  html[data-runtime='web'] .product-row-card {
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
    min-width: 0;
  }

  html[data-runtime='web'] .product-row-card > * {
    grid-column: auto;
    grid-row: auto;
    min-width: 0;
  }

  html[data-runtime='web'] .product-main,
  html[data-runtime='web'] .product-main > div,
  html[data-runtime='web'] .product-title-line {
    min-width: 0;
  }

  html[data-runtime='web'] .product-title-line {
    flex-wrap: wrap;
  }

  html[data-runtime='web'] .product-title-line > strong {
    max-width: none;
    overflow: visible;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  html[data-runtime='web'] :is(.combo-item-row, .purchase-item-row, .sale-item-row, .recipe-editor-row, .preparation-recipe-row, .split-payment-row, .refund-item-list article, .production-order, .stock-movement-list article, .inventory-count-list article, .product-option-main, .product-option-recipe-row, .coverage-row) {
    grid-template-columns: minmax(0, 1fr);
    min-width: 0;
    max-width: 100%;
  }

  html[data-runtime='web'] :is(.combo-item-row, .purchase-item-row, .sale-item-row, .recipe-editor-row, .preparation-recipe-row, .split-payment-row, .product-option-main, .product-option-recipe-row) > * {
    grid-column: auto;
    min-width: 0;
    max-width: 100%;
  }

  html[data-runtime='web'] :is(.combo-item-row, .purchase-item-row, .sale-item-row, .recipe-editor-row, .preparation-recipe-row, .split-payment-row) > .icon-button {
    justify-self: end;
  }

  html[data-runtime='web'] .field,
  html[data-runtime='web'] .field > :is(input, select, textarea),
  html[data-runtime='web'] .input-prefix,
  html[data-runtime='web'] .input-suffix,
  html[data-runtime='web'] .input-prefix input,
  html[data-runtime='web'] .input-suffix input,
  html[data-runtime='web'] .search-field {
    min-width: 0;
    max-width: 100%;
  }

  html[data-runtime='web'] .form-grid-four {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  html[data-runtime='web'] :is(.calculation-strip, .sale-preview, .sale-detail-kpis, .sale-detail-breakdown, .product-numbers, .combo-metrics, .preparation-metrics) {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  html[data-runtime='web'] :is(.product-photo-field, .profile-photo-field) {
    grid-template-columns: 58px minmax(0, 1fr);
  }

  html[data-runtime='web'] :is(.product-photo-field, .profile-photo-field) > button {
    grid-column: 1 / -1;
  }
}

.ca-mobile-controls,
.ca-mobile-menu-backdrop,
.ca-mobile-controls[hidden],
.ca-mobile-menu-backdrop[hidden] {
  display: none;
}

@media screen and (max-width: 820px) {
  html[data-runtime='web'] .app-shell {
    height: var(--ca-mobile-height, 100dvh);
    min-height: 0;
  }

  html[data-runtime='web'].ca-mobile-navigation-ready .app-shell {
    grid-template-rows: minmax(0, 1fr) calc(70px + env(safe-area-inset-bottom));
  }

  html[data-runtime='web'].ca-mobile-navigation-ready .sidebar {
    display: none;
  }

  html[data-runtime='web'] .ca-mobile-controls:not([hidden]) {
    position: fixed;
    z-index: 90;
    right: 0;
    bottom: var(--ca-mobile-keyboard-offset, 0px);
    left: 0;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 4px;
    height: calc(70px + env(safe-area-inset-bottom));
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
    border-top: 1px solid #d7d7d7;
    background: #fff;
    box-shadow: 0 -4px 16px rgb(0 0 0 / 7%);
  }

  html[data-runtime='web'] .ca-mobile-controls button {
    display: flex;
    min-width: 0;
    min-height: 48px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 4px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #52555b;
    font: 600 12px/1.2 Arial, sans-serif;
    cursor: pointer;
  }

  html[data-runtime='web'] .ca-mobile-controls :is(svg, .ca-mobile-menu-icon) {
    width: 21px;
    height: 21px;
    font-size: 21px;
    line-height: 21px;
  }

  html[data-runtime='web'] .ca-mobile-controls button.active,
  html[data-runtime='web'] .ca-mobile-controls button[aria-expanded='true'] {
    background: #fff0f1;
    color: #cf1720;
  }

  html[data-runtime='web'] .ca-mobile-menu-backdrop:not([hidden]) {
    position: fixed;
    z-index: 120;
    inset: 0;
    bottom: var(--ca-mobile-keyboard-offset, 0px);
    display: flex;
    align-items: flex-end;
    background: rgb(0 0 0 / 48%);
  }

  html[data-runtime='web'] .ca-mobile-menu {
    display: grid;
    width: 100%;
    max-height: calc(var(--ca-mobile-height, 100dvh) - 40px);
    grid-template-rows: auto minmax(0, 1fr);
    padding-bottom: env(safe-area-inset-bottom);
    border-radius: 18px 18px 0 0;
    background: #fff;
    color: #17191d;
  }

  html[data-runtime='web'] .ca-mobile-menu > header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 18px;
    border-bottom: 1px solid #dedfe2;
  }

  html[data-runtime='web'] .ca-mobile-menu h2 {
    margin: 0;
    font: 700 18px/1.3 Arial, sans-serif;
  }

  html[data-runtime='web'] .ca-mobile-menu-close {
    width: 44px;
    height: 44px;
    border: 1px solid #dedfe2;
    border-radius: 8px;
    background: #fff;
    color: #17191d;
    font-size: 25px;
  }

  html[data-runtime='web'] .ca-mobile-menu-list {
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 12px 16px 20px;
  }

  html[data-runtime='web'] .ca-mobile-menu-list h3 {
    margin: 12px 0 8px;
    color: #727780;
    font: 700 12px/1.4 Arial, sans-serif;
  }

  html[data-runtime='web'] .ca-mobile-menu-group {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  html[data-runtime='web'] .ca-mobile-menu-group button {
    display: flex;
    min-width: 0;
    min-height: 56px;
    align-items: center;
    gap: 10px;
    padding: 12px;
    border: 1px solid #e0e1e3;
    border-radius: 8px;
    background: #fff;
    color: #25282d;
    text-align: left;
    font: 600 14px/1.35 Arial, sans-serif;
    overflow-wrap: anywhere;
  }

  html[data-runtime='web'] .ca-mobile-menu-group button.active {
    border-color: #d71920;
    background: #fff3f3;
    color: #bc171e;
  }

  html[data-runtime='web'] .ca-mobile-menu-group button svg {
    width: 20px;
    height: 20px;
    flex: none;
  }

  html[data-runtime='web'] :is(.ca-mobile-controls, .ca-mobile-menu) button:focus-visible {
    outline: 3px solid #d7192070;
    outline-offset: 2px;
  }

  html[data-runtime='web'].ca-mobile-menu-open .content-scroll {
    overflow: hidden;
  }

  html[data-runtime='web'] .page {
    font-size: 16px;
    overflow-wrap: anywhere;
  }

  html[data-runtime='web'] .page-header h1 {
    font-size: clamp(24px, 7vw, 30px);
    line-height: 1.1;
  }

  html[data-runtime='web'] .page :is(.eyebrow, .record-count, .stat-card small) {
    font-size: 12px;
    line-height: 1.5;
  }

  html[data-runtime='web'] .stat-card small {
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
  }

  html[data-runtime='web'] :is(.field > span, .stat-card-top > span:first-child, .section-title p, .empty-state p, .product-main p, .product-numbers span, .calculation-strip span) {
    font-size: 14px;
    line-height: 1.4;
  }

  html[data-runtime='web'] :is(.section-title h2, .product-title-line > strong) {
    font-size: 17px;
    line-height: 1.35;
  }

  html[data-runtime='web'] :is(.section-title, .table-toolbar, .welcome-actions, .data-safety-panel, .demo-panel, .cloud-sync-summary) {
    flex-wrap: wrap;
    gap: 12px;
    min-width: 0;
  }

  html[data-runtime='web'] .table-toolbar .search-field {
    width: 100%;
    flex: 1 1 100%;
  }

  html[data-runtime='web'] :is(.dashboard-columns > .panel, .welcome-panel, .settings-form-panel, .installation-panel, .pricing-history-panel) {
    min-height: 0;
    padding: 16px;
  }

  html[data-runtime='web'] :is(.form-section, .product-row-card) {
    padding: 14px;
    min-width: 0;
  }

  html[data-runtime='web'] :is(.diagnostics-grid, .ai-roadmap-grid, .ai-suggestions, .ai-prompt-grid, .ai-context-bar, .cloud-profile-form, .notification-preference-grid, .admin-architecture-grid, .form-grid-four, .cash-opening-guide, .import-summary) {
    grid-template-columns: minmax(0, 1fr);
  }

  html[data-runtime='web'] .stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 10px;
  }

  html[data-runtime='web'] .stat-card {
    min-height: 0;
    padding: 14px;
  }

  html[data-runtime='web'] .stat-card-top {
    align-items: flex-start;
    gap: 6px;
  }

  html[data-runtime='web'] .stat-card-top .stat-icon {
    width: 26px;
    height: 26px;
    flex: 0 0 26px;
  }

  html[data-runtime='web'] .stat-card > strong {
    margin-top: 12px;
    font-size: clamp(20px, 5.7vw, 25px);
    overflow-wrap: anywhere;
  }

  html[data-runtime='web'] .product-numbers > div,
  html[data-runtime='web'] .calculation-strip > div {
    min-width: 0;
  }

  html[data-runtime='web'] .product-numbers strong {
    font-size: 15px;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  html[data-runtime='web'] .product-row-card > .row-actions {
    justify-content: flex-end;
    flex-wrap: wrap;
    padding-top: 10px;
    border-top: 1px solid #e4e4e4;
  }

  /* Comparativos mantêm os cabeçalhos e rolam dentro do próprio painel. */
  html[data-runtime='web'] .sales-analysis-card {
    min-width: 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  html[data-runtime='web'] .sales-analysis-card :is(.sales-analysis-head, .sales-analysis-row) {
    min-width: 490px;
    font-size: 12px;
  }

  /* Contagem física: cada ingrediente mostra os três valores em um bloco. */
  html[data-runtime='web'] .inventory-count-editor-head {
    display: none;
  }

  html[data-runtime='web'] .inventory-count-editor-row {
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
    min-width: 0;
  }

  html[data-runtime='web'] .inventory-count-editor-row > strong {
    font-size: 14px;
  }

  html[data-runtime='web'] .inventory-count-editor-row > strong:nth-child(2)::before {
    content: 'Esperado: ';
  }

  html[data-runtime='web'] .inventory-count-editor-row > strong:last-child::before {
    content: 'Diferença: ';
  }

  html[data-runtime='web'] .inventory-count-editor-row > .input-suffix::before {
    content: 'Contado';
    grid-column: 1 / -1;
    font-size: 14px;
    font-weight: 600;
  }

  html[data-runtime='web'] .inventory-count-editor-row > .input-suffix {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    row-gap: 8px;
    border: 0;
    background: transparent;
  }

  html[data-runtime='web'] .inventory-count-editor-row > .input-suffix input {
    width: 100%;
    min-height: 46px;
    border: 1px solid #aaa;
    border-radius: 4px 0 0 4px;
  }

  html[data-runtime='web'] .inventory-count-editor-row > .input-suffix > span {
    display: grid;
    min-height: 46px;
    place-items: center;
    border: 1px solid #aaa;
    border-left: 0;
    border-radius: 0 4px 4px 0;
    background: #f3f3f1;
  }

  html[data-runtime='web'] .inventory-count-editor-row .table-primary {
    min-width: 0;
  }

  html[data-runtime='web'] .inventory-count-editor-row .table-primary strong {
    font-size: 16px;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  html[data-runtime='web'] .modal-backdrop {
    bottom: var(--ca-mobile-keyboard-offset, 0px);
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
  }

  html[data-runtime='web'] .modal {
    max-height: calc(var(--ca-mobile-height, 100dvh) - 12px - env(safe-area-inset-bottom));
  }

  html[data-runtime='web'] .modal-header > div {
    min-width: 0;
  }

  html[data-runtime='web'] .modal-header h2 {
    font-size: 22px;
    line-height: 1.2;
    overflow-wrap: anywhere;
  }

  html[data-runtime='web'] .modal-header p {
    font-size: 13px;
    line-height: 1.5;
  }

  html[data-runtime='web'] .modal-body {
    padding: 14px;
    overflow-x: hidden;
    scrollbar-gutter: auto;
  }

  html[data-runtime='web'] .modal-footer {
    padding: 12px 14px;
  }

  html[data-runtime='web'] .button {
    font-size: 13px;
    line-height: 1.3;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  html[data-runtime='web'] .ca-ai {
    height: var(--ca-mobile-height, 100dvh);
  }

  html[data-runtime='web'] .ca-ai :is(.ca-ai-header, .ca-ai-toolbar) {
    min-width: 0;
    flex-wrap: wrap;
  }

  html[data-runtime='web'] .ca-ai-header-actions {
    margin-left: auto;
  }

  html[data-runtime='web'] .ca-ai .ca-ai-icon {
    width: 44px;
    height: 44px;
  }
}

@media screen and (max-width: 350px) {
  html[data-runtime='web'] .stat-grid {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  html[data-runtime='web'] .ca-mobile-menu-group {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media print {
  html[data-runtime='web'] body {
    min-width: 0;
    overflow: visible;
  }

  html[data-runtime='web'] .sidebar,
  html[data-runtime='web'] .topbar,
  html[data-runtime='web'] .assistant-launcher,
  html[data-runtime='web'] .assistant-drawer {
    display: none !important;
  }

  html[data-runtime='web'] .app-shell {
    display: block;
  }

  html[data-runtime='web'] .workspace,
  html[data-runtime='web'] .content-scroll {
    height: auto;
    overflow: visible;
  }
}
