/* ============================================
   First-run setup, and the guided walkthroughs.

   Two surfaces that only ever appear once, so they get their own file rather
   than another thousand lines on the end of pages.css.
   ============================================ */

/* The wizard owns the window. No sidebar, no inbox rail, nothing to wander
   into before there is anything to wander into. */
body.onboarding-active #sidebar,
body.onboarding-active .rail-toggle,
body.onboarding-active .activity-rail {
    display: none !important;
}

body.onboarding-active .main-content {
    margin-left: 0;
    padding: 0;
}

.ob {
    min-height: 100vh;
    background: var(--bg-secondary);
}

.ob-inner {
    width: min(100%, 760px);
    margin: 0 auto;
    padding: 28px 24px 64px;
}

.ob-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 30px;
}

.ob-logo { height: 30px; }

.ob-skip {
    background: none;
    border: none;
    color: var(--text-muted);
    font: inherit;
    font-size: 13px;
    cursor: pointer;
    padding: 6px 8px;
    border-radius: var(--radius-sm);
}

.ob-skip:hover { color: var(--text-secondary); }

/* The step rail. Horizontal, because four steps read as a short journey and
   a vertical list of four reads as a form. */
.ob-rail {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin: 0 0 32px;
    padding: 0;
    list-style: none;
    counter-reset: none;
}

.ob-rail-step {
    display: grid;
    gap: 7px;
    justify-items: center;
    text-align: center;
    position: relative;
}

/* The connecting line sits behind the marks and stops short of them. */
.ob-rail-step::before {
    content: '';
    position: absolute;
    top: 13px;
    left: calc(-50% + 20px);
    width: calc(100% - 40px);
    height: 1px;
    background: var(--border-color);
}

.ob-rail-step:first-child::before { display: none; }

.ob-rail-mark {
    display: grid;
    place-items: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 700;
    position: relative;
    z-index: 1;
    transition: background var(--fast) var(--ease), color var(--fast) var(--ease);
}

.ob-rail-mark svg { width: 13px; height: 13px; }

.ob-rail-step.here .ob-rail-mark {
    background: var(--green-accent);
    border-color: var(--green-bright);
    color: var(--on-accent);
}

.ob-rail-step.done .ob-rail-mark {
    background: var(--green-deep);
    border-color: var(--green-accent);
    color: var(--green-bright);
}

.ob-rail-label {
    font-size: 11px;
    color: var(--text-muted);
    line-height: 1.3;
}

.ob-rail-step.here .ob-rail-label { color: var(--text-primary); }

.ob-stage {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--elev-2);
    padding: 30px 30px 26px;
}

.ob-step h1 {
    margin: 0 0 8px;
    font-size: 23px;
    letter-spacing: -0.01em;
}

.ob-step h2 {
    margin: 0 0 8px;
    font-size: 14px;
}

.ob-lede {
    margin: 0 0 24px;
    font-size: 14px;
    line-height: 1.65;
    color: var(--text-secondary);
}

.ob-form { display: grid; gap: 16px; }

.ob-form .form-row {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
}

.ob-form .form-row .form-group { flex: 1 1 220px; margin: 0; }
.ob-form .form-group { margin: 0; }

.ob-hint {
    display: block;
    margin-top: 6px;
    font-size: 11px;
    line-height: 1.5;
    color: var(--text-muted);
}

.ob-note {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 20px;
    padding: 13px 15px;
    background: var(--green-deep);
    border: 1px solid var(--green-accent);
    border-radius: var(--radius-md);
    font-size: 13px;
}

.ob-test {
    padding: 11px 14px;
    border-radius: var(--radius-md);
    font-size: 12px;
    font-family: var(--font-mono, ui-monospace, monospace);
}

.ob-test.ok {
    background: rgba(127, 160, 150, 0.14);
    border: 1px solid var(--green-accent);
    color: var(--green-bright);
}

.ob-test.bad {
    background: rgba(220, 90, 90, 0.12);
    border: 1px solid rgba(220, 90, 90, 0.5);
    color: #F3B0B0;
}

.ob-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 8px;
    padding-top: 18px;
    border-top: 1px solid var(--border-color);
}

.ob-actions .btn-outline:first-child { margin-right: auto; }

/* Step 2: the Q&A rows. */
.ob-qa-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.ob-qa-head label { margin: 0; }

#ob-qa-list { display: grid; gap: 12px; }

.ob-qa {
    display: grid;
    gap: 7px;
    padding: 13px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
}

/* Step 3: what it will not do. Stated plainly, because switching an AI loose
   on a real mailbox is the moment people get nervous, and the guardrails are
   the actual answer to that. */
.ob-guards {
    margin-bottom: 22px;
    padding: 16px 18px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
}

.ob-guards ul {
    margin: 0;
    padding-left: 18px;
    display: grid;
    gap: 5px;
}

.ob-guards li {
    font-size: 13px;
    line-height: 1.55;
    color: var(--text-secondary);
}

.ob-guards .ob-hint { margin-top: 10px; }

.ob-choice {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-top: 8px;
    padding: 12px 14px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 13px;
    line-height: 1.55;
    cursor: pointer;
    transition: border-color var(--fast) var(--ease);
}

.ob-choice:hover { border-color: var(--green-accent); }
.ob-choice input { margin-top: 3px; flex-shrink: 0; }
.ob-choice strong { color: var(--text-primary); }
.ob-choice span { color: var(--text-secondary); }

.ob-own { margin-top: 14px; }

/* Step 4: the address, and the wait. */
.ob-address {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 15px 18px;
    background: var(--bg-tertiary);
    border: 1px dashed var(--green-accent);
    border-radius: var(--radius-md);
}

.ob-address .mono {
    font-family: var(--font-mono, ui-monospace, monospace);
    font-size: 15px;
    color: var(--green-bright);
    overflow: hidden;
    text-overflow: ellipsis;
}

.ob-watch { margin: 22px 0; }

.ob-watch-idle { display: grid; gap: 12px; justify-items: start; }
.ob-watch-idle p { margin: 0; font-size: 13px; line-height: 1.6; }
.ob-watch-bad p:first-child { color: #F3B0B0; }

.ob-watch-live {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 18px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
}

.ob-watch-live p { margin: 4px 0 0; }

.ob-pulse { display: flex; gap: 5px; flex-shrink: 0; }

.ob-pulse span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--green-accent);
    animation: ob-pulse 1.3s var(--ease) infinite;
}

.ob-pulse span:nth-child(2) { animation-delay: 0.18s; }
.ob-pulse span:nth-child(3) { animation-delay: 0.36s; }

@keyframes ob-pulse {
    0%, 65%, 100% { opacity: 0.22; transform: scale(0.8); }
    32% { opacity: 1; transform: scale(1); }
}

/* The payoff. This is the only moment in the product worth a flourish. */
.ob-watch-won {
    display: grid;
    gap: 12px;
    justify-items: center;
    text-align: center;
    padding: 26px 22px;
    background: var(--green-deep);
    border: 1px solid var(--green-accent);
    border-radius: var(--radius-lg);
}

.ob-watch-won h2 { margin: 0; font-size: 20px; color: var(--text-primary); }

.ob-tick {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: var(--green-accent);
    color: var(--on-accent);
    animation: ob-tick 0.4s var(--ease) both;
}

.ob-tick svg { width: 21px; height: 21px; }

@keyframes ob-tick {
    from { transform: scale(0.4); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.ob-reply {
    width: 100%;
    max-height: 220px;
    overflow-y: auto;
    padding: 15px 17px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 13px;
    line-height: 1.7;
    color: var(--text-secondary);
    text-align: left;
}

/* The dashboard's "you never finished" banner. */
.ob-resume {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 14px;
    margin-bottom: 20px;
    padding: 14px 18px;
    background: var(--green-deep);
    border: 1px solid var(--green-accent);
    border-radius: var(--radius-md);
}

.ob-resume-text { display: grid; gap: 3px; }
.ob-resume-text strong { font-size: 14px; }
.ob-resume-text span { font-size: 12px; color: var(--text-secondary); }
.ob-resume-actions { display: flex; align-items: center; gap: 8px; }

.sidebar-footer-actions { display: flex; gap: 8px; }
.sidebar-footer-actions .btn { flex: 1; }

@media (max-width: 640px) {
    .ob-rail-label { display: none; }
    .ob-stage { padding: 22px 18px 20px; }
    .ob-actions { flex-wrap: wrap; }
}

/* ============================================
   The walkthrough: spotlight and card.
   ============================================ */
.tour-root {
    position: fixed;
    inset: 0;
    z-index: 9000;
    pointer-events: none;
}

/* The veil is a separate layer from the spotlight so clicking it can dismiss
   without the spotlight's giant box-shadow swallowing the event. */
.tour-veil {
    position: absolute;
    inset: 0;
    background: rgba(3, 6, 5, 0.55);
    pointer-events: auto;
    animation: tour-fade 0.18s var(--ease) both;
}

/* One element, one enormous shadow: the hole IS the element, and the shadow
   is everything else. Cheaper and far more reliable than four positioned
   panels around a rect, which drift by a pixel at fractional zoom. */
.tour-spot {
    position: absolute;
    border-radius: 10px;
    box-shadow: 0 0 0 9999px rgba(3, 6, 5, 0.55),
                0 0 0 2px var(--green-accent);
    pointer-events: none;
    transition: left 0.22s var(--ease), top 0.22s var(--ease),
                width 0.22s var(--ease), height 0.22s var(--ease);
}

/* With a spotlight up, the veil underneath would double the dim. */
.tour-spot:not([hidden]) ~ .tour-veil,
.tour-root:has(.tour-spot:not([hidden])) .tour-veil {
    background: transparent;
}

.tour-pop {
    position: absolute;
    width: min(330px, calc(100vw - 32px));
    padding: 15px 17px 14px;
    background: var(--bg-primary);
    border: 1px solid var(--green-accent);
    border-radius: var(--radius-lg);
    box-shadow: var(--elev-3);
    pointer-events: auto;
    animation: tour-in 0.2s var(--ease) both;
}

@keyframes tour-fade { from { opacity: 0; } to { opacity: 1; } }

@keyframes tour-in {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: none; }
}

.tour-pop-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 7px;
}

.tour-count {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--green-bright);
}

.tour-skip {
    background: none;
    border: none;
    padding: 2px 4px;
    color: var(--text-muted);
    font: inherit;
    font-size: 11px;
    cursor: pointer;
}

.tour-skip:hover { color: var(--text-secondary); }

.tour-title { margin: 0 0 5px; font-size: 15px; }

.tour-body {
    margin: 0 0 14px;
    font-size: 13px;
    line-height: 1.6;
    color: var(--text-secondary);
}

.tour-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.tour-dots { display: flex; gap: 4px; }

.tour-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--border-color);
}

.tour-dot.on { background: var(--green-accent); }

.tour-nav { display: flex; gap: 7px; }

@media (prefers-reduced-motion: reduce) {
    .tour-spot { transition: none; }
    .tour-pop, .tour-veil { animation: none; }
    .ob-pulse span, .ob-tick { animation: none; }
}
