/* ═══════════════════════════════════════════════════════════════════════════════════════════════════════════
   NEEDS YOU - the one list the home's hello band (.needs--card) and the shell bar's bell (.needs--compact)
   render (Components/NeedsYou; portal-look-and-feel.md 2.3). Every class is needs-* and owned by THIS file.
   Colours are tokens only: the --wf-* block (Lane A) with the --theme-* value it derives from as the fallback,
   so the list reads right before and after the token block lands. No red anywhere - a to-do is primary-soft,
   good news is success-soft, and both always carry their words.
   ═══════════════════════════════════════════════════════════════════════════════════════════════════════════ */

.needs {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: var(--wf-space-3, 0.75rem);
    color: var(--theme-text);
}

.needs--card {
    padding: var(--wf-space-4, 1rem);
    background: var(--wf-card, var(--theme-background-raised));
    border: 1px solid var(--wf-line, var(--theme-border-subtle));
    border-radius: var(--wf-radius-lg, var(--theme-radius));
    box-shadow: var(--wf-elev-1, var(--theme-shadow));
}

.needs--compact {
    gap: var(--wf-space-2, 0.5rem);
}

.needs-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--wf-space-3, 0.75rem);
    flex-wrap: wrap;
}

.needs-title {
    margin: 0;
    font-size: var(--wf-text-h3, 0.9375rem);
    font-weight: 650;
    color: var(--theme-text-emphasis);
}

/* ── Tabs: To do / Good news ─────────────────────────────────────────────────────────────────────────────── */

.needs-tabs {
    display: inline-flex;
    gap: 2px;
    padding: 2px;
    background: var(--wf-inset, var(--theme-surface-sunken));
    border-radius: var(--wf-radius-pill, var(--theme-radius-button));
}

.needs-tab {
    display: inline-flex;
    align-items: center;
    gap: var(--wf-space-1, 0.25rem);
    padding: 0.25rem 0.75rem;
    border: 0;
    border-radius: var(--wf-radius-pill, var(--theme-radius-button));
    background: transparent;
    color: var(--theme-text-muted);
    font-size: var(--wf-text-sm, 0.8125rem);
    font-weight: 600;
    cursor: pointer;
    transition: background var(--wf-motion, var(--theme-transition)), color var(--wf-motion, var(--theme-transition));
}

.needs-tab:hover {
    color: var(--theme-text-emphasis);
}

.needs-tab.is-active {
    background: var(--wf-card, var(--theme-background-raised));
    color: var(--theme-text-emphasis);
    box-shadow: var(--wf-elev-1, var(--theme-shadow));
}

.needs-tab:focus-visible,
.needs-action:focus-visible,
.needs-notnow:focus-visible,
.needs-more:focus-visible,
.needs-retry:focus-visible,
.needs-toast-undo:focus-visible {
    outline: 2px solid var(--wf-primary-ink, var(--theme-primary));
    outline-offset: 2px;
}

.needs-count {
    min-width: 1.25rem;
    padding: 0 0.375rem;
    border-radius: var(--wf-radius-pill, var(--theme-radius-button));
    background: var(--wf-neutral-soft, var(--theme-surface-muted));
    color: var(--theme-text-secondary);
    font-size: var(--wf-text-xs, 0.75rem);
    line-height: 1.25rem;
    text-align: center;
}

/* ── Rows ────────────────────────────────────────────────────────────────────────────────────────────────── */

.needs-list {
    display: flex;
    flex-direction: column;
    gap: var(--wf-space-2, 0.5rem);
    margin: 0;
    padding: 0;
    list-style: none;
}

.needs-row {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: var(--wf-space-3, 0.75rem);
    padding: var(--wf-space-2, 0.5rem) 0;
    border-top: 1px solid var(--wf-line, var(--theme-border-subtle));
}

.needs-row:first-child {
    border-top: 0;
}

.needs-tile {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: var(--wf-radius-tile, var(--theme-radius));
    background: var(--wf-primary-soft, var(--theme-primary-muted));
    color: var(--wf-primary-ink, var(--theme-primary));
    font-size: 1rem;
}

.needs-row--good .needs-tile {
    background: var(--wf-success-soft, var(--theme-success-muted));
    color: var(--wf-success-ink, var(--theme-success));
}

.needs-body {
    min-width: 0;
}

.needs-sentence {
    margin: 0;
    color: var(--theme-text);
    font-size: var(--theme-font-size-base);
    line-height: 1.35;
}

.needs-subject {
    font-weight: 650;
    color: var(--theme-text-emphasis);
}

.needs-detail {
    margin: 0.125rem 0 0;
    color: var(--theme-text-muted);
    font-size: var(--wf-text-sm, 0.8125rem);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.needs-actions {
    display: inline-flex;
    align-items: center;
    gap: var(--wf-space-1, 0.25rem);
}

.needs-action {
    white-space: nowrap;
}

.needs-notnow {
    color: var(--theme-text-muted);
    text-decoration: none;
    white-space: nowrap;
}

.needs-notnow:hover {
    color: var(--theme-text-emphasis);
}

.needs-row--compact {
    grid-template-columns: auto minmax(0, 1fr);
    padding: var(--wf-space-1, 0.25rem) 0;
}

.needs-row--compact .needs-tile {
    width: 1.75rem;
    height: 1.75rem;
    font-size: 0.875rem;
}

.needs-row--compact .needs-actions {
    grid-column: 2;
}

.needs-more {
    align-self: flex-start;
    color: var(--wf-primary-ink, var(--theme-primary));
    text-decoration: none;
}

/* ── Empty, loading, failed ──────────────────────────────────────────────────────────────────────────────── */

.needs-empty {
    display: flex;
    align-items: center;
    gap: var(--wf-space-3, 0.75rem);
    padding: var(--wf-space-2, 0.5rem) 0;
}

.needs-empty-tile {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: var(--wf-radius-tile, var(--theme-radius));
    background: var(--wf-success-soft, var(--theme-success-muted));
    color: var(--wf-success-ink, var(--theme-success));
}

.needs-empty-text {
    margin: 0;
    color: var(--theme-text-secondary);
}

.needs-skeleton {
    height: 2.75rem;
    border-radius: var(--wf-radius-md, var(--theme-radius));
    background: var(--wf-inset, var(--theme-surface-sunken));
    animation: needs-shimmer 1.4s ease-in-out infinite;
}

@keyframes needs-shimmer {
    0%, 100% { opacity: 0.55; }
    50% { opacity: 1; }
}

.needs-failed {
    display: flex;
    align-items: center;
    gap: var(--wf-space-2, 0.5rem);
    flex-wrap: wrap;
    padding: var(--wf-space-2, 0.5rem) var(--wf-space-3, 0.75rem);
    border-radius: var(--wf-radius-md, var(--theme-radius));
    background: var(--wf-neutral-soft, var(--theme-surface-muted));
    color: var(--theme-text-secondary);
}

.needs-retry {
    color: var(--wf-primary-ink, var(--theme-primary));
}

/* ── The toast: "Hidden until tomorrow. Undo" ────────────────────────────────────────────────────────────── */

.needs-toast {
    position: absolute;
    left: 50%;
    bottom: calc(-1 * var(--wf-space-3, 0.75rem));
    transform: translate(-50%, 100%);
    z-index: 5;
    display: inline-flex;
    align-items: center;
    gap: var(--wf-space-2, 0.5rem);
    padding: 0.375rem 0.5rem 0.375rem 0.875rem;
    border-radius: var(--wf-radius-pill, var(--theme-radius-button));
    background: var(--wf-card, var(--theme-background-float));
    border: 1px solid var(--wf-line, var(--theme-border-subtle));
    box-shadow: var(--wf-elev-3, var(--theme-shadow-lg));
    color: var(--theme-text-emphasis);
    white-space: nowrap;
    animation: needs-toast-in 0.18s var(--wf-ease, ease-out);
}

.needs-toast-icon {
    color: var(--wf-success-ink, var(--theme-success));
}

.needs-toast-undo {
    color: var(--wf-primary-ink, var(--theme-primary));
    font-weight: 600;
}

@keyframes needs-toast-in {
    from { opacity: 0; transform: translate(-50%, calc(100% + 6px)); }
    to { opacity: 1; transform: translate(-50%, 100%); }
}

@media (prefers-reduced-motion: reduce) {
    .needs-skeleton,
    .needs-toast {
        animation: none;
    }
}

/* Phones and narrow columns: the actions drop under the sentence. */
@container (max-width: 420px) {
    .needs-row {
        grid-template-columns: auto minmax(0, 1fr);
    }

    .needs-row .needs-actions {
        grid-column: 2;
    }
}

@media (max-width: 640px) {
    .needs-row {
        grid-template-columns: auto minmax(0, 1fr);
    }

    .needs-row .needs-actions {
        grid-column: 2;
    }
}
