:root {
  --ink: #15171A;
  --ink-soft: #3C4045;
  --muted: #6A6D72;
  --line: #E2E0DA;
  --line-strong: #CCC9C0;
  --paper: #F2F1EE;
  --wax: #EAE8E3;
  --wax-deep: #DCD9D0;
  --flame: #FEDE04;
  --flame-dark: #6F5700;
  --flame-soft: #FFF7BF;
  --deep: #15171A;
  --card: #FFFFFF;
  --ok: #1E7A4F;
  --ok-soft: #E1F0E8;
  --warn: #8A5A00;
  --warn-soft: #FBEFCF;
  --bad: #CC130E;
  --bad-soft: #FDE4E2;
  --info: #2C5F8A;
  --info-soft: #E1EBF4;
  --sidebar: 252px;
  --r-lg: 16px;
  --r-md: 12px;
  --r-sm: 8px;
  --shadow: 0 1px 2px rgba(21, 23, 26, .05), 0 4px 14px rgba(21, 23, 26, .04);
  --veladora: #E31610;
  --serif: "Baskervville", "Iowan Old Style", Georgia, serif;
  --sans: "Work Sans", system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4, p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--flame-dark); }
[hidden] { display: none !important; }

:focus-visible { outline: 3px solid rgba(254, 222, 4, .7); outline-offset: 2px; }

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.ico { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.ico.sm { width: 16px; height: 16px; }
.ico.lg { width: 26px; height: 26px; }
.ico.flip { transform: rotate(180deg); }

.skip-link { position: fixed; left: 12px; top: 12px; z-index: 300; background: var(--deep); color: #fff; padding: 10px 14px; border-radius: 8px; transform: translateY(-200%); }
.skip-link:focus { transform: none; }

/* ---------- Estructura ---------- */
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar); z-index: 70;
  display: flex; flex-direction: column; background: var(--wax); border-right: 1px solid var(--line);
  overflow-y: auto;
}
.brand { padding: 22px 20px 14px; display: flex; align-items: center; gap: 10px; }
.brand-mark { width: 34px; height: 34px; border-radius: 10px; background: var(--deep); color: #FEDE04; display: grid; place-items: center; }
.brand-name { font-size: 20px; font-weight: 700; letter-spacing: -.02em; }
.brand-sub { font-size: 12px; color: var(--muted); margin-top: -2px; }
.nav { padding: 8px 10px 14px; display: grid; gap: 4px; }
.nav-label { font-size: 11px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); padding: 12px 12px 4px; }
.nav a {
  display: grid; grid-template-columns: 22px 1fr; align-items: center; gap: 12px;
  min-height: 46px; padding: 6px 12px; border-radius: 10px; text-decoration: none; color: var(--ink-soft); font-weight: 600;
}
.nav a small { display: block; font-weight: 400; font-size: 12px; color: var(--muted); line-height: 1.2; }
.nav a:hover { background: var(--wax-deep); }
.nav a.active { background: var(--card); color: var(--ink); box-shadow: inset 3px 0 0 var(--flame), var(--shadow); }
.nav a.active .ico { color: var(--flame); }
.sidebar-foot { margin-top: auto; padding: 14px 18px 18px; font-size: 12px; color: var(--muted); border-top: 1px solid var(--line); }
.demo-tag { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink-soft); background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: 3px 10px; }
.demo-tag::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--flame); }

.topbar { display: none; }
.backdrop { display: none; }

.main { margin-left: var(--sidebar); padding: 30px 34px 64px; min-width: 0; }
.content { max-width: 1240px; margin: 0 auto; }
.view { display: none; }
.view.active { display: block; animation: fade .25s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 24px; margin-bottom: 20px; }
.eyebrow { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--flame-dark); margin-bottom: 4px; }
.page-head h1 { font-size: 28px; line-height: 1.15; letter-spacing: -.02em; }
.lead { color: var(--ink-soft); max-width: 66ch; margin-top: 6px; }

/* ---------- Componentes ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow); min-width: 0; }
.card-pad { padding: 20px; }
.card-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.card-head h2, .card-head h3 { font-size: 16px; letter-spacing: -.01em; }
.card-head p { font-size: 13px; color: var(--muted); }
.card-body { padding: 18px 20px; }
.grid { display: grid; gap: 18px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.split-a { grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); }
.split-b { grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); }
.split-c { grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); }
.stack-gap > * + * { margin-top: 18px; }
.muted { color: var(--muted); }
.soft { color: var(--ink-soft); }
.small { font-size: 13px; }
.xs { font-size: 12px; }
.mono { font-family: var(--mono); }
.right { text-align: right; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.between { justify-content: space-between; }
.grow { flex: 1 1 auto; min-width: 0; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 42px; padding: 8px 16px; border-radius: 10px; border: 1px solid var(--line-strong);
  background: var(--card); color: var(--ink); font-weight: 600; text-decoration: none; transition: background .15s, transform .05s;
}
.btn:hover { background: var(--wax); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--flame); border-color: var(--flame); color: var(--ink); }
.btn-primary:hover { background: #FFB93D; border-color: #FFB93D; }
.btn-dark { background: var(--deep); border-color: var(--deep); color: #fff; }
.btn-dark:hover { background: #2C3036; }
.btn-ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn-ok:hover { background: #335838; }
.btn-bad { background: var(--bad-soft); border-color: #E7BDB4; color: var(--bad); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--ink-soft); }
.btn-ghost:hover { background: var(--wax); }
.btn-sm { min-height: 34px; padding: 4px 12px; font-size: 13px; border-radius: 8px; }
.btn-lg { min-height: 52px; padding: 10px 22px; font-size: 16px; }

.chip { display: inline-flex; align-items: center; gap: 5px; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; background: var(--wax); color: var(--ink-soft); }
.chip-ok { background: var(--ok-soft); color: var(--ok); }
.chip-warn { background: var(--warn-soft); color: var(--warn); }
.chip-bad { background: var(--bad-soft); color: var(--bad); }
.chip-info { background: var(--info-soft); color: var(--info); }
.chip-flame { background: var(--flame-soft); color: var(--flame-dark); }

.tabs { display: flex; gap: 4px; padding: 4px; background: var(--wax); border-radius: 12px; width: fit-content; max-width: 100%; overflow-x: auto; margin-bottom: 18px; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { border: 0; background: transparent; min-height: 40px; padding: 6px 16px; border-radius: 9px; font-weight: 600; color: var(--ink-soft); white-space: nowrap; display: inline-flex; align-items: center; gap: 8px; }
.tab:hover { background: var(--wax-deep); }
.tab.active { background: var(--card); color: var(--ink); box-shadow: var(--shadow); }
.tab .chip { padding: 0 8px; }

.banner { display: flex; gap: 12px; align-items: flex-start; padding: 12px 16px; border-radius: var(--r-md); background: var(--flame-soft); border: 1px solid #F2D18A; color: var(--deep); font-size: 14px; }
.banner .ico { color: var(--flame-dark); margin-top: 1px; }
.banner.info { background: var(--info-soft); border-color: #C6D5E2; }
.banner.info .ico { color: var(--info); }
.banner.bad { background: var(--bad-soft); border-color: #E7BDB4; }
.banner.bad .ico { color: var(--bad); }
.banner.ok { background: var(--ok-soft); border-color: #C3D9BF; }
.banner.ok .ico { color: var(--ok); }

.field { display: grid; gap: 4px; font-size: 13px; font-weight: 600; color: var(--ink-soft); }
.input, select.input, textarea.input {
  width: 100%; min-height: 42px; padding: 8px 12px; border: 1px solid var(--line-strong); border-radius: 10px; background: #fff; color: var(--ink); font-size: 15px; font-weight: 400;
}
.input.bad { border-color: var(--bad); background: #FFF6F3; }
.input.ok { border-color: #A9C7A3; }
.input.sm { min-height: 34px; padding: 4px 8px; font-size: 14px; border-radius: 8px; }

/* KPI */
.kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px; margin-bottom: 20px; }
.kpis.k4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.kpi { display: block; width: 100%; text-align: left; padding: 16px 18px; background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow); text-decoration: none; color: inherit; }
button.kpi:hover, a.kpi:hover { border-color: var(--flame); }
.kpi .k-label { font-size: 13px; color: var(--muted); font-weight: 600; display: flex; align-items: center; gap: 6px; }
.kpi .k-num { font-size: 32px; font-weight: 700; letter-spacing: -.03em; line-height: 1.1; margin-top: 6px; font-variant-numeric: tabular-nums; }
.kpi .k-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.kpi.alert .k-num { color: var(--bad); }
.kpi.flame .k-num { color: var(--flame-dark); }

/* Tablas */
.tbl-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); padding: 10px 14px; border-bottom: 1px solid var(--line); background: #F6F5F2; position: sticky; top: 0; z-index: 1; white-space: nowrap; }
.tbl td { padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tr.warnrow td { background: #FFF9EC; }
.tbl tr.badrow td { background: #FFF4F4; }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.scroll-y { max-height: 460px; overflow: auto; }

/* Barras */
.bars { display: grid; gap: 10px; }
.bar-row { display: grid; grid-template-columns: 130px minmax(0, 1fr) 54px; align-items: center; gap: 10px; font-size: 13px; }
.bar-row .b-name { color: var(--ink-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { height: 14px; background: var(--wax); border-radius: 7px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--flame); border-radius: 7px; transition: width .4s; }
.bar-fill.alt { background: var(--deep); }
.bar-val { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }

/* Inicio */
.mod-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.mod-card { display: flex; flex-direction: column; gap: 8px; padding: 18px; background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow); text-decoration: none; color: inherit; }
.mod-card:hover { border-color: var(--flame); }
.mod-card .m-ico { width: 42px; height: 42px; border-radius: 12px; background: var(--flame-soft); color: var(--flame-dark); display: grid; place-items: center; }
.mod-card h3 { font-size: 16px; }
.mod-card p { font-size: 13px; color: var(--ink-soft); flex: 1; }
.mod-card .m-stat { font-size: 12px; color: var(--muted); border-top: 1px solid var(--line); padding-top: 8px; }
.mod-card .m-go { font-size: 13px; font-weight: 700; color: var(--flame-dark); display: inline-flex; align-items: center; gap: 6px; }
.attn { list-style: none; margin: 0; padding: 0; }
.attn li { display: flex; align-items: center; gap: 12px; padding: 12px 20px; border-bottom: 1px solid var(--line); }
.attn li:last-child { border-bottom: 0; }
.attn .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--flame); flex: none; }
.attn .dot.bad { background: var(--bad); }
.attn .dot.ok { background: var(--ok); }
.chart-svg { width: 100%; height: auto; display: block; }

/* ---------- WhatsApp ---------- */
.chat-layout {
  display: grid; grid-template-columns: 330px minmax(0, 1fr); background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow);
  overflow: hidden; height: min(700px, calc(100vh - 200px)); min-height: 540px;
}
.inbox { border-right: 1px solid var(--line); overflow-y: auto; background: #FAFAF8; }
.inbox-head { padding: 14px 16px; border-bottom: 1px solid var(--line); font-weight: 700; display: flex; justify-content: space-between; align-items: center; position: sticky; top: 0; background: #FAFAF8; z-index: 1; }
.conv-item { display: grid; grid-template-columns: 38px minmax(0, 1fr); gap: 10px; width: 100%; text-align: left; padding: 12px 16px; border: 0; border-bottom: 1px solid var(--line); background: transparent; }
.conv-item:hover { background: var(--wax); }
.conv-item.active { background: var(--flame-soft); }
.avatar { width: 38px; height: 38px; border-radius: 50%; background: var(--wax-deep); color: var(--ink-soft); display: grid; place-items: center; font-weight: 700; font-size: 14px; }
.avatar.live { background: var(--deep); color: #FEDE04; }
.conv-top { display: flex; justify-content: space-between; gap: 8px; font-weight: 700; font-size: 14px; }
.conv-top span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv-top time { font-weight: 400; font-size: 12px; color: var(--muted); white-space: nowrap; }
.conv-prev { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin: 1px 0 5px; }
.conv { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: #F5F4F0; }
.conv-head { display: flex; align-items: center; gap: 12px; padding: 12px 16px; background: var(--card); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.conv-head .grow strong { display: block; line-height: 1.2; }
.back-btn { display: none; }
.thread { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 8px; min-height: 0; }
.bub { max-width: 82%; padding: 9px 13px; border-radius: 14px; font-size: 14.5px; line-height: 1.45; box-shadow: 0 1px 1px rgba(21, 23, 26, .06); white-space: pre-line; overflow-wrap: anywhere; }
.bub small { display: block; font-size: 11px; opacity: .65; margin-top: 3px; text-align: right; }
.bub .who { display: block; font-size: 11px; font-weight: 700; letter-spacing: .03em; color: var(--flame-dark); margin-bottom: 2px; }
.bub.cliente { align-self: flex-end; background: #FFF3A0; border-bottom-right-radius: 4px; }
.bub.agente { align-self: flex-start; background: #fff; border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.bub.asesor { align-self: flex-start; background: var(--deep); color: #F4F5F7; border-bottom-left-radius: 4px; }
.bub.asesor .who { color: #FEDE04; }
.bub.typing { color: var(--muted); font-style: italic; }
.sys-line { align-self: center; font-size: 12px; color: var(--ink-soft); background: var(--wax); border-radius: 999px; padding: 3px 12px; text-align: center; }
.qr-row { display: flex; flex-wrap: wrap; gap: 6px; margin: 2px 0 4px; }
.qr-chip { border: 1px solid var(--flame-dark); background: #fff; color: var(--flame-dark); border-radius: 999px; padding: 6px 14px; min-height: 36px; font-weight: 600; font-size: 14px; }
.qr-chip:hover { background: var(--flame-soft); }
.suggest { display: flex; gap: 6px; padding: 8px 16px 0; overflow-x: auto; scrollbar-width: none; background: var(--card); border-top: 1px solid var(--line); }
.suggest::-webkit-scrollbar { display: none; }
.suggest .qr-chip { white-space: nowrap; flex: none; }
.composer { display: flex; gap: 8px; padding: 10px 16px 14px; background: var(--card); }
.composer .input { border-radius: 999px; padding-left: 16px; }
.composer .btn { border-radius: 999px; min-width: 46px; padding: 8px 14px; }
.readonly-note { padding: 12px 16px; background: var(--card); border-top: 1px solid var(--line); font-size: 13px; color: var(--muted); text-align: center; }

.qa-item { padding: 16px 20px; border-bottom: 1px solid var(--line); display: grid; gap: 10px; }
.qa-item:last-child { border-bottom: 0; }
.qa-q { font-weight: 700; }
.qa-a { font-size: 14px; color: var(--ink-soft); background: var(--wax); border-radius: 10px; padding: 8px 12px; white-space: pre-line; }
.rate { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.rate .btn.sel-ok { background: var(--ok-soft); border-color: #A9C7A3; color: var(--ok); }
.rate .btn.sel-bad { background: var(--bad-soft); border-color: #E7BDB4; color: var(--bad); }
.donut-wrap { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.donut { --p: 80; width: 112px; height: 112px; border-radius: 50%; background: conic-gradient(var(--flame) calc(var(--p) * 1%), var(--wax-deep) 0); display: grid; place-items: center; flex: none; }
.donut > div { width: 82px; height: 82px; border-radius: 50%; background: var(--card); display: grid; place-items: center; font-size: 24px; font-weight: 700; letter-spacing: -.02em; }

/* ---------- Producción ---------- */
.puesto-wrap { display: grid; grid-template-columns: minmax(0, 440px) minmax(0, 1fr); gap: 24px; align-items: start; }
.phone { background: var(--deep); border-radius: 36px; padding: 12px; box-shadow: 0 10px 30px rgba(21, 23, 26, .25); max-width: 440px; width: 100%; margin: 0 auto; }
.phone-screen { background: var(--paper); border-radius: 26px; overflow: hidden; min-height: 640px; display: flex; flex-direction: column; }
.ph-bar { display: flex; justify-content: space-between; align-items: center; padding: 12px 18px; background: var(--wax); border-bottom: 1px solid var(--line); font-size: 13px; font-weight: 700; }
.ph-steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; padding: 12px 14px 4px; }
.ph-step { text-align: center; font-size: 11px; font-weight: 700; color: var(--muted); }
.ph-step i { display: block; height: 6px; border-radius: 3px; background: var(--line); margin-bottom: 4px; }
.ph-step.done i { background: var(--ok); }
.ph-step.cur i { background: var(--flame); }
.ph-step.cur { color: var(--flame-dark); }
.ph-body { padding: 12px 14px 18px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.ph-title { font-size: 22px; font-weight: 800; letter-spacing: -.02em; line-height: 1.15; }
.ph-hint { font-size: 14px; color: var(--ink-soft); }
.crumbs { display: grid; gap: 6px; }
.crumb { display: flex; align-items: center; justify-content: space-between; gap: 8px; background: var(--ok-soft); color: var(--ok); border-radius: 12px; padding: 8px 12px; font-weight: 700; font-size: 14px; }
.crumb button { border: 0; background: transparent; color: var(--ink-soft); text-decoration: underline; min-height: 36px; padding: 0 6px; font-size: 13px; }
.big-btn {
  display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: 2px; width: 100%; min-height: 76px; padding: 12px 18px;
  border: 2px solid var(--line-strong); border-radius: 18px; background: #fff; font-size: 19px; font-weight: 800; text-align: left;
}
.big-btn small { font-size: 13px; font-weight: 500; color: var(--muted); }
.big-btn:hover { border-color: var(--flame); background: var(--flame-soft); }
.big-btn:active { transform: scale(.985); }
.big-btn.sel { border-color: var(--ink); background: var(--flame); color: var(--ink); }
.big-btn.sel small { color: #3A2600; }
.big-btn.qty { min-height: 92px; align-items: center; font-size: 34px; text-align: center; }
.big-btn.qty small { font-size: 14px; font-weight: 600; }
.big-btn.confirm { background: var(--ok); border-color: var(--ok); color: #fff; align-items: center; font-size: 22px; min-height: 84px; }
.big-btn.confirm:hover { background: #335838; }
.big-btn.confirm:disabled { opacity: .4; cursor: not-allowed; }
.pgrid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.pgrid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.pgrid3 .big-btn { min-height: 72px; font-size: 18px; padding: 8px 10px; }
.pgrid3 .big-btn small { font-size: 11px; line-height: 1.2; }
.viewfinder { position: relative; height: 150px; border-radius: 18px; background: var(--deep); overflow: hidden; display: grid; place-items: center; color: #FEDE04; }
.viewfinder::before, .viewfinder::after { content: ""; position: absolute; inset: 24px 56px; border: 3px solid #FEDE04; border-radius: 14px; opacity: .6; }
.viewfinder.scanning::after { border-color: #7CE0A0; opacity: 1; }
.scanline { position: absolute; left: 56px; right: 56px; top: 24px; height: 3px; background: #7CE0A0; box-shadow: 0 0 14px #7CE0A0; animation: scan .8s ease-in-out infinite alternate; }
@keyframes scan { from { top: 26px; } to { top: 120px; } }
.summary-list { display: grid; gap: 4px; background: var(--wax); border-radius: 14px; padding: 12px 14px; font-size: 14px; }
.summary-list div { display: flex; justify-content: space-between; gap: 12px; }
.summary-list b { text-align: right; }
.done-card { text-align: center; display: grid; gap: 12px; padding: 18px 8px; }
.done-badge { width: 76px; height: 76px; margin: 0 auto; border-radius: 50%; background: var(--ok-soft); color: var(--ok); display: grid; place-items: center; }
.done-badge .ico { width: 40px; height: 40px; stroke-width: 2.4; }
.done-badge.warn { background: var(--warn-soft); color: var(--warn); }

.timeline { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 0; position: relative; }
.tl-step { position: relative; padding: 0 8px; text-align: center; font-size: 13px; }
.tl-step::before { content: ""; position: absolute; top: 17px; left: -50%; width: 100%; height: 3px; background: var(--line); z-index: 0; }
.tl-step:first-child::before { display: none; }
.tl-step.done::before { background: var(--ok); }
.tl-dot { position: relative; z-index: 1; width: 36px; height: 36px; border-radius: 50%; margin: 0 auto 8px; background: var(--wax); border: 2px solid var(--line-strong); display: grid; place-items: center; color: var(--muted); }
.tl-step.done .tl-dot { background: var(--ok); border-color: var(--ok); color: #fff; }
.tl-step.omit .tl-dot { background: var(--bad-soft); border-color: var(--bad); color: var(--bad); }
.tl-step b { display: block; }
.tl-step span { display: block; color: var(--muted); font-size: 12px; }
.cchips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 18px; }
.cchip { border: 1px solid var(--line-strong); background: #fff; border-radius: 999px; min-height: 34px; padding: 3px 12px; font-weight: 700; font-size: 13px; display: inline-flex; align-items: center; gap: 6px; }
.cchip.sel { background: var(--deep); color: #fff; border-color: var(--deep); }
.cchip i { width: 8px; height: 8px; border-radius: 50%; background: var(--bad); }
.alert-item { display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 12px; padding: 14px 20px; border-bottom: 1px solid var(--line); }
.alert-item:last-child { border-bottom: 0; }
.alert-item.closed { opacity: .55; }
.alert-ico { width: 34px; height: 34px; border-radius: 10px; background: var(--bad-soft); color: var(--bad); display: grid; place-items: center; }
.alert-item.closed .alert-ico { background: var(--ok-soft); color: var(--ok); }
.alert-item b { display: block; }

/* ---------- Facturación ---------- */
.fact-input { width: 100%; min-width: 110px; }
.run-log { background: var(--deep); color: #DDE1E6; border-radius: 12px; padding: 14px 16px; font-family: var(--mono); font-size: 12.5px; line-height: 1.6; min-height: 150px; max-height: 280px; overflow: auto; }
.run-log .t { color: #8B93A0; }
.run-log .e { color: #FF9A9F; }
.run-log .g { color: #8FE0AE; }
pre.preview { background: var(--wax); border: 1px solid var(--line); border-radius: 10px; padding: 12px; overflow-x: auto; font-size: 12px; line-height: 1.5; margin: 6px 0 0; font-family: var(--mono); max-width: 100%; white-space: pre; }

/* ---------- Despachos ---------- */
.kanban { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
.kcol { background: var(--wax); border-radius: 14px; padding: 12px; min-width: 0; }
.kcol h4 { font-size: 13px; display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.kcol h4 span { background: var(--card); border-radius: 999px; padding: 0 9px; font-size: 12px; }
.kcard { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 7px 10px; margin-bottom: 6px; font-size: 13px; }
.kcard b { display: block; font-variant-numeric: tabular-nums; }
.kcard span { color: var(--muted); font-size: 12px; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kmore { font-size: 12px; color: var(--muted); text-align: center; }
.stickers { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.sticker { background: #fff; border: 2px dashed var(--ink); border-radius: 10px; padding: 12px 14px; color: #000; break-inside: avoid; }
.st-top { display: flex; justify-content: space-between; align-items: baseline; font-size: 12px; border-bottom: 2px solid #000; padding-bottom: 4px; margin-bottom: 8px; }
.st-top b { font-size: 15px; letter-spacing: -.01em; }
.st-main { display: grid; grid-template-columns: minmax(0, 1fr) 96px; gap: 12px; align-items: center; }
.st-no { font-size: 34px; font-weight: 800; letter-spacing: -.03em; line-height: 1; font-variant-numeric: tabular-nums; }
.st-name { font-size: 16px; font-weight: 800; margin-top: 6px; line-height: 1.2; }
.st-line { font-size: 13px; line-height: 1.3; }
.st-foot { margin-top: 8px; padding-top: 5px; border-top: 1px solid #000; font-size: 11px; display: flex; justify-content: space-between; gap: 6px; flex-wrap: wrap; }
.st-qr svg { width: 96px; height: 96px; display: block; }
.verify-result { border-radius: 18px; padding: 22px; text-align: center; display: grid; gap: 6px; justify-items: center; }
.verify-result.ok { background: var(--ok-soft); color: var(--ok); border: 2px solid #A9C7A3; }
.verify-result.bad { background: var(--bad-soft); color: var(--bad); border: 2px solid #E7BDB4; }
.verify-result h3 { font-size: 28px; letter-spacing: -.02em; }
.verify-result .ico { width: 44px; height: 44px; stroke-width: 2.4; }
.wa-phone { background: #E3DFD3; border-radius: 16px; padding: 14px; }
.wa-bub { background: #fff; border-radius: 12px 12px 12px 4px; padding: 10px 12px; font-size: 14.5px; line-height: 1.45; box-shadow: 0 1px 1px rgba(0, 0, 0, .1); white-space: pre-line; overflow-wrap: anywhere; max-width: 100%; }
.wa-bub small { display: flex; justify-content: flex-end; gap: 4px; color: var(--muted); font-size: 11px; margin-top: 4px; }
.wa-link { color: #1F6AA5; text-decoration: underline; }
.list-pick { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--card); max-height: 420px; overflow-y: auto; }
.list-pick button { display: flex; justify-content: space-between; align-items: center; gap: 8px; width: 100%; text-align: left; border: 0; border-bottom: 1px solid var(--line); background: transparent; padding: 10px 14px; min-height: 52px; }
.list-pick button:last-child { border-bottom: 0; }
.list-pick button:hover { background: var(--wax); }
.list-pick button.sel { background: var(--flame-soft); }
.stepper { display: flex; gap: 3px; }
.stepper i { width: 18px; height: 5px; border-radius: 3px; background: var(--line); }
.stepper i.on { background: var(--flame); }
.stepper.bad i.on { background: var(--bad); }
.stepper.ok i.on { background: var(--ok); }
.check { width: 20px; height: 20px; accent-color: var(--flame); }
.switch { display: inline-flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 600; cursor: pointer; min-height: 40px; }
.switch input { width: 20px; height: 20px; accent-color: var(--flame); }
.filters { display: flex; flex-wrap: wrap; gap: 6px; }
.filters button { border: 1px solid var(--line-strong); background: #fff; border-radius: 999px; min-height: 34px; padding: 3px 14px; font-size: 13px; font-weight: 600; }
.filters button.sel { background: var(--deep); border-color: var(--deep); color: #fff; }

.toast-wrap { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 400; display: grid; gap: 8px; width: min(420px, calc(100vw - 32px)); pointer-events: none; }
.toast { background: var(--deep); color: #fff; padding: 12px 16px; border-radius: 12px; box-shadow: 0 8px 24px rgba(0, 0, 0, .25); font-size: 14px; animation: fade .2s ease; }
.toast.bad { background: var(--bad); }
.toast.ok { background: var(--ok); }
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 3px solid var(--line-strong); border-top-color: var(--flame); animation: spin .7s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.empty { padding: 28px 20px; text-align: center; color: var(--muted); }

/* ---------- Responsive ---------- */
@media (max-width: 1180px) {
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .kpis.k4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mod-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kanban { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 960px) {
  .sidebar { transform: translateX(-102%); transition: transform .25s ease; box-shadow: 6px 0 30px rgba(21, 23, 26, .2); width: min(300px, 86vw); }
  body.nav-open .sidebar { transform: none; }
  .backdrop { display: block; position: fixed; inset: 0; background: rgba(21, 23, 26, .45); z-index: 65; opacity: 0; pointer-events: none; transition: opacity .2s; }
  body.nav-open .backdrop { opacity: 1; pointer-events: auto; }
  .topbar { display: flex; align-items: center; gap: 12px; position: sticky; top: 0; z-index: 50; padding: 8px 14px; background: var(--wax); border-bottom: 1px solid var(--line); }
  .icon-btn { width: 46px; height: 46px; border-radius: 12px; border: 1px solid var(--line-strong); background: var(--card); display: grid; place-items: center; }
  .topbar .t-name { font-weight: 700; font-size: 17px; }
  .topbar .demo-tag { margin-left: auto; }
  .main { margin-left: 0; padding: 20px 16px 56px; }
  .g2, .g3, .split-a, .split-b, .split-c { grid-template-columns: minmax(0, 1fr); }
  .puesto-wrap { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 760px) {
  .chat-layout { grid-template-columns: minmax(0, 1fr); height: calc(100vh - 92px); height: calc(100dvh - 92px); min-height: 420px; scroll-margin-top: 70px; }
  .conv-head { padding: 8px 12px; gap: 8px; }
  .conv-head .grow .xs { display: none; }
  .chat-layout .conv { display: none; }
  .chat-layout.show-chat .inbox { display: none; }
  .chat-layout.show-chat .conv { display: flex; }
  .inbox { border-right: 0; }
  .back-btn { display: inline-flex; }
  .bub { max-width: 90%; }
  table.stack, .stack thead, .stack tbody, .stack tr, .stack td { display: block; width: 100%; }
  .stack thead { display: none; }
  .stack tr { border-bottom: 1px solid var(--line-strong); padding: 10px 14px; }
  .stack tr:last-child { border-bottom: 0; }
  .stack td { display: flex; justify-content: space-between; align-items: center; gap: 12px; border: 0 !important; padding: 5px 0 !important; background: transparent !important; text-align: right; }
  .stack td::before { content: attr(data-l); font-size: 12px; font-weight: 700; color: var(--muted); text-align: left; flex: none; max-width: 40%; }
  .stack td.nolabel::before { display: none; }
  .stack td .fact-input { width: 62%; min-width: 0; }
  .stack td .input { text-align: left; }
  .stack tr.warnrow, .stack tr.badrow { background: #FFF6F0; }
  .tbl .num { text-align: right; }
  .timeline { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .tl-step { display: grid; grid-template-columns: 36px minmax(0, 1fr); gap: 12px; text-align: left; padding: 0; align-items: center; }
  .tl-step::before { display: none; }
  .tl-dot { margin: 0; }
  .kanban { grid-template-columns: minmax(0, 1fr); }
  .bar-row { grid-template-columns: 96px minmax(0, 1fr) 46px; }
  .page-head h1 { font-size: 24px; }
  .kpis, .kpis.k4 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi { padding: 12px 14px; }
  .kpi .k-num { font-size: 26px; }
  .mod-grid { grid-template-columns: minmax(0, 1fr); }
  .g4 { grid-template-columns: minmax(0, 1fr); }
  .card-head, .card-body { padding-left: 16px; padding-right: 16px; }
  .attn li { padding-left: 16px; padding-right: 16px; flex-wrap: wrap; }
  .alert-item { padding-left: 16px; padding-right: 16px; }
  .qa-item { padding-left: 16px; padding-right: 16px; }
  .stickers { grid-template-columns: minmax(0, 1fr); }
  .btn-resp { width: 100%; }
}
@media (max-width: 440px) {
  .topbar .demo-tag { font-size: 11px; padding: 3px 8px; }
  .phone { border-radius: 28px; padding: 8px; }
  .phone-screen { border-radius: 22px; min-height: 600px; }
  .big-btn.qty { font-size: 30px; }
}

/* ---------- Impresión de stickers ---------- */
@media print {
  @page { size: A4; margin: 10mm; }
  body { background: #fff; }
  body.print-stickers * { visibility: hidden !important; }
  body.print-stickers #sticker-sheet, body.print-stickers #sticker-sheet * { visibility: visible !important; }
  body.print-stickers #sticker-sheet { position: absolute; left: 0; top: 0; width: 100%; display: grid; grid-template-columns: repeat(2, 1fr); gap: 6mm; }
  body.print-stickers .sticker { border-color: #000; }
  .sidebar, .topbar, .toast-wrap { display: none !important; }
  .main { margin: 0; padding: 0; }
}

/* =========================================================
   Identidad v2: tinta, veladora y llama
   ========================================================= */
body { font-optical-sizing: auto; }
h1, h2, h3, .brand-name, .kpi .k-num, .st-no, .ph-title { font-family: var(--sans); }

/* Barra lateral oscura */
.sidebar { background: var(--ink); border-right: 0; color: #fff; }
.brand { padding: 20px 16px 6px; display: block; }
.brand-logo { display: block; width: 100%; height: auto; background: #fff; border-radius: 14px; padding: 8px 12px; }
.brand-mark { width: 38px; height: 38px; border-radius: 11px; background: var(--veladora); color: #FEDE04; box-shadow: inset 0 -10px 16px rgba(0, 0, 0, .18); }
.brand-mark .ico { stroke-width: 1.9; }
@keyframes flicker { 0%, 100% { transform: scale(1, 1) rotate(0); } 18% { transform: scale(.96, 1.06) rotate(-2deg); } 36% { transform: scale(1.03, .97) rotate(1.5deg); } 62% { transform: scale(.98, 1.05) rotate(-1deg); } 80% { transform: scale(1.02, .99) rotate(1deg); } }
.brand-name { color: #fff; font-stretch: 112%; font-weight: 800; letter-spacing: -.01em; }
.brand-sub { color: #8B909A; font-size: 12px; margin: 10px 4px 0; }
.nav { padding: 6px 12px 14px; gap: 2px; }
.nav-label { color: #8B909A; font-family: var(--sans); font-weight: 600; letter-spacing: .1em; padding: 16px 12px 6px; }
.nav a { color: #D3D6DB; border-radius: 9px; position: relative; }
.nav a small { color: #858A94; }
.nav a .ico { color: #858A94; }
.nav a:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.nav a.active { background: rgba(255, 255, 255, .09); color: #fff; box-shadow: none; }
.nav a.active::before { content: ""; position: absolute; left: -12px; top: 10px; bottom: 10px; width: 4px; border-radius: 0 4px 4px 0; background: var(--flame); box-shadow: 0 0 14px rgba(254, 222, 4, .75); }
.nav a.active .ico { color: var(--flame); }
.nav a.active small { color: #A9AEB7; }
.sidebar-foot { border-top: 1px solid rgba(255, 255, 255, .09); color: #858A94; }
.sidebar .demo-tag { background: rgba(255, 255, 255, .07); border-color: rgba(255, 255, 255, .12); color: #E6E8EB; font-size: 12px; }

/* Encabezados */
.eyebrow { font-family: var(--sans); font-weight: 700; letter-spacing: .1em; color: var(--veladora); display: inline-flex; align-items: center; gap: 8px; }
.eyebrow::before { content: ""; width: 18px; height: 2px; background: var(--veladora); }
.page-head h1 { font-family: var(--serif); font-size: clamp(32px, 3.8vw, 46px); font-weight: 600; letter-spacing: -.015em; line-height: 1.05; }
.lead { font-size: 15.5px; }
.card-head h2, .card-head h3 { font-family: var(--serif); font-weight: 700; font-size: 20px; letter-spacing: 0; }
h2[style] { font-family: var(--serif); font-weight: 700; font-size: 24px !important; }

/* Tarjetas y datos */
.card, .kpi, .mod-card { border-radius: 14px; border-color: #DEDBD3; }
.kpi { position: relative; overflow: hidden; transition: border-color .15s, transform .15s; }
.kpi::before { content: ""; position: absolute; left: 0; top: 0; width: 100%; height: 4px; background: var(--ink); }
.kpi.flame::before { background: var(--flame); }
.kpi.alert::before { background: var(--veladora); }
a.kpi:hover { transform: translateY(-2px); border-color: var(--ink); }
.kpi .k-label { font-weight: 600; font-size: 12px; letter-spacing: .04em; text-transform: uppercase; }
.kpi .k-num { font-weight: 700; font-size: 36px; letter-spacing: -.03em; }
.kpi.flame .k-num { color: var(--ink); }
.kpi.alert .k-num { color: var(--veladora); }
.mod-card { transition: transform .15s, border-color .15s, box-shadow .15s; }
.mod-card:hover { border-color: var(--ink); transform: translateY(-2px); box-shadow: 0 10px 24px rgba(21, 23, 26, .08); }
.mod-card .m-ico { background: var(--veladora); color: #fff; border-radius: 11px; }
.mod-card h3 { font-family: var(--serif); font-weight: 700; font-size: 20px; }
.mod-card .m-stat { font-size: 12.5px; }
.tbl th { font-weight: 600; letter-spacing: .06em; }
.tbl td.num, .mono, .conv-top time, .st-top, .bar-val { font-family: var(--mono); }
.bar-val { font-weight: 700; font-size: 12.5px; }
.chip { font-family: var(--sans); font-stretch: 100%; font-weight: 650; }
.chip-flame { background: var(--flame-soft); color: var(--flame-dark); }
.tabs { background: #E4E2DC; }
.tab.active { box-shadow: 0 1px 3px rgba(21, 23, 26, .12); }
.btn { border-radius: 9px; font-weight: 650; }
.btn-dark { background: var(--ink); }
.attn .dot { background: var(--flame); box-shadow: 0 0 0 4px rgba(254, 222, 4, .3); }
.attn .dot.bad { background: var(--veladora); box-shadow: 0 0 0 4px rgba(227, 22, 16, .16); }
.attn .dot.ok { box-shadow: 0 0 0 4px rgba(30, 122, 79, .14); }
.banner { background: var(--flame-soft); }

/* Chat */
.bub.asesor { background: var(--ink); }
.bub.cliente { color: #2B2500; }
.bub .who { font-weight: 700; letter-spacing: .04em; text-transform: uppercase; font-size: 10.5px; color: var(--flame-dark); }
.avatar.live { background: var(--ink); color: var(--flame); }
.conv-item.active { background: var(--flame-soft); box-shadow: inset 3px 0 0 var(--flame); }

/* Producción */
.phone { background: #0E1013; box-shadow: 0 24px 48px rgba(21, 23, 26, .28), inset 0 0 0 1px rgba(255, 255, 255, .06); }
.ph-bar { background: var(--ink); color: #fff; border-bottom: 0; font-family: var(--mono); font-weight: 500; letter-spacing: .02em; }
.ph-title { font-weight: 800; }
.big-btn { border-width: 2px; border-color: var(--line-strong); }
.big-btn:hover { background: var(--flame-soft); border-color: var(--ink); }
.big-btn small { font-weight: 500; font-size: 12.5px; }
.viewfinder { background: #0E1013; color: #FEDE04; }
.ph-step.cur { color: var(--ink); }
.ph-step.cur i { background: var(--flame); }
.crumb { border-radius: 10px; }
.tl-dot { background: var(--wax); }

/* Despachos */
.kcol { background: #E7E5DF; }
.sticker { border: 2px dashed var(--ink); border-radius: 6px; }
.st-top, .st-foot { font-family: var(--mono); }
.st-no { font-family: var(--sans); font-weight: 800; }
.wa-phone { background: #D9D5C8; }
.verify-result h3 { font-weight: 800; }

/* Tablas y consola */
.run-log { background: #0E1013; color: #DDE1E6; border: 1px solid #23262B; }
pre.preview { background: #F6F5F2; }

@media (prefers-reduced-motion: reduce) {
  .brand-mark .ico { animation: none; }
  .kpi, .mod-card { transition: none; }
}
@media (max-width: 960px) {
  .topbar { background: var(--ink); border-bottom: 0; color: #fff; }
  .topbar .t-name { font-family: var(--serif); font-weight: 700; font-size: 19px; }
  .topbar .icon-btn { background: rgba(255, 255, 255, .08); border-color: rgba(255, 255, 255, .16); color: #fff; }
  .topbar .demo-tag { background: rgba(255, 255, 255, .08); border-color: rgba(255, 255, 255, .14); color: #E6E8EB; }
  .nav a.active::before { left: -12px; }
}
@media (max-width: 960px) {
  .topbar .t-name, .topbar .demo-tag { white-space: nowrap; }
}
@media (max-width: 440px) {
  .topbar .demo-tag { font-size: 10px; padding: 3px 8px; }
}

/* =========================================================
   Funciones nuevas: camino de pedidos, bodega, códigos QR,
   año contra año, conocimiento, historial y ahorro
   ========================================================= */

/* ---------- Inicio: camino de los pedidos ---------- */
.path { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 18px; margin-bottom: 22px; }
.path-step { position: relative; display: grid; align-content: start; gap: 6px; padding: 14px 16px; background: var(--card); border: 1px solid #DEDBD3; border-radius: 14px; box-shadow: var(--shadow); text-decoration: none; color: inherit; min-width: 0; }
.path-step:hover { border-color: var(--ink); }
.path-step:not(:last-child)::after { content: "›"; position: absolute; right: -14px; top: 50%; transform: translateY(-50%); font-size: 24px; line-height: 1; color: var(--line-strong); }
.path-step .ps-top { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 14px; }
.ps-n { width: 24px; height: 24px; flex: none; border-radius: 50%; background: var(--wax); color: var(--ink-soft); display: grid; place-items: center; font-size: 12px; font-family: var(--mono); }
.ps-n .ico { width: 14px; height: 14px; stroke-width: 2.6; }
.path-step.done .ps-n { background: var(--ok); color: #fff; }
.path-step.part .ps-n { background: var(--flame); color: var(--ink); }
.ps-big { font-size: 30px; font-weight: 700; letter-spacing: -.03em; line-height: 1.05; font-variant-numeric: tabular-nums; }
.ps-big small { font-size: 13px; font-weight: 500; color: var(--muted); letter-spacing: 0; }
.ps-sub { font-size: 12px; color: var(--muted); }
.path-step .bar-track { display: block; height: 8px; }
.path-step .bar-fill { display: block; }
.path-step.done .bar-fill { background: var(--ok); }

/* ---------- Bodega ---------- */
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12.5px; color: var(--ink-soft); margin-bottom: 14px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.sw { display: inline-block; width: 14px; height: 14px; border-radius: 4px; border: 2px solid var(--line-strong); background: #fff; }
.sw.lvl1 { background: var(--flame-soft); border-color: #E8D66A; }
.sw.lvl2 { background: var(--ink); border-color: var(--ink); }
.sw.hit { border-color: var(--veladora); box-shadow: 0 0 0 2px rgba(227, 22, 16, .3); }
.sw.yb-past { background: #CFCBC0; border-color: #CFCBC0; }
.sw.yb-now { background: var(--ink); border-color: var(--ink); }
.sw.yb-exp { border-color: var(--ink); background: repeating-linear-gradient(135deg, #fff 0 3px, var(--flame) 3px 6px); }
.bmap { display: grid; gap: 22px; }
.bodega h3 { font-family: var(--serif); font-size: 19px; margin-bottom: 8px; }
.aisle { margin-bottom: 12px; }
.aisle-name { display: block; font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }
.racks { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 6px; }
.rack { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; min-height: 58px; min-width: 0; padding: 4px 2px; border: 2px solid var(--line-strong); border-radius: 10px; background: #fff; color: var(--ink); font-family: var(--mono); }
.rack b { font-size: 14px; }
.rack span { font-size: 11px; color: var(--muted); }
.rack.lvl1 { background: var(--flame-soft); border-color: #E8D66A; }
.rack.lvl2 { background: var(--ink); border-color: var(--ink); color: #fff; }
.rack.lvl2 span { color: #C9CCD2; }
.rack:hover { border-color: var(--ink); }
.rack.lvl2:hover { border-color: var(--flame); }
.rack.hit { border-color: var(--veladora); box-shadow: 0 0 0 3px rgba(227, 22, 16, .35); }
.rack.sel { border-color: var(--ink); box-shadow: 0 0 0 3px var(--flame), 0 4px 10px rgba(21, 23, 26, .25); }
.rack.lvl2.sel { border-color: #fff; }
.rack.dim { opacity: .4; }
.lot-item { display: grid; gap: 3px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.lot-item:last-child { border-bottom: 0; padding-bottom: 0; }
.lot-item.is-hit { background: var(--flame-soft); margin: 0 -20px; padding: 12px 20px; }

/* ---------- Códigos QR ---------- */
.qr-sheet { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
.qr-card { background: #fff; border: 2px dashed var(--ink); border-radius: 10px; overflow: hidden; text-align: center; break-inside: avoid; color: #000; }
.qc-top { display: flex; justify-content: space-between; align-items: center; gap: 6px; padding: 6px 10px; background: var(--ink); color: #fff; font-size: 11px; text-align: left; }
.qc-top b { font-weight: 700; }
.qc-top span { font-family: var(--mono); text-transform: uppercase; letter-spacing: .06em; white-space: nowrap; }
.qr-card.k-machines .qc-top { background: var(--veladora); }
.qr-card.k-canastas .qc-top { background: var(--flame); color: var(--ink); }
.qc-qr { width: min(130px, 72%); margin: 12px auto 6px; }
.qc-qr svg { display: block; width: 100%; height: auto; }
.qc-name { font-weight: 800; font-size: 16px; line-height: 1.2; padding: 0 8px; }
.qc-code { font-family: var(--mono); font-size: 12px; margin-top: 2px; }
.qc-sub { font-size: 12px; color: var(--muted); padding: 2px 8px 0; }
.qc-live { margin: 8px 10px 0; font-size: 11.5px; font-weight: 600; color: var(--ink-soft); background: var(--wax); border-radius: 999px; padding: 2px 8px; display: inline-block; }
.qr-card::after { content: ""; display: block; height: 12px; }

/* ---------- Año contra año ---------- */
.yoy { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; align-items: end; border-bottom: 2px solid var(--ink); padding-bottom: 0; }
.yoy-grp { display: grid; gap: 2px; justify-items: center; text-align: center; min-width: 0; padding-bottom: 0; }
.yoy-grp b { margin-top: 8px; font-size: 14px; }
.yoy-grp span { font-size: 11.5px; line-height: 1.3; font-variant-numeric: tabular-nums; }
.yoy-bars { display: flex; align-items: flex-end; justify-content: center; gap: 6px; height: 190px; width: 100%; }
.yb { display: block; width: 40%; max-width: 48px; border-radius: 6px 6px 0 0; }
.yb.past { background: #CFCBC0; }
.yb.now { background: var(--ink); }
.yb.exp { background: repeating-linear-gradient(135deg, #fff 0 4px, var(--flame) 4px 8px); border: 2px solid var(--ink); border-bottom: 0; }

/* ---------- Conocimiento ---------- */
.kb-grid { align-items: start; }
.kb-prog { display: flex; align-items: center; gap: 12px; }
.kb-prog .bar-track { flex: 1 1 auto; height: 12px; }
.kb-prog b { font-family: var(--mono); font-size: 13px; white-space: nowrap; }
.kb-form { display: grid; gap: 10px; padding: 16px 20px; border-bottom: 1px solid var(--line); background: #FAFAF8; }
textarea.input { resize: vertical; min-height: 76px; line-height: 1.4; }
.kb-scroll { max-height: 560px; overflow-y: auto; }
.kb-item, .kb-gap { display: grid; gap: 10px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.kb-item:last-child, .kb-gap:last-child { border-bottom: 0; }
.kb-gap.is-done { background: #F7FAF8; }
.kb-note { font-size: 14px; background: var(--warn-soft); color: #4A3200; border-radius: 10px; padding: 8px 12px; }
.kb-note .btn { margin-left: 4px; }
.kb-teach { display: grid; gap: 8px; justify-items: start; }
.kb-teach .field { width: 100%; }
.kb-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.kb-steps li { border-radius: 10px; }
.kb-steps li:hover { background: var(--wax); }
.kb-steps label { display: grid; grid-template-columns: 24px minmax(0, 1fr); gap: 12px; align-items: start; padding: 10px; cursor: pointer; min-height: 48px; }
.kb-steps small { display: block; font-size: 12.5px; color: var(--muted); margin-top: 1px; }
.kb-steps li.done b { text-decoration: line-through; text-decoration-color: var(--line-strong); color: var(--ink-soft); }
.kb-steps .check { margin-top: 1px; }

/* ---------- Facturas: historial y ahorro ---------- */
.save-num { font-family: var(--mono); font-size: 34px; font-weight: 700; letter-spacing: -.03em; line-height: 1.1; }
input[type="number"].input { font-variant-numeric: tabular-nums; }
.city-filter { min-width: 190px; }
.city-filter .input { min-height: 42px; }

@media (max-width: 1180px) {
  .path { gap: 14px; }
  .path-step { padding: 12px 12px; }
  .path-step:not(:last-child)::after { right: -12px; font-size: 20px; }
  .ps-big { font-size: 26px; }
}
@media (max-width: 960px) {
  .path { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .path-step:not(:last-child)::after { display: none; }
}
@media (max-width: 760px) {
  .path { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .path-step { grid-template-columns: minmax(0, 1fr) auto; column-gap: 12px; row-gap: 4px; }
  .path-step .ps-top { grid-column: 1; }
  .path-step .ps-big { grid-column: 2; grid-row: 1 / span 2; align-self: center; text-align: right; }
  .path-step .bar-track { grid-column: 1 / -1; }
  .path-step .ps-sub { grid-column: 1; }
  .racks { gap: 4px; }
  .rack { min-height: 56px; }
  .qr-sheet { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .qc-top { flex-direction: column; align-items: flex-start; gap: 0; }
  .yoy { gap: 6px; }
  .yoy-bars { height: 150px; gap: 3px; }
  .yoy-grp span { font-size: 10.5px; }
  .yoy-grp b { font-size: 12.5px; }
  .kb-item, .kb-gap, .kb-form { padding-left: 16px; padding-right: 16px; }
  .lot-item.is-hit { margin: 0 -16px; padding: 12px 16px; }
  .city-filter { width: 100%; }
  .save-num { font-size: 28px; }
}
@media (prefers-reduced-motion: reduce) {
  .bar-fill, .rack, .path-step { transition: none; }
  .view.active { animation: none; }
}

/* ---------- Impresión de carnets y placas ---------- */
@media print {
  body.print-qr * { visibility: hidden !important; }
  body.print-qr #qr-sheet, body.print-qr #qr-sheet * { visibility: visible !important; }
  body.print-qr #qr-sheet { position: absolute; left: 0; top: 0; width: 100%; display: grid; grid-template-columns: repeat(3, 1fr); gap: 5mm; }
  body.print-qr .qr-card { border-color: #000; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  body.print-qr .qc-live { display: none; }
}

@media (max-width: 440px) {
  .topbar .demo-tag { max-width: 150px; overflow: hidden; text-overflow: ellipsis; }
}
