/* Spend profile onboarding — immersive full-screen journey */

:root {
    --so-brand: #0369a1;
    --so-brand-dark: #005f9c;
    --so-brand-deep: #0c4a6e;
    --so-brand-soft: #f0f9ff;
    --so-brand-border: #bae6fd;
    --so-surface: #ffffff;
    --so-stage: #f4f7fb;
    --so-text: #111827;
    --so-text-muted: #6b7280;
    --so-text-subtle: #9ca3af;
    --so-border: #e5e7eb;
    --so-radius: 10px;
    --so-radius-lg: 16px;
    --so-font: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

body.spend-onboard-open {
    overflow: hidden;
}

/* Reset global index.php button rules inside onboarding */
.spend-onboard button {
    width: auto;
    max-width: none;
    margin: 0;
    box-sizing: border-box;
    line-height: 1.35;
    font-weight: 500;
}

.spend-onboard button.spend-onboard__btn--primary {
    background: var(--so-brand-dark);
    color: #fff;
}

.spend-onboard button.spend-onboard__btn--primary:hover:not(:disabled) {
    background: var(--so-brand);
    color: #fff;
}

.spend-onboard button.spend-onboard__btn--ghost {
    background: var(--so-surface);
    color: var(--so-text-muted);
}

.spend-onboard button.spend-onboard__btn--ghost:hover:not(:disabled) {
    background: #f3f4f6;
    color: var(--so-text);
}

.spend-onboard button.spend-onboard__skip {
    background: var(--so-surface);
    color: var(--so-text-muted);
}

.spend-onboard {
    position: fixed;
    inset: 0;
    z-index: 12000;
    font-family: var(--so-font);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.spend-onboard.is-visible {
    opacity: 1;
    visibility: visible;
}

.spend-onboard__shell {
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
    min-height: 0;
}

/* —— Full-width top bar: logo + skip —— */
.spend-onboard__header {
    position: relative;
    z-index: 2;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 16px 28px;
    background: var(--so-surface);
    border-bottom: 1px solid var(--so-border);
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
}

.spend-onboard__content {
    flex: 1;
    display: grid;
    grid-template-columns: minmax(300px, 40%) 1fr;
    min-height: 0;
    overflow: hidden;
}

/* Brand: reuse .sidebar-brand / .sidebar-brand-logo from header.php */
.spend-onboard__header .spend-onboard__brand {
    flex: 1;
    min-width: 0;
    text-align: left;
}

.spend-onboard__header .sidebar-brand-tagline {
    max-width: 420px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* —— Hero panel (branded journey rail) —— */
.spend-onboard__hero {
    position: relative;
    display: flex;
    flex-direction: column;
    padding: 28px 32px 24px;
    color: #fff;
    background: linear-gradient(155deg, var(--so-brand-deep) 0%, var(--so-brand) 52%, #0ea5e9 100%);
    overflow: hidden;
    overflow-y: auto;
    min-height: 0;
}

.spend-onboard__hero::before,
.spend-onboard__hero::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
}

.spend-onboard__hero::before {
    width: 420px;
    height: 420px;
    top: -120px;
    right: -140px;
    background: rgba(255, 255, 255, 0.07);
}

.spend-onboard__hero::after {
    width: 280px;
    height: 280px;
    bottom: -80px;
    left: -60px;
    background: rgba(255, 255, 255, 0.05);
}

.spend-onboard__hero-grid {
    position: absolute;
    inset: 0;
    opacity: 0.04;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.9) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.9) 1px, transparent 1px);
    background-size: 32px 32px;
    pointer-events: none;
}

.spend-onboard__hero-message {
    position: relative;
    z-index: 1;
    margin-bottom: 20px;
    padding: 18px 20px;
    border-radius: var(--so-radius-lg);
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.18);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.spend-onboard__hero-art {
    position: relative;
    z-index: 1;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 130px;
    margin: 0 0 24px;
}

.spend-onboard__hero-art svg {
    width: min(100%, 240px);
    height: auto;
    filter: drop-shadow(0 12px 32px rgba(0, 0, 0, 0.15));
    animation: spend-onboard-float 5s ease-in-out infinite;
}

@keyframes spend-onboard-float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

.spend-onboard__hero-kicker {
    margin: 0 0 10px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.65);
}

.spend-onboard__hero-title {
    margin: 0 0 12px;
    font-size: 26px;
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1.2;
}

.spend-onboard__hero-copy {
    margin: 0;
    font-size: 14px;
    line-height: 1.65;
    color: rgba(255, 255, 255, 0.82);
    max-width: 340px;
}

.spend-onboard__hero-copy strong {
    color: #fff;
    font-weight: 600;
}

.spend-onboard__timeline {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    gap: 0;
    margin-top: auto;
    padding-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.spend-onboard__timeline-item {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 14px 0;
    position: relative;
}

.spend-onboard__timeline-item:not(:last-child)::before {
    content: '';
    position: absolute;
    left: 15px;
    top: 44px;
    bottom: -2px;
    width: 2px;
    background: rgba(255, 255, 255, 0.2);
}

.spend-onboard__timeline-item.is-done:not(:last-child)::before {
    background: rgba(255, 255, 255, 0.45);
}

.spend-onboard__timeline-dot {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    background: rgba(255, 255, 255, 0.12);
    border: 2px solid rgba(255, 255, 255, 0.25);
    color: rgba(255, 255, 255, 0.7);
    transition: all 0.25s ease;
}

.spend-onboard__timeline-item.is-active {
    padding-left: 10px;
    margin-left: -10px;
    padding-right: 10px;
    margin-right: -10px;
    border-radius: var(--so-radius);
    background: rgba(255, 255, 255, 0.08);
}

.spend-onboard__timeline-item.is-active .spend-onboard__timeline-dot {
    background: #fff;
    border-color: #fff;
    color: var(--so-brand);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.15);
    transform: scale(1.06);
}

.spend-onboard__timeline-item.is-done .spend-onboard__timeline-dot {
    background: rgba(255, 255, 255, 0.95);
    border-color: rgba(255, 255, 255, 0.95);
    color: #059669;
}

.spend-onboard__timeline-body {
    padding-top: 4px;
    opacity: 0.55;
    transition: opacity 0.25s ease;
}

.spend-onboard__timeline-item.is-active .spend-onboard__timeline-body,
.spend-onboard__timeline-item.is-done .spend-onboard__timeline-body {
    opacity: 1;
}

.spend-onboard__timeline-title {
    display: block;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 2px;
}

.spend-onboard__timeline-desc {
    display: block;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.72);
    line-height: 1.4;
}

.spend-onboard__hero-foot {
    position: relative;
    z-index: 1;
    margin-top: 20px;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.55);
}

/* —— Stage (interaction area) —— */
.spend-onboard__stage {
    position: relative;
    display: flex;
    flex-direction: column;
    min-height: 0;
    min-width: 0;
    background: linear-gradient(165deg, #f8fafc 0%, #eef4fa 45%, #f4f7fb 100%);
    overflow: hidden;
}

.spend-onboard__stage::before,
.spend-onboard__stage::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
}

.spend-onboard__stage::before {
    width: 480px;
    height: 480px;
    top: -200px;
    right: -120px;
    background: radial-gradient(circle, rgba(3, 105, 161, 0.06) 0%, transparent 70%);
}

.spend-onboard__stage::after {
    width: 360px;
    height: 360px;
    bottom: -140px;
    left: -80px;
    background: radial-gradient(circle, rgba(14, 165, 233, 0.05) 0%, transparent 70%);
}

.spend-onboard__stage > * {
    position: relative;
    z-index: 1;
}

.spend-onboard__progress {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 22px 40px 0;
    flex-shrink: 0;
}

.spend-onboard__progress-seg {
    flex: 1;
    height: 5px;
    border-radius: 999px;
    background: #d8e0ea;
    transition: background 0.35s ease, box-shadow 0.35s ease;
    overflow: hidden;
    position: relative;
}

.spend-onboard__progress-seg.is-done {
    background: var(--so-brand);
}

.spend-onboard__progress-seg.is-active {
    background: #c5d5e3;
    box-shadow: inset 0 0 0 1px rgba(3, 105, 161, 0.15);
}

.spend-onboard__progress-seg.is-active::after {
    content: '';
    position: absolute;
    inset: 0;
    width: 55%;
    background: var(--so-brand);
    border-radius: inherit;
    animation: spend-onboard-progress-pulse 1.8s ease-in-out infinite;
}

@keyframes spend-onboard-progress-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.65; }
}

.spend-onboard__stage-inner {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    padding: 28px 40px 32px;
    animation: spend-onboard-fade-in 0.35s ease;
}

@keyframes spend-onboard-fade-in {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.spend-onboard__shell.is-welcome .spend-onboard__stage-inner {
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 20px 40px 36px;
}

.spend-onboard__shell.is-welcome .spend-onboard__head {
    display: none;
}

.spend-onboard__shell.is-welcome .spend-onboard__foot {
    border: none;
    justify-content: center;
    padding-top: 8px;
}

.spend-onboard__shell.is-welcome .spend-onboard__foot-note,
.spend-onboard__shell.is-welcome #spendOnboardBack {
    display: none !important;
}

.spend-onboard__shell.is-welcome .spend-onboard__btn--primary {
    min-width: 220px;
    padding: 14px 28px;
    font-size: 15px;
    border-radius: 999px;
    box-shadow: 0 8px 28px rgba(0, 95, 156, 0.32);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.spend-onboard__btn-arrow {
    display: inline-block;
    transition: transform 0.2s ease;
}

.spend-onboard__btn--primary:hover:not(:disabled) .spend-onboard__btn-arrow {
    transform: translateX(3px);
}

.spend-onboard__head {
    flex-shrink: 0;
    margin-bottom: 20px;
}

.spend-onboard__eyebrow {
    margin: 0 0 8px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--so-brand);
}

.spend-onboard__title {
    margin: 0 0 10px;
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.03em;
    color: var(--so-text);
    line-height: 1.2;
}

.spend-onboard__hint {
    margin: 0;
    font-size: 15px;
    color: var(--so-text-muted);
    line-height: 1.6;
    max-width: 520px;
}

.spend-onboard__shell.is-welcome .spend-onboard__hint {
    margin-left: auto;
    margin-right: auto;
}

.spend-onboard__shell.is-picker .spend-onboard__stage-inner {
    max-width: 920px;
    margin: 0 auto;
    width: 100%;
}

.spend-onboard__levels {
    display: none;
}

.spend-onboard__crumbs {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    margin-bottom: 16px;
    background: var(--so-surface);
    border: 1px solid var(--so-border);
    border-radius: var(--so-radius);
    font-size: 13px;
    color: var(--so-text-muted);
    flex-shrink: 0;
}

.spend-onboard__crumb strong {
    color: var(--so-text);
    font-weight: 600;
}

.spend-onboard__crumb-sep {
    color: var(--so-text-subtle);
}

.spend-onboard__body {
    flex: 1;
    min-height: 0;
    overflow: auto;
    width: 100%;
}

.spend-onboard__shell.is-welcome .spend-onboard__body {
    flex: 0 1 auto;
    overflow: visible;
    max-width: 800px;
    width: 100%;
}

/* Welcome hero content */
.spend-onboard__welcome-panel {
    width: 100%;
    padding: 36px 40px 32px;
    background: var(--so-surface);
    border: 1px solid var(--so-border);
    border-radius: 20px;
    box-shadow:
        0 1px 2px rgba(15, 23, 42, 0.04),
        0 12px 40px rgba(15, 23, 42, 0.07);
    animation: spend-onboard-panel-in 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes spend-onboard-panel-in {
    from {
        opacity: 0;
        transform: translateY(16px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.spend-onboard__welcome-hero {
    width: 100%;
    max-width: 720px;
    margin: 0 auto;
}

.spend-onboard__welcome-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 20px;
    padding: 8px 14px;
    border-radius: 999px;
    background: var(--so-brand-soft);
    border: 1px solid var(--so-brand-border);
    color: var(--so-brand);
    font-size: 13px;
    font-weight: 600;
}

.spend-onboard__welcome-badge-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--so-brand);
    animation: spend-onboard-pulse 2s ease infinite;
}

@keyframes spend-onboard-pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(0.85); }
}

.spend-onboard__welcome-title {
    margin: 0 0 14px;
    font-size: clamp(28px, 4vw, 38px);
    font-weight: 700;
    letter-spacing: -0.03em;
    color: var(--so-text);
    line-height: 1.15;
}

.spend-onboard__welcome-sub {
    margin: 0 auto 36px;
    font-size: 16px;
    line-height: 1.65;
    color: var(--so-text-muted);
    max-width: 480px;
}

.spend-onboard__welcome-features {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 4px;
    text-align: left;
}

.spend-onboard__welcome-feature {
    position: relative;
    padding: 22px 18px 20px;
    background: linear-gradient(180deg, #fafcff 0%, var(--so-surface) 100%);
    border: 1px solid var(--so-border);
    border-radius: var(--so-radius-lg);
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
    animation: spend-onboard-stagger-in 0.45s ease backwards;
    animation-delay: calc(var(--so-stagger, 0) * 0.1s + 0.15s);
}

@keyframes spend-onboard-stagger-in {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.spend-onboard__welcome-feature:hover {
    border-color: var(--so-brand-border);
    box-shadow: 0 10px 28px rgba(3, 105, 161, 0.1);
    transform: translateY(-3px);
}

.spend-onboard__welcome-feature-step {
    position: absolute;
    top: 14px;
    right: 14px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: var(--so-brand);
    opacity: 0.45;
}

.spend-onboard__welcome-feature-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--so-radius);
    background: var(--so-brand-soft);
    color: var(--so-brand);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 14px;
}

.spend-onboard__welcome-feature-title {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--so-text);
    margin-bottom: 6px;
}

.spend-onboard__welcome-feature-desc {
    display: block;
    font-size: 13px;
    line-height: 1.5;
    color: var(--so-text-muted);
}

.spend-onboard__filter {
    position: relative;
    margin-bottom: 16px;
}

.spend-onboard__filter-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--so-text-subtle);
    pointer-events: none;
    display: flex;
}

.spend-onboard__filter input {
    width: 100%;
    padding: 12px 16px 12px 42px;
    border: 1px solid var(--so-border);
    border-radius: var(--so-radius-lg);
    font-family: var(--so-font);
    font-size: 15px;
    color: var(--so-text);
    background: var(--so-surface);
    box-sizing: border-box;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    box-shadow: var(--so-shadow-sm);
}

.spend-onboard__filter input:focus {
    outline: none;
    border-color: #7dd3fc;
    box-shadow: 0 0 0 3px rgba(3, 105, 161, 0.1);
}

.spend-onboard__choices {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 12px;
}

.spend-onboard__choice {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    text-align: left;
    padding: 16px 18px;
    border: 1px solid var(--so-border);
    border-radius: var(--so-radius-lg);
    background: var(--so-surface);
    cursor: pointer;
    font-family: var(--so-font);
    transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.spend-onboard__choice:hover {
    border-color: var(--so-brand-border);
    background: var(--so-brand-soft);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(3, 105, 161, 0.1);
}

.spend-onboard__choice--indirect {
    border-color: #c4b5fd;
    background: linear-gradient(180deg, #faf5ff 0%, #fff 100%);
}

.spend-onboard__choice--indirect:hover {
    border-color: #a78bfa;
    background: #f5f3ff;
}

.spend-onboard__choice--indirect .spend-onboard__choice-icon {
    background: #ede9fe;
    color: #7c3aed;
}

.spend-onboard__choice-icon {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border-radius: var(--so-radius);
    background: #f3f4f6;
    color: var(--so-brand);
    display: flex;
    align-items: center;
    justify-content: center;
}

.spend-onboard__choice-main {
    flex: 1;
    min-width: 0;
}

.spend-onboard__choice-name {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--so-text);
}

.spend-onboard__choice-meta {
    display: block;
    font-size: 12px;
    color: var(--so-text-muted);
    margin-top: 3px;
}

.spend-onboard__choice-chevron {
    flex-shrink: 0;
    color: var(--so-text-subtle);
}

.spend-onboard__empty {
    text-align: center;
    color: var(--so-text-muted);
    font-size: 14px;
    padding: 40px 8px;
    grid-column: 1 / -1;
}

.spend-onboard__foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding-top: 24px;
    margin-top: auto;
    flex-shrink: 0;
    width: 100%;
}

.spend-onboard__shell.is-picker .spend-onboard__foot .spend-onboard__btn--primary {
    margin-left: auto;
}

.spend-onboard__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: var(--so-radius);
    font-family: var(--so-font);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    padding: 11px 22px;
    white-space: nowrap;
    transition: background 0.15s ease, transform 0.15s ease, opacity 0.15s ease;
}

.spend-onboard__btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.spend-onboard__btn--ghost {
    background: var(--so-surface);
    color: var(--so-text-muted);
    border: 1px solid var(--so-border);
}

.spend-onboard__btn--ghost:hover:not(:disabled) {
    background: #f3f4f6;
    color: var(--so-text);
}

.spend-onboard__btn--primary {
    background: var(--so-brand-dark);
    color: #fff;
}

.spend-onboard__btn--primary:hover:not(:disabled) {
    background: var(--so-brand);
    transform: translateY(-1px);
}

.spend-onboard__foot-note {
    margin: 0;
    font-size: 13px;
    color: var(--so-text-subtle);
    flex: 1;
}

.spend-onboard__skip {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--so-border);
    background: var(--so-surface);
    color: var(--so-text-muted);
    font-family: var(--so-font);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    padding: 8px 16px;
    border-radius: 999px;
    white-space: nowrap;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.spend-onboard__skip:hover:not(:disabled) {
    color: var(--so-text);
    background: #f9fafb;
    border-color: #d1d5db;
}

.spend-onboard__skip:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

@media (max-width: 960px) {
    .spend-onboard__header {
        padding: 12px 16px;
        align-items: flex-start;
    }

    .spend-onboard__header .sidebar-brand-tagline {
        white-space: normal;
        max-width: none;
    }

    .spend-onboard__content {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr;
    }

    .spend-onboard__hero {
        padding: 20px 20px 16px;
    }

    .spend-onboard__hero-art,
    .spend-onboard__hero-foot,
    .spend-onboard__timeline {
        display: none;
    }

    .spend-onboard__hero-message {
        margin-bottom: 0;
    }

    .spend-onboard__hero-title {
        font-size: 20px;
    }

    .spend-onboard__progress {
        padding: 16px 20px 0;
    }

    .spend-onboard__stage-inner {
        padding: 20px;
    }

    .spend-onboard__welcome-features {
        grid-template-columns: 1fr;
    }

    .spend-onboard__welcome-panel {
        padding: 24px 20px 20px;
        border-radius: 16px;
    }

    .spend-onboard__title {
        font-size: 22px;
    }

    .spend-onboard__choices {
        grid-template-columns: 1fr;
    }
}
