@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
  --bg: #0f172a;
  --bg-2: #1e293b;
  --bg-3: #334155;
  --card: #ffffff;
  --text: #0f172a;
  --text-light: #f8fafc;
  --muted: #64748b;
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --primary-light: #e0e7ff;
  --danger: #ef4444;
  --danger-hover: #dc2626;
  --success: #10b981;
  --warning: #f59e0b;
  --border: #cbd5e1;
  --border-soft: #e2e8f0;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 12px 40px rgba(0,0,0,0.12);
  --transition: all 0.2s cubic-bezier(0.4,0,0.2,1);
}

* { box-sizing: border-box; margin: 0; }

html, body { min-height: 100%; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: #f1f5f9;
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

main.container { flex: 1; }

/* ─── HEADER ─── */
header.topbar {
  background: linear-gradient(135deg, var(--bg) 0%, var(--bg-2) 100%);
  color: #fff;
  padding: 0 28px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
header.topbar .logo {
  display: flex; align-items: center; gap: 10px;
  text-decoration: none; color: #fff;
}
header.topbar .logo-icon {
  width: 40px; height: 40px;
  background: transparent;
  object-fit: contain;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.4));
}
header.topbar h1 {
  font-size: 1.2rem; font-weight: 700; margin: 0;
  letter-spacing: -0.02em;
}
header.topbar nav { display: flex; align-items: center; gap: 10px; }

.container { max-width: 100%; margin: 0 auto; padding: 28px 40px; }

/* ─── BUTTONS ─── */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 7px; padding: 10px 20px;
  border-radius: var(--radius-sm);
  border: none;
  background: var(--primary);
  color: #fff;
  font-weight: 600; font-size: 0.875rem;
  cursor: pointer; text-decoration: none;
  transition: var(--transition);
  font-family: inherit;
  white-space: nowrap;
}
.btn:hover { background: var(--primary-hover); transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn:active { transform: translateY(0); }
.btn.secondary {
  background: #fff; color: var(--text);
  border: 1.5px solid #94a3b8;
  box-shadow: var(--shadow-sm);
}
.btn.secondary:hover { background: #f1f5f9; border-color: #64748b; }
.btn.danger { background: var(--danger); }
.btn.danger:hover { background: var(--danger-hover); }
.btn.small { padding: 6px 12px; font-size: 0.8rem; border-radius: 6px; }
.btn.ghost { background: transparent; color: var(--muted); padding: 6px 10px; }
.btn.ghost:hover { background: #f1f5f9; color: var(--text); }
.btn[disabled] { opacity: 0.55; pointer-events: none; }

/* ─── FORM ELEMENTS ─── */
input, textarea, select {
  width: 100%; padding: 10px 14px;
  border: 1.5px solid #94a3b8;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-family: inherit;
  transition: var(--transition);
  background: #fff;
  color: var(--text);
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.04);
}
input::placeholder, textarea::placeholder { color: #94a3b8; }
input:hover, textarea:hover, select:hover { border-color: #64748b; }
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}
input:disabled, textarea:disabled, select:disabled {
  background: #f1f5f9;
  color: #64748b;
  cursor: not-allowed;
}
.field { margin-bottom: 16px; }
.field label {
  display: block; font-size: 0.8rem; font-weight: 600;
  margin-bottom: 6px; color: #475569;
  text-transform: uppercase; letter-spacing: 0.04em;
}

/* ─── CARDS ─── */
.card {
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 22px;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}

/* ─── PRODUCT GRID (public) ─── */
.section-title {
  font-size: 1.5rem; font-weight: 700;
  color: var(--text); margin-bottom: 6px;
  letter-spacing: -0.02em;
  text-align: center;
}
.section-subtitle {
  color: var(--muted); font-size: 0.95rem; margin-bottom: 22px;
  text-align: center;
}

/* ─── SEARCH BAR (collapsible icon → bar) ─── */
.search-bar {
  position: relative;
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  transition: width 0.3s cubic-bezier(0.4,0,0.2,1);
}
.search-bar.expanded,
.search-bar.has-value {
  width: 320px;
}
.search-bar input {
  width: 100%;
  height: 40px;
  padding: 0 36px 0 40px;
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 999px;
  background: rgba(255,255,255,0.08);
  font-size: 0.9rem;
  font-family: inherit;
  color: #fff;
  transition: var(--transition);
  outline: none;
  cursor: pointer;
}
.search-bar:not(.expanded):not(.has-value) input {
  border-color: transparent;
  background: transparent;
  padding: 0;
  color: transparent;
}
.search-bar input::placeholder { color: rgba(255,255,255,0.55); }
.search-bar.expanded input,
.search-bar.has-value input { cursor: text; background: rgba(255,255,255,0.14); }
.search-bar input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.25);
}
.search-bar .search-icon {
  position: absolute;
  left: 0; top: 0;
  width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem;
  border: 1px solid rgba(255,255,255,0.15);
  background: rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.85);
  cursor: pointer;
  border-radius: 50%;
  transition: var(--transition);
  z-index: 2;
  padding: 0;
  line-height: 1;
}
.search-bar.expanded .search-icon,
.search-bar.has-value .search-icon {
  background: transparent;
  border-color: transparent;
}
.search-bar .search-icon:hover { color: #fff; background: rgba(255,255,255,0.15); }
.search-bar.expanded .search-icon:hover,
.search-bar.has-value .search-icon:hover { background: transparent; }
.search-bar .search-clear {
  position: absolute;
  right: 6px; top: 50%;
  transform: translateY(-50%);
  width: 26px; height: 26px;
  border: 0;
  background: transparent;
  color: rgba(255,255,255,0.7);
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
  border-radius: 50%;
  display: none;
  z-index: 3;
}
.search-bar .search-clear:hover { background: rgba(255,255,255,0.12); color: #fff; }
.search-bar.has-value .search-clear { display: block; }

.grid-products {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 22px;
}
@media (max-width: 1500px) { .grid-products { grid-template-columns: repeat(6, 1fr); } }
@media (max-width: 1280px) { .grid-products { grid-template-columns: repeat(5, 1fr); } }
@media (max-width: 1024px) { .grid-products { grid-template-columns: repeat(4, 1fr); } }
@media (max-width: 800px)  { .grid-products { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 560px)  { .grid-products { grid-template-columns: repeat(2, 1fr); } }

.product {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: var(--transition);
  cursor: pointer;
  position: relative;
}
.product:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--primary-light);
}
.product .img-wrap {
  position: relative; overflow: hidden;
  background: linear-gradient(135deg, #f1f5f9, #e2e8f0);
  aspect-ratio: 1 / 1;
}
.product img {
  width: 100%; height: 100%;
  object-fit: cover; display: block;
  transition: transform 0.4s ease;
}
.product:hover img { transform: scale(1.05); }
.product .badge {
  position: absolute; top: 10px; right: 10px;
  background: var(--success); color: #fff;
  padding: 3px 10px; border-radius: 20px;
  font-size: 0.7rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.04em;
}
.product .badge.out { background: var(--muted); }
.product .body { padding: 16px 18px; }
.product .name {
  font-weight: 600; font-size: 1rem;
  margin: 0 0 4px; color: var(--text);
  line-height: 1.3;
}
.product .price {
  color: var(--primary); font-weight: 800; font-size: 1.15rem;
  margin: 0;
}
.product .desc {
  color: var(--muted); font-size: 0.82rem;
  margin-top: 8px; line-height: 1.4;
  display: -webkit-box; -webkit-line-clamp: 2;
  -webkit-box-orient: vertical; overflow: hidden;
}
.product .colors-row {
  display: flex; gap: 5px; margin-top: 10px; flex-wrap: wrap;
}
.color-dot {
  width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid #fff; box-shadow: 0 0 0 1px #cbd5e1;
  cursor: pointer; transition: var(--transition);
}
.color-dot:hover, .color-dot.active {
  box-shadow: 0 0 0 2px var(--primary);
  transform: scale(1.15);
}

/* ─── BANNER / ADS ─── */
.banner-carousel {
  position: relative; margin-bottom: 30px;
  border-radius: var(--radius); overflow: hidden;
  background: var(--bg-2); min-height: 200px;
  box-shadow: var(--shadow-lg);
}
.banner-carousel img {
  width: 100%; max-height: 320px;
  object-fit: cover; display: block;
}
.banner-caption {
  position: absolute; bottom: 0; left: 0; right: 0;
  background: linear-gradient(transparent, rgba(0,0,0,0.7));
  color: #fff; padding: 28px 24px 20px;
}
.banner-caption strong { font-size: 1.2rem; }

/* ─── CAROUSEL (auto-rotating) ─── */
.ads-fullwidth {
  width: 100%;
  display: block;
}
.ads-fullwidth .carousel {
  border-radius: 0;
  margin-bottom: 0;
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}
.carousel {
  position: relative;
  margin-bottom: 36px;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-2);
  box-shadow: var(--shadow-lg);
}
.carousel-track {
  display: flex;
  transition: transform 0.6s cubic-bezier(0.4,0,0.2,1);
  will-change: transform;
}
.carousel-slide {
  flex: 0 0 100%;
  position: relative;
  cursor: pointer;
  overflow: hidden;
}
.carousel-slide img {
  width: 100%;
  aspect-ratio: 16 / 4;
  height: auto;
  object-fit: cover;
  display: block;
  transition: transform 0.6s ease;
}
.carousel-slide:hover img { transform: scale(1.03); }
.carousel-caption {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  background: linear-gradient(transparent, rgba(0,0,0,0.75));
  color: #fff;
  padding: 36px 28px 22px;
  pointer-events: none;
}
.carousel-caption strong {
  font-size: 1.4rem; font-weight: 700;
  letter-spacing: -0.01em;
  text-shadow: 0 2px 8px rgba(0,0,0,0.4);
}
.carousel-arrow {
  position: absolute;
  top: 50%; transform: translateY(-50%);
  width: 44px; height: 44px;
  border-radius: 50%;
  background: rgba(255,255,255,0.92);
  border: none;
  font-size: 1.5rem;
  font-weight: 700;
  cursor: pointer;
  color: var(--text);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  transition: var(--transition);
  z-index: 2;
}
.carousel-arrow:hover {
  background: #fff;
  transform: translateY(-50%) scale(1.1);
}
.carousel-arrow.prev { left: 16px; }
.carousel-arrow.next { right: 16px; }
.carousel-dots {
  position: absolute;
  bottom: 14px; left: 50%;
  transform: translateX(-50%);
  display: flex; gap: 8px;
  z-index: 2;
}
.carousel-dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  background: rgba(255,255,255,0.5);
  border: none;
  cursor: pointer;
  padding: 0;
  transition: var(--transition);
}
.carousel-dot:hover { background: rgba(255,255,255,0.8); }
.carousel-dot.active {
  background: #fff;
  width: 24px;
  border-radius: 5px;
}

@media (max-width: 640px) {
.carousel-slide img { aspect-ratio: 16 / 9; }
  .carousel-caption { padding: 24px 16px 16px; }
  .carousel-caption strong { font-size: 1rem; }
  .carousel-arrow { width: 36px; height: 36px; font-size: 1.2rem; }
  .carousel-arrow.prev { left: 8px; }
  .carousel-arrow.next { right: 8px; }
}

/* ─── WELCOME POPUP ─── */
.welcome-popup-bg {
  position: fixed; inset: 0;
  background: rgba(15,23,42,0.7);
  backdrop-filter: blur(6px);
  display: none; align-items: center; justify-content: center;
  z-index: 200; padding: 20px;
  animation: fadeIn 0.3s ease;
}
.welcome-popup-bg.open { display: flex; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.welcome-popup {
  background: #fff;
  border-radius: 18px;
  width: 100%; max-width: 520px;
  overflow: hidden;
  box-shadow: 0 30px 70px rgba(0,0,0,0.4);
  animation: popIn 0.35s cubic-bezier(0.34,1.56,0.64,1);
  position: relative;
  cursor: pointer;
}
@keyframes popIn {
  from { opacity: 0; transform: scale(0.85) translateY(20px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}
.welcome-popup .wp-close {
  position: absolute; top: 12px; right: 12px;
  width: 34px; height: 34px;
  border-radius: 50%;
  background: rgba(255,255,255,0.95);
  border: none; font-size: 1.4rem;
  cursor: pointer; color: var(--text);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
  z-index: 2;
  transition: var(--transition);
}
.welcome-popup .wp-close:hover { background: #fff; transform: scale(1.1); }
.welcome-popup img {
  width: 100%; max-height: 320px;
  object-fit: cover; display: block;
}
.welcome-popup .wp-body {
  padding: 22px 26px 24px;
  text-align: center;
}
.welcome-popup .wp-title {
  font-size: 1.4rem; font-weight: 700;
  margin: 0 0 6px;
  letter-spacing: -0.02em;
}
.welcome-popup .wp-cta {
  display: inline-block; margin-top: 14px;
  padding: 10px 26px;
  background: var(--primary); color: #fff;
  border-radius: var(--radius-sm);
  font-weight: 600; font-size: 0.9rem;
  text-decoration: none;
}

/* ─── FILE INPUT / IMAGE PICKER ─── */
.image-picker {
  display: flex; gap: 8px; align-items: stretch;
  margin-bottom: 8px;
}
.image-picker input[type="text"] { flex: 1; }
.image-picker .upload-btn {
  position: relative; overflow: hidden;
  padding: 0 14px;
  white-space: nowrap;
}
.image-picker input[type="file"] {
  position: absolute; inset: 0;
  opacity: 0; cursor: pointer;
  font-size: 0;
}
.image-preview {
  display: block; width: 100%;
  max-height: 140px; object-fit: cover;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  margin-bottom: 8px;
}
.upload-status {
  font-size: 0.78rem; color: var(--muted);
  margin-top: 4px;
}

/* ─── ORDERS ADMIN ─── */
.orders-filter {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  font-family: inherit;
  font-size: 0.9rem;
  cursor: pointer;
}
.status-pill {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.status-pill.pending   { background: #fef3c7; color: #92400e; }
.status-pill.confirmed { background: #dcfce7; color: #166534; }
.status-pill.rejected  { background: #fee2e2; color: #991b1b; }
.status-pill.cancelled { background: #e2e8f0; color: #475569; }
.status-pill.expired   { background: #f3e8ff; color: #6b21a8; }

.status-select {
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  cursor: pointer;
  outline: none;
  font-family: inherit;
  transition: var(--transition);
}
.status-select.status-en_espera     { background: #fef3c7; color: #92400e; border-color: #fde68a; }
.status-select.status-en_fabricacion{ background: #dbeafe; color: #1e40af; border-color: #bfdbfe; }
.status-select.status-por_pagar     { background: #ffedd5; color: #9a3412; border-color: #fed7aa; }
.status-select.status-pagado_no_fabricado { background: #fae8ff; color: #6b21a8; border-color: #f5d0fe; }
.status-select.status-terminado     { background: #dcfce7; color: #166534; border-color: #bbf7d0; }
.status-select.status-cancelled     { background: #fee2e2; color: #991b1b; border-color: #fecaca; }
.status-select:disabled { opacity: 0.6; cursor: wait; }

/* Botones por item dentro del pedido */
.item-actions {
  display: inline-flex;
  gap: 4px;
  margin-left: 6px;
  vertical-align: middle;
}
.item-btn {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  transition: var(--transition);
  padding: 0;
}
.item-btn:hover { background: var(--primary); color: #fff; border-color: var(--primary); }
.item-btn.item-btn-x:hover { background: var(--danger); border-color: var(--danger); }

.order-items-list {
  margin: 0; padding: 0; list-style: none;
  font-size: 0.85rem;
}
.order-items-list li {
  padding: 4px 0;
  border-bottom: 1px dashed #e2e8f0;
}
.order-items-list li:last-child { border-bottom: 0; }
.order-items-list .qty { color: var(--muted); }
.add-item-btn { margin-top: 6px; font-size: 0.75rem; padding: 4px 10px; }

/* ─── LOGIN ─── */
.login-wrap {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #1e1b4b 0%, #0f172a 50%, #042f2e 100%);
  padding: 20px;
  position: relative; overflow: hidden;
}
.login-wrap::before {
  content: ''; position: absolute;
  width: 500px; height: 500px;
  background: radial-gradient(circle, rgba(99,102,241,0.15), transparent 70%);
  top: -100px; right: -100px;
}
.login-wrap::after {
  content: ''; position: absolute;
  width: 400px; height: 400px;
  background: radial-gradient(circle, rgba(16,185,129,0.1), transparent 70%);
  bottom: -80px; left: -80px;
}
.login-card {
  background: #fff; padding: 40px 36px;
  border-radius: 18px; width: 100%; max-width: 400px;
  box-shadow: 0 25px 60px rgba(0,0,0,0.3);
  position: relative; z-index: 1;
}
.login-card .login-logo {
  width: 56px; height: 56px;
  background: linear-gradient(135deg, var(--primary), #818cf8);
  border-radius: 14px; margin: 0 auto 20px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem; font-weight: 800; color: #fff;
}
.login-card h2 {
  margin: 0 0 4px; text-align: center;
  font-size: 1.35rem; font-weight: 700;
}
.login-card .subtitle {
  text-align: center; margin-bottom: 28px;
}

/* ─── TABS (admin) ─── */
.tabs {
  display: flex; gap: 2px;
  background: #e2e8f0; border-radius: var(--radius-sm);
  padding: 3px; margin-bottom: 22px;
  width: fit-content;
}
.tab {
  padding: 9px 20px; cursor: pointer;
  border: none; background: transparent;
  font-size: 0.875rem; font-weight: 500;
  color: var(--muted);
  border-radius: 6px;
  transition: var(--transition);
  font-family: inherit;
}
.tab:hover { color: var(--text); }
.tab.active {
  background: #fff; color: var(--primary);
  box-shadow: var(--shadow-sm); font-weight: 600;
}

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ─── TABLE ─── */
table {
  width: 100%; border-collapse: separate;
  border-spacing: 0; background: #fff;
  border-radius: var(--radius);
  overflow: hidden; border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}
th, td {
  padding: 12px 16px; text-align: left;
  border-bottom: 1px solid #f1f5f9;
  font-size: 0.875rem;
}
th {
  background: #f8fafc; font-weight: 600;
  color: #475569; font-size: 0.78rem;
  text-transform: uppercase; letter-spacing: 0.04em;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: #fafbfc; }

.toolbar {
  display: flex; justify-content: space-between;
  align-items: center; margin-bottom: 16px;
  gap: 12px; flex-wrap: wrap;
}

/* ─── ALERTS ─── */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  font-size: 0.875rem; font-weight: 500;
  display: flex; align-items: center; gap: 8px;
}
.alert.error { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.alert.success { background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; }
.alert.info { background: #eef2ff; color: #3730a3; border: 1px solid #c7d2fe; }

/* Tabs internas del modal Mi cuenta */
.ac-tab {
  background: transparent; border: none; padding: 8px 12px; cursor: pointer;
  font-size: 0.85rem; font-weight: 600; color: var(--muted);
  border-bottom: 2px solid transparent; transition: all 0.15s;
}
.ac-tab:hover { color: var(--text); }
.ac-tab.active { color: var(--primary); border-bottom-color: var(--primary); }

/* PayPal Card Fields — contenedor de cada input embebido por el SDK. */
.card-field {
  min-height: 42px;
  border: 1px solid var(--border, #d4d4d8);
  border-radius: 8px;
  padding: 0 12px;
  margin-bottom: 8px;
  background: var(--bg-elev, #fff);
}
.card-field iframe { width: 100% !important; min-height: 40px; }

/* Lista de mis pedidos */
.ac-order {
  border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px;
  margin-bottom: 8px; font-size: 0.85rem;
}
.ac-order header {
  display: flex; justify-content: space-between; gap: 8px;
  font-weight: 600; margin-bottom: 4px;
}
.ac-order .badge {
  font-size: 0.72rem; padding: 2px 8px; border-radius: 999px;
  background: var(--bg-elev,#1e293b); color: var(--muted);
}
.ac-order .badge.en_camino { background: #dbeafe; color: #1e3a8a; }
.ac-order .badge.entregado { background: #d1fae5; color: #065f46; }
.ac-order .badge.cancelado { background: #fee2e2; color: #991b1b; }
html[data-theme="dark"] .ac-order .badge.en_camino { background: #1e3a8a; color: #dbeafe; }
html[data-theme="dark"] .ac-order .badge.entregado { background: #065f46; color: #d1fae5; }
html[data-theme="dark"] .ac-order .badge.cancelado { background: #7f1d1d; color: #fee2e2; }


/* Banner especial Lintac (Lincoln International Academy) en el paso 2 del signup */
.lintac-banner {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 10px;
  align-items: start;
  padding: 12px 14px;
  margin-bottom: 14px;
  border-radius: var(--radius-sm);
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  color: #065f46;
}
.lintac-banner__icon { font-size: 1.3rem; line-height: 1.2; }
.lintac-banner__text { font-size: 0.88rem; line-height: 1.45; }
.lintac-banner__text strong { font-weight: 700; }
html[data-theme="dark"] .lintac-banner {
  background: #022c22; color: #a7f3d0; border-color: #064e3b;
}

/* ─── MODAL ─── */
.modal-bg {
  position: fixed; inset: 0;
  background: rgba(15,23,42,0.6);
  backdrop-filter: blur(4px);
  display: none; align-items: center; justify-content: center;
  z-index: 100; padding: 20px;
}
.modal-bg.open { display: flex; }
.modal {
  background: #fff; border-radius: 16px;
  padding: 28px; width: 100%; max-width: 520px;
  max-height: 90vh; overflow-y: auto;
  box-shadow: 0 25px 60px rgba(0,0,0,0.25);
  animation: modalIn 0.2s ease;
}
@keyframes modalIn {
  from { opacity: 0; transform: scale(0.95) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}
.modal h3 {
  margin: 0 0 20px; font-size: 1.15rem;
  font-weight: 700;
}

/* ─── PRODUCT DETAIL MODAL (public) ─── */
.product-detail {
  display: flex; gap: 24px; flex-wrap: wrap;
}
.product-detail .detail-img {
  flex: 1; min-width: 200px;
}
.product-detail .detail-img img {
  width: 100%; border-radius: var(--radius);
  object-fit: cover; aspect-ratio: 1;
}
.product-detail .detail-info {
  flex: 1; min-width: 200px;
  display: flex; flex-direction: column; gap: 12px;
}
.product-detail .detail-name {
  font-size: 1.3rem; font-weight: 700;
  line-height: 1.3;
}
.product-detail .detail-price {
  font-size: 1.5rem; font-weight: 800;
  color: var(--primary);
}
.product-detail .detail-desc {
  color: var(--muted); font-size: 0.9rem; line-height: 1.6;
}
.product-detail .detail-stock {
  font-size: 0.85rem; font-weight: 500;
  padding: 6px 14px; border-radius: 20px;
  width: fit-content;
}
.product-detail .detail-stock.in {
  background: #ecfdf5; color: #065f46;
}
.product-detail .detail-stock.out {
  background: #fef2f2; color: #991b1b;
}
.detail-colors-label {
  font-size: 0.8rem; font-weight: 600;
  color: #475569; text-transform: uppercase;
  letter-spacing: 0.04em;
}
.detail-colors {
  display: flex; gap: 8px; flex-wrap: wrap;
}
.detail-color-opt {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 14px; border-radius: 20px;
  border: 1.5px solid var(--border);
  cursor: pointer; font-size: 0.82rem;
  font-weight: 500; transition: var(--transition);
  background: #fff;
}
.detail-color-opt:hover { border-color: var(--primary); }
.detail-color-opt.active {
  border-color: var(--primary);
  background: var(--primary-light);
  color: var(--primary);
}
.detail-color-opt .dot {
  width: 14px; height: 14px; border-radius: 50%;
  border: 1px solid rgba(0,0,0,0.1);
}

/* ─── COLOR CHIPS (admin) ─── */
.color-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.color-chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px 4px 6px;
  background: #f1f5f9; border-radius: 20px;
  font-size: 0.78rem; font-weight: 500;
}
.color-chip .dot {
  width: 14px; height: 14px; border-radius: 50%;
  border: 1px solid rgba(0,0,0,0.1);
}
.color-chip .remove {
  cursor: pointer; margin-left: 2px;
  color: var(--muted); font-weight: 700;
}
.color-chip .remove:hover { color: var(--danger); }

.row { display: flex; gap: 10px; }
.row > * { flex: 1; }

.muted { color: var(--muted); font-size: 0.85rem; }

.empty {
  text-align: center; padding: 60px 20px;
  color: var(--muted);
}

/* ─── CART ─── */
.cart-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255,255,255,0.1);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.18);
  padding: 8px 14px;
}
.cart-btn:hover {
  background: rgba(255,255,255,0.2);
  color: #fff;
}
.cart-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  background: var(--primary);
  color: #fff;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1;
}
.cart-count.empty { background: rgba(255,255,255,0.25); }

nav { display: flex; align-items: center; gap: 10px; }

.cart-drawer-bg {
  position: fixed; inset: 0;
  background: rgba(15,23,42,0.55);
  opacity: 0; visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
  z-index: 1500;
}
.cart-drawer-bg.show { opacity: 1; visibility: visible; }

.cart-drawer {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: 420px; max-width: 92vw;
  background: #fff;
  box-shadow: -4px 0 24px rgba(0,0,0,0.15);
  display: flex; flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.4,0,0.2,1);
  z-index: 1600;
}
.cart-drawer.open { transform: translateX(0); }

.cart-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
}
.cart-header h3 { margin: 0; font-size: 1.1rem; }
.cart-close {
  background: transparent; border: 0;
  font-size: 1.6rem; line-height: 1;
  color: var(--muted); cursor: pointer;
  width: 32px; height: 32px; border-radius: 50%;
}
.cart-close:hover { background: #f1f5f9; color: var(--text); }

.cart-items {
  flex: 1;
  overflow-y: auto;
  padding: 12px 16px;
}
.cart-empty {
  text-align: center;
  color: var(--muted);
  padding: 60px 20px;
  font-size: 0.95rem;
}

.cart-item {
  display: flex; gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}
.cart-item:last-child { border-bottom: 0; }
.cart-item-img {
  width: 64px; height: 64px;
  border-radius: 8px;
  object-fit: cover;
  background: #f1f5f9;
  flex-shrink: 0;
}
.cart-item-info {
  flex: 1;
  display: flex; flex-direction: column;
  gap: 4px; min-width: 0;
}
.cart-item-name {
  font-weight: 600; font-size: 0.92rem;
  color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cart-item-meta {
  font-size: 0.78rem; color: var(--muted);
}
.cart-item-unit {
  font-size: 0.8rem; color: var(--primary); font-weight: 600;
}
.cart-item-controls {
  display: flex; align-items: center; gap: 8px;
  margin-top: 4px;
}
.qty-btn {
  width: 26px; height: 26px;
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.95rem;
  line-height: 1;
  color: var(--text);
}
.qty-btn:hover { background: #f1f5f9; border-color: var(--primary); }
.qty-num { min-width: 24px; text-align: center; font-weight: 600; font-size: 0.9rem; }
.cart-item-remove {
  background: transparent; border: 0;
  color: var(--danger);
  cursor: pointer;
  font-size: 0.78rem;
  padding: 0;
  margin-left: auto;
}
.cart-item-remove:hover { text-decoration: underline; }

.cart-footer {
  border-top: 1px solid var(--border);
  padding: 16px 20px 20px;
  background: #fff;
}
.cart-total-row {
  display: flex; justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  font-size: 0.95rem;
}
.cart-total-row strong {
  font-size: 1.3rem; color: var(--primary);
}
.btn-block { display: block; width: 100%; }

/* Product detail action buttons */
.detail-actions {
  display: flex; gap: 10px; margin-top: 14px; flex-wrap: wrap;
}
.detail-actions .btn { flex: 1; min-width: 140px; }

/* Checkout modal */
#checkout-modal-bg input[type=email],
#checkout-modal-bg input[type=text] {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.95rem;
  font-family: inherit;
  outline: none;
  transition: var(--transition);
}
#checkout-modal-bg input[type=email]:focus,
#checkout-modal-bg input[type=text]:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.15);
}
.checkout-summary {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 16px;
  font-size: 0.9rem;
}
.checkout-summary .row {
  display: flex; justify-content: space-between;
  padding: 4px 0;
  border-bottom: 1px dashed #e2e8f0;
}
.checkout-summary .row:last-child { border-bottom: 0; }
.checkout-summary .total {
  display: flex; justify-content: space-between;
  margin-top: 8px; padding-top: 8px;
  border-top: 1px solid var(--border);
  font-weight: 700;
  color: var(--primary);
}
html[data-theme="dark"] .checkout-summary {
  background: #0f172a; border-color: #334155; color: #f1f5f9;
}
html[data-theme="dark"] .checkout-summary .row { border-bottom-color: #334155; color: #f1f5f9; }
html[data-theme="dark"] .checkout-summary .total { border-top-color: #475569; color: #a5b4fc; }
.checkout-instructions {
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 16px;
  font-size: 0.85rem;
  color: #78350f;
}
.checkout-instructions strong { display: block; margin-bottom: 4px; }
.checkout-instructions p { margin: 0; line-height: 1.5; }

.cash-notice {
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 10px;
  padding: 10px 12px;
  margin: 14px 0;
  font-size: 0.85rem;
  color: #78350f;
  line-height: 1.4;
}
.cash-notice strong { color: #92400e; }

/* ─── Menú de cuenta (topbar tienda) ─── */
.account-menu { position: relative; display: inline-flex; align-items: center; }
.account-user-box { position: relative; }
.account-dropdown {
  position: absolute; right: 0; top: calc(100% + 6px);
  background: #fff; border: 1px solid var(--border, #e5e7eb);
  border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,0.10);
  min-width: 200px; z-index: 50; padding: 6px;
}
.account-dropdown[hidden] { display: none; }
.account-dropdown-item {
  display: block; width: 100%; text-align: left; padding: 8px 10px;
  background: transparent; border: 0; border-radius: 6px; cursor: pointer;
  font-size: 0.9rem; color: var(--text); font-family: inherit;
}
.account-dropdown-item:hover { background: #f1f5f9; color: var(--text); }
html[data-theme="dark"] .account-dropdown { background: #1e293b; border-color: #334155; }
html[data-theme="dark"] .account-dropdown-item { color: #f1f5f9; }
html[data-theme="dark"] .account-dropdown-item:hover { background: #334155; color: #fff; }

.account-banner {
  background: #ecfdf5; border: 1px solid #a7f3d0; color: #065f46;
  border-radius: 8px; padding: 8px 10px; margin-bottom: 12px;
  font-size: 0.85rem;
}
html[data-theme="dark"] .account-banner {
  background: #022c22; border-color: #064e3b; color: #a7f3d0;
}

.auth-toggle .auth-mode.active { background: var(--primary, #6366f1); color: #fff; }

.cash-popup-icon {
  width: 72px;
  height: 72px;
  margin: 0 auto 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: #fffbeb;
  border: 2px solid #fde68a;
  font-size: 2rem;
}

/* ─── CHAT FAB (botón flotante de consultas) ─── */
.chat-fab {
  position: fixed;
  bottom: 22px;
  right: 22px;
  z-index: 80;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 18px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--primary) 0%, #4f46e5 100%);
  color: #fff;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(99,102,241,0.35);
  transition: var(--transition);
}
.chat-fab:hover { transform: translateY(-2px); box-shadow: 0 12px 24px rgba(99,102,241,0.45); }
.chat-fab span { font-size: 0.9rem; }
@media (max-width: 600px) {
  .chat-fab { padding: 12px; }
  .chat-fab span { display: none; }
}

/* ─── CHAT WINDOW ─── */
.chat-window {
  position: fixed;
  bottom: 22px;
  right: 22px;
  width: 380px;
  max-width: calc(100vw - 28px);
  height: 560px;
  max-height: calc(100vh - 60px);
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.25);
  display: none;
  flex-direction: column;
  overflow: hidden;
  z-index: 81;
  border: 1px solid var(--border);
}
.chat-window.open { display: flex; }
/* Hide FAB while chat is open (classic widget behavior) */
body.chat-open .chat-fab { display: none; }
.chat-header {
  background: linear-gradient(135deg, var(--primary) 0%, #4f46e5 100%);
  color: #fff;
  padding: 14px 16px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}
.chat-sub { font-size: 0.78rem; opacity: 0.9; margin-top: 2px; }
.chat-x {
  background: transparent; border: 0; color: #fff;
  font-size: 1.5rem; cursor: pointer; line-height: 1;
}
.chat-step {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 18px;
  gap: 10px;
  overflow-y: auto;
}
.chat-step[hidden] { display: none !important; }
.chat-step.chat-thread-step { padding: 0; }
.chat-intro { margin: 0 0 4px; color: var(--muted); font-size: 0.9rem; }
.chat-step label { font-size: 0.8rem; font-weight: 600; margin: 4px 0 -4px; color: var(--text); }
.chat-step input[type=text],
.chat-step input[type=email] {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-family: inherit;
  font-size: 0.95rem;
  outline: none;
  transition: var(--transition);
}
.chat-step input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(99,102,241,0.15); }

.chat-topic {
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  font-family: inherit;
  font-size: 0.95rem;
  cursor: pointer;
  color: var(--text);
  transition: var(--transition);
}
.chat-topic:hover { border-color: var(--primary); background: #f8faff; transform: translateX(2px); }
.chat-topic span small { color: var(--muted); font-size: 0.78rem; font-weight: normal; }

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: #f8fafc;
}
.chat-msg {
  max-width: 80%;
  padding: 8px 12px;
  border-radius: 14px;
  font-size: 0.9rem;
  line-height: 1.4;
  word-wrap: break-word;
  white-space: pre-wrap;
}
.chat-msg.client { align-self: flex-end; background: var(--primary); color: #fff; border-bottom-right-radius: 4px; }
.chat-msg.agent  { align-self: flex-start; background: #fff; color: var(--text); border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.chat-msg.system {
  align-self: center;
  background: #fef3c7; color: #78350f;
  font-size: 0.78rem; padding: 6px 12px; border-radius: 8px;
  max-width: 100%; text-align: center;
}
.chat-msg-file {
  display: inline-flex; align-items: center; gap: 6px;
  margin-top: 4px; padding: 4px 8px; border-radius: 6px;
  background: rgba(0,0,0,0.1); font-size: 0.8rem; text-decoration: none; color: inherit;
}
.chat-msg-time { display: block; font-size: 0.65rem; opacity: 0.65; margin-top: 2px; }

.chat-composer {
  display: flex;
  gap: 6px;
  padding: 10px;
  border-top: 1px solid var(--border);
  background: #fff;
  align-items: flex-end;
}
.chat-composer textarea {
  flex: 1;
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 8px 12px;
  font-family: inherit;
  font-size: 0.9rem;
  resize: none;
  outline: none;
  max-height: 100px;
  line-height: 1.4;
}
.chat-composer textarea:focus { border-color: var(--primary); }
.chat-attach, .chat-send {
  width: 38px; height: 38px;
  border: 0; border-radius: 50%;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
  transition: var(--transition);
}
.chat-attach { background: #f1f5f9; color: var(--text); }
.chat-attach:hover { background: #e2e8f0; }
.chat-send { background: var(--primary); color: #fff; font-size: 1.1rem; }
.chat-send:hover { background: #4f46e5; }
.chat-send:disabled { opacity: 0.5; cursor: not-allowed; }

@media (max-width: 600px) {
  .chat-window { right: 0; left: 0; bottom: 0; top: 0; width: auto; height: 100vh; max-height: 100vh; border-radius: 0; }
}

/* ─── ADMIN: messages list ─── */
.tab-badge {
  display: inline-block;
  margin-left: 6px;
  background: var(--danger);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  line-height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  text-align: center;
}
.messages-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.message-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  box-shadow: var(--shadow);
}
.message-card.unread {
  border-left: 4px solid var(--primary);
  background: #f8faff;
}
.message-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 6px;
}
.message-head a { margin-left: 8px; text-decoration: none; }
.message-head a:hover { color: var(--primary); }
.message-subject {
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text);
}
.message-body {
  color: var(--text);
  white-space: pre-wrap;
  line-height: 1.5;
  font-size: 0.92rem;
  margin-bottom: 12px;
}
.message-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ─── ADMIN: chat panel (clientes + thread) ─── */
.chat-subtab { font-weight: 500; opacity: 0.75; }
.chat-subtab.active { opacity: 1; background: var(--primary, #6366f1); color: #fff; }
.chat-admin {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 16px;
  height: calc(100vh - 220px);
  min-height: 480px;
}
.chat-clients-pane {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow-y: auto;
}
.chat-client-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: var(--transition);
  position: relative;
}
.chat-client-row:hover { background: #f8faff; }
.chat-client-row.selected { background: #eef2ff; border-left: 4px solid var(--primary); padding-left: 10px; }
.chat-client-row.has-unread strong { color: var(--primary); }
.chat-client-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.chat-client-info strong { font-size: 0.92rem; }
.chat-client-info span { font-size: 0.78rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-unread-pill {
  background: var(--danger);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
  min-width: 18px;
  text-align: center;
}
.chat-client-del {
  opacity: 0;
  transition: var(--transition);
  padding: 2px 8px !important;
}
.chat-client-row:hover .chat-client-del { opacity: 1; }

.chat-thread-pane {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.chat-empty {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  padding: 40px;
}
.chat-thread-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  gap: 12px;
}
.chat-thread-header a { margin-left: 8px; text-decoration: none; font-size: 0.85rem; }
.chat-thread-pane .chat-messages { flex: 1; }
.chat-thread-pane .chat-msg { position: relative; }
.chat-msg-del {
  position: absolute;
  top: -6px; right: -6px;
  width: 20px; height: 20px;
  border-radius: 50%;
  border: 0;
  background: var(--danger);
  color: #fff;
  font-size: 0.8rem;
  cursor: pointer;
  opacity: 0;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.chat-msg:hover .chat-msg-del { opacity: 1; }

@media (max-width: 900px) {
  .chat-admin { grid-template-columns: 1fr; height: auto; }
  .chat-clients-pane { max-height: 300px; }
}

/* ─── Permisos (pills + checkboxes) ─── */
.perm-pill {
  display: inline-block;
  background: #eef2ff;
  color: #3730a3;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  margin: 0 2px 2px 0;
}
.perm-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}
.perm-check {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: var(--transition);
  font-size: 0.88rem;
}
.perm-check:hover { background: #f8faff; }
.perm-check input { margin: 0; }
.order-ok-icon {
  width: 64px; height: 64px;
  border-radius: 50%;
  background: #16a34a;
  color: #fff;
  font-size: 32px;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 14px;
}

/* ─── FOOTER ─── */
footer.site-footer {
  background: linear-gradient(135deg, var(--bg) 0%, var(--bg-2) 100%);
  color: #cbd5e1;
  text-align: center;
  padding: 20px 24px;
  font-size: 0.82rem;
  margin-top: 60px;
  border-top: 1px solid rgba(255,255,255,0.06);
  letter-spacing: 0.02em;
}
footer.site-footer a { color: #fff; text-decoration: none; }
footer.site-footer a:hover { text-decoration: underline; }

/* ─── RESPONSIVE ─── */
@media (max-width: 640px) {
  .container { padding: 16px; }
  .grid-products { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
  .product .body { padding: 10px 12px; }
  .product .name { font-size: 0.9rem; }
  .product .price { font-size: 1rem; }
  header.topbar { padding: 0 14px; }
  .product-detail { flex-direction: column; }
  .tabs { overflow-x: auto; width: 100%; }
}

/* ─── IMAGE CROPPER ─── */
.crop-modal-bg {
  display: none;
  position: fixed; inset: 0;
  background: rgba(15,23,42,0.7);
  z-index: 2000;
  align-items: center; justify-content: center;
  padding: 16px;
}
.crop-modal-bg.show { display: flex; }
.crop-modal {
  background: #fff;
  border-radius: var(--radius);
  padding: 20px;
  max-width: 640px; width: 100%;
  box-shadow: var(--shadow-lg);
}
.crop-modal h3 { margin: 0 0 12px; font-size: 1.1rem; }
.crop-stage {
  width: 100%;
  background: #1e293b;
  position: relative;
  overflow: hidden;
  border-radius: 8px;
  user-select: none;
  touch-action: none;
  cursor: grab;
}
.crop-stage.dragging { cursor: grabbing; }
.crop-stage img {
  position: absolute;
  top: 50%; left: 50%;
  transform-origin: 0 0;
  pointer-events: none;
  max-width: none;
}
.crop-controls {
  display: flex; align-items: center; gap: 12px;
  margin-top: 14px;
}
.crop-controls label { font-size: 0.85rem; color: var(--muted); }
.crop-controls input[type=range] { flex: 1; }
.crop-actions {
  display: flex; gap: 10px; justify-content: flex-end;
  margin-top: 16px;
}
.crop-hint {
  font-size: 0.8rem; color: var(--muted);
  text-align: center; margin-top: 8px;
}

/* Color selection required feedback */
@keyframes shake { 0%,100%{transform:translateX(0)} 20%,60%{transform:translateX(-6px)} 40%,80%{transform:translateX(6px)} }
.shake { animation: shake 0.4s ease-in-out 2; }


/* ============================================================ */
/*  ADMIN STATS, PAYOUTS & AI OUTPUT                            */
/* ============================================================ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin: 12px 0 18px;
}
.stat-card {
  background: #fff;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 12px;
  padding: 14px 16px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}
.stat-card .stat-label {
  font-size: 0.78rem;
  color: var(--muted, #64748b);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-bottom: 6px;
}
.stat-card .stat-value {
  font-size: 1.45rem;
  font-weight: 700;
  color: #0f172a;
}
.stat-card .stat-sub {
  font-size: 0.78rem;
  color: var(--muted, #64748b);
  margin-top: 4px;
}
.stat-earned    { border-left: 4px solid #6366f1; }
.stat-paid      { border-left: 4px solid #22c55e; }
.stat-pending   { border-left: 4px solid #f59e0b; }
.stat-cancelled { border-left: 4px solid #ef4444; }

.payouts-panel {
  background: #fff;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 12px;
  padding: 16px;
  margin: 12px 0 18px;
}
.payout-header { margin-bottom: 12px; }
.payout-title  { font-weight: 700; font-size: 1.05rem; }
.payout-sub    { font-size: 0.82rem; color: var(--muted, #64748b); margin-top: 2px; }
.payout-list   { display: flex; flex-direction: column; gap: 6px; }
.payout-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 14px;
  align-items: center;
  padding: 10px 12px;
  background: #f8fafc;
  border-radius: 8px;
}
.payout-user { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.payout-role {
  font-size: 0.7rem;
  padding: 2px 8px;
  border-radius: 999px;
  background: #e0e7ff;
  color: #3730a3;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.payout-role.role-owner { background: #ecfdf5; color: #065f46; }
.payout-role.role-admin { background: #fef3c7; color: #92400e; }
.payout-pct {
  font-weight: 600;
  color: #475569;
  min-width: 60px;
  text-align: right;
}
.payout-amount {
  font-weight: 700;
  color: #0f172a;
  min-width: 110px;
  text-align: right;
}

.ai-output {
  background: linear-gradient(135deg, #faf5ff, #eef2ff);
  border: 1px solid #c7d2fe;
  border-radius: 12px;
  padding: 14px 16px;
  margin: 0 0 18px;
  font-size: 0.92rem;
  line-height: 1.5;
}
.ai-result { color: #1e1b4b; }

/* ============================================================ */
/*  RESPONSIVE � TABLET & MOBILE                                */
/* ============================================================ */

/* Tablet (<= 1024px) */
@media (max-width: 1024px) {
  .container { padding: 20px 18px; }
  .topbar { padding: 12px 16px; }
  .topbar h1 { font-size: 1rem; }
  table { font-size: 0.88rem; }
  table th, table td { padding: 8px 10px; }
}

/* Tablet small / mobile landscape (<= 768px) */
@media (max-width: 768px) {
  .container { padding: 16px 12px; }

  /* Topbar stacks */
  .topbar {
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px 12px;
  }
  .topbar .logo h1 { font-size: 0.95rem; }
  .topbar nav {
    width: 100%;
    flex-wrap: wrap;
    justify-content: flex-start;
    gap: 6px;
  }
  .topbar nav .btn { padding: 6px 10px; font-size: 0.82rem; }
  #user-info { width: 100%; order: -1; font-size: 0.75rem !important; }

  /* Tabs become scrollable */
  .tabs {
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
  }
  .tab { white-space: nowrap; flex: 0 0 auto; font-size: 0.85rem; padding: 8px 12px; }

  /* Toolbars stack */
  .toolbar {
    flex-direction: column;
    align-items: stretch !important;
    gap: 10px;
  }
  .toolbar > div { flex-wrap: wrap; gap: 6px !important; }
  .toolbar h2 { font-size: 1rem !important; }
  .toolbar .btn { font-size: 0.82rem; padding: 7px 12px; }

  /* Tables: allow horizontal scroll on the parent panel */
  .tab-panel table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    white-space: nowrap;
  }
  .tab-panel table tbody td,
  .tab-panel table thead th { white-space: normal; }

  /* Stats / payouts */
  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .stat-card { padding: 10px 12px; }
  .stat-card .stat-value { font-size: 1.15rem; }
  .stat-card .stat-label { font-size: 0.7rem; }

  .payout-row {
    grid-template-columns: 1fr auto;
    grid-template-areas: "user pct" "user amount";
    row-gap: 2px;
  }
  .payout-user   { grid-area: user; }
  .payout-pct    { grid-area: pct; }
  .payout-amount { grid-area: amount; min-width: 0; }

  /* Modals */
  .modal {
    max-width: 100% !important;
    margin: 12px;
    padding: 18px !important;
    max-height: calc(100vh - 24px);
    overflow-y: auto;
  }

  /* Chat admin */
  .chat-admin { grid-template-columns: 1fr !important; }
  .chat-clients-pane { max-height: 220px; overflow-y: auto; }
}

/* Mobile (<= 480px) */
@media (max-width: 480px) {
  .container { padding: 12px 10px; }

  .stats-grid { grid-template-columns: 1fr 1fr; }
  .stat-card .stat-value { font-size: 1rem; }

  /* Smaller tabs */
  .tab { font-size: 0.78rem; padding: 7px 10px; }

  /* Product detail modal */
  .product-modal { padding: 18px !important; }
  .detail-img img { max-height: 240px; }
  .detail-actions { flex-direction: column; }
  .detail-actions .btn { width: 100%; }

  /* Cart drawer wider on small screens */
  .cart-drawer { width: 100% !important; max-width: 100% !important; }

  /* Order rows: stack item actions */
  .order-items-list li { font-size: 0.82rem; }
  .item-btn { padding: 2px 6px; }

  /* Buttons more touch-friendly */
  .btn { min-height: 38px; }
  .btn.small { min-height: 30px; padding: 5px 10px; font-size: 0.78rem; }

  /* Hide some non-critical columns visually if needed */
  .topbar .logo-icon { width: 30px; height: 30px; font-size: 0.85rem; }
}

/* Cart/sliding panels safety: never wider than viewport */
.cart-drawer, .product-modal-bg .product-modal {
  max-width: 100vw;
  box-sizing: border-box;
}

/* ============================================================
   FAB Chat IA (visible en todas las pestañas del admin)
   ============================================================ */
.ai-chat-fab {
  position: fixed;
  right: 20px;
  bottom: 20px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
  font-size: 1.6rem;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(99, 102, 241, 0.45);
  z-index: 9998;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform .15s ease, box-shadow .15s ease;
}
.ai-chat-fab:hover { transform: scale(1.08); box-shadow: 0 10px 28px rgba(99,102,241,.6); }
.ai-chat-fab-icon { line-height: 1; }

.ai-chat-panel {
  position: fixed;
  right: 20px;
  bottom: 88px;
  width: 340px;
  max-width: calc(100vw - 32px);
  height: 460px;
  max-height: calc(100vh - 120px);
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
  display: none;
  flex-direction: column;
  overflow: hidden;
  z-index: 9999;
  border: 1px solid #e5e7eb;
}
.ai-chat-panel.open { display: flex; }

/* Modo pantalla completa (usado en "Pedido personalizado") */
.ai-chat-panel.fullscreen {
  right: 0;
  bottom: 0;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  max-width: 100vw;
  max-height: 100vh;
  border-radius: 0;
  border: none;
}
.ai-chat-panel.fullscreen .ai-chat-messages { font-size: 1rem; padding: 18px; }
.ai-chat-panel.fullscreen .ai-chat-form,
.ai-chat-panel.fullscreen #store-custom-form { padding: 14px 18px; }
.ai-chat-header {
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
}
.ai-chat-sub { font-size: .75rem; opacity: .85; }
.ai-chat-close {
  background: transparent;
  border: none;
  color: #fff;
  font-size: 1.4rem;
  cursor: pointer;
  line-height: 1;
}
.ai-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  background: #f9fafb;
  font-size: .9rem;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.ai-msg { padding: 8px 12px; border-radius: 10px; max-width: 88%; line-height: 1.35; }
.ai-msg.user { background: #6366f1; color: #fff; align-self: flex-end; border-bottom-right-radius: 3px; }
.ai-msg.bot { background: #fff; color: #111827; border: 1px solid #e5e7eb; align-self: flex-start; border-bottom-left-radius: 3px; white-space: pre-wrap; }
.ai-msg.error { background: #fee2e2; color: #991b1b; align-self: flex-start; }
.ai-chat-form {
  display: flex;
  gap: 6px;
  padding: 10px;
  border-top: 1px solid #e5e7eb;
  background: #fff;
}
.ai-chat-form input {
  flex: 1;
  padding: 8px 10px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: .9rem;
}
.ai-chat-form input:focus { outline: none; border-color: #6366f1; }

@media (max-width: 480px) {
  .ai-chat-panel { right: 8px; bottom: 78px; width: calc(100vw - 16px); height: 70vh; }
  .ai-chat-fab { right: 14px; bottom: 14px; }
}

/* ============================================================
   Ganancias extras (panel Pedidos)
   ============================================================ */
.extras-section {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 14px 16px;
  margin: 12px 0 16px;
}
.extras-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.extras-form {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 10px;
  padding: 10px;
  background: #f9fafb;
  border-radius: 8px;
}
.extras-form input[type="number"] { width: 140px; }
.extras-form input[type="text"] { flex: 1; min-width: 180px; }
.extras-form input {
  padding: 7px 10px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: .9rem;
}
.extras-list { display: flex; flex-direction: column; gap: 6px; }
.extras-empty { color: #6b7280; font-size: .85rem; font-style: italic; }
.extra-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 12px;
  background: #f3f4f6;
  border-radius: 6px;
  font-size: .9rem;
}
.extra-row .extra-amount { font-weight: 600; color: #047857; }
.extra-row .extra-desc { flex: 1; color: #374151; }
.extra-row .extra-meta { font-size: .75rem; color: #6b7280; }
.extra-row .btn.danger { padding: 4px 8px; font-size: .75rem; }
.stat-card.stat-extras .stat-value { color: #6366f1; }

.ai-chat-actions { display: flex; align-items: center; gap: 4px; }
.ai-chat-clear {
  background: transparent;
  border: none;
  color: #fff;
  font-size: 1rem;
  cursor: pointer;
  line-height: 1;
  padding: 4px 6px;
  border-radius: 6px;
  opacity: .85;
}
.ai-chat-clear:hover { opacity: 1; background: rgba(255,255,255,.15); }

/* ============================================================
   THEME â€” claro / oscuro / sistema (vÃ­a data-theme en <html>)
   ============================================================ */
:root { color-scheme: light; }
html[data-theme="dark"] { color-scheme: dark; }

/* BotÃ³n toggle de tema (header) */
.theme-toggle {
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.18);
  color: #fff;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  font-weight: 500;
  line-height: 1;
  transition: background .15s ease, transform .15s ease;
}
.theme-toggle:hover { background: rgba(255,255,255,0.2); transform: translateY(-1px); }
.theme-toggle .theme-toggle-icon { font-size: 1rem; line-height: 1; }
.theme-toggle .theme-toggle-label { font-size: 0.8rem; }
@media (max-width: 600px) {
  .theme-toggle .theme-toggle-label { display: none; }
}
/* Variante para usar en pÃ¡ginas sin header oscuro (ej. login) */
.theme-toggle-floating {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 100;
  background: rgba(0,0,0,0.6);
  color: #fff;
  border: none;
}

/* -------- Tema oscuro: override de variables y superficies -------- */
html[data-theme="dark"] {
  --bg: #020617;
  --bg-2: #0f172a;
  --bg-3: #1e293b;
  --card: #1e293b;
  --text: #f1f5f9;
  --text-light: #f8fafc;
  --muted: #94a3b8;
  --primary-light: #312e81;
  --border: #334155;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.4);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.5);
  --shadow-lg: 0 12px 40px rgba(0,0,0,0.6);
}

html[data-theme="dark"] body { background: #1e293b; color: var(--text); }

html[data-theme="dark"] main.container,
html[data-theme="dark"] .container { color: var(--text); }

/* Header se mantiene oscuro siempre; sÃ³lo refuerza el borde */
html[data-theme="dark"] header.topbar { border-bottom-color: rgba(255,255,255,0.08); }

/* Tarjetas, paneles, tablas y formularios genÃ©ricos */
html[data-theme="dark"] .product-card,
html[data-theme="dark"] .login-card,
html[data-theme="dark"] .tab-panel,
html[data-theme="dark"] .modal,
html[data-theme="dark"] .product-modal,
html[data-theme="dark"] .cart-drawer,
html[data-theme="dark"] .extras-section,
html[data-theme="dark"] .payouts-panel,
html[data-theme="dark"] .ai-output,
html[data-theme="dark"] .stat-card,
html[data-theme="dark"] .chat-admin,
html[data-theme="dark"] .chat-clients-pane,
html[data-theme="dark"] .chat-conversation {
  background: #1e293b;
  color: var(--text);
  border-color: var(--border);
}

html[data-theme="dark"] table { color: var(--text); }
html[data-theme="dark"] th { background: #0f172a; color: #cbd5e1; border-color: var(--border); }
html[data-theme="dark"] td { border-color: var(--border); }
html[data-theme="dark"] tr:hover td { background: rgba(255,255,255,0.03); }

html[data-theme="dark"] input,
html[data-theme="dark"] select,
html[data-theme="dark"] textarea {
  background: #0f172a;
  color: var(--text);
  border-color: var(--border);
}
html[data-theme="dark"] input::placeholder,
html[data-theme="dark"] textarea::placeholder { color: #64748b; }

html[data-theme="dark"] .btn.secondary {
  background: #334155;
  color: #f1f5f9;
  border-color: #475569;
}
html[data-theme="dark"] .btn.secondary:hover { background: #475569; }
html[data-theme="dark"] .btn.ghost { color: #f1f5f9; }

html[data-theme="dark"] .extras-form,
html[data-theme="dark"] .extra-row,
html[data-theme="dark"] .ai-chat-messages { background: #0f172a; }
html[data-theme="dark"] .extra-row { color: var(--text); }
html[data-theme="dark"] .extras-empty { color: #94a3b8; }

html[data-theme="dark"] .ai-chat-panel { background: #1e293b; border-color: var(--border); }
html[data-theme="dark"] .ai-msg.bot { background: #1e293b; color: var(--text); border-color: var(--border); }
html[data-theme="dark"] .ai-chat-form { background: #1e293b; border-top-color: var(--border); }

html[data-theme="dark"] .muted { color: #94a3b8; }
html[data-theme="dark"] .section-title,
html[data-theme="dark"] .section-subtitle { color: var(--text); }

/* Cancelled / terminated section title colors stay (use border-left) but text adapts */
html[data-theme="dark"] #orders-active-title,
html[data-theme="dark"] #orders-terminated-section h3,
html[data-theme="dark"] #orders-cancelled-section h3 { color: #e2e8f0; }

/* Alerts (mantener contraste razonable) */
html[data-theme="dark"] .alert.error { background: #450a0a; color: #fecaca; border-color: #7f1d1d; }
html[data-theme="dark"] .alert.success { background: #022c22; color: #a7f3d0; border-color: #064e3b; }

/* Stat cards subtÃ­tulos */
html[data-theme="dark"] .stat-label { color: #94a3b8; }
html[data-theme="dark"] .stat-sub { color: #94a3b8; }

/* -------- Tema oscuro: refuerzos sobre superficies hardcoded -------- */
html[data-theme="dark"] table {
  background: #1e293b;
  border-color: #334155;
  box-shadow: 0 1px 3px rgba(0,0,0,0.5);
}
html[data-theme="dark"] th,
html[data-theme="dark"] td {
  border-bottom-color: #334155 !important;
  color: #f1f5f9;
}
html[data-theme="dark"] th {
  background: #0f172a !important;
  color: #cbd5e1 !important;
}
html[data-theme="dark"] td { background: transparent; }
html[data-theme="dark"] tr:hover td { background: rgba(99,102,241,0.08) !important; }
html[data-theme="dark"] tbody tr { background: #1e293b; }

/* Cards / paneles con fondo blanco hardcoded */
html[data-theme="dark"] .product-card,
html[data-theme="dark"] .product-modal,
html[data-theme="dark"] .modal,
html[data-theme="dark"] .modal-content,
html[data-theme="dark"] .cart-drawer,
html[data-theme="dark"] .login-card,
html[data-theme="dark"] .welcome-popup,
html[data-theme="dark"] .toolbar,
html[data-theme="dark"] .chat-conversation,
html[data-theme="dark"] .chat-clients-pane,
html[data-theme="dark"] .chat-clients-pane .client-item,
html[data-theme="dark"] .stats-grid .stat-card {
  background: #1e293b !important;
  color: #f1f5f9;
  border-color: #334155;
}

/* Cualquier elemento con clase muted o subtítulos secundarios */
html[data-theme="dark"] .muted,
html[data-theme="dark"] .product-card .price + *,
html[data-theme="dark"] .product-name,
html[data-theme="dark"] td .muted { color: #cbd5e1 !important; }

/* Texto principal dentro de tablas (productos, pedidos, etc.) */
html[data-theme="dark"] td,
html[data-theme="dark"] td strong,
html[data-theme="dark"] td a { color: #f1f5f9; }
html[data-theme="dark"] td a:hover { color: #a5b4fc; }

/* Modal del producto (carrito, edit product) */
html[data-theme="dark"] .product-modal-bg,
html[data-theme="dark"] #modal-bg,
html[data-theme="dark"] #crop-modal-bg { background: rgba(0,0,0,0.7); }

/* Inputs / textarea / selects (incluye los de filas de pedidos) */
html[data-theme="dark"] input:not([type="checkbox"]):not([type="radio"]):not([type="color"]),
html[data-theme="dark"] select,
html[data-theme="dark"] textarea {
  background: #0f172a !important;
  color: #f1f5f9 !important;
  border-color: #334155 !important;
}
html[data-theme="dark"] select option { background: #0f172a; color: #f1f5f9; }

/* Botones secundarios genéricos sobre fondo claro */
html[data-theme="dark"] .btn.secondary { background: #334155; color: #f1f5f9; border-color: #475569; }

/* Titulares de secciones de pedidos (tienen color inline hardcodeado) */
html[data-theme="dark"] #orders-active-title,
html[data-theme="dark"] #orders-terminated-section h3,
html[data-theme="dark"] #orders-cancelled-section h3,
html[data-theme="dark"] .tab-panel h3[style*="color"] { color: #f1f5f9 !important; }

/* Cabeceras de tabla en modo oscuro */
html[data-theme="dark"] table thead th { color: #e2e8f0; background: #0f172a; border-bottom-color: #334155; }

/* Cuerpo del carrito y panel de checkout */
html[data-theme="dark"] .cart-item,
html[data-theme="dark"] .cart-summary,
html[data-theme="dark"] .checkout-form { background: #0f172a; color: #f1f5f9; border-color: #334155; }

/* Tabs del admin */
html[data-theme="dark"] .tabs { background: #0f172a; border-color: #334155; }
html[data-theme="dark"] .tab { color: #cbd5e1; }
html[data-theme="dark"] .tab.active { background: #1e293b; color: #a5b4fc; }
html[data-theme="dark"] .tab:hover:not(.active) { background: rgba(255,255,255,0.04); }

/* Sección "Pedidos en proceso / terminados / cancelados" títulos */
html[data-theme="dark"] #orders-active-title,
html[data-theme="dark"] #orders-terminated-section h3,
html[data-theme="dark"] #orders-cancelled-section h3 { color: #e2e8f0 !important; }

/* Forzar contraste de items de pedido (nombres / precios) */
html[data-theme="dark"] .order-items-list,
html[data-theme="dark"] .order-items-list li,
html[data-theme="dark"] .order-items-list strong { color: #f1f5f9; }
html[data-theme="dark"] .order-items-list span[style*="color:#94a3b8"] { color: #94a3b8 !important; }

/* Stat-card valores */
html[data-theme="dark"] .stat-value { color: #f1f5f9; }

/* ============================================================
   STORE CHAT — burbujas teaser + modos + custom order form
   ============================================================ */
.store-chat-teaser {
  position: fixed;
  right: 92px;
  bottom: 28px;
  z-index: 9997;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-end;
  pointer-events: none;
  max-width: calc(100vw - 110px);
}
.store-chat-teaser[aria-hidden="true"] { display: none; }
.store-chat-bubble {
  background: #fff;
  color: #0f172a;
  padding: 10px 14px;
  border-radius: 14px 14px 4px 14px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.18);
  font-size: 0.88rem;
  font-weight: 500;
  border: 1px solid #e5e7eb;
  animation: storeBubbleIn .35s ease both;
  pointer-events: auto;
  max-width: 260px;
}
@keyframes storeBubbleIn {
  from { opacity: 0; transform: translateY(8px) scale(.95); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
html[data-theme="dark"] .store-chat-bubble {
  background: #1e293b;
  color: #f1f5f9;
  border-color: #334155;
}

.store-chat-fab-dot {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #ef4444;
  border: 2px solid #fff;
  animation: storeDotPulse 1.6s infinite;
}
@keyframes storeDotPulse {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.25); }
}
#store-chat-fab.dismissed-dot .store-chat-fab-dot { display: none; }

/* Modos (toggle chat ↔ pedido personalizado) */
.store-chat-modes {
  display: flex;
  gap: 4px;
  padding: 8px 10px 4px;
  background: #fff;
  border-bottom: 1px solid #e5e7eb;
}
html[data-theme="dark"] .store-chat-modes { background: #1e293b; border-bottom-color: #334155; }
.store-chat-mode-btn {
  flex: 1;
  padding: 6px 10px;
  font-size: .8rem;
  border: 1px solid transparent;
  background: #f3f4f6;
  color: #374151;
  border-radius: 8px;
  cursor: pointer;
  transition: background .15s ease;
}
.store-chat-mode-btn:hover { background: #e5e7eb; }
.store-chat-mode-btn.active {
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
  border-color: transparent;
}
html[data-theme="dark"] .store-chat-mode-btn { background: #334155; color: #f1f5f9; }
html[data-theme="dark"] .store-chat-mode-btn:hover { background: #475569; }

/* Botones rápidos (chips) dentro de mensajes del bot */
.store-chat-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.store-chat-chip {
  background: #eef2ff;
  border: 1px solid #c7d2fe;
  color: #4338ca;
  padding: 5px 10px;
  border-radius: 14px;
  font-size: .8rem;
  cursor: pointer;
}
.store-chat-chip:hover { background: #e0e7ff; }
html[data-theme="dark"] .store-chat-chip {
  background: #312e81; border-color: #4f46e5; color: #c7d2fe;
}

/* Form de pedido personalizado */
.store-custom-form {
  padding: 12px;
  background: #fff;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  flex: 1;
}
html[data-theme="dark"] .store-custom-form { background: #1e293b; }
.store-custom-field { display: flex; flex-direction: column; gap: 4px; font-size: .85rem; }
.store-custom-field span { font-weight: 600; color: #374151; }
html[data-theme="dark"] .store-custom-field span { color: #cbd5e1; }
.store-custom-field input,
.store-custom-field textarea {
  padding: 8px 10px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: .88rem;
  font-family: inherit;
}
.store-custom-field input:focus,
.store-custom-field textarea:focus { outline: none; border-color: #6366f1; }
.store-custom-note {
  font-size: .78rem;
  color: #047857;
  margin: 0;
  background: #ecfdf5;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid #a7f3d0;
}
html[data-theme="dark"] .store-custom-note {
  color: #a7f3d0; background: #022c22; border-color: #064e3b;
}

@media (max-width: 480px) {
  .store-chat-teaser { right: 76px; bottom: 22px; max-width: calc(100vw - 90px); }
  .store-chat-bubble { font-size: .82rem; padding: 8px 12px; max-width: 200px; }
}

/* ============================================================
   FASE 2 — Categorías, wishlist, variantes, reseñas, cupón
============================================================ */
.category-chips {
  display: flex; flex-wrap: wrap; gap: 8px;
  padding: 12px 0 18px; justify-content: center;
}
.cat-chip {
  background: var(--bg-card, #fff); color: var(--text, #1e293b);
  border: 1px solid var(--border, #e5e7eb); padding: 8px 14px;
  border-radius: 999px; font-size: 0.85rem; font-weight: 600;
  cursor: pointer; transition: all 0.18s; white-space: nowrap;
}
.cat-chip:hover { border-color: #6366f1; color: #6366f1; }
.cat-chip.active {
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff; border-color: transparent;
}
html[data-theme="dark"] .cat-chip { background: #1e293b; color: #e2e8f0; border-color: #334155; }

.wishlist-heart {
  position: absolute; top: 8px; left: 8px;
  width: 36px; height: 36px; border-radius: 50%;
  background: rgba(255,255,255,0.92); border: none;
  font-size: 1.2rem; line-height: 1; color: #94a3b8;
  cursor: pointer; box-shadow: 0 2px 8px rgba(0,0,0,0.12);
  transition: all 0.18s; z-index: 2;
  display: flex; align-items: center; justify-content: center;
}
.wishlist-heart:hover { transform: scale(1.1); color: #ef4444; }
.wishlist-heart.active { color: #ef4444; background: #fff; }

.detail-variants {
  display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 12px;
}
.detail-variant-opt {
  display: flex; flex-direction: column; gap: 2px;
  padding: 10px 14px; border: 2px solid var(--border, #e5e7eb);
  border-radius: 10px; cursor: pointer; transition: all 0.18s;
  background: var(--bg-card, #fff); min-width: 90px; align-items: center;
}
.detail-variant-opt:hover { border-color: #8b5cf6; }
.detail-variant-opt.active { border-color: #6366f1; background: #eef2ff; }
html[data-theme="dark"] .detail-variant-opt.active { background: #312e81; }
.variant-delta { font-size: 0.75rem; color: #6b7280; font-weight: 600; }
.detail-variant-opt.active .variant-delta { color: #6366f1; }

.detail-thumbs {
  display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap;
}
.detail-thumb {
  width: 56px; height: 56px; object-fit: cover;
  border-radius: 8px; border: 2px solid transparent; cursor: pointer;
  transition: border-color 0.18s;
}
.detail-thumb:hover, .detail-thumb.active { border-color: #6366f1; }

.pm-reviews { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border, #e5e7eb); }
.pm-reviews-title { font-size: 1rem; margin: 0 0 10px; display: flex; align-items: center; gap: 10px; }
.pm-reviews-avg { font-size: 0.85rem; color: #f59e0b; font-weight: 700; }
.pm-reviews-list { display: flex; flex-direction: column; gap: 10px; max-height: 260px; overflow-y: auto; }
.pm-review { background: var(--bg-soft, #f8fafc); padding: 10px 12px; border-radius: 8px; }
.pm-review-head { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.pm-review-stars { color: #f59e0b; font-size: 0.85rem; }
.pm-review-comment { margin: 6px 0 0; font-size: 0.85rem; color: var(--text-soft, #475569); }
html[data-theme="dark"] .pm-review { background: #1e293b; }

.pm-review-form-wrap { margin-top: 14px; }
.pm-review-form-wrap > summary {
  cursor: pointer; font-size: 0.9rem; font-weight: 600; padding: 6px 0;
  color: #6366f1; user-select: none;
}
.pm-review-form { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.pm-review-form input, .pm-review-form textarea {
  padding: 8px 10px; border: 1px solid var(--border, #e5e7eb);
  border-radius: 6px; font-family: inherit; font-size: 0.85rem;
  background: var(--bg-card, #fff); color: var(--text, #1e293b);
}
.pm-stars-input { display: flex; gap: 4px; font-size: 1.5rem; color: #f59e0b; user-select: none; }
.pm-stars-input .star { cursor: pointer; transition: transform 0.1s; }
.pm-stars-input .star:hover { transform: scale(1.15); }
.pm-review-status { font-size: 0.8rem; min-height: 16px; }

.co-coupon-row #co-coupon { text-transform: uppercase; }

/* ============================================================
   FASE 3 — Dashboard, notif bell, filtros avanzados, lang
============================================================ */
.dash-kpis {
  display: grid; gap: 14px; margin: 16px 0 22px;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}
.dash-kpi {
  display: flex; align-items: center; gap: 14px;
  background: var(--bg-card, #fff); border: 1px solid var(--border, #e5e7eb);
  padding: 16px; border-radius: 12px; box-shadow: 0 2px 6px rgba(0,0,0,0.04);
}
.dash-kpi-icon { font-size: 2rem; }
.dash-kpi-val { font-size: 1.4rem; font-weight: 800; color: #6366f1; }
.dash-kpi-lbl { font-size: 0.78rem; color: var(--muted, #64748b); text-transform: uppercase; letter-spacing: 0.5px; }
.dash-charts {
  display: grid; gap: 18px;
  grid-template-columns: repeat(auto-fit, minmax(420px, 1fr));
}
.dash-chart-card {
  background: var(--bg-card, #fff); border: 1px solid var(--border, #e5e7eb);
  padding: 16px; border-radius: 12px;
}
.dash-chart-card h3 { margin: 0 0 12px; font-size: 0.95rem; color: var(--text, #1e293b); }
.dash-chart-card canvas { max-height: 260px; }
html[data-theme="dark"] .dash-kpi,
html[data-theme="dark"] .dash-chart-card { background: #1e293b; border-color: #334155; }

/* Notification bell */
.bell-btn {
  position: relative; background: transparent; border: none; cursor: pointer;
  font-size: 1.3rem; padding: 6px 10px; color: #94a3b8; transition: color 0.18s;
}
.bell-btn:hover { color: #6366f1; }
.bell-count {
  position: absolute; top: 0; right: 0; background: #ef4444; color: #fff;
  font-size: 0.65rem; font-weight: 700; min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 8px; display: flex; align-items: center; justify-content: center;
}
.notif-popover {
  position: absolute; top: 58px; right: 16px; width: 340px; max-height: 460px;
  background: var(--bg-card, #fff); border: 1px solid var(--border, #e5e7eb);
  border-radius: 12px; box-shadow: 0 12px 32px rgba(0,0,0,0.18);
  z-index: 9999; overflow: hidden; display: flex; flex-direction: column;
}
.notif-popover[hidden] { display: none; }
.notif-head { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--border, #e5e7eb); }
.notif-list { overflow-y: auto; max-height: 400px; }
.notif-item {
  display: flex; gap: 10px; padding: 10px 14px; border: none; background: transparent;
  width: 100%; text-align: left; cursor: pointer; border-bottom: 1px solid var(--border, #e5e7eb);
  color: var(--text, #1e293b); font-family: inherit; font-size: 0.85rem;
}
.notif-item:hover { background: var(--bg-soft, #f8fafc); }
.notif-item.fresh { background: rgba(99,102,241,0.08); }
.notif-icon { font-size: 1.3rem; }
.notif-text { flex: 1; line-height: 1.4; }
html[data-theme="dark"] .notif-popover { background: #1e293b; border-color: #334155; }
html[data-theme="dark"] .notif-item:hover { background: #0f172a; }

/* Filtros avanzados */
.filters-advanced { margin: 10px 0; }
.filters-advanced > summary {
  cursor: pointer; font-weight: 600; padding: 8px 12px; background: var(--bg-soft, #f8fafc);
  border-radius: 6px; user-select: none;
}
.filters-grid {
  display: grid; gap: 10px; padding: 14px;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  background: var(--bg-card, #fff); border: 1px solid var(--border, #e5e7eb);
  border-radius: 0 0 8px 8px; margin-top: -2px;
}
.filters-grid label { display: flex; flex-direction: column; gap: 4px; font-size: 0.78rem; color: var(--muted, #64748b); text-transform: uppercase; letter-spacing: 0.4px; }
.filters-grid input { padding: 8px 10px; border: 1px solid var(--border, #e5e7eb); border-radius: 6px; font-size: 0.85rem; background: var(--bg-card, #fff); color: var(--text, #1e293b); }
.filters-actions { display: flex; gap: 6px; align-items: flex-end; }
html[data-theme="dark"] .filters-advanced > summary { background: #0f172a; }
html[data-theme="dark"] .filters-grid { background: #1e293b; border-color: #334155; }

/* ============================================================
   DARK MODE — refuerzo general (aplica en TODA la web)
   Cubre superficies con background:#fff hardcoded y textos en negro
   que no se leían bien antes.
============================================================ */
html[data-theme="dark"] .product { background: #1e293b; border-color: #334155; }
html[data-theme="dark"] .product .name { color: #f1f5f9; }
html[data-theme="dark"] .product .desc { color: #cbd5e1; }
html[data-theme="dark"] .product .price { color: #a5b4fc; }
html[data-theme="dark"] .product .img-wrap { background: linear-gradient(135deg,#0f172a,#1e293b); }
html[data-theme="dark"] .product:hover { border-color: #818cf8; }

/* Tarjeta de bienvenida (welcome-popup) y otros banners */
html[data-theme="dark"] .welcome-popup,
html[data-theme="dark"] .cash-notice,
html[data-theme="dark"] .product-detail,
html[data-theme="dark"] .checkout-modal,
html[data-theme="dark"] .cart-summary,
html[data-theme="dark"] .cart-item,
html[data-theme="dark"] .ad-card,
html[data-theme="dark"] .reviews-section,
html[data-theme="dark"] .review-card,
html[data-theme="dark"] .store-custom-field,
html[data-theme="dark"] .store-custom-field input,
html[data-theme="dark"] .store-custom-field textarea {
  background: #1e293b !important;
  color: #f1f5f9;
  border-color: #334155;
}

/* Textos secundarios que quedaban casi negros sobre fondo oscuro */
html[data-theme="dark"] .product-detail .detail-name,
html[data-theme="dark"] .product-detail .detail-desc,
html[data-theme="dark"] .cart-item-name,
html[data-theme="dark"] .review-text,
html[data-theme="dark"] .review-author,
html[data-theme="dark"] .ad-title,
html[data-theme="dark"] .cash-notice,
html[data-theme="dark"] .checkout-modal label,
html[data-theme="dark"] .filters-grid label { color: #f1f5f9; }
html[data-theme="dark"] .product-detail .detail-desc,
html[data-theme="dark"] .ad-subtitle,
html[data-theme="dark"] .variant-delta { color: #cbd5e1; }

/* Burbujas de chat: la del agente quedaba blanca con texto blanco */
html[data-theme="dark"] .chat-msg.agent,
html[data-theme="dark"] .ai-msg.bot {
  background: #1e293b !important;
  color: #f1f5f9 !important;
  border-color: #334155 !important;
}

/* Inputs heredados que tenían background:#fff propio */
html[data-theme="dark"] .cat-chip { background: #1e293b; color: #e2e8f0; border-color: #334155; }
html[data-theme="dark"] .detail-variant-opt { background: #1e293b; border-color: #334155; color: #f1f5f9; }
html[data-theme="dark"] .detail-variant-opt:hover { border-color: #a78bfa; }

/* Status pills y badges con color de texto fijo: aclarar fondos */
html[data-theme="dark"] .status-pill.confirmed { background: #064e3b; color: #a7f3d0; }
html[data-theme="dark"] .status-select.status-en_fabricacion { background: #1e3a8a; color: #bfdbfe; border-color: #1e40af; }
html[data-theme="dark"] .status-select.status-terminado { background: #064e3b; color: #a7f3d0; border-color: #065f46; }
html[data-theme="dark"] .payout-role.role-owner { background: #064e3b; color: #a7f3d0; }

/* Notas de retiro / amarillos */
html[data-theme="dark"] .cash-notice,
html[data-theme="dark"] [style*="background:#fffbeb"],
html[data-theme="dark"] [style*="background: #fffbeb"] {
  background: #422006 !important;
  color: #fde68a !important;
  border-color: #78350f !important;
}

/* Texto claro forzado para placeholders e iconos heredados */
html[data-theme="dark"] .wishlist-heart { background: rgba(15,23,42,0.85); color: #cbd5e1; }
html[data-theme="dark"] .wishlist-heart.active { color: #ef4444; background: #1e293b; }

/* Chips de color en detalle de producto y admin (eran texto negro sobre #fff) */
html[data-theme="dark"] .detail-color-opt {
  background: #1e293b !important;
  color: #f1f5f9 !important;
  border-color: #334155;
}
html[data-theme="dark"] .detail-color-opt.active {
  background: rgba(99,102,241,0.18) !important;
  color: #c7d2fe !important;
  border-color: #818cf8;
}
html[data-theme="dark"] .detail-colors-label { color: #94a3b8; }
html[data-theme="dark"] .color-chip {
  background: #0f172a !important;
  color: #e2e8f0 !important;
}
html[data-theme="dark"] .product-detail .detail-stock { background: #064e3b; color: #a7f3d0; }
html[data-theme="dark"] .product-detail .detail-stock.out { background: #7f1d1d; color: #fecaca; }

/* Inline styles más estrictos (sin espacio después de los dos puntos) */
html[data-theme="dark"] [style*="background:#f0fdf4"],
html[data-theme="dark"] [style*="background: #f0fdf4"] {
  background: #064e3b !important;
  color: #a7f3d0 !important;
}
html[data-theme="dark"] [style*="background:#fef2f2"],
html[data-theme="dark"] [style*="background: #fef2f2"] {
  background: #422006 !important;
  color: #fecaca !important;
}
html[data-theme="dark"] [style*="color:#1f2937"],
html[data-theme="dark"] [style*="color: #1f2937"],
html[data-theme="dark"] [style*="color:#0f766e"],
html[data-theme="dark"] [style*="color: #0f766e"],
html[data-theme="dark"] [style*="color:#475569"],
html[data-theme="dark"] [style*="color: #475569"] { color: #f1f5f9 !important; }

/* Filas de reparto (payouts) tenían fondo y texto claros hardcoded */
html[data-theme="dark"] .payout-row {
  background: #0f172a !important;
  border: 1px solid #334155;
}
html[data-theme="dark"] .payout-user strong { color: #f1f5f9; }
html[data-theme="dark"] .payout-pct { color: #cbd5e1; }
html[data-theme="dark"] .payout-amount { color: #f1f5f9; }
html[data-theme="dark"] .payout-role { background: #312e81; color: #c7d2fe; }
html[data-theme="dark"] .payout-role.role-owner { background: #064e3b; color: #a7f3d0; }
html[data-theme="dark"] .payout-role.role-admin { background: #78350f; color: #fde68a; }

/* Historial de repartos: las filas usaban var(--bg-soft) que no existe en oscuro */
html[data-theme="dark"] .payout-history-list > div {
  background: #0f172a !important;
  color: #e2e8f0;
  border: 1px solid #334155;
}
html[data-theme="dark"] .payout-history-list > div span:last-child { color: #a5b4fc !important; }

/* ============================================================
   HOME MENU — pantalla principal del admin con botones grandes
============================================================ */
.home-menu { display: block; margin: 12px 0 26px; }
.home-title { margin: 0 0 4px; font-size: 1.4rem; font-weight: 700; }
.home-sub { margin: 0 0 18px; color: var(--muted, #64748b); font-size: 0.92rem; }
.home-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  width: 100%;
}
@media (max-width: 1100px) { .home-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px)  { .home-grid { grid-template-columns: 1fr; } }
.home-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  text-align: center;
  gap: 6px;
  padding: 22px 18px;
  background: var(--card, #fff);
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 14px;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.18s, border-color 0.18s;
  font-family: inherit;
  color: var(--text, #1e293b);
  width: 100%;
  min-height: 150px;
}
.home-card:hover {
  transform: translateY(-2px);
  border-color: var(--primary, #6366f1);
  box-shadow: 0 8px 24px rgba(99,102,241,0.18);
}
.home-card .hc-icon { font-size: 2.6rem; line-height: 1; margin-bottom: 6px; }
.home-card .hc-name { font-size: 1.05rem; font-weight: 700; }
.home-card .hc-desc { font-size: 0.84rem; color: var(--muted, #64748b); line-height: 1.35; }

/* Barra de retorno al menú */
.group-bar {
  display: flex; align-items: center; gap: 12px;
  margin: 4px 0 14px;
}
.group-label { font-weight: 600; color: var(--muted, #64748b); font-size: 0.9rem; text-transform: uppercase; letter-spacing: 0.06em; }

/* Cuando estamos en modo "home", oculta tabs y paneles */
body.home-mode .tabs,
body.home-mode .tab-panel,
body.home-mode #group-bar { display: none !important; }
body:not(.home-mode) #home-menu { display: none; }

/* Agenda */
.agenda-day {
  margin-bottom: 18px;
  background: var(--card, #fff);
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 10px;
  overflow: hidden;
}
.agenda-day-header {
  padding: 10px 14px;
  background: var(--primary-light, #eef2ff);
  font-weight: 700;
  color: var(--primary, #4f46e5);
  text-transform: capitalize;
}
.agenda-item {
  padding: 12px 14px;
  border-top: 1px solid var(--border, #e5e7eb);
  display: grid;
  grid-template-columns: 90px 1fr auto;
  gap: 12px;
  align-items: center;
}
.agenda-item:first-child { border-top: none; }
.agenda-item .ag-time { font-weight: 700; font-family: monospace; font-size: 0.95rem; color: var(--primary, #4f46e5); }
.agenda-item .ag-customer { font-size: 0.85rem; color: var(--muted, #64748b); }
.agenda-item .ag-overdue { color: #dc2626; }

html[data-theme="dark"] .agenda-day { background: #0f172a; border-color: #334155; }
html[data-theme="dark"] .agenda-day-header { background: #312e81; color: #c7d2fe; }
html[data-theme="dark"] .agenda-item { border-color: #334155; }
html[data-theme="dark"] .agenda-item .ag-time { color: #a5b4fc; }

@media (max-width: 600px) {
  .home-grid { grid-template-columns: 1fr; }
  .agenda-item { grid-template-columns: 1fr; gap: 4px; }
}

/* ============================================================
   PANEL IA — chatbot con sidebar y vision
   ============================================================ */
.ai-page {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 14px;
  height: calc(100vh - 240px);
  min-height: 460px;
  width: 100%;
  box-sizing: border-box;
}
.ai-page > .ai-sidebar,
.ai-page > .ai-main { min-width: 0; min-height: 0; }
/* El panel IA usa todo el ancho del .container sin romperlo (sin 100vw)
   para evitar scroll horizontal por culpa del scrollbar vertical. */
#panel-ai { width: 100%; box-sizing: border-box; }
@media (max-width: 900px) {
  .ai-page { grid-template-columns: 1fr; height: auto; min-height: 0; }
}
.ai-sidebar {
  background: var(--card, #fff);
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 12px;
  display: flex; flex-direction: column;
  overflow: hidden;
}
.ai-sidebar-top { padding: 10px; border-bottom: 1px solid var(--border, #e5e7eb); }
.ai-conv-list { flex: 1; overflow-y: auto; }
.ai-conv-item {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px; cursor: pointer;
  border-bottom: 1px solid var(--border, #f1f5f9);
  font-size: 0.88rem;
}
.ai-conv-item:hover { background: rgba(99,102,241,0.06); }
.ai-conv-item.active { background: rgba(99,102,241,0.12); font-weight: 600; }
.ai-conv-title { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ai-conv-del {
  background: none; border: 0; cursor: pointer; color: #94a3b8;
  font-size: 1.1rem; padding: 0 4px; opacity: 0;
}
.ai-conv-item:hover .ai-conv-del { opacity: 1; }
.ai-conv-del:hover { color: #dc2626; }

.ai-main {
  background: var(--card, #fff);
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 12px;
  display: flex; flex-direction: column;
  overflow: hidden;
}
.ai-main-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 14px; border-bottom: 1px solid var(--border, #e5e7eb);
}
.ai-messages {
  flex: 1; overflow-y: auto; padding: 20px 24px;
  display: flex; flex-direction: column; gap: 12px;
  background: var(--bg, #f8fafc);
}
.ai-msg-row { display: flex; }
.ai-msg-row.user { justify-content: flex-end; }
.ai-msg-row.assistant { justify-content: flex-start; }
.ai-msg-bubble {
  max-width: min(72ch, 80%);
  padding: 12px 16px;
  border-radius: 14px;
  font-size: 0.95rem;
  line-height: 1.55;
  word-break: break-word;
}
.ai-msg-bubble.user { background: #6366f1; color: #fff; border-bottom-right-radius: 4px; }
.ai-msg-bubble.assistant { background: var(--card, #fff); color: var(--text, #1e293b); border: 1px solid var(--border, #e5e7eb); border-bottom-left-radius: 4px; }
.ai-msg-text { white-space: pre-wrap; }
.ai-msg-bubble .ai-code {
  background: rgba(0,0,0,0.25); color: #fff;
  padding: 8px 10px; border-radius: 6px;
  font-family: ui-monospace, monospace; font-size: 0.82rem;
  overflow-x: auto; margin: 6px 0;
}
.ai-msg-bubble.assistant .ai-code { background: #0f172a; color: #e2e8f0; }
.ai-att-img { max-width: 260px; max-height: 260px; border-radius: 8px; display: block; margin-bottom: 6px; }
.ai-att-file { padding: 6px 10px; background: rgba(0,0,0,0.08); border-radius: 8px; font-size: 0.82rem; margin-bottom: 4px; }

.ai-attachments-preview {
  display: flex; flex-wrap: wrap; gap: 6px;
  padding: 0 14px; min-height: 0;
}
.ai-attachments-preview:not(:empty) { padding: 8px 14px; border-top: 1px solid var(--border, #e5e7eb); }
.ai-att-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 8px 4px 4px; background: var(--bg, #f1f5f9);
  border: 1px solid var(--border, #e5e7eb); border-radius: 999px;
  font-size: 0.78rem;
}
.ai-att-chip img { width: 24px; height: 24px; border-radius: 50%; object-fit: cover; }
.ai-att-name { max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ai-att-x { background: none; border: 0; cursor: pointer; color: #64748b; font-size: 1rem; padding: 0 4px; }
.ai-att-x:hover { color: #dc2626; }

.ai-input-form {
  display: flex; gap: 8px; padding: 10px 14px;
  border-top: 1px solid var(--border, #e5e7eb);
  align-items: flex-end;
}
.ai-attach-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; border-radius: 8px;
  background: var(--bg, #f1f5f9); cursor: pointer; font-size: 1.1rem;
  flex-shrink: 0; transition: background 0.15s;
}
.ai-attach-btn:hover { background: rgba(99,102,241,0.15); }
#ai-input {
  flex: 1; min-height: 38px; max-height: 160px; resize: none;
  padding: 9px 12px; border: 1px solid var(--border, #e5e7eb); border-radius: 8px;
  font-family: inherit; font-size: 0.92rem; background: var(--bg, #fff); color: var(--text, #1e293b);
}

/* Dark mode */
html[data-theme="dark"] .ai-sidebar,
html[data-theme="dark"] .ai-main { background: #1e293b; border-color: #334155; }
html[data-theme="dark"] .ai-conv-item { border-bottom-color: #334155; }
html[data-theme="dark"] .ai-conv-item:hover { background: rgba(99,102,241,0.15); }
html[data-theme="dark"] .ai-conv-item.active { background: rgba(99,102,241,0.25); }
html[data-theme="dark"] .ai-messages { background: #0f172a; }
html[data-theme="dark"] .ai-msg-bubble.assistant { background: #1e293b; border-color: #334155; color: #e2e8f0; }
html[data-theme="dark"] .ai-att-chip { background: #0f172a; border-color: #334155; color: #e2e8f0; }
html[data-theme="dark"] .ai-attach-btn { background: #0f172a; color: #e2e8f0; }
html[data-theme="dark"] #ai-input { background: #0f172a; color: #e2e8f0; border-color: #334155; }

@media (max-width: 800px) {
  .ai-page { grid-template-columns: 1fr; height: auto; }
  .ai-sidebar { max-height: 220px; }
}

/* Ocultar TOTALMENTE la barra superior de Google Translate. Si el usuario
   la cierra con la X de Google, ese widget también resetea la cookie y vuelve
   al idioma original; para evitarlo, simplemente la quitamos del flujo. */
.goog-te-banner-frame,
.goog-te-banner-frame.skiptranslate,
iframe.goog-te-banner-frame,
iframe.skiptranslate,
.goog-logo-link,
.goog-te-gadget span,
.goog-te-gadget-icon,
#goog-gt-tt,
.VIpgJd-ZVi9od-aZ2wEe-wOHMyf,
.VIpgJd-ZVi9od-aZ2wEe-OiiCO {
  display: none !important;
  visibility: hidden !important;
  height: 0 !important;
  width: 0 !important;
  opacity: 0 !important;
  pointer-events: none !important;
}
html, body { top: 0 !important; position: static !important; }
.goog-tooltip, .goog-tooltip:hover { display: none !important; }
.goog-text-highlight { background: transparent !important; box-shadow: none !important; }




/* ===================================================================
   MOBILE / TABLET RESPONSIVE
   Aplica a teléfonos (≤640px) y tablets pequeñas (≤900px).
=================================================================== */

/* Safe-area en iPhones con notch (cuando se instala como app) */
@supports (padding: env(safe-area-inset-top)) {
  body {
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
  }
}

/* ---------- Tablet (≤900px) ---------- */
@media (max-width: 900px) {
  .container { padding: 18px 14px; }
  header.topbar { padding: 10px 14px; gap: 8px; }
  header.topbar h1 { font-size: 1.1rem; }
  header.topbar .logo-icon { width: 34px; height: 34px; font-size: 0.85rem; }
  header.topbar nav { gap: 6px; }
}

/* ---------- Mobile (≤640px) ---------- */
@media (max-width: 640px) {
  /* Topbar compacta: logo + iconos esenciales */
  header.topbar {
    flex-wrap: wrap;
    padding: 8px 10px;
    gap: 6px;
  }
  header.topbar h1 { display: none; }              /* solo el cuadradito 3D */
  header.topbar .logo-icon { width: 36px; height: 36px; }
  header.topbar nav { flex: 1; justify-content: flex-end; }
  header.topbar nav .btn { padding: 8px 10px; font-size: 0.85rem; }
  /* Login link reducido a icono */
  #account-login-link {
    font-size: 0; padding: 8px 10px;
  }
  #account-login-link::before { content: '👤'; font-size: 1.1rem; }
  /* Tema toggle: solo icono */
  .theme-toggle .theme-toggle-label { display: none; }
  /* Búsqueda: ocupa todo el ancho cuando se expande */
  .search-bar.expanded,
  .search-bar.has-value {
    position: absolute; top: 56px; left: 8px; right: 8px;
    z-index: 50; background: var(--bg-elev, #1e293b);
    padding: 6px;
  }

  /* Modales: full-screen en mobile, scroll interno */
  .modal-bg .modal,
  .modal {
    max-width: 100% !important;
    width: 100% !important;
    min-height: 100vh;
    max-height: 100vh;
    border-radius: 0 !important;
    margin: 0 !important;
    padding: 18px !important;
    overflow-y: auto;
  }
  .modal-bg { align-items: flex-start; padding: 0 !important; }

  /* Cart drawer ocupa todo el ancho */
  .cart-drawer { width: 100% !important; max-width: 100% !important; }

  /* Carrito footer fijo para que el botón "Pagar" no se pierda */
  .cart-footer {
    position: sticky; bottom: 0; padding-bottom: max(12px, env(safe-area-inset-bottom));
  }

  /* Mi cuenta: tabs con scroll horizontal en vez de wrap */
  .ac-tabs {
    overflow-x: auto; -webkit-overflow-scrolling: touch;
    flex-wrap: nowrap !important;
    scrollbar-width: none;
  }
  .ac-tabs::-webkit-scrollbar { display: none; }
  .ac-tab { flex: 0 0 auto; white-space: nowrap; }

  /* Tarjetas de producto en grid pequeño */
  .grid-products { gap: 10px; }
  .product-card { font-size: 0.9rem; }

  /* Tablas admin: scroll horizontal sin romper el layout */
  .container table,
  .tab-panel table,
  table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    white-space: nowrap;
  }

  /* Admin: pestañas con scroll horizontal */
  .admin-tabs,
  .tabs,
  [role="tablist"] {
    overflow-x: auto; -webkit-overflow-scrolling: touch;
    flex-wrap: nowrap;
    scrollbar-width: none;
  }
  .admin-tabs::-webkit-scrollbar,
  .tabs::-webkit-scrollbar { display: none; }

  /* Login: padding compacto */
  body.login-wrap { padding: 12px !important; }
  .login-card { padding: 20px !important; max-width: 100% !important; }

  /* Botones más cómodos al tap (44px mínimo recomendado iOS) */
  .btn { min-height: 44px; }
  input, select, textarea { min-height: 44px; font-size: 16px; }
  /* font-size 16px evita el zoom automático en iOS Safari */

  /* Kiosko: grid 2 columnas */
  .kiosk-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 12px !important; padding: 12px !important;
  }
  .kiosk-cta { padding: 12px 18px !important; font-size: 0.95rem !important; }

  /* PayPal card fields: padding más cómodo */
  .card-field { min-height: 48px; padding: 0 10px; }
}

/* ---------- Mobile muy pequeño (≤380px) ---------- */
@media (max-width: 380px) {
  .grid-products { grid-template-columns: 1fr !important; }
  header.topbar nav .btn { padding: 6px 8px; }
  .cart-btn { padding: 6px 10px !important; }
}

/* ---------- Modo standalone (app instalada) ---------- */
@media all and (display-mode: standalone) {
  /* Oculta el banner de instalación si quedara remanente */
  #pwa-install-banner { display: none !important; }
  /* Un poco más de respiro arriba para el notch */
  header.topbar { padding-top: max(10px, env(safe-area-inset-top)); }
}



/* ===== Chat interno staff/admin/owner — DMs + Grupos
   Pestaña embebida, layout sidebar + main (similar al panel IA) ===== */
.staff-chat-page {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 14px;
  height: calc(100vh - 240px);
  min-height: 480px;
}
.staff-chat-sidebar {
  display: flex; flex-direction: column;
  background: var(--card, #fff);
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 12px;
  overflow: hidden;
}
.staff-chat-sidebar-tabs {
  display: flex; gap: 4px;
  padding: 8px; border-bottom: 1px solid var(--border, #e5e7eb);
}
.staff-chat-stab {
  flex: 1; padding: 7px 10px;
  background: transparent; border: 0; border-radius: 8px;
  font-family: inherit; font-size: 0.85rem; font-weight: 600;
  color: var(--muted, #64748b); cursor: pointer;
  transition: background 0.12s, color 0.12s;
}
.staff-chat-stab:hover { background: var(--bg-2, #f1f5f9); color: var(--text); }
.staff-chat-stab.active { background: var(--primary, #6366f1); color: #fff; }
.staff-chat-sidebar-actions { padding: 8px; border-bottom: 1px solid var(--border, #e5e7eb); }
.staff-chat-list {
  flex: 1; overflow-y: auto; padding: 6px;
}
.staff-chat-contact {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 10px;
  cursor: pointer; transition: background 0.12s;
  color: var(--text);
}
.staff-chat-contact:hover { background: var(--bg-2, #f1f5f9); }
.staff-chat-contact.selected { background: rgba(99,102,241,0.12); }
.staff-chat-contact__avatar {
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--primary-light, #eef2ff); color: var(--primary, #4f46e5);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; flex-shrink: 0; font-size: 0.95rem;
}
.staff-chat-contact__info { flex: 1; min-width: 0; }
.staff-chat-contact__name { font-weight: 600; font-size: 0.9rem; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.staff-chat-contact__last { font-size: 0.78rem; color: var(--muted, #64748b); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.staff-chat-contact__unread {
  min-width: 22px; height: 22px; padding: 0 7px;
  background: #ef4444; color: #fff;
  border-radius: 11px;
  font-size: 0.72rem; font-weight: 700; line-height: 22px;
  text-align: center; flex-shrink: 0;
}

.staff-chat-main {
  display: flex; flex-direction: column;
  background: var(--card, #fff);
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 12px;
  overflow: hidden;
  min-width: 0;
}
.staff-chat-main-header {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border, #e5e7eb);
  background: #f8fafc;
}
.staff-chat-main-header strong { flex: 1; font-size: 0.95rem; color: var(--text); }
.staff-chat-messages {
  flex: 1; overflow-y: auto; padding: 16px;
  display: flex; flex-direction: column; gap: 6px;
  background: #f8fafc;
}
.staff-chat-msg {
  max-width: 78%; padding: 8px 12px; border-radius: 14px;
  font-size: 0.88rem; line-height: 1.4;
  word-wrap: break-word;
}
.staff-chat-msg--mine   { align-self: flex-end;   background: var(--primary, #6366f1); color: #fff; border-bottom-right-radius: 4px; }
.staff-chat-msg--theirs { align-self: flex-start; background: #fff; color: var(--text); border: 1px solid var(--border, #e5e7eb); border-bottom-left-radius: 4px; }
.staff-chat-msg__meta   { display: block; font-size: 0.65rem; opacity: 0.75; margin-top: 3px; }
.staff-chat-msg__author { display: block; font-size: 0.72rem; font-weight: 700; color: var(--primary, #4f46e5); margin-bottom: 2px; }
.staff-chat-msg--mine .staff-chat-msg__author { color: rgba(255,255,255,0.85); }

.staff-chat-form {
  display: flex; gap: 8px; padding: 10px;
  border-top: 1px solid var(--border, #e5e7eb);
  background: var(--card, #fff);
}
.staff-chat-form input { flex: 1; padding: 8px 12px; }

/* Picker de personas en modal (crear/invitar a grupo) */
.staff-pick-list {
  max-height: 280px; overflow-y: auto;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 8px;
  padding: 6px;
}
.staff-pick-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 6px;
  cursor: pointer; user-select: none;
}
.staff-pick-row:hover { background: var(--bg-2, #f1f5f9); }
.staff-pick-row input { width: auto; margin: 0; }

html[data-theme="dark"] .staff-chat-sidebar,
html[data-theme="dark"] .staff-chat-main { background: #1e293b; border-color: #334155; }
html[data-theme="dark"] .staff-chat-main-header,
html[data-theme="dark"] .staff-chat-messages { background: #0f172a; }
html[data-theme="dark"] .staff-chat-msg--theirs { background: #1e293b; color: #f1f5f9; border-color: #334155; }
html[data-theme="dark"] .staff-chat-contact:hover,
html[data-theme="dark"] .staff-pick-row:hover { background: #0f172a; }
html[data-theme="dark"] .staff-chat-contact.selected { background: rgba(99,102,241,0.25); }
html[data-theme="dark"] .staff-pick-list { border-color: #334155; }

@media (max-width: 800px) {
  .staff-chat-page {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
    height: calc(100vh - 200px);
  }
  .staff-chat-sidebar { max-height: 40vh; }
}

/* ===== Banner / carousel — alturas responsivas para que la imagen no
   quede deformada en móvil. Aspect-ratio cambia según viewport. ===== */
@media (max-width: 900px) {
  .carousel-slide img { aspect-ratio: 16 / 6; max-height: 280px; }
  .carousel-caption  { padding: 28px 18px 14px; }
  .carousel-caption strong { font-size: 1.1rem; }
}
@media (max-width: 640px) {
  .carousel-slide img { aspect-ratio: 4 / 3; max-height: 320px; }
  .carousel-caption  { padding: 20px 14px 12px; }
  .carousel-caption strong { font-size: 1rem; }
  .carousel-arrow { width: 36px; height: 36px; font-size: 1.1rem; }
  .carousel-arrow.prev { left: 8px; }
  .carousel-arrow.next { right: 8px; }
}

/* ===== Impresoras 3D ===== */
.printers-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}
.printer-card {
  background: var(--card, #fff);
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 12px;
  padding: 14px;
  display: flex; flex-direction: column; gap: 10px;
}
.printer-card__head { display: flex; align-items: center; gap: 10px; }
.printer-card__name { font-weight: 700; font-size: 1rem; flex: 1; color: var(--text); }
.printer-card__brand { font-size: 0.7rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; }
.printer-card__status {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 8px; border-radius: 999px;
  font-size: 0.72rem; font-weight: 700;
  background: #f1f5f9; color: #475569;
}
.printer-card__status.printing  { background: #dbeafe; color: #1e40af; }
.printer-card__status.preparing { background: #fef3c7; color: #92400e; }
.printer-card__status.paused    { background: #fef3c7; color: #92400e; }
.printer-card__status.finished  { background: #d1fae5; color: #065f46; }
.printer-card__status.error     { background: #fee2e2; color: #991b1b; }
.printer-card__status.offline   { background: #e5e7eb; color: #6b7280; }
.printer-card__file {
  font-size: 0.82rem; color: var(--text);
  background: #f8fafc; border: 1px solid var(--border, #e5e7eb);
  border-radius: 8px; padding: 6px 10px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.printer-card__progress { width: 100%; height: 8px; background: #e2e8f0; border-radius: 999px; overflow: hidden; }
.printer-card__progress-bar { height: 100%; background: linear-gradient(90deg, var(--primary, #6366f1), #4f46e5); transition: width 0.5s; }
.printer-card__stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; font-size: 0.78rem; color: var(--muted); }
.printer-card__stat strong { display: block; color: var(--text); font-size: 0.9rem; font-weight: 700; }
.printer-card__actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.printer-card__last { font-size: 0.7rem; color: var(--muted); }

html[data-theme="dark"] .printer-card { background: #1e293b; border-color: #334155; }
html[data-theme="dark"] .printer-card__file { background: #0f172a; border-color: #334155; }

/* ============================================================
   GAMES PANEL — mini juegos del admin
   ============================================================ */
.games-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px;
  margin-top: 14px;
}
.game-card {
  background: var(--card, #fff);
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 14px;
  padding: 18px 14px;
  display: flex; flex-direction: column; align-items: center;
  text-align: center; gap: 8px;
  cursor: pointer;
  transition: transform 0.12s, box-shadow 0.12s;
  color: var(--text);
}
.game-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(0,0,0,0.08);
}
.game-card__icon { font-size: 2.2rem; }
.game-card__name { font-weight: 700; font-size: 1rem; }
.game-card__desc { font-size: 0.78rem; color: var(--muted); }
html[data-theme="dark"] .game-card { background: #1e293b; border-color: #334155; }

.game-stage {
  background: var(--card, #fff);
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 14px;
  padding: 16px;
  margin-top: 14px;
}
.game-stage__header {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 14px;
}
.game-stage__title { font-size: 1.05rem; }
.game-stage__body { display: flex; justify-content: center; }
html[data-theme="dark"] .game-stage { background: #1e293b; border-color: #334155; }

/* --- TicTacToe --- */
.ttt { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.ttt-board { display: grid; grid-template-columns: repeat(3, 84px); grid-gap: 6px; }
.ttt-cell {
  width: 84px; height: 84px; font-size: 2rem; font-weight: 800;
  background: #f1f5f9; border: 1px solid #cbd5e1; border-radius: 10px;
  cursor: pointer; color: var(--text);
}
.ttt-cell:hover { background: #e2e8f0; }
.ttt-status { font-weight: 600; }

/* --- Snake / Pong --- */
.snake-wrap, .pong-wrap { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.snake-info, .pong-info { display: flex; gap: 14px; align-items: center; }
#snake-canvas, #pong-cv { background: #0f172a; border-radius: 10px; max-width: 100%; }

/* --- 2048 --- */
.g2048 { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.g2048-board {
  display: grid; grid-template-columns: repeat(4, 70px); gap: 6px;
  background: #cbd5e1; padding: 6px; border-radius: 10px;
}
.g2048-cell {
  width: 70px; height: 70px; display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 1.2rem; border-radius: 6px; background: #f8fafc; color: #0f172a;
}
.g2048-cell.v2    { background: #fef3c7; }
.g2048-cell.v4    { background: #fde68a; }
.g2048-cell.v8    { background: #fdba74; color: #fff; }
.g2048-cell.v16   { background: #fb923c; color: #fff; }
.g2048-cell.v32   { background: #f97316; color: #fff; }
.g2048-cell.v64   { background: #ea580c; color: #fff; }
.g2048-cell.v128  { background: #fbbf24; color: #fff; }
.g2048-cell.v256  { background: #f59e0b; color: #fff; }
.g2048-cell.v512  { background: #d97706; color: #fff; }
.g2048-cell.v1024 { background: #b45309; color: #fff; font-size: 1rem; }
.g2048-cell.v2048 { background: #7c2d12; color: #fff; font-size: 1rem; }

/* --- Minesweeper --- */
.ms { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.ms-info { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.ms-board { display: grid; grid-template-columns: repeat(9, 32px); gap: 2px; background: #94a3b8; padding: 4px; border-radius: 6px; }
.ms-cell { width: 32px; height: 32px; background: #cbd5e1; border: 0; border-radius: 4px; font-weight: 700; cursor: pointer; }
.ms-cell.open { background: #e2e8f0; }
.ms-cell.mine { background: #ef4444; color: #fff; }
.ms-cell[data-n="1"] { color: #2563eb; }
.ms-cell[data-n="2"] { color: #16a34a; }
.ms-cell[data-n="3"] { color: #dc2626; }
.ms-cell[data-n="4"] { color: #7c3aed; }
.ms-cell[data-n="5"] { color: #b45309; }
.ms-cell[data-n="6"] { color: #0e7490; }

/* --- Memory --- */
.mem { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.mem-info { display: flex; gap: 14px; align-items: center; }
.mem-board { display: grid; grid-template-columns: repeat(4, 70px); gap: 8px; }
.mem-card {
  width: 70px; height: 70px; position: relative; perspective: 600px;
  background: transparent; border: 0; padding: 0; cursor: pointer;
}
.mem-card .mem-front, .mem-card .mem-back {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  border-radius: 10px; backface-visibility: hidden;
  font-size: 1.7rem; font-weight: 800;
}
.mem-card .mem-front { background: #6366f1; color: #fff; }
.mem-card .mem-back  { background: #f8fafc; color: #0f172a; transform: rotateY(180deg); border: 1px solid #cbd5e1; }
.mem-card.flip .mem-front { transform: rotateY(180deg); }
.mem-card.flip .mem-back  { transform: rotateY(0); }
.mem-card .mem-front, .mem-card .mem-back { transition: transform 0.35s; }

/* --- Reacción --- */
.rxn { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.rxn-light {
  width: 260px; height: 200px; display: flex; align-items: center; justify-content: center;
  background: #1e293b; color: #fff; border-radius: 14px; font-weight: 700; cursor: pointer;
  font-size: 1.1rem; text-align: center; padding: 12px;
}
.rxn-light.wait  { background: #b45309; }
.rxn-light.go    { background: #10b981; font-size: 1.6rem; }
.rxn-light.early { background: #dc2626; }
.rxn-result { font-size: 1.4rem; font-weight: 800; color: var(--text); }

/* --- Whack a Mole --- */
.wm { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.wm-info { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.wm-board { display: grid; grid-template-columns: repeat(3, 90px); gap: 8px; }
.wm-cell { width: 90px; height: 90px; background: #94a3b8; border: 0; border-radius: 50%; font-size: 2rem; cursor: pointer; }
.wm-cell.on { background: #10b981; }

/* --- Guess --- */
.guess { display: flex; flex-direction: column; gap: 10px; max-width: 320px; width: 100%; }
.guess-msg { font-weight: 600; }
.guess-msg.ok { color: #10b981; }

/* --- Hangman --- */
.hg { display: flex; flex-direction: column; gap: 10px; align-items: center; max-width: 460px; width: 100%; }
.hg-art { font-family: ui-monospace, Menlo, monospace; font-size: 0.95rem; line-height: 1.1; }
.hg-word { font-size: 1.5rem; letter-spacing: 0.3rem; font-weight: 800; }
.hg-keys { display: grid; grid-template-columns: repeat(9, 1fr); gap: 4px; }
.hg-key { padding: 6px 4px; border-radius: 6px; border: 1px solid #cbd5e1; background: #f8fafc; cursor: pointer; font-weight: 700; }
.hg-key.used { opacity: 0.5; cursor: default; }
.hg-key.wrong { background: #fee2e2; color: #991b1b; }
.hg-status { font-weight: 600; }

/* --- RPS --- */
.rps { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.rps-row { display: flex; gap: 10px; }
.rps-btn { display: flex; flex-direction: column; align-items: center; padding: 14px 18px; font-size: 2rem; background: #f1f5f9; border: 1px solid #cbd5e1; border-radius: 12px; cursor: pointer; }
.rps-btn span { display: block; font-size: 0.78rem; color: var(--muted); margin-top: 4px; text-transform: capitalize; }
.rps-score { font-weight: 700; }
.rps-msg { font-weight: 600; }

/* --- Simón --- */
.simon { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.simon-grid { display: grid; grid-template-columns: repeat(2, 110px); gap: 8px; }
.simon-pad { width: 110px; height: 110px; border: 0; border-radius: 12px; cursor: pointer; opacity: 0.85; transition: opacity 0.1s, transform 0.05s; }
.simon-pad.red    { background: #ef4444; }
.simon-pad.green  { background: #10b981; }
.simon-pad.blue   { background: #3b82f6; }
.simon-pad.yellow { background: #facc15; }
.simon-pad.on     { opacity: 1; transform: scale(1.04); box-shadow: 0 0 0 4px rgba(255,255,255,0.5); }
.simon-info { display: flex; gap: 12px; align-items: center; }
