:root {
  --brand-primary: #dc2626; --brand-dark: #991b1b; --brand-light: #fef2f2;
  --brand-font: system-ui, -apple-system, 'Segoe UI', sans-serif;
  --ink: #0f172a; --muted: #64748b; --line: #e2e8f0; --bg: #f1f5f9; --card: #fff;
  --r: 16px; --tap: 46px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; margin: 0; }
body { font-family: var(--brand-font); color: var(--ink); background: var(--bg); overflow: hidden; user-select: none; -webkit-user-select: none; touch-action: manipulation; }
input, textarea { user-select: text; -webkit-user-select: text; font-family: inherit; }
[x-cloak] { display: none !important; }
button { font-family: inherit; cursor: pointer; border: 0; color: inherit; background: none; }
.num { font-variant-numeric: tabular-nums; }

/* ---------- Estructura ---------- */
.app { height: 100vh; height: 100dvh; display: grid; grid-template-rows: 60px minmax(0, 1fr) auto; }
.topbar { display: flex; align-items: center; gap: 14px; padding: 0 20px; background: var(--brand-primary); color: #fff; box-shadow: 0 2px 12px rgba(0,0,0,.18); z-index: 5; }
.topbar .logo { height: 36px; max-width: 160px; object-fit: contain; }
.topbar .name { font-weight: 800; font-size: 20px; letter-spacing: .2px; }
.topbar .sp { flex: 1; }
.topbar .who { font-size: 13px; opacity: .9; text-align: right; line-height: 1.2; }
.chip-top { background: rgba(255,255,255,.18); padding: 8px 14px; border-radius: 999px; font-weight: 600; font-size: 14px; min-height: 40px; }
.chip-top.on { background: #fff; color: var(--brand-dark); }
.btn-send { background: #fff; color: var(--brand-dark); font-weight: 800; padding: 0 22px; height: 44px; border-radius: 12px; font-size: 16px; box-shadow: 0 4px 12px rgba(0,0,0,.2); }
.main { display: grid; grid-template-columns: 60% 40%; min-height: 0; }

/* ---------- Panel izquierdo ---------- */
.left { display: flex; flex-direction: column; min-height: 0; padding: 14px 18px 8px; gap: 10px; background: linear-gradient(160deg, var(--brand-light) 0%, #fff 70%); }
.vtabs { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; flex-shrink: 0; }
.vtab { white-space: nowrap; padding: 10px 16px; border-radius: 12px; background: #fff; border: 2px solid var(--line); font-weight: 600; min-height: 46px; }
.vtab.on { border-color: var(--brand-primary); background: var(--brand-primary); color: #fff; }
.stage { flex: 1; min-height: 0; position: relative; display: flex; align-items: center; justify-content: center; }
.stage img.photo { max-width: 100%; max-height: 100%; object-fit: contain; filter: drop-shadow(0 18px 24px rgba(0,0,0,.25)); }
.stage svg { width: min(92%, 640px); max-height: 100%; filter: drop-shadow(0 18px 20px rgba(0,0,0,.25)); }
.vtitle { position: absolute; left: 4px; top: 0; }
.vtitle h1 { margin: 0; font-size: 30px; line-height: 1.05; letter-spacing: -.5px; }
.vtitle p { margin: 3px 0 0; color: var(--muted); font-weight: 600; }
.vprice { position: absolute; right: 4px; top: 0; text-align: right; }
.vprice small { display: block; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .8px; }
.vprice b { font-size: 30px; color: var(--brand-dark); }
.swatches { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.sw { width: 44px; height: 44px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 0 0 2px var(--line), 0 2px 6px rgba(0,0,0,.2); }
.sw.on { box-shadow: 0 0 0 3px var(--brand-primary), 0 2px 6px rgba(0,0,0,.2); transform: scale(1.1); }
.ficha { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; flex-shrink: 0; }
.ficha div { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 7px 10px; }
.ficha small { display: block; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .5px; }
.ficha b { font-size: 14px; }
.accs { display: flex; gap: 8px; flex-wrap: wrap; flex-shrink: 0; align-items: center; }
.acc { padding: 8px 14px; border-radius: 999px; border: 2px dashed var(--line); background: #fff; font-weight: 600; min-height: 42px; }
.acc.on { border: 2px solid var(--brand-primary); background: var(--brand-light); color: var(--brand-dark); }
.lbl { font-size: 12px; text-transform: uppercase; letter-spacing: .8px; color: var(--muted); font-weight: 700; }

/* ---------- Panel derecho ---------- */
.right { overflow-y: auto; padding: 14px 18px 8px 8px; display: flex; flex-direction: column; gap: 10px; background: #fff; border-left: 1px solid var(--line); -webkit-overflow-scrolling: touch; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 9px 14px 10px; }
.card h3 { margin: 0 0 4px; font-size: 13px; text-transform: uppercase; letter-spacing: .8px; color: var(--muted); display: flex; justify-content: space-between; align-items: center; }
.row { display: flex; align-items: center; gap: 8px; }
.btn { min-height: var(--tap); min-width: 54px; padding: 0 6px; white-space: nowrap; border-radius: 14px; background: #fff; border: 2px solid var(--line); font-weight: 800; font-size: 16px; flex: 1; transition: transform .08s; }
.btn:active { transform: scale(.94); background: var(--brand-light); }
.btn.neg { color: #b91c1c; } .btn.pos { color: #047857; }
.big { font-size: 26px; font-weight: 800; }
.input-big { width: 100%; height: var(--tap); border: 2px solid var(--line); border-radius: 14px; padding: 0 12px; font-size: 22px; font-weight: 800; text-align: center; color: var(--brand-dark); }
.input-big:focus { outline: none; border-color: var(--brand-primary); }
.pills { display: flex; gap: 8px; flex-wrap: wrap; }
.pill { flex: 1; min-width: 64px; min-height: 44px; border-radius: 14px; border: 2px solid var(--line); font-weight: 800; font-size: 17px; background: #fff; }
.pill.on { background: var(--brand-primary); border-color: var(--brand-primary); color: #fff; }
.hint { font-size: 12px; color: var(--muted); }

input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; height: 38px; background: transparent; margin: 0; touch-action: none; }
input[type=range]::-webkit-slider-runnable-track { height: 12px; border-radius: 8px; background: linear-gradient(90deg, var(--brand-primary) var(--fill, 50%), #e2e8f0 var(--fill, 50%)); }
input[type=range]::-moz-range-track { height: 12px; border-radius: 8px; background: #e2e8f0; }
input[type=range]::-moz-range-progress { height: 12px; border-radius: 8px; background: var(--brand-primary); }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 40px; height: 40px; margin-top: -14px; border-radius: 50%; background: #fff; border: 5px solid var(--brand-primary); box-shadow: 0 3px 10px rgba(0,0,0,.3); }
input[type=range]::-moz-range-thumb { width: 28px; height: 28px; border-radius: 50%; background: #fff; border: 5px solid var(--brand-primary); }

/* ---------- Comparador ---------- */
.compare { background: #0f172a08; border-top: 1px solid var(--line); padding: 8px 18px 10px; background: #fff; }
.cmp-head { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; flex-wrap: wrap; }
.plan-chip { padding: 7px 14px; border-radius: 999px; border: 2px solid var(--line); background: #fff; font-weight: 700; font-size: 14px; min-height: 40px; }
.plan-chip.on { border-color: var(--brand-primary); background: var(--brand-light); color: var(--brand-dark); }
.cmp-grid { display: grid; gap: 10px; grid-template-columns: repeat(3, 1fr); }
.pc { border: 2px solid var(--line); border-radius: var(--r); padding: 8px 12px; background: #fff; text-align: left; position: relative; }
.pc.act { border-color: var(--brand-primary); box-shadow: 0 6px 20px color-mix(in srgb, var(--brand-primary) 25%, transparent); }
.pc .t { font-weight: 800; font-size: 15px; line-height: 1.15; } .pc .e { color: var(--muted); font-size: 12px; }
.pc .cuota { font-size: 27px; font-weight: 800; color: var(--brand-dark); line-height: 1.1; margin: 2px 0; }
.pc dl { margin: 0; display: grid; grid-template-columns: auto 1fr auto 1fr; gap: 1px 8px; font-size: 12px; }
.pc dt { color: var(--muted); } .pc dd { margin: 0; font-weight: 700; text-align: right; }
.badge { display: inline-block; font-size: 10.5px; font-weight: 700; padding: 2px 7px; border-radius: 6px; background: #fef3c7; color: #92400e; }
.badge.var { background: #e0e7ff; color: #3730a3; } .badge.fix { background: #dcfce7; color: #166534; }
.best { position: absolute; top: -9px; right: 12px; background: var(--brand-primary); color: #fff; font-size: 11px; font-weight: 800; padding: 2px 10px; border-radius: 99px; }

/* ---------- Modal ---------- */
.overlay { position: fixed; inset: 0; background: rgba(15,23,42,.6); display: flex; align-items: center; justify-content: center; z-index: 50; padding: 16px; backdrop-filter: blur(3px); }
.modal { background: #fff; border-radius: 22px; width: min(1100px, 100%); max-height: 94vh; display: grid; grid-template-columns: 1fr 1.1fr; overflow: hidden; box-shadow: 0 30px 80px rgba(0,0,0,.4); }
.modal .form { padding: 22px; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; }
.modal h2 { margin: 0 0 4px; font-size: 22px; }
.fld { display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: 700; color: var(--muted); }
.fld input, .fld textarea { height: 48px; border: 2px solid var(--line); border-radius: 12px; padding: 0 12px; font-size: 17px; color: var(--ink); }
.fld textarea { height: 64px; padding: 8px 12px; }
.fld input:focus, .fld textarea:focus { outline: none; border-color: var(--brand-primary); }
.cta { background: var(--brand-primary); color: #fff; height: 56px; border-radius: 14px; font-weight: 800; font-size: 18px; }
.cta[disabled] { opacity: .6; } .cta.ghost { background: #fff; color: var(--brand-dark); border: 2px solid var(--brand-primary); }
.err { background: #fee2e2; color: #991b1b; padding: 8px 12px; border-radius: 10px; font-weight: 600; font-size: 14px; }
.okbox { background: #dcfce7; color: #166534; padding: 10px 14px; border-radius: 12px; font-weight: 600; }
.sheet-wrap { background: #e2e8f0; padding: 16px; overflow-y: auto; }
.sheet { background: #fff; font-size: 12px; box-shadow: 0 4px 20px rgba(0,0,0,.15); }
.sheet .hd { background: var(--brand-primary); color: #fff; padding: 12px 16px; display: flex; justify-content: space-between; align-items: center; }
.sheet .bd { padding: 12px 16px; }
.sheet h4 { margin: 10px 0 4px; border-bottom: 2px solid var(--brand-primary); color: var(--brand-dark); font-size: 11px; text-transform: uppercase; padding-bottom: 2px; }
.sheet table { width: 100%; border-collapse: collapse; }
.sheet td, .sheet th { padding: 4px 6px; border-bottom: 1px solid #e5e7eb; text-align: right; }
.sheet th { background: var(--brand-dark); color: #fff; font-size: 11px; text-align: center; }
.sheet td:first-child { text-align: left; color: #475569; }
.sheet tr.hl td { background: var(--brand-light); font-weight: 800; color: var(--brand-dark); }

/* ---------- Login / varios ---------- */
.login-wrap { height: 100vh; display: grid; place-items: center; background: linear-gradient(135deg, var(--brand-primary), var(--brand-dark)); padding: 20px; }
.login-card { background: #fff; width: min(440px, 100%); border-radius: 24px; padding: 32px; box-shadow: 0 30px 80px rgba(0,0,0,.35); display: flex; flex-direction: column; gap: 14px; }
.login-card .logo { max-height: 56px; max-width: 220px; align-self: center; }
.login-card h1 { margin: 0; text-align: center; font-size: 24px; color: var(--brand-dark); }
.toast { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); background: #0f172a; color: #fff; padding: 12px 22px; border-radius: 14px; font-weight: 600; z-index: 99; box-shadow: 0 10px 30px rgba(0,0,0,.4); }
.offline { background: #f59e0b; color: #422006; text-align: center; font-weight: 700; font-size: 13px; padding: 3px; }

/* ---------- Pantallas más pequeñas / portrait ---------- */
@media (max-width: 1100px) { .ficha { grid-template-columns: repeat(3, 1fr); } .vtitle h1, .vprice b { font-size: 24px; } }
@media (max-width: 860px), (orientation: portrait) {
  body { overflow: auto; } .app { height: auto; min-height: 100vh; grid-template-rows: 60px auto auto; }
  .main { grid-template-columns: 1fr; } .left { min-height: 70vh; } .right { overflow: visible; border-left: 0; padding: 14px 18px; }
  .cmp-grid { grid-template-columns: 1fr; } .modal { grid-template-columns: 1fr; overflow-y: auto; } .sheet-wrap { display: none; }
}

/* ---------- Impresión (hoja membretada) ---------- */
@media print {
  body { overflow: visible; background: #fff; } .app, .toast, .modal .form, .overlay { position: static; }
  .app > *, .toast { display: none !important; }
  .overlay { display: block !important; background: none; backdrop-filter: none; padding: 0; }
  .modal { display: block; box-shadow: none; max-height: none; } .modal .form { display: none; }
  .sheet-wrap { display: block !important; background: #fff; padding: 0; } .sheet { box-shadow: none; font-size: 11px; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
