.navtool-history-nav-btn.is-active {
    background: var(--navtool-theme-bg);
}

.navtool-history-shell {
    position: static;
}

.navtool-history-panel {
    position: fixed;
    top: 92px;
    right: 38px;
    bottom: auto;
    left: auto;
    z-index: 100002;
    width: min(320px, calc(100vw - 32px));
    overflow: hidden;
    border: 1px solid var(--navtool-border);
    border-radius: var(--theme-border-radius);
    background: var(--navtool-bg);
    color: var(--navtool-text);
    box-shadow: 0 5px 20px var(--navtool-shadow);
    font-size: .875rem;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(-6px);
    transition: opacity .18s ease, transform .18s ease, visibility .18s ease;
}

.navtool-history-panel.is-open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0);
}

.navtool-history-head,
.navtool-history-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 10px;
}

.navtool-history-head {
    border-bottom: 1px solid var(--navtool-border);
}

.navtool-history-title {
    margin: 0;
    color: inherit;
    font-size: 1em;
    font-weight: 600;
    line-height: 1.35;
}

.navtool-history-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--navtool-text-muted);
    font-size: 1.125rem;
    line-height: 1;
    cursor: pointer;
}

.navtool-history-close:hover {
    background: var(--navtool-bg-muted-l);
}

.navtool-history-body {
    max-height: min(380px, 54vh);
    padding: 8px;
    overflow: auto;
}

.navtool-history-empty {
    padding: 28px 10px;
    color: var(--navtool-text-muted);
    font-size: .8125rem;
    font-weight: 600;
    text-align: center;
}

.navtool-history-item {
    display: grid;
    grid-template-columns: 30px minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
    padding: 7px 8px;
    border-radius: 8px;
    color: inherit;
    text-decoration: none;
}

.navtool-history-item + .navtool-history-item {
    margin-top: 3px;
}

.navtool-history-item:hover {
    background: var(--navtool-theme-bg);
    color: inherit;
    text-decoration: none;
}

.navtool-history-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    overflow: hidden;
    border-radius: 8px;
    background: var(--navtool-bg-muted-l);
    color: var(--navtool-text-muted);
    font-size: .8125rem;
    font-weight: 700;
}

.navtool-history-icon img {
    width: 20px;
    height: 20px;
    object-fit: contain;
}

.navtool-history-info {
    min-width: 0;
}

.navtool-history-item-title,
.navtool-history-item-host {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.navtool-history-item-title {
    color: inherit;
    font-size: .875rem;
    font-weight: 600;
    line-height: 1.35;
}

.navtool-history-item-host {
    margin-top: 2px;
    color: var(--navtool-text-muted);
    font-size: .75rem;
    line-height: 1.25;
}

.navtool-history-count {
    padding: 2px 6px;
    border-radius: 999px;
    background: var(--navtool-theme-bg);
    color: var(--navtool-theme);
    font-size: .75rem;
    font-weight: 700;
    line-height: 1.35;
    white-space: nowrap;
}

.navtool-history-foot {
    border-top: 1px solid var(--navtool-border);
}

.navtool-history-clear {
    width: 100%;
    padding: 7px 10px;
    border: 0;
    border-radius: 9px;
    background: var(--navtool-bg-muted-l);
    color: var(--navtool-text-muted);
    font-size: .8125rem;
    font-weight: 700;
    cursor: pointer;
}

.navtool-history-clear:hover {
    background: var(--navtool-theme-bg);
    color: var(--navtool-theme);
}

.navtool-history-nav-btn img {
    width: 22px;
    height: 22px;
    object-fit: contain;
}

@media (max-width: 768px) {
    .navtool-history-panel {
        width: auto;
    }
}
