/* SulbaTEK CRM · Ventas (pipeline): tablero por etapas, ficha y resumen tipo embudo.
   Teléfono: columnas que se deslizan de lado con chips de etapa. Computadora: todas a la vista. */

/* ---------- encabezado ---------- */
.top .vpick { flex: 1; min-width: 0; display: flex; align-items: center; gap: 6px; color: var(--hueso); font-size: 18px; font-weight: 600; text-align: left; min-height: 44px; }
.top .vpick span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top .vpick .i { width: 18px; height: 18px; opacity: .8; flex: none; }
.vhead { flex: none; padding: 10px 12px 4px; display: flex; flex-direction: column; gap: 8px; background: var(--bg); }
.vseg { display: flex; gap: 6px; align-items: center; overflow-x: auto; scrollbar-width: none; }
.vseg::-webkit-scrollbar { display: none; }
.vseg button { display: inline-flex; align-items: center; gap: 6px; padding: 7px 13px; border-radius: 20px; background: var(--card); color: var(--muted); font-size: 13.5px; font-weight: 500; border: 1px solid var(--line); white-space: nowrap; }
.vseg button .i { width: 17px; height: 17px; }
.vseg button.on { background: var(--noche); color: #fff; border-color: var(--noche); }
.vseg .vmine { margin-left: auto; }
.vseg .vmine.on { background: rgba(66, 96, 230, .12); color: var(--bt); border-color: rgba(66, 96, 230, .35); }
.vsearch { padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); outline: none; width: 100%; }
.vsearch:focus { border-color: var(--brand); }
.vsum { font-size: 13.5px; color: var(--muted); display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px; min-height: 20px; }
.vsum b { color: var(--text); font-size: 17px; font-weight: 700; letter-spacing: -.01em; }
.vsum small { color: var(--muted); }
.hidden { display: none !important; }

/* ---------- cuerpo ---------- */
.vbody { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.vchips { flex: none; display: flex; gap: 6px; overflow-x: auto; padding: 4px 12px 8px; scrollbar-width: none; scroll-behavior: smooth; }
.vchips::-webkit-scrollbar { display: none; }
.vchip { flex: none; display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 16px; font-size: 12.5px; font-weight: 500; color: var(--muted); background: var(--card); border: 1px solid var(--line); white-space: nowrap; }
.vchip i { width: 8px; height: 8px; border-radius: 50%; background: var(--sc); }
.vchip b { font-weight: 600; font-size: 11.5px; padding: 0 6px; border-radius: 9px; background: var(--panel); color: var(--text); }
.vchip.on { color: var(--text); border-color: var(--sc); box-shadow: inset 0 0 0 1px var(--sc); }

.vboard { flex: 1; min-height: 0; display: flex; gap: 12px; overflow-x: auto; overflow-y: hidden; padding: 0 12px calc(100px + env(safe-area-inset-bottom)); scroll-snap-type: x mandatory; scroll-padding: 0 12px; overscroll-behavior-x: contain; -webkit-overflow-scrolling: touch; }
.vcol { flex: none; width: min(86vw, 340px); display: flex; flex-direction: column; min-height: 0; scroll-snap-align: start; background: var(--panel); border-radius: 18px; padding: 10px 8px 8px; transition: box-shadow .15s, background .15s; }
.vcol.over { box-shadow: inset 0 0 0 2px var(--sc); background: color-mix(in srgb, var(--sc) 8%, var(--panel)); }
.vcol header { position: relative; padding: 2px 6px 12px; }
.vct { display: flex; align-items: center; gap: 8px; }
.vct b { font-size: 14.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vcount { flex: none; min-width: 22px; height: 22px; padding: 0 7px; border-radius: 11px; display: grid; place-items: center; font-size: 12px; font-weight: 600; color: #fff; background: var(--sc); }
.vctot { font-size: 12.5px; color: var(--muted); margin-top: 2px; font-weight: 500; }
.vline { position: absolute; left: 6px; bottom: 4px; width: 34px; height: 3px; border-radius: 2px; background: var(--sc); }
.vlist { flex: 1; min-height: 60px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; padding: 2px; overscroll-behavior: contain; }
.vnone { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 28px 8px; color: var(--muted); font-size: 13px; text-align: center; border: 1.5px dashed var(--line); border-radius: 14px; }
.vnone .i { width: 30px; height: 30px; opacity: .55; }
.vadd { margin-top: 8px; padding: 9px; border-radius: 12px; color: var(--muted); font-size: 13.5px; font-weight: 500; }
.vadd:active, .vadd:hover { background: var(--card); color: var(--bt); }

/* ---------- tarjeta ---------- */
.vcard { position: relative; background: var(--card); border-radius: 14px; padding: 11px 12px 10px 14px; box-shadow: var(--shadow); cursor: pointer; display: flex; flex-direction: column; gap: 8px; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; outline: none; transition: transform .12s, box-shadow .12s; }
.vcard::before { content: ''; position: absolute; left: 0; top: 10px; bottom: 10px; width: 3px; border-radius: 0 3px 3px 0; background: var(--sc); }
.vcard:focus-visible { box-shadow: 0 0 0 2px var(--brand); }
.vcard:active { transform: scale(.98); }
.vcard.drag { opacity: .45; }
.vcrow { display: flex; align-items: center; gap: 10px; min-width: 0; }
.vcrow .avatar.sm { width: 34px; height: 34px; font-size: 13px; flex: none; }
.vcname { min-width: 0; display: flex; flex-direction: column; }
.vcname b { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vcname small { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vcfoot { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.vval { font-size: 14px; font-weight: 700; color: var(--text); white-space: nowrap; }
.vval.zero { font-weight: 500; color: var(--muted); font-size: 12.5px; }
.vage { font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.vown { display: flex; align-items: center; gap: 5px; font-size: 11.5px; color: var(--muted); }
.vown .i { width: 13px; height: 13px; }


/* ---------- carga ---------- */
.vskel { display: flex; gap: 12px; padding: 8px 12px; overflow: hidden; }
.vskel > div { flex: none; width: min(86vw, 340px); display: flex; flex-direction: column; gap: 8px; padding: 10px 8px; border-radius: 18px; background: var(--panel); }
.vskel i { display: block; height: 76px; border-radius: 14px; background: linear-gradient(90deg, var(--card) 25%, var(--bg) 50%, var(--card) 75%); background-size: 200% 100%; animation: vsh 1.2s infinite linear; }
.vskel i:first-child { height: 22px; width: 60%; }
@keyframes vsh { to { background-position: -200% 0; } }

/* ---------- resumen (embudo) ---------- */
.vdash { overflow-y: auto; padding: 4px 0 calc(110px + env(safe-area-inset-bottom)); }
.vdash .kpis { margin: 0 12px 10px; }
.vdash > .card { margin: 0 12px 10px; border-radius: 18px; box-shadow: var(--shadow); }
.vkpi small { display: block; font-size: 11.5px; color: var(--muted); font-weight: 500; }
.vkpi.k-ok .kpic { color: var(--ok); background: rgba(31, 168, 85, .12); }
.vfunnel { display: flex; flex-direction: column; gap: 7px; }
.vfrow { display: flex; align-items: center; gap: 10px; }
.vfbar { flex: none; width: var(--w); min-width: 120px; max-width: 70%; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 12px; border-radius: 10px; color: #fff; font-size: 13px; font-weight: 500;
  background: linear-gradient(90deg, var(--sc), color-mix(in srgb, var(--sc) 78%, #fff)); transition: width .4s cubic-bezier(.2, .8, .2, 1); }
.vfbar span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vfbar b { font-weight: 700; }
.vfmeta { min-width: 0; display: flex; flex-direction: column; font-size: 12px; color: var(--muted); }
.vfmeta em { font-style: normal; font-weight: 600; color: var(--text); }
.vnote { font-size: 12.5px; }
.vrec { border-radius: 12px; }
.vrec > div { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.vrec small { color: var(--muted); font-size: 12px; }

/* ---------- ficha ---------- */
.vopp .vhero { gap: 14px; }
.vbig small { display: block; font-size: 12.5px; color: var(--muted); }
.vbig b { font-size: 28px; font-weight: 700; letter-spacing: -.02em; }
.vacts { display: flex; gap: 8px; }
.vacts > * { flex: 1; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.vsteps { display: flex; flex-direction: column; gap: 4px; }
.vsteps button { position: relative; display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: 12px; text-align: left; font-size: 14px; color: var(--muted); }
.vsteps button i { flex: none; width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--line); background: var(--card); }
.vsteps button:not(:last-child) i::after { content: ''; position: absolute; left: 16px; top: 30px; width: 2px; height: 14px; background: var(--line); }
.vsteps button.past i { border-color: var(--sc); background: var(--sc); }
.vsteps button.past { color: var(--text); }
.vsteps button.on { background: color-mix(in srgb, var(--sc) 12%, transparent); color: var(--text); font-weight: 600; }
.vsteps button.on i { border-color: var(--sc); background: var(--card); box-shadow: 0 0 0 3px color-mix(in srgb, var(--sc) 30%, transparent); }
.vstatus { display: flex; gap: 6px; }
.vstatus button { flex: 1; padding: 10px 6px; border-radius: 12px; background: var(--panel); font-size: 13.5px; font-weight: 500; color: var(--muted); }
.vstatus .st-open.on { background: var(--brand); color: #fff; }
.vstatus .st-won.on { background: var(--ok); color: #fff; }
.vstatus .st-lost.on { background: var(--danger); color: #fff; }
.vfield { display: flex; flex-direction: column; gap: 5px; }
.vfield > span { font-size: 12.5px; color: var(--muted); font-weight: 500; }
.vtags { display: flex; flex-wrap: wrap; gap: 6px; }
.vtags span { padding: 3px 10px; border-radius: 12px; background: var(--panel); font-size: 12.5px; }
.vdel { color: var(--danger); margin: 4px 12px 24px; width: calc(100% - 24px) !important; }

/* ---------- editor de etapas ---------- */
.vedit { display: flex; flex-direction: column; gap: 6px; }
.verow { display: flex; align-items: center; gap: 4px; }
.verow > i { flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--sc); margin-right: 4px; }
.verow input { flex: 1; min-width: 0; }
.verow .ic.dark { width: 36px; height: 36px; font-size: 16px; }
.verow .ic.dark:disabled { opacity: .3; }
.verow .ic.dark .i { width: 18px; height: 18px; }

/* ---------- computadora ---------- */
@media (min-width: 760px) {
  .vcol, .vskel > div { width: 290px; }
  .vboard { scroll-snap-type: none; padding-bottom: calc(92px + env(safe-area-inset-bottom)); }
  .vchips { display: none; }
  .vcard:hover { box-shadow: 0 2px 4px rgba(5, 15, 63, .08), 0 10px 24px rgba(5, 15, 63, .10); transform: translateY(-1px); }
  .vcard { cursor: grab; }
  .vdash .kpis { grid-template-columns: repeat(4, 1fr); }
}
body.desk #app:has(.vboard), body.desk #app:has(.vdash) { max-width: none; }
body.desk .vdash { padding-left: max(0px, calc((100% - 900px) / 2)); padding-right: max(0px, calc((100% - 900px) / 2)); }

/* ---------- modo oscuro ---------- */
@media (prefers-color-scheme: dark) {
  .vseg button.on { background: #2C3766; border-color: #2C3766; }
  .vcol { background: #10162D; }
  .vcard { background: var(--panel); box-shadow: none; }
  .vnone { border-color: #2A3354; }
  .vchip, .vseg button:not(.on), .vsearch { background: var(--card); }
}

/* ---------- panel del creador ---------- */
.crea > .card, .crea > .crtools { margin: 0 12px 10px; }
.crea > .card { border-radius: 18px; box-shadow: var(--shadow); }
.crea > .card:first-child { margin-top: 12px; }
.crhero { flex-direction: row !important; flex-wrap: wrap; gap: 6px 22px !important; align-items: baseline; }
.crhero div { display: flex; flex-direction: column; }
.crhero b { font-size: 26px; font-weight: 700; color: var(--text); line-height: 1.1; }
.crhero span { font-size: 12.5px; color: var(--muted); }
.crhero small { flex-basis: 100%; color: var(--muted); font-size: 12px; }
.crtools { display: flex; gap: 8px; }
.crtools > * { flex: 1; }
.crrow { cursor: pointer; }
.crrow:active { transform: scale(.99); }
.crtop { display: flex; align-items: center; gap: 10px; }
.crsw { flex: none; width: 34px; height: 34px; border-radius: 10px; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .08); }
.crname { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.crname b { font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crname small { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crdot { flex: none; width: 10px; height: 10px; border-radius: 50%; }
.crdot.up { background: var(--ok); box-shadow: 0 0 0 3px rgba(31, 168, 85, .2); }
.crdot.down { background: var(--danger); box-shadow: 0 0 0 3px rgba(214, 69, 69, .2); }
.crst { display: inline-block; flex: none; padding: 3px 10px; border-radius: 12px; font-size: 12px; font-weight: 600; background: var(--panel); color: var(--muted); }
.crst::first-letter { text-transform: uppercase; }
.crst.ok { background: rgba(31, 168, 85, .14); color: #138A43; }
.crst.amber { background: rgba(232, 163, 23, .16); color: #9A6A00; }
.crst.new { background: rgba(66, 96, 230, .12); color: var(--bt); }
.crmods { display: flex; gap: 6px; flex-wrap: wrap; }
.crmods span { padding: 3px 10px; border-radius: 12px; font-size: 12px; background: var(--panel); color: var(--muted); text-decoration: line-through; opacity: .7; }
.crmods span.on { background: rgba(66, 96, 230, .12); color: var(--bt); text-decoration: none; opacity: 1; font-weight: 500; }
.crlink { font-size: 13px; color: var(--bt); font-weight: 600; text-decoration: none; }
.crtoggles { display: flex; gap: 6px; flex-wrap: wrap; }
.crtoggles button { padding: 8px 14px; border-radius: 12px; background: var(--card); border: 1px solid var(--line); font-size: 14px; color: var(--muted); }
.crtoggles button.on { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 500; }
.crtoggles button:disabled { opacity: .8; }
.crpair { display: flex; gap: 10px; align-items: flex-end; }
.crpair label:first-child { flex: 1; }
.crpair input[type="color"] { width: 64px; height: 46px; padding: 4px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); }
.sheet textarea { padding: 11px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); outline: none; resize: vertical; font-size: 16px; }
@media (prefers-color-scheme: dark) {
  .crst.ok { color: #5FD08D; } .crst.amber { color: #F2C14E; }
}
