/* Nueva venta (/ventas/nueva). Usa piezas de presupuesto-form.css (pf-buscar, pf-lista, pf-opcion,
   pf-campo, pf-btn, pf-avatar…) y acá va el diseño propio, con prefijo vn-: carrito a la izquierda
   y a la derecha cliente, comprobante y totales con Guardar venta.
   Hoja global (los .razor.css no se cargan). */
.vn-pagina {
    --pf-azul: #2563eb;
    --pf-azul-hover: #1d4ed8;
    --pf-azul-claro: #e8f0fe;
    --vn-verde: #15803d;
    --vn-verde-claro: #dcfce7;
    --vn-fondo-suave: #f7f8fa;
    max-width: 1240px;
    margin: 0 auto;
}

.vn-pagina:focus { outline: none; }

/* ── Cabecera ── */
.vn-cab { display: flex; align-items: center; justify-content: space-between; gap: .75rem 1rem; flex-wrap: wrap; margin: .25rem 0 1.25rem; }
.vn-cab-titulo { display: flex; align-items: center; gap: .85rem; flex-wrap: wrap; }
.vn-cab-titulo h1 { margin: 0; font-size: 1.75rem; font-weight: 700; letter-spacing: -.01em; }
.vn-cab-acciones { display: flex; align-items: center; gap: .25rem; }
.vn-cab-acciones .pf-btn { height: 38px; color: #374151; }
.vn-pagina .caja-en-uso.vn-caja {
    margin: 0; padding: .2rem .65rem; border: 1px solid var(--pf-borde); border-radius: 999px;
    background: #f1f2f4; color: #374151; font-size: .82rem;
}
.vn-pagina .caja-en-uso.vn-caja strong { font-weight: 500; }

.vn-kbd {
    display: inline-block; padding: .05rem .4rem; border: 1px solid var(--pf-borde); border-radius: 5px;
    background: #f3f4f6; color: var(--pf-atenuado); font-size: .7rem; font-weight: 600; font-family: inherit;
    line-height: 1.4; box-shadow: none;
}
.vn-kbd-claro {
    padding: .05rem .4rem; border: 1px solid rgba(255, 255, 255, .35); border-radius: 5px;
    background: rgba(255, 255, 255, .16); color: #fff; font-size: .72rem; font-family: inherit; box-shadow: none;
}

/* ── Venta recién creada ── */
.vn-exito { display: flex; align-items: center; flex-wrap: wrap; gap: 1rem 1.25rem; padding: 1rem 1.25rem; border-color: #bbf7d0; background: #f0fdf4; }
.vn-exito-icono {
    flex: 0 0 44px; width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center;
    border-radius: 50%; background: var(--vn-verde-claro); color: var(--vn-verde); font-size: 1.4rem;
}
.vn-exito-texto { flex: 1; min-width: 220px; }
.vn-exito-texto h2 { margin: 0; font-size: 1.1rem; font-weight: 600; color: #14532d; }
.vn-exito-texto p { margin: .2rem 0 0; color: var(--pf-atenuado); font-size: .9rem; }
.vn-exito-acciones { display: flex; flex-wrap: wrap; gap: .5rem; }

/* ── Distribución ── */
.vn-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 1.25rem; align-items: start; }
.vn-lateral { display: flex; flex-direction: column; gap: 1.25rem; position: sticky; top: 1rem; }
.vn-tarjeta { background: #fff; border: 1px solid var(--pf-borde); border-radius: 14px; }
.vn-tarjeta-cliente, .vn-tarjeta-comprobante, .vn-tarjeta-totales { padding: 1rem 1rem 1.05rem; }
.vn-tarjeta-titulo { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-bottom: .75rem; color: #374151; font-size: .9rem; }

.vn-link {
    display: inline-flex; align-items: center; gap: .3rem; padding: 0; border: 0; background: none;
    color: var(--pf-azul); font: inherit; font-size: .88rem; cursor: pointer;
}
.vn-link:hover:not(:disabled) { text-decoration: underline; }
.vn-link:disabled { color: var(--pf-atenuado); opacity: .6; cursor: default; }

/* ── Carrito ── */
.vn-carrito { overflow: visible; }
.vn-agregar { display: flex; gap: .6rem; padding: 1rem; }
.vn-buscar { flex: 1; min-width: 0; }
.vn-buscar input { height: 52px; padding-right: 3.2rem; font-size: 1rem; border-radius: 12px; }
.vn-buscar input:focus { outline: none; border-color: var(--pf-azul); box-shadow: 0 0 0 3px rgba(37, 99, 235, .15); }
.vn-buscar .vn-kbd { position: absolute; right: .85rem; top: 26px; transform: translateY(-50%); pointer-events: none; }
.vn-buscar input:focus ~ .vn-kbd { display: none; }
.vn-multiplicador {
    flex: 0 0 74px; display: flex; align-items: center; gap: .3rem; height: 52px; margin: 0; padding: 0 .65rem;
    border: 1px solid var(--pf-borde); border-radius: 12px; background: #fff;
}
.vn-multiplicador span { color: var(--pf-atenuado); font-size: .9rem; }
.vn-multiplicador input { width: 100%; min-width: 0; border: 0; padding: 0; background: transparent; font-size: 1rem; text-align: right; }
.vn-multiplicador input:focus { outline: none; }
.vn-multiplicador:focus-within { border-color: var(--pf-azul); box-shadow: 0 0 0 3px rgba(37, 99, 235, .15); }

.vn-tabla-contenedor { overflow-x: auto; }
.vn-tabla { width: 100%; border-collapse: collapse; font-size: .93rem; }
.vn-tabla th {
    padding: .7rem .6rem; background: var(--vn-fondo-suave); border-top: 1px solid var(--pf-borde); border-bottom: 1px solid var(--pf-borde);
    color: var(--pf-atenuado); font-size: .82rem; font-weight: 500; text-align: left; white-space: nowrap;
}
.vn-tabla td { padding: .6rem; border-bottom: 1px solid #f0f1f3; vertical-align: middle; }
.vn-tabla th:first-child, .vn-tabla td:first-child { padding-left: 1rem; }
.vn-tabla th:last-child, .vn-tabla td:last-child { padding-right: .75rem; }
.vn-tabla tbody tr:hover { background: #fafbfc; }
.vn-col-cant { width: 136px; text-align: center !important; }
.vn-col-precio { width: 120px; text-align: right !important; }
.vn-col-dto { width: 96px; text-align: center !important; }
.vn-col-subtotal { width: 130px; text-align: right !important; font-weight: 600; }
.vn-col-acciones { width: 76px; text-align: right !important; white-space: nowrap; }

.vn-item-nombre {
    display: block; max-width: 100%; padding: 0; border: 0; background: none; color: var(--pf-texto);
    font: inherit; font-weight: 500; text-align: left; cursor: pointer; overflow-wrap: anywhere;
}
.vn-item-nombre:hover { color: var(--pf-azul); }
.vn-item-sub { display: block; margin-top: .1rem; color: var(--pf-atenuado); font-size: .8rem; }
.vn-etiqueta {
    display: inline-block; margin-left: .35rem; padding: 0 .4rem; border-radius: 6px;
    background: var(--pf-azul-claro); color: var(--pf-azul); font-size: .7rem; font-weight: 600;
}

.vn-cantidad { display: inline-flex; align-items: center; gap: .3rem; }
.vn-cantidad-btn {
    width: 32px; height: 32px; display: inline-flex; align-items: center; justify-content: center;
    border: 1px solid var(--pf-borde); border-radius: 8px; background: #fff; color: var(--pf-texto); font-size: 1rem; line-height: 1;
}
.vn-cantidad-btn:hover:not(:disabled) { background: #f3f4f6; }
.vn-cantidad-btn:disabled { opacity: .4; }
.vn-cantidad input {
    width: 48px; height: 32px; padding: 0 .2rem; border: 1px solid transparent; border-radius: 6px; background: transparent;
    font-weight: 600; text-align: center; -moz-appearance: textfield;
}
.vn-cantidad input:hover { border-color: var(--pf-borde); }
.vn-cantidad input:focus { outline: none; border-color: var(--pf-azul); background: #fff; }
.vn-dto {
    width: 76px; height: 36px; padding: 0 .55rem; border: 1px solid var(--pf-borde); border-radius: 8px; background: #fff;
    text-align: right; -moz-appearance: textfield;
}
.vn-dto:focus { outline: none; border-color: var(--pf-azul); box-shadow: 0 0 0 3px rgba(37, 99, 235, .12); }
.vn-dto.vn-recargo { color: var(--pf-naranja); }
.vn-cantidad input::-webkit-inner-spin-button, .vn-dto::-webkit-inner-spin-button,
.vn-cantidad input::-webkit-outer-spin-button, .vn-dto::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }

.vn-icono {
    width: 30px; height: 30px; display: inline-flex; align-items: center; justify-content: center;
    border: 0; border-radius: 8px; background: transparent; color: #9ca3af; font-size: .9rem;
}
.vn-icono:hover { background: #f3f4f6; color: var(--pf-texto); }
.vn-icono-quitar:hover { background: #fee2e2; color: var(--pf-rojo); }
.vn-tabla tr:not(:hover) .vn-icono:not(.vn-icono-quitar) { opacity: 0; }
.vn-tabla tr .vn-icono:focus-visible { opacity: 1; }

.vn-vacio { border-top: 1px solid var(--pf-borde); }
.vn-vacio strong { display: block; color: var(--pf-texto); margin-bottom: .15rem; }

/* Observaciones y remito: siempre visibles */
.vn-obs { padding: 1rem 1.5rem 1.25rem; border-top: 1px solid var(--pf-borde); }
.vn-obs-titulo { margin-bottom: .75rem; color: #374151; font-size: .92rem; font-weight: 500; }
.vn-obs-titulo span { color: var(--pf-atenuado); font-weight: 400; }
.vn-obs-campos { display: grid; grid-template-columns: minmax(0, 1fr) 160px; gap: 1rem; align-items: start; }
.vn-obs textarea, .vn-obs input, .vn-datos-extra select {
    width: 100%; padding: .55rem .75rem; border: 1px solid var(--pf-borde); border-radius: 10px; background: #fff;
    color: var(--pf-texto); font-size: .93rem;
}
.vn-obs input, .vn-datos-extra select { height: 42px; }
.vn-obs textarea { min-height: 58px; resize: vertical; }
.vn-obs textarea:focus, .vn-obs input:focus, .vn-datos-extra select:focus { outline: none; border-color: var(--pf-azul); box-shadow: 0 0 0 3px rgba(37, 99, 235, .12); }
.vn-obs .pf-campo > span, .vn-datos-extra .pf-campo > span { font-size: .85rem; font-weight: 500; }

/* ── Cliente ── */
.vn-avatar { flex: 0 0 40px; width: 40px; height: 40px; font-size: .85rem; }
.vn-tarjeta-cliente .dfc-cuerpo { display: flex; align-items: flex-start; gap: .75rem; }
.vn-tarjeta-cliente .dfc-texto { display: flex; flex-direction: column; min-width: 0; line-height: 1.35; }
.vn-tarjeta-cliente .dfc-texto strong { font-size: .98rem; font-weight: 600; overflow-wrap: anywhere; }
.vn-tarjeta-cliente .dfc-texto small { color: #4b5563; font-size: .83rem; overflow-wrap: anywhere; }
.vn-tarjeta-cliente .dfc-nota { color: var(--pf-azul) !important; }
.vn-tarjeta-cliente .dfc-alerta { color: #b45309; }
.vn-tarjeta-cliente .dfc-pie {
    display: flex; align-items: flex-start; justify-content: space-between; gap: .75rem;
    margin-top: .85rem; padding-top: .75rem; border-top: 1px solid var(--pf-borde); color: var(--pf-atenuado); font-size: .83rem;
}
.vn-tarjeta-cliente .dfc-pie-texto { display: flex; flex-direction: column; gap: .1rem; min-width: 0; }
.vn-tarjeta-cliente .dfc-editar {
    flex: none; padding: 0; border: 0; background: none; color: var(--pf-azul); font-size: .83rem;
    text-decoration: underline; text-underline-offset: 2px; cursor: pointer;
}
.vn-tarjeta-cliente .pf-buscar input { height: 44px; }
.vn-receptor { display: flex; flex-wrap: wrap; gap: .4rem 1rem; margin-top: .65rem; }
.vn-positivo { color: var(--vn-verde); }

/* ── Comprobante ── */
.vn-segmentos { display: flex; gap: .2rem; padding: .25rem; border-radius: 12px; background: #f1f2f4; }
.vn-segmento {
    flex: 1 1 auto; min-width: 0; height: 40px; padding: 0 .3rem; border: 0; border-radius: 9px; background: transparent;
    color: #4b5563; font-size: .85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.vn-segmento:hover:not(.activo) { color: var(--pf-texto); }
.vn-segmento.activo { background: #fff; color: var(--pf-texto); font-weight: 600; box-shadow: 0 1px 2px rgba(16, 24, 40, .12); }
.vn-info {
    position: relative; margin-top: .75rem; padding: .6rem .75rem .6rem 1.5rem; border-radius: 10px;
    background: #eef4ff; color: #1e40af; font-size: .84rem; line-height: 1.4;
}
.vn-info::before { content: ""; position: absolute; left: .7rem; top: .95rem; width: 6px; height: 6px; border-radius: 50%; background: var(--pf-azul); }
.vn-info-alerta { background: #fffbea; color: #92400e; }
.vn-info-alerta::before { background: #d97706; }
.vn-datos-extra { display: flex; flex-direction: column; gap: .75rem; margin-top: 1rem; }
.vn-tarjeta-comprobante .vn-datos-extra:first-child { margin-top: 0; }

/* ── Totales ── */
.vn-totales { margin: 0 0 1rem; }
.vn-totales > div { display: flex; justify-content: space-between; align-items: baseline; gap: .75rem; padding: .3rem 0; font-size: .92rem; }
.vn-totales dt { font-weight: 400; color: #4b5563; }
.vn-totales dd { margin: 0; font-variant-numeric: tabular-nums; white-space: nowrap; }
.vn-totales .vn-descuento dd { color: var(--pf-azul); font-weight: 500; }
.vn-totales .vn-recargo dd { color: var(--pf-naranja); font-weight: 500; }
.vn-totales .vn-dto-todos { padding-bottom: .6rem; font-size: .82rem; }
.vn-totales .vn-dto-todos .vn-link { font-size: .82rem; white-space: nowrap; }
.vn-totales .vn-total { align-items: center; margin-top: .25rem; padding-top: .75rem; border-top: 1px solid var(--pf-borde); }
.vn-totales .vn-total dt { color: var(--pf-texto); font-weight: 600; }
.vn-totales .vn-total dd { font-size: 1.85rem; font-weight: 700; letter-spacing: -.01em; }
.vn-tarjeta-totales .pf-btn-primario { width: 100%; height: 52px; border-radius: 12px; font-size: 1.05rem; }
.vn-nota { margin: .55rem 0 0; color: var(--pf-atenuado); font-size: .78rem; text-align: center; }
.vn-nota kbd { padding: 0 .3rem; border: 1px solid var(--pf-borde); border-radius: 4px; background: #f6f7f9; color: var(--pf-atenuado); font-size: .7rem; font-family: inherit; box-shadow: none; }

/* ── Celular: tarjetas por renglón ── */
.vn-item-movil { padding: .8rem 1rem; border-top: 1px solid #f0f1f3; }
.vn-item-movil-cab { display: flex; align-items: flex-start; justify-content: space-between; gap: .5rem; }
.vn-item-movil-pie { display: flex; align-items: center; justify-content: space-between; gap: .6rem; margin-top: .55rem; }
.vn-item-movil-pie > strong { font-size: 1rem; }
.vn-dto-movil { display: inline-flex; align-items: center; gap: .35rem; margin: 0; color: var(--pf-atenuado); font-size: .78rem; white-space: nowrap; }
.vn-dto-movil .vn-dto { width: 60px; height: 32px; }

@media (max-width: 1099.98px) {
    .vn-layout { grid-template-columns: minmax(0, 1fr) 290px; }
    .vn-col-precio { width: 100px; }
}

/* Tablet y celular: una columna; el cliente va arriba del carrito */
@media (max-width: 991.98px) {
    .vn-layout { display: flex; flex-direction: column; gap: 1rem; }
    .vn-lateral { display: contents; }
    .vn-tarjeta-cliente { order: 1; }
    .vn-carrito { order: 2; }
    .vn-tarjeta-comprobante { order: 3; }
    .vn-tarjeta-totales { order: 4; }
    .vn-layout > * { width: 100%; }
}

@media (max-width: 767.98px) {
    .vn-cab-titulo h1 { font-size: 1.45rem; }
    .vn-agregar { padding: .75rem; }
    .vn-buscar input, .vn-multiplicador { height: 48px; }
    .vn-buscar .vn-kbd { display: none; }
    .vn-buscar input { padding-right: .9rem; }
    .vn-multiplicador { flex-basis: 64px; }
    .vn-obs { padding: .9rem 1rem 1rem; }
    .vn-obs-campos { grid-template-columns: 1fr; gap: .75rem; }
    .vn-tarjeta-totales { margin-bottom: .5rem; }
}
