/* ============================================================
   Dashboard de Ventas — sistema de diseño
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

:root {
  /* superficies (tono frío neutro) */
  --bg:        oklch(0.975 0.006 280);
  --surface:   #ffffff;
  --surface-2: oklch(0.985 0.006 280);
  --border:    oklch(0.922 0.008 280);
  --border-2:  oklch(0.945 0.006 280);

  /* texto */
  --ink:    oklch(0.24 0.03 280);
  --ink-2:  oklch(0.46 0.03 280);
  --ink-3:  oklch(0.62 0.025 280);

  /* acento principal + variantes */
  --accent:      oklch(0.55 0.21 285);
  --accent-600:  oklch(0.49 0.21 285);
  --accent-50:   oklch(0.96 0.035 285);
  --accent-100:  oklch(0.93 0.06 285);
  --accent-ink:  #ffffff;

  /* paleta de gráficas (misma L/croma, hue variable) */
  --c-violet: oklch(0.62 0.18 285);
  --c-blue:   oklch(0.64 0.16 248);
  --c-teal:   oklch(0.70 0.13 195);
  --c-green:  oklch(0.72 0.15 152);
  --c-amber:  oklch(0.78 0.15 75);
  --c-pink:   oklch(0.68 0.18 350);

  /* semánticos */
  --pos:  oklch(0.62 0.16 152);
  --pos-bg: oklch(0.95 0.05 152);
  --neg:  oklch(0.60 0.20 25);
  --neg-bg: oklch(0.95 0.05 25);

  /* sombras suaves */
  --sh-sm: 0 1px 2px rgba(30,27,60,.05), 0 1px 3px rgba(30,27,60,.04);
  --sh-md: 0 4px 14px -6px rgba(40,30,90,.12), 0 2px 6px -2px rgba(40,30,90,.06);
  --sh-lg: 0 18px 40px -18px rgba(60,40,120,.28);

  /* forma */
  --r-card: 18px;
  --r-ctrl: 11px;
  --r-pill: 999px;

  /* densidad (7/10) */
  --pad: 18px;
  --gap: 16px;

  --sidebar-w: 244px;
  --topbar-h: 66px;

  font-synthesis-weight: none;
}

* { box-sizing: border-box; }
html { height: 100%; overflow: hidden; }
body { margin: 0; height: 100%; overflow-y: auto; overflow-x: hidden; }
body {
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
.tnum { font-variant-numeric: tabular-nums; }
button { font-family: inherit; cursor: pointer; }
::selection { background: var(--accent-100); }

/* scrollbar */
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: oklch(0.88 0.01 280); border-radius: 99px; border: 3px solid var(--bg); }
*::-webkit-scrollbar-thumb:hover { background: oklch(0.82 0.015 280); }

/* ============================================================
   APP SHELL
   ============================================================ */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
  transition: grid-template-columns .28s cubic-bezier(.4,0,.2,1);
}
.app.collapsed { grid-template-columns: 76px 1fr; }

/* ---------- Sidebar ---------- */
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 16px 14px;
  gap: 4px;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.sidebar::-webkit-scrollbar { width: 7px; }
.sidebar::-webkit-scrollbar-thumb { background: var(--border); border-radius: 99px; }
.sidebar::-webkit-scrollbar-thumb:hover { background: var(--border-2, #cbd5e1); }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 6px 8px 18px;
  white-space: nowrap;
}
.brand-mark {
  width: 34px; height: 34px;
  border-radius: 10px;
  flex: 0 0 auto;
  background: linear-gradient(135deg, var(--accent), var(--c-pink));
  display: grid; place-items: center;
  color: #fff; font-weight: 800; font-size: 17px;
  box-shadow: var(--sh-md);
}
.brand-name { font-weight: 800; font-size: 16.5px; letter-spacing: -.02em; }
.brand-name small { display: block; font-weight: 500; font-size: 11px; color: var(--ink-3); letter-spacing: 0; }
.collapsed .brand-name, .collapsed .nav-label, .collapsed .nav-group-label, .collapsed .side-card { display: none; }

.nav-group-label {
  font-size: 10.5px; font-weight: 700; letter-spacing: .09em;
  text-transform: uppercase; color: var(--ink-3);
  padding: 14px 10px 6px;
}
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 11px;
  border-radius: var(--r-ctrl);
  color: var(--ink-2);
  font-weight: 600; font-size: 13.5px;
  border: none; background: none; width: 100%;
  text-align: left;
  position: relative;
  transition: background .15s, color .15s;
}
.nav-item svg { width: 19px; height: 19px; flex: 0 0 auto; stroke-width: 2; }
.nav-item:hover { background: var(--surface-2); color: var(--ink); }
.nav-item.active { background: var(--accent-50); color: var(--accent-600); }
.nav-item.active::before {
  content: ''; position: absolute; left: -14px; top: 50%; transform: translateY(-50%);
  width: 4px; height: 22px; border-radius: 0 4px 4px 0; background: var(--accent);
}
.nav-item .badge {
  margin-left: auto; font-size: 11px; font-weight: 700;
  background: var(--accent); color: #fff; padding: 1px 7px; border-radius: 99px;
}
.collapsed .nav-item { justify-content: center; }
.collapsed .nav-item .badge { display: none; }

.side-card {
  margin-top: auto;
  flex: 0 0 auto;
  background: linear-gradient(160deg, var(--accent), var(--accent-600));
  border-radius: 16px;
  padding: 16px;
  color: #fff;
  position: relative; overflow: hidden;
}
.side-card::after {
  content: ''; position: absolute; right: -30px; top: -30px;
  width: 110px; height: 110px; border-radius: 50%;
  background: rgba(255,255,255,.13);
}
.side-card h4 { margin: 0 0 4px; font-size: 14px; }
.side-card p { margin: 0 0 12px; font-size: 12px; opacity: .85; line-height: 1.4; }
.side-card button {
  background: #fff; color: var(--accent-600); border: none;
  padding: 8px 14px; border-radius: 9px; font-weight: 700; font-size: 12.5px;
}

/* ---------- tarjeta de novedades dinámicas ---------- */
.news-card { padding: 14px 15px 13px; }
.news-eyebrow {
  display: flex; align-items: center; gap: 7px;
  font-size: 10px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase;
  opacity: .9; margin-bottom: 11px; position: relative; z-index: 1;
}
.news-pulse {
  width: 7px; height: 7px; border-radius: 50%; background: #fff;
  box-shadow: 0 0 0 0 rgba(255,255,255,.7); animation: newsPulse 2.2s infinite;
}
@keyframes newsPulse {
  0% { box-shadow: 0 0 0 0 rgba(255,255,255,.55); }
  70% { box-shadow: 0 0 0 7px rgba(255,255,255,0); }
  100% { box-shadow: 0 0 0 0 rgba(255,255,255,0); }
}
.news-stack { position: relative; min-height: 96px; z-index: 1; }
.news-item {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  text-decoration: none; color: #fff;
  opacity: 0; transform: translateY(6px); pointer-events: none;
  transition: opacity .4s ease, transform .4s ease;
}
.news-item.on { opacity: 1; transform: none; pointer-events: auto; }
.news-delta {
  align-self: flex-start; display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; font-weight: 800; font-variant-numeric: tabular-nums;
  padding: 2px 8px; border-radius: 99px; margin-bottom: 8px;
  background: rgba(255,255,255,.18); color: #fff;
}
.news-delta.up { background: rgba(214, 255, 224, .92); color: oklch(0.42 0.13 150); }
.news-delta.down { background: rgba(255, 224, 224, .92); color: oklch(0.46 0.16 22); }
.news-item h4 { margin: 0 0 3px; font-size: 14px; line-height: 1.25; letter-spacing: -.01em; }
.news-item p { margin: 0; font-size: 11.5px; opacity: .9; line-height: 1.4; font-variant-numeric: tabular-nums; }
.news-cta {
  margin-top: auto; padding-top: 9px; font-size: 11.5px; font-weight: 800;
  opacity: .96; transition: gap .15s;
}
.news-item:hover .news-cta { text-decoration: underline; }
.news-dots { display: flex; gap: 5px; margin-top: 11px; position: relative; z-index: 1; }
.news-dot {
  width: 6px; height: 6px; border-radius: 99px; border: none; padding: 0;
  background: rgba(255,255,255,.4); transition: width .25s, background .25s;
}
.news-dot.on { width: 16px; background: #fff; }

/* ---------- Main ---------- */
.main { min-width: 0; display: flex; flex-direction: column; }

.topbar {
  height: var(--topbar-h);
  position: sticky; top: 0; z-index: 30;
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 14px;
  padding: 0 24px;
}
.icon-btn {
  width: 38px; height: 38px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--surface);
  display: grid; place-items: center; color: var(--ink-2);
  position: relative; transition: .15s;
}
.icon-btn:hover { color: var(--ink); border-color: oklch(0.86 0.01 280); box-shadow: var(--sh-sm); }
.icon-btn svg { width: 18px; height: 18px; stroke-width: 2; }
.icon-btn .dot {
  position: absolute; top: 8px; right: 9px; width: 7px; height: 7px;
  background: var(--c-pink); border-radius: 50%; border: 1.5px solid var(--surface);
}

/* Botón "Descargar app" (PWA) en el topbar, junto a la campana */
.pwa-btn {
  display: inline-flex; align-items: center; gap: 7px;
  height: 38px; padding: 0 13px; border-radius: var(--r-pill, 999px);
  border: 1px solid transparent; background: var(--accent); color: #fff;
  font: inherit; font-size: 13px; font-weight: 600; cursor: pointer;
  white-space: nowrap; transition: .15s; box-shadow: var(--sh-sm);
}
.pwa-btn:hover { filter: brightness(1.06); box-shadow: var(--sh); }
.pwa-btn svg { width: 17px; height: 17px; stroke-width: 2; }
@media (max-width: 720px) {
  .pwa-btn .pwa-btn-l { display: none; }   /* en móvil queda solo el ícono */
  .pwa-btn { padding: 0; width: 38px; justify-content: center; border-radius: 10px; }
}

/* Mini-instructivo de instalación (iOS / navegadores sin instalación automática) */
.pwa-help-bg {
  position: fixed; inset: 0; z-index: 1000; display: none;
  align-items: center; justify-content: center; padding: 20px;
  background: color-mix(in srgb, #0b1020 55%, transparent); backdrop-filter: blur(3px);
}
.pwa-help-bg.open { display: flex; }
.pwa-help {
  width: 100%; max-width: 380px; background: var(--surface);
  border: 1px solid var(--border); border-radius: 16px; padding: 18px 20px;
  box-shadow: var(--sh-lg, 0 20px 50px rgba(0,0,0,.25));
}
.pwa-help-head { display: flex; align-items: center; justify-content: space-between; font-size: 16px; color: var(--ink); }
.pwa-help-x { border: none; background: none; font-size: 24px; line-height: 1; color: var(--ink-3); cursor: pointer; }
.pwa-help-sub { color: var(--ink-2); font-size: 13px; margin: 8px 0 12px; }
.pwa-help-steps { margin: 0; padding-left: 20px; color: var(--ink); font-size: 14px; }
.pwa-help-steps li { margin-bottom: 9px; line-height: 1.45; }

.searchbar {
  flex: 1; max-width: 420px;
  display: flex; align-items: center; gap: 9px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-ctrl); padding: 0 13px; height: 40px;
  color: var(--ink-3); transition: .15s;
}
.searchbar:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-50); }
.searchbar svg { width: 17px; height: 17px; flex: 0 0 auto; }
.searchbar input { border: none; outline: none; background: none; font: inherit; color: var(--ink); width: 100%; }
.searchbar kbd {
  font-family: inherit; font-size: 11px; color: var(--ink-3);
  border: 1px solid var(--border); border-radius: 5px; padding: 1px 6px; background: var(--surface-2);
}
.spacer { flex: 1; }

.profile {
  display: flex; align-items: center; gap: 10px;
  padding: 4px 4px 4px 6px; border-radius: var(--r-pill);
  border: 1px solid var(--border); background: var(--surface);
  transition: .15s;
}
.profile:hover { box-shadow: var(--sh-sm); }
.avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: linear-gradient(135deg, var(--c-teal), var(--c-blue));
  display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 13px;
}
.profile-meta { line-height: 1.15; text-align: left; }
.profile-meta b { font-size: 13px; font-weight: 700; }
.profile-meta span { font-size: 11px; color: var(--ink-3); display: block; }

/* ---------- Content ---------- */
.content { padding: 24px; display: flex; flex-direction: column; gap: var(--gap); }

.page-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  flex-wrap: wrap; gap: 14px;
}
.page-head h1 { margin: 0; font-size: 23px; font-weight: 800; letter-spacing: -.025em; }
.page-head .sub { margin: 3px 0 0; color: var(--ink-3); font-size: 13px; }

.head-actions { display: flex; align-items: center; gap: 10px; }

/* segmented period control */
.segment {
  display: inline-flex; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-ctrl); padding: 3px; gap: 2px; box-shadow: var(--sh-sm);
}
.segment button {
  border: none; background: none; padding: 7px 13px; border-radius: 8px;
  font-weight: 600; font-size: 12.5px; color: var(--ink-2); transition: .15s;
  white-space: nowrap;
}
.segment button:hover { color: var(--ink); }
.segment button.active { background: var(--accent); color: #fff; box-shadow: var(--sh-sm); }

.btn {
  display: inline-flex; align-items: center; gap: 7px;
  border: 1px solid var(--border); background: var(--surface);
  padding: 9px 14px; border-radius: var(--r-ctrl); font-weight: 600; font-size: 13px;
  color: var(--ink); transition: .15s; box-shadow: var(--sh-sm);
}
.btn:hover { box-shadow: var(--sh-md); }
.btn svg { width: 16px; height: 16px; stroke-width: 2; }
.btn.primary { background: var(--accent); color: #fff; border-color: transparent; }
.btn.primary:hover { background: var(--accent-600); }

/* ============================================================
   CARDS / GRID
   ============================================================ */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  box-shadow: var(--sh-sm);
}
.card-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: var(--pad) var(--pad) 0;
}
.card-head h3 { margin: 0; font-size: 15px; font-weight: 700; letter-spacing: -.01em; }
.card-head .ch-sub { font-size: 12px; color: var(--ink-3); margin: 2px 0 0; }

.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--gap); }

.grid-main { display: grid; grid-template-columns: 1.62fr 1fr; gap: var(--gap); }
.grid-3 { display: grid; grid-template-columns: 1.2fr 1fr 1fr; gap: var(--gap); }

@media (max-width: 1180px) {
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .grid-main, .grid-3 { grid-template-columns: 1fr; }
}

/* ---------- KPI card ---------- */
.kpi { padding: var(--pad); position: relative; overflow: hidden; display: flex; flex-direction: column; }
.kpi-top { display: flex; align-items: center; gap: 11px; }
.kpi-ico {
  width: 40px; height: 40px; border-radius: 12px; flex: 0 0 auto;
  display: grid; place-items: center;
}
.kpi-ico svg { width: 20px; height: 20px; stroke-width: 2; }
.kpi-label { font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.kpi-value { font-size: 27px; font-weight: 800; letter-spacing: -.03em; margin: 14px 0 8px; }
.kpi-foot { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.delta { display: inline-flex; align-items: center; gap: 3px; font-weight: 700; padding: 2px 7px; border-radius: 99px; }
.delta svg { width: 12px; height: 12px; stroke-width: 2.5; }
.delta.up { color: var(--pos); background: var(--pos-bg); }
.delta.down { color: var(--neg); background: var(--neg-bg); }
.kpi-foot .vs { color: var(--ink-3); }
.kpi-spark { margin: 14px -18px -18px; width: calc(100% + 36px); height: 42px; opacity: .9; pointer-events: none; }
.kpi-spark svg { display: block; }

/* ---------- Chart card ---------- */
.tabs { display: inline-flex; gap: 4px; }
.tab {
  border: none; background: none; padding: 6px 12px; border-radius: 8px;
  font-weight: 600; font-size: 12.5px; color: var(--ink-2); transition: .15s;
}
.tab:hover { background: var(--surface-2); color: var(--ink); }
.tab.active { background: var(--accent-50); color: var(--accent-600); }

.legend { display: flex; gap: 16px; padding: 4px var(--pad) 0; flex-wrap: wrap; }
.legend span { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; color: var(--ink-2); font-weight: 600; }
.legend i { width: 9px; height: 9px; border-radius: 3px; display: inline-block; }

.chart-wrap { padding: 8px var(--pad) var(--pad); position: relative; }
.chart-wrap svg { display: block; width: 100%; height: auto; overflow: visible; }

.tooltip {
  position: absolute; pointer-events: none; z-index: 5;
  background: var(--ink); color: #fff; border-radius: 10px; padding: 9px 12px;
  font-size: 12px; box-shadow: var(--sh-lg);
  transform: translate(-50%, -118%); white-space: nowrap; opacity: 0; transition: opacity .12s;
}
.tooltip b { font-size: 13.5px; }
.tooltip .tt-row { display: flex; align-items: center; gap: 7px; margin-top: 4px; }
.tooltip .tt-row i { width: 8px; height: 8px; border-radius: 2px; }
.tooltip .tt-lbl { opacity: .7; margin-bottom: 4px; font-weight: 600; }

/* ---------- Donut / products ---------- */
.donut-row { display: flex; align-items: center; gap: 18px; padding: 6px var(--pad) var(--pad); }
.donut-center text { font-weight: 800; }
.donut-legend { flex: 1; display: flex; flex-direction: column; gap: 11px; min-width: 0; }
.donut-legend .dl {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 9px;
  font-size: 12.5px;
}
.donut-legend i { width: 10px; height: 10px; border-radius: 3px; }
.donut-legend .dl-name { font-weight: 600; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.donut-legend .dl-val { font-weight: 700; color: var(--ink-2); font-variant-numeric: tabular-nums; }

/* ---------- Funnel ---------- */
.funnel { padding: 10px var(--pad) var(--pad); display: flex; flex-direction: column; gap: 11px; }
.fn-row { }
.fn-meta { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 5px; }
.fn-name { font-weight: 600; font-size: 12.5px; }
.fn-vals { font-size: 12px; color: var(--ink-3); }
.fn-vals b { color: var(--ink); font-size: 13px; }
.fn-bar { height: 13px; border-radius: 7px; background: var(--surface-2); overflow: hidden; }
.fn-fill { height: 100%; border-radius: 7px; transition: width .6s cubic-bezier(.4,0,.2,1); }
.fn-drop { font-size: 11px; color: var(--neg); font-weight: 600; }

/* ---------- Goals ---------- */
.goals { padding: 8px var(--pad) var(--pad); display: flex; flex-direction: column; gap: 16px; }
.goal { display: flex; align-items: center; gap: 14px; }
.ring { flex: 0 0 auto; }
.goal-meta { min-width: 0; }
.goal-meta .g-name { font-weight: 600; font-size: 13px; }
.goal-meta .g-sub { font-size: 11.5px; color: var(--ink-3); margin-top: 1px; }
.goal-meta .g-val { font-weight: 800; font-size: 16px; letter-spacing: -.02em; margin-top: 3px; }

/* ---------- Orders table ---------- */
.orders { padding-bottom: 4px; }
.table-toolbar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: var(--pad) var(--pad) 14px;
}
.chips { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.chip {
  border: 1px solid var(--border); background: var(--surface); color: var(--ink-2);
  padding: 6px 12px; border-radius: 99px; font-size: 12.5px; font-weight: 600; transition: .15s;
}
.chip:hover { border-color: oklch(0.84 0.02 280); color: var(--ink); }
.chip.active { background: var(--ink); color: #fff; border-color: var(--ink); }
.mini-search {
  margin-left: auto; display: flex; align-items: center; gap: 8px;
  border: 1px solid var(--border); border-radius: var(--r-ctrl); padding: 0 11px; height: 38px;
  background: var(--surface); color: var(--ink-3); transition: .15s; min-width: 210px;
}
.mini-search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-50); }
.mini-search svg { width: 16px; height: 16px; }
.mini-search input { border: none; outline: none; background: none; font: inherit; color: var(--ink); width: 100%; }

table { width: 100%; border-collapse: collapse; }
thead th {
  text-align: left; font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
  color: var(--ink-3); padding: 9px var(--pad); border-bottom: 1px solid var(--border);
  cursor: pointer; user-select: none; white-space: nowrap;
}
thead th:hover { color: var(--ink-2); }
thead th .sort-ico { opacity: .4; margin-left: 3px; }
thead th.num, td.num { text-align: right; }
tbody td { padding: 13px var(--pad); border-bottom: 1px solid var(--border-2); font-size: 13px; vertical-align: middle; }
tbody tr { transition: background .12s; }
tbody tr:hover { background: var(--surface-2); }
tbody tr:last-child td { border-bottom: none; }
.cust { display: flex; align-items: center; gap: 10px; }
.cust .av { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 12px; flex: 0 0 auto; }
.cust .c-name { font-weight: 600; }
.cust .c-mail { font-size: 11.5px; color: var(--ink-3); }
.oid { font-weight: 600; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.amount { font-weight: 700; font-variant-numeric: tabular-nums; }

.status { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 99px; }
.status::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status.completado { color: var(--pos); background: var(--pos-bg); }
.status.entregado  { color: var(--c-teal); background: oklch(0.95 0.04 195); }
.status.enviado    { color: var(--c-blue); background: oklch(0.95 0.04 248); }
.status.procesando { color: var(--c-violet); background: var(--accent-50); }
.status.pendiente  { color: var(--c-amber); background: oklch(0.95 0.05 75); }
.status.cancelado  { color: var(--neg); background: var(--neg-bg); }

.table-foot { display: flex; align-items: center; justify-content: space-between; padding: 13px var(--pad); flex-wrap: wrap; gap: 10px; }
.table-foot .info { font-size: 12.5px; color: var(--ink-3); }
.pager { display: inline-flex; gap: 5px; }
.pager button {
  min-width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface); color: var(--ink-2); font-weight: 600; font-size: 12.5px; padding: 0 6px;
}
.pager button:hover { color: var(--ink); border-color: oklch(0.84 0.02 280); }
.pager button.active { background: var(--accent); color: #fff; border-color: transparent; }
.pager button:disabled { opacity: .4; cursor: default; }

.empty { padding: 40px; text-align: center; color: var(--ink-3); font-size: 13.5px; }

/* count-up flash */
@keyframes pop { 0%{ transform: translateY(3px); opacity:.5 } 100%{ transform:none; opacity:1 } }
.flash { animation: pop .35s ease; }

/* notifications dropdown */
.dropdown {
  position: absolute; top: calc(var(--topbar-h) - 10px); right: 24px; z-index: 40;
  width: 320px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 16px; box-shadow: var(--sh-lg); overflow: hidden;
  opacity: 0; transform: translateY(-8px) scale(.98); pointer-events: none; transition: .16s;
}
.dropdown.open { opacity: 1; transform: none; pointer-events: auto; }
.dd-head { padding: 14px 16px; border-bottom: 1px solid var(--border); font-weight: 700; display: flex; justify-content: space-between; align-items: center; }
.dd-head span { font-size: 11px; color: var(--accent-600); font-weight: 700; }
.dd-item { display: flex; gap: 11px; padding: 12px 16px; border-bottom: 1px solid var(--border-2); }
.dd-item:last-child { border: none; }
.dd-item:hover { background: var(--surface-2); }
.dd-ico { width: 34px; height: 34px; border-radius: 10px; flex: 0 0 auto; display: grid; place-items: center; }
.dd-ico svg { width: 16px; height: 16px; }
.dd-item p { margin: 0; font-size: 12.5px; line-height: 1.35; }
.dd-item p b { font-weight: 700; }
.dd-item .t { font-size: 11px; color: var(--ink-3); margin-top: 2px; }

/* toast */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--ink); color: #fff; padding: 11px 18px; border-radius: 12px;
  font-size: 13px; font-weight: 600; box-shadow: var(--sh-lg); z-index: 100;
  opacity: 0; transition: .25s; pointer-events: none;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ============================================================
   TASAS DE CAMBIO — colores por moneda
   ============================================================ */
:root {
  --rate-green:    oklch(0.55 0.14 152);
  --rate-green-bg: oklch(0.945 0.055 152);
  --rate-green-ink:oklch(0.40 0.11 152);

  --rate-brown:    oklch(0.50 0.075 55);
  --rate-brown-bg: oklch(0.93 0.04 62);
  --rate-brown-ink:oklch(0.40 0.07 52);

  --rate-gold:     oklch(0.60 0.13 85);
  --rate-gold-bg:  oklch(0.82 0.135 88);
  --rate-gold-ink: oklch(0.34 0.06 80);
}
.tone-green { --tone: var(--rate-green); --tone-bg: var(--rate-green-bg); --tone-ink: var(--rate-green-ink); }
.tone-brown { --tone: var(--rate-brown); --tone-bg: var(--rate-brown-bg); --tone-ink: var(--rate-brown-ink); }
.tone-gold  { --tone: var(--rate-gold);  --tone-bg: var(--rate-gold-bg);  --tone-ink: var(--rate-gold-ink); }

/* ---------- cuadritos del dashboard (pegados a la derecha) ---------- */
.rate-row { display: flex; justify-content: flex-end; align-items: stretch; gap: 12px; flex-wrap: wrap; }
.rate-mini {
  min-width: 174px; border-radius: 14px; padding: 11px 14px 12px;
  background: var(--tone-bg); color: var(--tone-ink); box-shadow: var(--sh-sm);
  border: 1px solid color-mix(in srgb, var(--tone) 18%, transparent);
  display: flex; flex-direction: column; gap: 7px;
}
.rate-mini .rm-name { font-size: 11.5px; font-weight: 700; letter-spacing: .01em; display: flex; align-items: center; gap: 6px; }
.rate-mini .rm-name b { width: 16px; height: 16px; border-radius: 5px; background: var(--tone); color: #fff; display: grid; place-items: center; font-size: 10px; font-weight: 800; }
.rate-mini .rm-row { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.rate-mini .rm-val { font-size: 18px; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.rate-mini .rm-trend { font-size: 11.5px; font-weight: 700; white-space: nowrap; display: inline-flex; align-items: center; gap: 2px; padding: 1px 6px; border-radius: 99px; background: color-mix(in srgb, var(--tone) 16%, transparent); }
.rate-mini .rm-trend.down { color: var(--neg); background: color-mix(in srgb, var(--neg) 12%, transparent); }

/* ---------- página: tarjetas grandes ---------- */
.rate-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--gap); }
.rate-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-card);
  box-shadow: var(--sh-sm); padding: var(--pad); position: relative; overflow: hidden;
  display: flex; flex-direction: column; border-top: 3px solid var(--tone);
}
.rc-head { display: flex; align-items: center; gap: 11px; }
.rc-ico { width: 40px; height: 40px; border-radius: 12px; flex: 0 0 auto; display: grid; place-items: center;
  background: var(--tone-bg); color: var(--tone); font-weight: 800; font-size: 18px; }
.rc-name { font-weight: 700; font-size: 15px; letter-spacing: -.01em; }
.rc-src { font-size: 11px; color: var(--ink-3); margin-top: 1px; }
.rc-trend { margin-left: auto; font-size: 12.5px; font-weight: 700; display: inline-flex; align-items: center; gap: 3px; padding: 3px 9px; border-radius: 99px; color: var(--pos); background: var(--pos-bg); }
.rc-trend.down { color: var(--neg); background: var(--neg-bg); }
.rc-value { font-size: 32px; font-weight: 800; letter-spacing: -.03em; margin: 16px 0 4px; font-variant-numeric: tabular-nums; display: flex; align-items: baseline; gap: 7px; }
.rc-value .rc-cur { font-size: 16px; font-weight: 700; color: var(--ink-3); }
.rc-value .editable { cursor: text; border-bottom: 2px dashed transparent; padding-bottom: 1px; transition: .15s; }
.rc-value .editable:hover { border-bottom-color: color-mix(in srgb, var(--tone) 55%, transparent); }
.rc-value input {
  font: inherit; font-size: 32px; font-weight: 800; letter-spacing: -.03em; color: var(--ink);
  border: none; outline: none; background: var(--tone-bg); border-radius: 8px; padding: 0 8px;
  width: 5.2ch; font-variant-numeric: tabular-nums;
}
.rc-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--ink-3); margin-bottom: 4px; }
.rc-foot .rc-edit { border: 1px solid var(--border); background: var(--surface); color: var(--tone); font-weight: 700; font-size: 11.5px; padding: 5px 10px; border-radius: 8px; display: inline-flex; align-items: center; gap: 5px; }
.rc-foot .rc-edit:hover { border-color: var(--tone); }
.rc-foot .rc-edit svg { width: 13px; height: 13px; stroke-width: 2.2; }
.rc-spark { margin: 12px -18px -18px; height: 48px; }
.rc-spark svg { display: block; }
.rc-saved { color: var(--pos); font-weight: 700; }

/* ---------- página: resumen mensual (3 gráficas) ---------- */
.overview { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--gap); }
.ov-card { display: flex; flex-direction: column; }
.ov-head { display: flex; align-items: center; gap: 10px; padding: var(--pad) var(--pad) 0; }
.ov-dot { width: 11px; height: 11px; border-radius: 4px; background: var(--tone); flex: 0 0 auto; }
.ov-head h3 { margin: 0; font-size: 14.5px; font-weight: 700; }
.ov-head .ov-cur { margin-left: auto; text-align: right; }
.ov-head .ov-cur b { font-size: 16px; font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ov-head .ov-cur span { display: block; font-size: 11px; font-weight: 700; }
.ov-head .ov-cur span.up { color: var(--pos); }
.ov-head .ov-cur span.down { color: var(--neg); }
.ov-chart { padding: 6px 8px 4px; position: relative; }
.ov-stats { display: flex; justify-content: space-around; gap: 8px; padding: 10px var(--pad) var(--pad); border-top: 1px solid var(--border-2); margin-top: 4px; }
.ov-stat { text-align: center; }
.ov-stat .s-l { font-size: 10.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--ink-3); }
.ov-stat .s-v { font-size: 14px; font-weight: 800; font-variant-numeric: tabular-nums; margin-top: 2px; }

@media (max-width: 1180px) {
  .rate-cards, .overview { grid-template-columns: 1fr; }
  .rate-row { justify-content: stretch; }
  .rate-mini { flex: 1; }
}

/* ============================================================
   PRODUCTOS
   ============================================================ */
.prod-toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: var(--pad); }
.prod-toolbar .grow { flex: 1; }
.select {
  appearance: none; border: 1px solid var(--border); background: var(--surface);
  border-radius: var(--r-ctrl); padding: 9px 32px 9px 13px; font: inherit; font-size: 13px; font-weight: 600;
  color: var(--ink); cursor: pointer; box-shadow: var(--sh-sm);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' fill='none' stroke='%237a7790' stroke-width='2' viewBox='0 0 24 24'%3E%3Cpath d='M6 9l6 6 6-6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 11px center;
}
.select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-50); }

/* thumbnail */
.p-thumb {
  width: 46px; height: 46px; border-radius: 11px; flex: 0 0 auto; overflow: hidden;
  display: grid; place-items: center; position: relative;
  border: 1px solid var(--border-2);
}
.p-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.p-thumb .ph { width: 100%; height: 100%; display: grid; place-items: center; }
.p-thumb .ph svg { width: 22px; height: 22px; stroke-width: 1.8; opacity: .9; }

.prod { display: flex; align-items: center; gap: 12px; }
.prod .p-name { font-weight: 700; }
.prod .p-usd { font-size: 11.5px; color: var(--ink-3); margin-top: 1px; font-variant-numeric: tabular-nums; }

.cat-pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 99px; }
.cat-pill i { width: 8px; height: 8px; border-radius: 3px; }

.stock-tag { font-weight: 700; font-variant-numeric: tabular-nums; display: inline-flex; align-items: center; gap: 6px; }
.stock-tag .sdot { width: 7px; height: 7px; border-radius: 50%; }
.stock-tag.ok    { color: var(--pos); }
.stock-tag.low   { color: var(--c-amber); }
.stock-tag.out   { color: var(--neg); }

.gain { font-weight: 700; color: var(--pos); background: var(--pos-bg); padding: 3px 9px; border-radius: 99px; font-size: 12.5px; font-variant-numeric: tabular-nums; }

.price-cell { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.price-cell .pc-cur { font-size: 11px; color: var(--ink-3); font-weight: 600; }
.price-bcv { color: var(--rate-green); }
.price-euro { color: var(--rate-brown); }
.price-binance { color: var(--rate-gold-ink); }
.price-usd { color: var(--ink); }
.price-eurp { color: var(--rate-brown); }
.price-usd::before { content: ''; }

/* menú mostrar/ocultar columnas */
.col-menu { position: relative; }
.col-btn { display: inline-flex; align-items: center; gap: 7px; padding-right: 13px; cursor: pointer; background-image: none; }
.col-pop {
  position: absolute; top: calc(100% + 6px); right: 0; z-index: 40;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: var(--sh-lg, 0 12px 30px rgba(15,23,42,.16)); padding: 6px; min-width: 200px;
  display: none; flex-direction: column; gap: 1px;
}
.col-menu.open .col-pop { display: flex; }
.col-opt {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px;
  font-size: 13px; font-weight: 600; color: var(--ink); cursor: pointer; user-select: none;
}
.col-opt:hover { background: var(--surface-2); }
.col-opt input { position: absolute; opacity: 0; width: 0; height: 0; }
.col-check {
  width: 17px; height: 17px; border-radius: 5px; border: 1.5px solid var(--border-2, #cbd5e1);
  flex: 0 0 auto; position: relative; transition: .14s; background: var(--surface);
}
.col-opt input:checked + .col-check { background: var(--accent); border-color: var(--accent); }
.col-check::after {
  content: ''; position: absolute; left: 5px; top: 1.5px; width: 4px; height: 8px;
  border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg) scale(0); transition: .14s;
}
.col-opt input:checked + .col-check::after { transform: rotate(45deg) scale(1); }
.col-actions { border-top: 1px solid var(--border-2); margin-top: 4px; padding-top: 4px; }
.col-actions button {
  width: 100%; text-align: left; border: none; background: none; padding: 8px 10px; border-radius: 8px;
  font: inherit; font-size: 12.5px; font-weight: 700; color: var(--accent-600, var(--accent)); cursor: pointer;
}
.col-actions button:hover { background: var(--accent-50); }

.row-actions { display: inline-flex; gap: 6px; }
.act-btn {
  width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface); display: grid; place-items: center; color: var(--ink-2); transition: .15s;
}
.act-btn svg { width: 15px; height: 15px; stroke-width: 2; }
.act-btn.edit:hover { color: var(--accent-600); border-color: var(--accent); background: var(--accent-50); }
.act-btn.del:hover { color: var(--neg); border-color: var(--neg); background: var(--neg-bg); }

/* info button + popover en encabezados */
th .th-wrap { display: inline-flex; align-items: center; gap: 5px; }
.info-btn {
  width: 16px; height: 16px; border-radius: 50%; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--ink-3); font-size: 10px; font-weight: 800;
  display: inline-grid; place-items: center; cursor: help; flex: 0 0 auto; transition: .15s; line-height: 1;
}
.info-btn:hover, .info-btn.open { background: var(--accent); color: #fff; border-color: var(--accent); }
.info-pop {
  position: fixed; z-index: 60; max-width: 250px;
  background: var(--ink); color: #fff; border-radius: 11px; padding: 11px 13px;
  font-size: 12px; font-weight: 500; line-height: 1.5; text-transform: none; letter-spacing: 0;
  box-shadow: var(--sh-lg); opacity: 0; transform: translateY(4px); pointer-events: none; transition: .14s;
}
.info-pop.show { opacity: 1; transform: none; }
.info-pop b { color: #fff; font-weight: 800; display: block; margin-bottom: 3px; font-size: 12.5px; }
.info-pop::after { content: ''; position: absolute; top: -5px; left: var(--ax, 20px); width: 10px; height: 10px; background: var(--ink); transform: rotate(45deg); }

/* ============================================================
   MODAL
   ============================================================ */
.modal-bg {
  position: fixed; inset: 0; z-index: 80; background: rgba(30,24,60,.42);
  backdrop-filter: blur(3px); display: grid; place-items: center; padding: 24px;
  opacity: 0; pointer-events: none; transition: opacity .2s; overflow-y: auto;
}
.modal-bg.open { opacity: 1; pointer-events: auto; }
.modal {
  width: 560px; max-width: calc(100vw - 48px); max-height: 90vh; overflow-y: auto;
  background: var(--surface); border-radius: 20px; box-shadow: var(--sh-lg);
  transform: translateY(12px) scale(.98); transition: transform .2s, opacity .2s;
}
.modal-bg.open .modal { transform: none; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 20px 22px 0; }
.modal-head h2 { margin: 0; font-size: 18px; font-weight: 800; letter-spacing: -.02em; }
.modal-head .x { width: 34px; height: 34px; border-radius: 9px; border: 1px solid var(--border); background: var(--surface); display: grid; place-items: center; color: var(--ink-2); }
.modal-head .x:hover { color: var(--ink); box-shadow: var(--sh-sm); }
.modal-body { padding: 18px 22px; display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field.full { grid-column: 1 / -1; }
.field label { font-size: 12px; font-weight: 700; color: var(--ink-2); }
.field input, .field select {
  border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; font: inherit; font-size: 13.5px;
  color: var(--ink); background: var(--surface); transition: .15s;
}
.field input:focus, .field select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-50); }
.field .hint { font-size: 11px; color: var(--ink-3); }
.price-preview { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 2px; }
.pp { border-radius: 12px; padding: 11px 13px; }
.pp .pp-l { font-size: 11px; font-weight: 700; opacity: .85; }
.pp .pp-v { font-size: 16px; font-weight: 800; font-variant-numeric: tabular-nums; margin-top: 3px; white-space: nowrap; }
.pp.bcv { background: var(--rate-green-bg); color: var(--rate-green-ink); }
.pp.euro { background: var(--rate-brown-bg); color: var(--rate-brown-ink); }
.pp.binance { background: var(--rate-gold-bg); color: var(--rate-gold-ink); }
.modal-foot { display: flex; align-items: center; justify-content: flex-end; gap: 10px; padding: 6px 22px 22px; }
.modal-foot .btn.danger { color: var(--neg); border-color: color-mix(in srgb, var(--neg) 40%, var(--border)); margin-right: auto; }
.modal-foot .btn.danger:hover { background: var(--neg-bg); }

/* confirm */
.confirm { width: 400px; text-align: center; padding: 26px 24px 22px; }
.confirm .c-ico { width: 52px; height: 52px; border-radius: 50%; background: var(--neg-bg); color: var(--neg); display: grid; place-items: center; margin: 0 auto 14px; }
.confirm .c-ico svg { width: 26px; height: 26px; stroke-width: 2; }
.confirm h2 { margin: 0 0 6px; font-size: 18px; font-weight: 800; }
.confirm p { margin: 0 0 20px; color: var(--ink-2); font-size: 13.5px; }
.confirm .row { display: flex; gap: 10px; justify-content: center; }

.muted-row { opacity: .55; }

/* ---------- submenú lateral ---------- */
.nav-parent { display: flex; flex-direction: column; }
.nav-item.has-sub .chev { margin-left: auto; width: 16px; height: 16px; stroke-width: 2.4; transition: transform .26s cubic-bezier(.4,0,.2,1); opacity: .7; }
.nav-parent.open .nav-item.has-sub .chev { transform: rotate(180deg); }
.submenu {
  display: flex; flex-direction: column; gap: 1px;
  max-height: 0; overflow: hidden; transition: max-height .28s cubic-bezier(.4,0,.2,1);
  margin: 1px 0 0 18px; padding-left: 12px; position: relative;
}
.submenu::before { content: ''; position: absolute; left: 0; top: 4px; bottom: 8px; width: 1.5px; background: var(--border); border-radius: 2px; }
.nav-parent.open .submenu { max-height: 220px; }
.sub-item {
  text-align: left; border: none; background: none; width: 100%;
  padding: 8px 10px; border-radius: 9px; font-weight: 600; font-size: 12.5px;
  color: var(--ink-2); transition: .15s; position: relative;
}
.sub-item:hover { background: var(--surface-2); color: var(--ink); }
.sub-item.active { color: var(--accent-600); background: var(--accent-50); }
.sub-item.active::before { content: ''; position: absolute; left: -12.5px; top: 50%; transform: translateY(-50%); width: 1.5px; height: 18px; background: var(--accent); border-radius: 2px; }
.collapsed .submenu, .collapsed .nav-item.has-sub .chev { display: none; }

/* ---------- vista categorías ---------- */
.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(252px, 1fr)); gap: var(--gap); }
.cat-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-card);
  box-shadow: var(--sh-sm); padding: 18px; display: flex; flex-direction: column; gap: 15px;
  border-top: 3px solid var(--cc); transition: .15s;
}
.cat-card:hover { box-shadow: var(--sh-md); transform: translateY(-2px); }
.cc-top { display: flex; align-items: center; gap: 12px; }
.cc-ico { width: 44px; height: 44px; border-radius: 13px; flex: 0 0 auto; display: grid; place-items: center; background: color-mix(in srgb, var(--cc) 14%, #fff); }
.cc-ico svg { width: 23px; height: 23px; stroke-width: 1.9; }
.cc-name { font-weight: 700; font-size: 15.5px; letter-spacing: -.01em; }
.cc-count { font-size: 12px; color: var(--ink-3); margin-top: 1px; }
.cc-stats { display: flex; gap: 22px; }
.cc-stat .l { font-size: 10.5px; color: var(--ink-3); font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.cc-stat .v { font-weight: 800; font-size: 15px; letter-spacing: -.02em; margin-top: 2px; font-variant-numeric: tabular-nums; }
.cc-actions { display: flex; gap: 8px; margin-top: auto; }
.cc-actions .btn { flex: 1; justify-content: center; padding: 8px; font-size: 12.5px; }

/* ---------- selector de color ---------- */
.color-opts { display: flex; gap: 10px; flex-wrap: wrap; }
.color-opts .co { width: 36px; height: 36px; border-radius: 11px; cursor: pointer; border: 2px solid transparent; position: relative; transition: .12s; }
.color-opts .co:hover { transform: scale(1.08); }
.color-opts .co.sel { border-color: var(--surface); box-shadow: 0 0 0 2.5px var(--ink); }
.color-opts .co.sel::after { content: '✓'; position: absolute; inset: 0; display: grid; place-items: center; color: #fff; font-weight: 900; font-size: 15px; }

.prov-name { font-weight: 700; }
.prov-mail { font-size: 12.5px; color: var(--ink-2); }
.count-pill { font-weight: 700; font-variant-numeric: tabular-nums; background: var(--accent-50); color: var(--accent-600); padding: 3px 10px; border-radius: 99px; font-size: 12.5px; }

/* ---------- formularios ampliados ---------- */
.field textarea {
  border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; font: inherit; font-size: 13.5px;
  color: var(--ink); background: var(--surface); resize: vertical; transition: .15s; line-height: 1.5;
}
.field textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-50); }

.img-uploader { display: flex; gap: 14px; align-items: flex-start; }
.img-prev {
  width: 76px; height: 76px; border-radius: 13px; flex: 0 0 auto; overflow: hidden;
  background: var(--surface-2); border: 1px dashed var(--border); background-size: cover; background-position: center;
  display: grid; place-items: center; color: var(--ink-3);
}
.img-prev.round { border-radius: 50%; }
.img-prev .ph-ico { width: 26px; height: 26px; opacity: .5; }
.img-ctrls { flex: 1; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.img-btns { display: flex; gap: 8px; }
.img-ctrls .btn { padding: 8px 12px; font-size: 12.5px; }
.img-ctrls input { border: 1px solid var(--border); border-radius: 10px; padding: 9px 12px; font: inherit; font-size: 12.5px; color: var(--ink); background: var(--surface); }
.img-ctrls input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-50); }

.dyn-list { display: flex; flex-direction: column; gap: 8px; }
.dyn-row { display: flex; gap: 8px; align-items: center; }
.dyn-row input { flex: 1; border: 1px solid var(--border); border-radius: 10px; padding: 9px 12px; font: inherit; font-size: 13px; color: var(--ink); background: var(--surface); }
.dyn-row input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-50); }
.dyn-row .rm {
  width: 36px; height: 36px; flex: 0 0 auto; border-radius: 9px; border: 1px solid var(--border);
  background: var(--surface); color: var(--ink-3); display: grid; place-items: center;
}
.dyn-row .rm:hover { color: var(--neg); border-color: var(--neg); background: var(--neg-bg); }
.dyn-row .rm svg { width: 15px; height: 15px; stroke-width: 2; }
.btn-add {
  align-self: flex-start; border: 1px dashed var(--border); background: var(--surface-2);
  color: var(--accent-600); font-weight: 700; font-size: 12.5px; padding: 8px 13px; border-radius: 10px;
}
.btn-add:hover { border-color: var(--accent); background: var(--accent-50); }

.check-list { display: flex; flex-wrap: wrap; gap: 7px; }
.check-chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 11px; border-radius: 99px;
  border: 1px solid var(--border); background: var(--surface); font-size: 12.5px; font-weight: 600; color: var(--ink-2); cursor: pointer; transition: .14s;
}
.check-chip:hover { border-color: oklch(0.84 0.02 280); color: var(--ink); }
.check-chip.on { background: var(--accent); color: #fff; border-color: var(--accent); }
.check-chip.dis { opacity: .4; pointer-events: none; }
.check-list .none { font-size: 12.5px; color: var(--ink-3); }

/* ---------- tarjeta de categoría: imagen + jerarquía ---------- */
.cat-card .cc-thumb { width: 44px; height: 44px; border-radius: 13px; flex: 0 0 auto; object-fit: cover; }
.cc-parent { font-size: 11px; font-weight: 700; color: var(--ink-3); display: inline-flex; align-items: center; gap: 4px; margin-bottom: 8px; }
.cc-parent svg { width: 12px; height: 12px; }
.cc-desc { font-size: 12.5px; color: var(--ink-2); line-height: 1.5; margin-top: -4px; }
.cc-children { display: flex; flex-wrap: wrap; gap: 6px; }
.cc-children .subchip { font-size: 11px; font-weight: 600; padding: 3px 9px; border-radius: 99px; background: color-mix(in srgb, var(--cc) 13%, #fff); color: var(--cc); }
.cc-childlabel { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-3); margin-bottom: 5px; }

/* ---------- tarjetas de proveedor ---------- */
.sup-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: var(--gap); }
.sup-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-card);
  box-shadow: var(--sh-sm); padding: 18px; display: flex; flex-direction: column; gap: 13px; transition: .15s;
}
.sup-card:hover { box-shadow: var(--sh-md); transform: translateY(-2px); }
.sup-top { display: flex; align-items: center; gap: 13px; }
.sup-photo { width: 50px; height: 50px; border-radius: 50%; flex: 0 0 auto; object-fit: cover; display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 17px; background: linear-gradient(135deg, var(--c-teal), var(--c-blue)); }
.sup-name { font-weight: 700; font-size: 15.5px; letter-spacing: -.01em; }
.sup-count { font-size: 12px; color: var(--ink-3); margin-top: 1px; }
.sup-meta { display: flex; flex-direction: column; gap: 8px; }
.sup-line { display: flex; align-items: flex-start; gap: 9px; font-size: 12.5px; color: var(--ink-2); }
.sup-line svg { width: 15px; height: 15px; flex: 0 0 auto; stroke-width: 2; color: var(--ink-3); margin-top: 1px; }
.sup-line a { color: var(--accent-600); text-decoration: none; font-weight: 600; word-break: break-all; }
.sup-line a:hover { text-decoration: underline; }
.sup-line .multi { display: flex; flex-direction: column; gap: 2px; }
.sup-socials { display: flex; gap: 7px; flex-wrap: wrap; }
.sup-socials a {
  width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center;
  background: var(--surface-2); border: 1px solid var(--border-2); color: var(--ink-2); transition: .14s;
}
.sup-socials a:hover { color: var(--accent-600); border-color: var(--accent); background: var(--accent-50); }
.sup-socials a svg { width: 16px; height: 16px; }
.sup-foot { display: flex; gap: 8px; margin-top: auto; padding-top: 4px; border-top: 1px solid var(--border-2); }
.sup-foot .stat { flex: 1; }
.sup-foot .stat .l { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-3); }
.sup-foot .stat .v { font-weight: 800; font-size: 14px; font-variant-numeric: tabular-nums; margin-top: 1px; }
.sup-actions { display: flex; gap: 7px; }

/* ============================================================
   CLIENTES
   ============================================================ */
.cli-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: var(--gap); }
.cli-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-card);
  box-shadow: var(--sh-sm); padding: 18px; display: flex; flex-direction: column; gap: 14px; transition: .15s;
  cursor: pointer; position: relative;
}
.cli-card:hover { box-shadow: var(--sh-md); transform: translateY(-2px); }
.cli-top { display: flex; align-items: center; gap: 13px; }
.cli-photo {
  width: 52px; height: 52px; border-radius: 50%; flex: 0 0 auto; object-fit: cover;
  display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 18px; background: var(--avc, var(--c-blue));
}
.cli-name { font-weight: 700; font-size: 15.5px; letter-spacing: -.01em; }
.cli-sub { font-size: 12px; color: var(--ink-3); margin-top: 1px; }
.cli-tags { display: flex; gap: 6px; margin-left: auto; flex-direction: column; align-items: flex-end; }
.cli-meta { display: flex; gap: 8px; }
.cli-stat { flex: 1; background: var(--surface-2); border-radius: 11px; padding: 9px 11px; }
.cli-stat .l { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-3); }
.cli-stat .v { font-weight: 800; font-size: 15px; letter-spacing: -.02em; margin-top: 1px; font-variant-numeric: tabular-nums; }

.cli-contact { display: flex; flex-direction: column; gap: 6px; }
.cli-line { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--ink-2); }
.cli-line svg { width: 14px; height: 14px; stroke-width: 2; color: var(--ink-3); flex: 0 0 auto; }

/* tarjeta de crédito dentro del cliente */
.credit-box {
  border-radius: 14px; padding: 13px 14px; display: flex; flex-direction: column; gap: 10px;
  border: 1px solid var(--cb-bd); background: var(--cb-bg);
}
.credit-box.active  { --cb-bg: oklch(0.96 0.03 248); --cb-bd: oklch(0.86 0.06 248); --cb-ink: var(--c-blue); }
.credit-box.soon    { --cb-bg: oklch(0.96 0.05 75);  --cb-bd: oklch(0.85 0.09 75);  --cb-ink: oklch(0.50 0.12 70); }
.credit-box.overdue { --cb-bg: var(--neg-bg);          --cb-bd: oklch(0.85 0.08 25);  --cb-ink: var(--neg); }
.cb-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.cb-title { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: var(--cb-ink); display: flex; align-items: center; gap: 6px; }
.cb-title svg { width: 14px; height: 14px; stroke-width: 2.2; }
.cb-badge { font-size: 11px; font-weight: 800; padding: 3px 9px; border-radius: 99px; background: var(--cb-ink); color: #fff; white-space: nowrap; }
.cb-amounts { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.cb-bal { font-size: 21px; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; color: var(--ink); }
.cb-bal small { font-size: 12px; font-weight: 600; color: var(--ink-3); }
.cb-of { font-size: 12px; color: var(--ink-3); font-variant-numeric: tabular-nums; text-align: right; }
.cb-progress { height: 7px; border-radius: 5px; background: color-mix(in srgb, var(--cb-ink) 18%, #fff); overflow: hidden; }
.cb-fill { height: 100%; border-radius: 5px; background: var(--cb-ink); transition: width .6s cubic-bezier(.4,0,.2,1); }
.cb-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.cb-time { font-size: 12px; font-weight: 700; color: var(--cb-ink); display: flex; align-items: center; gap: 5px; }
.cb-time svg { width: 13px; height: 13px; stroke-width: 2.2; }
.cb-due { font-size: 11px; color: var(--ink-3); }

.cli-paid-tag { font-size: 11px; font-weight: 700; color: var(--pos); background: var(--pos-bg); padding: 4px 11px; border-radius: 99px; display: inline-flex; align-items: center; gap: 5px; align-self: flex-start; }
.cli-cash-tag { font-size: 11px; font-weight: 700; color: var(--ink-3); background: var(--surface-2); padding: 4px 11px; border-radius: 99px; align-self: flex-start; }

/* badges de estado de crédito (esquina) */
.chip-credit { font-size: 10.5px; font-weight: 800; padding: 3px 8px; border-radius: 99px; white-space: nowrap; }
.chip-credit.overdue { color: var(--neg); background: var(--neg-bg); }
.chip-credit.soon { color: oklch(0.50 0.12 70); background: oklch(0.95 0.06 75); }
.chip-credit.active { color: var(--c-blue); background: oklch(0.95 0.04 248); }

/* ---------- KPIs clientes ---------- */
.cli-kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--gap); }
@media (max-width: 1180px) { .cli-kpis { grid-template-columns: repeat(2, 1fr); } }

/* ---------- modal detalle de cliente ---------- */
.cli-detail { width: 600px; }
.cd-hero { display: flex; align-items: center; gap: 15px; padding: 4px 0 16px; }
.cd-photo { width: 64px; height: 64px; border-radius: 50%; flex: 0 0 auto; display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 23px; background: var(--avc, var(--c-blue)); object-fit: cover; }
.cd-name { font-size: 19px; font-weight: 800; letter-spacing: -.02em; }
.cd-sub { font-size: 12.5px; color: var(--ink-3); margin-top: 2px; }
.cd-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 18px; }
.cd-info { display: flex; align-items: center; gap: 9px; font-size: 13px; color: var(--ink-2); background: var(--surface-2); border-radius: 10px; padding: 10px 12px; }
.cd-info svg { width: 15px; height: 15px; stroke-width: 2; color: var(--ink-3); flex: 0 0 auto; }
.cd-section-t { font-size: 13px; font-weight: 800; letter-spacing: -.01em; margin: 4px 0 10px; display: flex; align-items: center; justify-content: space-between; }
.cd-section-t .btn { padding: 6px 11px; font-size: 12px; }

.credit-item { border: 1px solid var(--border); border-radius: 13px; padding: 13px 14px; margin-bottom: 10px; }
.ci-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 9px; }
.ci-concept { font-weight: 700; font-size: 14px; }
.ci-date { font-size: 11.5px; color: var(--ink-3); margin-top: 1px; }
.ci-amounts { display: flex; gap: 18px; margin-bottom: 9px; }
.ci-amt .l { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-3); }
.ci-amt .v { font-weight: 800; font-size: 15px; font-variant-numeric: tabular-nums; margin-top: 1px; }
.ci-amt .v.bal { color: var(--neg); }
.ci-amt .v.paidv { color: var(--pos); }
.ci-bar { height: 7px; border-radius: 5px; background: var(--surface-2); overflow: hidden; margin-bottom: 9px; }
.ci-bar i { display: block; height: 100%; border-radius: 5px; background: var(--pos); }
.ci-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.ci-status { font-size: 11.5px; font-weight: 700; display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 99px; }
.ci-status.overdue { color: var(--neg); background: var(--neg-bg); }
.ci-status.soon { color: oklch(0.50 0.12 70); background: oklch(0.95 0.06 75); }
.ci-status.active { color: var(--c-blue); background: oklch(0.95 0.04 248); }
.ci-status.paid { color: var(--pos); background: var(--pos-bg); }
.ci-actions { display: flex; gap: 7px; }
.ci-actions .btn { padding: 6px 11px; font-size: 12px; }
.ci-pays { margin-top: 9px; border-top: 1px dashed var(--border); padding-top: 9px; display: flex; flex-direction: column; gap: 5px; }
.ci-pay { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--ink-3); }
.ci-pay b { color: var(--pos); font-variant-numeric: tabular-nums; }

.pay-input { display: flex; gap: 8px; margin-top: 9px; }
.pay-input input { flex: 1; border: 1px solid var(--border); border-radius: 10px; padding: 8px 11px; font: inherit; font-size: 13px; }
.pay-input input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-50); }

.cd-empty { text-align: center; color: var(--ink-3); font-size: 13px; padding: 22px; background: var(--surface-2); border-radius: 13px; }

/* tabs dentro de la ficha */
.cd-tabs { display: flex; gap: 4px; background: var(--surface-2); padding: 4px; border-radius: 12px; margin-bottom: 16px; }
.cd-tab {
  flex: 1; border: none; background: none; padding: 9px 12px; border-radius: 9px;
  font-weight: 700; font-size: 13px; color: var(--ink-2); transition: .15s; display: inline-flex; align-items: center; justify-content: center; gap: 7px;
}
.cd-tab:hover { color: var(--ink); }
.cd-tab.active { background: var(--surface); color: var(--accent-600); box-shadow: var(--sh-sm); }
.cd-tab-badge { font-size: 11px; font-weight: 800; padding: 1px 7px; border-radius: 99px; background: var(--neg); color: #fff; }
.cd-tab-badge.alt { background: var(--accent); }

/* historial de compras */
.pu-list { display: flex; flex-direction: column; }
.pu-row { display: flex; align-items: center; gap: 12px; padding: 11px 4px; border-bottom: 1px solid var(--border-2); }
.pu-row:last-child { border-bottom: none; }
.pu-ico { width: 36px; height: 36px; border-radius: 10px; flex: 0 0 auto; display: grid; place-items: center; background: var(--accent-50); color: var(--accent-600); }
.pu-ico.credit { background: oklch(0.95 0.04 248); color: var(--c-blue); }
.pu-ico svg { width: 18px; height: 18px; stroke-width: 2; }
.pu-credit { font-weight: 800; color: var(--c-blue); }

/* ============================================================
   PEDIDOS
   ============================================================ */
.ord-status { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; padding: 4px 11px; border-radius: 99px; white-space: nowrap; }
.ord-status::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.ord-status.pendiente  { color: oklch(0.50 0.12 70); background: oklch(0.95 0.06 75); }
.ord-status.procesando { color: var(--c-violet); background: var(--accent-50); }
.ord-status.enviado    { color: var(--c-blue); background: oklch(0.95 0.04 248); }
.ord-status.entregado  { color: var(--c-teal); background: oklch(0.95 0.04 195); }
.ord-status.completado { color: var(--pos); background: var(--pos-bg); }
.ord-status.cancelado  { color: var(--neg); background: var(--neg-bg); }

.ord-items-cell { display: flex; align-items: center; gap: 8px; }
.ord-thumbs { display: flex; }
.ord-thumbs .t { width: 30px; height: 30px; border-radius: 8px; border: 2px solid var(--surface); margin-left: -8px; background: var(--surface-2); overflow: hidden; display: grid; place-items: center; }
.ord-thumbs .t:first-child { margin-left: 0; }
.ord-thumbs .t img { width: 100%; height: 100%; object-fit: cover; }
.ord-thumbs .t.more { background: var(--accent-50); color: var(--accent-600); font-size: 11px; font-weight: 800; }
.ord-thumbs .t svg { width: 15px; height: 15px; stroke-width: 1.8; }
.ord-items-txt { font-size: 12px; color: var(--ink-3); }

.method-tag { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.method-tag svg { width: 15px; height: 15px; stroke-width: 2; color: var(--ink-3); }
.method-tag.credito { color: var(--c-blue); }
.method-tag.credito svg { color: var(--c-blue); }

.view-btn {
  display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--border); background: var(--surface);
  color: var(--accent-600); font-weight: 700; font-size: 12.5px; padding: 7px 12px; border-radius: 9px; transition: .15s;
}
.view-btn:hover { border-color: var(--accent); background: var(--accent-50); }
.view-btn svg { width: 15px; height: 15px; stroke-width: 2; }

/* ---------- modal detalle de pedido ---------- */
.ord-detail { width: 680px; }
.od-head { display: flex; align-items: flex-start; gap: 14px; padding-bottom: 16px; border-bottom: 1px solid var(--border); margin-bottom: 16px; }
.od-id { font-size: 19px; font-weight: 800; letter-spacing: -.02em; }
.od-date { font-size: 12.5px; color: var(--ink-3); margin-top: 2px; }
.od-head .od-right { margin-left: auto; text-align: right; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; }

.od-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 18px; }
.od-panel { background: var(--surface-2); border-radius: 13px; padding: 13px 15px; }
.od-panel .pl { font-size: 10.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-3); margin-bottom: 8px; }
.od-cust { display: flex; align-items: center; gap: 10px; }
.od-av { width: 38px; height: 38px; border-radius: 50%; flex: 0 0 auto; display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 14px; background: var(--avc, var(--c-blue)); }
.od-cust .cn { font-weight: 700; font-size: 13.5px; }
.od-cust .ce { font-size: 11.5px; color: var(--ink-3); }
.od-line { display: flex; align-items: flex-start; gap: 8px; font-size: 12.5px; color: var(--ink-2); margin-top: 7px; }
.od-line svg { width: 14px; height: 14px; stroke-width: 2; color: var(--ink-3); flex: 0 0 auto; margin-top: 1px; }

.od-section-t { font-size: 13px; font-weight: 800; margin: 4px 0 10px; }
.od-items { border: 1px solid var(--border); border-radius: 13px; overflow: hidden; }
.od-item { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-bottom: 1px solid var(--border-2); }
.od-item:last-child { border-bottom: none; }
.od-item .oi-img { width: 42px; height: 42px; border-radius: 10px; flex: 0 0 auto; overflow: hidden; background: var(--surface-2); display: grid; place-items: center; }
.od-item .oi-img img { width: 100%; height: 100%; object-fit: cover; }
.od-item .oi-img svg { width: 19px; height: 19px; opacity: .6; }
.oi-main { flex: 1; min-width: 0; }
.oi-name { font-weight: 700; font-size: 13.5px; }
.oi-cat { font-size: 11.5px; color: var(--ink-3); }
.oi-qty { font-size: 12.5px; color: var(--ink-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.oi-sub { font-weight: 800; font-variant-numeric: tabular-nums; font-size: 13.5px; white-space: nowrap; text-align: right; min-width: 90px; }

.od-totals { margin-top: 14px; display: flex; flex-direction: column; gap: 7px; max-width: 280px; margin-left: auto; }
.od-tr { display: flex; justify-content: space-between; font-size: 13px; color: var(--ink-2); }
.od-tr.grand { border-top: 1px solid var(--border); padding-top: 9px; margin-top: 3px; font-size: 17px; font-weight: 800; color: var(--ink); }
.od-tr .v { font-variant-numeric: tabular-nums; font-weight: 700; }
.od-tr .v.bs { color: var(--ink-3); font-size: 12px; font-weight: 600; }
.od-tr.disc .v { color: var(--pos); }

/* timeline de estado */
.od-timeline { display: flex; align-items: center; margin: 6px 0 4px; }
.od-step { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; position: relative; }
.od-step:not(:last-child)::after { content: ''; position: absolute; top: 13px; left: 50%; width: 100%; height: 2px; background: var(--border); z-index: 0; }
.od-step.done:not(:last-child)::after { background: var(--pos); }
.od-dot { width: 27px; height: 27px; border-radius: 50%; background: var(--surface); border: 2px solid var(--border); display: grid; place-items: center; z-index: 1; color: var(--ink-3); }
.od-dot svg { width: 14px; height: 14px; stroke-width: 2.4; }
.od-step.done .od-dot { background: var(--pos); border-color: var(--pos); color: #fff; }
.od-step.current .od-dot { border-color: var(--accent); color: var(--accent); box-shadow: 0 0 0 4px var(--accent-50); }
.od-step .sl { font-size: 10.5px; font-weight: 700; color: var(--ink-3); }
.od-step.done .sl, .od-step.current .sl { color: var(--ink); }
.od-cancelled-banner { background: var(--neg-bg); color: var(--neg); font-weight: 700; font-size: 13px; padding: 12px; border-radius: 12px; text-align: center; display: flex; align-items: center; justify-content: center; gap: 8px; }
.od-cancelled-banner svg { width: 17px; height: 17px; stroke-width: 2; }

.status-select { position: relative; }
.od-note { font-size: 12.5px; color: var(--ink-2); background: oklch(0.96 0.05 75); border-radius: 10px; padding: 10px 13px; margin-top: 12px; display: flex; gap: 8px; align-items: flex-start; }
.od-note svg { width: 15px; height: 15px; stroke-width: 2; color: var(--c-amber); flex: 0 0 auto; margin-top: 1px; }

/* editor de líneas de pedido (nuevo) */
.ord-lines { display: flex; flex-direction: column; gap: 8px; }
.ord-line-row { display: flex; gap: 8px; align-items: center; }
.ord-line-row .ol-prod { flex: 1; min-width: 0; }
.ord-line-row select, .ord-line-row input {
  border: 1px solid var(--border); border-radius: 10px; padding: 9px 11px; font: inherit; font-size: 13px;
  color: var(--ink); background: var(--surface); width: 100%;
}
.ord-line-row select:focus, .ord-line-row input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-50); }
.ord-line-row .ol-qty { width: 64px; flex: 0 0 auto; text-align: center; }
.ord-line-row .ol-sub { width: 92px; flex: 0 0 auto; text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; font-size: 13px; color: var(--ink-2); }
.ord-line-row .rm { width: 34px; height: 34px; flex: 0 0 auto; border-radius: 9px; border: 1px solid var(--border); background: var(--surface); color: var(--ink-3); display: grid; place-items: center; }
.ord-line-row .rm:hover { color: var(--neg); border-color: var(--neg); background: var(--neg-bg); }
.ord-line-row .rm svg { width: 15px; height: 15px; stroke-width: 2; }

.new-totals { background: var(--surface-2); border-radius: 12px; padding: 13px 15px; display: flex; flex-direction: column; gap: 6px; }
.new-totals .nt-row { display: flex; justify-content: space-between; font-size: 13px; color: var(--ink-2); }
.new-totals .nt-row.grand { border-top: 1px solid var(--border); padding-top: 8px; margin-top: 2px; font-size: 16px; font-weight: 800; color: var(--ink); }
.new-totals .nt-row .v { font-variant-numeric: tabular-nums; font-weight: 700; }
.new-totals .nt-row .v.bs { color: var(--ink-3); font-weight: 600; font-size: 12px; }

/* campos de crédito en nuevo pedido */
.credit-fields { background: oklch(0.96 0.03 248); border: 1px solid oklch(0.86 0.06 248); border-radius: 13px; padding: 14px; }
.credit-fields .cf-head { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 13px; color: var(--c-blue); margin-bottom: 12px; }
.credit-fields .cf-head svg { width: 17px; height: 17px; }
.credit-fields .cf-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.credit-fields .field label { color: var(--ink-2); }
.credit-fields .cf-note { font-size: 12.5px; color: var(--ink-2); margin-top: 11px; }
.credit-fields .cf-note b { color: var(--c-blue); }

/* ============================================================
   NUEVO PEDIDO (página)
   ============================================================ */
.np-grid { display: grid; grid-template-columns: 1fr 350px; gap: var(--gap); align-items: start; }
@media (max-width: 1080px) { .np-grid { grid-template-columns: 1fr; } }

.np-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-card); box-shadow: var(--sh-sm); padding: var(--pad); margin-bottom: var(--gap); }
.np-card-t { font-size: 14px; font-weight: 800; letter-spacing: -.01em; margin: 0 0 14px; display: flex; align-items: center; gap: 9px; }
.np-card-t .step { width: 22px; height: 22px; border-radius: 7px; background: var(--accent-50); color: var(--accent-600); font-size: 12px; font-weight: 800; display: grid; place-items: center; }
.np-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.np-fields .field.full { grid-column: 1 / -1; }

/* línea de artículo (página) */
.np-line { display: flex; gap: 10px; align-items: center; padding: 10px; border: 1px solid var(--border); border-radius: 12px; margin-bottom: 9px; background: var(--surface-2); }
.np-line .nl-prod { flex: 1; min-width: 0; }
.np-line select, .np-line input { border: 1px solid var(--border); border-radius: 9px; padding: 9px 11px; font: inherit; font-size: 13px; color: var(--ink); background: var(--surface); width: 100%; }
.np-line select:focus, .np-line input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-50); }
.np-line .nl-qty { width: 76px; flex: 0 0 auto; text-align: center; }
.np-line .nl-sub { width: 100px; flex: 0 0 auto; text-align: right; font-weight: 800; font-variant-numeric: tabular-nums; font-size: 14px; }
.np-line .rm { width: 36px; height: 36px; flex: 0 0 auto; border-radius: 9px; border: 1px solid var(--border); background: var(--surface); color: var(--ink-3); display: grid; place-items: center; }
.np-line .rm:hover { color: var(--neg); border-color: var(--neg); background: var(--neg-bg); }
.np-line .rm svg { width: 16px; height: 16px; stroke-width: 2; }

/* cuadro de total de presupuesto */
.q-total { border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; background: var(--surface-2); }
.q-total .qt-row { display: flex; justify-content: space-between; align-items: center; font-size: 13px; color: var(--ink-2); padding: 3px 0; }
.q-total .qt-row b { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--ink); }
.q-total .qt-row.disc b { color: var(--neg); }
.q-total .qt-row.grand { margin-top: 6px; padding-top: 9px; border-top: 1px dashed var(--border); font-size: 15px; }
.q-total .qt-row.grand span { font-weight: 700; color: var(--ink); }
.q-total .qt-row.grand b { font-size: 18px; }
.q-total .qt-row.alt { font-size: 12px; color: var(--ink-3); }
.q-total .qt-row.alt b { font-weight: 600; color: var(--ink-3); }

/* resumen fijo */
.np-summary { position: sticky; top: calc(var(--topbar-h) + 20px); }
.np-sum-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-card); box-shadow: var(--sh-md); overflow: hidden; }
.np-sum-head { padding: 16px 18px; border-bottom: 1px solid var(--border); font-weight: 800; font-size: 15px; }
.np-sum-body { padding: 16px 18px; }
.np-sum-client { display: flex; align-items: center; gap: 10px; padding-bottom: 14px; margin-bottom: 14px; border-bottom: 1px dashed var(--border); }
.np-sum-client .av { width: 38px; height: 38px; border-radius: 50%; flex: 0 0 auto; display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 14px; background: var(--avc, var(--c-blue)); }
.np-sum-client .cn { font-weight: 700; font-size: 13.5px; }
.np-sum-client .ce { font-size: 11.5px; color: var(--ink-3); }
.np-sum-items { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; max-height: 200px; overflow-y: auto; }
.np-sum-item { display: flex; justify-content: space-between; gap: 10px; font-size: 12.5px; }
.np-sum-item .si-name { color: var(--ink-2); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.np-sum-item .si-name b { color: var(--ink-3); font-weight: 700; }
.np-sum-item .si-v { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.np-sum-empty { font-size: 12.5px; color: var(--ink-3); text-align: center; padding: 16px 0; }
.np-tot { display: flex; flex-direction: column; gap: 7px; padding-top: 14px; border-top: 1px solid var(--border); }
.np-tot .tr { display: flex; justify-content: space-between; font-size: 13px; color: var(--ink-2); }
.np-tot .tr .v { font-weight: 700; font-variant-numeric: tabular-nums; }
.np-tot .tr.grand { font-size: 19px; font-weight: 800; color: var(--ink); padding-top: 9px; margin-top: 2px; border-top: 1px solid var(--border); }
.np-tot .tr .v.bs { color: var(--ink-3); font-weight: 600; font-size: 12px; }
.np-tot .tr.disc .v { color: var(--pos); }
.np-sum-foot { padding: 0 18px 18px; display: flex; flex-direction: column; gap: 9px; }
.np-sum-foot .btn { justify-content: center; padding: 12px; font-size: 14px; }
.np-credit-badge { display: flex; align-items: center; gap: 8px; background: oklch(0.96 0.03 248); color: var(--c-blue); border: 1px solid oklch(0.86 0.06 248); border-radius: 11px; padding: 10px 12px; font-size: 12px; font-weight: 600; margin-top: 12px; }
.np-credit-badge svg { width: 16px; height: 16px; flex: 0 0 auto; }

/* ============================================================
   INVENTARIO
   ============================================================ */
.stock-badge { display: inline-flex; align-items: center; gap: 6px; font-weight: 800; font-variant-numeric: tabular-nums; font-size: 15px; }
.stock-badge .sdot { width: 8px; height: 8px; border-radius: 50%; }
.stock-bar { width: 90px; height: 6px; border-radius: 4px; background: var(--surface-2); overflow: hidden; margin-top: 5px; }
.stock-bar i { display: block; height: 100%; border-radius: 4px; }
.stk-adjust { display: inline-flex; align-items: center; gap: 6px; }
.stk-btn { width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); display: grid; place-items: center; color: var(--ink-2); font-weight: 800; }
.stk-btn:hover { border-color: var(--accent); color: var(--accent-600); background: var(--accent-50); }
.stk-btn.minus:hover { border-color: var(--neg); color: var(--neg); background: var(--neg-bg); }
.stk-btn svg { width: 15px; height: 15px; stroke-width: 2.5; }
.stk-set { width: 36px; height: 30px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--ink-2); display: grid; place-items: center; }
.stk-set:hover { border-color: var(--accent); color: var(--accent-600); }
.stk-set svg { width: 15px; height: 15px; stroke-width: 2; }

/* movimientos */
.mv-list { display: flex; flex-direction: column; }
.mv-row { display: flex; align-items: center; gap: 12px; padding: 11px 4px; border-bottom: 1px solid var(--border-2); }
.mv-row:last-child { border-bottom: none; }
.mv-ico { width: 34px; height: 34px; border-radius: 9px; flex: 0 0 auto; display: grid; place-items: center; }
.mv-ico.entrada { background: var(--pos-bg); color: var(--pos); }
.mv-ico.salida { background: var(--neg-bg); color: var(--neg); }
.mv-ico svg { width: 16px; height: 16px; stroke-width: 2.2; }
.mv-main { flex: 1; min-width: 0; }
.mv-name { font-weight: 700; font-size: 13.5px; }
.mv-meta { font-size: 11.5px; color: var(--ink-3); margin-top: 1px; }
.mv-delta { font-weight: 800; font-variant-numeric: tabular-nums; font-size: 14px; }
.mv-delta.entrada { color: var(--pos); }
.mv-delta.salida { color: var(--neg); }
.mv-after { font-size: 11.5px; color: var(--ink-3); width: 70px; text-align: right; }

/* modal ajuste de stock */
.adj-seg { display: inline-flex; background: var(--surface-2); border-radius: 10px; padding: 4px; gap: 3px; width: 100%; }
.adj-seg button { flex: 1; border: none; background: none; padding: 9px; border-radius: 8px; font-weight: 700; font-size: 13px; color: var(--ink-2); }
.adj-seg button.active.in { background: var(--pos); color: #fff; }
.adj-seg button.active.out { background: var(--neg); color: #fff; }
.adj-preview { font-size: 13px; color: var(--ink-2); background: var(--surface-2); border-radius: 10px; padding: 11px 13px; }
.adj-preview b { color: var(--ink); }

/* ============================================================
   AJUSTES
   ============================================================ */
.set-grid { display: grid; grid-template-columns: 220px 1fr; gap: var(--gap); align-items: start; }
@media (max-width: 900px) { .set-grid { grid-template-columns: 1fr; } }
.set-nav { display: flex; flex-direction: column; gap: 3px; position: sticky; top: calc(var(--topbar-h) + 20px); }
.set-nav button { text-align: left; border: none; background: none; padding: 11px 13px; border-radius: 11px; font-weight: 600; font-size: 13.5px; color: var(--ink-2); display: flex; align-items: center; gap: 11px; transition: .15s; }
.set-nav button svg { width: 18px; height: 18px; stroke-width: 2; }
.set-nav button:hover { background: var(--surface-2); color: var(--ink); }
.set-nav button.active { background: var(--accent-50); color: var(--accent-600); }
.set-section { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-card); box-shadow: var(--sh-sm); padding: 22px; margin-bottom: var(--gap); }
.set-section h2 { margin: 0 0 4px; font-size: 16px; font-weight: 800; letter-spacing: -.01em; }
.set-section .sec-desc { font-size: 12.5px; color: var(--ink-3); margin: 0 0 18px; }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 0; border-top: 1px solid var(--border-2); }
.set-row:first-of-type { border-top: none; }
.set-row .sr-label { font-weight: 600; font-size: 13.5px; }
.set-row .sr-sub { font-size: 12px; color: var(--ink-3); margin-top: 2px; max-width: 380px; }
.set-row .sr-control { flex: 0 0 auto; }
.set-form { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.set-form .field.full { grid-column: 1 / -1; }

/* toggle switch */
.switch { position: relative; width: 44px; height: 26px; flex: 0 0 auto; cursor: pointer; }
.switch input { display: none; }
.switch .track { position: absolute; inset: 0; background: var(--border); border-radius: 99px; transition: .2s; }
.switch .thumb { position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; background: #fff; border-radius: 50%; box-shadow: var(--sh-sm); transition: .2s; }
.switch input:checked + .track { background: var(--accent); }
.switch input:checked + .track + .thumb { transform: translateX(18px); }

.danger-zone { border-color: oklch(0.85 0.07 25); }
.danger-zone h2 { color: var(--neg); }
.seg-choice { display: inline-flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 3px; gap: 2px; }
.seg-choice button { border: none; background: none; padding: 7px 14px; border-radius: 8px; font-weight: 600; font-size: 13px; color: var(--ink-2); }
.seg-choice button.active { background: var(--surface); color: var(--accent-600); box-shadow: var(--sh-sm); }
.set-saved { font-size: 12.5px; color: var(--pos); font-weight: 700; }
.pu-main { flex: 1; min-width: 0; }
.pu-name { font-weight: 700; font-size: 13.5px; }
.pu-name .pu-qty { color: var(--ink-3); font-weight: 600; }
.pu-meta { font-size: 11.5px; color: var(--ink-3); margin-top: 1px; }
.pu-amt { font-weight: 800; font-variant-numeric: tabular-nums; font-size: 14px; }
.pu-del { width: 28px; height: 28px; border-radius: 7px; border: 1px solid transparent; background: none; color: var(--ink-3); display: grid; place-items: center; opacity: 0; transition: .14s; }
.pu-del svg { width: 14px; height: 14px; stroke-width: 2; }
.pu-row:hover .pu-del { opacity: 1; }
.pu-del:hover { color: var(--neg); border-color: var(--neg); background: var(--neg-bg); }

/* notas del cliente */
.notes-list { display: flex; flex-direction: column; gap: 12px; }
.note-card { background: var(--surface-2); border: 1px solid var(--border-2); border-radius: 13px; padding: 14px 16px; }
.note-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 9px; }
.note-created { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 600; color: var(--ink-3); }
.note-created svg { width: 13px; height: 13px; stroke-width: 2; opacity: .8; }
.note-acts { display: inline-flex; gap: 4px; flex: 0 0 auto; }
.note-act { width: 28px; height: 28px; border-radius: 7px; border: 1px solid transparent; background: none; color: var(--ink-3); display: grid; place-items: center; transition: .14s; }
.note-act svg { width: 15px; height: 15px; stroke-width: 2; }
.note-act:hover { color: var(--accent-600); border-color: var(--border); background: var(--surface); }
.note-act.del:hover { color: var(--neg); border-color: var(--neg); background: var(--neg-bg); }
.note-event { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--accent-600); background: var(--accent-50); padding: 5px 11px; border-radius: 99px; margin-bottom: 10px; }
.note-event svg { width: 14px; height: 14px; stroke-width: 2; }
.note-event b { font-weight: 700; }
.note-text { font-size: 13.5px; line-height: 1.55; color: var(--ink); white-space: pre-wrap; word-break: break-word; }

.notes-pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border-2); }
.np-btn { display: inline-flex; align-items: center; gap: 5px; border: 1px solid var(--border); background: var(--surface); border-radius: 9px; padding: 8px 13px; font: inherit; font-size: 13px; font-weight: 700; color: var(--ink-2); cursor: pointer; transition: .14s; }
.np-btn svg { width: 15px; height: 15px; stroke-width: 2.2; }
.np-btn:hover:not(:disabled) { color: var(--accent-600); border-color: var(--accent-100, var(--accent)); }
.np-btn:disabled { opacity: .4; cursor: default; }
.np-info { font-size: 12px; color: var(--ink-3); font-weight: 600; text-align: center; }
.note-created-hint { font-size: 12px; color: var(--ink-3); font-weight: 600; background: var(--surface-2); border-radius: 9px; padding: 8px 12px; margin-bottom: 4px; }
#nt_text { width: 100%; resize: vertical; font: inherit; font-size: 14px; padding: 11px 13px; border: 1px solid var(--border); border-radius: var(--r-ctrl, 10px); background: var(--surface); color: var(--ink); line-height: 1.5; }
#nt_text:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-50); }

/* ============================================================
   MULTIMEDIA / GALERÍA
   ============================================================ */
.media-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--gap); margin-bottom: var(--gap); }
@media (max-width: 1000px) { .media-stats { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .media-stats { grid-template-columns: 1fr; } }
.m-stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-card); box-shadow: var(--sh-sm); padding: 16px 18px; display: flex; align-items: center; gap: 13px; }
.m-stat-dot { width: 12px; height: 12px; border-radius: 50%; flex: 0 0 auto; }
.m-stat-v { font-size: 24px; font-weight: 800; letter-spacing: -.02em; line-height: 1; }
.m-stat-k { font-size: 12px; color: var(--ink-3); font-weight: 600; margin-top: 4px; }

.media-toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.media-toolbar .grow { flex: 1; }
.chip-n { margin-left: 6px; font-size: 11px; font-weight: 800; opacity: .6; }
.chip.active .chip-n { opacity: .9; }

.media-drop { border-radius: var(--r-card); transition: .15s; position: relative; }
.media-drop.drag { outline: 2px dashed var(--accent); outline-offset: 6px; background: var(--accent-50); }
.grid-media { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 16px; }

.m-card { position: relative; margin: 0; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; overflow: hidden; box-shadow: var(--sh-sm); cursor: pointer; transition: .16s; }
.m-card:hover { transform: translateY(-3px); box-shadow: var(--sh-lg, 0 14px 32px rgba(15,23,42,.14)); border-color: var(--accent-100, var(--border)); }
.m-thumb { aspect-ratio: 4 / 3; background-size: cover; background-position: center; background-color: var(--surface-2); }
.m-cap { padding: 10px 12px; font-size: 13px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.m-badge { position: absolute; top: 9px; left: 9px; font-size: 10.5px; font-weight: 800; padding: 3px 8px; border-radius: 99px; color: #fff; backdrop-filter: blur(4px); letter-spacing: .01em; }
.m-badge.s-upload    { background: color-mix(in srgb, var(--rate-gold-ink) 88%, transparent); }
.m-badge.s-producto  { background: color-mix(in srgb, var(--rate-green) 88%, transparent); }
.m-badge.s-categoria { background: color-mix(in srgb, var(--accent) 88%, transparent); }
.m-badge.s-proveedor { background: color-mix(in srgb, var(--rate-brown) 88%, transparent); }
.m-badge.s-cliente   { background: color-mix(in srgb, oklch(0.55 0.17 250) 88%, transparent); }

.media-empty { text-align: center; padding: 60px 24px; color: var(--ink-3); display: flex; flex-direction: column; align-items: center; gap: 14px; }
.media-empty svg { width: 48px; height: 48px; stroke-width: 1.4; opacity: .5; }
.media-empty p { margin: 0; max-width: 380px; font-size: 14px; }

/* lightbox */
.lightbox { position: fixed; inset: 0; z-index: 120; background: rgba(15,12,28,.82); backdrop-filter: blur(6px); display: none; align-items: center; justify-content: center; padding: 40px; }
.lightbox.open { display: flex; }
.lb-stage { max-width: min(880px, 92vw); max-height: 88vh; display: flex; flex-direction: column; gap: 0; background: var(--surface); border-radius: 16px; overflow: hidden; box-shadow: 0 30px 80px rgba(0,0,0,.4); }
.lb-stage img { max-height: 72vh; max-width: 100%; object-fit: contain; background: var(--surface-2); display: block; }
.lb-meta { display: flex; align-items: center; gap: 16px; padding: 14px 18px; border-top: 1px solid var(--border); }
.lb-info { flex: 1; min-width: 0; }
.lb-title { font-weight: 800; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lb-sub { font-size: 12px; color: var(--ink-3); margin-top: 2px; }
.lb-actions { display: flex; gap: 8px; flex: 0 0 auto; }
.lb-actions .btn { text-decoration: none; }
.lb-close { position: absolute; top: 20px; right: 22px; width: 42px; height: 42px; border-radius: 12px; border: none; background: rgba(255,255,255,.12); color: #fff; display: grid; place-items: center; cursor: pointer; transition: .14s; }
.lb-close:hover { background: rgba(255,255,255,.22); }
.lb-close svg { width: 20px; height: 20px; }
.lb-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 48px; height: 48px; border-radius: 50%; border: none; background: rgba(255,255,255,.12); color: #fff; display: grid; place-items: center; cursor: pointer; transition: .14s; }
.lb-nav:hover { background: rgba(255,255,255,.24); }
.lb-nav svg { width: 24px; height: 24px; }
.lb-nav.prev { left: 28px; }
.lb-nav.next { right: 28px; }
@media (max-width: 640px) { .lb-nav.prev { left: 10px; } .lb-nav.next { right: 10px; } .lightbox { padding: 16px; } }

/* ============================================================
   RESPONSIVE — tablets y teléfonos
   El menú lateral se vuelve un cajón (drawer) deslizable.
   ============================================================ */

/* fondo oscuro detrás del cajón (lo inserta responsive.js) */
.nav-backdrop {
  position: fixed; inset: 0; z-index: 45;
  background: rgba(25,20,55,.42);
  -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
  opacity: 0; pointer-events: none; transition: opacity .26s;
}

/* ---------- ≤ 900px : tablets en vertical y móviles ---------- */
@media (max-width: 900px) {
  /* el contenido ocupa todo el ancho; el sidebar se superpone */
  .app, .app.collapsed { grid-template-columns: 1fr; }

  /* sidebar -> cajón fuera de pantalla */
  .sidebar {
    position: fixed; top: 0; left: 0; z-index: 60;
    width: 274px; max-width: 84vw; height: 100vh; height: 100dvh;
    transform: translateX(-100%);
    transition: transform .28s cubic-bezier(.4,0,.2,1);
    box-shadow: var(--sh-lg);
  }
  .app.nav-open .sidebar { transform: none; }
  .app.nav-open .nav-backdrop { opacity: 1; pointer-events: auto; }

  /* dentro del cajón siempre mostramos textos completos
     (ignoramos el estado "colapsado" del escritorio) */
  .collapsed .brand-name,
  .collapsed .nav-label,
  .collapsed .nav-group-label,
  .collapsed .side-card { display: revert; }
  .collapsed .nav-item { justify-content: flex-start; }
  .collapsed .nav-item .badge { display: inline-block; }
  .collapsed .submenu { display: flex; }
  .collapsed .nav-item.has-sub .chev { display: block; }

  /* barra superior compacta */
  .topbar { padding: 0 14px; gap: 10px; }
  .topbar .spacer { display: none; }
  .searchbar { max-width: none; }
  .searchbar kbd { display: none; }
  .profile-meta { display: none; }
  .profile { padding: 4px; }

  /* contenido con menos margen */
  .content { padding: 16px 14px; gap: 14px; }

  /* encabezado de página apilado */
  .page-head { align-items: flex-start; }
  .page-head h1 { font-size: 20px; }
  .head-actions { width: 100%; flex-wrap: wrap; }
  .head-actions .segment { flex: 1; }
  .head-actions .segment button { flex: 1; text-align: center; }

  /* card-head con pestañas: permitir salto de línea */
  .card-head { flex-wrap: wrap; }
  .tabs { flex-wrap: wrap; }

  /* barra de herramientas de tabla: búsqueda a lo ancho */
  .table-toolbar .mini-search { margin-left: 0; width: 100%; min-width: 0; }

  /* dropdown de notificaciones a lo ancho */
  .dropdown { left: 12px; right: 12px; width: auto; }

  /* tasas: minicards a todo el ancho */
  .rate-row { justify-content: stretch; }
  .rate-mini { flex: 1 1 150px; min-width: 0; }

  /* ajustes: la navegación pasa a fila desplazable */
  .set-nav {
    position: static; flex-direction: row; gap: 6px;
    overflow-x: auto; padding-bottom: 4px; -webkit-overflow-scrolling: touch;
  }
  .set-nav button { white-space: nowrap; flex: 0 0 auto; }
  .set-section { padding: 18px 16px; }

  /* nuevo pedido: el resumen deja de estar fijo */
  .np-summary { position: static; }
}

/* ---------- ≤ 640px : teléfonos ---------- */
@media (max-width: 640px) {
  /* formularios y rejillas de 2 columnas -> 1 columna */
  .modal-body,
  .od-cols,
  .set-form,
  .np-fields,
  .price-preview,
  .credit-fields .cf-grid { grid-template-columns: 1fr; }

  /* modales a pantalla casi completa */
  .modal-bg { padding: 12px; align-items: flex-end; }
  .modal { width: 100% !important; max-width: calc(100vw - 24px); max-height: 92vh; border-radius: 18px; }
  .modal-bg.open .modal { transform: none; }
  /* rejillas de 2 columnas forzadas por estilo en línea -> 1 columna */
  .modal-body[style*="1fr 1fr"] { grid-template-columns: 1fr !important; }
  .modal-head { padding: 16px 16px 0; }
  .modal-body { padding: 14px 16px; }
  .modal-foot { padding: 6px 16px 16px; flex-wrap: wrap; }
  .modal-foot .btn { flex: 1; justify-content: center; }
  .modal-foot .btn.danger { margin-right: 0; flex-basis: 100%; }
  .confirm { width: 100%; }

  /* KPIs de 2 a 1 columna en pantallas muy estrechas */
  .kpis { grid-template-columns: 1fr; }
  .media-stats { grid-template-columns: 1fr; }

  /* totales de pedido a todo el ancho */
  .od-totals { max-width: none; }

  /* líneas de artículo del pedido: que respiren */
  .np-line { flex-wrap: wrap; }
  .np-line .nl-prod { flex: 1 1 100%; }
  .ord-line-row { flex-wrap: wrap; }
  .ord-line-row .ol-prod { flex: 1 1 100%; }

  /* tarjeta de cliente: stats en 1 columna si hace falta */
  .cli-tags { flex-direction: row; }

  /* timeline de estado: texto un poco menor */
  .od-step .sl { font-size: 9.5px; }
}

/* ---------- ≤ 420px : teléfonos pequeños ---------- */
@media (max-width: 420px) {
  .page-head h1 { font-size: 18px; }
  .kpi-value { font-size: 24px; }
  .brand { padding-bottom: 14px; }
  .searchbar input { font-size: 13px; }
}

/* spin animation for BCV fetch button */
@keyframes spin { to { transform: rotate(360deg); } }
.spin { animation: spin .8s linear infinite; display: inline-block; }

/* ── Selector de color personalizado ──────────────────────────── */
.cp-pop{position:absolute;z-index:9999;width:248px;background:#fff;border:1px solid var(--line,#e2e8f0);border-radius:14px;box-shadow:0 12px 40px rgba(0,0,0,.18);padding:14px;font-size:13px}
.cp-prev{display:flex;align-items:center;gap:9px;margin-bottom:11px}
.cp-prev-sw{width:34px;height:34px;border-radius:9px;border:1px solid var(--line,#e2e8f0);background-image:linear-gradient(45deg,#ddd 25%,transparent 25%),linear-gradient(-45deg,#ddd 25%,transparent 25%),linear-gradient(45deg,transparent 75%,#ddd 75%),linear-gradient(-45deg,transparent 75%,#ddd 75%);background-size:10px 10px;background-position:0 0,0 5px,5px -5px,-5px 0;position:relative;flex:0 0 auto}
.cp-prev-sw::after{content:"";position:absolute;inset:0;border-radius:8px;background:inherit}
.cp-prev-txt{font-family:ui-monospace,monospace;font-size:12px;color:var(--ink-2,#475569);word-break:break-all}
.cp-row{display:flex;align-items:center;gap:8px;margin-bottom:10px}
.cp-native{width:42px;height:34px;padding:0;border:1px solid var(--line,#e2e8f0);border-radius:8px;background:none;cursor:pointer;flex:0 0 auto}
.cp-hex{flex:1;border:1px solid var(--line,#e2e8f0);border-radius:8px;padding:8px 10px;font-family:ui-monospace,monospace;font-size:13px;text-transform:lowercase}
.cp-hex:focus,.cp-native:focus{outline:none;border-color:var(--accent,#7c5cff)}
.cp-op{gap:9px}
.cp-op-lbl{font-size:12px;color:var(--ink-2,#475569);flex:0 0 auto}
.cp-alpha{flex:1;accent-color:var(--accent,#7c5cff)}
.cp-alpha-val{font-size:12px;color:var(--ink-2,#475569);width:38px;text-align:right;flex:0 0 auto}
.cp-actions{display:flex;gap:8px;justify-content:flex-end;margin-top:4px}
.cp-actions .btn{padding:7px 14px;font-size:13px}

/* botón "+ personalizado" en las filas de color */
.co.co-add{display:inline-flex;align-items:center;justify-content:center;border:1.5px dashed var(--line,#cbd5e1);background:#fff;color:var(--ink-2,#475569);font-size:18px;line-height:1;cursor:pointer}
.co.co-add:hover{border-color:var(--accent,#7c5cff);color:var(--accent,#7c5cff)}
.co.co-custom{box-shadow:0 0 0 2px #fff inset}

/* cargador de imagen (foto responsable / logo / favicon) en Ajustes */
.img-uploader{display:flex;align-items:center;gap:14px}
.img-prev{width:60px;height:60px;border-radius:12px;border:1px solid var(--line,#e2e8f0);background:var(--bg-2,#f1f5f9);overflow:hidden;display:flex;align-items:center;justify-content:center;color:var(--ink-3,#94a3b8);font-weight:700;flex:0 0 auto}
.img-prev img{width:100%;height:100%;object-fit:cover;display:block}
.img-prev.fav{width:42px;height:42px;border-radius:9px}
.img-prev.fav img{object-fit:contain}
.img-ctrls{display:flex;flex-direction:column;gap:7px}
.img-btns{display:flex;gap:8px;flex-wrap:wrap}

.profile{position:relative}
.profile-menu{position:absolute;top:calc(100% + 8px);right:0;min-width:210px;background:#fff;border:1px solid var(--line,#e2e8f0);border-radius:13px;box-shadow:0 12px 40px rgba(0,0,0,.16);padding:7px;z-index:1000;display:none}
.profile-menu.open{display:block}
.profile-menu .pm-head{padding:9px 11px 10px;border-bottom:1px solid var(--line,#eef2f7);margin-bottom:6px}
.profile-menu .pm-name{font-weight:700;font-size:14px;color:var(--ink,#0f172a);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.profile-menu .pm-sub{font-size:12px;color:var(--ink-3,#94a3b8);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.profile-menu button{display:flex;align-items:center;gap:10px;width:100%;border:none;background:none;padding:10px 11px;border-radius:9px;font:inherit;font-size:13.5px;color:var(--ink-2,#334155);cursor:pointer;text-align:left}
.profile-menu button:hover{background:var(--bg-2,#f1f5f9)}
.profile-menu button svg{width:17px;height:17px;stroke-width:2;flex:0 0 auto}
.profile-menu button.pm-logout{color:var(--neg,#dc2626)}
.profile-menu button.pm-logout:hover{background:#fef2f2}

.admin-list{display:flex;flex-direction:column;gap:8px;margin-bottom:6px}
.admin-row{display:flex;align-items:center;gap:12px;padding:11px 13px;border:1px solid var(--line,#e2e8f0);border-radius:11px;background:#fff}
.admin-info{flex:1;min-width:0}
.admin-name{font-weight:650;font-size:14px;color:var(--ink,#0f172a)}
.admin-mail{font-size:12.5px;color:var(--ink-3,#94a3b8);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.admin-tag{display:inline-block;font-size:11px;font-weight:600;color:var(--accent-600,#6849e6);background:var(--accent-50,#efeaff);padding:1px 7px;border-radius:20px;margin-left:6px}
.admin-acts{display:flex;gap:7px;flex:0 0 auto}
.btn.sm{padding:6px 12px;font-size:12.5px;border-radius:8px}
.btn.sm.danger{color:var(--neg,#dc2626);border-color:var(--neg,#fca5a5)}

.icon-act{width:34px;height:34px;border-radius:9px;border:1px solid var(--border,#e2e8f0);background:var(--surface,#fff);display:grid;place-items:center;color:var(--ink-2,#475569);flex:0 0 auto;cursor:pointer;padding:0}
.icon-act:hover{color:var(--ink,#0f172a);border-color:var(--ink-3,#94a3b8)}
.icon-act svg{width:17px;height:17px;stroke-width:2}
.icon-act.danger{color:var(--neg,#dc2626)}
.icon-act.danger:hover{border-color:var(--neg,#fca5a5);background:#fef2f2}

.sidebar .brand{min-width:0;overflow:visible}
.brand-logo-img{max-width:100%;max-height:54px;width:auto;height:auto;object-fit:contain}
.app.collapsed .sidebar .brand-logo-img{max-height:36px}

.login-badge{display:inline-flex;align-items:center;gap:4px;font-size:11px;font-weight:600;color:var(--pos,#16a34a);background:var(--pos-bg,#dcfce7);padding:2px 8px;border-radius:20px;margin-left:6px;vertical-align:middle}
.login-badge svg{width:12px;height:12px;stroke-width:2}

.card.kpi{position:relative}
.info-btn{position:relative;width:20px;height:20px;border-radius:50%;border:none;background:none;color:var(--ink-3,#94a3b8);cursor:pointer;display:inline-grid;place-items:center;padding:0;flex:0 0 auto;vertical-align:middle}
.info-btn:hover{color:var(--accent,#7c5cff)}
.info-btn svg{width:16px;height:16px;stroke-width:2}
.info-btn.kpi-info{position:absolute;top:12px;right:12px}
.card-head h3{display:inline-flex;align-items:center;gap:7px}
.info-tip{display:none;position:fixed;width:230px;max-width:80vw;background:var(--ink,#0f172a);color:#fff;font-size:12px;font-weight:500;line-height:1.45;padding:9px 11px;border-radius:9px;box-shadow:0 10px 30px rgba(0,0,0,.22);z-index:9999;text-align:left;white-space:normal;letter-spacing:0;pointer-events:none}
.info-btn:hover .info-tip,.info-btn.open .info-tip{display:block}

.od-print-head{display:none}
.od-print-head .oph-brand{display:flex;align-items:center;gap:12px;min-width:0}
.od-print-head .oph-brand img{max-height:64px;max-width:220px;width:auto;object-fit:contain}
.od-print-head .oph-name{font-size:20px;font-weight:800;color:#0f172a}
.od-print-head .oph-meta{text-align:right;flex:0 0 auto}
.od-print-head .oph-title{font-size:16px;font-weight:700;color:#0f172a}
.od-print-head .oph-id{font-size:14px;font-weight:600;color:#475569}
.od-print-head .oph-date{font-size:12px;color:#94a3b8}
@media print{
  html,body{height:auto !important;overflow:visible !important;background:#fff !important}
  /* fuerza la impresión de colores de fondo (puntos/líneas del timeline, etiquetas) */
  #detailBg,#detailBg *{-webkit-print-color-adjust:exact !important;print-color-adjust:exact !important}
  body>*:not(#detailBg){display:none !important}
  #detailBg{position:static !important;display:block !important;background:#fff !important;padding:0 !important;overflow:visible !important}
  #detailBg .modal.ord-detail{box-shadow:none !important;border:none !important;border-radius:0 !important;max-width:100% !important;width:100% !important;max-height:none !important;height:auto !important;margin:0 !important;overflow:visible !important;background:#fff !important;padding:12mm !important}
  #detailBg .modal-head,#detailClose,#detailBg .modal-foot,#detailBg .status-select{display:none !important}
  #detailBg .od-print-head{display:flex !important;justify-content:space-between;align-items:center;gap:16px;padding:0 0 16px;margin-bottom:18px;border-bottom:2px solid #e2e8f0}
  #detailBg .modal-body{max-height:none !important;overflow:visible !important;padding:0 !important}
  @page{margin:0}
}
.an-list{display:flex;flex-direction:column;gap:8px}
.an-row{display:flex;align-items:center;gap:10px;padding:9px 11px;border:1px solid var(--border,#e2e8f0);border-radius:10px}
.an-main{flex:1;min-width:0}
.an-name{font-weight:650;font-size:13.5px;color:var(--ink,#0f172a);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.an-sub{font-size:12px;color:var(--ink-3,#94a3b8)}
.an-tag{flex:0 0 auto;font-size:11.5px;font-weight:700;padding:3px 9px;border-radius:20px;white-space:nowrap}
.an-tag.warn{color:var(--c-amber,#d97706);background:oklch(0.95 0.05 75)}
.an-tag.neg{color:var(--neg,#dc2626);background:var(--neg-bg,#fef2f2)}
.an-tag.ok{color:var(--pos,#16a34a);background:var(--pos-bg,#dcfce7)}

.mp-modal{width:680px;max-width:94vw}
.mp-toolbar{display:flex;gap:8px;align-items:center;padding:0 4px 12px;flex-wrap:wrap}
.mp-toolbar .mp-url{flex:1;min-width:160px;border:1px solid var(--line,#e2e8f0);border-radius:9px;padding:9px 11px;font:inherit;font-size:13.5px}
.mp-toolbar .mp-url:focus{outline:none;border-color:var(--accent,#7c5cff)}
.mp-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(110px,1fr));gap:10px;max-height:48vh;overflow-y:auto;padding:4px;border:1px solid var(--line,#eef2f7);border-radius:12px;background:var(--bg-2,#f8fafc)}
.mp-item{position:relative;aspect-ratio:1;border:2px solid transparent;border-radius:10px;overflow:hidden;background:#fff;cursor:pointer;padding:0}
.mp-item img{width:100%;height:100%;object-fit:contain;display:block}
.mp-item:hover{border-color:var(--ink-3,#cbd5e1)}
.mp-item.sel{border-color:var(--accent,#7c5cff);box-shadow:0 0 0 3px var(--accent-50,#efeaff)}
.mp-item.sel::after{content:"";position:absolute;top:5px;right:5px;width:18px;height:18px;border-radius:50%;background:var(--accent,#7c5cff)}
.mp-empty{grid-column:1/-1;text-align:center;color:var(--ink-3,#94a3b8);padding:34px 10px;font-size:13.5px;line-height:1.6}
