/* ================================================================
   Amoblarthe — App Design System
   Compartido por: panel admin (back-office) y storefront público.
   Coherente con auth.css (login).
   ================================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
  /* Brand */
  --brand: #8b5a2b;
  --brand-light: #b07a4a;
  --brand-dark: #5a3a1a;
  --accent: #2f8b85;
  --accent-light: #6dbab4;

  /* Backgrounds */
  --bg-cream: #f7f1e6;
  --bg-cream-2: #faf5eb;
  --bg-paper: #ffffff;
  --bg-soft: #f0e4d0;

  /* Text */
  --text: #2a1f15;
  --text-soft: rgba(42, 31, 21, 0.7);
  --text-muted: rgba(42, 31, 21, 0.55);

  /* Lines */
  --line: rgba(139, 90, 43, 0.14);
  --line-soft: rgba(139, 90, 43, 0.08);

  /* States */
  --ok: #2e7d32;
  --ok-bg: rgba(46, 125, 50, 0.1);
  --warn: #b8651b;
  --warn-bg: rgba(184, 101, 27, 0.12);
  --danger: #c44545;
  --danger-bg: rgba(196, 69, 69, 0.1);
  --info: #2f6e8b;
  --info-bg: rgba(47, 110, 139, 0.1);

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(90, 58, 26, 0.06);
  --shadow-md: 0 4px 12px -2px rgba(90, 58, 26, 0.12),
               0 2px 4px -2px rgba(90, 58, 26, 0.08);
  --shadow-lg: 0 16px 40px -12px rgba(90, 58, 26, 0.2),
               0 4px 12px -4px rgba(90, 58, 26, 0.12);

  /* Radius */
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 22px;

  /* Spacing scale */
  --gap-xs: 6px;
  --gap-sm: 10px;
  --gap-md: 16px;
  --gap-lg: 24px;
  --gap-xl: 36px;

  /* Glass */
  --glass-bg: rgba(255, 255, 255, 0.62);
  --glass-bg-strong: rgba(255, 255, 255, 0.78);
  --glass-border: rgba(255, 255, 255, 0.7);
}

/* ================================================================
   RESET / BASE
   ================================================================ */
.app-body { background: var(--bg-cream); margin: 0; }
.app-body main { max-width: none; padding: 0; margin: 0; }

/* Hide global topbar/footer when using admin shell */
.app-body .topbar,
.app-body .site-topbar,
.app-body .foot,
.app-body .site-foot { display: none !important; }

.app-page {
  min-height: 100vh;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: var(--text);
  position: relative;
  background:
    radial-gradient(ellipse 90% 60% at 0% 0%, #f3e7d4 0%, transparent 55%),
    radial-gradient(ellipse 80% 60% at 100% 100%, #e8d8c1 0%, transparent 50%),
    linear-gradient(180deg, var(--bg-cream-2) 0%, var(--bg-cream) 100%);
}

/* Subtle grid pattern in the background */
.app-page::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(139, 90, 43, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(139, 90, 43, 0.03) 1px, transparent 1px);
  background-size: 56px 56px;
  pointer-events: none;
  z-index: 0;
}

* { box-sizing: border-box; }
.app-page * { font-family: inherit; }
a { color: var(--brand); text-decoration: none; transition: color 0.15s; }
a:hover { color: var(--brand-dark); }

/* ================================================================
   TOPBAR (admin nav)
   ================================================================ */
.app-topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: var(--gap-lg);
  padding: 12px 28px;
  background: rgba(247, 241, 230, 0.85);
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  border-bottom: 1px solid var(--line);
}
.app-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none !important;
  color: var(--text);
  flex-shrink: 0;
}
.app-brand-mark {
  width: 40px; height: 40px;
  border-radius: 11px;
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-dark) 60%, var(--accent) 100%);
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  box-shadow: 0 6px 14px -3px rgba(139, 90, 43, 0.45),
              inset 0 1px 0 rgba(255,255,255,0.4);
  flex-shrink: 0;
  transition: transform 0.2s ease;
}
.app-brand:hover .app-brand-mark { transform: rotate(-3deg) scale(1.05); }
.app-brand-text {
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  background: linear-gradient(135deg, var(--brand-dark) 0%, var(--brand) 60%, var(--accent) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  line-height: 1;
}

.app-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1;
}
.app-nav a {
  padding: 8px 14px;
  border-radius: 9px;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-soft);
  transition: all 0.15s;
  display: flex;
  align-items: center;
  gap: 7px;
}
.app-nav a:hover {
  background: rgba(139, 90, 43, 0.08);
  color: var(--brand-dark);
}
.app-nav a.is-active {
  background: rgba(139, 90, 43, 0.12);
  color: var(--brand-dark);
  font-weight: 600;
}
.app-nav a svg { width: 16px; height: 16px; opacity: 0.85; }

.app-user {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.app-user-name {
  font-size: 0.88rem;
  color: var(--text-soft);
  font-weight: 500;
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}
.app-user-name strong { color: var(--text); font-weight: 600; font-size: 0.88rem; }
.app-user-role {
  display: inline-block;
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
  color: var(--brand);
  margin-top: 1px;
}
.app-user-divider {
  width: 1px;
  height: 24px;
  background: var(--line);
  margin: 0 4px;
}

/* Volver al catálogo - destacado en la barra superior */
.app-back-catalog {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 13px;
  border-radius: 9px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-soft);
  text-decoration: none !important;
  transition: all 0.15s ease;
  border: 1px solid transparent;
}
.app-back-catalog:hover {
  background: rgba(139, 90, 43, 0.08);
  color: var(--brand-dark);
  transform: translateX(-2px);
}
.app-back-catalog svg { width: 15px; height: 15px; flex-shrink: 0; transition: transform 0.15s; }
.app-back-catalog:hover svg { transform: translateX(-2px); }
.app-user-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand-light), var(--brand));
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  box-shadow: var(--shadow-sm);
}
.app-logout {
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 11px;
  cursor: pointer;
  color: var(--text-soft);
  font: inherit;
  font-size: 0.85rem;
  transition: all 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.app-logout:hover { background: rgba(196, 69, 69, 0.08); color: var(--danger); border-color: rgba(196, 69, 69, 0.3); }
.app-logout svg { width: 14px; height: 14px; }

/* ================================================================
   CONTENT WRAPPER
   ================================================================ */
.app-content {
  position: relative;
  z-index: 1;
  max-width: 1280px;
  margin: 0 auto;
  padding: 28px 28px 80px;
  animation: page-in 0.35s ease-out;
}
@keyframes page-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ================================================================
   PAGE HEADER (title + actions + breadcrumb)
   ================================================================ */
.page-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 0;
  margin-bottom: 8px;
  font-size: 0.88rem;
  color: var(--text-soft);
  font-weight: 500;
  transition: all 0.15s;
}
.page-back:hover { color: var(--brand-dark); transform: translateX(-2px); }
.page-back svg { width: 16px; height: 16px; }

.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--gap-lg);
  margin-bottom: var(--gap-lg);
  flex-wrap: wrap;
}
.page-title {
  margin: 0;
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
}
.page-title-row {
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
}
.page-count {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0;
}
.page-subtitle {
  margin: 4px 0 0;
  color: var(--text-soft);
  font-size: 0.95rem;
}
.page-actions {
  display: flex;
  align-items: center;
  gap: var(--gap-sm);
  flex-wrap: wrap;
}

/* ================================================================
   CARD
   ================================================================ */
.card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--r-lg);
  padding: var(--gap-lg);
  backdrop-filter: blur(18px) saturate(150%);
  -webkit-backdrop-filter: blur(18px) saturate(150%);
  box-shadow: var(--shadow-md);
  position: relative;
}
.card-solid {
  background: var(--bg-paper);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
.card-pad-lg { padding: var(--gap-xl); }
.card-pad-sm { padding: var(--gap-md); }
.card-section + .card-section { margin-top: var(--gap-lg); }
.card h3, .card-title {
  margin: 0 0 var(--gap-md);
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

/* ================================================================
   BUTTONS
   ================================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg-paper);
  color: var(--text);
  font: inherit;
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none;
  white-space: nowrap;
  user-select: none;
}
.btn:hover {
  border-color: rgba(139, 90, 43, 0.3);
  background: rgba(255, 255, 255, 0.95);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
  color: var(--text);
}
.btn:active { transform: translateY(0); }
.btn svg { width: 15px; height: 15px; }

.btn-primary {
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-dark) 100%);
  border-color: transparent;
  color: #fff;
  font-weight: 600;
  box-shadow: 0 4px 12px -3px rgba(139, 90, 43, 0.5),
              inset 0 1px 0 rgba(255, 255, 255, 0.2);
}
.btn-primary:hover {
  color: #fff;
  box-shadow: 0 6px 16px -3px rgba(139, 90, 43, 0.55),
              inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--text-soft);
}
.btn-ghost:hover { background: rgba(139, 90, 43, 0.08); color: var(--brand-dark); border-color: transparent; }

.btn-danger { color: var(--danger); border-color: rgba(196, 69, 69, 0.25); }
.btn-danger:hover {
  background: rgba(196, 69, 69, 0.08);
  border-color: rgba(196, 69, 69, 0.4);
  color: var(--danger);
}

.btn-sm { padding: 6px 11px; font-size: 0.82rem; border-radius: 8px; }
.btn-lg { padding: 12px 22px; font-size: 0.95rem; border-radius: 12px; }
.btn-icon { padding: 9px; }
.btn-icon svg { width: 16px; height: 16px; }

/* ================================================================
   FORM (inputs, selects, textareas, labels)
   ================================================================ */
.form { display: flex; flex-direction: column; gap: var(--gap-md); }
.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--gap-md);
}
.form-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.88rem;
}
.form-field > label,
.form-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0.01em;
}
.form-field small,
.form-hint {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.input,
.select,
.textarea {
  width: 100%;
  padding: 11px 14px;
  background: var(--bg-paper);
  border: 1.5px solid var(--line);
  border-radius: 10px;
  font: inherit;
  font-size: 0.92rem;
  color: var(--text);
  outline: none;
  transition: all 0.15s ease;
}
.input::placeholder, .textarea::placeholder { color: rgba(42, 31, 21, 0.4); }
.input:hover, .select:hover, .textarea:hover { border-color: rgba(139, 90, 43, 0.3); }
.input:focus, .select:focus, .textarea:focus {
  border-color: rgba(139, 90, 43, 0.7);
  box-shadow: 0 0 0 4px rgba(139, 90, 43, 0.1);
}
.textarea { min-height: 90px; resize: vertical; line-height: 1.5; }
.input-sm { padding: 7px 10px; font-size: 0.85rem; border-radius: 8px; }

/* Checkbox */
.checkbox {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  cursor: pointer;
  font-size: 0.9rem;
  user-select: none;
}
.checkbox input { accent-color: var(--brand); width: 16px; height: 16px; cursor: pointer; }

/* Form actions */
.form-actions {
  display: flex;
  gap: var(--gap-sm);
  margin-top: var(--gap-md);
  padding-top: var(--gap-md);
  border-top: 1px solid var(--line-soft);
  flex-wrap: wrap;
}

/* ================================================================
   TABLE
   ================================================================ */
.table-wrap {
  background: var(--bg-paper);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
.table thead th {
  background: rgba(139, 90, 43, 0.04);
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-soft);
  text-align: left;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.table tbody td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: middle;
}
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background 0.12s; }
.table tbody tr:hover { background: rgba(139, 90, 43, 0.03); }
.table .row-thumb {
  width: 44px; height: 44px;
  object-fit: cover;
  border-radius: 8px;
  display: block;
}
.table .row-thumb-empty {
  width: 44px; height: 44px;
  border-radius: 8px;
  background: var(--line-soft);
  color: var(--text-muted);
  font-size: 0.75rem;
  display: flex; align-items: center; justify-content: center;
}
.table-empty {
  padding: 40px 16px;
  text-align: center;
  color: var(--text-muted);
}
.row-warn { background: rgba(184, 101, 27, 0.06) !important; }
.row-danger { background: rgba(196, 69, 69, 0.06) !important; }

/* Inline form within a table cell (e.g. "Adjust min stock") */
.inline-form {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* ================================================================
   BADGE
   ================================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: var(--line-soft);
  color: var(--text-soft);
  white-space: nowrap;
}
.badge-ok      { background: var(--ok-bg);     color: var(--ok); }
.badge-warn    { background: var(--warn-bg);   color: var(--warn); }
.badge-danger  { background: var(--danger-bg); color: var(--danger); }
.badge-info    { background: var(--info-bg);   color: var(--info); }
.badge-neutral { background: var(--line-soft); color: var(--text-soft); }
.badge-dot::before {
  content: '';
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
}

/* ================================================================
   KPI CARDS
   ================================================================ */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--gap-md);
  margin-bottom: var(--gap-lg);
}
.kpi {
  background: var(--bg-paper);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 18px 20px;
  position: relative;
  overflow: hidden;
}
.kpi-label {
  font-size: 0.78rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.kpi-value {
  font-size: 2.1rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1.1;
  letter-spacing: -0.02em;
}
.kpi-sub {
  font-size: 0.82rem;
  color: var(--text-soft);
  margin-top: 4px;
}
.kpi.kpi-warn .kpi-value   { color: var(--warn); }
.kpi.kpi-danger .kpi-value { color: var(--danger); }
.kpi.kpi-ok .kpi-value     { color: var(--ok); }
.kpi-icon {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 28px; height: 28px;
  color: var(--text-muted);
  opacity: 0.5;
}

/* ================================================================
   TABS / FILTER PILLS
   ================================================================ */
.tabs {
  display: inline-flex;
  background: var(--bg-paper);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 3px;
  gap: 2px;
  margin-bottom: var(--gap-md);
}
.tabs a, .tabs button {
  padding: 7px 14px;
  border-radius: 7px;
  font-size: 0.86rem;
  font-weight: 500;
  color: var(--text-soft);
  background: transparent;
  border: 0;
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
}
.tabs a:hover, .tabs button:hover { background: rgba(139, 90, 43, 0.08); color: var(--text); }
.tabs a.is-active, .tabs button.is-active {
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-dark) 100%);
  color: #fff;
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

/* ================================================================
   FLASH (notifications)
   ================================================================ */
.flash {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  margin-bottom: var(--gap-md);
  border-radius: var(--r-md);
  font-size: 0.9rem;
  font-weight: 500;
  background: var(--info-bg);
  color: var(--info);
  border: 1px solid rgba(47, 110, 139, 0.2);
  animation: rise-in 0.3s ease-out;
}
.flash svg { width: 18px; height: 18px; flex-shrink: 0; }
.flash-ok     { background: var(--ok-bg);     color: var(--ok);     border-color: rgba(46, 125, 50, 0.2); }
.flash-warn   { background: var(--warn-bg);   color: var(--warn);   border-color: rgba(184, 101, 27, 0.2); }
.flash-danger { background: var(--danger-bg); color: var(--danger); border-color: rgba(196, 69, 69, 0.2); }
.flash.hide   { animation: rise-out 0.4s forwards; }
@keyframes rise-in {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes rise-out {
  to { opacity: 0; transform: translateY(-6px); height: 0; padding: 0; margin: 0; }
}

/* ================================================================
   STOCK BAR (inventory)
   ================================================================ */
.stock-bar-wrap {
  width: 100%;
  max-width: 110px;
  height: 6px;
  background: var(--line-soft);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 4px;
}
.stock-bar {
  height: 100%;
  border-radius: 999px;
  transition: width 0.3s;
}

/* Low stock alert widget (used in products list) */
.alert-widget {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 18px;
  background: linear-gradient(135deg, rgba(184, 101, 27, 0.08), rgba(196, 69, 69, 0.06));
  border: 1px solid rgba(184, 101, 27, 0.22);
  border-radius: var(--r-md);
  margin-bottom: var(--gap-lg);
}
.alert-widget-head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.alert-widget-icon {
  width: 28px; height: 28px;
  border-radius: 8px;
  background: var(--warn-bg);
  color: var(--warn);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.alert-widget-icon svg { width: 16px; height: 16px; }
.alert-widget-title {
  font-weight: 600;
  color: var(--warn);
  font-size: 0.95rem;
  flex: 1;
}
.alert-widget-link {
  font-size: 0.85rem;
  color: var(--warn);
  font-weight: 600;
}
.alert-widget-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.alert-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  background: rgba(255,255,255,0.65);
  border-radius: 999px;
  font-size: 0.82rem;
  border: 1px solid rgba(184, 101, 27, 0.18);
}
.alert-pill.is-critico { border-color: rgba(196, 69, 69, 0.3); color: var(--danger); }
.alert-pill b { font-weight: 700; }

/* ================================================================
   IMAGE GRID (admin existing images, e.g. product form)
   ================================================================ */
.img-tile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 14px;
}
.img-tile {
  background: var(--bg-paper);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  overflow: hidden;
  transition: transform 0.15s, box-shadow 0.15s;
}
.img-tile:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.img-tile.is-primary { border-color: var(--brand); box-shadow: 0 0 0 2px rgba(139, 90, 43, 0.2); }
.img-tile img { width: 100%; height: 130px; object-fit: cover; display: block; background: var(--line-soft); }
.img-tile-actions {
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.img-tile-actions form { display: flex; }
.img-tile-actions .btn { width: 100%; font-size: 0.78rem; padding: 6px 10px; }
.img-tile-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--brand);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 5px 8px;
  background: rgba(139, 90, 43, 0.1);
  border-radius: 6px;
}

/* ================================================================
   PUBLIC STOREFRONT (catalog + product detail)
   ================================================================ */
.store-hero {
  text-align: left;
  padding: 28px 0 16px;
}
.store-hero h1 {
  margin: 0 0 6px;
  font-size: 2.2rem;
  font-weight: 800;
  letter-spacing: -0.025em;
  background: linear-gradient(135deg, var(--brand-dark) 0%, var(--brand) 50%, var(--accent) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.store-hero p { margin: 0; color: var(--text-soft); font-size: 1.05rem; }

.store-filters {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr auto;
  gap: 10px;
  margin: 18px 0 24px;
  padding: 12px;
  background: rgba(247, 241, 230, 0.88);
  border: 1px solid var(--glass-border);
  border-radius: var(--r-md);
  backdrop-filter: blur(22px) saturate(170%);
  -webkit-backdrop-filter: blur(22px) saturate(170%);
  /* Sticky bajo el topbar (~76px de alto) — se mantiene visible al scrollear */
  position: sticky;
  top: 76px;
  z-index: 40;
  box-shadow: 0 4px 20px -8px rgba(90, 58, 26, 0.18);
  transition: padding 0.18s ease, box-shadow 0.18s ease;
}
/* Pequeña sombra extra cuando deja de estar pegado al borde superior natural */
.store-filters.is-pinned {
  padding: 10px 12px;
  box-shadow: 0 8px 24px -10px rgba(90, 58, 26, 0.28);
}
.store-filters input,
.store-filters select { padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px; font: inherit; background: #fff; }

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 18px;
}
.product-card {
  background: var(--bg-paper);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  overflow: hidden;
  transition: transform 0.18s, box-shadow 0.18s;
  display: block;
  color: inherit;
  text-decoration: none !important;
  position: relative;
}
.product-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
  border-color: rgba(139, 90, 43, 0.25);
}
.product-card-img { width: 100%; height: 200px; object-fit: cover; display: block; background: var(--line-soft); }
.product-card-noimg {
  width: 100%; height: 200px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted);
  background: var(--line-soft);
  font-size: 0.85rem;
}
.product-card-body { padding: 14px 16px; }
.product-card-cat {
  font-size: 0.72rem;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.07em;
  font-weight: 500;
}
.product-card-name { margin: 4px 0 8px; font-size: 1rem; font-weight: 600; line-height: 1.3; }
.product-card-price { font-size: 1.05rem; font-weight: 700; color: var(--brand-dark); }

.color-dots { display: flex; gap: 5px; margin-top: 10px; }
.color-dot {
  width: 14px; height: 14px;
  border-radius: 50%;
  border: 1px solid rgba(0,0,0,0.1);
  display: inline-block;
  background: #ddd;
}
.color-dot.lg { width: 26px; height: 26px; border-width: 2px; cursor: pointer; transition: transform 0.15s; }
.color-dot.lg:hover { transform: scale(1.1); }

/* ---------- Product detail (the page with the buggy thumbnails) ---------- */
.detail-grid {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 36px;
  align-items: start;
}
@media (max-width: 880px) {
  .detail-grid { grid-template-columns: 1fr; gap: 24px; }
}

.detail-gallery { display: flex; flex-direction: column; gap: 12px; }
.detail-main-img {
  width: 100%;
  height: 460px;
  object-fit: cover;
  border-radius: var(--r-md);
  background: var(--line-soft);
  box-shadow: var(--shadow-md);
  display: block;
}
.detail-noimg-big {
  width: 100%; height: 460px;
  border-radius: var(--r-md);
  background: var(--line-soft);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted);
}

/* THUMBS — fix del bug: grid de cuadritos, NO flex con stretch */
.detail-thumbs {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(72px, 80px));
  gap: 10px;
}
/* High specificity to override `.detail-gallery img { width: 100% }` */
.detail-thumbs .detail-thumb {
  width: 80px;
  height: 80px;
  max-width: 80px;
  object-fit: cover;
  border-radius: 10px;
  cursor: pointer;
  opacity: 0.75;
  transition: all 0.15s;
  border: 2px solid transparent;
  box-sizing: border-box;
  background: var(--line-soft);
  display: block;
}
.detail-thumbs .detail-thumb:hover { opacity: 1; transform: translateY(-1px); }
.detail-thumbs .detail-thumb.is-active { opacity: 1; border-color: var(--brand); }

.detail-info-cat {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 6px;
}
.detail-info h1 {
  margin: 0 0 12px;
  font-size: 1.85rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.detail-price {
  font-size: 1.85rem;
  font-weight: 800;
  color: var(--brand-dark);
  margin-bottom: 18px;
}
.detail-desc { color: var(--text); white-space: pre-wrap; line-height: 1.65; }

.detail-block { margin-top: 22px; }
.detail-block h4 {
  margin: 0 0 8px;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--brand-dark);
  font-weight: 700;
}
.detail-kv { padding: 0; margin: 0; list-style: none; display: flex; flex-direction: column; gap: 4px; }
.detail-kv li { font-size: 0.92rem; color: var(--text); }
.detail-kv b { color: var(--text); font-weight: 600; }
.detail-kv em { color: var(--text-muted); font-style: normal; font-size: 0.85rem; }

.complement-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
}
.complement-card {
  display: flex;
  flex-direction: column;
  background: var(--bg-paper);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  overflow: hidden;
  text-align: center;
  text-decoration: none !important;
  color: inherit;
  transition: all 0.15s;
}
.complement-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: rgba(139, 90, 43, 0.25); }
.complement-card img { width: 100%; height: 110px; object-fit: cover; display: block; background: var(--line-soft); }
.complement-card-body { padding: 10px; font-size: 0.85rem; }
.complement-card-body strong { display: block; margin-bottom: 2px; }
.complement-card-body div { color: var(--text-muted); font-size: 0.8rem; }

/* ================================================================
   EMPTY STATE
   ================================================================ */
.empty-state {
  text-align: center;
  padding: 60px 24px;
  color: var(--text-muted);
}
.empty-state-icon {
  display: flex; align-items: center; justify-content: center;
  width: 56px; height: 56px;
  margin: 0 auto 14px;
  border-radius: 14px;
  background: var(--line-soft);
  color: var(--text-muted);
}
.empty-state-icon svg { width: 28px; height: 28px; }
.empty-state h3 { margin: 0 0 6px; color: var(--text); font-size: 1.05rem; font-weight: 600; }
.empty-state p { margin: 0 0 16px; font-size: 0.9rem; }

/* ================================================================
   PAGINATION
   ================================================================ */
.pager {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-top: var(--gap-lg);
}
.pager .btn { min-width: 38px; padding: 7px 11px; font-size: 0.85rem; }

/* ================================================================
   UTILS
   ================================================================ */
.row { display: flex; gap: var(--gap-md); align-items: center; flex-wrap: wrap; }
.row-end { display: flex; gap: var(--gap-md); align-items: center; justify-content: flex-end; flex-wrap: wrap; }
.spacer { flex: 1; }
.muted { color: var(--text-muted); }
.text-soft { color: var(--text-soft); }
.text-danger { color: var(--danger); }
.text-ok { color: var(--ok); }
.mb-0 { margin-bottom: 0; }
.mb-md { margin-bottom: var(--gap-md); }
.mb-lg { margin-bottom: var(--gap-lg); }
.mt-md { margin-top: var(--gap-md); }
.mt-lg { margin-top: var(--gap-lg); }

/* ================================================================
   RESPONSIVE
   ================================================================ */
@media (max-width: 1100px) {
  .app-back-catalog span { display: none; }
  .app-back-catalog { padding: 7px 9px; }
  .app-user-name { display: none; }
}
@media (max-width: 920px) {
  .app-topbar { flex-wrap: wrap; padding: 10px 16px; }
  .app-nav { width: 100%; order: 3; overflow-x: auto; }
  .app-content { padding: 18px 16px 60px; }
  .app-brand-text { font-size: 1.15rem; }
  .app-brand-mark { width: 36px; height: 36px; }
  .page-title { font-size: 1.45rem; }
  .store-filters { grid-template-columns: 1fr 1fr; }
  .form-actions { flex-direction: column; }
  .form-actions .btn { width: 100%; }
}
@media (max-width: 480px) {
  .table thead { display: none; }
  .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
  .table tbody tr { border-bottom: 1px solid var(--line); padding: 10px 0; }
  .table tbody td { padding: 6px 16px; border-bottom: 0; }
  .table tbody td::before { content: attr(data-label) ': '; font-weight: 600; color: var(--text-muted); }
}

@media (prefers-reduced-motion: reduce) {
  .app-content { animation: none; }
  .product-card, .img-tile, .complement-card { transition: none; }
  .product-card:hover, .img-tile:hover, .complement-card:hover { transform: none; }
}
