/* GestorPro V95.0 — responsividade base acumulada e estabilizada */
/* ================================================================
   V92 — UX MOBILE / NAVEGACAO RESPONSIVA
   Mantem o desktop e melhora uso com uma mao em telas pequenas.
   ================================================================ */

.topbar-heading {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.topbar-title-block {
  min-width: 0;
}

.topbar-title-block h2 {
  margin: 0 0 5px;
  color: #F7FAFB;
  font-size: 1.24rem;
  line-height: 1.15;
}

.mobile-company-logo {
  display: none;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  font-size: 0.82rem;
  animation: none;
}

.topbar-company-name,
.sync-state {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
}

.sync-state {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.sync-state::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--success);
  box-shadow: 0 0 12px rgba(75, 210, 162, 0.5);
}

.topbar-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
}

.topbar-action-btn svg {
  width: 17px;
  height: 17px;
}

.mobile-menu-head,
.mobile-menu-quick-actions,
.mobile-menu-logout,
.mobile-menu-handle {
  display: none;
}

button,
[role="button"] {
  touch-action: manipulation;
}

@media (max-width: 980px) {
  html {
    scroll-padding-bottom: calc(96px + env(safe-area-inset-bottom));
  }

  body.mobile-menu-open {
    overflow: hidden;
    overscroll-behavior: none;
  }

  .app-shell {
    padding-bottom: calc(78px + env(safe-area-inset-bottom));
  }

  .main-panel {
    min-height: 100dvh;
  }

  .topbar {
    z-index: 14;
    gap: 10px;
    padding: 12px 14px 10px;
    padding-top: max(12px, env(safe-area-inset-top));
    border-bottom-color: rgba(22, 141, 76, 0.16);
    background: rgba(7, 11, 17, 0.94);
    box-shadow: 0 8px 26px rgba(0, 0, 0, 0.22);
    backdrop-filter: blur(18px);
  }

  .topbar-heading {
    width: 100%;
  }

  .mobile-company-logo {
    display: grid;
  }

  .topbar-title-block {
    flex: 1;
  }

  .topbar-title-block h2 {
    overflow: hidden;
    margin: 0 0 4px;
    font-size: 1.12rem;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .topbar-meta {
    gap: 8px;
  }

  .topbar-date {
    font-size: 0.72rem;
    letter-spacing: 0.025em;
  }

  .topbar-company-name,
  .sync-state {
    font-size: 0.72rem;
  }

  .topbar-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 46px;
    gap: 8px;
    width: 100%;
  }

  .topbar-actions button {
    min-height: 42px;
    margin: 0;
  }

  .topbar-icon-btn {
    width: 46px;
    min-width: 46px;
  }

  .view-root {
    padding: 14px 12px calc(98px + env(safe-area-inset-bottom));
  }

  .card,
  .form-card,
  .dashboard-card,
  .dashboard-panel,
  .dashboard-hero-card {
    border-radius: 12px;
  }

  .card:hover,
  .form-card:hover,
  .status-column:hover {
    transform: none;
  }

  .mobile-bottom-nav {
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 32;
    gap: 2px;
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
    border-right: 0;
    border-bottom: 0;
    border-left: 0;
    border-radius: 16px 16px 0 0;
    background: rgba(6, 10, 15, 0.97);
    box-shadow: 0 -12px 34px rgba(0, 0, 0, 0.42);
  }

  .mobile-bottom-nav button {
    min-height: 58px;
    border-radius: 10px;
    font-size: 0.68rem;
  }

  .mobile-bottom-nav svg {
    width: 20px;
    height: 20px;
  }

  .mobile-menu-panel {
    z-index: 30;
    align-items: end;
    padding: 0;
    background: rgba(0, 0, 0, 0.62);
    backdrop-filter: blur(6px);
  }

  .mobile-menu-card {
    width: 100%;
    max-height: min(84dvh, 720px);
    padding: 10px 14px calc(18px + env(safe-area-inset-bottom));
    border-right: 0;
    border-bottom: 0;
    border-left: 0;
    border-radius: 20px 20px 0 0;
    background:
      linear-gradient(180deg, rgba(22, 141, 76, 0.06), transparent 28%),
      rgba(12, 18, 27, 0.99);
    overscroll-behavior: contain;
  }

  .mobile-menu-handle {
    display: block;
    width: 44px;
    height: 5px;
    margin: 0 auto 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.25);
  }

  .mobile-menu-head {
    position: sticky;
    top: -10px;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 0 -2px 12px;
    padding: 4px 2px 10px;
    background: linear-gradient(180deg, rgba(12, 18, 27, 1) 74%, rgba(12, 18, 27, 0));
  }

  .mobile-menu-head .eyebrow {
    margin: 0 0 2px;
  }

  .mobile-menu-head h3 {
    margin: 0;
  }

  .mobile-menu-close {
    display: grid;
    place-items: center;
    width: 42px;
    min-width: 42px;
    height: 42px;
    padding: 0;
    border-radius: 12px;
  }

  .mobile-menu-close svg {
    width: 19px;
    height: 19px;
  }

  .mobile-menu-quick-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 12px;
  }

  .mobile-menu-quick-actions button {
    display: grid;
    place-items: center;
    gap: 6px;
    min-height: 68px;
    padding: 9px 6px;
    border: 1px solid rgba(22, 141, 76, 0.24);
    border-radius: 12px;
    background: rgba(22, 141, 76, 0.08);
    color: var(--text);
    font-size: 0.72rem;
    font-weight: 700;
    text-align: center;
  }

  .mobile-menu-quick-actions svg {
    width: 20px;
    height: 20px;
    color: #DEE1E8;
  }

  .mobile-menu-grid {
    gap: 8px;
  }

  .mobile-menu-grid button {
    min-height: 72px;
    border-color: rgba(143, 170, 202, 0.12);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.03);
    line-height: 1.2;
  }

  .mobile-menu-logout {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    min-height: 46px;
    margin-top: 12px;
    border: 1px solid rgba(255, 112, 102, 0.24);
    border-radius: 12px;
    background: rgba(255, 112, 102, 0.08);
    color: #ffb7b0;
    font-weight: 600;
  }

  .mobile-menu-logout svg {
    width: 18px;
    height: 18px;
    color: var(--danger);
  }

  input,
  select,
  textarea {
    min-height: 46px;
    font-size: 16px;
  }

  textarea {
    min-height: 104px;
  }

  .primary-btn,
  .ghost-btn,
  .danger-btn,
  .success-btn {
    min-height: 42px;
  }

  .table-card {
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-inline: contain;
  }

  .dashboard-shortcut,
  .mobile-bottom-nav button,
  .mobile-menu-grid button,
  .mobile-menu-quick-actions button {
    -webkit-tap-highlight-color: transparent;
  }
}

@media (max-width: 700px) {
  .entity-table-card {
    max-height: none;
    overflow: visible;
    border: 0;
    background: transparent;
    box-shadow: none;
  }

  .entity-table {
    min-width: 0;
    border-collapse: separate;
  }

  .entity-table thead {
    display: none;
  }

  .entity-table tbody {
    display: grid;
    gap: 10px;
  }

  .entity-table tbody tr {
    display: grid;
    width: 100%;
    padding: 4px 12px;
    border: 1px solid rgba(22, 141, 76, 0.16);
    border-radius: 12px;
    background:
      linear-gradient(180deg, rgba(255, 255, 255, 0.028), transparent),
      var(--panel);
    box-shadow: 0 10px 26px rgba(0, 0, 0, 0.2);
  }

  .entity-table tbody td {
    display: grid;
    grid-template-columns: minmax(92px, 38%) minmax(0, 1fr);
    gap: 12px;
    align-items: start;
    width: 100%;
    padding: 10px 0;
    border-bottom: 1px solid rgba(143, 170, 202, 0.11);
    text-align: right;
    overflow-wrap: anywhere;
  }

  .entity-table tbody td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.045em;
    text-align: left;
    text-transform: uppercase;
  }

  .entity-table tbody tr td:last-child {
    border-bottom: 0;
  }

  .entity-table .entity-actions-cell {
    display: block;
    text-align: left;
  }

  .entity-table .entity-actions-cell::before {
    display: block;
    margin-bottom: 8px;
  }

  .entity-table .entity-actions-cell .button-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    width: 100%;
  }

  .entity-table .entity-actions-cell .button-row button {
    width: 100%;
    min-height: 42px;
  }

  .entity-table .empty-row {
    padding: 0;
  }

  .entity-table .empty-row td {
    display: block;
    padding: 24px 14px;
    border: 0;
    text-align: center;
  }

  .entity-table .empty-row td::before {
    display: none;
  }
}

@media (max-width: 560px) {
  :root {
    --list-scroll-max: 330px;
    --table-scroll-max: 380px;
  }

  .topbar {
    padding-inline: 12px;
  }

  .topbar-date {
    display: none;
  }

  .topbar-meta {
    flex-wrap: nowrap;
    overflow: hidden;
  }

  .topbar-company-name {
    overflow: hidden;
    max-width: min(48vw, 220px);
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .sync-state {
    white-space: nowrap;
  }

  .topbar-actions {
    margin-top: 1px;
  }

  .topbar-action-btn span {
    font-size: 0.78rem;
  }

  .view-root {
    padding: 12px 10px calc(94px + env(safe-area-inset-bottom));
  }

  .card,
  .form-card {
    padding: 14px;
  }

  .section-head,
  .modal-head,
  .label-row {
    gap: 10px;
  }

  .section-head > .button-row,
  .modal-head > .button-row {
    width: 100%;
  }

  .button-row {
    gap: 8px;
  }

  .button-row > button,
  .button-row > a {
    min-height: 42px;
  }

  .dashboard-command {
    gap: 12px;
  }

  .dashboard-hero-card,
  .dashboard-card,
  .dashboard-panel {
    padding: 14px;
  }

  .dashboard-hero-card {
    gap: 14px;
    min-height: 0;
  }

  .dashboard-hero-card .muted {
    margin-bottom: 0;
  }

  .dashboard-hero-status {
    gap: 8px;
  }

  .dashboard-hero-pill {
    padding: 11px;
  }

  .dashboard-main-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .dashboard-main-grid > :not(.dashboard-kpi) {
    grid-column: 1 / -1;
  }

  .dashboard-kpi {
    min-height: 136px;
    padding: 13px;
  }

  .dashboard-kpi .dashboard-card-head {
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 6px;
  }

  .dashboard-kpi .dashboard-card-head h3 {
    font-size: 0.9rem;
    line-height: 1.22;
  }

  .dashboard-kpi .dashboard-card-icon {
    width: 34px;
    height: 34px;
    flex-basis: 34px;
  }

  .dashboard-kpi strong {
    font-size: 2rem;
  }

  .dashboard-shortcuts {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .dashboard-shortcut {
    min-height: 76px;
    gap: 7px;
    padding: 11px 8px;
    font-size: 0.82rem;
  }

  .dashboard-large-card {
    min-height: 0;
  }

  .dashboard-row,
  .trash-item {
    padding: 10px;
  }

  .mobile-menu-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .mobile-menu-grid button {
    min-height: 66px;
    padding: 9px 5px;
    font-size: 0.7rem;
  }

  .modal-root {
    z-index: 50;
    align-items: end;
    padding: 0;
    background: rgba(0, 0, 0, 0.7);
  }

  .modal-card {
    width: 100%;
    max-height: 91dvh;
    padding: 16px 14px calc(18px + env(safe-area-inset-bottom));
    border-right: 0;
    border-bottom: 0;
    border-left: 0;
    border-radius: 20px 20px 0 0;
    overscroll-behavior: contain;
  }

  .modal-head {
    position: sticky;
    top: -16px;
    z-index: 3;
    margin: -2px -2px 12px;
    padding: 8px 2px 10px;
    background: linear-gradient(180deg, var(--panel) 78%, rgba(13, 19, 28, 0));
  }

  .modal-head > button {
    width: 100%;
  }

  .form-grid.two,
  .form-grid.three,
  .form-grid.four {
    gap: 10px;
  }

  .sales-workspace {
    gap: 12px;
  }

  .sale-cart-panel {
    border-top-color: rgba(22, 141, 76, 0.3);
  }

  table:not(.entity-table) {
    min-width: 620px;
  }

  .toast {
    bottom: calc(84px + env(safe-area-inset-bottom));
  }
}

@media (max-width: 380px) {
  .topbar-company-name {
    max-width: 42vw;
  }

  .sync-state {
    display: none;
  }

  .mobile-menu-quick-actions {
    grid-template-columns: 1fr 1fr;
  }

  .mobile-menu-quick-actions button:last-child {
    grid-column: 1 / -1;
  }

  .dashboard-main-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-main-grid > :not(.dashboard-kpi) {
    grid-column: auto;
  }
}

/* V92.1 - Historico de vendas compacto no mobile */
.sale-items-summary {
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: middle;
}

@media (max-width: 700px) {
  .sales-entity-table-card {
    margin-top: 0;
  }

  .sales-entity-table tbody {
    gap: 6px;
  }

  .sales-entity-table tbody tr {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 3px 8px;
    padding: 7px 9px;
    border-radius: 10px;
  }

  .sales-entity-table tbody td {
    min-width: 0;
    padding: 0;
    border: 0;
    font-size: 0.78rem;
    line-height: 1.18;
    overflow: hidden;
  }

  /* Na lista inicial mobile, cliente/CPF/pagamento ficam somente no +Info. */
  .sales-entity-table tbody td[data-label="Cliente"],
  .sales-entity-table tbody td[data-label="CPF"],
  .sales-entity-table tbody td[data-label="Pagamento"] {
    display: none !important;
  }

  .sales-entity-table tbody td[data-label="Venda"] {
    grid-column: 1;
    grid-row: 1;
    display: block;
    white-space: nowrap;
    font-weight: 700;
    text-align: left;
  }

  .sales-entity-table tbody td[data-label="Data"] {
    grid-column: 2;
    grid-row: 1;
    display: block;
    white-space: nowrap;
    text-align: left;
    color: var(--muted);
  }

  .sales-entity-table tbody td[data-label="Total"] {
    grid-column: 3;
    grid-row: 1;
    display: block;
    white-space: nowrap;
    text-align: right;
    font-weight: 700;
  }

  .sales-entity-table tbody td[data-label="Venda"]::before,
  .sales-entity-table tbody td[data-label="Data"]::before,
  .sales-entity-table tbody td[data-label="Total"]::before {
    display: none;
  }

  .sales-entity-table tbody td[data-label="Item vendido"] {
    grid-column: 1 / -1;
    grid-row: 2;
    display: flex;
    align-items: center;
    gap: 5px;
    padding-top: 2px;
    text-align: left;
    white-space: nowrap;
  }

  .sales-entity-table tbody td[data-label="Item vendido"]::before {
    content: "Item:";
    display: inline;
    flex: 0 0 auto;
    font-size: 0.63rem;
    letter-spacing: 0;
    text-transform: none;
    white-space: nowrap;
  }

  .sales-entity-table .sale-items-summary {
    min-width: 0;
    flex: 1 1 auto;
    font-weight: 600;
  }

  .sales-entity-table .entity-actions-cell {
    grid-column: 1 / -1;
    grid-row: 3;
    display: block;
    padding-top: 4px;
  }

  .sales-entity-table .entity-actions-cell::before {
    display: none;
  }

  .sales-entity-table .entity-actions-cell .button-row {
    display: flex;
    flex-wrap: nowrap;
    gap: 4px;
    width: 100%;
  }

  .sales-entity-table .entity-actions-cell .button-row button {
    flex: 1 1 0;
    width: auto;
    min-width: 0;
    min-height: 28px;
    height: 28px;
    padding: 3px 6px;
    border-radius: 7px;
    font-size: 0.67rem;
    line-height: 1;
    white-space: nowrap;
  }
}

/* V92.2 - refinamentos de vendas e dashboard mobile */
@media (max-width: 700px) {
  /* Historico de vendas: remove o codigo OPERA da visualizacao inicial. */
  .sales-entity-table tbody tr {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .sales-entity-table tbody td[data-label="Venda"] {
    display: none !important;
  }

  .sales-entity-table tbody td[data-label="Data"] {
    grid-column: 1;
    grid-row: 1;
    font-size: 0.88rem;
    font-weight: 600;
    line-height: 1.15;
    color: var(--text);
  }

  .sales-entity-table tbody td[data-label="Total"] {
    grid-column: 2;
    grid-row: 1;
  }

  /* Dashboard: os dois KPIs principais permanecem lado a lado ate em telas estreitas. */
  .dashboard-main-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-main-grid > :not(.dashboard-kpi) {
    grid-column: 1 / -1;
  }

  .dashboard-kpi {
    min-height: 108px;
    gap: 6px;
    padding: 11px;
  }

  .dashboard-kpi > .muted {
    display: none;
  }

  .dashboard-kpi strong {
    font-size: 1.85rem;
  }
}

@media (max-width: 380px) {
  .dashboard-main-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
  }

  .dashboard-main-grid > :not(.dashboard-kpi) {
    grid-column: 1 / -1;
  }

  .dashboard-kpi {
    min-width: 0;
    padding: 9px;
  }

  .dashboard-kpi small {
    font-size: 0.67rem;
    line-height: 1.15;
  }

  .dashboard-kpi strong {
    font-size: 1.65rem;
  }
}

/* V92.3 - dashboard mobile ainda mais compacto */
.dashboard-main-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.dashboard-alert-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.dashboard-user-status {
  grid-template-columns: minmax(0, 1fr);
  width: min(340px, 100%);
}

.dashboard-cloud-status {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
}

.dashboard-cloud-status .dashboard-hero-pill {
  width: 100%;
}

@media (max-width: 700px) {
  /* Atalhos logo abaixo dos dois KPIs, com 3 por linha. */
  .dashboard-shortcuts-panel {
    padding: 11px;
  }

  .dashboard-shortcuts-panel .section-head {
    margin-bottom: 8px;
  }

  .dashboard-shortcuts-panel .section-head h3 {
    font-size: 0.94rem;
  }

  .dashboard-shortcuts {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 6px;
  }

  .dashboard-shortcut {
    min-width: 0;
    min-height: 62px;
    gap: 4px;
    padding: 8px 4px;
    font-size: 0.68rem;
    line-height: 1.08;
  }

  .dashboard-shortcut svg {
    width: 18px;
    height: 18px;
  }

  /* Alertas abaixo dos atalhos. */
  .dashboard-alert-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  /* Top 3 estoque baixo: uma linha curta por produto. */
  .dashboard-low-stock-card {
    padding: 11px;
  }

  .dashboard-low-stock-card .dashboard-card-head {
    gap: 8px;
    margin-bottom: 7px;
  }

  .dashboard-low-stock-card .dashboard-card-head h3 {
    font-size: 0.9rem;
  }

  .dashboard-low-stock-card .dashboard-card-icon {
    width: 30px;
    height: 30px;
    flex-basis: 30px;
  }

  .dashboard-low-stock-card .dashboard-list {
    gap: 5px;
  }

  .dashboard-low-stock-card .dashboard-row {
    flex-direction: row;
    align-items: center;
    gap: 7px;
    padding: 7px 8px;
  }

  .dashboard-low-stock-main {
    min-width: 0;
    flex: 1 1 auto;
  }

  .dashboard-low-stock-main strong {
    margin: 0 0 2px;
    overflow: hidden;
    font-size: 0.79rem;
    line-height: 1.05;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .dashboard-low-stock-main .muted {
    font-size: 0.68rem;
    line-height: 1;
    white-space: nowrap;
  }

  .dashboard-low-stock-row .tag {
    padding: 4px 6px;
    border-radius: 7px;
    font-size: 0.62rem;
    line-height: 1;
  }

  /* Contas a pagar: 3 resumos curtos lado a lado. */
  .dashboard-payables-panel {
    padding: 11px;
  }

  .dashboard-payables-panel .section-head {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
  }

  .dashboard-payables-panel .section-head h3 {
    margin: 0;
    font-size: 0.94rem;
  }

  .dashboard-payables-panel .section-head .ghost-btn {
    width: auto;
    min-height: 31px;
    padding: 5px 8px;
    font-size: 0.68rem;
  }

  .dashboard-payable-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 5px;
  }

  .dashboard-mini-metric {
    min-width: 0;
    min-height: 76px;
    gap: 3px;
    padding: 8px 6px;
    text-align: center;
  }

  .dashboard-mini-metric .dashboard-card-icon {
    display: none;
  }

  .dashboard-mini-metric span {
    min-height: 2.2em;
    font-size: 0.58rem;
    line-height: 1.08;
    letter-spacing: 0.02em;
  }

  .dashboard-mini-metric strong {
    font-size: 1.45rem;
    line-height: 1;
  }

  .dashboard-mini-metric small {
    display: none;
  }

  /* Backup/Nuvem fica no fim e ocupa o minimo de espaco. */
  .dashboard-cloud-panel {
    padding: 11px;
  }

  .dashboard-cloud-head {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 7px;
  }

  .dashboard-cloud-head h3 {
    margin: 0;
    font-size: 0.9rem;
  }

  .dashboard-cloud-head .ghost-btn {
    width: auto;
    min-height: 31px;
    padding: 5px 8px;
    font-size: 0.67rem;
  }

  .dashboard-cloud-status .dashboard-hero-pill {
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 5px 7px;
    padding: 8px;
  }

  .dashboard-cloud-status .dashboard-hero-pill svg {
    grid-row: 1 / 3;
    width: 18px;
    height: 18px;
  }

  .dashboard-cloud-status .dashboard-hero-pill span {
    font-size: 0.62rem;
  }

  .dashboard-cloud-status .dashboard-hero-pill strong {
    font-size: 0.76rem;
    white-space: nowrap;
  }

  .dashboard-cloud-status .dashboard-hero-pill small {
    grid-column: 2 / -1;
    overflow: hidden;
    font-size: 0.63rem;
    line-height: 1.1;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}

@media (max-width: 380px) {
  .dashboard-shortcuts {
    gap: 4px;
  }

  .dashboard-shortcut {
    min-height: 58px;
    padding: 7px 3px;
    font-size: 0.64rem;
  }

  .dashboard-payable-grid {
    gap: 4px;
  }

  .dashboard-mini-metric {
    padding: 7px 4px;
  }

  .dashboard-mini-metric span {
    font-size: 0.54rem;
  }

  .dashboard-mini-metric strong {
    font-size: 1.3rem;
  }
}

/* V92.3 - modulo Contas a Pagar otimizado para celular */
@media (max-width: 700px) {
  .payables-view-head {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
  }

  .payables-view-head .muted {
    display: none;
  }

  .payables-view-head h3 {
    margin: 0;
    font-size: 1.02rem;
  }

  .payables-view-head .primary-btn {
    width: auto;
    min-height: 36px;
    padding: 7px 9px;
    font-size: 0.72rem;
    white-space: nowrap;
  }

  .payable-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 6px;
    margin-bottom: 10px;
  }

  .payable-metrics .metric {
    min-width: 0;
    gap: 3px;
    padding: 9px;
    border-top-width: 2px;
  }

  .payable-metrics .metric span {
    font-size: 0.65rem;
    line-height: 1.08;
  }

  .payable-metrics .metric strong {
    overflow: hidden;
    font-size: 1.12rem;
    line-height: 1.05;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .payable-metrics .metric small {
    font-size: 0.63rem;
  }

  .payable-search-card {
    margin-bottom: 9px;
    padding: 9px;
  }

  .payable-search-card label {
    font-size: 0;
  }

  .payable-search-card input {
    min-height: 39px;
    font-size: 0.8rem;
  }

  .payables-table {
    margin-top: 9px;
    overflow: visible;
    border: 0;
    background: transparent;
    box-shadow: none;
  }

  .payables-table table,
  .payables-table tbody {
    display: block;
    width: 100%;
    min-width: 0 !important;
  }

  .payables-table thead {
    display: none;
  }

  .payables-table tbody {
    display: grid;
    gap: 7px;
  }

  .payables-table tbody tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 5px 8px;
    width: 100%;
    padding: 9px;
    border: 1px solid rgba(22, 141, 76, 0.15);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.026);
  }

  .payables-table tbody td {
    display: block;
    min-width: 0;
    padding: 0;
    border: 0;
  }

  .payables-table tbody td::before {
    content: none !important;
  }

  .payables-table tbody td[data-label="Conta"] {
    grid-column: 1;
    grid-row: 1;
  }

  .payables-table tbody td[data-label="Conta"] strong {
    display: block;
    overflow: hidden;
    margin: 0 0 2px;
    font-size: 0.82rem;
    line-height: 1.08;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .payables-table tbody td[data-label="Conta"] .muted {
    display: block;
    overflow: hidden;
    font-size: 0.65rem;
    line-height: 1.05;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .payables-table tbody td[data-label="Saldo"] {
    grid-column: 2;
    grid-row: 1;
    align-self: start;
    font-size: 0.86rem;
    font-weight: 700;
    color: #fff5df;
    white-space: nowrap;
  }

  .payables-table tbody td[data-label="Vencimento"] {
    grid-column: 1;
    grid-row: 2;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--muted);
    white-space: nowrap;
  }

  .payables-table tbody td[data-label="Vencimento"]::after {
    content: " venc.";
    font-size: 0.61rem;
    font-weight: 600;
    color: var(--muted);
  }

  .payables-table tbody td[data-label="Status"] {
    grid-column: 2;
    grid-row: 2;
    justify-self: end;
  }

  .payables-table tbody td[data-label="Status"] .tag {
    padding: 4px 6px;
    font-size: 0.61rem;
    line-height: 1;
    white-space: nowrap;
  }

  .payables-table tbody td[data-label="Valor"],
  .payables-table tbody td[data-label="Pago"] {
    display: none !important;
  }

  .payables-table .payable-actions-cell {
    grid-column: 1 / -1;
    grid-row: 3;
    padding-top: 3px;
  }

  .payables-table .payable-actions-cell .button-row {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 5px;
    width: 100%;
  }

  .payables-table .payable-actions-cell .button-row button {
    width: 100%;
    min-width: 0;
    min-height: 30px;
    padding: 4px 5px;
    font-size: 0.64rem;
    line-height: 1;
    white-space: nowrap;
  }

  .payables-table .empty-state {
    grid-column: 1 / -1;
    padding: 12px;
    font-size: 0.78rem;
  }
}
@media (max-width: 700px) {
  .payable-metrics .metric > small {
    font-size: 0.61rem;
    line-height: 1.08;
  }
}

/* V92.4 - leitura de codigo de barras por camera + rodape operacional compacto */
.field-label {
  display: block;
  margin-bottom: 7px;
  color: var(--text);
  font-weight: 700;
}

.barcode-input-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: stretch;
}

.barcode-input-row input {
  min-width: 0;
}

.barcode-camera-btn {
  min-width: 94px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding-inline: 12px;
  white-space: nowrap;
}

.barcode-camera-btn svg {
  width: 18px;
  height: 18px;
}

.barcode-scanner-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(2, 6, 12, 0.92);
  backdrop-filter: blur(8px);
}

.barcode-scanner-card {
  width: min(560px, 100%);
  overflow: hidden;
  border: 1px solid rgba(22, 141, 76, 0.24);
  border-radius: 18px;
  background: #080d14;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.45);
}

.barcode-scanner-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px;
}

.barcode-scanner-head > div {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.barcode-scanner-head strong {
  font-size: 1rem;
}

.barcode-scanner-head span,
.barcode-scanner-status {
  color: var(--muted);
  font-size: 0.78rem;
}

.barcode-camera-box {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: #020407;
}

.barcode-camera-box video {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.barcode-scan-guide {
  position: absolute;
  left: 7%;
  right: 7%;
  top: 50%;
  height: 30%;
  transform: translateY(-50%);
  border: 2px solid rgba(255, 255, 255, 0.85);
  border-radius: 12px;
  box-shadow: 0 0 0 999px rgba(0, 0, 0, 0.18);
}

.barcode-scan-guide::after {
  content: "";
  position: absolute;
  left: 5%;
  right: 5%;
  top: 50%;
  height: 2px;
  background: #168D4C;
  box-shadow: 0 0 12px rgba(22, 141, 76, 0.8);
}

.barcode-scanner-status {
  padding: 11px 14px 14px;
  text-align: center;
}

.dashboard-account-summary {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.dashboard-account-user {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
  font-size: 0.72rem;
}

.dashboard-account-user svg {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
}

.dashboard-account-user {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 700px) {
  .sale-barcode-field {
    padding: 10px;
  }

  .sale-barcode-field .field-label {
    margin-bottom: 5px;
    font-size: 0.76rem;
  }

  .sale-barcode-field input {
    min-height: 44px;
    font-size: 0.96rem;
  }

  .barcode-input-row {
    gap: 6px;
  }

  .barcode-camera-btn {
    min-width: 76px;
    min-height: 44px;
    padding: 6px 9px;
    font-size: 0.7rem;
  }

  .barcode-camera-btn svg {
    width: 16px;
    height: 16px;
  }

  .barcode-scanner-overlay {
    align-items: end;
    padding: 0;
  }

  .barcode-scanner-card {
    width: 100%;
    border-radius: 18px 18px 0 0;
    padding-bottom: max(8px, env(safe-area-inset-bottom));
  }

  .barcode-camera-box {
    aspect-ratio: 1 / 1;
    max-height: 58vh;
  }

  .dashboard-account-cloud-panel {
    padding: 9px 10px;
  }

  .dashboard-account-cloud-head {
    margin-bottom: 6px;
  }

  .dashboard-account-summary h3 {
    max-width: 58vw;
    overflow: hidden;
    font-size: 0.82rem;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .dashboard-account-user {
    max-width: 58vw;
    font-size: 0.62rem;
  }
}


/* V92.5 - Carrinho PDV mobile */
.mobile-sale-cart-bar,
.sale-cart-backdrop,
.sale-cart-handle,
.sale-cart-close-btn {
  display: none;
}

.sale-cart-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.sale-cart-head h3 {
  margin: 0;
}

.sale-cart-head h3 span {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 600;
}

.sale-cart-head p {
  margin: 3px 0 0;
}

.sale-cart-line-main {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.sale-cart-line-main strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sale-qty-control {
  display: inline-grid;
  grid-template-columns: 30px 30px 30px;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border: 1px solid rgba(22, 141, 76, 0.2);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.025);
}

.sale-qty-control button {
  width: 30px;
  height: 30px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #22A95C;
  font-size: 1.15rem;
  font-weight: 700;
}

.sale-qty-control strong {
  text-align: center;
  font-size: 0.82rem;
}

.sale-cart-line-total {
  white-space: nowrap;
}

.sale-line-trash {
  display: inline-grid;
  place-items: center;
  width: 32px;
  min-width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid rgba(255, 112, 102, 0.2);
  border-radius: 9px;
  background: rgba(255, 112, 102, 0.07);
  color: #ff8d84;
  font-size: 0.88rem;
}

.sale-discount-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  min-height: 38px;
  margin: 4px 0;
  padding: 7px 0;
  border: 0;
  border-bottom: 1px solid rgba(22, 141, 76, 0.12);
  border-radius: 0;
  background: transparent;
  color: #DEE1E8;
  text-align: left;
  font-size: 0.78rem;
  font-weight: 650;
}

.sale-cart-checkout {
  margin-top: 10px;
}

.sale-payment-grid {
  margin-top: 10px;
}

@media (min-width: 981px) {
  .sale-cart-line {
    grid-template-columns: minmax(0, 1fr) auto auto auto;
  }
}

@media (max-width: 980px) {
  html.sale-cart-open,
  body.sale-cart-open {
    overflow: hidden;
    overscroll-behavior: none;
  }

  body.sale-cart-open .mobile-bottom-nav {
    pointer-events: none;
  }

  .sales-workspace {
    display: block;
  }

  .sale-cart-backdrop {
    position: fixed;
    touch-action: none;
    inset: 0;
    z-index: 39;
    display: block;
    visibility: hidden;
    border: 0;
    border-radius: 0;
    background: rgba(0, 0, 0, 0.66);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.18s ease, visibility 0.18s ease;
    backdrop-filter: blur(4px);
  }

  .sale-cart-backdrop.is-open {
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
  }

  .sale-cart-panel {
    position: fixed;
    touch-action: manipulation;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 40;
    display: grid;
    grid-template-rows: auto auto minmax(0, 1fr) auto;
    width: 100%;
    height: min(88dvh, 760px);
    max-height: none;
    margin: 0;
    padding: 8px 12px calc(12px + env(safe-area-inset-bottom));
    border-right: 0;
    border-bottom: 0;
    border-left: 0;
    border-radius: 20px 20px 0 0;
    background: rgba(10, 15, 23, 0.99);
    box-shadow: 0 -22px 60px rgba(0, 0, 0, 0.5);
    transform: translateY(105%);
    transition: transform 0.22s ease;
    overscroll-behavior: contain;
  }

  .sale-cart-panel.is-open {
    transform: translateY(0);
  }

  .sale-cart-panel::before {
    display: none;
  }

  .sale-cart-handle {
    display: block;
    touch-action: pan-y;
    width: 44px;
    height: 4px;
    margin: 1px auto 8px;
    border-radius: 99px;
    background: rgba(255, 255, 255, 0.22);
  }

  .sale-cart-close-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 84px;
    min-height: 40px;
    padding: 7px 11px;
    font-size: 0.76rem;
    font-weight: 700;
    touch-action: manipulation;
  }

  .sale-cart-head {
    margin-bottom: 7px;
  }

  .sale-cart-head p {
    display: none;
  }

  .sale-cart-total-card {
    display: none;
  }

  .sale-cart-list {
    max-height: none;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    padding: 2px 1px 5px;
  }

  .sale-cart-line {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto auto;
    gap: 7px;
    align-items: center;
    padding: 8px 7px;
    border-radius: 10px;
  }

  .sale-cart-line-main .muted {
    overflow: hidden;
    font-size: 0.66rem;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .sale-cart-line-main strong {
    font-size: 0.78rem;
  }

  .sale-cart-line-total {
    font-size: 0.76rem;
  }

  .sale-qty-control {
    grid-template-columns: 28px 26px 28px;
  }

  .sale-qty-control button {
    width: 28px;
    height: 30px;
  }

  .sale-qty-control strong {
    font-size: 0.76rem;
  }

  .sale-line-trash {
    width: 30px;
    min-width: 30px;
    height: 30px;
  }

  .sale-cart-checkout {
    margin: 0 -2px;
    padding: 7px 2px 0;
    border-top: 1px solid rgba(22, 141, 76, 0.16);
    background: rgba(10, 15, 23, 0.99);
  }

  .sale-summary {
    margin-top: 0;
    padding-top: 0;
    border-top: 0;
  }

  .sale-summary .split-line {
    padding: 5px 0;
    font-size: 0.76rem;
  }

  .sale-total-line {
    margin-top: 1px;
  }

  .sale-total-line .total-line {
    color: #22A95C;
    font-size: 1.14rem;
  }

  .sale-discount-toggle {
    min-height: 32px;
    padding: 4px 0;
    font-size: 0.72rem;
  }

  .sale-discount-row {
    gap: 7px;
    padding: 6px 0;
  }

  .sale-discount-field {
    flex: 1 1 auto;
  }

  .sale-discount-field input,
  .sale-discount-row button {
    min-height: 38px;
  }

  .sale-payment-grid {
    display: grid !important;
    grid-template-columns: minmax(0, 1.35fr) minmax(88px, 0.65fr) !important;
    gap: 7px !important;
    margin-top: 7px;
  }

  .sale-payment-grid label {
    min-width: 0;
    font-size: 0.68rem;
  }

  .sale-payment-grid select {
    min-height: 40px;
    padding: 7px 28px 7px 9px;
    font-size: 0.78rem;
  }

  .finish-sale-btn {
    position: sticky;
    bottom: 0;
    min-height: 48px;
    margin-top: 8px;
    padding: 10px 12px;
    font-size: 0.86rem;
    box-shadow: 0 -6px 22px rgba(0, 0, 0, 0.22);
  }

  .mobile-sale-cart-bar {
    position: fixed;
    touch-action: pan-y;
    right: 10px;
    bottom: calc(73px + env(safe-area-inset-bottom));
    left: 10px;
    z-index: 31;
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 8px;
    min-height: 52px;
    padding: 8px 11px;
    border: 1px solid rgba(22, 141, 76, 0.32);
    border-radius: 13px;
    background: linear-gradient(135deg, rgba(42, 31, 13, 0.98), rgba(10, 15, 23, 0.98));
    color: #fff;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.46);
    backdrop-filter: blur(14px);
  }

  .mobile-sale-cart-count {
    white-space: nowrap;
    color: #DEE1E8;
    font-size: 0.72rem;
  }

  .mobile-sale-cart-bar > strong {
    justify-self: end;
    color: #22A95C;
    font-size: 0.94rem;
    white-space: nowrap;
  }

  .mobile-sale-cart-open-label {
    padding-left: 8px;
    border-left: 1px solid rgba(22, 141, 76, 0.22);
    color: #fff;
    font-size: 0.64rem;
    font-weight: 700;
    white-space: nowrap;
  }

  body.sale-cart-open .mobile-sale-cart-bar {
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
  }

  .sales-history-search {
    margin-top: 12px;
  }

  .view-root:has(.mobile-sale-cart-bar) {
    padding-bottom: calc(156px + env(safe-area-inset-bottom));
  }
}

@media (max-width: 430px) {
  .sale-cart-panel {
    height: 91dvh;
    max-height: none;
    padding-right: 9px;
    padding-left: 9px;
  }

  .sale-cart-line {
    grid-template-columns: minmax(0, 1fr) auto auto auto !important;
    gap: 5px;
    padding: 7px 5px;
  }

  .sale-cart-line-main strong {
    font-size: 0.74rem;
  }

  .sale-cart-line-main .muted {
    font-size: 0.61rem;
  }

  .sale-qty-control {
    grid-template-columns: 25px 23px 25px;
  }

  .sale-qty-control button {
    width: 25px;
    height: 28px;
    font-size: 1rem;
  }

  .sale-qty-control strong,
  .sale-cart-line-total {
    font-size: 0.7rem;
  }

  .sale-line-trash {
    width: 28px;
    min-width: 28px;
    height: 28px;
    font-size: 0.76rem;
  }

  .mobile-sale-cart-bar {
    right: 7px;
    left: 7px;
    grid-template-columns: auto 1fr auto;
    gap: 6px;
    padding: 7px 9px;
  }

  .mobile-sale-cart-open-label {
    font-size: 0.59rem;
  }
}


/* V92.6 - estabilidade do carrinho no mobile */
@media (max-width: 980px) {
  .sale-cart-panel:not(.is-open),
  .sale-cart-backdrop:not(.is-open) {
    pointer-events: none !important;
  }

  .sale-cart-head {
    position: relative;
    z-index: 2;
    min-height: 42px;
    background: rgba(10, 15, 23, 0.99);
  }

  .sale-cart-list {
    scrollbar-gutter: stable;
  }

  .sale-cart-checkout {
    position: relative;
    z-index: 2;
  }
}

/* V92.7 - carrinho mobile fixo, sem saltos ou cortes */
@media (max-width: 980px) {
  html.sale-cart-open,
  body.sale-cart-open {
    overflow: hidden !important;
    overscroll-behavior: none !important;
  }

  .sale-cart-handle {
    display: none !important;
  }

  .sale-cart-panel {
    display: flex !important;
    flex-direction: column;
    right: 0;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 86vh;
    height: 86svh;
    max-height: calc(100svh - 8px);
    overflow: hidden;
    padding-top: 9px;
    transform: none !important;
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
    transition: none !important;
    contain: layout paint;
  }

  .sale-cart-panel.is-open {
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
  }

  .sale-cart-head {
    flex: 0 0 auto;
    min-height: 44px;
    margin: 0 0 6px;
  }

  .sale-cart-list {
    flex: 1 1 auto;
    min-height: 0;
    max-height: none !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    overscroll-behavior-y: contain;
    touch-action: pan-y;
    -webkit-overflow-scrolling: touch;
  }

  .sale-cart-checkout {
    flex: 0 0 auto;
    min-height: 0;
    max-height: 46svh;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior-y: contain;
    -webkit-overflow-scrolling: touch;
  }

  .sale-cart-backdrop,
  .sale-cart-backdrop.is-open {
    transition: none !important;
  }

  .mobile-sale-cart-bar {
    touch-action: manipulation !important;
  }

  .sale-cart-line-main {
    grid-area: main;
  }

  .sale-qty-control {
    grid-area: qty;
  }

  .sale-cart-line-total {
    grid-area: total;
  }

  .sale-line-trash {
    grid-area: trash;
  }
}

@media (max-width: 480px) {
  .sale-cart-panel {
    height: 88vh;
    height: 88svh;
    max-height: calc(100svh - 6px);
    padding-right: 10px;
    padding-left: 10px;
  }

  .sale-cart-line {
    grid-template-columns: minmax(0, 1fr) auto !important;
    grid-template-areas:
      "main total"
      "qty trash" !important;
    column-gap: 8px !important;
    row-gap: 6px !important;
    padding: 8px !important;
  }

  .sale-cart-line-main {
    min-width: 0;
  }

  .sale-cart-line-main strong,
  .sale-cart-line-main .muted {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .sale-cart-line-total {
    align-self: start;
    justify-self: end;
    padding-top: 1px;
    font-size: 0.78rem;
  }

  .sale-qty-control {
    justify-self: start;
  }

  .sale-line-trash {
    justify-self: end;
  }

  .sale-cart-checkout {
    max-height: 48svh;
  }
}

/* V92.8 - Dashboard com titulos e icones uniformes */
.dashboard-section-head {
  min-width: 0;
}

.dashboard-section-head-action {
  justify-content: flex-start;
}

.dashboard-section-head-action > .ghost-btn {
  margin-left: auto;
}

.dashboard-kpi-head {
  margin-bottom: 0;
}

.dashboard-kpi-head h3,
.dashboard-section-head h3 {
  margin: 0;
}

@media (max-width: 700px) {
  /* Uma unica escala visual para todos os cabecalhos do Dashboard. */
  .dashboard-command .dashboard-card,
  .dashboard-command .dashboard-panel {
    border-radius: 12px;
  }

  .dashboard-command .dashboard-card-head,
  .dashboard-command .dashboard-section-head,
  .dashboard-command .dashboard-cloud-head,
  .dashboard-command .dashboard-account-cloud-head {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 32px;
    margin-bottom: 8px;
  }

  .dashboard-command .dashboard-card-head .dashboard-card-icon,
  .dashboard-command .dashboard-section-head .dashboard-card-icon,
  .dashboard-command .dashboard-kpi .dashboard-card-icon,
  .dashboard-command .dashboard-low-stock-card .dashboard-card-icon {
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    min-width: 32px;
    flex: 0 0 32px;
    border-radius: 9px;
  }

  .dashboard-command .dashboard-card-icon svg,
  .dashboard-command .dashboard-low-stock-card .dashboard-card-icon svg,
  .dashboard-command .dashboard-kpi .dashboard-card-icon svg {
    width: 17px;
    height: 17px;
  }

  .dashboard-command .dashboard-card-head h3,
  .dashboard-command .dashboard-section-head h3,
  .dashboard-command .dashboard-kpi-head h3,
  .dashboard-command .dashboard-low-stock-card .dashboard-card-head h3,
  .dashboard-command .dashboard-cloud-head h3,
  .dashboard-command .dashboard-account-summary h3 {
    min-width: 0;
    margin: 0;
    font-size: 0.88rem;
    font-weight: 700;
    line-height: 1.1;
    letter-spacing: 0;
  }

  /* KPIs principais seguem o mesmo cabecalho dos demais cards. */
  .dashboard-command .dashboard-kpi {
    align-content: start;
    gap: 6px;
  }

  .dashboard-command .dashboard-kpi-head {
    width: 100%;
  }

  .dashboard-command .dashboard-kpi > strong {
    margin-top: 1px;
  }

  /* Atalhos: icones e textos na mesma escala entre todas as tags. */
  .dashboard-command .dashboard-shortcut {
    gap: 4px;
  }

  .dashboard-command .dashboard-shortcut svg {
    width: 18px;
    height: 18px;
  }

  .dashboard-command .dashboard-shortcut span {
    display: block;
    max-width: 100%;
    font-size: 0.68rem;
    font-weight: 700;
    line-height: 1.08;
    text-align: center;
  }

  /* Os blocos que antes tinham section-head agora usam exatamente o mesmo alinhamento. */
  .dashboard-shortcuts-panel .dashboard-section-head,
  .dashboard-payables-panel .dashboard-section-head,
  .dashboard-history-panel .dashboard-section-head {
    margin-bottom: 8px;
  }

  .dashboard-payables-panel .dashboard-section-head .ghost-btn,
  .dashboard-account-cloud-panel .dashboard-section-head .ghost-btn {
    width: auto;
    min-height: 31px;
    margin-left: auto;
    padding: 5px 8px;
    font-size: 0.68rem;
    white-space: nowrap;
  }

  /* Rodape conta/nuvem preserva empresa e usuario sem quebrar o cabecalho. */
  .dashboard-account-cloud-head {
    display: grid !important;
    grid-template-columns: 32px minmax(0, 1fr) auto;
  }

  .dashboard-account-summary {
    gap: 2px;
  }

  .dashboard-account-summary h3 {
    max-width: none;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .dashboard-account-user {
    max-width: 100%;
  }
}

@media (max-width: 380px) {
  .dashboard-command .dashboard-card-head h3,
  .dashboard-command .dashboard-section-head h3,
  .dashboard-command .dashboard-kpi-head h3,
  .dashboard-command .dashboard-account-summary h3 {
    font-size: 0.82rem;
  }

  .dashboard-command .dashboard-shortcut span {
    font-size: 0.64rem;
  }
}
@media (max-width: 700px) {
  .dashboard-panel-note {
    display: none;
  }
}

/* V92.9 - busca de itens da venda em lista suspensa, especialmente no mobile */
.sale-search-field {
  position: relative;
  z-index: 40;
  min-width: 0;
}

.sale-search-field > label {
  display: block;
  margin-bottom: 6px;
}

.sale-search-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  left: 0;
  z-index: 160;
  display: none;
  grid-template-columns: 1fr;
  gap: 4px;
  width: 100%;
  max-height: min(360px, 48vh);
  margin: 0;
  padding: 5px;
  overflow-x: hidden;
  overflow-y: auto;
  border: 1px solid rgba(22, 141, 76, 0.28);
  border-radius: 12px;
  background: rgba(7, 12, 19, 0.985);
  box-shadow: 0 18px 38px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(12px);
  scrollbar-gutter: stable;
}

.sale-search-dropdown.is-visible {
  display: grid;
}

.sale-search-dropdown .sale-results-hint {
  margin: 0;
  padding: 10px;
  font-size: 0.78rem;
}

.sale-search-dropdown .sale-item-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "name price"
    "meta stock";
  gap: 2px 8px;
  min-height: 0;
  width: 100%;
  padding: 9px 10px;
  border-radius: 9px;
  transform: none;
}

.sale-search-dropdown .sale-item-card:hover {
  transform: none;
}

.sale-search-dropdown .sale-item-card > strong {
  grid-area: name;
  min-width: 0;
  overflow: hidden;
  color: var(--text);
  font-size: 0.86rem;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sale-search-dropdown .sale-item-card > .muted {
  grid-area: meta;
  min-width: 0;
  overflow: hidden;
  font-size: 0.68rem;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sale-search-dropdown .sale-item-card > .tag {
  grid-area: stock;
  align-self: center;
  justify-self: end;
  padding: 2px 6px;
  font-size: 0.6rem;
  line-height: 1.15;
  white-space: nowrap;
}

.sale-search-dropdown .sale-item-price {
  grid-area: price;
  align-self: start;
  justify-self: end;
  color: #DEE1E8;
  font-size: 0.8rem;
  line-height: 1.2;
  white-space: nowrap;
}

.sale-search-dropdown .sale-item-card:disabled {
  cursor: not-allowed;
}

@media (max-width: 980px) {
  .sales-pdv-panel {
    overflow: visible;
  }

  .sale-controls {
    position: relative;
    z-index: 35;
  }

  .sale-search-field {
    grid-column: 1 / -1;
  }

  .sale-search-field > label {
    margin-bottom: 5px;
    font-size: 0.78rem;
  }

  .sale-search-field > input {
    min-height: 44px;
    padding: 10px 12px;
    font-size: 0.96rem;
  }

  .sale-search-dropdown {
    top: calc(100% + 4px);
    max-height: min(44svh, 330px);
    padding: 4px;
    border-radius: 10px;
  }

  .sale-search-dropdown .sale-item-card {
    min-height: 48px;
    padding: 8px 9px;
  }

  .sale-search-dropdown .sale-item-card > strong {
    font-size: 0.82rem;
  }

  .sale-search-dropdown .sale-item-card > .muted {
    font-size: 0.64rem;
  }

  .sale-search-dropdown .sale-item-price {
    font-size: 0.76rem;
  }

  .sale-search-dropdown .sale-item-card > .tag {
    font-size: 0.57rem;
  }
}

@media (max-width: 380px) {
  .sale-search-dropdown .sale-item-card {
    gap: 2px 5px;
    padding: 7px 8px;
  }

  .sale-search-dropdown .sale-item-card > strong {
    font-size: 0.78rem;
  }

  .sale-search-dropdown .sale-item-price {
    font-size: 0.72rem;
  }
}


/* V93.0 - Nova Venda reorganizada e carrinho centralizado no mobile */
.sale-customer-section {
  margin-bottom: 12px;
}

.sale-entry-basics {
  margin-bottom: 12px;
}

.sale-item-entry {
  position: relative;
  z-index: 35;
  align-items: start;
  margin-bottom: 12px;
}

@media (max-width: 980px) {
  /* Fluxo da Nova Venda: quantidade, garantia e data na mesma linha. */
  .sales-pdv-panel .sale-entry-basics {
    display: grid !important;
    grid-template-columns: minmax(62px, 0.72fr) minmax(82px, 0.9fr) minmax(132px, 1.38fr) !important;
    gap: 6px !important;
    align-items: end;
  }

  .sales-pdv-panel .sale-entry-basics label {
    min-width: 0;
    gap: 4px;
    font-size: 0.66rem;
    line-height: 1.05;
    white-space: nowrap;
  }

  .sales-pdv-panel .sale-entry-basics input {
    min-width: 0;
    min-height: 42px;
    padding: 7px 8px;
    border-radius: 10px;
    font-size: 0.8rem;
    font-weight: 600;
  }

  .sales-pdv-panel .sale-entry-basics input[type="date"] {
    padding-right: 4px;
    font-size: 0.75rem;
  }

  /* Item e codigo passam para depois dos dados basicos e antes das observacoes. */
  .sales-pdv-panel .sale-item-entry {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 8px !important;
    margin-bottom: 10px;
  }

  .sales-pdv-panel .sale-item-entry .sale-search-field,
  .sales-pdv-panel .sale-item-entry .sale-barcode-field {
    min-width: 0;
  }

  .sales-pdv-panel .sale-barcode-field {
    padding: 9px 10px;
    border-radius: 12px;
  }

  .sales-pdv-panel .sale-barcode-field .field-label,
  .sales-pdv-panel .sale-search-field > label {
    font-size: 0.72rem;
  }

  .sales-pdv-panel .sale-barcode-field > .muted {
    display: none;
  }

  .sales-pdv-panel .sale-barcode-field input,
  .sales-pdv-panel .sale-search-field > input {
    min-height: 43px;
    font-size: 0.9rem;
  }

  /* Carrinho como modal central, sem encostar no topo ou no rodape do aparelho. */
  .sale-cart-backdrop {
    z-index: 1000;
    background: rgba(2, 6, 12, 0.76);
    backdrop-filter: blur(6px);
  }

  .sale-cart-panel,
  .sale-cart-panel.is-open {
    position: fixed !important;
    top: 50% !important;
    right: auto !important;
    bottom: auto !important;
    left: 50% !important;
    z-index: 1001;
    width: min(calc(100vw - 24px), 520px) !important;
    height: min(82svh, 720px) !important;
    max-height: calc(100svh - 28px - env(safe-area-inset-top) - env(safe-area-inset-bottom)) !important;
    margin: 0 !important;
    padding: 12px !important;
    border: 1px solid rgba(22, 141, 76, 0.3) !important;
    border-radius: 22px !important;
    background:
      linear-gradient(180deg, rgba(22, 141, 76, 0.045), transparent 24%),
      #0a0f17 !important;
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.62) !important;
    transform: translate(-50%, -50%) !important;
    overflow: hidden !important;
    contain: layout paint;
  }

  .sale-cart-panel:not(.is-open) {
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
  }

  .sale-cart-panel.is-open {
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: auto !important;
  }

  .sale-cart-head {
    flex: 0 0 auto;
    min-height: 48px;
    margin: 0 0 4px !important;
    padding: 0 0 9px;
    border-bottom: 1px solid rgba(22, 141, 76, 0.15);
    background: transparent !important;
  }

  .sale-cart-head h3 {
    font-size: 1rem;
    line-height: 1.1;
  }

  .sale-cart-head h3 span {
    font-size: 0.72rem;
  }

  .sale-cart-close-btn {
    min-width: 82px;
    min-height: 38px;
    padding: 6px 9px;
    border-color: rgba(22, 141, 76, 0.2);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.035);
    font-size: 0.72rem;
  }

  .sale-cart-list {
    flex: 1 1 auto !important;
    min-height: 110px !important;
    max-height: none !important;
    padding: 6px 1px 8px !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    overscroll-behavior: contain;
  }

  .sale-cart-line {
    border: 1px solid rgba(22, 141, 76, 0.11);
    background: rgba(255, 255, 255, 0.025);
  }

  .sale-cart-checkout {
    flex: 0 1 auto !important;
    max-height: min(43svh, 330px) !important;
    margin: 0 !important;
    padding: 9px 1px 0 !important;
    border-top: 1px solid rgba(22, 141, 76, 0.18);
    background: #0a0f17 !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    overscroll-behavior: contain;
  }

  .sale-payment-grid {
    margin-top: 6px !important;
  }

  .finish-sale-btn {
    bottom: -1px;
    min-height: 46px;
    margin-top: 7px;
    border-radius: 11px;
  }
}

@media (max-width: 390px) {
  .sales-pdv-panel .sale-entry-basics {
    grid-template-columns: minmax(56px, 0.66fr) minmax(76px, 0.86fr) minmax(122px, 1.48fr) !important;
    gap: 5px !important;
  }

  .sales-pdv-panel .sale-entry-basics label {
    font-size: 0.61rem;
  }

  .sales-pdv-panel .sale-entry-basics input {
    min-height: 40px;
    padding: 6px;
    font-size: 0.74rem;
  }

  .sales-pdv-panel .sale-entry-basics input[type="date"] {
    font-size: 0.69rem;
  }

  .sale-cart-panel,
  .sale-cart-panel.is-open {
    width: calc(100vw - 16px) !important;
    height: min(84svh, 690px) !important;
    padding: 10px !important;
    border-radius: 18px !important;
  }
}

/* V93.1 - carrinho mobile em formato de recibo + area segura + alertas centrais */
.sale-cart-receipt-head {
  display: none;
}

@media (max-width: 980px) {
  /* Modal menor e realmente centralizado, com folga visual do topo do navegador. */
  .sale-cart-panel,
  .sale-cart-panel.is-open {
    top: 50% !important;
    bottom: auto !important;
    left: 50% !important;
    width: min(calc(100vw - 24px), 520px) !important;
    height: min(72svh, 650px) !important;
    max-height: calc(100svh - 120px - env(safe-area-inset-top) - env(safe-area-inset-bottom)) !important;
    padding: 11px 12px 12px !important;
    border-radius: 20px !important;
    transform: translate(-50%, -50%) !important;
    overflow: hidden !important;
  }

  .sale-cart-head {
    min-height: 42px !important;
    margin-bottom: 2px !important;
    padding-bottom: 7px !important;
  }

  .sale-cart-head h3 {
    font-size: 0.96rem !important;
  }

  .sale-cart-close-btn {
    min-width: 72px !important;
    min-height: 34px !important;
    padding: 5px 8px !important;
  }

  /* Cabecalho de recibo. */
  .sale-cart-receipt-head {
    display: grid;
    grid-template-columns: 86px minmax(0, 1fr) 88px;
    gap: 7px;
    align-items: center;
    flex: 0 0 auto;
    margin: 2px 0 0;
    padding: 7px 4px 6px;
    border-bottom: 1px solid rgba(22, 141, 76, 0.32);
    color: #DEE1E8;
    font-size: 0.66rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
  }

  .sale-cart-receipt-head span:last-child {
    text-align: right;
  }

  .sale-cart-list {
    min-height: 76px !important;
    padding: 0 1px 5px !important;
  }

  /* Cada item vira uma linha de recibo: Qt | Item | Valor. */
  .sale-cart-line,
  .sale-cart-line.gift-line {
    display: grid !important;
    grid-template-columns: 86px minmax(0, 1fr) 88px !important;
    grid-template-areas: none !important;
    gap: 7px !important;
    align-items: center !important;
    min-height: 47px;
    margin: 0 !important;
    padding: 7px 4px !important;
    border: 0 !important;
    border-bottom: 1px dashed rgba(22, 141, 76, 0.18) !important;
    border-radius: 0 !important;
    background: transparent !important;
  }

  .sale-cart-line:last-child {
    border-bottom: 0 !important;
  }

  .sale-qty-control {
    grid-area: auto !important;
    display: grid !important;
    grid-template-columns: 24px 26px 24px !important;
    gap: 2px !important;
    justify-self: start !important;
    align-items: center;
    width: auto !important;
    padding: 0 !important;
    border: 0 !important;
    background: transparent !important;
  }

  .sale-qty-control button {
    width: 24px !important;
    min-width: 24px !important;
    height: 28px !important;
    min-height: 28px !important;
    padding: 0 !important;
    border-radius: 7px !important;
    font-size: 1rem !important;
    line-height: 1 !important;
  }

  .sale-qty-control strong {
    min-width: 26px;
    font-size: 0.78rem !important;
    text-align: center;
  }

  .sale-cart-line-main {
    grid-area: auto !important;
    position: relative;
    display: flex;
    align-items: center;
    gap: 5px;
    min-width: 0;
    padding-right: 19px;
  }

  .sale-cart-line-main > strong {
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
    font-size: 0.76rem !important;
    line-height: 1.18;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .sale-cart-gift-label {
    flex: 0 0 auto;
    padding: 2px 4px;
    border-radius: 5px;
    background: rgba(75, 210, 162, 0.12);
    color: #9de8cb;
    font-size: 0.52rem;
    font-weight: 700;
  }

  .sale-line-trash {
    position: absolute !important;
    top: 50%;
    right: 0;
    width: 18px !important;
    min-width: 18px !important;
    height: 18px !important;
    min-height: 18px !important;
    padding: 0 !important;
    border: 0 !important;
    background: transparent !important;
    color: #df7770 !important;
    font-size: 0.92rem !important;
    line-height: 18px !important;
    transform: translateY(-50%);
  }

  .sale-cart-line-total {
    grid-area: auto !important;
    align-self: center !important;
    justify-self: end !important;
    padding: 0 !important;
    font-size: 0.76rem !important;
    line-height: 1.15;
    white-space: nowrap;
  }

  .sale-cart-checkout {
    max-height: min(37svh, 290px) !important;
    padding-top: 7px !important;
  }

  .sale-summary .split-line {
    padding: 4px 0 !important;
  }

  .sale-payment-grid {
    margin-top: 5px !important;
  }

  .finish-sale-btn {
    min-height: 44px !important;
    margin-top: 6px !important;
  }
}

@media (max-width: 390px) {
  .sale-cart-panel,
  .sale-cart-panel.is-open {
    width: calc(100vw - 18px) !important;
    height: min(70svh, 610px) !important;
    max-height: calc(100svh - 112px - env(safe-area-inset-top) - env(safe-area-inset-bottom)) !important;
    padding: 9px 10px 10px !important;
  }

  .sale-cart-receipt-head,
  .sale-cart-line,
  .sale-cart-line.gift-line {
    grid-template-columns: 82px minmax(0, 1fr) 80px !important;
    gap: 5px !important;
  }

  .sale-cart-line-main > strong,
  .sale-cart-line-total {
    font-size: 0.71rem !important;
  }
}

/* Alertas sempre no centro e acima de qualquer modal/carrinho. */
.toast {
  top: 50% !important;
  right: auto !important;
  bottom: auto !important;
  left: 50% !important;
  z-index: 99999 !important;
  width: min(88vw, 380px);
  max-width: 380px;
  text-align: center;
  transform: translate(-50%, -50%) scale(0.96) !important;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.65) !important;
}

.toast.show {
  transform: translate(-50%, -50%) scale(1) !important;
}

