:root {
  --bg: #f6f5f2;
  --panel: #ffffff;
  --ink: #1d1d1b;
  --muted: #6b6a66;
  --line: #e6e3dc;
  --brand: #1f5f4a;
  --brand-ink: #ffffff;
  --brand-soft: #e5f0eb;
  --ok: #1f7a4d;   --ok-soft: #e3f4ea;
  --warn: #9a6400; --warn-soft: #fdf1d8;
  --bad: #b3261e;  --bad-soft: #fbe5e3;
  --info: #2457a6; --info-soft: #e4ecf9;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 6px 24px rgba(0,0,0,.06);
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--ink); font-size: 15px; line-height: 1.5; }
a { color: var(--brand); }
h1, h2, h3 { line-height: 1.2; margin: 0; }
.muted { color: var(--muted); }
[hidden] { display: none !important; }

/* ---------- Botones e inputs ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--line); background: var(--panel); color: var(--ink);
  padding: 9px 14px; border-radius: 10px; font: inherit; font-weight: 500; cursor: pointer;
  text-decoration: none; white-space: nowrap; transition: background .15s, border-color .15s;
}
.btn:hover { border-color: #cfcbc2; background: #faf9f6; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: rgba(0,0,0,.05); }
.btn.danger { color: var(--bad); }
.btn.sm { padding: 5px 10px; font-size: 13px; border-radius: 8px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.icon-btn { border: 0; background: transparent; font-size: 20px; cursor: pointer; padding: 4px 8px; border-radius: 8px; }
.icon-btn:hover { background: rgba(0,0,0,.06); }

label { display: grid; gap: 5px; font-size: 13px; font-weight: 600; color: #3c3b38; }
input, textarea, select {
  font: inherit; color: var(--ink); background: #fff; border: 1px solid var(--line);
  border-radius: 10px; padding: 9px 11px; width: 100%; font-weight: 400;
}
input:focus, textarea:focus, select:focus { outline: 2px solid var(--brand-soft); border-color: var(--brand); }
textarea { resize: vertical; }
.hint { font-size: 12px; color: var(--muted); font-weight: 400; }

.alert { padding: 10px 12px; border-radius: 10px; background: var(--bad-soft); color: var(--bad); font-size: 14px; }
.alert.ok { background: var(--ok-soft); color: var(--ok); }

.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.off { background: #ecebe7; color: #5d5c58; }
.badge.info { background: var(--info-soft); color: var(--info); }

.logo {
  width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center;
  background: var(--brand); color: #fff; font-size: 18px; flex: none;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand h1 { font-size: 20px; }

/* ---------- Login ---------- */
.auth-wrap { min-height: 100%; display: grid; place-items: center; padding: 24px 16px; }
.auth-card {
  width: 100%; max-width: 380px; background: var(--panel); border: 1px solid var(--line);
  border-radius: 16px; padding: 28px; box-shadow: var(--shadow); display: grid; gap: 16px;
}
.auth-card form { display: grid; gap: 14px; }

/* ---------- Chat ---------- */
.app { display: flex; height: 100%; overflow: hidden; }
.sidebar {
  width: 280px; flex: none; background: #fbfaf8; border-right: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 12px; padding: 14px;
}
.sidebar-head .brand span { font-weight: 700; }
.conv-list { flex: 1; overflow-y: auto; display: grid; align-content: start; gap: 2px; margin: 0 -6px; }
.conv-item {
  display: flex; align-items: center; gap: 6px; padding: 8px 10px; border-radius: 9px; cursor: pointer;
  font-size: 14px; color: #3c3b38;
}
.conv-item:hover { background: rgba(0,0,0,.05); }
.conv-item.active { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.conv-item .t { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv-item .x { opacity: 0; border: 0; background: none; cursor: pointer; color: var(--muted); font-size: 16px; padding: 0 4px; }
.conv-item:hover .x { opacity: 1; }
.conv-group { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 10px 10px 4px; font-weight: 600; }
.sidebar-foot { display: grid; gap: 6px; border-top: 1px solid var(--line); padding-top: 12px; }
.user-box { font-size: 13px; padding: 0 4px 6px; }
.user-box strong { display: block; font-size: 14px; }

.chat { flex: 1; display: flex; flex-direction: column; min-width: 0; background: var(--panel); }
.chat-head {
  display: flex; align-items: center; gap: 10px; padding: 12px 18px; border-bottom: 1px solid var(--line);
  font-weight: 600; min-height: 56px;
}
.chat-head #chatTitle { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#menuBtn { display: none; }
.notice { margin: 12px 18px 0; padding: 10px 14px; border-radius: 10px; background: var(--warn-soft); color: var(--warn); font-size: 14px; }

.messages { flex: 1; overflow-y: auto; padding: 24px 18px; }
.messages-inner { max-width: 780px; margin: 0 auto; display: grid; gap: 18px; }
.msg { display: flex; gap: 10px; }
.msg.user { justify-content: flex-end; }
.msg .bubble { max-width: 100%; }
.msg.user .bubble {
  background: var(--brand); color: #fff; padding: 10px 14px; border-radius: 16px 16px 4px 16px;
  max-width: 85%; white-space: pre-wrap; word-wrap: break-word;
}
.msg.assistant .avatar { width: 30px; height: 30px; font-size: 15px; border-radius: 9px; }
.msg.assistant .body { flex: 1; min-width: 0; }
.msg.assistant .bubble { padding-top: 3px; overflow-wrap: anywhere; }
.bubble p { margin: 0 0 .7em; }
.bubble p:last-child { margin-bottom: 0; }
.bubble ul, .bubble ol { margin: .3em 0 .8em; padding-left: 1.4em; }
.bubble li { margin: .2em 0; }
.bubble h1, .bubble h2, .bubble h3 { font-size: 1.05em; margin: 1em 0 .4em; }
.bubble table { border-collapse: collapse; margin: .6em 0; font-size: 14px; display: block; overflow-x: auto; }
.bubble th, .bubble td { border: 1px solid var(--line); padding: 6px 10px; text-align: left; vertical-align: top; }
.bubble th { background: #f6f5f2; }
.bubble code { background: #f1efea; padding: 1px 5px; border-radius: 5px; font-size: .92em; }
.bubble pre { background: #f1efea; padding: 12px; border-radius: 10px; overflow-x: auto; }
.bubble blockquote { border-left: 3px solid var(--line); margin: .5em 0; padding-left: 12px; color: #4a4945; }
.msg-actions { margin-top: 6px; display: flex; gap: 4px; }
.typing .bubble::after { content: "●●●"; letter-spacing: 2px; color: #b8b5ad; animation: blink 1.2s infinite; }
@keyframes blink { 50% { opacity: .35; } }

.empty { max-width: 640px; margin: 8vh auto 0; text-align: center; display: grid; gap: 18px; justify-items: center; }
.empty .logo { width: 52px; height: 52px; font-size: 26px; border-radius: 14px; }
.empty h2 { font-size: 22px; }
.chips { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; width: 100%; }
.chip {
  text-align: left; border: 1px solid var(--line); background: #fff; border-radius: 12px; padding: 12px 14px;
  cursor: pointer; font: inherit; font-size: 14px; color: var(--ink);
}
.chip:hover { border-color: var(--brand); background: var(--brand-soft); }
.chip b { display: block; font-size: 13px; color: var(--brand); margin-bottom: 2px; }

.composer-wrap { padding: 0 18px 14px; }
.composer {
  max-width: 780px; margin: 0 auto; display: flex; gap: 8px; align-items: flex-end;
  border: 1px solid var(--line); border-radius: 16px; padding: 8px; background: #fff; box-shadow: var(--shadow);
}
.composer textarea { border: 0; resize: none; max-height: 200px; padding: 8px; outline: none; }
.composer textarea:focus { outline: none; }
.disclaimer { text-align: center; font-size: 12px; color: var(--muted); margin: 8px 0 0; }

.blocked { min-height: 100%; display: grid; place-items: center; padding: 24px 16px; }

@media (max-width: 820px) {
  #menuBtn { display: inline-block; }
  .sidebar { position: fixed; inset: 0 auto 0 0; z-index: 20; transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow); }
  .sidebar.open { transform: none; }
  .scrim { position: fixed; inset: 0; background: rgba(0,0,0,.25); z-index: 15; }
  .messages { padding: 18px 14px; }
  .composer-wrap { padding: 0 10px 10px; }
}

/* ---------- Admin ---------- */
.admin-top {
  background: var(--panel); border-bottom: 1px solid var(--line); padding: 12px 20px;
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap; position: sticky; top: 0; z-index: 5;
}
.admin-top .spacer { flex: 1; }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.tab { border: 0; background: none; font: inherit; font-weight: 500; padding: 8px 12px; border-radius: 9px; cursor: pointer; color: var(--muted); }
.tab:hover { background: rgba(0,0,0,.05); color: var(--ink); }
.tab.active { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.admin-main { max-width: 1280px; margin: 0 auto; padding: 22px 20px 60px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; }
.section-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.section-head h2 { font-size: 20px; flex: 1; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.stat { cursor: pointer; transition: border-color .15s; }
.stat:hover { border-color: #cfcbc2; }
.stat.sel { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand); }
.stat .n { font-size: 28px; font-weight: 700; line-height: 1.1; }
.stat .l { font-size: 13px; color: var(--muted); }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.toolbar input { max-width: 320px; }
.toolbar select { width: auto; }
.table-wrap { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; padding: 10px 14px; border-bottom: 1px solid var(--line); background: #fbfaf8; white-space: nowrap; }
table.data td { padding: 11px 14px; border-bottom: 1px solid #f0eee9; vertical-align: middle; }
table.data tr:last-child td { border-bottom: 0; }
table.data .sub { font-size: 12px; color: var(--muted); }
table.data .actions { display: flex; gap: 4px; flex-wrap: nowrap; justify-content: flex-end; }
.empty-row { padding: 30px; text-align: center; color: var(--muted); }

.doc-list { display: grid; gap: 10px; }
.doc { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; display: flex; gap: 14px; align-items: flex-start; }
.doc .info { flex: 1; min-width: 0; }
.doc .title { font-weight: 600; }
.doc .prev { font-size: 13px; color: var(--muted); margin-top: 4px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.doc.off { opacity: .6; }
.switch { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 500; cursor: pointer; }
.switch input { width: auto; }
.meter { height: 8px; background: #ecebe7; border-radius: 99px; overflow: hidden; }
.meter > div { height: 100%; background: var(--brand); }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }
@media (max-width: 640px) { .form-grid { grid-template-columns: 1fr; } }

dialog {
  border: 0; border-radius: 16px; padding: 0; width: min(560px, calc(100vw - 32px));
  box-shadow: 0 20px 60px rgba(0,0,0,.25); color: var(--ink);
}
dialog::backdrop { background: rgba(20,20,18,.4); }
dialog form { padding: 22px; display: grid; gap: 14px; }
dialog h3 { font-size: 18px; }
dialog .foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
dialog.wide { width: min(860px, calc(100vw - 32px)); }

.toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: #1d1d1b; color: #fff;
  padding: 10px 16px; border-radius: 10px; font-size: 14px; z-index: 100; box-shadow: var(--shadow);
}
.toast.err { background: var(--bad); }
.preview-box { background: var(--brand-soft); color: var(--brand); padding: 10px 12px; border-radius: 10px; font-size: 14px; }

.sync-status { margin-top: 10px; font-size: 13px; color: var(--muted); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.sync-status.err { color: var(--bad); }
.src-tag { font-size: 11px; font-weight: 600; color: var(--ok); background: var(--ok-soft); padding: 1px 6px; border-radius: 6px; margin-left: 4px; }


/* ---------- Calculadora financiera ---------- */
.calc-main { max-width: 1280px; margin: 0 auto; padding: 22px 20px 20px; display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 26px; align-items: start; }
.calc-col { display: grid; gap: 14px; align-content: start; }
.calc-sticky { display: grid; gap: 14px; align-content: start; position: sticky; top: 76px; }
.calc-card h3 { font-size: 14px; margin: 0 0 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.calc-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; align-items: start; }
.calc-grid > label { align-content: start; }
.calc-note { font-size: 13px; color: var(--muted); margin: 12px 0 0; padding-top: 10px; border-top: 1px solid #f0eee9; }
.calc-foot { max-width: 1280px; margin: 0 auto; padding: 0 20px 40px; font-size: 12px; color: var(--muted); }

.price-card { background: var(--brand); border-color: var(--brand); color: #fff; }
.price-card.bad { background: var(--bad); border-color: var(--bad); }
.price-label { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; opacity: .8; }
.price-big { font-size: 40px; font-weight: 700; line-height: 1.1; margin-top: 2px; letter-spacing: -.02em; }
.price-sub { font-size: 12px; opacity: .85; margin-top: 4px; min-height: 16px; }
.price-split { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 14px; padding-top: 14px; border-top: 1px solid rgba(255,255,255,.25); }
.price-split .l { display: block; font-size: 12px; opacity: .8; }
.price-split strong { font-size: 20px; font-weight: 600; }

table.breakdown { width: 100%; border-collapse: collapse; font-size: 14px; }
table.breakdown td { padding: 7px 0; vertical-align: top; }
table.breakdown td.v { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; padding-left: 12px; }
table.breakdown tr.strong td { font-weight: 700; }
table.breakdown tr.neg td.v { color: var(--bad); }
table.breakdown tr.pos td.v { color: var(--ok); }
table.breakdown tr.sep td { padding: 0; border-top: 1px solid var(--line); height: 8px; }
table.breakdown .rh { display: block; font-size: 12px; color: var(--muted); font-weight: 400; }

.promo-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.chip-sm { border: 1px solid var(--line); background: #fff; color: var(--ink); font: inherit; font-size: 13px; padding: 5px 11px; border-radius: 999px; cursor: pointer; }
.chip-sm:hover { border-color: #cfcbc2; background: #faf9f6; }
.chip-sm.on { background: var(--brand-soft); border-color: var(--brand); color: var(--brand); font-weight: 600; }
.promo-card { border-left: 3px solid var(--brand); }
.promo-card.bad { border-left-color: var(--bad); }
.promo-verdict { margin: 12px 0 0; padding-top: 10px; border-top: 1px solid #f0eee9; font-size: 14px; }

@media (max-width: 900px) {
  .calc-main { grid-template-columns: minmax(0,1fr); gap: 16px; padding: 16px 14px; }
  .calc-sticky { position: static; }
  .price-big { font-size: 34px; }
}


/* ---------- Imágenes de productos ---------- */
.chat-img { display: block; margin: 10px 0; max-width: 340px; }
.chat-img img { display: block; width: 100%; height: auto; border-radius: 12px; border: 1px solid var(--line); background: #fff; }
.chat-img .btn { margin-top: 8px; display: inline-flex; text-decoration: none; }
.img-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; margin-top: 14px; }
.img-card { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.img-card img { width: 100%; aspect-ratio: 1 / 1; object-fit: contain; background: #f6f5f2; border-radius: 8px; }
.img-card .n { font-size: 13px; line-height: 1.3; word-break: break-word; min-height: 34px; }
.drop-zone { border: 2px dashed var(--line); border-radius: 12px; padding: 18px; text-align: center; color: var(--muted); margin: 10px 0; }
.drop-zone.over { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); }

/* ---------- Calculadora: botón Sugerido al público ---------- */
.sug-wrap { display: flex; flex-direction: column; gap: 6px; }
.sug-wrap .sug-label { font-size: 14px; font-weight: 500; }
.sug-wrap .btn { justify-content: center; }

/* ---------- Mi lista de precios ---------- */
.lista-main { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); gap: 24px; max-width: 1280px; margin: 0 auto; padding: 22px 20px 40px; }
.lista-tools { display: flex; gap: 8px; margin: 10px 0; flex-wrap: wrap; }
.lista-tools input { flex: 1; min-width: 180px; }
.lista-acciones { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.lista-productos { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.lp-marca { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; background: var(--brand-soft); border-top: 1px solid var(--line); font-size: 14px; }
.lp-marca:first-child { border-top: 0; }
.lp-fila { display: grid; grid-template-columns: minmax(0, 1fr) auto 120px; gap: 10px; align-items: center; padding: 9px 14px; border-top: 1px solid var(--line); font-size: 14px; }
.lp-fila.off { opacity: .45; }
.lp-fila.pierde { background: #fdecea; }
.lp-nombre { display: flex; gap: 8px; align-items: flex-start; cursor: pointer; }
.lp-nombre input, .lp-marca input { width: auto; margin-top: 3px; }
.lp-datos { display: flex; flex-direction: column; align-items: flex-end; font-size: 12px; text-align: right; }
.lp-datos .pos { color: var(--brand); } .lp-datos .neg { color: #b42318; }
.lp-precio { display: flex; flex-direction: column; align-items: stretch; gap: 2px; }
.lp-precio input { text-align: right; font-weight: 600; padding: 6px 8px; }
.lp-tag { font-size: 11px; font-style: normal; color: #8a5a00; background: #fff3cd; border-radius: 6px; padding: 0 6px; align-self: flex-end; }
.hoja-print { display: none; }
@media (max-width: 900px) {
  .lista-main { grid-template-columns: 1fr; }
  .lp-fila { grid-template-columns: minmax(0, 1fr) 110px; }
  .lp-datos { grid-column: 1 / -1; align-items: flex-start; text-align: left; order: 3; }
}
@media print {
  body { background: #fff; }
  .no-print { display: none !important; }
  .hoja-print { display: block; color: #000; font-size: 12pt; padding: 0 6mm; }
  .h-cab h1 { margin: 0 0 4px; font-size: 22pt; }
  .h-cab p { margin: 0 0 2px; }
  .h-tabla { width: 100%; border-collapse: collapse; margin-top: 12px; }
  .h-tabla td { padding: 5px 4px; border-bottom: 1px solid #ddd; }
  .h-marca td { font-weight: 700; padding-top: 12px; border-bottom: 2px solid #000; }
  .h-precio { text-align: right; font-weight: 700; white-space: nowrap; }
  .h-pie { margin-top: 12px; }
  .h-leyenda { font-size: 9pt; font-weight: 700; }
  tr { break-inside: avoid; }
}
.lp-marca label { display: flex; flex-direction: row; align-items: center; gap: 8px; margin: 0; }
.lp-nombre { margin: 0; flex-direction: row; }

/* ---------- Mis precios ---------- */
.mp-main { display: grid; grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.4fr); gap: 24px; max-width: 1360px; margin: 0 auto; padding: 22px 20px 40px; }
.mp-fila { grid-template-columns: auto minmax(0, 1fr) auto; cursor: pointer; }
.mp-fila:hover { background: #faf9f6; }
.mp-fila.abierta { background: var(--brand-soft); }
.mp-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.mp-nom { font-weight: 600; }
.mp-info .muted { font-size: 12px; }
.mp-orig { color: var(--brand); }
.mp-precio { font-size: 16px; }
.mp-precio s { color: var(--muted); font-weight: 400; font-size: 13px; }
.mp-detalle { padding: 14px 16px 18px; border-top: 1px solid var(--line); background: #fbfaf7; }
.mp-detalle h4 { margin: 14px 0 6px; font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.mp-ajuste { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.mp-ajuste label { min-width: 220px; }
.mp-propio { margin-top: 10px; }
.mp-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.mp-det { margin-top: 12px; border-top: 1px solid var(--line); padding-top: 10px; }
.mp-det > summary { cursor: pointer; font-weight: 600; font-size: 14px; display: flex; gap: 8px; align-items: center; }
.mp-cat { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px; margin-top: 8px; }
.mp-cat label { display: flex; flex-direction: row; align-items: center; justify-content: space-between; gap: 8px; font-size: 13px; }
.mp-cat input { width: 70px; text-align: right; }
.canal-on { font-size: 12px; font-weight: 600; background: var(--brand); color: #fff; border-radius: 999px; padding: 2px 8px; }
@media (max-width: 900px) {
  .mp-main { grid-template-columns: 1fr; }
  .mp-cols { grid-template-columns: 1fr; }
  .mp-fila { grid-template-columns: auto minmax(0, 1fr); }
  .mp-fila .lp-datos { grid-column: 2; align-items: flex-start; text-align: left; }
}
.mp-sim .promo-card { padding: 12px 14px; margin-top: 10px; }

/* Mis precios: formularios alineados, plegables, categorías y sabores */
.mp-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; align-items: start; }
.mp-form > label { display: flex; flex-direction: column; gap: 6px; margin: 0; }
.mp-form > label[hidden] { display: none; }
.mp-plegable > summary { list-style: none; cursor: pointer; }
.mp-plegable > summary::-webkit-details-marker { display: none; }
.mp-plegable > summary h3 { margin: 0; display: flex; align-items: center; gap: 8px; }
.mp-plegable > summary h3::before { content: '▸'; transition: transform .15s; display: inline-block; }
.mp-plegable[open] > summary h3::before { transform: rotate(90deg); }
.mp-plegable[open] > summary { margin-bottom: 12px; }
.mp-opc { text-transform: none; letter-spacing: 0; font-weight: 400; }
.mp-cattab { margin-top: 14px; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.mp-cathead, .mp-catfila { display: grid; grid-template-columns: minmax(0, 1fr) 110px 120px; gap: 10px; align-items: center; padding: 8px 12px; }
.mp-cathead { background: var(--brand-soft); font-size: 12px; font-weight: 600; }
.mp-cathead .muted { font-weight: 400; }
.mp-catfila { border-top: 1px solid var(--line); font-size: 14px; }
.mp-catfila input { text-align: right; padding: 6px 8px; }
.mp-sabores { display: flex; flex-wrap: wrap; gap: 4px; margin: 3px 0 2px; }
.mp-sabor { font-size: 12px; border: 1px solid var(--line); background: #fff; color: var(--muted); border-radius: 999px; padding: 2px 9px; cursor: pointer; text-decoration: line-through; }
.mp-sabor.on { background: var(--brand-soft); border-color: var(--brand); color: var(--brand); text-decoration: none; }
@media (max-width: 600px) { .mp-form { grid-template-columns: 1fr; } .mp-cathead, .mp-catfila { grid-template-columns: minmax(0, 1fr) 80px 90px; } }

/* Márgenes por categoría: compacto, en dos columnas */
.mp-catleyenda { display: grid; grid-template-columns: minmax(0, 1fr) 58px 58px; gap: 6px; font-size: 11px; color: var(--muted); margin: 14px 0 4px; padding: 0 10px; max-width: 50%; }
.mp-catleyenda span:nth-child(n+2) { text-align: center; }
.mp-catgrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 14px; }
.mp-catgrid .mp-catfila { display: grid; grid-template-columns: minmax(0, 1fr) 58px 58px; gap: 6px; align-items: center; padding: 4px 4px 4px 10px; border: 1px solid var(--line); border-top: 1px solid var(--line); border-radius: 8px; font-size: 13px; }
.mp-catgrid .mp-catfila.con-promo { border-color: #f0b429; background: #fffbea; }
.mp-catnom { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mp-catgrid input { text-align: center; padding: 4px 6px; height: 30px; font-size: 13px; }
@media (max-width: 600px) { .mp-catgrid { grid-template-columns: 1fr; } .mp-catleyenda { max-width: 100%; } }
.mp-catleyendas { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin: 14px 0 4px; }
.mp-catleyendas .mp-catleyenda { margin: 0; max-width: none; padding: 0 5px 0 10px; }
@media (max-width: 600px) { .mp-catleyendas { grid-template-columns: 1fr; } .mp-catleyendas .mp-catleyenda + .mp-catleyenda { display: none; } }
/* Marcas desplegables */
.mp-marca { justify-content: flex-start; gap: 10px; cursor: pointer; user-select: none; }
.mp-marca label { margin: 0; }
.mp-marca .mp-flecha { display: inline-block; transition: transform .15s; color: var(--muted); }
.mp-marca.abierta .mp-flecha { transform: rotate(90deg); }
.mp-marca .mp-marca-info { margin-left: auto; font-size: 13px; }
.mp-marca:hover { filter: brightness(.98); }

/* ---------- Mis precios: pulido de alineación ---------- */
.mp-main .section-head { min-height: 40px; align-items: center; }
.mp-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.mp-inline { display: flex !important; flex-direction: row !important; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); margin: 0; }
.mp-inline select { width: auto; padding: 6px 30px 6px 10px; font-size: 14px; color: var(--ink); }
.mp-main .calc-card { padding: 18px 20px; }
.mp-main .calc-card + .calc-card, .mp-main details.calc-card { margin-top: 14px; }
.mp-form { gap: 16px 18px; }
.mp-form > label { font-weight: 600; font-size: 14px; }
.mp-form > label .hint { font-weight: 400; min-height: 0; line-height: 1.35; }
.mp-form input, .mp-form select { width: 100%; height: 42px; }
/* Tabla de categorías: mismas columnas para encabezado y filas */
.mp-catleyendas { margin: 0 0 6px; gap: 14px; }
.mp-catleyendas .mp-catleyenda, .mp-catgrid .mp-catfila { grid-template-columns: minmax(0, 1fr) 64px 64px; gap: 6px; }
.mp-catleyendas .mp-catleyenda { padding: 0 7px 0 13px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.mp-catleyenda span:nth-child(n+2) { text-align: center; }
.mp-catgrid { gap: 8px 14px; }
.mp-catgrid .mp-catfila { padding: 6px 6px 6px 12px; min-height: 46px; }
.mp-catgrid input { width: 64px; height: 32px; }
.mp-catgrid input:focus { outline: 2px solid var(--brand-soft); border-color: var(--brand); }
.mp-main .calc-note { margin-top: 14px; }
.lista-tools, .lista-acciones { align-items: stretch; }
.lista-tools input { height: 40px; }
.lista-tools .btn, .lista-acciones .btn { height: 40px; display: inline-flex; align-items: center; }

/* ---------- Pedido inteligente ---------- */
.alert.info { background: var(--info-soft); color: var(--info); }
.alert.warn { background: var(--warn-soft); color: var(--warn); }
.mp-main .alert + .alert, .pd-tiles + .alert { margin-top: 0; }
#resultado { display: grid; gap: 12px; align-content: start; }
.pd-sub { font-size: 13px; color: var(--muted); margin: 0 0 10px; }
.pd-botones { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.pd-botones .btn { height: 36px; display: inline-flex; align-items: center; cursor: pointer; }
.pd-pegado { display: grid; gap: 8px; margin-bottom: 10px; }
.pd-pegado textarea { width: 100%; resize: vertical; font-size: 14px; }
.pd-pegado .btn { justify-self: start; }
.pd-periodo { margin-bottom: 12px; }
.pd-buscar { position: relative; margin-bottom: 10px; }
.pd-buscar input { width: 100%; height: 40px; }
.pd-opciones { position: absolute; z-index: 20; left: 0; right: 0; top: calc(100% + 4px); background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); max-height: 300px; overflow: auto; padding: 4px; }
.pd-opciones button { display: block; width: 100%; text-align: left; border: 0; background: none; font: inherit; font-size: 14px; padding: 8px 10px; border-radius: 8px; cursor: pointer; color: var(--ink); }
.pd-opciones button:hover { background: var(--brand-soft); }
.pd-opciones small { color: var(--muted); margin-left: 6px; }
.pd-vacio { font-size: 14px; color: var(--muted); margin: 4px 0 0; }
.pd-nom { display: flex; flex-direction: column; min-width: 0; }
.pd-nom b { font-weight: 600; font-size: 14px; line-height: 1.3; }
.pd-nom small { font-size: 12px; color: var(--muted); line-height: 1.35; margin-top: 2px; }
.pd-mal { color: var(--bad) !important; }
.pd-cab { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; }
.pd-fila { display: grid; grid-template-columns: minmax(0, 1fr) 76px 28px; gap: 10px; align-items: center; padding: 7px 0; border-top: 1px solid #f0eee9; }
.pd-fila.pd-cab { border-top: 0; padding-top: 0; }
.pd-fila input, .pd-rfila input, .pd-sfila input { height: 34px; text-align: right; width: 100%; }
.pd-x { border: 0; background: none; font-size: 18px; color: var(--muted); cursor: pointer; border-radius: 6px; height: 28px; }
.pd-x:hover { background: var(--bad-soft); color: var(--bad); }
.pd-total { font-size: 13px; color: var(--muted); padding-top: 8px; border-top: 1px solid var(--line); text-align: right; }
.pd-rev { background: var(--warn-soft); border-radius: 10px; padding: 10px 12px; margin-bottom: 10px; font-size: 14px; }
.pd-rev p { margin: 0 0 8px; color: var(--warn); }
.pd-revfila { display: grid; grid-template-columns: minmax(0, 1fr) 70px auto auto; gap: 8px; align-items: center; padding: 8px 0; border-top: 1px solid rgba(154,100,0,.15); }
.pd-revtxt { grid-column: 1 / -1; font-size: 13px; color: var(--ink); word-break: break-word; }
.pd-revfila select, .pd-revfila input { height: 34px; min-width: 0; }
.pd-aviso { margin-bottom: 10px; }
.pd-tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.pd-tile { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; display: flex; flex-direction: column; gap: 2px; }
.pd-tile span { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
.pd-tile b { font-size: 22px; font-variant-numeric: tabular-nums; }
.pd-tile small { font-size: 12px; color: var(--muted); }
.pd-tile.pos b { color: var(--ok); }
.pd-rfila { display: grid; grid-template-columns: minmax(0, 1fr) 76px 110px 100px; gap: 12px; align-items: center; padding: 10px 0; border-top: 1px solid #f0eee9; }
.pd-rfila.pd-cab { border-top: 0; padding-top: 0; }
.pd-rfila.pd-cab span:not(:first-child) { text-align: right; }
.pd-rfila.man input, .pd-sfila input.man { border-color: var(--warn); background: var(--warn-soft); }
.pd-rfila .v, .pd-sfila .v { text-align: right; font-variant-numeric: tabular-nums; font-size: 14px; display: flex; flex-direction: column; }
.pd-rfila .v small { font-size: 12px; color: var(--muted); }
.pd-rfila .v.pos { color: var(--ok); font-weight: 600; }
.pd-rfila .v.neg { color: var(--bad); font-weight: 600; }
.pd-norep { grid-template-columns: minmax(0, 1fr) 76px; }
.pd-acc { margin: 14px 0 0; padding-top: 12px; border-top: 1px solid var(--line); }
.pd-sfila { display: grid; grid-template-columns: minmax(0, 1fr) 80px 80px; gap: 12px; align-items: center; padding: 7px 0; border-top: 1px solid #f0eee9; }
.pd-sfila.pd-cab { border-top: 0; }
.pd-sfila.pd-cab span:not(:first-child) { text-align: right; }
.pd-empty ol { margin: 0 0 10px; padding-left: 20px; display: grid; gap: 4px; }
.pd-plegable .mp-opc { text-transform: none; letter-spacing: 0; }
@media (max-width: 600px) {
  .pd-tiles { grid-template-columns: 1fr; }
  .pd-rfila { grid-template-columns: minmax(0, 1fr) 64px 96px; }
  .pd-rfila > :nth-child(4) { display: none; }
  .pd-sfila { grid-template-columns: minmax(0, 1fr) 64px 64px; gap: 8px; }
}
a.tab { text-decoration: none; }
.pd-revfila { grid-template-columns: 76px auto auto 1fr; }
.pd-revfila select { grid-column: 1 / -1; width: 100%; }
.pd-fuera { background: var(--info-soft); }
.pd-fuera p { color: var(--info); }
.pd-fuera ul { margin: 0 0 10px; padding-left: 18px; font-size: 13px; }
.pd-buscar-pedido { margin: 0; }
.c5-tabla input { width: 120px; height: 36px; text-align: right; }
.c5-tabla tr.c5-marca td { background: var(--brand-soft); color: var(--brand); font-weight: 700; font-size: 13px; letter-spacing: .04em; }
.mp-pormarca { margin-top: 14px; padding-top: 12px; border-top: 1px solid #f0eee9; }
.mp-pormarca > summary { cursor: pointer; font-weight: 600; font-size: 14px; list-style: none; }
.mp-pormarca > summary::-webkit-details-marker { display: none; }
.mp-pormarca > summary::before { content: '▸ '; display: inline-block; transition: transform .15s; }
.mp-pormarca[open] > summary::before { transform: rotate(90deg); }
.mp-mc { border: 1px solid var(--line); border-radius: 10px; margin-bottom: 8px; overflow: hidden; }
.mp-mc-cab { width: 100%; display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: #fbfaf8; border: 0; font: inherit; cursor: pointer; text-align: left; color: var(--ink); }
.mp-mc-cab .muted { margin-left: auto; font-size: 13px; }
.mp-mc .mp-flecha { transition: transform .15s; display: inline-block; }
.mp-mc.abierta .mp-flecha { transform: rotate(90deg); }
.mp-mc-cats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 18px; padding: 10px 12px; }
.mp-mc-fila { display: grid; grid-template-columns: minmax(0, 1fr) 72px; gap: 10px; align-items: center; font-size: 14px; margin: 0; font-weight: 400; }
.mp-mc-fila input { height: 34px; text-align: right; width: 100%; }
@media (max-width: 600px) { .mp-mc-cats { grid-template-columns: 1fr; } }
.sidebar-foot .user-box { margin-top: 6px; padding-top: 10px; border-top: 1px solid var(--line); }

/* ---------- Mi calendario ---------- */
.cal-main { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 22px; max-width: 1360px; margin: 0 auto; padding: 22px 20px 40px; align-items: start; }
.cal-resumen { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.cal-tile { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; display: flex; flex-direction: column; gap: 2px; text-align: left; font: inherit; color: var(--ink); }
button.cal-tile { cursor: pointer; }
button.cal-tile:hover { border-color: var(--brand); }
.cal-tile span { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
.cal-tile b { font-size: 24px; line-height: 1.2; }
.cal-tile b.sm { font-size: 15px; line-height: 1.3; }
.cal-tile small { font-size: 12px; color: var(--muted); }
.cal-tile.mal b { color: var(--bad); }
.cal-tile.fecha { background: var(--warn-soft); border-color: transparent; }
.cal-nav { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.cal-nav h2 { font-size: 20px; margin: 0 6px; min-width: 170px; text-align: center; }
.cal-nav .spacer { flex: 1; }
.cal-leyenda { display: flex; gap: 6px; flex-wrap: wrap; }
.cal-grid-wrap { padding: 0; overflow: hidden; }
.cal-dias { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); background: #fbfaf8; border-bottom: 1px solid var(--line); }
.cal-dias span { padding: 8px 10px; font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal-celda { min-height: 112px; border: 0; border-right: 1px solid #f0eee9; border-bottom: 1px solid #f0eee9; background: #fff; padding: 6px; display: flex; flex-direction: column; gap: 3px; align-items: stretch; text-align: left; font: inherit; cursor: pointer; min-width: 0; color: var(--ink); }
.cal-celda:nth-child(7n) { border-right: 0; }
.cal-celda:hover { background: #fbfaf8; }
.cal-celda.fuera { background: #faf9f6; }
.cal-celda.fuera .cal-num { color: #bbb; }
.cal-celda.sel { box-shadow: inset 0 0 0 2px var(--brand); }
.cal-num { font-size: 13px; font-weight: 600; width: 24px; height: 24px; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; }
.cal-celda.hoy .cal-num { background: var(--brand); color: #fff; }
.cal-celda.atr .cal-num { color: var(--bad); }
.cal-celda.hoy.atr .cal-num { color: #fff; }
.cal-chip { display: inline-block; font-size: 11.5px; line-height: 1.3; padding: 2px 6px; border-radius: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; background: #f1efe9; color: var(--ink); }
.cal-chip.hecha { text-decoration: line-through; opacity: .55; }
.t-contenido { background: #f3e8fb; } .t-whatsapp { background: #e3f4ea; } .t-seguimiento { background: var(--info-soft); }
.t-promo { background: var(--bad-soft); } .t-stock { background: #fdf1d8; } .t-otro { background: #efefef; }
.cal-fecha { font-size: 11px; font-weight: 600; color: var(--warn); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-mas { font-size: 11px; color: var(--muted); }
.cal-puntos { display: none; gap: 3px; }
.cal-puntos i { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.cal-puntos i.t-contenido { background: #9b51e0; } .cal-puntos i.t-whatsapp { background: var(--ok); } .cal-puntos i.t-seguimiento { background: var(--info); }
.cal-puntos i.t-promo { background: var(--bad); } .cal-puntos i.t-stock { background: var(--warn); } .cal-puntos i.t-otro { background: #999; }
.cal-puntos i.hecha { opacity: .35; }
.cal-tip { font-size: 13px; margin: 12px 2px 0; }
.cal-dia { position: sticky; top: 16px; padding: 16px 18px; display: grid; gap: 12px; }
.cal-dia-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.cal-dia-head small { color: var(--muted); text-transform: capitalize; font-size: 13px; }
.cal-dia-head h3 { margin: 0; font-size: 20px; }
.cal-fecha-box { background: var(--warn-soft); border-radius: 10px; padding: 10px 12px; display: grid; gap: 6px; }
.cal-fecha-box b { color: var(--warn); }
.cal-fecha-box p { margin: 0; font-size: 13px; }
.cal-fecha-box .btn { justify-self: start; }
.cal-tarea { display: grid; grid-template-columns: 24px minmax(0, 1fr); gap: 8px; padding: 10px 0; border-top: 1px solid #f0eee9; }
.cal-check input { width: 18px; height: 18px; margin-top: 2px; }
.cal-tarea-txt { display: grid; gap: 4px; justify-items: start; }
.cal-tarea-txt b { font-size: 15px; line-height: 1.35; }
.cal-tarea-txt p { margin: 0; font-size: 13px; color: #4a4945; white-space: pre-wrap; }
.cal-tarea.hecha b { text-decoration: line-through; color: var(--muted); }
.cal-tarea-acc { display: flex; gap: 6px; flex-wrap: wrap; }
.cal-vacio { font-size: 14px; margin: 0; }
.cal-dlg { border: 0; border-radius: 16px; padding: 22px; width: min(520px, calc(100vw - 32px)); box-shadow: var(--shadow); }
.cal-dlg::backdrop { background: rgba(0,0,0,.35); }
.cal-dlg h3 { margin: 0 0 12px; }
.cal-dlg form { display: grid; gap: 12px; }
.cal-dlg label { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: 14px; }
.cal-dlg input, .cal-dlg select, .cal-dlg textarea { width: 100%; font-weight: 400; }
.cal-dlg-fila { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.cal-dlg-acc { display: flex; gap: 8px; align-items: center; margin-top: 4px; }
.cal-dlg-acc .spacer { flex: 1; }
/* Revisión desde el chat */
.cal-rev { width: min(640px, calc(100vw - 32px)); }
.cal-rev-lista { max-height: 60vh; overflow: auto; display: grid; gap: 0; margin-bottom: 12px; }
.cal-rev-fila { display: grid !important; grid-template-columns: 20px minmax(0, 1fr) 150px; gap: 10px; align-items: start; padding: 10px 0; border-top: 1px solid #f0eee9; font-weight: 400 !important; }
.cal-rev-fila input[type=checkbox] { width: 18px; height: 18px; margin-top: 2px; }
.cal-rev-txt { display: grid; gap: 2px; font-size: 14px; }
.cal-rev-txt small { color: var(--muted); font-size: 12px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
/* Tarjeta en el chat */
.cal-card { border: 1px solid var(--line); background: #fbfaf8; border-radius: 12px; padding: 12px 14px; margin: 10px 0 4px; display: grid; gap: 8px; }
.cal-card-head { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; font-size: 14px; }
.cal-card ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 3px; font-size: 13.5px; }
.cal-card li span { color: var(--muted); margin-right: 4px; text-transform: capitalize; }
.cal-card .btn { justify-self: start; }
#calLink .badge { margin-left: 6px; font-size: 11px; }
@media (max-width: 1000px) {
  .cal-main { grid-template-columns: 1fr; }
  .cal-dia { position: static; }
  .cal-resumen { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .cal-celda { min-height: 58px; padding: 4px; }
  .cal-celda .cal-chip, .cal-celda .cal-fecha, .cal-celda .cal-mas { display: none; }
  .cal-celda .cal-puntos { display: flex; }
  .cal-dias span { padding: 6px 4px; text-align: center; }
  .cal-leyenda { display: none; }
  .cal-rev-fila { grid-template-columns: 20px minmax(0, 1fr); }
  .cal-rev-fila input[type=date] { grid-column: 2; }
  .cal-dlg-fila { grid-template-columns: 1fr; }
}
.fc-tabla input { height: 36px; } .fc-tabla td:nth-child(3) { width: 50%; }

.cal-estrella { display: none; font-style: normal; color: var(--warn); font-size: 11px; position: absolute; top: 4px; right: 5px; }
.cal-celda { position: relative; }
@media (max-width: 640px) { .cal-estrella { display: block; } }
.cal-rev-txt { display: block; }
.cal-rev-txt small { display: block; margin-top: 2px; }
.mp-ayuda { font-size: 13px; margin: 2px 0 0; }
.mp-marca-campos { display: flex; gap: 10px; align-items: center; margin-left: 14px; cursor: default; }
.mp-marca-campos label { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: var(--muted); margin: 0; white-space: nowrap; }
.mp-marca-campos input { width: 62px; height: 32px; text-align: right; padding: 4px 8px; }
@media (max-width: 700px) {
  .mp-marca { flex-wrap: wrap; }
  .mp-marca .mp-marca-info { margin-left: 0; flex-basis: 100%; order: 3; padding-left: 30px; }
  .mp-marca-campos { margin-left: auto; }
}
.pd-subir .btn { margin-left: 6px; } .pd-subir small { opacity: .8; }
.pd-tile.neg b { color: var(--bad); }
/* Logo ProteViking */
.logo { background: #fff url(/logo.png) center / 92% no-repeat; border: 1px solid var(--line); color: transparent; font-size: 0 !important; overflow: hidden; }
.auth-logo { display: block; width: 190px; max-width: 70%; margin: 0 auto 4px; }
.auth-card .brand { justify-content: center; text-align: center; }
.mic { flex: none; width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line); background: #fff; color: var(--muted); display: inline-grid; place-items: center; cursor: pointer; align-self: flex-end; }
.mic:hover { color: var(--brand); border-color: var(--brand); }
.mic.on { background: var(--bad); border-color: var(--bad); color: #fff; animation: micPulso 1.2s ease-in-out infinite; }
@keyframes micPulso { 0%,100% { box-shadow: 0 0 0 0 rgba(179,38,30,.35); } 50% { box-shadow: 0 0 0 7px rgba(179,38,30,0); } }

/* ================= Armazón nuevo: menú por etapas ================= */
.shell { display: flex; min-height: 100vh; }
.appnav { width: 248px; flex: none; background: #fbfaf8; border-right: 1px solid var(--line); display: flex; flex-direction: column; gap: 4px; padding: 18px 14px; position: sticky; top: 0; height: 100vh; box-sizing: border-box; overflow-y: auto; }
.appnav-marca { display: flex; align-items: center; gap: 10px; padding: 0 6px 14px; font-size: 15px; }
.appnav-links { display: flex; flex-direction: column; gap: 2px; }
.appnav-grupo { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding: 14px 12px 4px; }
.appnav-link { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 10px; color: var(--ink); text-decoration: none; font-size: 14.5px; }
.appnav-link svg { color: var(--muted); flex: none; }
.appnav-link:hover { background: rgba(0,0,0,.05); }
.appnav-link.activo { background: var(--brand-soft); color: var(--brand); font-weight: 700; }
.appnav-link.activo svg { color: var(--brand); }
.appnav-link span { flex: 1; }
.appnav-badge { font-size: 11px; font-weight: 700; background: var(--brand); color: #fff; border-radius: 999px; padding: 1px 7px; }
.appnav-pie { margin-top: auto; border-top: 1px solid var(--line); padding-top: 12px; display: grid; gap: 6px; }
.appnav-user { font-size: 13px; padding: 0 6px; display: grid; }
.appnav-user strong { font-size: 14px; }
.appnav-links.compacto .appnav-link { padding: 7px 10px; font-size: 14px; }
.appnav-links.compacto .appnav-grupo { padding: 10px 10px 2px; }
.shell-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 12px; padding: 14px 28px; border-bottom: 1px solid var(--line); background: var(--panel); position: sticky; top: 0; z-index: 30; }
.topbar h1 { font-size: 20px; margin: 0; }
.topbar .spacer { flex: 1; }
.bottombar { display: none; }
.nav-velo { display: none; }
/* Campanita */
#bell { position: relative; }
.bell-btn { position: relative; width: 42px; height: 42px; border-radius: 50%; border: 1px solid var(--line); background: #fff; display: grid; place-items: center; cursor: pointer; color: var(--ink); }
.bell-btn:hover { border-color: var(--brand); color: var(--brand); }
.bell-n { position: absolute; top: -3px; right: -3px; min-width: 19px; height: 19px; border-radius: 999px; background: var(--bad); color: #fff; font-size: 11px; display: grid; place-items: center; padding: 0 4px; box-sizing: border-box; }
.bell-panel { position: absolute; right: 0; top: calc(100% + 8px); width: 360px; max-width: calc(100vw - 24px); background: #fff; border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); z-index: 60; max-height: 70vh; overflow: auto; }
.bell-cab { padding: 12px 16px; border-bottom: 1px solid var(--line); }
.bell-item { display: grid; gap: 2px; padding: 12px 16px; border-bottom: 1px solid #f0eee9; text-decoration: none; color: var(--ink); }
.bell-item:hover { background: #fbfaf8; }
.bell-item b { font-size: 14px; }
.bell-item span { font-size: 13px; color: var(--muted); }
.bell-item small { font-size: 11px; color: var(--muted); }
.bell-item.nueva { background: var(--warn-soft); }
.bell-vacio { padding: 16px; margin: 0; color: var(--muted); font-size: 14px; }
/* Páginas dentro del armazón */
.shell .mp-main, .shell .cal-main { max-width: 1400px; width: 100%; box-sizing: border-box; }
.pg { max-width: 1400px; width: 100%; box-sizing: border-box; margin: 0 auto; padding: 22px 28px 40px; display: grid; gap: 18px; align-content: start; }
@media (max-width: 900px) {
  .appnav { position: fixed; left: 0; top: 0; z-index: 80; transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow); }
  body.nav-abierto .appnav { transform: none; }
  body.nav-abierto .nav-velo { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.3); z-index: 70; }
  .topbar { padding: 12px 16px; }
  .pg { padding: 16px 16px 90px; }
  .shell .mp-main, .shell .cal-main { padding-bottom: 90px; }
  .bottombar { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; background: #fff; border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); }
  .bottombar a, .bottombar button { display: flex; flex-direction: column; align-items: center; gap: 2px; font: inherit; font-size: 11px; color: var(--muted); text-decoration: none; background: none; border: 0; padding: 4px 0; cursor: pointer; min-height: 44px; justify-content: center; }
  .bottombar .activo { color: var(--brand); font-weight: 700; }
}
/* Comunes de las secciones nuevas */
.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.tile > span { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.tile > b { font-size: 24px; font-variant-numeric: tabular-nums; }
.tile > small { font-size: 13px; color: var(--muted); }
.tile.pos > b { color: var(--ok); } .tile.neg > b { color: var(--bad); }
@media (max-width: 900px) { .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.seg { display: inline-flex; gap: 4px; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 4px; }
.seg button { border: 0; border-radius: 9px; padding: 8px 14px; background: transparent; font: inherit; font-size: 14px; cursor: pointer; color: var(--ink); }
.seg button.on { background: var(--brand-soft); color: var(--brand); font-weight: 700; }
.lista { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.lista-fila { display: grid; gap: 12px; padding: 12px 16px; border-top: 1px solid #f0eee9; align-items: center; font-size: 14px; }
.lista-fila:first-child { border-top: 0; }
.lista-cab { font-size: 11.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); background: #fbfaf8; }
button.lista-fila { width: 100%; border: 0; border-top: 1px solid #f0eee9; background: none; font: inherit; text-align: left; cursor: pointer; color: var(--ink); }
button.lista-fila:hover { background: #fbfaf8; }
.v-num { text-align: right; font-variant-numeric: tabular-nums; }
.etq { justify-self: start; font-size: 12px; font-weight: 700; padding: 4px 9px; border-radius: 6px; background: #f1efe9; color: #55544f; white-space: nowrap; }
.etq.ok { background: var(--ok-soft); color: var(--ok); } .etq.warn { background: var(--warn-soft); color: var(--warn); } .etq.bad { background: var(--bad-soft); color: var(--bad); } .etq.info { background: var(--info-soft); color: var(--info); }
.dlg { border: 0; border-radius: 16px; padding: 22px; width: min(640px, calc(100vw - 32px)); box-shadow: var(--shadow); max-height: calc(100vh - 40px); }
.dlg::backdrop { background: rgba(0,0,0,.35); }
.dlg h3 { margin: 0 0 14px; font-size: 19px; }
.dlg form, .dlg .dlg-cuerpo { display: grid; gap: 12px; }
.dlg label { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: 14px; }
.dlg input, .dlg select, .dlg textarea { width: 100%; font-weight: 400; box-sizing: border-box; }
.dlg .fila2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.dlg .acc { display: flex; gap: 8px; align-items: center; margin-top: 6px; flex-wrap: wrap; }
.dlg .acc .spacer { flex: 1; }
@media (max-width: 600px) { .dlg .fila2 { grid-template-columns: 1fr; } }
.buscador { position: relative; }
.buscador input { width: 100%; height: 42px; box-sizing: border-box; }
.buscador-op { position: absolute; z-index: 20; left: 0; right: 0; top: calc(100% + 4px); background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); max-height: 280px; overflow: auto; padding: 4px; }
.buscador-op button { display: block; width: 100%; text-align: left; border: 0; background: none; font: inherit; font-size: 14px; padding: 8px 10px; border-radius: 8px; cursor: pointer; color: var(--ink); }
.buscador-op button:hover { background: var(--brand-soft); }
.buscador-op small { color: var(--muted); margin-left: 6px; }
.vacio-box { padding: 28px; text-align: center; color: var(--muted); font-size: 14px; }
/* Mis ventas */
.vt-barra { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.vt-barra .spacer { flex: 1; }
.vt-mes { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; margin: 0; }
.vt-mes input { height: 40px; }
.vt-acc { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.vt-nota { font-size: 13px; margin: 10px 2px 0; }
.vt-cols { grid-template-columns: 64px minmax(0, 1.6fr) minmax(0, .8fr) 110px 110px 130px; }
.st-cols { grid-template-columns: minmax(0, 1fr) 90px 130px 130px 28px; }
.cl-cols { grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr) 80px 110px 220px; }
.st-input { height: 36px; text-align: right; width: 100%; box-sizing: border-box; }
.dlg-ancho { width: min(760px, calc(100vw - 32px)); }
.vt-agregar { display: flex; gap: 8px; }
.vt-agregar select { width: auto; }
.vt-items { display: grid; margin-top: 8px; }
.vt-item { display: grid; grid-template-columns: minmax(0, 1fr) 70px 120px 28px; gap: 8px; align-items: center; padding: 7px 0; border-top: 1px solid #f0eee9; font-size: 14px; }
.vt-item-cab { font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); border-top: 0; }
.vt-item input { height: 36px; text-align: right; }
.vt-item-n { display: flex; flex-direction: column; }
.vt-item-n small { font-size: 12px; color: var(--muted); }
.vt-tri { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 14px; font-weight: 600; }
.vt-tri span { min-width: 140px; }
.vt-recompra { background: var(--info-soft); border-radius: 12px; padding: 12px 14px; display: grid; gap: 8px; font-size: 14px; color: #1c4482; }
@media (max-width: 760px) {
  .vt-cols { grid-template-columns: 54px minmax(0, 1fr) 96px; }
  .vt-cols > :nth-child(3), .vt-cols > :nth-child(5), .vt-cols > :nth-child(6) { display: none; }
  .st-cols { grid-template-columns: minmax(0, 1fr) 70px 100px 28px; }
  .st-cols > :nth-child(3) { display: none; }
  .cl-cols { grid-template-columns: minmax(0, 1fr) 150px; }
  .cl-cols > :nth-child(2), .cl-cols > :nth-child(3), .cl-cols > :nth-child(4) { display: none; }
}
/* Combos */
.cb-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.cb-col { display: grid; gap: 18px; }
.cb-card { padding: 20px 22px; display: grid; gap: 12px; }
.cb-card h2 { font-size: 18px; margin: 0; }
.cb-cab { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.cb-sub { margin: -4px 0 0; font-size: 14px; }
.cb-label { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: 14px; }
.cb-label input { height: 42px; }
.cb-inline { flex-direction: row; align-items: center; gap: 10px; flex-wrap: wrap; }
.cb-inline input { width: 160px; }
.cb-precios { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.cb-precio { background: #f6f5f2; border-radius: 12px; padding: 12px 14px; display: flex; flex-direction: column; gap: 4px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 0; }
.cb-precio b { font-size: 20px; color: var(--ink); text-transform: none; letter-spacing: 0; }
.cb-precio b.tachado { text-decoration: line-through; color: var(--muted); }
.cb-precio input { height: 36px; font-size: 16px; font-weight: 700; }
.cb-precio.dark { background: #141413; color: #9fd3bd; }
.cb-precio.dark b { color: #fff; font-size: 22px; }
.cb-precio small { text-transform: none; letter-spacing: 0; font-weight: 500; color: #c9c7c0; font-size: 12.5px; }
.cb-precio small.mal { color: #ffb4ab; }
.cb-acc { margin: 0; }
.cb-item { display: flex; gap: 12px; align-items: center; padding: 12px 0; border-top: 1px solid #f0eee9; }
.cb-item:first-child { border-top: 0; padding-top: 0; }
.cb-item-txt { flex: 1; display: grid; gap: 2px; min-width: 0; }
.cb-item-txt span { font-size: 13px; color: var(--muted); }
.cb-item-txt small { font-size: 13px; color: var(--ok); font-weight: 600; }
.cb-item-acc { display: flex; gap: 4px; }
.cb-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.cb-chip { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 9px 14px; font: inherit; font-size: 13.5px; cursor: pointer; color: var(--ink); }
.cb-chip.on { background: #141413; border-color: #141413; color: #fff; font-weight: 600; }
.cb-rec { border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; display: grid; gap: 6px; }
.cb-rec-fila { display: grid; grid-template-columns: minmax(0, 1fr) 110px; gap: 10px; font-size: 14px; align-items: center; }
.cb-rec-fila > span:first-child { display: flex; flex-direction: column; }
.cb-rec-fila small { font-size: 12px; color: var(--muted); }
.cb-rec-fila.tot { border-top: 1px solid var(--line); padding-top: 6px; font-weight: 700; }
.cb-cruz { display: grid; grid-template-columns: 130px 20px minmax(0, 1fr); gap: 10px; align-items: center; padding: 10px 0; border-top: 1px solid #f0eee9; font-size: 14px; color: var(--muted); }
.cb-cruz b { color: var(--ink); }
.cb-cruz span { color: var(--ink); }
.cb-cruz small { color: var(--muted); }
@media (max-width: 900px) { .cb-grid { grid-template-columns: 1fr; } .cb-precios { grid-template-columns: 1fr; } .cb-cruz { grid-template-columns: 1fr; } .cb-cruz svg { display: none; } }
/* Inicio */
.in-saludo { display: flex; flex-direction: column; }
.in-saludo .muted { font-size: 13px; text-transform: capitalize; }
.in-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.in-col { display: grid; gap: 18px; }
.in-card { padding: 18px 20px; display: grid; gap: 10px; }
.in-card h2 { font-size: 17px; margin: 0; }
.in-link { font-size: 13px; font-weight: 600; }
.in-tile { text-decoration: none; color: var(--ink); }
.in-tile:hover { border-color: var(--brand); }
.in-aviso { background: var(--warn-soft); border-radius: 14px; padding: 14px 18px; display: flex; gap: 14px; align-items: center; margin-bottom: 4px; }
.in-aviso div { flex: 1; display: grid; gap: 2px; color: #6b4500; }
.in-aviso span { font-size: 14px; }
.in-aviso .btn { background: #141413; color: #fff; border-color: #141413; flex: none; }
.in-tarea { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; gap: 10px; align-items: start; padding: 10px 0; border-top: 1px solid #f0eee9; font-weight: 400; cursor: pointer; }
.in-tarea input { width: 18px; height: 18px; margin: 2px 0 0; }
.in-tarea-txt { display: grid; gap: 2px; min-width: 0; }
.in-tarea-txt b { font-size: 15px; }
.in-tarea-txt span { font-size: 13px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.in-tarea-txt small.mal { color: var(--bad); font-size: 12px; font-weight: 600; }
.in-tarea.hecha b { text-decoration: line-through; color: var(--muted); }
.in-rapidos { display: grid; gap: 8px; }
.in-rapidos .btn { justify-content: center; text-align: center; text-decoration: none; }
.in-preguntas { display: grid; gap: 8px; }
.in-preguntas a { border: 1px solid var(--line); border-radius: 10px; padding: 11px 14px; font-size: 14px; color: var(--ink); text-decoration: none; }
.in-preguntas a:hover { border-color: var(--brand); color: var(--brand); }
.in-pasos { gap: 6px; }
.in-paso { display: flex; gap: 10px; align-items: center; padding: 8px 4px; color: var(--ink); text-decoration: none; font-size: 14.5px; border-radius: 8px; }
.in-paso:hover { background: #fbfaf8; }
.in-paso.ok { color: var(--muted); text-decoration: line-through; }
.in-check { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line); display: grid; place-items: center; font-size: 13px; font-weight: 800; flex: none; }
.in-paso.ok .in-check { background: var(--ok); border-color: var(--ok); color: #fff; }
@media (max-width: 900px) { .in-grid { grid-template-columns: 1fr; } .in-aviso { flex-direction: column; align-items: flex-start; } }
@media print { .shell { display: block; } .shell-main { display: block; } }

/* Etiquetas de stock del recomendador */
.stk { display: inline-block; font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 999px; margin-left: 4px; vertical-align: middle; }
.stk-ok { background: #e3f2e8; color: #1f6b3a; }
.stk-no { background: #fdeaea; color: #a33; }
.stk-aviso { font-size: 12.5px; color: #a33; }
.stk-aviso.ok { color: #1f6b3a; }

/* Venta: cantidad que supera el stock */
.vt-item-n small.mal { color: #a33; font-weight: 600; }
.vt-item input.bad { border-color: #c0392b; background: #fdf1f0; }
#frmVenta button[type=submit]:disabled { opacity: .45; cursor: not-allowed; }

/* Pedido: cruz para quitar un producto */
.pd-rfila.con-x { grid-template-columns: minmax(0, 1fr) 76px 110px 100px 30px; }
@media (max-width: 600px) { .pd-rfila.con-x { grid-template-columns: minmax(0, 1fr) 64px 96px 30px; } }

/* Adjuntar presupuesto / subir ventas */
.vt-adjuntar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin: 10px 0; }
.vt-adjuntar .muted { font-size: 13.5px; }
.vt-fecha { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; }
.vt-fecha input { height: 38px; }
.vt-item.vt-imp { grid-template-columns: minmax(0, 1fr) 64px 100px 140px 28px; }
@media (max-width: 600px) {
  .vt-item.vt-imp { grid-template-columns: minmax(0, 1fr) 56px 86px 28px; }
  .vt-item.vt-imp > :nth-child(4) { grid-column: 1 / -2; }
}
@media (max-width: 600px) {
  .vt-agregar { flex-wrap: wrap; }
  .vt-agregar .buscador { flex-basis: 100% !important; }
  .vt-agregar #vCombo { width: 100%; }
  .vt-item.vt-imp input[type=date] { text-align: left; }
}

/* Burbujas del chat: de a dos, y la que queda sola va centrada */
.chips { display: flex; flex-wrap: wrap; justify-content: center; }
.chips .chip { flex: 0 1 calc(50% - 5px); box-sizing: border-box; }
@media (max-width: 560px) { .chips .chip { flex-basis: 100%; } }
/* Avisos con varias líneas (antes → después de cada producto) */
.bell-item span, .in-aviso span { white-space: pre-line; }
.in-aviso small { font-size: 12px; opacity: .8; }

/* Memoria del asistente (Inicio) */
.mem-ver { white-space: pre-line; font-size: 14px; line-height: 1.5; max-height: 320px; overflow: auto; background: var(--bg, #f6f5f2); border-radius: 10px; padding: 10px 12px; }

/* Guiones como documento aparte en el chat */
.gui-acc { display: flex; gap: 8px; flex-wrap: wrap; }
.gui-dlg { width: min(760px, 94vw); max-height: 88vh; }
.gui-doc { max-height: 70vh; overflow: auto; padding: 4px 6px; font-size: 15px; line-height: 1.55; }
.gui-doc h1 { font-size: 21px; margin: 4px 0 10px; } .gui-doc h2 { font-size: 17px; margin: 18px 0 6px; border-top: 1px solid var(--line); padding-top: 12px; } .gui-doc h3 { font-size: 15px; margin: 12px 0 4px; }

/* Nota para el revendedor en una tarea (ej. a qué fecha pasar el seguimiento) */
.cal-nota { margin-top: 6px; padding: 8px 10px; border-radius: 8px; background: #fff7e0; color: #6b5200; font-size: 13px; }
