/* Story demo: manual portal logins -> bot login -> export/merge/check -> daily report */

/* ---------- Browser chrome ---------- */
.sfx-bar .sfp-addr {
    flex: 1;
    margin-left: 10px;
    padding: 3px 10px 3px 22px;
    border-radius: 7px;
    background: #fff;
    border: 1px solid #e2e8f0;
    font-size: 10.5px;
    color: #475569;
    position: relative;
}

.sfx-bar .sfp-addr::before {
    content: "";
    position: absolute;
    left: 9px;
    top: 50%;
    width: 6px;
    height: 5px;
    margin-top: -1px;
    border-radius: 1px;
    background: #94a3b8;
    box-shadow: 0 -3px 0 -1px #fff, 0 -4px 0 0 #94a3b8;
}

.sfp-bot {
    flex: none;
    margin-left: 4px;
    padding: 2px 7px;
    border-radius: 6px;
    background: #2563eb;
    color: #fff;
    font-style: normal;
    font-size: 9.5px;
    font-weight: 700;
    letter-spacing: 0.08em;
}

.sfp-tabs {
    display: flex;
    gap: 2px;
    padding: 6px 10px 0;
    background: #f1f5f9;
    border-bottom: 1px solid #e2e8f0;
}

.sfp-tabs span {
    flex: 1;
    padding: 5px 8px;
    border-radius: 7px 7px 0 0;
    font-size: 10px;
    color: #64748b;
    background: #e8edf3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sfp-tabs span.on { background: #fff; color: #0f172a; font-weight: 600; }

/* ---------- Portal login page ---------- */
.sfp-login { display: grid; grid-template-columns: 128px 1fr; min-height: 210px; }
.sfp-login.big { grid-template-columns: 164px 1fr; min-height: 280px; }

.sfp-brand {
    padding: 18px 14px;
    background: linear-gradient(160deg, #1e3a8a, #2563eb);
    color: #fff;
}

.sfp-brand i {
    display: block;
    width: 30px;
    height: 30px;
    border-radius: 9px;
    background: #fff;
    box-shadow: inset 0 0 0 7px #fb923c;
    margin-bottom: 10px;
}

.sfp-brand b { display: block; font-size: 13px; margin-bottom: 10px; }
.sfp-brand .sfx-line { background: rgba(255, 255, 255, 0.25); }

.sfp-form { padding: 14px 18px 16px; }
.sfp-login.big .sfp-form { padding: 30px 26px 22px; }
.sfp-login.big .sfp-form label { margin-top: 10px; }
.sfp-login.big .sfp-field { height: 32px; line-height: 30px; font-size: 13px; }

.sfp-form label { display: block; font-size: 10.5px; color: #64748b; margin: 6px 0 3px; }

.sfp-field {
    height: 28px;
    padding: 0 10px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #f8fafc;
    font-size: 12px;
    line-height: 26px;
    color: #0f172a;
    white-space: nowrap;
    overflow: hidden;
}

.sfp-field.sfp-empty { border-color: #fca5a5; background: #fff; }

.sfp-btn {
    margin-top: 12px;
    padding: 7px;
    border-radius: 8px;
    background: #cbd5e1;
    color: #fff;
    text-align: center;
    font-size: 12px;
    font-weight: 700;
}

.sfp-alert {
    padding: 6px 10px;
    border-radius: 8px;
    background: #fee2e2;
    color: #b91c1c;
    font-size: 11px;
    font-weight: 600;
    margin-bottom: 4px;
}

.sfp-login.big .sfx-run-wrap { margin-top: 22px; }
.sfp-type { display: inline-block; }

/* ---------- Scene 1: downloads folder ---------- */
.sfp-files { padding: 6px 10px 10px; }

.sfp-f {
    display: grid;
    grid-template-columns: 36px 1fr 36px;
    align-items: center;
    gap: 8px;
    padding: 7px 6px;
    border-bottom: 1px solid #f1f5f9;
    font-size: 11.5px;
}

.sfp-f b { font-weight: 500; color: #334155; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sfp-f time { font-size: 10px; color: #94a3b8; text-align: right; }
.sfp-f.dup { background: #fef3c7; border-radius: 6px; }
.sfp-f.dup b { color: #b45309; }

.sfp-f i,
.sfp-ff i {
    font-style: normal;
    font-size: 8.5px;
    font-weight: 700;
    color: #fff;
    text-align: center;
    padding: 3px 0;
    border-radius: 4px;
}

.sfp-f i.csv, .sfp-ff i.csv { background: #0ea5e9; }
.sfp-f i.xls, .sfp-ff i.xls { background: #16a34a; }
.sfp-ff i.log { background: #64748b; }

/* ---------- Scene 2: clock + portal queue ---------- */
.sfp-clock {
    position: absolute;
    left: 36px;
    top: 48px;
    display: flex;
    align-items: center;
    gap: 10px;
    width: 204px;
    padding: 10px 16px 10px 10px;
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 14px 30px -12px rgba(15, 23, 42, 0.35);
}

.sfp-clock b { display: block; font-size: 17px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.sfp-clock span { font-size: 11px; color: #64748b; }

.sfp-clock-face {
    position: relative;
    flex: none;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 3px solid #2563eb;
    background: #eff6ff;
}

.sfp-clock-face::before,
.sfp-clock-face i {
    content: "";
    position: absolute;
    left: 50%;
    bottom: 50%;
    width: 2px;
    margin-left: -1px;
    border-radius: 2px;
    background: #1e3a8a;
    transform-origin: bottom center;
}

.sfp-clock-face::before { height: 8px; transform: rotate(180deg); }
.sfp-clock-face i { height: 11px; background: #2563eb; }

.sfp-queue {
    position: absolute;
    left: 36px;
    top: 134px;
    width: 204px;
    padding: 10px 12px 6px;
    background: #fff;
    border-radius: 14px;
    border: 1px solid rgba(15, 23, 42, 0.07);
    box-shadow:
        0 1px 2px rgba(15, 23, 42, 0.06),
        0 8px 16px -6px rgba(15, 23, 42, 0.12),
        0 30px 60px -18px rgba(15, 23, 42, 0.28);
}

.sfp-q-h { font-size: 11px; font-weight: 600; color: #94a3b8; padding-bottom: 6px; }

.sfp-q {
    display: grid;
    grid-template-columns: 24px 1fr 30px;
    align-items: center;
    gap: 8px;
    padding: 10px 0;
    border-top: 1px solid #f1f5f9;
    font-size: 12px;
}

.sfp-q > i {
    display: grid;
    place-items: center;
    width: 24px;
    height: 24px;
    border-radius: 7px;
    color: #fff;
    font-style: normal;
    font-size: 11px;
    font-weight: 700;
}

.sfp-q > b { font-weight: 600; color: #0f172a; }

/* ---------- Scene 3: portal report + merge ---------- */
.sfp-rep { padding: 12px 14px 14px; }
.sfp-rep-h { display: block; font-size: 13px; margin-bottom: 8px; }

.sfp-filter {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 10px;
}

.sfp-filter span {
    flex: 1;
    padding: 5px 9px;
    border: 1px solid #e2e8f0;
    border-radius: 7px;
    font-size: 10.5px;
    color: #334155;
    white-space: nowrap;
}

.sfp-export {
    padding: 5px 11px;
    border-radius: 7px;
    background: #2563eb;
    color: #fff;
    font-style: normal;
    font-size: 11px;
    font-weight: 700;
    box-shadow: 0 3px 0 #1e40af;
}

.sfp-mini div {
    display: flex;
    justify-content: space-between;
    padding: 6px 4px;
    border-bottom: 1px solid #f1f5f9;
    font-size: 11px;
    color: #334155;
    font-variant-numeric: tabular-nums;
}

.sfp-mini div span:first-child { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 10.5px; }
.sfp-mini div.h { font-size: 10px; font-weight: 600; color: #94a3b8; background: #f8fafc; }
.sfp-mini div.h span:first-child { font-family: inherit; font-size: 10px; }

.sfp-merge .sfx-row { grid-template-columns: 1.45fr 0.85fr 0.6fr 0.85fr; }
.sfp-merge .sfx-row span:first-child { color: #1d4ed8; }
.sfp-merge .sfx-row.head span:first-child { color: #94a3b8; font-family: inherit; font-size: 10.5px; }

.sfp-merged {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 12px 4px 2px;
    font-size: 11px;
    color: #64748b;
}

.sfp-merged b { color: #15803d; font-size: 12px; }
.sfp-pull-bar { flex: 1; height: 6px; border-radius: 999px; background: #e2e8f0; overflow: hidden; }
.sfp-pull-bar i { display: block; height: 100%; width: 100%; border-radius: inherit; background: linear-gradient(90deg, #3b82f6, #10b981); }

/* ---------- Scene 4: dashboard + shared folder ---------- */
.sfp-dash { padding: 14px 16px 14px; }

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

.sfp-tile {
    padding: 10px 12px;
    border-radius: 10px;
    background: #f8fafc;
    border: 1px solid #eef2f6;
}

.sfp-tile span { display: block; font-size: 10.5px; color: #64748b; }
.sfp-tile b { display: block; font-size: 19px; line-height: 1.3; font-weight: 700; color: #0f172a; font-variant-numeric: tabular-nums; }
.sfp-tile em { font-style: normal; font-size: 10.5px; font-weight: 600; color: #15803d; }

.sfp-chart { margin-top: 12px; }
.sfp-chart-h { font-size: 10.5px; font-weight: 600; color: #94a3b8; }
.sfp-chart .sfx-bars { height: 92px; margin: 6px 0 4px; }
.sfp-chart .sfx-bars span { background: linear-gradient(#93c5fd, #60a5fa); }
.sfp-chart .sfx-bars span.today { background: linear-gradient(#3b82f6, #1d4ed8); }

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

.sfp-folder {
    position: absolute;
    left: 584px;
    top: 112px;
    width: 186px;
    padding: 10px 12px 8px;
    background: #fff;
    border-radius: 14px;
    border: 1px solid rgba(15, 23, 42, 0.07);
    box-shadow:
        0 1px 2px rgba(15, 23, 42, 0.06),
        0 8px 16px -6px rgba(15, 23, 42, 0.12),
        0 30px 60px -18px rgba(15, 23, 42, 0.28);
}

.sfp-folder-h { display: flex; align-items: center; gap: 8px; padding-bottom: 8px; font-size: 11.5px; }

.sfp-folder-h i {
    position: relative;
    width: 22px;
    height: 16px;
    border-radius: 3px;
    background: #fbbf24;
}

.sfp-folder-h i::before {
    content: "";
    position: absolute;
    left: 0;
    top: -3px;
    width: 10px;
    height: 5px;
    border-radius: 2px 2px 0 0;
    background: #f59e0b;
}

.sfp-ff {
    display: grid;
    grid-template-columns: 34px 1fr;
    align-items: center;
    gap: 8px;
    padding: 7px 4px;
    border-top: 1px solid #f1f5f9;
    font-size: 11px;
}

.sfp-ff b { font-weight: 500; color: #334155; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sfp-ff.new { background: #ecfdf5; border-radius: 7px; }
.sfp-ff.new b { color: #15803d; font-weight: 600; }

/* ---------- Motion ---------- */
.is-active .sfp-clock-face i { animation: sfp-tick 2.4s linear infinite; }
.is-active .sfp-q { animation: sfp-rise 0.4s ease both; animation-delay: calc(var(--d) - 0.3s); }
.is-active .sfp-type { animation: sfp-type 0.6s steps(10, end) both; animation-delay: var(--d); }
.is-active .sfp-export { animation: sfp-tap 2.6s ease infinite 0.2s; }
.is-active .sfp-pull-bar i { animation: sfp-fill 2s ease both 0.4s; }
.is-active .sfp-tile { animation: sfp-rise 0.5s cubic-bezier(.2, 1.3, .4, 1) both; animation-delay: var(--d); }
.is-active .sfp-folder { animation: sfp-rise 0.6s ease both 0.6s; }
.is-active .sfp-ff { animation: sfp-rise 0.4s ease both; animation-delay: var(--d); }

@keyframes sfp-tick { to { transform: rotate(360deg); } }

@keyframes sfp-type {
    from { clip-path: inset(0 100% 0 0); }
    to { clip-path: inset(0 0 0 0); }
}

@keyframes sfp-tap {
    0%, 20% { transform: translateY(0); box-shadow: 0 3px 0 #1e40af; }
    26%, 32% { transform: translateY(3px); box-shadow: 0 0 0 #1e40af; }
    38%, 100% { transform: translateY(0); box-shadow: 0 3px 0 #1e40af; }
}

@keyframes sfp-fill {
    from { width: 0; }
    to { width: 100%; }
}

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

@media (prefers-reduced-motion: reduce) {
    .sfp-clock-face i { transform: rotate(0deg); }
}
