.sidebar-history {
    display: grid;
    gap: .45rem;
    min-height: 0;
}

.sidebar-history .sidebar-label {
    margin-top: .9rem;
}

.chat-history-list {
    display: grid;
    gap: .2rem;
    max-height: min(32vh, 280px);
    overflow-y: auto;
    padding-right: .15rem;
    scrollbar-width: thin;
}

.chat-history-empty {
    margin: .1rem .3rem 0;
    color: var(--text-3);
    font-size: .76rem;
    line-height: 1.45;
}

.chat-history-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 28px;
    align-items: center;
    gap: .2rem;
    border-radius: 10px;
}

.chat-history-item:hover,
.chat-history-item.is-active {
    background: var(--surface-hover);
}

.chat-history-item.is-active .chat-history-title {
    color: var(--text);
    font-weight: 600;
}

.chat-history-open,
.chat-history-delete {
    border: 0;
    background: transparent;
    color: var(--text-2);
    cursor: pointer;
    font: inherit;
}

.chat-history-open {
    min-width: 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: .55rem;
    padding: .58rem .45rem .58rem .7rem;
    text-align: left;
}

.chat-history-title {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: .8rem;
    font-weight: 500;
}

.chat-history-time {
    color: var(--text-3);
    font-size: .66rem;
    font-variant-numeric: tabular-nums;
}

.chat-history-delete {
    width: 28px;
    height: 28px;
    display: grid;
    place-items: center;
    border-radius: 8px;
    opacity: 0;
    color: var(--text-3);
    font-size: 1.05rem;
    line-height: 1;
}

.chat-history-item:hover .chat-history-delete,
.chat-history-delete:focus-visible,
.chat-history-item.is-active .chat-history-delete {
    opacity: 1;
}

.chat-history-delete:hover {
    background: var(--surface-3);
    color: var(--text);
}

.chat-history-open:focus-visible,
.chat-history-delete:focus-visible {
    outline: 2px solid var(--brand);
    outline-offset: 2px;
}

@media (max-width: 900px) {
    .chat-history-list {
        max-height: 34vh;
    }
}
