/* ============================================================
   DESIGN SYSTEM — Restaurante Control Center
   Light · Professional · Minimal — Blue Palette
   ============================================================ */

:root {
  /* ── Brand ── */
  --primary:        #2563EB;
  --primary-hover:  #1D4ED8;
  --primary-light:  #E0F2FE;
  --primary-subtle: #EFF6FF;

  /* ── Surfaces ── */
  --bg:        #F1F5F9;
  --surface:   #FFFFFF;
  --surface-2: #F8FAFC;

  /* ── Text ── */
  --text:           #1E293B;
  --text-secondary: #475569;
  --muted:          #94A3B8;

  /* ── Borders ── */
  --border:       #CBD5E1;
  --border-light: #E2E8F0;

  /* ── Status ── */
  --success:    #059669;
  --success-bg: #ECFDF5;
  --warning:    #D97706;
  --warning-bg: #FFFBEB;
  --danger:     #DC2626;
  --danger-bg:  #FEF2F2;

  /* ── Shadows ── */
  --shadow-sm: 0 1px 3px rgba(15,23,42,0.08), 0 1px 2px rgba(15,23,42,0.04);
  --shadow:    0 4px 6px rgba(15,23,42,0.07), 0 2px 4px rgba(15,23,42,0.04);
  --shadow-md: 0 10px 15px rgba(15,23,42,0.08), 0 4px 6px rgba(15,23,42,0.04);
  --shadow-lg: 0 20px 25px rgba(15,23,42,0.10), 0 8px 10px rgba(15,23,42,0.04);

  /* ── Radius ── */
  --radius-sm: 8px;
  --radius:    12px;
  --radius-lg: 16px;
  --radius-xl: 20px;

  /* ── Transitions ── */
  --transition: 0.1s ease;
}

/* ============================================================
   RESET & BASE
   ============================================================ */

* {
  box-sizing: border-box;
}

html {
  overscroll-behavior-x: contain;
  overflow-x: hidden;
  width: 100%;
}
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

body {
  margin: 0;
  font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
}

/* Background pattern — hidden in new design */
.bg-pattern {
  display: none;
}

h1, h2, h3, h4 {
  letter-spacing: -0.02em;
}

/* ============================================================
   TOPBAR
   ============================================================ */

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 clamp(16px, 4vw, 40px);
  height: 64px;
  border-bottom: 1px solid var(--border-light);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.topbar h1 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
}

.topbar p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 0.78rem;
}

.user-box {
  display: flex;
  align-items: center;
  gap: 10px;
}

#userInfo {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--bg);
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
}

/* ============================================================
   LAYOUT & CONTAINER
   ============================================================ */

.container {
  padding: clamp(16px, 3vw, 28px);
  width: 100%;
  box-sizing: border-box;
}

.layout {
  display: grid;
  gap: 16px;
}

/* ============================================================
   PANELS / CARDS
   ============================================================ */

.panel {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: clamp(16px, 2.5vw, 24px);
}

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

.panel-head h2,
.panel-head h3 {
  margin: 0;
}

.panel-inner {
  background: var(--surface-2);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 16px;
}

/* Login panel */
.login-panel {
  max-width: 440px;
  margin: 48px auto 0;
}

.login-panel h2 {
  margin: 0 0 6px;
  font-size: 1.4rem;
  font-weight: 700;
}

.login-panel small {
  color: var(--text-secondary);
  font-size: 0.82rem;
}

.login-panel p {
  margin: 12px 0 0;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.login-panel a {
  color: var(--primary);
  font-weight: 500;
  text-decoration: none;
}

.login-panel a:hover {
  text-decoration: underline;
}

/* ============================================================
   TABS NAVIGATION
   ============================================================ */

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 16px;
  background: var(--surface);
  padding: 5px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-sm);
}

.tab {
  background: transparent;
  border: none;
  border-radius: var(--radius);
  padding: 8px 16px;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
}

.tab:hover {
  background: var(--bg);
  color: var(--text);
}

.tab.active {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.28);
}

.tab-section.hidden {
  display: none;
}

/* ============================================================
   BUTTONS
   ============================================================ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition), transform 0.08s ease;
  white-space: nowrap;
  text-decoration: none;
  line-height: 1.4;
}

.btn:hover {
  background: var(--bg);
  border-color: var(--border);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
  box-shadow: none;
}

.btn.primary {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.22);
}

.btn.primary:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.32);
}

.btn.danger {
  background: #dc2626;
  color: #fff;
  border-color: #dc2626;
  box-shadow: 0 2px 6px rgba(220, 38, 38, 0.22);
}

.btn.danger:hover {
  background: #b91c1c;
  border-color: #b91c1c;
  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.32);
}

.btn.ghost {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
}

.btn.ghost:hover {
  background: var(--bg);
  border-color: var(--border);
}

/* ============================================================
   FORMS / INPUTS
   ============================================================ */

.grid {
  display: grid;
  gap: 12px;
}

.two-col {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

label {
  display: grid;
  gap: 5px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text);
}

input,
select {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  font: inherit;
  font-size: 0.875rem;
  color: var(--text);
  background: var(--surface);
  transition: border-color var(--transition), box-shadow var(--transition);
  width: 100%;
}

input::placeholder {
  color: var(--muted);
}

input:focus,
select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

select {
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394A3B8' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

/* ============================================================
   PRODUCT GRID
   ============================================================ */

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.product-card {
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 14px;
  background: var(--surface);
  transition: box-shadow var(--transition), border-color var(--transition);
}

.product-card:hover {
  box-shadow: var(--shadow);
  border-color: var(--border);
}

.product-card strong {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}

.product-card small {
  color: var(--text-secondary);
  font-size: 0.8rem;
}

.product-card.quick {
  display: grid;
  gap: 10px;
}

.qty-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.qty-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}

.qty-pill {
  min-width: 32px;
  text-align: center;
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--primary);
}

/* ============================================================
   QUICK FILTERS
   ============================================================ */

.quick-filters {
  display: grid;
  gap: 10px;
  margin-bottom: 12px;
}

.quick-table-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.quick-table-btn {
  min-width: 44px;
  height: 36px;
  padding: 0 8px;
  font-size: 0.82rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
}

.quick-table-btn.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.25);
}

.quick-summary {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.quick-summary strong {
  color: var(--primary);
  font-weight: 700;
}

/* ============================================================
   ORDER CARDS LIST
   ============================================================ */

.cards {
  display: grid;
  gap: 18px;
}

.card {
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 16px;
  background: var(--surface);
  transition: box-shadow var(--transition);
}

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

.card .panel-head {
  margin-bottom: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-light);
}

.item-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-light);
}

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

.item-row-info {
  min-width: 0;
  word-break: break-word;
}

.item-precio-label {
  color: var(--text-muted, #6b7280);
  font-size: .8rem;
}

.item-row-right {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}

.btn-price-edit {
  background: #f0fdf4;
  border: 1px solid #16a34a;
  color: #15803d;
  font-size: .85rem;
  padding: 2px 8px;
  border-radius: 6px;
  cursor: pointer;
  transition: background .15s;
}

.btn-price-edit:hover {
  background: #dcfce7;
}

.btn-nota-edit {
  background: #eff6ff;
  border: 1px solid #3b82f6;
  color: #1d4ed8;
  font-size: .85rem;
  padding: 2px 6px;
  border-radius: 4px;
  cursor: pointer;
  transition: background .15s;
}
.btn-nota-edit:hover {
  background: #dbeafe;
}

.actions-inline {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

/* ============================================================
   TABLES
   ============================================================ */

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  font-size: 0.85rem;
}

th,
td {
  border: 1px solid var(--border-light);
  padding: 10px 12px;
  text-align: left;
}

th {
  background: var(--bg);
  font-weight: 600;
  color: var(--text-secondary);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

tr:hover td {
  background: var(--primary-subtle);
}

/* ============================================================
   DASHBOARD
   ============================================================ */

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
}

.metric {
  border: 1px solid var(--border-light);
  border-left: 4px solid var(--primary);
  border-radius: var(--radius);
  padding: 20px;
  background: var(--surface);
  transition: box-shadow var(--transition);
}

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

.metric h3 {
  margin: 0 0 10px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
}

.metric strong {
  font-size: 2rem;
  font-weight: 800;
  color: var(--primary);
  display: block;
  margin-bottom: 6px;
  letter-spacing: -0.03em;
}

.metric pre {
  font-size: 0.75rem;
  color: var(--text-secondary);
  overflow: auto;
  margin: 0;
  background: var(--bg);
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-light);
  line-height: 1.6;
}

/* ============================================================
   STATUS BOX (WhatsApp)
   ============================================================ */

.status-box {
  background: var(--primary-subtle);
  border: 1px solid #BFDBFE;
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 16px;
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.9;
}

/* WhatsApp QR — estado conectado */
.wa-connected-check {
  font-size: 5rem;
  line-height: 1;
  color: #16a34a;
  animation: wa-check-in .45s cubic-bezier(.175,.885,.32,1.275) both;
}
.wa-connected-label {
  font-weight: 700;
  font-size: 1.1rem;
  color: #16a34a;
  margin: 8px 0 0;
  animation: wa-check-in .45s .1s cubic-bezier(.175,.885,.32,1.275) both;
}
@keyframes wa-check-in {
  from { transform: scale(.4); opacity: 0; }
  to   { transform: scale(1);  opacity: 1; }
}

/* ============================================================
   TOAST
   ============================================================ */

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  background: var(--primary);
  color: #fff;
  padding: 12px 18px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  font-size: 0.875rem;
  font-weight: 500;
  z-index: 9999;
  animation: toastSlideIn 0.15s ease;
  will-change: transform;
}

@keyframes toastSlideIn {
  from { transform: translateY(16px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

.hidden {
  display: none !important;
}

/* ============================================================
   KITCHEN SECTION
   ============================================================ */

.kitchen-item {
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin-bottom: 8px;
  background: var(--surface);
  transition: background var(--transition), border-color var(--transition);
}

.kitchen-item:last-child {
  margin-bottom: 0;
}

.kitchen-item strong {
  font-size: 1.15rem;
}

.kitchen-order-card {
  border-left: 4px solid var(--primary) !important;
}

.order-summary-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 4px 0;
}

.order-card-clickable {
  cursor: pointer;
}
.order-card-clickable:hover {
  border-color: #93c5fd !important;
  box-shadow: 0 0 0 2px #bfdbfe !important;
}

.order-locked {
  background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%) !important;
  border: 1px solid #d8e1eb !important;
  border-left: 4px solid #cbd5e1 !important;
  box-shadow: none;
  opacity: 0.9;
}

.order-locked .order-total-big {
  color: #64748B;
}

.order-locked:hover {
  box-shadow: var(--shadow-sm);
}

.order-locked .panel-head {
  border-bottom-color: #dbe4ee;
}

.order-locked .item-row {
  border-bottom-color: #e2e8f0;
}

.order-locked .item-row-info,
.order-locked .order-date,
.order-locked .state-locked-msg,
.order-locked .state-waiting-msg,
.order-locked .item-precio-label {
  color: #64748b;
}

.order-locked .order-state-badge {
  background: #e5e7eb;
  color: #475569;
  border: 1px solid #cbd5e1;
}

.order-total-big {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary);
}

.kitchen-area-card {
  border-left: 4px solid var(--border) !important;
}

.kitchen-area-card.my-area {
  border-left: 4px solid var(--primary) !important;
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary) 20%, transparent) !important;
}

.kitchen-area-head {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-light);
}

.kitchen-area-badge {
  font-size: 0.78rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 2px 10px;
  color: var(--text-muted);
  font-weight: 500;
}

.kitchen-done-label {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* Drag handle en cabecera de área */
.kitchen-drag-handle {
  font-size: 1.25rem;
  color: var(--text-muted);
  cursor: grab;
  padding: 0 4px;
  user-select: none;
  flex-shrink: 0;
}
.kitchen-drag-handle:active {
  cursor: grabbing;
}

/* Tarjeta siendo arrastrada */
.kitchen-area-card.kitchen-dragging {
  opacity: 0.45;
  border: 2px dashed var(--primary) !important;
}

/* Botón de colapsar/expandir */
.kitchen-collapse-btn {
  margin-left: auto;
  flex-shrink: 0;
  font-size: 0.78rem;
  padding: 2px 10px;
}

/* Cuerpo colapsable del área */
.kitchen-area-body {
  transition: none;
}
.kitchen-area-body.hidden {
  display: none;
}

/* Tiempo transcurrido por ítem de cocina */
.kitchen-elapsed {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 12px;
  margin-top: 4px;
  letter-spacing: 0.01em;
}
.kitchen-elapsed.elapsed-ok     { background: #D1FAE5; color: #065F46; }
.kitchen-elapsed.elapsed-warn   { background: #FEF3C7; color: #92400E; }
.kitchen-elapsed.elapsed-urgent { background: #FEE2E2; color: #991B1B; animation: elapsed-blink 1.2s ease-in-out infinite; }
@keyframes elapsed-blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.6; }
}

/* Quién está preparando el item */
.kitchen-item-preparador {
  margin-top: 5px;
  padding: 3px 8px;
  background: #EFF6FF;
  color: #1D4ED8;
  font-size: 0.9rem;
  border-radius: 4px;
  border-left: 3px solid #3B82F6;
}

.full-screen {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  z-index: 9999 !important;
  background: var(--surface) !important;
  border: none !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  margin: 0 !important;
  padding: 20px !important;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
}

.full-screen .panel-head {
  position: sticky;
  top: 0;
  background: var(--surface);
  z-index: 10;
  padding-bottom: 12px;
  margin-bottom: 12px;
  border-bottom: 2px solid var(--primary);
}

.kitchen-item.pending {
  animation: kitchenPendingPulse 1.8s ease-in-out infinite;
  background: #86EFAC !important;        /* verde vibrante — nuevo pedido */
  border-left: 5px solid #15803D !important;
  color: #064E3B !important;
  box-shadow: 0 1px 3px rgba(21, 128, 61, 0.18);
  opacity: 1 !important;
}
.kitchen-item.pending strong,
.kitchen-item.pending .muted,
.kitchen-item.pending span {
  color: #064E3B !important;
}
@keyframes kitchenPendingPulse {
  0%, 100% { background: #86EFAC !important; box-shadow: 0 1px 3px rgba(21,128,61,0.18); }
  50%       { background: #6EE7A5 !important; box-shadow: 0 2px 8px rgba(21,128,61,0.28); }
}

.kitchen-item.pending.urgent {
  animation: urgentBlink 0.8s infinite;
  background: #FEE2E2 !important;        /* rojo claro — urgente +5min */
  border-left: 4px solid #DC2626 !important;
  box-shadow: 0 0 8px rgba(220, 38, 38, 0.4);
}

@keyframes urgentBlink {
  0%, 100% { background: #FEE2E2 !important; }
  50% { background: #FECACA !important; border-color: #B91C1C !important; box-shadow: 0 0 14px rgba(220, 38, 38, 0.6); }
}

.kitchen-item.in-progress {
  background: #F1F5F9 !important;        /* gris azulado — en preparación */
  border-left: 4px solid #94A3B8 !important;
  opacity: 0.85;
}

.kitchen-item-note {
  margin-top: 4px;
  padding: 3px 8px;
  background: #FEF3C7;
  color: #92400E;
  font-size: 1rem;
  font-style: italic;
  border-radius: 4px;
  border-left: 3px solid #F59E0B;
}

.kitchen-item-spec,
.order-schedule-spec {
  margin-top: 4px;
  padding: 4px 8px;
  background: #DBEAFE;
  color: #1D4ED8;
  font-size: 0.82rem;
  font-weight: 700;
  border-radius: 4px;
  border-left: 3px solid #2563EB;
}

.item-note {
  margin-top: 2px;
  padding: 2px 6px;
  background: #FEF3C7;
  color: #92400E;
  font-size: 0.78rem;
  font-style: italic;
  border-radius: 3px;
  border-left: 3px solid #F59E0B;
  display: inline-block;
}

.item-preparador-label {
  display: inline-block;
  margin-top: 1px;
  font-size: 0.72rem;
  color: #2563EB;
  opacity: 0.85;
}

@keyframes pulse {
  0%, 100% { opacity: 1;    transform: scale(1);    }
  50%       { opacity: 0.85; transform: scale(1.01); }
}

/* ============================================================
   NOTIFICATION BANNER
   ============================================================ */

.notification {
  position: fixed;
  top: 20px;
  right: 20px;
  background: var(--success-bg);
  border: 1px solid #A7F3D0;
  color: #065F46;
  padding: 12px 18px;
  border-radius: var(--radius);
  z-index: 10000;
  animation: slideIn 0.3s ease-out;
  font-weight: 500;
  font-size: 0.875rem;
  box-shadow: var(--shadow-md);
}

.notification-delivery {
  background: #eff6ff;
  border-color: #93c5fd;
  color: #1e3a8a;
  font-weight: 700;
  letter-spacing: .01em;
}

.notification-whatsapp {
  background: #dcfce7;
  border-color: #4ade80;
  color: #14532d;
  font-weight: 600;
}

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}

/* ============================================================
   MESERO ORDER PANEL
   ============================================================ */

/* Mesa selection bar */
.mesero-mesa-bar {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px 0 16px;
  border-bottom: 1px solid var(--border-light);
  margin-bottom: 16px;
}

.mesa-bar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.mesero-mesa-label {
  font-weight: 600;
  font-size: 0.78rem;
  white-space: nowrap;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.mesa-count-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}

.mesa-count-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  min-width: 58px;
  text-align: center;
}

.btn-mesa-count {
  width: 28px;
  height: 28px;
  padding: 0;
  font-size: 1.1rem;
  font-weight: 700;
  line-height: 1;
  border-radius: 6px;
  background: var(--surface-alt, #f0f0f0);
  border: 1px solid var(--border-light);
  color: var(--text-primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}

.btn-mesa-count:hover {
  background: var(--primary-light, #d0eaff);
}

/* Two-column layout: fluid left / 300px right */
.mesero-layout {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 16px;
  align-items: start;
  min-height: 480px;
}

/* LEFT panel */
.mesero-left {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 0;
  overflow: hidden;
}

.mesero-left .panel-head {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-light);
  background: var(--bg);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  margin-bottom: 0;
}

.mesero-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 26px;
  height: 26px;
  padding: 0 8px;
  background: var(--primary);
  color: #fff;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
}

.mesero-items-list {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  max-height: 520px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Empty state */
.mesero-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 20px;
  color: var(--muted);
  text-align: center;
  gap: 6px;
}

.mesero-empty-icon {
  font-size: 2.8rem;
  margin-bottom: 8px;
  opacity: 0.6;
}

.mesero-empty-state p {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.mesero-empty-state small {
  font-size: 0.82rem;
  color: var(--muted);
}

/* Selected item card — Mobile-first 3-zone layout */
.order-item-card {
  background: var(--surface);
  border: 1.5px solid var(--border-light);
  border-radius: var(--radius);
  padding: 10px 12px;
  transition: box-shadow var(--transition), border-color var(--transition);
  box-shadow: 0 1px 4px rgba(15,23,42,0.05);
  flex-shrink: 0;
}

.order-item-card:hover {
  box-shadow: var(--shadow);
  border-color: var(--border);
}

/* Single row: info | qty | price+actions */
.order-item-main {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 10px;
}

/* ZONE 1 — Product info */
.order-item-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.order-item-name {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
  word-break: break-word;
}

.order-item-category {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 500;
  word-break: break-word;
}

.order-item-note {
  color: var(--primary);
  font-size: 0.72rem;
  font-style: italic;
  word-break: break-word;
}

/* ZONE 2 — Qty controls */
.order-item-controls {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.order-qty-controls {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--bg);
  border: 1px solid var(--border-light);
  border-radius: 10px;
  padding: 3px 4px;
}

/* Qty controls — touch-friendly (min 44px) */
.order-qty-btn {
  width: 32px !important;
  height: 32px !important;
  padding: 0 !important;
  font-size: 1.1rem !important;
  font-weight: 700 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  border-radius: 8px !important;
  flex-shrink: 0;
  transition: background var(--transition), transform 0.1s;
  -webkit-tap-highlight-color: transparent;
}

.order-qty-btn:active {
  transform: scale(0.88) !important;
}

.order-qty-display {
  min-width: 28px;
  text-align: center;
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--primary);
}

/* ZONE 3 — Price + actions */
.order-item-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  flex-shrink: 0;
}

.order-item-price {
  font-weight: 800;
  font-size: 0.95rem;
  color: var(--primary);
  letter-spacing: -0.02em;
  line-height: 1;
}

.order-item-actions {
  display: flex;
  gap: 4px;
}

.order-note-btn,
.order-delete-btn,
.order-dup-btn {
  width: 32px !important;
  height: 32px !important;
  padding: 0 !important;
  font-size: 0.82rem !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  border-radius: 8px !important;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
  transition: background var(--transition), transform 0.1s;
}

.order-note-btn:active,
.order-delete-btn:active,
.order-dup-btn:active {
  transform: scale(0.88) !important;
}

.order-dup-btn {
  background: #eff6ff !important;
  border-color: #bfdbfe !important;
  color: #2563eb !important;
}

.order-dup-btn:hover {
  background: #dbeafe !important;
}

/* Slot items (duplicated product with different note) */
.order-item-slot {
  border-left: 3px solid #2563eb !important;
  background: #f8faff !important;
}

.order-item-note--empty {
  color: #9ca3af !important;
  font-style: italic;
}

.order-delete-btn {
  background: var(--danger-bg) !important;
  border-color: #FECACA !important;
  color: var(--danger) !important;
}

.order-delete-btn:hover {
  background: #FEE2E2 !important;
}

/* RIGHT panel */
.mesero-right {
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: sticky;
  top: 80px;
}

/* Summary card */
.mesero-summary-card {
  padding: 18px !important;
}

.mesero-summary-title {
  margin: 0 0 14px;
  font-size: 0.72rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  font-weight: 600;
}

.summary-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.summary-divider {
  height: 1px;
  background: var(--border-light);
  margin: 6px 0;
}

.summary-total-line {
  padding-top: 10px;
}

.summary-total-line span {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
}

.summary-total-line strong {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--primary);
  letter-spacing: -0.03em;
}

/* Secondary action buttons */
.mesero-secondary-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.mesero-sec-btn {
  width: 100%;
  padding: 11px 16px !important;
  font-size: 0.875rem !important;
  text-align: left;
  border-radius: var(--radius-sm) !important;
  justify-content: flex-start !important;
}
/* ── Send row: Enviar Pedido + Venta Rápida lado a lado ──────── */
.send-btn-row {
  display: flex;
  gap: 8px;
}
.send-btn-row .send-order-btn {
  flex: 2;
  width: auto;
}
.vr-send-btn {
  flex: 1;
  min-height: 72px;
  padding: 16px 12px;
  font-size: 1rem;
  font-weight: 700;
  background: #7c3aed;
  color: #fff;
  border: none;
  border-radius: 14px;
  cursor: pointer;
  transition: background 0.1s, transform 0.08s;
  box-shadow: 0 6px 20px rgba(124,58,237,0.28);
}
.vr-send-btn:hover {
  background: #6d28d9;
  transform: translateY(-1px);
}
.vr-send-btn:active {
  transform: translateY(0);
}

/* ── Modal Venta Rápida ─────────────────────────────────────── */
.vr-modal-card {
  max-width: 420px;
  width: 96%;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 14px !important;
}
.vr-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}
.vr-title { margin: 0; font-size: 1rem; font-weight: 700; }
.vr-header-actions { display: flex; gap: 4px; align-items: center; }
.vr-cfg-btn { font-size: 1rem; padding: 4px 8px !important; }

/* ── Product grid (solo los seleccionados) ── */
.vr-product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
  gap: 7px;
  padding: 2px;
  margin-bottom: 10px;
}
.vr-no-products {
  grid-column: 1 / -1;
  text-align: center;
  color: #94a3b8;
  font-size: .82rem;
  padding: 18px 0;
}
.vr-product-tile {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 8px 5px 6px;
  border: 2px solid #e2e8f0;
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
  text-align: center;
  gap: 3px;
  transition: border-color .08s, background .08s, transform .05s;
  font-size: .8rem;
  min-height: 64px;
  line-height: 1.2;
}
.vr-product-tile:active { transform: scale(.95); }
.vr-product-tile:hover  { border-color: #7c3aed; background: #f5f3ff; }
.vr-product-tile.has-qty { border-color: #7c3aed; background: #ede9fe; }
.vr-product-name { font-weight: 600; word-break: break-word; }
.vr-product-price { color: #6d28d9; font-size: .76rem; font-weight: 500; }
.vr-qty-badge {
  position: absolute;
  top: -7px;
  right: -7px;
  background: #7c3aed;
  color: #fff;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .72rem;
  font-weight: 700;
  box-shadow: 0 1px 4px rgba(0,0,0,.18);
}

/* ── Carrito ── */
.vr-cart-section {
  border-top: 1px solid #e2e8f0;
  padding-top: 8px;
  flex-shrink: 0;
}
.vr-cart-items {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 110px;
  overflow-y: auto;
  margin-bottom: 8px;
  font-size: .83rem;
}
.vr-cart-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 1px 0;
}
.vr-cart-row-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vr-cart-row-controls { display: flex; align-items: center; gap: 3px; flex-shrink: 0; }
.vr-qty-btn {
  width: 22px;
  height: 22px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #f8fafc;
  cursor: pointer;
  font-size: .9rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.vr-qty-btn:hover { background: #e2e8f0; }
.vr-qty-num { min-width: 18px; text-align: center; font-weight: 600; font-size: .83rem; }
.vr-cart-row-subtotal { min-width: 52px; text-align: right; font-weight: 600; color: #6d28d9; flex-shrink: 0; }
.vr-cart-price-btn {
  background: #f0fdf4;
  border: 2px solid #16a34a;
  border-radius: 6px;
  padding: 3px 8px;
  font-size: .82rem;
  font-weight: 700;
  color: #15803d;
  cursor: pointer;
  min-width: 58px;
  text-align: center;
  flex-shrink: 0;
  transition: background .15s;
}
.vr-cart-price-btn:hover { background: #dcfce7; }
.vr-cart-price-btn.modified {
  background: #fef3c7;
  border-color: #f59e0b;
  color: #92400e;
}
.vr-cart-price-input {
  width: 68px;
  border: 2px solid #3b82f6;
  border-radius: 6px;
  padding: 3px 6px;
  font-size: .85rem;
  font-weight: 700;
  text-align: center;
  outline: none;
  flex-shrink: 0;
}
.vr-empty-cart { color: #94a3b8; font-size: .81rem; }
.vr-cart-footer { display: flex; flex-direction: column; gap: 7px; }
.vr-total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: .95rem;
  font-weight: 700;
}
.vr-footer-actions { display: flex; gap: 7px; align-items: center; }
.vr-metodo-select {
  flex: 1;
  padding: 6px 8px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  font-size: .83rem;
}
.vr-cobrar-btn { white-space: nowrap; font-weight: 700; padding: 8px 14px !important; }

/* ── Panel de configuración de productos ── */
.vr-cfg-hint {
  font-size: .82rem;
  color: #64748b;
  margin: 0 0 8px;
}
.vr-cfg-search {
  width: 100%;
  padding: 7px 11px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  font-size: .85rem;
  box-sizing: border-box;
  margin-bottom: 8px;
  outline: none;
}
.vr-cfg-search:focus { border-color: #7c3aed; box-shadow: 0 0 0 2px rgba(124,58,237,.15); }
.vr-config-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 55vh;
  overflow-y: auto;
}
.vr-cfg-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 8px;
  border-radius: 8px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background .12s, border-color .12s;
  font-size: .85rem;
}
.vr-cfg-row:hover { background: #f5f3ff; border-color: #ddd6fe; }
.vr-cfg-row.is-checked { background: #ede9fe; border-color: #c4b5fd; }
.vr-cfg-check { accent-color: #7c3aed; width: 16px; height: 16px; cursor: pointer; flex-shrink: 0; }
.vr-cfg-row-name { flex: 1; font-weight: 500; }
.vr-cfg-row-price { color: #6d28d9; font-size: .8rem; font-weight: 600; flex-shrink: 0; }
.vr-cfg-done { width: 100%; margin-top: 10px; }

/* ============================================================
   SEND ORDER BUTTON — 3 states
   ============================================================ */

.send-order-btn {
  width: 100%;
  min-height: 72px;
  padding: 16px 20px;
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: background 0.1s ease, transform 0.08s ease;
  background: var(--primary);
  color: #fff;
  box-shadow: 0 6px 20px rgba(37, 99, 235, 0.35);
  position: relative;
  overflow: hidden;
}

.send-order-btn:hover:not(:disabled) {
  background: var(--primary-hover);
  transform: translateY(-1px);
}

.send-order-btn:active:not(:disabled) {
  transform: translateY(0);
}

/* Sending state */
.send-order-btn[data-state="sending"] {
  background: #93C5FD;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

.send-order-btn[data-state="sending"] #enviarBtnIcon::after {
  content: '';
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2.5px solid rgba(255,255,255,0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: middle;
}

/* Sent state */
.send-order-btn[data-state="sent"] {
  background: var(--success);
  cursor: default;
  box-shadow: 0 6px 20px rgba(5, 150, 105, 0.32);
  animation: sentPulse 0.4s ease;
}

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

@keyframes sentPulse {
  0%   { transform: scale(1);    }
  40%  { transform: scale(1.03); }
  100% { transform: scale(1);    }
}

/* ============================================================
   PRODUCT CATALOG OVERLAY — Mobile-First Redesign
   ============================================================ */

.catalog-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  z-index: 1000;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: overlayFadeIn 0.12s ease;
}

.catalog-overlay.hidden {
  display: none !important;
}

@keyframes overlayFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* Bottom sheet */
.catalog-modal {
  background: var(--surface);
  border-radius: 20px 20px 0 0;
  width: 100%;
  max-width: 980px;
  height: 92vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 -8px 48px rgba(15, 23, 42, 0.18);
  animation: modalSlideUp 0.15s cubic-bezier(0.32, 0.72, 0, 1);
  overflow: hidden;
  will-change: transform;
}

@keyframes modalSlideUp {
  from { transform: translateY(40px); opacity: 0.5; }
  to   { transform: translateY(0);    opacity: 1; }
}

/* Drag handle */
.catalog-drag-handle {
  width: 40px;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  margin: 10px auto 0;
  flex-shrink: 0;
}

/* Header */
.catalog-modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 20px 8px;
  flex-shrink: 0;
}

.catalog-head-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.catalog-modal-head h3 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
}

.catalog-count-badge {
  background: var(--primary-light);
  color: var(--primary);
  font-size: 0.71rem;
  font-weight: 700;
  padding: 2px 9px;
  border-radius: 99px;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.catalog-close-btn {
  width: 34px;
  height: 34px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 1px solid var(--border-light);
  background: var(--bg);
  color: var(--text-secondary);
  font-size: 0.95rem;
  cursor: pointer;
  flex-shrink: 0;
  transition: background var(--transition), color var(--transition);
  -webkit-tap-highlight-color: transparent;
}

.catalog-close-btn:hover {
  background: var(--border-light);
  color: var(--text);
}

/* Sticky top block: search + chips */
.catalog-sticky-top {
  flex-shrink: 0;
  background: var(--surface);
  border-bottom: 1px solid var(--border-light);
}

.catalog-search-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px 10px;
}

.catalog-search-icon {
  font-style: normal;
  font-size: 1rem;
  flex-shrink: 0;
  color: var(--muted);
  line-height: 1;
}

.catalog-search-wrap input {
  flex: 1;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 10px 14px;
  font: inherit;
  font-size: 0.95rem;
  background: var(--surface-2);
  color: var(--text);
  transition: border-color var(--transition), box-shadow var(--transition);
}

.catalog-search-wrap input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Clear button inside search wrap */
.catalog-search-clear {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  background: var(--border);
  color: var(--text-secondary);
  font-size: 0.75rem;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, transform 0.1s;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.catalog-search-clear:hover {
  background: var(--muted, #9ca3af);
  color: var(--surface);
}

.catalog-search-clear:active {
  transform: scale(0.9);
}

.catalog-search-clear.hidden {
  display: none;
}

/* Categories chips scroll container */
.catalog-chips-scroll {
  overflow: hidden;
}

.catalog-chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 10px 16px 12px;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.catalog-chips::-webkit-scrollbar {
  display: none;
}

/* Individual chip */
.catalog-chip {
  flex: 0 0 auto;
  scroll-snap-align: start;
  white-space: nowrap;
  padding: 16px 20px;
  border-radius: 99px;
  font-size: 0.92rem;
  font-weight: 600;
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s, box-shadow 0.15s;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.catalog-chip:active {
  transform: scale(0.96);
}

.catalog-chip.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.28);
}

/* Fila: buscador + filtros de estado en línea (Admin → Productos) */
.catalog-search-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.catalog-search-row .catalog-search-wrap {
  flex: 0 0 auto;
  width: 240px;
  padding-right: 4px;
}
.catalog-search-row .catalog-chips-scroll-inline {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
}
.catalog-search-row .catalog-chips-scroll-inline .catalog-chips {
  padding: 8px 16px 10px 0;
}

/* Filtros de estado compactos */
.catalog-chips.catalog-chips-status {
  gap: 6px;
}
.catalog-chips.catalog-chips-status .catalog-chip {
  padding: 6px 10px;
  font-size: 0.75rem;
  font-weight: 600;
  border-width: 1px;
  line-height: 1.1;
}
.catalog-chips.catalog-chips-status .catalog-chip.active {
  background: #0f172a;
  border-color: #0f172a;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.22);
}

@media (max-width: 700px) {
  .catalog-search-row {
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
  }
  .catalog-search-row .catalog-search-wrap {
    width: auto;
    padding-right: 16px;
  }
  .catalog-search-row .catalog-chips-scroll-inline .catalog-chips {
    padding: 4px 16px 8px;
  }
}

/* Products grid */
.catalog-products-grid {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  padding: 14px 14px 80px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(156px, 1fr));
  gap: 10px;
  align-content: start;
}

/* Fade-in animation on category change */
@keyframes catalogFadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.catalog-products-grid.animating {
  animation: catalogFadeIn 0.2s ease;
}

/* Product cards inside catalog */
.catalog-product-card {
  background: var(--surface);
  border: 1.5px solid var(--border-light);
  border-radius: var(--radius);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: box-shadow 0.15s, border-color 0.15s, background 0.15s;
}

.catalog-product-card.has-qty {
  border-color: var(--primary);
  background: var(--primary-subtle);
}

.catalog-product-name {
  margin: 0;
  font-size: 0.87rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
}

.catalog-price-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  margin-bottom: 2px;
}

.catalog-product-price {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--primary);
}

.catalog-product-area {
  font-size: 0.71rem;
  color: var(--muted);
  font-weight: 500;
}

.catalog-qty-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  margin-top: auto;
  padding-top: 6px;
}

.catalog-qty-btn {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  font-size: 1.35rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text);
  flex-shrink: 0;
  transition: background 0.08s, border-color 0.08s, transform 0.05s;
  -webkit-tap-highlight-color: transparent;
}

.catalog-qty-btn:active {
  transform: scale(0.92);
}

.catalog-qty-btn.minus:active,
.catalog-qty-btn.minus:hover {
  border-color: var(--danger);
  color: var(--danger);
  background: var(--danger-bg);
}

.catalog-qty-btn.plus {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.catalog-qty-btn.plus:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
}

.catalog-qty-num {
  min-width: 28px;
  text-align: center;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--primary);
}

/* Nota button en catálogo — siempre visible junto al precio */
.catalog-nota-btn {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  font-size: .85rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: 1.5px solid var(--border-light);
  background: transparent;
  flex-shrink: 0;
  transition: background 0.12s, border-color 0.12s;
  -webkit-tap-highlight-color: transparent;
  visibility: hidden;
}

.catalog-product-card.has-qty .catalog-nota-btn {
  visibility: visible;
}

.catalog-nota-btn.active {
  border-color: #f59e0b;
  background: #fffbeb;
  visibility: visible;
}

.catalog-nota-btn:hover {
  border-color: #f59e0b;
  background: #fef3c7;
  visibility: visible;
}

.catalog-price-btn {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  visibility: visible !important;
  font-size: .85rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: 1.5px solid var(--border-light);
  background: transparent;
  flex-shrink: 0;
  transition: background 0.12s, border-color 0.12s;
  -webkit-tap-highlight-color: transparent;
  visibility: hidden;
}

.catalog-product-card.has-qty .catalog-price-btn {
  visibility: visible;
}

.catalog-price-btn.active {
  border-color: #16a34a;
  background: #f0fdf4;
  visibility: visible;
}

.catalog-price-btn:hover {
  border-color: #16a34a;
  background: #dcfce7;
  visibility: visible;
}

.catalog-dup-btn {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  font-size: .85rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: 1.5px solid var(--border-light);
  background: transparent;
  flex-shrink: 0;
  transition: background 0.12s, border-color 0.12s;
  -webkit-tap-highlight-color: transparent;
  visibility: hidden;
}

.catalog-product-card.has-qty .catalog-dup-btn {
  visibility: visible;
}

.catalog-dup-btn:hover {
  border-color: #2563eb;
  background: #eff6ff;
  visibility: visible;
}

/* Empty / no results state */
.catalog-empty {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 20px;
  color: var(--muted);
  gap: 8px;
}

.catalog-empty-icon {
  font-size: 2.4rem;
  line-height: 1;
}

.catalog-empty p {
  margin: 0;
  font-size: 0.88rem;
  text-align: center;
}

/* ── Mobile overrides ─────────────────────── */
@media (max-width: 600px) {
  .catalog-modal {
    height: 94vh;
    border-radius: 18px 18px 0 0;
  }

  .catalog-products-grid {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    padding: 10px 10px 80px;
  }

  .catalog-product-name {
    font-size: 0.82rem;
  }

  .catalog-product-price {
    font-size: 0.85rem;
  }
}

@media (max-width: 360px) {
  .catalog-products-grid {
    gap: 6px;
    padding: 8px 8px 80px;
  }
}

/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (max-width: 860px) {
  .mesero-layout {
    grid-template-columns: 1fr;
  }

  .mesero-right {
    position: static;
  }

  .mesero-items-list {
    max-height: 360px;
  }

  .send-order-btn {
    min-height: 64px;
    font-size: 0.95rem;
  }
  .vr-send-btn {
    min-height: 64px;
    font-size: 0.9rem;
  }
}

@media (max-width: 800px) {
  .topbar {
    height: auto;
    padding: 12px clamp(14px, 4vw, 24px);
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .tabs {
    gap: 3px;
  }

  .tab {
    padding: 7px 12px;
    font-size: 0.8rem;
  }

  .full-screen {
    padding: 10px !important;
  }

  .two-col {
    grid-template-columns: 1fr;
  }
}

/* ============================================================
   OPTIMIZACIÓN ADMINISTRATIVA - MÓVILES
   ============================================================ */

.admin-grid {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch; /* Smooth momentum scroll en iOS */
}

@media (max-width: 640px) {
  /* Optimizar paneles para móviles */
  .panel-inner {
    padding: 12px;
  }

  .panel-inner h3 {
    font-size: 1.1rem;
    margin: 0 0 12px;
  }

  /* Optimizar labels y espacios de formularios */
  label {
    gap: 3px;
    font-size: 0.8rem;
    margin-bottom: 8px;
  }

  input,
  select {
    padding: 10px 10px;
    font-size: 16px; /* Ancho suficiente para evitar zoom en iOS */
    border-radius: 8px;
    width: 100%;
    max-width: 100%;
  }

  /* Hacer selects más usables en móviles */
  select {
    background-size: 20px;
    background-position: right 8px center;
    padding-right: 32px;
    /* Evitar que el select sea demasiado grande */
    height: 44px;
    line-height: 44px;
  }

  /* Mejorar opciones desplegables en móviles */
  select option {
    padding: 8px;
    line-height: 1.5;
  }

  /* Asegurar scrolling dentro del form en móviles */
  form.panel-inner {
    max-height: 100%;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* Grid de formularios en móviles: una columna compacta */
  .grid.two-col {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  /* Botones más grandes y fáciles de tocar */
  .btn {
    min-height: 44px;
    padding: 10px 16px;
    font-size: 0.95rem;
  }
}

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

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

  /* Móviles muy pequeños */
  .panel-inner {
    padding: 10px;
  }

  label {
    margin-bottom: 6px;
  }

  input,
  select {
    padding: 9px 10px;
    font-size: 16px;
  }

  select {
    height: 42px;
    line-height: 42px;
  }

  .btn {
    min-height: 44px;
    padding: 10px 12px;
    font-size: 0.9rem;
  }
}

/* ═══════════════════════════════════════════════════════
   MESA BLOQUEADA / OCUPADA
   ═══════════════════════════════════════════════════════ */
.quick-table-btn.occupied {
  background: #FEF3C7;
  border-color: #F59E0B;
  color: #92400E;
  font-weight: 700;
}
.quick-table-btn.occupied:hover {
  background: #FDE68A;
  border-color: #D97706;
}

/* ═══════════════════════════════════════════════════════
   BANNER MODO APPEND (agregar a pedido existente)
   ═══════════════════════════════════════════════════════ */
.mesero-append-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: #FFF7ED;
  border: 1.5px solid #F97316;
  border-radius: 10px;
  padding: 10px 14px;
  margin: 8px 0 6px;
  font-size: 0.9rem;
  color: #9A3412;
}
.mesero-cancel-append {
  background: #FED7AA;
  border-color: #F97316;
  color: #9A3412;
  font-size: 0.8rem;
  padding: 5px 10px;
  min-height: unset;
}
.mesero-cancel-append:hover {
  background: #FDBA74;
}

/* ═══════════════════════════════════════════════════════
   PANEL DE CUENTAS POR MESA (múltiples cuentas)
   ═══════════════════════════════════════════════════════ */
.mesero-cuenta-panel {
  background: #EFF6FF;
  border: 1.5px solid #3B82F6;
  border-radius: 10px;
  padding: 10px 14px;
  margin: 8px 0 6px;
}
.cuenta-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}
.cuenta-panel-title {
  font-size: 0.9rem;
  color: #1E40AF;
  font-weight: 600;
}
.cuenta-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.cuenta-card {
  background: #fff;
  border: 1.5px solid #BFDBFE;
  border-radius: 8px;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}
.cuenta-card-info {
  flex: 1;
  min-width: 0;
}
.cuenta-card-title {
  font-weight: 700;
  font-size: 0.88rem;
  color: #1E3A5F;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cuenta-card-meta {
  font-size: 0.78rem;
  color: #64748B;
  margin-top: 2px;
}
.cuenta-card-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}
.cuenta-card-actions .btn {
  min-height: unset;
  padding: 5px 10px;
  font-size: 0.8rem;
}

/* Botón mesa con múltiples cuentas */
.quick-table-btn.multi-cuenta {
  background: #FEE2E2;
  border-color: #EF4444;
  color: #991B1B;
  font-weight: 700;
}
.quick-table-btn.multi-cuenta:hover {
  background: #FECACA;
  border-color: #DC2626;
}

/* ═══════════════════════════════════════════════════════
   FILA FILTRO DE FECHA (solo mesero)
   ═══════════════════════════════════════════════════════ */
.mesero-date-filter-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 4px 4px;
  flex-wrap: wrap;
}
.mesero-date-label {
  font-size: 0.85rem;
  color: var(--text-muted, #888);
  white-space: nowrap;
}
.mesero-date-filter-row input[type="date"] {
  border: 1.5px solid var(--border, #ccc);
  border-radius: 8px;
  padding: 5px 8px;
  font-size: 0.85rem;
  height: 34px;
  color: var(--text, #333);
  background: var(--bg-card, #fff);
}
.mesero-date-filter-row .btn {
  min-height: unset;
  padding: 5px 12px;
  font-size: 0.82rem;
  border-radius: 8px;
}

/* Fecha en tarjeta de pedido */
.order-date {
  font-size: 0.78rem;
  color: var(--text-muted, #888);
  margin-top: 2px;
}

/* ── Pedidos pagados / cerrados ─────────────────────── */
.order-card.order-locked {
  background: #f1f5f9;
  border-color: #cbd5e1;
  opacity: .72;
  filter: grayscale(.35);
}

.order-card.order-locked .panel-head strong,
.order-card.order-locked .order-state-badge,
.order-card.order-locked .item-row-info {
  color: #94a3b8;
}

/* ── Tarjeta de pedido compacta ──────────────────────── */
.order-card.card {
  padding: 10px 12px;
  font-size: .82rem;
  border: 2px solid #b6bfcc;
  border-radius: 12px;
  box-shadow: 0 4px 14px rgba(0,0,0,.13), 0 1px 3px rgba(0,0,0,.08);
  /* Evita el parpadeo blanco al hacer scroll en iOS */
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}

.order-card .panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 5px;
  padding-bottom: 5px;
}
.order-card .panel-head strong {
  font-size: .88rem;
  flex: 0 0 auto;
}
.order-card .panel-head-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.order-card .order-state-badge {
  font-size: .72rem;
  padding: 2px 7px;
}

/* Botones de estado de item → íconos planos (sin chrome de botón) */
.item-state-btn .btn-txt { display: none !important; }
.item-state-btn {
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  padding: 0 4px !important;
  margin: 0 !important;
  min-width: 0 !important;
  width: auto !important;
  min-height: 0 !important;
  height: auto !important;
}
.item-state-btn .btn-ic {
  font-size: 1.15rem;
  line-height: 1;
  display: inline-block;
}
.item-state-btn:active .btn-ic { transform: scale(0.85); }

/* WhatsApp ticket btn: siempre solo ícono */
.wa-ticket-btn .btn-txt { display: none !important; }
.wa-ticket-btn {
  display: inline-flex !important;
  align-items: center !important;
  min-width: 0 !important;
  flex: 0 0 auto !important;
}

.order-card .item-row {
  padding: 4px 0;
  gap: 5px;
  font-size: .8rem;
}

.order-card .item-row-info small {
  font-size: .75rem;
}

.order-card .item-precio-label {
  font-size: .72rem;
}

.order-card .actions-inline {
  gap: 4px;
}

.order-card .state-action-btn,
.order-card .state-waiting-msg,
.order-card .state-locked-msg {
  font-size: .8rem;
  padding: 4px 8px;
  margin-top: 3px;
}

.order-meta-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 6px;
  font-size: .8rem;
  margin-bottom: 1px;
}

.order-meta-row .order-total-big {
  font-size: 1.1rem;
}

.order-client-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  flex: 1 1 auto;
  overflow: hidden;
}

.order-client-meta-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.order-meta-row .order-total-big {
  flex-shrink: 0;
  white-space: nowrap;
}

/* ── Vista móvil vertical de pedidos activos ── */
@media (max-width: 640px) {
  /* Contenedor de pedidos con márgenes simétricos */
  #ordersList.cards {
    padding: 0 8px;
    gap: 14px;
  }

  /* Tarjeta: más respiro, borde suave */
  .order-card.card {
    padding: 12px 12px 14px;
    font-size: .82rem;
    max-width: 100%;
    overflow: hidden;
    box-sizing: border-box;
    border-radius: 12px;
  }

  /* Header: cliente + total en filas separadas si no entra */
  .order-meta-row {
    flex-wrap: wrap;
    row-gap: 3px;
    gap: 6px;
  }
  .order-meta-row .order-total-big {
    font-size: 1.05rem;
  }

  /* Item row: stack vertical con separación entre items */
  .order-card .item-row {
    display: block;
    padding: 10px 0;
    border-top: 1px dashed #e2e8f0;
  }
  .order-card .item-row:first-of-type { border-top: 0; }
  .order-card .item-row-info {
    margin-bottom: 8px;
    line-height: 1.35;
  }
  .order-card .item-row-info strong {
    font-size: .92rem;
  }
  .order-card .item-row-info small {
    display: inline;
    font-size: .72rem;
    color: #64748b;
  }
  .order-card .item-precio-label {
    display: block;
    margin-top: 3px;
    font-size: .78rem;
    font-weight: 600;
  }
  .order-card .item-preparador-label {
    display: block;
    margin-top: 2px;
    font-size: .7rem;
  }

  /* Item actions: fila compacta, iconos pequeños */
  .order-card .item-row-right {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 4px !important;
    align-items: center !important;
    justify-content: flex-start !important;
  }
  .order-card .item-row-right .actions-inline {
    display: contents;
  }
  .wa-ticket-btn {
    display: inline-flex !important;
    align-items: center !important;
    padding: 2px 6px !important;
    font-size: .82rem !important;
    min-height: 28px !important;
    min-width: 0 !important;
    flex: 0 0 auto !important;
  }

  /* Botones de ícono (🔒, ✏️, $, 🗑) — compactos cuadrados */
  .order-card .item-row-right > button,
  .order-card .item-row-right .actions-inline > button,
  .order-card .btn-nota-edit,
  .order-card .btn-price-edit,
  .order-card .btn-item-delete {
    min-height: 28px !important;
    height: 28px !important;
    padding: 2px 6px !important;
    font-size: .72rem !important;
    border-radius: 6px !important;
    line-height: 1 !important;
    min-width: 28px !important;
    width: auto !important;
    white-space: nowrap;
    box-sizing: border-box;
    flex: 0 0 auto !important;
  }
  /* Botones de acción con texto (Preparar, Entregado, Listo) — un poco más anchos */
  .order-card .item-row-right .state-action-btn {
    flex: 0 1 auto !important;
    padding: 2px 10px !important;
    font-size: .72rem !important;
    font-weight: 600 !important;
  }

  /* Fila de controles de pago */
  .order-card .order-actions-row,
  .order-card .pay-row,
  .order-card .state-action-btn-row {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
  }
  .order-card .order-pay-select {
    flex: 1 1 90px;
    min-width: 80px;
    font-size: .78rem;
    padding: 6px 6px;
  }
  .order-card .btn-pay-order,
  .order-card .btn-close-order {
    flex: 1 1 auto;
    min-width: 75px;
    font-size: .76rem;
    padding: 6px 8px;
  }

  /* Botones utilitarios */
  .order-card .actions-inline > button,
  .order-card .btn-xs {
    min-height: 32px;
    min-width: 36px;
    padding: 5px 8px;
    font-size: .76rem;
    border-radius: 7px;
  }

  /* Barra de acciones completa — row wrap para que botones fluyan */
  .order-card .order-actions-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
    max-width: 100%;
    align-items: center;
  }
  /* El msg "🔒 Cerrado" ocupa todo el ancho para empujar botones abajo */
  .order-card .order-actions-bar > .state-locked-msg {
    flex: 0 0 100%;
    font-size: .78rem;
  }
  .order-card .order-pay-group {
    display: grid !important;
    grid-template-columns: 1fr 1fr;
    grid-auto-rows: auto;
    gap: 6px;
    align-items: stretch;
    flex: 0 0 100%;
    margin-top: 4px;
  }
  .order-card .order-pay-group .order-pay-select {
    grid-column: 1 / -1; /* select ocupa toda la fila superior */
  }
  .order-card .order-secondary-actions {
    flex: 0 0 100%;
    margin-top: 8px;
  }
  .order-card .order-pay-group .order-pay-select {
    min-width: 0 !important;
    width: 100% !important;
    padding: 6px 4px !important;
    font-size: .74rem !important;
    min-height: 36px !important;
  }
  .order-card .order-pay-group .btn-pay-order,
  .order-card .order-pay-group .btn-close-order {
    min-width: 0 !important;
    width: 100% !important;
    min-height: 36px !important;
    font-size: .76rem !important;
    padding: 6px 6px !important;
    font-weight: 600 !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .order-card .order-secondary-actions {
    display: grid !important;
    grid-template-columns: repeat(6, 1fr);
    gap: 5px;
    justify-content: stretch;
  }
  .order-card .order-secondary-actions > button {
    width: 100% !important;
    min-width: 0 !important;
    min-height: 34px !important;
    padding: 4px 2px !important;
    font-size: .82rem !important;
    border-radius: 8px !important;
  }

  /* Header del pedido: una sola línea compacta */
  .order-card .panel-head {
    flex-wrap: nowrap !important;
    gap: 4px !important;
    margin-bottom: 3px !important;
    padding-bottom: 3px !important;
  }
  .order-card .panel-head > strong {
    font-size: .8rem !important;
    white-space: nowrap !important;
  }
  .order-card .panel-head-actions {
    flex-wrap: nowrap !important;
    gap: 3px !important;
    overflow-x: auto !important;
    scrollbar-width: none !important;
    -webkit-overflow-scrolling: touch !important;
  }
  .order-card .panel-head-actions::-webkit-scrollbar { display: none !important; }
  .order-card .panel-head .btn-xs {
    padding: 2px 5px !important;
    font-size: .66rem !important;
    min-height: 22px !important;
    min-width: auto !important;
    flex: 0 0 auto !important;
  }
  .order-card .order-state-badge {
    font-size: .62rem !important;
    padding: 1px 5px !important;
    white-space: nowrap !important;
    flex: 0 0 auto !important;
  }
}

/* ── Extra compacto para pantallas < 400px ── */
@media (max-width: 400px) {
  .order-card.card {
    padding: 10px 10px 12px;
    font-size: .78rem;
  }
  .order-card .panel-head strong { font-size: .82rem; }
  .order-card .order-state-badge { font-size: .66rem; padding: 1px 5px; }
  .order-card .order-meta-row { font-size: .75rem; }
  .order-card .order-total-big { font-size: .95rem; }

  .order-card .item-row-right > button,
  .order-card .item-row-right .actions-inline > button {
    min-height: 32px !important;
    font-size: .7rem !important;
    padding: 4px 4px !important;
  }
  .order-card .order-pay-group .btn-pay-order,
  .order-card .order-pay-group .btn-close-order {
    font-size: .7rem !important;
    padding: 5px 4px !important;
    min-height: 34px !important;
  }
  .order-card .order-pay-group .order-pay-select {
    font-size: .7rem !important;
    min-height: 34px !important;
  }
  .order-card .order-secondary-actions > button {
    min-height: 34px !important;
    padding: 4px 2px !important;
    font-size: .82rem !important;
  }
}

.order-phone-badge {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  background: #dcfce7;
  color: #15803d;
  border: 1px solid #86efac;
  border-radius: 10px;
  font-size: .72rem;
  font-weight: 600;
  padding: 1px 6px;
  margin-left: 4px;
  white-space: nowrap;
}

.btn-assign-phone {
  font-size: .75rem;
  padding: 2px 6px;
  border-radius: 10px;
  background: #f0fdf4;
  border: 1px solid #86efac;
  color: #15803d;
  cursor: pointer;
  white-space: nowrap;
}
.btn-assign-phone:hover { background: #dcfce7; }

.order-client-meta-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.btn-delivery-client-edit {
  flex-shrink: 0;
  padding: 2px 8px;
  min-height: 24px;
  line-height: 1;
}

/* Barra unificada de acciones */
.order-actions-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: nowrap;
  gap: 4px;
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid var(--border-light);
  overflow-x: auto;
}

.order-secondary-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.order-pay-group {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
  margin-left: auto;
}

.order-pay-select {
  padding: 3px 6px;
  font-size: .75rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  cursor: pointer;
  height: 26px;
  max-width: 110px;
}

.order-actions-sep {
  width: 1px;
  height: 18px;
  background: var(--border-light);
  margin: 0 2px;
  flex-shrink: 0;
}

.btn-xs {
  padding: 3px 8px;
  font-size: .75rem;
  border-radius: 5px;
  line-height: 1.4;
  height: 26px;
}

.btn-sm {
  padding: 4px 10px;
  font-size: .8rem;
  border-radius: 6px;
}

.btn-pay-order {
  background: #dcfce7;
  border: 1px solid #16a34a;
  color: #15803d;
  font-weight: 700;
  min-width: 68px;
  letter-spacing: .01em;
}
.btn-pay-order:hover:not(:disabled) {
  background: #bbf7d0;
}

.btn-close-order {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  font-weight: 700;
  min-width: 100px;
  letter-spacing: .01em;
}
.btn-close-order:hover:not(:disabled) {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
}

.btn-pay-order.btn-loading,
.btn-close-order.btn-loading {
  opacity: .7;
  cursor: not-allowed;
  pointer-events: none;
}

.btn-spinner {
  display: inline-block;
  width: 10px;
  height: 10px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: btn-spin .6s linear infinite;
  vertical-align: middle;
  margin-right: 4px;
}

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

/* ─── Wheel Picker — Comisión Tarjeta (mini, al pie del modal) ──────────────── */
:root { --tip-item-h: 26px; }

.tip-wheel-card {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  padding: 4px 8px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
}

.tip-wheel-label {
  font-size: 0.68rem;
  font-weight: 700;
  color: #1d4ed8;
  white-space: nowrap;
  flex-shrink: 0;
}

.tip-wheel-wrap {
  position: relative;
  width: 38px;
  height: calc(var(--tip-item-h) * 3);
  overflow: hidden;
  border-radius: 6px;
  border: 1px solid #93c5fd;
  background: #fff;
  flex-shrink: 0;
  cursor: grab;
  -webkit-user-select: none;
  user-select: none;
}

.tip-wheel-track {
  position: absolute;
  inset: 0;
  overflow-y: scroll;
  scroll-snap-type: y mandatory;
  scrollbar-width: none;
  -ms-overflow-style: none;
  padding: var(--tip-item-h) 0;
  box-sizing: border-box;
}
.tip-wheel-track::-webkit-scrollbar { display: none; }

.tip-wheel-item {
  height: var(--tip-item-h);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
  color: #94a3b8;
  scroll-snap-align: center;
  cursor: pointer;
}
.tip-wheel-item.selected { color: #1d4ed8; font-size: 0.8rem; }

.tip-wheel-overlay {
  position: absolute;
  left: 0; right: 0;
  height: var(--tip-item-h);
  pointer-events: none;
  z-index: 2;
}
.tip-wheel-overlay-top    { top: 0;    background: linear-gradient(to bottom, rgba(255,255,255,.92) 0%, transparent 100%); }
.tip-wheel-overlay-bottom { bottom: 0; background: linear-gradient(to top,   rgba(255,255,255,.92) 0%, transparent 100%); }
.tip-wheel-center-line {
  position: absolute;
  left: 3px; right: 3px;
  top: var(--tip-item-h);
  height: var(--tip-item-h);
  border-top: 1px solid #3b82f6;
  border-bottom: 1px solid #3b82f6;
  background: rgba(59,130,246,.06);
  pointer-events: none;
  z-index: 1;
}

/* Info inline */
.tip-inline-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
  font-size: 0.7rem;
  color: #64748b;
}
.tip-inline-info .tip-row { display: flex; justify-content: space-between; gap: 4px; }
.tip-inline-info .tip-row b { color: #1e293b; white-space: nowrap; }
.tip-inline-info .tip-row.tip-total b { color: #15803d; font-weight: 800; }

.btn-domicilio {
  background: #fffbeb;
  border: 1px solid #f59e0b;
  color: #b45309;
  font-weight: 600;
}

.btn-domicilio:hover {
  background: #fef3c7;
}

.btn-repartidor {
  background: #f0fdf4;
  border: 1px solid #22c55e;
  color: #15803d;
  font-weight: 600;
}
.btn-repartidor:hover { background: #dcfce7; }

.btn-reactivate {
  background: #f0fdf4;
  border: 1px solid #16a34a;
  color: #15803d;
  font-weight: 600;
}
.btn-reactivate:hover {
  background: #dcfce7;
}

/* Modal de acciones rápidas de pedido */
#quickOrderActionModal .btn {
  width: 100%;
  justify-content: center;
  font-size: .92rem;
  padding: 10px 12px;
  border-radius: 8px;
}
#quickOrderActionModal .order-pay-select {
  height: 36px;
  border-radius: 6px;
  font-size: .85rem;
  border: 1px solid #d1d5db;
  padding: 0 6px;
}

/* Botón inline de cambio de mesa dentro de la meta-row del pedido */
.btn-mesa-inline {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  color: inherit;
  cursor: pointer;
  text-decoration: underline dotted;
  text-underline-offset: 2px;
  border-radius: 4px;
}
.btn-mesa-inline:hover {
  color: var(--primary);
  text-decoration: underline;
}

/* Highlight de pedido al hacer scroll desde modal de mesa */
@keyframes order-highlight-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(37,99,235,.5), var(--card-shadow); }
  50%  { box-shadow: 0 0 0 8px rgba(37,99,235,.15), var(--card-shadow); }
  100% { box-shadow: 0 0 0 0 rgba(37,99,235,0), var(--card-shadow); }
}
.order-card-highlight {
  animation: order-highlight-pulse .6s ease 3;
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.send-wa-type-btn {
  border: 1px solid #d1d5db;
  background: #f9fafb;
  color: #374151;
  font-weight: 500;
  transition: background .15s, border-color .15s;
}
.send-wa-type-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.send-wa-type-btn:hover:not(.active) {
  background: #f3f4f6;
}

.order-bottom-actions {
  margin-top: 6px;
  gap: 6px;
}

/* ── Mapa selector de ubicación ───────────────────── */
.picker-map {
  height: 340px;
  border-radius: 8px;
  border: 1px solid var(--border-light);
  margin-top: 6px;
  z-index: 0;
}

.picker-map-hint {
  font-size: .72rem;
  color: #64748b;
  margin: 3px 0 6px;
}

/* ── Modal Editar envío / Mandar a domicilio — layout 2 columnas ──────────── */
.domicilio-convert-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  align-items: start;
  margin-top: 6px;
}
.domicilio-convert-col {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.domicilio-convert-col .picker-map {
  height: 100%;
  min-height: 320px;
}
@media (max-width: 720px) {
  .domicilio-convert-grid {
    grid-template-columns: 1fr;
  }
  .domicilio-convert-col .picker-map {
    min-height: 260px;
  }
}

/* ── Quick Sale: revisión de items con precios editables ───────────────────── */
.qs-items-review {
  margin-bottom: 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}

.qs-items-review-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 7px 12px;
  background: var(--surface-alt, #f8fafc);
  border-bottom: 1px solid var(--border);
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.qs-items-total {
  font-size: 0.88rem;
  font-weight: 800;
  color: #16a34a;
}

.qs-items-list {
  display: flex;
  flex-direction: column;
}

.qs-item-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
}
.qs-item-row:last-child { border-bottom: none; }

.qs-item-qty {
  font-weight: 700;
  color: var(--text-secondary);
  min-width: 22px;
  text-align: center;
  flex-shrink: 0;
}

.qs-item-name {
  flex: 1;
  color: var(--text);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Precio — modo display (tap para editar) */
.qs-item-price-wrap {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.qs-item-price-btn {
  background: #f0fdf4;
  border: 2px solid #16a34a;
  border-radius: 8px;
  padding: 5px 10px;
  font-size: 0.88rem;
  font-weight: 800;
  color: #15803d;
  cursor: pointer;
  min-width: 70px;
  text-align: center;
  transition: background 0.15s, transform .1s;
  white-space: nowrap;
}
.qs-item-price-btn:hover { background: #dcfce7; transform: scale(1.05); }
.qs-item-price-btn:active { transform: scale(.97); }
.qs-item-price-btn.modified {
  background: #fef3c7;
  border-color: #f59e0b;
  color: #92400e;
  animation: qsPricePulse .4s ease;
}
@keyframes qsPricePulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.1); }
  100% { transform: scale(1); }
}

/* Input inline al editar */
.qs-item-price-input {
  width: 72px;
  border: 1.5px solid #3b82f6;
  border-radius: 6px;
  padding: 3px 6px;
  font-size: 0.9rem;
  font-weight: 700;
  color: #1d4ed8;
  text-align: right;
  outline: none;
  background: #fff;
}

.qs-item-subtotal {
  font-size: 0.75rem;
  color: var(--text-secondary);
  min-width: 46px;
  text-align: right;
  flex-shrink: 0;
}

/* ── Quick Sale Modal (Mostrador / Mesa / Para llevar) ─────────────────────── */
.qs-options-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 12px;
}
@media (max-width: 540px) {
  .qs-options-grid { grid-template-columns: repeat(2, 1fr); }
}

.qs-option-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 16px 6px;
  border: 2px solid var(--border-light);
  border-radius: 10px;
  background: var(--card-bg);
  cursor: pointer;
  transition: border-color .15s, background .15s;
  font-size: .82rem;
  color: var(--text);
  text-align: center;
  line-height: 1.3;
}

.qs-option-btn .qs-icon { font-size: 1.6rem; line-height: 1; }
.qs-option-btn small { font-size: .68rem; color: #64748b; font-weight: 400; }
.qs-option-btn:hover { border-color: var(--primary); background: #eff6ff; }

/* ── Autocomplete de clientes en modal domicilio ─────────── */
/* Quick Sale: domicilio grid layout (2 columnas en tablet/PC) */
.qs-dom-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  align-items: start;
}
.qs-dom-col {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.qs-dom-col .picker-map {
  height: 100%;
  min-height: 280px;
}
@media (max-width: 720px) {
  .qs-dom-grid {
    grid-template-columns: 1fr;
  }
  .qs-dom-col .picker-map {
    min-height: 220px;
  }
}

.qs-dom-suggestions {
  position: absolute;
  left: 0; right: 0;
  top: calc(100% + 2px);
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  z-index: 9999;
  max-height: 200px;
  overflow-y: auto;
}
.qs-dom-suggestion-item {
  padding: 10px 14px;
  cursor: pointer;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.qs-dom-suggestion-item:last-child { border-bottom: none; }
.qs-dom-suggestion-item:hover { background: #eff6ff; }
.qs-dom-suggestion-phone { font-weight: 700; font-size: .9rem; }
.qs-dom-suggestion-name  { font-size: .78rem; color: var(--text-secondary); }
.ia-location-search-wrap { position: relative; }
.ia-location-suggestion-item { gap: 3px; }
.ia-location-sug-main {
  font-weight: 700;
  font-size: .82rem;
  color: #0f172a;
}
.ia-location-sug-sub {
  font-size: .74rem;
  color: #64748b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Sugerencias de producto existente (admin nuevo producto) ─── */
.adm-prod-suggestions {
  position: absolute;
  left: 0; right: 0;
  top: calc(100% + 3px);
  background: #fff;
  border: 1.5px solid #e2e8f0;
  border-radius: 10px;
  box-shadow: 0 8px 28px rgba(0,0,0,.13);
  z-index: 4500;
  max-height: 300px;
  overflow-y: auto;
}
.adm-prod-sug-item {
  padding: .65rem .95rem;
  border-bottom: 1px solid #f1f5f9;
  display: flex;
  flex-direction: column;
  gap: .22rem;
}
.adm-prod-sug-item:last-child { border-bottom: none; }
.adm-sug-name {
  font-weight: 700;
  font-size: .9rem;
  color: #1e293b;
  display: flex;
  align-items: center;
  gap: .4rem;
}
.adm-sug-meta {
  display: flex;
  flex-wrap: wrap;
  gap: .2rem .65rem;
  font-size: .78rem;
  color: #64748b;
}
.adm-sug-desc {
  font-size: .77rem;
  color: #94a3b8;
  font-style: italic;
}
.adm-sug-inactive {
  font-size: .7rem;
  background: #fee2e2;
  color: #dc2626;
  border-radius: 4px;
  padding: 1px 6px;
  font-weight: 600;
}

/* ── Input de nombre con botón X ───────────────────── */
.wa-name-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 10px;
}

.wa-name-row .wa-name-input {
  flex: 1;
  margin: 0;
}

.wa-clear-btn {
  background: none;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  padding: 4px 8px;
  font-size: .85rem;
  color: #64748b;
  cursor: pointer;
  line-height: 1;
  flex-shrink: 0;
}

.wa-clear-btn:hover {
  background: #fee2e2;
  border-color: #fca5a5;
  color: #dc2626;
}

/* ════════════════════════════════════════════════
   BOTÓN WHATSAPP EN TARJETA DE PEDIDO (entregado)
   ════════════════════════════════════════════════ */
.wa-ticket-btn {
  background: #25D366;
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 3px 10px;
  font-weight: 600;
  font-size: 0.75rem;
  cursor: pointer;
}

.order-card .wa-ticket-btn {
  height: 26px;
}
.wa-ticket-btn:hover {
  background: #1ebe5c;
}

/* ════════════════════════════════════════════════
   MODAL DE TICKET POR WHATSAPP
   ════════════════════════════════════════════════ */
.wa-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 16px;
}
.wa-modal {
  background: var(--bg-card, #fff);
  border-radius: 18px;
  padding: 28px 24px 24px;
  width: 100%;
  max-width: 360px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.25);
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.wa-modal-close {
  position: absolute;
  top: 12px;
  right: 14px;
  background: none;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  color: var(--text-muted, #888);
  min-height: unset;
  padding: 4px 6px;
}
.wa-modal-icon {
  font-size: 2.4rem;
  text-align: center;
  line-height: 1;
}
.wa-modal-title {
  text-align: center;
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
}
/* Repartidor worker picker */
.rep-search-wrap {
  margin-bottom: 6px;
}
.rep-search-input {
  width: 100%;
  padding: 7px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: .88rem;
  box-sizing: border-box;
  outline: none;
}
.rep-search-input:focus { border-color: #2563eb; }

.rep-modal-grid {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 14px;
  align-items: stretch;
}
.rep-modal-col-left, .rep-modal-col-right { display: flex; flex-direction: column; }
.rep-modal-col-right textarea { flex: 1; min-height: 220px; }
@media (max-width: 720px) {
  .rep-modal-grid { grid-template-columns: 1fr; gap: 10px; }
}

.rep-worker-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 260px;
  overflow-y: auto;
  margin-bottom: 0;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 4px;
  background: #f8fafc;
}
.rep-worker-chip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: #fff;
  border: 1.5px solid #e2e8f0;
  border-radius: 8px;
  cursor: pointer;
  font-size: .88rem;
  font-weight: 600;
  color: #1e293b;
  transition: border-color .12s, background .12s;
  text-align: left;
  width: 100%;
}
.rep-worker-chip:hover {
  border-color: #2563eb;
  background: #eff6ff;
}
.rep-worker-chip.selected {
  border-color: #2563eb;
  background: #dbeafe;
  color: #1d4ed8;
}
.rep-worker-num {
  font-size: .78rem;
  font-weight: 400;
  color: #64748b;
  font-family: monospace;
}
.rep-worker-chip.selected .rep-worker-num { color: #2563eb; }
.rep-no-workers {
  font-size: .82rem;
  color: #94a3b8;
  margin: 4px 6px;
}
.rep-worker-chip.rep-no-phone { opacity: .6; }
.rep-worker-chip.rep-no-phone .rep-worker-num { color: #ef4444; }

.wa-modal-hint {
  text-align: center;
  color: var(--text-muted, #888);
  font-size: 0.85rem;
  margin: 0;
}
.wa-phone-row {
  display: flex;
  align-items: center;
  gap: 0;
  border: 2px solid #25D366;
  border-radius: 10px;
  overflow: hidden;
}
.wa-prefix {
  background: #E9F9F0;
  color: #1ebe5c;
  font-weight: 700;
  padding: 10px 10px;
  font-size: 0.92rem;
  white-space: nowrap;
  border-right: 2px solid #25D366;
}
.wa-phone-row input {
  border: none;
  outline: none;
  flex: 1;
  padding: 10px 12px;
  font-size: 1rem;
  background: transparent;
  min-width: 0;
}
/* ── Autocomplete de teléfono en modal WhatsApp ── */
.wa-phone-suggestions {
  position: absolute;
  left: 0; right: 0;
  top: calc(100% + 2px);
  background: #fff;
  border: 1.5px solid #e2e8f0;
  border-radius: 10px;
  box-shadow: 0 6px 20px rgba(0,0,0,.13);
  z-index: 5000;
  max-height: 220px;
  overflow-y: auto;
}
.wa-phone-sug-item {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .6rem .9rem;
  border-bottom: 1px solid #f1f5f9;
  cursor: pointer;
}
.wa-phone-sug-item:last-child { border-bottom: none; }
.wa-phone-sug-item:hover { background: #eff6ff; }
.wa-sug-phone {
  font-weight: 700;
  font-size: .9rem;
  color: #1e293b;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.wa-sug-name {
  font-size: .82rem;
  color: #64748b;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wa-btn {
  width: 100%;
  margin-top: 4px;
  border-radius: 10px;
  font-size: 0.95rem;
  min-height: 44px;
}
.wa-btn-sec {
  background: transparent;
  border-color: var(--border, #ccc);
  color: var(--text-muted, #888);
  font-size: 0.85rem;
  min-height: 38px;
}
.wa-error {
  color: #e53e3e;
  font-size: 0.8rem;
  margin: -6px 0 0;
}
.wa-client-found {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #E9F9F0;
  border: 1.5px solid #25D366;
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 0.95rem;
}
.wa-client-icon {
  font-size: 1.4rem;
}
.wa-name-input {
  width: 100%;
  box-sizing: border-box;
  border: 2px solid var(--border, #ccc);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 0.95rem;
}
.wa-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 0.95rem;
  color: var(--text-muted, #888);
  padding: 8px 0;
}
.wa-spinner {
  width: 20px;
  height: 20px;
  border: 3px solid #25D366;
  border-top-color: transparent;
  border-radius: 50%;
  display: inline-block;
  animation: wa-spin 0.7s linear infinite;
}
@keyframes wa-spin {
  to { transform: rotate(360deg); }
}

/* ═══════════════════════════════════════════════════════
   OPCIONES EXTRA DE ADMIN EN PANEL MESERO
   ═══════════════════════════════════════════════════════ */
.admin-order-options {
  background: #F8FAFC;
  border: 1.5px solid #E2E8F0;
  border-radius: 10px;
  padding: 10px 14px;
  margin: 6px 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.admin-order-options-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.admin-order-options-row .compact-label {
  display: flex;
  flex-direction: column;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted, #888);
  gap: 3px;
  flex: 1;
  min-width: 130px;
}
.admin-order-options-row .compact-label select,
.admin-order-options-row .compact-label input {
  font-size: 0.85rem;
  padding: 5px 8px;
  border-radius: 7px;
  border: 1.5px solid var(--border, #ccc);
  background: var(--bg-card, #fff);
  height: 34px;
}
.admin-order-options-row input {
  flex: 1;
  min-width: 130px;
  font-size: 0.85rem;
  padding: 5px 8px;
  border-radius: 7px;
  border: 1.5px solid var(--border, #ccc);
  background: var(--bg-card, #fff);
  height: 34px;
}

/* ── Formulario rápido de nuevo movimiento ──────────────────── */
.cash-quick-form {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 14px;
  margin-bottom: 18px;
}
.cash-quick-title {
  font-weight: 700;
  font-size: 0.88rem;
  color: var(--text, #1a202c);
  white-space: nowrap;
  margin-right: 2px;
}
.cash-ctl {
  height: 34px;
  border: 1.5px solid var(--border, #e2e8f0);
  border-radius: 8px;
  padding: 0 10px;
  font-size: 0.84rem;
  background: var(--bg, #fff);
  color: var(--text, #1a202c);
  outline: none;
}
.cash-ctl:focus { border-color: var(--primary, #3b82f6); }
.cash-monto { width: 110px; }
.cash-desc  { flex: 1; min-width: 140px; max-width: 260px; }
.cash-btn   { height: 34px; padding: 0 16px; font-size: 0.84rem; white-space: nowrap; }

/* ── Balance por usuario (Caja) ────────────────────────────── */
#cashBalanceTable {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}
.balance-user-card {
  background: var(--bg-card, #fff);
  border: 1.5px solid var(--border, #e2e8f0);
  border-radius: 14px;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: 0 2px 6px rgba(0,0,0,.07);
  transition: box-shadow .15s;
}
.balance-user-card:hover {
  box-shadow: 0 4px 14px rgba(0,0,0,.12);
}
.balance-total-card {
  grid-column: 1 / -1;
  border: 2px solid #16a34a;
  background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
  box-shadow: 0 3px 12px rgba(22,163,74,.18);
  flex-direction: row;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px 24px;
}
.balance-user-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}
.balance-user-name {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text, #1a202c);
}
.balance-user-role {
  font-size: 0.72rem;
  background: var(--primary, #3b82f6);
  color: #fff;
  border-radius: 20px;
  padding: 2px 8px;
  white-space: nowrap;
}
.balance-user-total {
  font-size: 1.5rem;
  font-weight: 800;
  color: #16a34a;
  letter-spacing: -0.5px;
}
.balance-methods {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.balance-method {
  font-size: 0.75rem;
  border-radius: 6px;
  padding: 3px 8px;
  display: flex;
  align-items: center;
  gap: 4px;
}
.balance-method.efectivo     { background: #dcfce7; color: #166534; }
.balance-method.tarjeta      { background: #dbeafe; color: #1e40af; }
.balance-method.transferencia { background: #fef9c3; color: #854d0e; }
.balance-user-pedidos {
  font-size: 0.75rem;
  color: var(--text-muted, #64748b);
  margin-top: 2px;
}
.balance-neto-pos { color: #16a34a; }
.balance-neto-neg { color: #dc2626; }

.balance-day-label {
  font-size: 0.72rem;
  color: var(--text-muted,#64748b);
  font-weight: 500;
  margin-bottom: -2px;
}
.balance-no-activity {
  font-size: 0.78rem;
  color: var(--text-muted,#94a3b8);
  font-style: italic;
  padding: 4px 0;
}
.balance-user-inactive {
  opacity: .65;
}
.balance-desglose {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}
.bd-item {
  font-size: 0.75rem;
  border-radius: 6px;
  padding: 3px 8px;
  display: flex;
  align-items: center;
  gap: 4px;
}
.bd-cobro        { background: #eff6ff; color: #1d4ed8; }
.bd-extra        { background: #f0fdf4; color: #15803d; }
.bd-egreso       { background: #fff1f2; color: #b91c1c; }
.bd-efectivo     { background: #fef9c3; color: #854d0e; }
.bd-tarjeta      { background: #f5f3ff; color: #6d28d9; }
.bd-transferencia{ background: #ecfeff; color: #0e7490; }

/* ── Solicitudes de autorización ────────────────────────────── */
.auth-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 99px;
  background: #ef4444;
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  vertical-align: middle;
  margin-left: 6px;
}
.auth-request-card {
  background: #fff;
  border: 1px solid #fca5a5;
  border-left: 4px solid #ef4444;
  border-radius: 10px;
  padding: 12px 16px;
  margin-bottom: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.auth-request-card .auth-req-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 700;
  font-size: 0.95rem;
}
.auth-request-card .auth-req-meta {
  font-size: 0.82rem;
  color: #64748b;
}
.auth-request-card .auth-req-actions {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}
.btn-item-delete {
  font-size: .72rem !important;
  padding: 2px 6px !important;
  height: 22px !important;
  line-height: 1 !important;
  border-radius: 4px !important;
  min-width: unset !important;
}

.btn-danger {
  background: #ef4444;
  color: #fff;
  border: none;
  border-radius: 7px;
  padding: 6px 14px;
  font-size: 0.85rem;
  cursor: pointer;
  font-weight: 600;
}
.btn-danger:hover { background: #dc2626; }

.btn-warning {
  background: #f59e0b;
  color: #fff;
  border: none;
  border-radius: 7px;
  padding: 6px 14px;
  font-size: 0.85rem;
  cursor: pointer;
  font-weight: 600;
}
.btn-warning:hover { background: #d97706; }

/* ── Modal detalle de mesa ──────────────────────────────────── */
.mesa-detail-card {
  width: min(600px, 96vw);
  max-height: 82vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.mesa-detail-body {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.mesa-detail-empty {
  text-align: center;
  padding: 32px 16px;
  color: var(--text-secondary, #6b7280);
  font-size: 1rem;
}
.mesa-cuenta-block {
  border: 1px solid var(--border-light, #e5e7eb);
  border-radius: 10px;
  overflow: hidden;
}
.mesa-cuenta-actions {
  display: flex;
  gap: 8px;
  padding: 10px 14px;
  background: #f8fafc;
  border-top: 1px solid var(--border-light, #e5e7eb);
}
.mesa-cuenta-actions .btn {
  flex: 1;
  justify-content: center;
  font-size: .82rem;
}
.mesa-cuenta-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 14px;
  background: var(--surface-alt, #f8fafc);
  border-bottom: 1px solid var(--border-light, #e5e7eb);
}
.mesa-cuenta-title {
  font-weight: 700;
  font-size: 0.95rem;
}
.mesa-cuenta-meta {
  font-size: 0.82rem;
  color: var(--text-secondary, #6b7280);
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}
.mesa-cuenta-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  background: #dbeafe;
  color: #1e40af;
}
.mesa-cuenta-badge.estado-creado       { background: #fef9c3; color: #92400e; }
.mesa-cuenta-badge.estado-en_preparacion { background: #fed7aa; color: #9a3412; }
.mesa-cuenta-badge.estado-listo        { background: #dcfce7; color: #166534; }
.mesa-cuenta-badge.estado-entregado    { background: #e0e7ff; color: #3730a3; }
.mesa-cuenta-badge.estado-pagado       { background: #d1fae5; color: #065f46; }
.mesa-cuenta-items {
  padding: 0;
}
.mesa-item-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 14px;
  border-bottom: 1px solid var(--border-light, #f1f5f9);
  font-size: 0.88rem;
}
.mesa-item-row:last-child { border-bottom: none; }
.mesa-item-qty {
  min-width: 32px;
  font-weight: 700;
  color: var(--primary, #0f5d52);
  text-align: right;
}
.mesa-item-name { flex: 1; font-weight: 600; word-break: break-word; }
.mesa-item-sub  { font-size: 0.78rem; color: var(--text-secondary, #6b7280); }
.mesa-item-price {
  font-weight: 600;
  white-space: nowrap;
  text-align: right;
  min-width: 70px;
}
.mesa-detail-total-row {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  padding: 8px 14px 10px;
  font-size: 0.9rem;
  font-weight: 700;
  background: var(--surface-alt, #f8fafc);
  border-top: 2px solid var(--border-light, #e5e7eb);
}

/* ── Modal aprobación ────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  z-index: 9000;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: 20px 12px;
}
.modal-overlay.hidden { display: none; }
.modal-card {
  background: #fff;
  border-radius: 14px;
  padding: 28px 28px 24px;
  width: min(420px, 92vw);
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: 0 8px 32px rgba(0,0,0,.18);
  margin: auto;
  touch-action: pan-y;
  overscroll-behavior: contain;
}
.modal-card h3 { margin: 0; font-size: 1.1rem; }
.auth-detail {
  background: #f8fafc;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 0.9rem;
  line-height: 1.6;
}
.auth-pwd-label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 0.85rem;
  font-weight: 600;
  color: #374151;
}
.auth-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}
.btn-close-modal {
  position: absolute;
  top: 12px;
  right: 14px;
  background: none;
  border: none;
  font-size: 1.1rem;
  cursor: pointer;
  color: #94a3b8;
  line-height: 1;
}
.btn-close-modal:hover { color: #374151; }

/* ── Toolbar de movimientos ─────────────────────────────────── */
.cash-mov-toolbar {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 14px;
}
.cash-filter-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.cash-date-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  font-weight: 600;
}

/* Rango desplegable */
.cash-range-details {
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 8px;
  padding: 0;
  overflow: hidden;
}
.cash-range-summary {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--primary, #2563eb);
  padding: 7px 12px;
  cursor: pointer;
  user-select: none;
  list-style: none;
  background: var(--bg, #f8fafc);
}
.cash-range-summary::-webkit-details-marker { display: none; }
.cash-range-details[open] .cash-range-summary {
  border-bottom: 1px solid var(--border, #e2e8f0);
}
.cash-range-body {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 12px;
  align-items: flex-end;
}
.btn-sm { height: 30px; padding: 0 12px; font-size: 0.8rem; }
.cash-filter-active-label {
  font-size: 0.82rem;
  color: var(--primary, #2563eb);
  font-weight: 600;
  padding: 4px 8px;
  background: #eff6ff;
  border-radius: 6px;
  margin-top: 6px;
}

/* ── Movimientos agrupados por día ──────────────────────────── */
.mov-day-group { margin-bottom: 14px; }
.mov-day-header {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-muted, #64748b);
  padding: 4px 0 6px;
  border-bottom: 1px solid var(--border, #e2e8f0);
  margin-bottom: 6px;
  letter-spacing: .3px;
}
.mov-row {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 7px 10px;
  border-radius: 8px;
  margin-bottom: 5px;
  font-size: 0.82rem;
  border-left: 4px solid transparent;
}
.mov-verde  { background: #f0fdf4; border-color: #22c55e; }
.mov-rojo   { background: #fff1f2; border-color: #ef4444; }
.mov-azul   { background: #eff6ff; border-color: #3b82f6; }
.mov-gris   { background: #f8fafc; border-color: #94a3b8; }

/* Primera línea: badge + monto + hora + eliminar */
.mov-row-main {
  display: flex;
  align-items: center;
  gap: 6px;
}
.mov-badge {
  font-size: 0.72rem;
  font-weight: 700;
  border-radius: 6px;
  padding: 2px 7px;
  white-space: nowrap;
  background: rgba(0,0,0,.06);
  flex-shrink: 0;
}
.mov-verde  .mov-badge { color: #15803d; }
.mov-rojo   .mov-badge { color: #b91c1c; }
.mov-azul   .mov-badge { color: #1d4ed8; }
.mov-gris   .mov-badge { color: #475569; }
.mov-monto {
  font-weight: 800;
  white-space: nowrap;
  margin-left: auto;
}
.mov-verde  .mov-monto { color: #16a34a; }
.mov-rojo   .mov-monto { color: #dc2626; }
.mov-azul   .mov-monto { color: #2563eb; }
.mov-hora    { font-size: 0.72rem; color: var(--text-muted,#64748b); white-space: nowrap; flex-shrink: 0; }

/* Segunda línea: descripción detallada */
.mov-row-desc {
  font-size: 0.78rem;
  color: var(--text-muted,#64748b);
  line-height: 1.4;
  padding-left: 2px;
}

/* Botón ver todos / ver hoy */
.mov-toggle-row {
  display: flex;
  justify-content: center;
  padding: 8px 0 2px;
}
.mov-toggle-btn {
  font-size: 0.78rem;
  padding: 5px 14px;
  border: 1.5px solid var(--border,#e2e8f0);
  border-radius: 20px;
  color: var(--primary,#2563eb);
  background: var(--surface,#fff);
  font-weight: 600;
  cursor: pointer;
  transition: background .15s;
}
.mov-toggle-btn:hover { background: #eff6ff; }

/* Legado — ya no se usan pero se mantienen para no romper nada */
.mov-usuario { font-weight: 600; color: var(--text,#1a202c); }
.mov-metodo  { color: var(--text-muted,#64748b); white-space: nowrap; }
.mov-desc    { color: var(--text-muted,#64748b); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ════════════════════════════════════════════════════════
   ADMIN SECTION — TABS, INLINE FORMS, EDIT MODAL
   ════════════════════════════════════════════════════════ */

/* Header */
.adm-header h2 { margin: 0 0 .6rem; }

/* Sub-tabs */
.adm-tabs {
  display: flex;
  gap: .2rem;
  flex-wrap: wrap;
  border-bottom: 2px solid var(--border, #e2e8f0);
  margin-bottom: 1rem;
  padding-bottom: 2px;
}
.adm-tab {
  background: transparent;
  border: 1px solid var(--border, #e2e8f0);
  border-bottom: none;
  border-radius: .4rem .4rem 0 0;
  padding: .32rem .75rem;
  font-size: .82rem;
  cursor: pointer;
  color: var(--text-muted, #64748b);
  transition: background .12s, color .12s;
  line-height: 1.4;
}
.adm-tab:hover { background: var(--surface, #f4f6f9); color: var(--text, #1a202c); }
.adm-tab.active {
  background: var(--primary, #1a7a6e);
  color: #fff;
  border-color: var(--primary, #1a7a6e);
  font-weight: 600;
}

/* Panel bar (title + new button) */
.adm-panel-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: .5rem;
}
.adm-panel-title { font-weight: 600; font-size: .95rem; }
.adm-new-btn { font-size: .78rem; padding: .28rem .65rem; }

/* Buscador del panel de productos admin */
.adm-panel-bar #adminProductSearch {
  max-width: 300px;
  flex: 1;
  min-width: 0;
}

/* Admin productos: pills de filtro por categoría */
#adminProductCategoryFilters {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 8px;
  padding: 10px 0 14px;
  border-bottom: 1px solid var(--border, #e2e8f0);
  margin-bottom: 6px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
#adminProductCategoryFilters::-webkit-scrollbar {
  display: none;
}
#adminProductCategoryFilters .btn {
  flex: 0 0 auto;
  white-space: nowrap;
  font-size: 0.82rem;
  padding: 5px 15px;
  min-height: 30px;
  line-height: 1.3;
  border-radius: 20px;
}

/* Inline create form */
.adm-inline-form {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  align-items: center;
  background: var(--surface, #f9fafb);
  border: 1px solid var(--border, #e2e8f0);
  border-radius: .4rem;
  padding: .45rem .65rem;
  margin-bottom: .65rem;
}
.adm-inline-form input,
.adm-inline-form select {
  padding: .28rem .45rem;
  font-size: .83rem;
  border: 1px solid var(--border, #cbd5e1);
  border-radius: .3rem;
  flex: 1 1 110px;
  min-width: 0;
  background: #fff;
}
.adm-inline-form select { flex: 0 1 auto; }
.adm-inline-form .btn {
  padding: .28rem .65rem;
  font-size: .78rem;
  flex-shrink: 0;
}

/* Compact admin tables */
#adminSection table {
  width: 100%;
  border-collapse: collapse;
  font-size: .83rem;
}
#adminSection th,
#adminSection td {
  padding: .3rem .5rem;
  border-bottom: 1px solid var(--border, #e2e8f0);
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}
#adminSection th {
  background: var(--surface, #f4f6f9);
  font-weight: 600;
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  white-space: nowrap;
}
#adminSection tr:hover td { background: var(--surface, #f9fafb); }
#adminSection .actions-inline { gap: .25rem; }
#adminSection .actions-inline .btn {
  padding: .18rem .45rem;
  font-size: .75rem;
}

/* Admin edit modal */
.adm-edit-card {
  min-width: 290px;
  max-width: 500px;
  width: 96%;
}
.adm-edit-fields {
  display: flex;
  flex-direction: column;
  gap: .7rem;
  margin: .8rem 0;
}
.adm-edit-fields label {
  display: flex;
  flex-direction: column;
  gap: .28rem;
  font-size: .84rem;
  font-weight: 600;
  color: var(--text-muted, #64748b);
}
.adm-edit-fields label input,
.adm-edit-fields label select {
  padding: .45rem .6rem;
  border: 1px solid var(--border, #cbd5e1);
  border-radius: .4rem;
  font-size: .92rem;
  background: #fff;
  color: var(--text, #1a202c);
  min-height: 40px;
}
.adm-edit-fields label input:focus,
.adm-edit-fields label select:focus {
  outline: 2px solid var(--primary, #1a7a6e);
  outline-offset: -1px;
  border-color: var(--primary, #1a7a6e);
}
.adm-toggle-row {
  flex-direction: row !important;
  align-items: center !important;
  justify-content: space-between;
}
.adm-toggle-row input[type="checkbox"] {
  width: 1.2rem;
  height: 1.2rem;
  cursor: pointer;
  accent-color: var(--primary, #1a7a6e);
}
.adm-warn {
  background: #fef9c3;
  border: 1px solid #fbbf24;
  border-radius: .4rem;
  padding: .5rem .7rem;
  font-size: .82rem;
  color: #78350f;
  line-height: 1.5;
}

/* ════════════════════════════════════════════════════════
   ADMIN DASHBOARD: CUADRÍCULA DE TARJETAS DE ACCESO
   ════════════════════════════════════════════════════════ */

.adm-header-sub {
  margin: -.2rem 0 .8rem;
  font-size: .85rem;
  color: var(--text-muted, #64748b);
}

.adm-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1rem;
  padding: .5rem 0 1.5rem;
}

.adm-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .45rem;
  padding: 1.4rem 1rem;
  background: var(--surface, #f9fafb);
  border: 1.5px solid var(--border, #e2e8f0);
  border-radius: .75rem;
  cursor: pointer;
  transition: background .14s, border-color .14s, box-shadow .14s, transform .1s;
  text-align: center;
  font-family: inherit;
}
.adm-card:hover {
  background: #e8f5f3;
  border-color: var(--primary, #1a7a6e);
  box-shadow: 0 4px 14px rgba(26,122,110,.14);
  transform: translateY(-2px);
}
.adm-card:active { transform: translateY(0); box-shadow: none; }

.adm-card-icon {
  font-size: 2rem;
  line-height: 1;
}
.adm-card-label {
  font-weight: 700;
  font-size: .92rem;
  color: var(--text, #1a202c);
}
.adm-card-desc {
  font-size: .74rem;
  color: var(--text-muted, #64748b);
  line-height: 1.3;
}

/* ════════════════════════════════════════════════════════
   ADMIN SECTION MODAL — tabla grande dentro de overlay
   ════════════════════════════════════════════════════════ */

.adm-section-card {
  width: 96%;
  max-width: 960px;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 0;
}

.adm-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  padding: 1rem 1.2rem .75rem;
  border-bottom: 1px solid var(--border, #e2e8f0);
  flex-shrink: 0;
}
.adm-section-header h3 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text, #1a202c);
}

.adm-section-actions {
  display: flex;
  gap: .5rem;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

#adminSectionSearch {
  padding: .38rem .6rem;
  border: 1px solid var(--border, #cbd5e1);
  border-radius: .4rem;
  font-size: .85rem;
  min-width: 160px;
  max-width: 240px;
  width: 100%;
  background: #fff;
  color: var(--text, #1a202c);
}
#adminSectionSearch:focus {
  outline: 2px solid var(--primary, #1a7a6e);
  outline-offset: -1px;
  border-color: var(--primary, #1a7a6e);
}

#adminSectionCategoryFilters {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 8px;
  padding: 10px 1.2rem 12px;
  border-bottom: 1px solid var(--border, #e2e8f0);
  flex-shrink: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
#adminSectionCategoryFilters::-webkit-scrollbar {
  display: none;
}
#adminSectionCategoryFilters .btn {
  flex: 0 0 auto;
  white-space: nowrap;
  font-size: 0.8rem;
  padding: 4px 14px;
  min-height: 28px;
  border-radius: 20px;
}

.adm-section-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: .5rem .6rem;
}

/* Tabla dentro del modal de sección */
#adminSectionTableContainer table {
  width: 100%;
  border-collapse: collapse;
  font-size: .83rem;
}
#adminSectionTableContainer th,
#adminSectionTableContainer td {
  padding: .32rem .55rem;
  border-bottom: 1px solid var(--border, #e2e8f0);
  text-align: left;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#adminSectionTableContainer th {
  background: var(--surface, #f4f6f9);
  font-weight: 600;
  font-size: .74rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 1;
}
#adminSectionTableContainer tr:hover td { background: var(--surface, #f9fafb); }
#adminSectionTableContainer .actions-inline {
  display: flex;
  gap: .25rem;
  flex-wrap: wrap;
}
#adminSectionTableContainer .actions-inline .btn {
  padding: .18rem .45rem;
  font-size: .74rem;
}

/* Responsivo: modal como bottom-sheet en móvil */
@media (max-width: 600px) {
  .adm-card-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: .6rem;
  }
  .adm-card {
    padding: 1rem .6rem;
  }
  .adm-card-icon { font-size: 1.5rem; }
  .adm-card-label { font-size: .82rem; }
  .adm-card-desc { display: none; }

  .adm-section-card {
    width: 100%;
    max-width: 100%;
    max-height: 92vh;
    border-radius: 1rem 1rem 0 0;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
  }
  .adm-section-header {
    padding: .75rem 1rem .6rem;
    flex-wrap: wrap;
    gap: .5rem;
  }
  .adm-section-actions {
    width: 100%;
    justify-content: flex-start;
  }
  #adminSectionSearch {
    flex: 1;
    min-width: 0;
    max-width: none;
  }
  #adminSectionCategoryFilters {
    padding: 8px 1rem 10px;
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
  }
}

/* ── Delete Auth Modal — tabs ─────────────────────────────────────────────── */
.delete-auth-tabs {
  display: flex;
  gap: .3rem;
  margin: .5rem 0 .7rem;
  border-bottom: 2px solid var(--border, #e2e8f0);
  padding-bottom: 2px;
}
.delete-auth-tab {
  background: transparent;
  border: 1px solid var(--border, #e2e8f0);
  border-bottom: none;
  border-radius: .35rem .35rem 0 0;
  padding: .25rem .7rem;
  font-size: .8rem;
  cursor: pointer;
  color: var(--text-muted, #64748b);
  transition: background .1s, color .1s;
}
.delete-auth-tab:hover { background: var(--surface, #f4f6f9); }
.delete-auth-tab.active {
  background: var(--primary, #1a7a6e);
  color: #fff;
  border-color: var(--primary, #1a7a6e);
  font-weight: 600;
}

/* ============================================================
   DASHBOARD CHARTS
   ============================================================ */

.dash-panel-head {
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-start;
}

.dash-filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.dash-filters select,
.dash-filters input[type="date"] {
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  font-size: 0.85rem;
  color: var(--text);
}

.dash-custom-range {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

/* ─── Estado de Cuenta IA ──────────────────────────────────────────────────── */
.dash-session-report-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 20px;
}

.dsr-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  background: linear-gradient(135deg, #1e3a5f 0%, #1d4ed8 100%);
  flex-wrap: wrap;
}

.dsr-title-wrap {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: 1;
  min-width: 0;
}

.dsr-icon {
  font-size: 2rem;
  line-height: 1;
  flex-shrink: 0;
}

.dsr-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.01em;
}

.dsr-subtitle {
  margin: 2px 0 0;
  font-size: 0.75rem;
  color: rgba(255,255,255,0.72);
  line-height: 1.4;
}

.dsr-btn {
  background: rgba(255,255,255,0.15);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.35);
  border-radius: 8px;
  padding: 9px 18px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s;
}

.dsr-btn:hover {
  background: rgba(255,255,255,0.28);
}

.dsr-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.dsr-btn-icon { margin-right: 4px; }

.dsr-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  padding: 12px 20px 14px;
  background: #f8fafc;
  border-bottom: 1px solid var(--border, #e5e7eb);
}

.dsr-range-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.dsr-range-pill {
  appearance: none;
  border: 1px solid #cbd5e1;
  background: #fff;
  color: #334155;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
  line-height: 1;
  margin: 0;
  width: auto !important;
}

.dsr-range-pill:hover {
  background: #eef2ff;
  border-color: #a5b4fc;
  color: #1e3a8a;
}

.dsr-range-pill.active {
  background: linear-gradient(135deg, #1e3a5f 0%, #1d4ed8 100%);
  color: #fff;
  border-color: #1d4ed8;
  box-shadow: 0 2px 6px rgba(29,78,216,0.25);
}

.dsr-custom-dates {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  color: #334155;
  font-size: 0.8rem;
}

.dsr-custom-dates label {
  display: inline-flex !important;
  align-items: center;
  gap: 6px;
  margin: 0;
  color: #475569;
  font-weight: 500;
}

.dsr-custom-dates input[type="date"] {
  appearance: none;
  border: 1px solid #cbd5e1;
  background: #fff;
  color: #1e293b;
  padding: 5px 8px;
  border-radius: 8px;
  font-size: 0.8rem;
  width: auto !important;
}

.dsr-dash {
  color: #94a3b8;
  font-weight: 600;
}

.dsr-body {
  padding: 20px;
}

.dsr-loading {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 0;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.dsr-spinner {
  width: 28px;
  height: 28px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  flex-shrink: 0;
}

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

/* Render del reporte IA */
.dsr-result {
  font-size: 0.92rem;
  line-height: 1.65;
  color: var(--text);
}

.dsr-result .dsr-h {
  font-weight: 800;
  color: #0f172a;
  letter-spacing: -0.01em;
  margin: 22px 0 8px;
}

.dsr-result .dsr-h1 {
  font-size: 1.35rem;
  color: #1e3a5f;
  padding-bottom: 8px;
  border-bottom: 2px solid #3b82f6;
  margin: 8px 0 16px;
}

.dsr-result .dsr-h2 {
  font-size: 1.08rem;
  color: #1e3a5f;
  padding: 8px 12px;
  background: linear-gradient(90deg, #eff6ff 0%, rgba(239, 246, 255, 0) 100%);
  border-left: 4px solid #3b82f6;
  border-radius: 0 8px 8px 0;
  margin: 20px 0 10px;
}

.dsr-result .dsr-h3 {
  font-size: 0.98rem;
  color: #334155;
  margin: 16px 0 6px;
}

.dsr-result .dsr-h4 {
  font-size: 0.9rem;
  color: #475569;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin: 14px 0 4px;
}

.dsr-result h2:first-child,
.dsr-result h3:first-child,
.dsr-result h4:first-child { margin-top: 0; }

.dsr-result ul,
.dsr-result ol {
  margin: 8px 0 14px;
  padding-left: 22px;
}
.dsr-result ul { list-style: none; padding-left: 4px; }
.dsr-result ul li {
  position: relative;
  padding-left: 18px;
  margin-bottom: 5px;
}
.dsr-result ul li::before {
  content: '';
  position: absolute;
  left: 4px;
  top: 10px;
  width: 6px;
  height: 6px;
  background: #3b82f6;
  border-radius: 50%;
}
.dsr-result ol li { margin-bottom: 5px; }

.dsr-result p { margin: 8px 0; }

.dsr-result strong {
  color: #0f172a;
  font-weight: 700;
}

.dsr-result code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.85em;
  background: #f1f5f9;
  color: #1e3a5f;
  padding: 1px 6px;
  border-radius: 4px;
}

.dsr-result .dsr-hr {
  border: 0;
  border-top: 1px dashed #cbd5e1;
  margin: 18px 0;
}

.dsr-result .dsr-quote {
  margin: 10px 0;
  padding: 10px 14px;
  background: #f8fafc;
  border-left: 3px solid #94a3b8;
  border-radius: 0 6px 6px 0;
  color: #475569;
  font-style: italic;
}

.dsr-alert {
  padding: 10px 14px;
  border-radius: 0 8px 8px 0;
  margin: 10px 0;
  font-size: 0.9rem;
  line-height: 1.5;
}

.dsr-alert-warn {
  background: #fef3c7;
  border-left: 4px solid #f59e0b;
  color: #78350f;
}

.dsr-alert-ok {
  background: #dcfce7;
  border-left: 4px solid #16a34a;
  color: #14532d;
}

.dsr-alert-goal {
  background: #ede9fe;
  border-left: 4px solid #7c3aed;
  color: #4c1d95;
}

.dsr-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.dsr-btn-refresh {
  background: var(--surface-alt, #f1f5f9);
  color: var(--text);
  border: 1px solid var(--border);
}

/* ─────────────────────────────────────────────────────────────────────────── */

.dash-kpi-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin: 16px 0;
}

.dash-kpi-card {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 12px 14px;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
  overflow: hidden;
}

.dash-kpi-icon {
  font-size: 1.6rem;
  line-height: 1;
  flex-shrink: 0;
}

.dash-kpi-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

.dash-kpi-label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dash-kpi-value {
  font-size: clamp(0.95rem, 2.2vw, 1.25rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  word-break: break-word;
  line-height: 1.2;
}

.dash-kpi-blue  .dash-kpi-value { color: #2563EB; }
.dash-kpi-green .dash-kpi-value { color: #10b981; }
.dash-kpi-red   .dash-kpi-value { color: #ef4444; }
.dash-kpi-purple .dash-kpi-value { color: #7c3aed; }
.dash-kpi-amber  .dash-kpi-value { color: #d97706; }
.dash-kpi-teal   .dash-kpi-value { color: #0d9488; }
.dash-kpi-orange .dash-kpi-value { color: #ea580c; }

.dash-charts-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 4px;
}

.dash-chart-wide {
  grid-column: 1 / -1;
}

.dash-chart-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 16px 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
}

.dash-chart-card h3 {
  margin: 0 0 12px;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-secondary);
}

.dash-chart-wrap {
  position: relative;
  height: 260px;
}

/* Make doughnut & flujo-dia chart a bit shorter */
.dash-chart-card:not(.dash-chart-wide) .dash-chart-wrap {
  height: 240px;
}

.dash-users-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.dash-users-table th,
.dash-users-table td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  text-align: left;
}

.dash-users-table th {
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-secondary);
  background: var(--bg);
}

.dash-users-table tbody tr:hover {
  background: var(--bg);
}

.dash-rank {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(37,99,235,.12);
  color: #2563EB;
  font-size: 0.7rem;
  font-weight: 700;
  flex-shrink: 0;
  margin-right: 4px;
}

/* ── Análisis de rentabilidad ────────────────────────────── */
.profit-pnl {
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 16px;
  font-size: .9rem;
}
.profit-pnl-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 16px;
  border-bottom: 1px solid #f1f5f9;
  gap: 12px;
}
.profit-pnl-row:last-child { border-bottom: none; }
.profit-pnl-ing { background: #f0fdf4; color: #15803d; font-weight: 600; }
.profit-pnl-total { font-weight: 700; font-size: 1rem; }
.profit-pnl-divider { height: 2px; background: #e2e8f0; }
.profit-pnl-row small { font-size: .75rem; color: #94a3b8; }

.profit-alert {
  border-radius: 8px;
  padding: 10px 14px;
  font-size: .85rem;
  margin-bottom: 14px;
  line-height: 1.5;
}
.profit-alert--ok  { background: #f0fdf4; color: #15803d; border: 1px solid #bbf7d0; }
.profit-alert--warn{ background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }
.profit-alert--err { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }

.profit-section-title {
  font-size: .82rem;
  font-weight: 700;
  color: #475569;
  text-transform: uppercase;
  letter-spacing: .04em;
  margin: 14px 0 8px;
}
.profit-salaries-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 6px;
}
.profit-salary-chip {
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: .83rem;
}

/* ── Análisis de Rentabilidad IA ─────────────────────────────── */
.profit-ai-section {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--border, #e2e8f0);
}
.profit-ai-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}
.profit-ai-loading {
  padding: 14px;
  color: #2563eb;
  font-size: .88rem;
  background: #eff6ff;
  border-radius: 8px;
  animation: pulse 1.4s ease-in-out infinite;
}
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.5} }
.profit-ai-error {
  padding: 12px;
  background: #fef2f2;
  color: #991b1b;
  border-radius: 8px;
  font-size: .85rem;
}
.profit-ai-result-wrap { margin-top: 4px; }
.profit-ai-verdict {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  background: #f8fafc;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 10px;
  padding: 12px 16px;
  margin-bottom: 12px;
}
.profit-ai-verdict-label {
  font-size: .9rem;
  font-weight: 700;
  margin-bottom: 4px;
}
.profit-ai-resumen {
  font-size: .83rem;
  color: #475569;
  line-height: 1.5;
}
.profit-ai-score {
  display: flex;
  align-items: baseline;
  gap: 2px;
  flex-shrink: 0;
}
.profit-ai-score-num {
  font-size: 2rem;
  font-weight: 800;
  line-height: 1;
}
.profit-ai-score-label {
  font-size: .9rem;
  color: #94a3b8;
  font-weight: 600;
}
.profit-ai-tags-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 10px;
}
.profit-ai-tag {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 20px;
  font-size: .75rem;
  font-weight: 600;
  margin: 2px 3px 2px 0;
}
.profit-ai-recs {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}
.profit-ai-rec {
  background: #f0fdf4;
  border-left: 3px solid #16a34a;
  border-radius: 0 8px 8px 0;
  padding: 8px 12px;
}
.profit-ai-rec-title {
  font-weight: 700;
  font-size: .84rem;
  color: #15803d;
}
.profit-ai-rec-detail {
  font-size: .8rem;
  color: #475569;
  margin-top: 3px;
  line-height: 1.4;
}
.profit-ai-disclaimer {
  font-size: .72rem;
  color: #94a3b8;
  margin-top: 12px;
  line-height: 1.4;
}

.dash-insights-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
  padding: 4px 0;
}

.dash-insight-card {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 14px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  border-left: 4px solid #e2e8f0;
  background: var(--surface);
  box-shadow: 0 1px 3px rgba(0,0,0,.05);
}

.dash-insight-icon {
  font-size: 1.5rem;
  line-height: 1;
  flex-shrink: 0;
  margin-top: 1px;
}

.dash-insight-title {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-secondary);
  margin-bottom: 5px;
}

.dash-insight-text {
  font-size: 0.84rem;
  color: var(--text);
  line-height: 1.55;
}

.dash-insight-amber  { border-left-color: #f59e0b; }
.dash-insight-green  { border-left-color: #10b981; }
.dash-insight-blue   { border-left-color: #2563EB; }
.dash-insight-purple { border-left-color: #7c3aed; }
.dash-insight-teal   { border-left-color: #0d9488; }
.dash-insight-orange { border-left-color: #ea580c; }
.dash-insight-indigo { border-left-color: #4f46e5; }
.dash-insight-pink   { border-left-color: #db2777; }

.text-right { text-align: right !important; }
.text-center { text-align: center !important; }
.text-green { color: #10b981; font-weight: 600; }

.role-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  background: rgba(37,99,235,.1);
  color: #2563EB;
}

/* Responsive: stack charts on small screens */

/* ── Tablet ≤ 900px ─────────────────────────────────────────── */
@media (max-width: 900px) {
  .dash-kpi-row {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .dash-chart-wrap { height: 220px; }
  .dash-chart-card:not(.dash-chart-wide) .dash-chart-wrap { height: 200px; }

  .dash-filters select,
  .dash-filters input[type="date"] {
    font-size: 0.82rem;
    padding: 5px 8px;
  }
}

/* ── Tablet pequeña ≤ 700px ─────────────────────────────────── */
@media (max-width: 700px) {
  .dash-charts-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .dash-chart-wide { grid-column: unset; }

  .dash-chart-wrap { height: 200px; }
  .dash-chart-card:not(.dash-chart-wide) .dash-chart-wrap { height: 200px; }

  .dash-chart-card {
    padding: 12px 12px 10px;
  }
}

/* ── Móvil ≤ 540px ──────────────────────────────────────────── */
@media (max-width: 540px) {
  /* Cabecera del panel */
  .dash-panel-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 0;
  }

  /* Filtros: apilados verticalmente, ancho completo */
  .dash-filters {
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    width: 100%;
  }
  .dash-filters select,
  .dash-filters input[type="date"] {
    width: 100%;
    font-size: 1rem;       /* ≥16px evita zoom en iOS */
    padding: 8px 10px;
    height: 40px;
    box-sizing: border-box;
  }
  .dash-custom-range {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
  }
  .dash-custom-range input[type="date"] {
    flex: 1;
    min-width: 130px;
  }
  .dash-filters .btn {
    width: 100%;
    justify-content: center;
  }

  /* KPI: 2 columnas en móvil — valores visibles completos */
  .dash-kpi-row {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin: 12px 0;
  }
  .dash-kpi-card {
    padding: 9px 10px;
    gap: 7px;
  }
  .dash-kpi-icon  { font-size: 1.2rem; }
  .dash-kpi-value { font-size: clamp(0.88rem, 3.5vw, 1.05rem); }
  .dash-kpi-label { font-size: 0.65rem; }

  /* Gráficas */
  .dash-charts-grid { gap: 8px; max-width: 100%; overflow: hidden; }
  .dash-chart-wrap  { height: 180px; max-width: 100%; overflow: hidden; }
  .dash-chart-card:not(.dash-chart-wide) .dash-chart-wrap { height: 180px; }
  .dash-chart-card  { padding: 10px 10px 8px; max-width: 100%; overflow: hidden; box-sizing: border-box; }
  .dash-chart-card h3 { font-size: 0.75rem; margin-bottom: 8px; }
  .dash-chart-card canvas { max-width: 100% !important; }
  .dash-insights-grid {
    grid-template-columns: 1fr;
  }

  /* Tabla de rendimiento por usuario → tarjetas */
  .dash-users-table thead { display: none; }
  .dash-users-table,
  .dash-users-table tbody { display: block; }
  .dash-users-table tr {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px 10px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-bottom: 8px;
    background: var(--surface);
    font-size: 0.82rem;
  }
  .dash-users-table td {
    border: none;
    padding: 0;
    white-space: normal;
    word-break: break-word;
  }
  /* Primera celda (nombre) ocupa las 2 columnas */
  .dash-users-table td:first-child {
    grid-column: 1 / -1;
    font-weight: 700;
    font-size: 0.88rem;
    padding-bottom: 4px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 2px;
  }
  .dash-users-table td::before {
    display: block;
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--text-secondary);
    margin-bottom: 2px;
  }
  .dash-users-table td:nth-child(2)::before { content: "Rol"; }
  .dash-users-table td:nth-child(3)::before { content: "Pedidos"; }
  .dash-users-table td:nth-child(4)::before { content: "Total ventas"; }
  .dash-users-table td:nth-child(5)::before { content: "Ticket prom."; }
}

/* ── Móvil muy pequeño ≤ 380px ──────────────────────────────── */
@media (max-width: 380px) {
  .dash-kpi-row { gap: 5px; }
  .dash-kpi-card { padding: 7px 8px; gap: 5px; }
  .dash-kpi-icon  { font-size: 1rem; }
  .dash-kpi-value { font-size: clamp(0.82rem, 4vw, 0.95rem); }
  .dash-kpi-label { font-size: 0.6rem; }
  .dash-chart-wrap { height: 155px; }
}

/* ════════════════════════════════════════════════════════════
   NUEVO MOVIMIENTO — Flujo visual por rol
   ════════════════════════════════════════════════════════════ */

.mov-form-card {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1.25rem 1.4rem;
  margin-bottom: 1.5rem;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 2px 10px rgba(0,0,0,.07);
  border: 1.5px solid #e2e8f0;
  max-width: 580px;
}

.mov-form-title {
  font-weight: 800;
  font-size: 1rem;
  color: #1a202c;
  letter-spacing: -.2px;
}

/* ── Tipo: INGRESO / EGRESO ── */
.mov-type-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: .75rem;
}

.mov-type-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .25rem;
  padding: .9rem .5rem;
  border-radius: 12px;
  border: 2.5px solid #e2e8f0;
  background: #f8fafc;
  cursor: pointer;
  transition: border-color .1s ease, background .1s ease, transform .1s ease;
  line-height: 1.2;
}

.mov-type-btn:hover { transform: translateY(-1px); }

.mov-type-icon  { font-size: 1.6rem; }
.mov-type-label { font-weight: 700; font-size: .95rem; color: #374151; }
.mov-type-hint  { font-size: .72rem; color: #94a3b8; }

/* Activo INGRESO */
.mov-type-btn.mov-type-ingreso.active {
  border-color: #16a34a;
  background: #f0fdf4;
  box-shadow: 0 0 0 3px rgba(22,163,74,.15);
}
.mov-type-btn.mov-type-ingreso.active .mov-type-label { color: #15803d; }

/* Activo EGRESO */
.mov-type-btn.mov-type-egreso.active {
  border-color: #dc2626;
  background: #fff1f2;
  box-shadow: 0 0 0 3px rgba(220,38,38,.15);
}
.mov-type-btn.mov-type-egreso.active .mov-type-label { color: #b91c1c; }

.mov-type-btn.mov-type-transfer.active {
  border-color: #2563eb;
  background: #eff6ff;
  box-shadow: 0 0 0 3px rgba(37,99,235,.16);
}
.mov-type-btn.mov-type-transfer.active .mov-type-label { color: #1d4ed8; }

/* ── Monto ── */
.mov-amount-wrap {
  display: flex;
  align-items: center;
  gap: 0;
  border: 2px solid #e2e8f0;
  border-radius: 10px;
  overflow: hidden;
  transition: border-color .15s;
}
.mov-amount-wrap:focus-within { border-color: #0f5d52; }

.mov-currency {
  padding: 0 .75rem;
  font-size: 1.3rem;
  font-weight: 700;
  color: #6b7280;
  background: #f1f5f9;
  height: 52px;
  display: flex;
  align-items: center;
  border-right: 2px solid #e2e8f0;
  user-select: none;
}

.mov-amount-input {
  flex: 1;
  border: none;
  outline: none;
  padding: 0 1rem;
  font-size: 1.5rem;
  font-weight: 700;
  color: #1a202c;
  height: 52px;
  background: transparent;
  width: 100%;
}
.mov-amount-input::placeholder { color: #cbd5e1; font-weight: 400; font-size: 1.3rem; }

/* ── Sección label ── */
.mov-section-label {
  display: block;
  font-size: .78rem;
  font-weight: 700;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: .35rem;
}
.mov-section-label small {
  text-transform: none;
  font-weight: 400;
  letter-spacing: 0;
  color: #94a3b8;
}

/* ── Método: pills ── */
.mov-method-pills {
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
}

.mov-method-pill {
  padding: .35rem .85rem;
  border-radius: 9999px;
  border: 1.5px solid #e2e8f0;
  background: #f1f5f9;
  color: #374151;
  font-size: .83rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color .1s ease, background .1s ease, color .1s ease;
  white-space: nowrap;
}
.mov-method-pill:hover { border-color: #94a3b8; background: #e2e8f0; }
.mov-method-pill.active {
  border-color: #0f5d52;
  background: #0f5d52;
  color: #fff;
}

/* ── Referencia de usuario ── */
.mov-ref-select {
  width: 100%;
  height: 38px;
  border: 1.5px solid #e2e8f0;
  border-radius: 8px;
  padding: 0 .75rem;
  font-size: .88rem;
  background: #fff;
  color: #374151;
  outline: none;
  transition: border-color .15s;
}
.mov-ref-select:focus { border-color: #0f5d52; }

/* ── Descripción ── */
.mov-desc-input {
  width: 100%;
  height: 38px;
  border: 1.5px solid #e2e8f0;
  border-radius: 8px;
  padding: 0 .75rem;
  font-size: .88rem;
  color: #1a202c;
  background: #fff;
  outline: none;
  transition: border-color .15s;
  box-sizing: border-box;
}
.mov-desc-input:focus { border-color: #0f5d52; }
.mov-desc-input::placeholder { color: #94a3b8; }

/* ── Botón submit ── */
.mov-submit-btn {
  width: 100%;
  height: 48px;
  font-size: 1rem;
  font-weight: 700;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  letter-spacing: .02em;
  transition: background .15s, transform .1s;
}
.mov-submit-btn:active { transform: scale(.98); }

.mov-submit-ingreso {
  background: #16a34a;
  color: #fff;
}
.mov-submit-ingreso:hover { background: #15803d; }

.mov-submit-egreso {
  background: #dc2626;
  color: #fff;
}
.mov-submit-egreso:hover { background: #b91c1c; }

.mov-submit-transfer {
  background: #2563eb;
  color: #fff;
}
.mov-submit-transfer:hover { background: #1d4ed8; }

.cash-transfer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: .85rem;
}

.cash-transfer-field {
  display: flex;
  flex-direction: column;
  gap: .4rem;
  color: #475569;
  font-size: .85rem;
  font-weight: 600;
}

.cash-transfer-field small {
  color: #94a3b8;
  font-weight: 500;
}

@media (max-width: 500px) {
  .mov-form-card { padding: 1rem; }
  .mov-type-row  { grid-template-columns: 1fr; gap: .5rem; }
  .mov-amount-input { font-size: 1.2rem; }
  .mov-currency     { font-size: 1.1rem; }
}

/* ================================================================
   RESPONSIVE COMPLETO — Celulares · Tablets · Laptops
   Breakpoints: 1200 | 1024 | 900 | 768 | 640 | 600 | 520 | 480 | 400 | 360
   ================================================================ */

/* ── Global: sin desbordamiento horizontal ──────────────────────── */
/* IMPORTANTE: usar max-width:100% (no 100vw) — en mobile 100vw puede
   ser mayor que 100% por el ancho del scrollbar o safe-area, causando
   un desfase de 1-15px hacia la derecha */
html {
  overflow-x: hidden;
  width: 100%;
}
body {
  overflow-x: hidden;
  width: 100%;
  max-width: 100%;
  position: relative;
}

/* ── Respuesta táctil en todos los dispositivos ─────────────────── */
.btn,
button,
[role="button"] {
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

/* ================================================================
   LAPTOP GRANDE: 1025px – 1200px
   Pequeños ajustes para monitores compactos
   ================================================================ */
@media (min-width: 1025px) and (max-width: 1200px) {
  .container {
    padding: clamp(16px, 2.5vw, 24px);
  }
  .mesero-layout {
    grid-template-columns: 1fr 280px;
  }
  .dash-kpi-row {
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  }
}

/* ================================================================
   LAPTOP / TABLET HORIZONTAL: 901px – 1024px
   ================================================================ */
@media (min-width: 901px) and (max-width: 1024px) {
  .container {
    padding: clamp(14px, 2vw, 20px);
  }
  .topbar h1 {
    font-size: 0.95rem;
  }
  .mesero-layout {
    grid-template-columns: 1fr 260px;
  }
  .dash-charts-grid {
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }
  .dash-kpi-row {
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 10px;
  }
  .catalog-products-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  }
  #cashBalanceTable {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  }
}


/* ================================================================
   TABLET: 768px – 900px
   ================================================================ */
@media (min-width: 768px) and (max-width: 900px) {
  .container {
    padding: 14px;
  }
  .topbar {
    padding: 0 16px;
  }
  .topbar h1 {
    font-size: 0.92rem;
  }
  .topbar p {
    font-size: 0.72rem;
  }
  /* Tabs: scroll para que no se corten */
  .tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    padding: 4px 6px;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
    touch-action: pan-x;
    scroll-behavior: smooth;
  }
  .tabs::-webkit-scrollbar { display: none; }
  .tab {
    flex: 0 0 auto;
    padding: 8px 14px;
    font-size: 0.82rem;
    white-space: nowrap;
  }
  /* Mesero: columna única en tablet vertical */
  .mesero-layout {
    grid-template-columns: 1fr;
  }
  .mesero-right {
    position: static;
  }
  .mesero-items-list {
    max-height: 360px;
  }
  /* Dashboard: gráficas 1 columna en tablet */
  .dash-charts-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .dash-chart-wide {
    grid-column: unset;
  }
  .dash-kpi-row {
    grid-template-columns: 1fr 1fr 1fr;
    gap: 10px;
  }
  /* Catálogo */
  .catalog-products-grid {
    grid-template-columns: repeat(auto-fill, minmax(136px, 1fr));
  }
  /* Caja balance */
  #cashBalanceTable {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  }
  /* Movimientos: compactar texto */
  .mov-row { font-size: 0.78rem; }
  /* Admin inline form */
  .adm-inline-form {
    flex-wrap: wrap;
    gap: 6px;
  }
  /* Botones mínimo táctil */
  .btn:not(.btn-sm):not(.btn-close-modal):not(.order-qty-btn):not(.catalog-qty-btn) {
    min-height: 42px;
  }
  /* Store layout de tienda */
  .store-layout {
    grid-template-columns: 1.2fr 1fr;
    gap: 14px;
  }
}

/* ================================================================
   TABLET PEQUEÑA / MÓVIL HORIZONTAL: ≤ 767px
   ================================================================ */
@media (max-width: 767px) {
  /* Tabs: scroll horizontal */
  .tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
    touch-action: pan-x;
    scroll-behavior: smooth;
    scrollbar-width: none;
    padding: 4px 6px;
    gap: 3px;
  }
  .tabs::-webkit-scrollbar { display: none; }
  .tab {
    flex: 0 0 auto;
    min-height: 40px;
    padding: 8px 12px;
    font-size: 0.8rem;
    white-space: nowrap;
  }
  /* Botones: áreas táctiles ≥ 44px */
  .btn:not(.btn-sm):not(.btn-close-modal):not(.wa-modal-close):not(.catalog-close-btn):not(.order-qty-btn):not(.order-note-btn):not(.order-delete-btn):not(.order-dup-btn):not(.catalog-qty-btn) {
    min-height: 44px;
  }
  .send-order-btn {
    min-height: 60px;
    font-size: 1rem;
  }
  .vr-send-btn {
    min-height: 60px;
    font-size: 0.9rem;
  }
  /* Inputs: font-size 16px → evita zoom iOS */
  input:not([type="checkbox"]):not([type="radio"]):not([type="range"]),
  select,
  textarea {
    font-size: 16px !important;
  }
  select.cash-ctl,
  .mov-ref-select,
  .mov-desc-input {
    height: 44px !important;
  }
  .mov-amount-input {
    height: 52px;
  }
  .mesero-date-filter-row input[type="date"] {
    font-size: 16px !important;
  }
  /* Mesero: columna única */
  .mesero-layout {
    grid-template-columns: 1fr;
  }
  .mesero-right {
    position: static;
  }
  .mesero-items-list {
    max-height: 360px;
  }
  /* Dashboard: gráficas en columna */
  .dash-charts-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .dash-chart-wide {
    grid-column: unset;
  }
}

/* ================================================================
   MÓVIL GRANDE: ≤ 640px
   ================================================================ */
@media (max-width: 640px) {
  /* Movimientos de caja: compacto */
  #cashMovementsTable { overflow-x: hidden; }
  .mov-row { padding: 8px 10px; }
  .mov-row-desc { font-size: 0.74rem; }
  .mov-row .btn.btn-danger {
    min-height: 32px !important; height: 32px; width: 32px; padding: 0 !important;
  }
  /* Dashboard: KPI 2 col + filtros apilados */
  .dash-panel-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
  .dash-filters {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
  }
  .dash-filters select,
  .dash-filters input[type="date"],
  .dash-filters .btn {
    width: 100%;
    height: 44px;
    font-size: 16px !important;
  }
  .dash-custom-range {
    flex-direction: column;
    gap: 6px;
    width: 100%;
  }
  .dash-custom-range span { display: none; }
  .dash-kpi-row {
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 8px;
    margin: 10px 0;
  }
  .dash-kpi-card { padding: 10px 12px; gap: 8px; }
  .dash-kpi-icon { font-size: 1.4rem; }
  .dash-kpi-value { font-size: clamp(0.9rem, 2.5vw, 1.1rem); }
  .dash-kpi-label { font-size: 0.65rem; }
  .dash-chart-wrap { height: 200px; }
  .dash-chart-card:not(.dash-chart-wide) .dash-chart-wrap { height: 200px; }
  /* Admin tabs: scroll horizontal */
  .adm-tabs {
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 0;
    gap: 0;
  }
  .adm-tabs::-webkit-scrollbar { display: none; }
  .adm-tab {
    flex: 0 0 auto;
    padding: 8px 14px;
    font-size: 0.8rem;
    min-height: 36px;
    white-space: nowrap;
  }
  .adm-panel-bar {
    flex-wrap: wrap;
    gap: 6px;
  }
  .adm-panel-bar #adminProductSearch {
    order: 3;
    width: 100%;
    max-width: 100% !important;
    flex: 1 1 100%;
  }
  .adm-inline-form {
    flex-direction: column;
    align-items: stretch;
  }
  .adm-inline-form input,
  .adm-inline-form select { flex: 1 1 auto; width: 100%; }
  .adm-inline-form .btn { width: 100%; min-height: 40px; justify-content: center; }
  /* Tablas con scroll */
  table { min-width: 420px; }
  #adminSection table { min-width: 460px; }
  #dashUsersTable {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .dash-users-table { min-width: 400px; }
  #cashMovementsTable .mov-day-group { overflow-x: hidden; }
  /* Caja: balance apilado */
  #cashBalanceTable { grid-template-columns: 1fr; }
  .balance-total-card { flex-direction: column; align-items: flex-start; gap: 8px; }
  .balance-desglose { flex-direction: row; flex-wrap: wrap; }
  /* Filtros de categoría tienda: scroll horizontal */
  .store-filters .actions-inline {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .store-filters .actions-inline::-webkit-scrollbar { display: none; }

  /* Admin productos: panel bar → fila 1: título + botón / fila 2: buscador */
  [data-adm-panel="productos"] .adm-panel-bar {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto;
    gap: 8px;
    align-items: center;
  }
  [data-adm-panel="productos"] .adm-panel-bar .adm-panel-title {
    grid-column: 1; grid-row: 1;
  }
  [data-adm-panel="productos"] .adm-panel-bar .adm-new-btn {
    grid-column: 2; grid-row: 1;
    white-space: nowrap;
  }
  [data-adm-panel="productos"] .adm-panel-bar #adminProductSearch {
    grid-column: 1 / -1; grid-row: 2;
    max-width: 100% !important;
    width: 100%;
    order: unset; /* reset order previo */
  }

  /* Admin productos: filtros → scroll horizontal táctil */
  #adminProductCategoryFilters {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 6px;
    gap: 8px;
    /* fade lateral para indicar scroll */
    -webkit-mask-image: linear-gradient(to right, transparent 0%, black 5%, black 92%, transparent 100%);
    mask-image: linear-gradient(to right, transparent 0%, black 5%, black 92%, transparent 100%);
  }
  #adminProductCategoryFilters::-webkit-scrollbar { display: none; }
  #adminProductCategoryFilters .btn {
    flex: 0 0 auto;
    min-height: 36px;
    padding: 0 16px;
    font-size: 0.83rem;
    border-radius: 20px;
  }
}

/* ================================================================
   MÓVIL ESTÁNDAR: ≤ 600px
   ================================================================ */
@media (max-width: 600px) {
  /* Admin productos: tabla → tarjetas MEJORADAS */
  #productsTable > div { overflow: visible !important; }
  #productsTable table,
  #productsTable thead,
  #productsTable tbody,
  #productsTable tr,
  #productsTable td { display: block; }
  #productsTable table { min-width: 0 !important; width: 100%; }
  #productsTable thead { display: none; }
  #productsTable tbody { display: flex; flex-direction: column; gap: 14px; }
  #productsTable tr {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-areas:
      "nombre   nombre"
      "prest    pweb"
      "cat      area"
      "activo   activo"
      "acciones acciones";
    column-gap: 12px;
    row-gap: 0;
    border: 1px solid var(--border, #e2e8f0);
    border-radius: 12px;
    padding: 14px;
    background: #fff;
    box-shadow: 0 2px 6px rgba(0,0,0,.07);
  }
  #productsTable td {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 5px 0;
    border: none;
    white-space: normal;
    max-width: none;
    overflow: visible;
    text-overflow: unset;
    font-size: 0.85rem;
    min-width: 0;
  }
  #productsTable td::before {
    content: attr(data-label);
    font-size: 0.67rem;
    font-weight: 700;
    color: var(--text-muted, #64748b);
    text-transform: uppercase;
    letter-spacing: 0.05em;
  }
  /* Ocultar columna ID */
  #productsTable td:nth-child(1) { display: none; }
  /* Nombre: prominente, sin etiqueta */
  #productsTable td:nth-child(2) {
    grid-area: nombre;
    font-size: 1rem;
    font-weight: 700;
    color: var(--text, #1a202c);
    padding-bottom: 10px;
    margin-bottom: 2px;
    border-bottom: 1px solid var(--border, #e2e8f0);
  }
  #productsTable td:nth-child(2)::before { display: none; }
  /* Precio restaurante */
  #productsTable td:nth-child(3) { grid-area: prest; }
  /* Precio web */
  #productsTable td:nth-child(4) { grid-area: pweb; }
  /* Categoría */
  #productsTable td:nth-child(5) { grid-area: cat; }
  /* Área */
  #productsTable td:nth-child(6) { grid-area: area; }
  /* Activo: fila completa con valor inline */
  #productsTable td:nth-child(7) {
    grid-area: activo;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
    font-size: 0.82rem;
    border-top: 1px solid var(--border, #e2e8f0);
    margin-top: 2px;
  }
  /* Acciones: fila completa */
  #productsTable td:last-child {
    grid-area: acciones;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    padding-top: 10px;
    margin-top: 2px;
    border-top: 1px dashed var(--border, #e2e8f0);
  }
  #productsTable td:last-child::before { display: none; }
  #productsTable td:last-child .actions-inline {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    width: 100%;
  }
  #productsTable td:last-child .actions-inline .btn {
    flex: 1;
    min-height: 40px !important;
    justify-content: center;
    font-size: 0.8rem;
    white-space: nowrap;
  }

  /* Admin categorías: tabla → tarjetas */
  #categoriesTable > div { overflow: visible !important; }
  #categoriesTable table,
  #categoriesTable thead,
  #categoriesTable tbody,
  #categoriesTable tr,
  #categoriesTable td { display: block; }
  #categoriesTable table { min-width: 0 !important; width: 100%; }
  #categoriesTable thead { display: none; }
  #categoriesTable tbody { display: flex; flex-direction: column; gap: 10px; }
  #categoriesTable tr {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    border: 1px solid var(--border, #e2e8f0);
    border-radius: 10px;
    padding: 12px 14px;
    background: #fff;
    box-shadow: 0 1px 4px rgba(0,0,0,.06);
  }
  #categoriesTable td {
    border: none;
    white-space: normal;
    max-width: none;
    overflow: visible;
    text-overflow: unset;
    font-size: 0.88rem;
    padding: 0;
  }
  /* ID oculto */
  #categoriesTable td:nth-child(1) { display: none; }
  /* Nombre: crece y es prominente */
  #categoriesTable td:nth-child(2) {
    flex: 1 1 auto;
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text, #1a202c);
    min-width: 0;
  }
  /* Activo: badge compacto */
  #categoriesTable td:nth-child(3) {
    flex: 0 0 auto;
    font-size: 0.78rem;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 20px;
    background: var(--surface, #f0fdf4);
    color: var(--text-muted, #64748b);
    border: 1px solid var(--border, #e2e8f0);
  }
  /* Acciones: fila completa */
  #categoriesTable td:last-child {
    flex: 1 1 100%;
    padding-top: 8px;
    border-top: 1px dashed var(--border, #e2e8f0);
    margin-top: 4px;
  }
  #categoriesTable td:last-child .actions-inline {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    width: 100%;
  }
  #categoriesTable td:last-child .actions-inline .btn {
    flex: 1 1 auto;
    min-width: 80px;
    min-height: 40px !important;
    justify-content: center;
    font-size: 0.8rem;
  }

  /* Admin áreas: tabla → tarjetas */
  #areasTable > div { overflow: visible !important; }
  #areasTable table,
  #areasTable thead,
  #areasTable tbody,
  #areasTable tr,
  #areasTable td { display: block; }
  #areasTable table { min-width: 0 !important; width: 100%; }
  #areasTable thead { display: none; }
  #areasTable tbody { display: flex; flex-direction: column; gap: 10px; }
  #areasTable tr {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    border: 1px solid var(--border, #e2e8f0);
    border-radius: 10px;
    padding: 12px 14px;
    background: #fff;
    box-shadow: 0 1px 4px rgba(0,0,0,.06);
  }
  #areasTable td {
    border: none;
    white-space: normal;
    max-width: none;
    overflow: visible;
    text-overflow: unset;
    padding: 0;
  }
  /* ID oculto */
  #areasTable td:nth-child(1) { display: none; }
  /* Nombre: crece y es prominente */
  #areasTable td:nth-child(2) {
    flex: 1 1 auto;
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text, #1a202c);
    min-width: 0;
  }
  /* Tipo: badge compacto */
  #areasTable td:nth-child(3) {
    flex: 0 0 auto;
    font-size: 0.78rem;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 20px;
    background: var(--surface, #f0fdf4);
    color: var(--text-muted, #64748b);
    border: 1px solid var(--border, #e2e8f0);
    text-transform: capitalize;
  }
  /* Activo */
  #areasTable td:nth-child(4) {
    flex: 0 0 auto;
    font-size: 0.78rem;
    padding: 3px 10px;
    border-radius: 20px;
    background: var(--surface, #f0fdf4);
    color: var(--text-muted, #64748b);
    border: 1px solid var(--border, #e2e8f0);
  }
  /* Acciones: fila completa */
  #areasTable td:last-child {
    flex: 1 1 100%;
    padding-top: 8px;
    border-top: 1px dashed var(--border, #e2e8f0);
    margin-top: 4px;
  }
  #areasTable td:last-child .actions-inline {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    width: 100%;
  }
  #areasTable td:last-child .actions-inline .btn {
    flex: 1 1 auto;
    min-width: 80px;
    min-height: 40px !important;
    justify-content: center;
    font-size: 0.8rem;
  }

  /* Admin usuarios: tabla → tarjetas */
  #usersTable > div { overflow: visible !important; }
  #usersTable table,
  #usersTable thead,
  #usersTable tbody,
  #usersTable tr,
  #usersTable td { display: block; }
  #usersTable table { min-width: 0 !important; width: 100%; }
  #usersTable thead { display: none; }
  #usersTable tbody { display: flex; flex-direction: column; gap: 10px; }
  #usersTable tr {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    border: 1px solid var(--border, #e2e8f0);
    border-radius: 10px;
    padding: 12px 14px;
    background: #fff;
    box-shadow: 0 1px 4px rgba(0,0,0,.06);
  }
  #usersTable td {
    border: none;
    white-space: normal;
    max-width: none;
    overflow: visible;
    text-overflow: unset;
    padding: 0;
  }
  #usersTable td:nth-child(1) { display: none; }
  #usersTable td:nth-child(2) {
    flex: 1 1 auto;
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text, #1a202c);
    min-width: 0;
  }
  #usersTable td:nth-child(3) {
    flex: 0 0 auto;
    font-size: 0.78rem;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 20px;
    background: var(--surface, #f0fdf4);
    color: var(--text-muted, #64748b);
    border: 1px solid var(--border, #e2e8f0);
  }
  #usersTable td:nth-child(4) {
    flex: 0 0 auto;
    font-size: 0.78rem;
    padding: 3px 10px;
    border-radius: 20px;
    background: var(--surface, #f0fdf4);
    color: var(--text-muted, #64748b);
    border: 1px solid var(--border, #e2e8f0);
  }
  #usersTable td:last-child {
    flex: 1 1 100%;
    padding-top: 8px;
    border-top: 1px dashed var(--border, #e2e8f0);
    margin-top: 4px;
  }
  #usersTable td:last-child .actions-inline {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    width: 100%;
  }
  #usersTable td:last-child .actions-inline .btn {
    flex: 1 1 auto;
    min-width: 80px;
    min-height: 40px !important;
    justify-content: center;
    font-size: 0.8rem;
  }

  /* Admin roles: tabla → tarjetas */
  #rolesTable > div { overflow: visible !important; }
  #rolesTable table,
  #rolesTable thead,
  #rolesTable tbody,
  #rolesTable tr,
  #rolesTable td { display: block; }
  #rolesTable table { min-width: 0 !important; width: 100%; }
  #rolesTable thead { display: none; }
  #rolesTable tbody { display: flex; flex-direction: column; gap: 10px; }
  #rolesTable tr {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "nombre  prot"
      "desc    desc"
      "usuarios usuarios"
      "acciones acciones";
    gap: 4px 10px;
    border: 1px solid var(--border, #e2e8f0);
    border-radius: 10px;
    padding: 12px 14px;
    background: #fff;
    box-shadow: 0 1px 4px rgba(0,0,0,.06);
  }
  #rolesTable td {
    display: flex;
    flex-direction: column;
    gap: 1px;
    border: none;
    white-space: normal;
    max-width: none;
    overflow: visible;
    text-overflow: unset;
    padding: 2px 0;
    font-size: 0.85rem;
  }
  #rolesTable td::before {
    content: attr(data-label);
    font-size: 0.66rem;
    font-weight: 700;
    color: var(--text-muted, #64748b);
    text-transform: uppercase;
    letter-spacing: 0.05em;
  }
  #rolesTable td:nth-child(1) { display: none; }
  #rolesTable td:nth-child(2) {
    grid-area: nombre;
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--text, #1a202c);
  }
  #rolesTable td:nth-child(2)::before { display: none; }
  #rolesTable td:nth-child(3) { grid-area: desc; color: var(--text-muted, #64748b); font-size: 0.82rem; }
  #rolesTable td:nth-child(4) { grid-area: usuarios; }
  #rolesTable td:nth-child(5) {
    grid-area: prot;
    align-self: start;
    font-size: 0.78rem;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 20px;
    background: var(--surface, #f0fdf4);
    color: var(--text-muted, #64748b);
    border: 1px solid var(--border, #e2e8f0);
    text-align: center;
    flex-direction: row;
  }
  #rolesTable td:nth-child(5)::before { display: none; }
  #rolesTable td:last-child {
    grid-area: acciones;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 6px;
    padding-top: 8px;
    border-top: 1px dashed var(--border, #e2e8f0);
    margin-top: 2px;
  }
  #rolesTable td:last-child::before { display: none; }
  #rolesTable td:last-child .actions-inline {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    width: 100%;
  }
  #rolesTable td:last-child .actions-inline .btn {
    flex: 1 1 auto;
    min-width: 80px;
    min-height: 40px !important;
    justify-content: center;
    font-size: 0.8rem;
  }

  /* Panel head: apilar */
  .panel-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  .panel-head .actions-inline { width: 100%; }
  .panel-head .actions-inline select { flex: 1; min-width: 0; }
  .panel-head .actions-inline .btn { flex: 1; justify-content: center; }
  /* Toast centrado */
  .toast {
    right: 50%;
    transform: translateX(50%);
    bottom: 16px;
    max-width: calc(100vw - 32px);
    text-align: center;
    width: max-content;
  }
  .notification {
    right: 12px; left: 12px; top: 12px;
    text-align: center;
  }
  /* WhatsApp */
  #whatsappSection .panel-head .actions-inline {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
  }
  #whatsappSection .panel-head .actions-inline .btn { width: 100%; justify-content: center; }
  #waClientsSection .panel-head { flex-direction: column; align-items: flex-start; gap: 8px; }
  #waClientsSection .panel-head .actions-inline { flex-direction: column; align-items: stretch; width: 100%; }
  #waClientsSection .panel-head .actions-inline .btn { width: 100%; justify-content: center; }
  #waQrContainer img { max-width: 200px; width: 100%; }
  /* Cocina */
  #cocinaSection .panel-head { flex-wrap: wrap; gap: 8px; }
  #cocinaSection .panel-head .actions-inline { width: 100%; flex-wrap: nowrap; }
  #cocinaSection .panel-head .actions-inline .btn { flex: 1; justify-content: center; white-space: nowrap; }
  /* Mesero */
  .admin-order-options { padding: 10px; }
  .admin-order-options-row { flex-direction: column; gap: 8px; }
  .admin-order-options-row .compact-label,
  .admin-order-options-row input { width: 100%; min-width: 0; flex: 1 1 auto; }
  .mesero-append-banner { flex-direction: column; align-items: flex-start; gap: 8px; }
  .cuenta-panel-head { flex-direction: column; align-items: flex-start; gap: 6px; }
  .mesero-date-filter-row { gap: 6px; }
  .mesero-date-filter-row input[type="date"] { flex: 1; }
  /* Caja toolbar */
  .cash-mov-toolbar { flex-wrap: wrap; gap: 8px; }
  .cash-date-label { flex: 1; min-width: 0; }
  /* Two-col forma → una col */
  .two-col { grid-template-columns: 1fr; }
}

/* ================================================================
   MODAL COMO BOTTOM SHEET: ≤ 520px
   ================================================================ */
@media (max-width: 520px) {
  .modal-overlay { align-items: flex-end; }
  .modal-card {
    width: 100%;
    max-width: 100%;
    border-radius: 18px 18px 0 0;
    padding: 22px 16px 28px;
    margin: 0;
  }
  .auth-modal-actions { flex-direction: column; gap: 8px; }
  .auth-modal-actions .btn { width: 100%; justify-content: center; }
  /* Modales de WhatsApp */
  .modal-box {
    width: 100% !important;
    max-width: 100% !important;
    border-radius: 18px 18px 0 0 !important;
  }

  /* Productos en pedido: dar más ancho real al nombre en móvil vertical */
  .order-item-main {
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "info info"
      "controls right";
    align-items: start;
    gap: 8px 10px;
  }

  .order-item-info {
    grid-area: info;
  }

  .order-item-controls {
    grid-area: controls;
    align-items: flex-start;
  }

  .order-item-right {
    grid-area: right;
    min-width: 0;
  }

  .order-item-name,
  .order-item-category,
  .order-item-note {
    word-break: normal;
    overflow-wrap: anywhere;
  }

  .order-item-name {
    font-size: 0.96rem;
    line-height: 1.3;
  }
}

/* ================================================================
   MÓVIL COMPACTO: ≤ 480px
   ================================================================ */
@media (max-width: 480px) {
  /* Topbar */
  .topbar {
    padding: 10px 12px;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    height: auto;
  }
  .topbar > div:first-child { flex: 1; min-width: 0; }
  .topbar h1 { font-size: 0.88rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .topbar p  { font-size: 0.7rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .user-box  { gap: 6px; }
  #userInfo  {
    font-size: 0.75rem;
    padding: 4px 8px;
    max-width: 130px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  /* Container */
  .container { padding: 10px 10px 24px; }
  .panel { padding: 14px; border-radius: var(--radius); }
  .panel-inner { padding: 10px; }
  .login-panel { margin-top: 16px; }
  /* Product grid 2 col */
  .product-grid { grid-template-columns: 1fr 1fr; }
  /* Dashboard 1 col */
  .dashboard-grid { grid-template-columns: 1fr; }
  /* Mesas */
  .quick-table-row { gap: 4px; }
  .quick-table-btn { min-width: 40px; height: 40px; padding: 0 8px; font-size: 0.8rem; }
  /* Tarjeta de pedido */
  .card { padding: 12px; }
  .card .panel-head { margin-bottom: 8px; padding-bottom: 8px; }
  .item-row { grid-template-columns: 1fr; gap: 6px; }
  .item-row > *:last-child { display: flex; gap: 6px; flex-wrap: wrap; }
}

/* ================================================================
   PEDIDOS — MÓVIL OPTIMIZADO: ≤ 640px
   ================================================================ */
@media (max-width: 640px) {

  /* Lista de pedidos: scroll fluido */
  #ordersList {
    gap: 10px;
    padding-bottom: 32px;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: contain;
  }

  /* Tarjeta: aceleración GPU, bordes más compactos */
  .order-card.card {
    padding: 10px 10px 8px;
    border-radius: 10px;
    transform: translateZ(0);  /* GPU layer para scroll suave */
    -webkit-tap-highlight-color: transparent;
  }

  /* Cabecera de tarjeta: alinear badge sin desbordarse */
  .order-card .panel-head {
    flex-wrap: nowrap;
    align-items: center;
    gap: 6px;
    overflow: hidden;
  }
  .order-card .panel-head strong {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
    flex: 1;
  }
  .order-card .order-state-badge {
    white-space: nowrap;
    flex-shrink: 0;
  }

  /* Meta row: total siempre visible a la derecha */
  .order-meta-row {
    font-size: .78rem;
    flex-wrap: nowrap;
    align-items: center;
    gap: 4px;
  }
  .order-meta-row > span:first-child {
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .order-client-meta {
    width: 100%;
  }
  .order-client-meta-text {
    flex: 1;
  }
  .order-meta-row .order-total-big {
    font-size: 1rem;
    white-space: nowrap;
    flex-shrink: 0;
  }

  /* Barra de acciones: grupo pagar arriba, secundarios abajo */
  .order-actions-bar {
    flex-wrap: wrap;
    overflow-x: visible;
    gap: 6px 4px;
  }
  .order-pay-group {
    order: 1;
    width: 100%;
    margin-left: 0;
    justify-content: flex-end;
    flex-wrap: nowrap;
  }
  .order-secondary-actions {
    order: 2;
    flex-wrap: wrap;
  }

  /* Botones de pago: crecer para llenar el ancho */
  .order-pay-group .btn-pay-order,
  .order-pay-group .btn-close-order {
    flex: 1;
    min-width: 0;
    height: 36px;
    justify-content: center;
  }
  .order-pay-group .order-pay-select {
    flex: 1;
    min-width: 0;
    max-width: none;
    height: 36px;
  }

  /* Botones secundarios: tamaño táctil mínimo 36px */
  .order-secondary-actions .btn-xs,
  .order-actions-bar .btn-xs {
    height: 34px;
    min-width: 34px;
    padding: 0 9px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  /* Item status buttons: targets más grandes */
  .actions-inline .btn-xs {
    height: 34px;
    padding: 0 10px;
    touch-action: manipulation;
  }

  /* Estado bloqueado: msg + iconos bien distribuidos */
  .order-actions-bar .state-locked-msg {
    font-size: .76rem;
  }
}

/* ================================================================
   MÓVIL PEQUEÑO: ≤ 400px
   ================================================================ */
@media (max-width: 400px) {
  .dash-kpi-row { grid-template-columns: 1fr 1fr; gap: 6px; }
  /* Catálogo: 2 col ajustado */
  .catalog-products-grid {
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    padding: 8px 8px 80px;
  }
}

/* ================================================================
   MÓVIL MUY PEQUEÑO: ≤ 360px
   ================================================================ */
@media (max-width: 360px) {
  html { font-size: 13px; }
  .topbar h1 { font-size: 0.85rem; }
  .tab { padding: 7px 10px; font-size: 0.78rem; }
  .btn { padding: 8px 10px; }
}


/* ═══════════════════════════════════════════════════════════
   TARJETA IA WHATSAPP — Botón de activar / desactivar
══════════════════════════════════════════════════════════════ */

.ia-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  background: #ffffff;
  border: 1.5px solid #e2e8f0;
  border-radius: 14px;
  padding: 1rem 1.25rem;
  margin-bottom: 1.25rem;
  box-shadow: 0 2px 8px rgba(0,0,0,.06);
  transition: border-color .2s;
}

.ia-card:hover {
  border-color: #cbd5e1;
}

.ia-card-left {
  display: flex;
  align-items: center;
  gap: .85rem;
}

.ia-card-title {
  margin: 0;
  font-weight: 700;
  font-size: 1rem;
  color: #1e293b;
}

.ia-card-subtitle {
  margin: .15rem 0 0;
  font-size: .82rem;
  color: #64748b;
}

/* Indicador de estado (punto) */
.ia-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  flex-shrink: 0;
  transition: background .3s, box-shadow .3s;
}

.ia-dot--on {
  background: #22c55e;
  box-shadow: 0 0 0 3px rgba(34,197,94,.25);
  animation: ia-pulse 2s infinite;
}

.ia-dot--off {
  background: #94a3b8;
  box-shadow: none;
}

@keyframes ia-pulse {
  0%,100% { box-shadow: 0 0 0 3px rgba(34,197,94,.25); }
  50%      { box-shadow: 0 0 0 6px rgba(34,197,94,.08); }
}

/* Botón toggle */
.ia-toggle-btn {
  min-width: 160px;
  font-weight: 700;
  font-size: .9rem;
  border-radius: 10px;
  padding: .5rem 1.2rem;
  transition: background .25s, border-color .25s, transform .1s;
  cursor: pointer;
}

.ia-toggle-btn:active {
  transform: scale(.97);
}

.ia-toggle-btn.ia-on {
  background: #22c55e;
  border-color: #16a34a;
  color: #fff;
}

.ia-toggle-btn.ia-on:hover {
  background: #16a34a;
}

.ia-toggle-btn.ia-off {
  background: #f1f5f9;
  border-color: #cbd5e1;
  color: #475569;
}

.ia-toggle-btn.ia-off:hover {
  background: #e2e8f0;
}

.ia-toggle-btn:disabled {
  opacity: .55;
  cursor: not-allowed;
}

/* Variante compacta — usada en cabeceras de chat y barras de herramientas */
.ia-toggle-btn.ia-toggle-compact {
  min-width: 130px;
  font-size: .82rem;
  padding: .3rem .85rem;
}

.ia-mode-note {
  padding: 9px 14px;
  border-radius: 8px;
  font-size: .82rem;
  font-weight: 600;
  margin-bottom: 6px;
}
.ia-mode-note.mode-manual {
  background: #fef9c3;
  border: 1px solid #fde68a;
  color: #92400e;
}
.ia-mode-note.mode-auto {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  color: #166534;
}

.wa-service-summary {
  margin: -4px 0 14px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  color: #334155;
  font-size: .86rem;
  font-weight: 600;
}

.wa-service-summary.wa-mode-all {
  background: #ecfdf5;
  border-color: #86efac;
  color: #166534;
}

.wa-service-summary.wa-mode-delivery-off {
  background: #fffbeb;
  border-color: #fcd34d;
  color: #92400e;
}

.wa-service-summary.wa-mode-solo {
  background: #eff6ff;
  border-color: #93c5fd;
  color: #1e3a8a;
}

.wa-service-summary.wa-mode-error {
  background: #fef2f2;
  border-color: #fecaca;
  color: #991b1b;
}

/* Responsive */
@media (max-width: 520px) {
  .ia-card {
    flex-direction: column;
    align-items: flex-start;
    gap: .75rem;
  }

  .ia-toggle-btn {
    width: 100%;
  }
}


/* ═══════════════════════════════════════════════════════════════
   MÓDULO: Control de Empleados
═══════════════════════════════════════════════════════════════ */

/* ── Tile de registro de asistencia (reemplaza la tarjeta + botón) ── */
.att-face-tile {
  position: relative;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 1.8rem 2rem;
  margin: 0 0 1.5rem;
  border: none;
  border-radius: 20px;
  background: linear-gradient(135deg, #4c1d95 0%, #7c3aed 45%, #9333ea 100%);
  color: #fff;
  text-align: left;
  cursor: pointer;
  overflow: hidden;
  box-shadow: 0 10px 30px -10px rgba(124, 58, 237, 0.55), 0 4px 12px rgba(0,0,0,0.08);
  transition: transform .18s ease, box-shadow .18s ease, filter .18s ease;
  font-family: inherit;
}
.att-face-tile:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 36px -10px rgba(124, 58, 237, 0.7), 0 6px 16px rgba(0,0,0,0.1);
  filter: brightness(1.05);
}
.att-face-tile:active { transform: translateY(0); filter: brightness(.96); }
.att-face-tile:focus-visible { outline: 3px solid #fef08a; outline-offset: 3px; }

.att-face-tile-glow {
  position: absolute;
  inset: -40% -10% auto auto;
  width: 260px; height: 260px;
  background: radial-gradient(circle, rgba(255,255,255,.35) 0%, rgba(255,255,255,0) 65%);
  pointer-events: none;
  animation: faceTileGlow 6s ease-in-out infinite;
}
@keyframes faceTileGlow {
  0%,100% { transform: translate(0,0) scale(1); opacity: .8; }
  50%     { transform: translate(-30px, 20px) scale(1.15); opacity: 1; }
}

.att-face-tile-icon {
  position: relative;
  flex: 0 0 96px;
  width: 96px; height: 96px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,0.18);
  border: 2px solid rgba(255,255,255,0.35);
  border-radius: 50%;
  backdrop-filter: blur(6px);
}
.att-face-tile-camera { font-size: 2.6rem; line-height: 1; filter: drop-shadow(0 2px 4px rgba(0,0,0,.25)); }
.att-face-tile-pulse {
  position: absolute; inset: -8px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.55);
  animation: faceTilePulse 2s ease-out infinite;
  pointer-events: none;
}
.att-face-tile-pulse--delay { animation-delay: 1s; }
@keyframes faceTilePulse {
  0%   { transform: scale(.9); opacity: .9; }
  100% { transform: scale(1.5); opacity: 0; }
}

.att-face-tile-body { display: flex; flex-direction: column; gap: .35rem; min-width: 0; flex: 1; }
.att-face-tile-title { font-size: 1.55rem; font-weight: 800; letter-spacing: .01em; line-height: 1.1; }
.att-face-tile-sub   { font-size: .92rem; opacity: .88; line-height: 1.3; }
.att-face-tile-hint  {
  display: inline-flex; align-items: center; gap: .4rem;
  margin-top: .55rem;
  padding: .35rem .8rem;
  background: rgba(255,255,255,0.22);
  border-radius: 999px;
  font-size: .82rem; font-weight: 600;
  width: fit-content;
  animation: faceTileHint 2.4s ease-in-out infinite;
}
@keyframes faceTileHint {
  0%,100% { transform: translateY(0); }
  50%     { transform: translateY(-3px); }
}

@media (max-width: 640px) {
  .att-face-tile { flex-direction: column; text-align: center; gap: 1rem; padding: 1.4rem 1.2rem; }
  .att-face-tile-body { align-items: center; }
  .att-face-tile-hint { margin-left: auto; margin-right: auto; }
  .att-face-tile-icon { flex-basis: 80px; width: 80px; height: 80px; }
  .att-face-tile-camera { font-size: 2.2rem; }
  .att-face-tile-title { font-size: 1.3rem; }
}

/* ── Tarjeta check-in personal ── */
.att-my-card {
  display: flex;
  flex-wrap: wrap;
  gap: 1.2rem;
  align-items: center;
  background: linear-gradient(135deg, #1e3a5f 0%, #0f5d52 100%);
  color: #fff;
  border-radius: 14px;
  padding: 1.5rem 1.8rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 4px 20px rgba(0,0,0,.18);
}
.att-my-info { display: flex; align-items: center; gap: 1rem; flex: 1 1 240px; }
.att-my-avatar { font-size: 2.8rem; line-height: 1; }
.att-my-name  { font-size: 1.2rem; font-weight: 700; margin: 0; }
.att-my-date  { font-size: .85rem; opacity: .8; margin: .2rem 0 0; }

.att-my-times { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; flex: 1 1 220px; }
.att-time-block { text-align: center; min-width: 60px; }
.att-time-label { display: block; font-size: .7rem; text-transform: uppercase; opacity: .7; }
.att-time-value { display: block; font-size: 1.2rem; font-weight: 700; margin-top: .1rem; }
.att-time-sep   { font-size: 1.5rem; opacity: .5; }

.att-my-actions { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; flex: 0 0 auto; }

.btn.large { padding: .7rem 1.6rem; font-size: 1rem; }

/* ── Badges de estado ── */
.att-badge {
  display: inline-block;
  padding: .2rem .65rem;
  border-radius: 999px;
  font-size: .78rem;
  font-weight: 600;
  white-space: nowrap;
}
.att-badge-none  { background: #e5e7eb; color: #6b7280; }
.att-badge-ok    { background: #d1fae5; color: #065f46; }
.att-badge-warn  { background: #fef3c7; color: #92400e; }
.att-badge-error { background: #fee2e2; color: #991b1b; }
.att-badge-info  { background: #dbeafe; color: #1e40af; }

/* ── Sub-tabs ── */
.att-subtabs {
  display: flex;
  gap: .4rem;
  flex-wrap: nowrap;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  margin-bottom: 1.2rem;
  border-bottom: 2px solid #e5e7eb;
  padding-bottom: .5rem;
}
.att-subtabs::-webkit-scrollbar { display: none; }
.att-subtab { flex: 0 0 auto; white-space: nowrap; }
.att-subtab {
  background: none;
  border: none;
  padding: .45rem .9rem;
  border-radius: 8px 8px 0 0;
  cursor: pointer;
  font-size: .9rem;
  font-weight: 600;
  color: #6b7280;
  transition: color .15s, background .15s;
}
.att-subtab:hover  { background: #f3f4f6; color: #111; }
.att-subtab.active { background: #2563eb; color: #fff; }

.att-subtab-content { animation: fadeIn .2s ease; }
.att-subtab-content.hidden { display: none; }

/* ── Diviror ── */
.att-divider { border: none; border-top: 2px solid #e5e7eb; margin: 2rem 0 1.5rem; }

/* ── Tablas ── */
/* Resumen rápido de asistencia */
.att-summary-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 20px;
  padding: 10px 14px;
  background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
  border: 1px solid #93c5fd;
  border-radius: 10px;
  margin-bottom: 10px;
  font-size: .85rem;
  color: #1e40af;
}
.att-summary-strip strong { font-weight: 700; }

.att-table-wrap { overflow-x: auto; border-radius: 10px; border: 1px solid #e5e7eb; }
.att-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .88rem;
}
.att-table th {
  background: #f8fafc;
  text-align: left;
  padding: .65rem .9rem;
  font-weight: 700;
  color: #374151;
  border-bottom: 2px solid #e5e7eb;
  white-space: nowrap;
}
.att-table td {
  padding: .55rem .9rem;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
}
.att-table tr:last-child td { border-bottom: none; }
.att-table tr:hover td { background: #f8fafc; }

/* ── Préstamos: totales, progreso, timeline ─────────────────────────── */
.loan-totals {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: .75rem;
}
.loan-totals-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-left: 4px solid #cbd5e1;
  border-radius: 12px;
  padding: .85rem 1rem;
}
.loan-totals-card.loan-totals-debe     { border-left-color: #dc2626; }
.loan-totals-card.loan-totals-pagado   { border-left-color: #16a34a; }
.loan-totals-card.loan-totals-prestado { border-left-color: #2563eb; }
.loan-totals-label {
  font-size: .75rem; color: #6b7280;
  text-transform: uppercase; letter-spacing: .03em;
}
.loan-totals-value {
  font-size: 1.35rem; font-weight: 700; color: #111827;
  margin-top: .2rem;
}
.loan-totals-sub { font-size: .78rem; color: #6b7280; margin-top: .15rem; }

.loan-progress {
  position: relative;
  background: #f1f5f9;
  border-radius: 999px;
  height: 18px;
  overflow: hidden;
  min-width: 100px;
}
.loan-progress-fill {
  background: linear-gradient(90deg, #22c55e, #16a34a);
  height: 100%;
  transition: width .3s ease;
}
.loan-progress-label {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .72rem;
  font-weight: 600;
  color: #0f172a;
}

.loans-table td { vertical-align: top; }
.loan-timeline-row td { background: #fafbfc !important; padding: 0; }
.loan-timeline-wrap { padding: .5rem 1rem 1rem; }
.loan-timeline {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: .75rem;
}
.loan-timeline-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: .5rem;
  border-bottom: 1px solid #f1f5f9;
  margin-bottom: .5rem;
  font-size: .85rem;
}
.loan-pay-item {
  display: grid;
  grid-template-columns: 110px 120px 1fr auto;
  gap: .75rem;
  align-items: center;
  padding: .5rem;
  border-bottom: 1px solid #f4f4f5;
}
.loan-pay-item:last-child { border-bottom: none; }
.loan-pay-date   { font-size: .8rem; color: #475569; }
.loan-pay-amount { font-weight: 700; color: #16a34a; }
.loan-pay-meta   { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; font-size: .78rem; color: #475569; }
.loan-pay-origin {
  display: inline-block;
  padding: .1rem .4rem;
  border-radius: 999px;
  font-size: .72rem;
  font-weight: 600;
}
.loan-pay-origin-nomina { background: #dbeafe; color: #1e40af; }
.loan-pay-origin-manual { background: #fef3c7; color: #92400e; }
.loan-pay-note { font-style: italic; color: #6b7280; }

@media (max-width: 640px) {
  .loan-pay-item {
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "date amount"
      "meta meta"
      "act  act";
  }
  .loan-pay-date   { grid-area: date; }
  .loan-pay-amount { grid-area: amount; text-align: right; }
  .loan-pay-meta   { grid-area: meta; }
  .loan-pay-actions{ grid-area: act; text-align: right; }
}

/* ── Mis préstamos (vista empleado) ──────────────────────────────────── */
.my-loans-list { display: flex; flex-direction: column; gap: .75rem; }
.my-loan-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  padding: 1rem;
  box-shadow: 0 1px 2px rgba(0,0,0,.03);
}
.my-loan-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: .75rem;
  margin-bottom: .65rem;
}
.my-loan-amount { font-size: 1.15rem; font-weight: 700; white-space: nowrap; }
.my-loan-timeline { margin-top: .75rem; }
.my-loan-timeline.hidden { display: none; }

/* ── Resumen por empleado: filas expandibles ────────────────────────── */
.loan-emp-row:hover td { background: #f8fafc; }
.loan-emp-row td { vertical-align: top; }
.loan-emp-caret {
  display: inline-block;
  width: .9rem;
  color: #6b7280;
  font-weight: 700;
  transition: transform .15s ease;
  user-select: none;
}
.loan-emp-detail.hidden { display: none; }
.loan-emp-subtable {
  padding: .5rem .75rem .75rem;
  display: flex;
  flex-direction: column;
  gap: .5rem;
}
.loan-sub-row {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: .65rem .85rem;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: .5rem;
  align-items: start;
}
.loan-sub-main { display: flex; flex-direction: column; gap: .35rem; }
.loan-sub-concepto {
  display: flex;
  align-items: center;
  gap: .5rem;
  flex-wrap: wrap;
  font-size: .9rem;
}
.loan-sub-fecha { font-size: .78rem; color: #6b7280; }
.loan-sub-obs   { font-size: .8rem; color: #475569; font-style: italic; }
.loan-sub-nums {
  display: flex;
  flex-wrap: wrap;
  gap: .85rem;
  font-size: .82rem;
  color: #334155;
}
.loan-sub-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  justify-content: flex-end;
}
.loan-sub-timeline {
  grid-column: 1 / -1;
  margin-top: .4rem;
}
.loan-sub-timeline.hidden { display: none; }

@media (max-width: 640px) {
  .loan-sub-row { grid-template-columns: 1fr; }
  .loan-sub-actions { justify-content: flex-start; }
}

/* ── Bulk liquidation bar ────────────────────────────────────────────── */
.loan-bulk-bar {
  display: flex;
  gap: .5rem;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: .75rem;
}
.loan-bulk-actions {
  display: flex;
  gap: .5rem;
  align-items: center;
  flex-wrap: wrap;
  padding: .45rem .75rem;
  background: #fef3c7;
  border: 1px solid #fde68a;
  border-radius: 10px;
}
.loan-bulk-actions.hidden { display: none; }
.loan-bulk-count {
  font-weight: 700;
  color: #92400e;
  font-size: .88rem;
}
.loan-emp-check-cell input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: #16a34a;
}
#loanEmpCheckAll { width: 18px; height: 18px; cursor: pointer; accent-color: #16a34a; }

.att-role-tag {
  display: inline-block;
  background: #eff6ff;
  color: #1d4ed8;
  padding: .1rem .5rem;
  border-radius: 999px;
  font-size: .75rem;
  font-weight: 600;
}

/* ── Formularios de horario/salario ── */
.att-schedule-form-wrap {
  background: #f8fafc;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 1.2rem 1.5rem;
}

/* ── Filtros ── */
.att-filter-row {
  display: flex; flex-wrap: wrap; gap: .75rem; align-items: flex-end;
}
.att-filter-row label {
  display: flex; flex-direction: column; gap: .25rem;
  font-size: .85rem; font-weight: 600; color: #374151;
}
.att-filter-row label input,
.att-filter-row label select {
  font-size: .9rem;
  padding: .35rem .6rem;
  border: 1px solid #d1d5db;
  border-radius: 7px;
}

/* ── Historial colapsable ── */
.att-details {
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: .8rem 1.2rem;
  margin-bottom: 1.2rem;
}
.att-details > summary {
  cursor: pointer;
  font-weight: 700;
  font-size: .95rem;
  padding: .3rem 0;
  list-style: none;
  display: flex;
  align-items: center;
  gap: .5rem;
}
.att-details > summary::before { content: '▶'; font-size: .7rem; transition: transform .2s; }
.att-details[open] > summary::before { transform: rotate(90deg); }
.att-details > *:not(summary) { margin-top: .75rem; }

/* ── Rendimiento ── */
.att-perf-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}
.att-perf-card {
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  padding: 1.2rem;
  background: #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,.06);
}
.att-perf-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: .8rem;
}
.att-perf-name { font-weight: 700; font-size: 1rem; margin: 0 0 .25rem; }
.att-perf-pct  { font-size: 2rem; font-weight: 800; line-height: 1; }
.att-perf-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .4rem .75rem;
  margin-bottom: .75rem;
}
.att-stat { display: flex; flex-direction: column; }
.att-stat span   { font-size: .75rem; color: #6b7280; }
.att-stat strong { font-size: .95rem; }
.att-perf-salary {
  font-size: .82rem;
  color: #374151;
  background: #f0fdf4;
  border-radius: 8px;
  padding: .35rem .65rem;
  margin-bottom: .75rem;
}
.att-perf-bar-wrap {
  height: 8px;
  background: #e5e7eb;
  border-radius: 999px;
  overflow: hidden;
}
.att-perf-bar {
  height: 100%;
  border-radius: 999px;
  transition: width .4s ease;
}

.btn.small { padding: .25rem .55rem; font-size: .78rem; }

/* ================================================================
   EMPLEADOS — RESPONSIVE COMPLETO
   Breakpoints: 1024 | 768 | 640 | 480 | 400
   ================================================================ */

/* ── Tablet (iPad horizontal ~1024-1366px): asegurar que WhatsApp
      respete el margen derecho del viewport ───── */
@media (min-width: 769px) and (max-width: 1366px) {
  #whatsappSection {
    max-width: 100%;
    box-sizing: border-box;
    padding-right: clamp(16px, 2.5vw, 28px);
    overflow-x: hidden;
  }
  #whatsappSection > *,
  #whatsappSection .panel-head,
  #whatsappSection .wa-service-summary,
  #whatsappSection .status-box,
  #whatsappSection .grid,
  #whatsappSection form,
  #whatsappSection table {
    max-width: 100%;
    box-sizing: border-box;
  }
  #whatsappSection .panel-head { flex-wrap: wrap; gap: 8px; }
  #whatsappSection .grid.two-col { grid-template-columns: 1fr; }
  #whatsappSection table { display: block; overflow-x: auto; width: 100%; }
}

/* ── Tablet (iPad horizontal ~1024-1366px): asegurar que el contenido
      del módulo Empleados respete el margen derecho del viewport ───── */
@media (min-width: 769px) and (max-width: 1366px) {
  #empleadosSection {
    max-width: 100%;
    box-sizing: border-box;
    padding-right: clamp(16px, 2.5vw, 28px);
    overflow-x: hidden;
  }
  #empleadosSection > * {
    max-width: 100%;
    box-sizing: border-box;
  }
  #empleadosSection .att-table-wrap,
  #empleadosSection .tnotes-wrap,
  #empleadosSection .tnotes-compose,
  #empleadosSection .tnotes-input-row,
  #empleadosSection .tnotes-textarea,
  #empleadosSection .att-filter-row,
  #empleadosSection .att-my-card,
  #empleadosSection .att-perf-grid,
  #empleadosSection .att-summary-strip,
  #empleadosSection .att-details {
    max-width: 100%;
    box-sizing: border-box;
  }
  #empleadosSection .att-table-wrap { overflow-x: auto; }
  #empleadosSection .att-table { width: 100%; }
  /* Evitar que botones grandes y badges fuercen anchura */
  #empleadosSection .att-my-actions { flex-wrap: wrap; }
  #empleadosSection .att-my-actions .btn { white-space: normal; }
}

/* ── Tablet horizontal: ≤ 1024px ─────────────────────────────── */
@media (max-width: 1024px) {
  .att-my-card {
    gap: 1rem;
    padding: 1.3rem 1.5rem;
  }
  .att-perf-grid {
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  }
}

/* ── Tablet vertical: ≤ 768px ───────────────────────────────── */
@media (max-width: 768px) {
  /* Tarjeta de asistencia: info y tiempos en columna */
  .att-my-card {
    flex-direction: column;
    align-items: stretch;
    gap: .9rem;
    padding: 1.1rem 1.2rem;
  }
  .att-my-info {
    flex: unset;
  }
  .att-my-times {
    flex: unset;
    justify-content: flex-start;
    gap: 1rem;
  }
  .att-my-actions {
    flex-wrap: wrap;
    gap: .5rem;
  }
  /* Filtros: apilados en columna */
  .att-filter-row {
    flex-direction: column;
    align-items: stretch;
    gap: .6rem;
  }
  .att-filter-row label {
    width: 100%;
  }
  .att-filter-row label input,
  .att-filter-row label select {
    width: 100%;
  }
  .att-filter-row > .btn {
    width: 100%;
    justify-content: center;
  }
  /* Historial asistencias: botones nav en fila compacta en móvil */
  #myHistoryDetails .att-filter-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: .5rem;
  }
  #myHistoryDetails .att-filter-row > label {
    grid-column: 1 / -1;
  }
  #myHistoryDetails .att-filter-row > #myHistFilterBtn {
    grid-column: 1 / -1;
  }
  /* Sub-tabs: scroll horizontal */
  .att-subtabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: .4rem;
    gap: .3rem;
  }
  .att-subtabs::-webkit-scrollbar { display: none; }
  .att-subtab {
    flex: 0 0 auto;
    white-space: nowrap;
    font-size: .82rem;
    padding: .38rem .7rem;
  }
  /* Formularios: una columna */
  #scheduleForm.grid.two-col,
  #salaryForm.grid.two-col {
    grid-template-columns: 1fr;
  }
  #scheduleForm .btn[type="submit"],
  #salaryForm .btn[type="submit"] {
    width: 100%;
  }
  .att-schedule-form-wrap {
    padding: .9rem 1rem;
  }
  /* Detalles: padding reducido */
  .att-details {
    padding: .6rem .9rem;
  }
  /* Grid de rendimiento */
  .att-perf-grid {
    grid-template-columns: 1fr 1fr;
  }
}

/* ── Móvil grande: ≤ 640px ──────────────────────────────────── */
@media (max-width: 640px) {
  .att-my-card {
    padding: 1rem;
    border-radius: 12px;
  }
  .att-my-name  { font-size: 1.05rem; }
  .att-my-times { gap: .5rem; }
  .att-time-sep { display: none; }   /* quitar → en pantallas pequeñas */
  .att-time-value { font-size: 1rem; }

  /* Botones de acción: ancho completo */
  .att-my-actions {
    flex-direction: column;
    align-items: stretch;
    gap: .5rem;
    width: 100%;
  }
  .att-my-actions .btn {
    width: 100%;
    justify-content: center;
    text-align: center;
  }
  .att-my-actions .att-badge {
    text-align: center;
    width: 100%;
    padding: .28rem .5rem;
  }

  /* Tabla: fuente más pequeña */
  .att-table {
    font-size: .8rem;
  }
  .att-table th,
  .att-table td {
    padding: .45rem .6rem;
    white-space: nowrap;
  }

  /* Rendimiento: 1 columna */
  .att-perf-grid { grid-template-columns: 1fr; }
  .att-perf-pct  { font-size: 1.6rem; }

  /* Divider con menos margen */
  .att-divider { margin: 1.3rem 0 1rem; }

  /* Ajuste del encabezado de sección */
  #empleadosSection > .panel-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  #empleadosSection > .panel-head .btn {
    width: 100%;
    justify-content: center;
  }
}

/* ── Móvil compacto: ≤ 480px ────────────────────────────────── */
@media (max-width: 480px) {
  .att-my-card {
    padding: .85rem;
  }
  .att-my-avatar { font-size: 2.2rem; }
  .att-my-name   { font-size: 1rem; }
  .att-my-date   { font-size: .78rem; }
  .att-time-label { font-size: .65rem; }
  .att-time-block { min-width: 50px; }

  .att-subtab { font-size: .78rem; padding: .32rem .6rem; }

  .att-schedule-form-wrap {
    padding: .8rem;
    border-radius: 10px;
  }
  .att-schedule-form-wrap h4 { font-size: .9rem; }

  .att-filter-row label { font-size: .8rem; }
  .att-filter-row label input,
  .att-filter-row label select {
    font-size: .85rem;
    padding: .3rem .5rem;
  }

  .att-perf-card { padding: .9rem; }
  .att-perf-name { font-size: .92rem; }
  .att-perf-pct  { font-size: 1.4rem; }

  .att-role-tag { font-size: .7rem; }
  .btn.large { width: 100%; justify-content: center; }
}

/* ── Móvil pequeño: ≤ 400px ─────────────────────────────────── */
@media (max-width: 400px) {
  .att-my-card { padding: .75rem; gap: .75rem; }
  .att-my-times { gap: .4rem; }
  .att-time-value { font-size: .9rem; }
  .att-details { padding: .5rem .7rem; }
  .att-table { font-size: .75rem; }
  .att-table th,
  .att-table td { padding: .38rem .45rem; }
}

/* ================================================================
   EMPLEADOS — TAB HOY: TABLE → CARDS en móvil
   ================================================================ */

@media (max-width: 640px) {
  #hoyTableWrap .att-table,
  #hoyTableWrap .att-table thead,
  #hoyTableWrap .att-table tbody,
  #hoyTableWrap .att-table th,
  #hoyTableWrap .att-table td,
  #hoyTableWrap .att-table tr {
    display: block;
  }

  /* Ocultar cabecera: los labels vienen del data-label */
  #hoyTableWrap .att-table thead tr {
    display: none;
  }

  /* Cada fila = tarjeta */
  #hoyTableWrap .att-table tbody tr {
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    margin-bottom: .85rem;
    padding: .6rem .85rem;
    background: #fff;
    box-shadow: 0 2px 6px rgba(0,0,0,.06);
  }
  #hoyTableWrap .att-table tbody tr:last-child {
    margin-bottom: 0;
  }

  /* Cada celda = fila label : valor */
  #hoyTableWrap .att-table td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: .38rem 0;
    border: none;
    border-bottom: 1px solid #f1f5f9;
    font-size: .875rem;
    gap: .5rem;
  }
  #hoyTableWrap .att-table td:last-child {
    border-bottom: none;
    padding-top: .55rem;
    justify-content: flex-end;
  }

  /* Label generado desde data-label */
  #hoyTableWrap .att-table td::before {
    content: attr(data-label);
    font-weight: 600;
    color: #6b7280;
    font-size: .75rem;
    text-transform: uppercase;
    letter-spacing: .03em;
    white-space: nowrap;
    flex: 0 0 auto;
    min-width: 80px;
  }
  /* Celda de acciones: sin label, botones a la derecha */
  #hoyTableWrap .att-table td[data-label=""]::before {
    display: none;
  }
  #hoyTableWrap .att-table td[data-label=""] {
    flex-wrap: wrap;
    gap: .35rem;
    justify-content: flex-start;
  }

  /* Nombre destacado */
  #hoyTableWrap .att-table td[data-label="Empleado"] strong {
    font-size: .95rem;
  }
  /* Badge de estado alineado a la derecha */
  #hoyTableWrap .att-table td[data-label="Estado"] .att-badge {
    margin-left: auto;
  }
}

/* ── Panel de Envíos ──────────────────────────────────────────────────────── */
.envios-tabs {
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
  margin-bottom: 1.2rem;
  border-bottom: 2px solid #e5e7eb;
  padding-bottom: .5rem;
}
.envios-tab {
  padding: .45rem 1rem;
  border: none;
  background: transparent;
  border-radius: 6px 6px 0 0;
  font-size: .9rem;
  cursor: pointer;
  color: #6b7280;
  font-weight: 500;
  transition: background .15s, color .15s;
}
.envios-tab:hover { background: #f3f4f6; color: #111; }
.envios-tab.active { background: #2563eb; color: #fff; }
.envios-tab-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 .35rem;
  margin-left: .4rem;
  border-radius: 999px;
  background: #dc2626;
  color: #fff;
  font-size: .72rem;
  font-weight: 700;
}
.envios-tab-badge.hidden { display: none; }

/* Alerta urgente Chat IA */
@keyframes iaBadgePulse {
  0%, 100% { transform: scale(1);   background: #dc2626; box-shadow: 0 0 0 0 rgba(220,38,38,.6); }
  50%       { transform: scale(1.18); background: #b91c1c; box-shadow: 0 0 0 6px rgba(220,38,38,0); }
}
.envios-tab-badge.urgent-pulse {
  background: #dc2626 !important;
  animation: iaBadgePulse 1s ease-in-out infinite;
}
.envios-tab.urgent-pulse {
  color: #dc2626;
  font-weight: 700;
}
.envios-tab.urgent-pulse.active {
  background: #dc2626;
  color: #fff;
}

.envios-panel { }
.envios-panel.hidden { display: none; }

.envio-card {
  border-left: 5px solid #2563eb;
  margin-bottom: 1rem;
  padding: 1rem 1.1rem;
}
.envio-card-header {
  display: flex;
  align-items: center;
  gap: .75rem;
  flex-wrap: wrap;
  margin-bottom: .6rem;
}
.envio-num { font-size: 1rem; font-weight: 700; }
.envio-total { font-size: 1rem; font-weight: 700; color: #059669; }
.envio-rep-badge {
  background: #dbeafe;
  color: #1d4ed8;
  border-radius: 999px;
  padding: .15rem .6rem;
  font-size: .8rem;
  font-weight: 600;
}
.envio-estado-badge {
  border-radius: 999px;
  padding: .15rem .55rem;
  font-size: .75rem;
  font-weight: 600;
  background: #f1f5f9;
  color: #475569;
}
.envio-client { font-size: .92rem; line-height: 1.75; margin-bottom: .6rem; }
.envio-client > div { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.envio-lbl { font-size: 1rem; }
.envio-items {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem;
  margin-bottom: .75rem;
}
.envio-item-pill {
  background: #f3f4f6;
  border-radius: 999px;
  padding: .15rem .65rem;
  font-size: .82rem;
  color: #374151;
}
.envio-notas {
  font-size: .85rem;
  color: #6b7280;
  font-style: italic;
  margin-bottom: .5rem;
}
.envio-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  align-items: center;
  margin-top: .5rem;
}
.envio-assign-row {
  display: flex;
  align-items: center;
  gap: .4rem;
  flex-wrap: wrap;
}
.envio-rep-select {
  padding: .3rem .5rem;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: .85rem;
  min-width: 140px;
}
.envio-reasign-form {
  display: flex;
  align-items: center;
  gap: .4rem;
  flex-wrap: wrap;
  width: 100%;
  margin-top: .4rem;
}
.btn-sm { padding: .3rem .7rem; font-size: .82rem; }
.empty-hint { color: #9ca3af; font-style: italic; padding: 1rem 0; }

/* ═════════ Solicitudes IA — Apple-style redesign ═════════ */
.envios-ia-layout {
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  gap: 0;
  background: #f5f5f7;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Inter", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}
.envios-ia-sidebar {
  background: rgba(255,255,255,.72);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-right: 1px solid rgba(0,0,0,.06);
  padding: 18px 14px 14px;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.envios-ia-detail {
  background: #fff;
  padding: 0;
  overflow: hidden;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.envios-ia-sidebar-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin: 0 4px 14px;
}
.envios-ia-sidebar-head strong {
  font-size: 1.45rem;
  font-weight: 700;
  letter-spacing: -0.015em;
  color: #1d1d1f;
}
.envios-ia-sidebar-head .envio-rep-badge {
  background: #ff3b30;
  color: #fff;
  border-radius: 999px;
  padding: 2px 9px;
  font-size: .74rem;
  font-weight: 600;
  min-width: 22px;
  text-align: center;
}
.envios-ia-detail-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 18px 22px 14px;
  border-bottom: 1px solid rgba(0,0,0,.06);
}
.envios-ia-detail-head h3 {
  font-size: 1.12rem;
  font-weight: 600;
  color: #1d1d1f;
  letter-spacing: -0.01em;
  line-height: 1.25;
}
.envios-ia-detail-head .envio-notas {
  font-size: .78rem;
  color: #86868b;
  font-style: normal;
  margin-top: 2px !important;
  letter-spacing: -0.005em;
}

/* Segmented control (origen) */
.envios-ia-segmented {
  display: flex;
  background: rgba(120,120,128,.12);
  border-radius: 9px;
  padding: 2px;
  margin: 0 4px 12px;
  gap: 0;
}
.envios-ia-segmented button {
  flex: 1 1 0;
  appearance: none;
  border: 0;
  background: transparent;
  padding: 6px 10px;
  font-size: .78rem;
  font-weight: 500;
  color: #1d1d1f;
  border-radius: 7px;
  cursor: pointer;
  transition: background .18s, box-shadow .18s;
  letter-spacing: -0.005em;
}
.envios-ia-segmented button.active {
  background: #fff;
  font-weight: 600;
  box-shadow: 0 3px 8px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
}

.envios-ia-requests {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 2px 2px 8px;
  margin: 0 -2px;
  scrollbar-width: thin;
}
.envios-ia-requests::-webkit-scrollbar { width: 6px; }
.envios-ia-requests::-webkit-scrollbar-thumb { background: rgba(0,0,0,.15); border-radius: 3px; }
.envios-ia-requests::-webkit-scrollbar-thumb:hover { background: rgba(0,0,0,.25); }

.envios-ia-request {
  appearance: none;
  border: 0;
  text-align: left;
  width: 100%;
  border-radius: 12px;
  background: #fff;
  padding: 12px 14px;
  cursor: pointer;
  transition: background .16s, transform .08s;
  box-shadow: 0 1px 2px rgba(0,0,0,.04);
  position: relative;
  overflow: hidden;
}
.envios-ia-request:hover {
  background: #fafafa;
}
.envios-ia-request:active { transform: scale(.985); }
.envios-ia-request.active {
  background: #fff;
  box-shadow: 0 0 0 2px #0a84ff, 0 6px 16px rgba(10,132,255,.14);
}
.envios-ia-request::before {
  content: '';
  position: absolute;
  left: 10px; top: 14px;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: #d2d2d7;
}
.envios-ia-request.pending::before { background: #ff3b30; box-shadow: 0 0 0 3px rgba(255,59,48,.15); }
.envios-ia-request.responded::before { background: #34c759; }
.envios-ia-request-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 0 0 3px 14px;
}
.envios-ia-request-item {
  font-size: .92rem;
  font-weight: 600;
  color: #1d1d1f;
  letter-spacing: -0.01em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
  flex: 1;
}
.envios-ia-status-pill {
  font-size: .68rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  letter-spacing: .01em;
  flex-shrink: 0;
}
.envios-ia-status-pill.pending { background: rgba(255,59,48,.12); color: #c41e1e; }
.envios-ia-status-pill.responded { background: rgba(52,199,89,.14); color: #1e7a35; }
.envios-ia-request-client {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  font-size: .76rem;
  color: #86868b;
  margin: 0 0 3px 14px;
  letter-spacing: -0.005em;
}
.envios-ia-origen-chip {
  font-size: .66rem;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: 6px;
  letter-spacing: .005em;
}
.envios-ia-origen-chip.tienda { background: rgba(255,149,0,.15); color: #b25a00; }
.envios-ia-origen-chip.whatsapp { background: rgba(52,199,89,.14); color: #1e7a35; }
.envios-ia-request-snippet {
  font-size: .78rem;
  color: #515154;
  margin-left: 14px;
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  letter-spacing: -0.005em;
}

.envios-ia-empty {
  flex: 1;
  min-height: 320px;
  display: grid;
  place-content: center;
  text-align: center;
  color: #86868b;
  padding: 24px;
}
.envios-ia-empty h3 {
  font-size: 1.05rem;
  font-weight: 600;
  color: #1d1d1f;
  margin-bottom: 6px;
  letter-spacing: -0.01em;
}
.envios-ia-empty p {
  font-size: .88rem;
  color: #86868b;
  letter-spacing: -0.005em;
  max-width: 320px;
}

.envios-ia-detail-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 22px 12px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 0;
}

.envios-ia-context-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.envios-ia-context-card {
  background: #f5f5f7;
  border: 0;
  border-radius: 14px;
  padding: 12px 14px;
}
.envios-ia-context-card strong {
  font-size: .7rem;
  font-weight: 600;
  color: #86868b;
  text-transform: uppercase;
  letter-spacing: .04em;
  display: block;
  margin-bottom: 5px;
}
.envios-ia-context-card p {
  font-size: .95rem !important;
  font-weight: 600 !important;
  color: #1d1d1f;
  margin: 0;
  letter-spacing: -0.01em;
}
.envios-ia-pre {
  margin: 0;
  white-space: pre-wrap;
  font-family: inherit;
  font-size: .84rem;
  color: #1d1d1f;
  font-weight: 500;
  line-height: 1.45;
  letter-spacing: -0.005em;
}

.envios-ia-chat {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 340px;
  overflow-y: auto;
  padding: 4px 2px;
  scrollbar-width: thin;
}
.envios-ia-chat::-webkit-scrollbar { width: 5px; }
.envios-ia-chat::-webkit-scrollbar-thumb { background: rgba(0,0,0,.12); border-radius: 3px; }

.envios-ia-msg,
.envios-ia-message {
  max-width: 78%;
  padding: 9px 13px;
  border-radius: 18px;
  background: #e9e9eb;
  border: 0;
  color: #1d1d1f;
  font-size: .9rem;
  line-height: 1.4;
  letter-spacing: -0.005em;
  word-wrap: break-word;
}
.envios-ia-msg p,
.envios-ia-message p { margin: 0; }
.envios-ia-msg--cliente,
.envios-ia-message.cliente {
  align-self: flex-start;
  background: #e9e9eb;
  border-bottom-left-radius: 5px;
}
.envios-ia-msg--ia,
.envios-ia-msg--sistema,
.envios-ia-message.ia,
.envios-ia-message.sistema {
  align-self: flex-start;
  background: #f0e7fc;
  color: #4e2a9a;
  border-bottom-left-radius: 5px;
}
.envios-ia-msg--operador,
.envios-ia-message.operador {
  align-self: flex-end;
  background: #0a84ff;
  color: #fff;
  border-bottom-right-radius: 5px;
}
.envios-ia-msg-who {
  display: block;
  font-size: .68rem;
  font-weight: 600;
  opacity: .65;
  margin-bottom: 2px;
  letter-spacing: .005em;
}
.envios-ia-msg-time,
.envios-ia-message-meta {
  display: block;
  margin-top: 3px;
  font-size: .66rem;
  color: rgba(0,0,0,.5);
  letter-spacing: .005em;
}
.envios-ia-msg--operador .envios-ia-msg-time,
.envios-ia-msg--operador .envios-ia-msg-who { color: rgba(255,255,255,.75); }

.envios-ia-form {
  display: grid;
  gap: 10px;
  padding: 14px 22px 18px;
  border-top: 1px solid rgba(0,0,0,.06);
  background: rgba(245,245,247,.65);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
}
.envios-ia-form label {
  font-size: .8rem;
  color: #1d1d1f;
  font-weight: 500;
  display: flex;
  flex-direction: column;
  gap: 4px;
  letter-spacing: -0.005em;
}
.envios-ia-form textarea,
.envios-ia-form input[type="text"],
.envios-ia-form input:not([type="checkbox"]),
.envios-ia-form select {
  width: 100%;
  border: 1px solid rgba(0,0,0,.1);
  border-radius: 10px;
  padding: 10px 12px;
  font-family: inherit;
  font-size: .9rem;
  background: #fff;
  color: #1d1d1f;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.envios-ia-form textarea:focus,
.envios-ia-form input:focus,
.envios-ia-form select:focus {
  border-color: #0a84ff;
  box-shadow: 0 0 0 3px rgba(10,132,255,.18);
}
.envios-ia-check {
  flex-direction: row !important;
  align-items: center;
  gap: 8px !important;
  font-size: .82rem !important;
  color: #515154 !important;
}
.envios-ia-check input { width: auto !important; }
.envios-ia-quick-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}
.envios-ia-quick-actions .btn {
  border-radius: 999px !important;
  padding: 7px 14px !important;
  font-size: .8rem !important;
  font-weight: 600 !important;
  border: 0 !important;
  letter-spacing: -0.005em;
}
.envios-ia-quick-actions .btn.ios-green { background: #34c759 !important; color: #fff !important; }
.envios-ia-quick-actions .btn.ios-red { background: rgba(255,59,48,.12) !important; color: #c41e1e !important; }
.envios-ia-quick-actions .btn.ios-blue { background: #0a84ff !important; color: #fff !important; }
/* Artículo manual — tarjeta colapsable */
.ia-product-card {
  border: 1px solid var(--border, #e2e8f0);
  border-radius: .55rem;
  background: var(--surface-alt, #f8fafc);
  overflow: hidden;
}
.ia-product-card-head {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .6rem .85rem;
  cursor: pointer;
  font-size: .84rem;
  font-weight: 600;
  color: var(--text, #1a202c);
  list-style: none;
  user-select: none;
}
.ia-product-card-head::-webkit-details-marker { display: none; }
.ia-product-card-head::before {
  content: '▶';
  font-size: .6rem;
  transition: transform .15s;
  color: var(--text-muted, #64748b);
}
details[open].ia-product-card .ia-product-card-head::before { transform: rotate(90deg); }
.ia-product-card-hint {
  font-weight: 400;
  color: var(--text-muted, #64748b);
  font-size: .74rem;
  margin-left: auto;
}
.ia-product-fields {
  padding: .7rem .85rem .85rem;
  display: flex;
  flex-direction: column;
  gap: .55rem;
  border-top: 1px solid var(--border, #e2e8f0);
}
.ia-product-fields label {
  display: flex;
  flex-direction: column;
  gap: .26rem;
  font-size: .78rem;
  font-weight: 600;
  color: var(--text-muted, #64748b);
}
.ia-product-fields label input,
.ia-product-fields label select {
  padding: .45rem .6rem;
  border: 1px solid var(--border, #cbd5e1);
  border-radius: .4rem;
  font-size: .88rem;
  background: var(--surface, #fff);
  color: var(--text, #1a202c);
  min-height: 40px;
  width: 100%;
  box-sizing: border-box;
}
.ia-product-fields label input:focus,
.ia-product-fields label select:focus {
  outline: 2px solid var(--primary, #1a7a6e);
  outline-offset: -1px;
  border-color: var(--primary, #1a7a6e);
}
.ia-product-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .55rem;
}
.envios-ia-check {
  display: flex;
  align-items: center;
  gap: .55rem;
  font-size: .9rem;
  color: #334155;
}

@media (max-width: 980px) {
  .envios-ia-layout {
    grid-template-columns: 1fr;
  }
  .envios-ia-requests {
    max-height: none;
  }
  .envios-ia-context-grid {
    grid-template-columns: 1fr;
  }
  .ia-product-row {
    grid-template-columns: 1fr;
  }
  .envios-ia-message {
    max-width: 100%;
  }
}
/* ── /Panel de Envíos ─────────────────────────────────────────────────────── */

/* ═══════════════════════════════════════════════════════════════════════════
   ADMIN CATALOG OVERLAY — bottom-sheet al estilo del catálogo de pedidos
   ═══════════════════════════════════════════════════════════════════════════ */

.adm-catalog-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  z-index: 1100;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: overlayFadeIn 0.12s ease;
}
.adm-catalog-overlay.hidden { display: none !important; }

.adm-catalog-sheet {
  background: var(--surface, #fff);
  border-radius: 20px 20px 0 0;
  width: 100%;
  max-width: 980px;
  height: 92vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 -8px 48px rgba(15, 23, 42, 0.18);
  animation: modalSlideUp 0.15s cubic-bezier(0.32, 0.72, 0, 1);
  overflow: hidden;
  will-change: transform;
}

/* Header del catalogo admin */
.adm-catalog-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 20px 10px;
  border-bottom: 1px solid var(--border, #e2e8f0);
  flex-shrink: 0;
  gap: 10px;
}
.adm-catalog-head-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* Cuerpo scrollable del catálogo admin */
.adm-catalog-body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 10px 14px 80px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* ── Fila de ítem (área, categoría, producto, usuario, rol) ── */
.adm-item-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1.5px solid var(--border-light, #e2e8f0);
  background: var(--surface, #fff);
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}
.adm-item-row:hover {
  border-color: var(--primary, #1a7a6e);
  background: #f0fafa;
  box-shadow: 0 2px 8px rgba(26, 122, 110, 0.08);
}

.adm-item-avatar {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--primary-light, #d1fae5);
  color: var(--primary, #1a7a6e);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1rem;
  flex-shrink: 0;
}

.adm-item-info {
  flex: 1;
  min-width: 0;
}
.adm-item-name {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text, #1a202c);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.adm-item-meta {
  font-size: 0.75rem;
  color: var(--text-muted, #64748b);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.adm-item-price {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--primary, #1a7a6e);
  flex-shrink: 0;
  white-space: nowrap;
}

.adm-item-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  flex-shrink: 0;
}
.adm-badge {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 99px;
  white-space: nowrap;
  line-height: 1.5;
}
.adm-badge-active   { background: #d1fae5; color: #065f46; }
.adm-badge-inactive { background: #fee2e2; color: #991b1b; }
.adm-badge-cat      { background: #e0e7ff; color: #3730a3; }
.adm-badge-area     { background: #fef3c7; color: #92400e; }
.adm-badge-role     { background: #f3e8ff; color: #6b21a8; }
.adm-badge-type     { background: #f1f5f9; color: #475569; }

.adm-item-actions {
  display: flex;
  gap: 5px;
  flex-shrink: 0;
}
.adm-item-actions .btn {
  padding: .22rem .52rem;
  font-size: .8rem;
  min-height: 30px;
  line-height: 1.2;
}

/* Mensaje vacío */
.adm-catalog-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 20px;
  color: var(--text-muted, #64748b);
  gap: 8px;
}
.adm-catalog-empty-icon { font-size: 2.2rem; }
.adm-catalog-empty p { margin: 0; font-size: 0.88rem; }

/* Ocultar el wrap del buscador cuando no aplica */
.catalog-search-wrap.adm-hidden-search input { display: none; }
.catalog-search-wrap.adm-hidden-search .catalog-search-icon { display: none; }

/* ═══════════════════════════════════════════════════════════════════════════
   ADMIN FORM OVERLAY — bottom-sheet para crear / editar registros
   ═══════════════════════════════════════════════════════════════════════════ */

.adm-form-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.60);
  z-index: 1200;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: overlayFadeIn 0.1s ease;
}
.adm-form-overlay.hidden { display: none !important; }

.adm-form-sheet {
  background: var(--surface, #fff);
  border-radius: 20px 20px 0 0;
  width: 100%;
  max-width: 580px;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 -8px 48px rgba(15, 23, 42, 0.22);
  animation: modalSlideUp 0.15s cubic-bezier(0.32, 0.72, 0, 1);
  overflow: hidden;
}

/* Variante ancha para edición/creación de Producto — más espacio horizontal
   para el formulario (campos en 2 columnas, foto, etc.) */
.adm-form-sheet.adm-form-sheet--wide {
  max-width: 1040px;
}
.adm-form-sheet.adm-form-sheet--wide #adminEditFields.adm-edit-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 18px;
  row-gap: 0.85rem;
  align-items: start;
}
/* Permitir que campos específicos (textarea, foto, visibilidad) ocupen ambas columnas */
.adm-form-sheet.adm-form-sheet--wide #adminEditFields.adm-edit-fields > .adm-span-2,
.adm-form-sheet.adm-form-sheet--wide #adminEditFields.adm-edit-fields > textarea,
.adm-form-sheet.adm-form-sheet--wide #adminEditFields.adm-edit-fields > label:has(textarea),
.adm-form-sheet.adm-form-sheet--wide #adminEditFields.adm-edit-fields > .adm-visibility-row,
.adm-form-sheet.adm-form-sheet--wide #adminEditFields.adm-edit-fields > .adm-photo-row,
.adm-form-sheet.adm-form-sheet--wide #adminEditFields.adm-edit-fields > .prod-img-row,
.adm-form-sheet.adm-form-sheet--wide #adminEditFields.adm-edit-fields > .product-name-suggestions,
.adm-form-sheet.adm-form-sheet--wide #adminEditFields.adm-edit-fields > .prod-img-url-row {
  grid-column: 1 / -1;
}

.adm-form-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 20px 12px;
  border-bottom: 1px solid var(--border, #e2e8f0);
  flex-shrink: 0;
}
.adm-form-head h3 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text, #1a202c);
}

/* campos del formulario — scroll si hay muchos */
#adminEditFields.adm-edit-fields {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px 8px;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.adm-form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 12px 20px 8px;
  border-top: 1px solid var(--border, #e2e8f0);
  flex-shrink: 0;
}

.photo-upload-progress {
  padding: 0 20px 16px;
  flex-shrink: 0;
}

.photo-upload-progress.hidden {
  display: none;
}

.photo-upload-progress-bar {
  height: 6px;
  background: #e2e8f0;
  border-radius: 99px;
  overflow: hidden;
  margin-bottom: 5px;
}

.photo-upload-progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #2563eb, #60a5fa);
  border-radius: 99px;
  transition: width 0.2s ease;
}

.photo-upload-progress-label {
  font-size: .78rem;
  color: #2563eb;
}

/* Responsivo */
@media (max-width: 600px) {
  .adm-catalog-sheet {
    max-width: 100%;
    height: 93vh;
    border-radius: 18px 18px 0 0;
  }
  .adm-catalog-head {
    flex-wrap: wrap;
    padding: 8px 14px 8px;
  }
  .adm-catalog-head-actions {
    flex-wrap: wrap;
  }
  .adm-form-sheet {
    max-width: 100%;
    max-height: 95vh;
    border-radius: 18px 18px 0 0;
  }
  /* En móvil, variante ancha de producto colapsa a 1 columna */
  .adm-form-sheet.adm-form-sheet--wide #adminEditFields.adm-edit-fields {
    grid-template-columns: 1fr;
  }
  .adm-item-price { display: none; }
  .adm-item-badges { display: none; }
  .adm-item-meta { display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
}

/* ── Modal selección de usuario (rendimiento) ──────────────────────────────── */
.perform-user-list {
  max-height: 320px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.perform-user-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #f8fafc;
  cursor: pointer;
  font-size: 0.95rem;
  transition: background .15s, border-color .15s;
}
.perform-user-btn:hover {
  background: #eef6f5;
  border-color: #0f5d52;
}
.perform-user-btn .user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #0f5d52;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  flex-shrink: 0;
}
.perform-user-btn .user-info {
  display: flex;
  flex-direction: column;
}
.perform-user-btn .user-name {
  font-weight: 600;
}
.perform-user-btn .user-role {
  font-size: 0.8rem;
  color: #64748b;
}
.perform-user-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #0f5d52;
  color: #fff;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
}
.perform-user-badge.hidden { display: none; }

/* ═══════════════════════════════════════════════════════════
   CHAT IA ADMINISTRADOR
═══════════════════════════════════════════════════════════ */
.admin-ia-badge {
  background: #22c55e;
  color: #fff;
  font-size: 0.72rem;
  padding: 2px 10px;
  border-radius: 999px;
  font-weight: 600;
}

.admin-ia-layout {
  display: flex;
  gap: 16px;
  height: calc(100vh - 160px);
  min-height: 400px;
}

.admin-ia-sidebar {
  width: 190px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow-y: auto;
}

.admin-ia-sidebar-title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.admin-ia-chip {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px 10px;
  font-size: 0.8rem;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  color: var(--text);
}
.admin-ia-chip:hover {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.admin-ia-chat-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}

.admin-ia-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.admin-ia-bubble {
  max-width: 80%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 0.88rem;
  line-height: 1.5;
  word-break: break-word;
}

.admin-ia-bubble--user {
  align-self: flex-end;
  background: var(--primary);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.admin-ia-bubble--ai {
  align-self: flex-start;
  background: var(--bg);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
}

.admin-ia-bubble--ai.loading {
  opacity: 0.6;
  font-style: italic;
}

.admin-ia-bubble--ai.error {
  background: #fef2f2;
  border-color: #fca5a5;
  color: #b91c1c;
}

.admin-ia-input-area {
  border-top: 1px solid var(--border);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.admin-ia-textarea {
  width: 100%;
  resize: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 0.88rem;
  font-family: inherit;
  background: var(--bg);
  color: var(--text);
  outline: none;
  transition: border-color 0.15s;
}
.admin-ia-textarea:focus {
  border-color: var(--primary);
}

.admin-ia-input-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.admin-ia-voice-btn {
  font-size: 1.1rem;
  padding: 6px 12px;
}
.admin-ia-voice-btn.recording {
  background: #ef4444;
  color: #fff;
  border-color: #ef4444;
  animation: pulse-red 1s infinite;
}

@keyframes pulse-red {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239,68,68,0.4); }
  50%       { box-shadow: 0 0 0 6px rgba(239,68,68,0); }
}

@media (max-width: 640px) {
  .admin-ia-layout    { flex-direction: column; height: auto; }
  .admin-ia-sidebar   { width: 100%; flex-direction: row; flex-wrap: wrap; }
  .admin-ia-chip      { flex: 1 1 auto; text-align: center; }
  .admin-ia-messages  { min-height: 280px; }
}

/* ── Foto de usuario en administración ──────────────────────────────────── */
.adm-item-avatar-img {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  border: 2px solid var(--border, #e2e8f0);
}

/* Thumbnail de producto en lista de admin — cuadrado redondeado */
.adm-prod-thumb {
  border-radius: 10px;
  border: 1.5px solid var(--border, #e2e8f0);
}

.user-photo-upload-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 12px;
  border: 2px dashed var(--border, #e2e8f0);
  border-radius: 12px;
  background: var(--bg-secondary, #f8fafc);
  margin-bottom: 4px;
}

.user-photo-preview {
  width: 90px;
  height: 90px;
  border-radius: 50%;
  background: var(--bg, #fff);
  border: 2px solid var(--border, #e2e8f0);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  font-size: 2rem;
}

.user-photo-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.user-photo-placeholder {
  font-size: 2rem;
  opacity: .5;
}

.user-photo-actions {
  display: flex;
  gap: 8px;
}

.user-photo-hint {
  font-size: .75rem;
  color: var(--text-muted, #64748b);
  margin: 0;
  text-align: center;
}

/* ── Imagen compacta de producto ────────────────────────────────────────────── */
.prod-img-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: var(--bg-secondary, #f8fafc);
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 10px;
}

.prod-img-thumb {
  width: 52px;
  height: 52px;
  flex-shrink: 0;
  border-radius: 8px;
  background: var(--bg, #fff);
  border: 1px solid var(--border, #e2e8f0);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  color: #94a3b8;
}

.prod-img-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.prod-img-controls {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  flex-wrap: wrap;
}

.prod-img-label {
  font-size: .78rem;
  color: var(--text-muted, #64748b);
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.prod-img-progress {
  height: 4px;
  background: #e2e8f0;
  border-radius: 99px;
  overflow: hidden;
  margin-top: 4px;
  width: 100%;
  display: none;
}

.prod-img-progress.visible { display: block; }

.prod-img-progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #2563eb, #60a5fa);
  border-radius: 99px;
  transition: width 0.15s ease;
}

.btn-sm {
  padding: 4px 10px;
  font-size: .78rem;
}

/* ── Tabs método de asistencia ─────────────────────────────────────────── */
.att-method-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 14px;
  border-bottom: 2px solid var(--border, #e2e8f0);
  padding-bottom: 6px;
}

.att-method-tab {
  flex: 1;
  padding: 7px;
  border: none;
  background: none;
  cursor: pointer;
  border-radius: 8px;
  font-size: .85rem;
  font-weight: 600;
  color: var(--text-muted, #64748b);
  transition: background .15s, color .15s;
}

.att-method-tab.active {
  background: var(--primary, #2563eb);
  color: #fff;
}

/* ── Modal reconocimiento facial ───────────────────────────────────────── */
.face-att-card {
  max-width: 640px;
  width: 96%;
  padding: 24px;
}

.face-video-wrap {
  position: relative;
  width: 100%;
  border-radius: 12px;
  overflow: hidden;
  background: #000;
  aspect-ratio: 4/3;
  margin: 12px 0;
}

.face-video-wrap video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1);
}

.face-video-wrap canvas {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  transform: scaleX(-1);
}

.face-scan-line {
  position: absolute;
  top: 0;
  left: 0; right: 0;
  height: 2px;
  background: rgba(37, 99, 235, 0.7);
  animation: scan-move 2s linear infinite;
  pointer-events: none;
  will-change: transform;
}

@keyframes scan-move {
  0%   { transform: translateY(0); }
  50%  { transform: translateY(var(--scan-travel, 200px)); }
  100% { transform: translateY(0); }
}

.face-status {
  text-align: center;
  font-size: .85rem;
  color: var(--text-muted, #64748b);
  min-height: 20px;
}

.face-result {
  margin-top: 14px;
  padding: 14px;
  background: var(--bg-secondary, #f0fdf4);
  border: 2px solid #22c55e;
  border-radius: 12px;
  text-align: center;
}

.face-result-avatar {
  width: 110px;
  height: 110px;
  border-radius: 50%;
  background: #22c55e;
  color: #fff;
  font-weight: 700;
  font-size: 2.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 14px;
  box-shadow: 0 6px 18px -4px rgba(34,197,94,0.55);
}

.face-result-name {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--text, #1e293b);
  margin-bottom: 6px;
  letter-spacing: .01em;
}

.face-result-meta {
  display: inline-block;
  font-size: 1.6rem;
  font-weight: 800;
  color: #065f46;
  background: #d1fae5;
  border: 2px solid #22c55e;
  border-radius: 999px;
  padding: 10px 22px;
  margin-top: 8px;
  letter-spacing: .02em;
  box-shadow: 0 4px 12px -4px rgba(34,197,94,0.4);
}

.face-result-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  display: block;
}

/* ===== SOLICITUDES INTERNAS ===== */
.solicitud-icon-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.15rem;
  padding: 2px 6px;
  border-radius: 6px;
  vertical-align: middle;
  margin-left: 8px;
  transition: background 0.15s;
  line-height: 1;
}
.solicitud-icon-btn:hover { background: rgba(0,0,0,0.07); }
.solicitud-icon-btn svg { width: 18px; height: 18px; display: inline-block; vertical-align: middle; color: currentColor; }
.solicitud-icon-btn .solicitud-badge {
  position: relative;
  top: -8px;
  right: 2px;
  background: #e53e3e;
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  border-radius: 999px;
  padding: 1px 5px;
  min-width: 16px;
  text-align: center;
  display: inline-block;
  line-height: 1.4;
}

/* Overlay backdrop */
.solicitud-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 1100;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: fadeIn 0.15s ease;
}
.solicitud-overlay.hidden { display: none; }

/* Bottom sheet */
.solicitud-sheet {
  background: #fff;
  border-radius: 18px 18px 0 0;
  width: 100%;
  max-width: 520px;
  padding: 20px 20px 32px;
  box-shadow: 0 -4px 24px rgba(0,0,0,0.15);
  animation: slideUp 0.2s ease;
}
.solicitud-sheet--nota { padding-bottom: 24px; }

.solicitud-sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.solicitud-sheet-head h3 {
  font-size: 1.05rem;
  font-weight: 700;
  margin: 0;
  flex: 1;
  text-align: center;
}
.solicitud-hint {
  text-align: center;
  color: #64748b;
  font-size: 0.85rem;
  margin: 0 0 14px;
}

/* Grid de roles */
.solicitud-roles-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}
@media (max-width: 440px) {
  .solicitud-roles-grid { grid-template-columns: repeat(2, 1fr); }
}
.solicitud-role-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 14px 6px 10px;
  border-radius: 12px;
  border: 2px solid #e2e8f0;
  background: #f8fafc;
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 600;
  color: #1e293b;
  transition: border-color 0.15s, background 0.15s, transform 0.1s;
}
.solicitud-role-btn:hover {
  border-color: #0f5d52;
  background: #f0fdf4;
  transform: translateY(-2px);
}
.solicitud-role-btn .sr-emoji { font-size: 1.7rem; }

/* Textarea y envío */
.solicitud-textarea {
  width: 100%;
  border: 1.5px solid #cbd5e1;
  border-radius: 10px;
  padding: 12px;
  font-size: 0.95rem;
  font-family: inherit;
  resize: vertical;
  min-height: 90px;
  margin-top: 8px;
  box-sizing: border-box;
  transition: border-color 0.15s;
}
.solicitud-textarea:focus { outline: none; border-color: #0f5d52; }
.solicitud-chars {
  text-align: right;
  font-size: 0.78rem;
  color: #94a3b8;
  margin: 4px 0 12px;
}
.solicitud-send-btn {
  width: 100%;
  padding: 13px;
  font-size: 1rem;
  font-weight: 700;
  border-radius: 10px;
}

/* Panel de solicitudes recibidas (cocina) */
.solicitudes-panel {
  margin-bottom: 16px;
}
.solicitudes-panel-title {
  font-weight: 700;
  font-size: 0.95rem;
  color: #1e293b;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.solicitud-card {
  background: #fffbeb;
  border: 1.5px solid #fcd34d;
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 8px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
}
.solicitud-card--preparando {
  background: #eff6ff;
  border-color: #93c5fd;
}
.solicitud-card--listo {
  background: #f0fdf4;
  border-color: #86efac;
  opacity: 0.7;
}
.solicitud-card-body { flex: 1; min-width: 0; }
.solicitud-card-who {
  font-size: 0.78rem;
  font-weight: 700;
  color: #92400e;
  margin-bottom: 2px;
}
.solicitud-card--preparando .solicitud-card-who { color: #1d4ed8; }
.solicitud-card-msg {
  font-size: 0.9rem;
  color: #1e293b;
  word-break: break-word;
  margin-bottom: 6px;
}
.solicitud-card-time { font-size: 0.75rem; color: #94a3b8; }
.solicitud-card-actions { display: flex; gap: 6px; flex-shrink: 0; flex-direction: column; align-items: flex-end; }
.solicitud-card-actions .btn { font-size: 0.8rem; padding: 5px 10px; }

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

/* ── Split order modal V2 — tap-to-assign ─────────────────────────────── */
.modal-card.split-v2 {
  padding: 18px 20px 16px !important;
  gap: 12px;
}
.split-v2-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.split-v2-head h3 {
  font-size: 1.1rem;
  font-weight: 700;
}
.split-v2-subtitle {
  font-size: .82rem;
  color: #64748b;
  margin: -2px 0 0 !important;
}
.split-v2-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px;
  background: #F4F7FB;
  border-radius: 12px;
  border: 1px solid #E2E8F0;
}
.split-v2-action {
  flex: 1 1 auto;
  min-height: 40px;
  border: 1px solid #CBD5E1;
  background: #fff;
  border-radius: 10px;
  padding: 8px 10px;
  font-size: .82rem;
  font-weight: 600;
  color: #0f172a;
  cursor: pointer;
  transition: background .12s, border-color .12s, transform .05s;
  white-space: nowrap;
}
.split-v2-action:hover { background: #F1F5F9; border-color: #94A3B8; }
.split-v2-action:active { transform: scale(0.97); }

.split-v2-accounts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 4px 0 2px;
}
.split-v2-acct {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px 8px 8px;
  border-radius: 14px;
  min-width: 140px;
  flex: 1 1 140px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  position: relative;
}
.split-v2-acct-num {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(255,255,255,0.22);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.95rem;
  flex: 0 0 auto;
}
.split-v2-acct-info { flex: 1; min-width: 0; }
.split-v2-acct-total {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  line-height: 1.1;
}
.split-v2-acct-sub {
  font-size: 0.72rem;
  opacity: 0.85;
  font-weight: 500;
  margin-top: 2px;
}
.split-v2-acct-x {
  background: rgba(0,0,0,0.18);
  color: inherit;
  border: 0;
  border-radius: 50%;
  width: 22px;
  height: 22px;
  font-size: 11px;
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}
.split-v2-acct-x:hover { background: rgba(0,0,0,0.32); }
.split-v2-acct-add {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 140px;
  flex: 1 1 140px;
  background: #fff;
  border: 2px dashed #94A3B8;
  border-radius: 14px;
  color: #475569;
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  padding: 8px 10px;
  min-height: 48px;
}
.split-v2-acct-add:hover { border-color: #0A84FF; color: #0A84FF; background: #F0F7FF; }

.split-v2-items {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 4px 2px 2px;
  max-height: 48vh;
}
.split-v2-item {
  background: #fff;
  border: 1px solid #E2E8F0;
  border-radius: 14px;
  padding: 10px 12px;
  box-shadow: 0 1px 2px rgba(15,23,42,0.04);
}
.split-v2-item-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}
.split-v2-item-name {
  font-size: 0.92rem;
  font-weight: 600;
  color: #0f172a;
  line-height: 1.25;
  min-width: 0;
}
.split-v2-item-qty {
  color: #64748b;
  font-weight: 500;
  font-size: 0.82rem;
  margin-left: 4px;
}
.split-v2-item-price {
  font-size: 0.92rem;
  font-weight: 700;
  color: #0f172a;
  white-space: nowrap;
  flex: 0 0 auto;
}
.split-v2-item-notes {
  font-size: 0.76rem;
  color: #92400e;
  font-style: italic;
  margin-bottom: 6px;
  background: #FFFBEB;
  padding: 4px 8px;
  border-radius: 6px;
}
.split-v2-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.split-v2-chip {
  border: 0;
  border-radius: 999px;
  padding: 7px 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  font-size: 0.82rem;
  cursor: pointer;
  min-height: 34px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.12);
  transition: transform .08s ease, box-shadow .12s ease;
}
.split-v2-chip:hover { box-shadow: 0 3px 8px rgba(0,0,0,0.18); }
.split-v2-chip:active { transform: scale(0.95); }
.split-v2-chip-num {
  background: rgba(255,255,255,0.28);
  border-radius: 50%;
  width: 20px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  font-weight: 800;
}
.split-v2-chip-price {
  font-weight: 700;
  letter-spacing: 0.01em;
}

.split-v2-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-top: 10px;
  border-top: 1px solid #E2E8F0;
  flex-wrap: wrap;
}
.split-v2-msg {
  font-size: .78rem;
  color: #dc2626;
  flex: 1 1 auto;
  min-width: 0;
}
.split-v2-foot-btns {
  display: flex;
  gap: 8px;
  flex: 0 0 auto;
}

/* Responsive — móvil */
@media (max-width: 520px) {
  .modal-card.split-v2 { padding: 14px 14px 12px !important; }
  .split-v2-actions { padding: 6px; gap: 6px; }
  .split-v2-action {
    flex: 1 1 calc(50% - 3px);
    font-size: .78rem;
    padding: 7px 6px;
  }
  .split-v2-acct,
  .split-v2-acct-add { flex: 1 1 calc(50% - 4px); min-width: 0; }
  .split-v2-acct-total { font-size: .92rem; }
  .split-v2-item-name { font-size: .88rem; }
  .split-v2-chip { padding: 8px 12px; font-size: .82rem; }
  .split-v2-foot { flex-direction: column; align-items: stretch; }
  .split-v2-foot-btns { justify-content: space-between; }
  .split-v2-foot-btns .btn { flex: 1; }
}

/* ─── Notas del Equipo ───────────────────────────────────────────────────── */
.tnotes-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  margin: 0 0 20px;
}

.tnotes-header {
  padding: 16px 20px 14px;
  background: linear-gradient(135deg, #064e3b 0%, #059669 100%);
}

.tnotes-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
}

.tnotes-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
}

.tnotes-badge {
  background: rgba(255,255,255,0.25);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 20px;
  letter-spacing: 0.02em;
}

.tnotes-subtitle {
  margin: 0;
  font-size: 0.75rem;
  color: rgba(255,255,255,0.75);
}

/* Área de composición */
.tnotes-compose {
  padding: 14px 16px 10px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-alt, #f9fafb);
}

/* Selector de autor */
.tnotes-author-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.tnotes-author-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
  flex-shrink: 0;
}

.tnotes-author-select {
  flex: 1;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 0.875rem;
  font-family: inherit;
  color: var(--text);
  background: #fff;
  cursor: pointer;
  min-width: 0;
}

.tnotes-author-select:focus {
  outline: none;
  border-color: #059669;
}

.tnotes-shortcuts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.tnote-chip {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 4px 10px;
  font-size: 0.78rem;
  cursor: pointer;
  color: var(--text);
  transition: background 0.15s, border-color 0.15s;
  white-space: nowrap;
}

.tnote-chip:hover {
  background: #ecfdf5;
  border-color: #059669;
  color: #065f46;
}

.tnotes-input-row {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}

.tnotes-textarea {
  flex: 1;
  resize: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 0.875rem;
  font-family: inherit;
  color: var(--text);
  background: #fff;
  line-height: 1.5;
  transition: border-color 0.15s;
  min-height: 52px;
}

.tnotes-textarea:focus {
  outline: none;
  border-color: #059669;
}

.tnotes-send-btn {
  padding: 8px 18px;
  white-space: nowrap;
  background: #059669 !important;
  border-color: #059669 !important;
  flex-shrink: 0;
  align-self: flex-end;
}

.tnotes-send-btn:hover { background: #047857 !important; border-color: #047857 !important; }

.tnotes-charcount {
  text-align: right;
  font-size: 0.72rem;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* Lista de notas del día */
.tnotes-day-block {
  padding: 12px 16px;
}

.tnotes-day-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
  margin-bottom: 10px;
}

.tnotes-refresh-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 2px 8px;
  font-size: 0.8rem;
}

.tnotes-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tnotes-empty {
  text-align: center;
  color: var(--text-secondary);
  font-size: 0.85rem;
  padding: 18px 0;
}

/* Nota individual */
.tnote-item {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 10px 12px;
  background: var(--surface-alt, #f9fafb);
  border: 1px solid var(--border);
  border-radius: 10px;
  transition: border-color 0.15s;
}

.tnote-item:hover { border-color: #a7f3d0; }

.tnote-item.mine { border-left: 3px solid #059669; }

.tnote-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #d1fae5;
  color: #065f46;
  font-size: 0.8rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.tnote-body { flex: 1; min-width: 0; }

.tnote-meta {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-bottom: 4px;
  flex-wrap: wrap;
}

.tnote-author {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text);
}

.tnote-role {
  font-size: 0.72rem;
  color: var(--text-secondary);
  background: var(--border);
  padding: 1px 6px;
  border-radius: 10px;
}

.tnote-time {
  font-size: 0.72rem;
  color: var(--text-secondary);
  margin-left: auto;
}

.tnote-text {
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
}

.tnote-del-btn {
  background: none;
  border: none;
  color: #ef4444;
  cursor: pointer;
  font-size: 0.85rem;
  padding: 2px 4px;
  border-radius: 4px;
  opacity: 0;
  transition: opacity 0.15s;
  flex-shrink: 0;
}

.tnote-item:hover .tnote-del-btn { opacity: 1; }
.tnote-del-btn:hover { background: #fee2e2; }

/* Sección días anteriores */
.tnotes-prev-details {
  border-top: 1px solid var(--border);
}

.tnotes-prev-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  user-select: none;
  list-style: none;
}

.tnotes-prev-summary::-webkit-details-marker { display: none; }

.tnotes-prev-details[open] .tnotes-prev-arrow { transform: rotate(90deg); }
.tnotes-prev-arrow { transition: transform 0.2s; font-size: 1rem; }

.tnotes-prev-content {
  padding: 0 16px 16px;
}

/* Grupo de notas por fecha (días anteriores) */
.tnotes-prev-day {
  margin-bottom: 16px;
}

.tnotes-prev-day-label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 8px;
}

/* Responsive móvil */
@media (max-width: 600px) {
  .tnotes-shortcuts { gap: 4px; }
  .tnote-chip { font-size: 0.72rem; padding: 3px 8px; }
  .tnotes-input-row { flex-direction: column; gap: 6px; }
  .tnotes-send-btn { width: 100%; }
  .tnote-time { margin-left: 0; }
}

/* ── IA Manual ──────────────────────────────────────────────────────────── */
.ia-manual-topbar {
  display: flex !important;
  align-items: center;
  justify-content: flex-end;
  padding: 3px 8px !important;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  gap: 6px !important;
  flex-wrap: nowrap !important;
  overflow-x: auto;
  scrollbar-width: none;
}
.ia-manual-topbar::-webkit-scrollbar { display: none; }
/* Ocultar título y badges redundantes para dejar sólo los botones de acción */
.ia-manual-topbar-left { display: none !important; }
.ia-manual-topbar-btns { width: 100%; justify-content: flex-end; gap: 6px !important; flex-wrap: nowrap !important; }
.ia-manual-topbar-btns .btn { font-size: .72rem !important; padding: 4px 8px !important; min-height: 28px; white-space: nowrap; }
.ia-manual-topbar-left { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ia-manual-topbar-btns { display: flex; gap: 8px; flex-shrink: 0; flex-wrap: wrap; }
.ia-manual-modo-badge {
  font-size: .76rem;
  padding: 3px 9px;
  border-radius: 999px;
  background: #fee2e2;
  color: #b91c1c;
  font-weight: 600;
  white-space: nowrap;
}
.ia-manual-modo-badge.active {
  background: #dcfce7;
  color: #15803d;
}
.ia-auto-badge {
  background: #fef3c7;
  color: #92400e;
}
.ia-auto-badge.active {
  background: #d1fae5;
  color: #065f46;
}

/* Banner IA esperando respuesta */
.ia-wait-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  padding: 8px 12px;
  margin: 6px 10px;
  font-size: .82rem;
  color: #1e40af;
}
.ia-wait-banner-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #3b82f6;
  animation: pulse-dot 1.4s ease-in-out infinite;
  flex-shrink: 0;
}
@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: .4; transform: scale(.7); }
}
.ia-wait-banner span:nth-child(2) { flex: 1; }

/* Pill IA esperando en lista de chats */
.ia-chat-ia-wait-pill {
  font-size: .68rem;
  padding: 1px 6px;
  border-radius: 999px;
  background: #dbeafe;
  color: #1d4ed8;
  font-weight: 600;
}
.ia-chat-ia-wait-dot { font-size: .8rem; }
.ia-chat-esperando { border-left: 3px solid #3b82f6 !important; }

.ia-manual-layout {
  display: flex;
  height: calc(100dvh - 92px);
  min-height: 520px;
  overflow: hidden;
}

/* Sidebar */
.ia-manual-sidebar {
  width: 240px;
  min-width: 200px;
  border-right: 1px solid #e2e8f0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: width .22s ease, min-width .22s ease;
}
.ia-manual-sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 8px;
  font-size: .78rem;
  font-weight: 600;
  border-bottom: 1px solid #f1f5f9;
  background: #f8fafc;
  gap: 6px;
}
.ia-manual-label-filters.ia-filters-inline {
  padding: 0;
  background: transparent;
  border-bottom: none;
  flex: 1;
  min-width: 0;
}
.ia-manual-search-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  border-bottom: 1px solid #e2e8f0;
  background: #fff;
}
.ia-manual-search-bar.hidden { display: none; }
.ia-manual-search-bar input[type="search"] {
  flex: 1;
  min-width: 0;
  padding: 6px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 16px;
  font-size: .85rem;
  outline: none;
  background: #f8fafc;
}
.ia-manual-search-bar input[type="search"]:focus {
  border-color: #6366f1;
  background: #fff;
  box-shadow: 0 0 0 2px rgba(99,102,241,.15);
}
.ia-search-clear-btn {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  border: none;
  background: #e2e8f0;
  color: #475569;
  border-radius: 50%;
  font-size: .75rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.ia-search-clear-btn:hover { background: #cbd5e1; }
.ia-manual-chat-list {
  flex: 1;
  overflow-y: auto;
}
.ia-manual-chat-item.ia-chat-priority {
  background: #fee2e2 !important;
  border-left: 4px solid #dc2626 !important;
  position: relative;
  animation: chatPriorityPulse 2s ease-in-out infinite;
}
.ia-manual-chat-item.ia-chat-priority::before {
  content: "🚨";
  position: absolute;
  top: 4px;
  right: 6px;
  font-size: .9rem;
}
.ia-manual-chat-item.ia-chat-priority .ia-manual-chat-item-name {
  color: #b91c1c;
  font-weight: 800;
}
@keyframes chatPriorityPulse {
  0%, 100% { box-shadow: inset 0 0 0 0 rgba(220,38,38,0); }
  50% { box-shadow: inset 0 0 0 2px rgba(220,38,38,.35); }
}
.ia-manual-chat-item {
  padding: 10px 12px;
  cursor: pointer;
  border-bottom: 1px solid #f1f5f9;
  transition: background .15s;
  position: relative;
}
.ia-manual-chat-item:hover { background: #f1f5f9; }
.ia-manual-chat-item.active,
.ia-manual-chat-item.active:hover {
  background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%) !important;
  border-left: 4px solid #2563eb !important;
  box-shadow: inset 0 0 0 1px #93c5fd;
}
.ia-manual-chat-item.active .ia-manual-chat-item-name { color: #1e3a8a; }
.ia-manual-chat-item.active .ia-manual-chat-item-phone { color: #1d4ed8; }
.ia-manual-chat-item-name { font-weight: 600; font-size: .88rem; }
.ia-manual-chat-item-phone { font-size: .78rem; color: #64748b; }
.ia-manual-chat-item-preview { font-size: .76rem; color: #94a3b8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 190px; }
.ia-manual-chat-item-badge {
  background: #ef4444;
  color: #fff;
  font-size: .72rem;
  font-weight: 700;
  border-radius: 999px;
  padding: 2px 6px;
  min-width: 20px;
  text-align: center;
  flex-shrink: 0;
}
/* Chat list card rows */
.ia-chat-row-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 4px;
  margin-bottom: 2px;
}
.ia-chat-row-mid {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 4px;
  margin-bottom: 4px;
}
.ia-chat-row-bot {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  align-items: center;
}
.ia-chat-hora {
  font-size: .72rem;
  color: #94a3b8;
  white-space: nowrap;
  flex-shrink: 0;
}
/* Estado pills */
.ia-chat-estado-pill {
  font-size: .68rem;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: 999px;
  background: #e2e8f0;
  color: #475569;
}
.ia-chat-estado-activo      { background: #dcfce7; color: #15803d; }
.ia-chat-estado-atencion    { background: #dbeafe; color: #1d4ed8; }
.ia-chat-estado-cotizacion  { background: #fef9c3; color: #854d0e; }
.ia-chat-estado-pedido      { background: #ede9fe; color: #6d28d9; }
.ia-chat-estado-cerrado     { background: #f1f5f9; color: #64748b; }
/* Sin atender / Atendido pills */
.ia-chat-sin-atender-pill {
  font-size: .68rem;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 999px;
  background: #fee2e2;
  color: #dc2626;
}
.ia-chat-atendido-pill {
  font-size: .68rem;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: 999px;
  background: #dcfce7;
  color: #15803d;
}
/* Highlight card when unread */
.ia-manual-chat-item.ia-chat-sin-atender {
  border-left: 3px solid #ef4444;
}
.ia-manual-chat-item.active.ia-chat-sin-atender {
  border-left: 3px solid #2563eb; /* active wins */
}

/* Detail pane */
.ia-manual-detail {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.ia-manual-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #94a3b8;
  gap: 8px;
  padding: 40px;
}
#iaManualChatDetail {
  display: flex;
  flex-direction: column;
  flex: 1;
  height: 100%;
  overflow: hidden;
}

/* Chat head */
.ia-manual-chat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  border-bottom: 1px solid #e2e8f0;
  background: #fff;
  flex-shrink: 0;
  flex-wrap: wrap;
  gap: 6px;
}
.ia-manual-chat-head-info {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  flex: 1 1 auto;
  flex-wrap: wrap;
}
.ia-manual-chat-name { font-weight: 700; font-size: .88rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 160px; }
.ia-manual-chat-phone { font-size: .72rem; color: #64748b; }
.ia-manual-chat-address { display: none; }
.ia-manual-chat-head-actions {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  align-items: center;
  flex: 0 0 100%;
}
.ia-manual-chat-head-actions .btn { font-size: .7rem !important; padding: 3px 6px !important; min-height: 24px !important; white-space: nowrap; }
.ia-manual-chat-head-actions .ia-estado-select { font-size: .7rem !important; padding: 2px 4px !important; max-width: 110px; }

/* Selects inline (al lado del teléfono) — estilo compacto, look de pill */
.ia-manual-chat-head-info .ia-estado-inline {
  font-size: .7rem;
  padding: 2px 6px;
  height: 22px;
  min-height: 22px;
  max-width: 110px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #f8fafc;
  color: #334155;
  cursor: pointer;
  flex-shrink: 0;
}

/* Wrapper para selects con label visible (Estado / Etiqueta) */
.ia-select-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #f8fafc;
  padding: 2px 18px 2px 6px;
  height: 24px;
  cursor: pointer;
  flex: 0 0 auto;
  min-width: 0;
}
.ia-select-wrap::after {
  content: "▾";
  position: absolute;
  right: 5px;
  top: 50%;
  transform: translateY(-50%);
  color: #475569;
  font-size: .65rem;
  pointer-events: none;
}
.ia-select-wrap .ia-select-label {
  font-size: .6rem;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: .02em;
  white-space: nowrap;
  font-weight: 600;
}
.ia-select-wrap .ia-select-value {
  font-size: .72rem;
  color: #0f172a;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100px;
}
.ia-select-wrap select {
  position: absolute;
  inset: 0;
  opacity: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
  border: 0;
  padding: 0;
  margin: 0;
}
.ia-manual-chat-head-info .ia-estado-inline:hover {
  background: #eef2f7;
  border-color: #94a3b8;
}

/* Articles bar */
.ia-manual-articles-bar {
  padding: 3px 10px !important;
  border-bottom: 2px solid #2563eb;
  background: #f0f6ff;
  flex-shrink: 0;
  max-height: 28%;
  overflow-y: auto;
  transition: padding .25s ease;
  position: relative;
}
/* Cuando el usuario arrastra el handle, se aplica una altura fija por JS */
.ia-manual-articles-bar.user-resized {
  max-height: none !important;
  flex: 0 0 auto;
  transition: none;
}
/* Divisor arrastrable entre artículos y mensajes */
.ia-articles-resize-handle {
  flex: 0 0 auto;
  height: 12px;
  cursor: ns-resize;
  background: #e0e7ef;
  border-top: 1px solid #cbd5e1;
  border-bottom: 1px solid #cbd5e1;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  touch-action: none;
  z-index: 5;
  position: relative;
}
.ia-articles-resize-handle:hover {
  background: #dbeafe;
}
.ia-articles-resize-handle.dragging {
  background: #bfdbfe;
}
.ia-articles-resize-grip {
  display: block;
  width: 48px;
  height: 4px;
  border-radius: 2px;
  background: #94a3b8;
  pointer-events: none;
}
.ia-articles-resize-handle:hover .ia-articles-resize-grip,
.ia-articles-resize-handle.dragging .ia-articles-resize-grip {
  background: #2563eb;
}
.ia-manual-articles-bar.collapsed {
  max-height: 26px !important;
  overflow: hidden;
  padding-top: 2px !important;
  padding-bottom: 2px !important;
}
.ia-manual-articles-bar.collapsed .ia-manual-articles-head { font-size: .72rem !important; }
.ia-manual-articles-bar.collapsed .ia-manual-articles-list,
.ia-manual-articles-bar.collapsed .ia-manual-add-art {
  display: none;
}
.ia-manual-articles-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 3px;
  font-size: .78rem;
  gap: 6px;
}
.ia-manual-articles-bar.collapsed .ia-manual-articles-head {
  margin-bottom: 0;
}
/* Collapse toggle button */
.ia-art-collapse-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.35rem;
  color: #2563eb;
  padding: 0 6px 0 2px;
  line-height: 1;
  transition: transform .2s;
  flex-shrink: 0;
  font-weight: 700;
}
.ia-manual-articles-bar.collapsed .ia-art-collapse-btn {
  transform: rotate(-90deg);
}

/* Sidebar collapsed state */
.ia-manual-layout.sidebar-hidden .ia-manual-sidebar {
  width: 0;
  min-width: 0;
  overflow: hidden;
  border-right: none;
}
.ia-manual-restore-sidebar-btn {
  display: none;
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 50;
  background: #2563eb;
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: .78rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(37,99,235,.35);
}
.ia-manual-restore-sidebar-btn:hover { background: #1d4ed8; }
.ia-manual-layout { position: relative; }
.ia-manual-layout.sidebar-hidden .ia-manual-restore-sidebar-btn {
  display: inline-flex;
  align-items: center;
}
.ia-show-sidebar-btn {
  font-size: .78rem;
}
.ia-manual-art-total { font-weight: 700; color: #0f172a; margin-left: 4px; }
.ia-manual-art-count {
  font-size: .72rem;
  color: #fff;
  background: #2563eb;
  padding: 1px 7px;
  border-radius: 999px;
  font-weight: 700;
  margin-left: 4px;
  margin-right: auto;
  white-space: nowrap;
}
.ia-manual-art-count:empty { display: none; }
/* Estado select en el header del chat */
.ia-estado-select {
  font-size: .78rem;
  padding: 3px 6px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
  color: #0f172a;
  max-width: 150px;
}
.ia-manual-articles-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 28px;
  margin-bottom: 6px;
}
.ia-manual-art-tag {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  padding: 3px 8px;
  font-size: .8rem;
}
.ia-art-name { font-weight: 600; }
.ia-art-note {
  max-width: 220px;
  font-size: .72rem;
  color: #475569;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ia-manual-art-tag input[type=number] {
  width: 40px;
  border: none;
  background: transparent;
  font-size: .8rem;
  text-align: center;
  padding: 0 2px;
}
.ia-manual-art-tag button { background: none; border: none; cursor: pointer; color: #ef4444; font-size: .85rem; padding: 0 2px; }
.ia-art-price { color: #0f766e !important; }
.ia-art-subtotal { font-weight: 600; color: #0f172a; }
.ia-art-pending {
  color: #b45309;
  font-size: .85rem;
}
.ia-manual-add-art {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 4px;
}
.ia-manual-prod-select { flex: 1; min-width: 120px; font-size: .82rem; padding: 4px 6px; }
.ia-manual-qty-input { width: 52px; font-size: .82rem; padding: 4px 6px; }

/* Messages */
.ia-manual-messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: #f8fafc;
}
.ia-manual-msg {
  max-width: 62%;
  width: fit-content;
  padding: 4px 10px 3px;
  border-radius: 16px;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Segoe UI", system-ui, sans-serif;
  font-size: .86rem;
  line-height: 1.25;
  letter-spacing: -0.01em;
  white-space: pre-wrap;
  word-break: break-word;
  border: none !important;
  display: flex;
  flex-direction: column;
  gap: 0;
  box-shadow: 0 1px 1px rgba(0,0,0,.04);
}
.ia-manual-msg > *:not(:last-child) { margin-bottom: 0 !important; }
.ia-manual-msg.in {
  background: #E9E9EB;
  color: #0f172a;
  align-self: flex-start;
  border-bottom-left-radius: 6px;
}
.ia-manual-msg.out {
  background: #007AFF;
  color: #fff;
  align-self: flex-end;
  border-bottom-right-radius: 6px;
}
.ia-manual-msg.out.ia {
  background: #0A84FF;
}
.ia-manual-msg-time { font-size: .6rem; opacity: .85; margin-top: 0; }
.ia-manual-media-wrap { display: flex; flex-direction: column; gap: 2px; }
.ia-manual-msg-image {
  width: 100%;
  max-width: 280px;
  border-radius: 10px;
  border: 1px solid #dbeafe;
  display: block;
}
.ia-manual-msg-caption { font-size: .8rem; opacity: .92; }
.ia-location-link { color: #1d4ed8; text-decoration: underline; word-break: break-word; }
.ia-manual-location-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 220px;
}
.ia-manual-location-title { font-size: .82rem; font-weight: 600; color: inherit; }
.ia-manual-location-map {
  width: 100%;
  height: 140px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #fff;
}
.ia-manual-location-link {
  align-self: flex-start;
  background: #eff6ff;
  border-color: #bfdbfe;
  color: #1d4ed8;
}
.ia-manual-location-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 2px;
}
.ia-manual-location-add-btn {
  background: #16a34a;
  color: #fff;
  border: none;
  font-weight: 600;
}
.ia-manual-location-add-btn:hover { background: #15803d; }
.ia-manual-location-add-btn:disabled { opacity: .7; cursor: wait; }
.ia-loc-inline {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.ia-loc-inline .ia-manual-location-add-btn {
  font-size: .7rem;
  padding: 2px 7px;
}

/* Reply form */
.ia-manual-reply-form {
  padding: 10px 12px;
  border-top: 1px solid #e2e8f0;
  background: #fff;
  flex-shrink: 0;
}
.ia-manual-input-row { display: flex; gap: 6px; align-items: flex-start; margin-bottom: 6px; }
.ia-manual-input-row textarea { flex: 1; margin-bottom: 0; }
.ia-manual-reply-form textarea {
  width: 100%;
  resize: vertical;
  padding: 7px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: .88rem;
  font-family: inherit;
  margin-bottom: 6px;
}
.ia-attach-btn {
  cursor: pointer;
  padding: 6px 10px;
  font-size: 1.1rem;
  line-height: 1;
  border-radius: 8px;
  align-self: flex-start;
  flex-shrink: 0;
}
.ia-img-preview {
  position: relative;
  display: inline-flex;
  align-items: flex-start;
  margin-bottom: 6px;
  gap: 4px;
}
.ia-img-preview img { max-height: 80px; max-width: 140px; border-radius: 6px; border: 1px solid #cbd5e1; object-fit: cover; }
.ia-img-cancel-btn { background: #ef4444; color: #fff; border: none; border-radius: 50%; width: 20px; height: 20px; font-size: .7rem; cursor: pointer; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.ia-manual-reply-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* Botón Generar Pedido destacado */
.ia-generar-pedido-btn {
  background: linear-gradient(135deg, #16a34a 0%, #059669 100%) !important;
  color: #fff !important;
  border: none !important;
  font-weight: 900 !important;
  padding: 14px 28px !important;
  font-size: 1.1rem !important;
  border-radius: 14px !important;
  min-height: 48px;
  box-shadow: 0 4px 14px -2px rgba(22, 163, 74, 0.55), 0 2px 4px rgba(0,0,0,0.08) !important;
  letter-spacing: .02em;
  text-transform: uppercase;
  transition: transform .15s ease, box-shadow .15s ease, filter .15s ease !important;
  margin-left: auto;
  position: relative;
  animation: iaGenerarPedidoPulse 2.4s ease-in-out infinite;
}
.ia-generar-pedido-btn:hover {
  transform: translateY(-2px) scale(1.03);
  filter: brightness(1.08);
  box-shadow: 0 8px 20px -4px rgba(22, 163, 74, 0.7), 0 3px 6px rgba(0,0,0,0.1) !important;
}
.ia-generar-pedido-btn:active { transform: translateY(0); }
@keyframes iaGenerarPedidoPulse {
  0%, 100% { box-shadow: 0 4px 14px -2px rgba(22, 163, 74, 0.55), 0 2px 4px rgba(0,0,0,0.08); }
  50%      { box-shadow: 0 6px 22px -2px rgba(22, 163, 74, 0.9), 0 3px 8px rgba(0,0,0,0.1); }
}
/* Audio message type in chat */
.ia-manual-msg-audio {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-style: normal;
  color: #475569;
  min-width: 220px;
}
.ia-manual-msg-audio .ia-audio-header {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: .78rem;
  font-weight: 600;
  color: #7c3aed;
}
.ia-manual-msg-audio .audio-icon { font-size: 1.2rem; flex-shrink: 0; }
.ia-manual-msg-audio .ia-audio-title { font-weight: 600; }
.ia-manual-msg-audio-player {
  width: 100%;
  max-width: 260px;
  height: 40px;
  outline: none;
}
.ia-manual-msg-audio .audio-transcript {
  font-size: .82rem;
  color: #64748b;
  font-style: italic;
}

/* Video message type in chat */
.ia-manual-msg-video {
  max-width: 260px;
  width: 100%;
  border-radius: 8px;
  background: #000;
}

/* Botón de micrófono para grabar */
.ia-mic-btn {
  padding: 6px 10px;
  font-size: 1rem;
  border-radius: 8px;
  transition: background .15s, transform .1s;
}
.ia-mic-btn:hover:not(:disabled) { background: #f1f5f9; }
.ia-mic-btn.ia-mic-recording {
  background: #fee2e2 !important;
  color: #dc2626;
  animation: recPulse 1.2s ease-in-out infinite;
}
@keyframes recPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(220,38,38,.4); }
  50%      { box-shadow: 0 0 0 6px rgba(220,38,38,0); }
}

/* Estado de grabación activo */
.ia-rec-state {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
  padding: 8px 12px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 8px;
  color: #991b1b;
  font-size: .85rem;
  font-weight: 500;
}
.ia-rec-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #dc2626;
  animation: recDot 1s ease-in-out infinite;
}
@keyframes recDot {
  0%, 100% { opacity: 1; }
  50%      { opacity: .3; }
}
.ia-rec-timer {
  font-family: ui-monospace, Menlo, monospace;
  font-weight: 700;
  margin-right: auto;
}
/* Device message indicator */
.ia-manual-msg.out.device::before { content: '📱 '; font-size: .75rem; }
.ia-quick-modal-card { max-width: 640px; width: 95%; }
.ia-quick-form {
  display: grid;
  gap: 8px;
  margin-bottom: 10px;
  border-bottom: 1px solid #e2e8f0;
  padding-bottom: 10px;
}
.ia-quick-form-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}
.ia-quick-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 320px;
  overflow-y: auto;
}
.ia-quick-item {
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #f8fafc;
  padding: 8px 10px;
}
.ia-quick-item-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}
.ia-quick-item-content {
  font-size: .84rem;
  color: #334155;
  white-space: pre-wrap;
  margin-bottom: 6px;
}
.ia-quick-item-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

/* ── Botón volver (solo mobile) ──────────────────────────────────────────── */
.ia-manual-back-btn {
  display: none;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
  font-weight: 600;
  font-size: .82rem;
  padding: 5px 10px;
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  cursor: pointer;
  color: #334155;
  white-space: nowrap;
}
.ia-manual-back-btn:active { background: #e2e8f0; }

/* ── Responsive Chat Cliente ─────────────────────────────────────────────── */

/* Tablet portrait: sidebar un poco más estrecha */
@media (max-width: 900px) {
  .ia-manual-sidebar {
    width: 200px;
    min-width: 160px;
  }
  .ia-manual-chat-item-preview { max-width: 150px; }
}

/* Tablet estrecha / phablet */
@media (max-width: 720px) {
  .ia-manual-layout {
    height: calc(100dvh - 96px);
  }
  .ia-manual-sidebar {
    width: 170px;
    min-width: 140px;
  }
  .ia-manual-chat-head {
    padding: 8px 10px;
    gap: 6px;
  }
  .ia-manual-chat-head-actions {
    gap: 4px;
  }
  .ia-manual-articles-bar {
    padding: 8px 10px;
    max-height: 16%;
  }
  .ia-manual-reply-form {
    padding: 8px 10px;
  }
  .ia-manual-reply-actions {
    gap: 5px;
  }
  .ia-manual-reply-actions .btn {
    font-size: .78rem;
    padding: 5px 8px;
  }
}

/* Mobile: layout apilado con vista exclusiva sidebar / chat */
@media (max-width: 599px) {
  /* ── Topbar: ultra-compacta ── */
  .ia-manual-topbar {
    padding: 6px 10px;
    gap: 5px;
    flex-wrap: wrap;
  }
  .ia-manual-topbar-left {
    gap: 4px;
    flex-wrap: wrap;
    width: 100%;
  }
  .ia-manual-topbar-left strong {
    font-size: .82rem;
  }
  .ia-manual-topbar-left .ia-manual-modo-badge {
    font-size: .65rem;
    padding: 2px 6px;
  }
  .ia-manual-topbar-btns {
    width: 100%;
    gap: 4px;
    justify-content: space-between;
  }
  .ia-manual-topbar-btns .btn {
    font-size: .7rem;
    padding: 4px 7px;
    flex: 1;
    text-align: center;
    min-width: 0;
  }

  /* ── Layout apilado (sidebar o chat — nunca ambos) ── */
  .ia-manual-layout {
    flex-direction: column;
    height: calc(100dvh - 82px);
    min-height: 0;
  }
  .ia-manual-sidebar {
    width: 100%;
    min-width: 0;
    border-right: none;
    border-bottom: 1px solid #e2e8f0;
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }
  .ia-manual-detail {
    width: 100%;
    flex: 1;
    min-height: 0;
    display: none;
  }
  .ia-manual-layout.mobile-chat-open .ia-manual-sidebar {
    display: none;
  }
  .ia-manual-layout.mobile-chat-open .ia-manual-detail {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    height: 100%;
  }

  /* ── Sidebar items ── */
  .ia-manual-sidebar-head {
    padding: 8px 10px;
    font-size: .82rem;
  }
  .ia-manual-chat-item {
    padding: 8px 10px;
  }
  .ia-manual-chat-item-name { font-size: .84rem; }
  .ia-manual-chat-item-phone { font-size: .72rem; }
  .ia-manual-chat-item-preview { max-width: 100%; }
  .ia-chat-estado-pill,
  .ia-chat-sin-atender-pill,
  .ia-chat-atendido-pill {
    font-size: .62rem;
    padding: 1px 5px;
  }

  /* ── Botón Volver visible ── */
  .ia-manual-back-btn { display: inline-flex; }

  /* ── Chat head: una línea compacta ── */
  .ia-manual-chat-head {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    padding: 6px 10px;
    gap: 6px;
    min-height: auto;
  }
  .ia-manual-chat-head-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 4px 8px;
    align-items: baseline;
  }
  .ia-manual-chat-name {
    font-size: .88rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 140px;
  }
  .ia-manual-chat-phone { font-size: .72rem; }
  .ia-manual-chat-address {
    display: none; /* ocultar dirección en mobile — se ve al hacer scroll */
  }

  /* Actions: wrap para que no se oculten */
  .ia-manual-chat-head-actions {
    width: 100%;
    flex-wrap: wrap;
    gap: 4px;
  }
  .ia-manual-chat-head-actions .btn,
  .ia-manual-chat-head-actions .ia-estado-select {
    flex-shrink: 0;
    font-size: .7rem;
    padding: 4px 7px;
    white-space: nowrap;
    min-height: 28px;
  }
  .ia-estado-select { max-width: 120px; font-size: .72rem; }

  /* ── Topbar IA ultra-compacto ── */
  .ia-manual-topbar { padding: 2px 4px !important; gap: 2px !important; }
  .ia-manual-topbar-btns { gap: 2px !important; }
  .ia-manual-topbar-btns .btn {
    font-size: .58rem !important;
    padding: 2px 4px !important;
    min-height: 20px !important;
    line-height: 1.1 !important;
    border-radius: 5px !important;
  }
  .ia-manual-topbar-left strong { font-size: .7rem !important; }
  .ia-manual-topbar-left .ia-manual-modo-badge {
    font-size: .56rem !important;
    padding: 1px 4px !important;
  }

  /* Chat head: UNA SOLA LÍNEA scrollable en móvil */
  .ia-manual-chat-head {
    display: flex !important;
    flex-flow: row nowrap !important;
    align-items: center !important;
    padding: 4px 6px !important;
    gap: 4px !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    -webkit-overflow-scrolling: touch !important;
    scrollbar-width: none !important;
  }
  .ia-manual-chat-head::-webkit-scrollbar { display: none !important; }
  .ia-manual-back-btn {
    font-size: .72rem !important;
    padding: 5px 10px !important;
    min-height: 28px !important;
    flex-shrink: 0 !important;
    flex-grow: 0 !important;
    border-radius: 6px !important;
    background: #eff6ff !important;
    border: 1px solid #bfdbfe !important;
    color: #1d4ed8 !important;
    font-weight: 600 !important;
    white-space: nowrap !important;
    display: inline-flex !important;
    align-items: center !important;
    line-height: 1 !important;
  }
  .ia-manual-chat-head-info {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    gap: 4px !important;
    flex: 0 0 auto !important;
    min-width: 0 !important;
  }
  .ia-manual-chat-head-actions {
    flex-basis: auto !important;
    width: auto !important;
    flex: 0 0 auto !important;
    display: inline-flex !important;
    flex-wrap: nowrap !important;
  }
  .ia-manual-chat-name {
    font-size: .78rem !important;
    max-width: 90px !important;
    flex: 0 0 auto !important;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .ia-manual-chat-phone {
    font-size: .66rem !important;
    color: #64748b !important;
    flex-shrink: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .ia-manual-chat-head-actions {
    flex-basis: 100% !important;
    width: 100% !important;
  }
  .ia-manual-chat-head-actions .btn,
  .ia-manual-chat-head-actions .ia-estado-select {
    font-size: .56rem !important;
    padding: 2px 5px !important;
    min-height: 22px !important;
    line-height: 1.1 !important;
    border-radius: 5px !important;
  }
  /* Botones Cliente y Pedido — tamaño estándar de la fila de acciones */
  #iaManualEditClienteBtn,
  #iaManualGoToOrderBtn {
    font-size: .6rem !important;
    padding: 2px 6px !important;
    min-height: 22px !important;
    line-height: 1.1 !important;
    border-radius: 5px !important;
    max-width: none !important;
    white-space: nowrap !important;
    flex: 0 0 auto !important;
  }
  .ia-manual-chat-name { font-size: .76rem !important; }
  .ia-manual-chat-phone { font-size: .6rem !important; }

  /* Botón IA pausada/activa más angosto */
  #iaManualToggleAiBtn.ia-toggle-btn {
    font-size: .54rem !important;
    padding: 2px 5px !important;
    min-height: 22px !important;
    min-width: 0 !important;
    max-width: 80px !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* Selects de Estado (Activo) y Etiqueta (Sin etiqueta) — legibles en móvil */
  .ia-manual-chat-head-info #iaManualEstadoSelect,
  .ia-manual-chat-head-info #iaManualLabelSelect,
  .ia-manual-chat-head-actions #iaManualEstadoSelect,
  .ia-manual-chat-head-actions #iaManualLabelSelect,
  #iaManualEstadoSelect,
  #iaManualLabelSelect {
    font-size: .68rem !important;
    padding: 3px 16px 3px 6px !important;
    min-height: 24px !important;
    width: 92px !important;
    max-width: 92px !important;
    min-width: 92px !important;
    background-color: #fff !important;
    color: #0f172a !important;
    border: 1px solid #cbd5e1 !important;
    border-radius: 6px !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    appearance: none !important;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10'><path fill='%23475569' d='M1 3l4 4 4-4z'/></svg>") !important;
    background-repeat: no-repeat !important;
    background-position: right 5px center !important;
    text-overflow: ellipsis;
    overflow: hidden;
    white-space: nowrap !important;
  }

  /* ── Artículos: minimizado por defecto ── */
  .ia-manual-articles-bar {
    padding: 3px 8px !important;
    max-height: 22% !important;
    min-height: 0;
  }
  .ia-manual-articles-bar.collapsed { max-height: 22px !important; }
  .ia-manual-articles-head { font-size: .7rem !important; margin-bottom: 1px !important; gap: 4px !important; }
  .ia-manual-articles-head .btn { font-size: .62rem !important; padding: 2px 5px !important; min-height: 22px !important; }
  .ia-manual-art-total { font-size: .72rem !important; }
  .ia-manual-art-count { font-size: .62rem !important; padding: 1px 5px !important; }
  .ia-manual-art-tag { font-size: .64rem !important; padding: 1px 4px !important; }
  .ia-art-note { max-width: 100px; }

  /* ── Mensajes: máximo espacio posible ── */
  .ia-manual-messages {
    padding: 4px 6px;
    gap: 2px;
    flex: 1;
    min-height: 0;
  }
  .ia-manual-msg {
    max-width: 78%;
    font-size: .84rem !important;
    padding: 4px 10px 3px !important;
    border-radius: 16px !important;
    line-height: 1.25 !important;
  }
  .ia-manual-msg.in { border-bottom-left-radius: 6px !important; }
  .ia-manual-msg.out { border-bottom-right-radius: 6px !important; }
  .ia-manual-msg-footer { font-size: .54rem !important; margin-top: -1px !important; line-height: 1 !important; }
  .ia-manual-msg-time { font-size: .54rem !important; }
  .ia-manual-msg-image { max-width: 180px; }
  .ia-manual-msg-video { max-width: 180px; }
  .ia-manual-msg-audio-player { max-width: 180px; height: 32px; }

  /* ── Reply form: compacta ── */
  .ia-manual-reply-form {
    padding: 4px 6px;
    flex-shrink: 0;
  }
  .ia-manual-input-row {
    gap: 3px;
  }
  .ia-manual-reply-form textarea {
    font-size: .78rem;
    padding: 5px 7px;
    margin-bottom: 3px;
    min-height: 30px;
    max-height: 60px;
  }
  .ia-attach-btn, .ia-mic-btn {
    padding: 3px 6px;
    font-size: .82rem;
    min-width: 30px;
  }
  .ia-manual-reply-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 3px;
  }
  .ia-manual-reply-actions .btn {
    font-size: .66rem;
    padding: 4px 6px;
    text-align: center;
    flex: 1 1 auto;
    min-width: 0;
    min-height: 28px;
  }
  /* Enviar y Generar pedido más prominentes */
  .ia-manual-reply-actions .btn[type="submit"],
  .ia-manual-reply-actions button[type="submit"] {
    flex: 2 1 auto;
    font-weight: 700;
  }
  #iaManualGenerarPedidoBtn {
    flex: 2 1 auto;
    font-size: .78rem !important;
    padding: 7px 12px !important;
  }
}

/* ── Landscape (horizontal) en móvil: maximizar mensajes ── */
@media (max-width: 900px) and (max-height: 500px) and (orientation: landscape) {
  .ia-manual-topbar {
    padding: 3px 8px;
    gap: 4px;
  }
  .ia-manual-topbar-left strong { font-size: .78rem; }
  .ia-manual-topbar-left .ia-manual-modo-badge { display: none; }
  .ia-manual-topbar-btns .btn { font-size: .68rem; padding: 3px 6px; }

  .ia-manual-layout {
    height: calc(100dvh - 52px);
    min-height: 0;
  }
  .ia-manual-chat-head {
    padding: 4px 8px;
    gap: 4px;
  }
  .ia-manual-chat-head-actions .btn { font-size: .65rem; padding: 3px 5px; min-height: 24px; }
  .ia-manual-chat-name { font-size: .82rem; }
  .ia-manual-chat-address { display: none; }

  .ia-manual-articles-bar {
    max-height: 60px;
    padding: 4px 8px;
  }
  .ia-manual-messages {
    padding: 4px 6px;
    gap: 2px;
  }
  .ia-manual-msg {
    font-size: .76rem;
    padding: 5px 8px;
  }
  .ia-manual-reply-form {
    padding: 4px 8px;
  }
  .ia-manual-reply-form textarea {
    min-height: 30px;
    max-height: 50px;
    font-size: .8rem;
  }
  .ia-manual-reply-actions .btn {
    font-size: .68rem;
    padding: 3px 6px;
  }
}

/* Nav badge for main tabs */
.nav-badge {
  display: inline-block;
  background: #ef4444;
  color: #fff;
  font-size: .72rem;
  font-weight: 700;
  border-radius: 999px;
  padding: 1px 6px;
  min-width: 18px;
  text-align: center;
  margin-left: 4px;
  vertical-align: middle;
}
.nav-badge.hidden { display: none; }

/* ── IA Manual: artículos detectados (estructura item-row) ─────────────────── */
.ia-art-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 10px;
  border-bottom: 1px solid #e2e8f0;
  background: #fff;
}
.ia-art-row:last-child { border-bottom: none; }
.ia-art-row-info {
  flex: 1;
  min-width: 0;
}
.ia-art-row-info .ia-art-name {
  font-size: .88rem;
  font-weight: 600;
  color: #1e293b;
}
.ia-art-row-info .ia-art-note {
  font-size: .78rem;
  color: #64748b;
  margin-top: 2px;
}
.ia-art-price-label {
  font-size: .80rem;
  color: #475569;
  margin-top: 3px;
  display: block;
}
.ia-art-price-label strong { color: #0f172a; }
.ia-art-pending { font-size: .78rem; margin-left: 4px; }
.ia-art-row-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}
.ia-art-qty-display {
  min-width: 22px;
  text-align: center;
  font-weight: 700;
  font-size: .9rem;
  color: #1e293b;
}
.ia-art-minus, .ia-art-plus {
  min-width: 26px;
  font-weight: 700;
  font-size: 1rem;
  line-height: 1;
  padding: 2px 5px;
}
.ia-art-price-btn { font-size: .82rem; }
.ia-art-remove { color: #ef4444; }
.ia-art-remove:hover { background: #fee2e2; border-color: #fca5a5; }

/* ── IA Manual: footer del mensaje con botones delete/edit ─────────────────── */
.ia-manual-msg-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  margin: 0;
  padding: 0;
  line-height: 1;
}
.ia-manual-msg-footer .ia-manual-msg-time { font-size: .56rem; }
.ia-manual-msg.out.device::before { font-size: .6rem !important; }
.ia-manual-msg-time { font-size: .64rem; color: #64748b; }
.ia-manual-msg.out .ia-manual-msg-time { color: rgba(255, 255, 255, 0.82); }
.ia-msg-actions {
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity .15s;
}
.ia-manual-msg:hover .ia-msg-actions { opacity: 1; }
.ia-msg-action-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: .78rem;
  padding: 2px 4px;
  border-radius: 4px;
  line-height: 1;
}
.ia-msg-action-btn:hover { background: rgba(0,0,0,.08); }
.ia-manual-msg.out .ia-msg-action-btn { color: #ecfdf5; }
.ia-manual-msg.out .ia-msg-action-btn:hover { background: rgba(240,253,244,.2); }
.ia-msg-edit-area {
  width: 100%;
  min-width: 180px;
  padding: 5px 8px;
  border: 1px solid #7c3aed;
  border-radius: 6px;
  font-size: .85rem;
  font-family: inherit;
  resize: vertical;
  background: #fff;
  color: #1e293b;
  box-shadow: 0 0 0 2px rgba(124,58,237,.15);
  box-sizing: border-box;
}
.ia-manual-msg.out .ia-msg-edit-area {
  background: rgba(255,255,255,.15);
  color: #fff;
  border-color: rgba(255,255,255,.5);
}

/* ── Botón contestación manual ─────────────────────────────────────────────── */
.ia-manual-pause-btn {
  background: #fef3c7;
  border-color: #fbbf24;
  color: #92400e;
  font-weight: 600;
}
.ia-manual-pause-btn:hover { background: #fde68a; }
.ia-manual-pause-btn.ia-manual-pause-active {
  background: #fef9c3;
  border-color: #f59e0b;
  color: #78350f;
  animation: pausePulse 2s ease-in-out infinite;
}
@keyframes pausePulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(245,158,11,.4); }
  50%       { box-shadow: 0 0 0 4px rgba(245,158,11,0); }
}

/* ═══════════════════════════════════════════════════════════════════════════
   MI RENDIMIENTO — sección personal
═══════════════════════════════════════════════════════════════════════════ */

/* Filtro de fechas */
.rend-date-filter {
  background: linear-gradient(180deg, #f8fafc 0%, #ffffff 100%);
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 14px 16px;
  margin-bottom: 18px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}
.rend-df-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.rend-df-inputs {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}
.rend-df-label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: .78rem;
  color: #64748b;
  font-weight: 500;
}
.rend-df-input {
  padding: 7px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 9px;
  font-size: .9rem;
  background: #fff;
  color: #0f172a;
  min-width: 140px;
}
.rend-df-input:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}
.rend-df-presets {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.rend-preset-btn {
  font-size: .82rem !important;
  padding: 6px 12px !important;
  border-radius: 8px !important;
}
.rend-preset-btn.active {
  background: #3b82f6 !important;
  color: #fff !important;
  border-color: #3b82f6 !important;
}
.rend-df-badge {
  margin-top: 10px;
  padding: 8px 14px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 9px;
  font-size: .85rem;
  color: #1e40af;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
@media (max-width: 640px) {
  .rend-df-row { flex-direction: column; align-items: stretch; }
  .rend-df-inputs, .rend-df-presets { justify-content: flex-start; }
  .rend-df-input { min-width: 0; width: 100%; }
}

/* Cuadrícula de tarjetas resumen */
.rend-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}
@media (max-width: 768px) { .rend-summary-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 420px) { .rend-summary-grid { grid-template-columns: 1fr 1fr; } }

.rend-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  border-radius: 12px;
  background: var(--surface, #fff);
  box-shadow: 0 1px 4px rgba(0,0,0,.08);
  border-left: 4px solid #e2e8f0;
}
.rend-card--hoy    { border-left-color: #3b82f6; }
.rend-card--semana { border-left-color: #8b5cf6; }
.rend-card--mes    { border-left-color: #f59e0b; }
.rend-card--total  { border-left-color: #22c55e; }

.rend-card-icon { font-size: 1.6rem; flex-shrink: 0; }
.rend-card-value {
  font-size: 2rem;
  font-weight: 800;
  line-height: 1;
  color: var(--text-primary, #0f172a);
}
.rend-card-label { font-size: 0.78rem; color: #64748b; margin-top: 3px; }

/* Layout de 2 columnas */
.rend-body-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
@media (max-width: 860px) { .rend-body-grid { grid-template-columns: 1fr; } }

.rend-col { display: flex; flex-direction: column; gap: 16px; }

/* Widget contenedor */
.rend-widget {
  background: var(--surface, #fff);
  border-radius: 12px;
  padding: 16px 18px;
  box-shadow: 0 1px 4px rgba(0,0,0,.07);
}
.rend-widget--team { border: 1.5px solid #e0e7ff; }

.rend-widget-title {
  margin: 0 0 12px;
  font-size: 0.88rem;
  font-weight: 700;
  color: #475569;
  text-transform: uppercase;
  letter-spacing: .04em;
}

/* Gráfica */
.rend-chart-wrap {
  position: relative;
  height: 180px;
}

/* Desglose */
.rend-breakdown { display: flex; flex-direction: column; gap: 8px; }
.rend-bk-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
}
.rend-bk-row span:nth-child(2) { flex: 1; color: #334155; }
.rend-bk-row strong { color: #0f172a; font-size: 1rem; }
.rend-bk-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.rend-bk-total { margin-top: 4px; padding-top: 8px; border-top: 1px solid #f1f5f9; }

/* Comparativa equipo */
.rend-team-rank {
  font-size: 1.1rem;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 14px;
}
.rend-rank-num { font-size: 1.5rem; color: #3b82f6; }

.rend-team-bar-wrap { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; }
.rend-team-bar-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  color: #475569;
  margin-bottom: 2px;
}
.rend-team-bar-bg {
  background: #f1f5f9;
  border-radius: 99px;
  height: 10px;
  overflow: hidden;
}
.rend-team-bar-fill {
  height: 100%;
  border-radius: 99px;
  transition: width .5s ease;
}
.rend-bar-you { background: #3b82f6; }
.rend-bar-avg { background: #cbd5e1; }

.rend-team-tip { font-size: 0.83rem; margin: 6px 0 0; font-weight: 600; }

/* Asistencia */
.rend-att-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
@media (max-width: 500px) { .rend-att-grid { grid-template-columns: repeat(2, 1fr); } }

.rend-att-item {
  text-align: center;
  padding: 10px 6px;
  border-radius: 8px;
  background: #f8fafc;
}
.rend-att-item strong { display: block; font-size: 1.4rem; font-weight: 800; }
.rend-att-item span   { font-size: 0.72rem; color: #64748b; }
.rend-att-ok   { border-top: 3px solid #22c55e; }
.rend-att-warn { border-top: 3px solid #f59e0b; }
.rend-att-err  { border-top: 3px solid #ef4444; }
.rend-att-info { border-top: 3px solid #3b82f6; }

/* Top productos */
.rend-top-products { display: flex; flex-direction: column; gap: 8px; }
.rend-top-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.rend-top-pos  { font-size: 1.1rem; width: 28px; text-align: center; flex-shrink: 0; }
.rend-top-info { flex: 1; min-width: 0; }
.rend-top-name { font-size: 0.87rem; color: #1e293b; font-weight: 500; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 3px; }
.rend-top-bar-bg {
  background: #f1f5f9;
  border-radius: 99px;
  height: 6px;
  overflow: hidden;
}
.rend-top-bar-fill { height: 100%; background: #3b82f6; border-radius: 99px; transition: width .4s ease; }
.rend-top-count { font-size: 0.85rem; font-weight: 700; color: #334155; flex-shrink: 0; width: 60px; text-align: right; }

/* ═══════════════════════════════════════════════════════════════════════════
   SELECTOR DE USUARIO — Rendimiento Equipo
═══════════════════════════════════════════════════════════════════════════ */

.rend-user-picker {
  background: linear-gradient(135deg, #f0f9ff, #f0fdf4);
  border: 1.5px solid #bfdbfe;
  border-radius: 12px;
  padding: 14px 18px;
  margin-bottom: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.rend-user-picker-label {
  font-size: 0.88rem;
  font-weight: 700;
  color: #1e40af;
  display: flex;
  align-items: center;
  gap: 6px;
}
.rend-user-picker-controls {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}
.rend-picker-select {
  flex: 1;
  min-width: 200px;
  padding: 9px 12px;
  border: 1.5px solid #bfdbfe;
  border-radius: 8px;
  font-size: 0.92rem;
  background: #fff;
  color: #0f172a;
  cursor: pointer;
}
.rend-picker-select:focus { outline: none; border-color: #3b82f6; }
.rend-user-picker-tip {
  font-size: 0.75rem;
  color: #64748b;
}

/* Cabecera de la vista personal del usuario seleccionado */
.rend-personal-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 2px solid #e2e8f0;
  flex-wrap: wrap;
}
.rend-personal-name {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 800;
  color: #0f172a;
}
.rend-personal-role {
  background: #e0e7ff;
  color: #3730a3;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 99px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   LEADERBOARD DIARIO EN VIVO
═══════════════════════════════════════════════════════════════════════════ */

.rend-liveboard {
  background: var(--surface, #fff);
  border-radius: 14px;
  padding: 18px 20px;
  margin-bottom: 20px;
  box-shadow: 0 2px 8px rgba(0,0,0,.08);
  border: 1.5px solid #e0e7ff;
}

/* Cabecera */
.rend-lb-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}
.rend-lb-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1rem;
  font-weight: 700;
  color: #1e293b;
}
.rend-lb-date {
  font-size: 0.8rem;
  font-weight: 400;
  color: #64748b;
  text-transform: capitalize;
}
.rend-live-dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  background: #22c55e;
  flex-shrink: 0;
  animation: livePulse 1.6s ease-in-out infinite;
}
@keyframes livePulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(34,197,94,.5); }
  50%       { box-shadow: 0 0 0 5px rgba(34,197,94,0); }
}
.rend-lb-team-stats {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  color: #475569;
  flex-wrap: wrap;
}
.rend-lb-team-stats strong { color: #0f172a; }
.rend-lb-sep { color: #cbd5e1; }
.rend-lb-countdown { color: #94a3b8; font-size: 0.75rem; }

/* Filas del ranking */
.rend-lb-ranking-wrap { display: flex; flex-direction: column; gap: 6px; margin-bottom: 20px; }

.rend-lb-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  transition: background .15s;
}
.rend-lb-row:hover { background: #f1f5f9; }
.rend-lb-row--me {
  background: linear-gradient(135deg, #eff6ff, #f0fdf4);
  border: 1.5px solid #93c5fd;
}

.rend-lb-pos {
  font-size: 1.5rem;
  flex-shrink: 0;
  width: 32px;
  text-align: center;
}
.lb-rank-num {
  display: inline-block;
  width: 26px; height: 26px;
  line-height: 26px;
  text-align: center;
  border-radius: 50%;
  background: #e2e8f0;
  font-size: 0.78rem;
  font-weight: 700;
  color: #475569;
}

.rend-lb-info { flex: 1; min-width: 0; }
.rend-lb-name {
  font-size: 0.92rem;
  font-weight: 700;
  color: #0f172a;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.lb-you-tag {
  background: #dbeafe;
  color: #1d4ed8;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 99px;
  flex-shrink: 0;
}
.lb-motiv {
  font-size: 0.72rem;
  color: #16a34a;
  font-weight: 600;
  background: #dcfce7;
  padding: 1px 6px;
  border-radius: 99px;
}
.rend-lb-role-time {
  display: flex;
  gap: 8px;
  font-size: 0.75rem;
  color: #64748b;
  margin: 2px 0 4px;
  flex-wrap: wrap;
}
.rend-lb-role { font-weight: 500; }
.lb-time { color: #94a3b8; }

.rend-lb-bar-bg {
  height: 5px;
  background: #e2e8f0;
  border-radius: 99px;
  overflow: hidden;
}
.rend-lb-bar-fill { height: 100%; border-radius: 99px; transition: width .5s ease; }

.rend-lb-counts {
  flex-shrink: 0;
  text-align: right;
  min-width: 52px;
}
.rend-lb-main-count {
  font-size: 1.5rem;
  font-weight: 800;
  color: #1e293b;
  line-height: 1;
}
.rend-lb-sub-counts {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
  font-size: 0.7rem;
  color: #64748b;
  margin-top: 3px;
}

.rend-lb-empty {
  text-align: center;
  color: #94a3b8;
  padding: 20px 0;
  font-size: 0.9rem;
}
.rend-lb-not-yet {
  background: #fef9c3;
  border: 1px solid #fde68a;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 0.85rem;
  color: #92400e;
  margin-top: 6px;
}

/* Comparativo 7 días */
.rend-lb-week-section { margin-top: 4px; }
.rend-lb-week-title {
  font-size: 0.78rem;
  font-weight: 700;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: .04em;
  margin: 0 0 10px;
}
.rend-lb-week-bars {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 80px;
}
.rend-week-bar-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}
.rend-week-bar-track {
  width: 100%;
  flex: 1;
  background: #f1f5f9;
  border-radius: 4px 4px 0 0;
  display: flex;
  align-items: flex-end;
  overflow: hidden;
}
.rend-week-bar-fill {
  width: 100%;
  background: #93c5fd;
  border-radius: 4px 4px 0 0;
  transition: height .4s ease;
  min-height: 3px;
}
.rend-week-today .rend-week-bar-fill { background: #3b82f6; }
.rend-week-today .rend-week-bar-label { font-weight: 700; color: #1d4ed8; }
.rend-week-bar-val { font-size: 0.65rem; font-weight: 700; color: #334155; }
.rend-week-bar-label { font-size: 0.62rem; color: #94a3b8; }

/* ── Ranking del equipo ─────────────────────────────────────────────────── */
.rend-ranking-list { display: flex; flex-direction: column; gap: 10px; max-height: 520px; overflow-y: auto; }

.rend-rank-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  transition: background .15s;
}
.rend-rank-item:hover { background: #f1f5f9; }

.rend-rank-left { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }

.rend-rank-medal { font-size: 1.4rem; flex-shrink: 0; width: 28px; text-align: center; }
.rend-rank-pos {
  display: inline-block;
  width: 24px; height: 24px;
  line-height: 24px;
  text-align: center;
  border-radius: 50%;
  background: #e2e8f0;
  font-size: 0.78rem;
  font-weight: 700;
  color: #475569;
}

.rend-rank-info { flex: 1; min-width: 0; }
.rend-rank-name {
  font-size: 0.9rem;
  font-weight: 700;
  color: #0f172a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  gap: 6px;
}
.rend-rank-role { font-size: 0.75rem; color: #64748b; margin: 2px 0 4px; }

.rend-rank-bar-bg {
  background: #e2e8f0;
  border-radius: 99px;
  height: 5px;
  overflow: hidden;
}
.rend-rank-bar-fill { height: 100%; background: #3b82f6; border-radius: 99px; transition: width .4s ease; }

.rend-rank-badge { font-size: 0.72rem; padding: 1px 6px; border-radius: 99px; font-weight: 600; flex-shrink: 0; }
.rend-badge-hoy { background: #dbeafe; color: #1d4ed8; }

.rend-rank-stats { display: flex; gap: 8px; flex-shrink: 0; }
.rend-rank-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 38px;
}
.rend-rank-stat strong { font-size: 1rem; font-weight: 800; color: #1e293b; }
.rend-rank-stat span   { font-size: 0.65rem; color: #94a3b8; }
.rend-stat-pedidos strong { color: #22c55e; }

/* ═══════════════════════════════════════════════════════════════════════════
   DASHBOARD — Top 20 análisis
═══════════════════════════════════════════════════════════════════════════ */

.dash-top-header {
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}
.dash-top-header h3 { margin: 0; }
.dash-top-subtitle {
  font-size: 0.78rem;
  color: #64748b;
  font-weight: 400;
}

/* Tabla de análisis */
.dash-analysis-table {
  margin-top: 18px;
  overflow-x: auto;
}
.dash-an-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.83rem;
}
.dash-an-table thead th {
  background: #f1f5f9;
  padding: 7px 10px;
  text-align: left;
  font-weight: 700;
  color: #475569;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: .03em;
  white-space: nowrap;
}
.dash-an-table tbody tr { border-bottom: 1px solid #f1f5f9; transition: background .12s; }
.dash-an-table tbody tr:hover { background: #f8fafc; }
.dash-an-table tfoot tr { border-top: 2px solid #e2e8f0; background: #f8fafc; }
.dash-an-table td { padding: 7px 10px; vertical-align: middle; }
.dash-an-table tfoot td { padding: 8px 10px; font-size: 0.84rem; }

.dash-an-pos  { width: 36px; text-align: center; font-size: 1.1rem; }
.dash-an-name { max-width: 200px; }
.dash-an-name strong { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: #0f172a; }
.dash-an-sub  { font-size: 0.72rem; color: #94a3b8; margin-top: 1px; }
.dash-an-dot  { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; flex-shrink: 0; vertical-align: middle; }
.dash-an-num  { text-align: right; white-space: nowrap; color: #334155; }
.dash-an-pct  { min-width: 90px; }
.dash-an-pct > div { display: flex; align-items: center; gap: 6px; }
.dash-an-bar-bg { flex: 1; height: 6px; background: #e2e8f0; border-radius: 99px; overflow: hidden; }
.dash-an-bar    { height: 100%; border-radius: 99px; transition: width .3s ease; min-width: 2px; }
.dash-an-pct span { font-size: 0.72rem; color: #64748b; white-space: nowrap; width: 36px; text-align: right; }
.dash-rank { display: inline-block; width: 22px; height: 22px; line-height: 22px; text-align: center; border-radius: 50%; background: #e2e8f0; font-size: 0.72rem; font-weight: 700; color: #475569; }

/* ============================================================
   MÓVIL — RESPONSIVE COMPLETO (portrait + landscape)
   Aplica solo a ≤ 767px. Tablets y PC sin cambios.
   ============================================================ */

/* ── 1. TOPBAR ───────────────────────────────────────────── */
@media (max-width: 767px) {
  .topbar {
    height: auto;
    padding: 8px 12px;
    flex-wrap: nowrap;
    align-items: center;
    gap: 8px;
    min-height: 52px;
  }
  .topbar > div:first-child {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
    overflow: hidden;
  }
  .topbar > div:first-child img {
    height: 36px !important;
    flex-shrink: 0;
  }
  .topbar h1 {
    font-size: 0.88rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .topbar p { display: none; }
  .user-box {
    flex-shrink: 0;
    gap: 6px;
    align-items: center;
  }
  /* Logout: colapsar a icono ✕ para ahorrar espacio */
  #logoutBtn {
    font-size: 0 !important;
    padding: 0;
    width: 34px;
    height: 34px;
    min-height: 34px;
    border-radius: var(--radius-sm);
    flex-shrink: 0;
    position: relative;
  }
  #logoutBtn::before {
    content: "✕";
    font-size: 0.9rem;
    font-weight: 600;
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
  }
  #userInfo {
    font-size: 0.72rem;
    padding: 4px 8px;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  /* ── 2. CONTAINER / PANEL ──────────────────────────────── */
  .container {
    padding: 8px 8px 20px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow-x: hidden;
  }
  .layout {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
  }
  .panel {
    padding: 12px;
    border-radius: var(--radius);
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow-x: hidden;
  }
  .panel-head {
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
  }
  .panel-head h2,
  .panel-head h3 {
    font-size: 1rem;
    flex: 1 1 auto;
    min-width: 0;
  }
  /* Acciones en panel-head → ancho completo en fila nueva */
  .panel-head .actions-inline {
    width: 100%;
    flex-wrap: wrap;
    gap: 6px;
  }
  .panel-head .actions-inline .btn {
    flex: 1 1 auto;
    justify-content: center;
    min-height: 40px;
    font-size: 0.82rem;
    white-space: nowrap;
  }
  .panel-head .actions-inline select {
    flex: 1 1 auto;
    min-width: 0;
    height: 40px;
    font-size: 16px !important;
  }

  /* ── 3. TABS ───────────────────────────────────────────── */
  .tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding: 4px 6px;
    gap: 3px;
    margin-bottom: 10px;
  }
  .tabs::-webkit-scrollbar { display: none; }
  .tab {
    flex: 0 0 auto;
    padding: 7px 11px;
    font-size: 0.78rem;
    min-height: 38px;
    white-space: nowrap;
  }

  /* ── 4. BOTONES GLOBALES ───────────────────────────────── */
  .btn:not(.btn-sm):not(.btn-xs):not(.btn-close-modal):not(.wa-modal-close):not(.catalog-close-btn):not(.order-qty-btn):not(.order-note-btn):not(.order-delete-btn):not(.order-dup-btn):not(.catalog-qty-btn):not(.btn-mesa-count):not(.quick-table-btn) {
    min-height: 40px;
    font-size: 0.83rem;
  }
  .btn-sm { min-height: 34px; }

  /* Grupos de botones inline: siempre wrapean */
  .actions-inline {
    flex-wrap: wrap;
    gap: 6px;
  }

  /* ── 5. FORMULARIOS ────────────────────────────────────── */
  .grid.two-col,
  .two-col {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  input:not([type="checkbox"]):not([type="radio"]),
  select,
  textarea {
    font-size: 16px !important;
  }

  /* ── 6. SECCIÓN PEDIDOS ────────────────────────────────── */
  #ordersSection > .panel-head {
    flex-wrap: wrap;
    gap: 6px;
  }
  #ordersSection > .panel-head h2 {
    flex: 1;
    min-width: 0;
  }
  /* Botones inline del encabezado (🔔 📲) */
  .solicitud-icon-btn {
    padding: 4px 7px;
    font-size: 1rem;
    min-height: 34px;
    flex-shrink: 0;
  }

  /* ── 7. SECCIÓN COCINA ─────────────────────────────────── */
  #cocinaSection .panel-head {
    flex-wrap: wrap;
    gap: 8px;
  }
  #cocinaSection .panel-head h2 {
    width: 100%;
  }
  /* Cabecera de área cocina: compacta en móvil */
  .kitchen-area-head {
    flex-wrap: wrap;
    gap: 6px;
  }
  .kitchen-area-head strong { flex: 1; min-width: 0; }
  .kitchen-drag-handle { font-size: 1rem; padding: 0 2px; }
  .kitchen-area-badge { font-size: 0.72rem; padding: 1px 8px; }
  .kitchen-collapse-btn { font-size: 0.72rem; padding: 1px 8px; }
  #cocinaSection .panel-head .actions-inline {
    width: 100%;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    gap: 5px;
  }
  #cocinaSection .panel-head .actions-inline::-webkit-scrollbar { display: none; }
  #cocinaSection .panel-head .actions-inline .btn {
    flex: 0 0 auto;
    min-height: 38px;
    font-size: 0.78rem;
    padding: 0 10px;
    white-space: nowrap;
  }
  /* Tarjetas de cocina: items compactos, acciones apiladas */
  .kitchen-item .item-row {
    grid-template-columns: 1fr;
    gap: 6px;
  }
  .kitchen-item .actions-inline {
    width: 100%;
    flex-wrap: nowrap;
    gap: 6px;
  }
  .kitchen-item .actions-inline .btn {
    flex: 1;
    justify-content: center;
    min-height: 40px;
    font-size: 0.82rem;
  }

  /* ── 8. SECCIÓN CAJA ───────────────────────────────────── */
  #cashSection {
    overflow-x: hidden;
    max-width: 100vw;
    box-sizing: border-box;
  }
  #cashSection .panel-head {
    flex-wrap: wrap;
    gap: 8px;
  }
  #cashSection .panel-head h2 { flex: 1; }
  .cash-actions-bar {
    flex-wrap: wrap;
    gap: 6px;
  }
  .cash-actions-bar .btn {
    flex: 1 1 auto;
    justify-content: center;
    min-height: 40px;
  }
  #cashBalanceTable {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  /* ── 9. SECCIÓN ENVÍOS ─────────────────────────────────── */
  .envios-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    gap: 4px;
    padding-bottom: 2px;
  }
  .envios-tabs::-webkit-scrollbar { display: none; }
  .envios-tab {
    flex: 0 0 auto;
    white-space: nowrap;
    font-size: 0.78rem;
    padding: 6px 10px;
    min-height: 36px;
  }
  /* Layout envíos IA (móvil): stack + bottom-sheet feel */
  .envios-ia-layout {
    grid-template-columns: 1fr;
    background: #f5f5f7;
  }
  .envios-ia-sidebar {
    width: 100%;
    min-width: 0;
    max-width: none;
    border-right: 0;
    border-bottom: 1px solid rgba(0,0,0,.08);
    max-height: 42vh;
    padding: 14px 12px 10px;
  }
  .envios-ia-sidebar-head strong { font-size: 1.2rem; }
  .envios-ia-detail { width: 100%; border-radius: 14px 14px 0 0; }
  .envios-ia-detail-head { padding: 14px 16px 12px; }
  .envios-ia-detail-head h3 { font-size: 1rem; }
  .envios-ia-detail-body { padding: 12px 16px; gap: 12px; }
  .envios-ia-context-grid { grid-template-columns: 1fr; }
  .envios-ia-form { padding: 12px 16px calc(14px + env(safe-area-inset-bottom, 0px)); }
  .envios-ia-request { padding: 11px 14px 11px 14px; }
  .envios-ia-chat { max-height: 240px; }

  /* ── 10. SECCIÓN DASHBOARD ─────────────────────────────── */
  .dash-panel-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }
  .dash-panel-head h2 { font-size: 1.1rem; margin-bottom: 0; }
  .dash-filters {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
  }
  .dash-filters select,
  .dash-filters input[type="date"],
  .dash-filters .btn {
    height: 38px;
    font-size: 14px !important;
    min-width: 0;
    width: 100%;
    box-sizing: border-box;
  }
  .dash-filters .btn { grid-column: 1 / -1; }
  .dash-custom-range { grid-column: 1 / -1; }
  /* Estado de Cuenta Jornada — compacto en móvil */
  .dash-session-report-card { margin-bottom: 12px; }
  .dsr-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    padding: 14px;
  }
  .dsr-icon { font-size: 1.4rem; }
  .dsr-title { font-size: 0.88rem; }
  .dsr-subtitle { font-size: 0.7rem; }
  .dsr-title-wrap { gap: 10px; }
  .dsr-btn {
    width: 100%;
    text-align: center;
    justify-content: center;
    padding: 8px 14px;
    font-size: 0.82rem;
  }
  .dsr-body { padding: 14px; }
  .dsr-controls {
    padding: 10px 14px 12px;
    gap: 8px;
  }
  .dsr-range-pill { font-size: 0.75rem; padding: 5px 10px; }
  .dsr-custom-dates {
    margin-left: 0;
    width: 100%;
    flex-wrap: wrap;
  }
  .dsr-custom-dates label { font-size: 0.72rem; }
  .dash-kpi-row {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  .dash-kpi-card { padding: 10px 12px; gap: 8px; }
  .dash-kpi-value { font-size: clamp(0.9rem, 2.5vw, 1.1rem); }
  .dash-kpi-label { font-size: 0.66rem; }
  .dash-charts-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .dash-chart-wide { grid-column: unset; }
  .dash-chart-wrap { height: 220px; }
  /* Tablas de análisis: scroll horizontal en móvil */
  .dash-analysis-table {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .dash-an-table { min-width: 460px; }
  .dash-an-name { max-width: 130px; }
  .dash-top-header {
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
  }

  /* ── 11. SECCIÓN ADMIN ─────────────────────────────────── */
  .adm-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 2px;
    gap: 3px;
  }
  .adm-tabs::-webkit-scrollbar { display: none; }
  .adm-tab {
    flex: 0 0 auto;
    white-space: nowrap;
    font-size: 0.78rem;
    padding: 7px 12px;
    min-height: 36px;
  }
  .adm-panel-bar {
    flex-wrap: wrap;
    gap: 8px;
  }
  .adm-panel-bar .adm-panel-title { flex: 1; min-width: 0; }
  .adm-panel-bar #adminProductSearch {
    width: 100%;
    flex: 1 1 100%;
    order: 3;
    max-width: 100% !important;
  }
  #adminProductCategoryFilters {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  #adminProductCategoryFilters::-webkit-scrollbar { display: none; }
  #adminProductCategoryFilters .btn {
    flex: 0 0 auto;
    min-height: 34px;
    font-size: 0.8rem;
  }
  /* Tablas admin: scroll horizontal */
  #adminSection .table-wrap,
  #adminSection > .panel > div[style*="overflow"] {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
  }

  /* ── 12. SECCIÓN EMPLEADOS ─────────────────────────────── */
  #empleadosSection > .panel-head { flex-wrap: wrap; gap: 8px; }
  #empleadosSection > .panel-head .btn { flex: 1; justify-content: center; }

  /* ── 13. SECCIÓN WHATSAPP ──────────────────────────────── */
  #whatsappSection .panel-head { flex-wrap: wrap; gap: 8px; }
  #whatsappSection .panel-head .actions-inline {
    width: 100%;
    flex-wrap: wrap;
    gap: 6px;
  }
  #whatsappSection .panel-head .actions-inline .btn {
    flex: 1;
    justify-content: center;
    min-height: 40px;
  }

  /* ── 14. CHAT IA ADMIN ─────────────────────────────────── */
  .admin-ia-layout {
    flex-direction: column;
    height: auto;
  }
  .admin-ia-sidebar {
    width: 100%;
    flex-direction: row;
    flex-wrap: wrap;
    border-right: none;
    border-bottom: 1px solid var(--border-light);
    padding-bottom: 8px;
  }
  .admin-ia-chat-wrapper { min-height: 300px; }

  /* ── 15. RENDIMIENTO EQUIPO ────────────────────────────── */
  #miRendimientoSection {
    overflow-x: hidden;
    max-width: 100vw;
    box-sizing: border-box;
  }
  #miRendimientoSection .panel-head h2 { font-size: 1.1rem; }
  #miRendimientoSection .rend-liveboard { padding: 14px 12px; overflow: hidden; }
  #miRendimientoSection .rend-col { max-width: 100%; overflow: hidden; }
  .rend-summary-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .rend-body-grid    { grid-template-columns: 1fr; gap: 10px; }
  .rend-card         { padding: 12px; }
  .rend-card-val     { font-size: 1.4rem; }
  .rend-widget       { padding: 12px; overflow: hidden; max-width: 100%; box-sizing: border-box; }
  .rend-widget-title { font-size: 0.8rem; word-wrap: break-word; overflow-wrap: break-word; }
  .rend-top-row      { overflow: hidden; }
  .rend-top-row .rend-top-pos { width: auto !important; max-width: 65px; font-size: 0.75rem !important; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .rend-top-count    { width: auto; min-width: 40px; font-size: 0.8rem; }
  .rend-chart-wrap   { max-width: 100%; overflow: hidden; }
  .rend-team-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .rend-lb-bar-wrap  { max-width: 80px; }
  .rend-user-picker label { font-size: 0.82rem; }
  .rend-user-picker select { height: 42px; font-size: 16px !important; }

  /* ── 16. MODALES ───────────────────────────────────────── */
  .modal-overlay { align-items: flex-end; }
  .modal-card {
    width: 100%;
    max-width: 100%;
    border-radius: 18px 18px 0 0;
    padding: 20px 14px 28px;
    margin: 0;
    max-height: 88vh;
    overflow-y: auto;
  }
  .auth-modal-actions { flex-direction: column; gap: 8px; }
  .auth-modal-actions .btn { width: 100%; justify-content: center; }
  .modal-box {
    width: 100% !important;
    max-width: 100% !important;
    border-radius: 18px 18px 0 0 !important;
  }

  /* ── 17. QUICK MESAS ───────────────────────────────────── */
  .quick-table-row {
    gap: 4px;
    flex-wrap: wrap;
    width: 100%;
    max-width: 100%;
  }
  /* Botones de mesa: tamaño adaptable para no causar overflow
     Calc: (100% - N_gaps) / N_cols
     Objetivo 7 cols: (100% - 6×4px) / 7 ≈ min 38px */
  .quick-table-btn {
    flex: 1 1 calc(14.28% - 4px); /* ~7 cols */
    min-width: 38px;
    max-width: 52px;
    height: 40px;
    padding: 0 4px;
    font-size: 0.78rem;
    text-align: center;
  }
  .mesa-bar-header {
    flex-wrap: wrap;
    gap: 6px;
    width: 100%;
    max-width: 100%;
  }
  .mesa-count-controls {
    flex-shrink: 0;
  }
  .mesa-count-label {
    font-size: 0.75rem;
    min-width: 48px;
    max-width: 72px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* ── 18. TABLAS GENERALES ──────────────────────────────── */
  .table-scroll-x {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* ── 19. EVITAR OVERFLOW HORIZONTAL GLOBAL ─────────────── */
  /* Contenedores del mesero */
  #meseroOrderPanel,
  .mesero-mesa-bar,
  .mesero-layout,
  .mesero-left,
  .mesero-right {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow-x: hidden;
  }
  .mesero-layout {
    grid-template-columns: 1fr !important;
  }
  /* Cualquier tabla dentro de panel: contenedor scrollable */
  .panel div:not(.modal-overlay) > table {
    min-width: unset;
  }
  /* Imágenes y medios */
  img, video, canvas, svg {
    max-width: 100%;
  }
}

/* ── TIEMPOS DE PREPARACIÓN (Rendimiento Equipo) ────────── */
.prep-time-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.prep-time-avg {
  font-size: 0.85rem;
  color: #374151;
  background: #F1F5F9;
  border-radius: 8px;
  padding: 7px 12px;
  margin-bottom: 2px;
}
.prep-time-col {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.prep-time-col-title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 2px;
}
.prep-time-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #F8FAFC;
  border: 1px solid #E2E8F0;
  border-radius: 8px;
  padding: 7px 10px;
}
.prep-time-icon { font-size: 1.2rem; flex-shrink: 0; }
.prep-time-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.prep-time-prod {
  font-weight: 600;
  font-size: 0.88rem;
  color: #1E293B;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.prep-time-emp {
  font-size: 0.75rem;
  color: #6B7280;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.prep-time-val {
  font-size: 1rem;
  font-weight: 700;
  flex-shrink: 0;
}

/* ── MÓDULO: PEDIDO POR VOZ ─────────────────────────────── */
.voice-order-card {
  max-width: 420px;
  width: 95vw;
}

/* Área central del micrófono */
.voice-record-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 20px 0 10px;
}

/* Botón circular del micrófono */
.voice-record-btn {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  border: 3px solid #3B82F6;
  background: #EFF6FF;
  cursor: pointer;
  font-size: 2.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, transform 0.12s, border-color 0.2s, box-shadow 0.2s;
  box-shadow: 0 3px 12px rgba(59,130,246,0.18);
  outline: none;
}
.voice-record-btn:not(:disabled):hover { transform: scale(1.06); background: #DBEAFE; }
.voice-record-btn:disabled             { opacity: 0.65; cursor: not-allowed; }

/* Grabando → rojo pulsante */
.voice-record-btn.recording {
  background: #FEE2E2;
  border-color: #EF4444;
  box-shadow: 0 0 0 0 rgba(239,68,68,0.4);
  animation: voice-pulse 1s ease-in-out infinite;
}
/* Procesando → amarillo */
.voice-record-btn.processing {
  background: #FEF9C3;
  border-color: #EAB308;
  animation: none;
}
@keyframes voice-pulse {
  0%, 100% { box-shadow: 0 0 0 0   rgba(239,68,68,0.4); }
  50%       { box-shadow: 0 0 0 14px rgba(239,68,68,0); }
}

/* Hint debajo del botón */
.voice-record-hint {
  font-size: 0.83rem;
  color: #6B7280;
  margin: 0;
  text-align: center;
  min-height: 1.2em;
}

/* Waveform animado (5 barras) */
.voice-waveform {
  display: flex;
  align-items: center;
  gap: 5px;
  height: 28px;
}
.voice-waveform.hidden { display: none; }
.voice-waveform span {
  display: inline-block;
  width: 5px;
  border-radius: 3px;
  background: #EF4444;
  animation: voice-wave 0.75s ease-in-out infinite;
}
.voice-waveform span:nth-child(1) { height: 8px;  animation-delay: 0s; }
.voice-waveform span:nth-child(2) { height: 18px; animation-delay: 0.1s; }
.voice-waveform span:nth-child(3) { height: 24px; animation-delay: 0.2s; }
.voice-waveform span:nth-child(4) { height: 18px; animation-delay: 0.1s; }
.voice-waveform span:nth-child(5) { height: 8px;  animation-delay: 0s; }
@keyframes voice-wave {
  0%, 100% { transform: scaleY(1);   opacity: 0.75; }
  50%       { transform: scaleY(1.7); opacity: 1; }
}

/* Línea de estado / spinner */
.voice-status {
  text-align: center;
  font-size: 0.86rem;
  color: #6B7280;
  padding: 4px 0;
}
.voice-status.hidden { display: none; }

/* Transcripción — texto pequeño de referencia */
.voice-transcript-box {
  background: #F8FAFC;
  border: 1px solid #E2E8F0;
  border-radius: 8px;
  padding: 8px 12px;
  margin-top: 8px;
}
.voice-transcript-box.hidden { display: none; }
.voice-transcript-text {
  font-size: 0.82rem;
  color: #64748B;
  margin: 0;
  font-style: italic;
  line-height: 1.4;
}

/* Caja de artículos agregados */
.voice-articulos-box { margin-top: 10px; }
.voice-articulos-box.hidden { display: none; }
.voice-articulos-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: #16A34A;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 0 0 8px;
}

/* Fila de un artículo */
.voice-articulo-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: #F0FDF4;
  border: 1px solid #BBF7D0;
  border-radius: 8px;
  padding: 8px 12px;
  margin-bottom: 5px;
  animation: voice-item-in 0.22s ease-out;
}
@keyframes voice-item-in {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.voice-articulo-row.voice-art-unknown {
  background: #FFF7ED;
  border-color: #FED7AA;
}
.voice-art-qty {
  font-size: 1rem;
  font-weight: 800;
  color: #16A34A;
  min-width: 28px;
  text-align: center;
  flex-shrink: 0;
}
.voice-art-unknown .voice-art-qty { color: #EA580C; }
.voice-art-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.voice-art-name {
  font-weight: 600;
  font-size: 0.9rem;
  color: #1E293B;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.voice-art-nota {
  font-size: 0.76rem;
  color: #6B7280;
}

/* Resumen de IA */
.voice-resumen {
  font-size: 0.82rem;
  color: #475569;
  background: #F1F5F9;
  border-radius: 6px;
  padding: 7px 10px;
  margin-top: 8px;
}
.voice-resumen.hidden { display: none; }

/* Fila de botones "Dictar más" / "Listo" */
.voice-actions-row {
  display: flex;
  gap: 8px;
  margin-top: 14px;
}
.voice-actions-row .btn { flex: 1; }

/* Error */
.voice-error-box {
  background: #FEF2F2;
  border: 1px solid #FECACA;
  border-radius: 8px;
  color: #DC2626;
  font-size: 0.84rem;
  padding: 8px 12px;
  margin-top: 8px;
  text-align: center;
}
.voice-error-box.hidden { display: none; }

/* ── LANDSCAPE MÓVIL: ancho suficiente pero alto limitado ── */
@media (max-width: 900px) and (orientation: landscape) and (max-height: 520px) {
  .topbar {
    min-height: 46px;
    padding: 6px 12px;
  }
  .topbar > div:first-child img { height: 30px !important; }
  .topbar h1 { font-size: 0.82rem; }
  .container { padding: 6px 8px 16px; }
  .panel { padding: 10px; }
  .tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    margin-bottom: 8px;
  }
  .tabs::-webkit-scrollbar { display: none; }
  .tab {
    padding: 5px 10px;
    font-size: 0.76rem;
    min-height: 34px;
  }
  /* Dashboard charts: más cortos en landscape */
  .dash-chart-wrap { height: 180px; }
  /* Kitchen landscape: items en fila de nuevo */
  .kitchen-item .item-row { grid-template-columns: 1fr auto; align-items: flex-start; }
  #pendingKitchenOrders { grid-template-columns: 1fr 1fr !important; }
  /* Rendimiento: 2 col en landscape */
  .rend-summary-grid { grid-template-columns: repeat(4, 1fr); }
  /* Modal: slide from right in landscape */
  .modal-overlay { align-items: center; }
  .modal-card {
    max-width: 96vw;
    max-height: 96vh;
    border-radius: var(--radius-lg);
    margin: auto;
  }
  /* Formulario pedidos: 2 col en landscape para aprovechar ancho */
  #orderForm.grid.two-col {
    grid-template-columns: 1fr 1fr;
  }
}

/* ── PANTALLAS PEQUEÑAS: ≤ 400px portrait ──────────────── */
@media (max-width: 400px) {
  .rend-summary-grid { grid-template-columns: 1fr 1fr; gap: 6px; }
  .rend-card-val     { font-size: 1.2rem; }
  .dash-kpi-row      { grid-template-columns: 1fr 1fr; gap: 6px; }
  .dash-kpi-value    { font-size: 1rem; }
  #cashBalanceTable  { grid-template-columns: 1fr; }
  .tab               { padding: 6px 9px; font-size: 0.76rem; }
  .btn:not(.btn-sm):not(.btn-xs):not(.btn-close-modal):not(.quick-table-btn):not(.btn-mesa-count) {
    font-size: 0.8rem;
    padding: 8px 10px;
  }
}

/* ══════════════════════════════════════════════════════════
   NOTAS DEL EQUIPO — Modal confirmación con contraseña
══════════════════════════════════════════════════════════ */

.tnote-pass-overlay {
  position: fixed;
  inset: 0;
  z-index: 9200;
  background: rgba(15,23,42,.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeInOverlay .1s ease;
}

.tnote-pass-overlay.hidden { display: none !important; }

.tnote-pass-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 24px 24px 20px;
  width: 100%;
  max-width: 340px;
  box-shadow: var(--shadow-xl, 0 25px 50px rgba(15,23,42,.22));
  display: flex;
  flex-direction: column;
  gap: 10px;
  animation: slideUpSmall .22s cubic-bezier(.32,.72,0,1);
}

.tnote-pass-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  margin: 0;
}

.tnote-pass-sub {
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin: 0;
  line-height: 1.45;
}

.tnote-pass-input {
  width: 100%;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  font-size: 15px;
  font-family: inherit;
  color: var(--text);
  background: var(--surface);
  outline: none;
  transition: border-color .15s;
}

.tnote-pass-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}

.tnote-pass-error {
  font-size: 0.78rem;
  color: #dc2626;
  margin: 0;
  font-weight: 500;
}

.tnote-pass-error.hidden { display: none !important; }

.tnote-pass-actions {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}

.tnote-pass-btn {
  flex: 1;
  padding: 10px 8px;
  border-radius: var(--radius);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  font-family: inherit;
  transition: background .15s, opacity .15s;
}

.tnote-pass-btn:disabled { opacity: .55; cursor: not-allowed; }

.tnote-pass-btn-cancel {
  background: var(--bg-secondary, #f1f5f9);
  color: var(--text-secondary);
}

.tnote-pass-btn-cancel:hover:not(:disabled) { background: #e2e8f0; }

.tnote-pass-btn-confirm {
  background: #dc2626;
  color: #fff;
}

.tnote-pass-btn-confirm:hover:not(:disabled) { background: #b91c1c; }

@keyframes slideUpSmall {
  from { transform: translateY(16px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

/* ═══════════════════════════════════════════════════════════════════
   MARKETING / PUBLICIDAD IA
═══════════════════════════════════════════════════════════════════ */

.mkt-section {
  margin-top: 1.5rem;
  background: var(--surface);
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 12px;
  overflow: hidden;
}

.mkt-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border, #e2e8f0);
  background: linear-gradient(135deg, #f0fdf4 0%, #eff6ff 100%);
  gap: 12px;
  flex-wrap: wrap;
}

.mkt-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.mkt-header-icon {
  font-size: 1.8rem;
  line-height: 1;
}

.mkt-title {
  margin: 0 0 2px;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
}

.mkt-subtitle {
  margin: 0;
  font-size: .82rem;
  color: var(--text-secondary);
}

/* ── Formulario nueva campaña ── */
.mkt-form-wrap {
  padding: 20px;
  border-bottom: 1px solid var(--border, #e2e8f0);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.mkt-form-card {
  background: var(--surface-2, #f8fafc);
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 10px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.mkt-form-title {
  margin: 0 0 4px;
  font-size: .95rem;
  font-weight: 700;
  color: var(--text);
}

.mkt-label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: .85rem;
  font-weight: 600;
  color: var(--text);
}

.mkt-label-sm { flex: 1; min-width: 110px; }

.mkt-input {
  padding: 9px 12px;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 8px;
  font-size: .88rem;
  font-family: inherit;
  background: var(--surface);
  color: var(--text);
  transition: border .15s;
}

.mkt-input:focus {
  outline: none;
  border-color: var(--primary, #2563eb);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}

.mkt-textarea { resize: vertical; min-height: 90px; line-height: 1.5; }

.mkt-config-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.mkt-antibaan-info {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: .82rem;
  color: #166534;
  line-height: 1.4;
}

.mkt-shield { font-size: 1.1rem; flex-shrink: 0; }
.mkt-antibaan-info p { margin: 0; }

.mkt-form-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* ── Preview IA ── */
.mkt-preview-card {
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 10px;
  padding: 14px 16px;
}

.mkt-preview-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  font-size: .83rem;
  font-weight: 600;
  color: #92400e;
  flex-wrap: wrap;
  gap: 6px;
}

.mkt-preview-header small { color: #a16207; font-weight: 400; }

.mkt-preview-text {
  white-space: pre-line;
  font-size: .87rem;
  color: #1c1917;
  line-height: 1.55;
  background: #fff;
  border: 1px solid #fde68a;
  border-radius: 6px;
  padding: 10px 12px;
  margin-bottom: 8px;
}

.mkt-preview-note {
  margin: 0;
  font-size: .75rem;
  color: #a16207;
}

/* ── Lista de campañas ── */
.mkt-campaigns-list {
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.mkt-empty-state {
  text-align: center;
  padding: 32px 16px;
  color: var(--text-secondary);
}

.mkt-empty-icon { font-size: 2rem; display: block; margin-bottom: 8px; }
.mkt-empty-state p { margin: 0; font-size: .88rem; }

.mkt-campaign-card {
  background: var(--surface-2, #f8fafc);
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 10px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: box-shadow .15s;
}

.mkt-campaign-card:hover { box-shadow: 0 2px 8px rgba(0,0,0,.07); }

.mkt-cc-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.mkt-cc-info { display: flex; align-items: center; gap: 8px; }
.mkt-cc-name { font-weight: 700; font-size: .92rem; color: var(--text); }
.mkt-cc-date { font-size: .78rem; color: var(--text-secondary); }
.mkt-cc-desc { margin: 0; font-size: .83rem; color: var(--text-secondary); line-height: 1.4; }

.mkt-cc-stats {
  display: flex;
  gap: 14px;
  font-size: .8rem;
  color: var(--text-secondary);
  flex-wrap: wrap;
}

.mkt-stat-ok { color: #16a34a; font-weight: 600; }
.mkt-stat-err { color: #dc2626; font-weight: 600; }

/* Barra de progreso de campaña */
.mkt-cc-bar-wrap {
  height: 5px;
  background: #e2e8f0;
  border-radius: 99px;
  overflow: hidden;
}

.mkt-cc-bar {
  height: 100%;
  background: linear-gradient(90deg, #16a34a, #22c55e);
  border-radius: 99px;
  transition: width .4s ease;
}

.mkt-cc-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* Badges de estado */
.mkt-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: 99px;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .02em;
}

.mkt-badge-draft   { background: #f1f5f9; color: #64748b; }
.mkt-badge-active  { background: #dbeafe; color: #1d4ed8; }
.mkt-badge-done    { background: #dcfce7; color: #15803d; }
.mkt-badge-cancel  { background: #fee2e2; color: #b91c1c; }

/* ── Progreso de envío en vivo ── */
.mkt-progress-card {
  margin: 0 20px 16px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 10px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.mkt-progress-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.mkt-progress-title { font-weight: 700; font-size: .9rem; color: #1d4ed8; }

.mkt-progress-bar-wrap {
  height: 8px;
  background: #bfdbfe;
  border-radius: 99px;
  overflow: hidden;
}

.mkt-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #2563eb, #60a5fa);
  border-radius: 99px;
  transition: width .5s ease;
}

.mkt-progress-stats {
  display: flex;
  gap: 16px;
  font-size: .82rem;
  flex-wrap: wrap;
}

.mkt-stat { color: var(--text-secondary); }

.mkt-progress-current {
  margin: 0;
  font-size: .8rem;
  color: #3730a3;
}

.btn-sm { padding: 5px 12px; font-size: .82rem; }

/* ── Pedidos activos: header + chips de tipo ── */
.orders-header {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: .5rem;
}

.orders-header h3 { margin: 0; }

.orders-active-title {
  cursor: pointer;
  user-select: none;
  transition: color .15s;
}
.orders-active-title:hover { color: #2563eb; }

/* ── Modal cobrar / acciones rápidas de pedido ── */
.qoa-modal-card {
  max-width: 760px;
  width: 96%;
  position: relative;
}

.qoa-items .mesa-item-row {
  gap: 8px;
  padding: 8px 4px;
  border-bottom: 1px dashed #e2e8f0;
}
.qoa-item-actions {
  display: flex;
  gap: 4px;
  align-items: center;
  flex-shrink: 0;
}
.qoa-item-actions button {
  padding: 3px 7px;
  font-size: .82rem;
  border-radius: 5px;
  cursor: pointer;
  border: 1px solid;
  background: #fff;
  line-height: 1;
}
.qoa-item-actions .qoa-item-note-btn { border-color: #3b82f6; color: #1d4ed8; }
.qoa-item-actions .qoa-item-note-btn:hover { background: #eff6ff; }
.qoa-item-actions .qoa-item-price-btn { border-color: #16a34a; color: #15803d; }
.qoa-item-actions .qoa-item-price-btn:hover { background: #f0fdf4; }
.qoa-item-actions .qoa-item-delete-btn { border-color: #dc2626; color: #b91c1c; }
.qoa-item-actions .qoa-item-delete-btn:hover { background: #fef2f2; }

.qoa-btns {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.qoa-btn-row {
  display: grid;
  gap: 6px;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
}
.qoa-btn-row-pay {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}
.qoa-btn-row-pay > * { flex: 1 1 130px; min-width: 110px; }
.qoa-section-label {
  font-size: .72rem;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: .5px;
  font-weight: 600;
  margin-bottom: -4px;
  padding: 0 2px;
}
.qoa-btns .btn { margin: 0; }

@media (max-width: 600px) {
  .qoa-btn-row { grid-template-columns: 1fr 1fr; }
}

/* ── Modal historial de compras (WhatsApp) ── */
.wa-historial-modal-box {
  max-width: 1100px;
  width: 96%;
  background: #fff !important;
  max-height: 82vh;
  display: flex;
  flex-direction: column;
  border-radius: 12px;
  overflow: hidden;
}
.wa-historial-body {
  padding: 1rem 1.2rem;
  background: #fff;
  overflow-y: auto;
  flex: 1 1 auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: .75rem;
  align-content: start;
}
.wa-historial-body > p {
  grid-column: 1 / -1;
}
.wa-historial-body > div {
  background: #fff;
  margin-bottom: 0 !important;
}

@media (max-width: 700px) {
  .wa-historial-body {
    grid-template-columns: 1fr;
    padding: .75rem;
  }
}

/* ── Inventario: chips de stats en tarjetas del admin ── */
.inv-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}
.inv-chip {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: .78rem;
  padding: 2px 8px;
  border-radius: 12px;
  background: #f1f5f9;
  color: #475569;
}
.inv-chip b { font-weight: 700; margin-left: 2px; }
.inv-chip-total { background: #eff6ff; color: #1d4ed8; }
.inv-chip-sold  { background: #fef3c7; color: #a16207; }

/* ── Fidelidad: banner de alertas de regalo ── */
.loyalty-alert-banner {
  margin-bottom: 10px;
}
.loyalty-alert-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  border: 2px solid #f59e0b;
  border-radius: 12px;
  margin-bottom: 8px;
  animation: loyaltyPulse 2s ease-in-out infinite;
  cursor: pointer;
}
.loyalty-alert-card:hover { filter: brightness(1.03); }
@keyframes loyaltyPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(245,158,11,.4); }
  50%      { box-shadow: 0 0 0 8px rgba(245,158,11,0); }
}
.loyalty-alert-icon { font-size: 2rem; flex-shrink: 0; }
.loyalty-alert-info { flex: 1; min-width: 0; }
.loyalty-alert-title {
  font-weight: 700;
  color: #92400e;
  font-size: .92rem;
}
.loyalty-alert-sub {
  font-size: .78rem;
  color: #78350f;
  margin-top: 2px;
}
.loyalty-alert-btn {
  background: #f59e0b;
  color: #fff;
  border: 0;
  padding: 8px 14px;
  border-radius: 8px;
  font-weight: 700;
  font-size: .85rem;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}
.loyalty-alert-btn:hover { background: #d97706; }

/* Fidelidad: historial items */
.loyalty-reward-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid #f1f5f9;
  font-size: .82rem;
}
.loyalty-reward-row:last-child { border-bottom: 0; }
.loyalty-reward-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: .72rem;
  font-weight: 600;
  flex-shrink: 0;
}
.loyalty-badge-pendiente { background: #fef3c7; color: #92400e; }
.loyalty-badge-entregado { background: #dcfce7; color: #15803d; }
.loyalty-badge-expirado  { background: #fee2e2; color: #991b1b; }
.loyalty-badge-cancelado { background: #f1f5f9; color: #64748b; }

/* Fidelidad: producto selector checkboxes */
.loyalty-prod-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 0;
  font-size: .85rem;
}
.loyalty-prod-item input { width: 18px; height: 18px; cursor: pointer; }
.loyalty-prod-item label { cursor: pointer; flex: 1; }

/* ── Modal preview de imagen en grande ── */
.img-preview-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0,0,0,.85);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: imgPrevIn .2s ease;
}
.img-preview-overlay.hidden { display: none; }
@keyframes imgPrevIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
.img-preview-wrap {
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
}
.img-preview-wrap img {
  max-width: 90vw;
  max-height: 85vh;
  object-fit: contain;
  border-radius: 10px;
  box-shadow: 0 10px 40px rgba(0,0,0,.5);
  background: repeating-conic-gradient(#333 0 25%, #444 0 50%) 0/16px 16px;
}
.img-preview-close {
  position: absolute;
  top: -14px;
  right: -14px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #fff;
  color: #0f172a;
  border: 0;
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,.3);
  display: flex;
  align-items: center;
  justify-content: center;
}
.img-preview-close:hover { background: #f1f5f9; }

/* ── Agrupación de items en platos — Cocina (caja contenedora) ── */
.kitchen-plato-box {
  border: 3px solid #8b5cf6;
  border-radius: 12px;
  margin: 8px 0;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(139,92,246,.2);
}
.kitchen-plato-header {
  padding: 8px 12px;
  font-size: .85rem;
  color: #fff;
  background: #8b5cf6;
}
.kitchen-plato-box .kitchen-item {
  border-left: 0;
  margin: 0;
}
.kitchen-plato-box .kitchen-item + .kitchen-item {
  border-top: 1px dashed rgba(139,92,246,.3);
}

/* Colores por grupo */
.kitchen-plato-0 { border-color: #8b5cf6; }
.kitchen-plato-0 .kitchen-plato-header { background: #8b5cf6; }
.kitchen-plato-1 { border-color: #2563eb; }
.kitchen-plato-1 .kitchen-plato-header { background: #2563eb; }
.kitchen-plato-2 { border-color: #16a34a; }
.kitchen-plato-2 .kitchen-plato-header { background: #16a34a; }
.kitchen-plato-3 { border-color: #ea580c; }
.kitchen-plato-3 .kitchen-plato-header { background: #ea580c; }
.kitchen-plato-4 { border-color: #dc2626; }
.kitchen-plato-4 .kitchen-plato-header { background: #dc2626; }
.kitchen-plato-5 { border-color: #d97706; }
.kitchen-plato-5 .kitchen-plato-header { background: #d97706; }

/* ── Agrupación de items en platos — Pedidos activos ── */
.item-grupo {
  border-left: 3px solid #8b5cf6;
  padding-left: 8px;
  margin-left: -4px;
  background: #faf5ff;
}
.item-grupo-0 { border-left-color: #8b5cf6; background: #faf5ff; }
.item-grupo-1 { border-left-color: #2563eb; background: #eff6ff; }
.item-grupo-2 { border-left-color: #16a34a; background: #f0fdf4; }
.item-grupo-3 { border-left-color: #ea580c; background: #fff7ed; }
.item-grupo-4 { border-left-color: #dc2626; background: #fef2f2; }
.item-grupo-5 { border-left-color: #d97706; background: #fffbeb; }

.item-grupo-badge {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  background: #8b5cf6;
  color: #fff;
  font-size: .65rem;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 8px;
  margin-right: 4px;
}
.item-grupo-0 .item-grupo-badge { background: #8b5cf6; }
.item-grupo-1 .item-grupo-badge { background: #2563eb; }
.item-grupo-2 .item-grupo-badge { background: #16a34a; }
.item-grupo-3 .item-grupo-badge { background: #ea580c; }
.item-grupo-4 .item-grupo-badge { background: #dc2626; }
.item-grupo-5 .item-grupo-badge { background: #d97706; }

.btn-link-item {
  background: #f1f5f9;
  border: 1.5px solid #cbd5e1;
  border-radius: 6px;
  padding: 3px 6px;
  font-size: .82rem;
  cursor: pointer;
  transition: background .1s, border-color .1s, color .1s;
  line-height: 1;
}
.btn-link-item:hover { background: #e2e8f0; }
.btn-link-item.linked {
  background: #ede9fe;
  border-color: #8b5cf6;
}
.btn-link-item.link-selecting {
  background: #fef3c7;
  border-color: #f59e0b;
  animation: linkPulse .8s ease-in-out infinite;
}
@keyframes linkPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(245,158,11,.4); }
  50%      { box-shadow: 0 0 0 5px rgba(245,158,11,0); }
}

/* ── Productos en pedido — tablet (600-1024px) ── */
@media (min-width: 521px) and (max-width: 1024px) {
  .order-item-card {
    padding: 10px 12px;
  }
  .order-item-main {
    grid-template-columns: 1fr auto auto;
    gap: 8px;
    align-items: center;
  }
  .order-item-name {
    font-size: .88rem;
  }
  .order-item-category {
    font-size: .72rem;
  }
  .order-item-price {
    font-size: .9rem;
  }
  .order-qty-btn {
    width: 34px !important;
    height: 34px !important;
  }
  .order-qty-display {
    min-width: 26px;
    font-size: .9rem;
  }
  .order-item-actions {
    gap: 3px;
  }
  .order-note-btn,
  .order-delete-btn,
  .order-dup-btn,
  .order-link-btn {
    width: 30px !important;
    height: 30px !important;
    font-size: .78rem !important;
  }
}

/* ── Productos en pedido — móvil pequeño (≤520px) ── */
@media (max-width: 520px) {
  .order-item-card {
    padding: 8px 10px;
  }
  .order-item-name {
    font-size: .84rem;
  }
  .order-item-price {
    font-size: .85rem;
  }
  .order-qty-btn {
    width: 30px !important;
    height: 30px !important;
    font-size: 1rem !important;
  }
  .order-qty-display {
    min-width: 22px;
    font-size: .85rem;
  }
  .order-note-btn,
  .order-delete-btn,
  .order-dup-btn,
  .order-link-btn {
    width: 28px !important;
    height: 28px !important;
    font-size: .75rem !important;
  }
  .order-item-actions {
    gap: 2px;
  }
}

/* ── Cajas de plato en borrador — responsive ── */
@media (max-width: 520px) {
  .draft-plato-header {
    font-size: .75rem;
    padding: 5px 10px;
  }
  .draft-plato-box {
    border-width: 2px;
    margin: 6px 0;
  }
}

/* ── Grupos de plato en borrador — caja contenedora ── */
.draft-plato-box {
  border: 3px solid #8b5cf6;
  border-radius: 12px;
  margin: 8px 0;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(139,92,246,.15);
  flex-shrink: 0;
}
.draft-plato-header {
  padding: 6px 12px;
  font-size: .82rem;
  color: #fff;
  font-weight: 700;
  background: #8b5cf6;
}
.draft-plato-box .order-item-card { border-radius: 0; margin: 0; border: 0; border-bottom: 1px dashed rgba(139,92,246,.2); }
.draft-plato-box .order-item-card:last-child { border-bottom: 0; }

/* Badge de plato dentro de info en columna: evitar que se estire a todo el ancho */
.order-item-info .item-grupo-badge {
  align-self: flex-start;
  width: auto;
  max-width: max-content;
  flex: 0 0 auto;
  margin-bottom: 2px;
}

.draft-plato-0 { border-color: #8b5cf6; } .draft-plato-0 .draft-plato-header { background: #8b5cf6; }
.draft-plato-1 { border-color: #2563eb; } .draft-plato-1 .draft-plato-header { background: #2563eb; }
.draft-plato-2 { border-color: #16a34a; } .draft-plato-2 .draft-plato-header { background: #16a34a; }
.draft-plato-3 { border-color: #ea580c; } .draft-plato-3 .draft-plato-header { background: #ea580c; }
.draft-plato-4 { border-color: #dc2626; } .draft-plato-4 .draft-plato-header { background: #dc2626; }
.draft-plato-5 { border-color: #d97706; } .draft-plato-5 .draft-plato-header { background: #d97706; }

.draft-grupo {
  border-left: 3px solid #8b5cf6;
  padding-left: 6px;
}
.draft-grupo-0 { border-left-color: #8b5cf6; }
.draft-grupo-1 { border-left-color: #2563eb; }
.draft-grupo-2 { border-left-color: #16a34a; }
.draft-grupo-3 { border-left-color: #ea580c; }
.draft-grupo-4 { border-left-color: #dc2626; }
.draft-grupo-5 { border-left-color: #d97706; }

.order-link-btn {
  background: #f1f5f9 !important;
  border: 1.5px solid #cbd5e1 !important;
  font-size: .82rem;
  padding: 3px 5px;
  border-radius: 6px;
}
.order-link-btn:hover { background: #e2e8f0 !important; }
.order-link-btn.linked {
  background: #ede9fe !important;
  border-color: #8b5cf6 !important;
}

/* ── Botón instrucción IA en chat ── */
.ia-instruct-btn {
  background: linear-gradient(135deg, #7c3aed 0%, #6d28d9 100%) !important;
  color: #fff !important;
  border-color: #7c3aed !important;
  font-weight: 700;
}
.ia-instruct-btn:hover { filter: brightness(1.1); }

.ia-instruct-examples {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}
.ia-instruct-example {
  background: #f5f3ff;
  border: 1px solid #c4b5fd;
  color: #5b21b6;
  border-radius: 16px;
  padding: 5px 10px;
  font-size: .78rem;
  cursor: pointer;
  font-weight: 500;
  transition: background .12s;
}
.ia-instruct-example:hover { background: #ede9fe; }

/* ── Status de remoción de fondo ── */
.prod-img-bg-status {
  padding: 8px 12px;
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  border-radius: 8px;
  color: #0369a1;
  font-size: .82rem;
  font-weight: 500;
  margin: 6px 0;
  display: flex;
  align-items: center;
  gap: 8px;
}
.bg-status-spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid #93c5fd;
  border-top-color: #2563eb;
  border-radius: 50%;
  animation: spin .7s linear infinite;
  flex-shrink: 0;
}

/* ── Utilidades / Reporte de rentabilidad ── */
.profit-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}
.profit-summary-card {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 12px 14px;
}
.profit-summary-icon { font-size: 1.6rem; flex-shrink: 0; }
.profit-summary-label { font-size: .72rem; color: #64748b; text-transform: uppercase; font-weight: 600; }
.profit-summary-value { font-size: 1.1rem; font-weight: 800; }

.profit-good { color: #16a34a; }
.profit-ok   { color: #d97706; }
.profit-bad  { color: #dc2626; }

.profit-margen-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: .78rem;
  font-weight: 700;
}
.profit-margen-badge.profit-good { background: #dcfce7; }
.profit-margen-badge.profit-ok   { background: #fef3c7; }
.profit-margen-badge.profit-bad  { background: #fee2e2; }

/* ── Bloque de visibilidad pública (tienda / menú digital) ── */
.adm-visibility-row {
  margin: 12px 0 8px;
  padding: 10px 12px;
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  border-radius: 10px;
}
.adm-vis-title {
  display: block;
  font-weight: 700;
  font-size: .82rem;
  color: #0369a1;
  margin-bottom: 8px;
}
.adm-visibility-row .adm-toggle-row {
  margin: 0;
  padding: 5px 0;
}

/* ── Modal Menú Digital / QR ── */
.menu-digital-modal-card {
  max-width: 560px;
  width: 95%;
  max-height: 92vh;
  overflow-y: auto;
  position: relative;
}
.menu-qr-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 16px;
  background: #0f172a;
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  border: 1px solid rgba(254,243,199,.2);
  border-radius: 18px;
  margin: 16px 0;
  box-shadow: 0 10px 30px rgba(15,23,42,.25);
}
#menuQrImg {
  width: 100%;
  max-width: 360px;
  height: auto;
  aspect-ratio: 3 / 4;
  background: transparent;
  border-radius: 14px;
  padding: 0;
  box-shadow: 0 6px 20px rgba(0,0,0,.35);
  object-fit: contain;
}
.menu-qr-url {
  font-family: ui-monospace, Menlo, monospace;
  font-size: .78rem;
  color: #fef3c7;
  word-break: break-all;
  text-align: center;
}
.menu-qr-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 8px;
  margin: 14px 0;
}
.menu-qr-actions .btn {
  font-size: .85rem;
  padding: 9px 12px;
  text-align: center;
  text-decoration: none;
}
.menu-qr-stats {
  background: #fef3c7;
  border: 1px solid #fde68a;
  border-radius: 10px;
  padding: 12px 14px;
  margin-top: 14px;
}
.menu-qr-stat-title {
  font-weight: 700;
  color: #92400e;
  font-size: .88rem;
  margin-bottom: 8px;
}
.menu-qr-top-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid #fde68a;
  font-size: .85rem;
}
.menu-qr-top-item:last-child { border-bottom: 0; }
.menu-qr-top-rank {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #f97316;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: .72rem;
  flex-shrink: 0;
}
.menu-qr-top-name {
  flex: 1;
  color: #0f172a;
  font-weight: 500;
}
.menu-qr-top-likes {
  color: #dc2626;
  font-weight: 700;
  font-size: .82rem;
}
.menu-qr-top-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.menu-qr-top-total {
  background: #f97316;
  color: #fff;
  font-weight: 700;
  font-size: .78rem;
  padding: 2px 10px;
  border-radius: 999px;
  flex-shrink: 0;
}
.menu-qr-reaction-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.menu-qr-reaction-pill {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: rgba(255,255,255,.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid #fde68a;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: .75rem;
  line-height: 1;
}
.menu-qr-reaction-emoji { font-size: .9rem; }
.menu-qr-reaction-count {
  color: #92400e;
  font-weight: 700;
}

/* Reseñas en el modal del QR */
.menu-qr-reviews {
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  border-radius: 10px;
  padding: 12px 14px;
  margin-top: 12px;
}
.menu-qr-reviews-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.menu-qr-review-tabs {
  display: flex;
  gap: 4px;
  background: rgba(255,255,255,.6);
  padding: 3px;
  border-radius: 999px;
}
.menu-qr-rev-tab {
  background: transparent;
  border: none;
  border-radius: 999px;
  padding: 5px 12px;
  font-size: .78rem;
  font-weight: 600;
  color: #0369a1;
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
  -webkit-tap-highlight-color: transparent;
}
.menu-qr-rev-tab.active {
  background: #0ea5e9;
  color: #fff;
  box-shadow: 0 2px 6px rgba(14,165,233,.3);
}
.menu-qr-reviews-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 360px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding-right: 4px;
}
.menu-qr-review-card {
  background: #fff;
  border: 1px solid #e0f2fe;
  border-radius: 12px;
  padding: 10px 12px;
  box-shadow: 0 2px 6px rgba(14,165,233,.06);
}
.menu-qr-review-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}
.menu-qr-review-author {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: .88rem;
  color: #0f172a;
}
.menu-qr-review-avatar { font-size: 1.1rem; }
.menu-qr-review-alias { font-weight: 600; }
.menu-qr-review-stars {
  color: #f59e0b;
  font-size: .8rem;
  letter-spacing: 1px;
}
.menu-qr-review-del {
  background: transparent;
  border: 1px solid transparent;
  border-radius: 999px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  color: #dc2626;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition);
  -webkit-tap-highlight-color: transparent;
}
.menu-qr-review-del:hover,
.menu-qr-review-del:active {
  background: #fee2e2;
  border-color: #fecaca;
}
.menu-qr-review-product {
  font-size: .78rem;
  color: #64748b;
  margin-bottom: 4px;
}
.menu-qr-review-text {
  font-size: .85rem;
  color: #334155;
  margin-bottom: 6px;
  white-space: pre-wrap;
  word-break: break-word;
}
.menu-qr-review-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-size: .72rem;
  color: #94a3b8;
}
.menu-qr-review-status {
  padding: 2px 8px;
  border-radius: 999px;
  font-weight: 600;
  font-size: .7rem;
  text-transform: capitalize;
}
.menu-qr-review-status-approved { background: #dcfce7; color: #166534; }
.menu-qr-review-status-pending  { background: #fef3c7; color: #92400e; }
.menu-qr-review-status-rejected { background: #fee2e2; color: #991b1b; }

/* ── Area tipo picker: 3 cards visuales ── */
.area-tipo-wrap {
  margin: 14px 0 10px;
}
.area-tipo-label {
  font-size: .88rem;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 4px;
}
.area-tipo-hint {
  font-size: .75rem;
  color: #64748b;
  margin-bottom: 10px;
  line-height: 1.4;
}
.area-tipo-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
}
.area-tipo-card {
  background: var(--at-bg, #f8fafc);
  border: 2px solid var(--at-border, #e2e8f0);
  border-radius: 12px;
  padding: 12px 10px;
  text-align: center;
  cursor: pointer;
  transition: transform .12s, box-shadow .15s, border-color .15s;
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-family: inherit;
}
.area-tipo-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,.08);
}
.area-tipo-card-active {
  border-color: var(--at-color, #2563eb);
  box-shadow: 0 0 0 3px var(--at-bg, #eff6ff), 0 4px 12px rgba(0,0,0,.1);
  position: relative;
}
.area-tipo-card-active::before {
  content: '✓';
  position: absolute;
  top: 6px;
  right: 8px;
  background: var(--at-color, #2563eb);
  color: #fff;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  font-size: .7rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}
.area-tipo-icon {
  font-size: 1.8rem;
  line-height: 1;
}
.area-tipo-title {
  font-size: .95rem;
  font-weight: 700;
  color: var(--at-color, #0f172a);
}
.area-tipo-examples {
  font-size: .72rem;
  color: #475569;
  line-height: 1.35;
}
.area-tipo-notifica {
  font-size: .7rem;
  color: var(--at-color, #475569);
  font-weight: 600;
  margin-top: 3px;
  padding-top: 5px;
  border-top: 1px dashed var(--at-border, #cbd5e1);
}

/* ── Modal: matriz de permisos granulares por rol ── */
.role-perms-modal-card {
  max-width: 1100px;
  width: 96%;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
}
.role-perms-body {
  margin-top: 10px;
}
.rp-group {
  margin-bottom: 18px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  overflow: hidden;
}
.rp-group-title {
  background: #1e40af;
  color: #fff;
  padding: 8px 14px;
  font-weight: 700;
  font-size: .88rem;
}
.rp-table-wrap {
  overflow-x: auto;
}
.rp-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .85rem;
}
.rp-table th,
.rp-table td {
  padding: 8px 10px;
  border-bottom: 1px solid #f1f5f9;
  text-align: center;
  vertical-align: middle;
}
.rp-table thead th {
  background: #f8fafc;
  font-weight: 600;
  color: #334155;
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .3px;
}
.rp-table td.rp-label {
  text-align: left;
  max-width: 320px;
  min-width: 220px;
}
.rp-label-name {
  font-weight: 600;
  color: #0f172a;
}
.rp-label-desc {
  font-size: .74rem;
  color: #64748b;
  margin-top: 2px;
  line-height: 1.35;
}

/* Switch toggle */
.rp-switch {
  position: relative;
  display: inline-block;
  width: 38px;
  height: 22px;
}
.rp-switch input { opacity: 0; width: 0; height: 0; }
.rp-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: #cbd5e1;
  border-radius: 12px;
  transition: background .2s;
}
.rp-slider::after {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  top: 2px;
  left: 2px;
  background: #fff;
  border-radius: 50%;
  transition: left .2s;
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.rp-switch input:checked + .rp-slider { background: #16a34a; }
.rp-switch input:checked + .rp-slider::after { left: 18px; }

/* ── Botón "A dónde llevar" + modal mapa de pedidos domicilio ── */
.btn-delivery-map {
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  color: #fff;
  border: 0;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 8px;
}
.btn-delivery-map:hover {
  background: linear-gradient(135deg, #1d4ed8 0%, #1e40af 100%);
  color: #fff;
  border-color: transparent;
  filter: brightness(1.08);
}
#llevameBtn.btn-delivery-map,
#llevameBtn.btn-delivery-map:hover {
  background: linear-gradient(135deg, #16a34a 0%, #15803d 100%);
  color: #fff;
}

/* Reutilizamos .map-modal-wrap / .map-modal-inner de tienda.css pero al no estar
   cargado tienda.css en el app principal, los definimos aquí también. */
.map-modal-wrap {
  position: fixed;
  inset: 0;
  z-index: 9000;
  background: rgba(15,23,42,.65);
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.map-modal-inner {
  background: #fff;
  border-radius: 14px 14px 0 0;
  width: 100%;
  max-width: 900px;
  height: 92dvh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 -10px 40px rgba(0,0,0,.25);
  animation: dmSheetUp .15s cubic-bezier(.32,.72,0,1);
}
@keyframes dmSheetUp {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}
.map-modal-hdr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px 10px;
  border-bottom: 1px solid #e5e7eb;
  flex-shrink: 0;
}
.map-modal-title {
  font-size: 1rem;
  font-weight: 700;
  color: #0f172a;
}
.map-modal-hdr .close-btn,
.map-modal-hdr .btn-icon {
  background: #f1f5f9;
  border: 0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: .9rem;
  cursor: pointer;
}
.map-modal-hint {
  padding: 8px 18px;
  margin: 0;
  font-size: .78rem;
  color: #475569;
  flex-shrink: 0;
  border-bottom: 1px solid #f1f5f9;
}
.delivery-map-el {
  flex: 1 1 auto;
  width: 100%;
  height: 60vh;
  min-height: 320px;
  background: #e5e7eb;
  position: relative;
}
.delivery-map-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  padding: 10px 18px;
  font-size: .78rem;
  color: #475569;
  border-top: 1px solid #f1f5f9;
  flex-shrink: 0;
}
.dm-legend-item { display: inline-flex; align-items: center; gap: 5px; }
.dm-dot {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,.25);
}
.dm-dot-rest { background: #1e40af; }
.dm-dot-fast { background: #16a34a; }
.dm-dot-med  { background: #f97316; }
.dm-dot-far  { background: #dc2626; }

/* Marcadores Leaflet custom */
.dm-marker-rest {
  font-size: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,.4));
  line-height: 1;
}
.dm-marker-order {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 3px solid #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0,0,0,.35);
  color: #fff;
  font-weight: 700;
  font-size: .82rem;
}
.dm-marker-num { line-height: 1; }

.dm-popup {
  font-size: .85rem;
  min-width: 180px;
}
.dm-popup-title {
  font-weight: 700;
  font-size: .95rem;
  color: #0f172a;
  margin-bottom: 4px;
}
.dm-popup-sub {
  color: #64748b;
  font-size: .78rem;
  margin-bottom: 6px;
}
.dm-popup-stats {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: .82rem;
  color: #334155;
}
.dm-popup-state {
  margin-top: 6px;
  font-size: .72rem;
  text-transform: uppercase;
  color: #7c3aed;
  font-weight: 600;
}

body.map-open { overflow: hidden; }

@media (min-width: 720px) {
  .map-modal-wrap {
    align-items: center;
  }
  .map-modal-inner {
    border-radius: 14px;
    max-height: 88dvh;
  }
}

/* ── Botón "Va en camino" y leyenda posterior ── */
.btn-va-en-camino {
  display: block;
  width: 100%;
  margin-top: 8px;
  padding: 10px 14px;
  background: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
  color: #fff;
  border: 0;
  border-radius: 10px;
  font-weight: 700;
  font-size: .92rem;
  cursor: pointer;
  box-shadow: 0 3px 8px rgba(249,115,22,.35);
  transition: transform .1s, box-shadow .15s;
}
.btn-va-en-camino:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 5px 12px rgba(249,115,22,.45);
}
.btn-va-en-camino:active { transform: translateY(0); }
.btn-va-en-camino:disabled {
  opacity: .7;
  cursor: wait;
}

.en-camino-legend {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 8px;
  padding: 10px 14px;
  background: #dcfce7;
  border: 1px solid #86efac;
  border-radius: 10px;
  color: #15803d;
  font-size: .9rem;
  animation: enCaminoPulse .4s ease;
}
.en-camino-legend small {
  color: #166534;
  font-size: .75rem;
  font-weight: 500;
}
@keyframes enCaminoPulse {
  from { opacity: 0; transform: scale(.96); }
  to   { opacity: 1; transform: scale(1); }
}

/* ── Panel admin: privilegios de visibilidad de caja ── */
.cash-visibility-panel {
  margin: 12px 0;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  overflow: hidden;
}
.cash-vp-header {
  padding: 10px 14px;
  background: #1e40af;
  color: #fff;
  font-weight: 600;
  font-size: .9rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  user-select: none;
}
.cash-vp-header:hover { background: #1d4ed8; }
.cash-vp-toggle-icon {
  transition: transform .2s;
  font-size: .8rem;
}
.cash-vp-header.open .cash-vp-toggle-icon { transform: rotate(180deg); }

.cash-vp-body {
  padding: 12px 14px;
}
.cash-vp-hint {
  margin: 0 0 10px;
  font-size: .82rem;
  color: #475569;
  line-height: 1.4;
}
.cash-vp-grid {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.cash-vp-empty {
  padding: 14px;
  text-align: center;
  color: #64748b;
  font-size: .85rem;
  font-style: italic;
}
.cash-vp-section {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  overflow: hidden;
}
.cash-vp-section-title {
  background: #f1f5f9;
  padding: 8px 12px;
  font-weight: 700;
  font-size: .85rem;
  color: #0f172a;
  border-bottom: 1px solid #e2e8f0;
}
.cash-vp-section-title small {
  color: #64748b;
  font-weight: 500;
  margin-left: 4px;
}
.cash-vp-section-body {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 8px;
  padding: 10px;
}
.cash-vp-user-card {
  background: #fafbfd;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 9px 12px;
}
.cash-vp-user-inactive {
  opacity: .55;
}
.cash-vp-user-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 600;
  font-size: .86rem;
  color: #0f172a;
  margin-bottom: 6px;
  padding-bottom: 5px;
  border-bottom: 1px solid #f1f5f9;
}
.cash-vp-badge-inactive {
  background: #fef3c7;
  color: #92400e;
  font-size: .7rem;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 10px;
}
.cash-vp-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 0;
  font-size: .82rem;
  color: #334155;
  cursor: pointer;
}
.cash-vp-toggle input[type=checkbox] {
  width: 38px;
  height: 22px;
  appearance: none;
  background: #cbd5e1;
  border-radius: 12px;
  position: relative;
  cursor: pointer;
  transition: background .2s;
  flex-shrink: 0;
}
.cash-vp-toggle input[type=checkbox]::after {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  background: #fff;
  border-radius: 50%;
  top: 2px;
  left: 2px;
  transition: left .2s;
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.cash-vp-toggle input[type=checkbox]:checked {
  background: #16a34a;
}
.cash-vp-toggle input[type=checkbox]:checked::after {
  left: 18px;
}

/* ── PWA Install Banner (solo primera vez, empleados) ── */
.pwa-banner {
  position: sticky;
  top: 0;
  z-index: 5000;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  color: #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,.18);
  font-size: .9rem;
  animation: pwaBannerSlide .18s cubic-bezier(.32,.72,0,1);
}
.pwa-banner-icon {
  font-size: 1.6rem;
  flex-shrink: 0;
}
.pwa-banner-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  line-height: 1.25;
}
.pwa-banner-text strong { font-weight: 700; font-size: .95rem; }
.pwa-banner-text span { font-size: .78rem; opacity: .92; }
.pwa-banner-btn {
  background: #fff;
  color: #1d4ed8;
  border: 0;
  padding: 7px 14px;
  border-radius: 8px;
  font-weight: 700;
  font-size: .85rem;
  cursor: pointer;
  flex-shrink: 0;
}
.pwa-banner-btn:hover { background: #eff6ff; }
.pwa-banner-close {
  background: rgba(255,255,255,.18);
  color: #fff;
  border: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  font-size: .9rem;
  cursor: pointer;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.pwa-banner-close:hover { background: rgba(255,255,255,.28); }
@keyframes pwaBannerSlide {
  from { transform: translateY(-100%); opacity: 0; }
  to   { transform: translateY(0);     opacity: 1; }
}

/* Logo del topbar clickeable solo para admin → tienda en línea */
.topbar-logo-clickable {
  cursor: pointer;
  transition: transform .15s, filter .15s;
}
.topbar-logo-clickable:hover {
  transform: scale(1.05);
  filter: brightness(1.1);
}

.orders-type-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.orders-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 11px;
  border-radius: 99px;
  border: 1.5px solid var(--border, #e2e8f0);
  background: var(--surface);
  color: var(--text-secondary);
  font-size: .78rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
  font-family: inherit;
}

.orders-chip:hover {
  border-color: var(--primary, #2563eb);
  color: var(--primary, #2563eb);
  background: var(--primary-subtle, #eff6ff);
}

.orders-chip--active {
  background: var(--primary, #2563eb);
  border-color: var(--primary, #2563eb);
  color: #fff;
}

.orders-chip--active:hover {
  background: var(--primary-hover, #1d4ed8);
  border-color: var(--primary-hover, #1d4ed8);
  color: #fff;
}

.orders-chip-count {
  background: rgba(0,0,0,.12);
  border-radius: 99px;
  padding: 0 6px;
  font-size: .72rem;
  font-weight: 700;
  min-width: 18px;
  text-align: center;
}

.orders-chip--active .orders-chip-count {
  background: rgba(255,255,255,.25);
}

/* ── Botón Chat Cliente en pedido domicilio WhatsApp ── */
.btn-chat-cliente-order {
  background: #25d366;
  color: #fff;
  border-color: #25d366;
  font-size: .72rem;
}
.btn-chat-cliente-order:hover {
  background: #1ebe59;
  border-color: #1ebe59;
  color: #fff;
}

/* ═══ Tabs Proveedores ═════════════════════════════════════════════ */
.provTab { background: #f1f5f9; border-color: #e2e8f0; }
.provTab.active { background: #2563eb; color: #fff; border-color: #2563eb; }
.prov-tab-pane { padding-top: 6px; }

/* ═══ Etiquetas de chat ════════════════════════════════════════════ */
.ia-chat-label-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  color: #fff;
  font-size: .7rem;
  font-weight: 700;
  margin-left: 6px;
  vertical-align: middle;
  white-space: nowrap;
}
.ia-manual-label-filters {
  display: flex;
  gap: 4px;
  padding: 4px 6px;
  flex-wrap: nowrap;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  border-bottom: 1px solid #e2e8f0;
  background: #f8fafc;
}
.ia-manual-label-filters::-webkit-scrollbar { display: none; }
.ia-label-chip {
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 1.5px solid #cbd5e1;
  background: #fff;
  font-size: .85rem;
  cursor: pointer;
  font-weight: 700;
  color: #334155;
  line-height: 1;
  transition: transform .12s ease;
}
.ia-label-chip:hover { transform: scale(1.08); }
.ia-label-chip.active {
  box-shadow: 0 0 0 2px #fff, 0 0 0 4px currentColor;
}

/* ── Hora programada cercana: parpadeo tenue rojo ─────────────────────── */
.order-hora-programada.hora-programada-soon {
  background: #fee2e2 !important;
  border-color: #fca5a5 !important;
  animation: horaProgramadaSoon 1.6s ease-in-out infinite;
}
@keyframes horaProgramadaSoon {
  0%, 100% { background: #fee2e2; box-shadow: 0 0 0 0 rgba(220,38,38,0); }
  50%       { background: #fecaca; box-shadow: 0 0 0 3px rgba(220,38,38,.18); }
}
/* ── Pines tipo Rappi en mapas Leaflet ────────────────────────────────── */
.rappi-pin { background: transparent !important; border: 0 !important; }
/* Tiles: mayor saturación/contraste para que el mapa no se vea desvanecido */
.leaflet-preview .leaflet-tile-pane { filter: none; }
.leaflet-preview { background: #e8eef5 !important; }
@keyframes rappiPulse {
  0%   { transform: scale(.6); opacity: .6; }
  70%  { transform: scale(1.6); opacity: 0; }
  100% { transform: scale(1.6); opacity: 0; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   OPTIMIZACIONES TOUCH — Móvil, Tablet y PC táctil
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Global: touch-action para eliminar delay de 300ms ─────────────────── */
a, button, .btn, .tab, input, select, textarea, label,
.order-qty-btn, .order-note-btn, .order-delete-btn, .order-dup-btn,
.catalog-qty-btn, .catalog-chip, .qs-option-btn, .mov-type-btn,
.mov-method-pill, .att-subtab, .envios-tab, .kitchen-collapse-btn,
.vr-send-btn, .send-order-btn, .qs-item-price-btn {
  touch-action: manipulation;
}

/* ── GPU acceleration en contenedores scrollables ──────────────────────── */
.cards, .catalog-products, .order-items-track, .cash-movements-track,
.att-table-wrap, .rend-lb-ranking-wrap, .rend-ranking-list,
.envios-list, .chat-messages, #pendingKitchenOrders {
  -webkit-overflow-scrolling: touch;
  transform: translateZ(0);
}

/* ── Containment: reducir scope de repaints ────────────────────────────── */
.order-card, .kitchen-item, .kitchen-area-card, .catalog-product-card,
.rend-card, .dash-kpi-card, .dash-chart-card, .envio-card {
  contain: layout style;
}

/* ── Dispositivos touch: deshabilitar hover transforms ─────────────────── */
@media (hover: none) and (pointer: coarse) {
  .btn:hover {
    transform: none;
    box-shadow: none;
  }
  .btn.primary:hover {
    box-shadow: 0 2px 6px rgba(37, 99, 235, 0.22);
  }
  .tab:hover { background: transparent; color: var(--text-secondary); }
  .tab.active:hover { background: var(--primary); color: #fff; }
  .vr-send-btn:hover,
  .send-order-btn:hover:not(:disabled) {
    transform: none;
  }
  .catalog-qty-btn:hover,
  .catalog-qty-btn.minus:hover,
  .catalog-chip:hover,
  .qs-item-price-btn:hover,
  .mov-type-btn:hover,
  .att-face-tile:hover,
  .voice-record-btn:not(:disabled):hover,
  .ia-label-chip:hover {
    transform: none;
  }
  /* Active feedback más rápido y sutil */
  .btn:active {
    transform: scale(0.97);
    transition: transform 0.05s;
  }
  .order-qty-btn:active,
  .catalog-qty-btn:active {
    transform: scale(0.92) !important;
    transition: transform 0.05s !important;
  }
  .send-order-btn:active:not(:disabled),
  .vr-send-btn:active {
    transform: scale(0.98);
    transition: transform 0.05s;
  }
  /* Scroll suave instantáneo en touch */
  html { scroll-behavior: auto; }
  /* Reducir animaciones infinite en background */
  .kitchen-item.pending:not(.urgent) {
    animation-duration: 3s;
  }
}

/* ═══ TIENDA CONFIG MODAL ═══════════════════════════════════════════════════ */
/* ═══════════════════════════════════════════════════════════════════════════
   TIENDA CONFIG MODAL — Rediseño moderno con tabs + live preview
   ═══════════════════════════════════════════════════════════════════════════ */

.tc-modal-card {
  max-width: 1320px;
  width: 98%;
  max-height: 96vh;
  overflow: hidden;
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 0 !important;
  background: #f1f5f9;
  border-radius: 18px !important;
}

/* Header con gradiente */
.tc-header {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 22px;
  background: linear-gradient(135deg, #F59E0B 0%, #EA580C 50%, #DC2626 100%);
  color: #fff;
  flex-shrink: 0;
}
.tc-header-title {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: 1;
  min-width: 0;
}
.tc-header-ico {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  min-width: 46px;
  border-radius: 12px;
  background: rgba(255,255,255,.22);
  backdrop-filter: blur(10px);
  font-size: 1.5rem;
  flex-shrink: 0;
}
.tc-header-title h3 {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.01em;
}
.tc-header-title p {
  margin: 2px 0 0;
  font-size: 0.82rem;
  color: rgba(255,255,255,.9);
  font-weight: 500;
}
.tc-header-title code {
  background: rgba(0,0,0,.22);
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 0.78rem;
}
.tc-header-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(255,255,255,.18);
  backdrop-filter: blur(10px);
  font-weight: 700;
  font-size: 0.82rem;
  color: #fff;
}
.tc-live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 0 4px rgba(34,197,94,.35);
  animation: tcPulse 2s infinite;
}
.tc-live-dot.closed {
  background: #ef4444;
  box-shadow: 0 0 0 4px rgba(239,68,68,.35);
}
@keyframes tcPulse {
  0%,100% { box-shadow: 0 0 0 4px rgba(34,197,94,.35); }
  50%     { box-shadow: 0 0 0 8px rgba(34,197,94,.15); }
}
.tc-close {
  position: static !important;
  background: rgba(255,255,255,.18) !important;
  color: #fff !important;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  font-size: 1.1rem;
  border: none;
  cursor: pointer;
  transition: background .15s;
  flex-shrink: 0;
}
.tc-close:hover { background: rgba(255,255,255,.32) !important; }

/* Tabs */
.tc-tabs {
  display: flex;
  gap: 4px;
  padding: 10px 14px 0;
  background: #fff;
  border-bottom: 1px solid #e2e8f0;
  overflow-x: auto;
  scrollbar-width: none;
  flex-shrink: 0;
}
.tc-tabs::-webkit-scrollbar { display: none; }
.tc-tab {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 14px;
  background: transparent;
  border: none;
  border-radius: 8px 8px 0 0;
  font-size: 0.86rem;
  font-weight: 600;
  color: #64748b;
  cursor: pointer;
  white-space: nowrap;
  transition: color .15s, background .15s;
  border-bottom: 2.5px solid transparent;
  margin-bottom: -1px;
}
.tc-tab:hover { color: #0f172a; background: #f8fafc; }
.tc-tab.active {
  color: #F59E0B;
  border-bottom-color: #F59E0B;
  background: #fff;
}
.tc-tab-ico { font-size: 1rem; }
.tc-tab-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 6px;
  border-radius: 999px;
  background: #F59E0B;
  color: #fff;
  font-size: 0.7rem;
  font-weight: 800;
}
.tc-tab:not(.active) .tc-tab-badge { background: #cbd5e1; color: #475569; }

/* Layout principal */
.tc-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.9fr);
  gap: 0;
  overflow: hidden;
  flex: 1;
  min-height: 0;
  background: #f1f5f9;
}
.tc-form {
  overflow-y: auto;
  padding: 20px 22px 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* Panels (tabs content) */
.tc-panel {
  display: none;
  flex-direction: column;
  gap: 14px;
  animation: tcFadeIn .18s ease;
}
.tc-panel.active { display: flex; }
@keyframes tcFadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Cards */
.tc-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: 0 1px 3px rgba(15,23,42,.04);
}
.tc-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.tc-card-head h4 {
  margin: 0;
  font-size: 0.98rem;
  font-weight: 800;
  color: #0f172a;
  letter-spacing: -0.01em;
}
.tc-card-meta {
  font-size: 0.75rem;
  font-weight: 600;
  color: #64748b;
  padding: 3px 9px;
  border-radius: 999px;
  background: #f1f5f9;
}
.tc-card-status {
  background: linear-gradient(135deg, #fff 0%, #fef3c7 100%);
  border-color: #fde68a;
}

/* Fields */
.tc-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.tc-field-lbl {
  font-size: 0.8rem;
  font-weight: 700;
  color: #334155;
}
.tc-field input,
.tc-field select {
  padding: 10px 12px;
  border: 1.5px solid #cbd5e1;
  border-radius: 9px;
  font-size: 0.92rem;
  background: #fff;
  color: #0f172a;
  transition: border-color .15s, box-shadow .15s;
}
.tc-field input:focus,
.tc-field select:focus {
  border-color: #F59E0B;
  outline: none;
  box-shadow: 0 0 0 3px rgba(245,158,11,.18);
}
.tc-field-inline {
  flex-direction: row;
  align-items: center;
  gap: 8px;
}
.tc-field-inline input { max-width: 120px; font-size: 1.1rem; font-weight: 700; text-align: center; }
.tc-suffix {
  font-size: 1.05rem;
  font-weight: 800;
  color: #F59E0B;
}

.tc-row-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.tc-gap-md { gap: 12px; }

/* iOS-style switch */
.tc-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 26px;
  flex-shrink: 0;
  cursor: pointer;
}
.tc-switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.tc-switch-track {
  position: absolute;
  inset: 0;
  background: #cbd5e1;
  border-radius: 999px;
  transition: background .2s;
}
.tc-switch-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 22px;
  height: 22px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 2px 6px rgba(15,23,42,.22);
  transition: transform .2s;
}
.tc-switch input:checked + .tc-switch-track {
  background: linear-gradient(135deg, #22c55e, #16a34a);
}
.tc-switch input:checked + .tc-switch-track .tc-switch-thumb {
  transform: translateX(18px);
}

.tc-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #f8fafc;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.tc-toggle-row:hover { border-color: #cbd5e1; background: #f1f5f9; }
.tc-toggle-title {
  font-size: 0.92rem;
  font-weight: 700;
  color: #0f172a;
}
.tc-toggle-sub {
  font-size: 0.78rem;
  color: #64748b;
  margin-top: 2px;
}

.tc-hint {
  font-size: 0.8rem;
  color: #64748b;
  margin: 0;
  line-height: 1.45;
}
.tc-hint code {
  background: #f1f5f9;
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 0.78rem;
  color: #0f172a;
}

/* Hero preview (live) */
.tc-hero-preview {
  border-radius: 14px;
  padding: 18px;
  background: linear-gradient(135deg, #78350F 0%, #B45309 60%, #F59E0B 100%);
  color: #fff;
  text-align: center;
  box-shadow: 0 8px 24px -6px rgba(245,158,11,.4);
}
.tcp-greeting {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.1;
}
.tcp-subtitle {
  font-size: 0.88rem;
  opacity: .9;
  margin-top: 4px;
}
.tcp-stats {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-top: 12px;
  flex-wrap: wrap;
}
.tcp-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 78px;
  padding: 8px 10px;
  background: rgba(0,0,0,.28);
  border-radius: 10px;
  backdrop-filter: blur(8px);
}
.tcp-stat-val {
  font-size: 0.88rem;
  font-weight: 800;
  line-height: 1.15;
}
.tcp-stat-lbl {
  font-size: 0.64rem;
  opacity: .85;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.tcp-stat.amber .tcp-stat-val { color: #FCD34D; }
.tcp-stat.mint  .tcp-stat-val { color: #6EE7B7; }
.tcp-stat.coral .tcp-stat-val { color: #FCA5A5; }
.tcp-stat.sky   .tcp-stat-val { color: #93C5FD; }
.tcp-stat.dark  .tcp-stat-val { color: #E2E8F0; }

/* Promo preview (live) */
.tc-promo-preview {
  padding: 14px;
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  border-radius: 12px;
  overflow-x: auto;
  scrollbar-width: thin;
}
.tcp-promos {
  display: flex;
  gap: 8px;
  min-width: min-content;
}
.tcp-promo {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 700;
  white-space: nowrap;
  flex-shrink: 0;
}
.tcp-promo.disabled { opacity: .3; filter: grayscale(1); }
.tcp-promo.amber { background: #FEF3C7; color: #78350F; }
.tcp-promo.mint  { background: #D1FAE5; color: #065F46; }
.tcp-promo.coral { background: #FEE2E2; color: #991B1B; }
.tcp-promo.sky   { background: #DBEAFE; color: #1E3A8A; }
.tcp-promo.dark  { background: #334155; color: #F1F5F9; }

/* Rows (stats, promos, flows, categories) */
.tc-rows {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.tc-row {
  display: grid;
  align-items: center;
  background: #f8fafc;
  border: 1.5px solid #e2e8f0;
  border-radius: 10px;
  padding: 8px;
  gap: 6px;
  transition: border-color .15s, background .15s;
}
.tc-row:hover { border-color: #cbd5e1; background: #fff; }
.tc-row.tc-row-stat {
  grid-template-columns: 54px minmax(0, 1fr) minmax(0, 1.2fr) 100px;
}
.tc-row.tc-row-promo {
  grid-template-columns: 24px 40px 54px minmax(0, 1fr) 94px 32px;
}
.tc-row.tc-row-promo.disabled {
  opacity: .55;
  background: #f1f5f9;
}
.tc-row.tc-row-flow {
  grid-template-columns: 44px 50px minmax(0, 0.9fr) minmax(0, 1.2fr) 100px;
}
.tc-row.tc-row-cat {
  grid-template-columns: 24px 34px minmax(0, 1fr) 38px 38px;
}

/* Drag & drop */
.tc-drag-handle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 28px;
  color: #94a3b8;
  font-size: 1rem;
  cursor: grab;
  user-select: none;
  letter-spacing: -2px;
  line-height: 0.9;
  font-weight: 700;
  border-radius: 4px;
  transition: color .12s, background .12s;
}
.tc-drag-handle:hover { color: #F59E0B; background: #fef3c7; }
.tc-drag-handle:active { cursor: grabbing; }
.tc-row.tc-dragging {
  opacity: .5;
  background: #fef3c7 !important;
  border-color: #F59E0B !important;
  box-shadow: 0 8px 20px -6px rgba(245,158,11,.4);
}
.tc-row.tc-drop-before {
  box-shadow: 0 -3px 0 0 #F59E0B;
}
.tc-row.tc-drop-after {
  box-shadow: 0 3px 0 0 #F59E0B;
}
.tc-row.tc-row-cat .tc-cat-pos {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 28px;
  min-width: 28px;
  padding: 0 6px;
  border-radius: 999px;
  background: linear-gradient(135deg, #fde68a, #F59E0B);
  color: #78350F;
  font-weight: 800;
  font-size: 0.76rem;
}
.tc-row.tc-row-cat .tc-cat-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
  color: #0f172a;
  font-size: 0.9rem;
}

.tc-row input,
.tc-row select {
  padding: 7px 9px;
  border: 1.5px solid #cbd5e1;
  border-radius: 7px;
  font-size: 0.86rem;
  background: #fff;
  color: #0f172a;
  width: 100%;
}
.tc-row input:focus,
.tc-row select:focus {
  border-color: #F59E0B;
  outline: none;
  box-shadow: 0 0 0 2px rgba(245,158,11,.18);
}
.tc-in-icon {
  text-align: center;
  font-size: 1.05rem !important;
  padding: 6px !important;
}
.tc-in-tone {
  font-weight: 600;
  text-transform: capitalize;
}
.tc-mini-btn {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  background: #fff;
  border: 1.5px solid #e2e8f0;
  color: #475569;
  font-weight: 800;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  transition: background .12s, color .12s, border-color .12s;
}
.tc-mini-btn:hover:not(:disabled) {
  background: #F59E0B;
  color: #fff;
  border-color: #F59E0B;
}
.tc-mini-btn:disabled { opacity: .3; cursor: not-allowed; }
.tc-mini-btn.danger { color: #dc2626; }
.tc-mini-btn.danger:hover { background: #dc2626; color: #fff; border-color: #dc2626; }

.tc-row .tc-switch { width: 36px; height: 22px; }
.tc-row .tc-switch-thumb { width: 18px; height: 18px; }
.tc-row .tc-switch input:checked + .tc-switch-track .tc-switch-thumb { transform: translateX(14px); }

/* Flow toggle label */
.tc-flow-lbl {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  font-size: 0.82rem;
  color: #0f172a;
  text-transform: capitalize;
}

/* Add button */
.tc-btn-add {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 14px;
  background: #fff;
  border: 2px dashed #cbd5e1;
  border-radius: 10px;
  color: #475569;
  font-weight: 700;
  font-size: 0.88rem;
  cursor: pointer;
  transition: border-color .15s, color .15s, background .15s;
  align-self: flex-start;
}
.tc-btn-add:hover {
  border-color: #F59E0B;
  color: #F59E0B;
  background: #fef3c7;
}
.tc-btn-add span {
  font-size: 1.2rem;
  line-height: 1;
  font-weight: 800;
}

/* Preview iframe */
.tc-preview {
  display: flex;
  flex-direction: column;
  background: #0f172a;
  overflow: hidden;
  min-height: 0;
  border-left: 1px solid #e2e8f0;
}
.tc-preview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: #1e293b;
  color: #fff;
  font-weight: 700;
  font-size: 0.88rem;
  flex-shrink: 0;
}
.tc-preview-head .btn {
  background: #F59E0B;
  color: #0f172a;
  border: none;
  font-weight: 700;
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 0.78rem;
}
.tc-preview iframe {
  flex: 1;
  width: 100%;
  border: none;
  background: #fff;
  min-height: 400px;
}
.tc-preview-mobile-open {
  display: none;
  gap: 6px;
  align-items: center;
  justify-content: center;
  padding: 10px;
  font-size: 0.85rem;
  background: #f1f5f9;
  border: 1px dashed #cbd5e1;
  border-radius: 10px;
  color: #475569;
  font-weight: 600;
}

/* Footer acciones */
.tc-footer {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  padding: 12px 22px;
  background: #fff;
  border-top: 1px solid #e2e8f0;
  flex-shrink: 0;
  box-shadow: 0 -4px 12px rgba(15,23,42,.04);
}
.tc-btn-ghost,
.tc-btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  border: none;
  transition: transform .1s, box-shadow .15s, background .15s;
}
.tc-btn-ghost {
  background: #f1f5f9;
  color: #475569;
  border: 1.5px solid #e2e8f0;
}
.tc-btn-ghost:hover { background: #e2e8f0; color: #0f172a; }
.tc-btn-primary {
  background: linear-gradient(135deg, #F59E0B, #EA580C);
  color: #fff;
  box-shadow: 0 4px 12px rgba(245,158,11,.35);
}
.tc-btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(245,158,11,.48); }
.tc-btn-primary:active { transform: translateY(0); }

/* Responsive */
@media (max-width: 1100px) {
  .tc-layout { grid-template-columns: 1fr; }
  .tc-preview { display: none; }
  .tc-preview-mobile-open { display: inline-flex; }
}

@media (max-width: 720px) {
  .tc-modal-card {
    max-height: 100vh;
    height: 100vh;
    width: 100%;
    max-width: 100%;
    border-radius: 0 !important;
  }
  .tc-header {
    padding: 14px 16px;
    flex-wrap: wrap;
  }
  .tc-header-title h3 { font-size: 1.05rem; }
  .tc-header-title p { font-size: 0.76rem; }
  .tc-header-ico { width: 40px; height: 40px; min-width: 40px; font-size: 1.3rem; }
  .tc-header-status { font-size: 0.72rem; padding: 4px 9px; }
  .tc-tabs { padding: 8px 10px 0; }
  .tc-tab { padding: 9px 11px; font-size: 0.8rem; }
  .tc-tab-ico { font-size: 0.95rem; }
  .tc-form { padding: 14px 14px 20px; gap: 12px; }
  .tc-card { padding: 14px; gap: 9px; }
  .tc-card-head h4 { font-size: 0.92rem; }
  .tc-row-2 { grid-template-columns: 1fr; gap: 10px; }
  .tc-footer { padding: 10px 14px calc(10px + env(safe-area-inset-bottom, 0px)); gap: 8px; }
  .tc-btn-ghost, .tc-btn-primary { flex: 1 1 0; justify-content: center; }

  .tc-row.tc-row-stat,
  .tc-row.tc-row-promo,
  .tc-row.tc-row-flow {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 10px;
  }
  .tc-row > input,
  .tc-row > select { flex: 1 1 100%; min-width: 0; }
  .tc-row > .tc-in-icon { flex: 0 0 54px; max-width: 54px; }
  .tc-row > .tc-in-tone { flex: 0 0 100px; max-width: 100px; }
  .tc-row > .tc-mini-btn {
    flex: 0 0 32px;
    max-width: 32px;
    height: 32px;
  }
  .tc-row > .tc-switch { flex: 0 0 auto; }
  .tc-row.tc-row-cat {
    display: grid;
    grid-template-columns: 30px minmax(0,1fr) 34px 34px;
  }
}


/* ═══════════════════════════════════════════════════════════════════════════
   PROMOCIONES — Gestor de descuentos y ofertas
   ═══════════════════════════════════════════════════════════════════════════ */
.promos-modal-card {
  max-width: 1100px;
  width: 96%;
  max-height: 95vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: 0 !important;
  background: #f1f5f9;
  border-radius: 18px !important;
}
.promos-body {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 18px 22px;
}
.promos-form,
.promos-list-view,
.promos-form-view {
  width: 100%;
  max-width: 100%;
  min-width: 0;
}
.promos-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.promos-form .tc-card { width: 100%; min-width: 0; }
.promos-form .tc-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  min-width: 0;
}
.promos-form .tc-row-2 > * { min-width: 0; }
.promos-form input[type="text"],
.promos-form input[type="number"],
.promos-form input[type="date"],
.promos-form input[type="time"],
.promos-form input:not([type]),
.promos-form select {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

/* Toolbar con stats */
.promos-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 0 18px;
  flex-wrap: wrap;
}
.promos-toolbar-stats {
  display: flex;
  gap: 10px;
}
.promos-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 80px;
  padding: 10px 14px;
  border-radius: 12px;
  background: #fff;
  border: 1px solid #e2e8f0;
}
.promos-stat b {
  font-size: 1.35rem;
  color: #0f172a;
  line-height: 1;
  font-weight: 800;
}
.promos-stat span {
  font-size: 0.74rem;
  color: #64748b;
  margin-top: 3px;
  text-transform: uppercase;
  letter-spacing: .04em;
  font-weight: 600;
}
.promos-stat.active {
  background: linear-gradient(135deg, #fef3c7, #fde68a);
  border-color: #fcd34d;
}
.promos-stat.active b { color: #78350f; }

/* Lista de promos */
.promos-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.promos-list-empty {
  text-align: center;
  padding: 40px 20px;
  color: #64748b;
  background: #fff;
  border: 2px dashed #cbd5e1;
  border-radius: 14px;
}
.promos-list-empty .ico {
  font-size: 3rem;
  opacity: .5;
  display: block;
  margin-bottom: 10px;
}
.promo-card {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  gap: 14px;
  align-items: center;
  padding: 14px 16px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  transition: border-color .15s, box-shadow .15s;
  cursor: pointer;
}
.promo-card:hover {
  border-color: #F59E0B;
  box-shadow: 0 4px 14px rgba(245,158,11,.12);
}
.promo-card.inactive { opacity: .6; }
.promo-card-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 58px;
  padding: 8px 12px;
  border-radius: 10px;
  font-weight: 800;
  font-size: 1rem;
}
.promo-card-badge.amber { background: #FEF3C7; color: #78350F; }
.promo-card-badge.mint  { background: #D1FAE5; color: #065F46; }
.promo-card-badge.coral { background: #FEE2E2; color: #991B1B; }
.promo-card-badge.sky   { background: #DBEAFE; color: #1E3A8A; }
.promo-card-badge.dark  { background: #334155; color: #F1F5F9; }
.promo-card-body { min-width: 0; }
.promo-card-title {
  font-size: 0.98rem;
  font-weight: 700;
  color: #0f172a;
  margin: 0 0 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.promo-card-meta {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 0.78rem;
  color: #64748b;
}
.promo-card-meta span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.promo-card-meta .chip {
  padding: 2px 8px;
  background: #f1f5f9;
  border-radius: 999px;
  font-weight: 600;
  color: #475569;
}
.promo-card-actions {
  display: flex;
  gap: 6px;
  align-items: center;
}
.promo-card .tc-switch { width: 38px; height: 22px; }
.promo-card .tc-switch-thumb { width: 18px; height: 18px; }
.promo-card .tc-switch input:checked + .tc-switch-track .tc-switch-thumb { transform: translateX(16px); }

/* Form */
.promos-form-view { animation: tcFadeIn .18s ease; }
.promos-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Scope radios */
.promos-scope-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 12px;
}
.promos-scope-option {
  display: flex !important;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  padding: 14px;
  background: #f8fafc;
  border: 1.5px solid #e2e8f0;
  border-radius: 12px;
  cursor: pointer;
  transition: border-color .15s, background .15s, box-shadow .15s;
  position: relative;
  min-width: 0;
}
.promos-scope-option input[type="radio"] {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 18px !important;
  height: 18px;
  margin: 0;
  padding: 0;
  accent-color: #F59E0B;
  cursor: pointer;
  flex: 0 0 auto;
}
.promos-scope-option > span {
  display: block;
  width: 100%;
  padding-right: 26px;
  font-size: 0.9rem;
  color: #334155;
  line-height: 1.35;
}
.promos-scope-option > span b {
  display: block;
  font-weight: 700;
  color: #1e293b;
}
.promos-scope-option > span small {
  display: block;
  color: #94a3b8;
  font-size: 0.74rem;
  margin-top: 3px;
  font-weight: 400;
}
.promos-scope-option:hover {
  border-color: #fbbf24;
}
.promos-scope-option:has(input:checked) {
  border-color: #F59E0B;
  background: #fef3c7;
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.15);
}

.pm-scope-panel {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.pm-scope-panel input[type="text"],
.pm-scope-panel input:not([type]) {
  padding: 9px 12px;
  border: 1.5px solid #cbd5e1;
  border-radius: 8px;
  font-size: 0.88rem;
  background: #fff;
}

.pm-select-list {
  max-height: 260px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 6px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
}
.pm-select-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 7px;
  cursor: pointer;
  transition: background .12s;
  font-size: 0.88rem;
  color: #334155;
}
.pm-select-item:hover { background: #fff; }
.pm-select-item input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: #F59E0B;
  cursor: pointer;
}
.pm-select-item.selected { background: #fef3c7; color: #78350f; font-weight: 600; }
.pm-select-item .pm-item-meta {
  margin-left: auto;
  font-size: 0.76rem;
  color: #94a3b8;
}

/* Días de la semana */
.pm-days {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
}
.pm-days label {
  flex: 1 1 0;
  min-width: 44px;
}
.pm-days label input { display: none; }
.pm-days label span {
  display: block;
  text-align: center;
  padding: 8px 4px;
  background: #f8fafc;
  border: 1.5px solid #e2e8f0;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 600;
  color: #64748b;
  cursor: pointer;
  transition: all .12s;
}
.pm-days label input:checked + span {
  background: linear-gradient(135deg, #F59E0B, #EA580C);
  color: #fff;
  border-color: #F59E0B;
}

/* Badge preview */
.promo-badge-preview {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
  background:
    linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
  border: 1.5px dashed #fbbf24;
  border-radius: 12px;
  margin-top: 10px;
}
.pm-preview-badge {
  display: inline-flex;
  align-items: center;
  padding: 8px 16px;
  border-radius: 999px;
  font-weight: 800;
  font-size: 0.95rem;
  box-shadow: 0 4px 10px rgba(0,0,0,.1);
  letter-spacing: .02em;
}
.pm-preview-badge.amber { background: #FEF3C7; color: #78350F; }
.pm-preview-badge.mint  { background: #D1FAE5; color: #065F46; }
.pm-preview-badge.coral { background: #FEE2E2; color: #991B1B; }
.pm-preview-badge.sky   { background: #DBEAFE; color: #1E3A8A; }
.pm-preview-badge.dark  { background: #334155; color: #F1F5F9; }

@media (max-width: 720px) {
  .promos-modal-card {
    max-height: 100vh;
    height: 100vh;
    width: 100%;
    max-width: 100%;
    border-radius: 0 !important;
  }
  .promos-body { padding: 14px; }
  .promo-card { grid-template-columns: auto 1fr; }
  .promo-card-actions {
    grid-column: 1 / -1;
    justify-content: space-between;
    padding-top: 8px;
    border-top: 1px dashed #e2e8f0;
    margin-top: 4px;
  }
  .promos-scope-tabs { grid-template-columns: 1fr; }
  .pm-days label { min-width: 38px; }
  .pm-days label span { font-size: 0.72rem; padding: 6px 2px; }
}

/* ─── Badge de promoción en card del producto (público) ─── */
.prod-promo-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: .02em;
  box-shadow: 0 3px 8px rgba(0,0,0,.2);
  pointer-events: none;
}
.prod-promo-badge.amber { background: linear-gradient(135deg, #FCD34D, #F59E0B); color: #78350F; }
.prod-promo-badge.mint  { background: linear-gradient(135deg, #6EE7B7, #10B981); color: #064E3B; }
.prod-promo-badge.coral { background: linear-gradient(135deg, #FCA5A5, #EF4444); color: #fff; }
.prod-promo-badge.sky   { background: linear-gradient(135deg, #93C5FD, #3B82F6); color: #fff; }
.prod-promo-badge.dark  { background: linear-gradient(135deg, #475569, #1E293B); color: #fff; }
.prod-price-struck {
  text-decoration: line-through;
  color: #94a3b8;
  font-size: 0.85rem;
  margin-right: 6px;
  font-weight: 500;
}
.prod-price-promo {
  color: #DC2626;
  font-weight: 800;
}

/* ─── Menú Digital / Comunidad (panel admin) ─── */
.mc-community .mc-feat {
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  background: #fafafa;
  padding: 10px 12px;
  margin-bottom: 10px;
  transition: border-color .15s, background .15s;
}
.mc-community .mc-feat:has(.mc-feat-head input:checked) {
  border-color: #93c5fd;
  background: #eff6ff;
}
.mc-community .mc-feat-head {
  font-size: .9rem;
  margin-bottom: 6px;
}
.mc-community .mc-feat-sub {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding-left: 26px;
  font-size: .82rem;
  align-items: flex-end;
}
.mc-community .mc-feat-sub label {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: .76rem;
  color: #475569;
}
.mc-community .mc-feat-sub input[type="number"] {
  width: 80px;
  padding: 5px 8px;
  border-radius: 6px;
  border: 1px solid #cbd5e1;
  font-size: .85rem;
}
.mc-community .mc-feat-sub .tc-hint { margin: 0; }

/* ═════════════════════════════════════════════════════════════════════════
   MENU CONFIG — APPLE SKIN (scoped a .mc-apple para no pisar Tienda Config)
   ═════════════════════════════════════════════════════════════════════════ */
.mc-apple {
  --ma-bg:       #F5F5F7;
  --ma-surface:  #FFFFFF;
  --ma-text:     #1D1D1F;
  --ma-text-soft:#6E6E73;
  --ma-blue:     #0A84FF;
  --ma-blue-soft:rgba(10,132,255,0.12);
  --ma-green:    #34C759;
  --ma-border:   rgba(60,60,67,0.14);
  --ma-control:  rgba(120,120,128,0.12);
  --ma-radius:   16px;
  --ma-radius-sm:10px;
  --ma-shadow:   0 1px 2px rgba(0,0,0,0.04), 0 4px 16px rgba(0,0,0,0.05);

  background: var(--ma-bg) !important;
  border-radius: 20px !important;
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Inter', 'Segoe UI', Roboto, sans-serif !important;
  color: var(--ma-text);
}
.mc-apple > h3 {
  margin: 0 !important;
  padding: 20px 24px 8px !important;
  font-size: 1.05rem !important;
  font-weight: 700;
  letter-spacing: -0.015em;
  color: var(--ma-text);
  background: rgba(255,255,255,0.72);
  backdrop-filter: saturate(180%) blur(18px);
  -webkit-backdrop-filter: saturate(180%) blur(18px);
  border-bottom: 1px solid var(--ma-border);
  border-radius: 20px 20px 0 0;
  position: sticky;
  top: 0;
  z-index: 2;
}
.mc-apple > .auth-detail {
  margin: 0 !important;
  padding: 4px 24px 14px !important;
  font-size: 0.82rem;
  color: var(--ma-text-soft);
  background: rgba(255,255,255,0.72);
  backdrop-filter: saturate(180%) blur(18px);
  -webkit-backdrop-filter: saturate(180%) blur(18px);
  border-bottom: 1px solid var(--ma-border);
}
.mc-apple > .auth-detail code {
  background: var(--ma-control);
  padding: 1px 6px;
  border-radius: 6px;
  font-size: 0.78rem;
  color: var(--ma-text);
}
.mc-apple .btn-close-modal {
  position: absolute !important;
  top: 16px !important;
  right: 16px !important;
  width: 30px !important;
  height: 30px !important;
  background: var(--ma-control) !important;
  color: var(--ma-text-soft) !important;
  border: 0 !important;
  border-radius: 50% !important;
  font-size: 0.95rem !important;
  font-weight: 600 !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background .15s, color .15s;
  z-index: 3;
}
.mc-apple .btn-close-modal:hover {
  background: rgba(120,120,128,0.22) !important;
  color: var(--ma-text) !important;
}

/* Layout */
.mc-apple .tc-layout {
  background: var(--ma-bg) !important;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
}
.mc-apple .tc-form {
  padding: 18px 22px 28px !important;
  gap: 14px !important;
}

/* Sections as Apple cards */
.mc-apple .tc-section {
  background: var(--ma-surface);
  border: 1px solid var(--ma-border);
  border-radius: var(--ma-radius);
  padding: 16px 18px;
  box-shadow: var(--ma-shadow);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.mc-apple .tc-section h4 {
  margin: 0 !important;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--ma-text);
}

/* Labels + inputs — estilo iOS */
.mc-apple .tc-form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--ma-text-soft);
  letter-spacing: 0;
}
.mc-apple .tc-form input[type="text"],
.mc-apple .tc-form input[type="search"],
.mc-apple .tc-form input[type="number"],
.mc-apple .tc-form input:not([type]),
.mc-apple .tc-form textarea,
.mc-apple .tc-form select {
  width: 100%;
  padding: 10px 12px;
  background: var(--ma-control);
  border: 0;
  border-radius: var(--ma-radius-sm);
  font-size: 0.92rem;
  color: var(--ma-text);
  font-family: inherit;
  transition: background .15s, box-shadow .15s;
}
.mc-apple .tc-form input:focus,
.mc-apple .tc-form textarea:focus,
.mc-apple .tc-form select:focus {
  outline: none;
  background: var(--ma-surface);
  box-shadow: 0 0 0 3px var(--ma-blue-soft), inset 0 0 0 1.5px var(--ma-blue);
}
.mc-apple .tc-form input[type="color"] {
  width: 44px !important;
  height: 44px !important;
  padding: 0 !important;
  border: 2px solid var(--ma-border) !important;
  border-radius: 12px !important;
  background: transparent !important;
  cursor: pointer;
  box-shadow: var(--ma-shadow);
}
.mc-apple .tc-form input[type="color"]::-webkit-color-swatch { border: none; border-radius: 10px; }
.mc-apple .tc-form input[type="color"]::-moz-color-swatch { border: none; border-radius: 10px; }

/* iOS-style toggle — reemplaza checkbox nativo */
.mc-apple .tc-toggle {
  flex-direction: row !important;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: var(--ma-surface);
  border: 1px solid var(--ma-border);
  border-radius: var(--ma-radius-sm);
  cursor: pointer;
  font-size: 0.9rem !important;
  font-weight: 500 !important;
  color: var(--ma-text) !important;
  letter-spacing: -0.005em;
  transition: background .15s;
}
.mc-apple .tc-toggle:hover { background: #FAFAFA; }
.mc-apple .tc-toggle span {
  flex: 1;
  font-size: 0.9rem;
  color: var(--ma-text);
}
.mc-apple .tc-toggle span b { font-weight: 700; }
.mc-apple .tc-toggle input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  position: relative;
  width: 48px !important;
  height: 28px !important;
  padding: 0 !important;
  margin: 0 !important;
  background: #E5E5EA !important;
  border: 0 !important;
  border-radius: 999px !important;
  cursor: pointer;
  transition: background .2s;
  flex-shrink: 0;
  box-shadow: none !important;
  order: 2;
}
.mc-apple .tc-toggle input[type="checkbox"]::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 24px;
  height: 24px;
  background: #FFFFFF;
  border-radius: 50%;
  box-shadow: 0 2px 6px rgba(0,0,0,0.18), 0 1px 2px rgba(0,0,0,0.12);
  transition: transform .2s;
}
.mc-apple .tc-toggle input[type="checkbox"]:checked {
  background: var(--ma-green) !important;
}
.mc-apple .tc-toggle input[type="checkbox"]:checked::after {
  transform: translateX(20px);
}
.mc-apple .tc-toggle input[type="checkbox"]:focus-visible {
  box-shadow: 0 0 0 3px var(--ma-blue-soft) !important;
}
.mc-apple .tc-toggle-inline {
  background: transparent !important;
  border: 0 !important;
  padding: 4px 0 !important;
}

/* Tira de compartir — grid de botones sociales */
.mc-apple .tc-row-2 {
  gap: 8px;
}

/* Hints */
.mc-apple .tc-hint {
  font-size: 0.78rem;
  color: var(--ma-text-soft);
  line-height: 1.45;
  margin: 0;
}
.mc-apple .tc-hint code {
  background: var(--ma-control);
  color: var(--ma-text);
  padding: 1px 6px;
  border-radius: 6px;
  font-size: 0.76rem;
}

/* Rows de categorías */
.mc-apple .tc-rows { gap: 6px; }
.mc-apple .tc-row {
  background: var(--ma-surface);
  border: 1px solid var(--ma-border);
  border-radius: 12px;
  padding: 8px 10px;
  transition: background .15s, transform .15s;
}
.mc-apple .tc-row:hover {
  background: #FAFAFA;
  border-color: rgba(60,60,67,0.22);
}
.mc-apple .tc-row.tc-row-cat .tc-cat-pos {
  background: var(--ma-blue);
  color: #fff;
  font-weight: 700;
  box-shadow: 0 2px 6px rgba(10,132,255,0.3);
}
.mc-apple .tc-row.tc-row-cat .tc-cat-name {
  color: var(--ma-text);
  font-weight: 600;
}
.mc-apple .tc-row input,
.mc-apple .tc-row select {
  background: var(--ma-control);
  border: 0;
  border-radius: 8px;
  padding: 6px 10px;
  color: var(--ma-text);
  font-size: 0.86rem;
}
.mc-apple .tc-row input:focus,
.mc-apple .tc-row select:focus {
  box-shadow: 0 0 0 2px var(--ma-blue-soft), inset 0 0 0 1.5px var(--ma-blue);
  background: var(--ma-surface);
}
.mc-apple .tc-mini-btn {
  background: var(--ma-control) !important;
  border: 0 !important;
  color: var(--ma-text) !important;
  border-radius: 8px !important;
  transition: background .15s;
}
.mc-apple .tc-mini-btn:hover { background: rgba(120,120,128,0.22) !important; }
.mc-apple .tc-drag-handle { color: var(--ma-text-soft); }
.mc-apple .tc-drag-handle:hover { background: var(--ma-blue-soft); color: var(--ma-blue); }
.mc-apple .tc-row.tc-dragging {
  opacity: .55;
  background: var(--ma-blue-soft) !important;
  border-color: rgba(10,132,255,0.35) !important;
  box-shadow: 0 10px 22px -8px rgba(10,132,255,0.4) !important;
}
.mc-apple .tc-row.tc-drop-before { box-shadow: 0 -3px 0 0 var(--ma-blue) !important; }
.mc-apple .tc-row.tc-drop-after  { box-shadow: 0 3px 0 0 var(--ma-blue) !important; }

/* Comunidad: feature cards */
.mc-apple .mc-community .mc-feat {
  background: var(--ma-surface);
  border: 1px solid var(--ma-border);
  border-radius: 14px;
  padding: 12px 14px;
  margin-bottom: 10px;
  transition: border-color .18s, box-shadow .18s;
}
.mc-apple .mc-community .mc-feat:has(.mc-feat-head input:checked) {
  border-color: rgba(10,132,255,0.32);
  box-shadow: 0 0 0 3px var(--ma-blue-soft);
}
.mc-apple .mc-community .mc-feat-head {
  background: transparent !important;
  border: 0 !important;
  padding: 0 !important;
}
.mc-apple .mc-community .mc-feat-sub {
  padding-top: 10px;
  border-top: 1px solid var(--ma-border);
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.mc-apple .mc-community .mc-feat-sub label {
  flex-direction: row;
  align-items: center;
  gap: 10px;
  padding: 0;
  background: transparent;
  border: 0;
  font-size: 0.82rem;
  color: var(--ma-text-soft);
  font-weight: 500;
}
.mc-apple .mc-community .mc-feat-sub input[type="number"] {
  width: 90px !important;
  padding: 6px 10px !important;
  background: var(--ma-control) !important;
  border: 0 !important;
  border-radius: 8px !important;
  font-size: 0.88rem !important;
}
.mc-apple .mc-community .mc-feat-sub .btn {
  align-self: flex-start;
  background: var(--ma-control);
  color: var(--ma-text);
  border: 0;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.82rem;
  padding: 7px 14px;
}
.mc-apple .mc-community .mc-feat-sub .btn:disabled { opacity: .45; }

/* Acciones */
.mc-apple .tc-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--ma-border);
}
.mc-apple .tc-actions .btn,
.mc-apple .tc-preview-mobile-open {
  border-radius: 999px;
  font-weight: 600;
  padding: 10px 20px;
  font-size: 0.9rem;
  background: var(--ma-control);
  color: var(--ma-text);
  border: 0;
  transition: background .15s, transform .08s;
}
.mc-apple .tc-actions .btn:hover,
.mc-apple .tc-preview-mobile-open:hover { background: rgba(120,120,128,0.22); }
.mc-apple .tc-actions .btn.primary,
.mc-apple .tc-actions .btn.primary:hover {
  background: var(--ma-blue);
  color: #fff;
}
.mc-apple .tc-actions .btn.primary:hover { filter: brightness(1.05); }
.mc-apple .tc-actions .btn:active { transform: scale(0.97); }

.mc-apple .tc-preview-mobile-open {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  align-self: flex-start;
}

/* Preview panel */
.mc-apple .tc-preview {
  background: var(--ma-bg);
  border-left: 1px solid var(--ma-border);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow: hidden;
}
.mc-apple .tc-preview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: #1D1D1F;
  color: #fff;
  border-radius: 12px;
  font-weight: 600;
  font-size: 0.85rem;
}
.mc-apple .tc-preview-head .btn {
  background: var(--ma-blue);
  color: #fff;
  border: 0;
  border-radius: 999px;
  padding: 6px 14px;
  font-weight: 600;
  font-size: 0.8rem;
}
.mc-apple .tc-preview iframe {
  flex: 1;
  width: 100%;
  background: var(--ma-surface);
  border: 1px solid var(--ma-border);
  border-radius: 16px;
  box-shadow: var(--ma-shadow);
  min-height: 0;
}

@media (max-width: 900px) {
  .mc-apple .tc-layout { grid-template-columns: 1fr; }
  .mc-apple .tc-preview { display: none; }
}

/* ═════════════════════════════════════════════════════════════════════════
   LOYALTY CAMPAIGNS — APPLE SKIN (scoped a .lc-apple)
   ═════════════════════════════════════════════════════════════════════════ */
.lc-apple {
  --la-bg:        #F5F5F7;
  --la-surface:   #FFFFFF;
  --la-text:      #1D1D1F;
  --la-soft:      #6E6E73;
  --la-blue:      #0A84FF;
  --la-blue-soft: rgba(10,132,255,0.12);
  --la-green:     #34C759;
  --la-red:       #FF3B30;
  --la-border:    rgba(60,60,67,0.14);
  --la-control:   rgba(120,120,128,0.12);
  --la-radius:    14px;
  --la-radius-sm: 10px;
  --la-shadow:    0 1px 2px rgba(0,0,0,0.04), 0 4px 18px rgba(0,0,0,0.05);

  background: var(--la-bg) !important;
  border-radius: 20px !important;
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Inter', 'Segoe UI', Roboto, sans-serif !important;
  color: var(--la-text);
  overflow: hidden auto !important;
}

.lc-apple > h3 {
  margin: 0 !important;
  padding: 22px 28px 6px !important;
  font-size: 1.1rem !important;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--la-text);
  background: rgba(255,255,255,0.75);
  backdrop-filter: saturate(180%) blur(18px);
  -webkit-backdrop-filter: saturate(180%) blur(18px);
  position: sticky;
  top: 0;
  z-index: 3;
}
.lc-apple > .auth-detail {
  margin: 0 !important;
  padding: 4px 28px 18px !important;
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--la-soft);
  background: rgba(255,255,255,0.75);
  backdrop-filter: saturate(180%) blur(18px);
  -webkit-backdrop-filter: saturate(180%) blur(18px);
  border-bottom: 1px solid var(--la-border);
}

.lc-apple .btn-close-modal {
  position: absolute !important;
  top: 16px !important;
  right: 16px !important;
  width: 30px !important;
  height: 30px !important;
  background: var(--la-control) !important;
  color: var(--la-soft) !important;
  border: 0 !important;
  border-radius: 50% !important;
  font-size: 0.95rem !important;
  font-weight: 600 !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  z-index: 4;
  transition: background .15s, color .15s;
}
.lc-apple .btn-close-modal:hover {
  background: rgba(120,120,128,0.22) !important;
  color: var(--la-text) !important;
}

/* Tabs como segmented control iOS */
.lc-apple .lc-tabs {
  display: flex !important;
  gap: 4px !important;
  margin: 16px 22px 12px !important;
  padding: 4px !important;
  background: var(--la-control);
  border: 0 !important;
  border-radius: 12px;
}
.lc-apple .lc-tab {
  flex: 1;
  padding: 8px 10px !important;
  border: 0 !important;
  background: transparent !important;
  font-size: 0.88rem !important;
  font-weight: 600 !important;
  color: var(--la-soft) !important;
  border-radius: 9px !important;
  cursor: pointer;
  transition: background .15s, color .15s, box-shadow .15s;
  letter-spacing: -0.005em;
}
.lc-apple .lc-tab:hover:not(.active) { color: var(--la-text) !important; }
.lc-apple .lc-tab.active {
  background: var(--la-surface) !important;
  color: var(--la-text) !important;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08), 0 2px 8px rgba(0,0,0,0.04);
  border-bottom: 0 !important;
}

/* Paneles de contenido */
.lc-apple .lc-panel {
  padding: 4px 22px 22px !important;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.lc-apple .lc-panel.hidden { display: none; }

/* Bloque IA (borrador asistido) */
.lc-apple .lc-ai-box {
  background: linear-gradient(180deg, rgba(94, 92, 230, 0.08), rgba(10, 132, 255, 0.06));
  border: 1px solid rgba(94, 92, 230, 0.28);
  border-radius: var(--la-radius);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: 0 1px 0 rgba(255,255,255,0.6) inset, var(--la-shadow);
}
.lc-apple .lc-ai-head {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.lc-apple .lc-ai-title {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--la-text);
  letter-spacing: 0.01em;
}
.lc-apple .lc-ai-sub {
  font-size: 0.76rem;
  color: var(--la-soft);
}
.lc-apple .lc-ai-box textarea#lcAiPrompt {
  width: 100%;
  min-height: 62px;
  resize: vertical;
  background: #fff !important;
  border: 1px solid var(--la-border) !important;
  border-radius: 10px !important;
  padding: 10px 12px !important;
  font-size: 0.88rem !important;
  line-height: 1.35;
  color: var(--la-text) !important;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.lc-apple .lc-ai-box textarea#lcAiPrompt:focus {
  outline: none !important;
  border-color: rgba(94, 92, 230, 0.55) !important;
  box-shadow: 0 0 0 3px rgba(94, 92, 230, 0.18) !important;
}
.lc-apple .lc-ai-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.lc-apple .lc-ai-actions .btn {
  min-height: 38px;
}
.lc-apple .lc-ai-status {
  font-size: 0.78rem;
  color: var(--la-soft);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.lc-apple .lc-ai-status.is-loading { color: #5E5CE6; }
.lc-apple .lc-ai-status.is-error { color: #D70015; }
.lc-apple .lc-ai-status.is-ok { color: #0a7a3f; }
.lc-apple .lc-ai-justify {
  background: rgba(94, 92, 230, 0.08);
  border: 1px solid rgba(94, 92, 230, 0.22);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 0.82rem;
  color: var(--la-text);
  line-height: 1.4;
}
.lc-apple .lc-ai-justify.hidden { display: none; }
.lc-apple .lc-ai-justify::before {
  content: "💡 ";
  margin-right: 4px;
}
@media (max-width: 480px) {
  .lc-apple .lc-ai-actions { flex-direction: column; align-items: stretch; }
  .lc-apple .lc-ai-actions .btn { width: 100%; }
  .lc-apple .lc-ai-status { justify-content: center; }
}

/* Selector de imagen para el mensaje */
.lc-apple .lc-img-box {
  background: var(--la-surface);
  border: 1px solid var(--la-border);
  border-radius: var(--la-radius);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: var(--la-shadow);
}
.lc-apple .lc-img-head { display: flex; flex-direction: column; gap: 2px; }
.lc-apple .lc-img-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--la-text);
}
.lc-apple .lc-img-sub {
  font-size: 0.74rem;
  color: var(--la-soft);
}
.lc-apple .lc-img-options {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
.lc-apple .lc-img-opt {
  background: #fff;
  border: 2px solid var(--la-border);
  border-radius: 12px;
  padding: 12px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease, transform .05s ease;
  min-height: 84px;
}
.lc-apple .lc-img-opt:hover { background: #F7F9FC; }
.lc-apple .lc-img-opt:active { transform: scale(0.98); }
.lc-apple .lc-img-opt.active {
  border-color: var(--la-blue);
  background: rgba(10,132,255,0.08);
}
.lc-apple .lc-img-icn {
  font-size: 1.5rem;
  line-height: 1;
}
.lc-apple .lc-img-lbl {
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--la-text);
  text-align: center;
  line-height: 1.2;
}
.lc-apple .lc-img-preview {
  display: flex;
  gap: 12px;
  align-items: center;
  background: rgba(10,132,255,0.06);
  border: 1px solid rgba(10,132,255,0.18);
  border-radius: 10px;
  padding: 10px;
}
.lc-apple .lc-img-preview.hidden { display: none; }
.lc-apple .lc-img-preview img {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 8px;
  background: #fff;
  flex: 0 0 auto;
  border: 1px solid var(--la-border);
}
.lc-apple .lc-img-preview-meta {
  font-size: 0.78rem;
  color: var(--la-text);
  line-height: 1.35;
}
.lc-apple .lc-img-upload {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.lc-apple .lc-img-upload.hidden { display: none; }
.lc-apple .lc-img-upload-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--la-blue);
  color: #fff !important;
  padding: 9px 14px;
  border-radius: 10px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  margin: 0 !important;
  min-height: 38px;
  transition: filter .12s ease;
}
.lc-apple .lc-img-upload-btn:hover { filter: brightness(1.08); }
.lc-apple .lc-img-upload-status {
  font-size: 0.78rem;
  color: var(--la-soft);
}
.lc-apple .lc-img-upload-status.is-error { color: #D70015; }
.lc-apple .lc-img-upload-status.is-ok { color: #0a7a3f; }
@media (max-width: 640px) {
  .lc-apple .lc-img-options {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Labels + inputs tipo iOS */
.lc-apple label {
  display: flex !important;
  flex-direction: column;
  gap: 6px;
  font-size: 0.78rem !important;
  font-weight: 600;
  color: var(--la-soft) !important;
  letter-spacing: 0.01em;
  margin: 0 !important;
  text-transform: none;
}
.lc-apple label small {
  font-weight: 500;
  color: var(--la-soft);
  font-size: 0.72rem;
}
.lc-apple input[type="text"],
.lc-apple input[type="search"],
.lc-apple input[type="number"],
.lc-apple input:not([type]),
.lc-apple textarea,
.lc-apple select {
  width: 100%;
  padding: 11px 13px !important;
  background: var(--la-control) !important;
  border: 0 !important;
  border-radius: var(--la-radius-sm) !important;
  font-size: 0.95rem !important;
  color: var(--la-text) !important;
  font-family: inherit;
  height: auto !important;
  transition: background .15s, box-shadow .15s;
  box-shadow: none !important;
}
.lc-apple input:focus,
.lc-apple textarea:focus,
.lc-apple select:focus {
  outline: none !important;
  background: var(--la-surface) !important;
  box-shadow: 0 0 0 3px var(--la-blue-soft), inset 0 0 0 1.5px var(--la-blue) !important;
}
.lc-apple textarea { resize: vertical; min-height: 62px; }

/* Preview box destinatarios */
.lc-apple #lcPreviewBox {
  background: var(--la-surface) !important;
  border: 1px solid var(--la-border);
  border-radius: var(--la-radius) !important;
  padding: 12px 16px !important;
  margin: 4px 0 !important;
  box-shadow: var(--la-shadow);
}
.lc-apple #lcPreviewBox strong { color: var(--la-blue); font-weight: 700; }

/* Buscador de clientes */
.lc-apple #lcManualWrap > div:first-child { font-weight: 700; color: var(--la-text); letter-spacing: -0.01em; }
.lc-apple #lcClientSearch { padding: 6px 0 !important; background: transparent !important; box-shadow: none !important; }
.lc-apple #lcClientSearch:focus { background: transparent !important; box-shadow: none !important; }
.lc-apple #lcClientList {
  background: var(--la-surface) !important;
  border: 1px solid var(--la-border) !important;
  border-radius: var(--la-radius) !important;
  box-shadow: var(--la-shadow);
  overflow: hidden;
}
.lc-apple #lcClientList .lc-client-row {
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  gap: 12px !important;
  padding: 10px 14px !important;
  border-bottom: 1px solid #F1F5F9;
  cursor: pointer;
  margin: 0 !important;
  font-size: 0.9rem !important;
  font-weight: 500 !important;
  color: var(--la-text) !important;
  text-transform: none !important;
  letter-spacing: 0 !important;
  transition: background .12s;
}
.lc-apple #lcClientList .lc-client-row:last-child { border-bottom: 0; }
.lc-apple #lcClientList .lc-client-row:hover { background: rgba(10,132,255,0.05); }
.lc-apple #lcClientList .lc-client-cb {
  width: 18px !important;
  height: 18px !important;
  flex: 0 0 auto;
  accent-color: var(--la-blue);
  margin: 0 !important;
  padding: 0 !important;
}
.lc-apple #lcClientList .lc-client-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.lc-apple #lcClientList .lc-client-name {
  font-weight: 600;
  font-size: 13.5px;
  color: var(--la-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.lc-apple #lcClientList .lc-client-phone {
  font-size: 12px;
  color: var(--la-soft);
  font-weight: 500;
}
.lc-apple #lcClientList .lc-client-meta {
  flex: 0 0 auto;
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  text-align: right;
  max-width: 60%;
}
.lc-apple #lcClientList .lc-client-chip {
  background: rgba(10,132,255,0.10);
  color: var(--la-blue);
  padding: 3px 9px;
  border-radius: 999px;
  white-space: nowrap;
  line-height: 1.3;
}
.lc-apple #lcClientList .lc-client-chip.muted {
  background: rgba(120,120,128,0.12);
  color: var(--la-soft);
}

/* Barra de filtros inteligentes */
.lc-apple .lc-filter-bar {
  background: var(--la-surface) !important;
  border: 1px solid var(--la-border);
  border-radius: var(--la-radius) !important;
  padding: 14px;
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: var(--la-shadow);
}
.lc-apple .lc-filter-group {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}
.lc-apple .lc-filter-group + .lc-filter-group {
  padding-top: 14px;
  border-top: 1px solid var(--la-border);
}
.lc-apple .lc-filter-label {
  font-size: 11px !important;
  font-weight: 700 !important;
  color: var(--la-soft) !important;
  text-transform: uppercase !important;
  letter-spacing: 0.06em !important;
  display: inline-flex !important;
  align-items: center !important;
  margin: 0 !important;
  flex: 0 0 auto;
}
.lc-apple .lc-seg {
  display: inline-flex;
  background: rgba(120,120,128,0.12);
  border-radius: 9px;
  padding: 2px;
  gap: 0;
  flex: 0 0 auto;
}
.lc-apple .lc-seg button {
  border: 0;
  background: transparent;
  padding: 7px 12px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--la-soft);
  border-radius: 7px;
  cursor: pointer;
  transition: background .12s, color .12s;
  font-family: inherit;
  white-space: nowrap;
}
.lc-apple .lc-seg button:hover { color: var(--la-text); }
.lc-apple .lc-seg button.active {
  background: #fff;
  color: var(--la-text);
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

/* Grid de filtros "estilo campo" — uniforme en desktop */
.lc-apple .lc-filter-grid {
  display: grid !important;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
  align-items: stretch;
}
.lc-apple .lc-filter-field {
  display: flex !important;
  flex-direction: column !important;
  gap: 4px !important;
  margin: 0 !important;
  font-size: 11px !important;
  font-weight: 700 !important;
  color: var(--la-soft) !important;
  text-transform: uppercase !important;
  letter-spacing: 0.04em !important;
}
.lc-apple .lc-filter-field > span {
  font-size: 11px;
  font-weight: 700;
  color: var(--la-soft);
  letter-spacing: 0.04em;
}
.lc-apple .lc-filter-field select,
.lc-apple .lc-filter-field input[type="number"] {
  width: 100% !important;
  min-width: 0 !important;
  padding: 9px 12px !important;
  font-size: 13.5px !important;
  font-weight: 500;
  text-transform: none;
  letter-spacing: normal;
  color: var(--la-text);
  background: var(--la-surface);
  border: 1px solid var(--la-border);
  border-radius: var(--la-radius-sm);
  height: 38px;
  box-sizing: border-box;
}
.lc-apple .lc-filter-field select:focus,
.lc-apple .lc-filter-field input[type="number"]:focus {
  outline: none;
  border-color: var(--la-blue);
  box-shadow: 0 0 0 3px var(--la-blue-soft);
}
.lc-apple .lc-filter-reset {
  align-self: end;
  height: 38px;
  padding: 0 14px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--la-red);
  background: rgba(255,59,48,0.10);
  border: 1px solid transparent;
  border-radius: var(--la-radius-sm);
  cursor: pointer;
  transition: background .12s;
  font-family: inherit;
  white-space: nowrap;
}
.lc-apple .lc-filter-reset:hover { background: rgba(255,59,48,0.18); }

/* Cliente sin nombre — muestra teléfono como identificador */
.lc-apple #lcClientList .lc-client-row.lc-client-unnamed .lc-client-name {
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}
.lc-apple #lcClientList .lc-client-row.lc-client-unnamed .lc-client-phone {
  font-style: italic;
  color: #94a3b8;
}

/* Responsive — teléfonos y tablets (<=820px) */
@media (max-width: 820px) {
  .lc-apple .lc-filter-bar {
    padding: 12px;
    gap: 12px;
  }
  .lc-apple .lc-filter-group {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
  .lc-apple .lc-filter-group + .lc-filter-group { padding-top: 12px; }
  .lc-apple .lc-filter-label {
    margin-bottom: 2px !important;
  }
  .lc-apple .lc-seg {
    display: flex;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    max-width: 100%;
  }
  .lc-apple .lc-seg::-webkit-scrollbar { display: none; }
  .lc-apple .lc-seg button {
    flex: 0 0 auto;
    padding: 9px 14px !important;
    font-size: 13px !important;
    min-height: 38px;
  }
  .lc-apple .lc-filter-grid {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }
  .lc-apple .lc-filter-field select,
  .lc-apple .lc-filter-field input[type="number"] {
    height: 42px !important;
    font-size: 14px !important;
    padding: 10px 12px !important;
  }
  .lc-apple .lc-filter-reset {
    grid-column: 1 / -1;
    height: 42px;
    font-size: 13px;
  }
}
@media (max-width: 480px) {
  .lc-apple .lc-filter-grid {
    grid-template-columns: 1fr;
  }
}

/* Fila de cliente — chips horizontales en todos los tamaños */
@media (max-width: 640px) {
  .lc-apple #lcClientList .lc-client-row {
    flex-wrap: wrap;
    row-gap: 8px !important;
  }
  .lc-apple #lcClientList .lc-client-main {
    flex: 1 1 auto;
    min-width: 0;
  }
  .lc-apple #lcClientList .lc-client-meta {
    flex: 1 1 100%;
    max-width: 100%;
    justify-content: flex-start;
    padding-left: 30px;
  }
  .lc-apple #lcClientList .lc-client-chip {
    font-size: 11px;
    padding: 3px 8px;
  }
}

/* Combobox buscable (producto a regalar) */
.lc-apple .lc-combo {
  position: relative;
  width: 100%;
}
.lc-apple .lc-combo input[type="text"] {
  width: 100%;
  padding-right: 36px !important;
}
.lc-apple .lc-combo-clear {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 22px;
  height: 22px;
  border: 0;
  background: rgba(120,120,128,0.18);
  color: var(--la-soft);
  border-radius: 50%;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.lc-apple .lc-combo-clear:hover { background: rgba(120,120,128,0.30); color: var(--la-text); }
.lc-apple .lc-combo-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: #fff;
  border: 1px solid var(--la-border);
  border-radius: var(--la-radius-sm);
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  max-height: 280px;
  overflow-y: auto;
  z-index: 40;
}
.lc-apple .lc-combo-dropdown.hidden { display: none; }
.lc-apple .lc-combo-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  cursor: pointer;
  font-size: 13.5px;
  color: var(--la-text);
  font-weight: 500;
  border-bottom: 1px solid #F1F5F9;
  transition: background .1s;
}
.lc-apple .lc-combo-item:last-child { border-bottom: 0; }
.lc-apple .lc-combo-item:hover,
.lc-apple .lc-combo-item.highlight {
  background: rgba(10,132,255,0.10);
}
.lc-apple .lc-combo-item.selected {
  background: rgba(52,199,89,0.12);
  font-weight: 600;
}
.lc-apple .lc-combo-item img {
  width: 32px; height: 32px; border-radius: 8px; object-fit: cover;
  flex: 0 0 auto; background: #f1f5f9;
}
.lc-apple .lc-combo-item .lc-combo-item-info { flex: 1; min-width: 0; }
.lc-apple .lc-combo-item .lc-combo-item-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lc-apple .lc-combo-item .lc-combo-item-sub { font-size: 11.5px; color: var(--la-soft); font-weight: 500; }
.lc-apple .lc-combo-empty {
  padding: 14px; text-align: center; color: var(--la-soft); font-size: 12.5px;
}

.lc-apple .lc-filter-active-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(52,199,89,0.15);
  color: #1F8A3C;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
}

/* Botones primary estilo Apple */
.lc-apple .btn.primary {
  background: var(--la-blue) !important;
  color: #fff !important;
  border: 0 !important;
  border-radius: 10px !important;
  font-weight: 600 !important;
  padding: 10px 16px !important;
  letter-spacing: -0.005em;
  box-shadow: none !important;
  transition: background .15s, transform .06s;
}
.lc-apple .btn.primary:hover { background: #0070E0 !important; }
.lc-apple .btn.primary:active { transform: scale(0.98); }
.lc-apple .btn:not(.primary) {
  background: var(--la-control) !important;
  color: var(--la-text) !important;
  border: 0 !important;
  border-radius: 10px !important;
  font-weight: 600 !important;
  padding: 10px 14px !important;
  box-shadow: none !important;
}
.lc-apple .btn:not(.primary):hover { background: rgba(120,120,128,0.18) !important; }
.lc-apple .btn.btn-sm {
  padding: 6px 12px !important;
  font-size: 0.82rem !important;
}

/* Grid de duración/delays */
.lc-apple .lc-panel > div[style*="grid-template-columns"] {
  gap: 12px !important;
}

/* Campaign cards en listado */
.lc-apple #lcCampaignsList > * {
  background: var(--la-surface);
  border: 1px solid var(--la-border);
  border-radius: var(--la-radius);
  padding: 14px 16px;
  box-shadow: var(--la-shadow);
}

/* Details de teléfonos manuales */
.lc-apple details summary { font-weight: 600 !important; color: var(--la-blue) !important; }

/* Scan tab */
.lc-apple #lcScanCode {
  background: var(--la-surface) !important;
  box-shadow: inset 0 0 0 1.5px var(--la-border) !important;
}
.lc-apple #lcScanCode:focus {
  box-shadow: 0 0 0 3px var(--la-blue-soft), inset 0 0 0 1.5px var(--la-blue) !important;
}

@media (max-width: 640px) {
  .lc-apple > h3 { padding: 18px 20px 4px !important; font-size: 1.02rem !important; }
  .lc-apple > .auth-detail { padding: 4px 20px 14px !important; font-size: 0.82rem; }
  .lc-apple .lc-tabs { margin: 12px 16px 10px !important; }
  .lc-apple .lc-panel { padding: 2px 16px 18px !important; }
  .lc-apple .lc-tab { font-size: 0.82rem !important; padding: 7px 8px !important; }
}
