/* FEELING™ Admin — design tokens & base */

:root {
  /* Palette */
  --black: #0A0A0A;
  --ink: #141414;
  --ink-2: #1C1C1C;
  --line: #262626;
  --line-soft: #E8E2D2;
  --bone: #F5F2EB;
  --bone-2: #EFEBDF;
  --paper: #FBFAF6;
  --chrome: #B8B8B8;
  --chrome-2: #8C8C8C;
  --muted: #6B6B6B;
  --muted-2: #9A9A92;

  /* Accent — overridable by Tweaks */
  --accent: #C8392C;            /* default red */
  --accent-ink: #FFFFFF;
  --success: #4E6B3A;           /* verde militar */
  --warn: #C8881F;
  --danger: #C8392C;

  /* Type */
  --font-display: 'Archivo Black', 'Anton', 'Bebas Neue', sans-serif;
  --font-body: 'Inter', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', 'IBM Plex Mono', ui-monospace, monospace;

  /* Spacing */
  --radius: 2px;
  --radius-lg: 4px;
  --gutter: 20px;
  --nav-w: 232px;
}

* { box-sizing: border-box; }
html, body { overflow-x: hidden; max-width: 100vw; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.45;
  color: var(--ink);
  background: var(--bone);
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "ss01", "cv11";
}

button { font: inherit; cursor: pointer; border: 0; background: transparent; color: inherit; padding: 0; }
input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }

/* Typography */
.h-display { font-family: var(--font-display); font-weight: 900; letter-spacing: -0.01em; text-transform: uppercase; }
.h-mono { font-family: var(--font-mono); }
.nums { font-variant-numeric: tabular-nums; }
.upper { text-transform: uppercase; letter-spacing: 0.08em; font-size: 11px; font-weight: 600; }

/* Shell */
.app {
  min-height: 100vh;
  display: grid;
  grid-template-columns: var(--nav-w) 1fr;
  background: var(--bone);
}
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; padding-bottom: 64px; }
}

/* Sidebar (desktop) */
.sidebar {
  background: var(--black);
  color: var(--bone);
  display: flex;
  flex-direction: column;
  padding: 20px 16px 16px;
  border-right: 1px solid var(--line);
  position: sticky;
  top: 0;
  height: 100vh;
}
@media (max-width: 900px) { .sidebar { display: none; } }

.brand {
  display: flex;
  align-items: baseline;
  gap: 6px;
  padding: 6px 8px 24px;
}
.brand-mark {
  font-family: var(--font-display);
  font-size: 22px;
  letter-spacing: -0.02em;
  text-transform: uppercase;
  line-height: 1;
}
.brand-tm { font-size: 10px; color: var(--chrome); margin-left: -2px; }
.brand-sub { color: var(--chrome-2); font-size: 10px; text-transform: uppercase; letter-spacing: 0.18em; margin-left: auto; }

.nav-section { display: flex; flex-direction: column; gap: 2px; }
.nav-section + .nav-section { margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--line); }
.nav-label { color: var(--chrome-2); font-size: 10px; text-transform: uppercase; letter-spacing: 0.16em; padding: 4px 8px 8px; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 10px;
  color: var(--bone);
  font-size: 13px;
  font-weight: 500;
  border-radius: var(--radius);
  transition: background .12s ease;
  position: relative;
}
.nav-item:hover { background: var(--ink-2); }
.nav-item.active { background: var(--bone); color: var(--black); }
.nav-item .ic { width: 16px; height: 16px; flex: 0 0 16px; }
.nav-item .kbd { margin-left: auto; font-family: var(--font-mono); font-size: 10px; color: var(--chrome-2); }
.nav-item.active .kbd { color: var(--muted); }
.nav-item .count { margin-left: auto; font-family: var(--font-mono); font-size: 11px; color: var(--chrome); }
.nav-item.active .count { color: var(--muted); }

.nav-foot { margin-top: auto; display: flex; flex-direction: column; gap: 8px; padding-top: 16px; border-top: 1px solid var(--line); }

.publish-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  background: var(--bone);
  color: var(--black);
  font-weight: 700;
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.12em;
  border-radius: var(--radius);
  justify-content: center;
}
.publish-btn:hover { background: white; }
.publish-btn.publishing { background: var(--accent); color: var(--accent-ink); }
.publish-meta { font-size: 10px; color: var(--chrome-2); text-align: center; padding-top: 2px; }

.user-row { display: flex; align-items: center; gap: 10px; padding: 8px; color: var(--chrome); font-size: 12px; }
.user-avatar {
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--ink-2); color: var(--bone);
  display: grid; place-items: center;
  font-family: var(--font-display); font-size: 11px;
}
.user-row .out { margin-left: auto; font-size: 10px; text-transform: uppercase; letter-spacing: 0.12em; color: var(--chrome-2); }
.user-row .out:hover { color: var(--bone); }

/* Mobile bottom nav */
.botnav {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: var(--black);
  border-top: 1px solid var(--line);
  z-index: 50;
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
}
@media (max-width: 900px) { .botnav { display: grid; grid-template-columns: repeat(6, 1fr); } }

/* Menu Mas del bottom-nav (mobile) */
.nav-sheet-backdrop { position: fixed; inset: 0; z-index: 49; background: rgba(0,0,0,0.35); }
.nav-sheet { position: fixed; left: 8px; right: 8px; z-index: 60; bottom: calc(72px + env(safe-area-inset-bottom)); background: var(--paper); border: 1px solid var(--line-soft); border-radius: var(--radius-lg); box-shadow: 0 -10px 34px rgba(0,0,0,0.20); padding: 8px; display: flex; flex-direction: column; gap: 2px; }
.nav-sheet-title { font-size: 10px; text-transform: uppercase; letter-spacing: 0.12em; color: var(--muted); padding: 8px 10px 4px; }
.nav-sheet-item { display: flex; align-items: center; gap: 12px; padding: 13px 12px; border-radius: var(--radius); font-size: 14px; font-weight: 600; color: var(--ink); text-align: left; width: 100%; background: transparent; }
.nav-sheet-item:hover, .nav-sheet-item.active { background: var(--bone-2); }
.botnav-item {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 8px 4px; color: var(--chrome-2); font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em;
  min-height: 44px;
}
.botnav-item.active { color: var(--bone); }
.botnav-item .ic { width: 18px; height: 18px; }
.botnav-item.pub { color: var(--accent); }

/* Main */
.main { min-width: 0; }
.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 28px;
  border-bottom: 1px solid var(--line-soft);
  background: var(--bone);
  position: sticky; top: 0; z-index: 30;
}
@media (max-width: 900px) {
  /* En mobile el header wrappea: titulo arriba, acciones en una fila full-width
     abajo (antes los botones Contacto/Producto se cortaban a la derecha). */
  .topbar { padding: 14px 16px; flex-wrap: wrap; }
  .topbar .right { margin-left: 0; width: 100%; flex-wrap: wrap; }
}
.topbar h1 { font-family: var(--font-display); font-size: 18px; margin: 0; letter-spacing: -0.01em; text-transform: uppercase; }
.topbar .crumb { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.12em; }
.topbar .right { margin-left: auto; display: flex; gap: 8px; align-items: center; }

.page { padding: 28px; max-width: 1240px; }
@media (max-width: 900px) { .page { padding: 18px 16px calc(84px + env(safe-area-inset-bottom)); } }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 14px;
  font-size: 12px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.1em;
  border-radius: var(--radius);
  border: 1px solid var(--ink);
  background: var(--ink); color: var(--bone);
  transition: transform .06s ease, background .12s ease;
  min-height: 38px;
}
.btn:hover { background: var(--black); }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--ink); }
.btn.ghost:hover { background: var(--ink); color: var(--bone); }
.btn.line { background: var(--bone); color: var(--ink); border-color: var(--line-soft); }
.btn.line:hover { background: var(--paper); border-color: var(--ink); }
.btn.danger { background: transparent; color: var(--danger); border-color: var(--danger); }
.btn.danger:hover { background: var(--danger); color: white; }
.btn.accent { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.sm { padding: 6px 10px; font-size: 10px; min-height: 30px; }
.btn.lg { padding: 14px 20px; font-size: 13px; min-height: 48px; }
.btn.block { width: 100%; justify-content: center; }

/* Inputs */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); font-weight: 600; }
.field .req { color: var(--accent); margin-left: 2px; }
.input, .select, .textarea {
  background: var(--paper);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  padding: 11px 12px;
  font-size: 14px;
  color: var(--ink);
  width: 100%;
  outline: none;
  transition: border-color .12s ease, background .12s ease;
}
.input:focus, .select:focus, .textarea:focus { border-color: var(--ink); background: white; }
.input::placeholder { color: var(--muted-2); }
.textarea { resize: vertical; min-height: 88px; font-family: inherit; }
.input.mono { font-family: var(--font-mono); font-size: 13px; letter-spacing: -0.01em; }
.input.err { border-color: var(--danger); }
.field .hint { font-size: 11px; color: var(--muted); }
.field .err-msg { font-size: 11px; color: var(--danger); }

.search {
  position: relative;
  display: flex; align-items: center;
}
.search .ic { position: absolute; left: 12px; width: 14px; height: 14px; color: var(--muted); pointer-events: none; }
.search input { padding-left: 36px; }

/* Toggle */
.toggle { position: relative; width: 36px; height: 20px; }
.toggle input { display: none; }
.toggle .track {
  position: absolute; inset: 0; background: var(--chrome); border-radius: 999px; transition: background .14s ease;
}
.toggle .thumb {
  position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; background: white; border-radius: 50%; transition: transform .14s ease;
}
.toggle input:checked + .track { background: var(--ink); }
.toggle input:checked + .track + .thumb { transform: translateX(16px); }

/* Tables */
.table-wrap { background: var(--paper); border: 1px solid var(--line-soft); border-radius: var(--radius-lg); overflow: hidden; }
.table-scroll { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 720px; }
.tbl thead th {
  text-align: left;
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.12em;
  color: var(--muted); font-weight: 600;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line-soft);
  background: var(--bone-2);
  white-space: nowrap;
}
.tbl tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: middle;
}
.tbl tbody tr:hover { background: var(--bone-2); }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl td.right, .tbl th.right { text-align: right; }
.tbl td.num { font-variant-numeric: tabular-nums; }

/* Cells / chips */
.sku { font-family: var(--font-mono); font-size: 12px; color: var(--ink); letter-spacing: -0.02em; }
.thumb { width: 40px; height: 40px; border-radius: var(--radius); object-fit: cover; background: var(--bone-2); }
.thumb-ph {
  width: 40px; height: 40px; border-radius: var(--radius);
  background: repeating-linear-gradient(45deg, var(--bone-2) 0 6px, var(--paper) 6px 12px);
  display: grid; place-items: center;
  font-family: var(--font-display); font-size: 11px; color: var(--muted);
}

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 8px;
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em; font-weight: 600;
  border-radius: 999px; border: 1px solid var(--line-soft);
  background: var(--bone-2); color: var(--muted);
}
.chip.ink { background: var(--ink); color: var(--bone); border-color: var(--ink); }
.chip.success { background: rgba(78,107,58,0.12); color: var(--success); border-color: rgba(78,107,58,0.3); }
.chip.warn { background: rgba(200,136,31,0.12); color: var(--warn); border-color: rgba(200,136,31,0.3); }
.chip.danger { background: rgba(200,57,44,0.10); color: var(--danger); border-color: rgba(200,57,44,0.3); }
.chip.outline { background: transparent; }
.chip .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* Stock input inline */
.stock-edit {
  display: inline-flex; align-items: center; gap: 6px;
}
.stock-edit input {
  width: 64px; padding: 6px 8px; text-align: right;
  border: 1px solid var(--ink); background: white;
  font-variant-numeric: tabular-nums; font-size: 13px;
  border-radius: var(--radius);
}
.stock-display {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: var(--radius);
  font-variant-numeric: tabular-nums; cursor: pointer;
  min-width: 56px; justify-content: flex-end;
}
.stock-display:hover { background: var(--bone-2); outline: 1px dashed var(--line-soft); }
.stock-display.low { color: var(--danger); font-weight: 700; }
.stock-display .pencil { opacity: 0; transition: opacity .12s ease; width: 11px; height: 11px; color: var(--muted); }
.stock-display:hover .pencil { opacity: 1; }
.stock-saving { color: var(--success); display: inline-flex; align-items: center; gap: 4px; }

/* Cards & sections */
.card {
  background: var(--paper);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-lg);
  padding: 20px;
}
.card.dark { background: var(--black); color: var(--bone); border-color: var(--ink-2); }

.section-title {
  font-family: var(--font-display);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  margin: 0 0 14px;
  display: flex; align-items: center; gap: 10px;
}
.section-title .count {
  font-family: var(--font-mono); font-size: 11px; color: var(--muted);
  background: var(--bone-2); padding: 2px 6px; border-radius: 999px; letter-spacing: 0;
}
.section-title .right { margin-left: auto; }

/* Dashboard */
.metric-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px;
  margin-bottom: 22px;
}
@media (max-width: 720px) { .metric-grid { grid-template-columns: 1fr; } }

.metric {
  background: var(--paper);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-lg);
  padding: 22px;
  position: relative;
  overflow: hidden;
}
.metric.dark { background: var(--black); color: var(--bone); border-color: var(--ink-2); }
.metric .label { font-size: 10px; text-transform: uppercase; letter-spacing: 0.14em; color: var(--muted); font-weight: 600; }
.metric.dark .label { color: var(--chrome-2); }
.metric .val { font-family: var(--font-display); font-size: 44px; line-height: 1; margin: 14px 0 8px; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.metric .val .cur { font-size: 18px; color: var(--muted); margin-right: 8px; font-family: var(--font-body); font-weight: 700; }
.metric.dark .val .cur { color: var(--chrome); }
.metric .sub { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.metric.dark .sub { color: var(--chrome); }
.metric .delta { color: var(--success); }
.metric .delta.neg { color: var(--danger); }

.dash-grid { display: grid; grid-template-columns: 1fr 1.6fr; gap: 14px; align-items: start; }
@media (max-width: 900px) { .dash-grid { grid-template-columns: 1fr; } }

.toplist { display: flex; flex-direction: column; gap: 0; }
.toplist-row {
  display: grid; grid-template-columns: 28px 1fr auto; gap: 12px;
  align-items: center; padding: 12px 0;
  border-bottom: 1px solid var(--line-soft);
}
.toplist-row:last-child { border-bottom: 0; }
.toplist-row .rank { font-family: var(--font-display); font-size: 16px; color: var(--muted-2); }
.toplist-row .name { font-weight: 600; }
.toplist-row .qty { font-variant-numeric: tabular-nums; font-family: var(--font-mono); font-size: 12px; color: var(--muted); }
.toplist-row .bar {
  grid-column: 1 / -1;
  height: 2px; background: var(--bone-2); margin-top: 6px; border-radius: 1px;
  position: relative;
}
.toplist-row .bar i { display: block; height: 100%; background: var(--ink); border-radius: 1px; }

.lowstock-row {
  display: grid; grid-template-columns: 1fr auto; gap: 8px;
  padding: 12px 0; border-bottom: 1px solid var(--line-soft);
  align-items: center;
}
.lowstock-row:last-child { border-bottom: 0; }
.lowstock-row .sku-line { font-family: var(--font-mono); font-size: 11px; color: var(--muted); }
.lowstock-row .name { font-weight: 600; }
.lowstock-row .qty { color: var(--danger); font-weight: 700; font-variant-numeric: tabular-nums; }

.qa-row { display: flex; gap: 8px; flex-wrap: wrap; }

/* Login */
.login-shell {
  min-height: 100vh;
  background: var(--black);
  color: var(--bone);
  display: grid;
  grid-template-columns: 1fr 1fr;
}
@media (max-width: 800px) { .login-shell { grid-template-columns: 1fr; } }
.login-art {
  background: var(--black);
  padding: 48px;
  display: flex; flex-direction: column; justify-content: space-between;
  position: relative; overflow: hidden;
  border-right: 1px solid var(--ink-2);
}
@media (max-width: 800px) { .login-art { display: none; } }
.login-art .wm {
  font-family: var(--font-display);
  font-size: clamp(60px, 9vw, 132px);
  line-height: 0.85;
  letter-spacing: -0.04em;
  text-transform: uppercase;
}
.login-art .wm sup { font-size: 0.18em; vertical-align: top; color: var(--chrome); }
.login-art .tag { color: var(--chrome-2); font-size: 11px; text-transform: uppercase; letter-spacing: 0.2em; }
.login-art .meta { color: var(--chrome-2); font-size: 11px; text-transform: uppercase; letter-spacing: 0.2em; display: flex; justify-content: space-between; }
.login-art .grain {
  position: absolute; inset: 0;
  background-image: radial-gradient(rgba(255,255,255,0.05) 1px, transparent 1px);
  background-size: 4px 4px;
  pointer-events: none; opacity: 0.4;
}
.login-form-side { background: var(--bone); color: var(--ink); display: grid; place-items: center; padding: 32px; }
.login-form { width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 18px; }
.login-form .mark-mobile { display: none; }
@media (max-width: 800px) {
  .login-form .mark-mobile {
    display: block; font-family: var(--font-display); font-size: 48px; line-height: 1; margin-bottom: 16px;
  }
  .login-form .mark-mobile sup { font-size: 0.2em; vertical-align: top; color: var(--muted); }
}
.login-form h2 { font-family: var(--font-display); font-size: 24px; margin: 0; text-transform: uppercase; letter-spacing: -0.01em; }
.login-form .sub { color: var(--muted); font-size: 13px; margin-top: -10px; }
.login-foot { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0.14em; text-align: center; margin-top: 8px; }
.alert {
  padding: 10px 12px;
  background: rgba(200,57,44,0.08);
  border: 1px solid rgba(200,57,44,0.3);
  border-radius: var(--radius);
  color: var(--danger);
  font-size: 12px;
}

/* Toast */
.toast-stack {
  position: fixed; bottom: 20px; right: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 100;
  max-width: calc(100vw - 32px);
}
@media (max-width: 900px) { .toast-stack { bottom: 80px; right: 12px; left: 12px; align-items: flex-end; } }
.toast {
  background: var(--ink); color: var(--bone);
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 13px;
  display: flex; align-items: center; gap: 10px;
  min-width: 240px;
  border-left: 3px solid var(--accent);
  animation: toastIn .22s ease;
  box-shadow: 0 10px 30px -10px rgba(0,0,0,0.4);
}
.toast.success { border-left-color: var(--success); }
.toast.danger { border-left-color: var(--danger); }
.toast .ic { width: 16px; height: 16px; flex: 0 0 16px; }
@keyframes toastIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* Modal */
.modal-back {
  position: fixed; inset: 0; background: rgba(10,10,10,0.55); backdrop-filter: blur(2px);
  display: grid; place-items: center; z-index: 80; padding: 16px;
  animation: fadein .12s ease;
}
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: var(--bone); color: var(--ink);
  border-radius: var(--radius-lg);
  max-width: 460px; width: 100%;
  padding: 28px;
  border: 1px solid var(--line-soft);
}
.modal h3 { font-family: var(--font-display); margin: 0 0 8px; text-transform: uppercase; font-size: 18px; }
.modal p { color: var(--muted); margin: 0 0 20px; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; }

/* Forms layout */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 720px) { .form-grid { grid-template-columns: 1fr; } }
.form-grid .span-2 { grid-column: 1 / -1; }
.form-card { background: var(--paper); border: 1px solid var(--line-soft); border-radius: var(--radius-lg); padding: 24px; }
.form-card + .form-card { margin-top: 14px; }
.form-card h2 { font-family: var(--font-display); margin: 0 0 4px; font-size: 16px; text-transform: uppercase; }
.form-card .descr { color: var(--muted); font-size: 12px; margin: 0 0 18px; }

/* Talla picker */
.talla-grid { display: grid; gap: 10px; }
.talla-row {
  display: grid; grid-template-columns: auto 1fr auto 1fr auto; gap: 10px;
  align-items: center;
  padding: 10px 12px;
  background: var(--bone-2);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
}
.talla-row .size-tag {
  font-family: var(--font-display); font-size: 16px;
  width: 36px; text-align: center;
}
.talla-row.off { opacity: 0.45; }
.talla-row .lbl { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; }
.talla-row input[type="text"], .talla-row input[type="number"] {
  background: var(--paper); border: 1px solid var(--line-soft); border-radius: var(--radius);
  padding: 7px 10px; font-size: 13px;
}
.talla-row input.mono { font-family: var(--font-mono); }
@media (max-width: 600px) {
  .talla-row { grid-template-columns: auto 1fr; row-gap: 6px; }
  .talla-row .lbl { display: none; }
  .talla-row > * { grid-column: span 1; }
  .talla-row .size-tag { grid-row: span 3; }
}

/* Filter bar */
.filter-bar {
  display: flex; gap: 10px; flex-wrap: wrap; align-items: center;
  margin-bottom: 14px;
}
.filter-bar .search { flex: 1 1 280px; }
.filter-bar .select { width: auto; min-width: 140px; }

/* Empty state */
.empty {
  padding: 56px 28px; text-align: center;
  background: var(--paper); border: 1px dashed var(--line-soft); border-radius: var(--radius-lg);
}
.empty .glyph { font-family: var(--font-display); font-size: 48px; color: var(--bone-2); margin-bottom: 8px; }
.empty h3 { font-family: var(--font-display); font-size: 18px; margin: 0 0 8px; text-transform: uppercase; }
.empty p { color: var(--muted); margin: 0 0 18px; }

/* Venta rápida */
.pos-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 16px; align-items: start; }
@media (max-width: 900px) { .pos-grid { grid-template-columns: 1fr; } }
.cart-row {
  display: grid; grid-template-columns: 40px 1fr auto auto auto; gap: 10px;
  align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line-soft);
}
.cart-row:last-child { border-bottom: 0; }
.cart-row .name { font-weight: 600; font-size: 13px; }
.cart-row .meta { font-size: 11px; color: var(--muted); font-family: var(--font-mono); }
.qty-stepper { display: inline-flex; align-items: center; border: 1px solid var(--line-soft); border-radius: var(--radius); }
.qty-stepper button { width: 28px; height: 28px; display: grid; place-items: center; }
.qty-stepper button:hover { background: var(--bone-2); }
.qty-stepper input { width: 36px; text-align: center; border: 0; background: transparent; font-variant-numeric: tabular-nums; }
.cart-row .price { font-variant-numeric: tabular-nums; font-weight: 600; min-width: 60px; text-align: right; font-size: 13px; }
.cart-row .rm { color: var(--muted); padding: 4px; }
.cart-row .rm:hover { color: var(--danger); }

/* --- Mobile (<=600px): carrito en 2 filas para que el nombre se lea y los
   controles no se aplasten. Sin tocar JSX (5 hijos: thumb,nombre,qty,precio,rm). --- */
@media (max-width: 600px) {
  .cart-row {
    grid-template-columns: 40px 1fr auto;
    grid-template-areas: "thumb name rm" "thumb qty price";
    row-gap: 8px;
  }
  .cart-row > :nth-child(1) { grid-area: thumb; align-self: start; }
  .cart-row > :nth-child(2) { grid-area: name; }
  .cart-row > :nth-child(3) { grid-area: qty;   justify-self: start; }
  .cart-row > :nth-child(4) { grid-area: price; justify-self: end; align-self: center; }
  .cart-row > :nth-child(5) { grid-area: rm;    justify-self: end; align-self: start; }
  .payseg, .shipseg { gap: 8px; }
  .seg-btn { font-size: 11px; }
}

.totals { display: flex; flex-direction: column; gap: 6px; padding: 14px 0; border-top: 1px solid var(--ink); margin-top: 12px; }
.totals-row { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); }
.totals-row.grand { font-family: var(--font-display); color: var(--ink); font-size: 32px; align-items: baseline; }
.totals-row.grand .cur { font-size: 14px; color: var(--muted); margin-right: 8px; font-family: var(--font-body); }

.autocomplete { position: relative; }
.ac-list {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0;
  background: white; border: 1px solid var(--ink); border-radius: var(--radius);
  max-height: 280px; overflow-y: auto;
  z-index: 20;
  box-shadow: 0 12px 30px -12px rgba(0,0,0,0.2);
}
.ac-item { padding: 10px 12px; cursor: pointer; display: flex; gap: 10px; align-items: center; border-bottom: 1px solid var(--line-soft); }
.ac-item:last-child { border-bottom: 0; }
.ac-item:hover, .ac-item.active { background: var(--bone-2); }
.ac-item .ac-name { font-weight: 600; font-size: 13px; }
.ac-item .ac-meta { font-size: 11px; color: var(--muted); font-family: var(--font-mono); }
.ac-item .ac-right { margin-left: auto; font-variant-numeric: tabular-nums; font-size: 12px; color: var(--muted); }
.ac-empty { padding: 14px; color: var(--muted); font-size: 12px; }
.ac-empty .link { color: var(--ink); font-weight: 600; cursor: pointer; text-decoration: underline; }

.payseg, .shipseg { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px; }
.seg-btn {
  padding: 10px;
  border: 1px solid var(--line-soft);
  background: var(--paper);
  border-radius: var(--radius);
  text-transform: uppercase; letter-spacing: 0.08em;
  font-size: 10px; font-weight: 700;
  display: flex; flex-direction: column; gap: 4px;
  align-items: center;
  color: var(--muted);
  min-height: 60px;
  justify-content: center;
}
.seg-btn .ic { width: 18px; height: 18px; }
.seg-btn:hover { border-color: var(--ink); color: var(--ink); }
.seg-btn.on { background: var(--ink); color: var(--bone); border-color: var(--ink); }

.sale-policy { font-size: 11px; color: var(--muted); padding: 10px 12px; background: var(--bone-2); border-radius: var(--radius); border-left: 2px solid var(--accent); margin-top: 8px; }

/* Detail page */
.detail-grid { display: grid; grid-template-columns: 380px 1fr; gap: 20px; align-items: start; }
@media (max-width: 800px) { .detail-grid { grid-template-columns: 1fr; } }
.detail-photo {
  aspect-ratio: 1 / 1;
  background: var(--bone-2);
  border-radius: var(--radius-lg);
  display: grid; place-items: center;
  border: 1px solid var(--line-soft);
  font-family: var(--font-display);
  color: var(--muted);
  position: relative;
  overflow: hidden;
}
.detail-photo .ph-pattern {
  position: absolute; inset: 0;
  background: repeating-linear-gradient(135deg, var(--bone-2) 0 8px, var(--paper) 8px 16px);
}
.detail-photo .replace {
  position: absolute; bottom: 12px; right: 12px;
  background: var(--ink); color: var(--bone);
  padding: 6px 10px; font-size: 10px; text-transform: uppercase; letter-spacing: 0.12em;
  border-radius: var(--radius);
}

/* Utility */
.row { display: flex; gap: 10px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.spacer { flex: 1; }
.sep { height: 1px; background: var(--line-soft); margin: 14px 0; }
.muted { color: var(--muted); }
.small { font-size: 11px; }
.kbd-key {
  display: inline-block; padding: 1px 6px; border: 1px solid var(--line-soft); border-radius: 3px;
  font-family: var(--font-mono); font-size: 10px; color: var(--muted); background: var(--paper);
}
.tag-cat {
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted);
  padding: 2px 6px; background: var(--bone-2); border-radius: 2px;
}

/* Density variants (Tweaks) */
.density-tight .tbl tbody td { padding: 8px 12px; }
.density-tight .card { padding: 16px; }
.density-tight .metric { padding: 16px; }
.density-tight .form-card { padding: 18px; }

.density-loose .tbl tbody td { padding: 16px 16px; }
.density-loose .card { padding: 26px; }
.density-loose .metric { padding: 28px; }

/* ============================================================
   AGENTE — vista del agente WhatsApp (views-d.jsx).
   Todas las clases con prefijo .agente-* o scoped bajo .agente-page
   para evitar colisiones con clases globales del admin (.metric,
   .section-title, etc).

   Tokens locales: mapean los del design system de Claude Design
   a los tokens existentes del admin Feeling.
   ============================================================ */

.agente-page {
  --ag-ink: var(--ink);
  --ag-ink-muted: var(--muted);
  --ag-ink-soft: var(--muted-2);
  --ag-bg: var(--bone);
  --ag-surface: #ffffff;
  --ag-surface-2: var(--bone-2);
  --ag-border: var(--ink);
  --ag-border-soft: var(--line-soft);
  --ag-success: var(--success);
  --ag-danger: var(--danger);
  --ag-warn: var(--warn);
}

/* ─── Split layout (Conversaciones) ─── */
.agente-split {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 18px;
  align-items: start;
}
@media (max-width: 900px) { .agente-split { grid-template-columns: 1fr; } }

.agente-pane {
  background: var(--ag-surface);
  border: 1px solid var(--ag-border);
}
.agente-pane > header {
  padding: 12px 14px;
  border-bottom: 1px solid var(--ag-border);
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--ag-surface-2);
}
.agente-pane > header .t {
  font-family: var(--font-mono);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ag-ink-muted);
}
.agente-pane > header .spacer { flex: 1; }

/* Chat list */
.agente-conv-list { display: flex; flex-direction: column; max-height: 70vh; overflow: auto; }
.agente-conv-list .item {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--ag-border-soft);
  cursor: pointer;
}
.agente-conv-list .item:hover { background: var(--ag-surface-2); }
.agente-conv-list .item.active { background: var(--ag-ink); color: #fff; }
.agente-conv-list .item.active .meta { color: #c9c9c9; }
.agente-conv-list .item .ph { font-family: var(--font-mono); font-size: 12.5px; font-weight: 500; }
.agente-conv-list .item .meta { font-size: 11px; color: var(--ag-ink-muted); font-family: var(--font-mono); margin-top: 3px; display: flex; gap: 8px; }
.agente-conv-list .item .col { flex: 1; min-width: 0; }
.agente-conv-list .item .badge-mini {
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border: 1px solid currentColor;
  padding: 1px 5px;
  border-radius: 2px;
  opacity: 0.9;
}
/* Notificacion "sin responder" (estilo WhatsApp): pill verde a la derecha del item. */
.agente-conv-list .item .unread-pill {
  align-self: center;
  flex-shrink: 0;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #fff;
  background: var(--success, #1fa855);
  border-radius: 999px;
  padding: 3px 9px;
  white-space: nowrap;
}
.agente-conv-list .item.active .unread-pill { background: #fff; color: var(--ag-ink); }

/* Chat pane */
.agente-chat-pane { display: flex; flex-direction: column; min-height: 520px; }
.agente-chat-head {
  padding: 12px 14px;
  border-bottom: 1px solid var(--ag-border);
  display: flex; align-items: center; gap: 10px;
  background: var(--ag-surface-2);
}
.agente-chat-head .ph { font-family: var(--font-mono); font-size: 13px; font-weight: 600; }
.agente-chat-head .actions { margin-left: auto; display: flex; gap: 8px; }

.agente-chat-body {
  padding: 18px 18px 24px;
  display: flex; flex-direction: column; gap: 10px;
  background: var(--ag-surface-2);
  flex: 1; min-height: 420px; max-height: 70vh;
  overflow-y: auto;
}
.agente-bubble {
  max-width: 70%;
  padding: 9px 12px 10px;
  font-size: 13.5px;
  line-height: 1.42;
  border-radius: 6px;
  white-space: pre-wrap;
  word-wrap: break-word;
}
.agente-bubble .t {
  display: block;
  font-family: var(--font-mono);
  font-size: 9.5px;
  margin-top: 4px;
  opacity: 0.55;
  letter-spacing: 0.04em;
}
.agente-bubble.user { background: #fff; border: 1px solid var(--ag-border-soft); align-self: flex-start; }
.agente-bubble.agent { background: var(--ag-ink); color: #fff; align-self: flex-end; }
.agente-bubble.operator {
  background: #fff4d6;
  border: 1px solid #d9b800;
  color: #3d3000;
  align-self: flex-end;
}
.agente-bubble.operator .by {
  display: block;
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #6b5400;
  margin-bottom: 3px;
  opacity: 0.85;
}
.agente-chat-input-wrap {
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--ag-border);
  background: var(--ag-surface);
}
.agente-chat-input {
  display: flex;
  gap: 8px;
  padding: 12px 14px;
  align-items: flex-end;
}
.agente-chat-input textarea {
  flex: 1;
  min-height: 44px;
  border: 1px solid var(--ag-border-soft);
  padding: 8px 10px;
  font-size: 13.5px;
  font-family: inherit;
  resize: vertical;
  border-radius: 2px;
  outline: none;
  background: var(--ag-bg);
}
.agente-chat-input textarea:focus { border-color: var(--ag-ink); background: #fff; }

.agente-clip-btn,
.agente-mic-btn,
.agente-attach-btn {
  width: 40px !important;
  min-width: 40px !important;
  height: 40px !important;
  padding: 0 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  border-radius: 50% !important;
  background: var(--ag-surface) !important;
  color: var(--ag-ink) !important;
  border: 1px solid var(--ag-border-soft) !important;
  flex: 0 0 40px !important;
}
.agente-clip-btn:hover,
.agente-mic-btn:hover,
.agente-attach-btn:hover {
  background: var(--ag-surface-2) !important;
  border-color: var(--ag-ink) !important;
}
.agente-clip-btn .ic,
.agente-mic-btn .ic,
.agente-attach-btn .ic {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  pointer-events: none;
}
.agente-clip-btn svg,
.agente-mic-btn svg,
.agente-attach-btn svg {
  display: block !important;
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.agente-mic-btn.recording {
  background: var(--ag-danger) !important;
  color: #fff !important;
  border-color: var(--ag-danger) !important;
  animation: agente-mic-pulse 1.1s ease-out infinite;
}
@keyframes agente-mic-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(200, 57, 44, 0.55); }
  70%  { box-shadow: 0 0 0 12px rgba(200, 57, 44, 0); }
  100% { box-shadow: 0 0 0 0 rgba(200, 57, 44, 0); }
}

/* Popover de adjuntos (anclado al botón clip, abre hacia arriba) */
.agente-attach-popover {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0;
  z-index: 30;
  background: var(--ag-surface);
  border: 1px solid var(--ag-border);
  border-radius: 6px;
  padding: 6px;
  min-width: 200px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.15);
}
.agente-attach-popover button {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  background: none;
  border: 0;
  border-radius: 4px;
  text-align: left;
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--ag-ink);
  cursor: pointer;
  transition: background .08s ease;
}
.agente-attach-popover button:hover {
  background: var(--ag-surface-2);
}
.agente-attach-popover button svg { flex: 0 0 14px; }
@media (max-width: 600px) {
  .agente-attach-popover {
    position: fixed;
    bottom: auto;
    top: auto;
    left: 12px;
    right: 12px;
    min-width: auto;
  }
}

.agente-attach-preview {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  margin: 8px 14px 0;
  background: var(--ag-surface-2);
  border: 1px dashed var(--ag-border-soft);
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--ag-ink);
  align-self: flex-start;
}

/* Voice note preview con player + boton eliminar */
.agente-voice-preview {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  margin: 8px 14px 0;
  background: var(--ag-surface-2);
  border: 1px solid var(--ag-border-soft);
  border-radius: 4px;
}
.agente-voice-preview .lbl {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ag-ink-muted);
  flex: 0 0 auto;
}
.agente-voice-preview .voice-player {
  flex: 1;
  height: 36px;
  outline: none;
  min-width: 180px;
}
.agente-voice-preview .x {
  background: none;
  border: 0;
  padding: 8px;
  cursor: pointer;
  color: var(--ag-ink-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  flex: 0 0 32px;
  width: 32px;
  height: 32px;
}
.agente-voice-preview .x:hover {
  color: var(--ag-danger);
  background: rgba(200, 57, 44, 0.08);
}

/* Recording bar minimalista (reemplaza textarea durante grabación) */
.agente-recording-bar {
  flex: 1;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  height: 44px;
  border: 1px solid var(--ag-ink);
  border-radius: 2px;
  background: var(--ag-surface);
}
.agente-recording-bar .dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--ag-danger);
  animation: agente-rec-blink 1s ease-in-out infinite;
}
.agente-recording-bar .t {
  font-size: 14px;
  font-weight: 600;
  color: var(--ag-ink);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
}
.agente-recording-bar .hint {
  font-size: 11.5px;
  color: var(--ag-ink-muted);
  margin-left: auto;
  font-family: var(--font-body);
}
@keyframes agente-rec-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}
.agente-attach-preview .nm { max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.agente-attach-preview .sz { color: var(--ag-ink-muted); font-size: 10.5px; }
.agente-attach-preview .x {
  background: none; border: none; cursor: pointer; color: var(--ag-ink-muted);
  display: inline-flex; align-items: center; padding: 0; margin-left: 4px;
}
.agente-attach-preview .x:hover { color: var(--ag-danger); }

/* Inline media en burbujas */
.agente-bubble .media-img {
  display: block;
  max-width: 280px;
  max-height: 280px;
  border-radius: 4px;
  margin-bottom: 6px;
  cursor: zoom-in;
}
.agente-bubble .media-audio,
.agente-bubble .media-video {
  display: block;
  width: 280px;
  margin-bottom: 6px;
}
.agente-bubble .media-video { max-height: 280px; }
.agente-bubble .media-file {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: rgba(0,0,0,0.05);
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 12px;
  text-decoration: none;
  color: inherit;
  margin-bottom: 6px;
}
.agente-bubble .media-file:hover { background: rgba(0,0,0,0.1); }
.agente-bubble.agent .media-file { background: rgba(255,255,255,0.15); color: #fff; }
.agente-bubble.agent .media-file:hover { background: rgba(255,255,255,0.25); }
.agente-bubble .media-chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 8px;
  background: rgba(0,0,0,0.06);
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 11px;
  margin-bottom: 4px;
}
.agente-bubble .msg-text { display: block; }
.agente-bubble.system {
  align-self: center; background: transparent;
  border: 1px dashed var(--ag-border-soft);
  font-size: 12px; font-family: var(--font-mono);
  color: var(--ag-ink-muted); max-width: 80%; text-align: center;
}

/* Empty + spread + row helpers (scoped) */
.agente-page .empty {
  border: 1px dashed var(--ag-border-soft);
  padding: 32px 20px;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ag-ink-muted);
  background: var(--ag-surface);
}
.agente-page .spread { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.agente-page .row { display: flex; align-items: center; gap: 10px; }
.agente-page .muted { color: var(--ag-ink-muted); }
.agente-page .mono { font-family: var(--font-mono); }
.agente-page .hr { height: 1px; background: var(--ag-border-soft); margin: 18px 0; }
.agente-page .spin { display: inline-block; animation: spin 0.9s linear infinite; }

/* Chips agente con colores success/warn/danger */
.agente-page .chip.success { color: var(--ag-success); border-color: var(--ag-success); background: transparent; }
.agente-page .chip.danger  { color: var(--ag-danger);  border-color: var(--ag-danger);  background: transparent; }
.agente-page .chip.warn    { color: var(--ag-warn);    border-color: var(--ag-warn);    background: transparent; }
.agente-page .chip .dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
  display: inline-block;
}
.agente-page .form-card .section-title { margin-top: 0; }


/* ── Agente: tabs dev (Conversaciones / Seguimientos) ── */
.agente-tabs {
  display: flex; gap: 4px; padding: 0 16px;
  border-bottom: 1px solid var(--border, #e5e7eb);
  background: var(--bg-surface, #fff);
}
.agente-tab {
  padding: 10px 16px; border: none; background: none; cursor: pointer;
  font-size: 14px; color: var(--text-muted, #6b7280);
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.agente-tab.active { color: var(--accent, #111); border-bottom-color: var(--accent, #111); font-weight: 600; }

/* ── Seguimientos view ── */
.seg-view { padding: 16px; }
.seg-toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.seg-filter { display: flex; align-items: center; gap: 6px; font-size: 14px; cursor: pointer; }
.seg-empty { padding: 40px; text-align: center; color: var(--text-muted, #6b7280); }
.seg-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.seg-table th { text-align: left; padding: 10px 12px; border-bottom: 2px solid var(--border, #e5e7eb); color: var(--text-muted, #6b7280); font-weight: 600; }
.seg-table td { padding: 10px 12px; border-bottom: 1px solid var(--border, #f0f0f0); }
.seg-table tr.seg-failed { background: #fef2f2; }
.seg-badge { padding: 2px 8px; border-radius: 12px; font-size: 12px; font-weight: 600; }
.seg-badge-ok { background: #dcfce7; color: #166534; }
.seg-badge-fail { background: #fee2e2; color: #991b1b; }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.seg-add-form { display: flex; flex-direction: column; gap: 8px; }
.seg-add-form label { font-size: 13px; color: var(--text-muted, #6b7280); margin-top: 8px; }
.seg-add-form input, .seg-add-form select { padding: 8px 10px; border: 1px solid var(--border, #e5e7eb); border-radius: 6px; font-size: 14px; }
.seg-add-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }

/* ─── Asistente de ayuda "Lupe" (help-widget.jsx) ─── */
.help-fab {
  position: fixed; bottom: 20px; right: 20px;
  width: 54px; height: 54px; border-radius: 50%;
  background: var(--ink); color: var(--bone);
  border: 2px solid var(--ink); cursor: pointer;
  font-size: 22px; line-height: 1; display: grid; place-items: center;
  box-shadow: 0 4px 14px rgba(0,0,0,.25); z-index: 90;
}
.help-fab:hover { filter: brightness(1.08); }
.help-panel {
  position: fixed; bottom: 84px; right: 20px;
  width: 360px; max-width: calc(100vw - 32px); height: 70vh; max-height: 560px;
  background: var(--paper); border: 2px solid var(--ink); border-radius: var(--radius-lg);
  display: flex; flex-direction: column; overflow: hidden;
  box-shadow: 0 10px 30px rgba(0,0,0,.3); z-index: 90;
}
.help-head {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--ink); color: var(--bone); padding: 12px 14px;
  font-family: var(--font-body); font-weight: 600; font-size: 14px;
}
.help-close { background: none; border: none; color: var(--bone); cursor: pointer; font-size: 16px; padding: 0 4px; }
.help-body {
  flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px;
  background: var(--bone);
}
.help-msg {
  max-width: 88%; padding: 9px 12px; border-radius: 10px;
  font-family: var(--font-body); font-size: 13.5px; line-height: 1.45; word-wrap: break-word;
}
.help-msg-assistant { align-self: flex-start; background: #fff; border: 1px solid var(--line-soft); color: var(--ink); }
.help-msg-user { align-self: flex-end; background: var(--ink); color: var(--bone); }
.help-msg strong { font-weight: 700; }
.help-typing { font-style: italic; color: var(--muted); }
.help-input-wrap {
  display: flex; gap: 8px; padding: 10px; border-top: 1px solid var(--line-soft); background: var(--paper);
}
.help-input {
  flex: 1; resize: none; border: 1px solid var(--line-soft); border-radius: var(--radius);
  padding: 8px 10px; font-family: var(--font-body); font-size: 13.5px; max-height: 90px;
}
.help-send { white-space: nowrap; }
@media (max-width: 600px) {
  .help-fab { bottom: 76px; right: 14px; }
  .help-panel { bottom: 140px; right: 14px; left: 14px; width: auto; height: 64vh; }
}


/* Galeria de fotos en el detalle del producto (admin) */
.gallery-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 8px; margin-top: 8px; }
.gallery-thumb { position: relative; aspect-ratio: 1; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line-soft); background: var(--bone-2); }
.gallery-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gallery-del { position: absolute; top: 3px; right: 3px; width: 22px; height: 22px; border-radius: 50%; border: 0; cursor: pointer; background: rgba(0,0,0,.6); color: #fff; display: flex; align-items: center; justify-content: center; padding: 0; }
.gallery-del:hover { background: var(--danger); }

/* ============================================================
   Análisis completo (views-f.jsx) — dashboard vivo
   ============================================================ */
.an-page { max-width: 1100px; }

/* Panel de lectura IA */
.an-ia-card { background: var(--paper); border: 1px solid var(--line-soft); border-left: 3px solid var(--ink);
  border-radius: var(--radius-lg); padding: 16px 18px; margin-bottom: 22px; }
.an-ia-top { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 4px; }
.an-ia-title { font-family: var(--font-display); font-size: 15px; text-transform: uppercase;
  display: flex; align-items: center; gap: 10px; }
.an-ia-badge { font-family: var(--font-mono); font-size: 10px; font-weight: 700; color: var(--bone);
  background: var(--ink); border-radius: 3px; padding: 2px 6px; letter-spacing: .05em; }
.an-ia-top .btn { margin-left: auto; }
.an-ia-meta { color: var(--muted); font-size: 11.5px; margin: 0 0 12px; line-height: 1.5; }
.an-ia-meta b { color: var(--ink); }
.an-ia-err { background: var(--bone-2); color: var(--ink); border: 1px solid var(--line-soft);
  border-radius: var(--radius); padding: 8px 12px; font-size: 12.5px; margin-bottom: 10px; }
.an-ia-empty { color: var(--muted); font-size: 13px; padding: 6px 0; }
.an-ia-empty b { color: var(--ink); }
.an-ia-list { margin: 0; padding-left: 0; list-style: none; display: flex; flex-direction: column; gap: 10px; }
.an-ia-list li { font-size: 13px; color: var(--ink); padding-left: 16px; position: relative; line-height: 1.5; }
.an-ia-list li:before { content: ""; position: absolute; left: 0; top: 8px; width: 6px; height: 6px;
  background: var(--ink); border-radius: 50%; }
.an-ia-list b { color: var(--black); }

/* Chat "Preguntale al análisis" (monocromo) */
.an-chat { background: var(--paper); border: 1px solid var(--line-soft); border-left: 3px solid var(--ink);
  border-radius: var(--radius-lg); padding: 16px 18px; margin-bottom: 22px; }
.an-chat-head { font-family: var(--font-display); font-size: 15px; text-transform: uppercase;
  display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.an-chat-box { max-height: 320px; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; padding: 2px; }
.an-chat-empty { color: var(--muted); font-size: 13px; }
.an-chat-sugs { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.an-chat-sug { font-size: 12px; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line-soft);
  background: var(--bone-2); color: var(--ink); cursor: pointer; text-align: left; }
.an-chat-sug:hover { border-color: var(--ink); }
.an-msg { display: flex; }
.an-msg.user { justify-content: flex-end; }
.an-msg.assistant { justify-content: flex-start; }
.an-msg-b { max-width: 82%; font-size: 13px; line-height: 1.5; padding: 9px 13px; border-radius: 12px; white-space: pre-wrap; }
.an-msg.user .an-msg-b { background: var(--ink); color: var(--bone); border-bottom-right-radius: 3px; }
.an-msg.assistant .an-msg-b { background: var(--bone-2); color: var(--ink); border: 1px solid var(--line-soft); border-bottom-left-radius: 3px; }
.an-msg-load { color: var(--muted); display: inline-flex; align-items: center; gap: 8px; }
.an-chat-input { display: flex; gap: 8px; align-items: flex-end; margin-top: 12px; }
.an-chat-input textarea { flex: 1; resize: none; font-family: var(--font-body); font-size: 13px;
  padding: 10px 12px; border: 1px solid var(--line-soft); border-radius: var(--radius); background: var(--bone);
  color: var(--ink); min-height: 40px; max-height: 120px; line-height: 1.4; }
.an-chat-input textarea:focus { outline: none; border-color: var(--ink); }
.an-chat-input .btn { min-height: 40px; }

/* KPIs */
.an-kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 8px; }
.an-kpi { background: var(--paper); border: 1px solid var(--line-soft); border-radius: var(--radius-lg); padding: 16px; }
.an-kpi-k { font-family: var(--font-mono); font-size: 10px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.an-kpi-v { font-family: var(--font-display); font-size: 28px; letter-spacing: -.01em; margin-top: 8px; line-height: .95; }
.an-kpi-s { font-size: 11.5px; color: var(--muted); margin-top: 7px; }
.an-kpi-s b.up { color: var(--ink); font-weight: 700; }
.an-kpi-s b.down { color: var(--muted); font-weight: 700; }

/* Secciones */
.an-sec { margin-top: 28px; }
.an-sec-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 10px; }
.an-sec-n { font-family: var(--font-mono); font-size: 11px; color: var(--muted); font-weight: 700; }
.an-sec-head h2 { font-family: var(--font-display); font-size: 17px; text-transform: uppercase; margin: 0; letter-spacing: -.01em; }
.an-note { color: var(--muted); font-size: 12.5px; margin: 0 0 12px; max-width: 78ch; }
.an-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.an-blk { font-family: var(--font-mono); font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 0 0 12px; }
.an-empty-mini { color: var(--muted); font-size: 13px; padding: 6px 0; }

/* Barras de magnitud */
.an-bar-row { display: grid; grid-template-columns: 132px 1fr; gap: 12px; align-items: center; margin-bottom: 9px; }
.an-bar-lab { font-size: 12.5px; color: var(--ink); text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.an-bar-track { position: relative; background: var(--bone-2); border-radius: var(--radius); height: 24px; overflow: hidden; }
.an-bar-fill { position: absolute; inset: 0 auto 0 0; background: var(--ink); display: flex; align-items: center;
  justify-content: flex-end; padding-right: 8px; color: var(--bone); font-size: 11px; font-weight: 700; min-width: 46px;
  font-variant-numeric: tabular-nums; }
.an-bar-fill.mut { background: var(--chrome-2); color: var(--ink); }

/* Barras apiladas (día × canal) */
.an-stack-row { display: grid; grid-template-columns: 92px 1fr 66px; gap: 10px; align-items: center; margin-bottom: 8px; }
.an-stack-d { font-size: 12.5px; }
.an-stack-d small { color: var(--muted); font-family: var(--font-mono); font-size: 10px; }
.an-stack-track { display: flex; height: 22px; border-radius: var(--radius); overflow: hidden; background: var(--bone-2); gap: 2px; }
.an-seg { height: 100%; }
.an-seg.tienda { background: var(--ink); }
.an-seg.web { background: var(--muted); }
.an-seg.cambio { background: var(--chrome); }
.an-seg.agente { background: var(--muted-2); }
.an-stack-tot { text-align: right; font-weight: 700; font-size: 12.5px; font-variant-numeric: tabular-nums; }

/* Leyenda + share */
.an-legend { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 12px; font-size: 12px; color: var(--ink); }
.an-legend.an-legend-col { flex-direction: column; gap: 8px; }
.an-legend span { display: inline-flex; align-items: center; gap: 7px; }
.an-sw { width: 11px; height: 11px; border-radius: 2px; display: inline-block; flex: 0 0 11px; }
.an-share { display: flex; height: 30px; border-radius: var(--radius); overflow: hidden; gap: 2px; margin-bottom: 12px; }
.an-share > div { display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 700; font-size: 11.5px; }

/* Flags / callouts */
.an-flag { background: var(--bone-2); border: 1px solid var(--line-soft); border-left: 3px solid var(--ink);
  border-radius: var(--radius-lg); padding: 13px 16px; font-size: 13px; color: var(--ink); }
.an-flag b { color: var(--black); }
.an-callout { background: var(--bone-2); border: 1px solid var(--line-soft); border-radius: var(--radius-lg);
  padding: 13px 16px; font-size: 13px; color: var(--ink); margin-top: 12px; }
.an-callout b { color: var(--black); }

/* Mini stats */
.an-mini { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.an-m { background: var(--bone-2); border-radius: var(--radius); padding: 13px; }
.an-mv { font-family: var(--font-display); font-size: 22px; letter-spacing: -.01em; }
.an-ml { font-size: 11px; color: var(--muted); margin-top: 4px; line-height: 1.3; }
.an-ml b { color: var(--ink); }

/* Tablas del análisis (scoped, no dependen de estilos globales) */
.an-page table { width: 100%; border-collapse: collapse; font-size: 13px; }
.an-page th { font-family: var(--font-mono); font-size: 10px; letter-spacing: .06em; text-transform: uppercase;
  color: var(--muted); text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line-soft);
  font-weight: 500; white-space: nowrap; background: var(--bone-2); }
.an-page td { padding: 10px 12px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.an-page tr:last-child td { border-bottom: none; }
.an-page .an-r { text-align: right; font-variant-numeric: tabular-nums; }
.an-page .an-rk { font-family: var(--font-mono); color: var(--muted-2); font-size: 12px; }
.an-stripe.crit { border-left: 3px solid var(--ink); }
.an-stripe.warn { border-left: 3px solid var(--chrome-2); }

/* Chips monocromos del análisis (estética Feeling: negro/crema, sin color) */
.an-chip { display: inline-flex; align-items: center; padding: 3px 9px; font-size: 10px;
  text-transform: uppercase; letter-spacing: .08em; font-weight: 700; border-radius: 999px;
  border: 1px solid transparent; white-space: nowrap; }
.an-chip-crit { background: var(--ink); color: var(--bone); border-color: var(--ink); }
.an-chip-warn { background: transparent; color: var(--ink); border-color: var(--ink); }
.an-chip-ok { background: var(--bone-2); color: var(--muted); border-color: var(--line-soft); }
.an-chip-mut { background: var(--bone-2); color: var(--muted-2); border-color: var(--line-soft); }

@media (max-width: 900px) {
  .an-kpis { grid-template-columns: repeat(2, 1fr); }
  .an-grid2 { grid-template-columns: 1fr; }
  .an-bar-row { grid-template-columns: 104px 1fr; }
  .an-page { max-width: 100%; }
}

/* Banner de acceso al análisis desde el dashboard */
.analisis-cta { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 16px;
  background: var(--black); color: var(--bone); border: 1px solid var(--ink); border-radius: var(--radius-lg);
  padding: 16px 20px; margin-bottom: 22px; cursor: pointer; text-align: left; transition: transform .06s ease; }
.analisis-cta:hover { background: #151515; }
.analisis-cta:active { transform: translateY(1px); }
.analisis-cta .ac-l { display: flex; align-items: center; gap: 14px; }
.analisis-cta .ac-txt { display: flex; flex-direction: column; }
.analisis-cta .ac-t { font-family: var(--font-display); font-size: 16px; text-transform: uppercase; letter-spacing: -.01em; }
.analisis-cta .ac-s { font-size: 12px; color: var(--chrome); margin-top: 2px; }
.analisis-cta .ac-go { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .1em; color: var(--bone); white-space: nowrap; }
.analisis-cta .ac-ic { color: var(--bone); flex: 0 0 auto; }
@media (max-width: 620px) { .analisis-cta .ac-s { display: none; } }
