@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

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

body {
    font-family: 'Lato', sans-serif;
    background: #fafafa;
    min-height: 100vh;
    padding: 0;
    margin: 0;
}

body.slideout-open {
    overflow: hidden;
}

.container {
    width: 100%;
    min-height: 100vh;
    margin: 0;
    background: #fafafa;
    display: flex;
    flex-direction: column;
}

.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 30px;
    text-align: center;
    position: relative;
}

.header h1 {
    font-size: clamp(20px, 5vw, 32px);
    font-weight: 600;
    margin-bottom: 10px;
}

.header p {
    font-size: clamp(14px, 3vw, 16px);
    opacity: 0.9;
}

.header .breadcrumb-display {
    font-size: clamp(12px, 2.5vw, 14px);
    opacity: 0.85;
    margin-top: 8px;
    font-weight: 500;
}

/* Login Screen styles moved to styles.css */

.hidden {
    display: none !important;
}

/* App Navigation */
.app-navigation {
    background: oklch(1 0 0); /* White */
    border-bottom: 1px solid oklch(0.922 0 0); /* Border color */
    padding: 0.75rem 1.5rem; /* 12px 24px */
    display: flex;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 101;
    font-family: 'Lato', sans-serif;
}

/* Client selector in nav */
.nav-client-select {
    padding: 6px 12px;
    font-size: 13px;
    font-family: 'Lato', sans-serif;
    font-weight: 600;
    border: 1px solid oklch(0.922 0 0);
    border-radius: 6px;
    background: #fff;
    color: #1a1a1a;
    cursor: pointer;
    margin-right: 16px;
    max-width: 200px;
    appearance: auto;
}
.nav-client-select:focus {
    outline: none;
    border-color: #303030;
}

.nav-menu {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-client-logo-container {
    margin-left: auto;
    display: flex;
    align-items: center;
}

.nav-client-logo-link {
    display: flex;
    align-items: center;
    text-decoration: none;
    transition: opacity 0.2s;
}

.nav-client-logo-link:hover {
    opacity: 0.8;
}

.nav-client-logo-image {
    display: block;
    max-height: 40px;
    width: auto;
}

/* Nav Plan Indicator */
.nav-plan-indicator {
    display: none;
    flex-direction: row;
    align-items: center;
    gap: 10px;
    white-space: nowrap;
}

.marketably-user-info .nav-plan-indicator {
    margin-right: 4px;
}

.nav-plan-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.nav-plan-badge--basic {
    background: rgba(255, 255, 255, 0.12);
    color: rgba(255, 255, 255, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.24);
}

.nav-plan-badge--pro {
    background: rgba(185, 240, 64, 0.18);
    color: #B9F040;
    border: 1px solid rgba(185, 240, 64, 0.5);
}

.nav-plan-badge--enterprise {
    background: rgba(129, 140, 248, 0.18);
    color: #c7d2fe;
    border: 1px solid rgba(129, 140, 248, 0.5);
}

.nav-trial-counter {
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-trial-bar {
    width: 56px;
    height: 5px;
    background: rgba(255, 255, 255, 0.16);
    border-radius: 2px;
    overflow: hidden;
}

.nav-trial-bar__fill {
    height: 100%;
    background: #B9F040;
    border-radius: 2px;
    transition: width 0.3s ease;
}

.nav-trial-bar__fill--exhausted {
    background: #ff6b6b;
}

.nav-trial-label {
    font-size: 11px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.7);
    white-space: nowrap;
}

.nav-upgrade-link {
    font-size: 11px;
    font-weight: 700;
    color: #B9F040;
    text-decoration: none;
    transition: opacity 0.2s;
}

.nav-upgrade-link:hover {
    opacity: 0.8;
    text-decoration: underline;
}

/* Billing Section in Settings */
.billing-container {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.billing-plan-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid #f1f5f9;
}

.billing-plan-row:last-of-type {
    border-bottom: none;
}

.billing-label {
    font-size: 13px;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.billing-value {
    font-size: 14px;
    color: #1a202c;
    display: flex;
    align-items: center;
    gap: 8px;
}

.billing-trial-bar {
    width: 60px;
    height: 5px;
    background: #e2e8f0;
    border-radius: 3px;
    overflow: hidden;
}

.billing-trial-bar__fill {
    height: 100%;
    background: #B9F040;
    border-radius: 3px;
}

.billing-trial-bar__fill--exhausted {
    background: #e53e3e;
}

.billing-action-btn {
    display: inline-block;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    border: none;
    background: #B9F040;
    color: #000;
    transition: background 0.2s;
    font-family: 'Lato', sans-serif;
    align-self: flex-start;
}

.billing-action-btn:hover {
    background: #a0d636;
}

.billing-action-btn--secondary {
    background: #f1f5f9;
    color: #1a202c;
    border: 1px solid #e2e8f0;
}

.billing-action-btn--secondary:hover {
    background: #e2e8f0;
}

.billing-action-btn:disabled {
    opacity: 0.6;
    cursor: default;
}

.nav-menu-item {
    padding: 0.5rem 1rem; /* 8px 16px */
    color: oklch(0.556 0 0); /* Muted foreground */
    text-decoration: none;
    font-size: 1rem; /* 16px */
    font-weight: 500;
    font-family: 'Lato', sans-serif;
    border-radius: 0.375rem; /* 6px */
    transition: all 0.2s ease;
    position: relative;
}

.nav-menu-item:hover {
    color: oklch(0.145 0 0); /* Near black */
    background: oklch(0.97 0 0); /* Light gray */
}

.nav-menu-item.active {
    color: oklch(0.145 0 0); /* Near black */
    font-weight: 600;
}

.nav-menu-item.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 1rem;
    right: 1rem;
    height: 2px;
    background: #B9F040; /* Lime green underline */
    border-radius: 1px;
}

.nav-menu-item.founder-admin.hidden {
    display: none;
}

/* SPA Section Visibility */
.spa-section {
    display: none !important;
    height: 0 !important;
    min-height: 0 !important;
    max-height: 0 !important;
    overflow: hidden !important;
    margin: 0 !important;
    padding: 0 !important;
}

.spa-section.active {
    display: block !important;
    height: auto !important;
    min-height: auto !important;
    max-height: none !important;
    overflow: visible !important;
    margin: initial !important;
    padding: initial !important;
}

/* Overview iframe (Gamma deck embed) */
.overview-iframe {
    width: 100%;
    height: calc(100vh - 60px);
    border: none;
    display: block;
}

/* When showing insights, allow container to size naturally */
#mainContainer[data-view="insights"] {
    min-height: auto !important;
    height: auto !important;
}

.data-source-selector {
    padding: 18px 28px 22px;
    background: white;
    border-bottom: 1px solid #e4e6eb;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 18px;
    position: sticky;
    top: 48px; /* Below navigation */
    z-index: 100;
}

#dimensionNameEditor {
    display: flex;
}

.data-source-selector label {
    font-weight: 500;
    color: #333;
    font-size: 14px;
}

.data-source-selector select {
    padding: 10px 35px 10px 14px;
    border: 1px solid #d6d9df;
    border-radius: 6px;
    font-size: 15px;
    line-height: 1.35;
    min-height: 44px;
    width: 100%;
    cursor: pointer;
    color: #222;
    background-color: #fff;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%239ca3af' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
}

.data-source-selector select:focus {
    outline: none;
    border-color: #B9F040;
    box-shadow: 0 0 0 1px #B9F040;
}

.data-source-selector__content {
    display: flex;
    align-items: center;
    gap: 24px;
    width: 100%;
    flex-wrap: wrap;
}

.filter-panels {
    display: flex;
    align-items: center;
    gap: 24px;
    flex-wrap: nowrap;
    overflow: hidden;
    min-width: 0;
}

.filter-panel {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
    min-width: 0;
}

.lead-mode-toggle {
    display: inline-flex;
    align-items: center;
    border: 1px solid #d6d9df;
    border-radius: 8px;
    overflow: hidden;
    margin-right: 4px;
}

.lead-mode-toggle__btn {
    border: none;
    background: #fff;
    color: #4a4f5a;
    font-size: 12px;
    font-weight: 600;
    padding: 6px 10px;
    cursor: pointer;
}

.lead-mode-toggle__btn.active {
    background: #111827;
    color: #fff;
}

.filter-panel label {
    font-weight: 500;
    color: #333;
    font-size: 14px;
    flex-shrink: 0;
}

.filter-panel select {
    width: auto;
    min-width: 0;
    max-width: none;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex-shrink: 1;
}

#questionSelect {
    width: auto;
    min-width: 0;
    max-width: none;
}

.filter-panel select option {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.filter-tabs {
    display: none;
    width: 100%;
    gap: 28px;
    overflow-x: auto;
}

.filter-tabs::-webkit-scrollbar {
    display: none;
}

.filter-tab {
    position: relative;
    background: none;
    border: none;
    padding: 0 0 14px;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: #5c606b;
    cursor: pointer;
    transition: color 0.2s ease;
}

.filter-tab::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: 0;
    width: 100%;
    height: 2px;
    background: transparent;
    transition: background-color 0.2s ease;
}

.filter-tab:hover {
    color: #1a1c21;
}

.filter-tab.active {
    color: #111;
}

.filter-tab.active::after {
    background: #111;
}

.filter-tab.complete:not(.active) {
    color: #2f3540;
}

.filter-tab[disabled],
.filter-tab.is-disabled,
.filter-tab[aria-disabled="true"] {
    cursor: not-allowed;
    color: #c3c6ce;
}

.filter-tab[disabled]::after,
.filter-tab.is-disabled::after,
.filter-tab[aria-disabled="true"]::after {
    background: transparent;
}

.filter-tab:focus-visible {
    outline: none;
    color: #111;
}

.filter-tab:focus-visible::after {
    background: #111;
}

.data-source-actions {
    margin-left: auto;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
}

.filter-menu {
    position: relative;
}

.filter-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    position: relative;
    border: 1px solid #d6d9df;
    border-radius: 6px;
    background: #fff;
    color: #111;
    cursor: pointer;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, color 0.2s ease;
}

.filter-button:hover {
    border-color: #111;
    color: #111;
}

.filter-button:focus,
.filter-button:focus-visible {
    outline: none;
    border-color: #111;
    box-shadow: 0 0 0 1px #111;
}

.filter-button img {
    width: 18px;
    height: 18px;
}

@media (max-width: 768px) {
    .filter-button {
        border: none;
        border-radius: 0;
        background: transparent;
    }
    
    .filter-button:hover {
        border: none;
    }
    
    .filter-button:focus-visible {
        border: none;
        box-shadow: none;
    }
}

.filter-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 999px;
    background: #111;
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    display: none;
    align-items: center;
    justify-content: center;
}

#insights-section .filter-button {
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
}

#insights-section .filter-button:hover,
#insights-section .filter-button:focus,
#insights-section .filter-button:focus-visible {
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
}

.breadcrumbs {
    padding: 16px 30px;
    background: #f8f9fa;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    min-height: 56px;
}

.breadcrumb {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.breadcrumb-item {
    padding: 6px 14px;
    background: transparent;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease-in-out;
    font-size: 14px;
    color: #666;
    font-weight: 500;
}

.breadcrumb-item:hover {
    background: #e8e8e8;
    color: #333;
}

.breadcrumb-item.current {
    color: #667eea;
    font-weight: 600;
    cursor: default;
}

.breadcrumb-separator {
    color: #ccc;
    font-size: 14px;
}

.treemap-section {
    width: 100%;
    padding: 30px 30px 0 30px;
    background: #fafafa;
    flex-shrink: 0;
}

 .treemap-container {
     width: 100%;
     height: 75vh;
     min-height: 500px;
     max-height: 800px;
     background: white;
     border-radius: 8px;
     box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
     display: flex;
     flex-direction: column;
     position: relative;
     overflow: hidden;
     transition: height 0.3s ease-out, min-height 0.3s ease-out, max-height 0.3s ease-out;
 }

 .treemap-container.collapsed {
     height: auto;
     min-height: auto;
     max-height: none;
 }

 @media (max-width: 768px) {
     .treemap-container {
         height: 70vh;
         min-height: 500px;
         max-height: 700px;
     }

     .treemap-container.collapsed {
         height: auto;
         min-height: auto;
         max-height: none;
     }
 }

 @media (max-width: 480px) {
     .treemap-container {
         height: 75vh;
         min-height: 550px;
         max-height: none;
     }

     .treemap-container.collapsed {
         height: auto;
         min-height: auto;
         max-height: none;
     }
 }

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

.treemap-header-top {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0;
}

.treemap-title {
    font-family: 'Lato', sans-serif;
    font-size: 20px;
    font-weight: 600;
    color: #333;
    margin: 0;
    flex: 1;
}

.treemap-subtitle {
    font-family: 'Lato', sans-serif;
    font-size: 13px;
    color: #8B93A7;
    margin: 4px 0 0 0;
    transition: margin 0.3s ease-out, opacity 0.3s ease-out;
}

.treemap-container.collapsed .treemap-subtitle {
    opacity: 0.7;
}

.treemap-search-input-wrapper {
    position: relative;
    display: inline-block;
}

/* Bring search input and clear button above slideout overlay when search is active and slideout is visible */
body.slideout-open .treemap-header.search-active .treemap-search-input-wrapper {
    position: relative;
    z-index: 10001;
}

body.slideout-open .treemap-header.search-active .treemap-search-input {
    background: white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

body.slideout-open .treemap-header.search-active .treemap-search-clear {
    z-index: 10002;
}

.treemap-search-input {
    width: 300px;
    padding: 10px 40px 10px 14px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    font-family: 'Lato', sans-serif;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.treemap-search-input:focus {
    outline: none;
    border-color: #B9F040;
    box-shadow: 0 0 0 3px rgba(185, 240, 64, 0.1);
}

.treemap-search-clear {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    display: none;
    color: #999;
    font-size: 18px;
    line-height: 1;
    width: 24px;
    height: 24px;
    align-items: center;
    justify-content: center;
    border-radius: 3px;
    transition: background-color 0.2s, color 0.2s;
}

.treemap-search-clear:hover {
    background-color: #f0f0f0;
    color: #667eea;
}

.treemap-svg-container {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 0;
    overflow: hidden;
    width: 100%;
    transition: max-height 0.3s ease-out, opacity 0.3s ease-out, margin 0.3s ease-out, padding 0.3s ease-out;
    max-height: 2000px;
    opacity: 1;
}

.treemap-container.collapsed .treemap-svg-container {
    max-height: 0;
    opacity: 0;
    margin: 0;
    padding: 0;
    min-height: 0;
    overflow: hidden;
}

.treemap-container.collapsed .chart__toggle-icon {
    transform: rotate(-90deg);
}

.treemap-svg-container svg {
    display: block;
    /* SVG dimensions are set via attributes in JavaScript */
    /* SVG will be centered by parent flex container */
}

.visualizations-grid {
    display: grid;
    grid-template-columns: 1fr 1fr; /* 50/50 split */
    gap: 30px;
    padding: 30px;
    margin: 0;
    align-items: start;
}

.visualizations-grid > .chart-column,
.visualizations-grid > .chart {
    min-width: 0; /* Prevent grid items from overflowing */
}

.visualizations-grid.chart-fullwidth {
    grid-template-columns: 1fr; /* Full width for multi-choice charts */
}

.chart-fullwidth .chart {
    width: 100%;
}

.chart-column {
    display: flex;
    flex-direction: column;
    gap: 30px;
    transition: all 0.3s ease-out;
    min-width: 0; /* Prevent flex items from overflowing */
    width: 100%; /* Ensure it takes full width of grid column */
}

.favourites-section {
    transition: all 0.3s ease-out;
}

@media (max-width: 1024px) {
    .visualizations-grid {
        grid-template-columns: 1fr;
        gap: 20px;
        padding: 20px;
    }

    .chart-column {
        display: contents;
    }

    .chart-column > .chart {
        order: 1;
    }

    .chart[aria-label="All Topics"] {
        order: 2;
    }

    .favourites-section {
        order: 3;
    }

    .treemap-section {
        padding: 20px 20px 0 20px;
    }

    .data-source-selector__content {
        gap: 18px;
    }

    .filter-panels {
        gap: 18px;
    }
}

@media (max-width: 768px) {
    .treemap-section {
        padding: 16px 16px 0 16px;
    }

    .treemap-header {
        padding: 16px 20px 12px 20px;
    }

    .treemap-title {
        font-size: 18px;
    }

    .treemap-subtitle {
        font-size: 12px;
    }

    .filter-tabs {
        display: flex;
    }

    .data-source-selector {
        padding: 16px 20px;
        gap: 12px;
    }

    .data-source-selector__content {
        flex-direction: row;
        align-items: center;
        gap: 12px;
    }

    .filter-panels {
        flex-direction: column;
        gap: 0;
        flex: 1;
        min-width: 0;
    }

    .filter-panel {
        display: none;
        width: 100%;
    }

    .filter-panel.active {
        display: flex;
        flex-direction: row;
        align-items: center;
        gap: 12px;
    }

    .filter-panel label {
        display: none;
    }

    .filter-panel select {
        flex: 1;
        width: 100%;
        min-width: 0;
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .data-source-actions {
        margin-left: 0;
        width: auto;
        flex-shrink: 0;
    }

    .filter-menu {
        width: auto;
    }

    .filter-menu > button {
        width: auto;
    }

    #filterDropdown {
        left: auto;
        right: 0;
        min-width: 350px;
        max-width: 450px;
        width: auto;
    }

    #dimensionNameEditor {
        width: 100%;
        flex-wrap: wrap;
        gap: 10px;
    }

    #dimensionNameEditor select,
    #dimensionNameEditor input {
        flex: 1;
        min-width: 140px;
    }
}

.node {
    cursor: pointer;
    stroke: rgba(255, 255, 255, 0.8);
    stroke-width: 3px;
    transition: filter 0.3s ease-in-out, transform 0.2s ease-in-out;
    rx: 5px;
    ry: 5px;
    touch-action: manipulation; /* Prevents double-tap zoom on nodes */
}

.node:hover {
    filter: brightness(1.1);
}

.node:active {
    filter: brightness(0.95);
    transform: scale(0.98);
}

.node-text {
    pointer-events: none;
    font-family: 'Lato', sans-serif;
    font-size: clamp(10px, 1.5vw, 14px);
    font-weight: 500;
    fill: white;
    text-anchor: middle;
    dominant-baseline: middle;
}

.node-label {
    pointer-events: none;
    font-family: 'Lato', sans-serif;
    font-size: clamp(9px, 1.3vw, 12px);
    font-weight: 500;
    fill: white;
    text-anchor: middle;
    dominant-baseline: middle;
    opacity: 0.95;
}

.category-label {
    pointer-events: none;
    font-family: 'Lato', sans-serif;
    font-weight: 600;
    font-size: clamp(10px, 1.6vw, 14px);
    fill: white;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.category-percent {
    pointer-events: none;
    font-family: 'Lato', sans-serif;
    font-weight: 500;
    font-size: 0.8rem;
    fill: white;
    opacity: 0.9;
}

.overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 10001;
    animation: fadeIn 0.3s ease-in-out;
}

.overlay.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Context Menu Styles */
.context-menu {
    position: fixed;
    background: oklch(1 0 0); /* White */
    border: 1px solid oklch(0.922 0 0); /* Border color from style guide */
    border-radius: 0.5rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    z-index: 10002;
    min-width: 200px;
    padding: 0.25rem;
    display: none;
    font-family: 'Lato', sans-serif;
}

.context-menu-item {
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    font-size: 0.875rem;
    color: oklch(0.145 0 0); /* Near black */
    transition: background 0.2s ease;
    border-radius: 0.375rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.context-menu-item:hover {
    background: oklch(0.97 0 0); /* Light grey */
}

.context-menu-item:active {
    background: oklch(0.94 0 0);
}

/* Insight Modal Styles */
.insight-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 10003;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease-in-out;
}

.insight-modal-content {
    background: white;
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

.insight-modal-header {
    padding: 24px;
    border-bottom: 1px solid #EBEBEB;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.insight-modal-header h2 {
    margin: 0;
    font-size: 24px;
    font-weight: 600;
    color: #1A2B3C;
}

.insight-modal-close {
    background: none;
    border: none;
    font-size: 28px;
    color: #666;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s;
}

.insight-modal-close:hover {
    background: #f5f5f5;
    color: #333;
}

.insight-form-group {
    padding: 0 24px;
    margin-bottom: 20px;
}

.insight-form-group label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
}

.insight-form-group input,
.insight-form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #EBEBEB;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    box-sizing: border-box;
}

.insight-form-group textarea {
    min-height: 80px;
    resize: vertical;
}

.insight-origin-preview {
    padding: 12px;
    background: #f8f9fa;
    border: 1px solid #EBEBEB;
    border-radius: 6px;
    font-size: 13px;
    color: #666;
}

.insight-origin-preview strong {
    color: #333;
}

.insight-modal-actions {
    padding: 24px;
    border-top: 1px solid #EBEBEB;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.insight-modal-cancel,
.insight-modal-submit {
    padding: 10px 20px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
}

.insight-modal-cancel {
    background: white;
    color: #1A2B3C;
    border: 1px solid #EBEBEB;
}

.insight-modal-cancel:hover {
    background: #f5f5f5;
}

.insight-modal-submit {
    background: #B9F040;
    color: #1A2B3C;
}

.insight-modal-submit:hover {
    background: #A5D837;
}

.overlay-content {
    background: white;
    border-radius: 12px;
    width: 90%;
    max-width: 1200px;
    height: 85vh;
    max-height: 800px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    border: 1px solid #e8e8e8;
    display: flex;
    flex-direction: column;
    animation: slideUp 0.3s ease-in-out;
    overflow: hidden;
}

@keyframes slideUp {
    from { 
        opacity: 0;
        transform: translateY(30px);
    }
    to { 
        opacity: 1;
        transform: translateY(0);
    }
}

.overlay-header {
    padding: 20px 30px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    background: #000000;
    color: white;
    border-radius: 12px 12px 0 0;
    position: relative;
}

.overlay-header-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.settings-button {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    cursor: pointer;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease-in-out;
    padding: 0;
}

.settings-button img {
    opacity: 1;
    filter: none;
    transition: filter 0.2s ease-in-out, opacity 0.2s ease-in-out;
}

.settings-button:hover {
    background: rgba(185, 240, 64, 0.2);
    border-color: #B9F040;
    color: #B9F040;
    transform: scale(1.1);
}

.settings-button:hover img {
    filter: brightness(0) saturate(100%) invert(72%) sepia(98%) saturate(1352%) hue-rotate(50deg) brightness(1.05);
}

.settings-button.active {
    background: rgba(185, 240, 64, 0.2);
    border-color: #B9F040;
    color: #B9F040;
}

.settings-button.active img {
    filter: brightness(0) saturate(100%) invert(72%) sepia(98%) saturate(1352%) hue-rotate(50deg) brightness(1.05);
}

.settings-panel {
    position: absolute;
    top: 70px;
    right: 30px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    padding: 20px;
    min-width: 220px;
    z-index: 10002;
    display: none;
    animation: slideDown 0.2s ease-out;
}

.settings-panel.active {
    display: block;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.settings-panel h3 {
    font-family: 'Lato', sans-serif;
    font-size: 14px;
    font-weight: 600;
    margin: 0 0 16px 0;
    color: #333;
}

.settings-option {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
    cursor: pointer;
}

.settings-option:last-child {
    margin-bottom: 0;
}

.settings-option input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #B9F040;
}

.settings-option label {
    font-family: 'Lato', sans-serif;
    font-size: 14px;
    color: #555;
    cursor: pointer;
    user-select: none;
}

.overlay-title {
    font-family: 'Lato', sans-serif;
    font-size: 20px;
    font-weight: 600;
    margin: 0;
}

.overlay-subtitle {
    font-family: 'Lato', sans-serif;
    font-size: 14px;
    opacity: 0.9;
    margin-top: 4px;
}

.close-button {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    font-size: 28px;
    cursor: pointer;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease-in-out;
    line-height: 1;
    padding: 0;
}

.close-button:hover {
    background: rgba(185, 240, 64, 0.2);
    border-color: #B9F040;
    color: #B9F040;
    transform: scale(1.1);
}

.verbatim-container {
    columns: 280px;
    column-gap: 20px;
    padding: 30px;
    background: #fafafa;
    overflow-y: auto;
    flex: 1;
    box-sizing: border-box;
}

.verbatim-card {
    background: white;
    border: 1px solid #e8e8e8;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
    transition: all 0.3s ease-in-out;
    min-height: 80px;
    height: auto;
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow: visible;
    overflow-wrap: break-word;
    word-wrap: break-word;
    word-break: break-word;
    break-inside: avoid;
    page-break-inside: avoid;
    margin-top: 10px;
    margin-bottom: 10px;
}

.verbatim-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    border-color: #d0d0d0;
}

.verbatim-text {
    font-family: 'Lato', sans-serif;
    font-size: 14px;
    line-height: 1.6;
    color: #333;
    margin-bottom: 16px;
    flex: 0 1 auto;
    min-width: 0;
    width: 100%;
    overflow-wrap: break-word;
    word-wrap: break-word;
    word-break: break-word;
    hyphens: auto;
}

.verbatim-text p {
    margin-bottom: 8px;
}

.search-highlight {
    background-color: rgba(185, 240, 64, 0.3) !important;
    padding: 2px 2px;
    border-radius: 2px;
    font-weight: 500;
    color: inherit;
}

.verbatim-meta {
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-size: 12px;
    color: #666;
    border-top: 1px solid #f0f0f0;
    padding-top: 12px;
    flex-shrink: 0;
}

.verbatim-meta-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.verbatim-meta-label {
    font-weight: 600;
    color: #555;
}

.sentiment {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.sentiment-positive {
    background: #E8F5E9;
    color: #2E7D32;
}

.sentiment-neutral {
    background: #E3F2FD;
    color: #1565C0;
}

.sentiment-negative {
    background: #FFEBEE;
    color: #C62828;
}

.verbatim-metadata {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid #f0f0f0;
}

.verbatim-metadata-item {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    background: #f5f5f5;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
    color: #555;
    white-space: nowrap;
    line-height: 1.4;
}

.verbatim-metadata-item.sentiment-positive {
    background: #E8F5E9;
    border-color: #C8E6C9;
    color: #2E7D32;
}

.verbatim-metadata-item.sentiment-neutral {
    background: #E3F2FD;
    border-color: #BBDEFB;
    color: #1565C0;
}

.verbatim-metadata-item.sentiment-negative {
    background: #FFEBEE;
    border-color: #FFCDD2;
    color: #C62828;
}

.verbatim-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.favourite-button {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ccc;
    transition: all 0.2s ease;
    flex-shrink: 0;
    margin-left: 12px;
}

.favourite-button:hover {
    color: #ffa500;
    transform: scale(1.1);
}

.favourite-button.active {
    color: #ffa500;
}

.favourite-button svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

.favourites-section {
    padding: 24px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.insights-panel-container {
    margin: 0; /* Remove margin since chart-column already has gap */
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    border: 2px solid #EBEBEB;
    width: 100%; /* Match width of chart above */
    min-width: 0; /* Prevent overflow */
}

.insights-panel-header {
    padding: 20px 24px;
    border-bottom: 1px solid #EBEBEB;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}

.insights-panel-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.insights-panel-header-left h2 {
    font-size: 20px;
    font-weight: 600;
    color: #333;
    margin: 0;
}

.insights-filter-badge {
    background: #B9F040;
    color: #1A2B3C;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.insights-panel-header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.btn-primary-small {
    background: #B9F040;
    color: #1A2B3C;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    font-size: 13px;
}

.btn-link {
    background: none;
    border: none;
    color: #667eea;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    text-decoration: underline;
}

.insights-panel-toggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    color: #666;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s, transform 0.2s;
    border-radius: 4px;
}

.insights-panel-toggle:hover {
    color: #333;
    background: #f0f0f0;
}

.insights-panel-toggle-icon {
    transition: transform 0.2s;
}

.insights-panel-container.collapsed .insights-panel-toggle-icon {
    transform: rotate(-90deg);
}

.insights-panel-add-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, opacity 0.2s;
    border-radius: 4px;
    width: 24px;
    height: 24px;
}

.insights-panel-add-btn:hover {
    background: #f0f0f0;
    opacity: 0.8;
}

.insights-panel-add-btn img {
    display: block;
}

.insights-add-dropdown {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.insights-add-dropdown-menu {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    min-width: 180px;
    background: #fff;
    border: 1px solid #e8e8e8;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    padding: 6px;
    display: none;
    z-index: 10;
}

.insights-add-dropdown-menu.open {
    display: block;
}

.insights-add-dropdown-item {
    width: 100%;
    background: none;
    border: none;
    padding: 8px 10px;
    text-align: left;
    font-size: 13px;
    color: #333;
    cursor: pointer;
    border-radius: 6px;
    transition: background 0.2s, color 0.2s;
}

.insights-add-dropdown-item:hover {
    background: #f5f5f5;
}

.ai-button-container {
    position: relative;
    display: inline-block;
    margin-right: 8px;
}

.ai-dropdown-menu {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    min-width: 180px;
    background: #fff;
    border: 1px solid #e8e8e8;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    padding: 6px;
    z-index: 1001;
}

.ai-dropdown-menu.open {
    display: block !important;
}

.ai-dropdown-item {
    width: 100%;
    background: none;
    border: none;
    padding: 8px 10px;
    text-align: left;
    font-size: 13px;
    color: #333;
    cursor: pointer;
    border-radius: 6px;
    transition: background 0.2s, color 0.2s;
    display: block;
}

.ai-dropdown-item:hover:not(.loading) {
    background: #f5f5f5;
}

.ai-dropdown-item.loading {
    color: #999;
    font-style: italic;
    cursor: default;
}

.ai-dropdown-divider {
    height: 1px;
    background: #e8e8e8;
    margin: 4px 0;
}

.insights-panel-body {
    transition: max-height 0.3s ease-out;
    padding: 0 24px calc(24px + 0.5rem) 24px;
}

.insights-panel-body.collapsed {
    max-height: 0;
    overflow: hidden;
}

/* Insights Table Section */
.insights-table-section {
    padding: 0;
}

/* Override table width for insights panel to fit container */
.insights-table-section .table-container {
    overflow-x: visible;
    overflow-y: visible !important;
}

.insights-table-section .notion-table {
    min-width: auto;
    width: 100%;
    table-layout: fixed;
}

/* Hide drag handles and column icons in insights panel */
.insights-table-section .notion-table th .drag-handle,
.insights-table-section .notion-table th .column-icon {
    display: none;
}

/* Override name-cell padding and width in insights panel (no checkbox column) */
.insights-table-section .notion-table .name-cell,
.insights-table-section .notion-table th.name-cell {
    padding-left: 0.75rem;
    min-width: auto;
    width: 60%;
    max-width: 60%;
}

/* Created column takes remaining space */
.insights-table-section .notion-table th[data-column="created_at"],
.insights-table-section .notion-table td[data-column="created_at"] {
    width: 40%;
    max-width: 40%;
}

/* Pinned overview rows styling */
.insights-table-section .notion-table tbody tr.pinned-overview {
    background: rgba(185, 240, 64, 0.1); /* Subtle lime background */
}

.insights-table-section .notion-table tbody tr.pinned-overview:hover {
    background: rgba(185, 240, 64, 0.15); /* Slightly more visible on hover */
}

.insights-table-section .notion-table tbody tr.pinned-overview .pin-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    opacity: 0.8;
}

/* Fixed width for Status column in insights section */
#insights-section .notion-table th[data-column="status"],
#insights-section .notion-table td[data-column="status"] {
    width: 190px;
    min-width: 190px;
    max-width: 190px;
    text-align: center;
    vertical-align: middle;
}

#insights-section .notion-table td[data-column="status"] .status-select {
    margin: 0 auto;
    display: block;
}

/* Name column takes remaining space in insights section */
#insights-section .notion-table .name-cell,
#insights-section .notion-table th.name-cell {
    width: auto;
    min-width: 250px;
}

/* Font size for insight rows and pills */
#insights-section .notion-table td {
    font-size: 15px;
}

#insights-section .tag {
    font-size: 15px;
}

/* History Section Styles */
#history-section {
    padding: 0;
}

#history-section .control-bar {
    position: relative;
    padding: 0.5rem 1.5rem;
    border-bottom: 1px solid oklch(0.922 0 0);
    background: oklch(1 0 0);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    min-height: 40px;
}

#history-section .search-box {
    display: flex;
    align-items: center;
    background: oklch(0.97 0 0);
    border-radius: 0.375rem;
    padding: 0.25rem 0.5rem;
    min-width: 200px;
    flex: 0 0 auto;
}

#history-section .search-box input {
    border: none;
    background: transparent;
    outline: none;
    font-size: 0.875rem;
    font-family: 'Lato', sans-serif;
    padding: 0.125rem 0.25rem;
    flex: 1;
    color: oklch(0.145 0 0);
}

#history-section .search-box input::placeholder {
    color: oklch(0.556 0 0);
}

#history-section .table-container {
    overflow-x: auto;
}

#history-section .notion-table {
    width: 100%;
    border-collapse: collapse;
}

#history-section .notion-table th {
    padding: 0.5rem 0.75rem;
    text-align: left;
    font-weight: 500;
    font-size: 14px;
    color: oklch(0.556 0 0);
    border-bottom: 1px solid oklch(0.922 0 0);
    cursor: pointer;
    user-select: none;
}

#history-section .notion-table th:hover {
    background: oklch(0.97 0 0);
}

#history-section .notion-table td {
    padding: 0.5rem 0.75rem;
    font-size: 15px;
    border-bottom: 1px solid oklch(0.97 0 0);
}

#history-section .notion-table .name-cell {
    width: auto;
    min-width: 250px;
}

#history-section .notion-table th[data-column="origin"],
#history-section .notion-table td[data-column="origin"] {
    white-space: nowrap;
}

#history-section .notion-table th[data-column="created_at"],
#history-section .notion-table td[data-column="created_at"] {
    width: 30%;
    min-width: 120px;
}

#history-section .notion-table tbody tr:hover {
    background: oklch(0.98 0 0);
}

#history-section .name-content {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

#history-section .doc-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    color: oklch(0.556 0 0);
}

#history-section .sort-indicator {
    margin-left: 0.25rem;
    font-size: 12px;
    color: oklch(0.556 0 0);
}

/* Control Bar */
.control-bar {
    position: relative;
    padding: 0.5rem 1.5rem;
    border-bottom: 1px solid oklch(0.922 0 0);
    background: oklch(1 0 0);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    min-height: 40px;
}

.search-box {
    display: flex;
    align-items: center;
    background: oklch(0.97 0 0);
    border-radius: 0.375rem;
    padding: 0.25rem 0.5rem;
    min-width: 200px;
    flex: 0 0 auto;
}

.search-box input {
    border: none;
    background: transparent;
    outline: none;
    font-size: 0.875rem;
    font-family: 'Lato', sans-serif;
    padding: 0.125rem 0.25rem;
    flex: 1;
    color: oklch(0.145 0 0);
}

.search-box input::placeholder {
    color: oklch(0.556 0 0);
}

.filter-chips {
    display: flex;
    gap: 0.375rem;
    flex-wrap: wrap;
    flex: 1;
}

.filter-chip {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.25rem 0.5rem;
    background: oklch(0.97 0 0);
    border-radius: 0.375rem;
    font-size: 0.8125rem;
    font-family: 'Lato', sans-serif;
    color: oklch(0.145 0 0);
}

.filter-chip .remove {
    cursor: pointer;
    opacity: 0.6;
    padding: 0 0.125rem;
}

.filter-chip .remove:hover {
    opacity: 1;
}

/* Inline Filter Dropdown */
.inline-filter-dropdown {
    position: relative;
    display: inline-block;
    margin-right: 0.5rem;
}

.inline-filter-header {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.25rem 0.5rem;
    background: oklch(0.97 0 0);
    border: 1px solid rgba(55, 53, 47, 0.16);
    border-radius: 0.375rem;
    font-size: 0.8125rem;
    font-family: 'Lato', sans-serif;
    color: oklch(0.145 0 0);
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 120px;
}

.inline-filter-header:hover {
    background: oklch(0.95 0 0);
    border-color: rgba(55, 53, 47, 0.24);
}

.inline-filter-header.open {
    background: white;
    border-color: #B9F040;
    box-shadow: 0 0 0 2px rgba(185, 240, 64, 0.2);
}

.inline-filter-icon {
    opacity: 0.6;
    font-size: 0.875rem;
}

.inline-filter-label {
    flex: 1;
    font-weight: 500;
}

.inline-filter-chevron {
    opacity: 0.4;
    font-size: 0.75rem;
    transition: transform 0.2s;
}

.inline-filter-header.open .inline-filter-chevron {
    transform: rotate(180deg);
}

.inline-filter-options {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    background: white;
    border: 1px solid rgba(55, 53, 47, 0.16);
    border-radius: 0.375rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    min-width: 200px;
    max-width: 300px;
    z-index: 1001;
    display: none;
    padding: 4px 0;
}

.inline-filter-options.open {
    display: block;
}

.inline-filter-option {
    padding: 8px 12px;
    cursor: pointer;
    font-size: 0.8125rem;
    font-family: 'Lato', sans-serif;
    color: oklch(0.145 0 0);
    transition: background 0.1s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.inline-filter-option:hover {
    background: rgba(55, 53, 47, 0.06);
}

.inline-filter-option.selected {
    background: rgba(185, 240, 64, 0.2);
    font-weight: 500;
}

.inline-filter-toggle-all {
    padding: 6px 12px;
    margin-bottom: 4px;
    cursor: pointer;
    font-size: 0.75rem;
    font-family: 'Lato', sans-serif;
    color: #2563eb;
    border-bottom: 1px solid rgba(55, 53, 47, 0.09);
    user-select: none;
}

.inline-filter-toggle-all:hover {
    background: rgba(37, 99, 235, 0.06);
    text-decoration: underline;
}

.inline-filter-checkbox {
    width: 16px;
    height: 16px;
    cursor: pointer;
    margin: 0;
    flex-shrink: 0;
    accent-color: #B9F040;
    appearance: checkbox;
    -webkit-appearance: checkbox;
    -moz-appearance: checkbox;
}

/* Debug: Force checkbox visibility */
.inline-filter-checkbox:checked {
    accent-color: #B9F040 !important;
}

/* Additional debug styling */
.inline-filter-checkbox::before {
    content: '';
    display: none;
}

.inline-filter-option {
    display: flex;
    align-items: center;
    gap: 8px;
}

.inline-filter-remove {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 18px;
    height: 18px;
    background: white;
    border: 1px solid rgba(55, 53, 47, 0.16);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 12px;
    color: rgba(55, 53, 47, 0.6);
    z-index: 10;
    transition: all 0.2s;
    line-height: 1;
}

.inline-filter-remove:hover {
    background: rgba(220, 38, 38, 0.1);
    border-color: rgba(220, 38, 38, 0.3);
    color: rgba(220, 38, 38, 0.8);
}

.btn-filter {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.5rem;
    background: transparent;
    border: none;
    color: oklch(0.556 0 0);
    cursor: pointer;
    font-size: 0.8125rem;
    font-family: 'Lato', sans-serif;
    border-radius: 0.375rem;
    transition: all 0.2s ease;
}

.btn-filter:hover {
    background: oklch(0.97 0 0);
    color: oklch(0.145 0 0);
}

.btn-reset {
    padding: 0.25rem 0.5rem;
    background: transparent;
    border: none;
    color: oklch(0.556 0 0);
    cursor: pointer;
    font-size: 0.8125rem;
    font-family: 'Lato', sans-serif;
    border-radius: 0.375rem;
    transition: all 0.2s ease;
}

.btn-reset:hover {
    background: oklch(0.97 0 0);
    color: oklch(0.145 0 0);
}

.btn-delete {
    padding: 0.25rem 0.5rem;
    background: transparent;
    border: none;
    color: oklch(0.556 0 0);
    cursor: pointer;
    font-size: 0.8125rem;
    font-family: 'Lato', sans-serif;
    border-radius: 0.375rem;
    transition: all 0.2s ease;
}

.btn-delete:hover {
    background: oklch(0.97 0 0);
    color: oklch(0.8 0.15 25);
}

/* Filter Dropdown Menu */
.filter-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: white;
    border: 1px solid rgba(55, 53, 47, 0.16);
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    min-width: 280px;
    max-width: 320px;
    max-height: 500px;
    z-index: 1000;
    display: none;
    overflow: hidden;
    margin-top: 4px;
}

.filter-dropdown.active {
    display: block;
}

.filter-dropdown-search {
    padding: 12px;
    border-bottom: 1px solid rgba(55, 53, 47, 0.09);
}

.filter-dropdown-search input {
    width: 100%;
    padding: 6px 8px;
    border: 2px solid #4285f4;
    border-radius: 4px;
    font-size: 14px;
    font-family: 'Lato', sans-serif;
    outline: none;
    box-sizing: border-box;
}

.filter-dropdown-search input::placeholder {
    color: rgba(55, 53, 47, 0.4);
}

.filter-dropdown-list {
    max-height: 300px;
    overflow-y: auto;
    padding: 4px 0;
}

.filter-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    cursor: pointer;
    font-size: 14px;
    font-family: 'Lato', sans-serif;
    color: rgba(55, 53, 47, 0.8);
    transition: background 0.1s;
}

.filter-option:hover {
    background: rgba(55, 53, 47, 0.06);
}

.filter-option-icon {
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.6;
    font-size: 14px;
}

.filter-option-text {
    flex: 1;
}

.filter-active-filters {
    padding: 8px 12px;
    border-top: 1px solid rgba(55, 53, 47, 0.09);
    background: rgba(55, 53, 47, 0.03);
    max-height: 150px;
    overflow-y: auto;
}

.filter-active-filters-title {
    font-size: 12px;
    font-weight: 500;
    color: rgba(55, 53, 47, 0.6);
    margin-bottom: 6px;
}

.filter-active-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 8px;
    margin-bottom: 4px;
    background: white;
    border-radius: 3px;
    font-size: 12px;
}

.filter-active-item-remove {
    cursor: pointer;
    opacity: 0.6;
    padding: 0 4px;
    font-size: 16px;
    line-height: 1;
}

.filter-active-item-remove:hover {
    opacity: 1;
}

.filter-value-dialog {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    border: 1px solid rgba(55, 53, 47, 0.16);
    border-radius: 6px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    min-width: 300px;
    max-width: 400px;
    max-height: 500px;
    z-index: 2000;
    display: none;
}

.filter-value-dialog.active {
    display: block;
}

.filter-value-dialog-header {
    padding: 12px 16px;
    border-bottom: 1px solid rgba(55, 53, 47, 0.09);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.filter-value-dialog-title {
    font-size: 14px;
    font-weight: 600;
    color: rgba(55, 53, 47, 0.8);
    font-family: 'Lato', sans-serif;
}

.filter-value-dialog-close {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 20px;
    color: rgba(55, 53, 47, 0.6);
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 3px;
    transition: background 0.1s;
}

.filter-value-dialog-close:hover {
    background: rgba(55, 53, 47, 0.06);
}

.filter-value-dialog-body {
    padding: 16px;
    max-height: 400px;
    overflow-y: auto;
}

.filter-value-option {
    padding: 8px 12px;
    cursor: pointer;
    border-radius: 3px;
    margin-bottom: 4px;
    font-size: 14px;
    font-family: 'Lato', sans-serif;
    color: rgba(55, 53, 47, 0.8);
    transition: background 0.1s;
}

.filter-value-option:hover {
    background: rgba(55, 53, 47, 0.06);
}

.filter-value-option.selected {
    background: rgba(185, 240, 64, 0.2);
    font-weight: 500;
}

.filter-dialog-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    z-index: 1999;
    display: none;
}

.filter-dialog-overlay.active {
    display: block;
}

/* Table */
.table-container {
    overflow-x: auto;
    overflow-y: visible !important;
    background: oklch(1 0 0);
}

.notion-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 1200px;
}

.notion-table thead {
    background: oklch(0.98 0 0);
    border-bottom: 1px solid oklch(0.922 0 0);
}

.notion-table th {
    padding: 0.5rem 0.75rem;
    text-align: left;
    font-weight: 500;
    font-size: 0.8125rem;
    font-family: 'Lato', sans-serif;
    color: oklch(0.556 0 0);
    white-space: nowrap;
    cursor: pointer;
    user-select: none;
    position: relative;
    border-right: 1px solid oklch(0.92 0 0);
    border-bottom: 1px solid oklch(0.92 0 0);
}

.notion-table th:hover {
    background: oklch(0.97 0 0);
}

.notion-table th .sort-indicator {
    margin-left: 0.25rem;
    opacity: 0.4;
}

.notion-table th.sorted .sort-indicator {
    opacity: 1;
}

.notion-table th .column-icon {
    margin-right: 0.375rem;
    opacity: 0.4;
}

.notion-table tbody tr {
    transition: background 0.1s;
}

.notion-table tbody tr:hover {
    background: oklch(0.98 0 0);
}

.notion-table tbody tr:hover .insight-open-btn-table {
    display: flex !important;
}

.insight-open-btn-table {
    display: none;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.5rem;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(4px);
    border: 1px solid rgba(55, 53, 47, 0.1);
    border-radius: 0.375rem;
    color: oklch(0.556 0 0);
    font-size: 0.75rem;
    font-weight: 500;
    font-family: 'Lato', sans-serif;
    cursor: pointer;
    transition: all 0.2s ease;
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.insight-open-btn-table:hover {
    background: oklch(0.95 0 0);
    color: oklch(0.145 0 0);
}

.notion-table td {
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    font-family: 'Lato', sans-serif;
    vertical-align: middle;
    border-right: 1px solid oklch(0.92 0 0);
    border-bottom: 1px solid oklch(0.92 0 0);
}

.notion-table .checkbox-cell {
    width: 32px;
    padding: 0.5rem;
    text-align: center;
}

.notion-table .checkbox {
    width: 16px;
    height: 16px;
    border: 1.5px solid oklch(0.85 0 0);
    border-radius: 0.375rem;
    cursor: pointer;
    display: inline-block;
    transition: all 0.2s ease;
}

.notion-table .checkbox:hover {
    border-color: oklch(0.7 0 0);
}

.notion-table .name-cell {
    min-width: 250px;
    font-weight: 500;
    padding-left: 35px;
}

.notion-table th.name-cell {
    padding-left: 35px;
}

.notion-table .name-cell .name-content {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    position: relative;
    /* No padding-right - OPEN button overlays on hover */
}

.notion-table .name-cell .doc-icon {
    width: 16px;
    height: 16px;
    opacity: 0.4;
    flex-shrink: 0;
}

/* Tags/Pills */
.tag {
    display: inline-block;
    padding: 0.125rem 0.5rem;
    border-radius: 0.375rem;
    font-size: 0.8125rem;
    font-weight: 400;
    font-family: 'Lato', sans-serif;
    margin-right: 0.25rem;
    margin-bottom: 0.125rem;
}

.tag-type {
    background: rgba(46, 170, 220, 0.15);
    color: #2eaadc;
}

.tag-project {
    background: rgba(255, 171, 0, 0.15);
    color: #ffab00;
}

.tag-data-source {
    background: rgba(99, 71, 169, 0.15);
    color: #6347a9;
}

/* Status */
.status {
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.status-dot.not-started {
    background: #d1d1d1;
}

.status-dot.in-progress {
    background: #0b85ff;
}

.status-dot.done {
    background: #0f7b0f;
}

.status-select {
    border: none;
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 14px;
    font-weight: 500;
    background: white;
    color: #37352f;
    cursor: pointer;
    min-width: 140px;
    font-family: 'Lato', sans-serif;
    transition: all 0.2s ease;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%239ca3af' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 32px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.status-select:hover {
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
    transform: translateY(-1px);
}

.status-select:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(185, 240, 64, 0.15), 0 2px 4px rgba(0, 0, 0, 0.08);
}

.status-select:active {
    transform: translateY(0);
}

/* Insight Multi-Select Cells */
.insight-multiselect-cell {
    position: relative;
    cursor: pointer;
    padding: 8px 12px;
    min-height: 36px;
    display: flex;
    align-items: center;
    border-radius: 6px;
    transition: background 0.15s ease;
}

.insight-multiselect-cell:hover {
    background: oklch(0.98 0 0);
}

.insight-pills-container {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    width: 100%;
}

.insight-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    background: rgba(99, 71, 169, 0.1);
    color: #6347a9;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    transition: all 0.15s ease;
}

.insight-pill:hover {
    opacity: 0.8;
    filter: brightness(1.1);
}

.pill-remove {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    width: 16px;
    height: 16px;
    display: none;
    align-items: center;
    justify-content: center;
    border-radius: 3px;
    color: #6347a9;
    font-size: 18px;
    line-height: 1;
    transition: all 0.15s ease;
    opacity: 0.6;
}

.pill-remove:hover {
    background: rgba(99, 71, 169, 0.2);
    opacity: 1;
}

/* Show remove buttons when dropdown is active */
.insight-multiselect-cell.dropdown-active .pill-remove {
    display: flex;
}

.empty-value {
    color: oklch(0.7 0 0);
    font-size: 14px;
}

/* Multi-Select Dropdown */
.insight-multiselect-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 4px;
    background: white;
    border: 1px solid oklch(0.88 0 0);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1), 0 0 0 1px rgba(0, 0, 0, 0.05);
    z-index: 1000;
    max-height: 300px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.multiselect-search-container {
    padding: 8px;
    border-bottom: 1px solid oklch(0.92 0 0);
    background: white;
    position: sticky;
    top: 0;
    z-index: 1;
}

.multiselect-search {
    width: 100%;
    border: 1px solid oklch(0.88 0 0);
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 14px;
    font-family: 'Lato', sans-serif;
    outline: none;
    transition: all 0.15s ease;
}

.multiselect-search:focus {
    border-color: #b9f040;
    box-shadow: 0 0 0 3px rgba(185, 240, 64, 0.15);
}

.multiselect-options {
    overflow-y: auto;
    max-height: 250px;
}

.multiselect-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    cursor: pointer;
    transition: background 0.15s ease;
    font-size: 14px;
}

.multiselect-option:hover {
    background: oklch(0.98 0 0);
}

.multiselect-option.selected {
    background: rgba(185, 240, 64, 0.1);
}

.multiselect-option.selected:hover {
    background: rgba(185, 240, 64, 0.15);
}

.multiselect-option input[type="checkbox"] {
    cursor: pointer;
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.multiselect-option.create-new {
    color: #6347a9;
    font-weight: 500;
    border-top: 1px solid oklch(0.92 0 0);
    background: rgba(99, 71, 169, 0.03);
}

.multiselect-option.create-new:hover {
    background: rgba(99, 71, 169, 0.08);
}

.multiselect-option .create-icon {
    font-size: 18px;
    font-weight: bold;
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.multiselect-option .option-label {
    flex: 1;
    min-width: 0;
}

.multiselect-option-meatball {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 4px;
    opacity: 0;
    transition: opacity 0.15s ease, background 0.15s ease;
    flex-shrink: 0;
    color: oklch(0.556 0 0);
    font-size: 16px;
    line-height: 1;
}

.multiselect-option:hover .multiselect-option-meatball,
.multiselect-option-meatball-menu-open {
    opacity: 1;
}

.multiselect-option-meatball:hover {
    background: oklch(0.95 0 0);
}

.multiselect-option-meatball-menu {
    position: fixed;
    background: white;
    border: 1px solid oklch(0.88 0 0);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    min-width: 240px;
    max-width: 300px;
    z-index: 1002;
    display: none;
    padding: 12px;
}

.multiselect-option-meatball-menu.show {
    display: block;
}

.tag-edit-input-container {
    position: relative;
    margin-bottom: 12px;
}

.tag-edit-input {
    width: 100%;
    padding: 8px 32px 8px 10px;
    border: 2px solid #0b85ff;
    border-radius: 6px;
    font-size: 14px;
    font-family: 'Lato', sans-serif;
    outline: none;
    box-sizing: border-box;
}

.tag-edit-input:focus {
    border-color: #0b85ff;
}

.tag-info-icon {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: oklch(0.9 0 0);
    color: oklch(0.556 0 0);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    cursor: help;
}

.meatball-menu-divider {
    height: 1px;
    background: oklch(0.92 0 0);
    margin: 12px 0;
}

.meatball-menu-delete {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px;
    cursor: pointer;
    border-radius: 4px;
    transition: background 0.15s ease;
    color: oklch(0.145 0 0);
    font-size: 14px;
}

.meatball-menu-delete:hover {
    background: oklch(0.98 0 0);
}

.meatball-menu-delete-icon {
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.meatball-menu-colors-title {
    font-size: 14px;
    font-weight: 500;
    color: oklch(0.145 0 0);
    margin-bottom: 8px;
}

.meatball-menu-color-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    cursor: pointer;
    border-radius: 4px;
    transition: background 0.15s ease;
    font-size: 14px;
    color: oklch(0.145 0 0);
}

.meatball-menu-color-option:hover {
    background: oklch(0.98 0 0);
}

.meatball-menu-color-swatch {
    width: 16px;
    height: 16px;
    border-radius: 3px;
    flex-shrink: 0;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.meatball-menu-color-checkmark {
    margin-left: auto;
    color: oklch(0.556 0 0);
    font-size: 14px;
}

.meatball-menu-color-label {
    flex: 1;
}

.multiselect-empty {
    padding: 20px;
    text-align: center;
    color: oklch(0.6 0 0);
    font-size: 14px;
}

/* Inline Editable Name */
.insight-name-text {
    outline: none;
    padding: 2px 4px;
    border-radius: 4px;
    transition: background 0.15s ease;
    cursor: text;
}

.insight-name-text:hover {
    background: rgba(0, 0, 0, 0.03);
}

.insight-name-text:focus {
    background: rgba(185, 240, 64, 0.1);
    box-shadow: 0 0 0 2px rgba(185, 240, 64, 0.2);
}

/* Actions */
.actions-cell {
    width: 80px;
}

.action-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    color: oklch(0.7 0 0);
    font-size: 0.875rem;
    border-radius: 0.375rem;
    transition: all 0.2s ease;
}

.action-btn:hover {
    background: oklch(0.97 0 0);
    color: oklch(0.145 0 0);
}

/* Checkbox Column */
.checkbox-cell {
    width: 40px;
    text-align: center;
    padding: 0.5rem;
}

.checkbox-cell input[type="checkbox"] {
    cursor: pointer;
    width: 16px;
    height: 16px;
}

.notion-table tbody tr:hover .checkbox-cell {
    background: oklch(0.98 0 0);
}

/* Empty State */
.empty-state {
    padding: 3.75rem 1.5rem;
    text-align: center;
    color: oklch(0.556 0 0);
}

.empty-state h3 {
    font-size: 1rem;
    font-family: 'Lato', sans-serif;
    margin-bottom: 0.5rem;
    color: oklch(0.556 0 0);
}

.loading {
    padding: 2.5rem;
    text-align: center;
    color: oklch(0.556 0 0);
    font-family: 'Lato', sans-serif;
}

.favourites-section h2 {
    font-size: 24px;
    font-weight: 600;
    color: #333;
    margin-bottom: 16px;
}

.favourites-search-container {
    position: relative;
    margin-bottom: 24px;
}

.favourites-search-input {
    width: 100%;
    padding: 10px 40px 10px 14px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    font-family: 'Lato', sans-serif;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.favourites-search-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.favourites-search-clear {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    display: none;
    color: #999;
    font-size: 18px;
    line-height: 1;
    width: 24px;
    height: 24px;
    align-items: center;
    justify-content: center;
    border-radius: 3px;
    transition: background-color 0.2s, color 0.2s;
}

.favourites-search-clear:hover {
    background-color: #f0f0f0;
    color: #667eea;
}

.favourites-search-clear.active {
    display: flex;
}

.favourites-container {
    columns: 280px;
    column-gap: 20px;
    padding: 0;
}

.favourites-empty {
    padding: 40px 20px 20px;
    column-span: all;
    width: 100%;
    display: block;
}

.favourites-empty-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    grid-auto-rows: 150px;
    gap: 24px;
    justify-content: center;
    width: 100%;
}

@media (max-width: 1024px) {
    .favourites-empty-grid {
        grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
        grid-auto-rows: 150px;
    }
}

@media (max-width: 768px) {
    .favourites-empty-grid {
        grid-template-columns: minmax(0, 1fr);
        grid-auto-rows: 140px;
    }
}

.favourites-empty p {
    font-size: 16px;
    margin-bottom: 20px;
}

.skeleton-card {
    background: white;
    border: 1px solid #e8e8e8;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.6;
    }
}

.skeleton-line {
    height: 12px;
    background: #f0f0f0;
    border-radius: 4px;
    margin-bottom: 12px;
}

.skeleton-line:last-child {
    width: 60%;
}

.stats {
    padding: 24px 30px;
    background: white;
    border-bottom: 1px solid #e8e8e8;
    display: flex;
    justify-content: space-around;
    flex-wrap: wrap;
    gap: 30px;
}

.stat-item {
    text-align: center;
}

.stat-value {
    font-family: 'Lato', sans-serif;
    font-size: 36px;
    font-weight: 700;
    color: #667eea;
    display: block;
    line-height: 1;
}

.stat-label {
    font-family: 'Lato', sans-serif;
    font-size: 13px;
    color: #888;
    margin-top: 8px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.loading {
    text-align: center;
    font-size: 18px;
    color: #667eea;
    font-family: 'Lato', sans-serif;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    min-width: 280px;
}

.loading-label {
    font-size: 16px;
    font-weight: 500;
    color: #000;
}

.loading-progress {
    width: 100%;
    height: 6px;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 999px;
    overflow: hidden;
}

.loading-progress-bar {
    height: 100%;
    width: 0%;
    background: #B9F040;
    border-radius: 999px;
}

/* Skeleton loading states */
.is-loading {
    position: relative;
}

.skeleton-shimmer {
    animation: shimmer 1.2s infinite linear, pulse 2s infinite ease-in-out;
    background: linear-gradient(90deg, rgba(240,242,247,0.9) 25%, rgba(231,234,243,0.9) 37%, rgba(240,242,247,0.9) 63%);
    background-size: 400% 100%;
    border-radius: 6px;
}

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

@keyframes pulse {
    0%, 100% { 
        opacity: 0.6;
        transform: scale(1);
    }
    50% { 
        opacity: 0.8;
        transform: scale(1.02);
    }
}

/* Treemap skeleton */
.treemap-svg-container.is-loading::before {
    content: '';
    display: block;
    position: absolute;
    top: 16px;
    left: 16px;
    right: 16px;
    bottom: 16px;
    min-height: 220px;
    background: #f3f5fa;
    border: 1px dashed #e2e6f0;
    border-radius: 8px;
    animation: pulse 2s infinite ease-in-out;
}

.treemap-svg-container.is-loading::after {
    content: '';
    position: absolute;
    top: 16px;
    left: 16px;
    right: 16px;
    bottom: 16px;
    min-height: 220px;
    border-radius: 8px;
    opacity: 0.7;
}

/* Chart skeletons */
.chart.is-loading .chart__labels,
.chart.is-loading .chart__bars {
    position: relative;
    min-height: 140px;
}

.chart.is-loading .chart__labels::before,
.chart.is-loading .chart__labels::after,
.chart.is-loading .chart__bars::before,
.chart.is-loading .chart__bars::after {
    content: '';
    display: block;
    height: 12px;
    margin: 10px 0;
    background: #eef1f7;
    border-radius: 6px;
    animation: pulse 2s infinite ease-in-out;
}

.chart.is-loading .chart__labels::before { 
    width: 60%; 
    animation-delay: 0s;
}
.chart.is-loading .chart__labels::after { 
    width: 45%; 
    animation-delay: 0.3s;
}
.chart.is-loading .chart__bars::before { 
    width: 80%; 
    animation-delay: 0.1s;
}
.chart.is-loading .chart__bars::after { 
    width: 35%; 
    animation-delay: 0.4s;
}

/* Hide real content when loading */
.is-loading svg,
.chart.is-loading .chart__labels > *,
.chart.is-loading .chart__bars > * {
    opacity: 0;
    pointer-events: none;
}

.error {
    text-align: center;
    color: #dc3545;
    font-family: 'Lato', sans-serif;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

@media (max-width: 768px) {
    .node {
        stroke-width: 2px;
    }

    .header {
        padding: 20px 16px;
    }

    .breadcrumbs {
        padding: 12px 16px;
        min-height: 48px;
    }

    .breadcrumb-item {
        padding: 5px 10px;
        font-size: 12px;
    }

    .overlay-content {
        width: 95%;
        height: 90vh;
        height: calc(var(--vh, 1vh) * 90);
        border-radius: 8px;
        overflow: hidden;
    }

    .overlay-header {
        padding: 16px 20px;
        border-radius: 8px 8px 0 0;
    }

    .overlay-title {
        font-size: 16px;
    }

    .overlay-subtitle {
        font-size: 12px;
    }

    .verbatim-container {
        columns: 1;
        column-gap: 16px;
        padding: 16px;
        min-height: 0;
        overflow-y: auto;
    }

    .favourites-container {
        columns: 1;
        column-gap: 16px;
    }

    .verbatim-card {
        padding: 16px;
    }

    .verbatim-text {
        font-size: 13px;
    }

    .close-button {
        width: 36px;
        height: 36px;
        font-size: 24px;
    }

    .stats {
        padding: 16px 20px;
        gap: 20px;
    }

    .stat-value {
        font-size: 28px;
    }

    .stat-label {
        font-size: 11px;
    }
}

@media (max-width: 480px) {
    .header {
        padding: 16px 12px;
    }

    .header h1 {
        margin-bottom: 6px;
    }

    .breadcrumbs {
        padding: 10px 12px;
    }

    .overlay-content {
        width: 100%;
        height: 100vh;
        height: calc(var(--vh, 1vh) * 100);
        border-radius: 0;
        max-height: none;
        overflow: hidden;
    }

    .overlay-header {
        padding: 12px 16px;
        border-radius: 0;
    }

    .verbatim-container {
        columns: 1;
        column-gap: 12px;
        padding: 12px;
        min-height: 0;
        overflow-y: auto;
    }

    .favourites-container {
        columns: 1;
        column-gap: 12px;
    }

    .verbatim-card {
        padding: 14px;
    }

    .stat-value {
        font-size: 24px;
    }
}

/* Tablet landscape orientation */
@media (min-width: 769px) and (max-width: 1024px) {
    .verbatim-container {
        columns: 2;
    }

    .favourites-container {
        columns: 2;
    }
}

/* Very small screens - ensure cards are visible */
@media (max-width: 360px) {
    .verbatim-container {
        columns: 1;
        column-gap: 8px;
        padding: 8px;
        min-height: 0;
        overflow-y: auto;
    }

    .favourites-container {
        columns: 1;
        column-gap: 8px;
    }
    
    .verbatim-card {
        padding: 12px;
        min-height: 60px;
        width: 100%;
        box-sizing: border-box;
    }
    
    .verbatim-text {
        font-size: 12px;
        line-height: 1.4;
    }
    
    .overlay-content {
        height: 100vh;
        height: calc(var(--vh, 1vh) * 100);
        max-height: 100vh;
    }
}

/* Dimension Editor Styles */
.dimension-editor-container {
    padding: 30px;
    background: #fafafa;
    overflow-y: auto;
    flex: 1;
}

.dimension-editor-item {
    background: white;
    border: 1px solid #e8e8e8;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: all 0.3s ease-in-out;
}

.dimension-editor-item:hover {
    border-color: #667eea;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.1);
}

.dimension-ref {
    font-weight: 600;
    color: #667eea;
    min-width: 80px;
    font-size: 14px;
}

.dimension-select {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    font-family: 'Lato', sans-serif;
    transition: all 0.2s ease-in-out;
    background: white;
    cursor: pointer;
}

.dimension-select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.dimension-custom-input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    font-family: 'Lato', sans-serif;
    transition: all 0.2s ease-in-out;
    display: none;
}

.dimension-custom-input.active {
    display: block;
}

.dimension-custom-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.dimension-controls {
    flex: 1;
    display: flex;
    gap: 8px;
}

.manage-options-btn {
    padding: 8px 16px;
    background: #f0f0f0;
    color: #333;
    border: 1px solid #ddd;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s ease-in-out;
}

.manage-options-btn:hover {
    background: #e0e0e0;
}

.dimension-actions {
    display: flex;
    gap: 8px;
}

.dimension-save-btn {
    padding: 8px 16px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s ease-in-out;
}

.dimension-save-btn:hover {
    background: #5568d3;
}

.dimension-save-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.dimension-editor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid #e8e8e8;
}

.dimension-editor-actions {
    display: flex;
    gap: 12px;
}

.save-all-btn {
    padding: 10px 20px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s ease-in-out;
}

.save-all-btn:hover {
    background: #5568d3;
}

.save-all-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.dimension-status {
    font-size: 13px;
    color: #666;
    font-style: italic;
}

.dimension-status.saved {
    color: #2E7D32;
}

.dimension-status.unsaved {
    color: #C62828;
}

/* Bar Chart Styles */
.chart {
    background: white;
    border-radius: 8px;
    padding: 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    transition: padding 0.3s ease-out;
    width: 100%; /* Ensure chart takes full width of its container */
    min-width: 0; /* Prevent overflow */
    box-sizing: border-box; /* Include padding in width calculation */
}

.chart.collapsed {
    padding: 16px 24px;
    align-self: start;
    height: auto;
}

.chart.collapsed .chart__header {
    margin-bottom: 0;
}

.chart__header {
    margin-bottom: 8px;
}

.chart__header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.chart__title {
    font-family: 'Lato', sans-serif;
    font-size: 20px;
    font-weight: 600;
    color: #333;
    margin: 0;
    flex: 1;
}

.chart__toggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
    transition: color 0.2s, transform 0.2s;
    border-radius: 4px;
    flex-shrink: 0;
}

.chart__chart-type-toggle {
    display: inline-flex;
    background: #f0f0f0;
    border-radius: 6px;
    padding: 2px;
    flex-shrink: 0;
}

.chart-type-btn {
    background: none;
    border: none;
    padding: 4px 8px;
    cursor: pointer;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.15s, box-shadow 0.15s;
}

.chart-type-btn img {
    display: block;
    opacity: 0.45;
    transition: opacity 0.15s;
}

.chart-type-btn:hover img {
    opacity: 0.75;
}

.chart-type-btn.is-active {
    background: #fff;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.chart-type-btn.is-active img {
    opacity: 1;
}

.pie-chart__legend {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px 18px;
    margin-top: 12px;
    font-family: 'Lato', sans-serif;
    font-size: 13px;
    color: #333;
}

.pie-chart__legend-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.pie-chart__legend-swatch {
    width: 12px;
    height: 12px;
    border-radius: 2px;
    flex-shrink: 0;
}

.chart__toggle:hover {
    color: #333;
    background: #f0f0f0;
}

.chart__toggle-icon {
    transition: transform 0.2s;
}

.chart.collapsed .chart__toggle-icon {
    transform: rotate(-90deg);
}

.chart__subtitle {
    font-family: 'Lato', sans-serif;
    font-size: 13px;
    color: #8B93A7;
    margin: 4px 0 16px 0;
    transition: margin 0.3s ease-out, opacity 0.3s ease-out;
}

.chart.collapsed .chart__subtitle {
    margin-bottom: 0;
    opacity: 0.7;
}

.chart__body {
    position: relative;
    display: flex;
    gap: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out, opacity 0.3s ease-out, margin 0.3s ease-out, padding 0.3s ease-out;
    max-height: 2000px;
    opacity: 1;
}

.chart.collapsed .chart__body {
    max-height: 0;
    opacity: 0;
    margin: 0;
    padding: 0;
    min-height: 0;
}

.chart__footer {
    transition: opacity 0.3s ease-out, max-height 0.3s ease-out, margin 0.3s ease-out, padding 0.3s ease-out;
    overflow: hidden;
}

.chart.collapsed .chart__footer {
    opacity: 0;
    max-height: 0;
    margin: 0;
    padding: 0;
}

.chart__labels {
    width: 240px;
    flex-shrink: 0;
}

.chart__bars {
    flex: 1;
    position: relative;
    min-width: 0;
}

.gridlines {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 24px;
    pointer-events: none;
}

.gridline {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 1px;
    background: #E6EBF3;
}

.axis--bottom {
    display: flex;
    position: relative;
    height: 20px;
    margin-top: 4px;
}

.axis__label {
    position: absolute;
    font-size: 12px;
    color: #98A1B3;
    transform: translateX(-50%);
}

.group {
    margin-bottom: 3px;
}

.group__header {
    display: flex;
    align-items: center;
    margin-bottom: 6px;
    height: 32px;
}

.toggle {
    width: 20px;
    height: 20px;
    border: 1px solid #E5EAF2;
    border-radius: 4px;
    background: white;
    color: #7A8194;
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    padding: 0;
    margin: 0;
    transition: background 0.2s ease-in-out;
}

.toggle:hover {
    background: #F4F6FA;
}

.toggle:focus {
    outline: none;
}

.group__label-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-left: 6px;
    flex: 1;
    min-width: 0;
}

.group__label {
    font-family: 'Lato', sans-serif;
    font-size: 14px;
    font-weight: 600;
    color: #5B6275;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    min-width: 0;
}

.group__bar-container {
    position: relative;
    height: 32px;
    display: flex;
    align-items: center;
    margin-bottom: 6px;
}

.bar__track {
    position: absolute;
    left: 0;
    height: 16px;
    background: rgba(0, 0, 0, 0.04);
    border-radius: 9999px;
    width: 100%;
}

.bar__fill {
    position: absolute;
    left: 0;
    height: 16px;
    border-radius: 9999px;
    transition: width 0.6s ease-out;
    display: flex;
    align-items: center;
    justify-content: flex-end;
}

.bar__value {
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
    z-index: 1;
}

.bar__value--inside {
    position: relative;
    color: white;
    padding-right: 8px;
}

.bar__value--outside {
    position: absolute;
    color: #6B7280;
    padding-left: 8px;
}

 .group__panel {
     overflow: hidden;
     transition: max-height 0.3s ease-in-out, opacity 0.3s ease-in-out;
 }

 .group__panel[hidden] {
     display: block;
     max-height: 0;
     opacity: 0;
     pointer-events: none;
 }

 .group__panel:not([hidden]) {
     max-height: 2000px;
     opacity: 1;
     pointer-events: auto;
 }

 .topic {
     display: flex;
     align-items: center;
     margin-bottom: 6px;
     height: 32px;
     cursor: pointer;
     transition: background-color 0.2s ease-in-out;
     border-radius: 4px;
     padding: 2px 0;
     box-sizing: border-box;
 }

 .topic:hover {
     background-color: rgba(102, 126, 234, 0.05);
 }

 .topic:hover .topic__label {
     color: #667eea;
 }

 .topic__label-wrapper {
     display: flex;
     align-items: center;
     gap: 8px;
     padding-left: 28px;
 }

.bullet {
    width: 10px;
    height: 6px;
    border-radius: 3px;
    flex-shrink: 0;
}

.topic__label {
    font-family: 'Lato', sans-serif;
    font-size: 13px;
    font-weight: 500;
    color: #6B7280;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

 .topic__bar-container {
     position: relative;
     height: 32px;
     display: flex;
     align-items: center;
     margin-bottom: 6px;
 }

 .topic__bar-container[style*="cursor: pointer"]:hover .bar__fill {
     filter: brightness(1.1);
 }

.topic .bar__fill {
    height: 14px;
}

.topic .bar__track {
    height: 14px;
}

.group__panel .topic__bar-container {
    margin-bottom: 6px;
}

.chart__footer {
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid #E6EBF3;
    font-size: 12px;
    color: #8B93A7;
    text-align: center;
}

@media (max-width: 768px) {
    .chart__labels {
        width: 180px;
    }

    .group__label {
        font-size: 13px;
    }

    .topic__label {
        font-size: 12px;
    }

    .bar__fill, .bar__track {
        height: 14px !important;
    }

    .topic .bar__fill, .topic .bar__track {
        height: 12px !important;
    }
}

/* AI Insights Slideout Styles */
.ai-insights-tab {
    position: fixed;
    right: 0;
    top: calc(50% + 60px);
    transform: translateY(-50%);
    background: linear-gradient(135deg, #b9f040 0%, #a0d635 100%);
    color: #1a1a1a;
    padding: 16px 12px;
    border-radius: 8px 0 0 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    writing-mode: vertical-rl;
    text-orientation: mixed;
    box-shadow: -2px 2px 8px rgba(0,0,0,0.15);
    z-index: 10001;
    transition: all 0.3s ease;
    display: none; /* Hidden by default until dimension is selected */
}

/* TEMPORARILY HIDDEN: AI Insights tab hidden until further notice */
#slideoutTab {
    display: none !important;
}

.ai-insights-tab:hover {
    background: linear-gradient(135deg, #c7ff4d 0%, #b9f040 100%);
    padding-right: 16px;
}

.ai-insights-panel {
    position: fixed;
    right: -520px;
    top: 0;
    width: 500px;
    height: 100vh;
    background: oklch(1 0 0); /* White from style guide */
    box-shadow: -4px 0 20px rgba(0,0,0,0.15);
    z-index: 10000;
    transition: right 0.4s cubic-bezier(0.4, 0, 0.2, 1), width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    border-top: 3px solid #B9F040; /* Brand lime green */
}

.ai-insights-panel.open {
    right: 0;
}

.ai-insights-header {
    padding: 1.25rem 1.5rem 1rem 1.5rem; /* 20px 24px 16px 24px */
    border-bottom: 1px solid oklch(0.922 0 0); /* Border color from style guide */
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: oklch(1 0 0); /* White */
    gap: 12px;
}

.slideout-expand-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 8px;
    border-radius: 4px;
    transition: background 0.2s;
    width: 28px;
    height: 28px;
}

.slideout-expand-btn:hover {
    background: oklch(0.97 0 0);
}

.slideout-expand-btn img {
    display: block;
    width: 20px;
    height: 20px;
}

.slideout-back-button {
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    display: none;
    align-items: center;
    justify-content: center;
    color: oklch(0.556 0 0);
    border-radius: 4px;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.slideout-back-button:hover {
    background: oklch(0.97 0 0);
    color: oklch(0.145 0 0);
}

.slideout-back-button:active {
    transform: scale(0.95);
}

.insight-breadcrumb {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px;
    font-size: 0.875rem;
    font-family: 'Lato', sans-serif;
    color: oklch(0.556 0 0);
}

.insight-breadcrumb-item {
    color: oklch(0.556 0 0);
}

.insight-breadcrumb-item--clickable {
    color: oklch(0.4 0.15 240);
    cursor: pointer;
    text-decoration: none;
    transition: color 0.2s ease;
}

.insight-breadcrumb-item--clickable:hover {
    color: oklch(0.3 0.2 240);
    text-decoration: underline;
}

.insight-breadcrumb-separator {
    color: oklch(0.7 0 0);
    margin: 0 4px;
}

.chart-view-highlighted {
    background: oklch(0.95 0.1 120) !important;
    border: 2px solid #B9F040 !important;
    border-radius: 4px;
}

.chart-view-highlighted-topic {
    background: oklch(0.97 0.05 120) !important;
    border-left: 3px solid #B9F040 !important;
    padding-left: 8px !important;
}

.ai-insights-header h2,
#slideoutTitle {
    font-size: 1.5rem; /* 24px */
    font-weight: 600;
    margin: 0;
    color: oklch(0.145 0 0);
    font-family: 'Lato', sans-serif;
}

#slideoutTitle[contenteditable="true"]:focus {
    outline: none;
}

#slideoutTitle[contenteditable="true"]:empty:before {
    content: attr(data-placeholder);
    color: oklch(0.556 0 0);
}

/* Remove focus outline from Tiptap editor */
.tiptap:focus,
.ProseMirror:focus,
.ProseMirror-focused {
    outline: none !important;
    border: none !important;
}

#insightNotesEditor .tiptap:focus,
#insightNotesEditor .ProseMirror:focus,
#insightNotesEditor .ProseMirror-focused {
    outline: none !important;
    border: none !important;
}

/* Minimize empty paragraphs in editor */
#insightNotesEditor .tiptap p:empty,
#insightNotesEditor .ProseMirror p:empty {
    min-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    line-height: 1.2 !important;
}

/* Blockquote styling */
#insightNotesEditor blockquote,
.ProseMirror blockquote,
.tiptap blockquote {
    border-left: 3px solid oklch(0.556 0 0) !important;
    padding-left: 1rem !important;
    margin: 1rem 0 !important;
    font-style: italic !important;
    color: oklch(0.556 0 0) !important;
    background: oklch(0.98 0 0) !important;
    padding: 0.75rem 1rem !important;
    border-radius: 0.375rem !important;
}

#insightNotesEditor blockquote p,
.ProseMirror blockquote p,
.tiptap blockquote p {
    margin: 0 !important;
}

/* Task List (Checklist) styling */
#insightNotesEditor ul[data-type="taskList"],
.ProseMirror ul[data-type="taskList"],
.tiptap ul[data-type="taskList"] {
    list-style: none !important;
    padding-left: 0 !important;
}

#insightNotesEditor ul[data-type="taskList"] li,
.ProseMirror ul[data-type="taskList"] li,
.tiptap ul[data-type="taskList"] li {
    list-style: none !important;
    display: flex !important;
    align-items: flex-start !important;
    margin: 0.5rem 0 !important;
}

#insightNotesEditor ul[data-type="taskList"] li label,
.ProseMirror ul[data-type="taskList"] li label,
.tiptap ul[data-type="taskList"] li label {
    display: flex !important;
    align-items: center !important;
    cursor: pointer !important;
    margin-right: 0.5rem !important;
    flex-shrink: 0 !important;
}

#insightNotesEditor ul[data-type="taskList"] li label input[type="checkbox"],
.ProseMirror ul[data-type="taskList"] li label input[type="checkbox"],
.tiptap ul[data-type="taskList"] li label input[type="checkbox"] {
    margin: 0 !important;
    cursor: pointer !important;
    width: 1.125rem !important;
    height: 1.125rem !important;
}

#insightNotesEditor ul[data-type="taskList"] li > div,
.ProseMirror ul[data-type="taskList"] li > div,
.tiptap ul[data-type="taskList"] li > div {
    flex: 1 !important;
    margin: 0 !important;
}

#insightNotesEditor ul[data-type="taskList"] li > div p,
.ProseMirror ul[data-type="taskList"] li > div p,
.tiptap ul[data-type="taskList"] li > div p {
    margin: 0 !important;
    display: inline !important;
}

/* Image styling */
#insightNotesEditor img,
.ProseMirror img,
.tiptap img,
.insight-image {
    max-width: 100% !important;
    height: auto !important;
    border-radius: 0.5rem !important;
    margin: 1rem 0 !important;
    display: block !important;
    min-height: 50px !important; /* Ensure images take up space while loading */
    cursor: pointer !important; /* Indicate images are clickable */
}

/* Add error styling for broken images */
#insightNotesEditor img[src=""],
.ProseMirror img[src=""],
.tiptap img[src=""] {
    border: 2px dashed #ccc;
    background: #f5f5f5;
}

/* Image Modal Styles */
.image-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 100000; /* Higher than slideout panel */
    padding: 2rem;
    cursor: pointer;
}

.image-modal-overlay.active {
    display: flex;
}

.image-modal-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.image-modal-content img {
    max-width: 100%;
    max-height: 90vh;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 0.5rem;
    cursor: default;
}

/* Markdown styling for insight editor - matching .prompt-result-content */
#insightNotesEditor .ProseMirror,
#insightNotesEditor .tiptap {
    font-family: 'Lato', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 15px;
    line-height: 1.75;
    word-break: break-word;
    overflow-x: auto;
    color: oklch(0.145 0 0);
}

#insightNotesEditor .ProseMirror h1,
#insightNotesEditor .tiptap h1 {
    font-size: 26px;
    font-weight: 700;
    font-family: 'Lato', sans-serif;
    margin: 28px 0 18px 0;
    color: oklch(0.145 0 0);
    border-bottom: 2px solid #B9F040;
    padding-bottom: 10px;
    line-height: 1.3;
}

#insightNotesEditor .ProseMirror h1:first-child,
#insightNotesEditor .tiptap h1:first-child {
    margin-top: 0;
}

#insightNotesEditor .ProseMirror h2,
#insightNotesEditor .tiptap h2 {
    font-size: 22px;
    font-weight: 600;
    font-family: 'Lato', sans-serif;
    margin: 24px 0 14px 0;
    color: oklch(0.145 0 0);
    line-height: 1.35;
}

#insightNotesEditor .ProseMirror h3,
#insightNotesEditor .tiptap h3 {
    font-size: 18px;
    font-weight: 600;
    font-family: 'Lato', sans-serif;
    margin: 20px 0 10px 0;
    color: oklch(0.145 0 0);
    line-height: 1.4;
}

#insightNotesEditor .ProseMirror h4,
#insightNotesEditor .tiptap h4 {
    font-size: 16px;
    font-weight: 600;
    font-family: 'Lato', sans-serif;
    margin: 16px 0 8px 0;
    color: oklch(0.145 0 0);
    line-height: 1.45;
}

#insightNotesEditor .ProseMirror p,
#insightNotesEditor .tiptap p {
    margin: 14px 0;
    line-height: 1.75;
}

#insightNotesEditor .ProseMirror p:first-child,
#insightNotesEditor .tiptap p:first-child {
    margin-top: 0;
}

#insightNotesEditor .ProseMirror p:last-child,
#insightNotesEditor .tiptap p:last-child {
    margin-bottom: 0;
}

#insightNotesEditor .ProseMirror ul,
#insightNotesEditor .ProseMirror ol,
#insightNotesEditor .tiptap ul,
#insightNotesEditor .tiptap ol {
    margin: 14px 0;
    padding-left: 28px;
}

#insightNotesEditor .ProseMirror ol,
#insightNotesEditor .tiptap ol {
    list-style-type: decimal;
}

#insightNotesEditor .ProseMirror ol li,
#insightNotesEditor .tiptap ol li {
    list-style-position: outside;
}

#insightNotesEditor .ProseMirror li,
#insightNotesEditor .tiptap li {
    margin: 8px 0;
    line-height: 1.7;
}

#insightNotesEditor .ProseMirror li::marker,
#insightNotesEditor .tiptap li::marker {
    color: #B9F040;
}

#insightNotesEditor .ProseMirror strong,
#insightNotesEditor .tiptap strong {
    font-weight: 700;
    color: oklch(0.145 0 0);
    font-family: 'Lato', sans-serif;
}

#insightNotesEditor .ProseMirror em,
#insightNotesEditor .tiptap em {
    font-style: italic;
    color: oklch(0.145 0 0);
}

#insightNotesEditor .ProseMirror a,
#insightNotesEditor .tiptap a {
    color: #B9F040;
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-color 0.2s, color 0.2s;
}

#insightNotesEditor .ProseMirror a:hover,
#insightNotesEditor .tiptap a:hover {
    border-bottom-color: #B9F040;
    color: oklch(0.2 0 0);
}

#insightNotesEditor .ProseMirror code,
#insightNotesEditor .tiptap code {
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Courier New', monospace;
    font-size: 13px;
    background: rgba(185, 240, 64, 0.12);
    padding: 3px 7px;
    border-radius: 5px;
    color: oklch(0.145 0 0);
    border: 1px solid rgba(185, 240, 64, 0.2);
}

#insightNotesEditor .ProseMirror pre,
#insightNotesEditor .tiptap pre {
    background: oklch(0.145 0 0);
    color: oklch(0.98 0 0);
    padding: 16px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 16px 0;
    border: 1px solid oklch(0.922 0 0);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

#insightNotesEditor .ProseMirror pre code,
#insightNotesEditor .tiptap pre code {
    background: transparent;
    padding: 0;
    color: oklch(0.98 0 0);
    font-size: 13px;
    border: none;
}

#insightNotesEditor .ProseMirror hr,
#insightNotesEditor .tiptap hr {
    border: none;
    border-top: 2px solid oklch(0.922 0 0);
    margin: 24px 0;
}

#insightNotesEditor .ProseMirror table,
#insightNotesEditor .tiptap table {
    width: 100%;
    border-collapse: collapse;
    margin: 18px 0;
    font-size: 14px;
    background: oklch(0.98 0 0);
    border: 1px solid oklch(0.922 0 0);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

#insightNotesEditor .ProseMirror thead,
#insightNotesEditor .tiptap thead {
    background: rgba(185, 240, 64, 0.1);
}

#insightNotesEditor .ProseMirror th,
#insightNotesEditor .tiptap th {
    padding: 14px 18px;
    text-align: left;
    font-weight: 700;
    font-family: 'Lato', sans-serif;
    color: oklch(0.145 0 0);
    border-bottom: 2px solid #B9F040;
}

#insightNotesEditor .ProseMirror td,
#insightNotesEditor .tiptap td {
    padding: 12px 18px;
    border-bottom: 1px solid oklch(0.922 0 0);
    color: oklch(0.145 0 0);
}

#insightNotesEditor .ProseMirror tbody tr:last-child td,
#insightNotesEditor .tiptap tbody tr:last-child td {
    border-bottom: none;
}

#insightNotesEditor .ProseMirror tbody tr:hover,
#insightNotesEditor .tiptap tbody tr:hover {
    background: rgba(185, 240, 64, 0.05);
}

.image-modal-close {
    position: fixed;
    top: 1rem;
    right: 1rem;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    font-size: 2rem;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    transition: background 0.2s;
    z-index: 100001; /* Above the modal overlay */
}

.image-modal-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Video styling */
#insightNotesEditor video,
.ProseMirror video,
.tiptap video,
.video-embed {
    max-width: 100% !important;
    height: auto !important;
    border-radius: 0.5rem !important;
    margin: 1rem 0 !important;
    display: block !important;
}

/* Iframe styling (for Loom and other embeds) */
#insightNotesEditor .embed-iframe,
.ProseMirror .embed-iframe,
.tiptap .embed-iframe,
#insightNotesEditor iframe,
.ProseMirror iframe,
.tiptap iframe {
    width: 100% !important;
    border-radius: 0.5rem !important;
    aspect-ratio: 16/9 !important;
    margin: 1rem 0 !important;
    display: block !important;
    border: none !important;
}

/* Editor Context Menu */
.editor-context-menu {
    position: fixed; /* Use fixed positioning for viewport coordinates */
    background: oklch(1 0 0); /* White */
    border: 1px solid oklch(0.922 0 0); /* Border color from style guide */
    border-radius: 0.5rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    padding: 0.25rem;
    z-index: 10010; /* Higher than slideout panel (which is typically 10000) */
    min-width: 140px;
    font-family: 'Lato', sans-serif;
}

.context-menu-item {
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    color: oklch(0.145 0 0); /* Near black */
    cursor: pointer;
    border-radius: 0.375rem;
    transition: background 0.2s ease;
}

.context-menu-item:hover {
    background: oklch(0.97 0 0); /* Light grey */
}

.context-menu-item.active {
    background: oklch(0.97 0 0);
    color: oklch(0.145 0 0);
    font-weight: 600;
}

.context-menu-divider {
    height: 1px;
    background: oklch(0.922 0 0);
    margin: 0.25rem 0;
}

.context-menu-item-with-submenu {
    position: relative;
}

.context-menu-item-chevron {
    font-size: 0.75rem;
    color: oklch(0.556 0 0); /* Muted color */
    transition: color 0.2s ease;
    flex-shrink: 0;
    margin-left: auto;
    line-height: 1;
}

.context-menu-item-with-submenu:hover .context-menu-item-chevron {
    color: oklch(0.145 0 0);
}

.context-menu-submenu {
    position: absolute;
    left: 100%;
    top: 0;
    margin-left: -4px; /* Negative margin to create overlap, eliminating gap */
    background: oklch(1 0 0); /* White */
    border: 1px solid oklch(0.922 0 0); /* Border color from style guide */
    border-radius: 0.5rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    min-width: 220px;
    max-width: 320px;
    max-height: 400px;
    overflow-y: auto;
    z-index: 10003;
    padding: 0.25rem;
    display: none;
}

.context-menu-item-with-submenu:hover .context-menu-submenu,
.context-menu-submenu:hover {
    display: block !important;
}

.context-menu-submenu-item {
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    color: oklch(0.145 0 0);
    cursor: pointer;
    border-radius: 0.375rem;
    transition: background 0.2s ease;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.context-menu-submenu-item:hover {
    background: oklch(0.97 0 0);
}

.context-menu-submenu-item.loading {
    color: oklch(0.556 0 0);
    font-style: italic;
    cursor: default;
}

/* TipTap Editor Highlight Styling - Brand Green (lighter) */
.highlight-brand,
mark.highlight-brand {
    background-color: #D5F886; /* Lighter brand green (#B9F040 lightened) */
    border-radius: 0.125rem;
    padding: 0.0625rem 0.125rem;
    box-decoration-break: clone;
    -webkit-box-decoration-break: clone;
}

.ai-close-btn {
    background: none;
    border: none;
    color: oklch(0.556 0 0); /* Muted foreground */
    font-size: 1.75rem; /* 28px */
    line-height: 1;
    cursor: pointer;
    padding: 0;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.375rem; /* 6px - radius-sm */
    transition: all 0.2s ease;
    font-family: 'Lato', sans-serif;
}

.ai-close-btn:hover {
    background: oklch(0.97 0 0); /* Light gray */
    color: oklch(0.145 0 0); /* Near black */
}

.ai-close-btn:focus-visible {
    outline: 2px solid #B9F040;
    outline-offset: 2px;
}

/* Insight Attributes Styling - Matching Style Guide */
.insight-attribute-row {
    display: flex;
    align-items: center;
    gap: 0.5rem; /* 8px spacing between label and content */
    min-height: 32px;
    padding: 0.25rem 0; /* 4px */
}

.insight-attribute-chip {
    background: oklch(0.97 0 0); /* Light gray from style guide */
    border-radius: 0.375rem; /* 6px - radius-sm */
    padding: 0.375rem 0.75rem; /* 6px 12px */
    font-size: 0.875rem; /* 14px */
    font-family: 'Lato', sans-serif;
    font-weight: 400;
    color: oklch(0.145 0 0); /* Near black foreground */
    cursor: text;
    outline: none;
    border: 2px solid transparent;
    transition: all 0.2s ease;
}

.insight-attribute-chip:hover {
    background: oklch(0.95 0 0); /* Slightly darker gray */
}

.insight-attribute-chip:focus {
    background: oklch(1 0 0); /* White */
    border-color: #B9F040; /* Brand lime green */
    outline: none;
}

.insight-attribute-chip[contenteditable="true"]:empty:before {
    content: attr(data-placeholder);
    color: oklch(0.556 0 0); /* Muted foreground */
}

/* Editable Title Focus Styles */
#insightTitleEditable:focus {
    outline: 2px solid #B9F040;
    outline-offset: 2px;
    border-radius: 0.375rem; /* 6px */
}


.insights-panel-header-search {
    position: relative;
    flex: 1;
    min-width: 0;
    display: flex;
    justify-content: center;
}

.insights-panel-header-search .search-box {
    position: relative;
    min-width: 200px;
    max-width: 400px;
    width: 100%;
    background: white;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 8px 36px 8px 12px;
}

#insightsSearchInput {
    color: #333 !important;
    transition: border-color 0.2s, box-shadow 0.2s;
    border: none;
    background: transparent;
    outline: none;
    font-size: 14px;
    width: 100%;
    padding: 0;
}

#insightsSearchInput::placeholder {
    color: rgba(55, 53, 47, 0.4);
}

.insights-panel-header-search .search-box:focus-within {
    border-color: #B9F040 !important;
    box-shadow: 0 0 0 3px rgba(185, 240, 64, 0.1) !important;
}

#insightsSearchInput:focus {
    outline: none;
}

#insightsSearchClear {
    transition: all 0.2s;
}

#insightsSearchClear:hover {
    background: #f5f5f5;
    color: #333;
}

.ai-insights-content {
    flex: 1;
    min-height: 0; /* Required for flex child with overflow to scroll properly */
    overflow-y: auto;
    padding: 24px;
}

.ai-insights-content.transitioning {
    opacity: 0;
    transition: opacity 0.2s ease;
}

#slideoutTitle.transitioning,
#slideoutSubtitle.transitioning,
#slideoutSettingsBtn.transitioning {
    opacity: 0;
}

#slideoutTitle,
#slideoutSubtitle,
#slideoutSettingsBtn {
    transition: opacity 0.2s ease;
}

.ai-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
}

.ai-loading-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid #e4e6eb;
    border-top-color: #b9f040;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 16px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.ai-summary-section {
    margin-bottom: 32px;
}

.ai-summary-section h3 {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.ai-summary-text {
    line-height: 1.6;
    color: #555;
    margin-bottom: 12px;
}

.ai-insights-list {
    list-style: none;
    padding: 0;
}

.ai-insights-list li {
    padding: 12px;
    margin-bottom: 8px;
    background: #f8f9fa;
    border-left: 3px solid #b9f040;
    border-radius: 4px;
    color: #333;
    line-height: 1.5;
}

.ai-category-item {
    padding: 12px;
    margin-bottom: 8px;
    background: #fff;
    border: 1px solid #e4e6eb;
    border-radius: 6px;
}

.ai-category-name {
    font-weight: 600;
    color: #85c024;
    margin-bottom: 4px;
}

.ai-patterns-box {
    padding: 16px;
    background: linear-gradient(135deg, rgba(185,240,64,0.1) 0%, rgba(160,214,53,0.1) 100%);
    border-radius: 8px;
    border: 1px solid rgba(185,240,64,0.3);
    color: #333;
    line-height: 1.6;
}

.ai-metadata {
    margin-top: 32px;
    padding-top: 16px;
    border-top: 1px solid #e4e6eb;
    font-size: 12px;
    color: #999;
}

.ai-status-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    margin-bottom: 8px;
}

.ai-status-cached {
    background: #d1fae5;
    color: #065f46;
}

.ai-status-generated {
    background: #dbeafe;
    color: #1e40af;
}

.ai-regenerate-btn {
    margin-top: 16px;
    padding: 10px 20px;
    background: white;
    border: 2px solid #b9f040;
    color: #85c024;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
    font-size: 14px;
}

.ai-regenerate-btn:hover {
    background: #b9f040;
    color: #1a1a1a;
}

.ai-insights-overlay {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 500px; /* Only cover the slideout panel width */
    background: transparent; /* No gradient/backdrop - removed for cleaner UI */
    z-index: 9999;
    opacity: 0;
    pointer-events: none;
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    /* Removed opacity transition and background to prevent fade-in effect */
}

.ai-insights-overlay.visible {
    opacity: 1;
    pointer-events: all;
}

/* Insights Page Styles */
.page-header {
    padding: 16px 35px;
    border-bottom: 1px solid rgba(55, 53, 47, 0.09);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: white;
}

.page-header h1 {
    font-size: 20px;
    font-weight: 600;
    color: #37352f;
}

.btn-new {
    background: rgba(55, 53, 47, 0.08);
    color: #37352f;
    border: none;
    padding: 6px 12px;
    border-radius: 3px;
    font-weight: 500;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.2s;
}

.btn-new:hover {
    background: rgba(55, 53, 47, 0.12);
}

.control-bar {
    position: relative;
    padding: 8px 35px;
    border-bottom: 1px solid rgba(55, 53, 47, 0.09);
    background: white;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    min-height: 40px;
}

.search-box {
    display: flex;
    align-items: center;
    background: rgba(55, 53, 47, 0.06);
    border-radius: 3px;
    padding: 4px 8px;
    min-width: 200px;
    flex: 0 0 auto;
}

.search-box input {
    border: none;
    background: transparent;
    outline: none;
    font-size: 14px;
    padding: 2px 4px;
    flex: 1;
    color: #37352f;
}

.search-box input::placeholder {
    color: rgba(55, 53, 47, 0.4);
}

#insights-section .search-box {
    position: relative;
    align-items: center;
    background: white;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 8px 36px 8px 12px;
    min-width: 200px;
    max-width: 360px;
    width: 260px;
    flex: 0 0 auto;
}

#insights-section .search-box input {
    border: none;
    background: transparent;
    outline: none;
    font-size: 14px;
    padding: 0;
    width: 100%;
}

#insights-section .search-box input::placeholder {
    color: rgba(55, 53, 47, 0.4);
}

#insights-section .search-box:focus-within {
    border-color: #B9F040 !important;
    box-shadow: 0 0 0 3px rgba(185, 240, 64, 0.1) !important;
}

.filter-chips {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    flex: 1;
}

.filter-chip {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    background: rgba(55, 53, 47, 0.06);
    border-radius: 3px;
    font-size: 13px;
    color: #37352f;
}

.filter-chip .remove {
    cursor: pointer;
    opacity: 0.6;
    padding: 0 2px;
}

.filter-chip .remove:hover {
    opacity: 1;
}

.btn-filter {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    background: transparent;
    border: none;
    color: rgba(55, 53, 47, 0.6);
    cursor: pointer;
    font-size: 13px;
    border-radius: 3px;
}

.btn-filter:hover {
    background: rgba(55, 53, 47, 0.06);
    color: #37352f;
}

.btn-reset {
    padding: 4px 8px;
    background: transparent;
    border: none;
    color: rgba(55, 53, 47, 0.6);
    cursor: pointer;
    font-size: 13px;
    border-radius: 3px;
}

.btn-reset:hover {
    background: rgba(55, 53, 47, 0.06);
    color: #37352f;
}

.table-container {
    overflow-x: auto;
    background: white;
}

.notion-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 1200px;
}

.notion-table thead {
    background: rgba(55, 53, 47, 0.03);
    border-bottom: 1px solid rgba(55, 53, 47, 0.09);
}

.notion-table th {
    padding: 8px 12px;
    text-align: left;
    font-weight: 500;
    font-size: 13px;
    color: rgba(55, 53, 47, 0.6);
    white-space: nowrap;
    cursor: pointer;
    user-select: none;
    position: relative;
    border-right: 1px solid rgba(55, 53, 47, 0.09);
    border-bottom: 1px solid rgba(55, 53, 47, 0.09);
}

.notion-table th .resize-handle {
    position: absolute;
    top: 0;
    right: 0;
    width: 4px;
    height: 100%;
    cursor: col-resize;
    background: transparent;
    z-index: 10;
}

.notion-table th .resize-handle:hover {
    background: rgba(11, 133, 255, 0.3);
}

.notion-table th.resizing {
    user-select: none;
}

.notion-table th.resizing .resize-handle {
    background: rgba(11, 133, 255, 0.5);
}

.notion-table th.draggable {
    cursor: grab;
}

.notion-table th.draggable:active {
    cursor: grabbing;
}

.notion-table th.dragging {
    opacity: 0.5;
    background: rgba(185, 240, 64, 0.1);
}

.notion-table th.drag-over {
    border-left: 3px solid #B9F040;
    background: rgba(185, 240, 64, 0.05);
}

.notion-table th .drag-handle {
    display: inline-block;
    margin-right: 6px;
    opacity: 0;
    transition: opacity 0.2s;
    cursor: grab;
    vertical-align: middle;
    font-size: 14px;
    line-height: 1;
    color: rgba(55, 53, 47, 0.4);
    user-select: none;
}

.notion-table th:hover .drag-handle {
    opacity: 0.4;
}

.notion-table th.draggable:hover .drag-handle {
    opacity: 0.6;
}

.notion-table th.draggable:active .drag-handle {
    opacity: 0.8;
}

.notion-table th:hover {
    background: rgba(55, 53, 47, 0.06);
}

.notion-table th .sort-indicator {
    margin-left: 4px;
    opacity: 0.4;
}

.notion-table th.sorted .sort-indicator {
    opacity: 1;
}

.notion-table th .column-icon {
    margin-right: 6px;
    opacity: 0.4;
}

.notion-table tbody tr {
    transition: background 0.1s;
}

.notion-table tbody tr:hover {
    background: rgba(55, 53, 47, 0.03);
}

.notion-table tbody tr:hover .insight-open-btn-table {
    display: flex !important;
}

.insight-open-btn-table {
    display: none;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(4px);
    border: 1px solid rgba(55, 53, 47, 0.1);
    border-radius: 3px;
    color: rgba(55, 53, 47, 0.6);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.insight-open-btn-table:hover {
    background: rgba(55, 53, 47, 0.12);
    color: #37352f;
}

.notion-table td {
    padding: 8px 12px;
    font-size: 14px;
    vertical-align: middle;
    border-right: 1px solid rgba(55, 53, 47, 0.09);
    border-bottom: 1px solid rgba(55, 53, 47, 0.09);
}

.notion-table .checkbox-cell {
    width: 32px;
    padding: 8px;
    text-align: center;
}

.notion-table .checkbox {
    width: 16px;
    height: 16px;
    border: 1.5px solid rgba(55, 53, 47, 0.3);
    border-radius: 3px;
    cursor: pointer;
    display: inline-block;
    transition: all 0.1s;
}

.notion-table .checkbox:hover {
    border-color: rgba(55, 53, 47, 0.5);
}

.notion-table .name-cell {
    min-width: 250px;
    font-weight: 500;
    padding-left: 35px;
}

.notion-table th.name-cell {
    padding-left: 35px;
}

.notion-table .name-cell .name-content {
    display: flex;
    align-items: center;
    gap: 6px;
    position: relative;
    /* No padding-right - OPEN button overlays on hover */
}

.notion-table .name-cell .doc-icon {
    width: 16px;
    height: 16px;
    opacity: 0.4;
    flex-shrink: 0;
}

.tag {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 13px;
    font-weight: 400;
    margin-right: 4px;
    margin-bottom: 2px;
}

.tag-type {
    background: rgba(46, 170, 220, 0.15);
    color: #2eaadc;
}

.tag-project {
    background: rgba(255, 171, 0, 0.15);
    color: #ffab00;
}

.tag-data-source {
    background: rgba(99, 71, 169, 0.15);
    color: #6347a9;
}

.insight-origin-pill {
    transition: all 0.2s ease;
}

.insight-origin-pill:hover {
    opacity: 0.8;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.insight-origin-pill.tag-project:hover {
    background: rgba(255, 171, 0, 0.25);
}

.insight-origin-pill.tag-data-source:hover {
    background: rgba(99, 71, 169, 0.25);
}

.tag-category {
    background: rgba(111, 212, 161, 0.15);
    color: #6fd4a1;
}

.tag-topic {
    background: rgba(116, 199, 232, 0.15);
    color: #74c7e8;
}

.insight-origin-pill.tag-category:hover {
    background: rgba(111, 212, 161, 0.25);
}

.insight-origin-pill.tag-topic:hover {
    background: rgba(116, 199, 232, 0.25);
}

.insight-origin-pill:hover:not(.tag-project):not(.tag-data-source):not(.tag-category):not(.tag-topic) {
    background: rgba(0, 0, 0, 0.05);
}

.status {
    display: flex;
    align-items: center;
    gap: 6px;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.status-dot.not-started {
    background: #d1d1d1;
}

.status-dot.in-progress {
    background: #0b85ff;
}

.status-dot.done {
    background: #0f7b0f;
}

.actions-cell {
    width: 80px;
}

.checkbox-cell {
    width: 40px;
    text-align: center;
    padding: 0.5rem;
}

.checkbox-cell input[type="checkbox"] {
    cursor: pointer;
    width: 16px;
    height: 16px;
}

.notion-table tbody tr:hover .checkbox-cell {
    background: rgba(55, 53, 47, 0.03);
}

.action-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px 8px;
    color: rgba(55, 53, 47, 0.4);
    font-size: 14px;
    border-radius: 3px;
    transition: all 0.1s;
}

.action-btn:hover {
    background: rgba(55, 53, 47, 0.06);
    color: #37352f;
}

.empty-state {
    padding: 60px 24px;
    text-align: center;
    color: rgba(55, 53, 47, 0.4);
}

.empty-state h3 {
    font-size: 16px;
    margin-bottom: 8px;
    color: rgba(55, 53, 47, 0.6);
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex !important;
}

.modal-content {
    background: white;
    border-radius: 3px;
    padding: 32px;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: rgba(15, 15, 15, 0.05) 0px 0px 0px 1px, rgba(15, 15, 15, 0.1) 0px 3px 6px, rgba(15, 15, 15, 0.2) 0px 9px 24px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.modal-header h2 {
    font-size: 20px;
    font-weight: 600;
    color: #37352f;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: #37352f;
    margin-bottom: 6px;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid rgba(55, 53, 47, 0.16);
    border-radius: 3px;
    font-size: 14px;
    font-family: inherit;
    color: #37352f;
    background: white;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: rgba(55, 53, 47, 0.3);
}

.form-group textarea {
    min-height: 100px;
    resize: vertical;
}

.form-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 24px;
}

.btn-secondary {
    background: rgba(55, 53, 47, 0.08);
    color: #37352f;
    border: none;
    padding: 8px 16px;
    border-radius: 3px;
    font-weight: 500;
    cursor: pointer;
    font-size: 14px;
}

.btn-secondary:hover {
    background: rgba(55, 53, 47, 0.12);
}

.btn-save {
    background: #37352f;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 3px;
    font-weight: 500;
    cursor: pointer;
    font-size: 14px;
}

.btn-save:hover {
    background: #2e2a24;
}

.close-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    color: rgba(55, 53, 47, 0.4);
    font-size: 20px;
    line-height: 1;
}

.close-btn:hover {
    color: #37352f;
}

.ai-insights-panel {
    position: fixed;
    right: -520px;
    top: 0;
    width: 500px;
    height: 100vh;
    background: oklch(1 0 0);
    box-shadow: -4px 0 20px rgba(0,0,0,0.15);
    z-index: 10000;
    transition: right 0.4s cubic-bezier(0.4, 0, 0.2, 1), width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    border-top: 3px solid #B9F040;
}

.ai-insights-panel.open {
    right: 0;
}

.ai-insights-panel.expanded {
    width: 50vw;
    right: -50vw;
}

.ai-insights-panel.expanded.open {
    right: 0;
}

.ai-insights-header {
    padding: 1.25rem 1.5rem 1rem 1.5rem;
    border-bottom: 1px solid oklch(0.922 0 0);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: oklch(1 0 0);
    gap: 10px;
}

.slideout-header-search-container {
    flex: 1;
    min-width: 0;
    justify-content: flex-start;
}

.slideout-header-search-input-wrapper {
    position: relative;
    width: 100%;
    max-width: 320px;
}

.slideout-header-search-input {
    width: 100%;
    padding: 10px 38px 10px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    font-family: 'Lato', sans-serif;
}

.slideout-header-search-input:focus {
    outline: none;
    border-color: #B9F040;
    box-shadow: 0 0 0 3px rgba(185, 240, 64, 0.12);
}

.slideout-header-search-clear {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: #999;
    font-size: 18px;
    line-height: 1;
    width: 24px;
    height: 24px;
    display: none;
    align-items: center;
    justify-content: center;
    border-radius: 3px;
}

.slideout-header-search-clear:hover {
    background: #f0f0f0;
    color: #667eea;
}

.ai-insights-panel.slideout-search-mode #slideoutTitleContainer {
    display: none;
}

.ai-close-btn {
    background: none;
    border: none;
    font-size: 1.75rem;
    color: oklch(0.556 0 0);
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    line-height: 1;
    border-radius: 0.375rem;
    transition: all 0.2s ease;
    font-family: 'Lato', sans-serif;
}

.ai-close-btn:hover {
    background: oklch(0.97 0 0);
    color: oklch(0.145 0 0);
}

.ai-close-btn:focus-visible {
    outline: 2px solid #B9F040;
    outline-offset: 2px;
}

.ai-insights-content {
    flex: 1;
    min-height: 0; /* Required for flex child with overflow to scroll properly */
    overflow-y: auto;
    padding: 0 10px;
    transition: opacity 0.2s ease;
}

.ai-insights-content.transitioning {
    opacity: 0;
}

#slideoutTitle.transitioning,
#slideoutSubtitle.transitioning,
#slideoutSettingsBtn.transitioning {
    opacity: 0;
}

#slideoutTitle,
#slideoutSubtitle,
#slideoutSettingsBtn {
    transition: opacity 0.2s ease;
}

.insight-attribute-row {
    display: flex;
    align-items: center;
    gap: 0.5rem; /* 8px spacing between label and content */
    min-height: 32px;
    padding: 0.25rem 0;
}

.insight-attribute-chip {
    background: oklch(0.97 0 0);
    border-radius: 0.375rem;
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
    font-family: 'Lato', sans-serif;
    font-weight: 400;
    color: oklch(0.145 0 0);
    cursor: text;
    outline: none;
    border: 2px solid transparent;
    transition: all 0.2s ease;
}

.insight-attribute-chip:hover {
    background: oklch(0.95 0 0);
}

.insight-attribute-chip:focus {
    background: oklch(1 0 0);
    border-color: #B9F040;
    outline: none;
}

.insight-attribute-chip[contenteditable="true"]:empty:before {
    content: attr(data-placeholder);
    color: oklch(0.556 0 0);
}

#insightTitleEditable:focus {
    outline: 2px solid #B9F040;
    outline-offset: 2px;
    border-radius: 0.375rem;
}

.ai-error {
    padding: 24px;
    text-align: center;
}

.ai-error h3 {
    color: #dc2626;
    margin-bottom: 12px;
}

.ai-error button {
    margin-top: 16px;
    padding: 10px 20px;
    background: #b9f040;
    color: #1a1a1a;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
}

@media (max-width: 768px) {
    .ai-insights-panel {
        width: 100%;
        right: -100%;
    }
    
    .ai-insights-tab {
        padding: 12px 10px;
        font-size: 12px;
    }
}

/* Add Data Button (moved from inline) */
#addDataBtn:hover {
    background: #a0d636;
}
#addDataBtn:focus-visible {
    outline: 2px solid #B9F040;
    outline-offset: 2px;
}

/* Verbatim Search (moved from inline) */
#verbatimSearch::placeholder {
    color: rgba(255, 255, 255, 0.6);
}
#verbatimSearch:focus {
    outline: none;
    border-color: #B9F040;
    background: rgba(255, 255, 255, 0.15);
}
#verbatimSearchClear:hover {
    color: #B9F040;
}

/* ============================================
   Settings Page Styles
   ============================================ */

.settings-container {
    padding: 24px;
    max-width: 800px;
    margin: 0 auto;
}

.settings-form {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.settings-card {
    background: #ffffff;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    border: 1px solid #e2e8f0;
}

.settings-card-title {
    font-size: 18px;
    font-weight: 600;
    color: #1a202c;
    margin: 0 0 8px 0;
}

.settings-card-description {
    font-size: 14px;
    color: #718096;
    margin: 0 0 20px 0;
    line-height: 1.5;
}

.settings-field {
    margin-bottom: 16px;
}

.settings-field:last-child {
    margin-bottom: 0;
}

.settings-field label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: #374151;
    margin-bottom: 6px;
}

.settings-field input[type="text"],
.settings-field input[type="url"],
.settings-field textarea {
    width: 100%;
    padding: 10px 12px;
    font-size: 14px;
    font-family: 'Lato', sans-serif;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    background: #ffffff;
    color: #1a202c;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.settings-field input[type="text"]:focus,
.settings-field input[type="url"]:focus,
.settings-field textarea:focus {
    outline: none;
    border-color: #B9F040;
    box-shadow: 0 0 0 3px rgba(185, 240, 64, 0.15);
}

.settings-field input::placeholder,
.settings-field textarea::placeholder {
    color: #9ca3af;
}

.settings-field textarea {
    resize: vertical;
    min-height: 100px;
    line-height: 1.5;
}

#settingsBusinessSummary,
#settingsToneOfVoice {
    min-height: 250px;
}

/* API Access */
.api-credential-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

.api-credential-input {
    flex: 1;
    padding: 10px 12px;
    font-size: 14px;
    font-family: 'SF Mono', 'Fira Code', 'Fira Mono', monospace;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    background: #f9fafb;
    color: #1a202c;
}

.api-credential-input--key {
    background: #fffbeb;
    border-color: #f59e0b;
}

.api-copy-btn {
    padding: 8px 10px;
    background: #f3f4f6;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
    flex-shrink: 0;
}

.api-copy-btn:hover {
    background: #e5e7eb;
}

.api-keys-list {
    margin-bottom: 12px;
}

.api-keys-empty,
.api-keys-loading {
    font-size: 14px;
    color: #718096;
    margin: 0;
    padding: 8px 0;
}

.api-key-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    margin-bottom: 8px;
    background: #f9fafb;
}

.api-key-info {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0;
}

.api-key-prefix {
    font-family: 'SF Mono', 'Fira Code', 'Fira Mono', monospace;
    font-size: 13px;
    color: #374151;
    background: #e5e7eb;
    padding: 2px 8px;
    border-radius: 4px;
    flex-shrink: 0;
}

.api-key-name {
    font-size: 14px;
    color: #374151;
    font-weight: 500;
}

.api-key-meta {
    font-size: 12px;
    color: #9ca3af;
}

.api-key-revoke-btn {
    padding: 4px 12px;
    font-size: 13px;
    color: #dc2626;
    background: none;
    border: 1px solid #fecaca;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s;
    flex-shrink: 0;
}

.api-key-revoke-btn:hover {
    background: #fef2f2;
}

.api-generate-btn {
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 500;
    color: #1a202c;
    background: #B9F040;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
}

.api-generate-btn:hover {
    background: #a8d938;
}

.api-generate-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.api-key-reveal {
    margin-bottom: 12px;
    padding: 12px;
    background: #fffbeb;
    border: 1px solid #f59e0b;
    border-radius: 8px;
}

.api-key-reveal-warning {
    font-size: 13px;
    font-weight: 500;
    color: #92400e;
    margin: 0 0 8px 0;
}

/* Product Context */
.product-context-empty {
    padding: 24px 0;
}
.product-context-select-row {
    margin-bottom: 16px;
}
.product-context-select-row label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: #374151;
    margin-bottom: 6px;
}
.product-context-select {
    width: 100%;
    max-width: 400px;
    padding: 10px 12px;
    font-size: 14px;
    font-family: 'Lato', sans-serif;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    background: #ffffff;
    color: #1a202c;
}
.product-context-select:focus {
    outline: none;
    border-color: #B9F040;
}
.product-context-single-name {
    font-size: 14px;
    font-weight: 500;
    color: #374151;
}
.product-context-source-url {
    font-size: 13px;
    color: #718096;
    margin: 8px 0 16px 0;
}
.product-context-source-url a {
    color: #4a90d9;
    text-decoration: none;
}
.product-context-source-url a:hover {
    text-decoration: underline;
}
.product-context-actions {
    display: flex;
    gap: 12px;
    margin-top: 16px;
}
.settings-delete-btn {
    padding: 8px 16px;
    font-size: 14px;
    color: #dc2626;
    background: transparent;
    border: 1px solid #dc2626;
    border-radius: 8px;
    cursor: pointer;
}
.settings-delete-btn:hover {
    background: #fef2f2;
}
.settings-secondary-btn {
    padding: 8px 16px;
    font-size: 14px;
    color: #374151;
    background: transparent;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    cursor: pointer;
}
.settings-secondary-btn:hover {
    background: #f9fafb;
}
.product-context-add-form .settings-field {
    margin-bottom: 16px;
}
.product-context-add-form #productContextAddText {
    min-height: 200px;
    display: block;
}
.product-context-url-form .settings-field {
    margin-bottom: 0;
}
.product-context-add-actions {
    display: flex;
    gap: 12px;
    margin-top: 16px;
}
.settings-cancel-btn {
    padding: 8px 16px;
    font-size: 14px;
    color: #6b7280;
    background: transparent;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    cursor: pointer;
}
.settings-cancel-btn:hover {
    background: #f9fafb;
}
.product-context-loading,
.product-context-error {
    padding: 24px 0;
    color: #718096;
    font-size: 14px;
}
.product-context-error {
    color: #dc2626;
}

/* Logo Preview */
.settings-logo-preview {
    width: 200px;
    height: 80px;
    border: 2px dashed #d1d5db;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
    background: #f9fafb;
    overflow: hidden;
}

.settings-logo-preview img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.settings-logo-placeholder {
    font-size: 14px;
    color: #9ca3af;
}

/* Color Input */
.settings-color-input {
    display: flex;
    gap: 12px;
    align-items: center;
}

.settings-color-input input[type="color"] {
    width: 48px;
    height: 40px;
    padding: 2px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    cursor: pointer;
    background: #ffffff;
}

.settings-color-input input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 2px;
}

.settings-color-input input[type="color"]::-webkit-color-swatch {
    border-radius: 4px;
    border: none;
}

.settings-color-input input[type="text"] {
    flex: 1;
    max-width: 120px;
}

/* Save Actions */
.settings-actions {
    display: flex;
    align-items: center;
    gap: 16px;
    padding-top: 8px;
}

.settings-save-btn {
    padding: 12px 32px;
    font-size: 14px;
    font-weight: 600;
    font-family: 'Lato', sans-serif;
    background: #B9F040;
    color: #000000;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.settings-save-btn:hover {
    background: #a0d636;
}

.settings-save-btn:active {
    transform: scale(0.98);
}

.settings-save-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.settings-save-status {
    font-size: 14px;
    color: #059669;
    opacity: 0;
    transition: opacity 0.3s;
}

.settings-save-status.visible {
    opacity: 1;
}

.settings-save-status.error {
    color: #dc2626;
}

/* AI Spinner Animation */
.settings-ai-btn-spinner {
    animation: settings-spinner-rotate 1s linear infinite;
}

@keyframes settings-spinner-rotate {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* Settings Field Header with Edit Button */
.settings-field-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.settings-field-header label {
    margin-bottom: 0;
}

.settings-edit-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    background: transparent;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    color: #718096;
    cursor: pointer;
    transition: all 0.2s ease;
}

.settings-edit-btn:hover {
    background: #f7fafc;
    border-color: #cbd5e0;
    color: #4a5568;
}

.settings-edit-btn.active {
    background: #667eea;
    border-color: #667eea;
    color: #ffffff;
}

/* AI Generate Button Variant */
.settings-edit-btn--ai img {
    opacity: 0.55;
}

.settings-edit-btn--ai:hover img {
    opacity: 0.7;
}

.settings-edit-btn--ai:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.settings-edit-btn--ai .settings-ai-btn-spinner {
    animation: settings-spinner-rotate 1s linear infinite;
}

/* Copy Button */
.settings-copy-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    background: transparent;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.settings-copy-btn img {
    opacity: 0.45;
    transition: opacity 0.2s ease;
}

.settings-copy-btn:hover {
    background: #f7fafc;
    border-color: #cbd5e0;
}

.settings-copy-btn:hover img {
    opacity: 0.7;
}

.settings-copy-btn.copied {
    background: #f0fff4;
    border-color: #9ae6b4;
}

.settings-copy-btn.copied img {
    opacity: 0.8;
}

/* Field Actions Container */
.settings-field-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Rendered View Container */
.settings-rendered-view {
    padding: 16px 20px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 14px;
    line-height: 1.6;
    color: #2d3748;
    max-height: 500px;
    overflow-y: auto;
}

.settings-rendered-view:empty {
    display: none;
}

.settings-rendered-view.empty-state {
    display: block;
    color: #a0aec0;
    font-style: italic;
    padding: 24px;
    text-align: center;
}

/* Rendered Markdown Styles */
.settings-rendered-view h1 {
    font-size: 1.5em;
    font-weight: 700;
    color: #1a202c;
    margin: 0 0 16px 0;
    padding-bottom: 8px;
    border-bottom: 2px solid #B9F040;
}

.settings-rendered-view h2 {
    font-size: 1.25em;
    font-weight: 600;
    color: #2d3748;
    margin: 24px 0 12px 0;
}

.settings-rendered-view h3 {
    font-size: 1.1em;
    font-weight: 600;
    color: #4a5568;
    margin: 20px 0 8px 0;
}

.settings-rendered-view p {
    margin: 0 0 12px 0;
}

.settings-rendered-view ul,
.settings-rendered-view ol {
    margin: 8px 0 16px 0;
    padding-left: 24px;
}

.settings-rendered-view li {
    margin: 4px 0;
}

.settings-rendered-view strong {
    font-weight: 600;
    color: #1a202c;
}

.settings-rendered-view em {
    font-style: italic;
}

.settings-rendered-view code {
    background: #edf2f7;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'SF Mono', Consolas, monospace;
    font-size: 0.9em;
    color: #e53e3e;
}

.settings-rendered-view pre {
    background: #2d3748;
    color: #e2e8f0;
    padding: 16px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 12px 0;
}

.settings-rendered-view pre code {
    background: none;
    padding: 0;
    color: inherit;
}

.settings-rendered-view table {
    width: 100%;
    border-collapse: collapse;
    margin: 16px 0;
    font-size: 13px;
}

.settings-rendered-view th,
.settings-rendered-view td {
    padding: 8px 12px;
    border: 1px solid #e2e8f0;
    text-align: left;
}

.settings-rendered-view th {
    background: #f7fafc;
    font-weight: 600;
    color: #4a5568;
}

.settings-rendered-view tr:nth-child(even) td {
    background: #f8fafc;
}

.settings-rendered-view hr {
    border: none;
    border-top: 1px solid #e2e8f0;
    margin: 24px 0;
}

/* Responsive */
@media (max-width: 768px) {
    .settings-container {
        padding: 16px;
    }
    
    .settings-card {
        padding: 16px;
    }
    
    .settings-color-input {
        flex-wrap: wrap;
    }
    
    .settings-color-input input[type="text"] {
        max-width: none;
        flex: 1 1 100%;
    }
}

/* ──────────────────────────────────────────────
   Mobile: Hamburger nav & layout fixes
   ────────────────────────────────────────────── */

/* Hamburger button – hidden on desktop */
.nav-hamburger {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    z-index: 102;
    margin-left: auto;
}

.nav-hamburger span {
    display: block;
    width: 22px;
    height: 2px;
    background: #333;
    border-radius: 2px;
    transition: transform 0.25s, opacity 0.25s;
}

.nav-hamburger.open span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.nav-hamburger.open span:nth-child(2) {
    opacity: 0;
}

.nav-hamburger.open span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

@media (max-width: 768px) {
    /* ── Hamburger nav ── */
    .nav-hamburger {
        display: flex;
    }

    .nav-menu {
        display: none;
        flex-direction: column;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: white;
        border-bottom: 1px solid #e4e6eb;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
        padding: 8px 0;
        z-index: 101;
    }

    .nav-menu.open {
        display: flex;
    }

    .nav-menu-item {
        padding: 10px 24px;
        border-radius: 0;
    }

    .nav-menu-item.active::after {
        display: none;
    }

    .app-navigation {
        position: sticky;
        top: 0;
        z-index: 102;
    }

    /* ── Hide data-source-selector ── */
    .data-source-selector {
        display: none !important;
    }

    /* ── Hide logout button ── */
    .marketably-logout-btn {
        display: none !important;
    }

    /* ── Treemap header: stack title & search ── */
    .treemap-header {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
        padding: 12px 16px;
    }

    .treemap-header-top {
        width: 100%;
    }

    .treemap-search-input {
        width: 100%;
        box-sizing: border-box;
    }

    .treemap-search-input-wrapper {
        width: 100%;
        display: block;
    }

    /* ── Treemap: taller on mobile ── */
    .treemap-container {
        height: 85vh;
        min-height: 400px;
        max-height: none;
    }

    /* ── Hide insights panel ── */
    .insights-panel-container {
        display: none !important;
    }

    /* ── Hide axis--bottom (overlapping labels) ── */
    .axis--bottom {
        display: none !important;
    }

    /* ── Truncate chart labels ── */
    .chart__labels {
        width: 120px;
        overflow: hidden;
    }

    .group__label,
    .topic__label {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 100%;
    }

    .topic__label-wrapper {
        max-width: 100%;
        overflow: hidden;
    }

    .group__label-wrapper {
        max-width: 100%;
        overflow: hidden;
    }
}
