.pv-products-admin {
    --pv-cream: #f7f5ef;
    --pv-dark: #173f2d;
    --pv-green: #528737;
    --pv-line: #dfe5da;
    --pv-muted: #66736b;
    --pv-radius: 16px;
    max-width: 1240px;
}

.pv-products-admin .pv-admin-heading {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
    margin: 22px 0 18px;
}

.pv-products-admin .pv-admin-heading h1 {
    margin: 0 0 6px;
    color: var(--pv-dark);
    font-size: 30px;
}

.pv-products-admin .pv-admin-heading p,
.pv-products-admin .pv-card-title p {
    color: var(--pv-muted);
    margin: 0;
}

.pv-products-admin .pv-new-product {
    border-color: var(--pv-green);
    color: var(--pv-dark);
}

.pv-product-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.55fr) minmax(310px, .8fr);
    gap: 20px;
    align-items: start;
}

.pv-product-main,
.pv-product-side {
    display: grid;
    gap: 20px;
}

.pv-admin-card {
    background: #fff;
    border: 1px solid var(--pv-line);
    border-radius: var(--pv-radius);
    padding: 20px;
    box-shadow: 0 3px 12px rgba(23, 63, 45, .05);
}

.pv-card-title {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    margin-bottom: 18px;
}

.pv-card-title > .dashicons {
    width: 38px;
    height: 38px;
    line-height: 38px;
    text-align: center;
    border-radius: 50%;
    color: var(--pv-dark);
    background: #edf3e9;
    font-size: 20px;
}

.pv-card-title h2 {
    margin: 0 0 4px;
    color: var(--pv-dark);
    font-size: 21px;
}

.pv-form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px 18px;
}

.pv-form-grid label,
.pv-description-field {
    display: grid;
    gap: 7px;
}

.pv-form-grid label > span,
.pv-description-field > span {
    font-weight: 600;
    color: var(--pv-dark);
}

.pv-products-admin :is(input[type="text"], input[type="number"], select, textarea) {
    width: 100%;
    min-height: 42px;
    border: 1px solid #cfd8ca;
    border-radius: 8px;
    padding: 8px 11px;
}

.pv-description-field { margin-top: 17px; }

.pv-format-pills {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.pv-format-pills span {
    min-height: 48px;
    display: grid;
    place-items: center;
    border: 1px solid #cbd6c5;
    border-radius: 24px;
    background: #f9faf7;
    color: var(--pv-dark);
    font-size: 18px;
    font-weight: 700;
}

.pv-rule-note {
    margin-top: 12px;
    padding: 10px 12px;
    border-radius: 8px;
    background: #eef5e9;
    color: var(--pv-dark);
}

.pv-flavor-checks {
    display: flex;
    flex-wrap: wrap;
    gap: 9px;
}

.pv-flavor-chip {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 9px 12px;
    border: 1px solid #cbd6c5;
    border-radius: 20px;
    background: #fff;
    cursor: pointer;
}

.pv-flavor-chip:has(input:checked) {
    background: #e9f1e3;
    border-color: var(--pv-green);
    color: var(--pv-dark);
    font-weight: 600;
}

.pv-flavor-chip input { margin: 0; }
.pv-flavor-chip small { color: #916b00; }
.pv-flavor-obsoleto { opacity: .55; }
.pv-admin-card.is-disabled { opacity: .55; }

.pv-product-image-preview {
    aspect-ratio: 4 / 3;
    border: 1px dashed #cbd6c5;
    border-radius: 12px;
    background: var(--pv-cream);
    overflow: hidden;
    display: grid;
    place-items: center;
    align-content: center;
    gap: 8px;
    color: var(--pv-muted);
}

.pv-product-image-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.pv-image-actions {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px;
    margin-top: 12px;
}

.pv-products-admin .button-primary {
    background: var(--pv-green);
    border-color: var(--pv-green);
}

.pv-products-admin .button-primary:hover,
.pv-products-admin .button-primary:focus {
    background: #44751f;
    border-color: #44751f;
}

.pv-summary-content {
    display: grid;
    grid-template-columns: 86px 1fr;
    gap: 14px;
    align-items: center;
}

.pv-summary-image {
    width: 86px;
    height: 70px;
    border-radius: 10px;
    overflow: hidden;
    background: var(--pv-cream);
    display: grid;
    place-items: center;
}

.pv-summary-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.pv-summary-content strong {
    color: var(--pv-dark);
    font-size: 17px;
}

.pv-summary-content p { margin: 4px 0; }

.pv-save-bar {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.pv-save-bar .button {
    text-align: center;
    justify-content: center;
}

.pv-existing-products { margin-top: 20px; }
.pv-products-table-wrap { overflow-x: auto; }

@media (max-width: 960px) {
    .pv-product-layout { grid-template-columns: 1fr; }
    .pv-product-side { grid-template-columns: repeat(2, 1fr); }
    .pv-save-bar { grid-column: 1 / -1; }
}

@media (max-width: 720px) {
    .pv-form-grid,
    .pv-product-side { grid-template-columns: 1fr; }
    .pv-admin-heading { flex-direction: column; }
}


/* Medios del producto: 1 principal + 3 secundarias + video corto. */
.pv-product-media-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.pv-product-media-slot {
    display: grid;
    gap: 6px;
}

.pv-product-media-slot > strong {
    color: var(--pv-dark);
    font-size: 12px;
}

.pv-product-gallery-preview,
.pv-product-media-slot .pv-product-image-preview {
    aspect-ratio: 4 / 3;
    min-height: 0;
    border: 1px dashed #cbd6c5;
    border-radius: 10px;
    background: var(--pv-cream);
    overflow: hidden;
    display: grid;
    place-items: center;
    align-content: center;
    gap: 4px;
    color: var(--pv-muted);
}

.pv-product-gallery-preview img,
.pv-product-media-slot .pv-product-image-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.pv-product-gallery-preview em,
.pv-product-media-slot .pv-product-image-preview em {
    font-size: 11px;
}

.pv-gallery-actions { margin-top: 8px; }

.pv-product-video-box {
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid var(--pv-line);
}

.pv-product-video-heading {
    display: grid;
    gap: 3px;
    margin-bottom: 9px;
}

.pv-product-video-heading strong { color: var(--pv-dark); }
.pv-product-video-heading strong span,
.pv-product-video-heading small { color: var(--pv-muted); font-weight: 400; }

.pv-product-video-preview {
    min-height: 120px;
    border: 1px dashed #cbd6c5;
    border-radius: 12px;
    background: #f3f6ef;
    display: grid;
    place-items: center;
    align-content: center;
    gap: 6px;
    overflow: hidden;
    color: var(--pv-muted);
}

.pv-product-video-preview video {
    display: block;
    width: 100%;
    max-height: 220px;
    object-fit: cover;
    background: #000;
}

.pv-flavor-thumb {
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    border-radius: 8px;
    overflow: hidden;
    display: grid;
    place-items: center;
    background: var(--pv-cream);
    color: var(--pv-green);
}

.pv-flavor-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.pv-product-list-thumb img,
.pv-product-list-noimage {
    width: 60px;
    height: 45px;
    border-radius: 8px;
    object-fit: cover;
    display: grid;
    place-items: center;
}

.pv-product-list-noimage {
    background: var(--pv-cream);
    border: 1px solid var(--pv-line);
    color: var(--pv-muted);
    font-size: 10px;
}

@media (max-width: 720px) {
    .pv-product-media-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Navegación común del panel simplificado Productos / Sabores. */
.pv-panel-tabs {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin: 0 0 18px;
    padding: 6px;
    width: fit-content;
    max-width: 100%;
    background: #eef3e9;
    border: 1px solid var(--pv-line);
    border-radius: 14px;
}

.pv-panel-tab {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 40px;
    padding: 7px 14px;
    border-radius: 10px;
    color: var(--pv-dark);
    text-decoration: none;
    font-weight: 700;
}

.pv-panel-tab:hover,
.pv-panel-tab:focus {
    color: var(--pv-dark);
    background: rgba(255, 255, 255, .72);
}

.pv-panel-tab.is-active {
    color: #fff;
    background: var(--pv-dark);
    box-shadow: 0 2px 7px rgba(23, 63, 45, .16);
}

.pv-panel-tab.is-active .dashicons { color: #fff; }

/* La administración histórica de Sabores usa tablas/boxes de WordPress;
   estas reglas la integran visualmente al mismo panel sin cambiar su lógica. */
.pv-flavors-admin > p {
    max-width: 920px;
    color: var(--pv-muted);
}

.pv-flavors-admin .widefat {
    border: 1px solid var(--pv-line);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 3px 12px rgba(23, 63, 45, .04);
}

.pv-flavors-admin .widefat thead th {
    color: var(--pv-dark);
    font-weight: 700;
    background: #f3f6ef;
}

.pv-flavors-admin .widefat td { vertical-align: middle; }

.pv-flavors-admin .postbox {
    border: 1px solid var(--pv-line) !important;
    border-radius: var(--pv-radius) !important;
    box-shadow: 0 3px 12px rgba(23, 63, 45, .05) !important;
}

.pv-flavors-admin .postbox h2 { color: var(--pv-dark); }

@media (max-width: 720px) {
    .pv-panel-tabs { width: 100%; }
    .pv-panel-tab { flex: 1 1 auto; justify-content: center; }
}

/* ============================================================
   SABORES - cierre visual v7.7
   Solo presentación: no modifica estados, relaciones ni guardado.
   ============================================================ */

.pv-flavors-admin {
    max-width: 1500px;
}

.pv-flavors-admin .pv-flavor-table {
    background: #fff;
}

.pv-flavors-admin .pv-flavor-table th,
.pv-flavors-admin .pv-flavor-table td {
    padding: 12px 14px;
}

.pv-flavors-admin .pv-flavor-table tbody tr:hover td {
    background: #fbfcf9;
}

.pv-flavor-thumb-image,
.pv-flavor-thumb-empty {
    width: 76px;
    height: 57px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pv-flavor-thumb-image {
    object-fit: cover;
    box-shadow: 0 1px 4px rgba(23, 63, 45, .08);
}

.pv-flavor-thumb-empty {
    flex-direction: column;
    gap: 2px;
    background: var(--pv-cream);
    border: 1px dashed #c8d2c3;
    color: var(--pv-muted);
}

.pv-flavor-thumb-empty .dashicons {
    width: 22px;
    height: 22px;
    font-size: 22px;
}

.pv-flavor-thumb-empty small {
    font-size: 10px;
    line-height: 1;
}

.pv-flavor-status {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    line-height: 1;
    font-weight: 700;
    white-space: nowrap;
}

.pv-flavor-status--activo {
    color: #285d18;
    background: #eaf5e4;
    border: 1px solid #cce4bf;
}

.pv-flavor-status--sin-stock {
    color: #7a5600;
    background: #fff6d8;
    border: 1px solid #ead795;
}

.pv-flavor-status--obsoleto {
    color: #6d7470;
    background: #f0f1f0;
    border: 1px solid #d9ddda;
}

.pv-flavor-products {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.pv-flavor-products > span {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    padding: 4px 9px;
    border: 1px solid #d8e0d4;
    border-radius: 999px;
    background: #f7f9f5;
    color: var(--pv-dark);
    font-size: 12px;
    font-weight: 600;
}

.pv-flavor-products-empty {
    color: var(--pv-muted);
    font-style: italic;
}

.pv-products-admin .pv-flavor-edit-button {
    border-color: #bfcbbb;
    color: var(--pv-dark);
    font-weight: 600;
}

.pv-products-admin .pv-flavor-edit-button:hover,
.pv-products-admin .pv-flavor-edit-button:focus {
    border-color: var(--pv-green);
    color: var(--pv-dark);
    background: #f4f8f1;
}

.pv-flavors-admin .pv-flavor-editor {
    padding: 20px;
    margin: 0;
    background: #fff;
}

.pv-flavor-editor-title {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 18px;
}

.pv-flavor-editor-title > .dashicons {
    width: 38px;
    height: 38px;
    line-height: 38px;
    text-align: center;
    border-radius: 50%;
    color: var(--pv-dark);
    background: #edf3e9;
    font-size: 20px;
    flex: 0 0 38px;
}

.pv-flavor-editor-title h2 {
    margin: 0 0 4px !important;
    color: var(--pv-dark);
    font-size: 21px;
}

.pv-flavor-editor-title p {
    margin: 0;
    color: var(--pv-muted);
}

.pv-flavor-image-preview {
    width: 100%;
    max-width: 360px;
    margin-top: 8px;
    aspect-ratio: 4 / 3;
    border: 1px dashed #cbd6c5;
    border-radius: 12px;
    overflow: hidden;
    background: var(--pv-cream);
    display: flex;
    align-items: center;
    justify-content: center;
}

.pv-flavor-image-preview-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.pv-flavor-image-empty {
    display: flex;
    align-items: center;
    gap: 7px;
    color: var(--pv-muted);
}

.pv-flavor-image-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 10px 0 0;
}

.pv-flavor-help {
    margin: 7px 0 0;
    color: var(--pv-muted);
    font-size: 12px;
}

.pv-flavor-products-heading {
    display: grid;
    gap: 3px;
    margin: 18px 0 8px;
}

.pv-flavor-products-heading strong {
    color: var(--pv-dark);
}

.pv-flavor-products-heading span {
    color: var(--pv-muted);
    font-size: 12px;
}

.pv-flavor-product-checklist {
    max-height: 360px;
    overflow: auto;
    padding: 8px;
    border: 1px solid #dfe5da;
    border-radius: 10px;
    background: #fbfcfa;
}

.pv-flavor-product-checklist label {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 38px;
    margin: 0;
    padding: 7px 9px;
    border-radius: 8px;
    color: var(--pv-dark);
}

.pv-flavor-product-checklist label:hover {
    background: #eef4e9;
}

.pv-flavor-product-checklist input[type="checkbox"] {
    margin: 0;
}

@media (max-width: 1050px) {
    .pv-flavors-admin > div[style*="grid-template-columns"] {
        grid-template-columns: 1fr !important;
    }

    .pv-flavors-admin .pv-flavor-editor {
        max-width: none;
    }
}

@media (max-width: 782px) {
    .pv-flavors-admin .pv-flavor-table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }

    .pv-flavors-admin .pv-flavor-table th,
    .pv-flavors-admin .pv-flavor-table td {
        padding: 10px;
    }

    .pv-flavor-products {
        min-width: 210px;
        max-width: 320px;
        white-space: normal;
    }

    .pv-flavor-thumb-image,
    .pv-flavor-thumb-empty {
        width: 68px;
        height: 51px;
    }
}
