/* source: assets/archive.css lines 772-1697 */
.category-group {
    margin-bottom: 10px;
    border-radius: 18px;
    border: 1px solid transparent;
    overflow: hidden;
    transition: background 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease, transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}

.category-group.drag-target {
    background: rgba(211, 99, 58, 0.08);
    box-shadow: inset 0 0 0 1px rgba(211, 99, 58, 0.34);
    outline: 1px dashed rgba(211, 99, 58, 0.46);
    outline-offset: -1px;
}

.category-body.drag-target-body {
    background: linear-gradient(180deg, rgba(211, 99, 58, 0.08), rgba(211, 99, 58, 0.03));
    box-shadow: inset 0 0 0 1px rgba(211, 99, 58, 0.24);
    border-radius: 0 0 14px 14px;
}

.category-group.category-drag-before,
.category-group.category-drag-after,
.bookmark-item.bookmark-drop-before,
.bookmark-item.bookmark-drop-after {
    position: relative;
}

.category-group.category-drag-before::before,
.category-group.category-drag-after::after,
.bookmark-item.bookmark-drop-before::before,
.bookmark-item.bookmark-drop-after::after {
    content: "";
    position: absolute;
    left: 10px;
    right: 10px;
    height: 3px;
    border-radius: 999px;
    background: linear-gradient(90deg, rgba(211, 99, 58, 0.2), rgba(211, 99, 58, 0.95), rgba(211, 99, 58, 0.2));
    box-shadow: 0 0 0 1px rgba(211, 99, 58, 0.18), 0 0 10px rgba(211, 99, 58, 0.18);
    pointer-events: none;
}

.category-group.category-drag-before::before,
.bookmark-item.bookmark-drop-before::before {
    top: -2px;
}

.category-group.category-drag-after::after,
.bookmark-item.bookmark-drop-after::after {
    bottom: -2px;
}

.category-group.category-dragging {
    position: relative;
    z-index: 6;
    opacity: 0.94;
    transform: scale(1.008) rotate(-0.2deg);
    box-shadow: 0 22px 40px rgba(0, 0, 0, 0.2);
}

.category-group.category-dragging .category-header {
    cursor: grabbing;
    touch-action: none;
}

.category-group.drag-pickup .category-header {
    animation: drag-pickup-jiggle 180ms ease;
}

.category-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    cursor: pointer;
    -webkit-user-select: none;
    user-select: none;
    font-size: 0.88em;
    color: var(--text-muted);
    position: relative;
    border-radius: 16px;
    background: var(--category-header-bg);
    transition: background 0.25s ease, color 0.25s ease;
    touch-action: pan-y;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    overflow: hidden;
}

.category-header:hover,
.category-header:focus-within {
    background: var(--category-header-hover);
}

.cat-collapse-arrow {
    font-size: 1.04em;
    font-weight: 700;
    transition: transform 0.2s;
    display: inline-block;
    width: 18px;
    min-width: 18px;
    text-align: center;
    line-height: 1;
}

.cat-collapse-arrow.collapsed {
    transform: rotate(-90deg);
}

.cat-title {
    display: flex;
    align-items: center;
    min-width: 0;
    flex: 1;
}

.cat-name {
    font-weight: 600;
    font-size: 1em;
    letter-spacing: 0.3px;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}


/* Custom Select Dropdown & Buttons (Migrated from Inline) */
.custom-select-wrapper {
    flex: 1;
    position: relative;
    user-select: none;
}
.custom-new-cat-btn {
    width: 50% !important;
    padding: 8px 14px !important;
    white-space: nowrap !important;
    font-size: 0.9em !important;
}

.custom-select-display {
    padding: 9px 12px;
    background: var(--input-bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    font-size: 0.9em;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: border-radius 0.15s, border-color 0.2s;
}

.custom-select-display.is-open {
    border-radius: 6px 6px 0 0 !important;
    border-color: var(--accent) !important;
}

.custom-select-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.custom-select-arrow {
    font-size: 0.75em;
    opacity: 0.5;
    margin-left: 6px;
    transition: transform 0.2s;
}
.custom-select-arrow.is-open {
    transform: rotate(180deg);
}

.custom-select-dropdown {
    position: absolute;
    top: calc(100% - 1px);
    left: 0;
    right: 0;
    background: var(--dropdown-bg);
    border: 1px solid var(--accent);
    border-top: 1px solid var(--border);
    border-radius: 0 0 6px 6px;
    max-height: 220px;
    overflow-y: auto;
    z-index: 9999;
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.25);
}

.custom-select-opt {
    padding: 10px 12px;
    cursor: pointer;
    border-bottom: 1px solid rgb(255 255 255 / 1%);
    transition: background 0.2s;
    font-size: 0.9em;
}

.custom-select-opt:hover {
    background: var(--item-hover) !important;
}


.cat-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-left: auto;
    min-width: 24px;
    padding: 2px 8px;
    border-radius: 999px;
    border: 1px solid var(--category-count-border);
    background: var(--category-count-bg);
    font-size: 0.74em;
    color: var(--text-muted);
    opacity: 0.86;
    text-align: center;
    flex-shrink: 0;
    overflow: hidden;
    transition: opacity 0.2s ease, transform 0.2s ease, max-width 0.2s ease, padding 0.2s ease, margin 0.2s ease, border-color 0.2s ease;
}

.category-header:is(:hover, :focus-within) .cat-count {
    opacity: 0;
    width: 0;
    min-width: 0;
    max-width: 0;
    padding-left: 0;
    padding-right: 0;
    margin-left: 0;
    transform: translateX(8px);
    border-color: transparent;
}

.cat-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    position: absolute;
    top: 50%;
    right: 8px;
    opacity: 0;
    pointer-events: none;
    transform: translate(14px, -50%);
    filter: blur(1px);
    transition: opacity 0.24s cubic-bezier(0.22, 1, 0.36, 1), transform 0.24s cubic-bezier(0.22, 1, 0.36, 1), filter 0.24s ease;
}

.category-header:is(:hover, :focus-within) .cat-actions {
    opacity: 1;
    pointer-events: auto;
    transform: translate(0, -50%);
    filter: blur(0);
}

.cat-action-btn,
.bookmark-actions .action-btn {
    width: 22px;
    height: 22px;
    border: none;
    border-radius: 0;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: transform 0.18s ease, color 0.18s ease, opacity 0.18s ease;
}

.cat-action-btn svg,
.bookmark-actions .action-btn svg {
    width: 15px;
    height: 15px;
    display: block;
}

.cat-action-btn:hover,
.cat-action-btn:focus-visible,
.bookmark-actions .action-btn:hover,
.bookmark-actions .action-btn:focus-visible {
    color: var(--accent);
    transform: translateY(-1px);
    outline: none;
}

.cat-color-reset-btn {
    display: none;
    min-width: 0;
    height: 22px;
    padding: 0;
    border-radius: 0;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.72em;
    letter-spacing: 0.2px;
    opacity: 0;
    transition: opacity 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.cat-color-reset-btn.is-visible {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    opacity: 0.88;
}

.cat-color-reset-btn:disabled {
    display: none;
    opacity: 0;
    pointer-events: none;
}

.cat-color-reset-btn:hover:not(:disabled),
.cat-color-reset-btn:focus-visible {
    color: var(--accent);
    transform: translateY(-1px);
    outline: none;
}

.cat-delete-btn:hover,
.cat-delete-btn:focus-visible,
.bookmark-actions .action-btn.danger:hover,
.bookmark-actions .action-btn.danger:focus-visible {
    color: #d9381e;
}

.cat-rename-input {
    flex: 1;
    background: var(--input-bg);
    border: 1px solid var(--accent);
    border-radius: 4px;
    color: var(--text);
    font-size: 0.9em;
    padding: 2px 6px;
    outline: none;
}

.category-body {
    transition: opacity 0.2s;
    opacity: 1;
    margin: 0;
    padding: 0 10px 10px;
}

.category-group.is-expanded {
    background: var(--category-expanded-bg);
    border-color: var(--category-expanded-border);
    box-shadow: var(--category-shadow);
}

.category-group.is-expanded .category-header {
    background: var(--category-open-header-bg);
    border-radius: 16px 16px 0 0;
}

.category-group.is-expanded .category-body {
    padding-top: 8px;
    border-top: 1px solid var(--category-connector);
}

.category-body.collapsed {
    display: none;
    opacity: 0;
}

.bookmark-list {
    flex: 1;
    overflow-y: auto;
    /* Hidden action buttons slide slightly right when idle; clip that X overflow to avoid a bottom scrollbar. */
    overflow-x: hidden;
    padding: 10px 8px;
}

.bookmark-search-wrap,
.bookmark-search-wrap.notes-search-wrap {
    margin: 4px 8px 0;
    flex: none;
    height: auto;
    min-height: 0;
    align-self: stretch;
}

.bookmark-search-wrap .bookmark-search-input {
    height: 36px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.02)),
        rgba(0, 0, 0, 0.14);
    border-color: rgba(255, 255, 255, 0.08);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

:root[data-theme="light"] .bookmark-search-wrap .bookmark-search-input {
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(255, 245, 238, 0.92)),
        rgba(255, 255, 255, 0.92);
    border-color: rgba(184, 91, 63, 0.18);
    box-shadow:
        0 8px 18px rgba(121, 87, 66, 0.08),
        inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.bookmark-search-icon svg,
.bookmark-search-clear svg {
    width: 14px;
    height: 14px;
    display: block;
}

.bookmark-list.is-search-active {
    padding-top: 8px;
}

.bookmark-search-empty {
    padding: 22px 16px;
    border: 1px dashed var(--border);
    border-radius: 14px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.86em;
    line-height: 1.8;
    background: linear-gradient(180deg, rgba(211, 99, 58, 0.06), transparent);
}

.bookmark-item {
    display: flex;
    transform: translateZ(0);
    backface-visibility: hidden;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    position: relative;
    padding: 5px 7px;
    margin-bottom: 5px;
    border-radius: 12px;
    cursor: pointer;
    border: 1px solid transparent;
    -webkit-user-select: none;
    user-select: none;
    transition: background 0.2s ease, border-color 0.2s ease, transform 0.28s cubic-bezier(0.22, 1, 0.36, 1), padding-right 0.22s ease, box-shadow 0.22s ease;
    touch-action: pan-y;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
}

.category-header *,
.bookmark-item * {
    -webkit-user-select: none;
    user-select: none;
}

.bookmark-item:hover {
    background: var(--item-hover);
    border-color: rgba(211, 99, 58, 0.14);
}

.bookmark-item.active {
    background: var(--bookmark-active-bg);
    color: var(--bookmark-active-text);
    box-shadow: var(--bookmark-active-shadow);
}

.bookmark-item.dragging {
    position: relative;
    z-index: 7;
    opacity: 0.96;
    transform: scale(1.015);
    background: rgba(211, 99, 58, 0.12);
    border-color: rgba(211, 99, 58, 0.28);
    box-shadow: 0 18px 30px rgba(0, 0, 0, 0.18);
    cursor: grabbing;
    touch-action: none;
}

.bookmark-item.drag-pickup .bookmark-main {
    animation: drag-pickup-jiggle 180ms ease;
}

.bookmark-main {
    display: flex;
    align-items: center;
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.bookmark-copy {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
    min-width: 0;
}

@keyframes drag-pickup-jiggle {
    0% {
        transform: translate3d(0, 0, 0) scale(1);
    }
    25% {
        transform: translate3d(-1px, 0, 0) rotate(-1deg) scale(1.01);
    }
    50% {
        transform: translate3d(1px, -1px, 0) rotate(1deg) scale(1.015);
    }
    75% {
        transform: translate3d(-1px, 1px, 0) rotate(-0.6deg) scale(1.01);
    }
    100% {
        transform: translate3d(0, 0, 0) scale(1);
    }
}

.bookmark-main .icon {
    width: 22px;
    height: 22px;
    margin-right: 7px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
}

.bookmark-main .icon img,
.bookmark-main .icon svg {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 3px;
    display: block;
}

.icon-text {
    line-height: 1;
    font-size: 1.05em;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.bookmark-main .title {
    display: block;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.92em;
    font-weight: 500;
}

.bookmark-url {
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.72em;
    color: var(--text-muted);
}

.bookmark-item.search-result-item .bookmark-main {
    align-items: flex-start;
}

.bookmark-item.search-result-item .bookmark-main .icon {
    margin-top: 2px;
}

.bookmark-item mark {
    background: rgba(211, 99, 58, 0.18);
    color: inherit;
    padding: 0 3px;
    border-radius: 4px;
}

.bookmark-item.active mark {
    background: rgba(255, 255, 255, 0.22);
}

.bookmark-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    position: absolute;
    top: 50%;
    right: 3px;
    opacity: 0;
    pointer-events: none;
    transform: translate(14px, -50%);
    filter: blur(1px);
    transition: opacity 0.24s cubic-bezier(0.22, 1, 0.36, 1), transform 0.24s cubic-bezier(0.22, 1, 0.36, 1), filter 0.24s ease;
}

:root:not(.touch-optimized) .bookmark-item:is(:hover, :focus-within) .bookmark-actions {
    opacity: 1;
    pointer-events: auto;
    transform: translate(0, -50%);
    filter: blur(0);
}

:root:not(.touch-optimized) .bookmark-item:is(:hover, :focus-within) {
    padding-right: 58px;
}

.bookmark-actions .action-btn {
    color: inherit;
    opacity: 0.76;
}

.bookmark-actions .action-btn:hover,
.bookmark-actions .action-btn:focus-visible {
    opacity: 1;
}

.bookmark-item.active .bookmark-actions .action-btn {
    color: rgba(255, 255, 255, 0.92);
}

.bookmark-item.active .bookmark-actions .action-btn:hover,
.bookmark-item.active .bookmark-actions .action-btn:focus-visible {
    color: #fff;
}

:root.touch-optimized .bookmark-actions {
    opacity: 0;
    pointer-events: none;
    transform: translate(8px, -50%);
    filter: blur(1px);
}

:root.touch-optimized .bookmark-actions .action-btn {
    width: 22px;
    height: 22px;
    opacity: 0.78;
}

:root.touch-optimized .bookmark-item.active .bookmark-actions {
    opacity: 1;
    pointer-events: auto;
    transform: translate(0, -50%);
    filter: blur(0);
}

:root.touch-optimized .bookmark-item.active {
    padding-right: 56px;
}

body.archive-dragging,
body.archive-dragging * {
    cursor: grabbing !important;
}

.archive-drag-source {
    visibility: visible !important;
    opacity: 0.28 !important;
    transform: none !important;
    box-shadow: none !important;
    filter: saturate(0.72);
}

.bookmark-item.archive-drag-source {
    background: rgba(211, 99, 58, 0.08) !important;
    border-color: rgba(211, 99, 58, 0.2) !important;
    padding-right: 7px !important;
}

.bookmark-item.archive-drag-source .bookmark-actions,
.category-header.archive-drag-source .cat-actions,
.category-group.archive-drag-source .cat-actions {
    opacity: 0 !important;
    pointer-events: none !important;
    transform: translate(14px, -50%) !important;
    filter: blur(1px) !important;
}

.bookmark-item.archive-drag-source .bookmark-main,
.category-group.archive-drag-source .category-header {
    transform: none !important;
}

.category-group.archive-drag-source {
    background: rgba(211, 99, 58, 0.06) !important;
    border-color: rgba(211, 99, 58, 0.14) !important;
}

.archive-drag-ghost {
    position: fixed;
    left: 0;
    top: 0;
    margin: 0 !important;
    pointer-events: none;
    z-index: 40;
    touch-action: none;
    will-change: left, top;
    opacity: 0.98;
    filter: saturate(1.04);
}

.archive-drag-ghost.bookmark-item {
    box-shadow: 0 20px 34px rgba(0, 0, 0, 0.22);
    transform: scale(1.02);
    padding-right: 7px !important;
}

.archive-drag-ghost.bookmark-item.active {
    background: rgba(211, 99, 58, 0.16) !important;
    color: inherit !important;
    box-shadow: 0 20px 34px rgba(0, 0, 0, 0.22) !important;
}

.archive-drag-ghost.category-group {
    box-shadow: 0 24px 38px rgba(0, 0, 0, 0.24);
    transform: scale(1.01);
}

.archive-drag-ghost-simplified .bookmark-actions,
.archive-drag-ghost-simplified .cat-actions,
.archive-drag-ghost-simplified .cat-color-reset-btn,
.archive-drag-ghost-simplified .action-btn {
    opacity: 0 !important;
    pointer-events: none !important;
    visibility: hidden !important;
}

.archive-drag-ghost-simplified .cat-count {
    opacity: 1 !important;
    width: auto !important;
    min-width: 24px !important;
    max-width: none !important;
    margin-left: auto !important;
    padding-left: 8px !important;
    padding-right: 8px !important;
    transform: none !important;
    border-color: var(--category-count-border) !important;
}

.archive-drag-ghost .bookmark-actions,
.archive-drag-ghost .cat-actions {
    pointer-events: none !important;
}

:root.touch-optimized .category-group.is-expanded .cat-actions {
    opacity: 1;
    pointer-events: auto;
    transform: translate(0, -50%);
    filter: blur(0);
}

:root.touch-optimized .category-group.is-expanded .cat-count {
    opacity: 0;
    width: 0;
    min-width: 0;
    max-width: 0;
    padding-left: 0;
    padding-right: 0;
    margin-left: 0;
    transform: translateX(8px);
    border-color: transparent;
}

.action-btn {
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
    opacity: 0.6;
    padding: 2px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.action-btn:hover {
    opacity: 1;
}

.tools {
    position: relative;
    padding: 13px 11px 0 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 500px;
    opacity: 1;
    overflow: hidden;
    transition: max-height 0.3s ease, opacity 0.3s ease, padding 0.3s ease;
}

.tools::before {
    content: "";
    position: absolute;
    top: 0;
    left: 16px;
    right: 16px;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--border) 18%, rgba(211, 99, 58, 0.34) 50%, var(--border) 82%, transparent);
    box-shadow: 0 0 16px rgba(211, 99, 58, 0.12);
    pointer-events: none;
}

:root[data-theme="light"] .tools::before {
    background: linear-gradient(90deg, transparent, var(--border) 18%, rgba(184, 91, 63, 0.26) 50%, var(--border) 82%, transparent);
    box-shadow: 0 0 14px rgba(184, 91, 63, 0.08);
}

.tools.collapsed {
    max-height: 0;
    opacity: 0;
    padding-top: 0;
    padding-bottom: 0;
}

.tools.collapsed::before {
    opacity: 0;
}

.tool-btn.dragging {
    opacity: 0.82;
    transform: scale(1.015) rotate(-0.15deg);
    box-shadow: 0 16px 32px rgba(0, 0, 0, 0.18);
    border-color: rgba(211, 99, 58, 0.42);
}

.tool-btn.tool-drop-before,
.tool-btn.tool-drop-after {
    position: relative;
}

.tool-btn.tool-drop-before::before,
.tool-btn.tool-drop-after::after {
    content: "";
    position: absolute;
    left: 10px;
    right: 10px;
    height: 3px;
    border-radius: 999px;
    background: linear-gradient(90deg, rgba(211, 99, 58, 0.2), rgba(211, 99, 58, 0.95), rgba(211, 99, 58, 0.2));
    box-shadow: 0 0 0 1px rgba(211, 99, 58, 0.18), 0 0 10px rgba(211, 99, 58, 0.18);
    pointer-events: none;
}

.tool-btn.tool-drop-before::before {
    top: -2px;
}

.tool-btn.tool-drop-after::after {
    bottom: -2px;
}

.tools-collapse-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 44px;
    padding: 10px 0 12px;
    position: relative;
    overflow: visible;
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0;
    line-height: 0;
    transition: color 0.22s ease;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.tools-collapse-btn::before {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    width: 22px;
    height: 22px;
    background-color: currentColor;
    pointer-events: none;
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M7 16.5 12 12l5 4.5' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3Cpath d='M7 11.5 12 7l5 4.5' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    -webkit-mask-repeat: no-repeat;
    -webkit-mask-position: center;
    -webkit-mask-size: contain;
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M7 16.5 12 12l5 4.5' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3Cpath d='M7 11.5 12 7l5 4.5' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    mask-repeat: no-repeat;
    mask-position: center;
    mask-size: contain;
    transform: translate(-50%, -50%) rotate(180deg);
    transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1), filter 0.22s ease;
}

.tools-collapse-btn::after {
    content: none;
}

.tools-collapse-btn:hover {
    color: var(--accent);
}

.tools-collapse-btn:focus-visible {
    outline: none;
    color: var(--accent);
}

:root[data-theme="light"] .tools-collapse-btn {
    background: transparent;
}

:root[data-theme="light"] .tools-collapse-btn:hover,
:root[data-theme="light"] .tools-collapse-btn:focus-visible {
    background: transparent;
}

.tools-collapse-btn.hint-active,
.tools-collapse-btn[data-hint-active="1"] {
    animation: toolsCollapseHintColor 4.2s ease-in-out infinite;
}

.tools-collapse-btn.hint-active::before,
.tools-collapse-btn[data-hint-active="1"]::before {
    animation: toolsCollapseHintArrow 4.2s ease-in-out infinite;
}

.tools-collapse-btn.collapsed {
    background: transparent;
}

.tools-collapse-btn.collapsed::before {
    transform: translate(-50%, -50%) rotate(0deg);
}

@keyframes toolsCollapseHintColor {
    0%,
    100% {
        color: var(--text-muted);
    }

    18%,
    44% {
        color: var(--accent);
    }
}

@keyframes toolsCollapseHintArrow {
    0%,
    100% {
        filter: drop-shadow(0 0 0 rgba(211, 99, 58, 0));
    }

    20%,
    42% {
        filter: drop-shadow(0 0 7px rgba(211, 99, 58, 0.34));
    }
}

.center-copy-toast {
    position: fixed;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%) scale(0.86);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-width: 212px;
    max-width: min(78vw, 360px);
    padding: 18px 26px;
    border-radius: 999px;
    background: linear-gradient(135deg, rgba(33, 181, 92, 0.97), rgba(23, 154, 73, 0.97));
    color: #fff;
    font-size: 1.02rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    box-shadow: 0 22px 52px rgba(16, 133, 62, 0.32);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.36s cubic-bezier(0.22, 1, 0.36, 1);
    z-index: 1300;
}

.center-copy-toast.show {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.center-copy-toast.error {
    background: linear-gradient(135deg, rgba(220, 53, 69, 0.97), rgba(194, 35, 52, 0.97));
    box-shadow: 0 22px 52px rgba(194, 35, 52, 0.28);
}

.btn {
    display: block;
    width: 100%;
    padding: 11px;
    background: transparent;
    border: 1px solid var(--accent);
    color: var(--accent);
    text-align: center;
    border-radius: 8px;
    cursor: pointer;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9em;
    transition: transform 0.18s ease, background 0.18s ease, color 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.tool-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.tool-btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn:hover,
.btn:focus-visible {
    background: var(--accent);
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 10px 24px rgba(211, 99, 58, 0.18);
    outline: none;
}

.btn:disabled,
.btn[disabled] {
    opacity: 0.48;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

.btn:disabled:hover,
.btn:disabled:focus-visible,
.btn[disabled]:hover,
.btn[disabled]:focus-visible {
    background: transparent;
    color: var(--accent);
    box-shadow: none;
    transform: none;
}

.btn.btn-muted:disabled,
.btn.btn-muted[disabled],
.btn.btn-muted:disabled:hover,
.btn.btn-muted:disabled:focus-visible,
.btn.btn-muted[disabled]:hover,
.btn.btn-muted[disabled]:focus-visible {
    background: var(--soft-btn-bg) !important;
    color: var(--text) !important;
    border-color: var(--border) !important;
}

.btn.full {
    width: 100%;
}

.btn-muted {
    border-color: var(--border) !important;
    color: var(--text) !important;
    background: var(--soft-btn-bg) !important;
}

.welcome-session-actions .btn-muted:hover,
.welcome-session-actions .btn-muted:focus-visible {
    background: var(--accent) !important;
    color: #fff !important;
    border-color: var(--accent) !important;
    transform: translateY(-1px);
    box-shadow: 0 10px 24px rgba(211, 99, 58, 0.18);
    outline: none;
}

.bookmark-context-menu {
    position: fixed;
    z-index: 100000;
    width: max-content;
    max-width: min(320px, calc(100vw - 24px));
    padding: 0;
    border: none;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

.bookmark-context-menu-item {
    width: 100%;
    border: none;
    background: #17110e;
    color: var(--text);
    text-align: left;
    white-space: nowrap;
    padding: 8px 10px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.86em;
    transition: none;
}

.bookmark-context-menu-item:hover,
.bookmark-context-menu-item:focus-visible {
    background: #17110e;
    color: var(--text);
    outline: none;
}

:root[data-theme="light"] .bookmark-context-menu {
    background: transparent;
    border-color: transparent;
    box-shadow: none;
}

:root[data-theme="light"] .bookmark-context-menu-item {
    background: #fffaf5;
}

:root[data-theme="light"] .bookmark-context-menu-item:hover,
:root[data-theme="light"] .bookmark-context-menu-item:focus-visible {
    background: #fffaf5;
    color: var(--text);
}

@media (max-width: 768px) {
    #sidebar .bookmark-main .title {
        font-size: clamp(0.84rem, 1.15vw, 0.94rem) !important;
        font-weight: 400 !important;
        color: var(--text-muted) !important;
    }
}
