* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Пошук ПП: швидке повернення догори у довгій видачі */
.rp-scroll-top-btn {
    position: fixed;
    right: 28px;
    bottom: 30px;
    width: 48px;
    height: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.34);
    background: rgba(15, 23, 42, 0.58);
    color: rgba(255, 255, 255, 0.94);
    box-shadow: 0 14px 34px rgba(0, 0, 0, 0.34);
    backdrop-filter: blur(10px);
    opacity: 0;
    pointer-events: none;
    transform: translateY(8px);
    transition: opacity 160ms ease, transform 160ms ease, background 160ms ease, border-color 160ms ease;
    z-index: 11800;
}

.rp-scroll-top-btn.is-visible {
    opacity: 0.72;
    pointer-events: auto;
    transform: translateY(0);
}

.rp-scroll-top-btn:hover,
.rp-scroll-top-btn:focus-visible {
    opacity: 1;
    background: rgba(31, 41, 55, 0.82);
    border-color: rgba(45, 212, 191, 0.5);
    outline: none;
}

/* Маркери увімкнені: такий самий зелений акцент, як у активних фільтрів ПП */
.rp-toolbar-shell #vizDropdownBtn.viz-active,
.rp-dashboard-header .rp-markers-in-header #vizDropdownBtn.viz-active,
.rp-toolbar-shell .rp-markers-in-toolbar #vizDropdownBtn.viz-active {
    background: rgba(6, 78, 59, 0.5) !important;
    border-color: rgba(45, 212, 191, 0.42) !important;
    box-shadow: inset 0 0 0 1px rgba(16, 185, 129, 0.12) !important;
}

.rp-toolbar-shell #vizDropdownBtn.viz-active span,
.rp-dashboard-header .rp-markers-in-header #vizDropdownBtn.viz-active span,
.rp-toolbar-shell .rp-markers-in-toolbar #vizDropdownBtn.viz-active span {
    color: #34d399 !important;
    font-weight: 600;
}

.rp-refinement-apply-btn--busy,
.rp-refinement-apply-btn--busy:disabled {
    color: #ffffff !important;
    background: linear-gradient(90deg, #0f766e, #4f46e5, #0f766e) !important;
    background-size: 220% 100% !important;
    animation: rpApplyBusyPulse 1.15s linear infinite;
    box-shadow: 0 0 0 1px rgba(45, 212, 191, 0.28), 0 0 26px rgba(45, 212, 191, 0.2) !important;
    opacity: 1 !important;
    cursor: progress !important;
}

@keyframes rpApplyBusyPulse {
    0% { background-position: 0% 50%; }
    100% { background-position: 220% 50%; }
}

@media (max-width: 768px) {
    .rp-scroll-top-btn {
        right: 16px;
        bottom: calc(18px + env(safe-area-inset-bottom, 0px));
        width: 44px;
        height: 44px;
    }
}

:root {
    --primary-color: #6566F1;
    --primary-hover: #885DF6;
    --secondary-color: #64748b;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --error-color: #ef4444;
    --balance-trial-meta-color: #c4b5fd;
    --bg-color: #0f0a2e;
    --surface-color: rgba(255,255,255,0.04);
    --text-primary: #e2e8f0;
    --text-secondary: #94a3b8;
    --border-color: rgba(255,255,255,0.08);
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.4);
    --radius: 8px;
    --radius-lg: 12px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(160deg, #0f0a2e 0%, #1a1050 30%, #15103a 60%, #0d0825 100%);
    background-attachment: fixed;
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

/* Ambient background glow effects */
body::before {
    content: '';
    position: fixed;
    top: -30%;
    left: -20%;
    width: 60%;
    height: 60%;
    background: radial-gradient(ellipse, rgba(136,93,246,0.08) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
}

body::after {
    content: '';
    position: fixed;
    bottom: -20%;
    right: -15%;
    width: 50%;
    height: 50%;
    background: radial-gradient(ellipse, rgba(101,102,241,0.06) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
}

/* ============================================
   MAIN LAYOUT: Sidebar + Content
   ============================================ */

.main-layout {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: padding-left 0.3s ease;
    padding-left: 220px; /* sidebar width when open */
    flex: 1;
    min-width: 0;
}

.main-layout.sidebar-collapsed {
    padding-left: 0;
}

/* ============================================
   TOP NAVIGATION BAR (на всіх сторінках)
   ============================================ */
.top-nav-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px 1cm;
    background: rgba(15, 10, 46, 0.99);
    border-bottom: 1px solid var(--border-color);
    width: 100%;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    z-index: 10050;
    pointer-events: auto;
}

.top-nav-btn {
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.12);
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    text-decoration: none;
    font-family: inherit;
}

.top-nav-btn-with-help {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.top-nav-btn-with-help .sp-help-icon {
    width: 16px;
    height: 16px;
    min-width: 16px;
    min-height: 16px;
    border-radius: 50%;
    background: rgba(255,255,255,0.12);
    color: var(--text-primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    cursor: help;
}

.top-nav-btn:hover {
    background: rgba(255,255,255,0.1);
    border-color: rgba(255,255,255,0.2);
}

.top-nav-btn.active {
    background: var(--primary-color);
    color: #fff;
    border-color: var(--primary-color);
}

.top-nav-btn.module-hover-preview {
    background: linear-gradient(135deg, #14b8a6, #6d5dfc);
    color: #fff;
    border-color: rgba(45, 212, 191, 0.65);
    box-shadow: 0 0 0 2px rgba(45, 212, 191, 0.22), 0 10px 24px rgba(20, 184, 166, 0.18);
}

/* П.9: три стани кнопки AI чат — неактивна, активна, готова до активності */
.top-nav-btn.top-nav-btn-ai-chat {
    color: var(--text-secondary);
}
.top-nav-btn.top-nav-btn-ai-chat:not(.active):not(.top-nav-btn-ai-chat-ready) {
    opacity: 0.8;
    color: #94a3b8;
}
.top-nav-btn.top-nav-btn-ai-chat:hover,
.top-nav-btn.top-nav-btn-ai-chat.top-nav-btn-ai-chat-ready {
    color: var(--text-primary);
}
.top-nav-btn.top-nav-btn-ai-chat.active {
    opacity: 1;
}

.top-nav-btn.top-nav-btn-ai-chat-ready {
    background: rgba(245, 158, 11, 0.2);
    border-color: rgba(245, 158, 11, 0.5);
}

.top-nav-btn.top-nav-btn-ai-chat-ready::after {
    content: '';
    display: none;
}
.top-nav-btn .top-nav-ai-chat-badge {
    display: none;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    margin-left: 6px;
    border-radius: 9px;
    background: #f59e0b;
    color: #1e293b;
    font-size: 11px;
    font-weight: 700;
    line-height: 18px;
    vertical-align: middle;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
}
.top-nav-btn.top-nav-btn-ai-chat-ready .top-nav-ai-chat-badge {
    display: inline-flex;
}

.top-nav-btn-lex {
    /* Без margin-left: auto — усі кнопки навігації центровані разом */
}

.top-nav-balance {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    display: none;
    align-items: center;
    gap: 4px;
    padding: 8px 14px;
    border-radius: 999px;
    background: rgba(15, 118, 110, 0.28);
    border: 1px solid rgba(45, 212, 191, 0.4);
    color: #d1fae5;
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    overflow: visible;
}

.top-nav-balance strong {
    color: #34d399;
    font-weight: 700;
}

.top-nav-balance.has-meta {
    align-items: flex-start;
    flex-direction: column;
    gap: 2px;
    line-height: 1.2;
    white-space: normal;
}

.top-nav-balance-main {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}

.top-nav-balance-meta {
    color: var(--balance-trial-meta-color);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.01em;
}

.top-nav-balance-meta-link {
    cursor: pointer;
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 2px;
}

.top-nav-balance-clickable {
    cursor: pointer;
    text-decoration: none;
    transition: opacity 0.2s;
}
.top-nav-balance-clickable:hover {
    opacity: 0.9;
}

.top-nav-notification-indicator {
    position: fixed;
    top: max(6px, env(safe-area-inset-top, 0px));
    right: max(8px, env(safe-area-inset-right, 0px));
    width: 64px;
    height: 64px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    padding: 0;
    background: transparent;
    color: rgba(139, 92, 246, 0.68);
    opacity: 0.66;
    cursor: pointer;
    z-index: 4;
    pointer-events: auto;
    filter: drop-shadow(0 12px 24px rgba(79, 70, 229, 0.42));
}

.top-nav-notification-indicator[hidden] {
    display: none !important;
}

.top-nav-notification-indicator svg {
    width: 100%;
    height: 100%;
    fill: currentColor;
    stroke: rgba(199, 210, 254, 0.5);
    stroke-width: 1.2;
}

.top-nav-notification-indicator:hover,
.top-nav-notification-indicator:focus-visible {
    opacity: 0.86;
}

.top-nav-notification-count {
    position: absolute;
    top: 12px;
    right: 9px;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    border-radius: 999px;
    background: rgba(244, 63, 94, 0.92);
    color: #fff;
    font-size: 10px;
    font-weight: 800;
    line-height: 18px;
    text-align: center;
    box-shadow: 0 0 0 2px rgba(15, 10, 46, 0.72);
}

.rp-view-tabs-in-header {
    flex-shrink: 0;
}

/* Нижню панель режиму перегляду прибрано (п.1, п.2 ТЗ) */
#categoryResultsArea .rp-view-tabs.rp-cat-view-tabs {
    display: none !important;
}

.rp-perpage-in-header {
    flex-shrink: 0;
}

/* Опція «ПП на сторінці» не показується в тулбарі (залишається лише внутрішня логіка rpPerPage) */
#rpPerPageWrapper {
    display: none !important;
}

.rp-filters-in-header {
    width: auto;
    margin-top: 0;
}

.search-container {
    flex: 1;
    min-height: 0;
    max-width: 100%;
    width: 100%;
    margin: 0 auto;
    padding: 20px 1cm 28px;
}

/* ============================================
   LEFT SIDEBAR - Ліва бокова панель
   ============================================ */

.sidebar-panel {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: 220px;
    background: linear-gradient(180deg, #1a1050 0%, #130d3a 100%);
    color: #e2e8f0;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    border-right: 1px solid rgba(255,255,255,0.06);
    padding: 16px 12px;
    gap: 12px;
    overflow-y: auto;
    transition: transform 0.3s ease, width 0.3s ease;
    transform: translateX(0);
}

.sidebar-panel.collapsed {
    transform: translateX(-100%);
}

html.sidebar-state-collapsed .sidebar-panel {
    transform: translateX(-100%);
    transition: none;
}

html.sidebar-state-collapsed .sidebar-panel.mobile-open {
    transform: translateX(0);
    transition: transform 0.3s ease;
}

html.sidebar-state-collapsed .main-layout {
    padding-left: 0;
}

html.sidebar-state-collapsed .sidebar-toggle-btn {
    left: 12px;
}

/* Прихований блок решти пунктів меню (Синоніми та Промпт зверху) */
.sidebar-rest-hidden {
    display: none !important;
}

/* Sidebar navigation buttons */
.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sidebar-nav-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 14px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    text-align: left;
    line-height: 1.3;
    text-decoration: none;
}

.sidebar-nav-btn-primary {
    background: linear-gradient(135deg, #2563eb, #3b82f6);
    color: #fff;
}

.sidebar-nav-btn-primary:hover {
    filter: brightness(1.15);
    box-shadow: 0 4px 16px rgba(37,99,235,0.3);
}

.sidebar-nav-btn-outline {
    background: transparent;
    color: #94a3b8;
    border: 1px solid rgba(255,255,255,0.12);
}

.sidebar-nav-btn-outline:hover {
    background: rgba(255,255,255,0.06);
    color: #e2e8f0;
    border-color: rgba(255,255,255,0.2);
}

.sidebar-nav-btn-active {
    background: linear-gradient(135deg, rgba(136,93,246,0.25), rgba(101,102,241,0.25)) !important;
    border-color: rgba(136,93,246,0.5) !important;
    color: #c4b5fd !important;
}

/* Wrapper for history block (can be hidden by "Показати історію пошуку") */
.sidebar-history-block {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 0;
    overflow: hidden;
}
.sidebar-history-block.is-hidden {
    display: none;
}

/* Sidebar secondary nav group */
.sidebar-nav-secondary {
    margin-top: 4px;
}

/* Toggle "Показати історію пошуку" button */
.sidebar-toggle-history-btn .sidebar-toggle-history-text {
    white-space: normal;
    line-height: 1.25;
}

/* Sidebar history section */
.sidebar-history {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}

.sidebar-history-header {
    display: flex;
    align-items: center;
    gap: 6px;
    color: #64748b;
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 8px 4px 6px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    margin-bottom: 4px;
}

.sidebar-history-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

/* History items inside sidebar */
.sidebar-history-list .chat-history-item,
.sidebar-history-list > div {
    padding: 8px 10px;
    border-radius: 6px;
    font-size: 12px;
    color: #94a3b8;
    cursor: pointer;
    transition: all 0.15s;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar-history-list .chat-history-item:hover,
.sidebar-history-list > div:hover {
    background: rgba(255,255,255,0.06);
    color: #e2e8f0;
}

.sidebar-history-list .chat-history-item.active,
.sidebar-history-list > div.active {
    background: rgba(101,102,241,0.15);
    color: #c4b5fd;
}

.sidebar-new-search-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 12px;
    background: rgba(255,255,255,0.04);
    border: 1px dashed rgba(255,255,255,0.15);
    border-radius: 8px;
    color: #64748b;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
    margin-top: auto;
}

.sidebar-clear-search-btn {
    justify-content: center;
}

.sidebar-new-search-btn:hover {
    background: rgba(255,255,255,0.08);
    color: #e2e8f0;
    border-color: rgba(255,255,255,0.25);
}

/* Sidebar toggle button - always visible */
.sidebar-toggle-btn {
    position: fixed;
    top: 12px;
    left: 12px;
    z-index: 1002;
    width: 38px;
    height: 38px;
    border-radius: 8px;
    background: rgba(26, 16, 80, 0.95);
    border: 1px solid rgba(255,255,255,0.1);
    color: #94a3b8;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.25s;
}

.sidebar-toggle-btn:hover {
    background: rgba(101,102,241,0.25);
    border-color: rgba(101,102,241,0.4);
    color: #c4b5fd;
}

/* Animate toggle button position (no backdrop-filter to avoid blur) */
.sidebar-toggle-btn {
    transition: left 0.3s ease, background 0.2s, border-color 0.2s, color 0.2s;
}

/* When sidebar is open, shift toggle right of sidebar */
.sidebar-toggle-btn.shifted {
    left: 228px;
}

/* Hide old sidebar styles */
.chat-sidebar {
    display: none !important;
}
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.3);
}

.chat-sidebar.open {
    transform: translateX(0);
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid #334155;
}

.sidebar-header h3 {
    font-size: 16px;
    font-weight: 600;
    margin: 0;
    color: #f1f5f9;
}

.sidebar-close-btn {
    background: none;
    border: none;
    color: #94a3b8;
    font-size: 24px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    transition: all 0.2s;
}

.sidebar-close-btn:hover {
    background: #334155;
    color: #f1f5f9;
}

.new-chat-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 16px;
    padding: 12px 16px;
    background: #334155;
    border: 1px dashed #475569;
    border-radius: 8px;
    color: #e2e8f0;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
}

.new-chat-btn:hover {
    background: #475569;
    border-style: solid;
}

.new-chat-btn svg {
    flex-shrink: 0;
}

.chat-history {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

.chat-history-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    margin-bottom: 4px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    background: transparent;
}

.chat-history-item:hover {
    background: #334155;
}

.chat-history-item.active {
    background: #3b82f6;
}

.chat-history-item .chat-icon {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #94a3b8;
}

.chat-history-item.active .chat-icon {
    color: white;
}

.chat-history-item .chat-info {
    flex: 1;
    min-width: 0;
}

.chat-history-item .chat-title {
    font-size: 14px;
    font-weight: 500;
    color: #e2e8f0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-history-item .chat-date {
    font-size: 11px;
    color: #64748b;
    margin-top: 2px;
}

.chat-history-item.active .chat-title,
.chat-history-item.active .chat-date {
    color: white;
}

.chat-history-item .chat-delete {
    opacity: 0;
    background: none;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.2s;
}

.chat-history-item:hover .chat-delete {
    opacity: 1;
}

.chat-history-item .chat-delete:hover {
    background: #ef4444;
    color: white;
}

/* Кнопка відкриття sidebar */
.open-sidebar-btn {
    display: none !important; /* replaced by sidebar-toggle-btn */
}

.open-sidebar-btn:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.open-sidebar-btn svg {
    color: inherit;
}

/* Overlay для sidebar */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
}

.sidebar-overlay.visible {
    opacity: 1;
    visibility: visible;
}

/* Scrollbar для sidebar */
.chat-history::-webkit-scrollbar {
    width: 6px;
}

.chat-history::-webkit-scrollbar-track {
    background: transparent;
}

.chat-history::-webkit-scrollbar-thumb {
    background: #475569;
    border-radius: 3px;
}

.chat-history::-webkit-scrollbar-thumb:hover {
    background: #64748b;
}

/* Порожня історія */
.chat-history-empty {
    text-align: center;
    padding: 40px 20px;
    color: #64748b;
}

.chat-history-empty svg {
    width: 48px;
    height: 48px;
    margin-bottom: 12px;
    opacity: 0.5;
}

.chat-history-empty p {
    font-size: 14px;
    margin: 0;
}

/* Old search-container replaced by layout above */

/* Header */
.search-header {
    background: var(--surface-color);
    border-radius: var(--radius-lg);
    padding: 16px 20px;
    margin-bottom: 24px;
    box-shadow: var(--shadow);
}

/* Top panel wrapper: only the nav bar is sticky, search scrolls away */
.sticky-top-panel {
    position: relative;
    z-index: 200;
    background: linear-gradient(180deg, rgba(15, 10, 46, 0.98) 0%, #0f0a2e 8%, #151040 100%);
    margin-bottom: 0;
}

.sticky-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--surface-color);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.navigation-buttons {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.nav-btn {
    padding: 8px 16px;
    border: 2px solid var(--primary-color);
    background: var(--surface-color);
    color: var(--primary-color);
    border-radius: var(--radius);
    cursor: pointer;
    font-weight: 500;
    font-size: 14px;
    transition: all 0.2s;
    white-space: nowrap;
}

.nav-btn:hover {
    background: var(--primary-color);
    color: white;
}

.nav-btn.dashboard-btn {
    background: linear-gradient(135deg, #8b5cf6, #6366f1);
    color: white;
    border-color: #8b5cf6;
}

.nav-btn.dashboard-btn:hover {
    background: linear-gradient(135deg, #7c3aed, #4f46e5);
    border-color: #7c3aed;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.4);
}

.logo {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary-color);
}

.mode-switcher {
    display: flex;
    align-items: center;
    gap: 8px;
}

.mode-label {
    font-weight: 500;
    color: var(--text-secondary);
}

.clarification-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
    font-size: 14px;
    color: var(--text-primary);
}

.checkbox-input {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--primary-color);
}

.checkbox-text {
    font-weight: 500;
}

.checkbox-label:hover .checkbox-text {
    color: var(--primary-color);
}

.model-selector {
    display: flex;
    align-items: center;
    gap: 8px;
}

.model-label {
    font-weight: 500;
    color: var(--text-secondary);
    white-space: nowrap;
}

.model-select {
    padding: 8px 12px;
    border: 2px solid var(--border-color);
    background: var(--surface-color);
    color: var(--text-primary);
    border-radius: var(--radius);
    cursor: pointer;
    font-weight: 500;
    font-size: 14px;
    transition: all 0.2s;
    min-width: 140px;
}

.model-select:hover {
    border-color: var(--primary-color);
}

.model-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.mode-btn {
    padding: 6px 14px;
    border: 2px solid var(--border-color);
    background: var(--surface-color);
    border-radius: var(--radius);
    cursor: pointer;
    font-weight: 500;
    font-size: 14px;
    transition: all 0.2s;
    white-space: nowrap;
}

.mode-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.mode-btn.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* ============================================
   SEARCH PANEL (SP) - Нова пошукова панель
   ============================================ */

.sp-panel {
    background: linear-gradient(135deg, #1a1145 0%, #2d1b69 30%, #1e1555 70%, #151040 100%);
    border: 1px solid rgba(101,102,241,0.35);
    border-radius: 16px;
    padding: 18px 22px 14px;
    margin-bottom: 16px;
    box-shadow: 0 8px 32px rgba(30, 17, 69, 0.45), 0 2px 8px rgba(0,0,0,0.2);
    position: sticky;
    top: 0;
    z-index: 100;
    overflow: visible;
}

/* Панель пошуку категорій (скріншот 13) */
.sp-panel-category .sp-category-settings-row {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}
.sp-panel-category .sp-category-settings-group {
    display: flex;
    align-items: center;
    gap: 8px;
}
.sp-panel-category .sp-category-label {
    color: rgba(255,255,255,0.85);
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
}
.sp-panel-category .sp-category-input {
    padding: 8px 12px;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 8px;
    color: #e2e8f0;
    font-size: 14px;
    min-width: 180px;
}
.sp-panel-category .sp-category-select {
    padding: 8px 12px;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 8px;
    color: #e2e8f0;
    font-size: 14px;
    min-width: 160px;
}
.sp-panel-category .sp-category-select option {
    background: #1e1b4b;
    color: #f1f5f9;
}
.sp-panel-category .sp-category-search-btn {
    padding: 8px 20px;
    background: linear-gradient(90deg, #885DF6 0%, #6566F1 100%);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}
.sp-panel-category .sp-category-reset-btn {
    padding: 8px 16px;
    background: rgba(255,255,255,0.1);
    color: #e2e8f0;
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
}

/* --- Row 1: Search bar --- */
.sp-search-row {
    display: flex;
    align-items: stretch;
    gap: 0;
    position: relative;
    margin-bottom: 14px;
    border: 1px solid rgba(101,102,241,0.4);
    border-radius: 12px;
    overflow: visible;
    z-index: 120;
}

.sp-search-btn {
    background: linear-gradient(90deg, #885DF6 0%, #6566F1 100%);
    color: #fff;
    border: none;
    border-radius: 8px 0 0 8px;
    padding: 12px 28px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    letter-spacing: 0.3px;
    transition: filter 0.2s, box-shadow 0.2s;
    z-index: 2;
    height: 48px;
    display: flex;
    align-items: center;
    align-self: flex-start;
}

.sp-search-btn:hover {
    filter: brightness(1.12);
    box-shadow: 0 4px 16px rgba(136, 93, 246, 0.5);
}

.sp-search-btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.sp-search-btn.searching {
    pointer-events: none;
    position: relative;
    overflow: hidden;
}

.sp-search-btn.searching::after {
    content: '';
    position: absolute;
    top: 0; left: -100%;
    width: 200%; height: 100%;
    background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.25) 50%, transparent 100%);
    animation: sp-search-shimmer 1.2s ease-in-out infinite;
}

@keyframes sp-search-shimmer {
    0% { left: -100%; }
    100% { left: 100%; }
}

.sp-input-wrapper {
    flex: 1;
    position: relative;
    display: flex;
    align-items: stretch;
    min-height: 48px;
    padding-right: 176px;
    box-sizing: border-box;
    background: linear-gradient(135deg, #2d1b69 0%, #1e1555 50%, #1a1145 100%);
    z-index: 1201;
}

.sp-input {
    width: 100%;
    flex: 1 1 auto;
    min-width: 0;
    min-height: 48px;
    max-height: 200px;
    border: none;
    outline: none;
    font-size: 16px;
    padding: 12px 16px;
    background: transparent;
    color: #fff;
    border-radius: 0;
    resize: none;
    overflow-y: auto;
    scrollbar-gutter: stable;
    line-height: 1.5;
    font-family: inherit;
    box-sizing: border-box;
}

.sp-input::placeholder {
    color: rgba(255,255,255,0.6);
    font-weight: 400;
}

.sp-input:focus {
    box-shadow: inset 0 0 0 2px rgba(136, 93, 246, 0.4);
}

.sp-ai-mode-btn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-width: 116px;
    height: 34px;
    padding: 0 12px;
    border: 1px solid rgba(59, 130, 246, 0.75);
    border-radius: 999px;
    background:
        linear-gradient(#fff, #fff) padding-box,
        conic-gradient(from 210deg, #34d399, #60a5fa, #6366f1, #f59e0b, #34d399) border-box;
    color: #0f172a;
    font-size: 14px;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    z-index: 4;
    box-shadow: 0 2px 9px rgba(15, 23, 42, 0.22);
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.sp-ai-mode-btn:hover,
.sp-ai-mode-btn:focus-visible {
    transform: translateY(-50%) scale(1.02);
    box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.24), 0 4px 14px rgba(15, 23, 42, 0.28);
    outline: none;
}

.sp-ai-mode-btn svg {
    color: #0f172a;
    flex: 0 0 auto;
}

.sp-clear-btn {
    position: absolute;
    right: 132px;
    top: 14px;
    background: none;
    border: none;
    color: rgba(255,255,255,0.65);
    cursor: pointer;
    padding: 4px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s, background 0.2s;
    z-index: 3;
}

.sp-clear-btn:hover {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
}

.sp-input-inline-sep {
    display: none;
    width: 1px;
    align-self: stretch;
    margin: 10px 0;
    background: rgba(148, 163, 184, 0.35);
    flex-shrink: 0;
}

.sp-inline-search-submit {
    display: none;
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    padding: 0;
    border: none;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.06);
    color: #a5b4fc;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    z-index: 4;
    transition: background 0.2s, color 0.2s;
}

.sp-inline-search-submit:hover {
    background: rgba(101, 102, 241, 0.35);
    color: #e0e7ff;
}

.sp-inline-search-submit.searching {
    opacity: 0.65;
    pointer-events: none;
}

.sp-history-btn {
    background: linear-gradient(135deg, #3d2a7a 0%, #2d1b69 100%);
    border: 1px solid rgba(101,102,241,0.5);
    color: rgba(255,255,255,0.9);
    cursor: pointer;
    padding: 10px 12px;
    border-radius: 0 8px 8px 0;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s, background 0.2s, filter 0.2s;
    align-self: flex-start;
}

.sp-history-btn:hover {
    color: #fff;
    filter: brightness(1.15);
}

.sp-history-wrapper {
    position: relative;
    overflow: visible;
}

/* --- Autocomplete dropdown --- */
.sp-autocomplete-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border-radius: 0 0 10px 10px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
    z-index: 1300;
    display: none;
    max-height: 260px;
    overflow-y: auto;
}

.sp-autocomplete-dropdown.visible {
    display: block;
}

.sp-autocomplete-item {
    padding: 10px 16px;
    cursor: pointer;
    font-size: 14px;
    color: #1e293b;
    transition: background 0.15s;
    border-bottom: 1px solid #f1f5f9;
}

.sp-autocomplete-item:hover,
.sp-autocomplete-item.active {
    background: #f0f0ff;
    color: #6566F1;
}

.sp-autocomplete-item:last-child {
    border-bottom: none;
}

/* --- History dropdown --- */
.sp-history-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 360px;
    max-height: 400px;
    background: #1e1b3a;
    border-radius: 12px;
    box-shadow: 0 12px 40px rgba(0,0,0,0.4);
    z-index: 200;
    display: none;
    overflow: hidden;
}

.sp-history-dropdown.visible {
    display: block;
}

.sp-history-dropdown-header {
    padding: 14px 18px;
    font-weight: 600;
    font-size: 15px;
    color: #e2e8f0;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sp-history-dropdown-list {
    max-height: 340px;
    overflow-y: auto;
    padding: 6px;
}

.sp-history-dropdown-item {
    padding: 10px 14px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    color: #c4b5fd;
    transition: background 0.15s;
    display: flex;
    align-items: center;
    gap: 10px;
}

.sp-history-dropdown-item:hover {
    background: rgba(136, 93, 246, 0.2);
    color: #fff;
}

.sp-history-dropdown-item .history-icon {
    flex-shrink: 0;
    color: #818cf8;
}

.sp-history-dropdown-item .history-text {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sp-history-dropdown-item .history-date {
    font-size: 11px;
    color: #64748b;
    flex-shrink: 0;
}

.sp-history-dropdown-empty {
    padding: 24px;
    text-align: center;
    color: #64748b;
    font-size: 14px;
}

/* --- Row 2: Settings (legacy, kept for compatibility) --- */
.sp-settings-row {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

/* --- Horizontal filters row (скріншот 2) --- */
.sp-filters-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
}

.sp-filters-row .sp-dropdown-wrapper,
.sp-filters-row .sp-location-tab {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.sp-categorizer-launch-wrapper {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.sp-categorizer-launch-btn {
    min-width: 190px;
    justify-content: center;
    gap: 10px;
}

.sp-categorizer-launch-btn.sp-categorizer-launch-active {
    background: rgba(6, 78, 59, 0.72) !important;
    border-color: rgba(45, 212, 191, 0.58) !important;
    box-shadow: inset 0 0 0 1px rgba(16, 185, 129, 0.18);
}

.sp-categorizer-launch-btn.sp-categorizer-launch-active #spCategorizerLaunchText {
    color: #22ff66;
    font-weight: 700;
}

.sp-categorizer-launch-clear {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    margin-left: 4px;
    color: #22ff66;
    font-size: 20px;
    font-weight: 800;
    line-height: 1;
    cursor: pointer;
}

.sp-categorizer-launch-clear[hidden] {
    display: none !important;
}

.sp-categorizer-launch-clear:hover {
    color: #ffffff;
}

.sp-reset-all-search-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-left: 0;
    min-height: 38px;
    padding: 0 16px;
    border: 1px solid rgba(248, 113, 113, 0.5);
    border-radius: 8px;
    background: rgba(70, 24, 54, 0.42);
    color: #fecaca;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.15;
    cursor: pointer;
    transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.sp-reset-all-search-btn:hover,
.sp-reset-all-search-btn:focus-visible {
    background: rgba(127, 29, 29, 0.56);
    border-color: rgba(252, 165, 165, 0.78);
    color: #ffffff;
    outline: none;
    transform: translateY(-1px);
}
/* Однакова висота для всіх фільтрів */
.sp-filters-row .sp-dropdown-btn,
.sp-filters-row .sp-location-tab {
    min-height: 38px;
    box-sizing: border-box;
}

.sp-filter-hidden {
    display: none !important;
}

/* Врахувати назви категорій — dropdown меню (скріншот 2) */
.sp-category-menu {
    min-width: 320px;
}

.sp-choice-menu {
    min-width: 320px;
    padding: 8px;
}

.sp-choice-option {
    width: 100%;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.1);
    background: rgba(255,255,255,0.06);
    cursor: pointer;
    text-align: left;
    font: inherit;
    appearance: none;
    transition: background 0.18s ease, border-color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}

.sp-choice-option + .sp-choice-option {
    margin-top: 8px;
}

.sp-choice-option:hover {
    background: rgba(136, 93, 246, 0.18);
    border-color: rgba(136, 93, 246, 0.46);
    transform: translateY(-1px);
}

.sp-choice-option.selected {
    background: rgba(34, 197, 94, 0.16);
    border-color: rgba(34, 197, 94, 0.54);
    box-shadow: inset 0 0 0 1px rgba(34, 197, 94, 0.18);
    color: #ffffff;
}

.sp-choice-option:focus-visible {
    outline: none;
    border-color: rgba(165, 180, 252, 0.85);
    box-shadow: 0 0 0 3px rgba(129, 140, 248, 0.2);
}

.sp-choice-option-check {
    width: 22px;
    height: 22px;
    min-width: 22px;
    border-radius: 6px;
    border: 2px solid rgba(255,255,255,0.2);
    background: rgba(15, 23, 42, 0.35);
    position: relative;
    margin-top: 1px;
    transition: background 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.sp-choice-option.selected .sp-choice-option-check {
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    border-color: rgba(134, 239, 172, 0.95);
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.14);
}

.sp-choice-option.selected .sp-choice-option-check::after {
    content: '✓';
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-size: 14px;
    font-weight: 800;
}

.sp-choice-option-copy {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
    flex: 1 1 auto;
}

.sp-choice-option-title {
    color: #eef2ff;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.35;
}

.sp-choice-option-desc {
    color: rgba(255, 255, 255, 0.72);
    font-size: 12px;
    font-weight: 500;
    line-height: 1.45;
}

.sp-choice-option.selected .sp-choice-option-desc {
    color: rgba(255, 255, 255, 0.86);
}

.sp-location-dropdown-btn {
    min-width: 140px;
}

/* Маркери dropdown: primary row */
.sp-viz-primary-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    margin-bottom: 8px;
}

.sp-viz-label {
    color: #c4b5fd;
    font-size: 13px;
    font-weight: 500;
}

.sp-viz-primary-dot {
    width: 16px;
    height: 16px;
    border-radius: 4px;
    flex-shrink: 0;
}

.sp-viz-additional-label {
    color: #a855f7;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 8px;
}

.sp-settings-group {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.sp-settings-label {
    color: #a855f7;
    font-weight: 600;
    font-size: 13px;
    white-space: nowrap;
}

/* --- Dropdown button --- */
.sp-dropdown-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    gap: 4px;
}

.sp-dropdown-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 8px;
    color: #e2e8f0;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.sp-dropdown-btn:hover {
    background: rgba(255,255,255,0.14);
    border-color: rgba(136, 93, 246, 0.5);
}

.sp-dropdown-arrow {
    color: #a855f7;
    transition: transform 0.2s;
    flex-shrink: 0;
}

.sp-dropdown-btn.open .sp-dropdown-arrow {
    transform: rotate(180deg);
}

.sp-dropdown-menu {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    min-width: 220px;
    background: #1e1b3a;
    border-radius: 12px;
    box-shadow: 0 12px 40px rgba(0,0,0,0.5);
    z-index: 300;
    display: none;
    padding: 6px;
    animation: sp-dropdown-fade-in 0.15s ease;
}

.sp-dropdown-menu.visible {
    display: block;
}

@keyframes sp-dropdown-fade-in {
    from { opacity: 0; transform: translateY(-6px); }
    to { opacity: 1; transform: translateY(0); }
}

.sp-dropdown-item {
    padding: 10px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    color: #c4b5fd;
    transition: background 0.15s, color 0.15s;
    text-align: center;
}

.sp-dropdown-item:hover {
    background: rgba(136, 93, 246, 0.2);
    color: #fff;
}

.sp-dropdown-item.selected {
    background: rgba(136, 93, 246, 0.35);
    color: #fff;
}

.sp-dropdown-item-all {
    font-size: 13px;
    border-top: 1px solid rgba(255,255,255,0.08);
    margin-top: 4px;
    padding-top: 12px;
}

.sp-entity-menu {
    width: 320px;
    min-width: 320px;
    max-width: min(320px, calc(100vw - 24px));
    padding: 8px;
    border-radius: 12px;
    background: #201b3f;
    border: 1px solid rgba(167, 139, 250, 0.08);
}

.sp-entity-menu .sp-entity-option {
    width: 100%;
    min-height: 44px;
    display: grid;
    grid-template-columns: 28px minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: #c4b5fd;
    font: inherit;
    text-align: left;
    appearance: none;
}

.sp-entity-menu .sp-entity-option:hover {
    background: rgba(136, 93, 246, 0.18);
    color: #ffffff;
}

.sp-entity-menu .sp-entity-option.selected {
    background: rgba(34, 197, 94, 0.16);
    color: #22ff66;
}

.sp-entity-option-check,
.sp-entity-option-count {
    justify-self: center;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #c4b5fd;
    background: rgba(18, 15, 43, 0.42);
    color: #c4b5fd;
    box-sizing: border-box;
}

.sp-entity-option-check {
    width: 22px;
    height: 22px;
    border-radius: 6px;
    font-size: 15px;
    font-weight: 800;
    line-height: 1;
}

.sp-entity-option-label {
    min-width: 0;
    overflow: hidden;
    color: inherit;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.2;
    text-overflow: ellipsis;
    text-shadow: none;
    white-space: nowrap;
}

.sp-entity-option-count {
    min-width: 52px;
    height: 28px;
    padding: 0 10px;
    border-radius: 7px;
    font-size: 14px;
    font-weight: 700;
    line-height: 1;
}

.sp-entity-option-count[hidden] {
    display: none !important;
}

.sp-entity-option.selected .sp-entity-option-check,
.sp-entity-option.selected .sp-entity-option-count {
    border-color: #22ff66;
    color: #22ff66;
}

.sp-entity-option.selected .sp-entity-option-check::after {
    content: '✓';
}

.sp-entity-menu .sp-dropdown-item-all {
    margin-top: 8px;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

/* --- Checkbox custom --- */
.sp-checkbox-wrapper {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Primary visualization badge — same visual style as "додаткова візуалізація" button */
.sp-primary-viz-row {
    flex-wrap: wrap;
    gap: 8px;
}
.sp-primary-viz-badge {
    display: inline-flex;
    align-items: center;
    padding: 6px 14px;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 8px;
    color: #e2e8f0;
    font-size: 13px;
    font-weight: 500;
    pointer-events: none;
    white-space: nowrap;
}
.sp-primary-viz-badge[aria-hidden="true"] {
    display: none;
}
.sp-primary-viz-badge[aria-hidden="false"] {
    display: inline-flex;
}

.sp-checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
}

.sp-checkbox {
    display: none;
}

.sp-checkbox-custom {
    width: 20px;
    height: 20px;
    border-radius: 5px;
    border: 2px solid rgba(255,255,255,0.25);
    background: rgba(255,255,255,0.06);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
    position: relative;
}

.sp-checkbox:checked + .sp-checkbox-custom {
    background: #6566F1;
    border-color: #6566F1;
}

.sp-checkbox:checked + .sp-checkbox-custom::after {
    content: '✓';
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    line-height: 1;
}

.sp-checkbox-text {
    color: #e2e8f0;
    font-size: 13px;
    font-weight: 500;
}

.sp-checkbox-label:hover .sp-checkbox-custom {
    border-color: #a855f7;
}

/* --- Help icon (?) --- */
.sp-help-icon {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.2);
    color: #a855f7;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
    padding: 0;
    line-height: 1;
}

.sp-help-icon:hover {
    background: #a855f7;
    color: #fff;
    border-color: #a855f7;
}

/* --- Tooltip --- */
.sp-tooltip {
    position: fixed;
    max-width: 380px;
    padding: 14px 18px;
    background: #1e1b3a;
    color: #e2e8f0;
    border-radius: 10px;
    font-size: 13px;
    line-height: 1.6;
    box-shadow: 0 12px 40px rgba(0,0,0,0.5);
    z-index: 10000;
    display: none;
    pointer-events: none;
    border: 1px solid rgba(136, 93, 246, 0.3);
}

.sp-tooltip.visible {
    display: block;
}

/* --- Additional Visualization words menu --- */
.sp-viz-menu {
    min-width: 328px;
    max-width: min(420px, 96vw);
    padding: 12px;
}

.sp-viz-words-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 10px;
}

.sp-viz-menu-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}

.sp-viz-menu-title {
    color: #eef2ff;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.sp-viz-close-btn {
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 1px solid rgba(255,255,255,0.16);
    border-radius: 999px;
    background: rgba(255,255,255,0.06);
    color: #e2e8f0;
    font-size: 16px;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.sp-viz-close-btn:hover {
    background: rgba(239, 68, 68, 0.12);
    border-color: rgba(239, 68, 68, 0.34);
    transform: scale(1.04);
}

.sp-viz-word-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    row-gap: 6px;
    padding: 6px 8px;
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 10px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.sp-viz-word-row[data-live-state="threshold"],
.rp-refinement-tag[data-live-state="threshold"],
.rp-exclusion-tag[data-live-state="threshold"] {
    border-color: rgba(148, 163, 184, 0.34);
    background: rgba(255,255,255,0.04);
}

.sp-viz-word-row[data-live-state="processing"],
.rp-refinement-tag[data-live-state="processing"],
.rp-exclusion-tag[data-live-state="processing"] {
    border-color: rgba(251, 146, 60, 0.55);
    box-shadow: 0 0 0 1px rgba(251, 146, 60, 0.18), 0 0 18px rgba(251, 146, 60, 0.18);
    background: rgba(251, 146, 60, 0.08);
}

.sp-viz-word-row[data-live-state="ready"],
.rp-refinement-tag[data-live-state="ready"],
.rp-exclusion-tag[data-live-state="ready"] {
    border-color: rgba(52, 211, 153, 0.45);
    background: rgba(52, 211, 153, 0.08);
}

.sp-viz-color-dot {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    flex-shrink: 0;
    border: 2px solid rgba(255,255,255,0.2);
}

.sp-viz-color-picker {
    width: 24px;
    height: 24px;
    padding: 0;
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 4px;
    cursor: pointer;
    background: transparent;
    flex-shrink: 0;
}

.sp-viz-color-picker::-webkit-color-swatch-wrapper { padding: 2px; }
.sp-viz-color-picker::-webkit-color-swatch { border-radius: 3px; border: none; }
.sp-viz-color-picker::-moz-color-swatch { border-radius: 3px; border: none; }

.sp-viz-word-input {
    flex: 1;
    padding: 6px 10px;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 6px;
    color: #e2e8f0;
    font-size: 13px;
    outline: none;
    transition: border-color 0.2s;
}

.sp-viz-word-input:focus {
    border-color: #a855f7;
}

.sp-viz-word-input::placeholder {
    color: #64748b;
}

.sp-input-live-status {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 54px;
    height: 22px;
    padding: 0 8px;
    border-radius: 999px;
    background: rgba(255,255,255,0.08);
    color: #cbd5e1;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.01em;
    white-space: nowrap;
}

.sp-input-live-status[hidden] {
    display: none !important;
}

.sp-viz-word-row[data-live-state="processing"] .sp-input-live-status,
.rp-refinement-tag[data-live-state="processing"] .sp-input-live-status,
.rp-exclusion-tag[data-live-state="processing"] .sp-input-live-status {
    background: rgba(251, 146, 60, 0.18);
    color: #fdba74;
}

.sp-viz-word-row[data-live-state="ready"] .sp-input-live-status,
.rp-refinement-tag[data-live-state="ready"] .sp-input-live-status,
.rp-exclusion-tag[data-live-state="ready"] .sp-input-live-status {
    background: rgba(52, 211, 153, 0.18);
    color: #86efac;
}

/* Панель перемикання для кожного додаткового маркера (як Ctrl+F: N з M + стрілки) */
.sp-viz-marker-nav {
    display: none;
    flex-direction: row;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
    padding-left: 2px;
}

.sp-viz-marker-counter {
    font-size: 12px;
    font-weight: 600;
    color: #cbd5e1;
    white-space: nowrap;
}

.sp-viz-marker-arrows {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 2px;
}

.sp-viz-marker-prev,
.sp-viz-marker-next {
    width: 26px;
    height: 26px;
    padding: 0;
    border: 1px solid rgba(255,255,255,0.22);
    background: rgba(255,255,255,0.07);
    color: #e2e8f0;
    font-size: 10px;
    line-height: 1;
    cursor: pointer;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.sp-viz-marker-prev:hover,
.sp-viz-marker-next:hover {
    background: rgba(255,255,255,0.15);
    color: #e2e8f0;
}

.sp-viz-marker-prev:disabled,
.sp-viz-marker-next:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.sp-viz-count-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    margin-left: auto;
    background: rgba(101,102,241,0.25);
    color: #c4b5fd;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
}

/* Підсвітка кнопки Маркери тільки коли маркери активні (є додані слова) */
.rp-toolbar-shell #vizDropdownBtn.viz-active {
    background: rgba(6, 78, 59, 0.5) !important;
    border-color: rgba(45, 212, 191, 0.42) !important;
    box-shadow: inset 0 0 0 1px rgba(16, 185, 129, 0.12) !important;
}

.sp-viz-remove-btn {
    background: none;
    border: none;
    color: #94a3b8;
    font-size: 18px;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    transition: color 0.2s, background 0.2s;
    line-height: 1;
}

.sp-viz-remove-btn:hover {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
}

.sp-viz-add-btn {
    width: 100%;
    padding: 8px;
    background: rgba(136, 93, 246, 0.15);
    border: 1px dashed rgba(136, 93, 246, 0.4);
    border-radius: 6px;
    color: #a855f7;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.sp-viz-add-btn:hover {
    background: rgba(136, 93, 246, 0.3);
    border-color: #a855f7;
}

.sp-viz-actions-row {
    display: flex;
    gap: 8px;
    align-items: stretch;
    margin-top: 4px;
}
.sp-viz-actions-row .sp-viz-add-btn {
    flex: 1;
    min-width: 0;
    width: auto;
}
.sp-viz-clear-btn {
    flex: 0 0 auto;
    padding: 8px 14px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(148, 163, 184, 0.35);
    border-radius: 6px;
    color: #cbd5e1;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s, color 0.2s;
    white-space: nowrap;
}
.sp-viz-clear-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(148, 163, 184, 0.55);
    color: #f1f5f9;
}

/* --- Row 3: Search location --- */
.sp-location-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    padding: 10px 16px;
    background: rgba(255,255,255,0.04);
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.06);
}

.sp-location-label {
    color: #a855f7;
    font-weight: 600;
    font-size: 13px;
    white-space: nowrap;
    padding: 6px 14px;
    background: rgba(168, 85, 247, 0.1);
    border-radius: 8px;
    border: 1px solid rgba(168, 85, 247, 0.2);
}

.sp-location-tab {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 7px 16px;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.sp-location-tab:hover {
    background: rgba(255,255,255,0.1);
    border-color: rgba(136, 93, 246, 0.3);
}

.sp-location-tab.active {
    background: linear-gradient(135deg, rgba(136, 93, 246, 0.25), rgba(101, 102, 241, 0.25));
    border-color: rgba(136, 93, 246, 0.5);
}
/* Гібридний АІ пошук — точно як Оберіть форму, Врахувати назви, Пошук за реквізитами */
.sp-location-tab#searchModeAI,
.sp-location-tab#searchModeAI.active {
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.12);
    box-shadow: none;
    outline: none;
    min-height: 38px;
    padding: 0 12px;
}
.sp-location-tab#searchModeAI:hover {
    background: rgba(255,255,255,0.1);
    border-color: rgba(136, 93, 246, 0.5);
}
/* Без заднього контуру: внутрішня кнопка прозора, без власної рамки */
.sp-location-tab#searchModeAI .sp-dropdown-btn,
.sp-location-tab#searchModeAI .sp-dropdown-btn:hover,
.sp-location-tab#searchModeAI .sp-dropdown-btn.open {
    background: none;
    border: none;
    box-shadow: none;
    outline: none;
    min-height: auto;
    padding: 0;
}

.sp-location-tab-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.sp-location-checkbox {
    display: none;
}

.sp-location-checkbox-custom {
    width: 18px;
    height: 18px;
    border-radius: 4px;
    border: 2px solid rgba(255,255,255,0.25);
    background: rgba(255,255,255,0.06);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.sp-location-checkbox:checked + .sp-location-checkbox-custom {
    background: #6566F1;
    border-color: #6566F1;
}

.sp-location-checkbox:checked + .sp-location-checkbox-custom::after {
    content: '✓';
    color: #fff;
    font-size: 11px;
    font-weight: 700;
}

.sp-location-tab-text {
    color: #e2e8f0;
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
}

.sp-location-tab-dropdown-wrapper {
    position: relative;
}

.sp-location-tab-dropdown-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 2px;
    display: flex;
    align-items: center;
    color: #a855f7;
}

.sp-location-dropdown {
    right: 0;
    left: auto;
    min-width: 200px;
}

/* Не дефолтні / заповнені параметри пошуку — зелений акцент (як кінцева категорія в категоризаторі) */
.sp-search-param-active {
    border-color: rgba(16, 185, 129, 0.45) !important;
}
#entityDropdownBtn.sp-search-param-active #entityDropdownText,
#categoryDropdownBtn.sp-search-param-active #categoryDropdownText,
#aiSearchModeBtn.sp-search-param-active .sp-location-tab-text,
.sp-location-tab#searchModeRequisites.sp-search-param-active .sp-location-tab-text,
.rp-volume-dropdown-btn.sp-search-param-active span,
.rp-perpage-btn.sp-search-param-active span,
#rpCategoryPanelBtn.sp-search-param-active span,
#rpPpCategorizerFilterBtn.sp-search-param-active span,
#rpToolbarMobileToggle.sp-search-param-active .rp-toolbar-mobile-toggle-label {
    color: #34d399 !important;
    font-weight: 600;
}

/* Параметри корегування ПП — «активний» стан як капсула з темно-бірюзовим тлом (скрін 4) */
.rp-toolbar-shell .rp-volume-dropdown-btn.sp-search-param-active,
.rp-toolbar-shell .rp-perpage-btn.sp-search-param-active,
.rp-toolbar-shell #rpCategoryPanelBtn.sp-search-param-active,
.rp-toolbar-shell #rpPpCategorizerFilterBtn.sp-search-param-active,
.rp-toolbar-shell #rpPpCategorizerFilterBtn.rp-pp-filter-active,
.rp-toolbar-shell #rpToolbarMobileToggle.sp-search-param-active {
    background: rgba(6, 78, 59, 0.5) !important;
    border-color: rgba(45, 212, 191, 0.42) !important;
    box-shadow: inset 0 0 0 1px rgba(16, 185, 129, 0.12);
}

#rpPpCategorizerFilterBtn.rp-pp-filter-active #rpPpCategorizerFilterBtnLabel {
    color: #22ff66 !important;
}

#rpPpCategorizerFilterBtn.rp-pp-filter-active .sp-dropdown-arrow {
    display: none;
}

#rpPpCategorizerFilterBtn.rp-categorizer-dashboard-active {
    background: rgba(49, 46, 129, 0.82) !important;
    border-color: rgba(129, 140, 248, 0.62) !important;
    cursor: default;
}

#rpPpCategorizerFilterBtn.rp-categorizer-dashboard-active #rpPpCategorizerFilterBtnLabel {
    color: #34d399 !important;
}

.rp-pp-categorizer-clear {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    align-self: center;
    width: 24px;
    height: 24px;
    margin-left: 6px;
    padding: 0;
    border-left: 1px solid rgba(148, 163, 184, 0.32);
    color: #22ff66;
    font-size: 20px;
    font-weight: 800;
    line-height: 1;
    cursor: pointer;
}

.rp-pp-categorizer-clear[hidden] {
    display: none !important;
}

.rp-pp-categorizer-clear:hover {
    color: #fff;
}

#rpPpCategorizerFilterBtn.rp-categorizer-filter-disabled {
    opacity: 0.58;
}

/* Модалка «Фільтр категоризатора» — дерево категорій з поточної видачі */
.rp-pp-cat-modal {
    position: fixed;
    --rp-pp-cat-reserved-left: 54px;
    top: 0;
    right: 0;
    bottom: 0;
    left: var(--rp-pp-cat-reserved-left);
    z-index: 11900;
    display: flex;
    align-items: stretch;
    justify-content: center;
    padding: 8px;
    box-sizing: border-box;
}
.rp-pp-cat-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(2px);
}
.rp-pp-cat-modal-panel {
    position: relative;
    z-index: 1;
    width: min(1700px, calc(100% - 16px));
    max-width: calc(100% - 16px);
    min-width: min(100%, 320px);
    height: calc(100dvh - 16px);
    max-height: calc(100dvh - 16px);
    display: block;
    background: #1a1b3a;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 14px;
    box-shadow: 0 24px 48px rgba(0, 0, 0, 0.45);
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-gutter: stable;
}

html:not(.sidebar-state-collapsed) .rp-pp-cat-modal {
    --rp-pp-cat-reserved-left: 276px;
}

body:has(.sidebar-panel.mobile-open) .rp-pp-cat-modal {
    --rp-pp-cat-reserved-left: 260px;
}

@media (max-width: 768px) {
    html:not(.sidebar-state-collapsed) .rp-pp-cat-modal,
    html.sidebar-state-collapsed .rp-pp-cat-modal {
        --rp-pp-cat-reserved-left: 54px;
    }

    body:has(.sidebar-panel.mobile-open) .rp-pp-cat-modal {
        --rp-pp-cat-reserved-left: min(260px, 68vw);
    }
}

@media (max-width: 520px) {
    .rp-pp-cat-modal {
        --rp-pp-cat-reserved-left: 46px;
        padding: 6px;
    }

    .rp-pp-cat-modal-panel {
        width: calc(100% - 6px);
        max-width: calc(100% - 6px);
        height: calc(100dvh - 12px);
        max-height: calc(100dvh - 12px);
    }
}
.rp-pp-cat-modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 18px 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.rp-pp-cat-modal-header h2 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: #f1f5f9;
}
.rp-pp-cat-modal-close {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.06);
    color: #e2e8f0;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
}
.rp-pp-cat-modal-close:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
}
.rp-pp-cat-modal-hint {
    margin: 0;
    padding: 0 18px 12px;
    font-size: 13px;
    line-height: 1.5;
    color: #94a3b8;
}
.rp-pp-cat-tree {
    min-height: 360px;
    max-height: none;
    overflow: visible;
    overflow-x: hidden;
    padding: 10px 18px 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    font-size: 14px;
    color: #e2e8f0;
}
.rp-pp-cat-tree-loading,
.rp-pp-cat-tree-empty {
    margin: 12px 0;
    color: #94a3b8;
    font-size: 14px;
}
/* Як у категоризаторі: ряд = сітка «назва зліва — дії справа», вкладеність через відступ */
.rp-pp-cat-tree-branch {
    margin-left: 0;
}
.rp-pp-cat-tree-branch .rp-pp-cat-tree-branch {
    margin-top: 8px;
    margin-left: 10px;
    padding-left: 12px;
    border-left: 1px solid rgba(129, 140, 248, 0.22);
}
.rp-pp-cat-tree-row {
    display: grid;
    /* minmax(0,1fr) стискав колонку з назвою майже до нуля — довгі рядки ламались по одній літері */
    grid-template-columns: minmax(12rem, 1fr) auto;
    align-items: start;
    column-gap: 10px;
    row-gap: 8px;
    padding: 8px 10px;
    line-height: 1.35;
    background: rgba(15, 23, 42, 0.45);
    border: 1px solid rgba(100, 116, 139, 0.28);
    border-radius: 10px;
    box-sizing: border-box;
    min-width: 0;
}
.rp-pp-cat-tree-row--outside-hits {
    opacity: 0.72;
}
.rp-pp-cat-tree-row--outside-hits .rp-pp-cat-tree-label {
    opacity: 0.85;
}
.rp-pp-cat-tree-row--excluded {
    opacity: 0.62;
}
.rp-pp-cat-tree-row-main {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    min-width: 0;
    max-width: 100%;
}
.rp-pp-cat-tree-row-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 8px;
    flex-shrink: 0;
    max-width: 100%;
}
.rp-pp-cat-tree-row-actions .category-type {
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.rp-pp-cat-tree-row-actions .category-view-articles-btn {
    width: 36px;
    height: 36px;
    min-width: 36px;
    padding: 0;
    margin: 0;
}
/* Кнопки як у дереві категоризатора (нейтральні, не як картки ПП) */
.rp-pp-cat-tree .category-add-to-chat-btn {
    min-height: 36px;
    padding: 7px 12px;
    font-size: 12px;
    font-weight: 700;
    background: rgba(255, 255, 255, 0.06) !important;
    border: 1px solid rgba(129, 140, 248, 0.22) !important;
    color: #cbd5e1 !important;
}
.rp-pp-cat-tree .category-add-to-chat-btn:hover {
    background: rgba(101, 102, 241, 0.2) !important;
    border-color: rgba(129, 140, 248, 0.45) !important;
    color: #fff !important;
}
.rp-pp-cat-tree .category-add-to-chat-btn .rp-cat-card-add-to-chat-icon {
    display: none;
}
.rp-pp-cat-tree .category-add-to-chat-btn .rp-cat-card-add-to-chat-label {
    display: inline;
}
.rp-pp-cat-tree-cb {
    margin-top: 4px;
    flex-shrink: 0;
    accent-color: #34d399;
    cursor: pointer;
}
.rp-pp-cat-tree-label {
    cursor: pointer;
    user-select: none;
    flex: 1;
    min-width: 0;
    font-size: 14px;
    font-weight: 600;
    color: #e2e8f0;
    word-break: normal;
    overflow-wrap: break-word;
}
.rp-pp-cat-tree-label .category-sub-title {
    color: #ff3b30;
    font-weight: 900;
}
.rp-pp-cat-tree-branch[data-depth="0"] .rp-pp-cat-tree-label,
.rp-pp-cat-tree-branch[data-depth="1"] .rp-pp-cat-tree-label {
    font-weight: 800;
    font-size: 13px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #a5b4fc;
}
@media (max-width: 520px) {
    .rp-pp-cat-tree-row {
        grid-template-columns: minmax(0, 1fr);
    }
    .rp-pp-cat-tree-row-main {
        min-width: 0;
    }
    .rp-pp-cat-tree-row-actions {
        justify-content: flex-start;
        width: 100%;
        padding-top: 2px;
        border-top: 1px solid rgba(255, 255, 255, 0.06);
        margin-top: 2px;
    }
    .rp-pp-cat-tree .category-add-to-chat-btn .rp-cat-card-add-to-chat-label {
        display: none;
    }
    .rp-pp-cat-tree .category-add-to-chat-btn .rp-cat-card-add-to-chat-icon {
        display: flex !important;
    }
}
.rp-pp-cat-modal-footer {
    display: flex;
    position: sticky;
    bottom: 0;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: flex-end;
    padding: 12px 18px 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(10, 11, 30, 0.94);
    box-shadow: 0 -12px 24px rgba(0, 0, 0, 0.24);
    z-index: 2;
}
.rp-pp-cat-impact {
    display: grid;
    gap: 12px;
    margin: 0 18px 12px;
    padding: 14px;
    border: 1px solid rgba(45, 212, 191, 0.36);
    border-radius: 8px;
    background: linear-gradient(135deg, rgba(8, 47, 73, 0.72), rgba(30, 27, 75, 0.78));
    box-shadow: 0 14px 28px rgba(0, 0, 0, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.05);
    color: #dbeafe;
}
.rp-pp-cat-impact-title {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}
.rp-pp-cat-impact-title span {
    color: #f8fafc;
    font-size: 15px;
    font-weight: 900;
}
.rp-pp-cat-impact-title em {
    color: #93c5fd;
    font-size: 12px;
    font-style: normal;
    font-weight: 700;
}
.rp-pp-cat-impact-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}
.rp-pp-cat-impact-card {
    min-width: 0;
    padding: 12px;
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 8px;
    background: rgba(15, 23, 42, 0.38);
}
.rp-pp-cat-impact-card span,
.rp-pp-cat-impact-card small {
    display: block;
    color: #a5b4fc;
    font-size: 12px;
    font-weight: 800;
}
.rp-pp-cat-impact-card strong {
    display: block;
    margin: 4px 0;
    color: #34d399;
    font-size: 28px;
    line-height: 1;
    font-weight: 950;
}
.rp-pp-cat-impact-card small {
    color: #94a3b8;
    font-weight: 700;
}
.rp-pp-cat-impact-card--keep {
    border-color: rgba(52, 211, 153, 0.32);
    background: rgba(6, 78, 59, 0.22);
}
.rp-pp-cat-impact-card--drop {
    border-color: rgba(248, 113, 113, 0.42);
    background: rgba(127, 29, 29, 0.22);
}
.rp-pp-cat-impact-card--drop strong {
    color: #f87171;
}
@media (max-width: 720px) {
    .rp-pp-cat-impact-grid {
        grid-template-columns: 1fr;
    }
}
.rp-pp-cat-modal-btn {
    min-width: 120px;
    padding: 10px 16px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid transparent;
}
.rp-pp-cat-modal-btn--secondary {
    background: transparent;
    border-color: rgba(255, 255, 255, 0.2);
    color: #e2e8f0;
}
.rp-pp-cat-modal-btn--secondary:hover {
    background: rgba(255, 255, 255, 0.06);
}
.rp-pp-cat-modal-btn--primary {
    background: linear-gradient(135deg, #059669, #10b981);
    color: #fff;
    border-color: rgba(16, 185, 129, 0.5);
}
.rp-pp-cat-modal-btn--primary:hover {
    filter: brightness(1.06);
}

/* Спільна поверхня з модалкою категоризатора — для мобільних панелей ПП (див. .rp-pp-cat-modal-panel) */
/* #1a1b3a, border rgba(255,255,255,0.1), футер rgba(0,0,0,0.2) */

/* 8. Пошук за реквізитами СР — dropdown form */
.sp-requisites-menu {
    padding: 12px;
    width: 420px;
    min-width: 320px;
    max-width: calc(100vw - 24px);
    right: 0;
    left: auto;
}
.sp-requisites-case-wrapper {
    position: relative;
    margin-bottom: 10px;
}
.sp-requisites-case-wrapper .sp-requisites-input {
    margin-bottom: 0;
}
.sp-requisites-autocomplete {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 2px;
    max-height: 200px;
    overflow-y: auto;
    background: rgba(15, 10, 46, 0.98);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 6px;
    z-index: 1300;
    display: none;
    box-shadow: 0 4px 12px rgba(0,0,0,0.4);
}
.sp-requisites-autocomplete.visible {
    display: block;
}
.sp-req-ac-item {
    padding: 8px 12px;
    font-size: 14px;
    color: #e2e8f0;
    cursor: pointer;
    transition: background 0.15s;
}
.sp-req-ac-item:hover,
.sp-req-ac-item:focus {
    background: rgba(167,139,250,0.2);
    outline: none;
}
.sp-requisites-date-row {
    display: flex;
    gap: 12px;
    margin-bottom: 10px;
}
.sp-requisites-date-field {
    flex: 1;
    min-width: 0;
}
.sp-requisites-label-small {
    display: block;
    font-size: 11px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}
.sp-requisites-date {
    margin-bottom: 0;
}
.sp-requisites-label {
    display: block;
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 6px;
}
.sp-requisites-label.sp-requisites-label--active {
    color: #34d399;
    font-weight: 700;
}
.sp-requisites-input {
    width: 100%;
    padding: 8px 10px;
    margin-bottom: 10px;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 6px;
    color: #e2e8f0;
    font-size: 14px;
    box-sizing: border-box;
}
.sp-requisites-input:focus {
    outline: none;
    border-color: #a855f7;
}
.sp-requisites-input::placeholder {
    color: #64748b;
}
.sp-requisites-actions {
    display: flex;
    gap: 10px;
    margin-top: 12px;
}
.sp-requisites-search-btn {
    flex: 1;
    padding: 8px 14px;
    background: #7c3aed;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}
.sp-requisites-search-btn:hover {
    background: #6d28d9;
}
.sp-requisites-clear-btn {
    padding: 8px 14px;
    background: transparent;
    color: #94a3b8;
    border: 1px solid rgba(148, 163, 184, 0.4);
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
}
.sp-requisites-clear-btn:hover {
    color: #e2e8f0;
    background: rgba(148, 163, 184, 0.15);
}

/* --- Search status (updated) --- */
.search-status {
    margin-top: 4px;
    padding: 6px 16px;
    font-size: 14px;
    color: var(--text-secondary);
    min-height: 20px;
}

/* --- Navigation bar --- */
.sp-nav-bar {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 20px;
    padding: 10px 0;
}

/* --- Responsive --- */
@media (max-width: 900px) {
    .sp-settings-row {
        flex-direction: column;
        gap: 10px;
    }
    .sp-settings-group {
        width: 100%;
    }
    .sp-location-row {
        flex-direction: column;
        align-items: flex-start;
    }
}

@media (max-width: 600px) {
    .sp-panel {
        padding: 12px 10px 10px;
        border-radius: 10px;
    }
    .sp-search-btn {
        padding: 10px 18px;
        font-size: 14px;
    }
    .sp-input {
        font-size: 14px;
    }
    .sp-history-dropdown {
        width: 280px;
        right: -40px;
    }
}

/* Hide old elements that are now replaced */
.search-input-area { display: none !important; }
.search-header.sticky-header { display: none !important; }
.results-area { display: none !important; }

/* ============================================
   RESULTS PANEL (RP) - Панель результатів
   ============================================ */

.rp-panel {
    background: linear-gradient(135deg, #1a1145 0%, #252060 40%, #1e1555 100%);
    border: 1px solid rgba(101,102,241,0.35);
    border-radius: 16px;
    padding: 0;
    padding-left: clamp(12px, 2cm, 96px);
    padding-right: clamp(12px, 2cm, 96px);
    padding-bottom: 24px;
    margin-bottom: 20px;
    box-shadow: 0 8px 32px rgba(30, 17, 69, 0.45);
    overflow: visible;
    position: relative;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

.rp-panel.fullscreen {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 5000;
    border-radius: 0;
    margin: 0;
    overflow-y: auto;
}

#categoryResultsArea.rp-panel.fullscreen {
    display: flex !important;
    width: 100vw;
    max-width: none;
    background: linear-gradient(135deg, #1a1145 0%, #252060 40%, #1e1555 100%);
}

.rp-panel.fullscreen .rp-dashboard-header {
    top: 0;
}

.rp-panel.fullscreen .rp-toolbar-shell {
    top: 50px;
}

/* --- Dashboard header --- */
.rp-dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 16px 20px 10px;
    background: linear-gradient(135deg, #1a1145 0%, #252060 40%, #1e1555 100%);
    border-bottom: none;
    border-radius: 16px 16px 0 0;
    position: relative;
    top: auto;
    z-index: 1;
}

.rp-dashboard-title {
    display: flex;
    align-items: baseline;
    gap: 10px;
    flex-wrap: wrap;
}

/* Маркери справа від блоку кількості результатів */
.rp-dashboard-header .rp-markers-in-header {
    flex-shrink: 0;
    margin-left: auto;
}
.rp-dashboard-header .rp-markers-in-header .sp-dropdown-wrapper {
    position: relative;
}
.rp-dashboard-header .rp-markers-in-header .sp-viz-menu {
    left: auto;
    right: 0;
}
.rp-dashboard-header .rp-markers-in-header #vizDropdownBtn {
    min-height: 42px;
    padding: 10px 18px;
    border-radius: 999px;
    font-size: 15px;
    font-weight: 800;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.12);
}
.rp-dashboard-header .rp-markers-in-header #vizDropdownBtn:hover {
    background: rgba(255,255,255,0.1);
}
.rp-dashboard-header .rp-markers-in-header #vizDropdownBtn:hover:not(.viz-active) {
    border-color: rgba(255,255,255,0.12);
}
.rp-dashboard-header .rp-markers-in-header #vizDropdownBtn.viz-active {
    background: rgba(6, 78, 59, 0.5) !important;
    border-color: rgba(45, 212, 191, 0.42) !important;
    box-shadow: inset 0 0 0 1px rgba(16, 185, 129, 0.12) !important;
}

.rp-toolbar-shell .rp-markers-in-toolbar {
    flex: 0 0 auto;
    position: relative;
    z-index: 6;
}

.rp-toolbar-shell .rp-markers-in-toolbar .sp-dropdown-wrapper {
    position: relative;
}

.rp-toolbar-shell .rp-markers-in-toolbar .sp-viz-menu {
    left: auto;
    right: 0;
}

.rp-title-label {
    color: var(--text-primary);
    font-size: 18px;
    font-weight: 600;
    font-style: normal;
}

.rp-title-count {
    color: #34d399;
    font-size: 20px;
    font-weight: 800;
}

.rp-dashboard-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-left: auto;
}

.rp-toolbar-shell {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    padding: 10px 20px 12px;
    background: rgba(17, 11, 50, 0.98);
    border-top: 1px solid rgba(255,255,255,0.04);
    border-bottom: 1px solid rgba(255,255,255,0.06);
    position: sticky;
    top: 52px;
    z-index: 39;
    overflow: visible;
}

.rp-toolbar-group {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    flex-wrap: wrap;
}

.rp-toolbar-shell .rp-send-to-ai-wrapper {
    margin-left: 0;
    padding-left: 0;
    border-left: none;
}

.rp-toolbar-shell {
    --rp-toolbar-control-height: 46px;
    --rp-toolbar-control-radius: 18px;
}

.rp-toolbar-shell .rp-select-link,
.rp-toolbar-shell .rp-select-sep {
    font-size: 11px;
}

.rp-toolbar-shell .rp-send-to-ai-btn {
    min-height: var(--rp-toolbar-control-height);
    min-width: 260px;
    padding: 0 24px;
    border-radius: var(--rp-toolbar-control-radius);
    font-size: 13px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.rp-toolbar-shell .rp-volume-section {
    gap: 8px;
}

.rp-toolbar-shell .rp-volume-label {
    padding: 5px 10px;
    font-size: 12px;
    border-radius: 999px;
}

.rp-toolbar-shell .rp-volume-dropdown-btn,
.rp-toolbar-shell .rp-perpage-btn,
.rp-toolbar-shell .rp-toolbar-dropdown-btn,
.rp-toolbar-shell #vizDropdownBtn {
    min-height: var(--rp-toolbar-control-height);
    padding: 0 18px;
    border-radius: var(--rp-toolbar-control-radius);
    font-size: 14px;
    font-weight: 700;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.12);
}

.rp-toolbar-shell .rp-selected-fragment-ai-wrap[hidden] {
    display: none !important;
}

.rp-toolbar-shell .rp-selected-fragment-ai-btn {
    min-height: var(--rp-toolbar-control-height);
    padding: 0 18px;
    border-radius: var(--rp-toolbar-control-radius);
    border: 1px solid rgba(45, 212, 191, 0.42);
    background: rgba(6, 78, 59, 0.5);
    color: #d1fae5;
    font-size: 13px;
    font-weight: 800;
    font-family: inherit;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease, opacity 0.2s ease;
}

.rp-toolbar-shell .rp-selected-fragment-ai-btn:hover:not(:disabled) {
    background: rgba(13, 148, 136, 0.45);
    border-color: rgba(94, 234, 212, 0.58);
    transform: translateY(-1px);
}

.rp-toolbar-shell .rp-selected-fragment-ai-btn:disabled {
    cursor: wait;
    opacity: 0.78;
}

.rp-toolbar-shell .rp-selected-fragment-ai-btn.is-running,
.top-nav-btn.top-nav-btn-ai-chat-selected-running {
    background: linear-gradient(90deg, rgba(15, 118, 110, 0.92), rgba(79, 70, 229, 0.9), rgba(15, 118, 110, 0.92)) !important;
    background-size: 220% 100% !important;
    border-color: rgba(94, 234, 212, 0.62) !important;
    color: #ffffff !important;
    box-shadow: 0 0 0 2px rgba(45, 212, 191, 0.16), 0 12px 28px rgba(20, 184, 166, 0.18);
    animation: selected-fragment-ai-progress 1.5s linear infinite;
}

@keyframes selected-fragment-ai-progress {
    from { background-position: 0% 50%; }
    to { background-position: 220% 50%; }
}

.selected-fragment-ai-modal .modal-content {
    max-width: 520px;
    min-height: auto;
}

.selected-fragment-ai-modal .modal-body {
    color: var(--text-secondary, #cbd5e1);
    font-size: 15px;
    line-height: 1.55;
}

.selected-fragment-ai-preview {
    margin: 12px 0 0;
    padding: 12px 14px;
    border-radius: 12px;
    background: rgba(15, 23, 42, 0.4);
    border: 1px solid rgba(148, 163, 184, 0.18);
    color: #e2e8f0;
    font-size: 13px;
    max-height: 120px;
    overflow: auto;
}

.selected-fragment-ai-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 0 20px 20px;
}

.selected-fragment-ai-actions .btn {
    min-width: 110px;
}
.rp-toolbar-shell .rp-volume-dropdown-btn:hover,
.rp-toolbar-shell .rp-perpage-btn:hover,
.rp-toolbar-shell .rp-toolbar-dropdown-btn:hover,
.rp-toolbar-shell #vizDropdownBtn:hover {
    background: rgba(255,255,255,0.1);
}
/* Маркери: без фіолетової рамки при hover, якщо маркери не активні */
.rp-toolbar-shell #vizDropdownBtn:hover:not(.viz-active) {
    border-color: rgba(255,255,255,0.12);
}

#rpFiltersDisplayWrapper {
    display: none !important; /* Приховано: Пошук в межах фільтрів, теги фільтрів */
}
.rp-toolbar-shell .rp-filters-display {
    padding: 0;
    background: transparent;
    border: none;
    border-radius: 0;
    gap: 8px;
}

.rp-toolbar-shell .rp-filters-label {
    font-size: 12px;
}

.rp-toolbar-shell .rp-filters-tags {
    gap: 6px;
}

.rp-toolbar-shell .rp-filter-tag {
    padding: 5px 10px;
    border-radius: 999px;
    font-size: 12px;
}

.rp-toolbar-shell .rp-refinement-section {
    gap: 8px;
}

.rp-toolbar-shell .rp-refinement-label {
    font-size: 12px;
}

.rp-toolbar-shell .rp-refinement-tags,
.rp-toolbar-shell .rp-exclusion-tags {
    gap: 6px;
    min-width: 0;
}

.rp-toolbar-shell .rp-refinement-tag,
.rp-toolbar-shell .rp-exclusion-tag {
    min-height: 40px;
    padding: 7px 14px;
    border-radius: var(--rp-toolbar-control-radius);
}

.rp-toolbar-shell .rp-refinement-tag-input {
    width: 110px;
}

.rp-toolbar-shell .rp-exclusion-tag-input {
    width: 96px;
}

.rp-toolbar-shell .rp-exclusion-section {
    margin-left: 0;
    padding-left: 12px;
}

.rp-toolbar-shell .rp-refinement-add-btn {
    width: 28px;
    height: 28px;
}

.rp-toolbar-shell .rp-refinement-apply-btn {
    min-height: var(--rp-toolbar-control-height);
    padding: 0 18px;
    border-radius: var(--rp-toolbar-control-radius);
    font-size: 13px;
    font-weight: 700;
}

/* Десктоп: обгортка не змінює flex — дочірні групи лишаються в одному ряді .rp-toolbar-shell */
.rp-toolbar-advanced-block {
    display: contents;
}

.rp-toolbar-mobile-toggle {
    display: none;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
    margin: 0;
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid rgba(129, 140, 248, 0.35);
    background: rgba(67, 56, 202, 0.22);
    color: #e2e8f0;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    -webkit-tap-highlight-color: transparent;
}

/* Активний стан зведений до єдиного стилю з кнопкою «Категоризатор» (sp-categorizer-launch-active):
   темний зелений фон + яскраво-зелена назва. Раніше тут був градієнт фіолет→зелений,
   що випадав зі загального дизайну фільтрів. */
.rp-toolbar-mobile-toggle--adjusted {
    background: rgba(6, 78, 59, 0.72) !important;
    border-color: rgba(45, 212, 191, 0.58) !important;
    box-shadow: inset 0 0 0 1px rgba(16, 185, 129, 0.18);
}

.rp-toolbar-mobile-toggle--adjusted .rp-toolbar-mobile-toggle-label {
    color: #22ff66;
    font-weight: 700;
}

/* Хрестик для миттєвого скидання уточнень/виключень — поведінка та стиль як у
   .sp-categorizer-launch-clear (кнопка «Категоризатор»). Видимий тільки коли
   кнопка у стані --adjusted (керується через JS). */
.rp-toolbar-mobile-toggle-clear {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    margin: 0 2px;
    color: #22ff66;
    font-size: 20px;
    font-weight: 800;
    line-height: 1;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.rp-toolbar-mobile-toggle-clear[hidden] {
    display: none !important;
}

.rp-toolbar-mobile-toggle-clear:hover {
    color: #ffffff;
}

.rp-toolbar-mobile-toggle .rp-toolbar-mobile-chevron {
    flex-shrink: 0;
    transition: transform 0.2s ease;
    opacity: 0.9;
}

.rp-toolbar-mobile-toggle[aria-expanded="true"] .rp-toolbar-mobile-chevron {
    transform: rotate(180deg);
}

/* Десктоп: ручка шиту прихована, внутрішній скрол «прозорий» для flex */
.rp-toolbar-sheet-handle {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    margin: 0;
    padding: 12px 14px;
    border: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px 16px 0 0;
    background: linear-gradient(180deg, rgba(40, 32, 95, 0.98), rgba(22, 16, 58, 0.99));
    color: #e2e8f0;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    -webkit-tap-highlight-color: transparent;
    flex-shrink: 0;
}

.rp-toolbar-sheet-handle--adjusted {
    background: linear-gradient(135deg, rgba(109, 40, 217, 0.98), rgba(34, 197, 94, 0.94));
}

.rp-toolbar-sheet-handle-chevron {
    transition: transform 0.25s ease;
    opacity: 0.9;
}

.rp-toolbar-shell.rp-toolbar-sheet--open .rp-toolbar-sheet-handle-chevron {
    transform: rotate(180deg);
}

.rp-toolbar-sheet-scroll {
    display: contents;
}

.rp-fullscreen-btn {
    padding: 8px 20px;
    background: linear-gradient(135deg, #885DF6, #6566F1);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.rp-fullscreen-btn:hover {
    filter: brightness(1.15);
    box-shadow: 0 4px 16px rgba(136, 93, 246, 0.4);
}

/* --- Refinement row --- */
.rp-refinement-row {
    padding: 12px 20px;
    background: rgba(26, 17, 69, 0.95);
    border: 1px solid rgba(101,102,241,0.25);
    border-bottom: 1px solid rgba(255,255,255,0.06);
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    position: sticky;
    top: 130px;
    z-index: 38;
}

.rp-refinement-section {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.rp-refinement-label {
    color: #a855f7;
    font-weight: 700;
    font-size: 14px;
    white-space: nowrap;
}
.rp-refinement-section--active .rp-refinement-label {
    color: #34d399;
}

.rp-refinement-tags {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    flex: 1;
    min-width: 200px;
}

.rp-refinement-tag {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    background: linear-gradient(135deg, rgba(136,93,246,0.25), rgba(101,102,241,0.3));
    border: 1px solid rgba(136,93,246,0.4);
    border-radius: 20px;
    color: #e2e8f0;
    font-size: 13px;
    font-weight: 500;
}

.rp-refinement-tag-input {
    background: transparent;
    border: none;
    outline: none;
    color: #e2e8f0;
    font-size: 13px;
    width: 160px;
    min-width: 80px;
    flex: 1 1 auto;
}

.rp-refinement-tag-input::placeholder {
    color: #818cf8;
    opacity: 0.7;
}

.rp-refinement-tag-remove {
    background: none;
    border: none;
    color: #c084fc;
    cursor: pointer;
    font-size: 16px;
    padding: 0 2px;
    line-height: 1;
    transition: color 0.2s;
}

.rp-refinement-tag-remove:hover {
    color: #ef4444;
}

.rp-refinement-apply-btn {
    padding: 7px 20px;
    background: linear-gradient(135deg, #885DF6, #6566F1);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.rp-refinement-apply-btn:hover:not(:disabled) {
    filter: brightness(1.15);
}

.rp-refinement-apply-btn:disabled {
    opacity: 0.65;
    cursor: not-allowed;
    filter: grayscale(0.6);
    background: rgba(100, 100, 120, 0.5) !important;
    color: #94a3b8 !important;
    border: 1px solid rgba(255,255,255,0.1);
}

.rp-refinement-apply-btn--ready:not(:disabled) {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.88), rgba(109, 40, 217, 0.92)) !important;
    color: #f8fafc !important;
    border: 1px solid rgba(167, 243, 208, 0.35);
    box-shadow: 0 4px 14px rgba(16, 185, 129, 0.18);
}

.rp-refinement-add-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #885DF6, #6566F1);
    border: none;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.rp-refinement-add-btn:hover {
    filter: brightness(1.15);
    transform: scale(1.1);
}

/* --- Exclusion tags --- */
.rp-exclusion-section {
    margin-left: 16px;
    padding-left: 16px;
    border-left: 1px solid rgba(255,255,255,0.1);
}

.rp-exclusion-label {
    color: #f87171 !important;
}

.rp-exclusion-tags {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    flex: 1;
    min-width: 150px;
}

.rp-exclusion-tag {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    background: linear-gradient(135deg, rgba(239,68,68,0.2), rgba(220,38,38,0.25));
    border: 1px solid rgba(239,68,68,0.4);
    border-radius: 20px;
    color: #fca5a5;
    font-size: 13px;
    font-weight: 500;
}

.rp-exclusion-tag-input {
    background: transparent;
    border: none;
    outline: none;
    color: #fca5a5;
    font-size: 13px;
    width: 130px;
    min-width: 80px;
}

.rp-exclusion-tag-input::placeholder {
    color: #f87171;
    opacity: 0.6;
}

.rp-exclusion-tag-remove {
    background: none;
    border: none;
    color: #f87171;
    cursor: pointer;
    font-size: 16px;
    padding: 0 2px;
    line-height: 1;
    transition: color 0.2s;
}

.rp-exclusion-tag-remove:hover {
    color: #ef4444;
}

.rp-exclusion-add-btn {
    background: linear-gradient(135deg, #ef4444, #dc2626) !important;
}

/* Add (+) buttons inactive until user has entered value in a field */
.rp-refinement-add-btn.rp-add-btn-inactive,
.rp-exclusion-add-btn.rp-add-btn-inactive {
    opacity: 0.5;
    filter: grayscale(0.7);
    background: rgba(100, 100, 120, 0.4) !important;
    color: #94a3b8 !important;
    cursor: default;
    pointer-events: none;
}

/* --- Volume row --- */
.rp-volume-row {
    padding: 12px 24px;
    background: rgba(26, 17, 69, 0.3);
    border: 1px solid rgba(101,102,241,0.2);
    border-bottom: 1px solid rgba(255,255,255,0.06);
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    position: sticky;
    top: 144px;
    z-index: 38;
}

.rp-send-to-ai-in-volume {
    margin-left: 8px;
    padding-left: 16px;
    border-left: 1px solid rgba(255,255,255,0.1);
}

.rp-volume-section {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.rp-volume-label {
    color: #c4b5fd;
    font-weight: 600;
    font-size: 13px;
    padding: 6px 16px;
    background: rgba(136,93,246,0.12);
    border: 1px solid rgba(136,93,246,0.3);
    border-radius: 8px;
    white-space: nowrap;
}

.rp-volume-controls {
    display: flex;
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid rgba(101,102,241,0.4);
}

.rp-volume-btn {
    padding: 6px 14px;
    background: rgba(101,102,241,0.25);
    color: #818cf8;
    border: none;
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    line-height: 1;
}

.rp-volume-btn:hover {
    background: rgba(101,102,241,0.45);
    color: #fff;
}

.rp-volume-minus { border-right: 1px solid rgba(101,102,241,0.3); }

.rp-volume-dropdown-wrapper {
    position: relative;
    overflow: visible;
}

.rp-volume-dropdown-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 16px;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 8px;
    color: #e2e8f0;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.rp-volume-dropdown-btn:hover {
    background: rgba(255,255,255,0.1);
}

.rp-volume-menu {
    top: calc(100% + 4px);
    bottom: auto;
    min-width: 180px;
    z-index: 500;
}

/* --- Results list with optional density strip --- */
.rp-results-list-wrapper {
    display: flex;
    align-items: stretch;
    gap: 6px;
    flex: 1;
    min-height: 0;
    overflow: hidden;
    position: relative;
}

/* Бічна панель маркерів — на повну висоту до кінця контейнера */
.rp-results-list-wrapper .sp-marker-density-window {
    height: auto;
    max-height: none;
    position: absolute;
    top: 12px;
    right: 8px;
    bottom: 14px;
    align-self: auto;
    z-index: 6;
    pointer-events: none;
}

.rp-results-list-wrapper .rp-results-list {
    flex: 1;
    overflow-y: auto;
    padding-right: 42px;
}

/* --- 5.4 Marker density window (бічна панель маркерів) --- */
/* Ширша та більша панель з видимими кнопками навігації +/− */
.sp-marker-density-window {
    width: 18px;
    min-width: 18px;
    flex-shrink: 0;
    align-self: stretch;
    min-height: 0;
    background: transparent;
    border: none;
    border-radius: 0;
    box-shadow: none;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    overflow: visible;
}

.sp-marker-density-titlebar,
.sp-marker-density-word-select,
.sp-marker-density-nav {
    opacity: 1;
    pointer-events: auto;
    white-space: normal;
    overflow: visible;
    clip-path: none;
}

.sp-marker-density-hint {
    display: none !important;
}

.sp-marker-density-titlebar {
    position: fixed;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    width: min(360px, calc(100vw - 28px));
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0;
    padding: 8px 122px 8px 8px;
    background: rgba(32, 33, 36, 0.98);
    border: 1px solid rgba(95, 99, 104, 0.95);
    border-radius: 10px;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.36);
    z-index: 7000;
}

.sp-marker-density-word-select {
    display: none !important;
}

.sp-marker-density-nav {
    position: fixed;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    width: min(360px, calc(100vw - 28px));
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 2px;
    padding: 0 46px 0 0;
    border: none;
    background: transparent;
    box-shadow: none;
    z-index: 7001;
    pointer-events: none;
}

.sp-marker-density-title {
    display: flex;
    align-items: center;
    width: 100%;
    height: 100%;
    padding: 0 12px;
    background: rgba(17, 17, 17, 0.98);
    border: 1px solid rgba(17, 17, 17, 0.98);
    border-radius: 7px;
    font-size: 14px;
    font-weight: 500;
    color: #f1f3f4;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sp-marker-density-close {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 34px;
    height: 34px;
    padding: 0;
    border: none;
    background: transparent;
    color: #e8eaed;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    border-radius: 6px;
    z-index: 7002;
}

.sp-marker-density-close:hover {
    background: rgba(255,255,255,0.08);
    color: #fff;
}

.sp-marker-density-word-dropdown {
    width: 100%;
    max-width: 100%;
    padding: 8px 10px;
    font-size: 13px;
    font-weight: 600;
    background: rgba(255,255,255,0.07);
    color: #e5e7ff;
    border: 1px solid rgba(129, 140, 248, 0.28);
    border-radius: 10px;
    cursor: pointer;
}

.sp-marker-nav-prev,
.sp-marker-nav-next {
    width: 28px;
    height: 28px;
    min-width: 28px;
    min-height: 28px;
    flex-shrink: 0;
    padding: 0;
    border: none;
    background: transparent;
    color: #e8eaed;
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    border-radius: 4px;
    pointer-events: auto;
}

.sp-marker-nav-prev:hover,
.sp-marker-nav-next:hover {
    background: rgba(255,255,255,0.08);
    color: #fff;
}

.sp-marker-nav-prev:disabled,
.sp-marker-nav-next:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.sp-marker-nav-counter {
    min-width: 56px;
    font-size: 13px;
    font-weight: 500;
    color: #e8eaed;
    text-align: center;
    margin-right: 8px;
    pointer-events: none;
}

.sp-marker-nav-prev {
    border-left: 1px solid rgba(95, 99, 104, 0.95);
    padding-left: 8px;
    border-radius: 0;
}

.sp-marker-nav-prev svg,
.sp-marker-nav-next svg {
    display: block;
    margin: 0 auto;
}

/* Смуга не скролиться разом з ПП — весь контент масштабовано вміщується */
.sp-marker-density-body {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 12px;
    padding: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow: hidden;
    justify-content: stretch;
    pointer-events: auto;
    /* Висота = видима область #resultsList (як доріжка системного скролбара) */
    box-sizing: border-box;
}

.sp-marker-density-strip {
    width: 12px;
    max-width: 12px;
    min-height: 0;
    background: rgba(122, 102, 255, 0.12);
    border: none;
    border-radius: 999px;
    position: relative;
    flex: 1 1 auto;
    box-shadow: inset 0 0 0 1px rgba(129, 140, 248, 0.18);
}

.sp-marker-density-strip .density-line {
    position: absolute;
    left: 0;
    right: 0;
    height: 2px;
    min-height: 4px;
    border-radius: 999px;
    pointer-events: auto;
    z-index: 3;
}

.sp-marker-density-strip .density-line:hover {
    filter: brightness(1.2);
}

/* Прямокутник видимої області на смузі — навігація скролом (перетягування) */
.sp-marker-density-viewport-thumb {
    touch-action: none;
    position: absolute;
    left: 0;
    right: 0;
    min-height: 12px;
    background: rgba(100, 120, 255, 0.16);
    border: 1px solid rgba(100, 120, 255, 0.6);
    border-radius: 999px;
    pointer-events: auto;
    cursor: grab;
    z-index: 2;
    box-sizing: border-box;
}

.sp-marker-density-viewport-thumb:active {
    cursor: grabbing;
}

.rp-results-list-wrapper .sp-marker-density-window {
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 8;
}

.rp-results-list-wrapper .rp-results-list {
    padding-right: 34px;
}

.sp-marker-density-window {
    width: 14px;
    min-width: 14px;
    align-items: stretch;
}

.sp-marker-density-titlebar,
.sp-marker-density-word-select,
.sp-marker-density-nav {
    display: none !important;
}

.sp-marker-density-body {
    inset: 0;
    width: 14px;
    height: 100%;
}

.sp-marker-density-strip {
    height: 100%;
    min-height: 100%;
    align-self: stretch;
}

/* Що виділено в тексті: помітна підсвітка по центру екрану */
.rp-card-content mark.marker-scroll-highlight {
    animation: markerScrollPulse 2s ease-out;
}

mark.marker-scroll-highlight,
.rp-card-title mark.marker-scroll-highlight,
.rp-card-content mark.marker-scroll-highlight {
    color: #ffffff !important;
    -webkit-text-fill-color: #ffffff;
}

@keyframes markerScrollPulse {
    0%, 100% { box-shadow: none; background-color: inherit; color: inherit; }
    15%, 85% { box-shadow: 0 0 0 4px rgba(56, 189, 248, 0.55); background-color: #172554 !important; color: #fff !important; }
    50% { box-shadow: 0 0 0 6px rgba(56, 189, 248, 0.38); background-color: #1d4ed8 !important; color: #fff !important; }
}

/* Де виділено: підсвітка відповідного сегмента на смузі маркерів */
.sp-marker-density-strip .density-line.density-line-active {
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.9);
    filter: brightness(1.4);
    z-index: 3;
    animation: densityLineActivePulse 2s ease-out;
}

@keyframes densityLineActivePulse {
    0%, 100% { box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.6); }
    50% { box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.9); }
}

/* --- Results list --- */
/* Порожній стан пошуку ПП */
.rp-empty-state {
    text-align: center;
    padding: 40px 20px 48px;
    color: #94a3b8;
}
.rp-empty-state-title {
    color: #cbd5e1;
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 10px;
}
.rp-empty-state-hint {
    margin: 0;
    font-size: 14px;
    line-height: 1.5;
    color: #64748b;
    max-width: 420px;
    margin-left: auto;
    margin-right: auto;
}

.rp-results-list {
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    scrollbar-width: auto;
    scrollbar-color: rgba(148, 163, 184, 0.55) rgba(15, 23, 42, 0.35);
}

.rp-results-list::-webkit-scrollbar {
    width: 12px;
}

.rp-results-list::-webkit-scrollbar-track {
    background: rgba(15, 23, 42, 0.35);
    border-radius: 8px;
}

.rp-results-list::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, rgba(148, 163, 184, 0.55), rgba(100, 116, 139, 0.65));
    border-radius: 8px;
    border: 3px solid transparent;
    background-clip: padding-box;
}

.rp-results-list::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, rgba(203, 213, 225, 0.75), rgba(148, 163, 184, 0.85));
    border: 3px solid transparent;
    background-clip: padding-box;
}

/* --- PP Card --- */
.rp-card {
    background: rgba(26, 17, 69, 0.5);
    border: 1px solid rgba(101,102,241,0.35);
    border-top: 3px solid rgba(96, 165, 250, 0.5);
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.25s;
    margin-bottom: 12px;
    box-shadow: 0 0 0 1px rgba(129, 140, 248, 0.08), 0 12px 28px rgba(7, 10, 34, 0.26);
}

.rp-card:hover {
    border-color: rgba(136,93,246,0.3);
    box-shadow: 0 4px 20px rgba(136,93,246,0.15);
}

/* PP Card header (name panel) */
.rp-card-header {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 12px 16px;
    background: rgba(0,0,0,0.12);
    border-bottom: 1px solid rgba(255,255,255,0.06);
}

/* Top row inside header: rank, badges, actions */
.rp-card-header-top {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.rp-card-checkbox-wrap {
    display: flex;
    align-items: center;
    cursor: pointer;
    flex-shrink: 0;
}

.rp-card-checkbox {
    width: 18px;
    height: 18px;
    accent-color: #6566F1;
    cursor: pointer;
}

/* Relevance percentage badge */
.rp-card-relevance {
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.3px;
    white-space: nowrap;
    flex-shrink: 0;
    line-height: 1.4;
}

.rp-card-relevance.high {
    background: rgba(16, 185, 129, 0.18);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.35);
}

.rp-card-relevance.medium {
    background: rgba(245, 158, 11, 0.18);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.35);
}

.rp-card-relevance.low {
    background: rgba(239, 68, 68, 0.18);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.35);
}

.rp-card-rank {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6566F1, #885DF6);
    color: #fff;
    font-weight: 700;
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.rp-card-date {
    padding: 3px 10px;
    background: rgba(16,185,129,0.15);
    border: 1px solid rgba(16,185,129,0.3);
    border-radius: 6px;
    color: #34d399;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    flex-shrink: 0;
}

.rp-card-case-number {
    padding: 3px 10px;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 6px;
    color: #e2e8f0;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    flex-shrink: 0;
}

.rp-card-title {
    width: 100%;
    color: #e2e8f0;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.5;
    word-wrap: break-word;
    word-break: break-word;
    overflow-wrap: break-word;
    white-space: normal;
    display: block;
    min-height: 1.5em;
    overflow: visible;
    text-overflow: clip;
    max-height: none;
    -webkit-line-clamp: unset;
    -webkit-box-orient: initial;
}

.rp-card-title mark {
    background: #FFF942;
    color: #000;
    padding: 1px 4px;
    border-radius: 3px;
}

/* Court decision type — single badge with hierarchy coloring (п.7.2.5)
   Колегія (lowest):    ККС ВС / КАС ВС / КЦС ВС / КГС ВС — neutral
   Об'єднана палата:    ОП ККС ВС / ОП КАС ВС / etc.       — purple
   Велика палата (top):  ВП ВС                                — gold */
.rp-card-court-type {
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
    letter-spacing: 0.3px;
    flex-shrink: 0;
}

/* Колегія суддів — default (e.g. "ККС ВС", "КАС ВС") */
.rp-card-court-type.court-kolegiya {
    background: rgba(100, 116, 139, 0.2);
    border: 1px solid rgba(100, 116, 139, 0.4);
    color: #cbd5e1;
}

/* Об'єднана палата — purple (e.g. "ОП ККС ВС") */
.rp-card-court-type.court-op {
    background: rgba(139, 92, 246, 0.2);
    border: 1px solid rgba(139, 92, 246, 0.5);
    color: #a78bfa;
}

/* Велика палата — gold (e.g. "ВП ВС") */
.rp-card-court-type.court-vp {
    background: rgba(245, 158, 11, 0.2);
    border: 1px solid rgba(245, 158, 11, 0.5);
    color: #fbbf24;
}

.rp-card-link {
    color: #34d399;
    font-size: 12px;
    text-decoration: none;
    text-align: right;
    padding: 0;
    border: none;
    background: transparent;
    transition: color 0.2s ease;
    word-break: break-all;
    display: inline-flex;
    align-self: flex-end;
    max-width: 100%;
}

.rp-card-link:hover {
    color: #6ee7b7;
    text-decoration: underline;
}

/* Card actions (copy, bookmark, download, share) */
.rp-card-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-left: auto;
    flex-shrink: 0;
}

.rp-card-action-btn {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.1);
    color: #94a3b8;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    padding: 0;
}

.rp-card-action-btn:hover {
    background: rgba(136,93,246,0.2);
    border-color: rgba(136,93,246,0.4);
    color: #c4b5fd;
}

.rp-card-action-btn.active {
    background: rgba(250,204,21,0.15);
    border-color: rgba(250,204,21,0.4);
    color: #fbbf24;
}

/* PP Content panel */
.rp-card-content {
    padding: 14px 16px;
    color: #cbd5e1;
    font-size: 14px;
    line-height: 1.72;
    word-wrap: break-word;
    transition: max-height 0.3s ease;
    user-select: text;
    -webkit-user-select: text;
    cursor: text;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}

/* Expanded state for full PP content */
.rp-card-content.pp-expanded {
    border-left: 3px solid rgba(var(--accent-rgb, 88,86,214), 0.4);
    padding-left: 15px;
    max-height: none !important;
}

/* "Читати детальніше" / "Згорнути" button on PP cards */
.rp-card-expand-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(var(--accent-rgb, 88,86,214), 0.08);
    border: 1px solid rgba(var(--accent-rgb, 88,86,214), 0.2);
    color: var(--accent, #7c6ef6);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    padding: 5px 14px;
    margin: 0 16px 10px 16px;
    border-radius: 6px;
    transition: all 0.2s;
}
.rp-card-expand-btn:hover {
    background: rgba(var(--accent-rgb, 88,86,214), 0.18);
    border-color: rgba(var(--accent-rgb, 88,86,214), 0.4);
}
.rp-card-expand-btn:disabled {
    opacity: 0.6;
    cursor: wait;
}

.rp-card-content mark,
.rp-card-content mark.highlight-word {
    background: #FFF942;
    color: #000;
    padding: 1px 4px;
    border-radius: 3px;
    font-weight: 600;
}

.rp-card-title mark,
.rp-card-content mark,
mark.highlight-match {
    -webkit-box-decoration-break: clone;
    box-decoration-break: clone;
}

/* PP Categories panel — компактний стиль як у AI чаті */
.rp-card-categories {
    padding: 8px 12px;
    margin: 0 16px 10px;
    border: 1px solid rgba(129, 140, 248, 0.3);
    border-radius: 10px;
    background: rgba(49, 46, 129, 0.22);
}

.rp-card-categories-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 4px;
}

.rp-card-categories-header--compact {
    justify-content: flex-end;
}

.rp-card-categories-title-wrap {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
}

.rp-card-categories-title-wrap--compact {
    min-height: 28px;
}
.rp-card-categories-title {
    display: none;
}
.rp-card-cat-title-arrow {
    margin-left: 2px;
    font-size: 10px;
    color: #94a3b8;
    font-weight: 400;
}

.rp-card-categories-actions {
    display: flex;
    gap: 6px;
    align-items: center;
}

.rp-card-categories-actions--compact {
    justify-content: flex-end;
    margin-left: auto;
}

.rp-card-cat-btn {
    padding: 4px 10px;
    min-height: 28px;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.16);
    border-radius: 8px;
    color: #dbeafe;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.18s ease;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.rp-card-cat-btn:hover {
    background: rgba(255,255,255,0.1);
    border-color: rgba(255,255,255,0.26);
    color: #e2e8f0;
}

.rp-card-cat-path {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
    column-gap: 8px;
    row-gap: 6px;
    padding: 5px 8px;
    background: rgba(15, 23, 42, 0.28);
    border: 1px solid rgba(148, 163, 184, 0.14);
    border-radius: 8px;
    margin-bottom: 4px;
    cursor: pointer;
    transition: background 0.15s;
}

.rp-card-cat-path:hover {
    background: rgba(255,255,255,0.05);
}

.rp-card-cat-path:last-child {
    margin-bottom: 0;
}

.rp-card-cat-badge {
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
    max-width: 100%;
}

.rp-card-cat-badge.root { background: rgba(30,27,75,0.9); color: #e2e8f0; border: 1px solid rgba(255,255,255,0.12); }
.rp-card-cat-badge.article { background: rgba(30,27,75,0.9); color: #e2e8f0; border: 1px solid rgba(255,255,255,0.12); }
.rp-card-cat-badge.middle { background: rgba(45,27,105,0.9); color: #e2e8f0; border: 1px solid rgba(101,102,241,0.3); }
.rp-card-cat-badge.last { 
    background: rgba(45,27,105,0.95); 
    color: #e2e8f0; 
    border: 1px solid rgba(101,102,241,0.4);
    cursor: pointer;
    transition: all 0.2s ease;
}

.rp-card-cat-badge.last:hover {
    background: rgba(101,102,241,0.4);
    color: #fff;
    border-color: rgba(101,102,241,0.6);
    transform: scale(1.12);
    box-shadow: 0 3px 12px rgba(101,102,241,0.35);
    z-index: 2;
}

.rp-card-cat-sep {
    color: #475569;
    font-size: 10px;
}

.rp-card-cat-path-badges {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: flex-start;
    align-content: flex-start;
    gap: 6px;
    flex-wrap: wrap;
}

.rp-card-cat-path-badges .rp-card-cat-badge.middle,
.rp-card-cat-path-badges .rp-card-cat-badge.last {
    white-space: normal;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.rp-card-cat-add-to-chat-btn {
    flex-shrink: 0;
    width: 40px;
    height: 32px;
    min-width: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    margin-left: 0;
    justify-self: end;
    align-self: flex-start;
    background: rgba(101, 102, 241, 0.15);
    border: 1px solid rgba(101, 102, 241, 0.3);
    border-radius: 6px;
    color: #a5b4fc;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}
.rp-card-cat-add-to-chat-btn:hover {
    background: rgba(101, 102, 241, 0.25);
    color: #c4b5fd;
}

.rp-card-cat-add-all-to-chat-btn {
    width: 40px;
    height: 32px;
    min-width: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    background: rgba(101, 102, 241, 0.15);
    border: 1px solid rgba(101, 102, 241, 0.3);
    border-radius: 6px;
    color: #a5b4fc;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}
.rp-card-cat-add-all-to-chat-btn:hover {
    background: rgba(101, 102, 241, 0.25);
    color: #c4b5fd;
}

/* Згорнутий стан — мінімальна висота як у AI чату */
.rp-card-categories.collapsed .rp-card-cat-path,
.rp-card-categories.collapsed .rp-card-cat-more {
    display: none;
}
.rp-card-categories.collapsed {
    padding: 6px 10px;
    margin: 0 16px 10px;
}

.rp-card-categories.collapsed .rp-card-categories-header {
    margin-bottom: 0;
}

.rp-card-categories.collapsed .rp-card-categories-title-wrap,
.rp-card-categories.collapsed .rp-card-categories-actions {
    gap: 6px;
}

.rp-card-categories.collapsed .rp-card-categories-title {
    font-size: 12px;
}

.rp-card-categories.collapsed .rp-card-cat-btn {
    padding: 3px 8px;
    min-height: 24px;
    font-size: 11px;
}

.rp-card-ai-annotation {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin: 0 16px 10px;
    padding: 10px 12px;
    border: 1px solid rgba(16, 185, 129, 0.32);
    border-radius: 8px;
    background: rgba(16, 185, 129, 0.08);
}

.rp-card-ai-annotation--compact {
    margin: 10px 0 0;
}

.rp-card-ai-annotation-main {
    flex: 1;
    min-width: 0;
    display: grid;
    gap: 7px;
    color: #e5e7eb;
    font-size: 12px;
    line-height: 1.45;
}

.rp-card-ai-annotation-subject {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 6px 10px;
}

.rp-card-ai-annotation-subject strong {
    color: #f8fafc;
    font-size: 13px;
}

.rp-card-ai-annotation-main b {
    color: #22c55e;
}

.rp-card-ai-annotation-main span {
    overflow-wrap: anywhere;
}

.rp-card-ai-annotation-main em {
    color: #a7f3d0;
    font-style: normal;
    overflow-wrap: anywhere;
}

.rp-card-ai-annotation-btn {
    flex-shrink: 0;
    min-height: 32px;
    padding: 7px 12px;
    border-radius: 8px;
    border: 1px solid rgba(16, 185, 129, 0.45);
    background: rgba(15, 118, 110, 0.26);
    color: #6ee7b7;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
}

.rp-card-ai-annotation-btn:hover {
    background: rgba(16, 185, 129, 0.2);
    color: #d1fae5;
}

.court-ai-modal-open {
    overflow: hidden;
}

.court-ai-modal {
    position: fixed;
    inset: 0;
    z-index: 12500;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.court-ai-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(6, 4, 18, 0.82);
    backdrop-filter: blur(4px);
}

.court-ai-modal-panel {
    position: relative;
    z-index: 1;
    width: min(1120px, 100%);
    max-height: min(92vh, 920px);
    display: flex;
    flex-direction: column;
    border: 1px solid rgba(129, 140, 248, 0.28);
    border-radius: 12px;
    background: #111033;
    color: #e5e7eb;
    box-shadow: 0 28px 80px rgba(0, 0, 0, 0.55);
    overflow: hidden;
}

.court-ai-modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    padding: 20px 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.03);
}

.court-ai-modal-header h2 {
    margin: 0 0 6px;
    font-size: 24px;
    color: #f8fafc;
}

.court-ai-modal-header p {
    margin: 0;
    color: #cbd5e1;
    line-height: 1.45;
}

.court-ai-modal-close {
    width: 38px;
    height: 38px;
    border: 0;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.35);
    color: #e2e8f0;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
}

.court-ai-modal-body {
    padding: 20px 24px 24px;
    overflow-y: auto;
}

.court-ai-modal-link {
    display: block;
    margin-bottom: 14px;
    padding: 10px 12px;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.24);
    color: #34d399;
    text-align: right;
    overflow-wrap: anywhere;
}

.court-ai-modal-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 14px;
}

.court-ai-modal-meta span {
    padding: 5px 10px;
    border-radius: 7px;
    background: rgba(255, 255, 255, 0.07);
    color: #cbd5e1;
    font-size: 12px;
    font-weight: 700;
}

.court-ai-modal-section {
    margin-bottom: 14px;
    padding: 16px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.04);
}

.court-ai-modal-section h3 {
    margin: 0 0 12px;
    color: #e5e7eb;
    font-size: 18px;
}

.court-ai-modal-section p {
    margin: 0;
    color: #cbd5e1;
    line-height: 1.7;
    overflow-wrap: anywhere;
}

.court-ai-modal-subjects {
    display: grid;
    gap: 12px;
}

.court-ai-modal-subject {
    padding: 12px;
    border-radius: 8px;
    background: rgba(20, 184, 166, 0.08);
    border: 1px solid rgba(20, 184, 166, 0.22);
}

.court-ai-modal-subject h4 {
    margin: 0 0 10px;
    color: #f8fafc;
    font-size: 16px;
}

.court-ai-modal-subject dl {
    margin: 0;
    display: grid;
    gap: 8px;
}

.court-ai-modal-subject dl div {
    display: grid;
    grid-template-columns: minmax(100px, 160px) minmax(0, 1fr);
    gap: 12px;
}

.court-ai-modal-subject dt {
    color: #22c55e;
    font-weight: 700;
}

.court-ai-modal-subject dd {
    margin: 0;
    color: #e5e7eb;
    overflow-wrap: anywhere;
}

body.similar-pp-modal-open {
    overflow: hidden;
    scrollbar-gutter: stable;
}

.similar-pp-modal {
    position: fixed;
    inset: 0;
    z-index: 12600;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.similar-pp-modal[hidden] {
    display: none !important;
}

.similar-pp-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(6, 4, 22, 0.78);
    backdrop-filter: blur(10px);
}

.similar-pp-modal-panel {
    position: relative;
    z-index: 1;
    width: min(1480px, calc(100vw - 32px));
    height: min(92vh, 980px);
    max-height: calc(100vh - 32px);
    display: flex;
    flex-direction: column;
    background: rgba(15, 10, 46, 0.98);
    border: 1px solid rgba(129, 140, 248, 0.28);
    border-radius: 14px;
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.48);
    overflow: hidden;
}

.similar-pp-modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 18px 22px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.similar-pp-modal-heading {
    min-width: 0;
}

.similar-pp-modal-heading h2 {
    margin: 0;
    font-size: 20px;
    color: #f8fafc;
}

.similar-pp-modal-heading p {
    margin: 6px 0 0;
    max-width: 920px;
    color: #94a3b8;
    font-size: 13px;
    line-height: 1.45;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.similar-pp-modal-toolbar {
    display: grid;
    grid-template-columns: minmax(420px, 1fr) auto minmax(260px, 340px);
    align-items: center;
    gap: 12px;
    padding: 12px 22px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(22, 16, 63, 0.72);
}

.similar-pp-mode-switch {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    min-height: 38px;
    padding: 3px;
    border: 1px solid rgba(56, 189, 248, 0.55);
    border-radius: 8px;
    background: rgba(7, 6, 35, 0.72);
}

.similar-pp-mode-btn {
    min-width: 0;
    min-height: 32px;
    padding: 0 14px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: #dbeafe;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.15;
    cursor: pointer;
    transition: background 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}

.similar-pp-mode-btn.is-active {
    background: linear-gradient(135deg, rgba(45, 212, 191, 0.28), rgba(101, 102, 241, 0.62));
    color: #ffffff;
    box-shadow: inset 0 0 0 1px rgba(199, 210, 254, 0.26);
}

.similar-pp-mode-btn:hover {
    color: #ffffff;
    background: rgba(101, 102, 241, 0.24);
}

.similar-pp-viz-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 38px;
    padding: 0 12px;
    border: 1px solid rgba(148, 163, 184, 0.22);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.06);
    color: #e2e8f0;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}

.similar-pp-viz-toggle input {
    width: 16px;
    height: 16px;
    accent-color: #14b8a6;
}

.similar-pp-markers-panel {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 8px;
    min-height: 38px;
    padding: 0 10px;
    border: 1px solid rgba(56, 189, 248, 0.25);
    border-radius: 8px;
    background: rgba(14, 165, 233, 0.08);
}

.similar-pp-markers-label {
    color: #7dd3fc;
    font-size: 12px;
    font-weight: 800;
}

.similar-pp-marker-input {
    min-width: 0;
    width: 100%;
    height: 30px;
    padding: 0 10px;
    border: 1px solid rgba(125, 211, 252, 0.26);
    border-radius: 7px;
    background: rgba(8, 13, 35, 0.86);
    color: #f8fafc;
    font-size: 12px;
    outline: none;
}

.similar-pp-marker-input:focus {
    border-color: rgba(45, 212, 191, 0.7);
    box-shadow: 0 0 0 2px rgba(45, 212, 191, 0.12);
}

.similar-pp-modal-close {
    width: 34px;
    height: 34px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.06);
    color: #cbd5e1;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
}

.similar-pp-modal-close:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: rgba(248, 113, 113, 0.45);
    color: #fecaca;
}

.similar-pp-modal-body {
    flex: 1 1 auto;
    min-height: 0;
    padding: 18px 22px 22px;
    overflow-y: auto;
}

.similar-pp-modal-status {
    min-height: 20px;
    margin-bottom: 12px;
    color: #7dd3fc;
    font-size: 13px;
    font-weight: 700;
}

.similar-pp-modal-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-height: 260px;
}

.similar-pp-modal-list--loading {
    justify-content: flex-start;
}

.similar-pp-skeleton-card {
    min-height: 132px;
    padding: 18px 20px;
    border: 1px solid rgba(99, 102, 241, 0.32);
    border-radius: 10px;
    background: linear-gradient(180deg, rgba(31, 24, 86, 0.92), rgba(20, 15, 55, 0.92));
    box-shadow: inset 0 0 0 1px rgba(125, 211, 252, 0.06);
}

.similar-pp-skeleton-row {
    height: 14px;
    margin-top: 14px;
    border-radius: 999px;
    background: linear-gradient(90deg, rgba(148, 163, 184, 0.14), rgba(125, 211, 252, 0.26), rgba(148, 163, 184, 0.14));
    background-size: 220% 100%;
    animation: similarPpSkeleton 1.35s ease-in-out infinite;
}

.similar-pp-skeleton-row--top {
    width: 30%;
    margin-top: 0;
}

.similar-pp-skeleton-row--title {
    width: 62%;
    height: 18px;
}

.similar-pp-skeleton-row--short {
    width: 42%;
}

@keyframes similarPpSkeleton {
    0% { background-position: 120% 0; }
    100% { background-position: -120% 0; }
}

.similar-pp-modal-list .rp-card {
    margin: 0;
}

.similar-pp-modal-empty {
    padding: 28px 18px;
    border: 1px dashed rgba(148, 163, 184, 0.32);
    border-radius: 10px;
    color: #cbd5e1;
    text-align: center;
}

@media (max-width: 768px) {
    .similar-pp-modal {
        padding: 10px;
    }

    .similar-pp-modal-panel {
        width: 100%;
        height: calc(100dvh - 20px);
        max-height: calc(100dvh - 20px);
        border-radius: 12px;
    }

    .similar-pp-modal-header,
    .similar-pp-modal-body {
        padding-inline: 14px;
    }

    .similar-pp-modal-toolbar {
        grid-template-columns: 1fr;
        padding-inline: 14px;
    }

    .similar-pp-mode-switch {
        grid-template-columns: 1fr;
    }

    .similar-pp-viz-toggle {
        justify-content: flex-start;
        white-space: normal;
    }

    .similar-pp-modal-heading p {
        white-space: normal;
    }
}

/* PP Criteria / footer panel */
.rp-card-footer {
    display: none;
}

.rp-card-found-by {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    padding: 6px 12px;
    background: rgba(136,93,246,0.08);
    border: 1px solid rgba(136,93,246,0.2);
    border-radius: 8px;
    flex: 1;
}

.rp-card-found-by-label {
    color: var(--primary-color);
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.rp-card-found-word {
    padding: 2px 10px;
    background: rgba(101,102,241,0.2);
    border: 1px solid rgba(101,102,241,0.35);
    border-radius: 12px;
    color: #c4b5fd;
    font-size: 12px;
    font-weight: 500;
}

.rp-card-match-info {
    padding: 4px 10px;
    font-size: 11px;
    border-radius: 6px;
    background: rgba(0,0,0,0.15);
}

.rp-card-match-info .match-name { color: #34d399; }
.rp-card-match-info .match-content { color: #38bdf8; }
.rp-card-match-info .match-category { color: #fbbf24; }

.rp-card-entity-badge {
    padding: 6px 16px;
    background: linear-gradient(135deg, #06b6d4, #3b82f6);
    color: #fff;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 700;
    margin-left: auto;
    white-space: nowrap;
}

/* --- Bottom bar (fixed to bottom of viewport) --- */
.rp-bottom-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 24px;
    background: rgba(10, 10, 30, 0.97);
    border-top: 1px solid rgba(255,255,255,0.12);
    flex-wrap: wrap;
    position: fixed;
    bottom: 0;
    left: 200px; /* sidebar width */
    right: 0;
    z-index: 100;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    box-shadow: 0 -4px 20px rgba(0,0,0,0.4);
    transition: left 0.3s ease;
}
/* When sidebar is collapsed, bar spans full width */
.main-layout.sidebar-collapsed .rp-bottom-bar,
body:has(.sidebar-panel.collapsed) .rp-bottom-bar {
    left: 0;
}

.rp-perpage-wrapper {
    position: relative;
    overflow: visible;
}

.rp-perpage-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(136,93,246,0.3);
    border-radius: 999px;
    color: #c4b5fd;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.rp-perpage-btn:hover {
    background: rgba(255,255,255,0.1);
}

.rp-perpage-menu {
    top: calc(100% + 4px);
    bottom: auto;
    min-width: 100px;
    z-index: 500;
}

.rp-category-panel-menu {
    top: calc(100% + 4px);
    bottom: auto;
    min-width: 220px;
    z-index: 500;
}

.rp-category-panel-menu.show {
    display: block !important;
}

.rp-category-panel-wrapper {
    position: relative;
    overflow: visible;
}

.sp-dropdown-divider {
    height: 1px;
    background: rgba(255,255,255,0.1);
    margin: 6px 12px;
}

.rp-card-cat-more {
    font-size: 11px;
    color: #a78bfa;
    padding: 3px 8px;
    margin-top: 2px;
    margin-bottom: 2px;
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 2px;
}
.rp-card-cat-more:hover {
    color: #c4b5fd;
}

.rp-card-cat-path-hidden {
    display: none !important;
}

/* View tabs */
.rp-view-tabs {
    display: flex;
    align-items: center;
    gap: 0;
    background: rgba(101,102,241,0.15);
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid rgba(101,102,241,0.3);
    position: relative;
}

.rp-view-tab {
    padding: 8px 20px;
    color: #94a3b8;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.rp-view-tab:hover {
    color: #e2e8f0;
    background: rgba(255,255,255,0.05);
}

.rp-view-tab.active {
    background: #2563eb;
    color: #fff;
}

.rp-view-tabs-label {
    padding: 0 12px;
    color: #64748b;
    font-size: 12px;
    white-space: nowrap;
}

/* Filters display */
.rp-filters-display {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 16px;
    background: rgba(0,0,0,0.15);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 10px;
    flex-wrap: wrap;
}

.rp-filters-label {
    color: #a855f7;
    font-weight: 700;
    font-size: 13px;
    white-space: nowrap;
}

.rp-filters-tags {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.rp-filter-tag {
    padding: 4px 14px;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(136,93,246,0.3);
    border-radius: 6px;
    color: #e2e8f0;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
}

.rp-filter-tag.empty {
    border-style: dashed;
    color: #475569;
}

/* Не дефолтні параметри у рядку «Пошук в межах фільтрів» */
.rp-filter-tag--active {
    color: #34d399;
    border-color: rgba(16, 185, 129, 0.45);
    background: rgba(16, 185, 129, 0.08);
}

.rp-filter-editable {
    cursor: pointer;
    transition: all 0.2s;
}

.rp-filter-editable:hover {
    background: rgba(136,93,246,0.15);
    border-color: rgba(136,93,246,0.5);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(136,93,246,0.2);
}

@keyframes filterPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(136,93,246,0); }
    50% { box-shadow: 0 0 0 8px rgba(136,93,246,0.3); }
}

.filter-highlight-pulse {
    animation: filterPulse 0.75s ease 2;
}

/* --- Category Results Panel --- */
.rp-category-panel .rp-dashboard-header {
    flex-direction: column;
    gap: 14px;
    align-items: stretch;
}

.rp-cat-dashboard {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

/* Обгортка блоків під чекбоксом: на десктопі не ламає flex (діти як раніше в одному ряді) */
.rp-cat-dashboard-collapsible {
    display: contents;
}

.rp-cat-dashboard-mobile-toggle {
    display: none;
    align-items: center;
    gap: 10px;
    width: 100%;
    min-height: 48px;
    padding: 10px 14px;
    margin: 0;
    border-radius: 12px;
    border: 1px solid rgba(129, 140, 248, 0.35);
    background: rgba(67, 56, 120, 0.55);
    color: #e2e8f0;
    font: inherit;
    text-align: left;
    cursor: pointer;
    box-sizing: border-box;
}

.rp-cat-dashboard-mobile-toggle-title {
    flex: 0 0 auto;
    font-size: 15px;
    font-weight: 700;
    color: #f1f5f9;
}

.rp-cat-dashboard-mobile-summary {
    flex: 1 1 auto;
    min-width: 0;
    font-size: 12px;
    line-height: 1.35;
    color: #cbd5e1;
}

.rp-cat-dashboard-mobile-toggle-chevron {
    flex: 0 0 auto;
    width: 10px;
    height: 10px;
    border-right: 2px solid #a5b4fc;
    border-bottom: 2px solid #a5b4fc;
    transform: rotate(45deg);
    margin-top: -4px;
    transition: transform 0.2s ease;
}

.rp-cat-dash-add-to-chat-icon {
    display: none;
}

.rp-cat-dashboard.is-collapsed .rp-cat-dashboard-mobile-toggle-chevron {
    transform: rotate(-135deg);
    margin-top: 4px;
}

.rp-cat-stat {
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.rp-cat-stat-label {
    color: var(--text-secondary);
    font-size: 20px;
    font-weight: 600;
    font-style: normal;
}

.rp-cat-stat-value {
    color: #34d399;
    font-size: 24px;
    font-weight: 800;
}

.rp-cat-show-pp-btn {
    padding: 8px 20px;
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.rp-cat-show-pp-btn:hover:not(:disabled) {
    filter: brightness(1.15);
}

.rp-cat-show-pp-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.rp-cat-view-tabs {
    align-self: flex-end;
}

/* Список категорій: світлий фон, рядки з тонким темним роздільником (має бути — скріншот 1) */
.rp-category-results-list {
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0;
    background: #fff;
    border-radius: 0 0 12px 12px;
    overflow: hidden;
}

/* Category card — білий рядок, тонка темна лінія знизу */
.rp-cat-card {
    background: #fff;
    border: none;
    border-bottom: 1px solid #cbd5e1;
    border-radius: 0;
    padding: 14px 18px;
    transition: background 0.2s;
    position: relative;
    cursor: pointer;
}

.rp-cat-card:last-child {
    border-bottom: none;
}

.rp-cat-card:hover {
    background: #f1f5f9;
}

.rp-cat-card.expanded {
    background: #f8fafc;
    border-bottom-color: #cbd5e1;
}

.rp-cat-card-header {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Три блоки: блок 1 і 3 фіксовані, блок 2 гнучкий (текст переноситься) */
.rp-cat-card-block1 {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}
.rp-cat-card-block2 {
    flex: 1;
    min-width: 0;
}
.rp-cat-card-block3 {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.rp-cat-card-add-to-chat-btn {
    padding: 6px 14px;
    background: #4f46e5;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
    transition: all 0.2s;
}
.rp-cat-card-add-to-chat-btn:hover {
    background: #4338ca;
}

.rp-cat-card-checkbox {
    width: 26px;
    height: 26px;
    border-radius: 6px;
    border: 2px solid #cbd5e1;
    background: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.rp-cat-card-checkbox.checked {
    background: #10b981;
    border-color: #10b981;
}

.rp-cat-card-checkbox.checked::after {
    content: '✓';
    color: #fff;
    font-size: 15px;
    font-weight: 700;
}

.rp-cat-card-rank {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #e0e7ff;
    color: #4f46e5;
    font-weight: 700;
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.rp-cat-card-name {
    flex: 1;
    color: #1e293b;
    font-size: 15px;
    font-weight: 600;
    min-width: 0;
    white-space: normal;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.rp-cat-card-pp-count {
    padding: 4px 12px;
    background: #e0e7ff;
    border-radius: 6px;
    color: #4f46e5;
    font-size: 14px;
    font-weight: 700;
    white-space: nowrap;
    flex-shrink: 0;
}

/* Світло-синій квадрат з V (шеврон) справа — як на скріншоті 1 */
.rp-cat-card-expand-toggle {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: #93c5fd;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: transform 0.2s, background 0.2s;
    color: #fff;
}

.rp-cat-card-expand-toggle:hover {
    background: #60a5fa;
}

.rp-cat-card-expand-toggle.expanded {
    background: #3b82f6;
    color: #fff;
    transform: rotate(180deg);
}

.rp-cat-card-viewpp-btn {
    width: 36px;
    min-width: 36px;
    height: 36px;
    padding: 0;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    color: #475569;
    border-radius: 10px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.2s;
}

.rp-cat-card-viewpp-btn:hover {
    background: #e2e8f0;
    border-color: #cbd5e1;
    color: #1e293b;
    transform: translateY(-1px);
}

.rp-cat-card-entity {
    padding: 6px 16px;
    background: #e0e7ff;
    color: #4f46e5;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
    flex-shrink: 0;
}

/* --- Expandable paths area --- */
.rp-cat-card-paths-area {
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid #e2e8f0;
}

.rp-cat-card-path-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
}
.rp-cat-card-path-row .rp-cat-card-path { flex: 1; margin-bottom: 0; }

.rp-cat-card-paths-badge {
    display: inline-block;
    margin-left: 8px;
    padding: 1px 8px;
    background: rgba(101,102,241,0.15);
    color: #a78bfa;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    vertical-align: middle;
}

.rp-cat-card-path {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
    padding: 8px 12px;
    background: #f1f5f9;
    border-radius: 8px;
    margin-bottom: 6px;
    font-size: 13px;
    line-height: 1.6;
}

.rp-cat-card-path.expanded .rp-card-cat-badge.middle,
.rp-cat-card-path.expanded .rp-card-cat-sep {
    display: inline;
}

/* При розкритті шляху — повний текст вміщається (перенос, без обрізання) */
.rp-cat-card-path.expanded .rp-card-cat-badge {
    white-space: normal;
    word-break: break-word;
    max-width: 100%;
}
.rp-cat-card-path.expanded .rp-cat-path-dots {
    display: none !important;
}
.rp-cat-card-path.expanded [id^="path_"] {
    display: inline !important;
}

.rp-cat-path-dots {
    cursor: pointer;
    background: rgba(101,102,241,0.2) !important;
    border: 1px solid rgba(101,102,241,0.3) !important;
    color: #a78bfa !important;
    font-weight: 600 !important;
}

.rp-cat-path-dots:hover {
    background: rgba(101,102,241,0.35) !important;
}

.rp-cat-card-bottom-actions {
    display: flex;
    gap: 8px;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #e2e8f0;
}

.rp-cat-card-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.rp-cat-card-action {
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid transparent;
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.rp-cat-card-action.primary {
    background: #2563eb;
    color: #fff;
}

.rp-cat-card-action.primary:hover {
    filter: brightness(1.15);
}

.rp-cat-card-action.secondary {
    background: rgba(255,255,255,0.06);
    color: #94a3b8;
    border-color: rgba(255,255,255,0.12);
}

.rp-cat-card-action.secondary:hover {
    background: rgba(255,255,255,0.1);
    color: #e2e8f0;
}

/* Responsive */
@media (max-width: 768px) {
    .rp-dashboard-header { padding: 12px 16px; }
    .rp-title-label { font-size: 18px; }
    .rp-title-count { font-size: 22px; }
    .rp-refinement-row, .rp-volume-row { padding: 10px 16px; }
    .rp-card-header { padding: 10px 14px; }
    .rp-card-content { padding: 12px 14px; }
    .rp-bottom-bar { flex-direction: column; align-items: stretch; padding: 12px 16px; }
    .rp-cat-dashboard { flex-direction: column; gap: 10px; }
    .rp-cat-stat-label { font-size: 16px; }
}

/* Dialog Area */
/* Hide old dialog-area class */
.dialog-area { display: none !important; }

/* Приховано з усіх сторінок: панель «Історія діалогу в чаті» */
#dialogArea.dialog-panel {
    display: none !important;
}

/* Приховано з усіх сторінок: форма «Пошук категорій з GPT фільтрацією» */
#categorySearchArea.category-search-area {
    display: none !important;
}

/* ============================================
   DIALOG PANEL - Dark themed chat
   ============================================ */
.dialog-panel {
    background: linear-gradient(135deg, #1a1145 0%, #201860 50%, #1a1145 100%);
    border-radius: 16px;
    margin-bottom: 20px;
    box-shadow: 0 8px 32px rgba(30, 17, 69, 0.35);
    overflow: hidden;
    max-height: 600px;
    min-height: 200px;
    display: flex;
    flex-direction: column;
    width: 100%;
}

.dialog-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 20px;
    background: rgba(0,0,0,0.15);
    border-bottom: 1px solid rgba(255,255,255,0.06);
}

.dialog-panel-title {
    color: #e2e8f0;
    font-size: 16px;
    font-weight: 600;
    margin: 0;
}

.dialog-panel-close {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.1);
    color: #ef4444;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.dialog-panel-close:hover {
    background: rgba(239,68,68,0.15);
    border-color: rgba(239,68,68,0.3);
}

.dialog-panel-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.dialog-panel-messages::-webkit-scrollbar {
    width: 6px;
}
.dialog-panel-messages::-webkit-scrollbar-track {
    background: transparent;
}
.dialog-panel-messages::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.1);
    border-radius: 3px;
}

/* Chat message bubbles */
.message {
    display: flex;
    gap: 12px;
    animation: fadeIn 0.3s ease-in;
}

.message.user {
    flex-direction: row-reverse;
}

.message-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    flex-shrink: 0;
    font-size: 14px;
}

.message.user .message-avatar {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
}

.message.assistant .message-avatar {
    background: linear-gradient(135deg, #06b6d4, #0891b2);
    color: white;
}

.message-content {
    flex: 1;
    max-width: 85%;
}

.message-bubble {
    padding: 12px 16px;
    border-radius: var(--radius);
    background: rgba(255,255,255,0.06);
    color: #e2e8f0;
    border: 1px solid rgba(255,255,255,0.06);
    font-size: 14px;
    line-height: 1.6;
}

.message.user .message-bubble {
    background: rgba(16,185,129,0.1);
    border-color: rgba(16,185,129,0.2);
}

.message.assistant .message-bubble {
    background: rgba(6,182,212,0.08);
    border-color: rgba(6,182,212,0.15);
}

.message.user .message-bubble {
    background: var(--primary-color);
    color: white;
}

.message-time {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* Results Area */
.results-area {
    background: var(--surface-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow);
}

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--border-color);
    flex-wrap: wrap;
    gap: 12px;
}

.results-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
}

.results-meta {
    display: flex;
    gap: 12px;
    align-items: center;
}

.results-count {
    color: var(--text-secondary);
    font-size: 14px;
}

.relevance-badge {
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.relevance-badge.high {
    background: #d1fae5;
    color: #065f46;
}

.relevance-badge.medium {
    background: #fef3c7;
    color: #92400e;
}

.relevance-badge.low {
    background: #fee2e2;
    color: #991b1b;
}

/* Explanation Box - оптимізована висота */
.explanation-box {
    background: #f0f9ff;
    border-left: 4px solid var(--primary-color);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 20px;
}

.explanation-header h3 {
    font-size: 16px;
    margin-bottom: 8px;
    color: var(--text-primary);
    font-weight: 600;
}

.explanation-content {
    color: var(--text-primary);
    line-height: 1.8;
}

/* Key Matches - оптимізована висота */
.key-matches-box {
    margin-bottom: 20px;
    padding: 12px;
    background: var(--bg-color);
    border-radius: var(--radius);
}

.key-matches-box h4 {
    font-size: 14px;
    margin-bottom: 8px;
    color: var(--text-primary);
    font-weight: 600;
}

.key-matches-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.key-match-tag {
    padding: 6px 12px;
    background: var(--primary-color);
    color: white;
    border-radius: 16px;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
    cursor: default;
}

.key-match-tag:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
}

/* Первинні (найважливіші) ключові збіги */
.key-match-tag.primary {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    box-shadow: 0 2px 4px rgba(37, 99, 235, 0.2);
}

/* Вторинні ключові збіги */
.key-match-tag.secondary {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    opacity: 0.9;
}

/* "Ще X" бейдж */
.key-match-tag.more {
    background: #e5e7eb;
    color: #4b5563;
    font-weight: 600;
}

/* Results List */
.results-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Анімація появи карток */
@keyframes cardSlideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.result-item {
    animation: cardSlideIn 0.4s ease forwards;
}

.result-item:nth-child(1) { animation-delay: 0.05s; }
.result-item:nth-child(2) { animation-delay: 0.1s; }
.result-item:nth-child(3) { animation-delay: 0.15s; }
.result-item:nth-child(4) { animation-delay: 0.2s; }
.result-item:nth-child(5) { animation-delay: 0.25s; }
.result-item:nth-child(6) { animation-delay: 0.3s; }
.result-item:nth-child(7) { animation-delay: 0.35s; }
.result-item:nth-child(8) { animation-delay: 0.4s; }
.result-item:nth-child(9) { animation-delay: 0.45s; }
.result-item:nth-child(10) { animation-delay: 0.5s; }

/* ============================================
   ПОКРАЩЕНІ КАРТКИ РЕЗУЛЬТАТІВ ПОШУКУ
   ============================================ */

.result-item {
    background: var(--surface-color);
    border-radius: var(--radius-lg);
    padding: 0;
    border: 1px solid var(--border-color);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.result-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: linear-gradient(180deg, var(--primary-color), #818cf8);
    opacity: 0;
    transition: opacity 0.25s;
}

.result-item:hover {
    border-color: var(--primary-color);
    box-shadow: 0 12px 35px -8px rgba(37, 99, 235, 0.2), 
                0 6px 15px -6px rgba(37, 99, 235, 0.15);
    transform: translateY(-3px);
}

.result-item:hover::before {
    opacity: 1;
}

.result-item:hover .result-rank {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4);
}

.result-item:hover .result-title {
    color: var(--primary-color);
}

.result-rank {
    transition: all 0.25s ease;
}

/* Results Controls (Pagination) */
.results-controls {
    margin-top: 24px;
    padding: 16px;
    background: var(--surface-color);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border-top: 2px solid var(--border-color);
}

.pagination-info {
    text-align: center;
    margin-bottom: 12px;
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 500;
}

.results-actions {
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
}

.results-actions .btn {
    min-width: 180px;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 500;
    border-radius: var(--radius);
    transition: all 0.2s;
    cursor: pointer;
    border: 2px solid transparent;
}

.results-actions .btn-primary {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.results-actions .btn-primary:hover:not(:disabled) {
    background: var(--primary-hover);
    border-color: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(37, 99, 235, 0.3);
}

.results-actions .btn-secondary {
    background: var(--surface-color);
    color: var(--primary-color);
    border-color: var(--primary-color);
}

.results-actions .btn-secondary:hover:not(:disabled) {
    background: var(--primary-color);
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(37, 99, 235, 0.3);
}

.results-actions .btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* --- HEADER КАРТКИ --- */
.result-header {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 18px 20px;
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 50%, #f1f5f9 100%);
    border-bottom: 1px solid var(--border-color);
    position: relative;
}

.result-rank {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-color);
    color: white;
    font-weight: 700;
    font-size: 14px;
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
}

.result-title-wrapper {
    flex: 1;
    min-width: 0;
}

.result-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    transition: color 0.2s ease;
}

.result-title mark,
.result-title .highlight-match {
    background: linear-gradient(120deg, #fef08a 0%, #fde047 100%);
    color: #78350f;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 700;
    box-shadow: 0 1px 3px rgba(250, 204, 21, 0.3);
}

.result-meta-right {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Індикатор релевантності */
.relevance-indicator {
    position: relative;
    width: 60px;
    height: 28px;
    background: #e2e8f0;
    border-radius: 14px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.relevance-bar {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    transition: width 0.5s ease;
}

.relevance-indicator.high .relevance-bar {
    background: linear-gradient(90deg, #10b981, #34d399);
    animation: relevancePulseHigh 1.5s ease-in-out infinite;
}

.relevance-indicator.medium .relevance-bar {
    background: linear-gradient(90deg, #f59e0b, #fbbf24);
}

.relevance-indicator.low .relevance-bar {
    background: linear-gradient(90deg, #94a3b8, #cbd5e1);
}

@keyframes relevancePulseHigh {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

.relevance-text {
    position: relative;
    z-index: 1;
    font-size: 11px;
    font-weight: 700;
    color: var(--text-primary);
}

.result-date {
    font-size: 12px;
    color: var(--text-secondary);
    white-space: nowrap;
}

.result-type-badge {
    padding: 4px 10px;
    background: var(--primary-color);
    color: white;
    font-size: 11px;
    font-weight: 600;
    border-radius: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* --- КАТЕГОРІЇ (BREADCRUMB) --- */
.result-categories-row {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 12px 20px;
    background: linear-gradient(135deg, #fefce8 0%, #fef9c3 100%);
    border-bottom: 1px solid #fef08a;
    font-size: 13px;
    max-height: 200px;
    overflow-y: auto;
}

.result-categories-row::-webkit-scrollbar {
    width: 6px;
}

.result-categories-row::-webkit-scrollbar-track {
    background: #fef3c7;
    border-radius: 3px;
}

.result-categories-row::-webkit-scrollbar-thumb {
    background: #fcd34d;
    border-radius: 3px;
}

.result-categories-row::-webkit-scrollbar-thumb:hover {
    background: #f59e0b;
}

.category-path-item {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.85);
    border-radius: 8px;
    border: 1px solid #fde68a;
    flex-shrink: 1;
    min-width: 0;
    width: 100%;
    margin-bottom: 6px;
}

.category-separator {
    color: #d97706;
    font-weight: 600;
    margin: 0 2px;
}

.category-breadcrumb {
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 12px;
    transition: all 0.2s ease;
    cursor: pointer;
    /* Дозволяємо перенос тексту */
    word-break: break-word;
    line-height: 1.3;
}

.category-breadcrumb:hover {
    transform: scale(1.01);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.category-breadcrumb.root {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    color: #92400e;
    font-weight: 700;
    border: 1px solid #fcd34d;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.category-breadcrumb.last {
    background: linear-gradient(135deg, #dcfce7 0%, #bbf7d0 100%);
    color: #166534;
    font-weight: 600;
    border: 1px solid #86efac;
}

/* Стаття в шляху категорій */
.category-breadcrumb.article {
    background: linear-gradient(135deg, #fce7f3 0%, #fbcfe8 100%);
    color: #9d174d;
    font-weight: 600;
    border: 1px solid #f9a8d4;
}

/* Передкінцева категорія (синя) */
.category-breadcrumb.pre-last {
    background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
    color: #1e40af;
    font-weight: 600;
    border: 1px solid #93c5fd;
}

.category-breadcrumb-separator {
    color: #d97706;
    font-weight: 700;
    font-size: 18px;
    margin: 0 2px;
}

/* Роздільник у шляху категорій */
.category-separator {
    color: #9ca3af;
    font-weight: 400;
    font-size: 12px;
    margin: 0 4px;
}

.category-path-item:last-child {
    margin-bottom: 0;
}

/* Бейдж "ще X категорій" */
.category-more-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    background: #e5e7eb;
    color: #4b5563;
    font-size: 11px;
    font-weight: 600;
    border-radius: 12px;
    margin-left: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.category-more-badge:hover {
    background: var(--primary-color);
    color: white;
}

.result-item:hover .category-breadcrumb {
    transform: translateY(-1px);
}

/* Підсвічування категорій де є збіг з пошуковим запитом */
.category-breadcrumb.has-match {
    box-shadow: 0 0 0 2px rgba(250, 204, 21, 0.6), 0 2px 8px rgba(250, 204, 21, 0.4);
    animation: categoryMatchPulse 2s ease-in-out infinite;
}

.category-breadcrumb.root.has-match {
    background: linear-gradient(135deg, #fef08a 0%, #fde047 100%);
    border-color: #facc15;
}

.category-breadcrumb.last.has-match {
    background: linear-gradient(135deg, #bbf7d0 0%, #86efac 100%);
    box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.5), 0 2px 8px rgba(34, 197, 94, 0.3);
}

.category-breadcrumb.pre-last.has-match {
    background: linear-gradient(135deg, #bfdbfe 0%, #93c5fd 100%);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.5), 0 2px 8px rgba(59, 130, 246, 0.3);
}

/* Підсвічування mark тегів всередині категорій */
.category-breadcrumb mark,
.category-breadcrumb .highlight-match {
    background: rgba(250, 204, 21, 0.5);
    padding: 1px 3px;
    border-radius: 3px;
    font-weight: 700;
}

@keyframes categoryMatchPulse {
    0%, 100% {
        box-shadow: 0 0 0 2px rgba(250, 204, 21, 0.6), 0 2px 8px rgba(250, 204, 21, 0.4);
    }
    50% {
        box-shadow: 0 0 0 3px rgba(250, 204, 21, 0.8), 0 4px 12px rgba(250, 204, 21, 0.6);
    }
}

/* --- КЛІКАБЕЛЬНІ КАТЕГОРІЇ --- */
.category-breadcrumb.clickable {
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.category-breadcrumb.clickable:hover {
    background: var(--success-color) !important;
    color: white !important;
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.4);
    border-color: var(--success-color) !important;
}

.category-path-item.clickable-path {
    cursor: pointer;
    transition: all 0.2s ease;
    border-radius: 6px;
    padding: 4px 6px;
    margin: -4px -6px;
}

.category-path-item.clickable-path:hover {
    background: rgba(37, 99, 235, 0.08);
}

.category-path-item.clickable-path:hover .category-separator {
    color: var(--primary-color);
}

/* Іконка стрілки при наведенні на кінцеву категорію */
.category-breadcrumb.last.clickable::after {
    content: ' →';
    opacity: 0;
    transition: opacity 0.2s;
    font-size: 12px;
}

.category-breadcrumb.last.clickable:hover::after {
    opacity: 1;
}

/* --- ОПИС (ПОВНИЙ ТЕКСТ) --- */
.result-description-wrapper {
    padding: 16px 20px;
}

.result-description {
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.8;
    word-wrap: break-word;
    overflow-wrap: break-word;
    white-space: pre-wrap;
}

/* Повний текст - розгорнутий стан */
.result-description.expandable.expanded {
    max-height: none;
}

/* Повний текст - згорнутий стан */
.result-description.expandable.collapsed {
    max-height: 150px;
    overflow: hidden;
    position: relative;
}

.result-description.expandable.collapsed::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: linear-gradient(transparent, var(--surface-color));
    pointer-events: none;
}

/* Кнопка згортання/розгортання */
.description-toggle-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 10px 16px;
    margin-top: 12px;
    background: var(--bg-color);
    border: 1px dashed var(--border-color);
    border-radius: var(--radius);
    color: var(--primary-color);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.description-toggle-btn:hover {
    background: var(--primary-color);
    color: white;
    border-style: solid;
    border-color: var(--primary-color);
}

.description-toggle-btn .toggle-icon {
    font-size: 10px;
    transition: transform 0.2s ease;
}

.result-description .highlight-word,
.result-description mark {
    background: linear-gradient(120deg, #fef08a 0%, #fde047 100%);
    color: #78350f;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 700;
    box-shadow: 0 2px 4px rgba(250, 204, 21, 0.4);
    animation: highlightGlow 2s ease-in-out infinite;
    display: inline;
}

@keyframes highlightGlow {
    0%, 100% {
        box-shadow: 0 2px 4px rgba(250, 204, 21, 0.4);
    }
    50% {
        box-shadow: 0 2px 12px rgba(250, 204, 21, 0.7);
    }
}

.result-description .no-description {
    color: var(--text-secondary);
    font-style: italic;
}

/* --- FOOTER КАРТКИ --- */
.result-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 20px;
    background: var(--bg-color);
    border-top: 1px solid var(--border-color);
}

/* Контейнер для інформації про критерії пошуку */
.match-info-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
}

/* Слова, за якими знайдено */
.matched-words {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}

.match-label {
    font-size: 11px;
    color: #6b7280;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.matched-word {
    display: inline-block;
    padding: 3px 10px;
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    color: #92400e;
    font-size: 12px;
    font-weight: 600;
    border-radius: 12px;
    border: 1px solid #fcd34d;
}

.matched-word.semantic {
    background: linear-gradient(135deg, #e0e7ff 0%, #c7d2fe 100%);
    color: #4338ca;
    border-color: #a5b4fc;
    font-style: italic;
}

/* Де знайдено збіг */
.match-location-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    background: #dbeafe;
    color: #1e40af;
    font-size: 11px;
    font-weight: 500;
    border-radius: 16px;
    width: fit-content;
}

.match-location-badge svg {
    opacity: 0.7;
}

.result-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-left: auto;
}

.result-tag {
    padding: 4px 10px;
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    font-size: 11px;
    color: var(--text-secondary);
    font-weight: 500;
}

.result-tag.more {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.result-score {
    display: none; /* Приховуємо старий score */
}

/* Stage indicator */
.stage-indicator {
    font-size: 12px;
    color: var(--primary-color);
    padding: 4px 8px;
    background: #e0f2fe;
    border-radius: 4px;
    font-weight: 600;
    margin-left: 8px;
}

/* Highlight - покращена візуалізація (не тільки 100% співпадіння) */
.highlight {
    background: linear-gradient(120deg, #fef08a 0%, #fde047 100%);
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 700;
    color: #92400e;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    animation: highlightPulse 0.3s ease-in;
}

/* Підсвітка часткових збігів */
.highlight-partial {
    background: linear-gradient(120deg, #fef3c7 0%, #fde68a 100%);
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 600;
    color: #78350f;
}

/* Elasticsearch highlighting (як в Algolia) */
mark {
    background: #fef08a;
    padding: 2px 4px;
    border-radius: 3px;
    font-weight: 600;
    color: inherit;
}

/* Покращене підсвічування збігів */
mark.highlight-match {
    background: linear-gradient(120deg, #fef08a 0%, #fde047 100%);
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 700;
    color: #92400e;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    animation: highlightPulse 0.3s ease-in;
}

mark.highlight-match.category {
    background: linear-gradient(120deg, #bfdbfe 0%, #93c5fd 100%);
    color: #1e40af;
}

/* Інформація про поля де знайшли збіги */
.matched-fields-info {
    margin-top: 8px;
    margin-bottom: 8px;
}

.matched-fields-badge {
    display: inline-block;
    padding: 4px 12px;
    background: #e0f2fe;
    color: #0369a1;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    border: 1px solid #bae6fd;
}

/* Підсвічені категорії */
.category-info {
    margin-top: 12px;
    padding: 10px 12px;
    background: #f1f5f9;
    border-left: 3px solid var(--primary-color);
    border-radius: var(--radius);
    font-size: 14px;
    line-height: 1.5;
}

.category-info strong {
    color: var(--text-primary);
    font-weight: 600;
    margin-right: 8px;
}

.root-category {
    color: var(--primary-color);
    font-weight: 600;
    padding: 2px 6px;
    background: rgba(37, 99, 235, 0.1);
    border-radius: 4px;
}

.last-category {
    color: var(--success-color);
    font-weight: 600;
    padding: 2px 6px;
    background: rgba(16, 185, 129, 0.1);
    border-radius: 4px;
}

.category-highlight {
    margin-top: 12px;
    padding: 12px;
    background: #eff6ff;
    border-left: 3px solid #3b82f6;
    border-radius: 4px;
    font-size: 14px;
    color: #1e40af;
}

.category-highlight strong {
    color: #1e3a8a;
}

/* Анімація підсвічування */
@keyframes highlightPulse {
    0% {
        transform: scale(1);
        opacity: 0.8;
    }
    50% {
        transform: scale(1.05);
        opacity: 1;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Clarification Box */
.clarification-box {
    background: #fff7ed;
    border: 2px solid var(--warning-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 24px;
}

.clarification-header h3 {
    font-size: 20px;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.clarification-header p {
    color: var(--text-secondary);
    margin-bottom: 20px;
}

.clarification-questions {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 20px;
}

.clarification-question {
    padding: 16px;
    background: var(--surface-color);
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
}

.clarification-question label {
    display: block;
    font-weight: 500;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.clarification-question input {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 14px;
}

.clarification-actions {
    display: flex;
    gap: 12px;
}

/* Buttons */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius);
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-hover);
}

.btn-secondary {
    background: var(--surface-color);
    color: var(--text-primary);
    border: 2px solid var(--border-color);
}

.btn-secondary:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

/* Loading overlay - solid background, no blur, no transparency to avoid compositing blur */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #0f0a2e;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    pointer-events: auto;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    filter: none !important;
    isolation: isolate;
}

.loading-panel {
    width: min(420px, calc(100vw - 40px));
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 28px;
    border: 1px solid rgba(125, 110, 255, 0.38);
    border-radius: 8px;
    background: rgba(24, 18, 64, 0.96);
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.36);
}

.loading-overlay.hidden {
    display: none !important;
    visibility: hidden !important;
    pointer-events: none !important;
    opacity: 0 !important;
    left: -99999px !important;
    top: -99999px !important;
    width: 1px !important;
    height: 1px !important;
    overflow: hidden !important;
    clip: rect(0,0,0,0) !important;
    clip-path: inset(50%) !important;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.loading-text {
    margin: 2px 0 0;
    color: white;
    font-size: 16px;
    font-weight: 700;
    text-align: center;
}

.loading-progress-value {
    color: #7dd3fc;
    font-size: 28px;
    line-height: 1;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
}

.loading-progress-track {
    width: 100%;
    height: 8px;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.18);
    border: 1px solid rgba(148, 163, 184, 0.18);
}

.loading-progress-track span {
    display: block;
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #14b8a6, #6366f1);
    transition: width 0.35s ease;
}

.loading-progress-detail {
    min-height: 18px;
    margin: 0;
    color: #b9c0d7;
    font-size: 13px;
    font-variant-numeric: tabular-nums;
    text-align: center;
}

.query-limit-dialog[hidden] {
    display: none !important;
}

.query-limit-dialog {
    position: fixed;
    inset: 0;
    z-index: 10050;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.query-limit-dialog-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(7, 4, 30, 0.82);
}

.query-limit-dialog-panel {
    position: relative;
    width: min(560px, 100%);
    padding: 24px;
    border-radius: 8px;
    border: 1px solid rgba(125, 110, 255, 0.45);
    background: #17113f;
    color: #fff;
    box-shadow: 0 24px 90px rgba(0, 0, 0, 0.45);
}

.query-limit-dialog-panel h3 {
    margin: 0 0 12px;
    font-size: 22px;
    line-height: 1.2;
}

.query-limit-dialog-panel p {
    margin: 0;
    color: #e8e8f5;
    line-height: 1.55;
}

.query-limit-dialog-meta {
    margin-top: 12px;
    color: #9ca3c7;
    font-size: 13px;
    font-variant-numeric: tabular-nums;
}

.query-limit-dialog-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 22px;
}

.query-limit-dialog-btn {
    min-height: 38px;
    padding: 0 18px;
    border-radius: 8px;
    border: 1px solid rgba(125, 110, 255, 0.38);
    color: #fff;
    font-weight: 800;
    cursor: pointer;
}

.query-limit-dialog-btn--secondary {
    background: rgba(255, 255, 255, 0.08);
}

.query-limit-dialog-btn--primary {
    background: linear-gradient(135deg, #14b8a6, #6d5dfc);
    border-color: rgba(45, 212, 191, 0.45);
}

.query-limit-dialog-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 24px rgba(20, 184, 166, 0.18);
}

/* Debug Info */
.debug-info {
    margin-top: 24px;
    padding: 16px;
    background: #f1f5f9;
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
}

.debug-info h4 {
    margin-bottom: 12px;
    font-size: 14px;
    color: var(--text-secondary);
}

.debug-info pre {
    font-size: 12px;
    color: var(--text-primary);
    overflow-x: auto;
    max-height: 300px;
    overflow-y: auto;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Scrollbar */
.dialog-area::-webkit-scrollbar,
.debug-info pre::-webkit-scrollbar {
    width: 8px;
}

.dialog-area::-webkit-scrollbar-track,
.debug-info pre::-webkit-scrollbar-track {
    background: var(--bg-color);
}

.dialog-area::-webkit-scrollbar-thumb,
.debug-info pre::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

.dialog-area::-webkit-scrollbar-thumb:hover,
.debug-info pre::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* Categories Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 20px;
}

.modal-content {
    background: linear-gradient(135deg, #1a1145 0%, #201860 50%, #1a1145 100%);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    max-width: min(1200px, 96vw);
    width: 100%;
    min-height: 200px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    color: #e2e8f0;
}

/* Огляд категорій: ширина динамічно = 94% екрана, без фіксованого піксельного обмеження */
.modal-content-categories {
    width: 94vw;
    max-width: 94vw;
    min-width: 320px;
    height: 88vh;
    max-height: 88vh;
    min-height: 70vh;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    background: rgba(0,0,0,0.1);
}

.modal-header h2 {
    font-size: 24px;
    font-weight: 700;
    color: #38bdf8;
    color: var(--text-primary);
    margin: 0;
}

.modal-close {
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 6px;
    font-size: 32px;
    color: #ef4444;
    cursor: pointer;
    padding: 0;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.modal-close:hover {
    color: var(--text-primary);
}

/* Модальне вікно "Куди додати ПП?" — вище за fullscreen ПП (z-index 5000) і панелі маркерів */
#addToChatTargetModal.modal,
#shareSocialModal.modal,
#categoriesModal.modal {
    z-index: 12000;
}

/* Модальне вікно "Куди додати ПП?" */
.add-to-chat-target-content {
    max-width: 420px;
}
.add-to-chat-target-body {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.add-to-chat-target-desc {
    margin: 0 0 12px;
    font-size: 14px;
    color: var(--text-secondary, #94a3b8);
}

.share-social-content {
    max-width: 540px;
    min-height: auto;
}

/* Rules modal (Правила користування) — вище за sidebar, dark navy-purple style */
#rulesModal.modal {
    z-index: 10001;
    background: rgba(0, 0, 0, 0.7);
}
#rulesModal .rules-modal-content {
    max-width: min(920px, 96vw);
    max-height: 90vh;
    background: #1a1b3a;
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 16px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
}
#rulesModal .modal-header {
    padding: 24px 28px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    background: rgba(0,0,0,0.15);
}
#rulesModal .modal-header h2 {
    font-size: 20px;
    font-weight: 700;
    color: #fff;
}
#rulesModal .modal-close {
    background: #dc2626;
    border: none;
    border-radius: 8px;
    color: #fff;
    width: 36px;
    height: 36px;
    font-size: 24px;
}
#rulesModal .modal-close:hover {
    background: #ef4444;
    color: #fff;
}
#rulesModal .rules-modal-body {
    padding: 24px 28px 28px;
    line-height: 1.65;
    font-size: 15px;
    color: #cbd5e1;
}
#rulesModal .rules-modal-body h3 {
    margin: 1.4em 0 0.6em;
    font-size: 1.1em;
    font-weight: 600;
    color: #a78bfa;
}
#rulesModal .rules-modal-body h3:first-of-type {
    margin-top: 0;
}
#rulesModal .rules-modal-body p, #rulesModal .rules-modal-body ul, #rulesModal .rules-modal-body ol {
    margin: 0 0 0.6em;
    color: #cbd5e1;
}
#rulesModal .rules-modal-body ul, #rulesModal .rules-modal-body ol {
    padding-left: 1.5em;
}
#rulesModal .rules-modal-body ul {
    list-style-type: disc;
}
#rulesModal .rules-modal-body li {
    margin-bottom: 0.25em;
}
#rulesModal .rules-modal-intro {
    font-size: 0.9em;
    color: #94a3b8;
    margin-bottom: 1.2em !important;
}
#rulesModal .rules-modal-body::-webkit-scrollbar {
    width: 8px;
}
#rulesModal .rules-modal-body::-webkit-scrollbar-track {
    background: rgba(0,0,0,0.2);
    border-radius: 4px;
}
#rulesModal .rules-modal-body::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.15);
    border-radius: 4px;
}
#rulesModal .rules-modal-body::-webkit-scrollbar-thumb:hover {
    background: rgba(255,255,255,0.25);
}

.share-social-body {
    display: flex;
    justify-content: center;
    padding: 28px;
}

.share-social-list {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 14px;
}

.share-social-btn {
    width: 58px;
    height: 58px;
    border: none;
    border-radius: 14px;
    color: #fff;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.28);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.share-social-btn:hover {
    transform: translateY(-2px);
    filter: brightness(1.06);
}

.share-social-btn svg {
    width: 28px;
    height: 28px;
    display: block;
}

.share-social-btn-facebook {
    background: #4267b2;
}

.share-social-btn-twitter {
    background: #1d9bf0;
}

.share-social-btn-viber {
    background: #7c529e;
}

.share-social-btn-whatsapp {
    background: #25d366;
}

.share-social-btn-linkedin {
    background: #0a66c2;
}

.share-social-btn-telegram {
    background: #2aabee;
}
.add-to-chat-target-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    flex: 1;
    min-height: 0;
}
.add-to-chat-target-scroll {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding-right: 2px;
}
.add-to-chat-target-sessions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.add-to-chat-target-footer {
    position: sticky;
    bottom: 0;
    z-index: 2;
    padding-top: 8px;
    background: linear-gradient(180deg, rgba(26, 17, 69, 0) 0%, rgba(26, 17, 69, 0.92) 22%, rgba(26, 17, 69, 1) 100%);
}
.add-to-chat-target-item {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding: 12px 16px;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.12);
    background: rgba(255,255,255,0.04);
    color: var(--text-primary, #e2e8f0);
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
    width: 100%;
}
.add-to-chat-target-item.is-new-target {
    margin-top: 0;
}
.add-to-chat-target-item:hover {
    background: rgba(101, 102, 241, 0.2);
    border-color: rgba(101, 102, 241, 0.4);
}
.add-to-chat-target-item.is-disabled,
.add-to-chat-target-item:disabled {
    opacity: 0.52;
    cursor: not-allowed;
    background: rgba(148, 163, 184, 0.08);
    border-color: rgba(148, 163, 184, 0.22);
    color: rgba(226, 232, 240, 0.82);
    box-shadow: none;
}
.add-to-chat-target-item.is-disabled:hover,
.add-to-chat-target-item:disabled:hover {
    background: rgba(148, 163, 184, 0.08);
    border-color: rgba(148, 163, 184, 0.22);
}
.add-to-chat-target-item-title-row {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}
.add-to-chat-target-item-title {
    font-weight: 600;
    margin-bottom: 2px;
}
.add-to-chat-target-item-active {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #22d3ee;
    flex: 0 0 auto;
}
.add-to-chat-target-item-sub {
    font-size: 12px;
    color: var(--text-secondary, #94a3b8);
}
.add-to-chat-target-item-meta {
    margin-top: 4px;
    font-size: 11px;
    color: rgba(226, 232, 240, 0.7);
}

.modal-body {
    padding: 20px;
    overflow-y: auto;
    overflow-x: auto;
    flex: 1;
    min-height: 0;
}

.categories-search {
    margin-bottom: 20px;
}

.categories-search-input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 16px;
    outline: none;
    transition: border-color 0.2s;
}

.categories-search-input:focus {
    border-color: var(--primary-color);
}

.categories-tree {
    display: flex;
    flex-direction: column;
    gap: 4px;
    width: 100%;
    min-width: 0;
}

.category-node {
    margin-bottom: 6px;
    position: relative;
}

/* Підсвічування збігу при фільтрі в дереві категорій */
.category-node.has-match .category-header {
    background: linear-gradient(90deg, rgba(254, 243, 199, 0.5) 0%, var(--bg-color) 100%);
    border-left: 3px solid #f59e0b;
}
.category-node.has-match .category-name mark.highlight-match {
    background: linear-gradient(120deg, #fef08a 0%, #fde047 100%);
    padding: 2px 4px;
    border-radius: 3px;
    font-weight: 700;
    color: #92400e;
}

.category-header {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px 12px;
    background: var(--bg-color);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
    min-width: 0;
    width: 100%;
    box-sizing: border-box;
    position: relative;
    overflow: hidden;
}

.category-header:hover {
    background: #e2e8f0;
    transform: translateX(4px);
}

/* Візуалізація рядків, зафіксованих чекбоксом (обрані категорії) */
.category-node.category-row-selected .category-header {
    background: rgba(99, 102, 241, 0.15);
    border-left: 3px solid var(--primary-color, #6366f1);
}
.category-node.category-row-selected .category-header:hover {
    background: rgba(99, 102, 241, 0.25);
}

.category-node-open-path > .category-header {
    border-left: 2px solid rgba(129, 140, 248, 0.32);
}

.category-header-open {
    border-color: rgba(129, 140, 248, 0.45);
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.2);
}

.category-node-open > .category-header {
    background: linear-gradient(90deg, rgba(99, 102, 241, 0.18) 0%, var(--bg-color) 100%);
    border-left-color: rgba(129, 140, 248, 0.85);
}

.category-expand-btn {
    background: none;
    border: none;
    font-size: 14px;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
    width: 24px;
    height: 24px;
    min-width: 24px;
    min-height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
    flex-shrink: 0;
}

.category-expand-btn.expanded {
    transform: rotate(90deg);
}

.category-name-wrap {
    flex: 1 1 auto;
    min-width: 0;
    max-width: 100%;
    display: inline-flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 4px;
    word-break: break-word;
    overflow-wrap: break-word;
}

.category-sub-title {
    font-weight: 600;
    color: #dc2626;
    font-size: 14px;
}

.category-name {
    font-weight: 500;
    color: var(--text-primary);
    font-size: 15px;
    word-break: break-word;
    overflow-wrap: break-word;
}

.category-leaf-indicator {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 999px;
    border: 1px solid rgba(52, 211, 153, 0.34);
    background: linear-gradient(135deg, rgba(6, 78, 59, 0.34) 0%, rgba(16, 185, 129, 0.14) 100%);
    color: #d1fae5;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.02em;
    white-space: nowrap;
}

.category-leaf-indicator-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6ee7b7 0%, #34d399 100%);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.14);
}

.category-leaf-indicator-text {
    line-height: 1;
}

.category-pp-count {
    font-size: 13px;
    color: var(--text-secondary);
    white-space: nowrap;
}

.category-row-checkbox {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--primary-color);
}

.categorizer-force-toggle {
    border: none;
    background: transparent;
    padding: 0;
    margin: 0;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.categorizer-force-toggle-track {
    width: 42px;
    height: 24px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(148, 163, 184, 0.55);
    position: relative;
    transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
    box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.18);
}

.categorizer-force-toggle-thumb {
    position: absolute;
    top: 1px;
    left: 1px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #ffffff;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.28);
    transition: transform 0.2s ease;
}

.categorizer-force-toggle:hover .categorizer-force-toggle-track {
    box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.2), 0 0 0 2px rgba(129, 140, 248, 0.14);
}

.categorizer-force-toggle:focus-visible {
    outline: none;
}

.categorizer-force-toggle:focus-visible .categorizer-force-toggle-track {
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.24);
}

.categorizer-force-toggle.is-active .categorizer-force-toggle-track {
    background: linear-gradient(135deg, #885DF6 0%, #6566F1 58%, #60a5fa 100%);
    border-color: rgba(129, 140, 248, 0.78);
    box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.14), 0 0 0 1px rgba(129, 140, 248, 0.16);
}

.categorizer-force-toggle.is-active .categorizer-force-toggle-thumb {
    transform: translateX(18px);
}

.category-type {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #c7d2fe;
    background: rgba(99, 102, 241, 0.16);
    border: 1px solid rgba(129, 140, 248, 0.24);
    padding: 4px 10px;
    border-radius: 999px;
}

.category-children {
    position: relative;
    margin-top: 6px;
    margin-left: 14px;
    padding-left: 10px;
    background: transparent !important;
}

.category-node-open > .category-children {
    margin-top: 10px;
    margin-left: 18px;
    padding-left: 14px;
}

.category-node-open > .category-children::before {
    content: '';
    position: absolute;
    left: 0;
    top: 2px;
    bottom: 8px;
    width: 2px;
    border-radius: 999px;
    background: linear-gradient(180deg, rgba(129, 140, 248, 0.85) 0%, rgba(129, 140, 248, 0.14) 100%);
    box-shadow: 0 0 0 1px rgba(99, 102, 241, 0.08);
}

.category-node-open > .category-children > .category-node {
    margin-bottom: 8px;
}

.category-node-open > .category-children > .category-node:last-child {
    margin-bottom: 0;
}

/* Усунути білу смугу: дочірні рядки той самий фон що й батьківські */
.category-node .category-node .category-header {
    background: var(--bg-color) !important;
}

.no-categories {
    text-align: center;
    padding: 40px;
    color: var(--text-secondary);
    font-size: 16px;
}

/* ============================================
   МОДАЛЬНЕ ВІКНО ПРАВОВИХ ПОЗИЦІЙ КАТЕГОРІЇ
   ============================================ */

.modal-large {
    max-width: 1100px;
}

.modal-header-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.category-path-text {
    font-size: 14px;
    color: var(--text-secondary);
    margin: 0;
}

.category-articles-count {
    margin-bottom: 16px;
    font-size: 14px;
    color: var(--text-secondary);
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}

.category-articles-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.category-article-item {
    padding: 16px;
    background: var(--bg-color);
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
    transition: all 0.2s;
    cursor: pointer;
}

.category-article-item:hover {
    border-color: var(--primary-color);
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.1);
    transform: translateX(4px);
}

.category-article-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 8px;
}

.category-article-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.4;
    flex: 1;
}

.category-article-date {
    font-size: 12px;
    color: var(--text-secondary);
    white-space: nowrap;
}

.category-article-description {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 6;
    -webkit-box-orient: vertical;
    min-height: calc(1.5em * 6);
    overflow: hidden;
}

.category-article-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
}

.category-article-tag {
    font-size: 11px;
    padding: 3px 8px;
    background: #e0e7ff;
    color: #4338ca;
    border-radius: 10px;
}

.category-articles-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
}

.pagination-btn {
    padding: 8px 16px;
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}

.pagination-btn:hover:not(:disabled) {
    background: var(--bg-color);
    border-color: var(--primary-color);
}

.pagination-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pagination-info-text {
    font-size: 14px;
    color: var(--text-secondary);
}

.category-articles-empty {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.category-articles-empty svg {
    width: 48px;
    height: 48px;
    margin-bottom: 12px;
    opacity: 0.5;
}

.category-articles-empty p {
    font-size: 16px;
}

.category-articles-loading {
    text-align: center;
    padding: 40px;
    color: var(--text-secondary);
}

.category-articles-loading .spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 12px;
}

/* Кнопка "Переглянути ПП" у категорії */
.category-view-articles-btn {
    flex-shrink: 0;
    margin-left: auto;
    width: 34px;
    height: 34px;
    min-width: 34px;
    padding: 0;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.category-view-articles-btn:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

.category-add-to-chat-btn {
    flex-shrink: 0;
    white-space: nowrap;
    margin-left: 6px;
    padding: 6px 12px;
    background: rgba(101, 102, 241, 0.2);
    color: #a5b4fc;
    border: 1px solid rgba(101, 102, 241, 0.4);
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.category-add-to-chat-btn:hover {
    background: rgba(101, 102, 241, 0.3);
    border-color: var(--primary-color);
    color: #e2e8f0;
}

/* Кнопка "Додати в AI чат" у шапці модалки ПП категорії */
.modal-header-btn.modal-add-to-chat-btn {
    padding: 6px 14px;
    background: rgba(101, 102, 241, 0.25);
    color: #a5b4fc;
    border: 1px solid rgba(101, 102, 241, 0.5);
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    margin-right: 10px;
    transition: all 0.2s;
}

.modal-header-btn.modal-add-to-chat-btn:hover {
    background: rgba(101, 102, 241, 0.4);
    border-color: var(--primary-color);
    color: #e2e8f0;
}

/* Scrollbar for modal */
.modal-body::-webkit-scrollbar {
    width: 8px;
}

.modal-body::-webkit-scrollbar-track {
    background: var(--bg-color);
}

.modal-body::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

.modal-body::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* Responsive */
@media (max-width: 768px) {
    .search-container {
        padding: 12px;
    }

    .header-content {
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
    }

    .header-controls {
        width: 100%;
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .mode-switcher {
        width: 100%;
    }

    .clarification-checkbox {
        margin-top: 8px;
    }

    .clarification-checkbox {
        margin-top: 8px;
    }

    .model-selector {
        width: 100%;
    }

    .model-select {
        width: 100%;
    }

    .navigation-buttons {
        width: 100%;
        flex-direction: column;
    }

    .nav-btn {
        width: 100%;
    }

    .search-box-wrapper {
        flex-direction: column;
    }

    .results-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    /* Адаптивні картки результатів */
    .result-header {
        flex-wrap: wrap;
        gap: 10px;
        padding: 12px 16px;
    }

    .result-rank {
        width: 30px;
        height: 30px;
        font-size: 12px;
    }

    .result-title {
        font-size: 14px;
    }

    .result-meta-right {
        width: 100%;
        order: 3;
        justify-content: space-between;
        padding-top: 8px;
        border-top: 1px dashed var(--border-color);
    }

    .relevance-indicator {
        width: 50px;
        height: 24px;
    }

    .result-categories-row {
        padding: 10px 16px;
        gap: 6px;
        font-size: 12px;
    }

    .category-path-item {
        padding: 4px 8px;
    }

    .category-breadcrumb {
        padding: 3px 6px;
        font-size: 11px;
    }

    .result-description-wrapper {
        padding: 12px 16px;
    }

    .result-description {
        font-size: 13px;
    }

    .result-footer {
        flex-wrap: wrap;
        padding: 10px 16px;
    }

    .message-content {
        max-width: 85%;
    }

    .modal {
        padding: 10px;
    }

    .modal-content {
        max-height: 95vh;
    }

    .modal-header {
        padding: 16px;
    }

    .modal-body {
        padding: 16px;
    }

    .category-search-area {
        padding: 12px;
    }

    .category-search-input-wrapper {
        margin: 12px 0;
    }
}

/* ============================================
   CATEGORY SEARCH AREA
   ============================================ */

.category-search-area {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 20px;
}

.category-search-header {
    text-align: center;
    margin-bottom: 40px;
}

.category-search-header h2 {
    font-size: 32px;
    font-weight: 700;
    color: #38bdf8;
    margin-bottom: 12px;
}

.category-search-description {
    font-size: 16px;
    color: var(--text-secondary);
    line-height: 1.6;
    max-width: 600px;
    margin: 0 auto;
}

.category-search-input-wrapper {
    margin: 30px 0;
}

.category-search-box {
    display: flex;
    gap: 12px;
    max-width: 800px;
    margin: 0 auto;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: var(--radius-lg);
    padding: 8px;
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
}

.category-search-box:focus-within {
    border-color: rgba(136,93,246,0.5);
    box-shadow: 0 0 0 3px rgba(136, 93, 246, 0.15);
}

.category-search-input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 16px;
    padding: 12px 16px;
    background: transparent;
    color: #e2e8f0;
}

.category-search-input::placeholder {
    color: #64748b;
}

.category-search-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--radius);
    padding: 12px 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    font-weight: 500;
}

.category-search-btn:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-lg);
}

.category-search-btn:active {
    transform: translateY(0);
}

.category-search-status {
    text-align: center;
    margin-top: 12px;
    font-size: 14px;
    min-height: 20px;
}

.category-search-status.success {
    color: var(--success-color);
}

.category-search-status.error {
    color: var(--error-color);
}

.category-search-status.info {
    color: var(--primary-color);
}

/* Category Search Results */
.category-search-results {
    margin-top: 40px;
    animation: fadeIn 0.3s ease;
}

.category-results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 2px solid var(--border-color);
}

.category-results-header h3 {
    font-size: 24px;
    font-weight: 600;
    color: var(--text-primary);
}

.category-results-meta {
    display: flex;
    gap: 16px;
    align-items: center;
}

.category-results-count {
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 500;
}

.category-search-time {
    font-size: 12px;
    color: var(--text-secondary);
    background: var(--bg-color);
    padding: 4px 8px;
    border-radius: 4px;
}

.category-results-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.category-result-item {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px;
    transition: all 0.2s ease;
}

.category-result-item:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.category-result-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.category-result-rank {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    flex-shrink: 0;
}

.category-result-title {
    font-size: 17px;
    font-weight: 600;
    color: var(--text-primary);
    flex: 1;
    min-width: 0;
    line-height: 1.4;
    white-space: normal;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.category-result-type-badge {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    color: #92400e;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    flex-shrink: 0;
}

.category-result-path {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 16px;
    padding: 12px 16px;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-radius: var(--radius);
    border-left: 4px solid var(--primary-color);
}

.category-path-breadcrumb {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
}

.category-result-path .path-part {
    padding: 2px 6px;
    border-radius: 4px;
    background: white;
    transition: all 0.2s ease;
}

.category-result-path .path-root {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    color: #92400e;
    font-weight: 700;
}

.category-result-path .path-middle {
    background: #e5e7eb;
    color: #4b5563;
}

.category-result-path .path-last {
    background: linear-gradient(135deg, #dcfce7 0%, #bbf7d0 100%);
    color: #166534;
    font-weight: 600;
}

.category-result-path .path-separator {
    color: #9ca3af;
    font-weight: 400;
    margin: 0 2px;
}

.category-result-actions {
    display: flex;
    gap: 12px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
}

.category-action-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.category-action-btn.view-articles {
    background: var(--primary-color);
    color: white;
}

.category-action-btn.view-articles:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

.category-action-btn.copy-path {
    background: white;
    color: var(--text-primary);
    border-color: var(--border-color);
}

.category-action-btn.copy-path:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

/* Merged category badge and paths */
.category-merged-badge {
    background: linear-gradient(135deg, #e0e7ff 0%, #c7d2fe 100%);
    color: #4338ca;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    flex-shrink: 0;
    white-space: nowrap;
}

.category-result-paths-container {
    border: 1px solid var(--border-color, #e5e7eb);
    border-radius: 8px;
    padding: 8px 12px;
    background: var(--bg-secondary, #f9fafb);
    margin-bottom: 8px;
}

.merged-category-path-item {
    padding: 6px 0;
}

.merged-category-path-item:not(:first-child) {
    border-top: 1px solid var(--border-color, #e5e7eb);
}

.merged-category-path-item .category-action-btn {
    padding: 4px 8px;
    font-size: 12px;
    white-space: nowrap;
    flex-shrink: 0;
}

/* Modal for category articles */
.category-articles-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10000;
    display: flex;
    align-items: stretch;
    justify-content: center;
    padding: 8px 12px;
    box-sizing: border-box;
}

.category-articles-modal .modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
}

.category-articles-modal .modal-content {
    position: relative;
    background: linear-gradient(135deg, #1a1145 0%, #201860 50%, #1a1145 100%);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: var(--radius-lg);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    max-width: 1040px;
    width: min(96vw, 1040px);
    max-height: calc(100vh - 16px);
    height: calc(100vh - 16px);
    align-self: center;
    display: flex;
    flex-direction: column;
    animation: modalSlideIn 0.3s ease;
    color: #e2e8f0;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.category-articles-modal .modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
}

.category-articles-modal .modal-header h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.category-articles-modal .modal-close-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: var(--bg-color);
    color: var(--text-secondary);
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.category-articles-modal .modal-close-btn:hover {
    background: var(--error-color);
    color: white;
}

.category-articles-modal .modal-body {
    padding: 20px 24px;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}

.category-articles-modal .modal-pagination-info {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 16px;
    padding: 8px 12px;
    background: var(--bg-color);
    border-radius: var(--radius);
}

.category-articles-modal .modal-articles-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.category-articles-modal .modal-article-item {
    padding: 16px;
    background: var(--bg-color);
    border-radius: var(--radius);
    border-left: 3px solid var(--primary-color);
}

.category-articles-modal .modal-article-item.rp-card-style {
    cursor: default;
    border-left: 3px solid var(--primary-color);
    user-select: text;
}

.category-articles-modal .modal-article-item.rp-card-style:hover {
    transform: none;
    border-left-color: var(--success-color);
    background: rgba(37, 99, 235, 0.05);
}

.category-articles-modal .modal-article-header {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 8px;
}

.category-articles-modal .modal-article-header .rp-card-rank {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, #885DF6, #6566F1);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.category-articles-modal .modal-article-header .rp-card-date {
    color: #94a3b8;
    font-size: 13px;
}

.category-articles-modal .modal-article-header .rp-card-case-number {
    background: rgba(255,255,255,0.08);
    padding: 3px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    color: #e2e8f0;
}

.category-articles-modal .modal-article-header .rp-card-court-type {
    padding: 3px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.3px;
}
/* In modal: inherit hierarchy colors from main court-type classes */
.category-articles-modal .modal-article-header .rp-card-court-type.court-kolegiya {
    background: rgba(100, 116, 139, 0.25);
    border: 1px solid rgba(100, 116, 139, 0.4);
    color: #cbd5e1;
}
.category-articles-modal .modal-article-header .rp-card-court-type.court-op {
    background: rgba(139, 92, 246, 0.25);
    border: 1px solid rgba(139, 92, 246, 0.5);
    color: #a78bfa;
}
.category-articles-modal .modal-article-header .rp-card-court-type.court-vp {
    background: rgba(245, 158, 11, 0.25);
    border: 1px solid rgba(245, 158, 11, 0.5);
    color: #fbbf24;
}

.category-articles-modal .modal-article-header .rp-card-actions {
    display: flex;
    gap: 4px;
    margin-left: auto;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.category-articles-modal .modal-article-header .rp-card-action-btn {
    width: 30px;
    height: 30px;
    border-radius: 6px;
    border: 1px solid rgba(255,255,255,0.1);
    background: transparent;
    color: #94a3b8;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    text-decoration: none;
}

.category-articles-modal .modal-article-header .rp-card-action-btn:hover {
    background: rgba(255,255,255,0.1);
    color: #e2e8f0;
}

.category-articles-modal .modal-article-header .modal-article-ai-analysis-btn,
.category-articles-modal .modal-article-header .modal-article-link-btn {
    min-height: 30px;
    padding: 0 12px;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.12);
    background: rgba(255,255,255,0.04);
    color: #e2e8f0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    text-decoration: none;
    transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

.category-articles-modal .modal-article-header .modal-article-add-to-chat-btn {
    width: 30px;
    min-width: 30px;
    height: 30px;
    padding: 0;
}

.category-articles-modal .modal-article-header .modal-article-ai-analysis-btn {
    background: rgba(16, 185, 129, 0.12);
    border-color: rgba(16, 185, 129, 0.35);
    color: #d1fae5;
}

.category-articles-modal .modal-article-header .modal-article-ai-analysis-btn:hover {
    background: rgba(16, 185, 129, 0.2);
    border-color: rgba(16, 185, 129, 0.5);
    color: #ecfdf5;
}

.category-articles-modal .modal-article-header .modal-article-link-btn {
    background: rgba(16, 185, 129, 0.15);
    border-color: rgba(16, 185, 129, 0.32);
    color: #34d399;
}

.category-articles-modal .modal-article-header .modal-article-link-btn:hover {
    background: rgba(16, 185, 129, 0.22);
    border-color: rgba(16, 185, 129, 0.45);
    color: #6ee7b7;
}

.category-articles-modal .modal-article-header .modal-article-add-to-chat-btn:hover {
    background: rgba(99, 102, 241, 0.16);
    border-color: rgba(99, 102, 241, 0.4);
    color: #eef2ff;
}

.category-articles-modal .modal-article-header .modal-article-add-to-chat-btn.is-added {
    background: rgba(16, 185, 129, 0.16);
    border-color: rgba(16, 185, 129, 0.4);
    color: #d1fae5;
}

.category-articles-modal .modal-article-header .modal-article-add-to-chat-btn:disabled {
    opacity: 1;
    cursor: default;
}

.category-articles-modal .modal-article-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
    user-select: text;
    cursor: text;
}

.category-articles-modal .modal-article-description {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 6px;
    user-select: text;
    cursor: text;
    display: block;
    overflow: visible;
    position: relative;
    transition: max-height 0.35s ease;
}

/* Лише коли текст обрізаний попередньо — обмеження висоти та градієнт */
.category-articles-modal .modal-article-description.is-preview-truncated {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 6;
    max-height: calc(1.6em * 6);
    overflow: hidden;
}

/* Expanded state: no height limit */
.category-articles-modal .modal-article-description.expanded {
    display: block;
    -webkit-line-clamp: unset;
    max-height: none;
    overflow: visible;
    padding-bottom: 8px;
    border-left: 3px solid rgba(var(--accent-rgb, 88,86,214), 0.4);
    padding-left: 12px;
    margin-top: 4px;
}

/* Fade overlay on clamped description */
.category-articles-modal .modal-article-description.is-preview-truncated:not(.expanded)::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 30px;
    background: linear-gradient(transparent, var(--bg-card, rgba(30, 30, 60, 1)));
    pointer-events: none;
}

.modal-article-expand-btn {
    background: rgba(var(--accent-rgb, 88,86,214), 0.08);
    border: 1px solid rgba(var(--accent-rgb, 88,86,214), 0.2);
    color: var(--accent);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    padding: 5px 14px;
    margin-bottom: 6px;
    border-radius: 6px;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.modal-article-expand-btn:hover {
    background: rgba(var(--accent-rgb, 88,86,214), 0.18);
    border-color: rgba(var(--accent-rgb, 88,86,214), 0.4);
}
.modal-article-expand-btn:disabled {
    opacity: 0.6;
    cursor: wait;
}

/* Loading spinner for expand button */
.modal-expand-spinner {
    display: inline-block;
    width: 12px;
    height: 12px;
    border: 2px solid rgba(var(--accent-rgb, 88,86,214), 0.3);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: expandSpin 0.6s linear infinite;
}
@keyframes expandSpin {
    to { transform: rotate(360deg); }
}

.category-articles-modal .modal-article-meta {
    font-size: 12px;
    color: var(--text-secondary);
    display: flex;
    gap: 12px;
}

.category-articles-modal .modal-article-type {
    background: var(--primary-color);
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
}

/* Клікабельний елемент статті */
.category-articles-modal .modal-article-item {
    cursor: pointer;
    transition: all 0.2s ease;
}

.category-articles-modal .modal-article-item:hover {
    transform: translateX(4px);
    border-left-color: var(--success-color);
    background: rgba(37, 99, 235, 0.05);
}

/* Субтайтл модалу */
.category-articles-modal .modal-subtitle {
    font-size: 13px;
    color: var(--text-secondary);
    margin: 4px 0 0 0;
    max-width: 500px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Покращена інфо-панель */
.category-articles-modal .modal-pagination-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.category-articles-modal .modal-total-count {
    font-weight: 500;
}

.category-articles-modal .modal-total-count strong {
    color: var(--primary-color);
    font-size: 16px;
}

/* Пагінація модалу */
.category-articles-modal .modal-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    padding: 20px 0 0 0;
    margin-top: 16px;
    border-top: 1px solid var(--border-color);
}

.category-articles-modal .modal-page-btn {
    padding: 10px 20px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.category-articles-modal .modal-page-btn:hover:not(:disabled) {
    background: var(--primary-hover);
    transform: translateY(-2px);
}

.category-articles-modal .modal-page-btn:disabled {
    background: var(--border-color);
    color: var(--text-secondary);
    cursor: not-allowed;
}

.category-articles-modal .modal-page-info {
    font-size: 14px;
    color: var(--text-secondary);
}

/* Більший модал (~+30% до попереднього 800px; на всю висоту вікна) */
.category-articles-modal .modal-content.modal-large {
    max-width: 1170px;
    width: min(96vw, 1170px);
    max-height: calc(100vh - 16px);
    height: calc(100vh - 16px);
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================
   КНОПКА ТА ПАНЕЛЬ УТОЧНЕННЯ (праворуч)
   ============================================ */

/* Кнопка уточнення (праворуч, як sidebar ліворуч) */
.open-clarification-btn {
    position: fixed;
    right: 16px;
    top: 16px;
    z-index: 999;
    background: linear-gradient(135deg, #8b5cf6, #6366f1);
    border: 2px solid transparent;
    border-radius: 10px;
    padding: 10px 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.3);
    transition: all 0.2s;
    color: white;
}

.open-clarification-btn:hover {
    background: linear-gradient(135deg, #7c3aed, #4f46e5);
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(139, 92, 246, 0.4);
}

.open-clarification-btn svg {
    color: inherit;
}

/* Панель уточнення (зліва, як sidebar) */
.clarification-panel {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: 350px;
    background: linear-gradient(180deg, #1e1b4b 0%, #312e81 100%);
    color: #e2e8f0;
    z-index: 1001;
    transform: translateX(-100%);
    transition: transform 0.3s ease-in-out;
    display: flex;
    flex-direction: column;
    box-shadow: 4px 0 30px rgba(99, 102, 241, 0.3);
}

.clarification-panel.open {
    transform: translateX(0);
}

.clarification-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(0, 0, 0, 0.2);
}

.clarification-panel-header h3 {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
    color: #f1f5f9;
    display: flex;
    align-items: center;
    gap: 8px;
}

.clarification-panel-header h3::before {
    content: '?';
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: linear-gradient(135deg, #8b5cf6, #6366f1);
    border-radius: 50%;
    font-size: 14px;
    font-weight: bold;
}

.clarification-panel-close {
    background: none;
    border: none;
    color: #94a3b8;
    font-size: 28px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    transition: all 0.2s;
    line-height: 1;
}

.clarification-panel-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #f1f5f9;
}

.clarification-panel-content {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.clarification-panel-desc {
    font-size: 14px;
    color: #a5b4fc;
    line-height: 1.6;
    margin: 0;
}

.clarification-input-wrapper {
    position: relative;
}

.clarification-input {
    width: 100%;
    padding: 16px;
    background: rgba(255, 255, 255, 0.08);
    border: 2px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    color: #f1f5f9;
    font-size: 14px;
    line-height: 1.6;
    resize: vertical;
    min-height: 120px;
    transition: all 0.2s;
}

.clarification-input::placeholder {
    color: #818cf8;
    opacity: 0.7;
}

.clarification-input:focus {
    outline: none;
    border-color: #8b5cf6;
    background: rgba(255, 255, 255, 0.12);
    box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.2);
}

.clarification-panel-hint {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 12px 16px;
    background: rgba(139, 92, 246, 0.15);
    border-radius: 8px;
    font-size: 12px;
    color: #c4b5fd;
    line-height: 1.5;
}

.clarification-panel-hint svg {
    flex-shrink: 0;
    margin-top: 2px;
    color: #a78bfa;
}

.clarification-panel-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: auto;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.clarification-panel-actions .btn-primary {
    background: linear-gradient(135deg, #8b5cf6, #6366f1);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 20px;
    font-size: 15px;
    font-weight: 600;
    border-radius: 10px;
    transition: all 0.2s;
}

.clarification-panel-actions .btn-primary:hover {
    background: linear-gradient(135deg, #7c3aed, #4f46e5);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(139, 92, 246, 0.4);
}

.clarification-panel-actions .btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #e2e8f0;
    padding: 12px 20px;
    font-size: 14px;
    border-radius: 10px;
    transition: all 0.2s;
}

.clarification-panel-actions .btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
}

/* Overlay для панелі уточнення */
.clarification-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
}

.clarification-overlay.visible {
    opacity: 1;
    visibility: visible;
}

/* Режими панелі уточнення */
.clarification-mode {
    display: block;
}

/* Список питань уточнення */
.clarification-questions-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
    max-height: 400px;
    overflow-y: auto;
    padding-right: 8px;
}

.clarification-question-item {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    padding: 14px 16px;
    border-left: 3px solid #8b5cf6;
}

.clarification-question-label {
    font-size: 13px;
    font-weight: 500;
    color: #c4b5fd;
    margin-bottom: 10px;
    line-height: 1.5;
}

.clarification-question-input {
    width: 100%;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    color: #f1f5f9;
    font-size: 14px;
    transition: all 0.2s;
}

.clarification-question-input::placeholder {
    color: #818cf8;
    opacity: 0.6;
}

.clarification-question-input:focus {
    outline: none;
    border-color: #8b5cf6;
    background: rgba(255, 255, 255, 0.15);
}

/* Select для так/ні питань */
.clarification-question-select {
    width: 100%;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    color: #f1f5f9;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.clarification-question-select option {
    background: #1e1b4b;
    color: #f1f5f9;
}

.clarification-question-select:focus {
    outline: none;
    border-color: #8b5cf6;
}

/* Індикатор нових питань */
.clarification-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 18px;
    height: 18px;
    background: #ef4444;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: bold;
    color: white;
    animation: badgePulse 2s ease-in-out infinite;
}

@keyframes badgePulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.open-clarification-btn {
    position: relative;
}

/* Responsive для панелі уточнення */
@media (max-width: 480px) {
    .clarification-panel {
        width: 100%;
    }
    
    .open-clarification-btn {
        right: 12px;
        top: 12px;
        padding: 8px 10px;
    }
}

/* ============================================
   ЗГОРТАННЯ/РОЗГОРТАННЯ ШЛЯХІВ КАТЕГОРІЙ
   ============================================ */

/* Кнопка-тогл для згорнутого шляху */
.path-collapsed-toggle {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 10px;
    margin: 0 2px;
    background: linear-gradient(135deg, #e0e7ff, #c7d2fe);
    border: 1px solid #a5b4fc;
    border-radius: 14px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    color: #4f46e5;
    transition: all 0.25s ease;
    vertical-align: middle;
    user-select: none;
}

.path-collapsed-toggle:hover {
    background: linear-gradient(135deg, #c7d2fe, #a5b4fc);
    border-color: #818cf8;
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.25);
}

.path-collapsed-toggle.expanded {
    background: linear-gradient(135deg, #818cf8, #6366f1);
    border-color: #6366f1;
    color: white;
}

.path-collapsed-toggle.expanded:hover {
    background: linear-gradient(135deg, #6366f1, #4f46e5);
}

.collapsed-dots {
    font-size: 14px;
    letter-spacing: 1px;
    line-height: 1;
}

.collapsed-count {
    font-size: 10px;
    background: rgba(79, 70, 229, 0.15);
    padding: 1px 5px;
    border-radius: 8px;
    min-width: 16px;
    text-align: center;
}

.path-collapsed-toggle.expanded .collapsed-count {
    background: rgba(255, 255, 255, 0.25);
}

/* Прихований вміст шляху */
.path-collapsed-content {
    display: none;
    animation: pathFadeIn 0.3s ease;
}

.path-collapsed-content[style*="display: inline"] {
    display: inline;
}

@keyframes pathFadeIn {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Сепаратор після "..." */
.path-after-dots {
    transition: opacity 0.2s;
}

/* Стилі для частин шляху */
.path-part {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 12px;
    line-height: 1.4;
    transition: all 0.2s;
}

.path-part.path-root {
    background: #dbeafe;
    color: #1e40af;
    font-weight: 600;
}

.path-part.path-middle {
    background: #f1f5f9;
    color: #475569;
}

.path-part.path-pre-last {
    background: #e0e7ff;
    color: #4338ca;
}

.path-part.path-last {
    background: linear-gradient(135deg, #a855f7, #8b5cf6);
    color: white;
    font-weight: 600;
}

.path-separator {
    color: #94a3b8;
    margin: 0 4px;
    font-size: 12px;
    font-weight: 500;
}

/* Hover ефекти для частин шляху */
.path-part:hover {
    filter: brightness(0.95);
}

.path-part.path-last:hover {
    filter: brightness(1.1);
    box-shadow: 0 2px 8px rgba(139, 92, 246, 0.3);
}

/* Адаптивність для мобільних */
@media (max-width: 768px) {
    .path-collapsed-toggle {
        padding: 3px 8px;
        font-size: 11px;
    }
    
    .collapsed-count {
        display: none;
    }
    
    .path-part {
        font-size: 11px;
        padding: 2px 5px;
    }
    
    .path-separator {
        margin: 0 2px;
    }
}

/* Disabled state for search panel elements during category mode */
.sp-checkbox-wrapper.disabled {
    opacity: 0.35;
    pointer-events: none;
}

.sp-location-tab.disabled {
    opacity: 0.35;
    pointer-events: none;
}

.sp-dropdown-wrapper.disabled {
    opacity: 0.35;
    pointer-events: none;
}

/* Refinement tag input active effects */
.rp-refinement-tag-input:focus {
    outline: none;
    color: #fff;
}

/* Volume menu fix */
.rp-volume-menu.show,
.rp-perpage-menu.show {
    display: block !important;
}

/* Card content selection */
.rp-card-content::selection {
    background: rgba(136, 93, 246, 0.3);
    color: #fff;
}

/* ---- Fullscreen overlay ---- */
.rp-fullscreen-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: transparent;
    z-index: 4999;
    display: none;
}

/* Fullscreen button state */
.rp-panel.fullscreen .rp-fullscreen-btn {
    background: linear-gradient(135deg, #ef4444, #dc2626);
}

.rp-panel.fullscreen .rp-fullscreen-btn:hover {
    filter: brightness(1.15);
    box-shadow: 0 4px 16px rgba(239, 68, 68, 0.4);
}

/* ---- Dashboard actions row ---- */
.rp-dashboard-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
    flex-wrap: wrap;
}

.rp-send-to-ai-wrapper {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.rp-select-link {
    background: none;
    border: none;
    padding: 0;
    font-size: 12px;
    color: #6566F1;
    cursor: pointer;
    font-family: inherit;
}

.rp-select-link:hover {
    text-decoration: underline;
    color: #885DF6;
}

.rp-select-sep {
    color: #64748b;
    user-select: none;
}

.rp-send-to-ai-btn {
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 500;
    color: #e2e8f0;
    background: rgba(101, 102, 241, 0.25);
    border: 1px solid rgba(101, 102, 241, 0.5);
    border-radius: 8px;
    cursor: pointer;
    font-family: inherit;
}

.rp-send-to-ai-btn:hover:not(:disabled) {
    background: rgba(101, 102, 241, 0.4);
    border-color: #6566F1;
}

.rp-send-to-ai-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

#resultsArea .rp-toolbar-shell .rp-send-to-ai-btn {
    color: #34d399;
    background: rgba(6, 78, 59, 0.5);
    border: 1px solid rgba(45, 212, 191, 0.42);
    box-shadow: inset 0 0 0 1px rgba(16, 185, 129, 0.12);
}

#resultsArea .rp-toolbar-shell .rp-send-to-ai-btn:hover:not(:disabled) {
    color: #d1fae5;
    background: rgba(13, 148, 136, 0.58);
    border-color: rgba(45, 212, 191, 0.62);
}

#resultsArea .rp-toolbar-shell .rp-send-to-ai-btn:disabled {
    color: rgba(226, 232, 240, 0.64);
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.12);
    box-shadow: none;
}

.rp-clear-page-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 500;
    color: #94a3b8;
    background: rgba(148, 163, 184, 0.12);
    border: 1px solid rgba(148, 163, 184, 0.3);
    border-radius: 8px;
    cursor: pointer;
    font-family: inherit;
}
.rp-clear-page-btn:hover {
    color: #e2e8f0;
    background: rgba(148, 163, 184, 0.2);
    border-color: rgba(148, 163, 184, 0.5);
}

/* ---- Dashboard mode badge ---- */
.rp-dashboard-mode-badge {
    display: inline-block;
    padding: 4px 14px;
    background: linear-gradient(135deg, rgba(136,93,246,0.2), rgba(101,102,241,0.25));
    border: 1px solid rgba(136,93,246,0.35);
    border-radius: 20px;
    color: #c4b5fd;
    font-size: 13px;
    font-weight: 600;
    font-style: normal;
    margin-left: 8px;
    vertical-align: middle;
}

.rp-dashboard-mode-badge--highlight {
    background: rgba(16, 185, 129, 0.12);
    border-color: rgba(16, 185, 129, 0.35);
    color: #34d399;
}

/* ---- Filter tag variants ---- */
.rp-filter-tag-mode {
    background: rgba(136,93,246,0.12);
    border-color: rgba(136,93,246,0.4);
    color: #c4b5fd;
}

.rp-filter-tag-cat {
    background: rgba(250,204,21,0.08);
    border-color: rgba(250,204,21,0.3);
    color: #fbbf24;
}

/* PP count per page badge */
.rp-perpage-btn span {
    text-align: center;
}

/* Category panel fullscreen btn position */
.rp-cat-fullscreen-btn {
    margin-left: auto;
}

/* ============================================
   RESPONSIVE
   ============================================ */

/* Tablet */
@media (max-width: 1100px) {
    .search-container {
        padding: 16px;
    }
    .rp-bottom-bar {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
        left: 0 !important; /* On tablet/mobile, sidebar overlays so bar is full width */
    }
    .rp-filters-display {
        justify-content: center;
    }
}

/* Mobile */
@media (max-width: 768px) {
    .main-layout {
        padding-left: 0 !important;
    }
    .sidebar-panel {
        width: 260px;
        z-index: 2000;
        transform: translateX(-100%);
    }
    .sidebar-panel:not(.collapsed) {
        transform: translateX(-100%);
    }
    .sidebar-panel.mobile-open {
        transform: translateX(0) !important;
    }
    .sidebar-toggle-btn,
    .sidebar-toggle-btn.shifted {
        left: 12px !important;
        top: 10px;
    }
    .search-container {
        padding: 56px 10px 12px; /* top padding for toggle button */
    }
    .sp-search-row {
        flex-wrap: wrap;
    }
    .sp-settings-row {
        flex-direction: column;
        gap: 8px;
    }
    .rp-dashboard-header {
        flex-direction: column;
        gap: 10px;
        align-items: flex-start;
    }
    .rp-card-header {
        gap: 6px;
        padding: 10px 12px;
    }
    .rp-card-header-top {
        gap: 6px;
    }
    .rp-card-actions {
        width: 100%;
        justify-content: flex-end;
    }
    .rp-refinement-section {
        flex-direction: column;
        align-items: stretch;
    }
    .rp-volume-section {
        flex-wrap: wrap;
    }
    .rp-cat-dashboard {
        flex-direction: column;
        gap: 8px;
    }
    .dialog-panel {
        max-height: 400px;
    }
    .message-content {
        max-width: 90%;
    }
}

/* Small phones */
@media (max-width: 480px) {
    .search-container {
        padding: 54px 6px 8px;
    }
    .sp-panel {
        border-radius: 10px;
    }
    .rp-panel {
        border-radius: 10px;
    }
    .rp-title-label {
        font-size: 16px;
    }
    .rp-title-count {
        font-size: 20px;
    }
    .rp-card-content {
        font-size: 13px;
        line-height: 1.6;
    }
}

/* Mobile sidebar overlay */
.sidebar-mobile-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1999;
}
.sidebar-mobile-overlay.visible {
    display: block;
}

/* Loading overlay - solid color only (no blur) */
.loading-overlay:not(.hidden) {
    background: #0f0a2e !important;
}
.loading-text {
    color: #c4b5fd !important;
}

/* Стару модалку/панель уточнень не показуємо — уточнення тільки через нову панель у результатах */
#clarificationBox,
.clarification-box,
#clarificationPanel,
.clarification-panel,
.clarification-overlay {
    display: none !important;
    visibility: hidden !important;
    pointer-events: none !important;
}

/* Disable blur on all overlays to prevent post-search blur */
#loadingOverlay,
.rp-fullscreen-overlay,
.sidebar-mobile-overlay,
.sidebar-overlay,
.modal {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}
#loadingOverlay *,
.loading-overlay * {
    filter: none !important;
}

/* Buttons general dark theme */
.btn {
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}
.btn-primary {
    background: linear-gradient(135deg, #6566F1, #885DF6) !important;
    color: #fff !important;
    border: none !important;
}
.btn-primary:hover {
    filter: brightness(1.15);
}
.btn-secondary {
    background: rgba(255,255,255,0.06) !important;
    color: #94a3b8 !important;
    border: 1px solid rgba(255,255,255,0.12) !important;
}
.btn-secondary:hover {
    background: rgba(255,255,255,0.1) !important;
    color: #e2e8f0 !important;
}

/* На сторінці категоризатора закресленої панелі «Пошук» не має бути */
body.page-categorizer .search-container,
body.page-categorizer .sticky-top-panel .search-container {
    display: none !important;
}
body.page-categorizer {
    overflow: hidden;
}
body.page-categorizer .main-layout {
    min-height: 100dvh;
    height: 100dvh;
    overflow: hidden;
}
body.page-categorizer .sticky-top-panel {
    flex: 0 0 auto;
}
/* На великому екрані — компактні відступи; на мобільному керує глобальний блок MOBILE UX (один ряд + скрол) */
@media (min-width: 769px) {
    body.page-categorizer .top-nav-bar {
        gap: 6px;
        padding: 6px 18px;
    }
    body.page-categorizer .top-nav-btn,
    body.page-categorizer .top-nav-balance {
        padding-top: 7px;
        padding-bottom: 7px;
    }
}
/* Завжди один ряд навігації на всіх ширинах (як інші підмодулі) */
body.page-categorizer .top-nav-bar {
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
body.page-categorizer .top-nav-bar::-webkit-scrollbar {
    display: none;
}
body.page-categorizer .top-nav-btn,
body.page-categorizer .top-nav-balance {
    flex: 0 0 auto;
}
body.page-categorizer #searchStatus {
    display: none !important;
}
/* Приховати окремі вкладки «Місце пошуку», якщо панель колись показується */
body.page-categorizer #searchModeCategory,
body.page-categorizer #searchModeRequisites {
    display: none !important;
}

/* ============================================
   КАТЕГОРИЗАТОР (окрема сторінка)
   ============================================ */
.categorizer-section {
    position: relative;
    flex: 1 1 auto;
    min-height: 0;
    width: 100%;
    padding: 2px clamp(14px, 1.6vw, 24px) clamp(10px, 1.4vh, 14px);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    box-sizing: border-box;
}

.categorizer-panel {
    flex: 1 1 auto;
    width: min(100%, 1700px);
    min-width: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    color: var(--text-primary);
    margin: 0 auto;
    box-shadow: 0 18px 42px rgba(2, 6, 23, 0.24);
}

.categorizer-close {
    flex-shrink: 0;
    color: #f87171;
    border-color: rgba(248, 113, 113, 0.35);
    background: rgba(127, 29, 29, 0.22);
    line-height: 1;
}

.categorizer-close:hover {
    color: #fff;
    background: rgba(239, 68, 68, 0.28);
    border-color: rgba(248, 113, 113, 0.6);
}

.categorizer-add-status {
    display: none;
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    background: rgba(255,255,255,0.04);
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}
.categorizer-add-status--success {
    color: var(--success-color, #10b981);
}
.categorizer-add-status--error {
    color: var(--error-color, #ef4444);
}

.categorizer-mobile-top-stack {
    display: block;
    flex-shrink: 0;
}

.categorizer-mobile-top-toggle {
    display: none;
}

.categorizer-mobile-top-expandable {
    display: block;
}

.categorizer-search-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    flex: 0 0 auto;
}

.categorizer-top-reveal-btn {
    display: none;
}

.categorizer-top-collapse-btn {
    display: none;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: 14px;
    border: 1px solid rgba(148, 163, 184, 0.28);
    background: rgba(15, 23, 42, 0.55);
    color: #e2e8f0;
    cursor: pointer;
    transition: border-color 0.2s ease, transform 0.2s ease, background 0.2s ease;
}

.categorizer-top-collapse-btn:hover {
    border-color: rgba(125, 211, 252, 0.45);
    background: rgba(15, 23, 42, 0.72);
    transform: translateY(-1px);
}

/* Панель пошуку НЕ зникає при скролі */
.categorizer-sticky-toolbar {
    position: sticky;
    top: 0;
    z-index: 2;
    background: var(--bg-color);
    border-bottom: 1px solid var(--border-color);
    padding: 8px 16px;
    flex-shrink: 0;
}

.categorizer-search-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.categorizer-article-quick-input {
    flex: 0 0 clamp(180px, 13vw, 230px);
    min-width: 0;
}

.categorizer-search-input-wrap {
    position: relative;
    flex: 1 1 420px;
    min-width: 0;
}

.categorizer-search-input {
    padding-right: 44px;
}

.categorizer-search-clear-btn {
    position: absolute;
    top: 50%;
    right: 10px;
    transform: translateY(-50%);
    width: 24px;
    height: 24px;
    border: none;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.08);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    transition: background 0.2s, color 0.2s, opacity 0.2s;
}

.categorizer-search-clear-btn:hover {
    background: rgba(129, 140, 248, 0.18);
    color: var(--text-primary);
}

.categorizer-search-clear-btn--hidden {
    opacity: 0;
    pointer-events: none;
}

.categorizer-refresh-btn {
    min-height: 42px;
    padding: 0 16px;
    font-size: 14px;
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    color: var(--text-primary);
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.2s, border-color 0.2s;
}

.categorizer-refresh-btn:hover {
    background: rgba(255,255,255,0.08);
    border-color: var(--primary-color);
}

.categorizer-filter-btn {
    background: rgba(79, 70, 229, 0.26);
    border-color: rgba(129, 140, 248, 0.44);
    color: #eef2ff;
    font-weight: 800;
}

.categorizer-filter-btn:hover {
    background: rgba(99, 102, 241, 0.36);
    border-color: rgba(165, 180, 252, 0.62);
}

.categorizer-refresh-btn:disabled {
    opacity: 0.72;
    cursor: progress;
}

.categorizer-refresh-btn.is-loading {
    cursor: progress;
    opacity: 0.88;
}

.categorizer-group-actions {
    display: flex;
    gap: 8px;
    margin-top: 0;
    flex: 0 0 auto;
    flex-wrap: nowrap;
    align-items: center;
}

.categorizer-group-btn {
    min-height: 42px;
    padding: 7px 14px;
    font-size: 12px;
    line-height: 1.2;
    background: linear-gradient(135deg, #5b5ff4 0%, #7c4dff 100%);
    border: 1px solid rgba(167, 139, 250, 0.45);
    border-radius: 8px;
    color: #fff;
    cursor: pointer;
    font-weight: 800;
    text-transform: none;
    box-shadow: 0 8px 18px rgba(76, 29, 149, 0.22);
    transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease;
}

.categorizer-toolbar-close {
    width: 42px;
    height: 42px;
    min-width: 42px;
    border-radius: 10px;
    font-size: 24px;
}

.categorizer-group-btn:hover {
    transform: translateY(-1px);
    filter: brightness(1.06);
    border-color: rgba(45, 212, 191, 0.5);
    box-shadow: 0 10px 22px rgba(76, 29, 149, 0.28);
}

.categorizer-group-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.categorizer-group-btn.is-added {
    background: rgba(16, 185, 129, 0.25);
    border-color: rgba(16, 185, 129, 0.5);
    color: #d1fae5;
}

.categorizer-group-btn.is-added:hover {
    background: rgba(16, 185, 129, 0.25);
}

.categorizer-group-btn.is-loading {
    cursor: progress;
    opacity: 0.85;
}

.categorizer-tree-wrap {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: auto;
    padding: 8px 10px 10px 12px;
    position: relative;
    scrollbar-gutter: stable both-edges;
    overscroll-behavior: contain;
}

.categorizer-tree-wrap--loading {
    min-height: min(240px, 42vh);
}

.categorizer-tree-wrap .categories-tree {
    width: 100%;
    min-width: 0;
}

.categorizer-loading {
    position: absolute;
    inset: 0;
    margin: auto;
    width: fit-content;
    height: fit-content;
    max-width: 90%;
    z-index: 3;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    color: var(--text-secondary);
    font-size: 16px;
}

.categorizer-loading-spinner {
    display: block;
    width: 44px;
    height: 44px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.9s linear infinite;
}

.categorizer-loading-text {
    font-size: 15px;
    color: var(--text-secondary);
}

/* Усунути білу смугу у дочірніх категоріях */
.categorizer-tree-wrap .category-children {
    background: transparent !important;
    margin-top: 6px;
    margin-left: 10px;
    padding-left: 10px;
}

.categorizer-tree-wrap .category-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: flex-start;
    position: relative;
    column-gap: 12px;
    row-gap: 8px;
    background: var(--bg-color) !important;
    border: 1px solid var(--border-color);
    gap: 0;
    padding: 8px 10px 8px 12px;
    flex-wrap: nowrap;
    overflow: visible;
}

.categorizer-tree-wrap .category-header:hover {
    transform: none;
}

.categorizer-tree-wrap .category-header-main {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    min-width: 0;
}

.categorizer-tree-wrap .category-header-leading {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 0 0 auto;
    padding-top: 2px;
}

.categorizer-tree-wrap .category-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 0 0 auto;
    min-width: max-content;
    padding-left: 8px;
}

.categorizer-tree-wrap .category-header-actions > * {
    flex-shrink: 0;
}

.categorizer-tree-wrap .category-node .category-node:not(.category-node-open) > .category-header:not(.category-header-open) {
    background: var(--bg-color) !important;
}

.categorizer-tree-wrap .category-node-open-path > .category-header {
    border-left: 3px solid rgba(129, 140, 248, 0.42);
    box-shadow: inset 0 0 0 1px rgba(129, 140, 248, 0.08);
}

.categorizer-tree-wrap .category-node-open > .category-header,
.categorizer-tree-wrap .category-header-open {
    background: linear-gradient(90deg, rgba(99, 102, 241, 0.28) 0%, rgba(36, 22, 92, 0.96) 42%, rgba(10, 6, 46, 0.98) 100%) !important;
    border-color: rgba(129, 140, 248, 0.62);
    border-left-color: rgba(129, 140, 248, 0.92);
    box-shadow: 0 14px 30px rgba(30, 27, 75, 0.22), inset 0 0 0 1px rgba(165, 180, 252, 0.1);
}

.categorizer-tree-wrap .category-node-open > .category-children {
    margin-top: 8px;
    margin-left: 12px;
    padding-left: 12px;
}

.categorizer-tree-wrap .category-node-open > .category-children::before {
    left: 0;
    top: 4px;
    bottom: 8px;
    width: 2px;
    background: linear-gradient(180deg, rgba(129, 140, 248, 0.95) 0%, rgba(129, 140, 248, 0.22) 100%);
    box-shadow: 0 0 14px rgba(99, 102, 241, 0.12);
}

.categorizer-tree-wrap .category-node-open > .category-children > .category-node {
    margin-bottom: 8px;
}

/* Довгі назви: перенос блоками, щоб текст не виходив за межі */
.categorizer-tree-wrap .category-expand-btn {
    display: none !important;
}

.categorizer-tree-wrap .category-node[data-leaf="false"] > .category-header::before {
    content: '+';
    position: absolute;
    left: -27px;
    top: 50%;
    z-index: 2;
    width: 22px;
    height: 22px;
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transform: translateY(-50%);
    border-radius: 999px;
    border: 1px solid rgba(125, 211, 252, 0.42);
    background: linear-gradient(180deg, #38bdf8 0%, #0284c7 100%);
    box-shadow: 0 0 0 2px rgba(2, 132, 199, 0.14), 0 0 14px rgba(14, 165, 233, 0.38);
    color: #fff;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 19px;
    font-weight: 800;
    line-height: 1;
    text-align: center;
    cursor: pointer;
    pointer-events: auto;
}

.categorizer-tree-wrap .category-node[data-level="0"][data-leaf="false"] > .category-header::before {
    display: none;
}

.categorizer-tree-wrap .category-node-open[data-leaf="false"] > .category-header::before {
    content: '\2212';
    font-size: 21px;
}

.categorizer-tree-wrap .category-node {
    --categorizer-name-size: 16px;
    --categorizer-name-color: #ffffff;
    --categorizer-name-weight: 400;
    --categorizer-name-transform: none;
    --categorizer-subtitle-size: 17px;
    --categorizer-subtitle-color: #fa0505;
    --categorizer-subtitle-weight: 700;
}

.categorizer-tree-wrap .category-node[data-level="0"] {
    --categorizer-name-size: 24px;
    --categorizer-name-color: #6566f1;
    --categorizer-name-weight: 800;
    --categorizer-name-transform: uppercase;
    --categorizer-subtitle-size: 17px;
}

.categorizer-tree-wrap .category-node[data-level="1"] {
    --categorizer-name-size: 20px;
    --categorizer-name-color: #6566f1;
    --categorizer-name-weight: 800;
    --categorizer-name-transform: uppercase;
    --categorizer-subtitle-size: 17px;
}

.categorizer-tree-wrap .category-node[data-level="2"] {
    --categorizer-name-size: 18px;
    --categorizer-name-color: #ffffff;
    --categorizer-name-weight: 700;
    --categorizer-name-transform: none;
    --categorizer-subtitle-size: 17px;
}

.categorizer-tree-wrap .category-node[data-level="3"] {
    --categorizer-name-size: 17px;
    --categorizer-name-color: #ffffff;
    --categorizer-name-weight: 700;
    --categorizer-name-transform: none;
    --categorizer-subtitle-size: 17px;
}

.categorizer-tree-wrap .category-name-wrap {
    flex: 1 1 auto;
    min-width: 0;
    max-width: none;
    display: inline-flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 8px;
    word-break: break-word;
    overflow-wrap: break-word;
}

.categorizer-tree-wrap .category-sub-title {
    font-size: var(--categorizer-subtitle-size);
    font-weight: var(--categorizer-subtitle-weight);
    color: var(--categorizer-subtitle-color);
    text-transform: var(--categorizer-name-transform);
    line-height: 1.2;
}

.categorizer-tree-wrap .category-name {
    display: block;
    word-break: break-word;
    overflow-wrap: break-word;
    white-space: normal;
    line-height: 1.35;
    font-size: var(--categorizer-name-size);
    color: var(--categorizer-name-color);
    font-weight: var(--categorizer-name-weight);
    text-transform: var(--categorizer-name-transform);
}

.categorizer-tree-wrap .category-node[data-level="0"] > .category-header .category-name,
.categorizer-tree-wrap .category-node[data-level="1"] > .category-header .category-name {
    letter-spacing: 0.05em;
}

.categorizer-tree-wrap .category-node-leaf:not(.category-row-selected) > .category-header {
    border-color: rgba(52, 211, 153, 0.28);
    box-shadow: inset 0 0 0 1px rgba(16, 185, 129, 0.05);
}

.categorizer-tree-wrap .category-row-checkbox {
    margin-top: 1px;
}

.categorizer-tree-wrap .category-leaf-indicator,
.categorizer-tree-wrap .category-type,
.categorizer-tree-wrap .category-pp-count,
.categorizer-tree-wrap .categorizer-force-toggle,
.categorizer-tree-wrap .category-view-articles-btn,
.categorizer-tree-wrap .category-add-to-chat-btn {
    flex-shrink: 0;
}

.categorizer-tree-wrap .category-view-articles-btn {
    margin-left: 0;
    width: 36px;
    height: 36px;
    min-width: 36px;
}

/* Візуалізація при розкритті категорії */
.category-header.category-expanding {
    opacity: 0.85;
    background: rgba(101, 102, 241, 0.12) !important;
    transition: opacity 0.15s ease, background 0.15s ease;
}

.category-articles-loading-note {
    font-size: 13px;
    color: var(--text-secondary);
    max-width: 420px;
}

.category-articles-empty.is-error {
    color: #fca5a5;
}

.category-action-btn-icon {
    width: 36px;
    min-width: 36px;
    height: 36px;
    padding: 0;
    gap: 0;
    justify-content: center;
}

.category-action-btn-icon svg,
.category-view-articles-btn svg,
.rp-cat-card-viewpp-btn svg {
    flex-shrink: 0;
}

/* ============================================
   КАБІНЕТ (overview) + Закладки
   ============================================ */
.overview-section {
    position: relative;
    min-height: 100vh;
    padding: 60px 40px 40px;
    overflow: hidden;
}

.overview-bg {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse at 20% 50%, rgba(101,102,241,0.18) 0%, transparent 60%),
        radial-gradient(ellipse at 80% 20%, rgba(136,93,246,0.14) 0%, transparent 50%),
        radial-gradient(ellipse at 60% 80%, rgba(59,130,246,0.1) 0%, transparent 50%),
        linear-gradient(180deg, #0e0b20 0%, #13102b 100%);
    z-index: 0;
}

.overview-content {
    position: relative;
    z-index: 1;
    max-width: 900px;
    margin: 0 auto;
}

.overview-title {
    font-size: 32px;
    font-weight: 700;
    background: linear-gradient(135deg, #a78bfa, #6366f1, #3b82f6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 8px;
}

.overview-subtitle {
    font-size: 16px;
    color: #94a3b8;
    margin-bottom: 22px;
}

.overview-ai-search-form {
    display: flex;
    align-items: center;
    gap: 8px;
    width: min(100%, 780px);
    min-height: 46px;
    margin: 0 auto 32px;
    padding: 5px 6px 5px 14px;
    border-radius: 7px;
    border: 1px solid rgba(218, 220, 224, 0.96);
    background: #ffffff;
    color: #0f172a;
    box-shadow: 0 12px 32px rgba(7, 12, 34, 0.2);
    animation: overview-ai-search-pulse 2.8s ease-in-out infinite;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.overview-ai-search-form:focus-within {
    border-color: #60a5fa;
    box-shadow:
        0 0 0 3px rgba(96, 165, 250, 0.22),
        0 16px 42px rgba(7, 12, 34, 0.26);
}

.overview-ai-search-label {
    flex: 0 0 auto;
    font-size: 16px;
    font-weight: 700;
    color: #020617;
    white-space: nowrap;
}

.overview-ai-search-input {
    flex: 1;
    min-width: 120px;
    border: none;
    outline: none;
    background: transparent;
    color: #0f172a;
    font: inherit;
    font-size: 14px;
    line-height: 1.45;
}

.overview-ai-search-input::placeholder {
    color: #475569;
}

.overview-ai-search-submit {
    display: none;
}

@keyframes overview-ai-search-pulse {
    0%, 100% {
        border-color: rgba(218, 220, 224, 0.96);
        box-shadow: 0 12px 32px rgba(7, 12, 34, 0.2);
    }
    45% {
        border-color: rgba(59, 130, 246, 0.95);
        box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.2), 0 16px 38px rgba(7, 12, 34, 0.28);
    }
}

@media (max-width: 640px) {
    .overview-ai-search-form {
        align-items: stretch;
        flex-wrap: wrap;
        padding: 10px;
    }
    .overview-ai-search-label {
        width: 100%;
    }
    .overview-ai-search-submit {
        width: 42px;
        height: 42px;
    }
}

.overview-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.overview-card {
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 14px;
    padding: 24px;
    transition: all 0.25s;
    cursor: default;
}

.overview-card-clickable {
    cursor: pointer;
}

.overview-card-link {
    text-decoration: none;
    color: inherit;
    display: block;
}

.overview-card:hover {
    background: rgba(255,255,255,0.07);
    border-color: rgba(136,93,246,0.3);
    box-shadow: 0 8px 32px rgba(136,93,246,0.12);
    transform: translateY(-2px);
}

.overview-card-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(101,102,241,0.2), rgba(136,93,246,0.2));
    display: flex;
    align-items: center;
    justify-content: center;
    color: #a78bfa;
    margin-bottom: 14px;
}

.overview-card-title {
    font-size: 16px;
    font-weight: 600;
    color: #e2e8f0;
    margin-bottom: 8px;
}

.overview-card-desc {
    font-size: 13px;
    color: #94a3b8;
    line-height: 1.5;
}

.overview-stats {
    display: flex;
    gap: 32px;
    padding: 24px 0;
    border-top: 1px solid rgba(255,255,255,0.08);
}

.overview-stat {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.overview-stat-value {
    font-size: 28px;
    font-weight: 700;
    color: #a78bfa;
}

.overview-stat-label {
    font-size: 12px;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Розділ Закладки в Кабінеті */
.overview-bookmarks {
    margin-top: 48px;
    padding-top: 32px;
    border-top: 1px solid rgba(255,255,255,0.08);
}

.overview-bookmarks-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 4px;
}

.overview-back-to-results-btn {
    padding: 6px 14px;
    background: rgba(136, 93, 246, 0.25);
    border: 1px solid rgba(136, 93, 246, 0.5);
    border-radius: 8px;
    color: #c4b5fd;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}

.overview-back-to-results-btn:hover {
    background: rgba(136, 93, 246, 0.4);
    color: #e2e8f0;
}

.overview-bookmarks-title {
    font-size: 20px;
    font-weight: 600;
    color: #e2e8f0;
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.overview-bookmarks-title svg {
    color: #a78bfa;
    flex-shrink: 0;
}

.overview-bookmarks-desc {
    font-size: 13px;
    color: #94a3b8;
    margin-bottom: 20px;
    line-height: 1.5;
}

.overview-bookmarks-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.overview-bookmarks-loading,
.overview-bookmarks-error {
    font-size: 14px;
    color: #94a3b8;
    padding: 16px 0;
}

.overview-bookmarks-empty {
    font-size: 14px;
    color: #64748b;
    padding: 24px;
    background: rgba(255,255,255,0.03);
    border-radius: 12px;
    border: 1px dashed rgba(255,255,255,0.1);
}

.overview-bookmark-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 18px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 12px;
    transition: all 0.2s;
}

.overview-bookmark-item:hover {
    background: rgba(255,255,255,0.06);
    border-color: rgba(136,93,246,0.25);
}

.overview-bookmark-item-main {
    flex: 1;
    min-width: 0;
}

.overview-bookmark-item-meta {
    font-size: 12px;
    color: #64748b;
    display: block;
    margin-bottom: 4px;
}

.overview-bookmark-item-title {
    font-size: 14px;
    color: #e2e8f0;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
}

.overview-bookmark-item-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.overview-bookmark-btn {
    padding: 8px 14px;
    font-size: 12px;
    font-weight: 500;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
    border: 1px solid rgba(255,255,255,0.15);
    background: rgba(255,255,255,0.06);
    color: #e2e8f0;
}

.overview-bookmark-btn-chat:hover {
    background: rgba(101,102,241,0.25);
    border-color: rgba(101,102,241,0.5);
    color: #a5b4fc;
}

.overview-bookmark-btn-remove:hover {
    background: rgba(239,68,68,0.15);
    border-color: rgba(239,68,68,0.3);
    color: #f87171;
}

.overview-bookmarks-missing {
    font-size: 12px;
    color: #64748b;
    padding: 8px 0;
}

/* ============================================
   PROMPT EDITOR MODAL
   ============================================ */
.prompt-modal {
    position: fixed;
    inset: 0;
    z-index: 2000;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
}

.prompt-modal-content {
    background: #1a1640;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 16px;
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 24px 80px rgba(0,0,0,0.5);
}

.prompt-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.prompt-modal-header h2 {
    font-size: 18px;
    font-weight: 600;
    color: #e2e8f0;
    margin: 0;
}

.prompt-modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

.prompt-modal-desc {
    font-size: 13px;
    color: #94a3b8;
    margin-bottom: 16px;
    line-height: 1.5;
}

.prompt-editor {
    width: 100%;
    min-height: 340px;
    background: rgba(0,0,0,0.3);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 10px;
    color: #e2e8f0;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 13px;
    line-height: 1.6;
    padding: 16px;
    resize: vertical;
    outline: none;
    transition: border-color 0.2s;
}

.prompt-editor:focus {
    border-color: rgba(136,93,246,0.5);
}

.prompt-modal-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 16px;
}

.prompt-status {
    font-size: 13px;
    color: #94a3b8;
    margin-left: auto;
    transition: opacity 0.3s;
}

.prompt-status.success {
    color: #34d399;
}

.prompt-status.error {
    color: #f87171;
}

/* Category bottom bar info */
.rp-cat-bottom-info {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}

.rp-cat-bottom-label {
    font-size: 13px;
    color: #a78bfa;
    font-weight: 600;
}

/* Clear button disabled */
.sp-clear-btn.disabled {
    opacity: 0.3;
    pointer-events: none;
}

/* Clear button hidden when nothing to clear */
.sp-clear-btn.sp-clear-btn--hidden {
    visibility: hidden;
    pointer-events: none;
}

/* ============================================
   Category card paths container
   ============================================ */
/* (old grouped path styles removed) */

.rp-cat-card-toggle-paths--unused {
    display: flex;
    align-items: center;
    gap: 4px;
    background: none;
    border: 1px solid rgba(255,255,255,0.1);
    color: #a78bfa;
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    margin-top: 4px;
    transition: all 0.2s;
}

.rp-cat-card-toggle-paths--unused:hover {
    background: rgba(136,93,246,0.1);
    border-color: rgba(136,93,246,0.3);
}

/* Entity color variants — білий текст для читабельності на яскравому фоні */
.rp-cat-card-entity.entity-criminal {
    background: linear-gradient(135deg, #7c3aed, #6d28d9);
    color: #fff;
}

.rp-cat-card-entity.entity-civil {
    background: linear-gradient(135deg, #06b6d4, #0891b2);
    color: #fff;
}

.rp-cat-card-entity.entity-admin {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #fff;
}

.rp-cat-card-entity.entity-commercial {
    background: linear-gradient(135deg, #10b981, #059669);
    color: #fff;
}

.rp-cat-card-entity.entity-vp {
    background: linear-gradient(135deg, #ec4899, #db2777);
    color: #fff;
}

.rp-cat-card-entity.entity-espl {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: #fff;
}

/* Debug button in category dashboard */
.rp-cat-debug-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    background: rgba(251, 191, 36, 0.15);
    border: 1px solid rgba(251, 191, 36, 0.3);
    color: #fbbf24;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.rp-cat-debug-btn:hover {
    background: rgba(251, 191, 36, 0.25);
    border-color: rgba(251, 191, 36, 0.5);
}

/* ============================================
   Category Prompt Debug Panel
   ============================================ */
.cat-prompt-debug-panel {
    background: #1a1640;
    border: 1px solid rgba(251, 191, 36, 0.3);
    border-radius: 12px;
    margin-top: 12px;
    overflow: hidden;
}

.cat-prompt-debug-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: rgba(251, 191, 36, 0.08);
    border-bottom: 1px solid rgba(251, 191, 36, 0.15);
}

.cat-prompt-debug-header h3 {
    margin: 0;
    font-size: 14px;
    color: #fbbf24;
    font-weight: 700;
}

.cat-prompt-debug-meta {
    flex: 1;
    font-size: 12px;
    color: #94a3b8;
}

.cat-prompt-debug-meta b {
    color: #e2e8f0;
}

.cat-prompt-debug-close {
    background: none;
    border: none;
    color: #94a3b8;
    font-size: 20px;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
}

.cat-prompt-debug-close:hover {
    color: #f87171;
}

.cat-prompt-debug-body {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 600px;
    overflow-y: auto;
}

.cat-prompt-debug-section {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.cat-prompt-debug-label {
    font-size: 12px;
    font-weight: 600;
    color: #a78bfa;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.cat-prompt-debug-textarea {
    width: 100%;
    box-sizing: border-box;
    background: rgba(0,0,0,0.3);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 8px;
    color: #e2e8f0;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 12px;
    line-height: 1.5;
    padding: 10px;
    resize: vertical;
    outline: none;
}

.cat-prompt-debug-textarea:focus {
    border-color: rgba(251,191,36,0.4);
}

/* ============================================
   AI CHAT INTEGRATION STYLES
   ============================================ */

/* Chat button in sidebar - 3 states */
#goToAIChatBtnSidebar {
    position: relative;
}

.sidebar-add-to-chat-wrap {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 8px 14px;
    margin-top: 4px;
}
.sidebar-add-to-chat-label {
    font-size: 10px;
    color: #64748b;
    font-weight: 500;
}
.sidebar-add-to-chat-select {
    font-size: 11px;
    padding: 4px 8px;
    border-radius: 6px;
    border: 1px solid rgba(255,255,255,0.15);
    background: rgba(0,0,0,0.2);
    color: var(--text-color, #e2e8f0);
    max-width: 100%;
    cursor: pointer;
}

.sidebar-chat-badge {
    background: var(--primary-color);
    color: white;
    font-size: 10px;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 8px;
    min-width: 16px;
    text-align: center;
    line-height: 1.4;
    margin-left: auto;
}

/* Ready state: PP loaded, pulsing glow */
.sidebar-nav-btn-ready {
    background: rgba(16,185,129,0.12) !important;
    color: #34d399 !important;
    border-color: rgba(16,185,129,0.3) !important;
    animation: chatBtnPulse 2s infinite;
}

@keyframes chatBtnPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(16,185,129,0.2); }
    50% { box-shadow: 0 0 8px 2px rgba(16,185,129,0.15); }
}

/* "AI аналіз СР" button on PP search cards */
.rp-card-ai-analysis {
    min-height: 32px;
    padding: 0 12px;
    border-radius: 10px;
    border: 1px solid #10b981;
    background: rgba(16, 185, 129, 0.1);
    color: #d1fae5;
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
    cursor: pointer;
    transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

.rp-card-ai-analysis:hover {
    background: rgba(16,185,129,0.18);
    border-color: #34d399;
    color: #ecfdf5;
}

.rp-card-similar-btn,
.modal-article-similar-btn {
    min-height: 32px;
    padding: 0 12px;
    border-radius: 8px;
    border: 1px solid rgba(59, 130, 246, 0.38);
    background: rgba(59, 130, 246, 0.12);
    color: #bfdbfe;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 800;
    line-height: 1;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease, transform 0.18s ease;
    font-family: inherit;
}

.rp-card-similar-btn:hover,
.modal-article-similar-btn:hover {
    background: rgba(59, 130, 246, 0.2);
    border-color: rgba(96, 165, 250, 0.62);
    color: #eff6ff;
}

/* "Додати в AI чат" action button on PP cards */
.rp-card-action-btn-chat {
    color: #a5b4fc !important;
}

.rp-card-action-btn-chat:hover {
    color: var(--primary-color) !important;
    background: rgba(101,102,241,0.15) !important;
}

.rp-card-action-btn-chat-added {
    color: var(--success-color) !important;
    background: rgba(16,185,129,0.15) !important;
}

/* "Додати в AI чат" button in category dashboard */
.rp-cat-add-to-chat-btn {
    background: rgba(101,102,241,0.1) !important;
    color: #a5b4fc !important;
    border-color: rgba(101,102,241,0.25) !important;
}

.rp-cat-add-to-chat-btn:hover:not(:disabled) {
    background: rgba(101,102,241,0.2) !important;
    color: #c4b5fd !important;
}

.rp-cat-add-to-chat-btn:disabled {
    opacity: 0.4;
}

/* ============================================
   Category Search Refresh (AI chat visual language)
   ============================================ */
.sticky-top-panel .search-container,
.search-container {
    max-width: 1280px;
    width: min(100%, 1280px);
    margin: 0 auto;
}

.rp-cat-dashboard {
    gap: 12px;
    align-items: center;
    width: 100%;
}

.rp-cat-select-all {
    flex: 0 0 auto;
    width: 48px;
    height: 48px;
    border-radius: 14px;
    border: 1px solid rgba(129, 140, 248, 0.26);
    background: rgba(255, 255, 255, 0.05);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.03);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s, box-shadow 0.2s;
}

.rp-cat-select-all:hover {
    background: rgba(101, 102, 241, 0.14);
    border-color: rgba(129, 140, 248, 0.42);
    box-shadow: 0 0 0 4px rgba(101, 102, 241, 0.08);
}

.rp-cat-select-all input {
    width: 24px;
    height: 24px;
    margin: 0;
    accent-color: #34d399;
    cursor: pointer;
}

.rp-cat-select-all.is-indeterminate {
    border-color: rgba(96, 165, 250, 0.48);
    background: rgba(96, 165, 250, 0.14);
}

.rp-cat-stat {
    padding: 10px 18px;
    border-radius: 14px;
    border: 1px solid rgba(129, 140, 248, 0.24);
    background: linear-gradient(135deg, rgba(30, 21, 85, 0.92) 0%, rgba(15, 10, 46, 0.98) 100%);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.rp-cat-stat-label {
    color: #cbd5e1;
    font-size: 18px;
    font-weight: 600;
    font-style: normal;
}

.rp-cat-stat-value {
    color: #34d399;
    font-size: 24px;
    font-weight: 800;
}

.rp-cat-stat-meta {
    color: #a5b4fc;
    font-size: 15px;
    font-weight: 700;
    white-space: nowrap;
}

.rp-cat-fullscreen-btn {
    order: 99;
    margin-left: auto;
}

.rp-cat-show-pp-btn {
    min-height: 44px;
    padding: 10px 18px;
    border-radius: 12px;
    border: 1px solid rgba(96, 165, 250, 0.32);
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.86), rgba(37, 99, 235, 0.92));
    box-shadow: 0 10px 24px rgba(37, 99, 235, 0.22);
}

.rp-cat-show-pp-btn:hover:not(:disabled) {
    transform: translateY(-1px);
    filter: brightness(1.06);
}

.rp-cat-show-pp-btn:disabled {
    opacity: 0.35;
    box-shadow: none;
}

.rp-category-results-list {
    padding: 12px;
    gap: 12px;
    background: linear-gradient(180deg, rgba(15, 10, 46, 0.5) 0%, rgba(8, 6, 25, 0.9) 100%);
    border-top: 1px solid rgba(129, 140, 248, 0.12);
}

.rp-cat-card {
    background: linear-gradient(135deg, rgba(26, 17, 69, 0.94) 0%, rgba(15, 10, 46, 0.98) 100%);
    border: 1px solid rgba(129, 140, 248, 0.16);
    border-radius: 16px;
    padding: 16px 18px;
    box-shadow: 0 14px 32px rgba(7, 10, 34, 0.24);
    cursor: pointer;
}

.rp-cat-card:last-child {
    border-bottom: 1px solid rgba(129, 140, 248, 0.16);
}

.rp-cat-card:hover {
    background: linear-gradient(135deg, rgba(34, 24, 92, 0.98) 0%, rgba(18, 13, 58, 1) 100%);
    border-color: rgba(129, 140, 248, 0.28);
    transform: translateY(-1px);
}

.rp-cat-card.expanded {
    background: linear-gradient(135deg, rgba(34, 24, 92, 0.98) 0%, rgba(14, 11, 46, 1) 100%);
    border-color: rgba(129, 140, 248, 0.44);
    box-shadow: 0 20px 40px rgba(7, 10, 34, 0.34), inset 0 0 0 1px rgba(129, 140, 248, 0.12);
}

.rp-cat-card-added {
    border-color: rgba(16, 185, 129, 0.52);
    box-shadow: 0 16px 34px rgba(5, 150, 105, 0.16), inset 0 0 0 1px rgba(16, 185, 129, 0.16);
}

.rp-cat-card-header {
    align-items: flex-start;
    gap: 14px;
}

.rp-cat-card-block3 {
    gap: 8px;
}

.rp-cat-card-checkbox {
    border-color: rgba(148, 163, 184, 0.4);
    background: rgba(15, 10, 46, 0.76);
}

.rp-cat-card-checkbox.checked {
    background: linear-gradient(135deg, #10b981, #059669);
    border-color: rgba(16, 185, 129, 0.85);
}

.rp-cat-card-rank {
    background: rgba(129, 140, 248, 0.18);
    color: #e0e7ff;
}

.rp-cat-card-name {
    color: #eef2ff;
}

.rp-cat-card-pp-count {
    background: rgba(129, 140, 248, 0.16);
    border: 1px solid rgba(129, 140, 248, 0.18);
    color: #c7d2fe;
}

.rp-cat-card-expand-toggle {
    background: rgba(96, 165, 250, 0.18);
    border: 1px solid rgba(96, 165, 250, 0.22);
    color: #bfdbfe;
}

.rp-cat-card-expand-toggle:hover {
    background: rgba(96, 165, 250, 0.28);
}

.rp-cat-card-expand-toggle.expanded {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    border-color: rgba(96, 165, 250, 0.48);
}

.rp-cat-card-viewpp-btn,
.category-view-articles-btn {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(129, 140, 248, 0.2);
    color: #cbd5e1;
    box-shadow: none;
}

.rp-cat-card-viewpp-btn:hover,
.category-view-articles-btn:hover {
    background: rgba(101, 102, 241, 0.18);
    border-color: rgba(129, 140, 248, 0.4);
    color: #ffffff;
}

.rp-cat-card-add-to-chat-btn,
.category-add-to-chat-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 36px;
    padding: 7px 14px;
    border-radius: 10px;
    border: 1px solid rgba(129, 140, 248, 0.34);
    background: linear-gradient(135deg, rgba(101, 102, 241, 0.9), rgba(136, 93, 246, 0.86));
    color: #ffffff;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.01em;
}

/* Десктоп: лише підпис; іконка показується в мобільній версії */
.rp-cat-card-add-to-chat-icon {
    display: none;
    align-items: center;
    justify-content: center;
}

.rp-cat-card-add-to-chat-icon svg {
    display: block;
}

.rp-cat-card-add-to-chat-btn:hover,
.category-add-to-chat-btn:hover {
    background: linear-gradient(135deg, rgba(118, 119, 255, 0.96), rgba(147, 110, 255, 0.94));
    color: #ffffff;
    border-color: rgba(167, 139, 250, 0.55);
}

.rp-cat-card-add-to-chat-btn.is-added,
.category-add-to-chat-btn.is-added {
    background: rgba(16, 185, 129, 0.15);
    border-color: rgba(16, 185, 129, 0.42);
    color: #d1fae5;
}
.rp-cat-card-add-to-chat-btn:disabled,
.category-add-to-chat-btn:disabled {
    cursor: not-allowed;
    opacity: 0.85;
}
.rp-cat-card-add-to-chat-btn:disabled:hover,
.category-add-to-chat-btn:disabled:hover {
    background: inherit;
}

/* Категоризатор, десктоп: повна кнопка «Додати в АІ чат», нейтральні кольори (не градієнт як у карток) */
@media (min-width: 769px) {
    .categorizer-tree-wrap .category-add-to-chat-btn {
        width: auto;
        height: auto;
        min-width: 0;
        max-width: none;
        min-height: 36px;
        margin-left: 0;
        padding: 7px 14px;
        gap: 8px;
        justify-content: center;
        box-sizing: border-box;
        border-radius: 10px;
        background: rgba(255, 255, 255, 0.06) !important;
        border: 1px solid rgba(129, 140, 248, 0.2) !important;
        color: #cbd5e1 !important;
        box-shadow: none !important;
        font-weight: 600;
        font-size: 12px;
        line-height: normal;
    }

    .categorizer-tree-wrap .category-add-to-chat-btn .rp-cat-card-add-to-chat-icon {
        display: none !important;
    }

    .categorizer-tree-wrap .category-add-to-chat-btn .rp-cat-card-add-to-chat-label {
        position: static !important;
        width: auto !important;
        height: auto !important;
        padding: 0 !important;
        margin: 0 !important;
        overflow: visible !important;
        clip: auto !important;
        white-space: normal !important;
        border: 0 !important;
    }

    .categorizer-tree-wrap .category-add-to-chat-btn:hover:not(:disabled) {
        background: rgba(101, 102, 241, 0.18) !important;
        border-color: rgba(129, 140, 248, 0.4) !important;
        color: #ffffff !important;
    }

    .categorizer-tree-wrap .category-add-to-chat-btn.is-added {
        background: rgba(16, 185, 129, 0.14) !important;
        border-color: rgba(16, 185, 129, 0.42) !important;
        color: #6ee7b7 !important;
    }

    .categorizer-tree-wrap .category-add-to-chat-btn.is-added:hover:not(:disabled) {
        background: rgba(16, 185, 129, 0.2) !important;
        border-color: rgba(52, 211, 153, 0.5) !important;
        color: #d1fae5 !important;
    }
}

.rp-cat-card-paths-area {
    margin-top: 14px;
    padding: 14px 16px;
    border-top: none;
    background: linear-gradient(180deg, rgba(9, 7, 28, 0.86) 0%, rgba(15, 10, 46, 0.98) 100%);
    border: 1px solid rgba(129, 140, 248, 0.14);
    border-radius: 14px;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.02);
}

.rp-cat-card-path-row {
    padding: 8px 0;
}

.rp-cat-card-path-row + .rp-cat-card-path-row {
    border-top: 1px solid rgba(129, 140, 248, 0.12);
}

.rp-cat-card-path {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(129, 140, 248, 0.12);
    color: #e2e8f0;
}

.rp-cat-card-bottom-actions {
    padding-top: 12px;
    margin-top: 10px;
    border-top: 1px solid rgba(129, 140, 248, 0.14);
}

.rp-cat-card-action.secondary {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(129, 140, 248, 0.16);
    color: #cbd5e1;
}

.rp-cat-card-action.secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
}

.rp-cat-card-path .rp-card-cat-badge.last.is-clickable {
    cursor: pointer;
    background: rgba(16, 185, 129, 0.14) !important;
    border: 1px solid rgba(16, 185, 129, 0.28) !important;
    color: #d1fae5 !important;
}

.rp-cat-card-path .rp-card-cat-badge.last.is-clickable:hover {
    background: rgba(16, 185, 129, 0.24) !important;
}

.category-node.category-added-to-chat > .category-header {
    background: linear-gradient(90deg, rgba(16, 185, 129, 0.12) 0%, var(--bg-color) 100%);
    border-left: 3px solid rgba(16, 185, 129, 0.72);
}

.rp-cat-empty-state {
    padding: 28px 24px;
    border: 1px dashed rgba(129, 140, 248, 0.28);
    border-radius: 18px;
    background: linear-gradient(135deg, rgba(31, 24, 78, 0.9) 0%, rgba(15, 11, 45, 0.96) 100%);
    color: #cbd5f5;
    font-size: 16px;
    font-weight: 600;
    text-align: center;
}

.sidebar-history {
    padding: 8px 0 2px;
}

.sidebar-history-header {
    color: #cbd5f5;
}

.sidebar-history-list {
    gap: 8px;
}

.sidebar-history-list .chat-history-item,
.sidebar-history-list > div,
.chat-history-item {
    border: 1px solid rgba(129, 140, 248, 0.12);
    border-radius: 14px;
    background: linear-gradient(135deg, rgba(28, 22, 73, 0.94) 0%, rgba(16, 11, 46, 0.98) 100%);
    color: #dbe7ff;
    box-shadow: 0 12px 28px rgba(8, 10, 24, 0.18);
}

.sidebar-history-list .chat-history-item:hover,
.sidebar-history-list > div:hover,
.chat-history-item:hover {
    background: linear-gradient(135deg, rgba(49, 35, 112, 0.96) 0%, rgba(26, 18, 72, 1) 100%);
    border-color: rgba(129, 140, 248, 0.32);
}

.sidebar-history-list .chat-history-item.active,
.sidebar-history-list > div.active,
.chat-history-item.active {
    background: linear-gradient(135deg, rgba(90, 73, 217, 0.95) 0%, rgba(64, 47, 178, 1) 100%);
    border-color: rgba(196, 181, 253, 0.42);
    color: #fff;
}

.chat-history-item .chat-title,
.chat-history-item .chat-date {
    color: inherit;
}

.chat-history-item .chat-delete {
    border-radius: 10px;
}

.sp-history-dropdown {
    border: 1px solid rgba(129, 140, 248, 0.22);
    background: linear-gradient(180deg, rgba(20, 16, 56, 0.98) 0%, rgba(12, 10, 38, 0.98) 100%);
    box-shadow: 0 30px 70px rgba(7, 10, 28, 0.45);
}

.sp-history-dropdown-header {
    color: #dbe7ff;
    border-bottom: 1px solid rgba(129, 140, 248, 0.18);
}

.sp-history-dropdown-item {
    border: 1px solid transparent;
    border-radius: 12px;
    color: #cbd5f5;
}

.sp-history-dropdown-item:hover {
    border-color: rgba(129, 140, 248, 0.26);
    background: linear-gradient(135deg, rgba(67, 56, 202, 0.24) 0%, rgba(76, 29, 149, 0.22) 100%);
}

.sp-history-dropdown-item .history-date,
.sp-history-dropdown-empty {
    color: #94a3b8;
}

/* ============================================
   MOBILE UX OVERRIDES
   ============================================ */
@media (max-width: 768px) {
    body {
        overflow-x: hidden;
    }

    /* Вузька колонка на телефоні: базовий .rp-panel використовує clamp(…, 2cm, 96px) — занадто широкі поля */
    .rp-panel {
        padding-left: 12px;
        padding-right: 12px;
    }

    /* ПП: та сама «картка», що модалка «Фільтр категоризатора» */
    #resultsArea.rp-panel {
        background: #1a1b3a;
        border: 1px solid rgba(255, 255, 255, 0.1);
        box-shadow: 0 24px 48px rgba(0, 0, 0, 0.35);
        border-radius: 14px;
    }

    #spPanelPP.sp-panel {
        background: #1a1b3a;
        border: 1px solid rgba(255, 255, 255, 0.1);
        box-shadow: 0 12px 28px rgba(0, 0, 0, 0.28);
        border-radius: 14px;
    }

    #resultsArea .rp-card {
        background: rgba(0, 0, 0, 0.22);
        border: 1px solid rgba(255, 255, 255, 0.1);
        border-top: 1px solid rgba(255, 255, 255, 0.1);
        box-shadow: 0 10px 28px rgba(0, 0, 0, 0.22);
    }

    .top-nav-bar {
        justify-content: flex-start;
        flex-wrap: nowrap;
        gap: 8px;
        padding: 8px 10px 8px 52px;
        overflow-x: auto;
        overflow-y: hidden;
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
    }

    .top-nav-bar::-webkit-scrollbar {
        display: none;
    }

    .top-nav-btn {
        flex: 0 0 auto;
        padding: 8px 12px;
        font-size: 12px;
    }

    .top-nav-balance {
        position: relative;
        transform: none;
        order: 99;
        margin-left: 0;
        flex: 0 0 auto;
    }

    .search-container {
        max-width: none;
        padding: 56px 12px 16px;
    }

    .sp-panel {
        padding: 14px 14px 12px;
        border-radius: 14px;
    }

    .sp-search-row {
        display: flex;
        flex-direction: row;
        align-items: stretch;
        gap: 8px;
        border: none;
        background: transparent;
        overflow: visible;
    }

    .sp-search-btn {
        display: none !important;
    }

    .sp-input-wrapper {
        flex: 1;
        min-width: 0;
        min-height: 44px;
        padding-right: 216px;
        border-radius: 12px 0 0 12px;
        border: 1px solid rgba(101, 102, 241, 0.4);
        border-right: none;
        overflow: hidden;
    }

    .sp-input {
        min-height: 44px;
        padding: 11px 14px;
        font-size: 15px;
        border-radius: 12px 0 0 12px;
    }

    .sp-clear-btn {
        right: 174px;
        top: 12px;
    }

    .sp-input-inline-sep {
        display: block;
        position: absolute;
        right: 42px;
        top: 50%;
        transform: translateY(-50%);
        margin: 0;
        height: 22px;
    }

    .sp-inline-search-submit {
        display: inline-flex;
        right: 6px;
    }

    .sp-ai-mode-btn {
        right: 52px;
        height: 34px;
        min-width: 112px;
        padding: 0 10px;
        font-size: 13px;
    }

    .sp-history-btn {
        border-radius: 0 12px 12px 0;
        height: 44px;
        min-width: 44px;
        padding: 10px;
        border: 1px solid rgba(101, 102, 241, 0.4);
        border-left: none;
        align-self: flex-start;
        box-sizing: border-box;
    }

    .sp-history-dropdown {
        top: calc(100% + 8px);
        right: 0;
        left: auto;
        width: min(360px, calc(100vw - 24px));
        max-width: calc(100vw - 24px);
    }

    .sp-filters-row {
        display: grid;
        grid-template-columns: minmax(0, 1fr);
        gap: 10px;
    }

    .sp-reset-all-search-btn {
        width: 100%;
        min-height: 44px;
        margin-left: 0;
    }

    .sp-filters-row .sp-dropdown-wrapper,
    .sp-filters-row .sp-location-tab {
        width: 100%;
        min-width: 0;
    }

    .sp-filters-row .sp-dropdown-btn,
    .sp-filters-row .sp-location-dropdown-btn {
        width: 100%;
        min-width: 0;
        min-height: 44px;
        justify-content: space-between;
        white-space: normal;
        text-align: left;
    }

    .sp-filters-row .sp-help-icon {
        align-self: center;
    }

    #searchModeRequisites {
        justify-content: space-between;
        padding: 10px 14px;
        min-height: 44px;
        position: relative;
    }

    .sp-dropdown-menu,
    .sp-viz-menu,
    .sp-location-dropdown,
    .rp-volume-menu,
    .rp-perpage-menu {
        left: 0;
        right: auto;
        width: min(100%, calc(100vw - 24px));
        max-width: calc(100vw - 24px);
        min-width: 0;
    }

    .sp-entity-menu {
        padding: 12px;
        max-height: min(78vh, 620px);
        overflow-y: auto;
    }

    .sp-entity-menu .sp-entity-option {
        min-height: 44px;
        grid-template-columns: 28px minmax(0, 1fr) auto;
        gap: 10px;
        padding: 8px 10px;
    }

    .sp-entity-option-check {
        width: 22px;
        height: 22px;
        border-radius: 6px;
        font-size: 15px;
    }

    .sp-entity-option-label {
        font-size: 14px;
        text-align: left;
    }

    .sp-entity-option-count {
        min-width: 52px;
        height: 28px;
        padding: 0 10px;
        border-radius: 7px;
        font-size: 14px;
    }

    .sp-requisites-menu {
        position: fixed;
        left: var(--sp-req-menu-left, 8px) !important;
        top: var(--sp-req-menu-top, 76px) !important;
        right: auto !important;
        width: var(--sp-req-menu-width, calc(100vw - 16px));
        max-width: calc(100vw - 16px);
        min-width: min(300px, calc(100vw - 16px));
        max-height: min(72vh, 560px);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        z-index: 10120;
        box-shadow: 0 18px 42px rgba(4, 10, 30, 0.58);
    }

    .sp-viz-word-row {
        flex-wrap: wrap;
    }

    .sp-viz-marker-nav {
        margin-left: auto;
    }

    .rp-dashboard-header,
    .rp-dashboard-actions,
    .rp-refinement-row,
    .rp-volume-row,
    .rp-volume-section,
    .rp-send-to-ai-wrapper,
    .rp-card-footer,
    .rp-cat-card-header,
    .rp-cat-card-bottom-actions,
    .rp-cat-card-actions,
    .overview-bookmarks-header-row {
        flex-direction: column;
        align-items: stretch;
    }

    .rp-exclusion-section,
    .rp-send-to-ai-in-volume {
        margin-left: 0;
        padding-left: 0;
        border-left: none;
        border-top: 1px solid rgba(255,255,255,0.1);
        padding-top: 6px;
    }

    /* Нижній шит — як підвал модалки категоризатора: суцільна темна поверхня, без фіолетового градієнта */
    .rp-toolbar-sheet-handle {
        display: flex;
        background: rgba(0, 0, 0, 0.22);
        border-top: 1px solid rgba(255, 255, 255, 0.08);
        border-bottom: 1px solid rgba(255, 255, 255, 0.06);
        box-shadow: 0 -8px 28px rgba(0, 0, 0, 0.4);
        color: #f1f5f9;
    }

    .rp-toolbar-sheet-handle--adjusted {
        background: rgba(6, 78, 59, 0.55) !important;
        border-top-color: rgba(45, 212, 191, 0.4);
    }

    .rp-toolbar-shell {
        position: fixed !important;
        left: 0;
        right: 0;
        bottom: 0;
        top: auto !important;
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        padding: 0;
        padding-bottom: env(safe-area-inset-bottom, 0px);
        background: #1a1b3a;
        border-top: 1px solid rgba(255, 255, 255, 0.1);
        border-radius: 14px 14px 0 0;
        box-shadow: 0 -16px 44px rgba(0, 0, 0, 0.5);
        z-index: 95;
        max-height: none;
    }

    .rp-toolbar-sheet-scroll {
        display: flex;
        flex-direction: column;
        gap: 8px;
        align-items: stretch;
        max-height: 0;
        overflow: hidden;
        padding: 0 16px;
        opacity: 0;
        pointer-events: none;
        transition: max-height 0.3s ease, opacity 0.22s ease, padding 0.22s ease;
    }

    .rp-toolbar-shell.rp-toolbar-sheet--open .rp-toolbar-sheet-scroll {
        max-height: min(78vh, 760px);
        overflow-x: hidden;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        padding: 10px 16px 18px;
        border-top: 1px solid rgba(255, 255, 255, 0.06);
        background: rgba(0, 0, 0, 0.2);
        opacity: 1;
        pointer-events: auto;
    }

    .rp-toolbar-mobile-toggle {
        display: flex;
    }

    #resultsArea .rp-toolbar-mobile-toggle {
        background: rgba(255, 255, 255, 0.06);
        border: 1px solid rgba(255, 255, 255, 0.12);
        border-radius: 10px;
        color: #f1f5f9;
        font-weight: 600;
    }

    #resultsArea .rp-toolbar-mobile-toggle--adjusted {
        background: rgba(6, 78, 59, 0.5);
        border-color: rgba(45, 212, 191, 0.42);
        box-shadow: none;
    }

    .rp-toolbar-advanced-block {
        display: none;
        flex-direction: column;
        align-items: stretch;
        gap: 6px;
        width: 100%;
    }

    .rp-toolbar-advanced-block.rp-toolbar-advanced-expanded {
        display: flex;
    }

    #resultsArea.rp-panel .rp-refinement-apply-btn {
        width: 100%;
        box-sizing: border-box;
    }

    #resultsArea .rp-toolbar-shell .rp-send-to-ai-btn {
        width: 100%;
        min-width: 0;
        border-radius: 8px;
        font-size: 14px;
        font-weight: 600;
        color: #fff;
        background: linear-gradient(135deg, #059669, #10b981);
        border: 1px solid rgba(16, 185, 129, 0.5);
        box-shadow: none;
    }

    #resultsArea .rp-toolbar-shell .rp-send-to-ai-btn:hover:not(:disabled) {
        filter: brightness(1.06);
        border-color: rgba(16, 185, 129, 0.65);
    }

    #resultsArea .rp-toolbar-shell .rp-send-to-ai-btn:disabled {
        background: rgba(100, 100, 120, 0.45);
        border-color: rgba(255, 255, 255, 0.12);
        color: #94a3b8;
    }

    #resultsArea.rp-panel {
        padding-bottom: calc(54px + env(safe-area-inset-bottom, 0px));
    }

    /* Ручка шиту (~48–54px) + розгорнутий скрол — інакше останні картки ховаються під ручкою */
    #resultsArea.rp-panel.rp-toolbar-sheet-area-open {
        padding-bottom: calc(52px + min(78vh, 760px) + env(safe-area-inset-bottom, 0px));
    }

    #resultsArea .rp-dashboard-header {
        flex-direction: column;
        align-items: stretch;
        justify-content: flex-start;
        gap: 10px;
        padding: 16px 16px 12px;
        background: #1a1b3a;
        border-bottom: 1px solid rgba(255, 255, 255, 0.08);
        border-radius: 14px 14px 0 0;
    }

    #resultsArea .rp-dashboard-title {
        min-width: 0;
        width: 100%;
        gap: 6px;
        row-gap: 6px;
        align-items: flex-start;
    }

    #resultsArea .rp-title-label,
    #resultsArea #rpTotalLabel {
        font-size: 14px;
        line-height: 1.25;
        color: #94a3b8;
        font-weight: 600;
    }

    #resultsArea .rp-title-count {
        font-size: 20px;
        line-height: 1.15;
        color: #f1f5f9;
        font-weight: 700;
    }

    #resultsArea .rp-dashboard-mode-badge {
        margin-left: 0;
        margin-top: 2px;
        max-width: 100%;
        box-sizing: border-box;
        word-break: break-word;
    }

    #resultsArea .rp-dashboard-header .rp-markers-in-header {
        margin-left: 0;
        width: 100%;
        flex: 1 1 auto;
        align-self: stretch;
    }

    #resultsArea .rp-dashboard-header .rp-markers-in-header .sp-dropdown-wrapper {
        width: 100%;
    }

    #resultsArea .rp-dashboard-header .rp-markers-in-header #vizDropdownBtn {
        width: 100%;
        min-height: 40px;
        padding: 10px 14px;
        font-size: 14px;
        font-weight: 600;
        justify-content: space-between;
        box-sizing: border-box;
        border-radius: 10px;
        background: rgba(255, 255, 255, 0.06);
        border: 1px solid rgba(255, 255, 255, 0.12);
    }

    .rp-results-list-wrapper {
        flex-direction: column;
        min-height: min(58dvh, 520px);
    }

    /* Випадаючі меню в тулбарі — фіксована панель по центру екрана, не «вилітають» за край */
    #resultsArea .rp-toolbar-shell .sp-dropdown-menu.rp-category-panel-menu,
    #resultsArea .rp-toolbar-shell .sp-dropdown-menu.rp-volume-menu,
    #resultsArea .rp-toolbar-shell .sp-dropdown-menu.rp-perpage-menu {
        position: fixed !important;
        left: 12px !important;
        right: 12px !important;
        top: 22vh !important;
        bottom: auto !important;
        width: auto !important;
        min-width: 0 !important;
        max-width: none !important;
        max-height: min(48vh, 420px);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        z-index: 10080;
        box-sizing: border-box;
        background: #1a1b3a !important;
        border: 1px solid rgba(255, 255, 255, 0.1) !important;
        border-radius: 14px !important;
        box-shadow: 0 24px 48px rgba(0, 0, 0, 0.45) !important;
    }

    #resultsArea .rp-dashboard-header .sp-dropdown-menu.sp-viz-menu {
        position: fixed !important;
        left: 10px !important;
        right: 10px !important;
        top: 18vh !important;
        bottom: auto !important;
        width: auto !important;
        max-height: min(70vh, 560px);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        z-index: 10090;
        background: #1a1b3a !important;
        border: 1px solid rgba(255, 255, 255, 0.1) !important;
        border-radius: 14px !important;
        box-shadow: 0 24px 48px rgba(0, 0, 0, 0.45) !important;
    }

    .rp-refinement-tags,
    .rp-exclusion-tags {
        min-width: 0;
        width: 100%;
        justify-content: flex-start;
    }

    /* Компактні чіпи замість повноширинних «стадіонів» (Уточнення / Виключення) */
    .rp-refinement-tag,
    .rp-exclusion-tag {
        width: auto;
        max-width: 100%;
        min-height: 36px;
        flex: 0 1 auto;
        align-self: flex-start;
        border-radius: 12px;
        justify-content: flex-start;
        box-sizing: border-box;
        padding: 6px 10px;
    }

    #resultsArea .rp-toolbar-shell .rp-refinement-tag,
    #resultsArea .rp-toolbar-shell .rp-exclusion-tag {
        width: auto;
        max-width: 100%;
        min-height: 36px;
        flex: 0 1 auto;
        border-radius: 12px;
        padding: 6px 10px;
    }

    .rp-refinement-tag-input,
    .rp-exclusion-tag-input {
        width: auto;
        min-width: 0;
        max-width: min(72vw, 260px);
        flex: 1 1 auto;
        font-size: 14px;
        font-weight: 500;
    }

    #resultsArea .rp-toolbar-shell .rp-refinement-tag-input,
    #resultsArea .rp-toolbar-shell .rp-exclusion-tag-input {
        width: auto !important;
        max-width: min(75vw, 280px);
        min-width: min(42vw, 160px);
        font-size: 14px;
        font-weight: 500;
    }

    #resultsArea .rp-toolbar-shell .rp-refinement-tag-remove,
    #resultsArea .rp-toolbar-shell .rp-exclusion-tag-remove {
        font-size: 18px;
    }

    .sp-marker-density-window {
        width: 18px;
        min-width: 18px;
        max-height: none;
        border-top: none;
        top: 12px;
        right: 6px;
        bottom: 12px;
    }

    .rp-results-list,
    .category-results-list {
        /* Нижній відступ — скрол усередині списку; фіксована ручка тулбару не перекриває останню картку */
        padding: 14px 32px calc(18px + 58px + env(safe-area-inset-bottom, 0px)) 12px;
        scroll-padding-bottom: calc(58px + env(safe-area-inset-bottom, 0px));
    }

    #resultsArea.rp-panel.rp-toolbar-sheet-area-open .rp-results-list {
        padding-bottom: calc(18px + min(78vh, 760px) + env(safe-area-inset-bottom, 0px));
    }

    .sp-marker-density-titlebar,
    .sp-marker-density-word-select,
    .sp-marker-density-nav {
        width: min(320px, calc(100vw - 20px));
        left: 50%;
        right: auto;
        transform: translateX(-50%);
    }

    .rp-card-header,
    .rp-card-content,
    .rp-card-categories,
    .rp-card-footer,
    .rp-card-expand-btn {
        margin-left: 0;
        margin-right: 0;
    }

    .rp-card-actions,
    .rp-cat-card-block3 {
        width: 100%;
        justify-content: flex-start;
    }

    #resultsArea .rp-card-title {
        font-size: 14px;
        line-height: 1.55;
    }

    #resultsArea .rp-card-link {
        text-align: left;
        font-size: 11px;
        display: inline-flex;
        align-self: flex-start;
    }

    #resultsArea .rp-card-categories,
    #resultsArea .rp-card-categories.collapsed {
        padding: 8px 10px;
        margin: 0 0 10px;
    }

    #resultsArea .rp-card-categories-header {
        display: flex;
        flex-direction: row;
        align-items: center;
        justify-content: flex-end;
        gap: 8px;
        margin-bottom: 0;
    }

    #resultsArea .rp-card-categories-title-wrap {
        min-width: 0;
        flex: 1 1 auto;
        gap: 6px;
        flex-wrap: nowrap;
    }

    #resultsArea .rp-card-categories-title {
        min-width: 0;
        font-size: 12px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    #resultsArea .rp-card-categories-actions {
        flex: 0 0 auto;
        gap: 6px;
        justify-content: flex-end;
        margin-left: auto;
    }

    #resultsArea .rp-card-cat-btn {
        min-height: 30px;
        padding: 0 10px;
        font-size: 11px;
    }

    #resultsArea .rp-card-cat-add-all-to-chat-btn {
        width: 30px;
        height: 30px;
        min-width: 30px;
        flex: 0 0 auto;
    }

    .rp-card-action-btn,
    .rp-cat-card-add-to-chat-btn,
    .rp-cat-card-viewpp-btn,
    .rp-cat-card-action,
    .overview-back-to-results-btn {
        min-height: 40px;
    }

    .rp-cat-card {
        padding: 14px 12px;
        border-radius: 10px;
        margin: 0 0 10px;
        border: 1px solid #cbd5e1;
    }

    .rp-cat-card-block1,
    .rp-cat-card-block3 {
        flex-wrap: wrap;
    }

    .rp-cat-card-entity,
    .rp-cat-card-pp-count,
    .rp-card-entity-badge {
        margin-left: 0;
    }

    .modal {
        padding: 10px;
    }

    .modal-content,
    .modal-content-categories,
    .modal-large {
        width: 100%;
        max-width: 100%;
        min-width: 0;
        min-height: 0;
        max-height: calc(100dvh - 20px);
        height: auto;
        border-radius: 14px;
    }

    .modal-header {
        align-items: flex-start;
        gap: 12px;
        flex-wrap: wrap;
    }

    .modal-header h2 {
        font-size: 20px;
    }

    .category-header,
    .category-article-header {
        align-items: flex-start;
    }

    .category-children {
        margin-left: 10px;
    }

    .categorizer-section {
        padding: 4px 6px 8px;
    }

    .categorizer-panel {
        width: 100%;
        border-radius: 12px;
    }

    /* Один ряд як на пошуку: без багаторядкового «ламу», горизонтальний скрол */
    body.page-categorizer .top-nav-bar {
        justify-content: flex-start;
        flex-wrap: nowrap;
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        padding: 8px 10px 8px 56px;
        gap: 8px;
        scrollbar-width: none;
    }

    body.page-categorizer .top-nav-bar::-webkit-scrollbar {
        display: none;
    }

    body.page-categorizer .top-nav-btn,
    body.page-categorizer .top-nav-balance {
        flex: 0 0 auto;
    }

    .categorizer-mobile-top-stack {
        border-bottom: 1px solid rgba(255,255,255,0.06);
        background: rgba(15, 10, 46, 0.88);
        max-height: 220px;
        overflow: hidden;
        transition: max-height 0.38s ease, opacity 0.28s ease, border-width 0.2s ease;
    }

    body.page-categorizer .sticky-top-panel {
        max-height: 88px;
        overflow: hidden;
        transition: max-height 0.38s ease, opacity 0.28s ease, border-width 0.2s ease;
    }

    body.page-categorizer.categorizer-mobile-top-collapsed .sticky-top-panel {
        max-height: 0;
        opacity: 0;
        border-bottom-width: 0;
        pointer-events: none;
    }

    body.page-categorizer.categorizer-mobile-top-collapsed .categorizer-mobile-top-stack {
        max-height: 0;
        opacity: 0;
        border-bottom-width: 0;
        pointer-events: none;
    }

    .categorizer-mobile-top-toggle,
    #categorizerMobileTopToggle[hidden] {
        display: none !important;
    }

    .categorizer-top-reveal-btn {
        position: fixed;
        top: 10px;
        left: 50%;
        transform: translateX(-50%);
        z-index: 230;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        padding: 8px 20px;
        border-radius: 999px;
        border: 1px solid rgba(125, 211, 252, 0.35);
        background: linear-gradient(180deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.08));
        color: #e2e8f0;
        font-size: 13px;
        font-weight: 700;
        cursor: pointer;
        box-shadow: 0 14px 36px rgba(8, 15, 44, 0.35);
    }

    .categorizer-top-reveal-btn:hover {
        border-color: rgba(125, 211, 252, 0.5);
    }

    .categorizer-top-reveal-btn[hidden] {
        display: none !important;
    }

    .categorizer-top-collapse-btn {
        display: inline-flex;
    }

    .categorizer-sticky-toolbar {
        position: static;
        top: auto;
        z-index: auto;
        padding: 10px;
        border-bottom: none;
    }

    /* Панель пошуку: sticky top:0 накладалась під верхню навігацію (z-index 210) */
    /* Мобільний категоризатор: без трикутників розгортання — більше місця під текст (розгортання — клік по рядку) */
    .categorizer-tree-wrap .category-expand-btn {
        display: none !important;
    }

    .categorizer-group-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .categorizer-search-row {
        flex-wrap: wrap;
    }

    .categorizer-article-quick-input {
        flex: 1 1 100%;
    }

    .categorizer-search-input-wrap {
        flex: 1 1 calc(100% - 56px);
    }

    .categorizer-search-actions {
        flex: 0 0 auto;
    }

    .categorizer-group-actions {
        flex: 1 1 100%;
    }

    .categorizer-refresh-btn {
        width: auto;
    }

    .categorizer-group-btn {
        width: 100%;
    }

    .categorizer-tree-wrap {
        padding: 6px 6px 6px 28px;
        overflow-x: hidden;
    }

    .categorizer-tree-wrap .categories-tree {
        min-width: 0;
        width: 100%;
    }

    .categorizer-tree-wrap .category-header {
        min-width: 0;
        width: 100%;
        padding: 8px 8px 8px 10px;
        grid-template-columns: minmax(0, 1fr);
        column-gap: 10px;
    }

    .categorizer-tree-wrap .category-node[data-leaf="false"] > .category-header {
        padding-left: 10px;
    }

    .categorizer-tree-wrap .category-header-main {
        gap: 8px;
    }

    .categorizer-tree-wrap .category-header-leading {
        gap: 4px;
    }

    .categorizer-tree-wrap .category-header-actions {
        width: 100%;
        min-width: 0;
        flex-wrap: wrap;
        justify-content: flex-end;
        align-items: center;
        gap: 6px;
        box-sizing: border-box;
        padding-left: 0;
        margin-top: 6px;
    }

    .categorizer-tree-wrap .category-children {
        margin-left: 5px;
        padding-left: 5px;
    }

    .categorizer-tree-wrap .category-node-open > .category-children {
        margin-left: 6px;
        padding-left: 6px;
    }

    .categorizer-tree-wrap .category-node-open > .category-children::before {
        width: 1px;
        bottom: 6px;
    }

    .categorizer-tree-wrap .category-node[data-leaf="false"] > .category-header::before {
        left: -22px;
        width: 18px;
        height: 18px;
        font-size: 16px;
    }

    .categorizer-tree-wrap .category-node {
        --categorizer-name-size: 14px;
        --categorizer-subtitle-size: 17px;
    }

    .categorizer-tree-wrap .category-node[data-level="0"] {
        --categorizer-name-size: 20px;
        --categorizer-subtitle-size: 17px;
    }

    .categorizer-tree-wrap .category-node[data-level="1"] {
        --categorizer-name-size: 17px;
        --categorizer-subtitle-size: 17px;
    }

    .categorizer-tree-wrap .category-node[data-level="2"] {
        --categorizer-name-size: 16px;
        --categorizer-subtitle-size: 17px;
    }

    .categorizer-tree-wrap .category-node[data-level="3"] {
        --categorizer-name-size: 15px;
        --categorizer-subtitle-size: 17px;
    }

    .categorizer-tree-wrap .category-name {
        line-height: 1.3;
    }

    .categorizer-tree-wrap .category-type {
        font-size: 10px;
        padding: 3px 8px;
    }

    .categorizer-tree-wrap .category-leaf-indicator {
        font-size: 10px;
        padding: 3px 8px;
        gap: 5px;
    }

    .categorizer-tree-wrap .category-pp-count {
        font-size: 11px;
    }

    .categorizer-tree-wrap .category-view-articles-btn {
        width: 32px;
        height: 32px;
        min-width: 32px;
    }

    /* Мобільний категоризатор: «Додати в AI чат» — лише іконка, розмір як «Переглянути ПП» */
    .categorizer-tree-wrap .category-add-to-chat-btn {
        position: relative;
        width: 32px;
        height: 32px;
        min-width: 32px;
        max-width: 32px;
        min-height: 32px;
        margin-left: 0;
        padding: 0;
        gap: 0;
        justify-content: center;
        box-sizing: border-box;
        border-radius: 10px;
        background: rgba(255, 255, 255, 0.06) !important;
        border: 1px solid rgba(129, 140, 248, 0.2) !important;
        color: #cbd5e1 !important;
        box-shadow: none !important;
        font-weight: 600;
        font-size: 0;
        line-height: 0;
    }

    .categorizer-tree-wrap .category-add-to-chat-btn .rp-cat-card-add-to-chat-icon {
        display: inline-flex !important;
        align-items: center;
        justify-content: center;
    }

    .categorizer-tree-wrap .category-add-to-chat-btn .rp-cat-card-add-to-chat-label {
        position: absolute;
        width: 1px;
        height: 1px;
        padding: 0;
        margin: -1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
        white-space: nowrap;
        border: 0;
    }

    .categorizer-tree-wrap .category-add-to-chat-btn:hover:not(:disabled) {
        background: rgba(101, 102, 241, 0.18) !important;
        border-color: rgba(129, 140, 248, 0.4) !important;
        color: #ffffff !important;
    }

    .categorizer-tree-wrap .category-add-to-chat-btn.is-added {
        background: rgba(16, 185, 129, 0.14) !important;
        border-color: rgba(16, 185, 129, 0.42) !important;
        color: #6ee7b7 !important;
    }

    .categorizer-tree-wrap .category-add-to-chat-btn.is-added:hover:not(:disabled) {
        background: rgba(16, 185, 129, 0.2) !important;
        border-color: rgba(52, 211, 153, 0.5) !important;
        color: #d1fae5 !important;
    }

    .categorizer-tree-wrap .categorizer-force-toggle-track {
        width: 38px;
        height: 22px;
    }

    .categorizer-tree-wrap .categorizer-force-toggle-thumb {
        width: 18px;
        height: 18px;
    }

    .categorizer-tree-wrap .categorizer-force-toggle.is-active .categorizer-force-toggle-thumb {
        transform: translateX(16px);
    }

    .overview-content {
        padding: 80px 16px 24px;
    }

    .overview-title {
        font-size: 28px;
    }

    .overview-cards,
    .overview-stats,
    .overview-bookmarks-list {
        grid-template-columns: 1fr;
    }

    .overview-card,
    .overview-stat,
    .overview-bookmark-item {
        padding: 16px;
    }

    .overview-bookmark-item,
    .overview-bookmark-item-actions {
        flex-direction: column;
        align-items: stretch;
    }
}

@media (max-width: 480px) {
    .top-nav-bar {
        gap: 8px;
        padding: 9px 10px 9px 52px;
    }

    .top-nav-btn {
        padding: 7px 12px;
        font-size: 12px;
    }

    .search-container {
        padding: 52px 8px 12px;
    }

    .sp-panel,
    .rp-panel {
        border-radius: 12px;
    }

    .sp-history-dropdown,
    .sp-dropdown-menu,
    .sp-requisites-menu,
    .sp-viz-menu,
    .sp-location-dropdown,
    .rp-volume-menu,
    .rp-perpage-menu {
        width: calc(100vw - 16px);
        max-width: calc(100vw - 16px);
    }

    .rp-dashboard-header,
    .rp-refinement-row,
    .rp-volume-row,
    .modal-header,
    .modal-body {
        padding-left: 12px;
        padding-right: 12px;
    }

    .rp-title-label {
        font-size: 16px;
    }

    .rp-title-count {
        font-size: 20px;
    }

    .rp-card-content,
    .rp-card-title,
    .category-name,
    .category-article-title {
        font-size: 13px;
        line-height: 1.6;
    }

    .overview-content {
        padding-left: 12px;
        padding-right: 12px;
    }

    body.page-categorizer .top-nav-bar {
        padding: 8px 8px 8px 56px;
        gap: 6px;
    }

    body.page-categorizer .top-nav-btn {
        padding: 7px 11px;
        font-size: 11px;
    }

    .categorizer-section {
        padding: 2px 4px 6px;
    }

    .categorizer-panel {
        border-radius: 10px;
    }

    .categorizer-sticky-toolbar {
        padding-left: 8px;
        padding-right: 8px;
    }

    .categorizer-tree-wrap {
        padding: 4px 4px 4px 24px;
    }

    .categorizer-tree-wrap .categories-tree,
    .categorizer-tree-wrap .category-header {
        min-width: 0;
    }

    .categorizer-tree-wrap .category-node {
        --categorizer-name-size: 13px;
        --categorizer-subtitle-size: 17px;
    }

    .categorizer-tree-wrap .category-node[data-level="0"] {
        --categorizer-name-size: 18px;
        --categorizer-subtitle-size: 17px;
    }

    .categorizer-tree-wrap .category-node[data-level="1"] {
        --categorizer-name-size: 16px;
        --categorizer-subtitle-size: 17px;
    }

    .categorizer-tree-wrap .category-node[data-level="2"] {
        --categorizer-name-size: 15px;
        --categorizer-subtitle-size: 17px;
    }

    .categorizer-tree-wrap .category-node[data-level="3"] {
        --categorizer-name-size: 14px;
        --categorizer-subtitle-size: 17px;
    }

    .categorizer-tree-wrap .category-header-actions {
        padding-left: 0;
    }
}

@media (max-width: 768px) {
    #categoryResultsArea .rp-dashboard-header {
        padding: 14px 12px 10px;
        gap: 12px;
    }

    #categoryResultsArea .rp-cat-dashboard {
        width: 100%;
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    #categoryResultsArea .rp-cat-dashboard-mobile-toggle {
        display: flex;
    }

    #categoryResultsArea .rp-cat-dashboard-collapsible {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
        width: 100%;
    }

    #categoryResultsArea .rp-cat-dashboard.is-collapsed .rp-cat-dashboard-collapsible {
        display: none;
    }

    #categoryResultsArea #rpCatFullscreenBtn.rp-cat-fullscreen-btn {
        display: none !important;
    }

    #categoryResultsArea .rp-cat-dash-add-to-chat-label {
        position: absolute;
        width: 1px;
        height: 1px;
        padding: 0;
        margin: -1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
        white-space: nowrap;
        border: 0;
    }

    #categoryResultsArea .rp-cat-add-to-chat-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        min-height: 46px;
        padding: 10px 16px;
    }

    #categoryResultsArea .rp-cat-dash-add-to-chat-icon {
        display: flex !important;
        align-items: center;
        justify-content: center;
    }

    #categoryResultsArea .rp-cat-select-all {
        width: 100%;
        height: 46px;
        padding: 0 14px;
        border-radius: 12px;
        justify-content: flex-start;
        gap: 12px;
    }

    #categoryResultsArea .rp-cat-select-all::after {
        content: 'Виділити всі знайдені';
        color: #e2e8f0;
        font-size: 14px;
        font-weight: 700;
        line-height: 1.2;
    }

    #categoryResultsArea .rp-cat-select-all input {
        width: 22px;
        height: 22px;
        flex: 0 0 auto;
    }

    #categoryResultsArea .rp-cat-stat {
        width: 100%;
        min-width: 0;
        padding: 12px 14px;
        justify-content: space-between;
        align-items: center;
        gap: 10px;
        flex-wrap: wrap;
    }

    #categoryResultsArea .rp-cat-stat-label {
        font-size: 15px;
        line-height: 1.35;
    }

    #categoryResultsArea .rp-cat-stat-value {
        font-size: 22px;
    }

    #categoryResultsArea .rp-cat-stat-meta {
        margin-left: auto;
        font-size: 14px;
    }

    #categoryResultsArea .rp-cat-fullscreen-btn,
    #categoryResultsArea .rp-cat-show-pp-btn,
    #categoryResultsArea .rp-cat-add-to-chat-btn,
    #categoryResultsArea .rp-cat-debug-btn {
        width: 100%;
        margin-left: 0;
    }

    #categoryResultsArea .rp-category-results-list {
        padding: 10px;
    }

    #categoryResultsArea .rp-cat-card {
        padding: 14px 12px;
        border-radius: 14px;
        overflow: hidden;
    }

    #categoryResultsArea .rp-cat-card-header {
        gap: 12px;
    }

    #categoryResultsArea .rp-cat-card-block1,
    #categoryResultsArea .rp-cat-card-block2,
    #categoryResultsArea .rp-cat-card-block3 {
        width: 100%;
        min-width: 0;
    }

    #categoryResultsArea .rp-cat-card-block1 {
        flex-wrap: nowrap;
    }

    #categoryResultsArea .rp-cat-card-checkbox,
    #categoryResultsArea .rp-cat-card-expand-toggle,
    #categoryResultsArea .rp-cat-card-rank {
        flex: 0 0 auto;
    }

    #categoryResultsArea .rp-cat-card-name {
        display: block;
        width: 100%;
        font-size: clamp(16px, 4.2vw, 19px);
        line-height: 1.5;
        overflow-wrap: anywhere;
        word-break: break-word;
    }

    #categoryResultsArea .rp-cat-card-paths-badge {
        display: inline-flex;
        width: fit-content;
        max-width: 100%;
        margin-left: 0;
        margin-top: 8px;
        white-space: normal;
    }

    #categoryResultsArea .rp-cat-card-block3 {
        display: grid;
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 44px 44px;
        gap: 10px;
        align-items: stretch;
    }

    #categoryResultsArea .rp-cat-card-pp-count,
    #categoryResultsArea .rp-cat-card-entity {
        display: flex;
        align-items: center;
        justify-content: center;
        min-width: 0;
        min-height: 44px;
        text-align: center;
        white-space: normal;
    }

    #categoryResultsArea .rp-cat-card-viewpp-btn {
        width: 44px;
        min-width: 44px;
        height: 44px;
        justify-self: end;
    }

    #categoryResultsArea .rp-cat-card-add-to-chat-btn {
        position: relative;
        grid-column: auto;
        width: 44px;
        min-width: 44px;
        max-width: 44px;
        height: 44px;
        padding: 0;
        justify-content: center;
        text-align: center;
        box-sizing: border-box;
        /* Як «око» поруч: темний квадрат, контурна іконка чату */
        background: rgba(255, 255, 255, 0.07);
        border: 1px solid rgba(129, 140, 248, 0.42);
        color: #7dd3fc;
    }

    #categoryResultsArea .rp-cat-card-add-to-chat-btn:hover:not(:disabled) {
        background: rgba(101, 102, 241, 0.22);
        border-color: rgba(167, 139, 250, 0.55);
        color: #bae6fd;
    }

    #categoryResultsArea .rp-cat-card-add-to-chat-btn.is-added,
    #categoryResultsArea .rp-cat-card-add-to-chat-btn:disabled {
        background: rgba(16, 185, 129, 0.14);
        border-color: rgba(16, 185, 129, 0.45);
        color: #6ee7b7;
    }

    #categoryResultsArea .rp-cat-card-add-to-chat-icon {
        display: inline-flex;
    }

    #categoryResultsArea .rp-cat-card-add-to-chat-label {
        position: absolute;
        width: 1px;
        height: 1px;
        padding: 0;
        margin: -1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
        white-space: nowrap;
        border: 0;
    }

    #categoryResultsArea .rp-cat-card-paths-area {
        margin-top: 12px;
        padding: 12px;
        border-radius: 12px;
        overflow: hidden;
    }

    #categoryResultsArea .rp-cat-card-path-row {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
        padding: 10px 0;
    }

    #categoryResultsArea .rp-cat-card-path {
        width: 100%;
        min-width: 0;
        max-width: 100%;
        padding: 10px;
        gap: 6px;
    }

    #categoryResultsArea .rp-cat-card-path .rp-card-cat-badge,
    #categoryResultsArea .rp-cat-card-path .rp-card-cat-sep {
        max-width: 100%;
    }

    #categoryResultsArea .rp-cat-card-path .rp-card-cat-badge {
        white-space: normal;
        word-break: break-word;
        overflow-wrap: anywhere;
    }

    #categoryResultsArea .rp-cat-card-path-row > .rp-cat-card-action.secondary {
        align-self: flex-start;
        width: auto;
        max-width: 100%;
        white-space: normal !important;
    }

    #categoryResultsArea .rp-cat-card-bottom-actions {
        gap: 10px;
    }

    #categoryResultsArea .rp-cat-card-action {
        width: 100%;
        justify-content: flex-start;
        text-align: left;
        white-space: normal;
    }
}

@media (max-width: 480px) {
    #categoryResultsArea .rp-cat-select-all::after {
        content: 'Виділити всі';
    }

    #categoryResultsArea .rp-cat-stat {
        align-items: flex-start;
    }

    #categoryResultsArea .rp-cat-stat-meta {
        margin-left: 0;
    }

    #categoryResultsArea .rp-category-results-list {
        padding: 8px;
    }

    #categoryResultsArea .rp-cat-card {
        padding: 12px 10px;
    }

    #categoryResultsArea .rp-cat-card-name {
        font-size: 15px;
    }

    #categoryResultsArea .rp-cat-card-paths-area {
        padding: 10px;
    }

    #categoryResultsArea .rp-cat-card-path {
        padding: 9px;
    }

    #categoryResultsArea .rp-card-cat-badge {
        padding: 3px 7px;
        font-size: 10px;
    }
}

/* ============================================
   Search Results Toolbar polish
   ============================================ */

.rp-volume-dropdown-btn.open .sp-dropdown-arrow,
.rp-perpage-btn.open .sp-dropdown-arrow {
    transform: rotate(180deg);
}

.rp-toolbar-shell .rp-refinement-section {
    gap: 8px;
    flex: 0 1 clamp(220px, 18vw, 360px);
    min-width: 0;
    max-width: min(100%, 360px);
}

.rp-toolbar-shell .rp-refinement-label {
    display: none;
}

.rp-toolbar-shell .rp-refinement-tags,
.rp-toolbar-shell .rp-exclusion-tags {
    display: flex;
    align-items: stretch;
    gap: 8px;
    flex-wrap: wrap;
    min-width: 0;
    flex: 1 1 auto;
    max-width: 100%;
}

.rp-toolbar-shell .rp-refinement-tag,
.rp-toolbar-shell .rp-exclusion-tag {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 42px;
    padding: 0 16px;
    border-radius: 999px;
    flex: 0 1 100%;
    width: 100%;
    max-width: 100%;
    min-width: 0;
}

.rp-toolbar-shell .rp-refinement-tag {
    background: linear-gradient(135deg, rgba(96, 94, 255, 0.3), rgba(104, 118, 255, 0.24));
    border: 1px solid rgba(133, 117, 255, 0.42);
    box-shadow: inset 0 0 0 1px rgba(160, 150, 255, 0.08);
}

.rp-toolbar-shell .rp-exclusion-tag {
    background: linear-gradient(135deg, rgba(110, 22, 55, 0.7), rgba(88, 18, 44, 0.82));
    border: 1px solid rgba(215, 86, 109, 0.44);
    box-shadow: inset 0 0 0 1px rgba(255, 164, 180, 0.06);
}

.rp-toolbar-shell .rp-refinement-tag-input,
.rp-toolbar-shell .rp-exclusion-tag-input {
    width: 100%;
    min-width: 0;
    background: transparent;
    border: none;
    outline: none;
    font-size: 14px;
    font-weight: 600;
    flex: 1 1 auto;
}

.rp-filter-marker-nav {
    margin-left: auto;
    flex: 0 0 auto;
}

.rp-toolbar-shell .rp-filter-marker-nav .sp-viz-marker-counter {
    color: var(--rp-filter-nav-color, rgba(226, 232, 240, 0.88));
    font-weight: 700;
}

.rp-toolbar-shell .rp-refinement-tag-input {
    color: #d8d6ff;
}

.rp-toolbar-shell .rp-refinement-tag-input::placeholder {
    color: rgba(196, 199, 255, 0.78);
    opacity: 1;
}

.rp-toolbar-shell .rp-exclusion-tag-input {
    color: #ff9aa8;
}

.rp-toolbar-shell .rp-exclusion-tag-input::placeholder {
    color: rgba(255, 154, 168, 0.74);
    opacity: 1;
}

.rp-toolbar-shell .rp-refinement-tag-remove,
.rp-toolbar-shell .rp-exclusion-tag-remove {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 22px;
    font-weight: 700;
    line-height: 1;
    padding: 0;
    flex: 0 0 auto;
}

.rp-toolbar-shell .rp-refinement-tag-remove {
    color: #f5b8ff;
}

.rp-toolbar-shell .rp-exclusion-tag-remove {
    color: #ffb1bc;
}

.rp-toolbar-shell .rp-exclusion-section {
    margin-left: 0;
    padding-left: 10px;
    border-left: 1px solid rgba(255,255,255,0.08);
}

.rp-toolbar-shell .rp-refinement-add-btn {
    width: 42px;
    height: 42px;
    position: relative;
    border-radius: 50%;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.1);
    color: #d9dbff;
    box-shadow: none;
}

.rp-toolbar-shell .rp-refinement-add-btn::before {
    content: '';
    position: absolute;
    left: -10px;
    top: 8px;
    bottom: 8px;
    width: 1px;
    background: rgba(255,255,255,0.14);
}

.rp-toolbar-shell .rp-refinement-add-btn:hover {
    background: rgba(255,255,255,0.14);
    border-color: rgba(255,255,255,0.18);
    transform: scale(1.04);
}

.rp-toolbar-shell .rp-exclusion-add-btn {
    background: rgba(255, 99, 132, 0.12) !important;
    border-color: rgba(255, 99, 132, 0.22) !important;
    color: #ff9aa8 !important;
}

.rp-refinement-add-btn.rp-add-btn-hidden,
.rp-exclusion-add-btn.rp-add-btn-hidden {
    display: none;
}

.rp-toolbar-shell .rp-refinement-apply-btn {
    min-height: 42px;
    padding: 9px 20px;
    border-radius: 999px;
    font-size: 14px;
    font-weight: 700;
}

@media (max-width: 1380px) {
    .rp-toolbar-shell .rp-refinement-section {
        flex-basis: clamp(220px, 28vw, 340px);
        max-width: min(100%, 340px);
    }
}

.add-to-chat-target-list {
    gap: 10px;
}

.add-to-chat-target-item {
    padding: 14px 18px;
    border-radius: 14px;
}

.add-to-chat-target-item.is-current-target {
    background: linear-gradient(135deg, rgba(92, 88, 214, 0.34), rgba(63, 145, 255, 0.16));
    border-color: rgba(95, 160, 255, 0.42);
    box-shadow: 0 0 0 1px rgba(95, 160, 255, 0.12) inset;
}

.add-to-chat-target-item.is-new-target {
    background: linear-gradient(135deg, rgba(91, 68, 160, 0.18), rgba(131, 104, 255, 0.08));
    border-style: dashed;
    border-color: rgba(167, 139, 250, 0.46);
}

.add-to-chat-target-item.is-disabled,
.add-to-chat-target-item:disabled {
    background: rgba(148, 163, 184, 0.08);
    border-style: solid;
    border-color: rgba(148, 163, 184, 0.22);
}

.add-to-chat-target-item-title {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
}

.add-to-chat-target-item-plus {
    width: 22px;
    height: 22px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(167, 139, 250, 0.18);
    color: #d8b4fe;
    font-size: 16px;
    line-height: 1;
    font-weight: 700;
}

@media (max-width: 768px) {
    /* У колонці flex-basis з clamp(220px,…) ставив ~220px висоти секції — зайві «дірки» під чіпами */
    .rp-toolbar-shell .rp-refinement-section {
        min-width: 100%;
        max-width: 100%;
        flex-wrap: wrap;
        flex: 0 0 auto !important;
        flex-basis: auto !important;
        min-height: 0;
        align-self: stretch;
    }

    .rp-toolbar-shell .rp-refinement-tags,
    .rp-toolbar-shell .rp-exclusion-tags {
        width: 100%;
        justify-content: flex-start;
        flex: 0 1 auto !important;
        align-items: center;
        align-content: flex-start;
    }

    .rp-toolbar-shell .rp-refinement-tag,
    .rp-toolbar-shell .rp-exclusion-tag {
        width: auto;
        max-width: 100%;
        min-height: 36px;
        flex: 0 1 auto;
        border-radius: 12px;
        padding: 6px 10px;
    }

    .rp-toolbar-shell .rp-refinement-add-btn {
        width: 36px;
        height: 36px;
        flex-shrink: 0;
    }

    .rp-toolbar-shell .rp-refinement-add-btn::before {
        display: none;
    }

    .rp-toolbar-shell .rp-exclusion-section {
        padding-left: 0;
        border-left: none;
    }
}

/* Налаштування користувача / повідомлення про проблему (user-preferences.js) */
/* Тимчасово приховано — приберіть цей блок, щоб знову показати кнопку */
#sidebarReportProblemBtn {
    display: none !important;
}

#lexgoSettingsModal.modal,
#lexgoReportModal.modal,
#lexgoNotificationsModal.modal {
    z-index: 10002;
}

.lexgo-user-modal-content {
    max-width: 520px;
}

.lexgo-notifications-modal-content {
    width: min(960px, 96vw);
    max-width: 960px;
}

.lexgo-user-modal-body {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.lexgo-user-modal-intro {
    margin: 0 0 0.25rem 0;
    font-size: 0.95rem;
    color: rgba(226, 232, 240, 0.88);
    line-height: 1.45;
}

.lexgo-user-status {
    min-height: 1.25em;
    margin: -0.25rem 0 0 0;
    font-size: 0.88rem;
    line-height: 1.4;
    color: rgba(148, 163, 184, 0.95);
}

.lexgo-user-status-error {
    color: #f87171;
}

.lexgo-user-status-success {
    color: #34d399;
}

.lexgo-user-field {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.lexgo-user-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: rgba(241, 245, 249, 0.95);
}

.lexgo-user-select {
    width: 100%;
    padding: 0.5rem 0.65rem;
    border-radius: 8px;
    border: 1px solid rgba(148, 163, 184, 0.35);
    background: rgba(15, 23, 42, 0.85);
    color: #f1f5f9;
    font-size: 0.95rem;
}

.lexgo-user-textarea {
    width: 100%;
    min-height: 120px;
    padding: 0.65rem 0.75rem;
    border-radius: 8px;
    border: 1px solid rgba(148, 163, 184, 0.35);
    background: rgba(15, 23, 42, 0.85);
    color: #f1f5f9;
    font-size: 0.95rem;
    line-height: 1.45;
    resize: vertical;
    font-family: inherit;
}

.lexgo-user-field-checkbox .lexgo-user-checkbox-label {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    cursor: pointer;
    color: rgba(241, 245, 249, 0.95);
}

.lexgo-user-field-checkbox input[type="checkbox"] {
    width: 1.1rem;
    height: 1.1rem;
    accent-color: #8b5cf6;
}

.lexgo-user-hint {
    margin: 0.25rem 0 0 0;
    font-size: 0.82rem;
    line-height: 1.4;
    color: rgba(148, 163, 184, 0.95);
}

.lexgo-user-modal-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
    margin-top: 0.5rem;
}

.lexgo-user-report-status {
    margin: 0;
    min-height: 1.25em;
    font-size: 0.88rem;
    line-height: 1.4;
}

.lexgo-notifications-btn {
    position: relative;
}

.lexgo-notifications-btn.has-unread {
    background: rgba(16, 185, 129, 0.14) !important;
    color: #d1fae5 !important;
    border-color: rgba(16, 185, 129, 0.42) !important;
    box-shadow: 0 0 0 1px rgba(16, 185, 129, 0.16), 0 8px 22px rgba(16, 185, 129, 0.12);
}

.lexgo-notification-badge {
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    margin-left: auto;
    border-radius: 8px;
    background: #ef4444;
    color: #fff;
    font-size: 11px;
    font-weight: 800;
    line-height: 1;
}

.lexgo-notifications-subtitle {
    margin: 0.2rem 0 0 0;
    color: rgba(148, 163, 184, 0.95);
    font-size: 0.9rem;
}

.lexgo-notifications-body {
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
    max-height: min(72vh, 760px);
    overflow: auto;
    padding-right: 0.35rem;
}

.lexgo-notifications-list {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.lexgo-notification-card {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    padding: 1rem 1.1rem;
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 8px;
    background: rgba(15, 23, 42, 0.72);
    color: #e5e7eb;
}

.lexgo-notification-card.is-unread {
    border-color: rgba(16, 185, 129, 0.42);
    background: rgba(16, 185, 129, 0.08);
}

.lexgo-notification-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    color: rgba(148, 163, 184, 0.95);
    font-size: 0.86rem;
}

.lexgo-notification-unread-label {
    padding: 0.2rem 0.5rem;
    border-radius: 8px;
    background: rgba(16, 185, 129, 0.18);
    color: #86efac;
    font-size: 0.75rem;
    font-weight: 800;
    text-transform: uppercase;
}

.lexgo-notification-text {
    color: #f8fafc;
    font-size: 1rem;
    line-height: 1.65;
    overflow-wrap: anywhere;
}

.lexgo-notification-text p {
    margin: 0 0 0.9rem 0;
}

.lexgo-notification-text p:last-child {
    margin-bottom: 0;
}

.lexgo-notification-link {
    align-self: flex-start;
    color: #67e8f9;
    font-weight: 700;
    text-decoration: none;
}

.lexgo-notification-link:hover {
    color: #a5f3fc;
    text-decoration: underline;
}

.lexgo-notifications-empty {
    padding: 1.25rem;
    border: 1px dashed rgba(148, 163, 184, 0.28);
    border-radius: 8px;
    color: rgba(226, 232, 240, 0.82);
    text-align: center;
}

.lexgo-notifications-tabs {
    display: flex;
    gap: 0.5rem;
    padding: 0.25rem;
    border-radius: 12px;
    background: rgba(15, 23, 42, 0.72);
}

.lexgo-notifications-tab {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    border: 0;
    border-radius: 10px;
    padding: 0.65rem 0.9rem;
    background: transparent;
    color: rgba(226, 232, 240, 0.78);
    font-weight: 800;
    cursor: pointer;
}

.lexgo-notifications-tab.is-active {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.95), rgba(14, 165, 233, 0.82));
    color: #fff;
}

.lexgo-notifications-tab-badge {
    min-width: 1.55rem;
    height: 1.35rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 0.35rem;
    border-radius: 999px;
    background: #f59e0b;
    color: #111827;
    font-size: 0.72rem;
    font-weight: 950;
    line-height: 1;
}

.lexgo-notifications-tab-badge[hidden] {
    display: none !important;
}

.lexgo-notifications-pane {
    display: none;
}

.lexgo-notifications-pane-active {
    display: block;
}

.lexgo-support-history {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-height: min(44vh, 420px);
    overflow: auto;
    padding: 0.75rem;
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 12px;
    background: rgba(15, 23, 42, 0.55);
}

.lexgo-support-empty {
    color: rgba(226, 232, 240, 0.72);
    text-align: center;
    padding: 0.9rem;
}

.lexgo-support-message {
    max-width: 82%;
    align-self: flex-start;
}

.lexgo-support-message.is-user {
    align-self: flex-end;
}

.lexgo-support-message-meta {
    margin: 0 0 0.25rem 0.25rem;
    color: rgba(148, 163, 184, 0.9);
    font-size: 0.78rem;
    font-weight: 700;
}

.lexgo-support-message-text {
    padding: 0.7rem 0.85rem;
    border-radius: 14px;
    background: rgba(30, 41, 59, 0.92);
    color: #e5e7eb;
    line-height: 1.5;
    overflow-wrap: anywhere;
}

.lexgo-support-message.is-user .lexgo-support-message-text {
    background: rgba(79, 70, 229, 0.72);
    color: #fff;
}

.lexgo-support-message.is-admin .lexgo-support-message-text {
    background: rgba(8, 145, 178, 0.34);
}

.lexgo-support-message-text p {
    margin: 0 0 0.65rem 0;
}

.lexgo-support-message-text p:last-child {
    margin-bottom: 0;
}

.lexgo-support-admin-panel {
    display: grid;
    grid-template-columns: minmax(220px, 300px) minmax(0, 1fr);
    gap: 1rem;
}

.lexgo-support-admin-side {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    min-width: 0;
}

.lexgo-support-conversation-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-height: min(56vh, 520px);
    overflow: auto;
}

.lexgo-support-admin-start {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    padding: 0.65rem;
    border: 1px solid rgba(34, 211, 238, 0.22);
    border-radius: 12px;
    background: rgba(15, 23, 42, 0.54);
}

.lexgo-support-admin-start-title {
    margin: 0;
    color: #c4b5fd;
    font-size: 0.84rem;
    font-weight: 900;
}

.lexgo-support-admin-start-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 0.45rem;
}

.lexgo-support-admin-input {
    width: 100%;
    min-height: 38px;
    padding: 0.55rem 0.7rem;
    border: 1px solid rgba(148, 163, 184, 0.28);
    border-radius: 10px;
    background: rgba(15, 23, 42, 0.82);
    color: #e5e7eb;
    outline: none;
    box-sizing: border-box;
}

.lexgo-support-admin-input:focus {
    border-color: rgba(96, 165, 250, 0.7);
    box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.14);
}

.lexgo-support-admin-start-btn {
    min-height: 38px;
    border-radius: 10px;
}

.lexgo-support-conversation-btn {
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 12px;
    padding: 0.75rem;
    background: rgba(15, 23, 42, 0.72);
    color: #e5e7eb;
    text-align: left;
    cursor: pointer;
}

.lexgo-support-conversation-btn strong,
.lexgo-support-conversation-btn span {
    display: block;
}

.lexgo-support-conversation-btn span {
    margin-top: 0.25rem;
    color: rgba(203, 213, 225, 0.78);
    font-size: 0.82rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.lexgo-support-conversation-btn.is-active,
.lexgo-support-conversation-btn.has-unread {
    border-color: rgba(16, 185, 129, 0.5);
    background: rgba(16, 185, 129, 0.12);
}

.lexgo-support-admin-chat,
.lexgo-support-user-panel {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

@media (max-width: 760px) {
    .lexgo-support-admin-panel {
        grid-template-columns: 1fr;
    }
}

/* Пошук ПП: акуратна однотипна панель уточнення / виключення */
.rp-perpage-wrapper {
    display: none !important;
}

#resultsArea .rp-toolbar-shell {
    --rp-toolbar-control-radius: 8px;
}

@media (min-width: 769px) {
    #resultsArea .rp-toolbar-advanced-block {
        display: flex;
        align-items: center;
        gap: 10px;
        min-width: min(100%, 560px);
        flex: 1 1 560px;
        padding: 8px;
        border: 1px solid rgba(129, 140, 248, 0.16);
        border-radius: 8px;
        background: rgba(255, 255, 255, 0.035);
    }

    #resultsArea .rp-toolbar-shell .rp-refinement-section {
        flex: 1 1 0;
        max-width: none;
        min-width: 190px;
        padding: 0;
        border: 0;
        margin: 0;
    }
}

#resultsArea .rp-toolbar-shell .rp-volume-dropdown-btn,
#resultsArea .rp-toolbar-shell .rp-toolbar-dropdown-btn,
#resultsArea .rp-toolbar-shell #vizDropdownBtn,
#resultsArea .rp-toolbar-shell .rp-send-to-ai-btn,
#resultsArea .rp-toolbar-shell .rp-refinement-apply-btn {
    border-radius: 8px !important;
}

#resultsArea .rp-toolbar-shell .rp-refinement-tag,
#resultsArea .rp-toolbar-shell .rp-exclusion-tag {
    min-height: 38px;
    border-radius: 8px !important;
    background: rgba(255, 255, 255, 0.06) !important;
    border: 1px solid rgba(129, 140, 248, 0.22) !important;
    color: #e2e8f0 !important;
    box-shadow: none !important;
}

#resultsArea .rp-toolbar-shell .rp-refinement-tag-input,
#resultsArea .rp-toolbar-shell .rp-exclusion-tag-input {
    color: #e2e8f0 !important;
    font-weight: 600;
}

#resultsArea .rp-toolbar-shell .rp-refinement-tag-input::placeholder,
#resultsArea .rp-toolbar-shell .rp-exclusion-tag-input::placeholder {
    color: rgba(203, 213, 225, 0.72) !important;
}

#resultsArea .rp-toolbar-shell .rp-refinement-tag-remove,
#resultsArea .rp-toolbar-shell .rp-exclusion-tag-remove {
    color: rgba(226, 232, 240, 0.82) !important;
}

#resultsArea .rp-toolbar-shell .rp-refinement-add-btn,
#resultsArea .rp-toolbar-shell .rp-exclusion-add-btn {
    width: 38px;
    height: 38px;
    border-radius: 8px !important;
    background: rgba(255, 255, 255, 0.07) !important;
    border: 1px solid rgba(129, 140, 248, 0.22) !important;
    color: #e2e8f0 !important;
}

#resultsArea .rp-toolbar-shell .rp-refinement-add-btn::before {
    display: none !important;
}

#resultsArea .rp-toolbar-shell .rp-refinement-apply-btn--ready:not(:disabled) {
    background: rgba(20, 184, 166, 0.86) !important;
    border: 1px solid rgba(45, 212, 191, 0.42);
    box-shadow: none;
}

.categorizer-group-btn-pp {
    background: rgba(20, 184, 166, 0.92);
}

.categorizer-group-btn-pp:hover {
    background: rgba(13, 148, 136, 0.96);
}

@media (max-width: 768px) {
    #resultsArea .rp-toolbar-advanced-block {
        gap: 8px;
    }

    #resultsArea .rp-toolbar-advanced-block.rp-toolbar-advanced-expanded {
        display: grid;
        grid-template-columns: 1fr;
    }

    #categoryResultsArea .rp-cat-card-actions,
    #categoryResultsArea .rp-cat-card-bottom-actions {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
        width: 100%;
    }

    #categoryResultsArea .rp-cat-card-action,
    #categoryResultsArea .rp-cat-card-viewpp-btn,
    #categoryResultsArea .rp-cat-card-add-to-chat-btn,
    #categoryResultsArea .category-view-articles-btn,
    #categoryResultsArea .category-add-to-chat-btn {
        width: 100%;
        min-width: 0;
        justify-content: center;
    }

    #categoryResultsArea .rp-cat-card-block3 {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
        align-items: stretch;
    }

    .categorizer-group-actions {
        display: grid !important;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
    }

    .categorizer-group-btn {
        width: 100%;
        min-width: 0;
    }
}

/* Modal refinement/exclusion panel for PP search */
body.rp-adjustment-modal-active {
    overflow: hidden;
}

.rp-adjustment-modal-backdrop[hidden] {
    display: none !important;
}

.rp-adjustment-modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 10140;
    background: rgba(4, 2, 22, 0.52);
}

#resultsArea .rp-toolbar-mobile-toggle,
.rp-toolbar-mobile-toggle {
    display: inline-flex;
    width: auto;
    min-height: var(--rp-toolbar-control-height, 46px);
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 0 18px;
    border-radius: 8px;
    background: rgba(79, 70, 229, 0.26);
    border: 1px solid rgba(129, 140, 248, 0.38);
    color: #eef2ff;
    font-size: 14px;
    font-weight: 700;
}

#resultsArea .rp-toolbar-mobile-toggle:hover,
.rp-toolbar-mobile-toggle:hover {
    background: rgba(99, 102, 241, 0.34);
    border-color: rgba(165, 180, 252, 0.5);
}

.rp-toolbar-advanced-block {
    display: none !important;
}

.rp-toolbar-advanced-block.rp-adjustment-modal-open {
    position: fixed;
    left: 50%;
    top: 50%;
    z-index: 10150;
    transform: translate(-50%, -50%);
    display: flex !important;
    flex-direction: column;
    align-items: stretch;
    gap: 28px;
    width: min(560px, calc(100vw - 32px));
    min-height: min(520px, calc(100dvh - 44px));
    max-height: calc(100dvh - 44px);
    padding: 36px 34px 28px;
    overflow-y: auto;
    background: #100b2d;
    border: 1px solid rgba(129, 140, 248, 0.35);
    border-radius: 8px;
    box-shadow: 0 28px 78px rgba(0, 0, 0, 0.58);
}

.rp-adjustment-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.rp-adjustment-modal-title {
    margin: 0;
    color: #e7e5ff;
    font-size: 18px;
    font-weight: 800;
}

.rp-adjustment-modal-actions {
    display: inline-flex;
    align-items: center;
    gap: 12px;
}

.rp-adjustment-help-btn {
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(236, 72, 153, 0.12);
    border: 1px solid rgba(244, 114, 182, 0.3);
    color: #f9a8d4;
    font-size: 20px;
    font-weight: 850;
    line-height: 1;
    cursor: pointer;
}

.rp-adjustment-help-btn:hover {
    background: rgba(236, 72, 153, 0.2);
    border-color: rgba(244, 114, 182, 0.48);
}

.rp-adjustment-modal-close {
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    color: #f0abfc;
    font-size: 28px;
    font-weight: 800;
    line-height: 1;
    cursor: pointer;
}

.rp-adjustment-help-backdrop[hidden],
.rp-adjustment-help-dialog[hidden] {
    display: none !important;
}

.rp-adjustment-help-backdrop {
    position: fixed;
    inset: 0;
    z-index: 30020;
    background: rgba(3, 1, 18, 0.72);
    backdrop-filter: blur(2px);
}

.rp-adjustment-help-dialog {
    position: fixed;
    left: 50%;
    top: 50%;
    z-index: 30030;
    transform: translate(-50%, -50%);
    width: min(720px, calc(100vw - 28px));
    max-height: calc(100dvh - 34px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    color: #f8fafc;
    background: linear-gradient(180deg, #17113f 0%, #0b0726 100%);
    border: 1px solid rgba(165, 180, 252, 0.42);
    border-radius: 8px;
    box-shadow: 0 34px 90px rgba(0, 0, 0, 0.78), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.rp-adjustment-help-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 20px 22px 14px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.24);
}

.rp-adjustment-help-header h3 {
    margin: 0;
    color: #ffffff;
    font-size: 19px;
    font-weight: 850;
    line-height: 1.2;
}

.rp-adjustment-help-close {
    width: 38px;
    height: 38px;
    flex: 0 0 38px;
    border-radius: 8px;
    background: rgba(236, 72, 153, 0.14);
    border: 1px solid rgba(244, 114, 182, 0.28);
    color: #f9a8d4;
    font-size: 28px;
    font-weight: 800;
    line-height: 1;
    cursor: pointer;
}

.rp-adjustment-help-body {
    overflow-y: auto;
    padding: 18px 22px 22px;
}

.rp-adjustment-help-body p {
    margin: 0 0 12px;
    color: rgba(248, 250, 252, 0.92);
    font-size: 15px;
    line-height: 1.55;
}

.rp-adjustment-help-body p:last-child {
    margin-bottom: 0;
}

.rp-adjustment-help-body strong {
    color: #fef3c7;
    font-weight: 850;
}

.rp-toolbar-shell .rp-toolbar-advanced-block.rp-adjustment-modal-open .rp-refinement-section {
    width: 100%;
    max-width: none;
    flex: 0 0 auto;
}

.rp-toolbar-shell .rp-toolbar-advanced-block.rp-adjustment-modal-open .rp-refinement-label {
    display: none;
}

.rp-toolbar-shell .rp-toolbar-advanced-block.rp-adjustment-modal-open .rp-refinement-tags,
.rp-toolbar-shell .rp-toolbar-advanced-block.rp-adjustment-modal-open .rp-exclusion-tags {
    width: 100%;
}

.rp-toolbar-shell .rp-toolbar-advanced-block.rp-adjustment-modal-open .rp-refinement-tag,
.rp-toolbar-shell .rp-toolbar-advanced-block.rp-adjustment-modal-open .rp-exclusion-tag {
    min-height: 64px;
    border-radius: 8px;
}

.rp-toolbar-shell .rp-toolbar-advanced-block.rp-adjustment-modal-open .rp-exclusion-section {
    margin-left: 0;
    padding-left: 0;
    padding-top: 26px;
    border-left: none;
    border-top: 1px solid rgba(148, 163, 184, 0.22);
}

.rp-toolbar-shell .rp-toolbar-advanced-block.rp-adjustment-modal-open .rp-refinement-add-btn {
    align-self: flex-start;
    width: 44px;
    height: 44px;
    border-radius: 8px;
}

.rp-toolbar-shell .rp-toolbar-advanced-block.rp-adjustment-modal-open .rp-refinement-add-btn::before {
    display: none;
}

.rp-toolbar-shell .rp-toolbar-advanced-block.rp-adjustment-modal-open .rp-refinement-apply-btn {
    align-self: center;
    min-width: 120px;
    margin-top: auto;
    border-radius: 8px;
}

.rp-adjustment-footer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-top: auto;
}

.rp-refinement-clear-btn {
    min-height: 46px;
    min-width: 120px;
    padding: 0 22px;
    border-radius: 8px;
    border: 1px solid rgba(244, 114, 182, 0.34);
    background: rgba(236, 72, 153, 0.12);
    color: #fecdd3;
    font-weight: 850;
    cursor: pointer;
}

.rp-refinement-clear-btn:hover {
    background: rgba(236, 72, 153, 0.2);
    color: #ffffff;
}

.categorizer-filter-btn,
#categorizerFilterBtn {
    display: none !important;
}

.marker-scroll-highlight {
    color: #ffffff !important;
}

.rp-pp-cat-depth-control {
    position: sticky;
    top: 0;
    z-index: 4;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px 16px;
    align-items: center;
    margin: 0;
    padding: 10px 18px 12px;
    border: 0;
    border-top: 1px solid rgba(129, 140, 248, 0.24);
    border-bottom: 1px solid rgba(129, 140, 248, 0.24);
    border-radius: 0;
    background: rgba(30, 31, 63, 0.98);
    box-shadow: 0 12px 22px rgba(3, 7, 18, 0.22);
    color: #e7e5ff;
    font-weight: 800;
}

.rp-pp-cat-depth-control > span {
    white-space: nowrap;
}

.rp-pp-cat-depth-control input {
    grid-column: 1 / -1;
    margin: 0;
    accent-color: #38bdf8;
}

.rp-pp-cat-depth-scale {
    grid-column: 1 / -1;
    display: flex;
    justify-content: space-between;
    margin-top: -6px;
    color: #bfdbfe;
    font-size: 12px;
    font-weight: 900;
    line-height: 1;
    pointer-events: none;
}

.rp-pp-cat-depth-scale span {
    text-align: center;
    min-width: 1ch;
}

.rp-pp-cat-depth-control output {
    grid-column: 2;
    grid-row: 1;
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: #38bdf8;
    color: #ffffff;
    font-size: 18px;
    font-weight: 900;
}

@media (max-width: 780px) {
    .rp-pp-cat-depth-control {
        grid-template-columns: minmax(0, 1fr) auto;
    }

    .rp-pp-cat-depth-control > span {
        white-space: normal;
    }
}

@media (max-width: 900px) {
    #resultsArea .rp-toolbar-mobile-toggle,
    .rp-toolbar-mobile-toggle {
        width: 100%;
    }

    .rp-toolbar-advanced-block.rp-adjustment-modal-open {
        width: calc(100vw - 22px);
        min-height: min(460px, calc(100dvh - 28px));
        padding: 28px 20px 22px;
    }
}

/* Strong modal overrides: the regular toolbar rules are more specific and otherwise make this panel translucent. */
body.rp-adjustment-modal-active #resultsArea .rp-adjustment-modal-backdrop,
body.rp-adjustment-modal-active .rp-adjustment-modal-backdrop {
    position: fixed !important;
    inset: 0 !important;
    z-index: 30000 !important;
    background: rgba(3, 1, 18, 0.84) !important;
    backdrop-filter: blur(3px);
}

body.rp-adjustment-modal-active #resultsArea .rp-toolbar-shell .rp-toolbar-advanced-block.rp-adjustment-modal-open,
body.rp-adjustment-modal-active .rp-toolbar-advanced-block.rp-adjustment-modal-open {
    position: fixed !important;
    left: 50% !important;
    top: 50% !important;
    right: auto !important;
    bottom: auto !important;
    z-index: 30010 !important;
    transform: translate(-50%, -50%) !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    justify-content: flex-start !important;
    gap: 18px !important;
    width: min(660px, calc(100vw - 28px)) !important;
    min-width: 0 !important;
    max-width: calc(100vw - 28px) !important;
    min-height: 0 !important;
    max-height: calc(100dvh - 34px) !important;
    padding: 24px !important;
    box-sizing: border-box !important;
    overflow-y: auto !important;
    color: #f8fafc !important;
    background: linear-gradient(180deg, #17113f 0%, #0b0726 100%) !important;
    border: 1px solid rgba(165, 180, 252, 0.42) !important;
    border-radius: 8px !important;
    box-shadow: 0 34px 90px rgba(0, 0, 0, 0.78), inset 0 1px 0 rgba(255, 255, 255, 0.06) !important;
}

body.rp-adjustment-modal-active #resultsArea .rp-toolbar-shell .rp-toolbar-advanced-block.rp-adjustment-modal-open .rp-adjustment-modal-header,
body.rp-adjustment-modal-active .rp-toolbar-advanced-block.rp-adjustment-modal-open .rp-adjustment-modal-header {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 16px !important;
    padding-bottom: 14px !important;
    border-bottom: 1px solid rgba(148, 163, 184, 0.24) !important;
}

body.rp-adjustment-modal-active #resultsArea .rp-toolbar-shell .rp-toolbar-advanced-block.rp-adjustment-modal-open .rp-adjustment-modal-title,
body.rp-adjustment-modal-active .rp-toolbar-advanced-block.rp-adjustment-modal-open .rp-adjustment-modal-title {
    margin: 0 !important;
    color: #ffffff !important;
    font-size: 20px !important;
    font-weight: 850 !important;
    line-height: 1.2 !important;
    letter-spacing: 0 !important;
}

body.rp-adjustment-modal-active #resultsArea .rp-toolbar-shell .rp-toolbar-advanced-block.rp-adjustment-modal-open .rp-adjustment-modal-close,
body.rp-adjustment-modal-active .rp-toolbar-advanced-block.rp-adjustment-modal-open .rp-adjustment-modal-close {
    width: 40px !important;
    height: 40px !important;
    flex: 0 0 40px !important;
    border-radius: 8px !important;
    background: rgba(236, 72, 153, 0.14) !important;
    border: 1px solid rgba(244, 114, 182, 0.28) !important;
    color: #f9a8d4 !important;
}

body.rp-adjustment-modal-active #resultsArea .rp-toolbar-shell .rp-toolbar-advanced-block.rp-adjustment-modal-open .rp-refinement-section,
body.rp-adjustment-modal-active .rp-toolbar-advanced-block.rp-adjustment-modal-open .rp-refinement-section {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    justify-content: flex-start !important;
    gap: 10px !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
    min-height: 0 !important;
    flex: 0 0 auto !important;
    margin: 0 !important;
    padding: 16px !important;
    box-sizing: border-box !important;
    border-radius: 8px !important;
    background: rgba(255, 255, 255, 0.055) !important;
    border: 1px solid rgba(129, 140, 248, 0.32) !important;
}

body.rp-adjustment-modal-active #resultsArea .rp-toolbar-shell .rp-toolbar-advanced-block.rp-adjustment-modal-open .rp-exclusion-section,
body.rp-adjustment-modal-active .rp-toolbar-advanced-block.rp-adjustment-modal-open .rp-exclusion-section {
    padding-top: 16px !important;
    border-top: 1px solid rgba(248, 113, 113, 0.24) !important;
    border-left: 1px solid rgba(248, 113, 113, 0.24) !important;
    background: rgba(127, 29, 29, 0.24) !important;
}

body.rp-adjustment-modal-active #resultsArea .rp-toolbar-shell .rp-toolbar-advanced-block.rp-adjustment-modal-open .rp-refinement-label,
body.rp-adjustment-modal-active .rp-toolbar-advanced-block.rp-adjustment-modal-open .rp-refinement-label {
    display: block !important;
    color: #e0e7ff !important;
    font-size: 14px !important;
    font-weight: 800 !important;
    line-height: 1.25 !important;
    white-space: normal !important;
}

body.rp-adjustment-modal-active #resultsArea .rp-toolbar-shell .rp-toolbar-advanced-block.rp-adjustment-modal-open .rp-exclusion-label,
body.rp-adjustment-modal-active .rp-toolbar-advanced-block.rp-adjustment-modal-open .rp-exclusion-label {
    color: #fecdd3 !important;
}

body.rp-adjustment-modal-active #resultsArea .rp-toolbar-shell .rp-toolbar-advanced-block.rp-adjustment-modal-open .rp-refinement-tags,
body.rp-adjustment-modal-active #resultsArea .rp-toolbar-shell .rp-toolbar-advanced-block.rp-adjustment-modal-open .rp-exclusion-tags,
body.rp-adjustment-modal-active .rp-toolbar-advanced-block.rp-adjustment-modal-open .rp-refinement-tags,
body.rp-adjustment-modal-active .rp-toolbar-advanced-block.rp-adjustment-modal-open .rp-exclusion-tags {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 10px !important;
    width: 100% !important;
    min-width: 0 !important;
}

body.rp-adjustment-modal-active #resultsArea .rp-toolbar-shell .rp-toolbar-advanced-block.rp-adjustment-modal-open .rp-refinement-tag,
body.rp-adjustment-modal-active #resultsArea .rp-toolbar-shell .rp-toolbar-advanced-block.rp-adjustment-modal-open .rp-exclusion-tag,
body.rp-adjustment-modal-active .rp-toolbar-advanced-block.rp-adjustment-modal-open .rp-refinement-tag,
body.rp-adjustment-modal-active .rp-toolbar-advanced-block.rp-adjustment-modal-open .rp-exclusion-tag {
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
    width: 100% !important;
    min-height: 54px !important;
    padding: 10px 12px !important;
    box-sizing: border-box !important;
    border-radius: 8px !important;
    background: rgba(15, 23, 42, 0.82) !important;
    border: 1px solid rgba(165, 180, 252, 0.34) !important;
    box-shadow: none !important;
}

body.rp-adjustment-modal-active #resultsArea .rp-toolbar-shell .rp-toolbar-advanced-block.rp-adjustment-modal-open .rp-exclusion-tag,
body.rp-adjustment-modal-active .rp-toolbar-advanced-block.rp-adjustment-modal-open .rp-exclusion-tag {
    border-color: rgba(248, 113, 113, 0.42) !important;
    background: rgba(69, 10, 10, 0.58) !important;
}

body.rp-adjustment-modal-active #resultsArea .rp-toolbar-shell .rp-toolbar-advanced-block.rp-adjustment-modal-open .rp-refinement-tag-input,
body.rp-adjustment-modal-active #resultsArea .rp-toolbar-shell .rp-toolbar-advanced-block.rp-adjustment-modal-open .rp-exclusion-tag-input,
body.rp-adjustment-modal-active .rp-toolbar-advanced-block.rp-adjustment-modal-open .rp-refinement-tag-input,
body.rp-adjustment-modal-active .rp-toolbar-advanced-block.rp-adjustment-modal-open .rp-exclusion-tag-input {
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
    color: #ffffff !important;
    font-size: 16px !important;
    font-weight: 700 !important;
    line-height: 1.35 !important;
}

body.rp-adjustment-modal-active #resultsArea .rp-toolbar-shell .rp-toolbar-advanced-block.rp-adjustment-modal-open .rp-refinement-tag-input::placeholder,
body.rp-adjustment-modal-active .rp-toolbar-advanced-block.rp-adjustment-modal-open .rp-refinement-tag-input::placeholder {
    color: rgba(224, 231, 255, 0.72) !important;
    opacity: 1 !important;
}

body.rp-adjustment-modal-active #resultsArea .rp-toolbar-shell .rp-toolbar-advanced-block.rp-adjustment-modal-open .rp-exclusion-tag-input::placeholder,
body.rp-adjustment-modal-active .rp-toolbar-advanced-block.rp-adjustment-modal-open .rp-exclusion-tag-input::placeholder {
    color: rgba(254, 202, 202, 0.78) !important;
    opacity: 1 !important;
}

body.rp-adjustment-modal-active #resultsArea .rp-toolbar-shell .rp-toolbar-advanced-block.rp-adjustment-modal-open .rp-refinement-add-btn,
body.rp-adjustment-modal-active #resultsArea .rp-toolbar-shell .rp-toolbar-advanced-block.rp-adjustment-modal-open .rp-exclusion-add-btn,
body.rp-adjustment-modal-active .rp-toolbar-advanced-block.rp-adjustment-modal-open .rp-refinement-add-btn,
body.rp-adjustment-modal-active .rp-toolbar-advanced-block.rp-adjustment-modal-open .rp-exclusion-add-btn {
    width: 46px !important;
    height: 42px !important;
    min-height: 42px !important;
    align-self: flex-start !important;
    border-radius: 8px !important;
    background: rgba(255, 255, 255, 0.1) !important;
    border: 1px solid rgba(203, 213, 225, 0.24) !important;
    color: #f8fafc !important;
}

body.rp-adjustment-modal-active #resultsArea .rp-toolbar-shell .rp-toolbar-advanced-block.rp-adjustment-modal-open .rp-refinement-apply-btn,
body.rp-adjustment-modal-active .rp-toolbar-advanced-block.rp-adjustment-modal-open .rp-refinement-apply-btn {
    width: min(220px, 100%) !important;
    min-height: 46px !important;
    align-self: center !important;
    margin: 2px 0 0 !important;
    border-radius: 8px !important;
    font-size: 15px !important;
    font-weight: 850 !important;
}

body.rp-adjustment-modal-active #resultsArea .rp-toolbar-shell .rp-toolbar-advanced-block.rp-adjustment-modal-open .rp-refinement-apply-btn:disabled,
body.rp-adjustment-modal-active .rp-toolbar-advanced-block.rp-adjustment-modal-open .rp-refinement-apply-btn:disabled {
    opacity: 0.48 !important;
}

@media (max-width: 640px) {
    body.rp-adjustment-modal-active #resultsArea .rp-toolbar-shell .rp-toolbar-advanced-block.rp-adjustment-modal-open,
    body.rp-adjustment-modal-active .rp-toolbar-advanced-block.rp-adjustment-modal-open {
        width: calc(100vw - 16px) !important;
        max-height: calc(100dvh - 18px) !important;
        padding: 18px !important;
        gap: 14px !important;
    }

    body.rp-adjustment-modal-active #resultsArea .rp-toolbar-shell .rp-toolbar-advanced-block.rp-adjustment-modal-open .rp-adjustment-modal-title,
    body.rp-adjustment-modal-active .rp-toolbar-advanced-block.rp-adjustment-modal-open .rp-adjustment-modal-title {
        font-size: 18px !important;
    }
}

body .rp-toolbar-shell #vizDropdownBtn.viz-active,
body .rp-dashboard-header .rp-markers-in-header #vizDropdownBtn.viz-active,
body .rp-toolbar-shell .rp-markers-in-toolbar #vizDropdownBtn.viz-active {
    background: rgba(6, 78, 59, 0.5) !important;
    border-color: rgba(45, 212, 191, 0.42) !important;
    box-shadow: inset 0 0 0 1px rgba(16, 185, 129, 0.12) !important;
}

body .rp-toolbar-shell #vizDropdownBtn.viz-active span,
body .rp-dashboard-header .rp-markers-in-header #vizDropdownBtn.viz-active span,
body .rp-toolbar-shell .rp-markers-in-toolbar #vizDropdownBtn.viz-active span {
    color: #34d399 !important;
    font-weight: 600;
}

body .rp-refinement-apply-btn.rp-refinement-apply-btn--busy,
body .rp-refinement-apply-btn.rp-refinement-apply-btn--busy:disabled {
    opacity: 1 !important;
}
