/* ============================================================
   VIKINGS FITNESS — Admin Design System
   Palette: #0D0D0D · #FFFFFF · #2B2B2B · #E66E1D (accent)
   Type: Poppins
   ============================================================ */

/* ---------- Tokens ---------- */
:root {
  /* Surface ramp (dark, premium) */
  --bg:            #0D0D0D;
  --surface:       #141414;
  --surface-2:     #191919;
  --elevated:      #1F1F1F;
  --border:        #2B2B2B;
  --border-soft:   #232323;
  --border-strong: #3A3A3A;

  /* Ink ramp */
  --ink:           #FFFFFF;
  --ink-2:         #C9C9CE;
  --ink-3:         #8A8A93;
  --ink-4:         #5E5E66;

  /* Accent — used sparingly */
  --accent:        #E66E1D;
  --accent-hover:  #F07E30;
  --accent-press:  #CC5F14;
  --accent-soft:   rgba(230, 110, 29, 0.14);
  --accent-line:   rgba(230, 110, 29, 0.35);

  /* Semantic status */
  --ok:      #3FB98C;
  --ok-soft: rgba(63, 185, 140, 0.14);
  --info:    #5B93F0;
  --info-soft: rgba(91, 147, 240, 0.14);
  --warn:    #E6A23C;
  --warn-soft: rgba(230, 162, 60, 0.14);
  --danger:  #E5544B;
  --danger-soft: rgba(229, 84, 75, 0.14);
  --neutral-soft: rgba(255,255,255,0.06);

  /* Manuable (guías de envío) — morado */
  --manuable:        #7C5CFC;
  --manuable-hover:  #8E71FF;
  --manuable-press:  #6A48E8;
  --manuable-soft:   rgba(124, 92, 252, 0.14);

  /* Radii */
  --r-xs: 6px;
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 22px;
  --r-full: 999px;

  /* Spacing rhythm */
  --s-1: 4px;  --s-2: 8px;  --s-3: 12px; --s-4: 16px;
  --s-5: 20px; --s-6: 24px; --s-8: 32px; --s-10: 40px; --s-12: 48px;

  /* Shadow / depth */
  --shadow-sm: 0 1px 2px rgba(0,0,0,.4);
  --shadow-md: 0 8px 24px -8px rgba(0,0,0,.6);
  --shadow-lg: 0 24px 60px -18px rgba(0,0,0,.7);
  --shadow-pop: 0 12px 40px -8px rgba(0,0,0,.65), 0 0 0 1px var(--border);

  /* Motion — Apple-style ease-out, minimal */
  --ease: cubic-bezier(0.22, 1, 0.36, 1);      /* ease-out-quint */
  --ease-soft: cubic-bezier(0.33, 1, 0.68, 1); /* ease-out-cubic */
  --t-fast: 130ms;
  --t: 220ms;
  --t-slow: 360ms;

  /* Layout */
  --sidebar-w: 248px;
  --sidebar-collapsed: 76px;
  --topbar-h: 64px;

  /* Z-scale (semantic) */
  --z-base: 1;
  --z-sticky: 100;
  --z-drawer: 300;
  --z-backdrop: 400;
  --z-modal: 500;
  --z-toast: 700;
  --z-tooltip: 800;
}

/* ---------- Reset ---------- */
* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; overflow-x: hidden; }
body {
  font-family: 'Poppins', system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow: hidden;
  width: 100%;
  max-width: 100%;
  overscroll-behavior-x: none;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: none; }
a { color: inherit; text-decoration: none; }
ul { list-style: none; }
::selection { background: var(--accent-soft); }
img, svg { display: block; }

/* Scrollbar */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #262626; border-radius: 999px; border: 3px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: #333; }

/* ---------- Typographic scale ---------- */
.h1 { font-size: 28px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.15; }
.h2 { font-size: 22px; font-weight: 600; letter-spacing: -0.015em; }
.h3 { font-size: 17px; font-weight: 600; letter-spacing: -0.01em; }
.eyebrow { font-size: 11px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); }
.muted { color: var(--ink-3); }
.mono { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; letter-spacing: -0.01em; }
.num { font-variant-numeric: tabular-nums; }

/* ============================================================
   APP SHELL
   ============================================================ */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  height: 100vh;
  height: 100dvh;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
  transition: grid-template-columns var(--t) var(--ease);
}
.app.collapsed { grid-template-columns: var(--sidebar-collapsed) 1fr; }

/* ---------- Sidebar ---------- */
.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border-soft);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
  z-index: var(--z-sticky);
}
.brand {
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 20px;
  border-bottom: 1px solid var(--border-soft);
  flex-shrink: 0;
}
.brand-mark {
  width: 34px; height: 34px; border-radius: 9px;
  background: var(--ink);
  color: var(--bg);
  display: grid; place-items: center;
  font-weight: 800; font-size: 18px; letter-spacing: -0.04em;
  flex-shrink: 0;
}
.brand-name { font-weight: 700; letter-spacing: -0.01em; font-size: 15px; white-space: nowrap; }
.brand-name small { display: block; font-size: 10px; font-weight: 500; letter-spacing: 0.14em; color: var(--ink-3); text-transform: uppercase; }
.collapsed .brand-name, .collapsed .nav-label, .collapsed .nav-section-title, .collapsed .sidebar-foot .u-meta { opacity: 0; pointer-events: none; }

.nav {
  flex: 1;
  overflow-y: auto;
  padding: 14px 12px;
  display: flex; flex-direction: column; gap: 2px;
}
.nav-section-title {
  font-size: 10px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--ink-4); padding: 16px 12px 6px; white-space: nowrap;
  transition: opacity var(--t-fast) var(--ease);
}
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 12px; border-radius: var(--r-sm);
  color: var(--ink-3);
  position: relative;
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
  white-space: nowrap;
}
.nav-item svg { width: 19px; height: 19px; flex-shrink: 0; stroke-width: 1.7; }
.nav-item:hover { background: var(--neutral-soft); color: var(--ink-2); }
.nav-item.active { background: var(--elevated); color: var(--ink); }
.nav-item.active::before {
  content: ""; position: absolute; left: -12px; top: 50%; transform: translateY(-50%);
  width: 3px; height: 18px; border-radius: 0 3px 3px 0; background: var(--accent);
}
.nav-label { transition: opacity var(--t-fast) var(--ease); }
.nav-badge {
  margin-left: auto; font-size: 11px; font-weight: 600;
  background: var(--accent-soft); color: var(--accent);
  padding: 1px 7px; border-radius: var(--r-full); font-variant-numeric: tabular-nums;
}
.collapsed .nav-badge { display: none; }

.sidebar-foot {
  padding: 12px; border-top: 1px solid var(--border-soft); flex-shrink: 0;
}
.u-card {
  display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: var(--r-sm);
  transition: background var(--t-fast) var(--ease);
}
.u-card:hover { background: var(--neutral-soft); }
.avatar {
  width: 34px; height: 34px; border-radius: var(--r-full); flex-shrink: 0;
  background: linear-gradient(135deg, #2b2b2b, #191919);
  display: grid; place-items: center; font-weight: 600; font-size: 13px; color: var(--ink-2);
  border: 1px solid var(--border);
}
.u-meta { min-width: 0; transition: opacity var(--t-fast) var(--ease); }
.u-meta b { display: block; font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.u-meta span { font-size: 11px; color: var(--ink-3); }

/* ---------- Topbar ---------- */
.main { display: flex; flex-direction: column; min-width: 0; overflow: hidden; }
/* Aviso global de modo de pruebas: visible en todas las ventanas cuando el ERP
   opera sobre el entorno de staging. */
.staging-banner {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 16px; font-size: 13px; line-height: 1.35;
  color: #3a2a06; background: var(--warn);
  border-bottom: 1px solid rgba(0,0,0,.18);
  box-shadow: 0 1px 4px rgba(0,0,0,.15); z-index: 40;
}
/* El atributo `hidden` debe ganarle a `display:flex` (si no, el banner nunca
   se oculta al pasar a producción). */
.staging-banner[hidden] { display: none; }
.staging-banner svg { width: 18px; height: 18px; flex: 0 0 auto; stroke-width: 2; }
.staging-banner b { font-weight: 800; }

/* ---- Editor de formularios (Configuración → Formularios) ---- */
.fe-section { margin-top: 18px; }
.fe-section-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.fe-section-title { font-weight: 700; font-size: 13.5px; display: flex; align-items: center; gap: 8px; }
.fe-section-title .fe-count { font-weight: 500; color: var(--ink-4); font-size: 12px; }
.fe-list { display: flex; flex-direction: column; gap: 8px; }
.fe-field {
  display: grid; grid-template-columns: 22px 26px 1fr 150px 92px 34px; align-items: center; gap: 10px;
  padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface);
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease), opacity .15s;
}
.fe-field:hover { border-color: var(--border-strong, var(--accent)); }
.fe-field.fe-dragging { opacity: .45; }
.fe-field.fe-dragover { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft, rgba(230,110,29,.18)); }
.fe-field.fe-locked { background: var(--neutral-soft); }
.fe-handle { cursor: grab; color: var(--ink-4); display: flex; align-items: center; justify-content: center; }
.fe-handle:active { cursor: grabbing; }
.fe-handle svg { width: 16px; height: 16px; }
.fe-field .fe-key { font-size: 11px; color: var(--ink-4); }
.fe-field .fe-key code { font-size: 11px; }
.fe-field input.input, .fe-field select.select { height: 34px; }
.fe-badge { display: inline-block; font-size: 9.5px; font-weight: 700; letter-spacing: .03em; padding: 2px 6px; border-radius: 999px; background: var(--neutral-soft); color: var(--ink-4); vertical-align: middle; }
.fe-vis { display: flex; align-items: center; justify-content: center; }
.fe-req { display: flex; align-items: center; justify-content: center; }
.fe-head-row { display: grid; grid-template-columns: 22px 26px 1fr 150px 92px 34px; gap: 10px; padding: 0 12px 4px; font-size: 10.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-4); font-weight: 700; }
@media (max-width: 720px) {
  .fe-field, .fe-head-row { grid-template-columns: 22px 1fr 84px; }
  .fe-field .fe-vis, .fe-field .fe-type, .fe-head-row .fe-h-vis, .fe-head-row .fe-h-type, .fe-field .fe-key { display: none; }
}
.topbar {
  height: var(--topbar-h); flex-shrink: 0;
  display: flex; align-items: center; gap: 12px;
  padding: 0 24px;
  background: rgba(13,13,13,0.72);
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  border-bottom: 1px solid var(--border-soft);
  position: relative; z-index: var(--z-sticky);
}
.icon-btn {
  width: 38px; height: 38px; border-radius: var(--r-sm);
  display: grid; place-items: center; color: var(--ink-3);
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease), transform var(--t-fast) var(--ease);
  position: relative;
}
.icon-btn svg { width: 19px; height: 19px; stroke-width: 1.7; }
.icon-btn:hover { background: var(--neutral-soft); color: var(--ink); }
.icon-btn:active { transform: scale(0.94); }
.icon-btn .dot {
  position: absolute; top: 3px; right: 3px; min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 9px; background: var(--accent); border: 2px solid var(--bg);
  color: #fff; font-size: 10px; font-weight: 700; line-height: 1;
  align-items: center; justify-content: center; box-sizing: border-box;
}
.searchbar {
  flex: 1; max-width: 460px; height: 40px; position: relative;
  display: flex; align-items: center; gap: 10px;
  padding: 0 14px; border-radius: var(--r-md);
  background: var(--surface-2); border: 1px solid var(--border-soft);
  color: var(--ink-3);
  transition: border-color var(--t) var(--ease), background var(--t) var(--ease);
}
.global-search-results {
  position: absolute; top: calc(100% + 8px); left: 0; right: 0; z-index: 60;
  max-height: min(70vh, 520px); overflow-y: auto;
  background: var(--elevated); border: 1px solid var(--border);
  border-radius: var(--r-md); box-shadow: 0 18px 44px rgba(0,0,0,.28);
  padding: 6px;
}
.gsr-group-title {
  font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase;
  color: var(--ink-4); padding: 10px 10px 5px;
}
.gsr-item {
  display: flex; align-items: center; gap: 11px; width: 100%; text-align: left;
  padding: 9px 10px; border-radius: 9px; cursor: pointer; border: none; background: none;
  color: var(--ink); transition: background var(--t) var(--ease);
}
.gsr-item:hover, .gsr-item.gsr-active { background: var(--surface-2); }
.gsr-item.gsr-active { outline: 2px solid var(--accent); outline-offset: -2px; }
.gsr-item .gsr-ic {
  width: 30px; height: 30px; flex-shrink: 0; border-radius: 8px;
  display: grid; place-items: center; background: var(--surface-2); color: var(--ink-3);
}
.gsr-item .gsr-ic svg { width: 16px; height: 16px; }
.gsr-item b { font-weight: 600; font-size: 13px; }
.gsr-item .gsr-meta { display: block; font-size: 11.5px; color: var(--ink-3); }
.gsr-item .gsr-right { margin-left: auto; text-align: right; font-size: 12px; color: var(--ink-3); white-space: nowrap; }
.gsr-msg { padding: 16px 12px; text-align: center; color: var(--ink-3); font-size: 12.5px; }

/* Buscador del listado de pedidos: input y botón alineados y de igual alto. */
.orders-search { display: flex; gap: 8px; align-items: center; }
.orders-search .input { width: 230px; max-width: 48vw; }
.orders-search .btn { height: 42px; white-space: nowrap; }
@media (max-width: 640px) {
  .orders-search { width: 100%; margin-top: 10px; }
  .orders-search .input { flex: 1; width: auto; max-width: none; min-width: 0; }
  /* Botón compacto: solo el ícono, cuadrado, para que no se desborde. */
  .orders-search-btn { width: 42px; padding: 0; flex: none; }
  .orders-search-btn .orders-search-label { display: none; }
  .orders-search-btn svg { margin: 0; }
}
/* Separación entre el buscador y el listado de pedidos. */
.orders-table { margin-top: 25px; }

/* Enlace del producto hacia la ficha en la tienda. */
.prod-link { color: var(--accent); text-decoration: none; border-bottom: 1px solid transparent; }
.prod-link:hover { border-bottom-color: currentColor; }

/* Filtros de pedidos: canal + estado + periodo. */
.orders-filter-row { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 10px; }
.orders-filter-field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.orders-filter-field > span { font-size: 11px; font-weight: 600; color: var(--ink-3); letter-spacing: .02em; }
.orders-filter-field .select { min-width: 180px; }

/* En tablet/móvil cada filtro ocupa una línea completa para evitar textos
   recortados y mantener Canal, Estado y Periodo legibles. */
@media (max-width: 900px) {
  .orders-filter-row {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  .orders-filter-field {
    width: 100%;
    flex: none;
  }
  .orders-filter-field .select,
  .orders-filter-field .input {
    min-width: 0;
    width: 100%;
    max-width: none;
  }
}

/* En tablet y pantallas intermedias el bloque de filtros aprovecha mejor el
   ancho disponible sin quedar limitado al contenido del encabezado. */
@media (min-width: 641px) and (max-width: 1100px) {
  .orders-section-head {
    align-items: stretch;
    flex-direction: column;
  }
  .orders-filters-wrap,
  .orders-filter-row {
    width: min(100%, 760px);
  }
  .orders-filter-field {
    width: min(100%, 760px);
  }
  .orders-filter-field .select,
  .orders-filter-field .input {
    width: 100%;
    min-width: 0;
    max-width: none;
  }
  .orders-search {
    width: min(100%, 760px);
    max-width: none;
  }
}

/* En celular los filtros y el buscador usan todo el ancho útil de la tarjeta. */
@media (max-width: 640px) {
  .orders-section-head {
    align-items: stretch;
    flex-direction: column;
    padding-left: 14px;
    padding-right: 14px;
  }
  .orders-filters-wrap,
  .orders-filter-row,
  .orders-filter-field,
  .orders-search {
    width: 100%;
    max-width: none;
  }
  .orders-filter-field .select,
  .orders-filter-field .input {
    width: 100%;
    min-width: 0;
    max-width: none;
  }
}
.searchbar:focus-within { border-color: var(--border-strong); background: var(--elevated); }
.searchbar svg { width: 17px; height: 17px; flex-shrink: 0; }
.searchbar input { flex: 1; background: none; border: none; outline: none; color: var(--ink); font-size: 13.5px; }
.searchbar input::placeholder { color: var(--ink-4); }
.searchbar kbd {
  font-family: inherit; font-size: 11px; color: var(--ink-3);
  background: var(--elevated); border: 1px solid var(--border); border-radius: 5px;
  padding: 2px 6px; font-variant-numeric: tabular-nums;
}
.spacer { flex: 1; }

.branch-select {
  display: flex; align-items: center; gap: 9px; height: 40px; padding: 0 14px;
  border-radius: var(--r-md); background: var(--surface-2); border: 1px solid var(--border-soft);
  transition: border-color var(--t-fast) var(--ease), background var(--t-fast) var(--ease);
}
.branch-select:hover { border-color: var(--border-strong); background: var(--elevated); }
.branch-select .pin { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); }
.branch-select b { font-size: 13px; font-weight: 600; }
.branch-select svg { width: 15px; height: 15px; color: var(--ink-3); }

/* ---------- Content area ---------- */
.content { flex: 1; overflow-y: auto; overflow-x: hidden; scroll-behavior: smooth; }
.page { padding: 28px 32px 64px; max-width: 1560px; margin: 0 auto; }
.page-head {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 20px;
  margin-bottom: 24px; flex-wrap: wrap;
}
.page-head .sub { color: var(--ink-3); font-size: 13.5px; margin-top: 5px; }
.breadcrumb { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--ink-3); margin-bottom: 10px; }
.breadcrumb a:hover { color: var(--ink-2); }
.breadcrumb svg { width: 13px; height: 13px; opacity: .5; }

/* ============================================================
   COMPONENTS
   ============================================================ */

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 16px; border-radius: var(--r-sm);
  font-size: 13.5px; font-weight: 600; letter-spacing: -0.01em;
  border: 1px solid transparent; white-space: nowrap;
  transition: background var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease),
              transform var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.btn svg { width: 17px; height: 17px; stroke-width: 2; }
.btn:active { transform: scale(0.975); }
.btn-primary { background: var(--accent); color: #1a0d03; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-primary:active { background: var(--accent-press); }
.btn-white { background: var(--ink); color: var(--bg); }
.btn-white:hover { background: #e8e8e8; }
.btn-ghost { background: var(--surface-2); color: var(--ink-2); border-color: var(--border); }
.btn-ghost:hover { background: var(--elevated); color: var(--ink); border-color: var(--border-strong); }
.btn-quiet { background: transparent; color: var(--ink-3); }
.btn-quiet:hover { background: var(--neutral-soft); color: var(--ink); }
.btn-danger { background: var(--danger-soft); color: var(--danger); }
.btn-danger:hover { background: rgba(229,84,75,.24); }
.btn-manuable { background: var(--manuable); color: #fff; }
.btn-manuable:hover { background: var(--manuable-hover); }
.btn-manuable:active { background: var(--manuable-press); }
.btn-manuable:disabled { opacity: .55; cursor: not-allowed; }
.btn-sm { height: 34px; padding: 0 12px; font-size: 12.5px; }
.btn-icon-only { width: 40px; padding: 0; }
.btn:disabled { opacity: .45; pointer-events: none; }

/* Cards */
.card {
  background: var(--surface); border: 1px solid var(--border-soft); border-radius: var(--r-lg);
}
.card-pad { padding: 20px; }

/* KPI */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; margin-bottom: 22px; }
.kpi {
  background: var(--surface); border: 1px solid var(--border-soft); border-radius: var(--r-md);
  padding: 18px; position: relative; overflow: hidden;
  transition: border-color var(--t) var(--ease), transform var(--t) var(--ease);
}
.kpi:hover { border-color: var(--border); transform: translateY(-2px); }
.kpi.feature { background: linear-gradient(160deg, #1c1206 0%, var(--surface) 46%); border-color: var(--accent-line); }
.kpi-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.kpi-label { font-size: 12.5px; color: var(--ink-3); font-weight: 500; }
.kpi-ic { width: 32px; height: 32px; border-radius: var(--r-sm); background: var(--elevated); display: grid; place-items: center; color: var(--ink-2); }
.kpi.feature .kpi-ic { background: var(--accent-soft); color: var(--accent); }
.kpi-ic svg { width: 17px; height: 17px; stroke-width: 1.8; }
.kpi-value { font-size: 27px; font-weight: 600; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; line-height: 1; }
.kpi-value .unit { font-size: 14px; color: var(--ink-3); font-weight: 500; margin-left: 3px; letter-spacing: 0; }
.kpi-sub { margin-top: 9px; font-size: 12px; display: flex; align-items: center; gap: 6px; color: var(--ink-3); }
.trend { display: inline-flex; align-items: center; gap: 3px; font-weight: 600; font-variant-numeric: tabular-nums; }
.trend.up { color: var(--ok); }
.trend.down { color: var(--danger); }
.trend svg { width: 13px; height: 13px; }

/* Dashboard detail sections: full-width single-column hierarchy on every viewport. */
.dashboard-single-column {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
  width: 100%;
  min-width: 0;
}
.dashboard-single-column > .card { min-width: 0; width: 100%; }
.dash-store-status-grid{display:block;max-width:580px}
.dash-store-error{font-size:12px;margin:8px 0}
.dash-order-backup-inline{display:flex;align-items:center;justify-content:space-between;gap:10px;padding:4px 0;font-size:12.5px}
.dash-order-backup-inline .chip{white-space:nowrap}
@media(max-width:450px){.dash-order-backup-inline{flex-wrap:wrap}}

/* Section grid */
.grid-2 { display: grid; grid-template-columns: 1.6fr 1fr; gap: 16px; align-items: start; }
.grid-2b { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.section-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; padding: 18px 20px 0; }
.section-head .h3 { display: flex; align-items: center; gap: 10px; }
.camino-filter-select { display: none; }
.camino-table-wrap { margin-top: 14px; }
.link-more { font-size: 12.5px; color: var(--ink-3); font-weight: 500; display: inline-flex; align-items: center; gap: 4px; transition: color var(--t-fast) var(--ease); }
.link-more:hover { color: var(--accent); }
.link-more svg { width: 14px; height: 14px; }

/* Status chips */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  height: 24px; padding: 0 9px; border-radius: var(--r-full);
  font-size: 11.5px; font-weight: 600; letter-spacing: -0.005em; white-space: nowrap;
  border: 1px solid transparent;
}
.chip .glyph { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.chip svg { width: 13px; height: 13px; }
.chip-ok { background: var(--ok-soft); color: var(--ok); } .chip-ok .glyph { background: var(--ok); }
.chip-info { background: var(--info-soft); color: var(--info); } .chip-info .glyph { background: var(--info); }
.chip-warn { background: var(--warn-soft); color: var(--warn); } .chip-warn .glyph { background: var(--warn); }
.chip-danger { background: var(--danger-soft); color: var(--danger); } .chip-danger .glyph { background: var(--danger); }
.chip-accent { background: var(--accent-soft); color: var(--accent); } .chip-accent .glyph { background: var(--accent); }
.chip-neutral { background: var(--neutral-soft); color: var(--ink-3); } .chip-neutral .glyph { background: var(--ink-3); }

/* Dashboard: horizontal touch scrolling for Top productos on tablets and phones.
   min-width:0 prevents grid children from expanding beyond their track. */
.grid-2 > .card { min-width: 0; }
.dashboard-top-products-scroll {
  display: block;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  touch-action: pan-x pan-y;
}
.dashboard-top-products-scroll > .tbl {
  min-width: 690px;
  width: 100%;
}
.dashboard-top-products-scroll .tbl td:first-child,
.dashboard-top-products-scroll .tbl th:first-child {
  min-width: 300px;
}

/* Tables */
.table-wrap { overflow-x: auto; border-radius: 0 0 var(--r-lg) var(--r-lg); }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl thead th {
  text-align: left; font-weight: 500; font-size: 11.5px; color: var(--ink-3);
  padding: 11px 16px; border-bottom: 1px solid var(--border-soft);
  white-space: nowrap; position: sticky; top: 0; background: var(--surface); z-index: 2;
}
.tbl thead th.r, .tbl td.r { text-align: right; }
.tbl tbody td { padding: 12px 16px; border-bottom: 1px solid var(--border-soft); vertical-align: middle; white-space: nowrap; }
.tbl tbody tr { transition: background var(--t-fast) var(--ease); }
.tbl tbody tr:hover { background: var(--surface-2); }
.tbl tbody tr:last-child td { border-bottom: none; }
.tbl .num { font-variant-numeric: tabular-nums; }

/* Inventario agrupado por producto: fila-cabecera + variantes desglosables */
tr.inv-group-row { cursor: pointer; }
tr.inv-group-row:hover { background: var(--surface-2); }
tr.inv-group-row.open { background: var(--surface-2); }
.inv-chevron { display: inline-flex; transition: transform var(--t-fast) var(--ease); }
tr.inv-group-row.open .inv-chevron { transform: rotate(90deg); }
tr.inv-variant-row { display: none; background: var(--surface-2); }
tr.inv-variant-row.open { display: table-row; }
tr.inv-variant-row > td:first-child { padding-left: 34px; }

.cell-prod { display: flex; align-items: center; gap: 11px; }
.thumb {
  width: 38px; height: 38px; border-radius: var(--r-sm); flex-shrink: 0;
  background: var(--elevated); border: 1px solid var(--border); overflow: hidden;
  display: grid; place-items: center; color: var(--ink-4); font-size: 10px;
}
.thumb.sq { border-radius: 7px; }
.cell-prod b { font-weight: 600; font-size: 13px; }
.cell-prod span { display: block; font-size: 11.5px; color: var(--ink-4); font-variant-numeric: tabular-nums; }
.sku { font-size: 12px; color: var(--ink-3); font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }

/* Distribución: paquetes asignados a sucursales con su avance operativo */
.dist-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 16px; }
.dist-pkg { padding: 16px; display: flex; flex-direction: column; gap: 14px; }
.dist-pkg-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.dist-steps {
  display: flex; align-items: center; flex-wrap: wrap; gap: 4px;
  padding: 10px 12px; background: var(--surface-2); border-radius: 10px;
}
.dist-step { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--ink-4); white-space: nowrap; }
.dist-step .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--border-strong); flex-shrink: 0; }
.dist-step.done { color: var(--ink-3); }
.dist-step.done .dot { background: var(--ok); }
.dist-step.active { color: var(--ink); font-weight: 600; }
.dist-step.active .dot { background: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.dist-sep { flex: 1; min-width: 8px; height: 1px; background: var(--border); }
.dist-pkg-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-top: auto; }
.scan-ok { background: var(--ok-soft); }
@media (max-width: 640px){ .dist-grid { grid-template-columns: 1fr; } }

/* Toolbar over tables */
.toolbar {
  display: flex; align-items: center; gap: 10px; padding: 14px 16px; flex-wrap: wrap;
  border-bottom: 1px solid var(--border-soft);
}
.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--border-soft); border-radius: var(--r-sm); padding: 3px; gap: 2px; }
.seg button {
  height: 30px; padding: 0 13px; border-radius: 6px; font-size: 12.5px; font-weight: 500; color: var(--ink-3);
  transition: color var(--t-fast) var(--ease), background var(--t-fast) var(--ease);
  display: inline-flex; align-items: center; gap: 6px;
}
.seg button .cnt { font-size: 11px; color: var(--ink-4); font-variant-numeric: tabular-nums; }
.seg button.on { background: var(--elevated); color: var(--ink); box-shadow: var(--shadow-sm); }
.seg button.on .cnt { color: var(--ink-3); }
.filter-chip {
  display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 12px;
  border-radius: var(--r-sm); background: var(--surface-2); border: 1px solid var(--border-soft);
  font-size: 12.5px; color: var(--ink-2); font-weight: 500;
  transition: border-color var(--t-fast) var(--ease), background var(--t-fast) var(--ease);
}
.filter-chip:hover { border-color: var(--border-strong); background: var(--elevated); }
.filter-chip svg { width: 15px; height: 15px; color: var(--ink-3); }
.filter-chip.active { border-color: var(--accent-line); background: var(--accent-soft); color: var(--accent); }
.filter-chip.active svg { color: var(--accent); }

/* Filtro POS (chips combinables) — envuelve en varias filas con alineación consistente */
.pos-filter {
  display: flex; flex-wrap: wrap;
  column-gap: 8px; row-gap: 8px;
  align-items: center; align-content: flex-start;
  padding: 30px 2px 14px;
}
.pos-filter .chip { flex: 0 0 auto; }
.pos-filter-label {
  align-self: center; flex: 0 0 auto;
  font-size: 11.5px; text-transform: uppercase; letter-spacing: .4px;
  margin-right: 2px;
}
/* En pantallas chicas la etiqueta encabeza su propia fila para que los chips no queden desfasados */
@media (max-width: 640px) {
  .pos-filter { row-gap: 10px; }
  .pos-filter-label { flex: 1 0 100%; margin-right: 0; }
}

/* Progress */
.bar { height: 6px; border-radius: var(--r-full); background: var(--elevated); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: inherit; background: var(--accent); transition: width var(--t-slow) var(--ease); }
.bar.ok > i { background: var(--ok); }
.bar.warn > i { background: var(--warn); }

/* Mini bar chart (CSS) */
.chart { display: flex; align-items: flex-end; gap: 8px; height: 180px; padding: 20px; }
.chart .col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 8px; height: 100%; justify-content: flex-end; }
.chart .col .stack { width: 100%; max-width: 34px; border-radius: 6px 6px 3px 3px; background: var(--elevated); position: relative; transition: transform var(--t) var(--ease); }
.chart .col:hover .stack { transform: scaleY(1.02); }
.chart .col .stack.hl { background: linear-gradient(180deg, var(--accent) 0%, var(--accent-press) 100%); }
.chart .col label { font-size: 11px; color: var(--ink-4); }

/* Horizontal bars list */
.hbars { padding: 8px 20px 18px; display: flex; flex-direction: column; gap: 15px; }
.hbar-row .top { display: flex; justify-content: space-between; font-size: 12.5px; margin-bottom: 7px; }
.hbar-row .top b { font-weight: 600; }
.hbar-row .top .v { color: var(--ink-3); font-variant-numeric: tabular-nums; }

/* Donut (conic) */
.donut-wrap { display: flex; align-items: center; gap: 22px; padding: 8px 20px 20px; }
.donut { width: 132px; height: 132px; border-radius: 50%; flex-shrink: 0; position: relative; }
.donut::after { content: ""; position: absolute; inset: 20px; background: var(--surface); border-radius: 50%; }
.donut-center { position: absolute; inset: 0; display: grid; place-items: center; z-index: 2; text-align: center; }
.donut-center b { font-size: 22px; font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.donut-center span { font-size: 10.5px; color: var(--ink-3); }
.legend { display: flex; flex-direction: column; gap: 11px; flex: 1; }
.legend li { display: flex; align-items: center; gap: 9px; font-size: 12.5px; }
.legend .sw { width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; }
.legend .lv { margin-left: auto; color: var(--ink-3); font-variant-numeric: tabular-nums; }

/* Alerts list */
.alerts { display: flex; flex-direction: column; }
.alert-row {
  display: flex; gap: 13px; padding: 14px 20px; border-bottom: 1px solid var(--border-soft);
  transition: background var(--t-fast) var(--ease);
}
.alert-row:last-child { border-bottom: none; }
.alert-row:hover { background: var(--surface-2); }
.alert-ic { width: 32px; height: 32px; border-radius: var(--r-sm); display: grid; place-items: center; flex-shrink: 0; }
.alert-ic svg { width: 16px; height: 16px; }
.alert-ic.warn { background: var(--warn-soft); color: var(--warn); }
.alert-ic.danger { background: var(--danger-soft); color: var(--danger); }
.alert-ic.info { background: var(--info-soft); color: var(--info); }
.alert-ic.success { background: var(--ok-soft, rgba(34,197,94,.14)); color: var(--ok, #22c55e); }
.alert-body b { font-size: 13px; font-weight: 600; display: block; }
.alert-body span { font-size: 12px; color: var(--ink-3); }
.alert-time { margin-left: auto; font-size: 11.5px; color: var(--ink-4); white-space: nowrap; flex-shrink: 0; }

/* Quick actions */
.qa-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px,1fr)); gap: 12px; }
.qa {
  display: flex; flex-direction: column; gap: 12px; padding: 16px; border-radius: var(--r-md);
  background: var(--surface); border: 1px solid var(--border-soft); text-align: left;
  transition: border-color var(--t) var(--ease), transform var(--t) var(--ease), background var(--t) var(--ease);
}
.qa:hover { border-color: var(--border-strong); transform: translateY(-2px); background: var(--surface-2); }
.qa-ic { width: 40px; height: 40px; border-radius: var(--r-sm); background: var(--elevated); display: grid; place-items: center; color: var(--ink); }
.qa:hover .qa-ic { background: var(--accent-soft); color: var(--accent); }
.qa-ic svg { width: 20px; height: 20px; stroke-width: 1.7; }
.qa b { font-size: 13.5px; font-weight: 600; }
.qa span { font-size: 11.5px; color: var(--ink-3); }

/* Stepper */
.stepper { display: flex; align-items: center; gap: 0; margin-bottom: 26px; }
.step { display: flex; align-items: center; gap: 11px; }
.step .dot {
  width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
  font-size: 13px; font-weight: 600; flex-shrink: 0;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--ink-3);
  transition: all var(--t) var(--ease);
}
.step .lbl { font-size: 13px; font-weight: 500; color: var(--ink-3); white-space: nowrap; }
.step.done .dot { background: var(--ok-soft); border-color: transparent; color: var(--ok); }
.step.active .dot { background: var(--accent); border-color: transparent; color: #1a0d03; }
.step.active .lbl { color: var(--ink); }
.step-line { flex: 1; height: 1px; background: var(--border); margin: 0 14px; min-width: 20px; }
.step.done + .step-line { background: var(--ok); }

/* Forms */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px,1fr)); gap: 16px; }
.field { display: flex; flex-direction: column; gap: 7px; }
.field label { font-size: 12.5px; font-weight: 500; color: var(--ink-2); display: flex; align-items: center; gap: 6px; }
.field label .req { color: var(--accent); }
.field .hint { font-size: 11.5px; color: var(--ink-4); }
.input, .select {
  height: 42px; padding: 0 13px; border-radius: var(--r-sm);
  background: var(--surface-2); border: 1px solid var(--border); color: var(--ink);
  font-size: 13.5px; outline: none; width: 100%;
  transition: border-color var(--t-fast) var(--ease), background var(--t-fast) var(--ease);
}
.input::placeholder { color: var(--ink-4); }
.input:focus, .select:focus { border-color: var(--accent-line); background: var(--elevated); }
.input.locked { background: var(--surface); color: var(--ink-3); border-style: dashed; }
textarea.input { height: auto; padding: 11px 13px; resize: vertical; min-height: 84px; line-height: 1.5; }
.input-group { display: flex; align-items: center; gap: 0; }
.input-group .input { border-radius: var(--r-sm) 0 0 var(--r-sm); border-right: none; }
.input-group .addon {
  height: 42px; display: grid; place-items: center; padding: 0 12px;
  background: var(--elevated); border: 1px solid var(--border); border-radius: 0 var(--r-sm) var(--r-sm) 0;
  color: var(--ink-3); font-size: 12px; font-weight: 600;
}
.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238A8A93' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px; }

/* Variant matrix */
.matrix { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
.matrix th { font-size: 11.5px; font-weight: 500; color: var(--ink-3); padding: 10px 8px; text-align: center; border-bottom: 1px solid var(--border); }
.matrix th:first-child, .matrix td:first-child { text-align: left; padding-left: 16px; }
.matrix td { padding: 6px 8px; text-align: center; border-bottom: 1px solid var(--border-soft); }
.matrix .color-tag { display: inline-flex; align-items: center; gap: 8px; font-weight: 500; }
.matrix .color-tag .sw { width: 14px; height: 14px; border-radius: 4px; border: 1px solid var(--border-strong); }
.qty-in {
  width: 52px; height: 34px; text-align: center; border-radius: 7px;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--ink);
  font-size: 13px; font-variant-numeric: tabular-nums; outline: none;
  transition: border-color var(--t-fast) var(--ease), background var(--t-fast) var(--ease);
}
.qty-in:focus { border-color: var(--accent-line); background: var(--elevated); }
.qty-in.filled { border-color: var(--border-strong); }
.matrix .rowtot { font-weight: 600; font-variant-numeric: tabular-nums; color: var(--accent); }
.matrix tfoot td { padding: 12px 8px; font-weight: 600; border-top: 1px solid var(--border); font-variant-numeric: tabular-nums; }

/* Checkbox */
.chk { width: 18px; height: 18px; border-radius: 5px; border: 1.5px solid var(--border-strong); background: var(--surface-2); display: grid; place-items: center; transition: all var(--t-fast) var(--ease); flex-shrink: 0; cursor: pointer; }
.chk svg { width: 12px; height: 12px; opacity: 0; transform: scale(.6); transition: all var(--t-fast) var(--ease); color: #1a0d03; }
.chk.on { background: var(--accent); border-color: var(--accent); }
.chk.on svg { opacity: 1; transform: scale(1); }

/* Timeline */
.timeline { padding: 6px 20px 20px; position: relative; }
.tl-item { display: flex; gap: 14px; padding-bottom: 18px; position: relative; }
.tl-item:last-child { padding-bottom: 0; }
.tl-rail { display: flex; flex-direction: column; align-items: center; flex-shrink: 0; }
.tl-node { width: 12px; height: 12px; border-radius: 50%; background: var(--elevated); border: 2px solid var(--border-strong); z-index: 1; margin-top: 3px; }
.tl-node.done { background: var(--ok); border-color: var(--ok); }
.tl-node.active { background: var(--accent); border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.tl-line { flex: 1; width: 2px; background: var(--border-soft); margin: 3px 0; }
.tl-item:last-child .tl-line { display: none; }
.tl-body b { font-size: 13px; font-weight: 600; }
.tl-body p { font-size: 12px; color: var(--ink-3); margin-top: 2px; }
.tl-body .meta { font-size: 11px; color: var(--ink-4); margin-top: 4px; display: flex; gap: 10px; }

/* Sucursal cards */
.branch-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px,1fr)); gap: 16px; }
.branch-card { padding: 20px; }
.branch-card .bh { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 18px; }
.branch-card .bh h4 { font-size: 15.5px; font-weight: 600; }
.branch-card .bh .code { font-size: 12px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.branch-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 16px; }
.branch-stat b { font-size: 20px; font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.branch-stat span { font-size: 11.5px; color: var(--ink-3); display: block; }
.branch-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 14px; border-top: 1px solid var(--border-soft); }
.branch-address { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.branch-edit-btn { position: relative; z-index: 2; flex: 0 0 auto; pointer-events: auto; }

/* Tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border-soft); margin-bottom: 20px; overflow-x: auto; }
.tab { padding: 11px 14px; font-size: 13px; font-weight: 500; color: var(--ink-3); position: relative; white-space: nowrap; transition: color var(--t-fast) var(--ease); }
.tab:hover { color: var(--ink-2); }
.tab.on { color: var(--ink); }
.tab.on::after { content: ""; position: absolute; left: 8px; right: 8px; bottom: -1px; height: 2px; background: var(--accent); border-radius: 2px; }

/* Empty / placeholder view */
.empty { display: grid; place-items: center; padding: 80px 20px; text-align: center; }
.empty .ic { width: 64px; height: 64px; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--border-soft); display: grid; place-items: center; margin-bottom: 18px; color: var(--ink-3); }
.empty .ic svg { width: 28px; height: 28px; stroke-width: 1.6; }
.empty h3 { font-size: 17px; font-weight: 600; margin-bottom: 7px; }
.empty p { color: var(--ink-3); max-width: 380px; font-size: 13.5px; }

/* Drawer */
.backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: var(--z-backdrop);
  opacity: 0; pointer-events: none; transition: opacity var(--t) var(--ease);
  backdrop-filter: blur(2px);
}
.backdrop.show { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(480px, 92vw);
  background: var(--surface); border-left: 1px solid var(--border); z-index: var(--z-modal);
  transform: translateX(100%); transition: transform var(--t-slow) var(--ease);
  display: flex; flex-direction: column; box-shadow: var(--shadow-lg);
}
.drawer.show { transform: translateX(0); }
.drawer.wide { width: 96vw; max-width: 1400px; }
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 20px 22px; border-bottom: 1px solid var(--border-soft); }
.drawer-body { flex: 1; overflow-y: auto; padding: 22px; }
.drawer-foot { padding: 16px 22px; border-top: 1px solid var(--border-soft); display: flex; flex-wrap: wrap; gap: 10px; }

/* Toast */
.toast-zone { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: var(--z-toast); display: flex; flex-direction: column; gap: 10px; align-items: center; }
.toast {
  display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: var(--r-md);
  background: var(--elevated); border: 1px solid var(--border); box-shadow: var(--shadow-pop);
  font-size: 13.5px; font-weight: 500; min-width: 280px;
  animation: toastIn var(--t-slow) var(--ease);
}
.toast .ti { width: 26px; height: 26px; border-radius: 7px; display: grid; place-items: center; flex-shrink: 0; background: var(--ok-soft); color: var(--ok); }
.toast .ti svg { width: 15px; height: 15px; }
@keyframes toastIn { from { opacity: 0; transform: translateY(14px) scale(.97); } to { opacity: 1; transform: none; } }

/* Info rows (product ficha) */
.info-list { display: flex; flex-direction: column; }
.info-row { display: flex; justify-content: space-between; padding: 11px 0; border-bottom: 1px solid var(--border-soft); font-size: 13px; }
.info-row:last-child { border-bottom: none; }
.info-row .k { color: var(--ink-3); }
.info-row .v { font-weight: 500; font-variant-numeric: tabular-nums; }
.copy-chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border: 1px solid var(--border); border-radius: 7px; background: var(--surface-2, var(--surface)); color: inherit; font: inherit; font-weight: 600; cursor: pointer; transition: background var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease); }
.copy-chip:hover { border-color: var(--accent); background: var(--accent-soft, rgba(0,0,0,.04)); }
.copy-chip .copy-ic { width: 15px; height: 15px; opacity: .6; }
.copy-chip:hover .copy-ic { opacity: 1; }

/* Location tag */
.loc { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.loc svg { width: 13px; height: 13px; color: var(--ink-4); }

/* View transitions */
.view { display: none; }
.view.active { display: block; animation: viewIn var(--t) var(--ease-soft); }
@keyframes viewIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* Stagger helper for lists */
.stagger > * { animation: staggerIn var(--t) var(--ease-soft) backwards; }
@keyframes staggerIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* Section wrapper spacing */
.stack-lg > * + * { margin-top: 16px; }

/* Responsive */
@media (max-width: 1180px) {
  /* minmax(0,1fr) permite que la columna se encoja por debajo del contenido;
     sin esto, una tabla o texto sin wrap desborda la tarjeta en el teléfono. */
  .grid-2, .grid-2b { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 900px) {
  .app { grid-template-columns: var(--sidebar-collapsed) 1fr; }
  .app .nav-label, .app .brand-name, .app .nav-section-title, .app .u-meta { opacity: 0; pointer-events: none; }
  /* En el riel colapsado por media query (sin la clase .collapsed) hay que
     ocultar también los badges: con margin-left:auto y la etiqueta invisible
     que aún ocupa ancho, se iban muy a la derecha y desbordaban el riel. */
  .app .nav-badge { display: none; }
  .sidebar, .nav { overflow-x: hidden; }
  .searchbar { max-width: none; }
  .branch-select b { display: none; }
  .page { padding: 24px 16px calc(120px + env(safe-area-inset-bottom, 0px)); }
  .content { -webkit-overflow-scrolling: touch; }
  /* First tap expands the sidebar over the content, second tap navigates. */
  .app.nav-open .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: var(--sidebar-w); z-index: 600; box-shadow: var(--shadow-lg); }
  .app.nav-open .brand-name, .app.nav-open .nav-label, .app.nav-open .nav-section-title, .app.nav-open .sidebar-foot .u-meta { opacity: 1 !important; pointer-events: auto !important; }
  .app.nav-open .nav-badge { display: inline-flex !important; }
  .app.nav-open .nav-scrim { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 590; }
}
.nav-scrim { display: none; }

/* Catálogo de ofertas */
.offer-editor{display:flex;flex-direction:column;gap:16px}.offer-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}.offer-section{padding:15px;border:1px solid var(--border);border-radius:12px;background:var(--surface-2)}.offer-section-head{display:flex;align-items:center;justify-content:space-between;gap:12px}.offer-condition{display:grid;grid-template-columns:1fr 1.2fr .75fr 1.2fr 38px;gap:8px;margin-top:10px;align-items:center}.select-inline{width:auto;display:inline-block;padding:5px 28px 5px 8px}.offer-check{display:flex;align-items:center;gap:9px;padding:10px 0;font-size:13px;color:var(--ink-2)}
.offer-qty-value{display:grid;grid-template-columns:minmax(0,1fr) 92px;gap:6px;min-width:0}.offer-qty-value>:only-child{grid-column:1/-1}.offer-sim-controls{display:grid;grid-template-columns:auto 110px minmax(220px,1fr);gap:10px;align-items:center;margin-bottom:16px;padding:12px 14px;border:1px solid var(--border);border-radius:10px;background:var(--surface-2)}.offer-sim-controls label{font-size:12px;font-weight:700}.offer-sim-controls .hint{margin:0}
.offer-help{display:inline-flex;align-items:center;justify-content:center;width:17px;height:17px;margin-left:4px;border:1px solid var(--border);border-radius:50%;font-size:11px;color:var(--ink-3);cursor:help}.offer-preview-summary{display:grid;grid-template-columns:repeat(3,1fr);gap:10px;margin-bottom:16px}.offer-preview-summary>div{display:flex;flex-direction:column;gap:3px;padding:12px 14px;border:1px solid var(--border);border-radius:10px;background:var(--surface-2)}.offer-preview-summary span{font-size:11px}.offer-preview-summary b{font-size:13px}
.offer-product-value{width:100%;min-width:0;height:39px;display:flex;align-items:center;justify-content:space-between;gap:8px;padding:0 11px;color:var(--ink-2);background:var(--surface);border:1px solid var(--border);border-radius:8px;cursor:pointer;text-align:left}.offer-product-value:hover{border-color:var(--accent);color:var(--ink)}.offer-product-value span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.offer-product-value svg{width:17px;height:17px;flex:none}.offer-picker-search{position:sticky;top:-20px;z-index:2;padding:4px 0 14px;background:var(--surface)}.offer-picker-search .search-wrap{position:relative}.offer-picker-search .search-wrap>svg{position:absolute;left:12px;top:50%;width:17px;height:17px;transform:translateY(-50%);color:var(--ink-3);z-index:1}.offer-picker-search input{padding-left:38px}.offer-picker-results{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:9px}.offer-picker-card{display:grid;grid-template-columns:54px minmax(0,1fr) auto 18px;align-items:center;gap:11px;padding:10px;background:var(--surface-2);color:var(--ink);border:1px solid var(--border);border-radius:11px;text-align:left;cursor:pointer;transition:border-color var(--t-fast),background var(--t-fast)}.offer-picker-card:hover{border-color:var(--accent);background:var(--elevated)}.offer-picker-card>svg{width:17px;height:17px;color:var(--ink-3)}.offer-picker-info{display:flex;min-width:0;flex-direction:column;gap:2px}.offer-picker-info b,.offer-picker-info span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.offer-picker-info b{font-size:13px}.offer-picker-info span{font-size:11px}.offer-picker-price{font-size:12px;font-weight:700;white-space:nowrap}
.offer-sim-list{display:flex;flex-direction:column;gap:8px}.offer-sim-row{display:grid;grid-template-columns:minmax(220px,1fr) repeat(3,minmax(92px,120px));gap:12px;align-items:center;padding:11px 13px;border:1px solid var(--border);border-radius:11px;background:var(--surface-2)}.offer-sim-product{display:flex;align-items:center;gap:10px;min-width:0}.offer-sim-product>div{display:flex;flex-direction:column;gap:2px;min-width:0}.offer-sim-product b{font-size:12.5px;line-height:1.3;white-space:normal;overflow-wrap:anywhere}.offer-sim-product span{font-size:10.5px;white-space:normal;line-height:1.25}.offer-sim-price{display:flex;flex-direction:column;gap:3px;text-align:right}.offer-sim-price span{font-size:10.5px;color:var(--ink-3)}.offer-sim-price b{font-size:13px;white-space:nowrap}.offer-sim-price.featured{padding:7px 9px;border-radius:8px;background:var(--elevated)}
@media(max-width:760px){.offer-grid,.offer-preview-summary,.offer-picker-results{grid-template-columns:1fr}.offer-condition{grid-template-columns:1fr 1fr}.offer-condition .icon-btn{grid-column:2;justify-self:end}.offer-section-head{align-items:flex-start;flex-direction:column}.offer-picker-card{grid-template-columns:48px minmax(0,1fr) 18px}.offer-picker-thumb img,.offer-picker-thumb>div{width:48px!important;height:48px!important}.offer-picker-price{display:none}.offer-sim-row{grid-template-columns:1fr 1fr 1fr}.offer-sim-product{grid-column:1/-1}.offer-sim-price{text-align:left}.offer-sim-controls{grid-template-columns:1fr}.offer-sim-controls .input{width:100%}}
@media (max-width: 640px) {
  .hide-sm { display: none !important; }
  .page-head { flex-direction: column; align-items: stretch; }
  .page-head > div { width: 100%; }
  /* Los grupos de botones envuelven a varias filas en vez de desbordar sin scroll */
  .page-head > div[style*="flex"] { flex-wrap: wrap; }
  .page-head > div[style*="flex"] .btn { flex: 1 1 auto; min-width: 140px; }
  /* Topbar: evitar que el buscador y los iconos de la derecha se salgan */
  .topbar { padding: 0 12px; gap: 8px; }
  .topbar .spacer { display: none; }
  .searchbar { min-width: 0; overflow: hidden; }
  .searchbar input { min-width: 0; }
  .searchbar kbd { display: none; }
  .branch-select { display: none; }
  .grid-2b { grid-template-columns: minmax(0, 1fr); }
  /* minmax(0,1fr) capa el track al ancho del contenedor; sin esto el track
     crece hasta el min-content de la tarjeta y la desborda. */
  .branch-grid { grid-template-columns: minmax(0, 1fr); }
  .branch-card { min-width: 0; }
  /* Las estadísticas de sucursal se encogen y envuelven en vez de estirar
     la tarjeta más allá de la pantalla (valores largos como el gerente). */
  .branch-stats, .branch-stat { min-width: 0; }
  .branch-stat b { overflow-wrap: anywhere; font-size: 16px; }
  .kpi-grid { grid-template-columns: 1fr; }
  .stepper { overflow-x: auto; padding-bottom: 8px; }
  .step .lbl { display: none; }
  .step.active .lbl { display: inline; }
  /* Drawer (shipment detail) full-screen and thumb-friendly on phones */
  .drawer, .drawer.wide { width: 100vw; max-width: none; }
  .drawer-body { padding: 16px; }
  .drawer-foot { flex-direction: column; padding: 12px 16px; }
  .drawer-foot .btn { flex: 0 0 auto !important; width: 100%; }
  .info-row { flex-wrap: wrap; gap: 2px 12px; }
  .info-row .v { text-align: left; }
  .section-head { flex-wrap: wrap; row-gap: 8px; }
  /* On phones: collapse the status filter into a single dropdown to save space */
  .camino-filters { display: none !important; }
  .camino-filter-select { display: block; width: 100%; }
  .camino-table-wrap { margin-top: 18px; }
  /* "Mercancía en camino" table → stacked cards on phones so actions are reachable */
  .camino-table-wrap { overflow-x: hidden; }
  .camino-tbl thead { display: none; }
  .camino-tbl, .camino-tbl tbody, .camino-tbl tr, .camino-tbl td { display: block; width: auto; max-width: 100%; }
  /* Only real data rows become cards; empty-state / message rows stay as-is. */
  .camino-tbl tr.camino-data-row { border: 1px solid var(--border); border-radius: 12px; margin: 0 0 10px; padding: 6px 14px; background: var(--surface); }
  /* `.camino-tbl tbody td` supera en especificidad a `.tbl tbody td`
     (que fija white-space: nowrap y hace que correos y asuntos largos
     se desborden de la tarjeta). */
  .camino-tbl tbody td { border: none; padding: 8px 0; min-height: 0; white-space: normal; overflow-wrap: anywhere; word-break: break-word; }
  .camino-tbl td[data-label] { display: flex; justify-content: space-between; align-items: baseline; gap: 14px; text-align: right; }
  .camino-tbl td[data-label] > * { min-width: 0; }
  .camino-tbl td[data-label]::before { content: attr(data-label); color: var(--ink-3); font-weight: 600; text-align: left; white-space: nowrap; flex: 0 0 auto; }
  /* Celda de asunto/confirmación (colspan, sin data-label): a ancho completo,
     alineada a la izquierda, con envoltura del texto. */
  .camino-tbl td[colspan]:not([data-label]):not(.tbl-actions) { text-align: left; }
  .camino-tbl td.tbl-actions { display: flex; justify-content: flex-start; flex-wrap: wrap; gap: 8px; padding-top: 12px; margin-top: 4px; border-top: 1px solid var(--border-soft); white-space: normal; }
  .camino-tbl td.tbl-actions .btn { flex: 1; }
  .empty { padding: 48px 14px; }
  .empty p { max-width: 100%; }
}

/* Patrón genérico tabla → tarjetas en móvil (opt-in con .tbl-cards) */
@media (max-width: 640px) {
  /* La tabla nunca debe forzar scroll horizontal en modo tarjeta.
     Solo se restringe el wrap de las tablas-tarjeta; las demás tablas
     (dentro de modales, etc.) conservan su scroll horizontal. */
  .tbl-cards thead { display: none; }
  .table-wrap:has(.tbl-cards) { overflow-x: hidden; }
  .tbl-cards { width: 100%; max-width: 100%; table-layout: fixed; }
  .tbl-cards, .tbl-cards tbody, .tbl-cards tr, .tbl-cards td { display: block; width: auto; max-width: 100%; }
  .tbl-cards tr.tbl-card-row {
    border: 1px solid var(--border); border-radius: 12px;
    margin: 0 0 10px; padding: 6px 14px; background: var(--surface);
  }
  /* Cada celda: etiqueta fija a la izquierda, valor a la derecha que envuelve.
     Se usa `.tbl-cards tbody td` para ganar en especificidad a `.tbl tbody td`
     (que fija white-space: nowrap). */
  .tbl-cards tbody td {
    border: none; padding: 8px 0 8px 40%; min-height: 0; position: relative;
    text-align: right; white-space: normal; overflow-wrap: anywhere; word-break: break-word;
  }
  .tbl-cards tbody td .cell-prod b,
  .tbl-cards tbody td .cell-prod span { white-space: normal; }
  .tbl-cards td[data-label]::before {
    content: attr(data-label); position: absolute; left: 0; top: 8px;
    width: 36%; text-align: left; color: var(--ink-3); font-weight: 600;
    white-space: normal; overflow-wrap: anywhere;
  }
  /* Celda de producto: encabezado de la tarjeta a ancho completo (thumb + nombre) */
  .tbl-cards td:has(.cell-prod) {
    padding: 4px 0 10px; text-align: left;
    border-bottom: 1px solid var(--border-soft); margin-bottom: 4px;
  }
  .tbl-cards td:has(.cell-prod)::before { display: none; }
  .tbl-cards td:has(.cell-prod) .cell-prod { justify-content: flex-start; text-align: left; }
  .tbl-cards td:has(.cell-prod) .cell-prod > div { min-width: 0; }
  .tbl-cards td:has(.cell-prod) .cell-prod b { overflow-wrap: anywhere; }
  /* Celda de acciones (encabezado vacío ⇒ sin data-label): fila propia con botones */
  .tbl-cards td:not([data-label]) {
    display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-start;
    padding: 12px 0 0; margin-top: 4px; text-align: left;
    border-top: 1px solid var(--border-soft);
  }
  .tbl-cards td:not([data-label]):empty { display: none; }
  .tbl-cards td:not([data-label]) .btn { flex: 1; }
  /* Inventario agrupado en móvil: variantes ocultas hasta expandir; cuando se
     abren aparecen como sub-tarjetas anidadas bajo la tarjeta del producto. */
  .tbl-cards tr.inv-variant-row { display: none; }
  .tbl-cards tr.inv-variant-row.open { display: block; }
  .tbl-cards tr.inv-variant-row.tbl-card-row {
    margin: 0 0 10px 16px; border-left: 3px solid var(--accent);
    background: var(--surface-2);
  }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
}

/* ============================================================
   MODAL (centered dialog) — above drawer
   ============================================================ */
.mbackdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 590;
  opacity: 0; pointer-events: none; transition: opacity var(--t) var(--ease);
  backdrop-filter: blur(3px);
}
.mbackdrop.show { opacity: 1; pointer-events: auto; }
.modal-wrap {
  position: fixed; inset: 0; z-index: 600; display: grid; place-items: center; padding: 24px;
  pointer-events: none;
}
.modal {
  width: min(560px, 100%); max-height: 88vh; max-height: 88dvh; display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-xl);
  box-shadow: var(--shadow-lg); pointer-events: none;
  opacity: 0; transform: scale(.96) translateY(8px); transform-origin: center;
  transition: opacity var(--t) var(--ease), transform var(--t-slow) var(--ease);
}
.modal.lg { width: min(720px, 100%); }
.modal-wrap.show .modal { opacity: 1; transform: none; pointer-events: auto; }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 22px 24px 16px; }
.modal-head h3 { font-size: 17px; font-weight: 600; letter-spacing: -0.01em; }
.modal-head p { font-size: 12.5px; color: var(--ink-3); margin-top: 3px; }
.modal-body { padding: 0 24px 8px; overflow-y: auto; flex: 1 1 auto; min-height: 0; }
.modal-foot { padding: 18px 24px 22px; display: flex; gap: 10px; justify-content: flex-end; flex-shrink: 0; }
.modal-foot .grow { flex: 1; }
@media (prefers-reduced-motion: reduce) { .modal { transition: opacity 160ms ease; transform: none !important; } }

/* Chips input (colors) */
.chips-input { display: flex; flex-wrap: wrap; gap: 7px; padding: 8px; min-height: 42px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-sm); align-items: center; }
.chips-input:focus-within { border-color: var(--accent-line); }
.chips-input input { flex: 1; min-width: 90px; background: none; border: none; outline: none; color: var(--ink); font-size: 13px; height: 26px; }
.chips-input input::placeholder { color: var(--ink-4); }
.color-chip { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 8px 0 6px;
  background: var(--elevated); border: 1px solid var(--border); border-radius: var(--r-full); font-size: 12px; }
.color-chip .sw { width: 12px; height: 12px; border-radius: 3px; border: 1px solid var(--border-strong); }
.color-chip button { color: var(--ink-4); display: grid; place-items: center; width: 15px; height: 15px; border-radius: 50%; }
.color-chip button:hover { color: var(--ink); background: var(--neutral-soft); }

/* Size toggles */
.size-toggles { display: flex; flex-wrap: wrap; gap: 7px; }
.size-toggle { height: 34px; min-width: 42px; padding: 0 12px; border-radius: var(--r-sm);
  background: var(--surface-2); border: 1px solid var(--border); color: var(--ink-3);
  font-size: 12.5px; font-weight: 600; font-variant-numeric: tabular-nums;
  transition: all var(--t-fast) var(--ease); }
.size-toggle:hover { border-color: var(--border-strong); color: var(--ink-2); }
.size-toggle.on { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent); }

/* SKU preview */
.sku-preview { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: var(--r-sm);
  background: var(--surface-2); border: 1px dashed var(--border); }
.sku-preview .lbl { font-size: 11.5px; color: var(--ink-3); }
.sku-preview b { font-size: 14px; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; margin-left: auto; }

/* Search menu (producto existente) */
.menu-search { display: flex; align-items: center; gap: 10px; padding: 0 14px; height: 44px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-sm); margin-bottom: 12px; }
.menu-search svg { width: 17px; height: 17px; color: var(--ink-3); }
.menu-search input { flex: 1; background: none; border: none; outline: none; color: var(--ink); font-size: 13.5px; }
.menu-list { display: flex; flex-direction: column; gap: 4px; max-height: 340px; overflow-y: auto; }
.menu-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: var(--r-sm);
  cursor: pointer; transition: background var(--t-fast) var(--ease); }
.menu-item:hover { background: var(--surface-2); }
.menu-item .thumb { width: 36px; height: 36px; }
.menu-item b { font-size: 13px; font-weight: 600; display: block; }
.menu-item span { font-size: 11.5px; color: var(--ink-4); }
.menu-item .add { margin-left: auto; color: var(--accent); font-size: 12px; font-weight: 600; opacity: 0; transition: opacity var(--t-fast) var(--ease); }
.menu-item:hover .add { opacity: 1; }

/* Assign summary */
.assign-sum { background: var(--surface-2); border: 1px solid var(--border-soft); border-radius: var(--r-md); padding: 4px 16px; margin-top: 6px; }
.assign-sum .info-row:last-child { border-top: 1px solid var(--border); border-bottom: none; margin-top: 2px; padding-top: 13px; }
.assign-sum .info-row:last-child .v { color: var(--accent); font-size: 15px; }

/* Per-product qty card (ingresar cantidades) */
.qty-card { border: 1px solid var(--border-soft); border-radius: var(--r-md); overflow: hidden; }
.qty-card + .qty-card { margin-top: 14px; }
.qty-card .qh { display: flex; align-items: center; gap: 12px; padding: 14px 16px; background: var(--surface-2); border-bottom: 1px solid var(--border-soft); }
.qty-card .qh b { font-size: 14px; font-weight: 600; }
.qty-card .qh .sku { margin-left: auto; }
.qty-card .qbody { padding: 8px 8px 4px; overflow-x: auto; }

/* Existencias breakdown table */
.brk td, .brk th { font-size: 12.5px; }
.pill { display: inline-block; padding: 1px 8px; border-radius: var(--r-full); background: var(--neutral-soft); font-size: 11px; color: var(--ink-2); font-variant-numeric: tabular-nums; }

/* Marca card */
.marca-logo { width: 46px; height: 46px; border-radius: var(--r-md); display: grid; place-items: center;
  font-weight: 800; font-size: 18px; letter-spacing: -0.03em; color: var(--bg); flex-shrink: 0; }

/* Damaged sub-section */
.subcard { background: var(--surface-2); border: 1px solid var(--border-soft); border-radius: var(--r-md); padding: 16px; }
.subcard-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.subcard-head b { font-size: 13.5px; font-weight: 600; display: flex; align-items: center; gap: 8px; }

/* Pedido selector card */
.pedido-select { display: grid; grid-template-columns: repeat(auto-fit,minmax(230px,1fr)); gap: 12px; margin-bottom: 20px; }
.pedido-opt { text-align: left; padding: 14px 16px; border-radius: var(--r-md); background: var(--surface-2);
  border: 1px solid var(--border); transition: all var(--t-fast) var(--ease); }
.pedido-opt:hover { border-color: var(--border-strong); }
.pedido-opt.on { border-color: var(--accent-line); background: var(--accent-soft); }
.pedido-opt .pf { font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; display: flex; align-items: center; gap: 8px; }
.pedido-opt .pm { font-size: 11.5px; color: var(--ink-3); margin-top: 4px; }
.pedido-opt.on .pm { color: var(--ink-2); }

/* Partidas de orden de compra (grid de captura) */
.po-grid {
  display: grid;
  grid-template-columns: minmax(200px,1.5fr) 140px 130px 90px 70px 170px 34px;
  gap: 8px;
  align-items: center;
}
.po-head { padding: 0 2px 7px; color: var(--ink-3); font-size: 11px; font-weight: 600; }
.po-item { margin-bottom: 8px; }
/* Primera celda de la partida: miniatura de la imagen capturada + nombre */
.po-name-cell { display: flex; gap: 10px; align-items: center; min-width: 0; padding: 6px 4px; }
.po-name-cell > span, .po-name-cell > input { min-width: 0; }
.po-thumb {
  flex: 0 0 auto; width: 44px; height: 44px; padding: 0; overflow: hidden;
  border: 1px dashed var(--border); border-radius: 9px; background: var(--surface-2);
  color: var(--ink-4); cursor: pointer; display: grid; place-items: center;
  transition: border-color var(--t-fast) var(--ease);
}
.po-thumb:hover { border-color: var(--accent-line); color: var(--accent); }
.po-thumb.has-img { border-style: solid; }
.po-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* Selector de imagen (galería del correo + captura por URL), sobre el modal */
.imgpick-backdrop {
  position: fixed; inset: 0; z-index: 620; display: grid; place-items: center; padding: 20px;
  background: rgba(0,0,0,.55); backdrop-filter: blur(3px);
  opacity: 0; pointer-events: none; transition: opacity var(--t) var(--ease);
}
.imgpick-backdrop.show { opacity: 1; pointer-events: auto; }
.imgpick {
  width: min(460px, 100%); max-height: 82vh; max-height: 82dvh; display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-xl); box-shadow: var(--shadow-lg);
}
.imgpick-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 18px 12px; border-bottom: 1px solid var(--border-soft); }
.imgpick-head h3 { font-size: 15px; font-weight: 600; }
.imgpick-body { padding: 14px 18px 18px; overflow-y: auto; }
.imgpick-label { font-size: 11px; font-weight: 600; color: var(--ink-3); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 8px; }
.imgpick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; }
.imgpick-tile {
  aspect-ratio: 1; padding: 0; overflow: hidden; cursor: pointer; background: var(--surface-2);
  border: 2px solid var(--border); border-radius: 10px; transition: border-color var(--t-fast) var(--ease);
}
.imgpick-tile:hover { border-color: var(--accent-line); }
.imgpick-tile.sel { border-color: var(--accent); }
.imgpick-tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.imgpick-clear {
  display: flex; align-items: center; gap: 10px; width: 100%; margin-top: 10px; padding: 9px 12px;
  border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); color: var(--ink-2);
  font-size: 13px; cursor: pointer; transition: border-color var(--t-fast) var(--ease);
}
.imgpick-clear:hover { border-color: var(--accent-line); }
.imgpick-clear.sel { border-color: var(--accent); color: var(--ink); }
.imgpick-clear svg { width: 18px; height: 18px; flex: 0 0 auto; }
.imgpick-url { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 8px; align-items: center; }
@media (max-width: 640px) {
  .po-head { display: none; }
  .po-item {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    padding: 14px 12px 12px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface);
  }
  /* Nombre y precio ocupan el ancho completo; el resto va en dos columnas */
  .po-item > .po-name-input,
  .po-item > .po-name-text,
  .po-item > .po-name-cell,
  .po-item > .po-cost-wrap { grid-column: 1 / -1; }
  /* Botón eliminar: fila propia, alineado al borde derecho de la tarjeta */
  .po-item > .icon-btn { grid-column: 1 / -1; justify-self: end; width: 34px; height: 34px; }
}

/* Full product modal (ventana grande) */
.modal.xl { width: min(940px, 100%); }
.prod-link { cursor: pointer; transition: color var(--t-fast) var(--ease); }
.prod-link:hover { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.pf-grid { display: grid; grid-template-columns: 300px 1fr; gap: 24px; }
.pf-media { display: flex; flex-direction: column; gap: 12px; }
.pf-hero { aspect-ratio: 1; border-radius: var(--r-lg); background: var(--elevated); border: 1px solid var(--border);
  display: grid; place-items: center; color: var(--ink-4); font-size: 13px; letter-spacing: .1em; }
.pf-gallery { display: grid; grid-template-columns: repeat(4,1fr); gap: 8px; }
.pf-thumb { aspect-ratio: 1; border-radius: var(--r-sm); background: var(--elevated); border: 1px solid var(--border);
  display: grid; place-items: center; color: var(--ink-4); font-size: 9px; cursor: pointer; transition: border-color var(--t-fast) var(--ease); }
.pf-thumb:hover { border-color: var(--border-strong); }
.pf-thumb.on { border-color: var(--accent); }
.pf-stats { display: grid; grid-template-columns: repeat(4,1fr); gap: 10px; }
.pf-stat { background: var(--surface-2); border: 1px solid var(--border-soft); border-radius: var(--r-md); padding: 12px 14px; }
.pf-stat b { font-size: 20px; font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; display: block; }
.pf-stat span { font-size: 11px; color: var(--ink-3); }
.pf-body { padding-top: 18px; max-height: 46vh; overflow-y: auto; }

/* WooCommerce modal */
.woo-store { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: var(--r-md);
  background: var(--surface-2); border: 1px solid var(--border-soft); }
.woo-store b { font-size: 13.5px; font-weight: 600; display: block; }
.woo-store span { font-size: 11.5px; color: var(--ink-3); }
.woo-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 4px var(--ok-soft); flex-shrink: 0; }
.woo-map { border: 1px solid var(--border-soft); border-radius: var(--r-md); overflow: hidden; }
.woo-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 16px; border-bottom: 1px solid var(--border-soft); font-size: 13px; }
.woo-row:last-child { border-bottom: none; }
.woo-row .k { color: var(--ink-3); }
.woo-row .v { font-weight: 500; text-align: right; }
.woo-note { display: flex; align-items: center; gap: 10px; margin-top: 14px; padding: 12px 14px; border-radius: var(--r-sm);
  background: var(--accent-soft); border: 1px solid var(--accent-line); color: var(--accent); font-size: 12px; font-weight: 500; }
.woo-note svg { width: 16px; height: 16px; flex-shrink: 0; }
.chip svg { width: 12px; height: 12px; }
@media (max-width: 720px){ .pf-grid { grid-template-columns: 1fr; } .pf-stats { grid-template-columns: repeat(2,1fr); } }

/* ===== Parte 3: matriz de variantes + modales en móvil ===== */
@media (max-width: 640px) {
  /* Modales xl/lg a pantalla casi completa, con menos padding y aire lateral */
  .modal-wrap { padding: 10px; }
  .modal, .modal.lg, .modal.xl { width: 100%; max-width: 100%; min-width: 0; max-height: 94vh; max-height: 94dvh; }
  .modal-head { padding: 18px 18px 12px; }
  .modal-body { padding: 0 18px 8px; min-width: 0; }
  .modal-foot { padding: 14px 18px calc(18px + env(safe-area-inset-bottom)); flex-wrap: wrap; gap: 8px; }
  .modal-foot .btn { flex: 1 1 100%; }

  /* Matriz de variantes: scroll horizontal con la columna de Color congelada.
     min-width:0 en la cadena evita que la matriz (min-width:max-content)
     estire el modal más allá de la pantalla; el scroll queda en .qbody. */
  .qty-card, .qty-card .qbody { min-width: 0; }
  .qty-card .qbody { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .matrix { min-width: max-content; }
  .matrix th:first-child, .matrix td:first-child {
    position: sticky; left: 0; z-index: 1; background: var(--surface);
  }
  .matrix thead th:first-child { z-index: 2; }
  /* Inputs de cantidad más grandes para captura táctil */
  .qty-in { width: 48px; height: 40px; font-size: 14px; }
}

/* ============================================================
   LOGIN
   ============================================================ */
.login-screen { position: fixed; inset: 0; z-index: var(--z-modal); display: grid; grid-template-columns: 1.1fr 1fr; background: var(--bg); }
.login-art {
  position: relative; overflow: hidden;
  background: radial-gradient(120% 120% at 20% 10%, #1a1006 0%, #0d0d0d 55%);
  border-right: 1px solid var(--border-soft);
  display: flex; flex-direction: column; justify-content: space-between; padding: 48px;
}
.login-art .glow { position: absolute; width: 480px; height: 480px; border-radius: 50%; background: radial-gradient(circle, var(--accent-soft) 0%, transparent 70%); top: -120px; right: -120px; filter: blur(20px); }
.login-art .brand { border: none; padding: 0; height: auto; }
.login-art .pitch { position: relative; z-index: 1; }
.login-art .pitch h1 { font-size: 40px; font-weight: 600; letter-spacing: -0.03em; line-height: 1.08; text-wrap: balance; margin-bottom: 16px; }
.login-art .pitch h1 em { font-style: normal; color: var(--accent); }
.login-art .pitch p { color: var(--ink-3); font-size: 15px; max-width: 400px; line-height: 1.6; }
.login-art .verbs { display: flex; gap: 10px; margin-top: 28px; }
.login-art .verb { font-size: 12px; font-weight: 600; letter-spacing: 0.1em; padding: 7px 14px; border: 1px solid var(--border); border-radius: var(--r-full); color: var(--ink-2); }
.login-form-wrap { display: grid; place-items: center; padding: 40px; }
.login-form { width: 100%; max-width: 360px; }
.login-form h2 { font-size: 24px; font-weight: 600; letter-spacing: -0.02em; margin-bottom: 6px; }
.login-form .sub { color: var(--ink-3); margin-bottom: 30px; font-size: 14px; }
.login-form .field { margin-bottom: 16px; }
.login-form .btn { width: 100%; margin-top: 8px; height: 46px; }
.login-form .foot { margin-top: 22px; text-align: center; font-size: 12.5px; color: var(--ink-4); }
@media (max-width: 860px) { .login-screen { grid-template-columns: 1fr; } .login-art { display: none; } }

/* ===== Recepción de mercancía (pantalla completa: escaneo / marcado) ===== */
.recv-screen { position: fixed; inset: 0; z-index: 700; background: var(--bg, #0e0e0e); display: flex; flex-direction: column; }
.recv-screen[hidden] { display: none; }
.recv-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border); background: var(--surface); }
.recv-title { font-size: 17px; font-weight: 700; }
.recv-sub { font-size: 12.5px; color: var(--ink-3); margin-top: 2px; }
.recv-progress { position: relative; height: 30px; background: var(--surface-2); border-bottom: 1px solid var(--border); overflow: hidden; }
.recv-bar { position: absolute; inset: 0 auto 0 0; background: var(--ok-soft); border-right: 2px solid var(--ok); transition: width var(--t-fast) var(--ease); }
.recv-prog-label { position: relative; z-index: 1; display: flex; align-items: center; height: 100%; padding: 0 16px; font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.recv-scanbar { display: flex; gap: 10px; padding: 14px 20px; border-bottom: 1px solid var(--border-soft); background: var(--surface); }
.recv-scan-input { flex: 1; font-family: monospace; font-size: 15px; letter-spacing: .03em; }
.recv-cam { position: relative; background: #000; display: flex; align-items: center; justify-content: center; border-bottom: 1px solid var(--border); }
.recv-cam[hidden] { display: none; }
.recv-cam { min-height: 240px; }
.recv-cam video { width: 100%; max-height: 46vh; object-fit: contain; }
.recv-cam #recvReader { width: 100%; }
.recv-cam img { display: none; }
.recv-cam-hint { position: absolute; bottom: 10px; left: 50%; transform: translateX(-50%); background: rgba(0,0,0,.6); color: #fff; font-size: 12px; padding: 5px 12px; border-radius: 20px; }
.recv-lines { flex: 1; overflow-y: auto; padding: 10px 16px 16px; }
.recv-line { display: flex; align-items: center; gap: 14px; padding: 12px 14px; margin-bottom: 8px; border: 1px solid var(--border); border-left-width: 4px; border-radius: 10px; background: var(--surface); transition: background var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease); }
.recv-line-main { flex: 1; min-width: 0; }
.recv-sku { font-family: monospace; font-weight: 700; font-size: 14px; letter-spacing: .03em; }
.recv-name { font-size: 12.5px; color: var(--ink-3); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recv-count { display: flex; align-items: baseline; gap: 6px; min-width: 96px; justify-content: flex-end; }
.recv-acc { font-size: 24px; font-weight: 800; font-variant-numeric: tabular-nums; }
.recv-exp { font-size: 13px; color: var(--ink-3); }
.recv-dmg { font-size: 11px; color: var(--danger); font-weight: 600; margin-left: 8px; }
.recv-actions { display: flex; gap: 8px; }
.recv-btn { width: 46px; height: 46px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2); color: var(--ink-1); font-size: 22px; font-weight: 700; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: transform var(--t-fast) var(--ease), background var(--t-fast) var(--ease); }
.recv-btn:active { transform: scale(.92); }
.recv-btn.ok { color: var(--ok); border-color: var(--ok); }
.recv-btn.ok:hover { background: var(--ok-soft); }
.recv-btn.bad { color: var(--danger); border-color: var(--danger); }
.recv-btn.bad:hover { background: var(--danger-soft); }
.recv-line.ok { border-left-color: var(--ok); background: var(--ok-soft); }
.recv-line.partial { border-left-color: var(--warn); }
.recv-line.surplus { border-left-color: var(--accent); background: var(--accent-soft); }
.recv-line.pending { border-left-color: var(--border); }
.recv-line.flash { animation: recvFlash .45s var(--ease); }
@keyframes recvFlash { 0% { background: var(--ok); } 100% { background: var(--ok-soft); } }
.recv-foot { display: flex; gap: 10px; padding: 14px 20px; border-top: 1px solid var(--border); background: var(--surface); }
@media (max-width: 640px) {
  .recv-line { flex-wrap: wrap; gap: 8px 12px; }
  .recv-line-main { flex: 1 1 62%; }
  .recv-count { min-width: auto; }
  .recv-actions { flex: 1 1 100%; gap: 10px; }
  .recv-btn { flex: 1; width: auto; height: 50px; font-size: 24px; }
  .recv-foot { flex-wrap: wrap; }
  .recv-foot .btn { flex: 1 1 100%; }
  .recv-scanbar { flex-wrap: wrap; }
  .recv-scan-input { flex: 1 1 100%; }
  .recv-cam video { max-height: 50vh; }
}

/* ============================================================
   Configuración — layout + iconos de sección
   ============================================================ */
.section-head .h3 svg { width: 18px; height: 18px; flex-shrink: 0; stroke-width: 1.8; }
.config-layout { display: grid; grid-template-columns: 220px minmax(0,1fr); gap: 18px; align-items: start; }
.woo-config-content { min-width: 0; }

/* Menú lateral de configuración: mismo lenguaje visual que el nav principal */
.config-menu { display: flex; flex-direction: column; gap: 3px; }
.config-menu-item {
  display: flex; align-items: center; gap: 11px;
  width: 100%; padding: 9px 11px; border-radius: var(--r-sm);
  font-size: 13.5px; font-weight: 600; letter-spacing: -0.01em;
  color: var(--ink-2); background: transparent; border: 1px solid transparent;
  text-align: left; position: relative; cursor: pointer;
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.config-menu-item svg { width: 18px; height: 18px; flex-shrink: 0; stroke-width: 1.8; color: var(--ink-3); transition: color var(--t-fast) var(--ease); }
.config-menu-item:hover { background: var(--neutral-soft); color: var(--ink); }
.config-menu-item:hover svg { color: var(--ink-2); }
.config-menu-item.active { background: var(--accent-soft); color: var(--accent); }
.config-menu-item.active svg { color: var(--accent); }
.config-menu-item.active::before {
  content: ""; position: absolute; left: -1px; top: 50%; transform: translateY(-50%);
  width: 3px; height: 20px; border-radius: 0 3px 3px 0; background: var(--accent);
}
.config-menu-item:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

@media (max-width: 820px) {
  /* minmax(0,1fr) evita que la columna crezca hasta el min-content del
     formulario y desborde el panel a lo ancho. */
  .config-layout { grid-template-columns: minmax(0, 1fr); }
  .config-layout > * { min-width: 0; }
  .config-menu { flex-direction: row; flex-wrap: wrap; gap: 6px; }
  .config-options .eyebrow { width: 100%; margin-bottom: 4px; }
  .config-menu-item { width: auto; flex: 1 1 auto; justify-content: center; }
  .config-menu-item.active::before { display: none; }
  .config-layout .section-head { flex-wrap: wrap; gap: 8px; }
}
@media (max-width: 640px) {
  /* Botonera de la config (Guardar + Probar conexión + resultado) envuelve
     en vez de desbordar; el cuadro de resultado ocupa el ancho completo. */
  .card-pad > div[style*="flex"] { flex-wrap: wrap; }
  #pec_test_result { max-width: 100% !important; flex: 1 1 100%; }
}

/* ============================================================
   Canales de venta
   ============================================================ */
.ch-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.ch-card { padding: 18px; display: flex; flex-direction: column; gap: 14px; }
.ch-head { display: flex; align-items: center; gap: 12px; }
.ch-ic { width: 42px; height: 42px; border-radius: 11px; background: var(--surface-2); border: 1px solid var(--border-soft);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.ch-ic svg { width: 20px; height: 20px; stroke-width: 1.7; color: var(--ink-2); }
.ch-head h4 { font-size: 15px; font-weight: 600; }
.ch-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.ch-stat { background: var(--surface-2); border: 1px solid var(--border-soft); border-radius: 10px; padding: 11px; text-align: center; }
.ch-stat b { display: block; font-size: 19px; font-weight: 700; }
.ch-stat span { font-size: 11px; color: var(--ink-3); }
.ch-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-top: 2px; }
@media (max-width: 640px) { .ch-grid { grid-template-columns: minmax(0, 1fr); } .ch-card, .ch-stats, .ch-stat { min-width: 0; } }

/* ============================================================
   Migración WooCommerce
   ============================================================ */
.mig-summary { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.mig-chip { background: var(--surface); border: 1px solid var(--border-soft); border-radius: 12px;
  padding: 12px 18px; text-align: center; min-width: 96px; }
.mig-chip b { display: block; font-size: 22px; font-weight: 700; }
.mig-chip span { font-size: 11px; color: var(--ink-3); text-transform: uppercase; letter-spacing: .04em; }
.select-sm { padding: 6px 8px; font-size: 12.5px; min-width: 140px; }
tr.mig-done { opacity: .6; }
@media (max-width: 640px) { .mig-summary .mig-chip { flex: 1 1 40%; } }

.mig-bar { height: 8px; background: var(--surface-2); border: 1px solid var(--border-soft); border-radius: 999px; overflow: hidden; }
.mig-bar i { display: block; height: 100%; background: var(--accent); border-radius: 999px; transition: width .4s ease; }
#migProgLabel svg { width: 15px; height: 15px; vertical-align: -2px; }

.mig-filters { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 12px 20px 4px; }

.mig-tabs { display: flex; gap: 6px; margin-bottom: 16px; flex-wrap: wrap; }
.mig-tab { padding: 8px 14px; border-radius: 9px; font-size: 13px; font-weight: 500;
  background: var(--surface-2); border: 1px solid var(--border-soft); color: var(--ink-3); cursor: pointer; }
.mig-tab:hover:not(:disabled) { color: var(--ink); border-color: var(--border-strong); }
.mig-tab.active { background: var(--accent); border-color: var(--accent); color: #1a0d03; }
.mig-tab:disabled { opacity: .45; cursor: not-allowed; }

/* ---------- Importación de clientes (progreso + bitácora) ---------- */
.clbar { height: 10px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border-soft); overflow: hidden; }
.clbar-fill { height: 100%; background: var(--accent); border-radius: 999px; transition: width .4s ease; }
.clbar-indet { height: 100%; width: 35%; border-radius: 999px; background: var(--accent); animation: clindet 1.2s ease-in-out infinite; }
@keyframes clindet { 0% { margin-left: -35%; } 100% { margin-left: 100%; } }
.cllog { max-height: 260px; overflow-y: auto; background: var(--bg); border: 1px solid var(--border-soft); border-radius: 10px; padding: 10px 12px; font: 12px/1.6 ui-monospace, SFMono-Regular, Menlo, monospace; }
.cllog-row { display: flex; gap: 10px; padding: 1px 0; }
.cllog-t { color: var(--ink-4); flex-shrink: 0; font-variant-numeric: tabular-nums; }

/* ---- Menú de perfil (topbar) ---- */
.profile-wrap { position: relative; }
.profile-menu {
  position: absolute; top: calc(100% + 8px); right: 0; z-index: 70; width: 236px;
  background: var(--elevated); border: 1px solid var(--border);
  border-radius: var(--r-md); box-shadow: 0 18px 44px rgba(0,0,0,.28); padding: 8px;
}
.profile-menu[hidden] { display: none; }
.pm-head { display: flex; gap: 10px; align-items: center; padding: 6px 6px 10px; }
/* El popover reutiliza .u-meta; anula la regla móvil que la oculta en el sidebar. */
.profile-menu .u-meta { opacity: 1 !important; pointer-events: auto !important; }
.pm-head .u-meta b { font-size: 13px; color: var(--ink-1); }
.pm-email {
  font-size: 11.5px; color: var(--ink-3); padding: 0 6px 9px 50px; word-break: break-all;
  border-bottom: 1px solid var(--border-soft); margin-bottom: 8px;
}
.pm-logout {
  width: 100%; display: flex; gap: 8px; align-items: center; justify-content: center;
  padding: 9px 10px; border: 1px solid var(--border); border-radius: var(--r-sm);
  background: var(--surface); color: var(--ink-2); font-size: 13px; font-weight: 600; cursor: pointer;
  transition: background var(--t-fast) var(--ease);
}
.pm-logout:hover { background: var(--neutral-soft); }
.pm-logout svg { width: 16px; height: 16px; flex-shrink: 0; }

/* ---- Croquis / mapa del almacén (Acomodo layout) ---- */
.acm-grid { display: grid; gap: 6px; min-width: min-content; }
.acm-cell { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 54px; padding: 6px 4px; border: 1px dashed var(--border); border-radius: 9px; background: var(--surface); cursor: pointer; text-align: center; transition: border-color var(--t-fast) var(--ease), background var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease); }
button.acm-cell { font: inherit; color: inherit; }
.acm-cell.empty { cursor: default; }
.acm-cell.filled { border-style: solid; }
.acm-cell.sel { box-shadow: 0 0 0 2px var(--accent, #2563eb); border-color: var(--accent, #2563eb); }
.acm-cell:not(.empty):hover { border-color: var(--accent, #2563eb); }
.acm-cell-plus { color: var(--muted); font-size: 18px; line-height: 1; opacity: .5; }
.acm-cell-label { font-size: 12px; font-weight: 700; line-height: 1.15; word-break: break-word; }
.acm-cell-zone { font-size: 10px; color: var(--muted); line-height: 1.1; word-break: break-word; }

/* ---- Selector de ubicación de trabajo (topbar) ---- */
.loc-wrap { position: relative; }
.branch-select { cursor: pointer; }
.branch-select.locked { cursor: default; opacity: .85; }
.branch-select.locked svg { display: none; }
.loc-menu {
  position: absolute; top: calc(100% + 8px); right: 0; z-index: 70; width: 288px;
  background: var(--elevated); border: 1px solid var(--border);
  border-radius: var(--r-md); box-shadow: 0 18px 44px rgba(0,0,0,.28); padding: 8px;
}
.loc-menu[hidden] { display: none; }
.loc-menu-title { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-3); padding: 6px 8px 8px; font-weight: 700; }
.loc-menu-sep { font-size: 10.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-3); padding: 10px 8px 4px; }
.loc-menu-note { font-size: 12px; color: var(--ink-3); padding: 8px; line-height: 1.4; }
.loc-item {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  padding: 9px 8px; border: none; background: transparent; border-radius: 9px;
  cursor: pointer; color: inherit; font: inherit; transition: background var(--t-fast) var(--ease);
}
.loc-item:hover { background: var(--neutral-soft, rgba(0,0,0,.05)); }
.loc-item.active { background: var(--accent-soft, rgba(91,147,240,.14)); }
.loc-item .pin { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); flex-shrink: 0; }
.loc-item-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.loc-item-main b { font-size: 13px; font-weight: 600; }
.loc-item-sub { font-size: 11px; color: var(--ink-3); }
.loc-item svg { width: 16px; height: 16px; color: var(--accent, #5B93F0); flex-shrink: 0; }
/* Banner de contexto de ubicación en las ventanas dependientes */
.loc-context {
  display: flex; align-items: center; gap: 8px; margin: 0 0 14px;
  padding: 9px 13px; border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface); font-size: 12.5px; color: var(--ink-2);
}
.loc-context.branch { border-color: var(--accent, #5B93F0); background: var(--accent-soft, rgba(91,147,240,.1)); }
.loc-context svg { width: 15px; height: 15px; color: var(--accent, #5B93F0); flex-shrink: 0; }
.loc-context b { color: var(--ink-1); }

/* Botón "quitar" dentro de un chip (catálogo de medidas de caja) */
.chip .chip-x {
  border: none; background: transparent; cursor: pointer; color: inherit;
  font-size: 14px; line-height: 1; padding: 0 0 0 2px; opacity: .55;
}
.chip .chip-x:hover { opacity: 1; color: var(--danger, #e5484d); }

/* Condicionantes de caja en el croquis */
.acm-cell { position: relative; }
.acm-cell-lock { position: absolute; top: 3px; right: 3px; opacity: .8; }
.acm-cell-lock svg { width: 11px; height: 11px; display: block; }
.acm-cell-restr { font-size: 9.5px; color: #fff; font-weight: 700; line-height: 1.15; margin-top: 1px; word-break: break-word; }
.acm-cell.restr { border-style: solid; }

/* En celular el texto de restricciones se amontona dentro de la caja cuando
   hay muchas condicionantes. Se oculta y queda solo el candado como señal;
   las restricciones completas se ven al tocar la caja (abre su ventana). */
@media (max-width: 640px) {
  .acm-cell-restr { display: none; }
  .acm-cell-lock { top: 4px; right: 4px; }
  .acm-cell-lock svg { width: 13px; height: 13px; }
}

/* Varios racks en el mapa de Acomodo */
.acm-racks { display: flex; flex-direction: column; gap: 22px; }
.acm-rack { }
.acm-rack-head { display: flex; align-items: center; gap: 7px; margin-bottom: 8px; font-size: 13px; }
.acm-rack-head svg { width: 15px; height: 15px; color: var(--accent, #5B93F0); }

/* Ícono dentro del botón de chip (editar medida de caja) */
.chip .chip-x svg { width: 12px; height: 12px; display: block; }

/* ============================================================
   Dashboard e-commerce — gráfica de barras + responsividad
   ============================================================ */
.dash-bars-wrap { width: 100%; overflow-x: auto; }
.dash-bars {
  display: flex; align-items: flex-end; gap: 4px;
  height: 190px; min-width: 100%;
}
.dash-bar-col {
  flex: 1 1 0; min-width: 14px; display: flex; flex-direction: column;
  align-items: center; cursor: pointer; height: 100%;
}
.dash-bar-track { width: 100%; flex: 1; display: flex; align-items: flex-end; min-height: 0; }
.dash-bar-fill {
  width: 100%; max-width: 30px; margin: 0 auto;
  background: var(--accent); border-radius: 5px 5px 0 0;
  transition: height .25s var(--ease, ease), opacity .15s ease;
}
.dash-bar-col:hover .dash-bar-fill { opacity: .8; }
.dash-bar-lbl {
  font-size: 10px; color: var(--ink-3); margin-top: 6px; height: 12px;
  white-space: nowrap; line-height: 1; text-align: center;
}
/* En periodos largos las barras se hacen delgadas: permitir scroll horizontal */
@media (max-width: 640px) {
  .dash-bars { gap: 3px; height: 160px; }
  .dash-bar-col { min-width: 10px; }
  .dash-bar-lbl { font-size: 9px; }
}

/* ---- Productos: responsividad en celular ---- */
@media (max-width: 900px) {
  /* El sidebar de filtros pasa a ancho completo, arriba del listado */
  .prod-sidebar { width: 100% !important; flex: 1 1 100% !important; }
  .prod-sidebar .card { position: static !important; }
}
@media (max-width: 640px) {
  /* Catálogo: 2 columnas cómodas en teléfono */
  .prod-catalog { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)) !important; gap: 10px !important; }
  /* Lista: ocultar columna de stock (el estado y precio bastan en pantalla chica) */
  .prod-col-hide { display: none !important; }
}
@media (max-width: 420px) {
  .prod-catalog { grid-template-columns: 1fr 1fr !important; }
}

/* Menos padding lateral en páginas dentro de celular (dashboard y demás) */
@media (max-width: 640px) {
  .page { padding: 18px 14px 56px; }
  /* Ninguna tarjeta debe rebasar el ancho de la pantalla en vertical */
  .card { min-width: 0; max-width: 100%; overflow: hidden; }
  .card img { max-width: 100%; height: auto; }
  /* La gráfica de barras se hace desplazable en vez de comprimirse ilegible */
  .dash-bars { min-width: max-content; }
  .dash-bar-col { min-width: 16px; }
}

/* ---- Editor de producto: inputs de precio/oferta/existencias por talla ---- */
.pe-var-input { width: 96px; min-width: 84px; text-align: right; }
@media (max-width: 640px) {
  /* En celular la tabla de variaciones se desplaza horizontalmente y los campos
     mantienen un ancho cómodo para escribir (no se comprimen). */
  .pe-var-input { width: 96px; min-width: 90px; font-size: 16px; padding: 9px 10px; }
}

/* ---- Configuración → Módulos y ventanas ---- */
.erp-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(280px,1fr));gap:14px}
.erp-mod{display:flex;flex-direction:column;gap:10px}
.erp-mod.off{background:var(--surface-2,rgba(0,0,0,.02))}
.erp-mod-head{display:flex;justify-content:space-between;align-items:flex-start;gap:12px}
.erp-feats{display:flex;flex-direction:column}
.erp-feat{display:flex;justify-content:space-between;align-items:center;gap:10px;padding:7px 0;font-size:13px;border-top:1px solid var(--border-soft,#e5e7eb)}
.erp-feat.dim{opacity:.55}
.erp-sw{position:relative;display:inline-block;flex:0 0 auto;width:40px;height:22px;cursor:pointer}
.erp-sw.locked{cursor:not-allowed;opacity:.6}
.erp-sw input{position:absolute;opacity:0;width:100%;height:100%;margin:0;cursor:inherit}
.erp-sw-track{position:absolute;inset:0;border-radius:999px;background:var(--border,#cbd5e1);transition:background .15s}
.erp-sw-knob{position:absolute;top:3px;left:3px;width:16px;height:16px;border-radius:50%;background:#fff;box-shadow:0 1px 3px rgba(0,0,0,.3);transition:left .15s;pointer-events:none}
.erp-sw input:checked ~ .erp-sw-track{background:#16a34a}
.erp-sw input:checked ~ .erp-sw-knob{left:21px}
.erp-sw input:focus-visible ~ .erp-sw-track{outline:2px solid var(--accent,#2563eb);outline-offset:2px}
@media (max-width:600px){.erp-grid{grid-template-columns:1fr}}

/* Catálogo de ofertas: filtros en dos columnas, incluso en tablet. */
.offers-filter-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 8px;
  width: min(100%, 560px);
  min-width: 0;
}
.offers-filter-grid > .select,
.offers-filter-grid > .input {
  width: 100%;
  min-width: 0;
}
@media (max-width: 520px) {
  .offers-filter-grid { width: 100%; }
}

/* Pedidos: periodos visuales y búsqueda expandible. */
.orders-period-field { min-width:0; }
.orders-period-pills { display:flex; flex-wrap:nowrap; align-items:center; gap:5px; max-width:100%; min-width:0; }
.orders-period-pills .btn { white-space:nowrap; padding:7px 10px; }
.orders-period-toggle{display:inline-flex;align-items:center;justify-content:center;min-width:34px}
.orders-period-toggle svg{width:14px;height:14px;stroke-width:2;transform:rotate(90deg);transition:transform .18s ease}
.orders-period-toggle[aria-expanded="true"] svg{transform:rotate(-90deg)}
.orders-period-pills>.btn{flex:0 0 auto}
.orders-period-options{display:flex;flex:0 1 auto;align-items:center;gap:5px;flex-wrap:nowrap;min-width:0;max-width:0;opacity:0;transform:translateX(-14px);overflow:hidden;white-space:nowrap;pointer-events:none;visibility:hidden;transition:max-width .36s ease,opacity .25s ease,transform .36s ease,visibility 0s linear .36s}
.orders-period-options.is-expanded{max-width:min(660px,calc(100vw - 250px));opacity:1;transform:translateX(0);overflow-x:auto;overflow-y:hidden;pointer-events:auto;visibility:visible;transition:max-width .36s ease,opacity .25s ease,transform .36s ease,visibility 0s}
.orders-period-options .btn{flex:0 0 auto}
.orders-period-options::-webkit-scrollbar{height:4px}
.orders-period-options::-webkit-scrollbar-thumb{background:var(--border-strong);border-radius:6px}
@media(max-width:600px){.orders-period-options.is-expanded{max-width:calc(100vw - 175px)}}
@media(prefers-reduced-motion:reduce){.orders-period-options{transition:none}.orders-period-toggle svg{transition:none}}

.orders-search:not(.orders-search-expanded) { flex:0 0 auto; width:auto; min-width:0; }
.orders-search:not(.orders-search-expanded) .btn { min-width:40px; }
.orders-search-expanded { display:flex; align-items:center; gap:6px; min-width:0; }
.orders-search-expanded .input { flex:1 1 180px; min-width:0; }
@media (max-width:800px) {
  .orders-period-pills { width:100%; }
  .orders-search-expanded { width:100%; }
}

/* Historial: compact native date picker on narrow screens. */
@media (max-width: 600px) {
  .hist-date-field {
    flex: 0 0 auto !important;
    width: auto !important;
    min-width: 0 !important;
    max-width: 100%;
  }
  .hist-date-field .hist-date-input {
    box-sizing: border-box;
    width: 172px !important;
    min-width: 0 !important;
    max-width: 100%;
    padding-inline: 10px;
  }
}

/* History activity calendar */
.hist-calendar-popover{position:absolute;z-index:100;top:100%;left:0;margin-top:6px;width:min(300px,calc(100vw - 190px));min-width:240px;padding:12px;border:1px solid var(--border,#383838);border-radius:12px;background:var(--surface,#181818);box-shadow:0 12px 36px #0008}
.hist-calendar-header{display:flex;align-items:center;justify-content:space-between;gap:8px;margin-bottom:10px;text-transform:capitalize}
.hist-calendar-grid{display:grid;grid-template-columns:repeat(7,minmax(0,1fr));gap:3px;text-align:center;align-items:center}
.hist-calendar-day{position:relative;min-height:36px;border:0;border-radius:7px;background:transparent;color:inherit;cursor:pointer}
.hist-calendar-day:hover,.hist-calendar-day.selected{background:#e8761b;color:#111}
.hist-calendar-dot{position:absolute;bottom:3px;left:calc(50% - 2px);width:4px;height:4px;border-radius:50%;background:#e8761b}
.hist-calendar-day.selected .hist-calendar-dot{background:#111}
@media(max-width:600px){.hist-calendar-popover{width:260px;min-width:0;max-width:calc(100vw - 175px)}}

/* Historial: consistent filter hierarchy and responsive layout */
.hist-filter-panel{display:flex;flex-direction:column;gap:18px}
.hist-filter-top{display:flex;align-items:center;justify-content:space-between}
.hist-filter-top .orders-filter-field{width:auto;min-width:0}
.hist-filter-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:14px;align-items:end}
.hist-filter-grid .orders-filter-field{min-width:0;width:100%}
.hist-filter-grid .orders-filter-field select{width:100%;min-width:0}
.hist-filter-actions{display:flex;align-items:flex-end;justify-content:space-between;gap:16px;flex-wrap:wrap;padding-top:14px;border-top:1px solid var(--border,#383838)}
.hist-filter-actions .hist-date-field{min-width:0}
.hist-filter-buttons{display:flex;align-items:center;justify-content:flex-end;gap:10px;flex-wrap:wrap}
@media(max-width:1050px){.hist-filter-grid{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(max-width:600px){.hist-filter-grid{grid-template-columns:minmax(0,1fr);gap:12px}.hist-filter-actions{align-items:stretch}.hist-filter-actions .hist-date-field{width:100%}.hist-filter-buttons{width:100%;justify-content:flex-start}.hist-calendar-popover{width:min(300px,calc(100vw - 48px));max-width:calc(100vw - 48px)}}

/* Historial de pedidos: semantic status indicators, never color alone */
.hist-status{display:inline-flex;align-items:center;gap:8px;max-width:100%;padding:6px 10px;border-radius:8px;border:1px solid currentColor;font-size:12px;font-weight:600;line-height:1.35;white-space:nowrap}
.hist-status-icon{display:inline-grid;place-items:center;flex:0 0 19px;width:19px;height:19px;border-radius:50%;font-size:13px;font-weight:800;background:currentColor}
.hist-status-icon::first-letter{color:inherit}
.hist-status-pending{color:#e8b04d;background:rgba(232,176,77,.11);border-color:rgba(232,176,77,.3)}
.hist-status-processing{color:#67b9fa;background:rgba(103,185,250,.11);border-color:rgba(103,185,250,.3)}
.hist-status-hold{color:#c4a0f7;background:rgba(196,160,247,.11);border-color:rgba(196,160,247,.3)}
.hist-status-completed{color:#59ce93;background:rgba(89,206,147,.11);border-color:rgba(89,206,147,.3)}
.hist-status-cancelled{color:#aeb3bc;background:rgba(174,179,188,.10);border-color:rgba(174,179,188,.3)}
.hist-status-refunded{color:#65c6c9;background:rgba(101,198,201,.11);border-color:rgba(101,198,201,.3)}
.hist-status-failed{color:#f17d81;background:rgba(241,125,129,.11);border-color:rgba(241,125,129,.3)}
.hist-status-trash,.hist-status-unknown{color:#9ca3af;background:rgba(156,163,175,.08);border-color:rgba(156,163,175,.25)}
.hist-status-icon{background:transparent;border:1px solid currentColor}
@media(max-width:600px){.hist-status{padding:5px 8px;font-size:11px;gap:6px}.hist-status-icon{width:17px;height:17px;flex-basis:17px}}

/* Dashboard: sales chart occupies the complete content width */
.dashboard-sales-stack{display:grid;grid-template-columns:minmax(0,1fr);gap:16px}
.dashboard-sales-stack>.card{min-width:0}
.dashboard-sales-full .dash-bars-wrap{width:100%;max-width:100%}
.dashboard-sales-full .dash-bars{min-width:0}

/* Sales chart: synchronized plot/labels and legible monetary Y axis */
.dash-sales-chart{width:100%;min-width:0;padding-top:16px}
.dash-sales-plot{height:240px;position:relative;margin-left:75px;margin-right:12px;border-bottom:1px solid var(--border,#383838)}
.dash-sales-grid{position:absolute;inset:0;pointer-events:none}
.dash-sales-gridline{position:absolute;left:0;right:0;border-top:1px dashed rgba(145,145,145,.22)}
.dash-sales-gridline>span{position:absolute;right:calc(100% + 12px);top:-8px;text-align:right;min-width:57px;font-size:11px;line-height:16px;white-space:nowrap;color:var(--ink-3)}
.dash-sales-bar-grid{position:absolute;inset:0;display:flex;gap:4px;align-items:stretch}
.dash-sales-bar-cell{flex:1 1 0;min-width:0;position:relative;cursor:pointer;outline-offset:2px}
.dash-sales-bar{position:absolute;bottom:0;left:50%;transform:translateX(-50%);width:min(100%,30px);background:var(--accent);border-radius:5px 5px 0 0;transition:height .25s ease,opacity .15s ease}
.dash-sales-bar-cell:hover .dash-sales-bar,.dash-sales-bar-cell:focus-visible .dash-sales-bar{opacity:.72}
.dash-sales-average{position:absolute;left:0;right:0;border-top:2px dashed #65c6c9;pointer-events:none;z-index:2}
.dash-sales-average>span{position:absolute;right:0;bottom:4px;font-size:10px;font-weight:700;background:var(--card,#171717);color:#65c6c9;padding:2px 5px;border-radius:4px}
.dash-sales-dates{display:flex;gap:4px;margin:8px 12px 0 75px;min-height:17px}
.dash-sales-date{flex:1 1 0;min-width:0;text-align:center;color:var(--ink-3);font-size:10px;white-space:nowrap}
.dash-sales-legend{display:flex;align-items:center;gap:6px;justify-content:flex-end;margin:12px 12px 0 75px;color:var(--ink-3);font-size:11px}
.dash-sales-legend-line{width:20px;border-top:2px dashed #65c6c9}
@media(max-width:640px){.dash-sales-plot{height:190px;margin-left:62px;margin-right:4px}.dash-sales-dates{margin-left:62px;margin-right:4px}.dash-sales-gridline>span{right:calc(100% + 7px);min-width:49px;font-size:10px}.dash-sales-dates{gap:2px}.dash-sales-bar-grid{gap:2px}.dash-sales-date{font-size:9px}.dash-sales-legend{margin-left:62px;margin-right:4px}.dash-sales-average>span{font-size:9px}}

/* Restore original bar proportions, add guides without changing bar layout */
.dash-sales-original{width:100%;min-width:0}
.dash-sales-original-plot{position:relative;margin-left:75px;margin-right:8px}
.dash-sales-original-plot .dash-bars-wrap{position:relative;z-index:1;width:100%;overflow-x:auto}
.dash-sales-original-plot .dash-bars{height:240px}
.dash-sales-original-guides{position:absolute;inset:0 0 18px;pointer-events:none;z-index:2}
.dash-sales-original-guides .dash-sales-gridline{border-color:rgba(145,145,145,.18)}
.dash-sales-original-guides .dash-sales-average{z-index:2}
.dash-sales-original .dash-sales-legend{margin-left:75px}
@media(max-width:640px){.dash-sales-original-plot{margin-left:62px;margin-right:4px}.dash-sales-original-plot .dash-bars{height:190px}.dash-sales-original .dash-sales-legend{margin-left:62px}}

/* One weekday/day label per bar; preserve legibility on long periods */
.dash-sales-original-plot .dash-bars{gap:5px;min-width:max(100%,840px)}
.dash-sales-original-plot .dash-bar-col{min-width:23px}
.dash-sales-original-plot .dash-bar-lbl{font-size:10px;white-space:nowrap;overflow:visible;height:15px;line-height:15px;margin-top:6px}
@media(max-width:640px){.dash-sales-original-plot .dash-bars{min-width:max(100%,900px);gap:5px}.dash-sales-original-plot .dash-bar-col{min-width:25px}.dash-sales-original-plot .dash-bar-lbl{font-size:9px}}

/* Daily labels: vertical text and wider columns to prevent collisions */
.dash-sales-original-plot .dash-bars{gap:10px;min-width:max(100%,1200px);height:300px}
.dash-sales-original-plot .dash-bar-col{min-width:32px}
.dash-sales-original-plot .dash-bar-lbl{
  writing-mode:vertical-rl;
  text-orientation:mixed;
  transform:rotate(180deg);
  display:flex;align-items:center;justify-content:flex-start;
  flex:0 0 64px;height:64px;min-height:64px;
  width:100%;margin-top:8px;
  font-size:11px;line-height:1.2;letter-spacing:.2px;
  white-space:nowrap;overflow:visible;
}
.dash-sales-original-guides{bottom:72px}
@media(max-width:640px){
  .dash-sales-original-plot .dash-bars{gap:9px;min-width:max(100%,1160px);height:260px}
  .dash-sales-original-plot .dash-bar-col{min-width:30px}
  .dash-sales-original-plot .dash-bar-lbl{font-size:10px;height:64px;min-height:64px;flex-basis:64px}
  .dash-sales-original-guides{bottom:72px}
}

/* Month colors apply only to X-axis date labels; revenue bars retain brand orange */
.dash-sales-original-plot .dash-bar-lbl{font-weight:650}
.dash-sales-month-legend{display:flex;flex-wrap:wrap;gap:8px 18px;align-items:center;margin:12px 8px 0 75px}
.dash-sales-month-item{display:inline-flex;align-items:center;gap:7px;color:var(--ink-2);font-size:11px;text-transform:capitalize}
.dash-sales-month-item i{display:inline-block;flex:none;width:9px;height:9px;border-radius:50%}
@media(max-width:640px){.dash-sales-month-legend{margin-left:62px;gap:7px 12px}}

/* Report period controls: calendar month ranges alongside day-level presets */
.rep-month-range{display:flex;align-items:end;gap:10px;flex-wrap:wrap;flex-basis:100%;padding-top:12px;border-top:1px solid var(--border,#383838)}
.rep-month-range label{display:flex;flex-direction:column;gap:5px;font-size:12px;color:var(--ink-3)}
.rep-month-range input[type=month]{width:160px;max-width:100%}
@media(max-width:600px){.rep-month-range label{flex:1 1 135px}.rep-month-range input[type=month]{width:100%}}

/* Unified sales-report period selector */
.rep-period-controls{display:flex;align-items:flex-end;gap:14px;flex-wrap:wrap}
.rep-period-field,.rep-period-range label{display:flex;flex-direction:column;gap:6px;font-size:12px;color:var(--ink-3)}
.rep-period-field{flex:1 1 230px;min-width:190px}
.rep-period-field .select{width:100%}
.rep-period-range{display:flex;align-items:flex-end;gap:12px;flex-wrap:wrap}
.rep-period-range label{min-width:145px}
.rep-period-range .input{width:175px;max-width:100%}
.rep-period-summary{font-size:12px;align-self:center;white-space:nowrap}
@media(max-width:650px){.rep-period-field{flex-basis:100%}.rep-period-range{width:100%}.rep-period-range label{flex:1 1 130px;min-width:0}.rep-period-range .input{width:100%}.rep-period-controls>.btn{width:100%}}

/* Report KPI drill-down cards and Accounts nested navigation */
.report-kpi-link{display:block;min-width:0;cursor:pointer;border-radius:14px;outline-offset:3px}
.report-kpi-link>.kpi{height:100%;transition:border-color .16s ease,transform .16s ease,box-shadow .16s ease}
.report-kpi-link:hover>.kpi,.report-kpi-link:focus-visible>.kpi{border-color:var(--accent,#e8761b);transform:translateY(-2px);box-shadow:0 5px 18px rgba(0,0,0,.16)}
.report-kpi-link:focus-visible{outline:2px solid var(--accent,#e8761b)}
.nav-item.nav-subitem{margin-left:20px;padding-left:16px;font-size:12px;opacity:.9;border-left:2px solid var(--border,#383838)}
.nav-item.nav-subitem.active{border-left-color:var(--accent,#e8761b);opacity:1}

/* Accounts submenu: collapsed by default, hover on desktop and tap on touch */
.nav-accounts-group{min-width:0}
.nav-accounts-parent{display:flex;align-items:stretch;position:relative}
.nav-accounts-parent>.nav-item{flex:1;min-width:0}
.nav-accounts-toggle{flex:0 0 32px;border:0;background:transparent;color:var(--ink-3);cursor:pointer;font-size:22px;transition:transform .18s ease;color:inherit}
.nav-accounts-toggle:focus-visible{outline:2px solid var(--accent,#e8761b);outline-offset:-2px;border-radius:6px}
.nav-accounts-children{display:none;padding-top:2px}
.nav-accounts-group.expanded>.nav-accounts-children{display:block}
.nav-accounts-group.expanded .nav-accounts-toggle{transform:rotate(180deg)}
.nav-accounts-group .nav-subitem{margin-left:20px}
@media(hover:hover) and (pointer:fine){.nav-accounts-group:hover>.nav-accounts-children{display:block}.nav-accounts-group:hover .nav-accounts-toggle{transform:rotate(180deg)}}

/* Product filter sidebar: expand/collapse with responsive catalog density */
.prod-layout{width:100%;min-width:0}
.prod-layout .prod-sidebar{width:250px;flex:0 0 250px;min-width:0}
.prod-layout .prod-results{flex:1 1 0;min-width:0;width:100%}
.prod-layout.prod-filters-open .prod-catalog{grid-template-columns:repeat(3,minmax(0,1fr))}
.prod-layout.prod-filters-closed .prod-catalog{grid-template-columns:repeat(4,minmax(0,1fr))}
.prod-layout.prod-filters-closed .prod-results{width:100%}
.prod-layout .prod-sidebar .icon-btn{cursor:pointer}
@media(max-width:1150px){
  .prod-layout.prod-filters-open .prod-catalog{grid-template-columns:repeat(2,minmax(0,1fr))}
  .prod-layout.prod-filters-closed .prod-catalog{grid-template-columns:repeat(3,minmax(0,1fr))}
}
@media(max-width:800px){
  .prod-layout{flex-wrap:wrap}
  .prod-layout .prod-sidebar{width:100%;flex:1 1 100%}
  .prod-layout .prod-sidebar .card{position:static!important}
  .prod-layout.prod-filters-open .prod-catalog,.prod-layout.prod-filters-closed .prod-catalog{grid-template-columns:repeat(2,minmax(0,1fr))}
}
@media(max-width:420px){
  .prod-layout.prod-filters-open .prod-catalog,.prod-layout.prod-filters-closed .prod-catalog{grid-template-columns:repeat(2,minmax(0,1fr))}
}


/* Sidebar icon rail: prevent horizontal scrolling when collapsed. */
.app.collapsed .nav{overflow-x:hidden;overscroll-behavior-x:none;touch-action:pan-y;min-width:0}
.app.collapsed .nav-label,.app.collapsed .nav-section-title,.app.collapsed .nav-badge,
.app.collapsed .nav-accounts-toggle,.app.collapsed .nav-accounts-children{display:none!important}
.app.collapsed .nav-item{width:100%;min-width:0;box-sizing:border-box;justify-content:center;padding-left:0;padding-right:0;margin-left:0}
.app.collapsed .nav-accounts-parent>.nav-item{flex:1 1 auto}
.app.collapsed .brand{justify-content:center;padding-left:0;padding-right:0}
.app.collapsed .sidebar-foot .u-meta{display:none}
@media(max-width:900px){
  .app:not(.nav-open) .nav{overflow-x:hidden;overscroll-behavior-x:none;touch-action:pan-y;min-width:0}
  .app:not(.nav-open) .nav-label,.app:not(.nav-open) .nav-section-title,
  .app:not(.nav-open) .nav-badge,.app:not(.nav-open) .nav-accounts-toggle,
  .app:not(.nav-open) .nav-accounts-children{display:none!important}
  .app:not(.nav-open) .nav-item{width:100%;min-width:0;box-sizing:border-box;justify-content:center;padding-left:0;padding-right:0;margin-left:0}
  .app:not(.nav-open) .nav-accounts-parent>.nav-item{flex:1 1 auto}
  .app:not(.nav-open) .brand{justify-content:center;padding-left:0;padding-right:0}
  .app:not(.nav-open) .sidebar-foot .u-meta{display:none}
}


/* Keep the Vikings logo inside the narrow tablet rail. The brand text must not
   reserve intrinsic width or push the mark outside the sidebar. */
.app.collapsed .brand-name,
.app.collapsed .brand .brand-name{display:none!important}
.app.collapsed .brand-mark{margin:0;flex:0 0 34px}
@media(max-width:900px){
  .app:not(.nav-open) .brand-name{display:none!important}
  .app:not(.nav-open) .brand-mark{margin:0;flex:0 0 34px}
}

/* Mobile: one notification control instead of five competing with global search. */
.mobile-notif-group{display:flex;align-items:center;position:relative;flex-shrink:0}
.mobile-notif-items{display:flex;align-items:center;gap:8px}
.mobile-notif-toggle{display:none}
@media(max-width:640px){
  .topbar{gap:6px;padding:0 8px}
  .topbar>.icon-btn,.topbar>.profile-wrap,.mobile-notif-group{flex-shrink:0}
  .topbar .searchbar{flex:1 1 0;min-width:0;max-width:none}
  .mobile-notif-toggle{display:grid}
  .mobile-notif-items{display:none;position:absolute;right:0;top:calc(100% + 10px);padding:8px;background:var(--surface,var(--bg));border:1px solid var(--border-soft);border-radius:12px;box-shadow:0 10px 32px rgba(0,0,0,.28);z-index:var(--z-tooltip);gap:4px}
  .mobile-notif-group.expanded .mobile-notif-items{display:flex}
  .mobile-notif-toggle .dot{pointer-events:none}
}

/* Salidas: date filters remain usable on narrow phone screens. */
.outflow-period-controls{display:flex;gap:12px;align-items:end;flex-wrap:wrap;margin-bottom:16px}
.outflow-period-controls label{display:flex;flex-direction:column;gap:6px;min-width:170px}
.outflow-period-controls .outflow-period-summary{padding-bottom:8px}
@media(max-width:640px){
  .outflow-period-controls{display:flex;flex-direction:column;align-items:stretch;gap:12px}
  .outflow-period-controls label,.outflow-period-controls .select,.outflow-period-controls .input{width:100%;min-width:0;max-width:100%}
  .outflow-period-controls .btn{width:100%;margin-top:4px}
  .outflow-period-controls .outflow-period-summary{padding-bottom:0;font-size:12px}
}

/* Salidas: preserve a tabular ledger on desktop and mobile. */
.outflow-table-wrap{width:100%;overflow-x:auto;-webkit-overflow-scrolling:touch}
.outflow-table{width:100%;min-width:610px;border-collapse:collapse}
.outflow-table th,.outflow-table td{white-space:nowrap}
.outflow-table td:nth-child(3){white-space:normal;min-width:170px}
.outflow-table th:last-child,.outflow-table td:last-child{text-align:right}
@media(max-width:640px){
  .outflow-table-wrap{max-width:100%}
  .outflow-table{display:table;min-width:610px}
  .outflow-table thead{display:table-header-group}
  .outflow-table tbody{display:table-row-group}
  .outflow-table tr{display:table-row}
  .outflow-table th,.outflow-table td{display:table-cell;padding:10px 12px;font-size:12px}
}

/* Direct page navigation for the Salidas ledger. */
.outflow-pagination{display:flex;align-items:center;justify-content:center;gap:10px;flex-wrap:wrap;margin-top:16px}
.outflow-page-numbers{display:flex;align-items:center;gap:5px;max-width:100%;overflow-x:auto}
.outflow-page-btn{min-width:36px;height:36px;padding:0 9px;flex-shrink:0}
.outflow-page-btn.active{background:var(--accent);color:#111;font-weight:700}
.outflow-page-ellipsis{padding:0 5px;color:var(--ink-3)}
@media(max-width:640px){
 .outflow-pagination{gap:8px}
 .outflow-page-numbers{order:-1;width:100%;justify-content:center}
 .outflow-page-btn{min-width:34px;height:34px}
}

/* Dashboard: carga inicial con skeleton animado */
.dash-loading-top{display:flex;align-items:center;gap:14px;margin:0 0 20px;padding:16px 18px;border:1px solid var(--border);border-radius:14px}
.dash-loading-spinner{width:26px;height:26px;flex:0 0 26px;border:3px solid var(--border);border-top-color:var(--accent);border-radius:50%;animation:dash-loading-spin .85s linear infinite}
.dash-loading-card{min-height:126px;display:flex;flex-direction:column;justify-content:center;gap:18px}
.dash-loading-chart{display:flex;flex-direction:column;gap:20px;min-height:240px}
.dash-skeleton{display:block;border-radius:7px;background:linear-gradient(100deg,var(--border) 15%,rgba(148,163,184,.23) 40%,var(--border) 65%);background-size:220% 100%;animation:dash-loading-shimmer 1.5s ease-in-out infinite}
.dash-skeleton-label{width:42%;height:14px}
.dash-skeleton-value{width:65%;height:32px}
.dash-skeleton-wide{width:100%;height:22px}
@keyframes dash-loading-spin{to{transform:rotate(360deg)}}
@keyframes dash-loading-shimmer{to{background-position-x:-220%}}
@media(prefers-reduced-motion:reduce){.dash-loading-spinner,.dash-skeleton{animation:none}}

/* Ventas: indicador de actividad durante la consulta del comparativo anual */
.sales-chart-loading{padding:16px 2px 8px}
.sales-chart-loading-heading{display:flex;align-items:center;gap:14px;margin-bottom:22px}
.sales-chart-loading-spinner{width:27px;height:27px;flex:0 0 27px;border:3px solid var(--border);border-top-color:var(--accent);border-radius:50%;animation:sales-chart-spin .85s linear infinite}
.sales-chart-loading-track{height:5px;overflow:hidden;border-radius:999px;background:var(--border);margin-bottom:24px}
.sales-chart-loading-track span{display:block;height:100%;width:35%;border-radius:inherit;background:var(--accent);animation:sales-chart-progress 1.6s ease-in-out infinite}
.sales-chart-loading-bars{display:flex;align-items:end;justify-content:space-between;gap:7px;height:170px;padding:0 4px 10px;border-bottom:1px solid var(--border)}
.sales-chart-loading-bars i{display:block;flex:1;min-width:0;height:var(--bar-height,35%);border-radius:4px 4px 0 0;background:var(--border);opacity:.7;animation:sales-chart-pulse 1.3s ease-in-out infinite alternate}
.sales-chart-loading-bars i:nth-child(3n+1){--bar-height:24%;animation-delay:.1s}
.sales-chart-loading-bars i:nth-child(3n+2){--bar-height:58%;animation-delay:.3s}
.sales-chart-loading-bars i:nth-child(4n){--bar-height:82%;animation-delay:.5s}
@keyframes sales-chart-spin{to{transform:rotate(360deg)}}
@keyframes sales-chart-progress{0%{transform:translateX(-110%)}100%{transform:translateX(310%)}}
@keyframes sales-chart-pulse{to{opacity:.25}}
@media(prefers-reduced-motion:reduce){.sales-chart-loading-spinner,.sales-chart-loading-track span,.sales-chart-loading-bars i{animation:none}}

/* Email Flow — mobile-friendly profile menu and mailbox settings */
.profile-menu .pm-actions{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;margin-top:8px}
.profile-menu .pm-actions .pm-logout{width:100%;min-width:0;min-height:38px;padding:8px 6px;font-size:12px;line-height:1.2;white-space:nowrap}
.profile-menu .pm-actions .pm-logout svg{width:14px;height:14px}
.mail-profile-panel{display:grid;gap:16px;min-width:0}
.mail-profile-identity{display:grid;gap:4px;min-width:0;overflow-wrap:anywhere}
.mail-settings-card{display:grid;gap:12px;min-width:0;padding:16px;border:1px solid var(--border);border-radius:var(--r-md);background:var(--surface)}
.mail-settings-title{display:flex;align-items:center;gap:10px}
.mail-settings-title h3{margin:0;font-size:16px}
.mail-settings-card p{margin:0;line-height:1.5}
.mail-settings-actions{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}
.mail-settings-actions .btn{min-width:0;width:100%;white-space:normal;line-height:1.25;padding:10px 8px;font-size:12px;min-height:42px}
.mail-config-form{display:grid;gap:14px;min-width:0;padding:2px 0 8px}
.mail-config-form label{display:grid;gap:6px;min-width:0;font-size:13px;font-weight:600}
.mail-config-form .input{display:block;box-sizing:border-box;width:100%;min-width:0}
.mail-config-form .muted{margin:0;line-height:1.5}
.mail-config-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}
@media(max-width:600px){
 .modal-wrap .modal{max-width:calc(100vw - 24px);width:calc(100vw - 24px)}
 .modal-wrap .modal-body{padding-left:16px;padding-right:16px}
 .modal-wrap .modal-foot{padding:12px 16px 16px;gap:8px;flex-wrap:wrap}
 .modal-wrap .modal-foot .btn{min-width:0}
 .mail-settings-card{padding:12px}
}

/* Perfil: evita desbordamiento de Cerrar sesión en pantallas estrechas */
.profile-menu .pm-actions .pm-logout{box-sizing:border-box;overflow:hidden;white-space:normal;overflow-wrap:normal;word-break:normal;text-align:center;font-size:clamp(10px,2.8vw,12px);gap:4px;padding-inline:4px}
.profile-menu .pm-actions .pm-logout svg{flex:0 0 13px;width:13px;height:13px}
@media(max-width:390px){.profile-menu .pm-actions{gap:6px}.profile-menu .pm-actions .pm-logout{font-size:11px;padding-inline:3px}}

/* Catálogo: ajustar precio largo sin recortar el estado de publicación */
.prod-card-price-status{min-width:0;width:100%}
.prod-card-price{min-width:0;flex:1 1 auto;display:block}
.prod-card-price>b,.prod-card-price>span{max-width:100%}
.prod-card-publish{flex:0 0 auto;white-space:nowrap}
@media(max-width:700px){.prod-card-price-status{gap:4px!important}.prod-card-price b{font-size:clamp(10px,2.7vw,13px)!important}.prod-card-publish .chip{font-size:clamp(10px,2.5vw,12px);padding-inline:6px}}

/* Email Flow — layout de tres paneles */
.ef-shell{height:calc(100vh - 135px);min-height:550px;display:flex;flex-direction:column;border:1px solid #303030;border-radius:16px;overflow:hidden;background:#151515;color:#eaeaea}
.ef-header{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:18px 22px;border-bottom:1px solid #303030}.ef-header h1{font-size:22px;margin:0 0 4px}.ef-header p{font-size:12px;color:#999;margin:0}.ef-actions{display:flex;gap:8px}
.ef-layout{display:grid;grid-template-columns:195px minmax(300px,390px) minmax(0,1fr);min-height:0;flex:1}
.ef-sidebar{border-right:1px solid #303030;padding:22px 12px}.ef-sidebar small{display:block;color:#777;font-size:10px;letter-spacing:1px;margin:0 10px 16px}.ef-sidebar p{color:#777;font-size:11px;line-height:1.5;padding:18px 10px}
.ef-folder{width:100%;display:flex;justify-content:space-between;gap:8px;border:0;border-radius:9px;padding:13px 12px;background:transparent;color:#bbb;text-align:left;cursor:pointer}.ef-folder.active,.ef-folder:hover{background:#332419;color:#f28a40}
.ef-list{min-height:0;display:flex;flex-direction:column;border-right:1px solid #303030}.ef-list-head{display:flex;align-items:center;justify-content:space-between;gap:8px;padding:19px 14px 12px}.ef-list-head h2{font-size:16px;margin:0 0 4px}.ef-list-head small{color:#888;font-size:11px}.ef-tabs{display:flex;background:#242424;border-radius:8px;padding:3px}.ef-tabs button{background:transparent;border:0;color:#aaa;padding:7px;font-size:11px;cursor:pointer}.ef-tabs button.active{background:#414141;color:white;border-radius:6px}
.ef-search{display:flex;align-items:center;gap:8px;border:1px solid #353535;border-radius:9px;margin:0 14px 12px;padding:9px;color:#888}.ef-search input{background:none;border:0;outline:0;min-width:0;width:100%;font:inherit;color:#eee;font-size:12px}
.ef-rows{min-height:0;overflow:auto;flex:1}.ef-row{display:flex;align-items:center;gap:10px;width:100%;padding:14px 12px;background:transparent;border:0;border-bottom:1px solid #292929;text-align:left;color:#ccc;cursor:pointer}.ef-row:hover,.ef-row.ef-active{background:#252525}.ef-row.ef-active{box-shadow:inset 3px 0 #f27825}.ef-avatar{display:grid;place-items:center;flex:0 0 34px;height:34px;border-radius:50%;background:#3c3029;color:#e6b38b;font-weight:700}.ef-row-text{min-width:0;flex:1;display:grid;gap:7px}.ef-row-from,.ef-row-subject{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:12px}.ef-row-subject{color:#999}.ef-unread .ef-row-from,.ef-unread .ef-row-subject{font-weight:800;color:#fff}.ef-row time{flex-shrink:0;font-size:10px;color:#888}
.ef-footer{display:flex;justify-content:space-between;align-items:center;gap:8px;padding:12px;border-top:1px solid #303030;font-size:11px;color:#aaa}.ef-reader{min-width:0;overflow:auto}.ef-reader-empty{display:flex;height:100%;flex-direction:column;align-items:center;justify-content:center;text-align:center;padding:25px;color:#888}.ef-reader-empty span{font-size:48px;color:#f27825}.ef-reader-empty h3{font-size:18px;color:#eee;margin:14px 0 0}.ef-reader-empty p{max-width:260px;font-size:12px;line-height:1.6}
.ef-reader-top{padding:14px 20px;display:flex;align-items:center;justify-content:space-between;border-bottom:1px solid #303030;font-size:11px;color:#888}.ef-message{padding:22px;overflow-wrap:anywhere}.ef-message h2{font-size:21px;line-height:1.4}.ef-sender{display:grid;gap:5px;padding:16px 0;border-bottom:1px solid #303030;font-size:12px}.ef-sender small{color:#888}.ef-body{padding:22px 0;white-space:pre-wrap;overflow-wrap:anywhere;font-size:13px;line-height:1.7}.ef-attachments{border-top:1px solid #303030;padding:15px 0;font-size:12px}.ef-empty,.ef-error{padding:30px;text-align:center;color:#999;font-size:12px}.ef-error{color:#ff8d8d}.ef-back{display:none}
@media(max-width:1100px){.ef-layout{grid-template-columns:145px minmax(250px,350px) minmax(0,1fr)}.ef-sidebar{padding:14px 6px}}
@media(max-width:800px){.ef-shell{height:calc(100dvh - 110px);min-height:440px}.ef-layout{grid-template-columns:minmax(0,1fr)}.ef-sidebar{display:none}.ef-list{border:0}.ef-reader{display:none}.ef-shell:has(.ef-message) .ef-list{display:none}.ef-shell:has(.ef-message) .ef-reader{display:block}.ef-back{display:inline-flex}.ef-header{padding:14px}.ef-header h1{font-size:18px}.ef-message{padding:16px}}

/* Correo como espacio de trabajo a pantalla completa (sin tarjeta exterior) */
#app.email-workspace #view-correo.active>.page{padding:0!important;margin:0!important;max-width:none!important;width:100%!important}
#app.email-workspace .ef-shell{height:calc(100dvh - 65px);min-height:0;width:100%;max-width:none;border:0;border-radius:0;box-shadow:none}
#app.email-workspace .ef-layout{grid-template-columns:205px minmax(330px,440px) minmax(0,1fr)}
#app.email-workspace #content{overflow:hidden}
@media(max-width:1100px){#app.email-workspace .ef-layout{grid-template-columns:160px minmax(280px,370px) minmax(0,1fr)}}
@media(max-width:800px){#app.email-workspace #content{overflow:auto}#app.email-workspace .ef-shell{height:calc(100dvh - 65px)}#app.email-workspace .ef-layout{grid-template-columns:minmax(0,1fr)}}

/* Email Flow: listado ancho completo hasta abrir mensaje con doble clic */
#app.email-workspace .ef-shell.ef-inbox .ef-layout{grid-template-columns:185px minmax(0,1fr)}
#app.email-workspace .ef-shell.ef-inbox .ef-reader{display:none}
#app.email-workspace .ef-shell.ef-inbox .ef-list{border-right:0}
#app.email-workspace .ef-shell.ef-inbox .ef-row-text{display:flex;align-items:center;gap:24px}
#app.email-workspace .ef-shell.ef-inbox .ef-row-from{flex:0 0 260px}
#app.email-workspace .ef-shell.ef-inbox .ef-row-subject{flex:1;min-width:0}
#app.email-workspace .ef-shell.ef-inbox .ef-row{min-height:56px}
#app.email-workspace .ef-shell.ef-reading .ef-layout{grid-template-columns:185px minmax(300px,390px) minmax(0,1fr)}
#app.email-workspace .ef-shell.ef-reading .ef-back{display:inline-flex}
@media(max-width:800px){
 #app.email-workspace .ef-shell.ef-inbox .ef-layout{grid-template-columns:minmax(0,1fr)}
 #app.email-workspace .ef-shell.ef-inbox .ef-row-text{display:grid;gap:5px}
 #app.email-workspace .ef-shell.ef-inbox .ef-row-from{flex:auto}
 #app.email-workspace .ef-shell.ef-reading .ef-layout{grid-template-columns:minmax(0,1fr)}
}

/* Render de correos HTML aislados */
.ef-html-body{display:block;width:100%;height:min(70vh,850px);min-height:420px;border:1px solid #303030;border-radius:8px;background:white}

.ef-image-consent{display:flex;align-items:center;justify-content:space-between;gap:12px;background:#29221b;border:1px solid #664528;border-radius:8px;padding:12px;margin:12px 0;color:#e8bb92;font-size:12px}
@media(max-width:600px){.ef-image-consent{flex-direction:column;align-items:stretch}}

/* WooCommerce email viewing: avoid forcing compact preview tables to wrap */
#app.email-workspace .ef-shell.ef-reading .ef-layout{grid-template-columns:185px minmax(250px,330px) minmax(0,1fr)}
#app.email-workspace .ef-shell.ef-reading .ef-body{white-space:normal;overflow-wrap:normal}
#app.email-workspace .ef-html-body{height:calc(100dvh - 345px);min-height:500px}
@media(max-width:1050px){#app.email-workspace .ef-shell.ef-reading .ef-layout{grid-template-columns:160px minmax(220px,280px) minmax(0,1fr)}}
@media(max-width:800px){#app.email-workspace .ef-shell.ef-reading .ef-layout{grid-template-columns:minmax(0,1fr)}}


/* Orders: compact, verified MariaDB snapshot marker (outline database icon). */
.order-backup-indicator{
  display:inline-flex;align-items:center;justify-content:center;
  width:22px;height:22px;margin-left:5px;vertical-align:middle;
  border-radius:7px;border:1px solid transparent;
  color:var(--ink-3,#969696);background:var(--elevated,rgba(110,110,110,.08));
  cursor:help;white-space:nowrap;
}
.order-backup-indicator svg{width:15px;height:15px;flex-shrink:0}
.order-backup-indicator.backup-saved{
  color:#2a9c67;background:rgba(42,156,103,.12);border-color:rgba(42,156,103,.20)
}
.order-backup-indicator.backup-stale{
  color:#d59034;background:rgba(213,144,52,.12);border-color:rgba(213,144,52,.24)
}
.order-backup-indicator.backup-missing,
.order-backup-indicator.backup-unknown{
  color:var(--ink-3,#969696);background:transparent;border-color:var(--border,#444)
}

/* Explicit feedback on narrow order cards; iOS does not display hover tooltips. */
.order-backup-indicator .order-backup-label{display:none}
@media(max-width:640px){
  .orders-table td[data-label="Pedido"] .order-backup-indicator,
  .orders-table td[data-label="Venta"] .order-backup-indicator{
    display:inline-flex;vertical-align:middle;gap:5px;
    width:auto;min-width:22px;height:25px;padding:0 6px;
    max-width:min(100%,140px);text-align:left;
  }
  .orders-table td[data-label="Pedido"] .order-backup-indicator svg,
  .orders-table td[data-label="Venta"] .order-backup-indicator svg{width:15px;height:15px;flex:none}
  .orders-table td[data-label="Pedido"] .order-backup-label,
  .orders-table td[data-label="Venta"] .order-backup-label{
    display:inline-block;font-size:10px;line-height:1.1;font-weight:600;
    white-space:normal;overflow-wrap:normal;
  }
  .orders-table td[data-label="Pedido"],
  .orders-table td[data-label="Venta"]{overflow-wrap:normal;word-break:normal}
}

/* Notification categories: compact, consistently sized icons and accessible accordion. */
.notif-sec-toggle{width:100%;display:flex;align-items:center;justify-content:space-between;gap:8px;min-height:44px;padding:10px 16px;background:none;border:0;border-bottom:1px solid var(--border-soft);cursor:pointer;color:var(--ink-2);font-size:11px;font-weight:700;text-transform:uppercase;letter-spacing:.04em;text-align:left}
.notif-sec-toggle:focus-visible{outline:2px solid var(--accent);outline-offset:-2px}
.notif-sec-label{display:inline-flex;align-items:center;gap:8px;min-width:0}
.notif-sec-icon{display:inline-flex;align-items:center;justify-content:center;width:18px;height:18px;flex:0 0 18px}
.notif-sec-icon svg{display:block;width:16px;height:16px;stroke-width:1.8}
.notif-sec-count{font-size:11px;font-weight:600;padding:2px 7px;border-radius:999px;background:var(--surface-2);color:var(--ink-2);letter-spacing:0}
.notif-sec-chevron{display:inline-flex;align-items:center;justify-content:center;width:18px;height:18px;flex:0 0 18px;transition:transform .18s ease}
.notif-sec-chevron svg{width:15px;height:15px}
.notif-sec-chevron.expanded{transform:rotate(90deg)}

/* Semantic colors for order-notification section headings. */
.notif-sec-toggle--orders_new{--notif-heading-color:var(--ok)}
.notif-sec-toggle--orders_pending_payment{--notif-heading-color:var(--info)}
.notif-sec-toggle--orders_stale{--notif-heading-color:var(--danger)}
.notif-sec-toggle[class*="notif-sec-toggle--orders_"]{color:var(--notif-heading-color)}
.notif-sec-toggle[class*="notif-sec-toggle--orders_"] .notif-sec-icon,
.notif-sec-toggle[class*="notif-sec-toggle--orders_"] .notif-sec-count{color:var(--notif-heading-color)}
.notif-sec-toggle[class*="notif-sec-toggle--orders_"] .notif-sec-count{background:color-mix(in srgb,var(--notif-heading-color) 14%,transparent)}
.notif-sec-toggle[class*="notif-sec-toggle--orders_"] .notif-sec-chevron{color:var(--ink-3)}

/* Pending-payment notifications are orange (not blue). */
.notif-sec-toggle--orders_pending_payment{--notif-heading-color:var(--warn)}

/* Pedido: timeline de estados y responsables debajo de facturación/envío. */
.order-timeline-section{margin-top:20px;padding:0;border:0;border-radius:0;background:transparent}
.order-timeline{list-style:none;margin:0;padding:0 0 0 16px;border-left:1px solid var(--border-strong)}
.order-timeline-entry{position:relative;margin:0;padding:0 0 20px 18px;overflow-wrap:anywhere}
.order-timeline-entry:last-child{padding-bottom:0}
.order-timeline-entry::before{content:"";position:absolute;left:-21px;top:5px;width:9px;height:9px;border-radius:50%;background:var(--accent);box-shadow:0 0 0 3px var(--surface)}
.order-timeline-date{font-size:11px;color:var(--ink-3);margin-bottom:5px}
.order-timeline-cause{font-size:13px;font-weight:650;color:var(--ink)}
.order-timeline-transition{font-size:12px;color:var(--ink-2);margin-top:4px}
.order-timeline-transition strong{color:var(--accent)}
.order-timeline-actor{font-size:11px;color:var(--ink-3);margin-top:5px}

/* Timeline: each dot reflects the new order status, never the current status. */
.order-timeline-entry{--order-timeline-dot:var(--ink-3)}
.order-timeline-entry--created{--order-timeline-dot:var(--ink-3)}
.order-timeline-entry--pending{--order-timeline-dot:var(--warn)}
.order-timeline-entry--on-hold{--order-timeline-dot:var(--accent)}
.order-timeline-entry--processing{--order-timeline-dot:var(--info)}
.order-timeline-entry--completed{--order-timeline-dot:var(--ok)}
.order-timeline-entry--failed{--order-timeline-dot:var(--danger)}
.order-timeline-entry--cancelled,.order-timeline-entry--refunded,.order-timeline-entry--trash{--order-timeline-dot:var(--ink-4)}
.order-timeline-entry--unknown{--order-timeline-dot:var(--ink-3)}
.order-timeline-entry::before{background:var(--order-timeline-dot)}

/* Order details: independently expandable sections, collapsed on every open. */
.order-detail-fold-group{display:grid;gap:8px;margin-top:20px}
.order-detail-fold{border:1px solid var(--border-soft);border-radius:10px;background:var(--surface);overflow:hidden;margin-top:14px}
.order-detail-fold-group>.order-detail-fold{margin-top:0}
.order-detail-fold>summary{display:flex;align-items:center;gap:10px;min-height:46px;padding:11px 15px;cursor:pointer;list-style:none;color:var(--ink);font-size:13px;font-weight:650;user-select:none}
.order-detail-fold>summary::-webkit-details-marker{display:none}
.order-detail-fold>summary::after{content:"";margin-left:auto;flex-shrink:0;width:7px;height:7px;border-right:1.8px solid var(--ink-3);border-bottom:1.8px solid var(--ink-3);transform:rotate(45deg);transition:transform var(--t-fast)}
.order-detail-fold[open]>summary::after{transform:rotate(225deg)}
.order-detail-fold>summary:hover{background:var(--surface-2)}
.order-detail-fold>summary:focus-visible{outline:2px solid var(--accent);outline-offset:-3px}
.order-detail-fold-count{font-size:11px;font-weight:500;color:var(--ink-3)}
.order-detail-fold-content{padding:14px 15px 16px;border-top:1px solid var(--border-soft);min-width:0}

/* Pedido: datos clave en dos columnas independientes, apiladas en móvil. */
.order-overview-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:20px;margin-bottom:20px;align-items:start}
.order-overview-column{min-width:0}
.order-overview-heading{margin:0 0 9px}
.order-overview-column .info-list{min-width:0}
.order-overview-column .info-row{gap:12px}
.order-overview-column .info-row .v{min-width:0;overflow-wrap:anywhere;text-align:right}
@media(max-width:760px){.order-overview-grid{grid-template-columns:minmax(0,1fr);gap:18px}}

/* Pedido: historial visible entre resumen y productos, horizontal y cronológico. */
.order-timeline-section{margin:0 0 20px;padding:16px;min-width:0}
.order-timeline-scroll{overflow-x:auto;overscroll-behavior-inline:contain;padding:8px 2px 12px;scrollbar-width:thin}
.order-timeline-scroll:focus-visible{outline:2px solid var(--accent);outline-offset:2px}
.order-customer-note{margin-top:18px;padding:0 16px;min-width:0}
.order-timeline{display:grid;grid-template-columns:repeat(var(--timeline-count),minmax(0,1fr));align-items:start;gap:0;position:relative;width:100%;min-width:0;margin:0;padding:0;border:0;list-style:none}
.order-timeline::before{content:"";position:absolute;left:14px;right:14px;top:17px;height:2px;background:var(--border-strong)}
.order-timeline[data-timeline-count="1"]::before{display:none}
.order-timeline[data-timeline-count="2"]::before{right:50%}
.order-timeline-entry{min-width:0;width:auto;max-width:none;padding:39px clamp(5px,1.2vw,18px) 0 8px;position:relative;overflow-wrap:anywhere}
.order-timeline-entry:last-child{padding-right:8px}
.order-timeline-entry::before{left:8px;top:12px;width:12px;height:12px;z-index:1;background:var(--order-timeline-dot);box-shadow:0 0 0 4px var(--surface)}
.order-timeline-entry::after{display:none}
.order-timeline[data-timeline-count]:not([data-timeline-count="1"]):not([data-timeline-count="2"]) .order-timeline-entry:not(:first-child):not(:last-child)::before{left:50%;transform:translateX(-50%)}
.order-timeline[data-timeline-count]:not([data-timeline-count="1"]):not([data-timeline-count="2"]) .order-timeline-entry:not(:first-child):not(:last-child){text-align:center}
.order-timeline[data-timeline-count]:not([data-timeline-count="1"]):not([data-timeline-count="2"]) .order-timeline-entry:last-child::before{left:auto;right:8px}
.order-timeline[data-timeline-count]:not([data-timeline-count="1"]):not([data-timeline-count="2"]) .order-timeline-entry:last-child{text-align:right}
.order-timeline-transition strong{color:var(--order-timeline-dot)}
@media(max-width:760px){.order-timeline-section{padding:14px 12px}.order-customer-note{padding:0 12px}.order-timeline-entry{font-size:11px;padding-left:5px;padding-right:5px}.order-timeline-entry::before{left:5px}}


/* Pedido: secciones sin tarjetas, encabezado + divisor y control +/- */
.order-detail-fold{
  margin-top:12px;
  border:0;
  border-radius:0;
  background:transparent;
  overflow:visible;
}
.order-detail-fold-group{gap:8px}
.order-detail-fold>summary{
  display:flex;
  align-items:center;
  gap:10px;
  min-height:44px;
  padding:8px 0;
  border:0;
  background:transparent;
  font-size:15px;
  font-weight:700;
}
.order-detail-fold>summary::before{
  content:"";
  order:2;
  flex:1 1 auto;
  min-width:16px;
  height:1px;
  background:var(--border-soft);
}
.order-detail-fold>summary::after{
  content:"+";
  order:3;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  width:26px;
  height:26px;
  margin-left:0;
  border:0;
  transform:none;
  color:var(--ink-2);
  font-size:23px;
  font-weight:400;
  line-height:1;
}
.order-detail-fold[open]>summary::after{content:"−";transform:none}
.order-detail-fold>summary:hover{background:transparent;color:var(--accent)}
.order-detail-fold>summary:hover::after{color:var(--accent)}
.order-detail-fold>summary:focus-visible{outline:2px solid var(--accent);outline-offset:2px}
.order-detail-fold-content{
  padding:10px 0 20px;
  border-top:0;
}
@media(max-width:760px){
  .order-detail-fold>summary{gap:8px;min-height:44px}
  .order-detail-fold>summary::after{width:32px;height:32px}
}
/* Pedido: menú compacto de acciones de envío en el pie del drawer. */
.order-shipping-menu{position:relative;flex:0 0 auto;width:172px;min-width:0;margin-left:auto}
.order-shipping-menu>summary{list-style:none;width:100%;justify-content:center;cursor:pointer}
.order-shipping-menu>summary::-webkit-details-marker{display:none}
.order-shipping-menu>summary svg:last-child{width:14px;height:14px;transition:transform .15s}
.order-shipping-menu[open]>summary svg:last-child{transform:rotate(180deg)}
.order-shipping-options{position:absolute;right:12px;left:auto;bottom:calc(100% + 12px);z-index:40;width:min(320px,calc(100vw - 48px));max-width:calc(100vw - 48px);padding:8px;background:var(--surface,#fff);border:1px solid var(--border-soft);border-radius:10px;box-shadow:0 12px 34px rgba(15,23,42,.18)}
.order-shipping-options button{display:flex;width:100%;gap:10px;align-items:flex-start;padding:11px 12px;border:0;border-radius:8px;background:transparent;color:var(--ink);text-align:left;cursor:pointer}
.order-shipping-options button{transition:background-color .16s ease,color .16s ease}
.order-shipping-options button:hover,.order-shipping-options button:focus-visible{background:var(--accent);color:#fff;outline:none}
.order-shipping-options button:hover small,.order-shipping-options button:focus-visible small{color:rgba(255,255,255,.85)}
.order-shipping-options button>svg{width:18px;height:18px;flex:0 0 auto;margin-top:1px}
.order-shipping-options span{display:grid;gap:2px}
.order-shipping-options small{color:var(--ink-3);font-size:11.5px;font-weight:400}

/* Envío: botón compacto con el naranja principal de Vikings. */
.order-shipping-menu>summary.btn-manuable{background:var(--accent);color:#fff;min-height:40px;padding:0 16px;border-color:var(--accent);font-weight:650}
.order-shipping-menu>summary.btn-manuable:hover{background:var(--accent-hover);border-color:var(--accent-hover)}
.order-shipping-menu>summary.btn-manuable:active{background:var(--accent-press)}
#drawerFoot>.btn-manuable:disabled{background:var(--accent);color:#fff;max-width:100%;padding-inline:14px}
@media(max-width:480px){.order-shipping-menu{width:150px}.order-shipping-menu>summary.btn-manuable{padding-inline:10px}}

/* Seguimiento: formulario WooCommerce adaptado al tema Vikings. */
.order-tracking-form{display:grid;gap:15px}
.order-tracking-field{display:grid;gap:7px;color:var(--ink-2);font-size:12.5px;font-weight:500}
.order-tracking-field>.input,.order-tracking-field>.select{width:100%;min-height:40px;color:var(--ink);background:var(--elevated);border:1px solid var(--border);border-radius:7px}
.order-tracking-field>.input:focus,.order-tracking-field>.select:focus{border-color:var(--accent);outline:2px solid var(--accent-soft)}
.order-tracking-notice{font-size:11.5px;color:var(--ink-3);margin-top:-9px}
.order-tracking-complete{display:flex;align-items:center;gap:10px;font-size:12.5px;color:var(--ink);cursor:pointer}
.order-tracking-complete>input{width:17px;height:17px;accent-color:var(--accent)}
.order-tracking-existing{display:grid;gap:8px;padding:12px;border:1px solid var(--border-soft);border-radius:8px;background:var(--surface-2)}

/* Menú contextual de pedidos: iconos consistentes y foco visible. */
.bulk-action-option svg{width:16px;height:16px;flex:0 0 16px;stroke-width:1.8}
.bulk-action-icon-placeholder{display:inline-block;width:16px;flex:0 0 16px}
.bulk-action-option:hover,.bulk-action-option:focus-visible{background:rgba(230,110,29,.12)!important;color:var(--accent)!important;outline:none}

/* Reportes > Ventas por talla: pastel porcentual adaptable. */
.size-pie-layout{display:flex;align-items:center;justify-content:center;gap:36px;padding:12px 0 18px;flex-wrap:wrap}
.size-pie-svg{width:min(290px,100%);height:auto;flex:0 0 290px;max-width:100%}
.size-pie-label{font-size:13px;font-weight:700;fill:#fff;paint-order:stroke;stroke:rgba(0,0,0,.25);stroke-width:2px;stroke-linejoin:round}
.size-pie-legend{display:flex;flex-direction:column;gap:10px;min-width:210px;max-width:350px;flex:1 1 220px}
.size-pie-legend-row{display:grid;grid-template-columns:12px minmax(40px,1fr) auto;gap:10px;align-items:center;font-size:12px;color:var(--ink-2)}
.size-pie-legend-row b{color:var(--ink)}
.size-pie-legend-row>span:last-child{white-space:nowrap;text-align:right}
.size-pie-swatch{width:12px;height:12px;border-radius:3px}
.size-pie-total{padding-top:10px;margin-top:4px;border-top:1px solid var(--border-soft);color:var(--ink-3);font-size:12px}
.size-pie-total b{color:var(--ink)}
@media(max-width:600px){.size-pie-layout{gap:18px}.size-pie-svg{flex-basis:240px}.size-pie-legend{flex-basis:100%}}

/* Pedidos: navegación de páginas compacta, centrada y con números más accesibles. */
.orders-pagination{display:flex;flex-direction:column;align-items:center;gap:9px;padding:16px 12px 12px}
.orders-pagination-controls{display:flex;align-items:center;justify-content:center;gap:12px;flex-wrap:wrap}
.orders-pagination-pages{display:flex;align-items:center;justify-content:center;gap:7px;flex-wrap:wrap}
.orders-pagination-pages .btn{min-width:40px;height:40px;padding:8px 12px}
.orders-pagination-controls>.btn{min-height:40px;padding:8px 14px}
.orders-pagination-summary{font-size:12px;text-align:center}
@media(max-width:600px){.orders-pagination-controls{gap:7px}.orders-pagination-pages{gap:4px}.orders-pagination-pages .btn{min-width:34px;height:36px;padding:6px 9px}.orders-pagination-controls>.btn{min-height:36px;padding:6px 10px}}

/* Pedido: seguimiento guardado, sin caja adicional y alineado con el resumen. */
.order-tracking-summary{margin-top:20px}
.order-tracking-summary-heading{display:flex;align-items:center;gap:9px;margin-bottom:12px}
.order-tracking-summary-heading svg{width:18px;height:18px;flex:0 0 18px;color:var(--accent)}
.order-tracking-summary-list{display:grid;gap:14px}
.order-tracking-summary-item{display:grid;gap:6px;min-width:0}
.order-tracking-summary-item+.order-tracking-summary-item{padding-top:12px;border-top:1px solid var(--border-soft)}
.order-tracking-number{overflow-wrap:anywhere}
.order-tracking-summary .icon-btn{vertical-align:middle;width:29px;height:29px}
.order-tracking-summary .link-more{display:inline-flex;align-items:center;gap:5px}
.order-tracking-summary .link-more svg{width:14px;height:14px}

/* Historial de pedidos: registro de guía/paquetería sin confundirlo con un cambio de estado. */
.order-timeline-entry--shipping{--order-timeline-dot:var(--accent)}
.order-timeline-shipping{display:grid;gap:4px;font-size:12px;color:var(--ink-2);margin-top:6px;overflow-wrap:anywhere}
.order-timeline-shipping strong{color:var(--ink);font-weight:600}
.order-timeline-shipping .link-more{font-size:12px;justify-self:start;margin-top:3px}

/* Pedido: seguimiento plegado debajo del historial. */
.order-shipping-fold .order-tracking-summary{margin-top:0}
.order-shipping-fold .order-detail-fold-content{padding-top:12px}

/* Mantener todo el contenido del evento alineado con su marcador de la línea del tiempo. */
.order-timeline-entry{box-sizing:border-box}
.order-timeline-shipping{width:100%;min-width:0}
.order-timeline[data-timeline-count]:not([data-timeline-count="1"]):not([data-timeline-count="2"]) .order-timeline-entry:not(:first-child):not(:last-child) .order-timeline-shipping{justify-items:center;text-align:center}
.order-timeline[data-timeline-count]:not([data-timeline-count="1"]):not([data-timeline-count="2"]) .order-timeline-entry:not(:first-child):not(:last-child) .order-timeline-shipping .link-more{justify-self:center}
.order-timeline[data-timeline-count]:not([data-timeline-count="1"]):not([data-timeline-count="2"]) .order-timeline-entry:last-child .order-timeline-shipping{justify-items:end;text-align:right}
.order-timeline[data-timeline-count]:not([data-timeline-count="1"]):not([data-timeline-count="2"]) .order-timeline-entry:last-child .order-timeline-shipping .link-more{justify-self:end}
.order-timeline-entry .order-timeline-cause,.order-timeline-entry .order-timeline-date,.order-timeline-entry .order-timeline-actor{max-width:100%;overflow-wrap:anywhere}

/* Mantener el botón de copiar junto al número de rastreo, sin salto de línea. */
.order-tracking-copy{display:inline-flex;align-items:center;justify-content:flex-end;gap:7px;max-width:100%;vertical-align:middle}
.order-tracking-copy .order-tracking-number{min-width:0;overflow-wrap:anywhere}
.order-tracking-copy .icon-btn{display:inline-flex;align-items:center;justify-content:center;flex:0 0 29px;width:29px;height:29px;margin:0;padding:5px}
.order-tracking-copy .icon-btn svg{width:15px;height:15px;flex-shrink:0}

/* Pedidos: tres indicadores independientes, en orden estado / envío / respaldo. */
.order-triple-status{display:inline-flex;align-items:center;gap:7px;white-space:nowrap}
.order-triple-status .order-state-indicator,
.order-triple-status .order-paid-indicator,
.order-triple-status .order-shipping-indicator,
.order-triple-status .order-backup-indicator{display:inline-flex;align-items:center;justify-content:center;width:28px;height:28px;min-width:28px;box-sizing:border-box;border-radius:8px;padding:5px;border:1px solid transparent}
.order-triple-status svg{width:16px;height:16px;flex:none;stroke-width:1.8}
.order-triple-status .order-state-indicator.chip-ok{background:var(--ok-soft);color:var(--ok)}
.order-triple-status .order-state-indicator.chip-info{background:var(--info-soft);color:var(--info)}
.order-triple-status .order-state-indicator.chip-warn{background:var(--warn-soft);color:var(--warn)}
.order-triple-status .order-state-indicator.chip-accent{background:var(--accent-soft);color:var(--accent)}
.order-triple-status .order-state-indicator.chip-danger{background:var(--danger-soft);color:var(--danger)}
.order-triple-status .order-state-indicator.chip-neutral{background:var(--elevated);color:var(--ink-3)}
.order-triple-status .shipping-sent{color:var(--ok);background:var(--ok-soft);border-color:rgba(32,167,134,.16)}
.order-triple-status .shipping-tracked{color:var(--accent);background:var(--accent-soft)}
.order-triple-status .shipping-pending{color:var(--ink-3);background:var(--elevated)}
.order-triple-status .shipping-unknown{color:var(--warn);background:var(--warn-soft)}
.order-triple-status .order-backup-indicator .order-backup-label{display:none}
.order-triple-status .order-backup-indicator{margin:0}
.order-payment-badge{display:inline-flex;align-items:center;gap:7px;max-width:100%;padding:5px 9px;border-radius:8px;font-size:12px;line-height:1.35;font-weight:600}
.order-payment-badge svg{width:16px;height:16px;flex:0 0 16px;stroke-width:1.8}
.order-payment-badge span{overflow-wrap:anywhere}
.order-payment-badge.payment-card{color:#e0b25c;background:rgba(206,148,51,.13)}
.order-payment-badge.payment-transfer{color:#b49af5;background:rgba(154,116,224,.13)}
.order-payment-badge.payment-cash{color:#59c6a0;background:rgba(43,165,121,.13)}
.order-payment-badge.payment-wallet{color:#e0b25c;background:rgba(206,148,51,.13)}
.order-payment-badge.payment-mercadopago{color:#009ee3;background:rgba(0,158,227,.14)}
.order-payment-badge.payment-deposit{color:#e9a069;background:rgba(216,115,57,.13)}
.order-payment-badge.payment-other{color:var(--ink-2);background:var(--elevated)}

/* Pedidos: filtro Estado con el mismo patrón deslizante de Periodo. */
.orders-status-field{min-width:0;max-width:100%}
.orders-status-pills{display:flex;align-items:center;gap:5px;flex-wrap:nowrap;max-width:100%;min-width:0}
.orders-status-pills .btn{white-space:nowrap;padding:7px 10px;flex:0 0 auto}
.orders-status-toggle{display:inline-flex;align-items:center;justify-content:center;min-width:34px}
.orders-status-toggle svg{width:14px;height:14px;stroke-width:2;transform:rotate(90deg);transition:transform .18s ease}
.orders-status-toggle[aria-expanded="true"] svg{transform:rotate(-90deg)}
.orders-status-options{display:flex;align-items:center;gap:5px;flex:0 1 auto;flex-wrap:nowrap;min-width:0;max-width:0;opacity:0;transform:translateX(-14px);overflow:hidden;white-space:nowrap;pointer-events:none;visibility:hidden;transition:max-width .36s ease,opacity .25s ease,transform .36s ease,visibility 0s linear .36s}
.orders-status-options.is-expanded{max-width:min(420px,calc(100vw - 480px));opacity:1;transform:translateX(0);overflow-x:auto;overflow-y:hidden;pointer-events:auto;visibility:visible;transition:max-width .36s ease,opacity .25s ease,transform .36s ease,visibility 0s}
.orders-status-options .btn{flex:0 0 auto}
.orders-status-options::-webkit-scrollbar{height:4px}
.orders-status-options::-webkit-scrollbar-thumb{background:var(--border-strong);border-radius:6px}
@media(max-width:1100px){.orders-status-options.is-expanded{max-width:min(560px,calc(100vw - 190px))}}
@media(max-width:900px){.orders-status-field,.orders-status-pills{width:100%}.orders-status-options.is-expanded{max-width:calc(100% - 130px)}}
@media(prefers-reduced-motion:reduce){.orders-status-options,.orders-status-toggle svg{transition:none}}

/* Estado / Periodo: expansión en una sola fila sin recortar Completado. */
.orders-period-toggle svg,.orders-status-toggle svg{transform:rotate(0deg)}
.orders-period-toggle[aria-expanded="true"] svg,.orders-status-toggle[aria-expanded="true"] svg{transform:rotate(90deg)}
.orders-filter-row:has(.orders-status-options.is-expanded){flex-wrap:nowrap;overflow-x:auto;overflow-y:hidden;max-width:100%;scrollbar-width:thin;align-items:flex-end;padding-bottom:7px}
.orders-filter-row:has(.orders-status-options.is-expanded)>.orders-filter-field{flex:0 0 auto;width:auto;max-width:none}
.orders-filter-row:has(.orders-status-options.is-expanded) .orders-status-field,.orders-filter-row:has(.orders-status-options.is-expanded) .orders-status-pills{max-width:none;min-width:max-content}
.orders-status-options{flex:0 0 auto}
.orders-status-options.is-expanded{max-width:var(--orders-status-expanded-width,900px);overflow:visible;flex:0 0 auto}
.orders-filter-row:has(.orders-status-options.is-expanded) .orders-period-field{flex:0 0 auto;margin-left:4px}
@media(max-width:900px){
  .orders-filter-row:has(.orders-status-options.is-expanded){flex-direction:row;align-items:flex-end}
  .orders-filter-row:has(.orders-status-options.is-expanded)>.orders-filter-field{width:auto;flex:0 0 auto}
  .orders-status-options.is-expanded{max-width:var(--orders-status-expanded-width,900px)}
}
@media(prefers-reduced-motion:reduce){.orders-period-toggle svg,.orders-status-toggle svg{transition:none}}

/* Pedidos: listado sin tarjeta, a todo el ancho útil de la página. */
.orders-list-full{width:100%;min-width:0;background:transparent;border:0;border-radius:0;box-shadow:none;margin:0}
.orders-list-full>.orders-section-head{padding:12px 0 16px;min-width:0;align-items:flex-start}
.orders-list-full .orders-filters-wrap{flex:1 1 auto;min-width:0;max-width:100%}
.orders-list-full .orders-table{width:100%;margin-top:8px;min-width:0}
.orders-list-full .orders-table table{width:100%}
.orders-list-full>.orders-pagination{padding-left:0;padding-right:0}

/* Nunca se abren Estado y Periodo simultáneamente.
   La fila y sus controles permanecen dentro del ancho disponible. */
.orders-list-full .orders-filter-row,
.orders-list-full .orders-filter-row:has(.orders-status-options.is-expanded){
  width:100%;max-width:100%;min-width:0;
  display:flex;flex-direction:row;flex-wrap:wrap;align-items:flex-end;
  gap:12px;overflow:visible;padding-bottom:0;
}
.orders-list-full .orders-filter-row>.orders-filter-field,
.orders-list-full .orders-filter-row:has(.orders-status-options.is-expanded)>.orders-filter-field{
  flex:0 0 auto;width:auto;max-width:100%;min-width:0;
}
.orders-list-full .orders-status-field,
.orders-list-full .orders-filter-row:has(.orders-status-options.is-expanded) .orders-status-field{
  flex:1 1 260px;max-width:100%;min-width:0;width:auto;
}
.orders-list-full .orders-status-pills,
.orders-list-full .orders-filter-row:has(.orders-status-options.is-expanded) .orders-status-pills{
  max-width:100%;min-width:0;width:100%;display:flex;
}
.orders-list-full .orders-status-options,
.orders-list-full .orders-status-options.is-expanded{
  flex:0 1 auto;min-width:0;max-width:0;
}
.orders-list-full .orders-status-options.is-expanded{
  max-width:calc(100% - 120px);
  overflow-x:auto;overflow-y:hidden;
}
.orders-list-full .orders-period-field,
.orders-list-full .orders-filter-row:has(.orders-status-options.is-expanded) .orders-period-field{
  flex:0 1 auto;min-width:0;max-width:100%;width:auto;margin-left:0;
}
.orders-list-full .orders-period-pills{max-width:100%;width:auto;min-width:0}
.orders-list-full .orders-period-options.is-expanded{max-width:min(660px,calc(100% - 110px));overflow-x:auto}
@media(max-width:900px){
 .orders-list-full .orders-filter-row,
 .orders-list-full .orders-filter-row:has(.orders-status-options.is-expanded){flex-direction:column;align-items:stretch}
 .orders-list-full .orders-filter-row>.orders-filter-field,
 .orders-list-full .orders-filter-row:has(.orders-status-options.is-expanded)>.orders-filter-field{flex:0 0 auto;width:100%;max-width:100%}
 .orders-list-full .orders-status-field,
 .orders-list-full .orders-filter-row:has(.orders-status-options.is-expanded) .orders-status-field{flex:0 0 auto;width:100%;max-width:100%}
 .orders-list-full .orders-period-pills{width:100%}
 .orders-list-full .orders-status-options.is-expanded{max-width:calc(100% - 120px)}
}

/* Evitar el espacio vacío entre Estado y Periodo al expandir los botones. */
@media(min-width:901px){
  .orders-list-full .orders-status-field,
  .orders-list-full .orders-filter-row:has(.orders-status-options.is-expanded) .orders-status-field{
    flex:0 1 auto;
    width:max-content;
    max-width:100%;
    min-width:0;
  }
  .orders-list-full .orders-status-pills,
  .orders-list-full .orders-filter-row:has(.orders-status-options.is-expanded) .orders-status-pills{
    width:max-content;
    max-width:100%;
  }
  .orders-list-full .orders-filter-row,
  .orders-list-full .orders-filter-row:has(.orders-status-options.is-expanded){column-gap:12px}
}

/* Estado de pago confirmado por WooCommerce (independiente del método de pago). */
.order-triple-status .paid-confirmed{color:var(--ok);background:var(--ok-soft);border-color:color-mix(in srgb,var(--ok) 24%,transparent)}
.order-triple-status .paid-unconfirmed{color:var(--ink-3);background:var(--elevated)}

/* Pedidos: aprovechar el ancho real del área de contenido, sin límite de 1560px. */
#app.orders-workspace #view-pedidos.active > .page{
  width:100%;max-width:none;margin:0;box-sizing:border-box;
  padding-left:24px;padding-right:24px;
}
#app.orders-workspace #view-pedidos .orders-list-full,
#app.orders-workspace #view-pedidos .orders-table{width:100%;max-width:none;min-width:0}
@media(max-width:900px){
  #app.orders-workspace #view-pedidos.active > .page{padding-left:16px;padding-right:16px}
}
@media(max-width:640px){
  #app.orders-workspace #view-pedidos.active > .page{padding-left:14px;padding-right:14px}
}

/* Contador de correos sin leer en el menú lateral (independiente de alertas ERP). */
.nav-mail-badge{align-items:center;justify-content:center;white-space:nowrap}
/* En el menú recogido, mantener un indicador discreto sobre el icono de correo. */
@media(min-width:901px){
 .app.collapsed .nav-item[data-view="correo"] .nav-mail-badge:not([style*="display: none"]){
  display:inline-flex!important;position:absolute;top:3px;right:3px;
  min-width:8px;width:8px;height:8px;padding:0;font-size:0;border-radius:50%;background:var(--accent)
 }
}
@media(max-width:900px){
 .app:not(.nav-open) .nav-item[data-view="correo"] .nav-mail-badge:not([style*="display: none"]){
  display:inline-flex!important;position:absolute;top:3px;right:3px;
  min-width:8px;width:8px;height:8px;padding:0;font-size:0;border-radius:50%;background:var(--accent)
 }
}

/* Notificaciones de pagos: categorías separadas y periodos anidados. */
.notif-payment-category + .notif-payment-category{margin-top:10px}
.notif-payment-periods{padding-left:14px;border-left:2px solid var(--border-soft);margin-left:12px}
.notif-payment-periods .notif-sec{margin-top:5px}

/* Pedidos: Canal, Estado y Periodo permanecen en una misma fila.
   Las opciones se abren debajo como panel flotante sin recortes ni saltos de línea. */
#app.orders-workspace .orders-list-full .orders-filter-row,
#app.orders-workspace .orders-list-full .orders-filter-row:has(.orders-status-options.is-expanded){
  display:flex;
  flex-direction:row;
  flex-wrap:wrap;
  align-items:flex-end;
  column-gap:12px;
  row-gap:10px;
  width:100%;
  max-width:100%;
  position:relative;
  overflow:visible;
  padding-bottom:0;
}
#app.orders-workspace .orders-list-full .orders-filter-row>.orders-filter-field,
#app.orders-workspace .orders-list-full .orders-filter-row:has(.orders-status-options.is-expanded)>.orders-filter-field{
  flex:0 0 auto;
  width:auto;
  min-width:0;
  max-width:100%;
}
#app.orders-workspace .orders-list-full .orders-status-field,
#app.orders-workspace .orders-list-full .orders-filter-row:has(.orders-status-options.is-expanded) .orders-status-field,
#app.orders-workspace .orders-list-full .orders-period-field{
  flex:0 0 auto;
  width:auto;
  min-width:0;
  max-width:100%;
}
#app.orders-workspace .orders-list-full .orders-status-pills,
#app.orders-workspace .orders-list-full .orders-period-pills{
  display:flex;
  flex-wrap:nowrap;
  align-items:center;
  gap:5px;
  width:max-content;
  max-width:100%;
  min-width:0;
}
#app.orders-workspace .orders-list-full .orders-status-options,
#app.orders-workspace .orders-list-full .orders-period-options{
  position:absolute;
  top:calc(100% + 7px);
  left:0;
  z-index:90;
  box-sizing:border-box;
  flex:none;
  width:min(900px,100%);
  min-width:0;
  max-width:none;
  padding:10px;
  border:1px solid var(--border);
  border-radius:12px;
  background:var(--surface);
  box-shadow:var(--shadow-lg);
  display:none;
  opacity:0;
  visibility:hidden;
  transform:translateY(-6px);
}
#app.orders-workspace .orders-list-full .orders-status-options.is-expanded,
#app.orders-workspace .orders-list-full .orders-period-options.is-expanded{
  display:flex;
  flex-wrap:wrap;
  align-items:center;
  gap:7px;
  width:min(900px,100%);
  max-width:none;
  overflow:visible;
  opacity:1;
  visibility:visible;
  pointer-events:auto;
  transform:translateY(0);
  transition:opacity .18s ease,transform .18s ease;
}
#app.orders-workspace .orders-list-full .orders-status-options .btn,
#app.orders-workspace .orders-list-full .orders-period-options .btn{
  flex:0 0 auto;
  white-space:nowrap;
}
@media(max-width:640px){
  #app.orders-workspace .orders-list-full .orders-filter-row{
    justify-content:flex-start;
  }
  #app.orders-workspace .orders-list-full .orders-filter-row>.orders-filter-field:first-child{
    flex:0 1 100%;
  }
  #app.orders-workspace .orders-list-full .orders-filter-row>.orders-filter-field:first-child .select{
    max-width:100%;
  }
}

/* Selector del estado del pedido: menú compacto junto a Envío en el pie del detalle. */
.order-status-menu{position:relative;flex:0 0 auto;width:150px;min-width:0}
.order-status-menu>summary{list-style:none;display:flex;align-items:center;justify-content:center;gap:8px;min-height:40px;width:100%;cursor:pointer}
.order-status-menu>summary::-webkit-details-marker{display:none}
.order-status-menu>summary svg{width:16px;height:16px;flex:none}
.order-status-menu>summary svg:last-child{width:14px;height:14px;transition:transform .15s}
.order-status-menu[open]>summary svg:last-child{transform:rotate(180deg)}
.order-status-options{position:absolute;right:0;bottom:calc(100% + 12px);z-index:41;display:flex;flex-direction:column;gap:10px;width:min(300px,calc(100vw - 48px));max-width:calc(100vw - 48px);padding:14px;border:1px solid var(--border-soft);border-radius:10px;background:var(--surface);box-shadow:0 12px 34px rgba(0,0,0,.23)}
.order-status-options label{font-size:12px;font-weight:600;color:var(--ink-2)}
.order-status-options .select{width:100%;min-width:0}
.order-status-options .btn{width:100%;justify-content:center}
@media(max-width:480px){.order-status-menu{width:150px}}

/* Reportes > Existencias: secciones plegables sin cajas exteriores. */
.rep-inv-controls{margin-bottom:18px;padding:0;min-width:0}
.rep-inv-sections{display:grid;gap:8px;margin-top:8px}
.rep-inv-section{border:0;background:transparent;border-radius:0;min-width:0}
.rep-inv-section>summary{display:flex;align-items:center;gap:10px;list-style:none;cursor:pointer;padding:12px 0;border-bottom:1px solid var(--border-soft);font-size:16px;font-weight:650;color:var(--ink)}
.rep-inv-section>summary::-webkit-details-marker{display:none}
.rep-inv-section>summary svg{margin-left:auto;width:16px;height:16px;transition:transform .2s ease}
.rep-inv-section[open]>summary svg{transform:rotate(90deg)}
.rep-inv-section-count{font-size:11px;color:var(--ink-3);font-weight:500}
.rep-inv-section-body{padding:10px 0 18px}
.rep-inv-section-actions{display:flex;justify-content:flex-end;min-height:25px;margin-bottom:8px}
.rep-inv-section .table-wrap{border-radius:0}
