/* Minha Comanda — mobile-first, alto contraste, sol na praia */
:root {
  --bg: #f0f7fa;
  --surface: #ffffff;
  --ink: #0b1f2a;
  --muted: #4a6674;
  --primary: #0a4d68;
  --primary-dark: #083a4f;
  --accent: #f4a261;
  --success: #2a9d8f;
  --danger: #e76f51;
  --whatsapp: #128c7e;
  --pix: #32bcad;
  --border: #c5d8e0;
  --shadow: 0 4px 16px rgba(10, 77, 104, 0.12);
  --radius: 14px;
  --tap: 52px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html {
  height: auto;
  overflow-x: hidden;
  overflow-y: scroll; /* only html scrolls — do not also scroll body */
  -webkit-overflow-scrolling: touch;
}
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.4;
  -webkit-tap-highlight-color: transparent;
  min-height: 100dvh;
  height: auto;
  overflow-x: hidden;
  overflow-y: visible; /* let html scroll */
  touch-action: manipulation;
  overscroll-behavior-y: auto;
  position: relative;
}

.hidden { display: none !important; }
.screen,
#screen-app {
  height: auto;
  min-height: 100dvh;
  overflow: visible;
}

/* LOGIN */
#screen-login {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: linear-gradient(160deg, #0a4d68 0%, #1a7a9a 50%, #f4a261 140%);
  min-height: 100dvh;
}
.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border-radius: 20px;
  padding: 28px 24px;
  box-shadow: var(--shadow);
}
.brand { text-align: center; margin-bottom: 24px; }
.brand-emoji { font-size: 48px; display: block; }
.brand h1 { font-size: 1.55rem; color: var(--primary); margin-top: 8px; }
.subtitle { color: var(--muted); font-size: 0.95rem; margin-top: 4px; }
.auth-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 16px;
  background: #e8f1f5;
  padding: 4px;
  border-radius: 12px;
}
.auth-tab {
  flex: 1;
  min-height: 44px;
  border: none;
  background: transparent;
  border-radius: 10px;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.95rem;
}
.auth-tab.active {
  background: #fff;
  color: var(--primary);
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}
.login-mode-toggle {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.login-mode-toggle .chip { flex: 1; text-align: center; }
#form-login-senha label,
#form-login-pin label,
#form-register label {
  display: block;
  font-weight: 700;
  margin-bottom: 6px;
  font-size: 0.9rem;
}
#form-login-senha input,
#form-login-pin input,
#form-register input {
  width: 100%;
  height: var(--tap);
  font-size: 1.05rem;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 12px;
  padding: 0 12px;
  letter-spacing: normal;
  text-align: left;
}
#form-login-pin #pin {
  letter-spacing: 0.2em;
  text-align: center;
  font-size: 1.35rem;
}
#form-login-senha input:focus,
#form-login-pin input:focus,
#form-register input:focus {
  outline: 3px solid #7ec8e3;
  border-color: var(--primary);
}
.admin-store-card { background: var(--surface); }

/* TOPBAR */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--primary);
  color: #fff;
  padding: 10px 12px;
  min-height: 56px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}
.topbar-left { display: flex; align-items: center; gap: 8px; min-width: 0; }
.topbar h1 {
  font-size: 1.1rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.btn-icon {
  min-width: 44px;
  min-height: 44px;
  border: none;
  background: rgba(255,255,255,0.15);
  color: #fff;
  border-radius: 10px;
  font-size: 1.35rem;
  cursor: pointer;
}

/* DRAWER */
.drawer { position: fixed; inset: 0; z-index: 50; }
.drawer.hidden {
  pointer-events: none !important;
}

.drawer-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.45); }
.drawer-panel {
  position: absolute;
  top: 0; right: 0; bottom: 0;
  width: min(300px, 85vw);
  background: var(--surface);
  padding: 20px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  box-shadow: -4px 0 20px rgba(0,0,0,0.2);
}
.drawer-brand {
  font-weight: 800;
  color: var(--primary);
  padding: 8px 12px 16px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 8px;
}
.drawer-item {
  text-align: left;
  border: none;
  background: transparent;
  padding: 14px 14px;
  font-size: 1.1rem;
  border-radius: 10px;
  cursor: pointer;
  color: var(--ink);
  font-weight: 600;
}
.drawer-item:hover, .drawer-item:active { background: #e8f4f8; }
.drawer-item.danger { color: var(--danger); margin-top: auto; }

main { padding: 14px; padding-bottom: calc(100px + env(safe-area-inset-bottom, 0px)); max-width: 640px; margin: 0 auto; height: auto; overflow: visible; }

/* BUTTONS */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: var(--tap);
  padding: 0 18px;
  border: none;
  border-radius: var(--radius);
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
  color: #fff;
  box-shadow: 0 2px 0 rgba(0,0,0,0.12);
}
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--primary); }
.btn-primary:active { background: var(--primary-dark); }
.btn-lg { width: 100%; font-size: 1.15rem; }
.btn-block { width: 100%; margin-bottom: 14px; }
.btn-success { background: var(--success); }
.btn-whatsapp { background: var(--whatsapp); flex: 1; }
.btn-pix { background: var(--pix); flex: 1; color: #073; font-weight: 800; }
.btn-danger { background: var(--danger); }
.btn-ghost {
  background: #e8f0f4;
  color: var(--ink);
  box-shadow: none;
}

.toolbar {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 14px;
}
.tabs-filter { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  min-height: 40px;
  padding: 0 14px;
  border-radius: 999px;
  border: 2px solid var(--border);
  background: #fff;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
}
.chip.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.card-list { display: flex; flex-direction: column; gap: 10px; }
.card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  min-height: 64px;
}
.card:active { background: #f5fbfd; }
.card h3 { font-size: 1.15rem; }
.card .meta { color: var(--muted); font-size: 0.9rem; }
.card .price { font-size: 1.2rem; font-weight: 800; color: var(--primary); white-space: nowrap; }
.empty { text-align: center; color: var(--muted); padding: 40px 16px; }

.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 800;
  background: #d4edda;
  color: #155724;
}
.badge.closed { background: #e2e8ec; color: #4a6674; }

/* RECEIPT */
.receipt {
  background: #fffef8;
  border: 2px dashed #b8a88a;
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 16px;
  font-family: ui-monospace, "Courier New", monospace;
}
.receipt-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  border-bottom: 1px dashed #b8a88a;
  padding-bottom: 10px;
  margin-bottom: 10px;
}
.receipt-head h2 { font-family: var(--font); font-size: 1.35rem; }
.receipt-items { display: flex; flex-direction: column; gap: 6px; }
.receipt-line {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 8px;
  font-size: 0.95rem;
}
.receipt-line .qty { color: var(--muted); }
.receipt-total {
  display: flex;
  justify-content: space-between;
  border-top: 2px solid var(--ink);
  margin-top: 12px;
  padding-top: 10px;
  font-family: var(--font);
  font-size: 1.35rem;
}

/* PRODUCT GRID (comanda) */
.prod-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 90px;
  max-height: none;
  overflow: visible;
}
#view-comanda {
  overflow: visible;
}
#produtos-rapidos {
  max-height: none;
  overflow: visible;
  -webkit-overflow-scrolling: touch;
}
.prod-row {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  box-shadow: var(--shadow);
}
.prod-row-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 10px;
}
.prod-row-top strong { font-size: 1.1rem; }
.prod-row-top span { color: var(--muted); font-weight: 700; }
.prod-btns { display: flex; gap: 8px; }
.prod-btns button {
  flex: 1;
  min-height: 56px;
  border: none;
  border-radius: 12px;
  font-size: 1.25rem;
  font-weight: 800;
  cursor: pointer;
}
.btn-minus { background: #fde8e4; color: var(--danger); }
.btn-plus1 { background: #d4edda; color: #155724; }
.btn-plus2 { background: var(--primary); color: #fff; }
.prod-qty-badge {
  display: inline-block;
  min-width: 28px;
  text-align: center;
  background: var(--accent);
  color: #000;
  border-radius: 8px;
  padding: 2px 8px;
  font-weight: 800;
  margin-left: 6px;
}

.action-bar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  display: flex;
  gap: 8px;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  background: rgba(255,255,255,0.96);
  border-top: 1px solid var(--border);
  backdrop-filter: blur(8px);
  z-index: 30;
  max-width: 640px;
  margin: 0 auto;
}

/* FORMS */
.form-stack label { display: block; font-weight: 700; margin: 12px 0 6px; }
.form-stack input, .form-stack select {
  width: 100%;
  min-height: 48px;
  font-size: 1.05rem;
  padding: 10px 12px;
  border: 2px solid var(--border);
  border-radius: 10px;
  background: #fff;
}
.form-stack hr { margin: 20px 0; border: none; border-top: 1px solid var(--border); }
.form-stack h3 { margin-top: 4px; color: var(--primary); }
.hint { margin-top: 16px; color: var(--muted); font-size: 0.9rem; }

.error { color: var(--danger); font-weight: 700; margin-top: 10px; }
.ok { color: var(--success); font-weight: 700; margin-top: 10px; }

/* PRODUCT ADMIN CARD */
.prod-admin {
  cursor: default;
  flex-direction: column;
  align-items: stretch;
}
.prod-admin-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}
.prod-admin-info { flex: 1; min-width: 0; }
.prod-admin-actions { display: flex; gap: 8px; margin-top: 10px; }
.prod-admin-actions .btn { flex: 1; min-height: 44px; font-size: 0.95rem; }

/* MODAL */
.modal { position: fixed; inset: 0; z-index: 60; display: flex; align-items: flex-end; justify-content: center; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.5); }
.modal-card {
  position: relative;
  width: 100%;
  max-width: 480px;
  max-height: 90dvh;
  overflow: auto;
  background: var(--surface);
  border-radius: 20px 20px 0 0;
  padding: 20px;
  box-shadow: 0 -8px 30px rgba(0,0,0,0.25);
}
@media (min-width: 520px) {
  .modal { align-items: center; }
  .modal-card { border-radius: 20px; }
}
.modal-card h2 { margin-bottom: 14px; color: var(--primary); }
.modal-actions { display: flex; gap: 8px; margin-top: 16px; }
.modal-actions .btn { flex: 1; }

.pix-box { text-align: center; }
.pix-box img { width: 240px; height: 240px; margin: 8px auto; display: block; border: 4px solid #fff; box-shadow: var(--shadow); }
.pix-amount { font-size: 1.6rem; font-weight: 800; color: var(--primary); margin: 8px 0; }
.pix-code {
  word-break: break-all;
  font-size: 0.7rem;
  background: #f0f4f6;
  padding: 10px;
  border-radius: 8px;
  max-height: 80px;
  overflow: auto;
  text-align: left;
}

.toast {
  position: fixed;
  bottom: 90px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: #fff;
  padding: 12px 20px;
  border-radius: 999px;
  font-weight: 700;
  z-index: 70;
  box-shadow: var(--shadow);
  max-width: 90vw;
}

/* Optional 10% tip */
.tip-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 12px;
  padding: 10px 0 4px;
  border-top: 1px dashed var(--border);
}
.tip-check {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 1.05rem;
  cursor: pointer;
  user-select: none;
  min-height: 44px;
}
.tip-check input {
  width: 22px;
  height: 22px;
  accent-color: var(--primary);
}
.tip-hint {
  color: var(--muted);
  font-size: 0.85rem;
}
.receipt-breakdown {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 6px;
  font-size: 0.95rem;
  color: var(--muted);
}
.breakdown-line {
  display: flex;
  justify-content: space-between;
}


/* Voltar button — clear label on inner screens */
.btn-back {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 44px;
  padding: 0 12px;
  border: none;
  background: rgba(255,255,255,0.2);
  color: #fff;
  border-radius: 10px;
  font-size: 1rem;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
}
.btn-back-arrow { font-size: 1.25rem; line-height: 1; }
.btn-back-label { font-size: 0.95rem; }

.action-bar-wrap {
  flex-wrap: wrap;
}
.btn-block-danger {
  width: 100%;
  flex: 1 1 100%;
  margin-top: 4px;
}

.section-hr {
  margin: 24px 0 16px;
  border: none;
  border-top: 1px solid var(--border);
}

.faturamento-section h3 {
  color: var(--primary);
  font-size: 1.25rem;
}
.faturamento-section h4 {
  color: var(--primary);
  margin: 8px 0;
}
.faturamento-section label {
  display: block;
  font-weight: 700;
  margin: 12px 0 6px;
}
.faturamento-section input {
  width: 100%;
  min-height: 48px;
  font-size: 1.05rem;
  padding: 10px 12px;
  border: 2px solid var(--border);
  border-radius: 10px;
  background: #fff;
}

.revenue-summary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.rev-stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow);
}
.rev-stat .label { color: var(--muted); font-size: 0.85rem; font-weight: 700; }
.rev-stat .value { font-size: 1.35rem; font-weight: 800; color: var(--primary); margin-top: 4px; }
.rev-stat.wide { grid-column: 1 / -1; }
.rev-stat .value.big { font-size: 1.7rem; color: var(--success); }

.rev-prod-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
}
.rev-prod-table th, .rev-prod-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
.rev-prod-table th { background: #e8f4f8; font-weight: 800; }
.rev-prod-table td:last-child, .rev-prod-table th:last-child { text-align: right; }


/* Forgot PIN */
.link-forgot,
.btn-forgot-pin {
  display: block;
  width: 100%;
  margin-top: 14px;
  background: #fff;
  border: 2px solid var(--primary);
  color: var(--primary);
  font-weight: 800;
  font-size: 1rem;
  text-decoration: none;
  cursor: pointer;
  padding: 14px 12px;
  border-radius: 12px;
  text-align: center;
}
.btn-forgot-pin:active { opacity: 0.85; background: #e8f4f8; }
.login-forgot-hint {
  margin-top: 8px;
  text-align: center;
  font-size: 0.85rem;
  color: #5a6a75;
}
.btn-forgot-pin-cfg {
  margin-top: 10px;
  margin-bottom: 4px;
  font-size: 0.95rem;
  padding: 12px 10px;
}
.numpad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 12px 0 4px;
}
.numpad button {
  height: 52px;
  font-size: 1.35rem;
  font-weight: 700;
  border: 2px solid var(--border);
  border-radius: 12px;
  background: #f7fafc;
  color: var(--text);
  cursor: pointer;
}
.numpad button:active { background: #e2eef5; }
.numpad .numpad-wide { grid-column: span 1; }
.forgot-step-hint { color: var(--muted); font-size: 0.9rem; margin-bottom: 10px; }
.forgot-field {
  width: 100%;
  height: var(--tap);
  font-size: 1.35rem;
  letter-spacing: 0.25em;
  text-align: center;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 8px;
  padding: 0 12px;
}

@keyframes forgotPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(10, 77, 104, 0.45); transform: scale(1); }
  50% { box-shadow: 0 0 0 8px rgba(10, 77, 104, 0); transform: scale(1.02); }
}
.btn-forgot-pin-pulse {
  animation: forgotPulse 0.7s ease-in-out 3;
  background: #e8f4f8 !important;
}


/* Maquininhas / card payments */
.btn-card {
  background: #1e3a5f;
  color: #fff;
  flex: 1;
  font-weight: 700;
}
.btn-card:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.machine-pay-bar {
  margin-top: 10px;
  padding-top: 4px;
}
.machine-pay-hint {
  margin: 0 0 8px;
  font-size: 0.85rem;
}
.machine-pay-btns {
  gap: 8px;
}
.payment-fields {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.payment-devices {
  margin-top: 12px;
}
.device-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 8px;
}
@media (max-width: 420px) {
  .device-row {
    grid-template-columns: 1fr;
  }
}

.pay-clear-wrap {
  margin-top: 12px;
  padding-top: 8px;
}
.btn-clear-keys {
  color: var(--danger);
  border: 1px solid var(--danger);
  background: transparent;
  font-weight: 700;
}
.btn-clear-keys:hover {
  background: #fde8e4;
}

/* ---- Trial banner ---- */
.trial-banner {
  background: #fff3cd;
  color: #7a5b00;
  text-align: center;
  font-size: 0.9rem;
  font-weight: 700;
  padding: 8px 12px;
  border-bottom: 1px solid #f0d78c;
}

/* ---- Subscription gate ---- */
.subscription-gate {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  overflow-y: auto;
  padding: 24px 16px 40px;
  background: linear-gradient(160deg, #0a4d68 0%, #1a7a9a 50%, #f4a261 140%);
  min-height: 100dvh;
}
.subscription-card {
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border-radius: 20px;
  padding: 28px 24px;
  box-shadow: var(--shadow);
  margin: auto;
}
.sub-gate-msg {
  margin: 12px 0;
  color: var(--ink);
  font-size: 1rem;
}
.sub-pix-area {
  margin-top: 8px;
  text-align: center;
}
.sub-pix-area .pix-qr,
.sub-pix-area img {
  width: 240px;
  height: 240px;
  margin: 8px auto;
  display: block;
  border: 4px solid #fff;
  box-shadow: var(--shadow);
  border-radius: 12px;
}
.sub-pix-amount {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--primary);
  margin: 8px 0;
}
.sub-pix-area .pix-payload,
#sub-pix-payload {
  width: 100%;
  font-size: 0.72rem;
  font-family: ui-monospace, monospace;
  padding: 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  resize: none;
  margin: 8px 0;
  word-break: break-all;
}
.admin-sub-badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 999px;
}
.admin-sub-badge.trial { background: #fff3cd; color: #7a5b00; }
.admin-sub-badge.active { background: #d8f3ef; color: #1b6b5f; }
.admin-sub-badge.expired { background: #fde8e4; color: #9b2c10; }
.admin-sub-badge.blocked { background: #eceff1; color: #37474f; }

/* ---- Business type picker (register) ---- */
.biz-type-fieldset {
  border: none;
  margin: 14px 0 8px;
  padding: 0;
}
.biz-type-fieldset legend {
  font-weight: 800;
  color: var(--primary);
  margin-bottom: 8px;
  font-size: 0.95rem;
}
.biz-type-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.biz-type-option {
  display: block;
  cursor: pointer;
}
.biz-type-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.biz-type-card {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 12px;
  border: 2px solid var(--border);
  border-radius: 12px;
  background: #f7fbfd;
  transition: border-color 0.15s, background 0.15s;
}
.biz-type-card strong { color: var(--ink); font-size: 1rem; }
.biz-type-card small { color: var(--muted); font-size: 0.82rem; line-height: 1.3; }
.biz-type-option input:checked + .biz-type-card {
  border-color: var(--primary);
  background: #e8f4f8;
  box-shadow: 0 0 0 1px var(--primary);
}
.biz-type-option:active .biz-type-card { transform: scale(0.99); }

/* ---- PDV / Vender ---- */
.pdv-layout {
  display: flex;
  flex-direction: column;
  gap: 0;
  position: relative;
  height: auto;
  overflow: visible;
}
.pdv-products {
  /* room for floating cart FAB */
  padding-bottom: calc(88px + env(safe-area-inset-bottom));
  height: auto;
  overflow: visible;
}
.pdv-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  max-height: none;
  overflow: visible;
}
.pdv-prod-tile {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 12px;
  box-shadow: var(--shadow);
  min-height: 72px;
  text-align: left;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
  font: inherit;
  color: inherit;
}
.pdv-prod-tile:active { background: #eef7fa; transform: scale(0.98); }
.pdv-prod-tile strong { font-size: 1.05rem; line-height: 1.25; }
.pdv-prod-tile .pdv-price { font-weight: 800; color: var(--primary); font-size: 1.1rem; }
.pdv-prod-tile .pdv-in-cart {
  align-self: flex-start;
  background: var(--primary);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 999px;
}

/* Fixed bottom cart dock (mobile-first) */
.pdv-cart-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.35);
  z-index: 45;
}
.pdv-cart-backdrop.hidden {
  pointer-events: none !important;
}
.pdv-cart {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 46;
  max-width: 640px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  pointer-events: none;
  height: auto;
}
.pdv-cart[data-open="0"] {
  height: auto;
  top: auto;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
}
.pdv-cart > * { pointer-events: auto; }

.pdv-cart-sheet {
  display: none;
  background: var(--surface);
  border-radius: 18px 18px 0 0;
  box-shadow: 0 -8px 28px rgba(0,0,0,0.18);
  max-height: min(72dvh, 640px);
  overflow: hidden;
  flex-direction: column;
  border: 1px solid var(--border);
  border-bottom: none;
}
.pdv-cart[data-open="1"] .pdv-cart-sheet {
  display: flex;
}
.pdv-cart-sheet-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px 4px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.pdv-cart-close {
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 10px;
  background: #eef2f4;
  color: var(--ink);
  font-size: 1.25rem;
  font-weight: 800;
  cursor: pointer;
  line-height: 1;
}
.pdv-cart-title {
  font-size: 1.15rem;
  color: var(--primary);
  margin: 0;
}
.pdv-cart-sheet-body {
  padding: 12px 14px 10px;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}
.pdv-obs-label {
  display: block;
  font-weight: 700;
  font-size: 0.9rem;
  margin-bottom: 4px;
}
#pdv-obs {
  width: 100%;
  min-height: 44px;
  padding: 8px 10px;
  border: 2px solid var(--border);
  border-radius: 10px;
  font-size: 1rem;
  margin-bottom: 10px;
}
.pdv-cart-items { display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; }
.pdv-cart-empty-hint { margin-top: 4px; margin-bottom: 8px; }
.pdv-cart-line {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px dashed var(--border);
}
.pdv-cart-line:last-child { border-bottom: none; }
.pdv-cart-line-name { font-weight: 700; }
.pdv-cart-line-meta { color: var(--muted); font-size: 0.85rem; }
.pdv-qty-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}
.pdv-qty-controls button {
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 10px;
  font-size: 1.2rem;
  font-weight: 800;
  cursor: pointer;
}
.pdv-qty-controls .pdv-qminus { background: #fde8e4; color: var(--danger); }
.pdv-qty-controls .pdv-qplus { background: #d4edda; color: #155724; }
.pdv-qty-controls .pdv-qty { min-width: 28px; text-align: center; font-weight: 800; }
.pdv-total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 1.35rem;
  font-weight: 800;
  margin: 10px 0 12px;
  padding-top: 8px;
  border-top: 2px solid var(--ink);
}
.pdv-tip-row { margin: 8px 0; }
.pdv-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
  position: static;
}
.pdv-actions .btn { flex: 1 1 140px; }
.pdv-machine-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  position: static;
}
.pdv-machine-btns .btn { flex: 1 1 100px; }
.pdv-clear-btn { margin-top: 8px; }

/* Floating cart FAB — icon-only default, no empty bar */
.pdv-cart-fab {
  position: fixed;
  right: max(16px, env(safe-area-inset-right));
  bottom: max(20px, calc(16px + env(safe-area-inset-bottom)));
  z-index: 47;
  width: 58px;
  height: 58px;
  border: none;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  box-shadow: 0 8px 24px rgba(0, 90, 120, 0.35);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.pdv-cart-fab:active { transform: scale(0.94); }
.pdv-cart-fab:focus-visible {
  outline: 3px solid #fff;
  outline-offset: 3px;
  box-shadow: 0 0 0 5px var(--primary), 0 8px 24px rgba(0, 90, 120, 0.35);
}
.pdv-cart-fab-icon { display: block; }
.pdv-cart-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 999px;
  background: #e53935;
  color: #fff;
  font-size: 0.75rem;
  font-weight: 800;
  line-height: 22px;
  text-align: center;
  box-shadow: 0 2px 6px rgba(0,0,0,0.25);
  border: 2px solid #fff;
}
.pdv-cart-badge.hidden { display: none; }
/* Hide FAB while sheet is open so it does not cover pay buttons */
.pdv-cart-fab[data-sheet-open="1"] {
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
}

@media (min-width: 860px) {
  .pdv-layout {
    flex-direction: column;
    align-items: stretch;
    gap: 0;
  }
  .pdv-products {
    flex: 1;
    padding-bottom: calc(88px + env(safe-area-inset-bottom));
  }
  .pdv-cart {
    max-width: 480px;
    left: auto;
    right: 24px;
  }
  .pdv-cart-sheet {
    max-height: min(80dvh, 720px);
    border-radius: 18px 18px 0 0;
  }
  .pdv-cart-fab {
    right: max(28px, env(safe-area-inset-right));
    bottom: max(28px, calc(20px + env(safe-area-inset-bottom)));
  }
  .pdv-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}


/* ---- Product search ---- */
.prod-search-wrap {
  position: relative;
  margin: 0 0 10px;
}
.prod-search-wrap input[type="search"] {
  width: 100%;
  min-height: 46px;
  font-size: 1.05rem;
  padding: 10px 42px 10px 12px;
  border: 2px solid var(--border);
  border-radius: 10px;
  background: #fff;
}
.prod-search-wrap input[type="search"]::-webkit-search-cancel-button {
  -webkit-appearance: none;
  appearance: none;
}
.prod-search-clear {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 8px;
  background: #eef2f4;
  color: var(--ink);
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
  font-weight: 700;
}
.prod-search-clear:active { background: #dde5ea; }
.prod-code {
  display: inline-block;
  margin-left: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.02em;
}
.pdv-prod-tile .prod-code {
  margin-left: 0;
  font-size: 0.7rem;
}
#view-comanda .prod-search-wrap {
  margin: 10px 0 8px;
}


/* ---- PDV category strip (supermarket / iFood style) ---- */
.pdv-cat-strip {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  padding: 2px 2px 10px;
  margin: 0 0 4px;
}
.pdv-cat-strip::-webkit-scrollbar { height: 4px; }
.pdv-cat-chip {
  flex: 0 0 auto;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-width: 72px;
  max-width: 96px;
  padding: 8px 10px;
  border: 2px solid var(--border);
  border-radius: 14px;
  background: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.15;
  color: var(--text);
  cursor: pointer;
  text-align: center;
}
.pdv-cat-chip .pdv-cat-icon {
  font-size: 1.45rem;
  line-height: 1;
}
.pdv-cat-chip.active {
  border-color: var(--primary);
  background: #e8f6fb;
  color: var(--primary);
  box-shadow: 0 0 0 1px var(--primary);
}
.pdv-cat-chip:active { transform: scale(0.96); }

.produtos-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}
.produtos-tabs .chip { flex: 1; text-align: center; }

.cat-admin-icon {
  font-size: 1.5rem;
  margin-right: 6px;
}
.prod-admin .prod-cat-badge {
  display: inline-block;
  margin-top: 4px;
  font-size: 0.8rem;
  color: var(--muted);
  font-weight: 600;
}


/* ---- PDV product folders (Produtos admin) ---- */
.folder-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 4px;
  max-height: none;
  overflow: visible;
}
.folder-tile {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 12px 14px;
  box-shadow: var(--shadow);
  min-height: 118px;
  text-align: left;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  width: 100%;
  font: inherit;
  color: inherit;
}
.folder-tile:active { background: #eef7fa; transform: scale(0.98); }
.folder-tile-icon { font-size: 2rem; line-height: 1; }
.folder-tile-name { font-weight: 800; font-size: 1.05rem; line-height: 1.2; }
.folder-tile-count { color: var(--muted); font-size: 0.85rem; font-weight: 600; }
.folder-tile-edit {
  position: absolute;
  top: 6px;
  right: 6px;
  min-height: 36px;
  min-width: 36px;
  padding: 0 8px;
  border: none;
  background: #e8f0f4;
  border-radius: 8px;
  font-size: 1rem;
  cursor: pointer;
}
.folder-tile-edit:active { transform: scale(0.94); }
.pasta-atual-label {
  font-weight: 800;
  font-size: 1.2rem;
  margin: 0 0 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.pastas-hint { margin-top: 14px; }
.prod-cat-locked {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 12px 0 0;
  padding: 10px 12px;
  border: 2px solid var(--border);
  border-radius: 10px;
  background: #f4fafc;
  font-weight: 700;
}
.prod-cat-locked span { font-weight: 500; color: var(--muted); }
@media (min-width: 520px) {
  .folder-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}


/* ---- Customer orders / QR (comanda) ---- */
.nav-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  margin-left: 6px;
  border-radius: 999px;
  background: #e74c3c;
  color: #fff;
  font-size: 0.75rem;
  font-weight: 800;
  vertical-align: middle;
}
.nav-badge.hidden { display: none !important; }
.toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.pedido-card {
  flex-wrap: wrap;
  align-items: flex-start;
}
.pedido-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 120px;
}
.cfg-qr-cliente {
  background: #f5fbfd;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  margin: 8px 0 16px;
}
.cfg-qr-cliente h3 { margin: 0 0 6px; font-size: 1.05rem; }
.cfg-qr-img {
  display: block;
  width: 200px;
  height: 200px;
  margin: 10px auto;
  border-radius: 12px;
  background: #fff;
}
.cfg-qr-url {
  width: 100%;
  min-height: 44px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 0.9rem;
  margin-bottom: 8px;
}
.cfg-qr-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}


/* Photo category icons (URL paths in categories.icon) */
.folder-tile-icon .folder-tile-img,
.pasta-atual-icon .folder-tile-img {
  width: 52px;
  height: 52px;
  object-fit: cover;
  border-radius: 12px;
  display: block;
  background: #f3f6f8;
  box-shadow: 0 1px 3px rgba(0,0,0,.08);
}
.pasta-atual-icon {
  display: inline-flex;
  align-items: center;
}
.pasta-atual-icon .folder-tile-img {
  width: 36px;
  height: 36px;
  border-radius: 8px;
}
.pdv-cat-chip .pdv-cat-icon .pdv-cat-img {
  width: 28px;
  height: 28px;
  object-fit: cover;
  border-radius: 8px;
  display: block;
  margin: 0 auto 2px;
}
.prod-cat-badge .prod-cat-img,
.prod-cat-locked .prod-cat-img {
  width: 18px;
  height: 18px;
  object-fit: cover;
  border-radius: 4px;
  vertical-align: middle;
  display: inline-block;
  margin-right: 4px;
}


/* ---- Product photo / icon thumbs ---- */
.prod-thumb {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: 10px;
  background: #eef3f6;
  flex-shrink: 0;
  display: block;
}
.prod-thumb--sm { width: 36px; height: 36px; border-radius: 8px; }
.prod-thumb--pdv { width: 44px; height: 44px; border-radius: 10px; }
.prod-thumb--cli { width: 44px; height: 44px; border-radius: 10px; }
.prod-thumb--fallback,
span.prod-thumb {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  color: var(--primary, #0a4d68);
  font-size: 1rem;
}
.prod-row-name {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.prod-row-name strong { min-width: 0; }
.pdv-prod-main {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.pdv-prod-text {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.prod-image-editor {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin-top: 6px;
}
.prod-image-preview {
  width: 72px;
  height: 72px;
  border-radius: 12px;
  background: #eef3f6;
  overflow: hidden;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.prod-image-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.prod-image-actions {
  flex: 1;
  min-width: 0;
}
.prod-image-actions input[type="file"] {
  display: block;
  width: 100%;
  margin-bottom: 6px;
  font-size: 0.9rem;
}


/* ---- Category · product labels ---- */
.item-cat-chip {
  display: inline-block;
  margin-right: 6px;
  padding: 2px 8px;
  border-radius: 999px;
  background: #e8f6fb;
  color: #0a4d68;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.01em;
  vertical-align: middle;
  max-width: 11rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.item-prod-name { font-weight: 700; }
.pedido-items {
  list-style: none;
  margin: 8px 0 4px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.pedido-item-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 6px;
  font-size: 0.95rem;
  line-height: 1.35;
  color: var(--ink);
}
.pedido-item-qty {
  font-weight: 800;
  color: var(--primary);
  min-width: 1.6rem;
}

/* ---- iFood-style live order banner (praia) ---- */
.order-live-banner {
  position: sticky;
  top: 56px;
  z-index: 39;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: center;
  padding: 8px 10px;
  background: linear-gradient(90deg, #0a4d68 0%, #1a7a9a 55%, #ea1d2c 140%);
  box-shadow: 0 2px 10px rgba(0,0,0,0.18);
}
.order-live-banner.hidden { display: none !important; }
.order-live-toast,
.order-live-chip {
  border: none;
  cursor: pointer;
  font-weight: 800;
  border-radius: 999px;
  min-height: 40px;
  padding: 8px 16px;
  font-size: 0.95rem;
}
.order-live-toast {
  background: #fff;
  color: #ea1d2c;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.order-live-toast.hidden { display: none !important; }
.order-live-toast--pulse {
  animation: orderLivePulse 0.55s ease-out;
}
@keyframes orderLivePulse {
  0% { transform: scale(0.92); opacity: 0.5; }
  60% { transform: scale(1.04); }
  100% { transform: scale(1); opacity: 1; }
}
.order-live-chip {
  background: rgba(255,255,255,0.18);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.45);
}
.order-live-chip.hidden { display: none !important; }

/* ---- Activate order alerts (audio unlock) ---- */
.btn-ativar-alertas {
  border: none;
  cursor: pointer;
  font-weight: 800;
  border-radius: 999px;
  min-height: 40px;
  padding: 8px 16px;
  font-size: 0.9rem;
  background: #fff3cd;
  color: #7a4d00;
  box-shadow: 0 2px 8px rgba(0,0,0,0.12);
  border: 1px solid #f0d78c;
}
.btn-ativar-alertas.hidden { display: none !important; }
.btn-ativar-alertas--block {
  display: block;
  width: 100%;
  margin: 0 0 12px;
  border-radius: 12px;
}
.btn-ativar-alertas--block.hidden { display: none !important; }
