/* =========================================================
   Manifiesto — sistema de diseno
   Paleta inspirada en manifiestos de carga y sellos de aduana
   ========================================================= */
:root {
  --ink: #14213d;
  --ink-soft: #1d2c4f;
  --paper: #f7f5f0;
  --surface: #ffffff;
  --line: #e5e1d6;
  --line-strong: #d8d3c4;
  --amber: #e8a33d;
  --amber-dark: #c97f1e;
  --amber-ink: #5c3d0e;
  --success: #2f6844;
  --success-bg: #e3efe6;
  --danger: #b23a2e;
  --danger-bg: #fbeae7;
  --info: #2f5d8a;
  --info-bg: #e7eef6;
  --slate: #5f6270;
  --slate-light: #8b8d97;
  --text: #1c1f2a;
  --radius: 8px;
  --radius-sm: 5px;
  --shadow: 0 1px 2px rgba(20, 33, 61, 0.06), 0 4px 16px rgba(20, 33, 61, 0.06);
  --font-ui: 'Space Grotesk', system-ui, sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, monospace;
}

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  background: var(--paper);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { margin: 0; font-family: var(--font-ui); font-weight: 600; letter-spacing: -0.01em; }
p { margin: 0; }
a { color: inherit; }
button { font-family: inherit; }
:focus-visible { outline: 2px solid var(--amber-dark); outline-offset: 2px; }
::selection { background: var(--amber); color: var(--ink); }

.mono { font-family: var(--font-mono); }

/* ---------- Estructura general ---------- */
#app { min-height: 100vh; }

.shell {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: var(--ink);
  color: #eef1fa;
  padding: 22px 16px;
  display: flex;
  flex-direction: column;
  gap: 22px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 0 8px;
}
.brand .mark {
  width: 10px; height: 10px;
  background: var(--amber);
  border-radius: 2px;
  transform: rotate(45deg);
  flex: none;
}
.brand span {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.brand small {
  display: block;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: #9aa4c4;
  letter-spacing: 0.04em;
  padding-left: 18px;
  margin-top: -4px;
}

.nav-group { display: flex; flex-direction: column; gap: 2px; }
.nav-label {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: #7d87ab;
  padding: 10px 10px 4px;
  letter-spacing: 0.03em;
}
.nav-link {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  color: #d7dcee;
  text-decoration: none;
  font-size: 14px;
  border-left: 2px solid transparent;
  cursor: pointer;
}
.nav-link:hover { background: rgba(255,255,255,0.06); color: #fff; }
.nav-link.active {
  background: rgba(232, 163, 61, 0.12);
  border-left-color: var(--amber);
  color: #fff;
  font-weight: 500;
}
.nav-link svg { width: 16px; height: 16px; flex: none; opacity: 0.85; }

.sidebar-footer {
  margin-top: auto;
  border-top: 1px solid rgba(255,255,255,0.1);
  padding-top: 14px;
  display: flex; flex-direction: column; gap: 10px;
}
.user-chip { display: flex; align-items: center; gap: 10px; padding: 0 8px; }
.user-chip .avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--amber); color: var(--ink);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px; flex: none;
}
.user-chip .who { min-width: 0; }
.user-chip .who .name { font-size: 13.5px; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-chip .who .role { font-size: 11.5px; color: #9aa4c4; }
.logout-btn {
  background: none; border: 1px solid rgba(255,255,255,0.15);
  color: #cfd5ea; border-radius: var(--radius-sm);
  padding: 7px 10px; font-size: 13px; cursor: pointer; text-align: left;
}
.logout-btn:hover { background: rgba(255,255,255,0.06); color: #fff; }

.main { display: flex; flex-direction: column; min-width: 0; }
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 28px; border-bottom: 1px solid var(--line);
  background: var(--paper);
  position: sticky; top: 0; z-index: 5;
}
.topbar h1 { font-size: 19px; }
.topbar .crumb { font-family: var(--font-mono); font-size: 11px; color: var(--slate-light); letter-spacing: 0.03em; margin-bottom: 3px; }
.hamburger { display: none; background: none; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); padding: 7px 9px; cursor: pointer; }

.topbar-actions { display: flex; align-items: center; gap: 8px; }
.icon-btn-wrap { position: relative; }
.icon-btn-wrap .btn svg { width: 18px; height: 18px; }
.notif-badge {
  position: absolute; top: -3px; right: -3px;
  background: var(--danger); color: #fff; font-size: 10px; font-weight: 700;
  min-width: 16px; height: 16px; border-radius: 8px; display: flex; align-items: center; justify-content: center;
  padding: 0 3px; font-family: var(--font-mono); border: 2px solid var(--paper);
}
.brand-logo { width: 22px; height: 22px; object-fit: contain; border-radius: 4px; flex: none; }

.content { padding: 26px 28px 60px; max-width: 1180px; width: 100%; }

/* ---------- Botones ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 16px; border-radius: var(--radius-sm);
  border: 1px solid transparent; cursor: pointer;
  font-size: 13.5px; font-weight: 500; font-family: var(--font-ui);
  transition: filter .12s ease, background .12s ease;
  white-space: nowrap;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--ink); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--ink-soft); }
.btn-accent { background: var(--amber); color: var(--ink); font-weight: 600; }
.btn-accent:hover:not(:disabled) { background: var(--amber-dark); color: #fff; }
.btn-outline { background: transparent; border-color: var(--line-strong); color: var(--text); }
.btn-outline:hover:not(:disabled) { border-color: var(--ink); }
.btn-ghost { background: transparent; color: var(--slate); }
.btn-ghost:hover:not(:disabled) { background: rgba(20,33,61,0.06); color: var(--text); }
.btn-danger { background: transparent; color: var(--danger); border-color: var(--danger-bg); }
.btn-danger:hover:not(:disabled) { background: var(--danger-bg); }
.btn-sm { padding: 5px 10px; font-size: 12.5px; }
.btn-icon { padding: 7px; }

/* ---------- Cards / superficies ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
}
.card + .card { margin-top: 16px; }
.card-title { font-size: 14.5px; font-weight: 600; margin-bottom: 4px; }
.card-sub { font-size: 12.5px; color: var(--slate); margin-bottom: 14px; }

.page-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px; margin-bottom: 20px; flex-wrap: wrap;
}
.page-header h2 { font-size: 22px; }
.page-header p { color: var(--slate); font-size: 13.5px; margin-top: 4px; max-width: 60ch; }

.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 20px; }
.stat-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px;
}
.stat-card .num { font-family: var(--font-mono); font-size: 26px; font-weight: 600; color: var(--ink); }
.stat-card .label { font-size: 12.5px; color: var(--slate); margin-top: 2px; }
.stat-card.accent { border-color: var(--amber); background: linear-gradient(180deg, #fff 0%, #fdf6ea 100%); }

/* ---------- Tablas ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
thead th {
  text-align: left; font-weight: 500; color: var(--slate);
  font-size: 11.5px; letter-spacing: 0.02em; font-family: var(--font-mono);
  padding: 11px 14px; border-bottom: 1px solid var(--line); white-space: nowrap;
  background: #fbfaf7;
}
tbody td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #fbfaf6; }
tbody tr.clickable { cursor: pointer; }
td.sku { font-family: var(--font-mono); font-size: 12.5px; color: var(--ink); }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; }

.empty-state {
  text-align: center; padding: 50px 20px; color: var(--slate);
}
.empty-state .glyph { font-size: 28px; margin-bottom: 10px; }
.empty-state h3 { font-size: 15px; color: var(--text); margin-bottom: 6px; }
.empty-state p { font-size: 13px; max-width: 40ch; margin: 0 auto; }

/* ---------- Pills / badges ---------- */
.pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: 20px;
  font-size: 11.5px; font-weight: 500; font-family: var(--font-mono);
  white-space: nowrap;
}
.pill-dot { width: 6px; height: 6px; border-radius: 50%; flex: none; }
.pill-slate { background: #eceef2; color: var(--slate); }
.pill-success { background: var(--success-bg); color: var(--success); }
.pill-danger { background: var(--danger-bg); color: var(--danger); }
.pill-info { background: var(--info-bg); color: var(--info); }
.pill-amber { background: #fbf0dc; color: var(--amber-ink); }

/* ---------- Formularios ---------- */
.field { margin-bottom: 15px; }
.field label {
  display: block; font-size: 12.5px; font-weight: 500; color: var(--slate); margin-bottom: 5px;
}
.field .hint { font-size: 11.5px; color: var(--slate-light); margin-top: 4px; }
.field .req { color: var(--danger); }
input[type=text], input[type=tel], input[type=email], input[type=password], input[type=number],
input[type=date], input[type=search], input[type=url], select, textarea {
  width: 100%; padding: 9px 11px; border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm); background: var(--surface);
  font-family: var(--font-ui); font-size: 13.5px; color: var(--text);
}
textarea { resize: vertical; min-height: 80px; }
input:focus, select:focus, textarea:focus { border-color: var(--ink); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.checkbox-row { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.checkbox-row input { width: auto; }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.inline-list { display: flex; flex-direction: column; gap: 8px; }
.inline-list-row { display: flex; gap: 8px; align-items: center; }

.search-bar { display: flex; gap: 10px; margin-bottom: 16px; align-items: center; flex-wrap: wrap; }
.search-bar input[type=search] { max-width: 320px; }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; }
.tab {
  padding: 9px 14px; font-size: 13.5px; color: var(--slate); cursor: pointer;
  border-bottom: 2px solid transparent; margin-bottom: -1px; background: none; border-top: none; border-left: none; border-right: none;
}
.tab.active { color: var(--ink); border-bottom-color: var(--amber-dark); font-weight: 600; }

/* ---------- Modal ---------- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(20,33,61,0.45);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 40px 16px; overflow-y: auto; z-index: 100;
}
.modal {
  background: var(--surface); border-radius: 12px; width: 100%; max-width: 560px;
  padding: 24px 26px; box-shadow: 0 20px 60px rgba(20,33,61,0.25);
}
.modal.modal-lg { max-width: 780px; }
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.modal-header h3 { font-size: 17px; }
.modal-close { background: none; border: none; cursor: pointer; color: var(--slate); font-size: 20px; line-height: 1; padding: 2px; }

/* ---------- Toast ---------- */
#toast-root { position: fixed; bottom: 20px; right: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 200; }
.toast {
  background: var(--ink); color: #fff; padding: 11px 16px; border-radius: var(--radius-sm);
  font-size: 13.5px; box-shadow: var(--shadow); min-width: 220px; max-width: 340px;
  border-left: 3px solid var(--amber);
}
.toast.error { border-left-color: var(--danger); }
.toast.success { border-left-color: var(--success); }

/* ---------- Login ---------- */
.login-screen {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: var(--ink);
  background-image: radial-gradient(circle at 15% 20%, rgba(232,163,61,0.10), transparent 40%),
                     radial-gradient(circle at 85% 80%, rgba(232,163,61,0.08), transparent 40%);
  padding: 20px;
}
.login-card {
  background: var(--surface); border-radius: 14px; padding: 38px 34px;
  width: 100%; max-width: 380px; box-shadow: 0 30px 80px rgba(0,0,0,0.35);
}
.login-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.login-brand .mark { width: 12px; height: 12px; background: var(--amber); border-radius: 2px; transform: rotate(45deg); }
.login-brand span { font-size: 19px; font-weight: 600; }
.login-card p.tag { color: var(--slate); font-size: 13px; margin-bottom: 26px; }
.login-error { background: var(--danger-bg); color: var(--danger); padding: 9px 12px; border-radius: var(--radius-sm); font-size: 13px; margin-bottom: 14px; }

/* ---------- Field builder / dynamic fields ---------- */
.field-type-chip {
  display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 5px;
  background: #eceef2; color: var(--slate); font-family: var(--font-mono); font-size: 10.5px;
}
.builder-row {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface);
}
.builder-row + .builder-row { margin-top: 8px; }
.builder-row .grip { color: var(--slate-light); font-size: 13px; cursor: grab; }
.builder-row .main { flex: 1; min-width: 0; }
.builder-row .main .label { font-weight: 500; font-size: 14px; }
.builder-row .main .meta { font-size: 11.5px; color: var(--slate); margin-top: 2px; }
.toggle-group { display: flex; gap: 14px; flex-wrap: wrap; }
.toggle-mini { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--slate); }
.toggle-mini input { width: auto; }

/* attachments / feedback thread */
.feedback-thread { display: flex; flex-direction: column; gap: 14px; }
.feedback-entry { border: 1px solid var(--line); border-radius: var(--radius); padding: 13px 15px; background: #fdfcfa; }
.feedback-entry .who { display: flex; justify-content: space-between; font-size: 12px; color: var(--slate); margin-bottom: 6px; }
.feedback-entry .who b { color: var(--text); }
.feedback-entry .comment { font-size: 13.5px; margin-bottom: 8px; white-space: pre-wrap; }
.att-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.att-chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px;
  border: 1px solid var(--line-strong); border-radius: 20px; font-size: 12px; text-decoration: none; color: var(--text);
  background: #fff;
}
.att-thumb { width: 96px; height: 72px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line-strong); }
.att-video { width: 160px; border-radius: 6px; border: 1px solid var(--line-strong); }

.order-item-card { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); margin-bottom: 14px; overflow: hidden; }
.order-item-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 16px; background: #fbfaf7; cursor: pointer; flex-wrap: wrap;
}
.order-item-head .title { font-weight: 600; font-size: 14.5px; }
.order-item-head .sku-line { font-family: var(--font-mono); font-size: 11.5px; color: var(--slate); margin-top: 2px; }
.order-item-body { padding: 16px; border-top: 1px solid var(--line); display: none; }
.order-item-body.open { display: block; }
.spec-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.spec-item .k { font-size: 11px; color: var(--slate); font-family: var(--font-mono); }
.spec-item .v { font-size: 13.5px; margin-top: 2px; }

.product-picker { border: 1px solid var(--line); border-radius: var(--radius); max-height: 280px; overflow-y: auto; }
.product-picker-row { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-bottom: 1px solid var(--line); font-size: 13px; }
.product-picker-row:last-child { border-bottom: none; }
.product-picker-row input { width: auto; }

.loading-block { padding: 40px; text-align: center; color: var(--slate); font-size: 13.5px; }

/* ---------- Responsive ---------- */
@media (max-width: 880px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; z-index: 50; left: 0; top: 0; height: 100vh; width: 230px;
    transform: translateX(-100%); transition: transform .2s ease;
  }
  .sidebar.open { transform: translateX(0); box-shadow: 20px 0 40px rgba(0,0,0,0.25); }
  .hamburger { display: inline-flex; }
  .content { padding: 18px 16px 50px; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .form-grid { grid-template-columns: 1fr; }
  .topbar { padding: 14px 16px; }
}
@media (max-width: 520px) {
  .stat-grid { grid-template-columns: 1fr; }
}

/* =========================================================
   v1.3 — Odoo (catalogo en tiempo real) y WhatsApp
   ========================================================= */

/* Interruptor si/no */
.switch { position: relative; display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 12.5px; color: var(--slate); user-select: none; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch .track {
  width: 36px; height: 20px; border-radius: 20px; background: var(--line-strong);
  position: relative; transition: background .15s ease; flex: none;
}
.switch .track::after {
  content: ''; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px;
  border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.2); transition: transform .15s ease;
}
.switch input:checked + .track { background: var(--success); }
.switch input:checked + .track::after { transform: translateX(16px); }
.switch input:focus-visible + .track { outline: 2px solid var(--amber-dark); outline-offset: 2px; }
.switch input:disabled + .track { opacity: .5; }

/* Barra de herramientas sobre tablas */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 14px; }
.toolbar .grow { flex: 1 1 240px; }
.toolbar input[type=search] { width: 100%; }
.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); overflow: hidden; background: var(--surface); }
.seg button { border: none; background: none; padding: 7px 12px; font-size: 13px; color: var(--slate); cursor: pointer; }
.seg button + button { border-left: 1px solid var(--line-strong); }
.seg button.active { background: var(--ink); color: #fff; }
.bulk-bar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  background: #fdf6ea; border: 1px solid var(--amber); border-radius: var(--radius); padding: 9px 12px; margin-bottom: 12px; font-size: 13px;
}
.bulk-bar b { font-family: var(--font-mono); }

.thumb { width: 40px; height: 40px; border-radius: 6px; object-fit: contain; background: #f2efe7; border: 1px solid var(--line); display: block; }
.thumb.empty { display: flex; align-items: center; justify-content: center; color: var(--slate-light); font-size: 16px; }
.muted { color: var(--slate); }
.small { font-size: 12px; }
.num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

/* Existencias por almacen */
.stock-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.stock-chip {
  display: inline-flex; align-items: baseline; gap: 6px; padding: 4px 9px; border-radius: 6px;
  border: 1px solid var(--line-strong); background: #fff; font-size: 12px; line-height: 1.3;
}
.stock-chip .wh { color: var(--slate); max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stock-chip .q { font-family: var(--font-mono); font-weight: 600; color: var(--ink); }
.stock-chip .q small { font-weight: 400; color: var(--slate); }
.stock-chip.zero { background: #f6f4ef; }
.stock-chip.zero .q { color: var(--slate-light); }
.stock-chip.low .q { color: var(--amber-dark); }
.stock-chip.ok { border-color: #bfd8c6; background: var(--success-bg); }

/* Catalogo del buscador */
.catalog-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.cat-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  display: flex; flex-direction: column; overflow: hidden; cursor: pointer; transition: border-color .12s, box-shadow .12s;
}
.cat-card:hover { border-color: var(--line-strong); box-shadow: var(--shadow); }
.cat-card .img { height: 150px; background: #f4f1ea; display: flex; align-items: center; justify-content: center; border-bottom: 1px solid var(--line); }
.cat-card .img img { max-width: 100%; max-height: 100%; object-fit: contain; }
.cat-card .img .ph { color: var(--slate-light); font-size: 34px; }
.cat-card .body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.cat-card .name { font-weight: 600; font-size: 14px; line-height: 1.3; }
.cat-card .meta { font-family: var(--font-mono); font-size: 11.5px; color: var(--slate); }
.cat-card .total { display: flex; justify-content: space-between; align-items: baseline; font-size: 12.5px; color: var(--slate); border-top: 1px dashed var(--line); padding-top: 8px; margin-top: auto; }
.cat-card .total b { font-family: var(--font-mono); font-size: 18px; color: var(--ink); }
.note-box { background: #fdf6ea; border-left: 3px solid var(--amber); padding: 7px 10px; font-size: 12.5px; border-radius: 0 6px 6px 0; white-space: pre-wrap; }

.live-dot { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--slate); }
.live-dot::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 3px var(--success-bg); }
.live-dot.off::before { background: var(--slate-light); box-shadow: 0 0 0 3px #eee; }
.live-dot.err::before { background: var(--danger); box-shadow: 0 0 0 3px var(--danger-bg); }

.alert { border-radius: var(--radius); padding: 12px 14px; font-size: 13px; margin-bottom: 14px; border: 1px solid; }
.alert-warn { background: #fdf6ea; border-color: var(--amber); color: var(--amber-ink); }
.alert-danger { background: var(--danger-bg); border-color: #e8b9b2; color: var(--danger); }
.alert-info { background: var(--info-bg); border-color: #c4d4e6; color: var(--info); }

/* Detalle de existencias */
.wh-table td, .wh-table th { padding: 7px 10px; }
.wh-table .loc td { color: var(--slate); font-size: 12.5px; }
.wh-table .loc td:first-child { padding-left: 26px; }

/* WhatsApp */
.wa-grid { display: grid; grid-template-columns: 360px 1fr; gap: 16px; align-items: start; }
.qr-box {
  width: 100%; aspect-ratio: 1; max-width: 300px; margin: 0 auto; border: 1px dashed var(--line-strong);
  border-radius: 12px; display: flex; align-items: center; justify-content: center; background: #fff; overflow: hidden; text-align: center; padding: 14px;
}
.qr-box img { width: 100%; height: 100%; object-fit: contain; image-rendering: pixelated; }
.wa-status { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 14px; margin-bottom: 14px; }
.wa-status .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--slate-light); }
.wa-status.connected .dot { background: #25d366; box-shadow: 0 0 0 4px #dcf8e7; }
.wa-status.qr .dot, .wa-status.starting .dot, .wa-status.reconnecting .dot { background: var(--amber); box-shadow: 0 0 0 4px #fbecd2; }
.wa-status.error .dot { background: var(--danger); }
.steps { margin: 0; padding-left: 18px; font-size: 13px; color: var(--slate); }
.steps li + li { margin-top: 4px; }
.tpl-row { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); padding: 14px 16px; }
.tpl-row + .tpl-row { margin-top: 12px; }
.tpl-row .head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 8px; }
.tpl-row textarea { font-family: var(--font-mono); font-size: 12.5px; min-height: 96px; }
.var-chip { font-family: var(--font-mono); font-size: 11px; padding: 2px 7px; border-radius: 4px; background: #f1eee6; border: 1px solid var(--line); cursor: pointer; }
.var-chip:hover { background: #fbecd2; border-color: var(--amber); }
.wa-preview {
  background: #e7ddd3; border-radius: 10px; padding: 12px; margin-top: 10px;
}
.wa-bubble {
  background: #dcf8c6; border-radius: 8px 8px 8px 2px; padding: 8px 10px; font-size: 13px; max-width: 420px;
  white-space: pre-wrap; box-shadow: 0 1px 1px rgba(0,0,0,.08); color: #111;
}
.recipient-list { max-height: 260px; overflow-y: auto; border: 1px solid var(--line); border-radius: var(--radius); }
.recipient-row { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-bottom: 1px solid var(--line); font-size: 13px; }
.recipient-row:last-child { border-bottom: none; }
.recipient-row input { width: auto; }

@media (max-width: 880px) {
  .wa-grid { grid-template-columns: 1fr; }
  .catalog-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
}

/* =========================================================
   v1.4 — Categorias, selector de productos y Odoo en ordenes
   ========================================================= */
.op-layout { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 16px; align-items: start; }
.cat-tree { padding: 0; position: sticky; top: 12px; max-height: calc(100vh - 24px); display: flex; flex-direction: column; overflow: hidden; }
.cat-tree-head { padding: 12px 12px 10px; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; }
.cat-tree-head b { font-size: 13.5px; }
.cat-tree-head input { padding: 7px 10px; font-size: 13px; }
.cat-tree-body { overflow-y: auto; padding: 6px; flex: 1; }
.cat-row {
  display: flex; align-items: center; gap: 8px; padding: 5px 8px; border-radius: 7px; cursor: pointer;
  font-size: 13px; border: 1px solid transparent; min-height: 40px;
}
.cat-row:hover { background: #f6f3ec; }
.cat-row.active { background: #fdf6ea; border-color: var(--amber); }
.cat-caret { width: 16px; flex: none; border: none; background: none; cursor: pointer; color: var(--slate); font-size: 11px; padding: 0; }
.cat-caret.none { cursor: default; }
.cat-thumb { border-radius: 7px; object-fit: cover; flex: none; background: #f2efe7; border: 1px solid var(--line); display: block; }
.cat-thumb-ph { display: inline-flex; align-items: center; justify-content: center; color: var(--ink); font-weight: 600; background: linear-gradient(135deg, #fbecd2, #f2efe7); }
.cat-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cat-count { font-family: var(--font-mono); font-size: 11px; color: var(--slate); flex: none; }
.cat-count b { color: var(--success); }

.cat-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 14px; padding: 14px 16px; }
.cat-head-img { position: relative; cursor: pointer; flex: none; }
.cat-head-img-edit {
  position: absolute; left: 0; right: 0; bottom: 0; text-align: center; font-size: 10px; color: #fff;
  background: rgba(20,33,61,.7); border-radius: 0 0 7px 7px; padding: 2px 0; opacity: 0; transition: opacity .12s;
}
.cat-head-img:hover .cat-head-img-edit, .cat-head-img:focus-within .cat-head-img-edit { opacity: 1; }

.src-badge {
  display: inline-block; font-family: var(--font-mono); font-size: 10px; font-weight: 600; letter-spacing: .03em;
  color: #714B67; background: #f3e8f0; border: 1px solid #e2cddb; border-radius: 4px; padding: 1px 5px; vertical-align: middle;
}

/* Selector de productos */
.pp-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.pp-chips:empty { display: none; }
.pp-chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 4px 3px 8px; border-radius: 16px;
  background: #fdf6ea; border: 1px solid var(--amber); font-size: 12px; max-width: 100%;
}
.pp-chip img { width: 18px; height: 18px; border-radius: 4px; object-fit: cover; }
.pp-chip button { border: none; background: none; cursor: pointer; font-size: 14px; line-height: 1; color: var(--amber-ink); padding: 0 4px; }
.product-picker-row.pp-disabled { opacity: .55; }
.pp-src button { padding: 6px 12px; }

/* Configuracion de origen */
.src-options { display: grid; gap: 8px; }
.src-option { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: var(--radius); cursor: pointer; font-size: 13.5px; }
.src-option input { width: auto; margin-top: 3px; }
.src-option.active { border-color: var(--amber); background: #fdf6ea; }

/* Producto Odoo dentro de la orden */
.odoo-block { display: flex; gap: 16px; align-items: flex-start; margin-bottom: 16px; flex-wrap: wrap; }
.odoo-img { width: 140px; height: 140px; flex: none; border: 1px solid var(--line); border-radius: 8px; background: #f4f1ea; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.odoo-img img { max-width: 100%; max-height: 100%; object-fit: contain; }
.spec-item.wide { grid-column: 1 / -1; }

td .btn-icon svg, .bulk-bar .btn-icon svg { width: 16px; height: 16px; display: block; }
.op-main { min-width: 0; }

@media (max-width: 980px) {
  .op-layout { grid-template-columns: minmax(0, 1fr); }
  .cat-tree { position: static; max-height: 320px; }
}
/* Las filas del selector dentro de un .field no deben heredar el estilo de etiqueta */
.field label.product-picker-row { display: flex; align-items: center; margin: 0; font-size: 13px; font-weight: 400; color: var(--text); text-transform: none; letter-spacing: 0; }
