.mac-head-history-popover {
    background: var(--tpl-bg-base, #fff);
    border: 1px solid var(--tpl-border-soft, #e5e7eb);
    border-radius: 6px;
    box-shadow: 0 16px 42px rgba(15, 23, 42, .16);
    box-sizing: border-box;
    display: none;
    overflow: hidden;
    position: fixed;
    width: min(360px, calc(100vw - 24px));
    z-index: 2147482000;
}

.mac-head-history-popover.is-open {
    display: block;
}

.mac-head-history-popover__head {
    align-items: center;
    border-bottom: 1px solid var(--tpl-border-soft, #eee);
    display: flex;
    justify-content: space-between;
    min-height: 44px;
    padding: 0 14px;
}

.mac-head-history-popover__title {
    color: var(--tpl-text-strong, #111827);
    font-size: 14px;
    font-weight: 700;
    margin: 0;
}

.mac-head-history-popover__clear {
    background: transparent;
    border: 0;
    color: var(--tpl-text-muted, #6b7280);
    cursor: pointer;
    font-size: 12px;
    padding: 7px 4px;
}

.mac-head-history-popover__clear:disabled {
    cursor: default;
    opacity: .45;
}

.mac-head-history-popover__list {
    list-style: none;
    margin: 0;
    max-height: min(420px, calc(100vh - 100px));
    overflow-x: hidden;
    overflow-y: auto;
    padding: 6px;
}

.mac-head-history-popover__item {
    margin: 0;
    padding: 0;
}

.mac-head-history-popover__link {
    align-items: center;
    border-radius: 5px;
    color: var(--tpl-text, #333);
    display: grid;
    gap: 10px;
    grid-template-columns: 42px minmax(0, 1fr);
    min-height: 62px;
    padding: 7px 8px;
    text-decoration: none;
}

.mac-head-history-popover__link:hover,
.mac-head-history-popover__link:focus-visible {
    background: rgba(64, 204, 146, .09);
    color: var(--tpl-accent, #40cc92);
    outline: 0;
}

.mac-head-history-popover__thumb {
    background: var(--tpl-bg-muted, #f3f4f6);
    border-radius: 4px;
    display: block;
    height: 56px;
    object-fit: cover;
    width: 42px;
}

.mac-head-history-popover__thumb--empty {
    align-items: center;
    color: var(--tpl-text-subtle, #9ca3af);
    display: flex;
    font-size: 18px;
    justify-content: center;
}

.mac-head-history-popover__meta {
    min-width: 0;
}

.mac-head-history-popover__name {
    color: inherit;
    display: block;
    font-size: 13px;
    font-weight: 600;
    line-height: 19px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mac-head-history-popover__part {
    color: var(--tpl-text-muted, #6b7280);
    display: block;
    font-size: 12px;
    line-height: 18px;
    margin-top: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mac-head-history-popover__empty {
    color: var(--tpl-text-muted, #6b7280);
    font-size: 13px;
    margin: 0;
    padding: 28px 16px;
    text-align: center;
}

body.bstem .mac-head-history-popover {
    background: var(--tpl-bg-base, #16151b);
    border-color: rgba(255, 255, 255, .1);
    box-shadow: 0 18px 48px rgba(0, 0, 0, .58);
}

body.bstem .mac-head-history-popover__head {
    border-bottom-color: rgba(255, 255, 255, .08);
}

body.bstem .mac-head-history-popover__thumb {
    background: rgba(255, 255, 255, .07);
}

body.bstem .mac-head-history-popover__link:hover,
body.bstem .mac-head-history-popover__link:focus-visible {
    background: rgba(64, 204, 146, .12);
}

@media screen and (max-width: 820px) {
    .mac-head-history-popover {
        width: min(340px, calc(100vw - 16px));
    }

    .mac-head-history-popover__list {
        max-height: min(60vh, 380px);
    }
}
