/* Story demo pieces for: LINE order-taking chatbot with automatic order recording */

@property --sfp-n {
    syntax: '<integer>';
    inherits: false;
    initial-value: 0;
}

.sfp-tilt-l { transform: rotateX(8deg) rotateY(13deg); }
.sfp-tilt-m { transform: rotateX(7deg) rotateY(-9deg); }

.sfp-phone,
.sfp-slip,
.sfp-cat,
.sfp-bot-card,
.sfp-slip-big,
.sfp-match-card {
    box-shadow:
        0 1px 2px rgba(15, 23, 42, 0.06),
        0 8px 16px -6px rgba(15, 23, 42, 0.12),
        0 28px 56px -18px rgba(15, 23, 42, 0.3);
}

/* ---------- Phone with a chat app ---------- */
.sfp-phone {
    position: absolute;
    width: var(--w, 220px);
    height: var(--h, 380px);
    padding: 7px;
    border-radius: 34px;
    background: linear-gradient(160deg, #334155, #0f172a 40%);
    transform: translateZ(var(--z, 0));
}

.sfp-phone::before {
    content: "";
    position: absolute;
    left: 50%;
    top: 12px;
    width: 58px;
    height: 15px;
    margin-left: -29px;
    border-radius: 10px;
    background: #0f172a;
    z-index: 2;
}

.sfp-screen {
    height: 100%;
    display: flex;
    flex-direction: column;
    border-radius: 27px;
    background: #dbe5f1;
    overflow: hidden;
}

.sfp-screen-white { background: #fff; }

.sfp-status {
    flex: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 30px;
    padding: 4px 20px 0 22px;
    background: #fff;
    font-size: 9.5px;
    color: #0f172a;
}

.sfp-status span { font-size: 6px; letter-spacing: 1px; color: #64748b; }

.sfp-head {
    flex: none;
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 5px 10px 8px;
    background: #fff;
    border-bottom: 1px solid #e8edf3;
    font-size: 11.5px;
}

.sfp-back { font-size: 17px; line-height: 1; color: #94a3b8; }

.sfp-shop {
    display: grid;
    place-items: center;
    width: 24px;
    height: 24px;
    border-radius: 8px;
    background: #06c755;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
}

.sfp-bot-pill {
    margin-left: auto;
    padding: 1px 7px;
    border-radius: 999px;
    background: #eff6ff;
    color: #2563eb;
    font-style: normal;
    font-size: 9.5px;
    font-weight: 700;
}

.sfp-msgs {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 8px 9px;
    overflow: hidden;
}

.sfp-msg {
    max-width: 82%;
    padding: 6px 10px;
    border-radius: 14px;
    font-size: 10.5px;
    line-height: 1.45;
    box-shadow: 0 1px 1px rgba(15, 23, 42, 0.06);
}

.sfp-msg.me { align-self: flex-end; background: #b5ef9b; color: #14532d; border-bottom-right-radius: 4px; }
.sfp-msg.bot { max-width: 94%; align-self: flex-start; background: #fff; color: #334155; border-bottom-left-radius: 4px; }

.sfp-slot { position: relative; align-self: stretch; }

.sfp-typing {
    position: absolute;
    left: 0;
    top: 0;
    display: flex;
    gap: 4px;
    padding: 9px 11px;
    border-radius: 14px 14px 14px 4px;
    background: #fff;
}

.sfp-typing i { width: 6px; height: 6px; border-radius: 50%; background: #94a3b8; }

.sfp-flex {
    position: relative;
    align-self: flex-start;
    width: 90%;
    border-radius: 14px;
    background: #fff;
    overflow: hidden;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08), 0 6px 14px -8px rgba(15, 23, 42, 0.25);
}

.sfp-flex-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 7px 10px;
    background: #2563eb;
    color: #fff;
    font-size: 10.5px;
}

.sfp-flex-head span { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 9.5px; opacity: 0.85; }
.sfp-flex-ok { background: #16a34a; }

.sfp-flex-body { position: relative; padding: 7px 10px 10px; font-size: 10.5px; }

.sfp-li { display: flex; justify-content: space-between; padding: 2px 0; color: #475569; font-variant-numeric: tabular-nums; }
.sfp-li em { font-style: normal; color: #2563eb; font-weight: 600; }
.sfp-li b { color: #0f172a; font-weight: 600; }

.sfp-total {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-top: 4px;
    padding-top: 6px;
    border-top: 1px dashed #e2e8f0;
    font-size: 11px;
    color: #64748b;
}

.sfp-total b { font-size: 15px; color: #0f172a; }

.sfp-btn {
    display: block;
    margin-top: 7px;
    padding: 5px;
    border-radius: 9px;
    background: #06c755;
    color: #fff;
    text-align: center;
    font-size: 11px;
    font-weight: 700;
    box-shadow: 0 3px 0 #05a046;
}

.sfp-tap {
    position: absolute;
    left: 50%;
    bottom: 6px;
    width: 40px;
    height: 40px;
    margin-left: -20px;
    border-radius: 50%;
    border: 2px solid rgba(15, 23, 42, 0.45);
    background: rgba(15, 23, 42, 0.12);
    opacity: 0;
    pointer-events: none;
}

.sfp-input {
    flex: none;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px 14px;
    background: #fff;
    border-top: 1px solid #e8edf3;
}

.sfp-input span { flex: 1; height: 20px; border-radius: 999px; background: #f1f5f9; }
.sfp-input i { width: 20px; height: 20px; border-radius: 50%; background: #06c755; }

/* Chat list (scene 1) */
.sfp-list-head {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px 8px;
    font-size: 15px;
    border-bottom: 1px solid #f1f5f9;
}

.sfp-list-head em {
    padding: 1px 8px;
    border-radius: 999px;
    background: #ef4444;
    color: #fff;
    font-style: normal;
    font-size: 10.5px;
    font-weight: 700;
}

.sfp-list-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 11px;
    border-bottom: 1px solid #f1f5f9;
}

.sfp-av { flex: none; width: 28px; height: 28px; border-radius: 50%; background: linear-gradient(135deg, #fff, var(--c) 55%); }

.sfp-list-txt { min-width: 0; flex: 1; }
.sfp-list-txt b { display: block; font-size: 11px; color: #0f172a; }
.sfp-list-txt span { display: block; font-size: 9.5px; color: #64748b; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.sfp-unread {
    flex: none;
    display: grid;
    place-items: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 999px;
    background: #06c755;
    color: #fff;
    font-style: normal;
    font-size: 9.5px;
    font-weight: 700;
}

/* Loose transfer slips (scene 1) */
.sfp-slips { position: absolute; left: 630px; top: 92px; width: 150px; height: 250px; }

.sfp-slip {
    position: absolute;
    width: 116px;
    padding: 10px 11px 8px;
    border-radius: 10px;
    background: #fff;
    border: 1px solid rgba(15, 23, 42, 0.06);
    transform: rotate(var(--r, 0));
}

.sfp-slip b { display: block; margin: 5px 0 2px; font-size: 15px; font-variant-numeric: tabular-nums; }

.sfp-slip-ok { display: inline-flex; align-items: center; gap: 3px; font-size: 9.5px; font-weight: 600; color: #15803d; }

.sfp-q {
    position: absolute;
    left: 0;
    top: 194px;
    padding: 6px 12px;
    border-radius: 999px;
    background: #fef3c7;
    color: #b45309;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
    box-shadow: 0 6px 16px -6px rgba(180, 83, 9, 0.35);
}

/* ---------- Scene 2: catalogue cards + bot status ---------- */
.sfp-cat {
    position: absolute;
    display: flex;
    align-items: center;
    gap: 12px;
    width: 186px;
    padding: 12px 14px 12px 12px;
    border-radius: 14px;
    background: #fff;
    border: 1px solid rgba(15, 23, 42, 0.06);
    transform: rotate(var(--r, 0));
}

.sfp-cat b { display: block; font-size: 12.5px; color: #0f172a; }
.sfp-cat span { display: block; font-size: 10.5px; color: #94a3b8; }
.sfp-cat em { display: inline-block; margin-top: 4px; padding: 1px 8px; border-radius: 6px; background: #eff6ff; color: #1d4ed8; font-style: normal; font-size: 12px; font-weight: 700; }

.sfp-bag {
    position: relative;
    flex: none;
    width: 44px;
    height: 58px;
    border-radius: 6px 6px 8px 8px;
    background: linear-gradient(100deg, #78350f, #a16207 55%, #854d0e);
    box-shadow: inset 0 6px 0 rgba(0, 0, 0, 0.18);
}

.sfp-bag::after {
    content: "";
    position: absolute;
    left: 8px;
    right: 8px;
    top: 20px;
    height: 22px;
    border-radius: 4px;
    background: #fef3c7;
    box-shadow: inset 0 -6px 0 #fcd34d;
}

.sfp-bag-box {
    height: 50px;
    border-radius: 6px;
    background: linear-gradient(100deg, #e7e5e4, #fafaf9 55%, #d6d3d1);
    box-shadow: inset 0 5px 0 #b91c1c;
}

.sfp-bag-box::after { top: 16px; background: #fff; box-shadow: inset 0 -5px 0 #fecaca; }

.sfp-bot-card {
    position: absolute;
    width: 196px;
    padding: 14px 16px 10px;
    border-radius: 16px;
    background: #fff;
    border: 1px solid rgba(15, 23, 42, 0.06);
}

.sfp-bot-top { margin-bottom: 8px; }

.sfp-live {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px;
    border-radius: 999px;
    background: #dcfce7;
    color: #15803d;
    font-size: 11px;
    font-weight: 700;
}

.sfp-live i { width: 7px; height: 7px; border-radius: 50%; background: #16a34a; }

.sfp-bot-stat {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 7px 0;
    border-top: 1px dashed #e2e8f0;
    font-size: 11px;
    color: #64748b;
}

.sfp-bot-stat b { font-size: 16px; color: #0f172a; font-variant-numeric: tabular-nums; }
.sfp-bot-stat b i { font-style: normal; }

.sfp-count { --sfp-n: var(--to); counter-reset: sfp var(--sfp-n); }
.sfp-count::after { content: counter(sfp); }

/* ---------- Scene 3: slip check + order database ---------- */
.sfp-slip-big {
    position: absolute;
    left: 36px;
    top: 56px;
    width: 204px;
    padding: 20px 14px 10px;
    border-radius: 14px;
    background: #fff;
    border: 1px solid rgba(15, 23, 42, 0.07);
    transform: rotate(-4deg);
    z-index: 2;
}

.sfp-slip-big .sfx-ocr-amt b { font-size: 22px; }

.sfp-card-tag {
    position: absolute;
    top: -11px;
    left: 14px;
    padding: 3px 10px;
    border-radius: 999px;
    background: #2563eb;
    color: #fff;
    font-size: 10.5px;
    font-weight: 600;
    white-space: nowrap;
}

.sfp-match-card {
    position: absolute;
    left: 40px;
    top: 268px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border-radius: 14px;
    background: #fff;
    border: 1px solid rgba(15, 23, 42, 0.07);
    transform: rotate(2deg);
    z-index: 2;
}

.sfp-match-card span { display: block; font-size: 10px; color: #94a3b8; }
.sfp-match-card b { display: block; font-size: 15px; color: #0f172a; font-variant-numeric: tabular-nums; }
.sfp-match-card i { font-style: normal; font-size: 18px; font-weight: 700; color: #93c5fd; }
.sfp-match-card em { padding: 3px 9px; border-radius: 999px; background: #dcfce7; color: #15803d; font-style: normal; font-size: 11.5px; font-weight: 700; white-space: nowrap; }

.sfp-fly { left: 196px; top: 206px; z-index: 3; }

.sfp-db .sfx-row { grid-template-columns: .8fr .85fr 1.05fr .6fr 1.2fr; }
.sfp-db .sfx-row.sfp-new { background: #eff6ff; border-radius: 8px; border-bottom-color: transparent; }

/* ---------- Scene 4: confirmation, dashboard, packing list ---------- */
.sfp-step {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 4px 0;
    font-size: 10.5px;
    color: #334155;
}

.sfp-step i {
    display: grid;
    place-items: center;
    flex: none;
    width: 15px;
    height: 15px;
    border-radius: 50%;
    background: #16a34a;
    color: #fff;
    font-style: normal;
    font-size: 8.5px;
    font-weight: 800;
}

.sfp-step-now { color: #1d4ed8; font-weight: 600; }
.sfp-step-now i { background: #fff; border: 2px solid #2563eb; box-shadow: inset 0 0 0 2.5px #fff, inset 0 0 0 8px #2563eb; }

.sfp-dash-body { padding: 12px 14px 12px; }

.sfp-kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }

.sfp-kpi { padding: 8px 10px; border-radius: 12px; background: #f8fafc; border: 1px solid #eef2f6; }
.sfp-kpi span { display: block; font-size: 10.5px; color: #64748b; }
.sfp-kpi b { display: block; font-size: 24px; line-height: 1.2; font-weight: 700; color: #0f172a; font-variant-numeric: tabular-nums; }
.sfp-kpi-ok { background: #f0fdf4; border-color: #dcfce7; }
.sfp-kpi-ok b { color: #15803d; }
.sfp-kpi-warn { background: #fffbeb; border-color: #fef3c7; }
.sfp-kpi-warn b { color: #b45309; }

.sfp-split-title { margin: 12px 0 0; font-size: 10.5px; font-weight: 600; color: #94a3b8; letter-spacing: 0.04em; }

.sfp-bars { height: 72px; margin: 6px 0 4px; }
.sfp-bars span { background: linear-gradient(#60a5fa, #2563eb); }
.sfp-bars span:nth-child(5) { background: linear-gradient(#34d399, #059669); }

.sfp-hours { display: flex; gap: 8px; font-size: 9px; color: #94a3b8; text-align: center; }
.sfp-hours span { flex: 1; }

/* ---------- Motion ---------- */
.is-active .sfp-in { opacity: 0; animation: sfp-msg-in 0.45s cubic-bezier(.2, 1.2, .4, 1) forwards; animation-delay: var(--d, 0s); }
.is-active .sfp-typing { opacity: 0; animation: sfp-typing 1.3s ease both; }
.is-active .sfp-typing i { animation: sfp-dot 0.5s ease-in-out infinite alternate; }
.is-active .sfp-typing i:nth-child(2) { animation-delay: 0.15s; }
.is-active .sfp-typing i:nth-child(3) { animation-delay: 0.3s; }
.is-active .sfp-btn { animation: sfp-press 0.5s ease both 2.3s; }
.is-active .sfp-tap { animation: sfp-tap 0.9s ease-out both 2.15s; }

.is-active .sfp-slip { animation: sfp-drop 0.5s ease both; }
.is-active .sfp-slip:nth-child(2) { animation-delay: 0.15s; }
.is-active .sfp-slip:nth-child(3) { animation-delay: 0.3s; }

.is-active .sfp-cat { opacity: 0; animation: sfp-drop 0.5s ease forwards; animation-delay: var(--d, 0s); }
.is-active .sfp-bot-card { opacity: 0; animation: sfp-rise 0.6s ease forwards 0.5s; }
.is-active .sfp-live i { animation: sfp-blink 1.4s ease-in-out infinite; }
.is-active .sfp-count { animation: sfp-count 1.2s cubic-bezier(.2, .7, .3, 1) both 0.6s; }

.is-active .sfp-slip-big { animation: sfp-slide-in 0.6s ease both; }
.is-active .sfp-match-card { opacity: 0; animation: sfp-pop 0.45s cubic-bezier(.2, 1.4, .4, 1) forwards 1.3s; }
.is-active .sfp-fly { opacity: 0; animation: sfp-fly 0.9s cubic-bezier(.5, 0, .3, 1) both 1.3s; }

.is-active .sfp-step { opacity: 0; animation: sfp-msg-in 0.35s ease forwards; animation-delay: var(--d, 0s); }
.is-active .sfp-step-now i { animation: sfp-ring 1.4s ease-in-out infinite 1.8s; }
.is-active .sfp-dash { opacity: 0; animation: sfp-rise 0.6s ease forwards 0.1s; }

@keyframes sfp-msg-in {
    from { opacity: 0; transform: translateY(8px) scale(0.96); }
    to { opacity: 1; transform: none; }
}

@keyframes sfp-typing {
    0%, 30% { opacity: 0; }
    40%, 90% { opacity: 1; }
    100% { opacity: 0; }
}

@keyframes sfp-dot { to { transform: translateY(-3px); opacity: 0.5; } }

@keyframes sfp-press {
    0%, 100% { transform: none; box-shadow: 0 3px 0 #05a046; }
    30%, 60% { transform: translateY(3px); box-shadow: 0 0 0 #05a046; background: #05a046; }
}

@keyframes sfp-tap {
    0% { opacity: 0; transform: scale(0.4); }
    30% { opacity: 1; transform: scale(0.8); }
    100% { opacity: 0; transform: scale(1.5); }
}

@keyframes sfp-drop {
    from { opacity: 0; transform: rotate(var(--r, 0)) translateY(-24px); }
    to { opacity: 1; transform: rotate(var(--r, 0)); }
}

@keyframes sfp-rise {
    from { opacity: 0; transform: translateY(18px); }
    to { opacity: 1; transform: none; }
}

@keyframes sfp-blink { 50% { opacity: 0.25; } }

@keyframes sfp-count {
    from { --sfp-n: 0; }
    to { --sfp-n: var(--to); }
}

@keyframes sfp-slide-in {
    from { opacity: 0; transform: rotate(-4deg) translateX(-30px); }
    to { opacity: 1; transform: rotate(-4deg); }
}

@keyframes sfp-pop {
    from { opacity: 0; transform: rotate(2deg) scale(0.85); }
    to { opacity: 1; transform: rotate(2deg) scale(1); }
}

@keyframes sfp-fly {
    0% { opacity: 0; transform: translate(0, 0) scale(1); }
    20% { opacity: 1; transform: translate(10px, 0) scale(1); }
    85% { opacity: 1; transform: translate(170px, 64px) scale(0.7); }
    100% { opacity: 0; transform: translate(190px, 70px) scale(0.6); }
}

@keyframes sfp-ring {
    50% { transform: scale(1.2); }
}

@media (prefers-reduced-motion: reduce) {
    .sfp-tap, .sfp-fly, .sfp-typing { display: none; }
}
