.history-summary {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--space-3);
    margin-bottom: var(--space-3);
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    color: var(--text-muted);
}
.history-total strong {
    color: var(--text);
    font-variant-numeric: tabular-nums;
}

.history-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr));
    gap: var(--space-4);
    /* pager clicks scroll back to the top of the results, below the sticky header */
    scroll-margin-top: calc(var(--chrome-h, 0px) + var(--space-3));
    transition: opacity var(--dur-2) var(--ease-out-quint);
}
.history-grid > * { min-width: 0; }
.history-grid > .empty-state { grid-column: 1 / -1; }

/* search in flight: previous results stay in place (no layout collapse), just dimmed */
.history-grid.is-loading {
    opacity: 0.45;
    pointer-events: none;
}
/* only cards injected by a search animate; the server render stays static */
.history-grid.is-swapped .history-card {
    animation: panel-in var(--dur-3) var(--ease-out-quint) backwards;
}

.history-card { padding: var(--space-4); }
.history-card-body {
    display: grid;
    grid-template-columns: 90px minmax(0, 1fr);
    gap: var(--space-3);
    align-items: start;
}
.history-thumb {
    width: 90px;
    height: 70px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--panel-alt);
}
.history-card-content {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    min-width: 0;
}
.history-card-head {
    display: flex;
    gap: var(--space-2);
    align-items: flex-start;
    justify-content: space-between;
}
.history-card-title {
    margin: 0;
    min-width: 0;
    font-family: var(--font-ui);
    font-size: var(--text-base);
    font-weight: 600;
    line-height: 1.3;
    overflow-wrap: break-word;
}
.history-card-title a {
    color: var(--text);
    text-decoration: none;
    transition: color var(--motion-fast);
}
.history-card-title a:hover { color: var(--accent); }
.history-card-badges {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    flex-shrink: 0;
}
.history-ai-link img {
    width: 22px;
    height: 22px;
    display: block;
}
.history-card-summary {
    margin: 0;
    font-size: var(--text-sm);
    color: var(--text-soft);
    line-height: 1.55;
    overflow-wrap: break-word;
}

.history-pagination {
    display: flex;
    justify-content: center;
    gap: var(--space-2);
    margin-top: var(--space-5);
}
