:root {
    --kbx-navy: #1E2A45;
    --kbx-gold: #C6A15B;
    --kbx-cream: #FAEFE6;
    --kbx-plum: #4A2C6A;
    --kbx-pink: #EC407A;
    --radius: 12px;
    --shadow: 0 4px 20px rgba(30,42,69,0.08);
}

.kbx-ps-dashboard {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px;
    font-family: 'Helvetica Neue', Arial, sans-serif;
    color: var(--kbx-navy);
}

.kbx-ps-header {
    padding: 32px 0 16px;
}
.kbx-ps-header-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 100%;
    margin: 0 auto;
}
.kbx-ps-header h1 {
    font-family: Georgia, serif;
    font-size: 2.2rem;
    color: var(--kbx-navy);
    margin: 0 0 8px;
}
.kbx-ps-subtitle {
    color: #666;
    font-size: 1.1rem;
    margin: 0;
}
.kbx-ps-btn-logout {
    background: var(--kbx-cream);
    color: var(--kbx-pink);
    border: 2px solid var(--kbx-pink);
    padding: 8px 16px;
    font-size: 0.85rem;
    border-radius: 9999px;
}
.kbx-ps-btn-logout:hover {
    background: var(--kbx-pink);
    color: #fff;
}

.kbx-ps-layout {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 32px;
    margin-top: 24px;
}

.kbx-ps-main {
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 32px;
}
.kbx-ps-sidebar {
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 24px;
}

/* Buttons */
.kbx-ps-btn {
    display: inline-block;
    padding: 12px 28px;
    border-radius: 9999px;
    border: none;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.3s ease;
}
.kbx-ps-btn-primary {
    background: var(--kbx-navy);
    color: var(--kbx-gold);
}
.kbx-ps-btn-primary:hover {
    background: var(--kbx-gold);
    color: var(--kbx-navy);
}
.kbx-ps-btn-secondary {
    background: var(--kbx-cream);
    color: var(--kbx-navy);
    border: 2px solid var(--kbx-gold);
}

/* Form */
.kbx-ps-form-wrap { margin-top: 24px; }
.kbx-ps-form-help { color: #888; font-size: 0.9rem; margin-bottom: 20px; }
.kbx-ps-form-actions { margin-top: 24px; }

.kbx-ps-item {
    display: grid;
    grid-template-columns: 140px 1fr 40px;
    gap: 16px;
    margin-bottom: 20px;
    padding: 16px;
    border: 2px dashed #ddd;
    border-radius: var(--radius);
    align-items: start;
}
.kbx-ps-item-photo { text-align: center; }
.kbx-ps-photo-input { display: none; }
.kbx-ps-photo-preview img {
    width: 120px; height: 120px; object-fit: cover;
    border-radius: 8px; border: 2px solid var(--kbx-gold);
}
.kbx-ps-photo-btn {
    margin-top: 8px;
    background: var(--kbx-plum);
    color: #fff;
    padding: 8px 16px;
    border-radius: 9999px;
    border: none;
    cursor: pointer;
}
.kbx-ps-item-fields label {
    display: block; margin-bottom: 8px; font-size: 0.9rem; color: #555;
}
.kbx-ps-item-fields input,
.kbx-ps-item-fields textarea {
    width: 100%; padding: 8px 12px; border: 1px solid #ddd;
    border-radius: 6px; font-size: 0.9rem;
}
.kbx-ps-item-fields textarea { min-height: 80px; resize: vertical; }
.kbx-ps-remove-item {
    background: var(--kbx-pink); color: #fff;
    border: none; width: 36px; height: 36px;
    border-radius: 50%; cursor: pointer; font-weight: bold;
}

/* ─── Success Animation (full-screen) ─── */
.kbx-ps-confirmation { text-align: center; padding: 48px 24px; }

/* Overlay full-screen: cubre TODO el viewport, desktop y móvil */
.kbx-ps-celebration {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(30, 42, 69, 0.55);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    animation: kbxOverlayIn 0.4s ease-out;
    overflow-y: auto;
}
@keyframes kbxOverlayIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.kbx-ps-celebration-card {
    position: relative;
    z-index: 2;
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.25);
    padding: 48px 40px;
    max-width: 480px;
    width: 100%;
    text-align: center;
    animation: kbxCardPop 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.4);
}
@keyframes kbxCardPop {
    0%   { opacity: 0; transform: scale(0.7) translateY(30px); }
    100% { opacity: 1; transform: scale(1) translateY(0); }
}

/* Checkmark SVG animado (círculo se dibuja + check aparece) */
.kbx-ps-checkwrap {
    width: 110px; height: 110px;
    margin: 0 auto 20px;
}
.kbx-ps-checksvg { width: 100%; height: 100%; }
.kbx-ps-checkcircle {
    fill: none;
    stroke: #C6A15B;
    stroke-width: 5;
    stroke-dasharray: 290;
    stroke-dashoffset: 290;
    animation: kbxCircleDraw 1s ease-out forwards;
}
@keyframes kbxCircleDraw { to { stroke-dashoffset: 0; } }
.kbx-ps-checkpath {
    fill: none;
    stroke: #1E2A45;
    stroke-width: 7;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-dasharray: 60;
    stroke-dashoffset: 60;
    animation: kbxCheckDraw 0.5s ease-out 0.7s forwards;
}
@keyframes kbxCheckDraw { to { stroke-dashoffset: 0; } }

.kbx-ps-celebration-card h2 {
    font-family: Georgia, serif;
    font-size: 1.8rem;
    color: #1E2A45;
    margin: 0 0 10px;
}
.kbx-ps-celebration-num {
    font-size: 1.05rem;
    color: #C6A15B;
    font-weight: 600;
    margin: 0 0 14px;
}
.kbx-ps-celebration-msg {
    font-size: 0.95rem;
    color: #555;
    line-height: 1.6;
    margin: 0 0 14px;
}
.kbx-ps-celebration-inspire {
    font-size: 0.95rem;
    color: #1E2A45;
    font-style: italic;
    font-family: Georgia, serif;
    margin: 0 0 24px;
    padding: 12px 16px;
    background: #FAEFE6;
    border-left: 3px solid #C6A15B;
    border-radius: 8px;
}
.kbx-ps-celebration-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Confetti: cae desde arriba en toda la pantalla */
.kbx-ps-confetti {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
    z-index: 1;
}
.kbx-ps-confetti-piece {
    position: absolute;
    top: -20px;
    border-radius: 2px;
    opacity: 0;
    animation-name: kbxConfettiFall;
    animation-timing-function: linear;
    animation-iteration-count: infinite;
}
@keyframes kbxConfettiFall {
    0%   { transform: translateY(0) rotate(0deg); opacity: 1; }
    80%  { opacity: 1; }
    100% { transform: translateY(110vh) rotate(720deg); opacity: 0; }
}

/* ─── Fuegos artificiales ─── */
.kbx-ps-fireworks {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
    z-index: 1;
}
/* Cohete: sube desde el borde inferior */
.kbx-ps-firework-trail {
    position: absolute;
    bottom: 0;
    width: 3px;
    height: 46px;
    border-radius: 3px;
    background: linear-gradient(to top, transparent, var(--fw-color, #C6A15B));
    animation: kbxRocketRise 0.5s ease-out forwards;
    opacity: 0.9;
}
@keyframes kbxRocketRise {
    0%   { transform: translateY(0); opacity: 0; }
    15%  { opacity: 0.9; }
    100% { transform: translateY(-62vh); opacity: 0; }
}
/* Explosión: punto que destella al abrirse */
.kbx-ps-firework {
    position: absolute;
    width: 0; height: 0;
}
.kbx-ps-firework::after {
    content: "";
    position: absolute;
    left: -6px; top: -6px;
    width: 12px; height: 12px;
    border-radius: 50%;
    background: var(--fw-color, #C6A15B);
    box-shadow: 0 0 18px 6px var(--fw-color, #C6A15B);
    animation: kbxFlash 0.45s ease-out forwards;
}
@keyframes kbxFlash {
    0%   { transform: scale(0.2); opacity: 1; }
    100% { transform: scale(2.6); opacity: 0; }
}
/* Chispas radiantes que salen del centro de la explosión */
.kbx-ps-firework-spark {
    position: absolute;
    width: 6px; height: 6px;
    border-radius: 50%;
    background: var(--fw-color, #C6A15B);
    box-shadow: 0 0 8px 2px var(--fw-color, #C6A15B);
    animation-name: kbxSparkFly;
    animation-timing-function: cubic-bezier(0.12, 0.8, 0.39, 1);
    animation-fill-mode: forwards;
}
@keyframes kbxSparkFly {
    0%   { transform: translate(0, 0) scale(1); opacity: 1; }
    70%  { opacity: 1; }
    100% { transform: translate(var(--fw-tx, 60px), var(--fw-ty, -60px)) scale(0.25); opacity: 0; }
}

/* ─── Emojis fashion en las esquinas ─── */
.kbx-ps-fashion {
    position: absolute;
    z-index: 1;
    display: flex;
    gap: 14px;
    pointer-events: none;
}
.kbx-ps-fashion--tl { top: 26px; left: 26px; }
.kbx-ps-fashion--tr { top: 26px; right: 26px; }
.kbx-ps-fashion--bl { bottom: 26px; left: 26px; }
.kbx-ps-fashion--br { bottom: 26px; right: 26px; }
.kbx-ps-fashion span {
    font-size: 46px;
    line-height: 1;
    filter: drop-shadow(0 6px 14px rgba(30, 42, 69, 0.35));
    opacity: 0.95;
    animation: kbxFashionFloat 3.4s ease-in-out infinite;
}
.kbx-ps-fashion span:nth-child(2) { animation-delay: 1.2s; }
.kbx-ps-fashion--tr span { animation-delay: 0.6s; }
.kbx-ps-fashion--bl span { animation-delay: 1.8s; }
.kbx-ps-fashion--br span { animation-delay: 0.9s; }
@keyframes kbxFashionFloat {
    0%, 100% { transform: translateY(0) rotate(-4deg) scale(1); }
    50%      { transform: translateY(-12px) rotate(5deg) scale(1.08); }
}

@media (max-width: 768px) {
    .kbx-ps-celebration { padding: 14px; }
    .kbx-ps-celebration-card { padding: 34px 20px; border-radius: 16px; }
    .kbx-ps-checkwrap { width: 90px; height: 90px; }
    .kbx-ps-celebration-card h2 { font-size: 1.45rem; }
    .kbx-ps-celebration-num { font-size: 0.95rem; }
    .kbx-ps-celebration-msg { font-size: 0.9rem; }
    .kbx-ps-celebration-inspire { font-size: 0.9rem; }
    .kbx-ps-celebration-actions .kbx-ps-btn { padding: 14px 16px; }
    /* Fashion: más chico y pegado a las esquinas en móvil */
    .kbx-ps-fashion--tl, .kbx-ps-fashion--tr { top: 14px; }
    .kbx-ps-fashion--bl, .kbx-ps-fashion--br { bottom: 14px; }
    .kbx-ps-fashion--tl, .kbx-ps-fashion--bl { left: 10px; }
    .kbx-ps-fashion--tr, .kbx-ps-fashion--br { right: 10px; }
    .kbx-ps-fashion span { font-size: 30px; gap: 8px; }
    .kbx-ps-fashion { gap: 8px; }
}

/* ─── Modal detalle de pedido (clienta) ─── */
.kbx-ps-detail-overlay {
    position: fixed;
    inset: 0;
    z-index: 999998;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(30, 42, 69, 0.55);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    overflow-y: auto;
}
.kbx-ps-detail-card {
    position: relative;
    background: #fff;
    border-radius: 18px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.25);
    padding: 34px 30px;
    max-width: 520px;
    width: 100%;
    animation: kbxCardPop 0.45s cubic-bezier(0.175, 0.885, 0.32, 1.4);
}
.kbx-ps-detail-card h3 {
    font-family: Georgia, serif;
    color: #1E2A45;
    margin: 0 0 8px;
    font-size: 1.4rem;
}
.kbx-ps-detail-meta { margin: 0 0 18px; }
.kbx-ps-detail-close {
    position: absolute;
    top: 14px; right: 14px;
    width: 34px; height: 34px;
    border: none; border-radius: 50%;
    background: #FAEFE6; color: #1E2A45;
    font-size: 16px; cursor: pointer;
    transition: all 0.2s ease;
}
.kbx-ps-detail-close:hover { background: #EC407A; color: #fff; }
.kbx-ps-detail-items { max-height: 52vh; overflow-y: auto; }
.kbx-ps-detail-item {
    display: flex;
    gap: 14px;
    padding: 12px 0;
    border-bottom: 1px solid #F0E8DE;
    align-items: flex-start;
}
.kbx-ps-detail-item img {
    width: 72px; height: 72px;
    object-fit: cover;
    border-radius: 8px;
    border: 2px solid #C6A15B;
    flex-shrink: 0;
}
.kbx-ps-detail-info { display: flex; flex-direction: column; gap: 4px; }
.kbx-ps-detail-info strong { color: #1E2A45; font-size: 0.95rem; }
.kbx-ps-detail-qty { font-size: 0.85rem; color: #C6A15B; font-weight: 600; }
.kbx-ps-detail-notes { font-size: 0.82rem; color: #6E6270; }

@media (max-width: 768px) {
    .kbx-ps-detail-overlay { padding: 14px; }
    .kbx-ps-detail-card { padding: 26px 18px; }
    .kbx-ps-detail-item img { width: 58px; height: 58px; }
    .kbx-ps-detail-items { max-height: 48vh; }
}

/* ─── Login interactivo ─── */
.kbx-ps-login-lead {
    color: #555;
    font-size: 0.95rem;
    line-height: 1.6;
    margin: 0 0 22px;
}
.kbx-ps-login-cta {
    display: block;
    padding: 16px 28px;
    font-size: 1.05rem;
    animation: kbxPulse 2.4s ease-in-out infinite;
}
@keyframes kbxPulse {
    0%, 100% { transform: scale(1); box-shadow: 0 4px 14px rgba(30,42,69,0.25); }
    50%      { transform: scale(1.03); box-shadow: 0 8px 24px rgba(198,161,91,0.45); }
}
.kbx-ps-login-sep {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 18px 0;
    color: #999;
    font-size: 0.8rem;
}
.kbx-ps-login-sep::before,
.kbx-ps-login-sep::after {
    content: "";
    flex: 1;
    height: 1px;
    background: #EAE0D4;
}
.kbx-ps-login-alt { transition: all 0.25s ease; }
.kbx-ps-login-alt:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(198,161,91,0.3);
}

/* Login */
.kbx-ps-login-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
    padding: 32px;
}
.kbx-ps-login-card {
    background: #fff;
    padding: 48px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    text-align: center;
    max-width: 400px;
}
.kbx-ps-logo {
    display: block;              /* garantiza centrado perfecto */
    margin: 0 auto 24px;         /* centrado horizontal explícito */
    max-width: 180px;
    height: auto;
}
.kbx-ps-login-card h2 {
    font-family: Georgia, serif;
    color: var(--kbx-navy);
    margin: 0 0 12px;
}
.kbx-ps-login-note {
    font-size: 0.8rem; color: #888; margin-top: 16px;
}

/* Historial */
.kbx-ps-list { list-style: none; padding: 0; }
.kbx-ps-list li {
    padding: 12px 0;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    align-items: center;
    gap: 8px;
}
.kbx-ps-badge {
    font-size: 0.7rem;
    padding: 3px 10px;
    border-radius: 20px;
    font-weight: bold;
}
.kbx-ps-badge--publish { background: #e8f5e9; color: #2e7d32; }
.kbx-ps-badge--kbx_leido { background: #fff3e0; color: #ef6c00; }
.kbx-ps-badge--kbx_procesando { background: #e3f2fd; color: #1565c0; }
.kbx-ps-badge--kbx_comprado { background: #f3e5f5; color: #7b1fa2; }
.kbx-ps-badge--kbx_despachado { background: #e0f7fa; color: #00695c; }

@media (max-width: 768px) {
    .kbx-ps-dashboard { padding: 16px; }
    .kbx-ps-header { padding: 20px 0 12px; }
    .kbx-ps-header h1 { font-size: 1.5rem; }
    .kbx-ps-subtitle { font-size: 0.95rem; }
    .kbx-ps-header-inner { flex-direction: column; gap: 12px; text-align: center; }
    .kbx-ps-layout { grid-template-columns: 1fr; gap: 20px; margin-top: 16px; }
    .kbx-ps-main { padding: 20px 16px; }
    .kbx-ps-sidebar { padding: 18px 16px; }

    /* Item: foto arriba, campos abajo, botón ✕ arriba-derecha */
    .kbx-ps-item {
        grid-template-columns: 1fr 40px;
        grid-template-areas: "photo remove" "fields fields";
        padding: 14px;
        gap: 12px;
        position: relative;
    }
    .kbx-ps-item-photo { grid-area: photo; text-align: center; }
    .kbx-ps-item-fields { grid-area: fields; }
    .kbx-ps-remove-item {
        grid-area: remove;
        width: 32px; height: 32px;
        justify-self: end;
    }
    .kbx-ps-photo-preview img { width: 100px; height: 100px; }

    /* Botones touch-friendly */
    .kbx-ps-btn {
        display: block;
        width: 100%;
        padding: 14px 20px;
        font-size: 1rem;
        text-align: center;
        box-sizing: border-box;
    }
    .kbx-ps-form-actions { margin-top: 20px; }
    #kbxPsAddItem { margin-top: 14px; }
    .kbx-ps-btn-logout { display: inline-block; width: auto; }

    /* Login card full-width en móvil */
    .kbx-ps-login-wrap { padding: 20px 14px; min-height: 70vh; }
    .kbx-ps-login-card {
        padding: 32px 22px;
        width: 100%;
        max-width: 400px;
        box-sizing: border-box;
    }
    .kbx-ps-logo { max-width: 150px; }

    /* Confirmación */
    .kbx-ps-confirmation { padding: 32px 8px; }
    .kbx-ps-success h2 { font-size: 1.5rem; }
    .kbx-ps-checkmark { width: 64px; height: 64px; line-height: 64px; font-size: 26px; }

    /* Historial sidebar */
    .kbx-ps-list li { flex-wrap: wrap; gap: 6px; font-size: 0.9rem; }
}

@media (max-width: 400px) {
    .kbx-ps-login-card { padding: 26px 16px; }
    .kbx-ps-logo { max-width: 130px; }
    .kbx-ps-header h1 { font-size: 1.3rem; }
}