:root {
    --tl-card: #fff;
    --tl-line: #f0d7dd;
    --tl-shadow: 0 18px 40px rgba(60, 20, 35, .08);
    --tl-text: #2a1b22;
    --tl-muted: #7a5a66;
    --tl-pink: #f2b8c7;
    --tl-pink-2: #f7c6d3;
    --tl-gold: #d6b06a;
}

/* page */
.vc-page {
    max-width: 900px;
    margin: 0 auto;
    padding: 18px 16px 26px;
}

.vc-card {
    background: var(--tl-card);
    border: 1px solid var(--tl-line);
    border-radius: 24px;
    box-shadow: var(--tl-shadow);

    /* ✅ IMPORTANTE: si está hidden, corta el dropdown */
    overflow: visible;
}

/* header */
.vc-head {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px;
    background: linear-gradient(135deg, rgba(242, 184, 199, .30), rgba(214, 176, 106, .14));
    border-bottom: 1px solid var(--tl-line);
    border-top-left-radius: 24px;
    border-top-right-radius: 24px;
}

.vc-ico {
    width: 52px;
    height: 52px;
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, .75);
    border: 1px solid rgba(240, 215, 221, .9);
    font-size: 22px;
}

.vc-title h1 {
    margin: 0;
    font-size: 22px;
    color: var(--tl-text);
}

.vc-title p {
    margin: 4px 0 0;
    color: var(--tl-muted);
    font-weight: 700;
    font-size: 13px;
}

.vc-tag {
    margin-left: auto;
    font-size: 12px;
    font-weight: 900;
    padding: 6px 10px;
    border-radius: 999px;
    border: 1px solid var(--tl-line);
    background: rgba(255, 255, 255, .78);
    color: var(--tl-muted);
    white-space: nowrap;
}

/* form */
.vc-form {
    padding: 16px;
    display: grid;
    gap: 12px;
}

.row label {
    display: block;
    font-weight: 900;
    color: var(--tl-text);
    margin-bottom: 6px;
    font-size: 13px;
}

.row input,
.row select {
    width: 100%;
    padding: 11px 12px;
    border-radius: 16px;
    border: 1px solid var(--tl-line);
    background: rgba(251, 246, 247, .65);
    font-weight: 800;
    color: var(--tl-text);
    outline: none;
    transition: box-shadow .15s ease, transform .15s ease, border-color .15s ease;
}

.row input:focus,
.row select:focus {
    border-color: rgba(214, 176, 106, .55);
    box-shadow: 0 14px 24px rgba(214, 176, 106, .14);
    transform: translateY(-1px);
}

.hint {
    margin-top: 6px;
    font-size: 12px;
    font-weight: 800;
    color: #a6374a;
    display: none;
}

.hint2 {
    margin-top: 6px;
    color: var(--tl-muted);
    font-weight: 800;
    font-size: 12px;
}

.hint3 {
    margin-top: 6px;
    color: var(--tl-muted);
    font-weight: 900;
    font-size: 12px;
}

/* resumen */
.resume {
    margin-top: 6px;
    border: 1px solid var(--tl-line);
    background: rgba(255, 255, 255, .75);
    border-radius: 18px;
    padding: 12px;
}

.rline {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 7px 2px;
    color: var(--tl-text);
    font-weight: 800;
    border-bottom: 1px dashed rgba(240, 215, 221, .9);
}

.rline:last-child {
    border-bottom: 0;
}

.rline span {
    color: var(--tl-muted);
    font-weight: 900;
}

.rline.total b {
    font-size: 18px;
}

/* actions */
.actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 6px;
}

.btn-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 14px;
    border-radius: 999px;
    border: 1px solid var(--tl-line);
    background: rgba(255, 255, 255, .82);
    font-weight: 900;
    color: var(--tl-text);
    text-decoration: none;
    cursor: pointer;
    transition: transform .14s ease, box-shadow .14s ease;
    min-height: 44px;
}

.btn-pill.primary {
    border: 0;
    background: linear-gradient(180deg, var(--tl-pink), var(--tl-pink-2));
}

.btn-pill.ghost {
    background: transparent;
}

.btn-pill:hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 20px rgba(60, 20, 35, .08);
}

/* ===== BUSCADOR PRO ===== */

.hidden-select {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.pbox {
    position: relative;
}

.psearch {
    width: 100%;
    padding: 11px 12px;
    border-radius: 16px;
    border: 1px solid var(--tl-line);
    background: rgba(251, 246, 247, .65);
    font-weight: 850;
    color: var(--tl-text);
    outline: none;
    transition: box-shadow .15s ease, transform .15s ease, border-color .15s ease;
}

.psearch:disabled {
    opacity: .75;
    cursor: not-allowed;
}

.psearch:focus {
    border-color: rgba(214, 176, 106, .55);
    box-shadow: 0 14px 24px rgba(214, 176, 106, .14);
    transform: translateY(-1px);
}

/* ✅ dropdown con scroll en ESCRITORIO y MÓVIL */
.plist {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;

    background: rgba(255, 255, 255, .96);
    border: 1px solid var(--tl-line);
    border-radius: 18px;
    box-shadow: 0 22px 60px rgba(60, 20, 35, .16);

    /* ✅ clave para el scroll */
    max-height: 320px;
    /* escritorio */
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;

    /* antes tenías hidden, eso mataba el scroll */
    overflow-x: hidden;

    padding: 8px;

    /* ✅ para que no lo tape el header/cards */
    z-index: 999;
}

.plist.open {
    display: block;
}

.pitem {
    width: 100%;
    border: 1px solid transparent;
    background: transparent;
    padding: 10px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    cursor: pointer;
    text-align: left;
    border-radius: 14px;
}

.pitem:hover {
    background: rgba(242, 184, 199, .14);
    border-color: rgba(240, 215, 221, .9);
}

.pitem.active {
    background: linear-gradient(180deg, rgba(242, 184, 199, .28), rgba(214, 176, 106, .10));
    border-color: rgba(240, 215, 221, .9);
}

.p-left {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.p-id {
    font-weight: 950;
    color: var(--tl-text);
    font-size: 13px;
}

.p-type {
    margin-top: 2px;
    font-weight: 800;
    color: var(--tl-muted);
    font-size: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 240px;
}

.p-price {
    font-weight: 950;
    color: var(--tl-text);
    white-space: nowrap;
}

.pempty {
    padding: 12px;
    color: var(--tl-muted);
    font-weight: 850;
    font-size: 13px;
}

/* ✅ scrollbar bonito */
.plist::-webkit-scrollbar {
    width: 10px;
}

.plist::-webkit-scrollbar-track {
    background: rgba(242, 184, 199, .10);
    border-radius: 999px;
}

.plist::-webkit-scrollbar-thumb {
    background: rgba(214, 176, 106, .35);
    border-radius: 999px;
    border: 2px solid rgba(255, 255, 255, .65);
}

/* responsive */
@media (max-width: 520px) {
    .actions {
        grid-template-columns: 1fr;
    }

    /* en móvil que sea más alto (por viewport) */
    .plist {
        max-height: 42vh;
    }
}
