/* =========================================================================
   Reneé Cosmetics — Panel de administración
   ========================================================================= */
:root {
  --rose: #C2185B; --rose-deep: #9C1249; --wine: #6B1232; --blush: #F3DCE3; --petal: #EBCAD5;
  --bg: #FAF4F5; --card: #FFFFFF; --ink: #2A0F18; --muted: #7A5F67; --line: #EADBDF;
  --ok: #4f7a55; --okbg: #e8f1e9; --warn: #a8692e; --warnbg: #fbefe1; --danger: #a24a4a; --dangerbg: #f7e7e7; --info: #4f6b8a; --infobg: #e7eef6;
  --f-body: 'Lato', 'Helvetica Neue', Arial, sans-serif;
  --f-display: 'Marcellus', Georgia, serif; --night: #3B0A1B; --orchid: #E89AB6;
  --r: 16px; --side: 248px;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: var(--f-body); color: var(--ink); background: var(--bg); font-size: 15px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
input, select, textarea { font: inherit; color: inherit; }
img { display: block; max-width: 100%; }
:focus-visible { outline: 2px solid var(--rose); outline-offset: 2px; }

/* login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: radial-gradient(circle at 20% 10%, var(--petal), transparent 50%), var(--bg); }
.login-card { width: min(420px, 100%); background: var(--card); border-radius: 24px; padding: 40px 32px; box-shadow: 0 30px 60px -30px rgba(59, 10, 27, .35); text-align: center; }
.login-card img { height: 40px; margin: 0 auto 8px; }
.login-card p { color: var(--muted); margin: 0 0 24px; }
.login-card form { display: grid; gap: 12px; text-align: left; }

/* layout */
.app { display: grid; grid-template-columns: var(--side) 1fr; min-height: 100vh; }
.side { background: var(--wine); color: #EBCAD5; padding: 24px 16px; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 6px; overflow-y: auto; }
.side .brand { display: flex; align-items: center; gap: 10px; padding: 0 10px 22px; }
.side .brand img { height: 30px; }
.side .brand small { font-size: 10px; letter-spacing: .2em; text-transform: uppercase; opacity: .6; }
.side a { display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 12px; font-size: 14px; transition: background .2s; position: relative; }
.side a:hover { background: rgba(255, 255, 255, .07); }
.side a.on { background: rgba(255, 255, 255, .13); color: #fff; }
.side svg { width: 19px; height: 19px; stroke: currentColor; fill: none; stroke-width: 1.6; flex: none; }
.side .pill { margin-left: auto; background: var(--rose); color: #fff; font-size: 11px; border-radius: 10px; padding: 1px 8px; }
.side .grow { flex: 1; }
.side .foot { font-size: 12px; opacity: .6; padding: 12px; }

.main { padding: 28px clamp(16px, 3vw, 40px) 60px; min-width: 0; }
.top { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.top h1 { font-weight: 300; font-size: clamp(22px, 2.6vw, 30px); letter-spacing: .2em; text-transform: uppercase; color: var(--wine); margin: 0; line-height: 1.2; }
.top p { margin: 4px 0 0; color: var(--muted); }
.top-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.live { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; color: var(--ok); background: var(--okbg); padding: 6px 12px; border-radius: 999px; }
.live::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; animation: pulse 1.6s infinite; }
@keyframes pulse { 50% { opacity: .3; } }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 42px; padding: 0 18px; border-radius: 12px; font-size: 14px; font-weight: 500; transition: background .2s, transform .1s; white-space: nowrap; }
.btn:active { transform: scale(.97); }
.btn-p { background: var(--rose); color: #fff; } .btn-p:hover { background: var(--rose-deep); }
.btn-d { background: var(--wine); color: #fff; }
.btn-g { background: var(--card); border: 1px solid var(--line); } .btn-g:hover { border-color: var(--rose); }
.btn-x { color: var(--danger); background: var(--dangerbg); }
.btn-s { height: 34px; padding: 0 12px; font-size: 13px; border-radius: 10px; }
.btn svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 1.8; }

.card { background: var(--card); border-radius: var(--r); border: 1px solid var(--line); padding: 20px; }
.card h3 { margin: 0 0 14px; font-size: 12px; letter-spacing: .2em; text-transform: uppercase; color: var(--wine); font-weight: 500; display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.grid2 { display: grid; grid-template-columns: 1.4fr 1fr; gap: 18px; margin-top: 18px; }
.grid2 > * { min-width: 0; }

.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 18px 20px; }
.kpi span { font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.kpi b { display: block; font-size: 30px; font-weight: 400; color: var(--wine); line-height: 1.2; margin-top: 6px; letter-spacing: .02em; }
.kpi small { color: var(--muted); }
.kpi.alert b { color: var(--danger); }

.tbl-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); font-weight: 500; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tbody tr { transition: background .2s; }
tbody tr:hover { background: #FBEFF2; }
tr.click { cursor: pointer; }
.thumb { width: 44px; height: 44px; border-radius: 10px; object-fit: cover; background: #fff; border: 1px solid var(--line); }
.pname { display: flex; gap: 12px; align-items: center; min-width: 220px; }
.pname b { font-weight: 500; display: block; line-height: 1.3; }
.pname small { color: var(--muted); }

.st { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; padding: 4px 10px; border-radius: 999px; white-space: nowrap; font-weight: 500; }
.st::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.st.ok, .st.entregado { color: var(--ok); background: var(--okbg); }
.st.low, .st.nuevo, .st.preparando { color: var(--warn); background: var(--warnbg); }
.st.out, .st.cancelado { color: var(--danger); background: var(--dangerbg); }
.st.pagado, .st.enviado { color: var(--info); background: var(--infobg); }

.stepper { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 10px; background: #fff; overflow: hidden; }
.stepper button { width: 34px; height: 34px; color: var(--rose); font-size: 18px; }
.stepper button:hover { background: var(--blush); }
.stepper input { width: 52px; height: 34px; border: 0; text-align: center; outline: 0; -moz-appearance: textfield; }
.stepper input::-webkit-inner-spin-button { display: none; }
.flash { animation: flash 1s; }
@keyframes flash { from { background: var(--petal); } }

.toolbar { display: flex; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; align-items: center; }
.input, .sel, textarea.input { height: 42px; border-radius: 12px; border: 1px solid var(--line); background: #fff; padding: 0 14px; outline: 0; min-width: 0; }
textarea.input { height: auto; min-height: 90px; padding: 10px 14px; resize: vertical; width: 100%; }
.input:focus, .sel:focus { border-color: var(--rose); box-shadow: 0 0 0 3px rgba(194, 24, 91, .12); }
.search { flex: 1; min-width: 180px; max-width: 360px; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.tab { height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); font-size: 13px; }
.tab.on { background: var(--wine); color: #fff; border-color: var(--wine); }

.form { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form .full { grid-column: 1 / -1; }
.f { display: grid; gap: 6px; }
.f label { font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.h-body label.btn, .h-body label.chk, .h-body label.h-thumb { letter-spacing: normal; text-transform: none; color: inherit; font-size: 13px; }
.h-body label.h-add { font-size: 26px; color: var(--rose); }
.f .input { width: 100%; }
.hint { font-size: 12px; color: var(--muted); }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chk { display: inline-flex; gap: 8px; align-items: center; padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; cursor: pointer; }
.chk input { accent-color: var(--rose); }
.h-row { border: 1px solid var(--line); border-radius: 14px; background: #fff; margin-bottom: 10px; }
.h-row.off .h-head > :not(.h-tools) { opacity: .45; }
.h-head { display: flex; align-items: center; gap: 12px; padding: 10px 12px; }
.h-slide { width: 96px; aspect-ratio: 2 / 1; object-fit: cover; border-radius: 8px; background: var(--bg); flex: none; }
.h-num { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--blush); color: var(--wine); font-size: 13px; flex: none; }
.h-meta { flex: 1; min-width: 0; display: grid; gap: 2px; }
.h-meta small { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.h-tools { display: flex; align-items: center; gap: 6px; flex: none; }
.h-tools > button { height: 36px; min-width: 36px; padding: 0 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); font-size: 13px; }
.h-tools > button:disabled { opacity: .35; }
.h-body { padding: 4px 14px 16px; border-top: 1px solid var(--line); padding-top: 14px; }
.h-img { display: grid; gap: 8px; }
.h-img img, .h-noimg { width: 100%; max-height: 180px; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); }
.h-noimg { height: 90px; display: grid; place-items: center; color: var(--muted); font-size: 13px; }
.h-img-act { display: flex; gap: 8px; }
.h-imgs { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; }
.h-thumb { position: relative; aspect-ratio: 1; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); background: var(--bg); }
.h-thumb img { width: 100%; height: 100%; object-fit: cover; }
.h-thumb button { position: absolute; top: 4px; right: 4px; width: 24px; height: 24px; border-radius: 50%; border: 0; background: rgba(0, 0, 0, .55); color: #fff; }
.h-add { display: grid; place-items: center; font-size: 26px; color: var(--rose); cursor: pointer; border-style: dashed; }
.switch { position: relative; width: 42px; height: 24px; flex: none; cursor: pointer; }
.switch input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: var(--line); transition: background .2s; pointer-events: none; }
.switch span::after { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .2); transition: transform .2s; }
.switch input:checked + span { background: var(--rose); }
.switch input:checked + span::after { transform: translateX(18px); }
.switch input:focus-visible + span { outline: 2px solid var(--rose); outline-offset: 2px; }
.link-pick { display: grid; gap: 6px; }
.vrow { display: flex; gap: 8px; margin-bottom: 8px; align-items: center; }
.vrow [data-vn] { flex: 1; }
.vrow .btn.on { border-color: var(--rose); color: var(--rose); }
.vpick { margin: -2px 0 12px; padding: 12px; border: 1px dashed var(--line); border-radius: 12px; background: #fff; }
.vpick .hint { margin: 0 0 10px; }
.vpick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 8px; }
.vpick-grid button { position: relative; aspect-ratio: 1; padding: 0; border-radius: 10px; overflow: hidden; border: 2px solid transparent; background: var(--bg); opacity: .55; }
.vpick-grid button.on { border-color: var(--rose); opacity: 1; }
.vpick-grid button.on::after { content: '✓'; position: absolute; top: 4px; right: 4px; width: 18px; height: 18px; border-radius: 50%; background: var(--rose); color: #fff; font-size: 11px; line-height: 18px; text-align: center; }
.vpick-grid img { width: 100%; height: 100%; object-fit: cover; }
.imgs { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 10px; }
.imgcell { position: relative; aspect-ratio: 1; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); background: #fff; }
.imgcell.cover { border: 2px solid var(--rose); }
.imgcell img { width: 100%; height: 100%; object-fit: cover; -webkit-user-drag: none; }
.imgs .imgcell { cursor: grab; -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
.imgcell.drag-src { opacity: .35; border-style: dashed; }
.drag-ghost { position: fixed; left: 0; top: 0; z-index: 1000; margin: 0; pointer-events: none; cursor: grabbing; box-shadow: 0 18px 36px -12px rgba(59, 10, 27, .5); }
.cover-tag { position: absolute; left: 6px; top: 6px; font-size: 10px; letter-spacing: .1em; text-transform: uppercase; background: var(--rose); color: #fff; padding: 2px 8px; border-radius: 999px; }
.mk-cover { position: absolute; left: 6px; top: 6px; font-size: 10px; background: rgba(255, 255, 255, .92); color: var(--wine); padding: 2px 8px; border-radius: 999px; opacity: 0; transition: opacity .2s; }
.imgcell:hover .mk-cover { opacity: 1; }
.img-tools { position: absolute; left: 0; right: 0; bottom: 0; display: flex; justify-content: space-between; gap: 2px; padding: 4px; background: linear-gradient(transparent, rgba(42, 15, 24, .55)); }
.img-tools button, .img-tools label { width: 26px; height: 26px; border-radius: 50%; background: rgba(255, 255, 255, .92); color: var(--wine); font-size: 15px; line-height: 26px; text-align: center; cursor: pointer; }
.img-tools button:disabled { opacity: .35; cursor: default; }
@media (hover: none) { .mk-cover { opacity: 1; } }

.list { display: grid; gap: 2px; }
.list-item { display: flex; gap: 12px; align-items: center; padding: 10px 6px; border-bottom: 1px solid var(--line); }
.list-item:last-child { border-bottom: 0; }
.list-item .grow { flex: 1; min-width: 0; }
.list-item small { color: var(--muted); display: block; }
.empty { text-align: center; color: var(--muted); padding: 40px 10px; }
.empty b { display: block; font-size: 14px; letter-spacing: .22em; text-transform: uppercase; color: var(--wine); font-weight: 400; margin-bottom: 6px; }

.bars { display: flex; align-items: flex-end; gap: 8px; height: 150px; padding-top: 10px; }
.bars div { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; font-size: 11px; color: var(--muted); }
.bars i { width: 100%; max-width: 34px; background: var(--rose); border-radius: 6px 6px 2px 2px; min-height: 3px; transition: height .6s; }

/* correos */
.mail { display: grid; grid-template-columns: 340px 1fr; gap: 18px; }
.mail > * { min-width: 0; }
.mail-list { max-height: 72vh; overflow-y: auto; padding: 6px; }
.mail-item { padding: 12px; border-radius: 12px; cursor: pointer; display: grid; gap: 2px; }
.mail-item:hover { background: var(--blush); }
.mail-item.on { background: var(--petal); }
.mail-item b { font-weight: 500; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mail-item small { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mail-view iframe { width: 100%; height: 70vh; border: 0; border-radius: 12px; background: #F6EEF0; }
.mail-meta { font-size: 13px; color: var(--muted); margin-bottom: 12px; display: grid; gap: 2px; }

/* modal */
.modal { position: fixed; inset: 0; background: rgba(42, 15, 24, .45); z-index: 100; display: none; align-items: flex-start; justify-content: center; padding: 5vh 16px; overflow-y: auto; }
.modal.on { display: flex; animation: fade .25s; }
.modal-box { background: var(--card); border-radius: 22px; width: min(760px, 100%); padding: 26px; position: relative; animation: up .35s cubic-bezier(.2, .7, .2, 1); }
.modal-box h2 { font-weight: 300; font-size: 24px; letter-spacing: .18em; text-transform: uppercase; color: var(--wine); margin: 8px 0 4px; }
.modal-close { position: absolute; top: 14px; right: 14px; width: 40px; height: 40px; border-radius: 50%; font-size: 24px; }
.modal-close:hover { background: var(--blush); }
@keyframes fade { from { opacity: 0; } }
@keyframes up { from { transform: translateY(20px); opacity: 0; } }
.timeline { display: flex; gap: 6px; flex-wrap: wrap; margin: 16px 0; }
.timeline button { flex: 1; min-width: 92px; height: 40px; border-radius: 10px; border: 1px solid var(--line); background: #fff; font-size: 13px; }
.timeline button.done { background: var(--blush); border-color: var(--petal); color: var(--wine); }
.timeline button.on { background: var(--wine); color: #fff; border-color: var(--wine); }

.toast { position: fixed; bottom: 24px; left: 50%; transform: translate(-50%, 150%); background: var(--ink); color: #fff; padding: 12px 20px; border-radius: 14px; z-index: 200; transition: transform .4s cubic-bezier(.2, .7, .2, 1), opacity .3s, visibility .4s; font-size: 14px; max-width: calc(100% - 32px); opacity: 0; visibility: hidden; }
.toast.on { transform: translate(-50%, 0); opacity: 1; visibility: visible; }
.note { background: var(--blush); border-radius: 12px; padding: 12px 14px; font-size: 13px; color: var(--rose-deep); }

.mtop { display: none; }
.photo-actions { display: flex; gap: 8px; margin-top: 10px; }
.photo-actions .btn { flex: 1; }
.only-mob { display: none !important; }
.save-bar { display: none; }

@media (max-width: 1100px) {
  .kpis { grid-template-columns: 1fr 1fr; }
  .grid2, .mail { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
  .app { grid-template-columns: 1fr; }
  .side { position: fixed; inset: 0 auto 0 0; width: 270px; z-index: 90; transform: translateX(-100%); transition: transform .4s cubic-bezier(.2, .7, .2, 1); }
  .side.on { transform: none; box-shadow: 0 0 0 100vmax rgba(42, 15, 24, .4); }
  .mtop { display: flex; position: sticky; top: 0; z-index: 50; background: rgba(250, 244, 245, .92); backdrop-filter: blur(10px); padding: 12px 16px; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
  .mtop img { height: 24px; }
  .main { padding-top: 18px; }
  .form { grid-template-columns: 1fr; }
  .only-mob { display: inline-flex !important; }
  .only-desk { display: none !important; }
  .photo-actions label.only-mob span, .photo-actions .only-mob { display: inline-flex !important; }
  .save-bar { display: block; position: fixed; left: 0; right: 0; bottom: 0; z-index: 60; padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); background: rgba(250, 244, 245, .96); backdrop-filter: blur(10px); border-top: 1px solid var(--line); }
  .save-bar .btn { width: 100%; height: 50px; font-size: 15px; }
  .main:has(.save-bar) { padding-bottom: 100px; }
  .imgs { grid-template-columns: repeat(3, 1fr); }
  .img-tools button, .img-tools label { width: 30px; height: 30px; line-height: 30px; }
  .stepper button { width: 42px; height: 42px; font-size: 20px; }
  .stepper input { height: 42px; }
  .input, .sel { height: 46px; font-size: 16px; }
  textarea.input { font-size: 16px; }
  .search { max-width: none; }
  /* tablas como tarjetas */
  table.resp thead { display: none; }
  table.resp, table.resp tbody, table.resp tr, table.resp td { display: block; width: 100%; }
  table.resp tr { border: 1px solid var(--line); border-radius: 14px; margin-bottom: 10px; padding: 6px 12px; background: var(--card); }
  table.resp td { border: 0; padding: 7px 0; display: flex; justify-content: space-between; align-items: center; gap: 10px; }
  table.resp td[data-l]::before { content: attr(data-l); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
  table.resp td.first { display: block; }
  .pname { min-width: 0; }
  .mail-view iframe { height: 60vh; }
}
@media (max-width: 480px) {
  .kpi b { font-size: 24px; }
  .top-actions { width: 100%; }
  .top-actions .btn { flex: 1; }
}
@media (max-width: 600px) {
  .h-head { flex-wrap: wrap; }
  .h-slide { width: 72px; }
  .h-tools { width: 100%; justify-content: flex-end; }
  .h-tools > button { height: 40px; min-width: 44px; }
}
@media (max-width: 480px) {
  .vrow { flex-wrap: wrap; padding-bottom: 12px; margin-bottom: 12px; border-bottom: 1px solid var(--line); }
  .vrow [data-vn] { flex: 1 1 100%; }
  .vrow [data-vq] { flex: 1; }
}

/* ---------- inventario: escáner e historial ---------- */
.inv-qty { display: inline-flex; align-items: center; gap: 8px; }
.scan-btn { position: relative; width: 38px; padding: 0; }
.scan-btn svg { width: 18px; height: 18px; }
@media (max-width: 900px) { .scan-btn { width: 44px; height: 44px; } .scan-btn svg { width: 20px; height: 20px; } }
.scan-btn .dot { position: absolute; top: 5px; right: 5px; width: 7px; height: 7px; border-radius: 50%; background: var(--warn); }
.mv { display: inline-block; min-width: 34px; padding: 1px 8px; border-radius: 999px; font-weight: 600; font-size: 13px; text-align: center; }
.mv.in { background: var(--okbg); color: var(--ok); }
.mv.out { background: var(--dangerbg); color: var(--danger); }
html.no-scroll, html.no-scroll body { overflow: hidden; }
.scanner { position: fixed; inset: 0; z-index: 200; background: var(--bg); display: flex; flex-direction: column; overflow-y: auto; overscroll-behavior: contain; animation: fade .2s; }
.sc-head { display: flex; align-items: center; justify-content: space-between; padding: calc(10px + env(safe-area-inset-top)) 16px 10px; }
.sc-head h2 { margin: 0; font-weight: 300; font-size: 18px; letter-spacing: .22em; text-transform: uppercase; color: var(--wine); }
.sc-x { width: 44px; height: 44px; border-radius: 50%; font-size: 28px; color: var(--wine); }
.sc-cam { position: relative; margin: 0 16px; border-radius: 18px; overflow: hidden; background: #1E0A11; aspect-ratio: 4 / 3; max-height: 42vh; flex-shrink: 0; outline: 3px solid transparent; transition: outline-color .3s; }
.sc-cam video { width: 100%; height: 100%; object-fit: cover; display: block; }
.sc-frame { position: absolute; left: 7%; right: 7%; top: 22%; bottom: 22%; border: 2px solid rgba(255, 255, 255, .85); border-radius: 12px; box-shadow: 0 0 0 100vmax rgba(0, 0, 0, .25); }
.sc-frame::after { content: ''; position: absolute; left: 6%; right: 6%; top: 50%; height: 2px; background: #E89AB6; box-shadow: 0 0 10px #E89AB6; animation: scanline 1.8s ease-in-out infinite alternate; }
@keyframes scanline { from { transform: translateY(-34px); } to { transform: translateY(34px); } }
.sc-msg { position: absolute; left: 0; right: 0; bottom: 8px; margin: 0; text-align: center; color: #fff; font-size: 13px; text-shadow: 0 1px 4px rgba(0, 0, 0, .6); padding: 0 12px; }
.sc-cam.off { aspect-ratio: auto; min-height: 120px; display: grid; place-items: center; }
.sc-cam.off video, .sc-cam.off .sc-frame { display: none; }
.sc-cam.off .sc-msg { position: static; padding: 18px; }
.sc-cam.hit { outline-color: var(--ok); }
.sc-cam.miss { outline-color: var(--danger); }
.sc-body { padding: 14px 16px calc(24px + env(safe-area-inset-bottom)); display: grid; gap: 12px; align-content: start; width: min(640px, 100%); margin: 0 auto; }
.sc-modes { display: grid; grid-template-columns: 1fr 1fr; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 4px; gap: 4px; }
.sc-modes button { height: 42px; border-radius: 10px; font-weight: 500; color: var(--muted); }
.sc-modes button.on { background: var(--wine); color: #fff; }
.sc-modes button[data-mode="salida"].on { background: var(--danger); }
.sc-prod { display: flex; align-items: center; gap: 12px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 10px; }
.sc-prod img { width: 54px; height: 54px; border-radius: 10px; object-fit: cover; }
.sc-prod > div:nth-child(2) { flex: 1; min-width: 0; }
.sc-prod b, .sc-prod small { display: block; }
.sc-prod small { color: var(--muted); }
.sc-qty { text-align: center; }
.sc-qty b { font-size: 28px; font-weight: 300; color: var(--wine); line-height: 1; }
.sc-codes { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip { display: inline-flex; align-items: center; gap: 4px; background: var(--blush); color: var(--wine); border-radius: 999px; padding: 3px 4px 3px 10px; font-size: 12px; font-variant-numeric: tabular-nums; }
.chip button { width: 22px; height: 22px; border-radius: 50%; font-size: 15px; line-height: 1; }
.sc-last:empty { display: none; }
.sc-last { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; border-radius: 14px; padding: 12px; font-size: 14px; }
.sc-last small { flex-basis: 100%; color: var(--muted); }
.sc-last .btn { margin-left: auto; }
.sc-last.ok { background: var(--okbg); }
.sc-last.bad { background: var(--dangerbg); color: var(--danger); }
.sc-type { display: flex; gap: 8px; }
.sc-type .input { flex: 1; }
.sc-log h3 { margin: 6px 0 8px; font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--wine); font-weight: 500; }
.sc-log h3 small { letter-spacing: 0; text-transform: none; color: var(--muted); font-weight: 400; margin-left: 6px; }
.sc-log > div { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.sc-log > div small { margin-left: auto; color: var(--muted); font-variant-numeric: tabular-nums; }
.sc-pick { position: fixed; inset: 0; z-index: 210; background: rgba(42, 15, 24, .45); display: flex; align-items: flex-end; justify-content: center; }
.sc-pick-box { background: var(--card); width: min(560px, 100%); max-height: 85vh; border-radius: 22px 22px 0 0; padding: 20px 16px calc(16px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 10px; animation: up .3s cubic-bezier(.2, .7, .2, 1); }
.sc-pick-box h3 { margin: 0; font-weight: 300; letter-spacing: .2em; text-transform: uppercase; color: var(--wine); }
.sc-pick-box .hint { margin: 0; font-size: 13px; }
.sc-pick-list { overflow-y: auto; display: grid; gap: 6px; min-height: 120px; }
.sc-pick-list button { display: flex; align-items: center; gap: 10px; text-align: left; padding: 8px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.sc-pick-list img { width: 42px; height: 42px; border-radius: 8px; object-fit: cover; }
.sc-pick-list b, .sc-pick-list small { display: block; }
.sc-pick-list small { color: var(--muted); }
@media (min-width: 900px) {
  .scanner { background: rgba(42, 15, 24, .45); padding: 4vh 0; }
  .sc-head, .sc-cam, .sc-body { width: min(640px, 100%); margin-left: auto; margin-right: auto; background: var(--bg); }
  .sc-head { border-radius: 22px 22px 0 0; }
  .sc-cam { border-radius: 0; margin-top: 0; margin-bottom: 0; }
  .sc-body { border-radius: 0 0 22px 22px; }
}
.lbl-opts { display: flex; flex-wrap: wrap; gap: 12px 20px; align-items: end; margin-bottom: 12px; }
.lbl-opts .f { flex: 1 1 280px; }
.lbl-opts .f span { font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.lbl-opts .chk { display: inline-flex; align-items: center; gap: 8px; height: 46px; }
#ltable td[data-l="Etiquetas"] { white-space: nowrap; }
#ltable td[data-l="Etiquetas"] .btn { margin-left: 6px; }
.sc-print { display: inline-flex; align-items: center; gap: 6px; margin-top: 8px; font-size: 13px; color: var(--rose); }
.sc-print svg { width: 15px; height: 15px; stroke: currentColor; fill: none; stroke-width: 1.8; }

/* ---------- registrar venta ---------- */
.steps { list-style: none; display: flex; gap: 6px; padding: 0; margin: 0 0 14px; overflow-x: auto; scrollbar-width: none; }
.steps li { flex: 1; min-width: 0; }
.steps button { width: 100%; display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 12px; color: var(--muted); font-size: 13px; }
.steps button:disabled { cursor: default; }
.steps i { flex-shrink: 0; width: 24px; height: 24px; border-radius: 50%; border: 1px solid var(--line); display: grid; place-items: center; font-style: normal; font-size: 12px; background: var(--card); }
.steps .on button { color: var(--wine); font-weight: 500; }
.steps .on i { background: var(--wine); border-color: var(--wine); color: #fff; }
.steps .done i { background: var(--blush); border-color: var(--blush); color: var(--wine); }
.sale-card h3 { margin-top: 0; }
.sale-scan { width: 100%; height: 52px; font-size: 15px; }
.sale-scan svg { width: 20px; height: 20px; }
.sale-search { position: relative; margin: 12px 0; }
.sale-search .input { width: 100%; max-width: none; }
.sale-results:empty { display: none; }
.sale-results { display: grid; gap: 6px; margin-top: 8px; max-height: 340px; overflow-y: auto; }
.sale-results button { display: flex; align-items: center; gap: 10px; text-align: left; padding: 8px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.sale-results button:disabled { opacity: .5; }
.sale-results img { width: 42px; height: 42px; border-radius: 8px; object-fit: cover; }
.sale-results b, .sale-results small { display: block; }
.sale-results small { color: var(--muted); }
.sale-items .list-item { flex-wrap: wrap; }
.sale-items .grow { min-width: 140px; }
.sale-sub { text-align: right; margin: 12px 0 0; }
.sale-form { margin-top: 12px; }
.chips-pick { display: flex; flex-wrap: wrap; gap: 8px; }
.chips-pick button { height: 40px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--line); background: #fff; font-size: 14px; }
.chips-pick button.on { background: var(--wine); color: #fff; border-color: var(--wine); }
.opts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.opts.col { grid-template-columns: 1fr; }
.opt { text-align: left; padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: #fff; display: grid; gap: 3px; }
.opt b { color: var(--wine); font-weight: 500; }
.opt small { color: var(--muted); font-size: 12.5px; line-height: 1.35; }
.opt.on { border-color: var(--rose); box-shadow: inset 0 0 0 1px var(--rose); background: #FBEFF2; }
.quote { margin: 0; height: 46px; display: flex; align-items: center; font-weight: 500; }
.sale-paid { margin: 14px 0 10px; }
.sale-sum { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; margin: 16px 0 0; }
.sale-sum dt { color: var(--muted); font-size: 12px; letter-spacing: .1em; text-transform: uppercase; padding-top: 2px; }
.sale-sum dd { margin: 0; text-align: right; }
.sale-sum .tot { font-size: 18px; font-weight: 600; color: var(--wine); border-top: 1px solid var(--line); padding-top: 10px; letter-spacing: normal; text-transform: none; }
.sale-err { color: var(--danger); min-height: 18px; }
.sale-bar { display: flex !important; align-items: center; gap: 10px; }
.sale-bar .sale-tot { margin-right: auto; display: grid; line-height: 1.2; }
.sale-bar .sale-tot b { font-size: 18px; color: var(--wine); }
.sale-bar .sale-tot small { color: var(--muted); }
.sale-done { text-align: center; padding: 34px 20px; }
.sale-done h2 { font-weight: 300; letter-spacing: .18em; text-transform: uppercase; color: var(--wine); margin: 12px 0 4px; }
.sale-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 18px; }
@media (min-width: 901px) {
  .sale-bar { position: sticky; bottom: 0; margin-top: 14px; padding: 12px 16px; background: rgba(250, 244, 245, .96); border-top: 1px solid var(--line); z-index: 5; }
}
@media (max-width: 900px) {
  .sale-bar .btn { width: auto !important; flex: 1; max-width: 200px; }
  .main:has(.sale-bar) { padding-bottom: 110px; }
  .steps span { display: none; }
  .steps .on span { display: inline; }
  .steps li { flex: 0 0 auto; }
  .steps .on { flex: 1; }
}
@media (max-width: 600px) {
  .opts { grid-template-columns: 1fr; }
  .sale-actions .btn { width: 100%; }
}

/* ---------- app instalable y acceso ---------- */
.link-btn { display: block; width: 100%; margin-top: 12px; font-size: 13px; color: var(--rose); text-decoration: underline; text-underline-offset: 3px; }
.install-steps { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 14px 0; }
.install-steps .card.on { border-color: var(--rose); }
.install-steps ol { margin: 0; padding-left: 18px; display: grid; gap: 6px; font-size: 14px; }
@media (max-width: 600px) { .install-steps { grid-template-columns: 1fr; } }
@media (display-mode: standalone) {
  .mtop { padding-top: calc(12px + env(safe-area-inset-top)); }
  .side { padding-top: calc(24px + env(safe-area-inset-top)); }
}

/* ---------- borrador y vista previa ---------- */
.draft-bar { display: flex; align-items: center; gap: 10px 14px; flex-wrap: wrap; margin: 0 0 18px; padding: 10px 12px 10px 16px; border-radius: 16px; background: var(--warnbg); border: 1px solid #f0dcc4; }
.draft-bar.ok { background: transparent; border: 0; padding: 0; margin-bottom: 12px; color: var(--muted); font-size: 13px; }
.draft-bar.ok .btn { margin-left: auto; }
.draft-count { text-align: left; color: var(--warn); font-size: 14px; display: grid; flex: 1; min-width: 180px; }
.draft-count b { font-size: 16px; }
.draft-count small { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 60vw; }
.draft-actions { display: flex; gap: 8px; }
.draft-modal-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; margin-top: 14px; }
.pv { position: fixed; inset: 0; z-index: 150; background: var(--bg); display: flex; flex-direction: column; animation: fade .2s; }
.pv-bar { display: flex; align-items: center; gap: 10px; padding: calc(8px + env(safe-area-inset-top)) 12px 8px; background: #2A0F18; color: #F3DCE3; }
.pv-x { width: 40px; height: 40px; border-radius: 50%; font-size: 26px; color: #fff; flex-shrink: 0; }
.pv-t { display: grid; flex: 1; min-width: 0; line-height: 1.25; }
.pv-t b { letter-spacing: .18em; text-transform: uppercase; font-weight: 500; font-size: 12px; color: #fff; }
.pv-t small { font-size: 12px; opacity: .8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pv-bar .btn-g { background: transparent; color: #fff; border-color: rgba(255, 255, 255, .35); }
.pv iframe { flex: 1; width: 100%; border: 0; background: #fff; }
.test-toggle { display: flex !important; align-items: flex-start; gap: 10px; padding: 12px 14px; border: 1px dashed var(--line); border-radius: 14px; margin-bottom: 14px; }
.test-toggle span { display: grid; gap: 2px; }
.test-toggle small { color: var(--muted); font-size: 12.5px; }
.test-toggle.on { border-color: var(--warn); background: var(--warnbg); }
@media (max-width: 600px) {
  .draft-actions { width: 100%; }
  .draft-actions .btn { flex: 1; height: 40px; }
  .draft-modal-actions .btn { flex: 1; }
}
.sc-tools:empty { display: none; }
.sc-tools { position: absolute; top: 10px; right: 10px; display: flex; gap: 6px; }
.sc-tools button { min-width: 42px; height: 34px; padding: 0 10px; border-radius: 999px; background: rgba(0, 0, 0, .45); color: #fff; font-size: 13px; backdrop-filter: blur(6px); }
.sc-tools button.on { background: #fff; color: var(--wine); }
.sc-per { display: flex; align-items: center; justify-content: space-between; gap: 10px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 6px 6px 6px 14px; font-size: 14px; color: var(--muted); }
.sc-per .stepper input { width: 64px; }

/* ---------- links de carrito, comprobantes y avisos push ---------- */
.st.verificando { color: #8a5a12; background: #fbe9c9; }
.chip.warn { background: #fbe9c9; color: #8a5a12; border-color: transparent; }
.push-card { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; background: #FBEFF2; }
.push-card.on { background: var(--okbg); }
.push-card .grow { display: grid; gap: 4px; }
.push-card small { color: var(--muted); }
.receipt-card { margin-top: 14px; }
.receipt-card.pending { border-color: #e6c27f; background: #fffaf0; }
.receipt-row { display: flex; gap: 16px; align-items: flex-start; }
.receipt-thumb { flex: none; width: 120px; height: 150px; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); background: #fff; display: grid; place-items: center; }
.receipt-thumb img { width: 100%; height: 100%; object-fit: cover; }
.receipt-thumb span { font-weight: 600; letter-spacing: .1em; color: var(--rose); }
.receipt-actions { display: flex; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.receipt-actions .btn { flex: 1; min-width: 130px; height: 46px; }
.link-box { display: flex; gap: 8px; margin: 14px 0; }
.link-box .input { flex: 1; min-width: 0; font-size: 14px; }
.link-done h2 { margin: 10px 0 0; }
.links-card { margin-top: 18px; }
.link-row { flex-wrap: wrap; }
.link-acts { display: flex; gap: 6px; }
@media (max-width: 640px) {
  .receipt-row { flex-direction: column; }
  .receipt-thumb { width: 100%; height: 220px; }
  .link-box { flex-direction: column; }
  .link-row .grow { flex-basis: 100%; }
  .push-card { flex-direction: column; align-items: stretch; }
}
.list-item.click { cursor: pointer; border-radius: 10px; } .list-item.click:hover { background: #FBEFF2; }
.link-hist { color: var(--rose); text-decoration: underline; white-space: nowrap; }

/* modo prueba / producción (Registrar venta) */
.mode-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; padding: 10px 12px; border-radius: 14px; background: var(--card); border: 1px solid var(--line); }
.mode-bar.test { background: #fff5e6; border-color: #e6c27f; }
.mode-bar small { color: var(--muted); flex: 1; min-width: 200px; line-height: 1.45; }
.mode-bar.test small { color: #8a5a12; }
.mode-switch { display: inline-flex; padding: 3px; border-radius: 999px; background: var(--bg); border: 1px solid var(--line); }
.mode-switch button { border: 0; background: none; padding: 8px 16px; border-radius: 999px; font-size: 13px; color: var(--muted); cursor: pointer; }
.mode-switch button.on { background: var(--wine); color: #fff; }
.mode-bar.test .mode-switch button.on { background: #b5793f; }
.mode-note { margin: 12px 0 0; background: #fff5e6; color: #8a5a12; }
/* Forza: credenciales lado a lado en computadora, una debajo de otra en celular */
.fz-creds { grid-template-columns: 1fr 1fr; margin-top: 0; }
@media (max-width: 760px) { .fz-creds { grid-template-columns: 1fr; } }


/* Identidad 3.0 */
.top h1, .modal-box h2, .sc-head h2, .sale-done h2, .login-card h1, .login-card h2 { font-family: var(--f-display); font-weight: 400; }
.side { background: var(--night); }

/* publicar: rosca de carga y confirmación */
.spin { display: inline-block; width: 14px; height: 14px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; vertical-align: -2px; margin-right: 8px; animation: spin .7s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }
.btn .spin { margin-right: 0; }
.draft-bar.busy { background: var(--blush); border-color: var(--petal); }
.draft-bar.busy .draft-count { color: var(--wine); }
.draft-bar.busy .draft-count b { display: inline-flex; align-items: center; font-size: 15px; }
.draft-bar.done { background: var(--okbg); border-color: transparent; color: var(--ok); font-size: 14px; animation: fade .3s ease; }
.draft-bar.done .btn { margin-left: auto; }
.ok-check { width: 24px; height: 24px; border-radius: 50%; background: var(--ok); color: #fff; display: grid; place-items: center; font-size: 13px; font-weight: 700; animation: pop .4s cubic-bezier(.2,.9,.3,1.4); }
@keyframes pop { from { transform: scale(0); } }
@media (prefers-reduced-motion: reduce) { .spin { animation-duration: 2s; } .ok-check { animation: none; } }

/* Imágenes y portada: imágenes fijas de la tienda */
.h-imgs-g { margin: 18px 0 8px; font-size: 12px; letter-spacing: .2em; text-transform: uppercase; color: var(--wine); }
.h-img img.h-logo { object-fit: contain; background: #fff; padding: 10px; }
.h-img img.h-logo.on-dark { background: var(--night); }

/* Menú lateral en celular: altura real de la pantalla, desplazamiento propio y la página de atrás quieta */
@media (max-width: 820px) {
  .side { height: 100vh; height: 100dvh; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; touch-action: pan-y; padding-bottom: calc(24px + env(safe-area-inset-bottom)); }
  html.side-open, html.side-open body { overflow: hidden; overscroll-behavior: none; }
}

[hidden] { display: none !important; }

/* Ajustes: submenú de secciones */
.aj-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 0 0 6px; position: sticky; top: 0; z-index: 5; background: var(--bg); padding: 8px 0; }
.aj-tabs a { display: inline-flex; align-items: center; gap: 6px; height: 40px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); font-size: 13px; color: var(--ink); white-space: nowrap; flex: none; }
.aj-tabs a:hover { border-color: var(--rose); }
.aj-tabs a.on { background: var(--wine); border-color: var(--wine); color: #fff; }
.aj-tabs a small { font-size: 11px; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--blush); color: var(--wine); display: inline-grid; place-items: center; }
.aj-tabs a.on small { background: rgba(255,255,255,.2); color: #fff; }
.aj-crumb { margin: 0 0 4px; font-size: 12px; letter-spacing: .2em; text-transform: uppercase; }
.aj-crumb a { color: var(--rose); }
.aj-note { margin: 0 0 14px; }
.aj-panes { grid-template-columns: 1fr; max-width: 820px; }
.aj-panes > div:empty, .aj-panes > div:not(:has(> .card:not([hidden]))) { display: none; }
@media (max-width: 820px) {
  .aj-tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -16px 6px; padding: 8px 16px; top: 56px; }
  .aj-tabs::-webkit-scrollbar { display: none; }
}

/* Menú lateral agrupado */
.side .nav-g { font-size: 10px; letter-spacing: .24em; text-transform: uppercase; opacity: .5; padding: 14px 12px 4px; }
.side .nav-g:first-of-type { padding-top: 0; }
.side-tools { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; border-top: 1px solid rgba(255,255,255,.1); padding-top: 10px; }
.side-tools a { font-size: 12px; padding: 9px 8px; gap: 7px; white-space: nowrap; overflow: hidden; }
.side-tools svg { width: 17px; height: 17px; }

/* Resumen: accesos rápidos */
.quick-acts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin: 0 0 18px; }
.qa { display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 12px; align-items: center; text-align: left; padding: 16px 18px; border-radius: var(--r); background: var(--card); border: 1px solid var(--line); color: var(--ink); cursor: pointer; transition: border-color .2s, transform .2s; }
.qa:hover { border-color: var(--rose); transform: translateY(-1px); }
.qa svg { grid-row: span 2; width: 26px; height: 26px; stroke: var(--rose); fill: none; stroke-width: 1.6; }
.qa b { font-weight: 600; font-size: 15px; }
.qa small { color: var(--muted); font-size: 12.5px; }
.qa.hot { border-color: var(--warn); background: var(--warnbg); }
.qa.hot svg { stroke: var(--warn); }
@media (max-width: 760px) { .quick-acts { grid-template-columns: 1fr; } }

/* ---------- Finanzas ---------- */
.fin-bar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin: 4px 0 14px; }
.fin-bar .search { flex: 1; min-width: 180px; }
.fin-period { min-width: 190px; font-weight: 600; }
.fin-alerts { display: grid; gap: 8px; margin-bottom: 14px; }
.fin-alerts .note { display: block; }
.kpi b.neg, .neg { color: #b3261e !important; }
.pos { color: #2e7d4f; }
.fin-t td.num, .fin-t th.num, .fin-pl td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.fin-t tfoot td { font-weight: 600; border-top: 2px solid var(--line); padding-top: 10px; }
.fin-pl { width: 100%; border-collapse: collapse; }
.fin-pl td { padding: 8px 0; border-bottom: 1px solid var(--line); }
.fin-pl tr.sub td { color: var(--muted); padding-left: 10px; }
.fin-pl tr.tot td { font-weight: 600; color: var(--ink); }
.fin-pl tr.big td { font-size: 17px; color: var(--wine); border-bottom: 0; }
.fin-chart { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 6px; height: 200px; align-items: end; }
.fin-chart > div { display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; justify-content: flex-end; font-size: 11px; color: var(--muted); }
.fin-chart .cols { display: flex; gap: 2px; align-items: flex-end; width: 100%; justify-content: center; flex: 1; }
.fin-chart .cols i { width: 42%; max-width: 18px; border-radius: 4px 4px 1px 1px; min-height: 2px; }
.fin-chart i.s, .fin-legend i.s { background: var(--rose); }
.fin-chart i.g, .fin-legend i.g { background: var(--wine); }
.fin-chart .v { font-size: 10px; white-space: nowrap; }
.fin-chart .n { color: var(--wine); font-weight: 600; min-height: 14px; }
.fin-legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12.5px; margin: 12px 0 0; align-items: center; }
.fin-legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.fin-li { display: grid; grid-template-columns: 1fr auto; column-gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.fin-li small { grid-column: 1 / -1; color: var(--muted); font-size: 12px; }
.fin-gl { display: flex; justify-content: space-between; gap: 10px; margin: 12px 0 6px; font-size: 14px; }
.fin-goal { height: 10px; border-radius: 99px; background: var(--blush); overflow: hidden; }
.fin-goal i { display: block; height: 100%; background: var(--rose); border-radius: 99px; }
.fin-disc { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 0 0 14px; }
.fin-disc > span { font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.fin-disc .chips-pick button { height: 34px; font-size: 13px; padding: 0 12px; }
.fin-disc-other { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.fin-disc-other .input { width: 70px; height: 34px; }
.fin-gain { font-weight: 600; }
.fin-gain.ok { color: #2e7d4f; }
.fin-gain.low { color: #b3261e; }
.fin-rule { margin-bottom: 14px; }
.fin-rule p { margin: 6px 0 0; font-size: 14px; color: var(--ink); }
.fin-pct { display: flex; align-items: center; gap: 6px; }
.fin-pct .input { max-width: 120px; }
.fin-ex { margin: 0; font-size: 13.5px; line-height: 1.6; }
.fin-steps { margin: 8px 0 12px; padding-left: 18px; line-height: 1.7; }
.fin-file { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.fin-file span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fin-form3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.fin-amt { display: flex; gap: 6px; }
.fin-amt .input { flex: 1; min-width: 0; }
.fin-cur { width: 86px; flex: none; }
.fin-fx { margin: 0; font-size: 15px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-height: 42px; }
.fin-lines td { vertical-align: top; }
.fin-lines .input, .fin-lines .sel { height: 38px; font-size: 13.5px; }
.fin-lines td > .input + .input, .fin-lines td > .sel + .sel { margin-top: 6px; }
/* Cada producto de la compra es una tarjeta: datos arriba, cálculos abajo */
.fin-lines, .fin-lines tbody, .fin-lines tfoot { display: block; width: 100%; }
.fin-lines thead { display: none; }
.fin-lines tbody tr { position: relative; display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px 14px; border: 1px solid var(--line); border-radius: 14px; margin-bottom: 10px; padding: 14px 48px 14px 14px; background: var(--card); }
.fin-lines tbody td { border: 0; padding: 0; min-width: 0; }
.fin-lines tbody td:nth-child(1), .fin-lines tbody td:nth-child(2) { grid-column: span 2; }
.fin-lines tbody td:nth-child(n+5) { background: var(--bg); border-radius: 10px; padding: 8px 10px; text-align: left; }
.fin-lines tbody td:last-child { position: absolute; top: 10px; right: 10px; background: none; padding: 0; }
.fin-lines tbody td:last-child:has([data-papply]) { position: static; grid-column: 1 / -1; }
.fin-lines tbody tr:has([data-papply]), .fin-lines tbody tr:not(:has([data-pdel])) { padding-right: 14px; }
.fin-lines td[data-l]::before { content: attr(data-l); display: block; font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin-bottom: 4px; }
.fin-lines td .input, .fin-lines td .sel { width: 100%; }
.fin-lines td.num { font-size: 14px; }
.fin-lines tfoot tr { display: flex; flex-wrap: wrap; gap: 6px 18px; padding: 10px 4px 0; }
.fin-lines tfoot td { border: 0; padding: 0; }
.fin-lines tfoot td:empty { display: none; }
.fin-n { text-align: right; }
.fin-cost { width: 90px; text-align: right; height: 36px; }
.fin-warn { display: block; color: #8a5a12; font-size: 12px; margin-top: 4px; }
.fin-skip { font-size: 12px; margin-top: 6px; }
tr.fin-doubt td { background: #fff7e3; }
.fin-pgrid { margin-top: 0; }
@media (max-width: 820px) {
  .fin-form3 { grid-template-columns: 1fr; }
  .fin-chart { gap: 3px; height: 170px; } .fin-chart .v { display: none; }
  .fin-lines tbody tr { grid-template-columns: 1fr 1fr; padding-right: 44px; }
  .fin-lines tbody td:nth-child(1), .fin-lines tbody td:nth-child(2) { grid-column: 1 / -1; }
  .fin-n, .fin-cost { width: 100%; text-align: left; }
}

.fin-lines td small { overflow-wrap: anywhere; }

/* Ajustes → Integraciones */
.int-tabs { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; margin: 6px 0 18px; }
.int-tabs a { display: grid; gap: 2px; padding: 12px 16px; border-radius: 14px; border: 1px solid var(--line); background: var(--card); color: var(--ink); }
.int-tabs a small { color: var(--muted); font-size: 12px; }
.int-tabs a.on { background: var(--wine); border-color: var(--wine); color: #fff; }
.int-tabs a.on small { color: rgba(255,255,255,.75); }

/* Integraciones: qué ambiente usa la tienda en vivo y cuál la vista previa */
.env-row { display: flex; justify-content: space-between; align-items: center; gap: 14px; flex-wrap: wrap; padding: 10px 0; border-bottom: 1px solid var(--line); }
.env-row b { display: block; } .env-row small { color: var(--muted); font-size: 12.5px; }
.env-row .tab { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.env-row .tab input { accent-color: var(--rose); }
.warn-note { background: #fbe9c9; color: #8a5a12; margin-top: 12px; }

/* Contraseñas: botón "Ver" dentro del campo */
.pw-wrap { position: relative; display: flex; }
.pw-wrap .input { flex: 1; padding-right: 86px; }
.pw-eye { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); height: 32px; padding: 0 12px; border-radius: 8px; border: 1px solid var(--line); background: #fff; font-size: 12.5px; color: var(--ink); cursor: pointer; }
.env-pass { margin-top: 14px; padding: 14px; border-radius: 12px; background: var(--blush); }

/* Contraseña de ambientes: tarjeta desplegable */
.pin-card { padding-top: 0; padding-bottom: 0; }
.pin-card > summary { list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 0; }
.pin-card > summary::-webkit-details-marker { display: none; }
.pin-sum { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.pin-act { font-size: 13px; color: var(--rose-deep); font-weight: 700; white-space: nowrap; }
.pin-act::after { content: " ▾"; }
.pin-card[open] .pin-act::after { content: " ▴"; }
.pin-body { padding-bottom: 18px; }
.pin-ok { display: flex; align-items: center; gap: 12px; padding: 14px; border-radius: 12px; background: var(--okbg); color: var(--ok); animation: fade .3s ease; }
.pin-ok small { display: block; color: var(--ink, inherit); opacity: .8; margin-top: 2px; }
.btn-s .spin { width: 12px; height: 12px; }
.pin-sum b { font-size: 12px; letter-spacing: .2em; text-transform: uppercase; color: var(--wine); font-weight: 500; }

/* Wompi: resultado de "Probar conexión" */
.wp-diag { margin-top: 14px; display: grid; gap: 8px; }
.wp-step { padding: 10px 12px; border-radius: 10px; background: var(--okbg); }
.wp-step.bad { background: var(--dangerbg); }
.wp-step > b { display: block; font-size: 14px; color: var(--ok); }
.wp-step.bad > b { color: var(--danger); }
.wp-step small { display: block; margin-top: 2px; font-size: 13px; }
.wp-step details { margin-top: 6px; font-size: 12px; }
.wp-step summary { cursor: pointer; color: var(--rose-deep); }
.wp-step pre { margin: 6px 0 0; padding: 10px; background: #fff; border-radius: 8px; max-height: 260px; overflow: auto; white-space: pre-wrap; word-break: break-all; font-size: 12px; }

/* Tienda en construcción */
.uc-card.on { border-color: var(--warn); background: var(--warnbg); }

/* Tienda en vivo (otra pestaña) */
.side a.side-live { margin: 4px 0 6px; background: rgba(255, 255, 255, .1); color: #fff; border: 1px solid rgba(255, 255, 255, .18); font-weight: 700; }
.side a.side-live:hover { background: rgba(255, 255, 255, .17); }
.side a.side-live svg:last-child { margin-left: auto; width: 15px; height: 15px; opacity: .8; }
.btn svg + * { margin-left: 0; }

/* Botones de guardar: "Guardando…" mientras trabaja y "Guardado" al terminar */
.btn.is-busy { pointer-events: none; opacity: .85; cursor: progress; }
.btn.is-busy .spin { margin-right: 6px; }
.btn.is-done { background: var(--ok, #2e7d4f) !important; border-color: var(--ok, #2e7d4f) !important; color: #fff !important; pointer-events: none; }
.flash-err { color: var(--danger) !important; background: var(--dangerbg); border-radius: 8px; padding: 6px 8px; transition: background .3s; }

/* Pedido: tarjetas en dos columnas que en el celular van una debajo de la otra */
.grid2.g-even { grid-template-columns: 1fr 1fr; }
@media (max-width: 820px) { .grid2.g-even { grid-template-columns: 1fr; } }
#modalBody .grid2.g-even { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }

/* Forza en el pedido */
.fz-guide { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 6px; }
.fz-acts { display: flex; flex-wrap: wrap; gap: 8px; }
.fz-pdf { margin-top: 12px; }
.fz-pdf iframe { width: 100%; height: 520px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.fz-saved { margin: 4px 0 0; color: #2e7d4f; font-weight: 600; }
@media (max-width: 700px) { .fz-pdf iframe { height: 440px; } }
.fz-out { margin-top: 12px; }
.fz-out .fz-err { color: var(--danger); }
.fz-out .fz-ok { margin: 0 0 6px; color: var(--ok); }
.fz-tl { list-style: none; margin: 0; padding: 0 0 0 4px; display: grid; gap: 10px; }
.fz-tl li { position: relative; padding-left: 20px; }
.fz-tl li::before { content: ''; position: absolute; left: 0; top: 5px; width: 10px; height: 10px; border-radius: 50%; background: var(--line); }
.fz-tl li::after { content: ''; position: absolute; left: 4px; top: 18px; bottom: -8px; width: 2px; background: var(--line); }
.fz-tl li:last-child::after { display: none; }
.fz-tl li.now::before { background: var(--rose); box-shadow: 0 0 0 4px rgba(194, 24, 91, .15); }
.fz-tl b { display: block; font-size: 14px; }
.fz-tl small { color: var(--muted); font-size: 12px; }
.pk-box { border-top: 1px dashed var(--line); margin: 0 0 12px; padding: 0 0 12px; }
.pk-loc { display: flex; gap: 8px; flex-wrap: wrap; }
.pk-loc .input { flex: 1 1 260px; }
.mp-prev { width: 100%; height: 300px; border: 1px solid var(--line); border-radius: 12px; }
.uc-testers .chips { display: flex; flex-wrap: wrap; gap: 6px; }
.uc-testers .chip button { border: 0; background: none; margin-left: 4px; font-size: 15px; line-height: 1; cursor: pointer; color: inherit; }

/* Comprobante de transferencia: imagen | lectura de Claude + pago (en celular, uno debajo del otro) */
.rc-grid { display: grid; grid-template-columns: minmax(180px, 240px) 1fr; gap: 20px; align-items: start; }
.rc-left .receipt-thumb { position: relative; width: 100%; height: 300px; padding: 0; cursor: zoom-in; font: inherit; }
.rc-left .receipt-thumb em { position: absolute; left: 8px; bottom: 8px; padding: 4px 10px; border-radius: 20px; background: rgba(42, 15, 24, .75); color: #fff; font-size: 12px; font-style: normal; }
.rc-left .receipt-thumb img { object-fit: contain; background: #fff; }
.rc-right #payForm { margin: 12px 0 0; padding: 14px; box-shadow: none; }
.rc-right .receipt-actions { margin-top: 12px; }
.rc-ai { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; background: #fff; }
.rc-ai-h { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 6px; }
.rc-row { display: grid; grid-template-columns: 120px 1fr auto; gap: 8px; padding: 5px 0; border-bottom: 1px dashed var(--line); font-size: 14px; }
.rc-row span { color: var(--muted); }
.rc-row b { font-weight: 600; word-break: break-word; }
.rc-row i { font-style: normal; font-weight: 700; }
.rc-row i.ok { color: var(--ok); }
.rc-row i.bad { color: var(--danger); }
.rc-issues { margin: 8px 0 0; padding: 8px 10px 8px 26px; border-radius: 10px; background: var(--dangerbg); color: var(--danger); font-size: 13px; }
@media (max-width: 760px) {
  .rc-grid { grid-template-columns: 1fr; }
  .rc-left .receipt-thumb { height: 260px; }
  .rc-row { grid-template-columns: 105px 1fr auto; }
}
.rc-view { position: fixed; inset: 0; z-index: 400; background: rgba(20, 6, 11, .92); display: flex; flex-direction: column; }
.rc-view-bar { display: flex; gap: 8px; align-items: center; padding: 12px 14px; padding-top: calc(12px + env(safe-area-inset-top)); color: #fff; }
.rc-view-bar b { flex: 1; }
.rc-view-body { flex: 1; overflow: auto; display: grid; place-items: center; padding: 10px; }
.rc-view-body img { max-width: none; cursor: zoom-out; }
.rc-view-body img.fit { max-width: 100%; max-height: calc(100vh - 90px); object-fit: contain; cursor: zoom-in; }
.rc-view-body iframe { width: min(900px, 100%); height: calc(100vh - 90px); border: 0; background: #fff; border-radius: 8px; }

/* Asistente (chat con tu tienda) */
.as-card { display: flex; flex-direction: column; padding: 0; overflow: hidden; height: calc(100vh - 230px); min-height: 460px; }
.as-msgs { flex: 1; overflow-y: auto; padding: 18px; display: flex; flex-direction: column; gap: 12px; background: #fcf8f6; }
.as-msg { display: flex; flex-direction: column; max-width: 86%; }
.as-msg.me { align-self: flex-end; align-items: flex-end; }
.as-msg.ai { align-self: flex-start; }
.as-bubble { padding: 10px 14px; border-radius: 16px; line-height: 1.5; font-size: 14.5px; word-break: break-word; }
.as-msg.me .as-bubble { background: var(--wine); color: #fff; border-bottom-right-radius: 4px; }
.as-msg.ai .as-bubble { background: #fff; border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.as-bubble p { margin: 0 0 6px; } .as-bubble p:last-child { margin-bottom: 0; }
.as-bubble ul { margin: 4px 0 8px; padding-left: 20px; }
.as-bubble a { color: var(--rose); word-break: break-all; }
.as-bubble code { background: #f3ecee; padding: 1px 5px; border-radius: 4px; font-size: 13px; }
.as-used { color: var(--muted); font-size: 11px; margin: 3px 6px 0; }
.as-typing { display: flex; align-items: center; gap: 4px; color: var(--muted); }
.as-typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--rose); opacity: .4; animation: asDot 1.2s infinite; }
.as-typing i:nth-child(2) { animation-delay: .2s; } .as-typing i:nth-child(3) { animation-delay: .4s; }
.as-typing span { margin-left: 8px; font-size: 13px; }
@keyframes asDot { 40% { opacity: 1; transform: translateY(-3px); } }
.as-empty { margin: auto; text-align: center; max-width: 560px; padding: 20px 6px; }
.as-empty > svg { width: 40px; height: 40px; stroke: var(--rose); fill: none; stroke-width: 1.5; }
.as-empty h3 { margin: 8px 0 4px; }
.as-sug { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 14px; }
.as-sug button { border: 1px solid var(--petal); background: #fff; color: var(--wine); border-radius: 20px; padding: 8px 14px; font: inherit; font-size: 13px; cursor: pointer; }
.as-sug button:hover { border-color: var(--rose); }
.as-input { display: flex; gap: 8px; align-items: flex-end; padding: 12px; border-top: 1px solid var(--line); background: #fff; }
.as-input textarea { flex: 1; resize: none; border: 1px solid var(--line); border-radius: 14px; padding: 11px 14px; font: inherit; font-size: 15px; max-height: 160px; outline: none; }
.as-input textarea:focus { border-color: var(--rose); }
.as-mic, .as-send { flex: none; width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line); background: #fff; display: grid; place-items: center; cursor: pointer; }
.as-mic svg, .as-send svg { width: 20px; height: 20px; stroke: var(--wine); fill: none; stroke-width: 1.8; }
.as-send { background: var(--rose); border-color: var(--rose); } .as-send svg { stroke: #fff; }
.as-mic.on { background: var(--rose); border-color: var(--rose); animation: asPulse 1.2s infinite; } .as-mic.on svg { stroke: #fff; }
@keyframes asPulse { 50% { box-shadow: 0 0 0 8px rgba(194, 24, 91, .18); } }
.as-foot { margin: 0; padding: 0 14px 12px; font-size: 12px; background: #fff; }
.as-action { margin-top: 10px; padding: 12px; border-radius: 12px; border: 1px dashed var(--rose); background: #fff7fa; }
.as-action.hecho { border-style: solid; border-color: var(--ok); background: var(--okbg); }
.as-action.cancelada { opacity: .6; }
.as-action ul { margin: 6px 0; } .as-action em { color: var(--danger); font-style: normal; font-size: 12px; }
.as-act-btns, .as-link { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.as-link .input { flex: 1 1 200px; font-size: 13px; }
@media (max-width: 900px) { .as-card { height: calc(100vh - 190px); } .as-msg { max-width: 94%; } }
.as-clip { flex: none; width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line); display: grid; place-items: center; font-size: 19px; cursor: pointer; background: #fff; }
.as-attach { display: flex; gap: 8px; flex-wrap: wrap; padding: 10px 12px 0; background: #fff; border-top: 1px solid var(--line); }
.as-chip { display: flex; align-items: center; gap: 6px; padding: 4px 6px 4px 4px; border: 1px solid var(--line); border-radius: 10px; font-size: 12px; max-width: 220px; }
.as-chip img { width: 34px; height: 34px; object-fit: cover; border-radius: 6px; }
.as-chip small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.as-chip button { border: 0; background: none; font-size: 16px; cursor: pointer; color: var(--muted); }
.as-files { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.as-files span { font-size: 12px; padding: 3px 8px; border-radius: 8px; background: rgba(255, 255, 255, .18); }
.as-msg.ai .as-files span { background: #f3ecee; }
.as-golinks { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.as-bubble a.as-go { font-weight: 700; text-decoration: none; }
.as-action.danger { border-color: var(--danger); background: var(--dangerbg); }
.as-action.danger .btn-x { background: var(--danger); border-color: var(--danger); color: #fff; }
.as-status { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; margin-top: 4px; }
.as-status .spin { margin: 0; }
.rc-left .receipt-thumb.rc-more { height: 120px; margin-top: 8px; }
.rc-items { display: grid; gap: 4px; margin: 4px 0 6px; padding: 8px 10px; border-radius: 10px; background: #faf5f2; font-size: 13px; }
.pay-banks { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.pay-banks h4 { margin: 0 0 6px; font-size: .78rem; letter-spacing: .16em; text-transform: uppercase; color: var(--wine, #6b1530); }
.pay-banks [data-bank-row] { background: #fff !important; }
