.npm-wrapper {
    display: flex;
    flex-direction: column;
    height: 100%;
    background-color: var(--color-third);
    overflow: hidden;
}

.npm-tool-header {
    display: flex;
    align-items: center;
    padding: 0.25rem var(--spacing-sm);
    gap: var(--spacing-xsm);
    background-color: var(--color-third);
    border-bottom: 1px solid var(--color-border-color);
}

.npm-tool-controls-left,
.npm-tool-controls-right {
    display: flex;
    align-items: center;
    gap: var(--spacing-xsm);
}

.npm-tool-controls-right {
    /* margin-left: auto; */
}

.npm-tool-header button:not(.npm-search-btn) {
    background: transparent;
    border: none;
    color: var(--color-note-text);
    font-size: 0.85rem;
    padding: var(--spacing-xsm);
    cursor: pointer;
    border-radius: var(--border-radius-button);
    transition: background 0.2s;
}

.npm-tool-header button:hover {
    /* background-color: var(--color-fourth); */
    color: var(--color-text);
}

.npm-search-wrapper {
    position: relative;
    flex: 1;
}

.npm-tool-search {
    width: 100%;
    padding: 0.15rem var(--spacing-md);
    padding-left: 0.25rem;
    font-size: var(--font-size-xsm);
    font-family: var(--font-family);
    border: 1px solid transparent;
    border-radius: 4px;
    background-color: transparent;
    color: var(--color-text);
    outline: none;
    padding-right: 1.75rem;
    min-height: 24px;
    transition: all 0.2s ease;
}

.npm-tool-search:focus {
    border-color: var(--color-accent2);
    /* box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.1); */
    color: var(--color-text);
}

.npm-filter-clear {
    position: absolute;
    right: 8px;
    top: calc(50% - 2px);
    transform: translateY(-50%);
    font-size: 1.5rem;
    color: var(--color-note-text);
    cursor: pointer;
    user-select: none;
    opacity: 0.75
}

.npm-filter-clear:hover {
    opacity: 1;
    color: var(--color-text);
}

.npm-search-btn {
    background-color: transparent;
    border: none;
    padding: 0.3rem var(--spacing-sm);
    border-radius: 4px;
    font-size: 0.7rem;
    cursor: pointer;
    color: var(--color-note-text);
    transition: background 0.2s, color 0.2s;
    /* height: 26px; */
    font-family: var(--font-family);
    font-weight: 500;
}

.npm-search-btn:hover {
    background-color: var(--color-accent2);
    color: var(--color-accent2-text) !important;
}

.npm-results {
    height: 100%;
    width: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: var(--scroll-thumb) var(--scroll-background);
    position: relative;
    padding-bottom: 100px;
}


.npm-loading {
    padding: var(--spacing-md);
    color: var(--color-note-text);
}











/* ───────── npm tool content styles ───────── */

.npm-results h2,
.npm-results h3 {
    font-size: var(--font-size-md);
    color: var(--color-text);
    font-weight: 500;
    margin: var(--spacing-md) 0 var(--spacing-sm);
}

.npm-results p {
    color: var(--color-note-text);
    font-size: 0.9rem;
    line-height: 1.4;
    margin: var(--spacing-xsm) 0;
}

#npm-package-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.package-item {
    display: flex;
    gap: var(--spacing-md);
    padding: var(--spacing-md);
    border-bottom: 1px solid var(--color-border-color);
    cursor: pointer;
    align-items: flex-start;
    transition: background 0.2s;
}

.package-item:hover {
    background: var(--color-fourth);
}

.pkg-logo {
    width: 25px;
    height: 25px;
    object-fit: contain;
    border-radius: 4px;
    background: transparent;
    margin-top: 3px;
    margin-right: var(--spacing-xsm);
}

.pkg-author {
    font-size: var(--font-size-xsm);
    color: var(--color-note-text);
}

.pkg-body {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.pkg-head {
    display: flex;
    align-items: center;
    gap: var(--spacing-xsm);
    font-weight: 500;
    color: var(--color-textHilight);
}

.pkg-head strong {
    font-weight: 500;
}

.pkg-ver {
    font-size: var(--font-size-xsm);
    color: var(--color-note-text);
}

.pkg-desc {
    margin: var(--spacing-xsm) 0;
    font-size: 0.9rem;
    color: var(--color-note-text);
}

.detail-meta,
.pkg-meta {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-sm);
    font-size: var(--font-size-xsm);
    color: var(--color-note-text);
    margin-top: var(--spacing-md);
}

.pkg-meta {
    margin-top: var(--spacing-sm);
}

.pkg-tags {
    margin-top: var(--spacing-sm);
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-sm);
}

.pkg-tag {
    background: var(--color-fourth);
    color: var(--color-note-text);
    font-size: var(--font-size-xsm);
    padding: 0.1rem 0.5rem;
    border-radius: 4px;
    text-align: center;
    font-weight: 500;
    border: thin solid var(--color-border-color);
}

.pkg-tag.meta-tag {
    color: var(--color-note-text);
    background: var(--color-fifth);
    border: thin solid transparent;
    font-weight: 600;
}

/* Detail view */

.npm-detail-page {
    padding: var(--spacing-md);
    display: flex;
    flex-direction: column;
    /* gap: var(--spacing-md); */
    max-width: 900px;
    margin: 0 auto;
}

.npm-files-header {
    max-width: 500px;
    width: 100%;
    margin: 0 auto !important;
    padding: var(--spacing-sm);
    font-weight: 500;
}

.npm-detail-page .file-tree {
    max-width: 500px;
    width: 100%;
    margin: 0 auto;
    border: 1px solid var(--color-border-color);
    padding: var(--spacing-md);
    background-color: var(--color-third);
    border-radius: var(--border-radius);
    margin-top: var(--spacing-md);

}

.npm-detail-page .tree-item-header:hover {
    background-color: var(--color-fifth) !important;
}

.tree-item-icon-btn {
    background: none;
    border: none;
    padding: 2px 6px;
    cursor: pointer;
    color: var(--color-note-text);
    font-size: 1rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s ease;
}

.tree-item-icon-btn i {
    font-size: 1rem;
    pointer-events: none;
}

.tree-item-icon-btn:hover {
    color: var(--color-accent2, #4fc1ff);
    text-decoration: none !important;
}

.tree-item-icon-btn:last-child:hover {
    color: var(--color-textHilight);
}
.detail-wrapper{
    display: flex;
    flex-direction: column;
}
.detail-head {
    display: flex;
    align-items: flex-end;
    gap: var(--spacing-sm);
    
    margin-bottom: var(--spacing-sm);

}
.detail-author{
    margin: 0.75rem 0 0.5rem;
}
.cdn-panel {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.cdn-note {
    margin-top: var(--spacing-md) !important;
    /* margin-bottom: var(--spacing-md) !important; */
    color: var(--color-note-text) !important;
}

.detail-head .pkg-logo.big {
    width: 60px;
    height: 60px;
    border-radius: 6px;
    margin-top: var(--spacing-md);
}

.detail-head h2 {
    font-size: var(--font-size-lg);
    margin: 0 0 var(--spacing-xsm);
}

.detail-head .pkg-desc {
    margin: var(--spacing-xsm) 0;
    font-size: 0.9rem;
    color: var(--color-text);
}

.npm-results pre {
    background: var(--color-fourth);
    /* padding: var(--spacing-sm); */
    border-radius: var(--border-radius-button);
    overflow-x: auto;
    font-size: 0.9rem;
    margin: var(--spacing-sm) 0;
    /* border: thin solid var(--color-border-color); */
}

.npm-results pre code {
    font-size: 14px !important;
    /* padding: var(--spacing-sm); */
}

/* Show More button */
.show-more {
    margin: var(--spacing-md) auto;
    display: block;
    background-color: var(--color-fourth);
    border: 1px solid var(--color-border-color);
    padding: var(--spacing-xsm) var(--spacing-md);
    border-radius: var(--border-radius-button);
    font-size: 0.9rem;
    cursor: pointer;
    color: var(--color-note-text);
    transition: background 0.2s, color 0.2s;
}

.show-more:hover {
    background-color: var(--color-fifth);
    color: var(--color-text);
}

#npm-back {
    border: 0;
    background: none;
    color: var(--color-href);
    font-size: 0.9rem;
    cursor: pointer;
    width: 70px;
    padding-left: 0px;
    /* background-color: var(--color-fifth); */
    text-align: left;
}

/* ──────────────────────────────────────────────
   NPM Tool Content Styling (like Assistant style)
   ────────────────────────────────────────────── */

.npm-results h1,
.npm-results h2,
.npm-results h3,
.npm-results h4,
.npm-results h5,
.npm-results h6 {
    font-weight: 500;
    /* line-height: 1.4; */
    color: var(--color-textHilight);
    margin: 0.75rem 0 0.5rem;
}

.npm-results h1 {
    font-size: 1.1rem;
}

.npm-results h2 {
    font-size: 1.0rem;
}

.npm-results h3 {
    font-size: 0.9rem;
}

.npm-results h4,
.npm-results h5,
.npm-results h6 {
    font-size: 0.95rem;
}

.npm-results p {
    margin: 0.25rem 0;
    font-size: 0.9rem;
    color: var(--color-text);
    line-height: 1.5;
}

.npm-results a {
    color: var(--color-href);
    text-decoration: none;
}

.npm-results a:hover {
    text-decoration: underline;
}

.npm-results ul,
.npm-results ol {
    margin: 0.5rem 0 0.5rem 1.5rem;
    padding: 0;
}

.npm-results li:not(.package-item) {
    margin-bottom: 0.3rem;
    list-style-position: outside;
    max-width: 100%;
    word-wrap: break-word;
    font-size: 0.9rem;
}

.npm-results li::marker {
    color: var(--color-note-text);
}

.npm-results ul {
    list-style-type: disc;
}

.npm-results ol {
    list-style-type: decimal;
}

.npm-results blockquote {
    border-left: 4px solid var(--color-border-hover);
    padding: 0.4rem 1rem;
    margin: 1rem 0;
    background-color: var(--color-fifth);
    color: var(--color-note-text);
    font-style: italic;
    border-radius: 0 6px 6px 0;
}

.npm-results pre {
    background: var(--color-fourth);
    padding: var(--spacing-sm);
    border-radius: var(--border-radius-button);
    overflow-x: auto;
    font-size: 0.85rem;
    margin: var(--spacing-sm) 0;
}

.npm-results pre code {
    font-family: SFMono-Regular, Consolas, "Liberation Mono", Menlo, Courier, monospace;
    font-size: 13px;
}

.npm-results p code,
.npm-results li code,
.npm-results blockquote code {
    display: inline-block;
    background-color: var(--color-fifth);
    border-radius: 4px;
    padding: 0.1rem 0.4rem;
    font-size: 0.85em;
    font-family: SFMono-Regular, Consolas, "Liberation Mono", Menlo, Courier, monospace;
    color: var(--color-textHilight);
    max-width: 100%;
    overflow-wrap: break-word;
    white-space: pre-wrap;
}

.npm-results table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
    font-size: 0.9rem;
}

.npm-results th,
.npm-results td {
    border: 1px solid var(--color-border-color);
    padding: 0.5rem 0.75rem;
    text-align: left;
    vertical-align: top;
}

.npm-results th {
    background-color: var(--color-fourth);
    font-weight: 500;
    color: var(--color-textHilight);
}

.npm-results tr:nth-child(even) td {
    background-color: var(--color-third);
}

.npm-results table,
.npm-results thead,
.npm-results tbody,
.npm-results tfoot {
    /* display: block;
    width: 100%;
    max-width: 100%;
    overflow-x: auto; */
}

.npm-results table img {
    max-width: calc(100% - var(--spacing-md) - var(--spacing-md));
    height: auto;
    display: block;
}

.npm-results th,
.npm-results td {
    word-break: break-word;
    overflow-wrap: break-word;
    white-space: normal;
    max-width: 100%;
}

/* .npm-results img {
    max-width: 100%;
    height: auto;
    margin: 0.5rem 0;
    border-radius: 8px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
} */
.esm-badge {
    font-size: 0.75em;
    padding: 2px 6px;
    border-radius: 4px;
  }
  .esm-ok {
    border: thin solid var(--color-border-hover);
    color: var(--color-info);
    background-color: rgba(37, 85, 149, 0.05);
  }
  .esm-warn {
    border: thin solid var(--color-border-hover);
    color: var(--color-error);
    background-color: rgba(220, 53, 69, 0.05);
  }
  