/**
 * Create Your Weekly Box — guided add-to-box flow.
 * Overlay is constrained to the portal app frame so it reads as a phone screen
 * on desktop too (see --kf-app-shell-max in customer-native-app-shell.css).
 */

.kf-wbox {
    position: fixed;
    inset: 0;
    z-index: 12060;
    display: flex;
    justify-content: center;
}

.kf-wbox[hidden] {
    display: none !important;
}

.kf-wbox__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(6, 24, 14, 0.72);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.kf-wbox--open .kf-wbox__backdrop {
    opacity: 1;
}

.kf-wbox__frame {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: var(--kf-app-shell-max, 430px);
    height: 100%;
    overflow: hidden;
    background: var(--kf-nature-page-bg, #f7faf8);
    box-shadow: 0 0 60px rgba(6, 24, 14, 0.4);
    transform: translateY(100%);
    transition: transform 0.34s cubic-bezier(0.22, 0.61, 0.36, 1);
}

.kf-wbox--open .kf-wbox__frame {
    transform: translateY(0);
}

/* Immersive steps (welcome, hand-off messages, summary) paint the whole frame. */
.kf-wbox--immersive .kf-wbox__frame {
    background:
        radial-gradient(ellipse 120% 80% at 50% 0%, rgba(74, 222, 128, 0.26) 0%, transparent 60%),
        linear-gradient(165deg, #14532d 0%, #166534 48%, #15803d 100%);
    color: #f0fdf4;
}

/* ── Header ── */
.kf-wbox__head {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex: 0 0 auto;
    padding: calc(0.7rem + env(safe-area-inset-top, 0px)) 0.75rem 0.6rem;
    background: #fff;
    border-bottom: 1px solid rgba(15, 23, 42, 0.08);
}

.kf-wbox--immersive .kf-wbox__head {
    background: transparent;
    border-bottom-color: transparent;
}

.kf-wbox__head-text {
    flex: 1 1 auto;
    min-width: 0;
}

.kf-wbox__eyebrow {
    margin: 0;
    font-size: 0.64rem;
    font-weight: 800;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: #15803d;
}

.kf-wbox--immersive .kf-wbox__eyebrow {
    color: rgba(190, 242, 100, 0.9);
}

.kf-wbox__heading {
    margin: 0.1rem 0 0;
    font-size: 1rem;
    font-weight: 800;
    line-height: 1.25;
    letter-spacing: -0.015em;
    color: #0f172a;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.kf-wbox--immersive .kf-wbox__heading {
    color: #fff;
}

.kf-wbox__back,
.kf-wbox__close {
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    width: 2.1rem;
    height: 2.1rem;
    padding: 0;
    border: 1px solid rgba(15, 23, 42, 0.12);
    color: #334155;
    background: #fff;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.kf-wbox--immersive .kf-wbox__back,
.kf-wbox--immersive .kf-wbox__close {
    border-color: rgba(240, 253, 244, 0.32);
    color: #f0fdf4;
    background: rgba(4, 47, 24, 0.38);
}

.kf-wbox__back[hidden] {
    display: none;
}

/* ── Progress ── */
.kf-wbox__progress {
    display: flex;
    gap: 3px;
    flex: 0 0 auto;
    padding: 0.5rem 0.75rem 0;
    background: #fff;
}

.kf-wbox--immersive .kf-wbox__progress {
    background: transparent;
}

.kf-wbox__progress[hidden] {
    display: none;
}

.kf-wbox__pip {
    flex: 1 1 0;
    height: 3px;
    background: rgba(15, 23, 42, 0.12);
}

.kf-wbox__pip--done {
    background: #4ade80;
}

.kf-wbox__pip--now {
    background: #15803d;
}

/* ── Running tally ── */
.kf-wbox__tally {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.75rem;
    flex: 0 0 auto;
    padding: 0.55rem 0.85rem;
    background: #fff;
    border-bottom: 1px solid rgba(15, 23, 42, 0.07);
}

.kf-wbox__tally[hidden] {
    display: none;
}

.kf-wbox__tally-count {
    font-size: 0.76rem;
    font-weight: 700;
    color: #475569;
}

.kf-wbox__tally-total {
    font-size: 0.95rem;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    color: #14532d;
}

/* ── Body ── */
.kf-wbox__body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

/* ── Immersive step content ── */
.kf-wbox__pitch {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 100%;
    padding: 1.6rem 1.4rem 2rem;
    text-align: center;
}

.kf-wbox__pitch--welcome {
    overflow: hidden;
}

.kf-wbox__pitch-atmos {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.kf-wbox__pitch-orb {
    position: absolute;
    border-radius: 50%;
}

.kf-wbox__pitch-orb--a {
    top: -18%;
    right: -20%;
    width: 14rem;
    height: 14rem;
    background: radial-gradient(circle, rgba(190, 242, 100, 0.28) 0%, transparent 68%);
}

.kf-wbox__pitch-orb--b {
    bottom: -22%;
    left: -24%;
    width: 16rem;
    height: 16rem;
    background: radial-gradient(circle, rgba(74, 222, 128, 0.18) 0%, transparent 70%);
}

.kf-wbox__pitch-kicker {
    position: relative;
    z-index: 1;
    margin: 0 0 0.85rem;
    font-size: 1.05rem;
    font-weight: 650;
    color: rgba(240, 253, 244, 0.82);
}

.kf-wbox__pitch-name {
    font-weight: 800;
    color: #d9f99d;
}

.kf-wbox__pitch-title {
    position: relative;
    z-index: 1;
    margin: 0;
    font-size: clamp(1.55rem, 6.8vw, 2.1rem);
    font-weight: 800;
    line-height: 1.22;
    letter-spacing: -0.025em;
    color: #fff;
    text-wrap: balance;
}

.kf-wbox__pitch-title-sub {
    display: block;
    margin-top: 0.45rem;
    font-size: clamp(1rem, 4.2vw, 1.18rem);
    font-weight: 700;
    line-height: 1.35;
    letter-spacing: -0.01em;
    color: #d9f99d;
}

.kf-wbox__pitch-text {
    position: relative;
    z-index: 1;
    margin: 1rem 0 0;
    font-size: 0.98rem;
    font-weight: 600;
    line-height: 1.5;
    color: rgba(240, 253, 244, 0.86);
}

.kf-wbox__pitch-chip {
    position: relative;
    z-index: 1;
    display: inline-flex;
    align-self: center;
    margin-top: 1.25rem;
    padding: 0.7rem 1rem;
    border: 1px solid rgba(236, 252, 203, 0.22);
    background: rgba(15, 61, 36, 0.4);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.kf-wbox__pitch-chip-copy {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.kf-wbox__pitch-chip-lab {
    font-size: 0.74rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: rgba(240, 253, 244, 0.7);
}

.kf-wbox__pitch-date {
    display: block;
    font-size: 1.12rem;
    font-weight: 800;
    color: #d9f99d;
}

/* ── Product picker (reuses category-page multi-tier card styles) ── */
.kf-wbox__section-note {
    margin: 0;
    padding: 0.7rem 0.85rem;
    font-size: 0.76rem;
    font-weight: 600;
    line-height: 1.45;
    color: #475569;
    background: #eefaf1;
    border-bottom: 1px solid rgba(21, 128, 61, 0.12);
}

.kf-wbox__panel {
    background: #fff;
}

/* Sticky tier header sits at the top of the scrollable body. */
.kf-wbox__body .bh-mt-head {
    top: 0;
}

.kf-wbox__body .bh-custom-panel--multitier,
.kf-wbox__body .bh-grid.bh-grid--multitier-host {
    overflow: visible;
}

/* ── Summary ── */
.kf-wbox__summary {
    padding: 1.2rem 1rem 1.6rem;
}

.kf-wbox__summary-group {
    margin: 0 0 0.9rem;
    padding: 0.7rem 0.8rem;
    background: rgba(240, 253, 244, 0.1);
    border: 1px solid rgba(240, 253, 244, 0.22);
}

.kf-wbox__summary-cat {
    margin: 0 0 0.45rem;
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #bef264;
}

.kf-wbox__summary-line {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.2rem 0;
    font-size: 0.82rem;
    font-weight: 600;
    color: rgba(240, 253, 244, 0.92);
}

.kf-wbox__summary-line-amt {
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.kf-wbox__summary-empty {
    margin: 0 0 0.9rem;
    padding: 0.7rem 0.8rem;
    font-size: 0.8rem;
    font-weight: 600;
    line-height: 1.45;
    color: rgba(240, 253, 244, 0.86);
    background: rgba(4, 47, 24, 0.28);
    border: 1px dashed rgba(240, 253, 244, 0.3);
}

.kf-wbox__summary-link {
    padding: 0;
    border: 0;
    font: inherit;
    font-weight: 800;
    color: #bef264;
    text-decoration: underline;
    background: none;
    cursor: pointer;
}

.kf-wbox__bill {
    margin-top: 1rem;
    padding-top: 0.7rem;
    border-top: 1px dashed rgba(240, 253, 244, 0.34);
}

.kf-wbox__bill-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.18rem 0;
    font-size: 0.85rem;
    font-weight: 650;
    color: rgba(240, 253, 244, 0.88);
}

.kf-wbox__bill-row--total {
    margin-top: 0.35rem;
    padding-top: 0.45rem;
    border-top: 1px solid rgba(240, 253, 244, 0.28);
    font-size: 1.02rem;
    font-weight: 800;
    color: #fff;
}

.kf-wbox__bill-note {
    margin: 0.5rem 0 0;
    font-size: 0.7rem;
    font-weight: 600;
    line-height: 1.45;
    color: rgba(240, 253, 244, 0.7);
}

/* ── Footer ── */
.kf-wbox__foot {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex: 0 0 auto;
    padding: 0.7rem 0.85rem calc(0.7rem + env(safe-area-inset-bottom, 0px));
    background: #fff;
    border-top: 1px solid rgba(15, 23, 42, 0.08);
}

.kf-wbox--immersive .kf-wbox__foot {
    background: transparent;
    border-top-color: transparent;
}

.kf-wbox__foot[hidden] {
    display: none;
}

.kf-wbox__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    min-height: 46px;
    padding: 0.7rem 1rem;
    border: 0;
    font: inherit;
    font-size: 0.95rem;
    font-weight: 800;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: filter 0.18s ease;
}

.kf-wbox__btn:disabled {
    opacity: 0.6;
    cursor: default;
}

.kf-wbox__btn--primary {
    flex: 1 1 auto;
    color: #fff;
    background: linear-gradient(145deg, #1f7a4f 0%, #166534 100%);
    box-shadow: 0 6px 16px rgba(22, 101, 52, 0.26);
}

.kf-wbox--immersive .kf-wbox__btn--primary {
    color: #14532d;
    background: linear-gradient(145deg, #ecfccb 0%, #bef264 100%);
    box-shadow: 0 8px 20px rgba(4, 47, 24, 0.32);
}

.kf-wbox__btn--ghost {
    flex: 0 0 auto;
    color: #64748b;
    background: #f1f5f9;
}

.kf-wbox--immersive .kf-wbox__btn--ghost {
    color: rgba(240, 253, 244, 0.86);
    background: rgba(4, 47, 24, 0.34);
}

.kf-wbox__btn:hover,
.kf-wbox__btn:focus-visible {
    filter: brightness(1.05);
}

.kf-wbox__btn-sub {
    font-size: 0.72rem;
    font-weight: 700;
    opacity: 0.85;
}

.kf-wbox__nudge {
    flex: 1 1 100%;
    margin: 0;
    padding: 0.5rem 0.1rem 0;
    font-size: 0.74rem;
    font-weight: 650;
    line-height: 1.45;
    color: #b45309;
}

/* ── States ── */
.kf-wbox__state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    min-height: 100%;
    padding: 2rem 1.4rem;
    text-align: center;
}

.kf-wbox__state-text {
    margin: 0;
    font-size: 0.92rem;
    font-weight: 650;
    line-height: 1.5;
    color: #475569;
}

.kf-wbox--immersive .kf-wbox__state-text {
    color: rgba(240, 253, 244, 0.88);
}

.kf-wbox__spinner {
    width: 1.9rem;
    height: 1.9rem;
    border: 3px solid rgba(21, 128, 61, 0.2);
    border-top-color: #15803d;
    border-radius: 50%;
    animation: kf-wbox-spin 0.85s linear infinite;
}

@keyframes kf-wbox-spin {
    to { transform: rotate(360deg); }
}

body.kf-wbox-open {
    overflow: hidden;
}

@media (prefers-reduced-motion: reduce) {
    .kf-wbox__frame,
    .kf-wbox__backdrop {
        transition: none;
    }

    .kf-wbox__spinner {
        animation-duration: 2s;
    }
}
