/* Setup flow and the modal shell it shares with Settings, plus timeline menus and notices. */
/* ── Settings and Twitter/X-style setup modal ───────────────────────────── */

.settings-modal-backdrop {
    padding: 16px;
}
.setup-modal-shell {
    width: min(100%, 600px);
    height: min(90vh, 720px);
    flex-direction: column;
}
.setup-modal-header {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 54px;
    padding: 0 56px;
    flex-shrink: 0;
}
.setup-modal-close {
    position: absolute;
    left: 8px;
    top: 9px;
}
.setup-modal-heading {
    color: var(--text-primary);
    font-size: 20px;
    font-weight: 800;
    line-height: 1;
}
.setup-desktop-required { display: none; }
.setup-desktop-required-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    border-radius: var(--radius-full);
    color: var(--accent-color);
    background: color-mix(in srgb, var(--accent-color) 12%, transparent);
}
.setup-desktop-required-icon svg { width: 28px; height: 28px; fill: currentColor; }
.setup-modal-step {
    position: absolute;
    right: 18px;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}
.setup-modal-progress {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 1fr;
    gap: 4px;
    padding: 0 20px;
    height: 3px;
    flex-shrink: 0;
}
.setup-modal-progress span {
    border-radius: var(--radius-full);
    background: var(--border-color);
    transition: background 180ms ease;
}
.setup-modal-progress span.is-complete { background: var(--accent-color); }
.setup-modal-content {
    overflow-x: hidden;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
}
.setup-modal-inner {
    width: 100%;
    max-width: 480px;
    min-height: 100%;
    margin: 0 auto;
    padding: 34px 20px 48px;
}
.setup-modal-title {
    color: var(--text-primary);
    font-size: 30px;
    font-weight: 800;
    line-height: 1.18;
    letter-spacing: -0.025em;
}
.setup-modal-description {
    margin-top: 10px;
    color: var(--text-secondary);
    font-size: 15px;
    line-height: 1.4;
}
.setup-flow-error {
    margin-bottom: 16px;
    color: var(--destructive-color);
    font-size: 14px;
    font-weight: 700;
    line-height: 1.4;
}
.setup-flow-panel { --setup-slide-distance: 28px; }
.setup-flow-panel.slide-back { --setup-slide-distance: -28px; }
.setup-flow-enter {
    transition: opacity 220ms ease, transform 260ms cubic-bezier(0.16, 1, 0.3, 1);
}
.setup-flow-enter-start {
    opacity: 0;
    transform: translateX(var(--setup-slide-distance));
}
.setup-flow-enter-end {
    opacity: 1;
    transform: translateX(0);
}

@media (max-width: 767px) {
    .settings-modal-backdrop { padding: 0; }
    .setup-modal-shell {
        width: 100%;
        height: 100%;
        max-height: none;
    }
    .setup-modal-inner { padding: 28px 20px 36px; }
    .setup-modal-title { font-size: 28px; }
    .setup-modal-step,
    .setup-modal-footer,
    .setup-modal-progress,
    .setup-modal-content { display: none !important; }
    .setup-desktop-required {
        display: flex;
        flex: 1;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        padding: 32px 28px 96px;
        text-align: center;
    }
    .setup-desktop-required h2 {
        margin-top: 22px;
        color: var(--text-primary);
        font-size: 28px;
        font-weight: 800;
        line-height: 1.2;
        letter-spacing: -0.025em;
    }
    .setup-desktop-required p {
        max-width: 330px;
        margin-top: 12px;
        color: var(--text-secondary);
        font-size: 15px;
        line-height: 1.45;
    }
}

/* Setup flow */

/* Vertical stepper layout */
.setup-step {
    display: flex;
    gap: 0;
    padding-bottom: 0;
}

/* Step body */
.setup-step-body {
    flex: 1;
    min-width: 0;
    padding-bottom: 0;
}
.setup-step:last-child .setup-step-body {
    padding-bottom: 0;
}
.setup-step-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 24px;
}

/* Card container */
.setup-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 16px 18px;
    transition: border-color 0.15s ease;
}
.setup-card:hover {
    border-color: color-mix(in srgb, var(--text-secondary) 30%, var(--border-color));
}

.setup-modal-shell .setup-card {
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
}
.setup-modal-shell .setup-card:hover { border-color: transparent; }

/* Refined setup flow: one footer, outlined fields and visible alternatives */
.setup-modal-shell .setup-upload-zone:focus-visible,
.setup-modal-shell .setup-option-row:focus-visible,
.setup-modal-shell .setup-link:focus-visible,
.setup-confirm button:focus-visible {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}
.setup-modal-title:focus { outline: none; }
.setup-modal-footer {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
    padding: 12px 16px;
    border-top: 1px solid var(--border-color);
    background: var(--dialog-bg);
}
.setup-modal-footer .nook-button.is-primary { margin-left: auto; min-width: 96px; }

/* Uncounted page shown after Finish; icons remain neutral in every state. */
.setup-modal-shell.is-complete .setup-modal-inner { max-width: 512px; padding: 24px 16px; }
.setup-completion { color: var(--text-secondary); font-size: 15px; line-height: 20px; }
.setup-completion h2 { margin: 0; color: var(--text-primary); font-size: 20px; line-height: 24px; font-weight: 700; }
.setup-completion h2:focus { outline: none; }
.setup-completion h3 { margin: 0; color: var(--text-primary); font-size: 15px; line-height: 20px; font-weight: 700; }
.setup-completion p { margin: 0; }
.setup-completion .setup-completion-intro { margin-top: 8px; }
.setup-completion-pipeline { display: flex; flex-direction: column; gap: 8px; margin-top: 24px; }
.setup-completion-stage { position: relative; display: grid; grid-template-columns: 56px minmax(0, 1fr); grid-template-rows: minmax(20px, max-content) auto; column-gap: 16px; min-height: 72px; }
.setup-completion-stage-icon { grid-row: 1 / 3; width: 56px; height: 56px; }
.setup-completion-icon { display: block; position: relative; width: 52px; height: 52px; color: var(--text-secondary); }
.setup-completion svg { display: block; fill: currentColor; }
.setup-completion-icon-main { position: absolute; left: 0; top: 0; width: 40px; height: 40px; }
.setup-completion-icon-badge { position: absolute; right: 0; bottom: 0; display: flex; align-items: center; justify-content: center; width: 28px; height: 28px; background: var(--bg-primary); border-radius: 4px; }
.setup-completion-icon-detail { width: 20px; height: 20px; }
.setup-completion-stage-heading { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 4px 12px; align-self: start; }
.setup-completion-status { display: inline-flex; align-items: center; gap: 4px; }
.setup-completion-status svg { width: 16px; height: 16px; }
.setup-completion-stage[data-state="active"] .setup-completion-status,
.setup-completion-stage[data-state="connection"] .setup-completion-status { color: var(--accent-color); }
.setup-completion-stage[data-state="attention"] .setup-completion-status { color: var(--destructive-color); }
.setup-completion-stage > p { margin-top: 4px; align-self: start; }
.setup-completion-connector { position: absolute; top: 60px; left: 20px; width: 16px; height: 16px; }
.setup-completion-stage:last-child .setup-completion-connector { display: none; }
.setup-completion .setup-completion-note { margin-top: 16px; }
.setup-completion-expectations { display: grid; grid-template-columns: 20px minmax(0, 1fr); gap: 12px; margin-top: 24px; padding-top: 24px; border-top: 1px solid var(--border-color); }
.setup-completion-expectations > svg { width: 20px; height: 20px; }
.setup-completion-expectations p { margin-top: 8px; }
.setup-completion-footer .nook-button { font-size: 15px; line-height: 20px; }
@media (max-width: 767px) {
    .setup-modal-shell.is-complete .setup-desktop-required { display: none; }
    .setup-modal-shell.is-complete .setup-modal-content { display: block !important; }
    .setup-modal-shell.is-complete .setup-completion-footer { display: flex !important; }
    .setup-completion-stage { grid-template-columns: 48px minmax(0, 1fr); }
    .setup-completion-stage-icon { width: 48px; }
    .setup-completion-connector { left: 16px; }
}
.setup-link {
    display: block;
    width: fit-content;
    margin-top: 4px;
    color: var(--accent-color);
    font-weight: 700;
}
.setup-link:hover { text-decoration: underline; }
.setup-help {
    margin-top: 12px;
    color: var(--text-secondary);
    font-size: 13px;
    line-height: 18px;
}
.setup-status {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-top: 12px;
    color: var(--text-primary);
    font-size: 15px;
    line-height: 20px;
}
.setup-step-header + .setup-status { margin: 0 0 16px; }
.setup-status > svg { flex-shrink: 0; width: 20px; height: 20px; fill: currentColor; }
.setup-status > svg.is-accent { color: var(--accent-color); }
.setup-status > .setup-btn-spinner { margin: 3px; color: var(--accent-color); }
.setup-status.is-error { color: var(--destructive-color); }
.setup-options {
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
}
.setup-options h3 {
    margin-bottom: 4px;
    color: var(--text-primary);
    font-size: 15px;
    line-height: 20px;
    font-weight: 700;
}
.setup-option-row {
    display: flex;
    align-items: center;
    gap: 12px;
    width: calc(100% + 24px);
    min-height: 64px;
    margin: 0 -12px;
    padding: 12px;
    border: 0;
    border-radius: var(--radius-lg);
    color: var(--text-primary);
    background: transparent;
    font-family: inherit;
    text-align: left;
    cursor: pointer;
}
.setup-option-row:hover:not(:disabled) { background: var(--hover-bg); }
.setup-option-row:disabled { opacity: .5; cursor: default; }
.setup-option-icon { flex-shrink: 0; display: flex; color: var(--text-secondary); }
.setup-option-icon svg { width: 22px; height: 22px; fill: currentColor; }
.setup-option-copy { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.setup-option-copy strong { font-size: 15px; line-height: 20px; font-weight: 400; }
.setup-option-copy span { color: var(--text-secondary); font-size: 13px; line-height: 16px; }
.setup-option-chevron { flex-shrink: 0; width: 18.75px; height: 18.75px; fill: var(--text-secondary); }
.setup-option-check { flex-shrink: 0; width: 20px; height: 20px; fill: var(--accent-color); visibility: hidden; }
.setup-option-row[aria-pressed="true"] { background: var(--bg-secondary); }
.setup-option-row[aria-pressed="true"] .setup-option-check { visibility: visible; }
.setup-archive-summary { margin: 0 0 16px; }
.setup-archive-summary > svg { color: var(--text-secondary); }
.setup-fields { display: flex; flex-direction: column; gap: 16px; }
.setup-password-fields { min-width: 0; margin: 0; padding: 0; border: 0; transition: opacity 120ms ease; }
.setup-password-fields:disabled { opacity: .5; }
.setup-field-error { margin: 6px 12px 0; font-size: 13px; line-height: 16px; }
.setup-field-error { color: var(--destructive-color); }
.setup-field-error.setup-step-error { margin: 12px 0 0; font-size: 15px; line-height: 20px; }

/* Cookie instructions sheet, generated from docs/getting-started.md */
button.setup-link { padding: 0; border: 0; background: none; font-family: inherit; font-size: inherit; cursor: pointer; }
.nook-sheet.setup-help-sheet { width: min(680px, 100%); }
.setup-help-sheet .nook-sheet-header { z-index: 1; }
/* Setup's Schedule and Appearance steps reuse the Settings row and theme-tile styles. */
.setup-sync-switch { border-bottom: 1px solid var(--border-color); }
.setup-sync-section { margin-top: 16px; }
.setup-sync-section h3 { color: var(--text-primary); font-size: 15px; line-height: 20px; font-weight: 700; }
.setup-help-sheet .setup-modal-close { position: static; flex-shrink: 0; }
.setup-help-error { margin: 0 16px 16px; }
.setup-help-tabs { height: 53px; border-bottom: 1px solid var(--border-color); }
.setup-help-tabs .nook-tab:focus-visible { outline: 2px solid var(--accent-color); outline-offset: -2px; }
.setup-help-body { padding: 16px 16px 24px; color: var(--text-primary); font-size: 15px; line-height: 20px; }
.setup-help-caution { display: flex; gap: 10px; margin-bottom: 16px; padding-bottom: 16px; border-bottom: 1px solid var(--border-color); }
.setup-help-caution svg { flex-shrink: 0; width: 20px; height: 20px; fill: var(--destructive-color); }
.setup-help-also { margin-bottom: 12px; color: var(--text-secondary); font-size: 13px; line-height: 16px; }
.setup-help-steps { display: flex; flex-direction: column; gap: 20px; margin: 0; padding: 0; list-style: none; }
.setup-help-steps li { display: flex; gap: 12px; }
.setup-help-block + .setup-help-steps { margin-top: 16px; }
.setup-help-number {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: var(--radius-full);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}
.setup-help-step { flex: 1; min-width: 0; }
.setup-help-step h4 { margin-bottom: 4px; font-size: 15px; line-height: 24px; font-weight: 700; }
.setup-help-block + .setup-help-block { margin-top: 6px; }
.setup-help-block p { color: var(--text-secondary); }
.setup-help-block pre {
    border-radius: 4px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 13px;
}
.setup-help-block pre { width: fit-content; max-width: 100%; margin: 0; padding: 6px 10px; overflow-x: auto; line-height: 18px; white-space: pre; user-select: all; }
.setup-help-source { margin-top: 24px; font-size: 15px; }

/* Developer replay source section on Setup step 1 */
.setup-replay-lede { margin: 0 0 12px; }
.setup-replay-fields { margin-bottom: 4px; }
.setup-replay > .setup-status { margin: 0 0 8px; }
.setup-check-row { display: flex; align-items: center; gap: 16px; min-height: 64px; padding: 12px 0; cursor: pointer; }
.setup-check-row .setup-option-copy strong { font-size: 15px; line-height: 20px; font-weight: 400; color: var(--text-primary); }
.setup-replay-actions { display: flex; gap: 12px; margin-top: 4px; }
.nook-demo-badge.setup-replay-badge { position: absolute; left: 56px; font-size: 13px; line-height: 16px; font-weight: 700; }
.setup-help code { padding: 1px 4px; border-radius: 4px; background: var(--bg-secondary); color: var(--text-primary); font-size: 12px; }

/* Inline spinner for buttons */
.setup-btn-spinner {
    width: 14px;
    height: 14px;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    animation: setup-spin 0.65s linear infinite;
    flex-shrink: 0;
}
.setup-btn-spinner.is-white {
    border-color: rgba(255,255,255,0.35);
    border-top-color: transparent;
}

/* Page-level loading spinner */
.setup-spinner {
    width: 24px;
    height: 24px;
    border: 2.5px solid var(--border-color);
    border-top-color: var(--accent-color);
    border-radius: 50%;
    animation: setup-spin 0.7s linear infinite;
}
@keyframes setup-spin { to { transform: rotate(360deg); } }

/* Upload zone */
.setup-upload-zone {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    width: 100%;
    min-height: 148px;
    padding: 20px 16px;
    border: 1px dashed var(--input-border);
    border-radius: var(--radius-xl);
    color: var(--text-primary);
    background: var(--bg-secondary);
    font-family: inherit;
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease;
}
.setup-upload-zone:hover:not(:disabled),
.setup-upload-zone.is-dragover {
    border-color: var(--accent-color);
    background: color-mix(in srgb, var(--accent-color) 4%, transparent);
}
.setup-upload-zone:disabled { opacity: .5; cursor: default; }
.setup-upload-icon {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 8px;
    border-radius: 50%;
    background: color-mix(in srgb, var(--accent-color) 10%, transparent);
    color: var(--accent-color);
}
.setup-upload-icon svg { width: 22px; height: 22px; fill: currentColor; }
.setup-upload-title { font-size: 15px; line-height: 20px; font-weight: 700; }
.setup-upload-hint { color: var(--text-secondary); font-size: 13px; line-height: 16px; }

/* Archive file row: name, size and state, with upload progress while sending */
.setup-file-row {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 72px;
    padding: 12px 8px 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
}
.setup-file-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-lg);
    background: var(--bg-secondary);
    color: var(--text-secondary);
    flex-shrink: 0;
}
.setup-file-icon svg { width: 22px; height: 22px; fill: currentColor; }
.setup-file-copy { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.setup-file-copy strong {
    overflow: hidden;
    color: var(--text-primary);
    font-size: 15px;
    line-height: 20px;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.setup-file-copy > span { color: var(--text-secondary); font-size: 13px; line-height: 16px; font-variant-numeric: tabular-nums; }
.setup-progress {
    margin-top: 6px;
}

/* Timeline menus */
.feed-pickers { display: flex; align-items: center; gap: 4px; }
.feed-picker { position: relative; }
.feed-picker-trigger {
    display: flex; align-items: center; gap: 6px; min-height: 36px;
    padding: 6px 10px; border: 0; border-radius: var(--radius-full);
    color: var(--text-primary); background: transparent;
    font-size: 15px; font-weight: 700; white-space: nowrap; cursor: pointer;
    transition: background 150ms;
}
.feed-picker-trigger:hover, .feed-picker-trigger[aria-expanded="true"] {
    background: var(--button-hover-bg);
}
.feed-picker-trigger svg { width: 18px; height: 18px; fill: currentColor; }
.feed-picker-menu {
    position: absolute; top: calc(100% + 6px); right: 0; z-index: 60;
    width: 220px; max-width: calc(100vw - 32px); padding: 4px 0;
    max-height: min(380px, 65vh); overflow-y: auto;
}
.feed-picker:first-child .feed-picker-menu { left: 0; right: auto; }
.feed-picker-option {
    justify-content: space-between; gap: 20px; min-height: 48px; padding: 12px 16px;
}
.feed-picker-trigger:focus-visible {
    outline: 2px solid var(--accent-color); outline-offset: -2px;
}

/* Persistent notifications reuse the Settings card and button styles. */
.notice-item { margin: 0; }
.notice-section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}
.notice-time {
    margin-top: 2px;
    color: var(--text-secondary);
    font-size: 13px;
    font-variant-numeric: tabular-nums;
}
