:root {
  --bg: #c9b79f;
  --surface: #d8c7b0;
  --text: #241c16;
  --muted: #6e5a49;
  --on-primary: #fdf8f2;
  --primary: #8b1e25;
  --primary-700: #6d151b;
  --btn-primary: #7a1f3d;
  --btn-primary-700: #5f1830;
  --danger: #9f2f30;
  --success: #4f6130;
  --border: #b79f87;
  --shadow: 0 6px 20px rgba(36, 28, 22, 0.16);
}

[data-theme="dark"] {
  --bg: #101418;
  --surface: #182028;
  --text: #f5f7fa;
  --muted: #b3bdc7;
  --on-primary: #f5f7fa;
  --primary: #a03b5a;
  --primary-700: #7e2d46;
  --btn-primary: #7a1f3d;
  --btn-primary-700: #5f1830;
  --danger: #f87171;
  --success: #4ade80;
  --border: #2f3a46;
  --shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  font-family: "Nunito", "Segoe UI", sans-serif;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--bg) 86%, transparent) 0%, color-mix(in srgb, var(--bg) 76%, transparent) 100%),
    url("../../../parede.png") center/cover fixed no-repeat;
  color: var(--text);
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }

.app-shell { min-height: 100dvh; padding-bottom: 110px; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--surface) 97%, var(--bg));
  backdrop-filter: blur(10px) saturate(130%);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; }
.brand img { width: 36px; height: 36px; border-radius: 10px; object-fit: cover; background: #fff; }
.action-row { display: flex; gap: 8px; }

.container { padding: 14px; max-width: 980px; margin: 0 auto; }
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 14px;
  margin-bottom: 12px;
}
.grid { display: grid; gap: 10px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }

@media (max-width: 680px) {
  .grid-2 { grid-template-columns: 1fr; }
}

.btn {
  border: none;
  border-radius: 12px;
  padding: 12px 14px;
  font-weight: 700;
  cursor: pointer;
  min-height: 46px;
}
.btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 1px;
}
.btn-primary { background: var(--btn-primary); color: #fff; }
.btn-primary:hover { background: var(--btn-primary-700); }
.btn-muted { background: color-mix(in srgb, var(--surface) 65%, var(--border)); color: var(--text); }
.btn-danger { background: var(--danger); color: #fff; }

.input, .select, .textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 11px 12px;
  min-height: 44px;
  background: color-mix(in srgb, var(--surface) 95%, #fff);
  color: var(--text);
}
.textarea { min-height: 88px; resize: vertical; }
label { display: block; font-size: 0.9rem; font-weight: 700; margin-bottom: 6px; }

form .input + label,
form .select + label,
form .textarea + label {
  margin-top: 10px;
}

form .grid {
  margin-bottom: 10px;
}

input[type="file"].input::file-selector-button {
  border: none;
  border-radius: 10px;
  padding: 8px 12px;
  margin-right: 10px;
  background: var(--btn-primary);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}
input[type="file"].input::-webkit-file-upload-button {
  border: none;
  border-radius: 10px;
  padding: 8px 12px;
  margin-right: 10px;
  background: var(--btn-primary);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}
input[type="file"].input:hover::file-selector-button,
input[type="file"].input:hover::-webkit-file-upload-button {
  background: var(--btn-primary-700);
}

.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  background: color-mix(in srgb, var(--primary) 18%, var(--surface));
  color: var(--primary-700);
}
.badge-fila { background: #dbeafe; color: #1e40af; }
.badge-preparo { background: #bfdbfe; color: #1d4ed8; }
.badge-pronto { background: #dcfce7; color: #166534; }
.badge-cancelado { background: #fee2e2; color: #991b1b; }

.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 30px;
  z-index: 1000;
  margin: 0 auto;
  max-width: 980px;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
  padding: 8px;
  border-top: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 97%, var(--bg));
  backdrop-filter: blur(10px) saturate(130%);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.14);
}
.bottom-nav a {
  font-size: 0.7rem;
  border-radius: 10px;
  padding: 7px 3px;
  text-align: center;
  font-weight: 700;
  color: var(--muted);
}
.bottom-nav a.active { background: color-mix(in srgb, var(--primary) 16%, var(--surface)); color: var(--primary); }
.bottom-nav .desktop-extra { display: none; }
.more-trigger {
  border: none;
  border-radius: 10px;
  padding: 7px 3px;
  text-align: center;
  font-weight: 700;
  color: var(--muted);
  background: transparent;
  font-size: 0.7rem;
}
.drawer-overlay {
  position: fixed;
  inset: 0;
  z-index: 1050;
  pointer-events: none;
}
.drawer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.26);
  opacity: 0;
  transition: opacity 180ms ease;
  z-index: 1;
}
.drawer-panel {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: min(82vw, 320px);
  background: var(--surface);
  border-right: 1px solid var(--border);
  box-shadow: var(--shadow);
  padding: 14px;
  overflow-y: auto;
  overscroll-behavior: contain;
  transform: translateX(-104%);
  transition: transform 220ms ease;
  z-index: 2;
}
.drawer-overlay.show {
  pointer-events: auto;
}
.drawer-overlay.show .drawer-backdrop {
  opacity: 1;
}
.drawer-overlay.show .drawer-panel {
  transform: translateX(0);
}
.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.drawer-link {
  display: flex;
  align-items: center;
  gap: 10px;
  border: none;
  border-radius: 12px;
  padding: 12px;
  background: transparent;
  font-weight: 700;
  opacity: 0;
  transform: translateX(-14px);
}
.drawer-link:hover {
  background: color-mix(in srgb, var(--surface) 84%, var(--border));
}
.drawer-overlay.show .drawer-link {
  animation: drawerLinkIn 280ms ease forwards;
}
.drawer-overlay.show .drawer-link:nth-of-type(1) { animation-delay: 180ms; }
.drawer-overlay.show .drawer-link:nth-of-type(2) { animation-delay: 240ms; }
.drawer-overlay.show .drawer-link:nth-of-type(3) { animation-delay: 300ms; }
.drawer-overlay.show .drawer-link:nth-of-type(4) { animation-delay: 360ms; }
.drawer-overlay.show .drawer-link:nth-of-type(5) { animation-delay: 420ms; }
.drawer-overlay.show .drawer-link:nth-of-type(6) { animation-delay: 480ms; }

@keyframes drawerLinkIn {
  from {
    opacity: 0;
    transform: translateX(-14px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.fixed-credit {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 990;
  text-align: center;
  padding: 6px;
  font-size: 0.72rem;
  color: var(--muted);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  border-top: 1px solid var(--border);
}
.clean-link,
.clean-link:visited,
.clean-link:hover,
.clean-link:focus,
.clean-link:active {
  color: inherit;
  text-decoration: none;
}
.credit-brand {
  font-weight: 800;
}

.kpi { font-size: 1.4rem; font-weight: 800; margin-top: 6px; }
.item-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px dashed var(--border); }
.hide { display: none !important; }
.prod-row {
  width: 100%;
  border: none;
  background: transparent;
  text-align: left;
  cursor: pointer;
  border-radius: 12px;
  padding: 8px;
  color: var(--text);
}
.prod-row:hover { background: color-mix(in srgb, var(--surface) 84%, var(--border)); }
.prod-row strong { color: var(--text); }
.prod-row small { color: var(--muted); }
.prod-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.prod-thumb {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  object-fit: cover;
  border: 1px solid var(--border);
  flex: 0 0 auto;
}
.prod-preview {
  width: 100%;
  max-height: 180px;
  margin-top: 8px;
  border-radius: 12px;
  object-fit: cover;
  border: 1px solid var(--border);
}
.prod-thumb-inactive {
  filter: grayscale(100%);
  opacity: 0.78;
}

/* Products page */
.products-page {
  display: grid;
  gap: 12px;
}
.products-hero-card {
  margin-bottom: 0;
}
.products-hero-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  flex-wrap: wrap;
}
.products-hero-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.products-hero-actions .btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.products-list {
  display: grid;
  gap: 8px;
}
.products-row {
  border: 1px solid var(--border);
}
.products-row-inactive {
  background: color-mix(in srgb, var(--surface) 82%, #101827);
}
.products-row-inactive strong {
  color: color-mix(in srgb, var(--text) 82%, #9ca3af);
}
.products-categories-list {
  display: grid;
  gap: 8px;
}
.products-category-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px;
}
.products-category-row small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
}
.products-mini-btn {
  min-height: 34px;
  min-width: 34px;
  padding: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.settings-form {
  display: grid;
  gap: 12px;
}
.settings-banner-guide {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
  background: color-mix(in srgb, var(--surface) 94%, #fff);
  display: grid;
  gap: 4px;
}
.settings-banner-guide small {
  color: var(--muted);
}
.settings-media-stack {
  display: grid;
  gap: 10px;
}
.mesa-extra-rows {
  display: grid;
  gap: 10px;
}
.mesa-extra-row {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px;
  background: color-mix(in srgb, var(--surface) 93%, #fff);
}
.mesa-extra-remove-btn {
  min-height: 40px;
}

.toast-wrap { position: fixed; top: 12px; right: 12px; display: grid; gap: 8px; z-index: 999; }
.toast { background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--primary); padding: 10px 12px; border-radius: 12px; box-shadow: var(--shadow); }
.ui-dialog-overlay {
  position: fixed;
  inset: 0;
  z-index: 2100;
  background: rgba(0, 0, 0, 0.48);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.ui-dialog-card {
  width: min(100%, 420px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 14px;
}
.ui-dialog-card h4 { margin: 0 0 8px; }
.ui-dialog-card p { margin: 0 0 10px; color: var(--muted); }
.ui-dialog-actions {
  margin-top: 12px;
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.modal {
  position: fixed; inset: 0; background: rgba(0, 0, 0, 0.45);
  display: none; align-items: flex-end; justify-content: center; z-index: 1300;
  overflow-y: auto;
  padding: 12px 12px 28px;
}
.modal.show { display: flex; }
.modal-content {
  width: 100%;
  max-width: 560px;
  max-height: calc(100dvh - 24px);
  overflow-y: auto;
  background: var(--surface);
  border-radius: 16px 16px 0 0;
  padding: 14px;
}

.skeleton { border-radius: 8px; background: linear-gradient(90deg, color-mix(in srgb, var(--surface) 92%, #ddd), color-mix(in srgb, var(--surface) 70%, #ddd), color-mix(in srgb, var(--surface) 92%, #ddd)); background-size: 200% 100%; animation: sk 1.5s linear infinite; }
@keyframes sk { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

.flash-new { animation: blink 0.8s linear 2; }
@keyframes blink { 0%,100% { outline: 0; } 50% { outline: 2px solid var(--primary); } }

.banner { border-radius: 16px; width: 100%; max-height: 180px; object-fit: cover; border: 1px solid var(--border); }
.menu-list { display: grid; gap: 10px; }
.menu-product { display: grid; grid-template-columns: 70px 1fr auto; gap: 10px; align-items: center; }
.menu-product img { width: 70px; height: 70px; border-radius: 10px; object-fit: cover; border: 1px solid var(--border); }

/* Home KPI */
.home-kpi {
  position: relative;
  overflow: hidden;
  margin-bottom: 0;
}
.home-kpi::after {
  content: "";
  position: absolute;
  right: -28px;
  top: -28px;
  width: 90px;
  height: 90px;
  border-radius: 999px;
  opacity: 0.18;
  background: var(--home-kpi-accent, #f59e0b);
  pointer-events: none;
  z-index: 0;
}
.home-kpi > * {
  position: relative;
  z-index: 1;
}
.home-kpi-queue { --home-kpi-accent: #f59e0b; }
.home-kpi-prep { --home-kpi-accent: #3b82f6; }
.home-kpi-delivery-waiting { --home-kpi-accent: #fb7185; }
.home-kpi-deliveries-today { --home-kpi-accent: #22c55e; }
.home-kpi-revenue { --home-kpi-accent: #06b6d4; }
.home-kpi-menus { --home-kpi-accent: #a855f7; }

/* Finance */
.finance-page {
  display: grid;
  gap: 12px;
}
.finance-kpi-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.finance-kpi {
  margin-bottom: 0;
  position: relative;
  overflow: hidden;
}
.finance-kpi::after {
  content: "";
  position: absolute;
  right: -28px;
  top: -28px;
  width: 90px;
  height: 90px;
  border-radius: 999px;
  opacity: 0.18;
}
.finance-kpi-day::after { background: #f59e0b; }
.finance-kpi-month::after { background: #22c55e; }
.finance-kpi-year::after { background: #0ea5e9; }
.finance-kpi-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 700;
}
.finance-kpi-value {
  display: block;
  margin-top: 8px;
  font-size: clamp(1.2rem, 2.4vw, 1.7rem);
  line-height: 1.1;
}
.finance-kpi small {
  display: block;
  margin-top: 6px;
  color: var(--muted);
}
.finance-filter-card {
  margin-bottom: 0;
}
.finance-panels-grid {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 10px;
}
.finance-actions-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.finance-panel {
  margin-bottom: 0;
}
.finance-list {
  display: grid;
  gap: 8px;
}
.finance-list-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px;
}
.finance-list-row small {
  color: var(--muted);
}
.finance-rank-pos {
  width: 26px;
  height: 26px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.82rem;
  font-weight: 800;
  background: color-mix(in srgb, var(--primary) 18%, var(--surface));
  color: var(--primary);
}
.finance-mini-bar {
  width: 88px;
  height: 8px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface) 85%, var(--border));
  overflow: hidden;
  flex: 0 0 auto;
}
.finance-mini-bar span {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--primary) 0%, #f59e0b 100%);
}
.finance-stats-grid {
  display: grid;
  gap: 8px;
}
.finance-channel-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  background: color-mix(in srgb, var(--surface) 93%, #09111f);
}
.finance-channel-card small {
  color: var(--muted);
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.3px;
}
.finance-channel-card strong {
  display: block;
  margin-top: 8px;
  font-size: 1.1rem;
}
.finance-history-list {
  display: grid;
  gap: 8px;
}
.finance-history-row {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px;
  background: color-mix(in srgb, var(--surface) 94%, #0b1220);
}
.finance-history-row p {
  margin: 6px 0;
  font-weight: 700;
}
.finance-history-row small {
  color: var(--muted);
}
.finance-promo-list {
  display: grid;
  gap: 10px;
}
.finance-promo-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px;
  background: color-mix(in srgb, var(--surface) 95%, #0b1220);
}
.finance-promo-card small {
  color: var(--muted);
}
.finance-promo-actions {
  margin-top: 8px;
  display: grid;
  gap: 6px;
}
.finance-promo-btn {
  width: 100%;
  text-align: left;
}

@media (min-width: 900px) {
  .container { padding-bottom: 130px; }
}

@media (min-width: 681px) {
  .bottom-nav { grid-template-columns: repeat(8, minmax(0, 1fr)); }
  .bottom-nav .desktop-extra { display: block; }
  .more-trigger { display: none; }
  .drawer-overlay { display: none; }
}

@media (max-width: 680px) {
  .modal { padding: 8px 8px 24px; }
  .modal-content { max-height: calc(100dvh - 16px); }
  .finance-kpi-grid { grid-template-columns: 1fr; }
  .finance-panels-grid { grid-template-columns: 1fr; }
  .finance-actions-grid { grid-template-columns: 1fr; }
  .finance-mini-bar { width: 72px; }
}

/* Delivery menu */
.dlv-page { padding-bottom: 10px; }
.dlv-banner-card {
  padding: 0;
  overflow: hidden;
  position: relative;
}
.dlv-banner-track {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 6;
  min-height: 140px;
}
.dlv-banner-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 420ms ease;
}
.dlv-banner-slide.active {
  opacity: 1;
}
.dlv-banner-dots {
  position: absolute;
  left: 50%;
  bottom: 10px;
  transform: translateX(-50%);
  display: inline-flex;
  gap: 6px;
  padding: 5px 8px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface) 82%, var(--bg));
}
.dlv-banner-dot {
  width: 8px;
  height: 8px;
  border: none;
  border-radius: 999px;
  background: color-mix(in srgb, var(--muted) 40%, var(--surface));
  padding: 0;
}
.dlv-banner-dot.active {
  background: var(--primary);
}
.dlv-banner-placeholder {
  min-height: 110px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 16px;
  color: var(--muted);
  background: color-mix(in srgb, var(--surface) 94%, var(--bg));
  border: 1px dashed var(--border);
  border-radius: 16px;
}
.dlv-hero {
  background: linear-gradient(180deg, color-mix(in srgb, var(--surface) 96%, #fff) 0%, color-mix(in srgb, var(--bg) 85%, var(--surface)) 100%);
  color: var(--text);
  border: 1px solid var(--border);
}
.dlv-hero h1 { margin: 0 0 6px; font-size: clamp(1.4rem, 4vw, 2.1rem); line-height: 1.1; }
.dlv-hero-top { display: flex; gap: 12px; justify-content: space-between; align-items: start; }
.dlv-meta { display: flex; flex-wrap: wrap; gap: 10px; color: var(--muted); }
.dlv-open { color: var(--success); }
.dlv-closed-text { color: var(--danger); }
.dlv-search-wrap {
  margin-top: 12px;
  display: grid;
  grid-template-columns: 20px 1fr auto;
  align-items: center;
  gap: 8px;
  background: color-mix(in srgb, var(--surface) 90%, #fff);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 8px 10px;
}
.dlv-search-wrap .input {
  background: transparent;
  border: none;
  color: var(--text);
}
.dlv-search-wrap .btn { min-height: 38px; padding: 8px 12px; }
.dlv-clear-search-btn {
  background: transparent;
  border: none;
  color: var(--muted);
  padding: 8px;
  min-width: 38px;
}
.dlv-clear-search-btn:hover {
  background: transparent;
  color: var(--text);
}
.dlv-closed {
  margin-top: 10px;
  border: 1px solid color-mix(in srgb, var(--danger) 60%, var(--border));
  color: var(--danger);
  background: color-mix(in srgb, var(--danger) 15%, var(--surface));
  border-radius: 12px;
  padding: 10px;
}
.dlv-cart-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid color-mix(in srgb, var(--primary) 35%, var(--border));
  border-radius: 999px;
  background: color-mix(in srgb, var(--primary) 14%, var(--surface));
  color: var(--text);
  min-height: 44px;
  padding: 8px 14px;
}
.dlv-cart-pill span {
  min-width: 24px;
  height: 24px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--primary);
  color: var(--on-primary);
  font-weight: 800;
}
.dlv-categories {
  display: flex;
  gap: 8px;
  flex-wrap: nowrap;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  margin: 12px 0;
}
.dlv-chip {
  flex: 0 0 auto;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 90%, var(--bg));
  color: var(--text);
  border-radius: 999px;
  padding: 8px 14px;
  font-weight: 700;
}
.dlv-chip.active {
  background: var(--btn-primary);
  color: var(--on-primary);
  border-color: var(--btn-primary);
}
@media (max-width: 680px) {
  .dlv-categories {
    -ms-overflow-style: none;
    scrollbar-width: none;
  }
  .dlv-categories::-webkit-scrollbar {
    display: none;
  }
}
.dlv-products {
  display: grid;
  grid-template-columns: repeat(1, minmax(0, 1fr));
  gap: 12px;
}
.dlv-product-card {
  background: color-mix(in srgb, var(--surface) 95%, #fff);
  border: 1px solid var(--border);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: var(--shadow);
}
.dlv-product-card img {
  width: 100%;
  height: 174px;
  object-fit: cover;
  display: block;
}
.dlv-product-body { padding: 12px; }
.dlv-product-body h3 { margin: 0 0 6px; font-size: 1.35rem; }
.dlv-product-body p { margin: 0; color: var(--muted); min-height: 42px; }
.dlv-product-foot { margin-top: 10px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.dlv-product-foot strong { font-size: 1.5rem; }

.dlv-modal {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: none;
}
.dlv-modal.show { display: block; }
.dlv-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(36, 28, 22, 0.42);
}
.dlv-modal-card {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(95vw, 700px);
  max-height: 92dvh;
  overflow: auto;
  background: linear-gradient(180deg, color-mix(in srgb, var(--surface) 95%, #fff) 0%, var(--surface) 100%);
  border: 1px solid var(--border);
  border-radius: 18px;
  color: var(--text);
  padding: 14px;
}
.dlv-modal-head { display: flex; justify-content: space-between; gap: 10px; align-items: start; }
.dlv-modal-head h3 { margin: 0; font-size: 2rem; line-height: 1; }
.dlv-modal-head p { margin: 6px 0 0; color: var(--muted); font-size: 1.6rem; font-weight: 700; }
.dlv-item-photo {
  width: 100%;
  max-height: 320px;
  object-fit: cover;
  border-radius: 14px;
  margin: 8px 0 10px;
}
.dlv-qty-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 10px;
}
.dlv-qty-row strong { font-size: 1.8rem; min-width: 40px; text-align: center; }
.dlv-qty-row .btn { min-width: 52px; }
.dlv-save-item { width: 100%; margin-top: 12px; background: var(--btn-primary); color: #fff; }

.dlv-cart-drawer {
  position: fixed;
  inset: 0;
  z-index: 1250;
  pointer-events: none;
}
.dlv-cart-drawer.show { pointer-events: auto; }
.dlv-cart-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(36, 28, 22, 0.4);
  opacity: 0;
  transition: opacity 180ms ease;
}
.dlv-cart-panel {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(100vw, 540px);
  background: linear-gradient(180deg, color-mix(in srgb, var(--surface) 95%, #fff) 0%, var(--surface) 100%);
  color: var(--text);
  border-left: 1px solid var(--border);
  transform: translateX(102%);
  transition: transform 230ms ease;
  display: flex;
  flex-direction: column;
}
.dlv-cart-drawer.show .dlv-cart-backdrop { opacity: 1; }
.dlv-cart-drawer.show .dlv-cart-panel { transform: translateX(0); }
.dlv-cart-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 14px;
  border-bottom: 1px solid var(--border);
}
.dlv-cart-head h3 { margin: 0; font-size: 2rem; }
.dlv-cart-body {
  overflow: auto;
  padding: 14px;
  display: grid;
  gap: 8px;
}
.dlv-cart-items { margin-top: 6px; display: grid; gap: 8px; }
.dlv-cart-item {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.dlv-cart-item p { margin: 4px 0 0; color: var(--muted); font-size: 0.92rem; }
.dlv-mini-qty { display: inline-flex; align-items: center; gap: 8px; }
.dlv-mini-qty button {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 92%, #fff);
  color: var(--text);
}
.dlv-totals {
  border-top: 1px solid var(--border);
  padding-top: 8px;
  display: grid;
  gap: 6px;
}
.dlv-totals div { display: flex; justify-content: space-between; font-size: 1.05rem; }
.dlv-total { font-size: 1.35rem !important; font-weight: 800; }
.dlv-submit {
  margin-top: 6px;
  background: var(--btn-primary);
  color: #fff;
}
.dlv-card-notice {
  margin: 2px 0 4px;
  color: var(--primary-700);
  font-weight: 800;
  font-size: 0.92rem;
}

@media (min-width: 760px) {
  .dlv-products { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (min-width: 1160px) {
  .dlv-products { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* Barcode scanner */
.bs-overlay {
  position: fixed;
  inset: 0;
  z-index: 2400;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px;
}
.bs-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(1, 7, 16, 0.75);
}
.bs-card {
  position: relative;
  width: min(100%, 720px);
  background: #06101d;
  color: #e5edf8;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 16px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.45);
  padding: 12px;
}
.bs-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}
.bs-video-wrap {
  position: relative;
  width: 100%;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: #020812;
  min-height: 260px;
}
.bs-video-wrap video,
.bs-video-wrap .bs-quagga,
.bs-video-wrap canvas {
  width: 100% !important;
  height: min(56vh, 420px) !important;
  object-fit: cover;
  display: block;
}
.bs-guide {
  pointer-events: none;
  position: absolute;
  inset: 16% 10%;
  border: 2px solid #f59e0b;
  border-radius: 14px;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.2) inset;
}
.bs-help {
  margin: 10px 0 0;
  color: #b9c8de;
}
.bs-actions {
  margin-top: 10px;
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}
