/* GoPhoenix Herramientas — editor táctil (Cotizador y Contrato).
   Pantalla completa, hecho primero para iPhone Safari y Android; en computadora el panel va a la derecha.
   Diseñado y desarrollado por Damian Peña. */
:root {
  --bg: #f3eeec; --stage: #ece5e2; --dot: rgba(120, 90, 90, .13);
  --surface: #ffffff; --surface-2: #faf7f6; --line: #ece2df; --line-2: #f4ecea;
  --ink: #1d1818; --muted: #776a6c; --soft: #aa9c9e;
  --coral: #ef7973; --deep: #d86658; --accent: #b4483b; --pink: #f58fa4; --orange: #ff9274; --yellow: #ffdc57;
  --cream: #fff6d9; --blush: #fff0ec; --green: #1fa855; --blue: #3d8fd6;
  --ui: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --r-sm: 12px; --r: 16px; --r-lg: 22px; --r-xl: 28px;
  --sh-1: 0 1px 2px rgba(50, 25, 25, .06), 0 4px 14px rgba(50, 25, 25, .06);
  --sh-2: 0 2px 8px rgba(50, 25, 25, .08), 0 18px 48px rgba(50, 25, 25, .14);
  --sh-paper: 0 1px 1px rgba(50, 25, 25, .04), 0 10px 30px rgba(50, 25, 25, .12), 0 30px 60px -30px rgba(50, 25, 25, .25);
  --spring: cubic-bezier(.32, 1.4, .54, 1); --ease: cubic-bezier(.22, 1, .36, 1);
  --top: 56px; --dock: 66px; --safe-b: env(safe-area-inset-bottom, 0px); --safe-t: env(safe-area-inset-top, 0px);
  --vvh: 100dvh;
}
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); font: 16px/1.4 var(--ui); -webkit-font-smoothing: antialiased; -webkit-text-size-adjust: 100%; }
body { overflow: hidden; overscroll-behavior: none; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; -webkit-user-select: none; user-select: none; }
a { color: inherit; }
svg { display: block; }
:focus-visible { outline: 3px solid rgba(239, 121, 115, .5); outline-offset: 2px; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ======================================================= marco de la app */
.ed { position: fixed; left: 0; right: 0; top: var(--vvt, 0px); height: var(--vvh); display: grid; grid-template-rows: auto minmax(0, 1fr) auto; overflow: hidden; }

/* barra superior */
.tb { position: relative; z-index: 30; display: flex; align-items: center; gap: 6px; padding: calc(6px + var(--safe-t)) max(8px, env(safe-area-inset-right)) 6px max(8px, env(safe-area-inset-left)); background: rgba(255, 255, 255, .9); -webkit-backdrop-filter: saturate(1.8) blur(18px); backdrop-filter: saturate(1.8) blur(18px); border-bottom: 1px solid var(--line); }
.ib { flex: none; display: grid; place-items: center; width: 42px; height: 42px; border: 0; border-radius: 12px; background: none; color: var(--ink); transition: background .15s, transform .12s, opacity .15s; }
.ib:active { transform: scale(.9); background: var(--line-2); }
.ib svg { width: 22px; height: 22px; }
.ib[disabled] { opacity: .3; pointer-events: none; }
.tb-t { flex: 1; min-width: 0; display: grid; padding: 0 2px; border: 0; background: none; text-align: left; }
.tb-t b { font: 700 16px/1.2 var(--ui); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tb-t small { display: flex; align-items: center; gap: 5px; color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; }
.tb-t small i { width: 6px; height: 6px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 3px rgba(31, 168, 85, .15); flex: none; transition: background .2s; }
.tb-t small.saving i { background: var(--yellow); box-shadow: 0 0 0 3px rgba(255, 220, 87, .25); }
.pb { flex: none; display: inline-flex; align-items: center; gap: 7px; min-height: 40px; padding: 0 15px; border: 0; border-radius: 12px; background: var(--coral); color: #fff; font: 700 14.5px var(--ui); box-shadow: 0 8px 18px -10px rgba(216, 102, 88, .95); transition: transform .12s; }
.pb:active { transform: scale(.95); }
.pb svg { width: 18px; height: 18px; }

/* escenario (lienzo) */
.stage { position: relative; overflow: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; background-color: var(--stage); background-image: radial-gradient(var(--dot) 1px, transparent 1.2px); background-size: 18px 18px; }
.stage-in { min-height: 100%; padding: 18px 14px calc(110px + var(--sheet-h, 0px)); display: grid; justify-items: center; align-content: start; gap: 14px; transition: padding .35s var(--ease); }

/* dock de herramientas */
.dock { position: relative; z-index: 32; height: calc(var(--dock) + var(--safe-b)); display: flex; gap: 2px; padding: 6px max(6px, env(safe-area-inset-right)) calc(6px + var(--safe-b)) max(6px, env(safe-area-inset-left)); background: rgba(255, 255, 255, .94); -webkit-backdrop-filter: saturate(1.8) blur(18px); backdrop-filter: saturate(1.8) blur(18px); border-top: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.dock::-webkit-scrollbar { display: none; }
.dk { flex: 1 0 64px; display: grid; justify-items: center; align-content: center; gap: 3px; height: 54px; padding: 6px 4px 4px; border: 0; border-radius: 14px; background: none; color: var(--soft); font: 600 11px var(--ui); position: relative; transition: color .2s, background .2s; }
.dk svg { width: 25px; height: 25px; transition: transform .3s var(--spring); }
.dk:active svg { transform: scale(.85); }
.dk[aria-pressed=true] { color: var(--deep); background: var(--blush); }
.dk[aria-pressed=true] svg { transform: translateY(-1px) scale(1.06); }
.dk .ok { position: absolute; top: 5px; right: calc(50% - 20px); width: 15px; height: 15px; border-radius: 50%; background: var(--green); border: 2px solid #fff; display: grid; place-items: center; }
.dk .ok::after { content: ""; width: 5px; height: 3px; border: 1.6px solid #fff; border-top: 0; border-right: 0; transform: rotate(-45deg) translate(0, -1px); }

/* hoja (panel) */
.sheet { position: absolute; z-index: 31; left: 0; right: 0; bottom: calc(var(--dock) + var(--safe-b)); height: calc((var(--vvh) - var(--dock) - var(--safe-b)) * .6); display: flex; flex-direction: column; background: var(--surface); border-radius: var(--r-xl) var(--r-xl) 0 0; box-shadow: 0 -10px 40px rgba(50, 25, 25, .16); transform: translateY(calc(100% + 20px)); transition: transform .42s var(--spring), height .35s var(--ease); will-change: transform; }
.sheet.open { transform: translateY(0); }
.sheet.full { height: calc(var(--vvh) - var(--dock) - var(--safe-b) - var(--safe-t) - 62px); }
.kb .dock { display: none; }
.kb .sheet { bottom: 0; }
.kb .sheet.full { height: calc(var(--vvh) - var(--safe-t) - 62px); }
.sheet.dragging { transition: none; }
.grab { flex: none; display: grid; place-items: center; height: 26px; touch-action: none; cursor: grab; }
.grab i { width: 40px; height: 5px; border-radius: 3px; background: #ddd0cd; }
.sh-h { flex: none; display: flex; align-items: center; gap: 10px; padding: 0 16px 10px; }
.sh-h .ico { flex: none; display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px; background: var(--blush); color: var(--deep); }
.sh-h .ico svg { width: 21px; height: 21px; }
.sh-h div { flex: 1; min-width: 0; }
.sh-h b { display: block; font: 800 19px/1.15 var(--ui); letter-spacing: -.01em; }
.sh-h small { display: block; color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sh-b { flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; padding: 4px 16px 24px; }
.sh-f { flex: none; display: flex; gap: 8px; padding: 10px 16px 12px; border-top: 1px solid var(--line-2); background: var(--surface); }
.sh-f .btn { flex: 1; }
.sh-b.anim > * { animation: rise .32s var(--ease) both; }
.sh-b.anim > *:nth-child(2) { animation-delay: .03s; } .sh-b.anim > *:nth-child(3) { animation-delay: .06s; } .sh-b.anim > *:nth-child(4) { animation-delay: .09s; } .sh-b.anim > *:nth-child(n+5) { animation-delay: .12s; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }
.scrim { position: absolute; z-index: 29; inset: 0; background: rgba(29, 24, 24, .18); opacity: 0; pointer-events: none; transition: opacity .3s; }
.scrim.on { opacity: 1; pointer-events: auto; }

/* ======================================================= controles */
.fld { display: grid; gap: 6px; margin-bottom: 14px; }
.fld > span { font: 600 13px var(--ui); color: var(--muted); }
.in { width: 100%; min-height: 50px; padding: 0 14px; border: 1.5px solid var(--line); border-radius: var(--r-sm); background: var(--surface-2); font-size: 16px; -webkit-appearance: none; appearance: none; transition: border-color .15s, box-shadow .15s, background .15s; }
.in::placeholder { color: #c4b7b9; }
.in:focus { outline: none; border-color: var(--coral); background: #fff; box-shadow: 0 0 0 4px rgba(239, 121, 115, .14); }
textarea.in { min-height: 120px; padding: 12px 14px; line-height: 1.45; resize: vertical; }
input[type=date].in { padding-right: 10px; }
.money { position: relative; display: block; }
.money::before { content: "$"; position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--soft); font-weight: 700; pointer-events: none; }
.money .in { padding-left: 28px; font-weight: 700; font-variant-numeric: tabular-nums; }
.money.pct::before { content: "%"; left: auto; right: 14px; } .money.pct .in { padding-left: 14px; padding-right: 32px; }
.money.mi::before { content: "millas"; left: auto; right: 14px; font-size: 13px; } .money.mi .in { padding-left: 14px; padding-right: 64px; }
.money.big .in { min-height: 64px; font-size: 26px; border-radius: var(--r); }
.money.big::before { font-size: 22px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.hint { margin: -6px 0 14px; color: var(--muted); font-size: 13px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { min-height: 40px; padding: 0 14px; border: 1.5px solid var(--line); border-radius: 999px; background: #fff; font: 600 14px var(--ui); transition: all .15s; }
.chip:active { transform: scale(.95); }
.chip[aria-pressed=true] { border-color: var(--ink); background: var(--ink); color: #fff; }
.step { display: inline-flex; align-items: center; border: 1.5px solid var(--line); border-radius: var(--r-sm); background: #fff; min-height: 50px; }
.step button { width: 46px; height: 46px; border: 0; background: none; font: 700 22px var(--ui); color: var(--deep); border-radius: 10px; }
.step button:active { background: var(--blush); }
.step output { min-width: 30px; text-align: center; font: 800 18px var(--ui); font-variant-numeric: tabular-nums; }
.step.big { min-height: 60px; } .step.big button { width: 58px; height: 56px; font-size: 26px; } .step.big output { min-width: 44px; font-size: 24px; }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; padding: 4px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--line-2); }
.seg button { min-height: 44px; padding: 4px 8px; border: 0; border-radius: 10px; background: none; font: 700 13.5px/1.15 var(--ui); color: var(--muted); transition: background .2s, color .2s; }
.seg button[aria-pressed=true] { background: #fff; color: var(--ink); box-shadow: var(--sh-1); }
.seg button span { display: block; font: 400 11.5px var(--ui); opacity: .85; }
.tog { flex: none; position: relative; width: 50px; height: 30px; border: 0; border-radius: 999px; background: #d8cbc8; transition: background .2s; }
.tog::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.2); transition: transform .3s var(--spring); }
.tog[aria-checked=true] { background: var(--green); } .tog[aria-checked=true]::after { transform: translateX(20px); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 9px; min-height: 50px; padding: 0 18px; border: 0; border-radius: 14px; font: 700 15.5px var(--ui); text-decoration: none; transition: transform .12s, background .15s; }
.btn:active { transform: scale(.97); }
.btn svg { width: 20px; height: 20px; flex: none; }
.btn.pri { background: var(--coral); color: #fff; box-shadow: 0 10px 22px -12px rgba(216, 102, 88, .95); }
.btn.ink { background: var(--ink); color: #fff; }
.btn.wa { background: var(--green); color: #fff; box-shadow: 0 10px 22px -12px rgba(31, 168, 85, .9); }
.btn.gh { background: var(--surface-2); color: var(--ink); border: 1.5px solid var(--line); }
.btn.dn { background: none; color: var(--accent); }
.btn.full { width: 100%; }
.btn[disabled] { opacity: .5; }
.card { padding: 14px; border-radius: var(--r); background: var(--surface-2); border: 1px solid var(--line-2); margin-bottom: 10px; }
.note { margin: 0 0 14px; padding: 12px 14px; border-radius: var(--r-sm); background: var(--cream); color: #6b5a3c; font-size: 13.5px; }
.note b { color: var(--ink); }
.lbl { display: block; margin: 18px 0 8px; font: 700 12px var(--ui); letter-spacing: .06em; color: var(--soft); text-transform: uppercase; }
.lbl:first-child { margin-top: 2px; }
.row { display: flex; align-items: center; gap: 10px; }
.row > .grow { flex: 1; min-width: 0; }
.list { display: grid; gap: 8px; }
.li { display: flex; align-items: center; gap: 12px; min-height: 60px; padding: 10px 12px; border: 1px solid var(--line-2); border-radius: var(--r); background: #fff; text-align: left; width: 100%; transition: transform .12s, box-shadow .15s; }
.li:active { transform: scale(.985); }
.li .ic { flex: none; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: var(--c, var(--blush)); color: var(--cc, var(--deep)); }
.li .ic svg { width: 22px; height: 22px; }
.li .tx { flex: 1; min-width: 0; }
.li .tx b { display: block; font: 700 15px/1.2 var(--ui); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.li .tx small { display: block; color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.li .vl { flex: none; font: 800 15px var(--ui); font-variant-numeric: tabular-nums; }
.li .chev { flex: none; width: 18px; height: 18px; color: var(--soft); }
.add { width: 100%; min-height: 50px; border: 1.5px dashed #efb2ab; border-radius: var(--r); background: #fffaf9; color: var(--deep); font: 700 14.5px var(--ui); display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.add svg { width: 18px; height: 18px; }

/* catálogo */
.cat { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.ct { display: grid; justify-items: center; gap: 6px; padding: 14px 6px 12px; border: 1px solid var(--line-2); border-radius: var(--r); background: #fff; text-align: center; transition: transform .15s var(--spring), box-shadow .15s; }
.ct:active { transform: scale(.94); }
.ct i { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 15px; background: var(--c); color: var(--cc, #fff); box-shadow: 0 8px 16px -10px var(--c); }
.ct i svg { width: 26px; height: 26px; }
.ct b { font: 700 13px/1.15 var(--ui); }
.ct small { color: var(--soft); font-size: 11px; line-height: 1.2; }
.ct em { font-style: normal; display: inline-block; padding: 1px 7px; border-radius: 999px; background: var(--blush); color: var(--deep); font: 700 11px var(--ui); }

/* toast y confeti */
.toast { position: fixed; z-index: 60; left: 50%; top: calc(var(--vvt, 0px) + var(--safe-t) + 64px); transform: translate(-50%, -20px); opacity: 0; display: inline-flex; align-items: center; gap: 8px; max-width: calc(100% - 32px); padding: 11px 16px; border-radius: 14px; background: var(--ink); color: #fff; font: 600 14px var(--ui); box-shadow: var(--sh-2); pointer-events: none; transition: transform .35s var(--spring), opacity .25s; }
.toast.on { transform: translate(-50%, 0); opacity: 1; }
.toast svg { width: 18px; height: 18px; color: #7ee2a8; flex: none; }
.conf { position: fixed; inset: 0; z-index: 70; pointer-events: none; overflow: hidden; }
.conf i { position: absolute; bottom: -70px; width: calc(32px * var(--s)); height: calc(40px * var(--s)); border-radius: 50% 50% 48% 48%; background: radial-gradient(circle at 32% 28%, rgba(255,255,255,.75) 0 12%, transparent 13%), var(--c); animation: fly 2.6s cubic-bezier(.3, .6, .4, 1) var(--d) forwards; }
.conf i::after { content: ""; position: absolute; left: 50%; top: 100%; width: 1px; height: 38px; background: rgba(0,0,0,.25); }
@keyframes fly { to { transform: translateY(-120vh) rotate(var(--r)); } }
@media (prefers-reduced-motion: reduce) { .sheet, .sh-b.anim > *, .toast, .dk svg { transition: none !important; animation: none !important; } }

/* ======================================================= computadora */
@media (min-width: 980px) {
  :root { --rail: 88px; --panel: 420px; }
  .ed { grid-template-columns: var(--rail) minmax(0, 1fr) var(--panel); grid-template-rows: auto minmax(0, 1fr); }
  .tb { grid-column: 1 / -1; padding: 10px 18px; }
  .dock { grid-column: 1; grid-row: 2; height: auto; flex-direction: column; gap: 6px; padding: 14px 10px; border-top: 0; border-right: 1px solid var(--line); overflow-y: auto; }
  .dk { flex: none; min-height: 66px; }
  .stage { grid-column: 2; grid-row: 2; }
  .stage-in { padding: 34px 28px 60px; }
  .sheet { position: relative; bottom: auto; grid-column: 3; grid-row: 2; min-height: 0; height: auto !important; transform: none !important; border-radius: 0; box-shadow: none; border-left: 1px solid var(--line); }
  .grab { display: none; }
  .sh-h { padding: 20px 20px 12px; }
  .sh-b { padding: 4px 20px 30px; }
  .sh-f { padding: 12px 20px; }
  .scrim { display: none; }
  .toast { top: 76px; }
}
.sh-h .x { margin-right: -6px; color: var(--soft); }
@media (min-width: 980px) { .sh-h .x { display: none; } }
