/* === Reset & Base === */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-hover: #f1f5f9;
  --border: #e2e8f0;
  --border-light: #f1f5f9;
  --text: #0f172a;
  --text-secondary: #64748b;
  --text-muted: #94a3b8;
  --danger: #ef4444;
  --danger-light: #fef2f2;
  --danger-dark: #dc2626;
  --warning: #e8a317;
  --warning-light: #fef9ec;
  --warning-dark: #92640a;
  --success: #10b981;
  --success-light: #ecfdf5;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(15,23,42,.04);
  --shadow: 0 1px 3px rgba(15,23,42,.06), 0 1px 2px rgba(15,23,42,.04);
  --shadow-lg: 0 4px 12px rgba(15,23,42,.08);
  --transition: 0.2s cubic-bezier(.4,0,.2,1);
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

#app { padding: 0 16px 80px; }

/* === Loading === */
#loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  gap: 16px;
  color: var(--text-muted);
  font-size: 15px;
}

.loading-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* === Error === */
#error {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  gap: 12px;
  color: var(--text-muted);
  font-size: 15px;
  text-align: center;
  padding: 20px;
}

/* === Header === */
header {
  padding: 20px 0 16px;
  margin-bottom: 4px;
  position: relative;
  overflow: visible;
}

.header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  position: relative;
}

.brand {
  display: flex;
  align-items: center;
}

.brand-logo {
  height: 58px;
  width: auto;
  cursor: pointer;
}

.order-badge {
  font-size: 13px;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 20px;
  background: #e8ecf1;
  color: #0f172a;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: background 0.15s;
}

.order-badge .copy-icon {
  display: none;
  width: 13px;
  height: 13px;
  flex-shrink: 0;
}

.order-badge:hover .copy-icon {
  display: inline;
}

.order-badge:hover {
  background: #dce1e8;
}

.order-badge-draft {
  background: var(--accent);
  color: white;
  font-family: 'SF Mono', 'Fira Code', monospace;
  letter-spacing: 1px;
}

#order-meta {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-light);
}

.meta-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: var(--text-secondary);
  padding: 4px 0;
}

.meta-row svg {
  flex-shrink: 0;
  stroke: var(--text-muted);
}

.meta-row strong {
  color: var(--text);
  font-weight: 600;
}

/* === Products section === */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 0 12px;
}

.section-header h2 {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.2px;
}

.product-count {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
}

/* === Product card === */
.product-item {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 12px;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-light);
  transition: box-shadow var(--transition);
  position: relative;
}

.product-item:active {
  box-shadow: var(--shadow);
}

.product-thumb {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
  object-fit: cover;
}

.product-thumb-placeholder {
  background: #e2e8f0;
}

.product-info {
  flex: 1;
  min-width: 0;
}

.product-name {
  font-weight: 600;
  font-size: 14px;
  line-height: 1.3;
  color: var(--text);
  margin-bottom: 2px;
  min-width: 0;
  display: flex;
  align-items: center;
}
.product-name-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
/* When JS detects overflow + dash, break into two lines */
.product-name-text.pn-wrap {
  white-space: normal;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.product-name-text.pn-wrap .pn-sep { display: none; }
.product-name-text.pn-wrap .pn-sub { display: block; }

/* Product attribute icons (Rebanado, Caja, etc.) */
.product-attr-icons {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  margin-left: 4px;
  gap: 3px;
}
.product-attr-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 4px;
  background: var(--surface, #f1f5f9);
  color: var(--text-muted, #64748b);
  position: relative;
  cursor: default;
}
.product-attr-icon svg {
  display: block;
}
/* Tooltip */
.product-attr-icon::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--text, #1e293b);
  color: #fff;
  font-size: 11px;
  font-weight: 500;
  padding: 3px 7px;
  border-radius: 4px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity .15s;
  z-index: 10;
}
.product-attr-icon:hover::after,
.product-attr-icon.touched::after {
  opacity: 1;
}

.product-ref {
  font-size: 12px;
  color: var(--text-muted);
}

.product-controls {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}

.qty-btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  transition: all var(--transition);
  -webkit-tap-highlight-color: transparent;
}

.qty-btn:active {
  background: var(--surface-hover);
  transform: scale(0.92);
}

.qty-value {
  display: inline-block;
  width: 36px;
  text-align: center;
  font-weight: 600;
  font-size: 15px;
  color: var(--text);
  border: none;
  background: transparent;
  user-select: none;
}

/* === Cross-selling === */
.cross-sell-item {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 12px;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 12px;
  border: 2px dashed var(--accent);
  position: relative;
  animation: productIn 0.2s ease-out;
}

.cross-sell-item .product-thumb-placeholder {
  background: var(--accent-light);
}

.cross-sell-name {
  color: var(--accent-dark);
}

.cross-sell-cta {
  font-size: 12px;
  color: var(--accent);
  line-height: 1.3;
}

.btn-cross-sell-add {
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: background var(--transition);
  -webkit-tap-highlight-color: transparent;
}

.btn-cross-sell-add:active { background: var(--accent-dark); }

/* === Add product button === */
#add-product-btn {
  width: 100%;
  padding: 14px;
  border-radius: var(--radius);
  border: 2px dashed var(--border);
  background: transparent;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  margin-top: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all var(--transition);
  -webkit-tap-highlight-color: transparent;
}

#add-product-btn:active {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-light);
}

/* === Footer === */
footer {
  padding-top: 20px;
  margin-top: 8px;
}

.cutoff-note {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 16px;
  margin-top: 16px;
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-sm);
}

.cutoff-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 6px;
  letter-spacing: -0.2px;
}

.cutoff-text {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* Cutoff states */
.cutoff-closing {
  background: #FFF3E0;
  border-color: #FF9800;
}

.cutoff-closing .cutoff-title {
  color: #E65100;
}

.cutoff-closing .cutoff-text {
  color: #BF360C;
}

.cutoff-closing-inner {
  display: flex;
  align-items: center;
  gap: 12px;
}

.cutoff-closing-text {
  flex: 1;
  min-width: 0;
}

.cutoff-ring {
  flex-shrink: 0;
}

.cutoff-closed {
  background: #E8F5E9;
  border-color: #4CAF50;
}

.cutoff-closed .cutoff-title {
  color: #1B5E20;
}

.cutoff-closed .cutoff-text {
  color: #2E7D32;
}

/* === Modal overlay === */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 100;
  animation: fadeIn 0.15s ease-out;
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

.modal {
  background: var(--surface);
  border-radius: 20px 20px 0 0;
  padding: 28px 24px;
  padding-bottom: calc(28px + env(safe-area-inset-bottom, 0px));
  width: 100%;
  max-width: 480px;
  text-align: center;
  animation: slideUp 0.2s ease-out;
}

.modal-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
}

.modal-icon-danger {
  background: var(--danger-light);
  color: var(--danger);
}

.modal-icon-danger svg { stroke: var(--danger); }

.modal h3 {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 6px;
  letter-spacing: -0.2px;
}

.modal p {
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: 24px;
  line-height: 1.5;
}

.modal-actions {
  display: flex;
  gap: 10px;
}

.modal-actions button {
  flex: 1;
  padding: 13px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all var(--transition);
  -webkit-tap-highlight-color: transparent;
}

.btn-modal-secondary {
  background: var(--surface-hover);
  border: 1px solid var(--border);
  color: var(--text);
}

.btn-modal-secondary:active {
  background: var(--border);
}

.btn-modal-danger {
  background: var(--danger);
  border: none;
  color: white;
}

.btn-modal-danger:active {
  background: var(--danger-dark);
}

/* === Search modal === */
.modal-search {
  text-align: left;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
}

.modal-search-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.modal-search-header h3 {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 0;
}

.btn-close {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: var(--surface-hover);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  transition: background var(--transition);
  -webkit-tap-highlight-color: transparent;
}

.btn-close:active { background: var(--border); }

.search-input-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin-bottom: 8px;
  transition: border-color var(--transition);
}

.search-input-wrap:focus-within {
  border-color: var(--accent);
}

.search-input-wrap input {
  flex: 1;
  border: none;
  background: none;
  font-size: 15px;
  font-family: inherit;
  color: var(--text);
  outline: none;
}

.search-input-wrap input::placeholder {
  color: var(--text-muted);
}

#search-results {
  flex: 1;
  overflow-y: auto;
  max-height: 50vh;
}

.popular-header {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 12px 4px 4px;
}

.search-result-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 4px;
  border-bottom: 1px solid var(--border-light);
}

.search-result-item:last-child { border-bottom: none; }

.search-result-thumb {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
  object-fit: cover;
}

.search-result-thumb-placeholder {
  background: #e2e8f0;
}

.search-result-name {
  font-size: 14px;
  color: var(--text);
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
}

.search-result-action {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  position: relative;
}

/* Habitual quantity tooltip */
.habitual-tooltip {
  position: absolute;
  right: 100%;
  top: 50%;
  transform: translateY(-50%);
  margin-right: 8px;
  background: var(--accent);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  padding: 8px 14px;
  border-radius: 10px;
  animation: tooltipNudge 0.4s ease-in-out 3, tooltipFadeOut 0.3s ease 1.5s forwards;
  pointer-events: none;
  z-index: 5;
}

/* Arrow pointing right */
.habitual-tooltip::after {
  content: '';
  position: absolute;
  right: -6px;
  top: 50%;
  transform: translateY(-50%);
  width: 0;
  height: 0;
  border-top: 7px solid transparent;
  border-bottom: 7px solid transparent;
  border-left: 7px solid var(--accent);
  filter: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='r'%3E%3CfeGaussianBlur stdDeviation='0.5'/%3E%3C/filter%3E%3C/svg%3E#r");
}

@keyframes tooltipNudge {
  0%   { transform: translateY(-50%) translateX(0); }
  50%  { transform: translateY(-50%) translateX(6px); }
  100% { transform: translateY(-50%) translateX(0); }
}

@keyframes tooltipFadeOut {
  0%   { opacity: 1; }
  100% { opacity: 0; }
}

.search-result-action .product-controls {
  gap: 1px;
}

.search-result-action .qty-btn {
  width: 30px;
  height: 30px;
}

.search-result-action .qty-value {
  width: 32px;
  font-size: 14px;
}

.btn-add-item {
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--transition);
  -webkit-tap-highlight-color: transparent;
}

.btn-add-item:active { background: var(--accent-dark); }


/* Quantity confirmation modal */
.modal-confirm {
  background: #ffffff;
  border-radius: 20px;
  padding: 32px 28px 28px;
  margin: 0 20px;
  max-width: 360px;
  width: 100%;
  text-align: center;
  box-shadow: 0 20px 60px rgba(15,23,42,.18), 0 4px 16px rgba(15,23,42,.08);
}

.modal-confirm-icon {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--accent-light);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 18px;
}

.modal-confirm-icon svg {
  stroke: var(--accent);
}

.modal-confirm p {
  font-size: 15px;
  font-weight: 400;
  line-height: 1.6;
  color: var(--text-secondary);
  margin-bottom: 24px;
}

.confirm-qty {
  display: block;
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 6px 0;
}

.modal-confirm p strong {
  color: var(--text-primary);
  font-weight: 600;
}

.modal-confirm-actions {
  display: flex;
  gap: 10px;
}

.btn-confirm {
  flex: 1;
  padding: 13px 16px;
  border: none;
  border-radius: var(--radius);
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  -webkit-tap-highlight-color: transparent;
}

.btn-confirm:active { transform: scale(0.97); }

.btn-confirm-no {
  background: var(--bg-secondary);
  color: var(--text-primary);
  border: 1px solid var(--border);
}

.btn-confirm-yes {
  background: var(--accent);
  color: #fff;
}

.btn-confirm-yes:active { background: var(--accent-dark); }

.btn-load-more {
  display: block;
  width: 100%;
  padding: 12px;
  border: none;
  background: transparent;
  color: var(--accent);
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: color var(--transition);
  -webkit-tap-highlight-color: transparent;
}

.btn-load-more:active { color: var(--accent-dark); }

.no-results {
  text-align: center;
  color: var(--text-muted);
  padding: 32px 20px;
  font-size: 14px;
}

/* === Floating action button === */
#fab-add-product {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  border-radius: 100px;
  border: none;
  background: var(--accent);
  color: white;
  padding: 14px 24px;
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  box-shadow: 0 4px 14px rgba(var(--accent-rgb, 249, 115, 22), 0.4);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  z-index: 50;
  transition: all var(--transition);
  -webkit-tap-highlight-color: transparent;
  white-space: nowrap;
}

#fab-add-product:active {
  background: var(--accent-dark);
  transform: translateX(-50%) scale(0.95);
}

@media (hover: hover) {
  #fab-add-product:hover {
    background: var(--accent-dark);
    box-shadow: 0 6px 20px rgba(var(--accent-rgb, 249, 115, 22), 0.5);
    transform: translateX(-50%) scale(1.03);
  }
}

/* === Save indicator === */
@keyframes savePopIn {
  from { opacity: 0; transform: translateX(-50%) translateY(-12px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

#save-indicator {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: #22c55e;
  color: white;
  padding: 11px 22px;
  border-radius: 100px;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  box-shadow: 0 4px 20px rgba(34, 197, 94, 0.35), 0 2px 8px rgba(0,0,0,0.12);
  transition: opacity 0.3s;
  z-index: 200;
  display: flex;
  align-items: center;
  gap: 6px;
  animation: savePopIn 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* === Cancelled state === */
.cancelled {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
  font-size: 16px;
  line-height: 1.6;
}

.cancelled svg {
  display: block;
  margin: 0 auto 16px;
  stroke: var(--text-muted);
}

/* === Animations === */
@keyframes productIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.product-item { animation: productIn 0.2s ease-out; }

/* === Desktop hover enhancements === */
@media (hover: hover) {
  #add-product-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-light);
  }

  .qty-btn:hover {
    background: var(--surface-hover);
    border-color: var(--text-muted);
  }

  .btn-add-item:hover { background: var(--accent-dark); }
  .btn-cross-sell-add:hover { background: var(--accent-dark); }
  .btn-load-more:hover { color: var(--accent-dark); }

  .product-item:hover { box-shadow: var(--shadow); }
}

/* === Devoluciones section === */
#devoluciones-section {
  padding-bottom: 12px;
  margin-bottom: 4px;
}

.section-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.dev-badge {
  font-size: 13px;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 20px;
  background: #fee2e2;
  color: #b91c1c;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: background 0.15s;
}

.dev-badge .copy-icon {
  display: none;
  width: 13px;
  height: 13px;
  flex-shrink: 0;
  stroke: #b91c1c;
}

.dev-badge:hover .copy-icon {
  display: inline;
}

.dev-badge:hover {
  background: #fecaca;
}

.order-badge-inline {
  font-size: 13px;
}

.dev-empty-msg {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 24px 16px;
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
  border: 1px solid var(--border-light);
}

.dev-product-item {
  opacity: 0.45;
  transition: opacity var(--transition);
}

.dev-product-item.dev-active {
  opacity: 1;
}

.dev-qty-value {
  color: #b91c1c !important;
  font-weight: 700 !important;
}

/* === Delivery change modal === */
.meta-row-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.meta-rows {
  flex: 1;
  min-width: 0;
}

.btn-change-delivery {
  flex-shrink: 0;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  padding: 6px 14px;
  border-radius: 100px;
  cursor: pointer;
  transition: all 0.15s;
  -webkit-tap-highlight-color: transparent;
  white-space: nowrap;
}

.btn-change-delivery:active {
  background: var(--bg-secondary);
  transform: scale(0.96);
}

.modal-delivery {
  text-align: left;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
}

.modal-delivery-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.modal-delivery-header h3 {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 0;
}

.delivery-loading {
  display: flex;
  justify-content: center;
  padding: 40px 0;
}

.loading-spinner-sm {
  width: 28px;
  height: 28px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.delivery-address-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

.delivery-address-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border: 2px solid var(--border-light);
  border-radius: var(--radius);
  background: var(--surface);
  cursor: pointer;
  transition: all 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.delivery-address-option:active {
  transform: scale(0.98);
}

.delivery-address-option.selected {
  border-color: var(--accent);
  background: var(--accent-light);
}

.delivery-address-radio {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid var(--border);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.delivery-address-option.selected .delivery-address-radio {
  border-color: var(--accent);
}

.delivery-address-radio-inner {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  transform: scale(0);
  transition: transform 0.15s;
}

.delivery-address-option.selected .delivery-address-radio-inner {
  transform: scale(1);
}

.delivery-address-info {
  flex: 1;
  min-width: 0;
}

.delivery-address-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.delivery-address-icon {
  flex-shrink: 0;
  stroke: var(--text-muted);
}

.delivery-date-list h4 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 10px;
}

.delivery-date-list {
  margin-bottom: 16px;
}

#delivery-dates {
  display: flex;
  gap: 8px;
}

.delivery-date-option {
  flex: 1;
  padding: 12px 8px;
  border: 2px solid var(--border-light);
  border-radius: var(--radius);
  background: var(--surface);
  cursor: pointer;
  text-align: center;
  transition: all 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.delivery-date-option:active {
  transform: scale(0.96);
}

.delivery-date-option.selected {
  border-color: var(--accent);
  background: var(--accent-light);
}

.delivery-date-day {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  text-transform: capitalize;
}

.delivery-date-num {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.btn-delivery-confirm {
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: var(--radius);
  background: var(--accent);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.btn-delivery-confirm:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-delivery-confirm:not(:disabled):active {
  background: var(--accent-dark);
  transform: scale(0.98);
}

@media (hover: hover) {
  .btn-change-delivery:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-light);
  }
  .delivery-address-option:hover {
    border-color: var(--text-muted);
  }
  .delivery-date-option:hover {
    border-color: var(--text-muted);
  }
  .btn-delivery-confirm:not(:disabled):hover {
    background: var(--accent-dark);
  }
}

/* === Empty order welcome modal === */
.modal-welcome {
  text-align: center;
  padding: 32px 24px;
  padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px));
}

.modal-welcome-icon {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: var(--accent-light);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 18px;
}

.modal-welcome-icon svg {
  stroke: var(--accent);
}

.modal-welcome-icon-success {
  background: var(--success-light);
}

.modal-welcome-icon-success svg {
  stroke: var(--success);
}

.modal-welcome-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 6px;
  letter-spacing: -0.3px;
  line-height: 1.35;
}

.modal-welcome-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.45;
  margin-bottom: 24px;
}

.modal-welcome-subtitle:empty {
  display: none;
}

.modal-welcome-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.btn-welcome-primary {
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: var(--radius);
  background: var(--accent);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all var(--transition);
  -webkit-tap-highlight-color: transparent;
}

.btn-welcome-primary:active { background: var(--accent-dark); transform: scale(0.98); }

.btn-welcome-secondary {
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: var(--radius);
  background: var(--surface-hover);
  color: var(--text-secondary);
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all var(--transition);
  -webkit-tap-highlight-color: transparent;
}

.btn-welcome-secondary:active { background: var(--border); transform: scale(0.98); }

.btn-welcome-tertiary {
  width: 100%;
  padding: 10px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: color var(--transition);
  -webkit-tap-highlight-color: transparent;
}

.btn-welcome-tertiary:active { color: var(--text-secondary); }

@media (hover: hover) {
  .btn-welcome-primary:hover { background: var(--accent-dark); }
  .btn-welcome-secondary:hover { background: var(--border); }
  .btn-welcome-tertiary:hover { color: var(--text-secondary); }
}

/* === Comercial gate (login overlay) === */
#comercial-gate {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.comercial-gate-inner {
  text-align: center;
  width: 100%;
  max-width: 320px;
  padding: 0 20px;
}

.gate-logo {
  height: 32px;
  margin-bottom: 24px;
}

.comercial-gate-inner h2 {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 24px;
}

#comercial-gate-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

#comercial-gate-form input {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 15px;
  font-family: inherit;
  background: var(--surface);
  color: var(--text);
  outline: none;
  transition: border-color 0.15s;
}

#comercial-gate-form input:focus {
  border-color: var(--accent);
}

#comercial-gate-form button[type="submit"] {
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: var(--radius);
  background: var(--accent);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s;
  margin-top: 4px;
}

#comercial-gate-form button[type="submit"]:active {
  background: var(--accent-dark);
}

.gate-error {
  color: var(--danger);
  font-size: 13px;
  margin-top: 4px;
}

/* === Comercial top bar === */
#comercial-bar {
  background: var(--accent);
  color: #fff;
  text-align: center;
  padding: 12px 16px;
  font-size: 17px;
  font-weight: 700;
  font-family: 'Inter', sans-serif;
  letter-spacing: 0.1px;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  max-width: 480px;
  margin: 0 auto;
  z-index: 300;
}

body.comercial-mode #app {
  padding-top: 46px;
}

/* Push save indicator below the comercial bar when it's visible */
body.comercial-mode #save-indicator {
  top: 52px;
}

/* === Edited-by badge === */
.edited-by-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 100px;
  background: var(--accent-light);
  color: var(--accent);
  margin-left: 8px;
  vertical-align: middle;
}

/* Version label */
.app-version {
  position: fixed;
  bottom: 6px;
  right: 10px;
  font-size: 11px;
  color: #b0b8c4;
  pointer-events: none;
  z-index: 9999;
  font-family: 'Inter', sans-serif;
  letter-spacing: 0.3px;
}
