/* ── While you were away (web/digest.js) ─────────────────────────────────
   A card in the top-right corner, under the bar: out of the composer's way at
   the bottom, and not over the rail on the left where the same sessions are
   listed. Not modal — nothing behind it is dimmed or blocked — so it can stay
   up while you work through it. Tokens only; base.css and colours.css own
   them. */

.digest {
    position: fixed;
    top: calc(52px + var(--sp-4));   /* the bar's 52px, then a step */
    right: var(--sp-7);
    /* Over the panes; under dialogs, menus and toasts. A card that is not modal
       has no claim to sit on top of a dialog's scrim. */
    z-index: var(--z-card);
    width: min(380px, calc(100vw - 2 * var(--sp-7)));
    pointer-events: none;     /* the empty container must not eat clicks */
}

.digest-card {
    pointer-events: auto;
    display: flex;
    flex-direction: column;
    max-height: min(70vh, 640px);
    background: var(--s2);
    color: var(--text);
    border: 1px solid var(--outline-soft);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-pop);
    animation: digest-in var(--t-med) var(--ease);
}

.digest-head {
    display: flex;
    align-items: center;
    gap: var(--sp-4);
    padding: var(--sp-6) var(--sp-5) var(--sp-4) var(--sp-7);
}
.digest-title {
    flex: 1;
    min-width: 0;
    margin: 0;
    font: 500 var(--fs-base)/var(--lh-snug) var(--sans);
}
.digest-away { color: var(--text-3); font-weight: 400; }

.digest-close {
    flex: none;
    display: grid;
    place-items: center;
    width: var(--ctl-sm); height: var(--ctl-sm);
    border-radius: 50%;
    font-size: var(--fs-sm);
    color: var(--text-3);
    transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.digest-close:hover { background: var(--s4); color: var(--text); }

.digest-body {
    overflow-y: auto;
    padding: 0 var(--sp-4) var(--sp-5);
}

.digest-group + .digest-group { margin-top: var(--sp-3); }

.digest-group-head {
    display: flex;
    align-items: center;
    gap: var(--sp-4);
    margin: 0;
    padding: var(--sp-3) var(--sp-4) var(--sp-2);
    font: 500 var(--fs-xs)/var(--lh-snug) var(--sans);
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-3);
}
.digest-count {
    min-width: 18px;
    padding: 0 var(--sp-3);
    border-radius: var(--pill);
    background: var(--s4);
    color: var(--text-2);
    font-size: var(--fs-xs);
    text-align: center;
    letter-spacing: 0;
}
.digest-group[data-tone="ask"] .digest-group-head { color: var(--yellow); }
.digest-group[data-tone="ask"] .digest-count { background: var(--yellow); color: var(--on-yellow); }
.digest-group[data-tone="bad"] .digest-group-head { color: var(--red); }

.digest-rows { margin: 0; padding: 0; list-style: none; }

.digest-row {
    display: grid;
    grid-template-columns: 1fr auto;
    column-gap: var(--sp-5);
    width: 100%;
    padding: var(--sp-3) var(--sp-4);
    border-radius: var(--r-sm);
    text-align: left;
    transition: background var(--t-fast) var(--ease);
}
.digest-row:hover { background: var(--s3); }
.digest-row:focus-visible { outline: var(--focus-w) solid var(--focus-colour); outline-offset: calc(-1 * var(--focus-w)); }
.digest-group[data-tone="ask"] .digest-row { background: var(--s3); margin-bottom: var(--sp-1); }
.digest-group[data-tone="ask"] .digest-row:hover { background: var(--s4); }

.digest-row-title {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    font-size: var(--fs-md);
    color: var(--text);
}
.digest-row-at {
    font-size: var(--fs-sm);
    color: var(--text-4);
    white-space: nowrap;
}
.digest-row-sub {
    grid-column: 1 / -1;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    font-size: var(--fs-sm);
    line-height: var(--lh-base);
    color: var(--text-3);
}

.digest-more {
    margin: var(--sp-1) 0 0 var(--sp-4);
    padding: var(--sp-1) var(--sp-3);
    border-radius: var(--r-xs);
    font-size: var(--fs-sm);
    color: var(--blue);
}
.digest-more:hover { background: var(--s3); }
.digest-more-note { margin: var(--sp-1) var(--sp-4) 0; font-size: var(--fs-sm); color: var(--text-3); }

.digest-empty { margin: var(--sp-2) var(--sp-4) var(--sp-3); font-size: var(--fs-md); color: var(--text-3); }

@keyframes digest-in {
    from { opacity: 0; transform: translateY(calc(-1 * var(--sp-3))); }
    to { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
    .digest-card { animation: none; }
}
