/* CSS simples para a rota /m em WebViews antigos de maquininhas. */
html,
body {
  min-height: 100%;
  margin: 0;
}

/* O botao flutuante LOG foi movido para o menu ⋮ do cabecalho. Escondemos aqui. */
#dbg-btn {
  display: none !important;
}

/* Menu suspenso (kebab) do cabecalho */
.machine-menu-wrap { position: relative; display: inline-block; }
.machine-menu-btn {
  font-size: 22px !important;
  font-weight: 900;
  color: #ffffff !important;
  touch-action: manipulation;
}
.machine-menu-dropdown {
  display: none;
  position: absolute;
  top: 40px;
  right: 0;
  z-index: 500;
  min-width: 180px;
  background: #ffffff;
  color: #0f172a;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.35);
  overflow: hidden;
}
.machine-menu-wrap.open .machine-menu-dropdown { display: block; }
.machine-menu-item {
  display: block;
  width: 100%;
  min-height: 44px;
  padding: 12px 14px;
  border: 0;
  background: transparent;
  color: #0f172a;
  text-align: left;
  font: 700 14px Arial, Helvetica, sans-serif;
  cursor: pointer;
  border-bottom: 1px solid #e2e8f0;
  touch-action: manipulation;
}
.machine-menu-item:last-child { border-bottom: 0; }
.machine-menu-item:active { background: #f1f5f9; }
.machine-menu-danger { color: #b91c1c; }
.machine-header-spacer { width: 8px; }


.machine-login-screen,
.machine-screen,
.machine-modal-layer,
.machine-code-card,
.machine-code-card *,
.machine-screen *,
.machine-modal-panel,
.machine-modal-panel * {
  box-sizing: border-box;
}

.machine-login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #020617;
  color: #f1f5f9;
  padding: 16px;
  font-family: Arial, Helvetica, sans-serif;
}

.machine-code-card {
  width: 100%;
  max-width: 384px;
  background: #0f172a;
  border: 1px solid #1e293b;
  border-radius: 8px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
}

.machine-code-wrap {
  width: 100%;
  max-width: 384px;
}

.machine-code-content {
  padding: 24px;
}

.machine-version {
  margin-top: 12px;
  color: #64748b;
  text-align: center;
  font-size: 11px;
  font-weight: 700;
}

.machine-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 24px;
  color: #f1f5f9;
  font-weight: 700;
}

.machine-code-help {
  margin: 0 0 16px;
  color: #94a3b8;
  font-size: 14px;
}

.machine-form > * + * {
  margin-top: 12px;
}

.machine-code-input,
.machine-cash-input {
  width: 100%;
  border: 1px solid #334155;
  border-radius: 6px;
  background: #1e293b;
  color: #ffffff;
  text-align: center;
  font-family: monospace;
  outline: none;
}

.machine-code-input {
  height: 56px;
  font-size: 30px;
  letter-spacing: 6px;
}

.machine-code-submit,
.machine-ok-button,
.machine-confirm-button,
.machine-secondary-button,
.machine-sync-button,
.machine-bluetooth-button,
.machine-payment-option,
.machine-icon-button,
.machine-cart-control {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 6px;
  cursor: pointer;
  font-family: Arial, Helvetica, sans-serif;
}

.machine-code-submit,
.machine-confirm-button {
  width: 100%;
  height: 48px;
  background: #e68223;
  color: #fffdf8;
  font-size: 16px;
  font-weight: 700;
}

.machine-secondary-button {
  min-height: 40px;
  padding: 0 16px;
  border: 1px solid #cbd5e1;
  background: transparent;
  color: #f8fafc;
}

.machine-screen {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: #0d2a52;
  color: #f1f5f9;
  font-family: Arial, Helvetica, sans-serif;
}

.machine-header {
  position: relative;
  min-height: 52px;
  display: grid;
  grid-template-columns: 44px 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 8px 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.machine-title {
  min-width: 0;
  max-width: 100%;
  margin: 0;
  overflow: hidden;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #ffffff;
  font-size: 18px;
  font-weight: 800;
  text-transform: uppercase;
}

.machine-header-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  justify-self: end;
}

.machine-logout {
  justify-self: start;
}


.machine-icon-button,
.machine-cart-control {
  width: 36px;
  height: 36px;
  background: transparent;
  color: #cbd5e1;
}

.machine-cart-control {
  width: 28px;
  height: 28px;
  color: #ffffff;
}

.machine-remove-control {
  color: #fca5a5;
}

.machine-sync-button {
  height: 32px;
  margin-right: 4px;
  padding: 0 8px;
  background: #f59e0b;
  color: #111827;
  font-size: 12px;
  font-weight: 800;
}

.machine-bluetooth-button {
  width: 36px;
  height: 32px;
  margin-right: 4px;
  background: #14b8a6;
  color: #042f2e;
  font-size: 12px;
  font-weight: 900;
}

.machine-cash-closed {
  margin: 12px 12px 0;
  padding: 8px;
  border: 1px solid rgba(239, 68, 68, 0.4);
  border-radius: 6px;
  background: rgba(239, 68, 68, 0.2);
  text-align: center;
  font-size: 12px;
}

.machine-products-area {
  flex: 1 1 auto;
  overflow: auto;
  padding: 12px;
}

.machine-empty {
  padding: 64px 0;
  color: #94a3b8;
  text-align: center;
}

.machine-products-grid {
  display: flex;
  flex-wrap: wrap;
  margin: -4px;
}

.machine-product-button {
  position: relative;
  width: calc(33.333% - 8px);
  min-height: 96px;
  margin: 4px;
  padding: 18px 6px 8px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #f1f5f9;
  color: #0f172a;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.machine-product-disabled {
  background: rgba(226, 232, 240, 0.7);
  color: #64748b;
}

.machine-product-name {
  max-height: 48px;
  overflow: hidden;
  font-size: 13px;
  line-height: 16px;
  font-weight: 800;
  text-transform: uppercase;
}

.machine-product-price {
  margin-top: 4px;
  font-size: 11px;
  font-weight: 700;
  opacity: 0.72;
}

.machine-stock-badge,
.machine-cart-badge {
  position: absolute;
  top: 4px;
  min-width: 18px;
  border-radius: 999px;
  padding: 1px 5px;
  font-size: 10px;
  font-weight: 900;
  line-height: 16px;
}

.machine-stock-badge {
  right: 4px;
  background: rgba(0, 0, 0, 0.1);
}

.machine-cart-badge {
  left: 4px;
  background: #ff8a1f;
  color: #ffffff;
}

.machine-cart-panel,
.machine-footer {
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  background: #0a2144;
}

.machine-cart-panel {
  padding: 8px;
}

.machine-cart-list {
  max-height: 160px;
  overflow: auto;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.05);
}

.machine-cart-line {
  display: flex;
  align-items: center;
  padding: 6px 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 14px;
}

.machine-cart-name {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.machine-cart-price {
  margin: 0 8px;
  opacity: 0.75;
}

.machine-cart-controls {
  display: flex;
  align-items: center;
}

.machine-cart-qty {
  width: 24px;
  text-align: center;
  font-weight: 800;
}

.machine-footer {
  padding: 12px;
}

.machine-footer-row {
  display: flex;
  align-items: center;
}

.machine-total {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 56px;
  margin-right: 8px;
  padding: 8px 16px;
  border-radius: 6px;
  background: #ff8a1f;
  color: #111827;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
}

.machine-total-label {
  font-size: 14px;
  font-weight: 800;
  text-transform: uppercase;
}

.machine-total-value {
  font-size: 24px;
  font-weight: 900;
}

.machine-ok-button {
  width: 76px;
  height: 56px;
  background: #10b981;
  color: #ffffff;
  font-size: 18px;
  font-weight: 900;
}

.machine-modal-layer {
  position: fixed;
  z-index: 9999;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(0, 0, 0, 0.78);
  font-family: Arial, Helvetica, sans-serif;
}

.machine-modal-panel {
  position: relative;
  width: 100%;
  max-width: 448px;
  max-height: 92vh;
  overflow: auto;
  padding: 24px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #ffffff;
  color: #0f172a;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.45);
}

.machine-modal-close {
  position: absolute;
  top: 10px;
  right: 12px;
  border: 0;
  background: transparent;
  color: #334155;
  font-size: 28px;
  line-height: 28px;
  cursor: pointer;
}

.machine-modal-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 32px 16px 0;
  font-size: 18px;
  font-weight: 800;
}

.machine-payment-total {
  margin-bottom: 12px;
  padding: 12px;
  border-radius: 6px;
  background: #f1f5f9;
  text-align: center;
}

.machine-payment-total-label {
  color: #64748b;
  font-size: 12px;
  text-transform: uppercase;
}

.machine-payment-total-value {
  font-size: 30px;
  font-weight: 900;
}

.machine-payment-grid {
  display: flex;
  flex-wrap: wrap;
  margin: -4px -4px 12px;
}

.machine-payment-option {
  width: calc(50% - 8px);
  height: 64px;
  margin: 4px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #0f172a;
  flex-direction: column;
  font-weight: 700;
}

.machine-payment-selected {
  border-color: #e68223;
  background: #e68223;
  color: #ffffff;
}

.machine-cash-form > * + * {
  margin-top: 8px;
}

.machine-cash-label {
  display: block;
  font-size: 14px;
  font-weight: 700;
}

.machine-cash-input {
  height: 48px;
  border-color: #cbd5e1;
  background: #ffffff;
  color: #0f172a;
  font-size: 20px;
  letter-spacing: 0;
}

.machine-cash-preview { font-size: 15px; color: #cbd5f5; margin: 4px 0; text-align: right; }
.machine-cash-preview strong { color: #ffffff; font-size: 20px; }
.machine-change-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 800;
}

.machine-change-negative {
  background: rgba(220, 38, 38, 0.1);
  color: #dc2626;
}

.machine-change-positive {
  background: rgba(16, 185, 129, 0.1);
  color: #047857;
}

.machine-pending {
  margin: 12px 0 0;
  color: #64748b;
  text-align: center;
  font-size: 14px;
}

.machine-loading,
.machine-error {
  text-align: center;
}

.machine-toast {
  position: fixed;
  z-index: 10000;
  right: 16px;
  bottom: 16px;
  max-width: 320px;
  padding: 12px 14px;
  border-radius: 6px;
  background: #111827;
  color: #ffffff;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 14px;
  font-weight: 700;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
}

.machine-error-text {
  color: #f1f5f9;
  font-size: 18px;
}

button:disabled,
.machine-product-button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.tabular-nums {
  font-variant-numeric: tabular-nums;
}

@media (min-width: 640px) {
  .machine-product-button {
    width: calc(25% - 8px);
  }
}

@media (min-width: 768px) {
  .machine-product-button {
    width: calc(20% - 8px);
  }
}

@media (min-width: 1024px) {
  .machine-product-button {
    width: calc(16.666% - 8px);
  }
}

@media (max-width: 420px) {
  .machine-title {
    font-size: 15px;
  }


  .machine-total {
    padding-right: 10px;
    padding-left: 10px;
  }

  .machine-total-label {
    font-size: 12px;
  }

  .machine-total-value {
    font-size: 20px;
  }
}