/**
 * opti-behavior Heatmap Modern Dashboard Styles
 *
 * @package opti-behavior-heatmap
 * @version 1.0.0
 */

/* Reset and base styles */
.opti-behavior-dashboard,
.opti-behavior-sessions,
.opti-behavior-heatmaps,
.opti-behavior-analytics {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Ubuntu, Cantarell, 'Helvetica Neue', sans-serif;
    background: #f1f1f1;
    margin: 0;
    padding: 0;
}

.opti-behavior-dashboard .wrap,
.opti-behavior-sessions .wrap,
.opti-behavior-heatmaps .wrap,
.opti-behavior-analytics .wrap {
    background: transparent;
    margin: 20px 0 0 0;
    padding: 0;
}

/* Dashboard header */
.opti-behavior-dashboard h1 {
    color: #1e293b;
    font-size: 2rem;
    font-weight: 600;
    margin: 0 0 2rem 0;
    padding: 0;
}

/* Dashboard grid layout */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

/* Stats cards */
.stats-card {
    background: #ffffff;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border: 1px solid #e2e8f0;
    transition: all 0.2s ease;
}

.stats-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
}

.stats-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.stats-card-title {
    font-size: 0.875rem;
    font-weight: 500;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stats-card-icon {
    width: 2rem;
    height: 2rem;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
}

.stats-card-icon.sessions {
    background: #dbeafe;
    color: #2563eb;
}

.stats-card-icon.visitors {
    background: #dcfce7;
    color: #16a34a;
}

.stats-card-icon.pageviews {
    background: #fef3c7;
    color: #d97706;
}

.stats-card-icon.bounce {
    background: #fee2e2;
    color: #dc2626;
}

.stats-card-value {
    font-size: 2rem;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 0.5rem;
}

.stats-card-change {
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.stats-card-change.positive {
    color: #16a34a;
}

.stats-card-change.negative {
    color: #dc2626;
}

.stats-card-change.neutral {
    color: #64748b;
}

/* Chart containers */
.chart-container {
    background: #ffffff;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border: 1px solid #e2e8f0;
    margin-bottom: 1.5rem;
    height: 400px; /* Fixed height to prevent huge charts */
    max-height: 400px;
    overflow: hidden;
}

/* Chart canvas sizing */
.chart-container canvas {
    max-height: 300px !important;
    height: 300px !important;
    width: 100% !important;
}

/* Specific chart containers */
#sessions-chart {
    max-height: 300px !important;
    height: 300px !important;
    width: 100% !important;
}

/* Chart wrapper for better control */
.chart-wrapper {
    position: relative;
    height: 300px;
    max-height: 300px;
    width: 100%;
    overflow: hidden;
}

.chart-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}

.chart-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: #1e293b;
}

.chart-filters {
    display: flex;
    gap: 0.5rem;
}

.chart-filter-btn {
    padding: 0.5rem 1rem;
    border: 1px solid #e2e8f0;
    background: #ffffff;
    border-radius: 6px;
    font-size: 0.875rem;
    color: #64748b;
    cursor: pointer;
    transition: all 0.2s ease;
}

.chart-filter-btn:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
}

.chart-filter-btn.active {
    background: #2563eb;
    border-color: #2563eb;
    color: #ffffff;
}

/* Session recordings table */
.sessions-table {
    background: #ffffff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border: 1px solid #e2e8f0;
}

.sessions-table-header {
    background: #f8fafc;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sessions-table-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: #1e293b;
}

.sessions-table-filters {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.sessions-table-search {
    padding: 0.5rem 1rem;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 0.875rem;
    width: 200px;
}

.sessions-table-body {
    overflow-x: auto;
}

.sessions-table table {
    width: 100%;
    border-collapse: collapse;
}

.sessions-table th,
.sessions-table td {
    padding: 1rem 1.5rem;
    text-align: left;
    border-bottom: 1px solid #f1f5f9;
}

.sessions-table th {
    background: #f8fafc;
    font-weight: 600;
    color: #374151;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.sessions-table td {
    color: #1e293b;
    font-size: 0.875rem;
}

.sessions-table tr:hover {
    background: #f8fafc;
}

/* Session row elements */
.session-id {
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.75rem;
    color: #6b7280;
}

.session-duration {
    font-weight: 600;
    color: #1e293b;
}

.session-pages {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.session-device {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.device-icon {
    width: 1rem;
    height: 1rem;
    opacity: 0.7;
}

.session-country {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.country-flag {
    width: 1rem;
    height: 1rem;
    border-radius: 2px;
}

.visitor-flag-icon {
    width: 1rem;
    height: 0.75rem;
    object-fit: cover;
    border-radius: 2px;
    margin-right: 0.5rem;
    display: inline-block;
    vertical-align: middle;
}

.session-actions {
    display: flex;
    gap: 0.5rem;
}

.action-btn {
    padding: 0.25rem 0.75rem;
    border: 1px solid #e2e8f0;
    background: #ffffff;
    border-radius: 4px;
    font-size: 0.75rem;
    color: #374151;
    cursor: pointer;
    transition: all 0.2s ease;
}

.action-btn:hover {
    background: #f3f4f6;
    border-color: #d1d5db;
}

.action-btn.primary {
    background: #2563eb;
    border-color: #2563eb;
    color: #ffffff;
}

.action-btn.primary:hover {
    background: #1d4ed8;
    border-color: #1d4ed8;
}

/* Loading states */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    color: #64748b;
}

.loading-spinner {
    width: 2rem;
    height: 2rem;
    border: 2px solid #e2e8f0;
    border-top: 2px solid #2563eb;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 0.75rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Widget Empty State Fixes */
/* Fix Real-time Visitors widget container to prevent scrollbars */
.realtime-widget .widget-content {
    overflow: auto !important;
    height: 400px !important;
    max-height: 400px !important;
}

.realtime-widget .realtime-visitors {
    height: 100% !important;
    max-height: 400px !important;
    overflow: auto !important;
}

/* Fix Real-time Visitors widget empty state to fill widget properly */
.realtime-widget .optibehavior-empty-state {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    max-height: 400px !important;
    overflow: hidden !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 20px !important;
    box-sizing: border-box !important;
}

/* Ensure the container has relative positioning for absolute positioning to work */
.realtime-widget .realtime-visitors {
    position: relative !important;
}

/* Fix Real-time Visitors widget no-visitors state (JavaScript generated) */
.dashboard-widget.realtime-widget .no-visitors {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    height: 100% !important;
    max-height: 400px !important;
    width: 100% !important;
    text-align: center !important;
    color: #6b7280 !important;
    padding: 20px !important;
    overflow: hidden !important;
    box-sizing: border-box !important;
}

.dashboard-widget.realtime-widget .no-visitors p {
    margin: 0 !important;
    font-size: 14px !important;
    color: #6b7280 !important;
}

/* Responsive design */
@media (max-width: 768px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .chart-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .sessions-table-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .sessions-table-filters {
        width: 100%;
        justify-content: space-between;
    }

    .sessions-table-search {
        width: 100%;
    }
}

/* 3-Column Analytics Layout - Modern Professional Design */
.optibehavior-analytics-container {
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    border: none;
    border-radius: 20px;
    box-shadow:
        0 4px 6px -1px rgba(0, 0, 0, 0.1),
        0 2px 4px -1px rgba(0, 0, 0, 0.06),
        0 0 0 1px rgba(255, 255, 255, 0.05);
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Ubuntu, Cantarell, 'Helvetica Neue', sans-serif;
    position: relative;
}

.optibehavior-analytics-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #3b82f6 0%, #10b981 50%, #ef4444 100%);
}

.optibehavior-analytics-grid {
    display: flex !important;
    flex-direction: row !important;
    gap: 16px;
    min-height: 350px;
    width: 100% !important;
    align-items: stretch;
}

.optibehavior-analytics-column {
    padding: 24px;
    background: #ffffff;
    display: flex !important;
    flex-direction: column !important;
    position: relative;
    transition: all 0.3s ease;
    flex: 1 1 33.333% !important;
    width: 33.333% !important;
    min-width: 0 !important;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    box-shadow: 0 1px 2px rgba(0,0,0,.04);
}

.optibehavior-analytics-column:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}


.optibehavior-column-header {
    display: flex !important;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    text-align: left;
    margin-bottom: 16px;
    padding: 14px 16px;
    border-radius: 12px;
    position: relative;
    overflow: hidden;
    border-bottom: 1px solid #e5e7eb;
}

.optibehavior-column-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    opacity: 0.1;
    background: radial-gradient(circle at center, currentColor 0%, transparent 70%);
}

.optibehavior-column-icon {
    font-size: 20px;
    margin: 0;
    display: inline-block;
    align-self: center;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

.optibehavior-column-title {
    margin: 0 0 4px 0;
    font-size: 18px;
    font-weight: 700;
    color: #1e293b;
    letter-spacing: -0.025em;
}

.optibehavior-column-subtitle {
    font-size: 13px;
    color: #64748b;
    margin: 0;
    font-weight: 500;
    flex-basis: 100%;
    padding-left: 42px; /* 32px icon + 10px gap */
}

.optibehavior-column-content {
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* Entry Column Styles - Blue Theme */
.optibehavior-entry-column .optibehavior-column-header {
    background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
    border: 1px solid #93c5fd;
}

.optibehavior-entry-column .optibehavior-column-icon {
    color: #1d4ed8;
}

.optibehavior-entry-column .optibehavior-column-title {
    color: #1e40af;
}

/* Behavior Column Styles - Green Theme */
.optibehavior-behavior-column .optibehavior-column-header {
    background: linear-gradient(135deg, #dcfce7 0%, #bbf7d0 100%);
    border: 1px solid #86efac;
}

.optibehavior-behavior-column .optibehavior-column-icon {
    color: #15803d;
}

.optibehavior-behavior-column .optibehavior-column-title {
    color: #166534;
}

.optibehavior-behavior-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.optibehavior-behavior-stat {
    text-align: center;
    padding: 16px 12px;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.optibehavior-behavior-stat::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #10b981, #059669);
}

.optibehavior-behavior-stat:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.optibehavior-behavior-label {
    font-size: 10px;
    color: #64748b;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}

.optibehavior-behavior-value {
    font-size: 16px;
    font-weight: 800;
    color: #0f172a;
    line-height: 1.2;
}

/* Exit Column Styles - Red Theme */
.optibehavior-exit-column .optibehavior-column-header {
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    border: 1px solid #fca5a5;
}

.optibehavior-exit-column .optibehavior-column-icon {
    color: #dc2626;
}

.optibehavior-exit-column .optibehavior-column-title {
    color: #991b1b;
}

/* Referrer and Outbound Click Item Styles */
#optibehavior-referrers-content,
#optibehavior-outbound-content {
    min-height: 60px;
}

#optibehavior-referrers-list > div,
#optibehavior-outbound-list > div {
    display: grid;
    gap: 8px;
}

#optibehavior-referrers-list > div > div,
#optibehavior-outbound-list > div > div {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px;
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    border-radius: 12px;
    margin-bottom: 10px;
    border: 1px solid #e2e8f0;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

#optibehavior-referrers-list > div > div::before,
#optibehavior-outbound-list > div > div::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    width: 4px;
    transition: all 0.3s ease;
}

#optibehavior-referrers-list > div > div::before {
    background: linear-gradient(180deg, #3b82f6 0%, #1d4ed8 100%);
}

#optibehavior-outbound-list > div > div::before {
    background: linear-gradient(180deg, #ef4444 0%, #dc2626 100%);
}

#optibehavior-referrers-list > div > div:hover,
#optibehavior-outbound-list > div > div:hover {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

#optibehavior-referrers-list > div > div:hover::before,
#optibehavior-outbound-list > div > div:hover::before {
    width: 6px;
}

#optibehavior-referrers-list > div > div:last-child,
#optibehavior-outbound-list > div > div:last-child {
    margin-bottom: 0;
}

#optibehavior-referrers-list > div > div > div:first-child,
#optibehavior-outbound-list > div > div > div:first-child {
    flex: 1;
    font-weight: 600;
    color: #1e293b;
    font-size: 14px;
    line-height: 1.4;
}

#optibehavior-referrers-list > div > div > div:last-child,
#optibehavior-outbound-list > div > div > div:last-child {
    font-size: 12px;
    color: #ffffff;
    font-weight: 700;
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
    padding: 6px 12px;
    border-radius: 20px;
    box-shadow: 0 2px 4px rgba(99, 102, 241, 0.3);
    min-width: 60px;
    text-align: center;
}

/* Loading and Empty States */
.optibehavior-loading {
    text-align: center;
    padding: 48px 20px;
    color: #64748b;
    font-style: italic;
    font-size: 14px;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-radius: 12px;
    border: 1px dashed #cbd5e1;
}

.optibehavior-empty {
    text-align: center;
    padding: 48px 20px;
    color: #94a3b8;
    font-size: 14px;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-radius: 12px;
    border: 1px dashed #cbd5e1;
}

/* Controls Row */
.optibehavior-controls-row {
    border-top: 1px solid #e5e7eb;
    padding: 16px 24px;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-radius: 0 0 20px 20px;
}

.optibehavior-heatmap-controls {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    flex-wrap: wrap;
    gap: 14px 18px;
}

.optibehavior-heatmap-links {
    display: inline-flex;
    gap: 12px;
    white-space: nowrap;
}

.optibehavior-heatmap-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
    text-decoration: none;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.3);
}

.optibehavior-heatmap-link:hover {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(59, 130, 246, 0.4);
}

.optibehavior-time-filters {
    display: inline-flex;
    gap: 8px;
    flex-wrap: wrap;
    background: #ffffff;
    padding: 6px;
    border-radius: 16px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    white-space: nowrap;
}

.optibehavior-time-filter {
    padding: 8px 16px;
    background: transparent;
    color: #64748b;
    text-decoration: none;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    transition: all 0.3s ease;
    cursor: pointer;
    white-space: nowrap;
}

.optibehavior-time-filter:hover {
    background: #f1f5f9;
    color: #475569;
    transform: translateY(-1px);
}

.optibehavior-time-filter.active {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.3);
}

/* Responsive Design - Only stack on very small phones */
@media (max-width: 480px) {
    .optibehavior-analytics-grid {
        flex-direction: column !important;
        gap: 1px;
    }

    .optibehavior-analytics-column {
        padding: 20px;
        background: #ffffff;
        width: 100% !important;
        flex: none !important;
    }

    .optibehavior-analytics-column:first-child {
        border-radius: 20px 20px 0 0;
    }

    .optibehavior-analytics-column:last-child {
        border-radius: 0 0 20px 20px;
    }

    .optibehavior-analytics-column:only-child {
        border-radius: 20px;
    }

    .optibehavior-behavior-stats {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }

    .optibehavior-heatmap-controls {
        flex-direction: column;
        align-items: stretch;
        gap: 16px;
    }

    .optibehavior-heatmap-links {
        justify-content: center;
    }

    .optibehavior-time-filters {
        justify-content: center;
    }
}

@media (max-width: 400px) {
    .optibehavior-analytics-column {
        padding: 16px;
    }

    .optibehavior-column-header {
        padding: 16px 12px;
        margin-bottom: 20px;
    }

    .optibehavior-column-icon {
        font-size: 28px;
        margin-bottom: 10px;
    }

    .optibehavior-column-title {
        font-size: 16px;
    }

    .optibehavior-behavior-stats {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .optibehavior-behavior-stat {
        padding: 12px 10px;
    }

    .optibehavior-behavior-value {
        font-size: 14px;
    }

    #optibehavior-referrers-list > div > div,
    #optibehavior-outbound-list > div > div {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
        padding: 12px;
    }

    #optibehavior-referrers-list > div > div > div:last-child,
    #optibehavior-outbound-list > div > div > div:last-child {
        align-self: flex-end;
    }

    .optibehavior-heatmap-link {
        padding: 10px 16px;
        font-size: 13px;
    }

    .optibehavior-time-filters {
        gap: 4px;
        padding: 4px;
    }

    .optibehavior-time-filter {
        padding: 6px 12px;
        font-size: 11px;
    }
}

/* ========================================================================
   Additional Dashboard Styles (Previously in dashboard-custom.css)
   ======================================================================== */

/* Realtime Map Styles */
/* Vertical tooltips on the real-time map (avoid horizontal cropping) */
#realtime-map .leaflet-tooltip,
.realtime-map .leaflet-tooltip {
    font-size: 11px !important;
    line-height: 1.2;
    padding: 2px 6px;
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid #cbd5e1;
}

#realtime-map .leaflet-tooltip .leaflet-tooltip-content {
    writing-mode: vertical-rl;
    text-orientation: mixed;
    white-space: normal;
}

/* Pulsing blue live marker */
.leaflet-div-icon.realtime-pulse-icon,
.leaflet-marker-icon.realtime-pulse-icon {
    position: absolute !important;
    width: 28px;
    height: 28px;
    background: transparent;
    border: none;
}

/* Realtime pulse marker - larger and more visible */
.leaflet-div-icon.realtime-pulse-icon::before,
.leaflet-marker-icon.realtime-pulse-icon::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    margin-left: -20px;
    margin-top: -20px;
    border-radius: 50%;
    background: rgba(59, 130, 246, 0.3);
    animation: rt-pulse 1.5s ease-out infinite;
}

.leaflet-div-icon.realtime-pulse-icon::after,
.leaflet-marker-icon.realtime-pulse-icon::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 12px;
    height: 12px;
    margin-left: -6px;
    margin-top: -6px;
    border-radius: 50%;
    background: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.6), 0 0 10px rgba(59, 130, 246, 0.8);
}

@keyframes rt-pulse {
    0% {
        transform: scale(0.3);
        opacity: 1;
    }
    50% {
        transform: scale(1.5);
        opacity: 0.5;
    }
    100% {
        transform: scale(2);
        opacity: 0;
    }
}

@keyframes spn {
    to {
        transform: rotate(360deg);
    }
}

/* Heatmap Table Styles */
.heatmaps-panel [data-optibehavior-table] {
    --chip-bg: #3b82f6;
    --chip-ring: #dbeafe;
}

/* Modern compact chips for actions */
.optibehavior-chip {
    --bg: #6757e8;
    --fg: #fff;
    --ring: #dcd7ff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 28px;
    width: 84px;
    padding: 0 8px;
    border-radius: 8px;
    background: var(--bg);
    color: var(--fg);
    text-decoration: none;
    box-shadow: 0 0 0 1px var(--ring) inset;
    transition: background 0.2s ease, transform 0.05s ease;
    font-size: 12px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    line-height: 1;
}

.optibehavior-chip:hover {
    filter: saturate(1.1);
    transform: translateY(-1px);
}

.optibehavior-chip:focus {
    outline: 2px solid #3858e9;
    outline-offset: 2px;
}

.optibehavior-chip .optibehavior-icon {
    width: 14px;
    height: 14px;
    opacity: 0.95;
}

.optibehavior-chip .optibehavior-count {
    min-width: 0;
}

/* Chip Variants */
.optibehavior-chip.is-mixed {
    --bg: #6c5ce7;
    --ring: #dcd7ff;
}

.optibehavior-chip.is-desktop {
    --bg: #10b981;
    --ring: #ccf1e3;
}

.optibehavior-chip.is-mobile {
    --bg: #f472b6;
    --ring: #ffd6e9;
}

/* Actions cell layout */
.heatmaps-panel [data-optibehavior-table] td.actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    align-items: center;
    white-space: nowrap;
}

/* Standardize WP admin-sized buttons in the Actions column */
.optibehavior-btn.button {
    height: 28px;
    line-height: 26px;
    padding: 0 10px;
    font-size: 12px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.optibehavior-btn {
    min-width: 118px;
    text-align: center;
}

.optibehavior-btn .optibehavior-btn-icon {
    width: 14px;
    height: 14px;
    vertical-align: middle;
}

/* Loading State */
.heatmaps-panel.is-loading {
    opacity: 0.6;
    pointer-events: none;
}

/* Table Wrapper */
[data-optibehavior-table-wrapper] {
    margin-top: 20px;
}

/* Simplified Heatmap Table */
.simplified-heatmap-table {
    width: 100%;
    border-collapse: collapse;
}

.simplified-heatmap-table th,
.simplified-heatmap-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #e5e7eb;
}

.simplified-heatmap-table thead th {
    background: #f9fafb;
    font-weight: 600;
    cursor: pointer;
}

.simplified-heatmap-table thead th:hover {
    background: #f3f4f6;
}

.simplified-heatmap-table tbody tr:hover {
    background: #f9fafb;
}

/* Sortable Column Indicators */
.simplified-heatmap-table thead a[data-sort] {
    text-decoration: none;
    color: inherit;
    display: flex;
    align-items: center;
    gap: 4px;
}

.simplified-heatmap-table thead a[data-sort]::after {
    content: "↕";
    opacity: 0.3;
}

.simplified-heatmap-table thead a[data-sort][data-active="1"]::after {
    opacity: 1;
}

.simplified-heatmap-table thead a[data-sort][data-current="asc"]::after {
    content: "↑";
}

.simplified-heatmap-table thead a[data-sort][data-current="desc"]::after {
    content: "↓";
}

/* Dashboard Stats Cards */
.dashboard-stats-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 16px;
}

.dashboard-stats-card h3 {
    margin: 0 0 12px 0;
    font-size: 14px;
    font-weight: 600;
    color: #374151;
}

.dashboard-stats-card .stat-value {
    font-size: 24px;
    font-weight: 700;
    color: #111827;
}

/* Stat Value Loading Spinner */
.stat-value-spinner {
    display: inline-block;
    width: 32px;
    height: 32px;
    border: 4px solid #e2e8f0;
    border-top-color: #3B82F6;
    border-right-color: #3B82F6;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    vertical-align: middle;
    margin: 8px 0;
}

.stat-value.is-loaded .stat-value-spinner {
    display: none;
}

.dashboard-stats-card .stat-label {
    font-size: 12px;
    color: #6b7280;
    margin-top: 4px;
}

/* Chart Containers */
.chart-container {
    position: relative;
    height: 300px;
    margin: 20px 0;
}

.chart-container canvas {
    max-height: 100%;
}

/* Period Selector */
#dashboard-period,
#start-date,
#end-date {
    padding: 6px 12px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 13px;
}

/* Custom Date Range */
.custom-date-range {
    display: none;
    gap: 8px;
    align-items: center;
    margin-top: 8px;
}

.custom-date-range.active {
    display: flex;
}

/* Responsive Design for Additional Styles */
@media (max-width: 782px) {
    .optibehavior-btn {
        min-width: auto;
        padding: 0 8px;
    }

    .heatmaps-panel [data-optibehavior-table] td.actions {
        flex-direction: column;
        gap: 4px;
    }
}

/* Spinner animation */
@keyframes spn {
    to {
        transform: rotate(360deg);
    }
}

/* Force the table to fit the viewport even on small admin screens */
.heatmaps-panel .simplified-heatmap-table {
    overflow-x: hidden !important;
}

.heatmaps-panel .heatmap-table {
    table-layout: fixed !important;
    width: 100% !important;
    border-collapse: collapse;
}

.heatmaps-panel .heatmap-table th,
.heatmaps-panel .heatmap-table td {
    padding: 10px 8px !important;
    box-sizing: border-box;
}

.heatmaps-panel [data-optibehavior-table] .page-info {
    width: 180px !important;
    max-width: 180px !important;
}

.heatmaps-panel [data-optibehavior-table] .page-title,
.heatmaps-panel [data-optibehavior-table] .page-url {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.heatmaps-panel [data-optibehavior-table] .page-url {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    display: block !important;
}

.heatmaps-panel [data-optibehavior-table] td.actions {
    display: flex;
    flex-wrap: nowrap;
    gap: 6px;
    justify-content: flex-end;
}

.heatmaps-panel [data-optibehavior-table] td.actions a {
    white-space: nowrap !important;
    padding: 4px 8px;
    font-size: 12px;
    width: 84px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-variant-numeric: tabular-nums;
}


/* Top Pages modern indicators */
.opti-behavior-dashboard .top-pages .page-item {
	display: flex;
	flex-direction: column;
	align-items: stretch;
	gap: 4px;
	padding: 10px 12px;
	border-radius: 8px;
	border: 1px solid #e2e8f0;
	background: #ffffff;
	margin-bottom: 8px;
}

.opti-behavior-dashboard .top-pages .page-info {
	flex: 1;
	min-width: 0;
}

.opti-behavior-dashboard .top-pages .page-title-row {
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 8px;
	margin-bottom: 4px;
}

.opti-behavior-dashboard .top-pages .page-title {
	flex: 1 1 auto;
	min-width: 0;
	font-weight: 500;
	color: #0f172a;
	font-size: 13px;
	white-space: nowrap;
	text-overflow: ellipsis;
	overflow: hidden;
}

.opti-behavior-dashboard .top-pages .page-actions {
	display: flex;
	flex-wrap: nowrap;
	align-items: center;
	gap: 4px;
}

.opti-behavior-dashboard .top-pages .page-url {
	display: inline-block;
	font-size: 11px;
	color: #64748b;
	text-decoration: none;
	max-width: 100%;
	text-overflow: ellipsis;
	white-space: nowrap;
	overflow: hidden;
}

.opti-behavior-dashboard .top-pages .page-url:hover {
	color: #0f172a;
	text-decoration: underline;
}

.opti-behavior-dashboard .top-pages .page-stats {
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	gap: 4px;
	min-width: 180px;
}

.opti-behavior-dashboard .top-pages .page-views-wrapper {
	margin-bottom: 2px;
}

.opti-behavior-dashboard .top-pages .page-views {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	font-size: 11px;
	color: #0f172a;
}

.opti-behavior-dashboard .top-pages .page-views-icon {
	width: 14px;
	height: 14px;
	color: #f97316;
}

.opti-behavior-dashboard .top-pages .page-views-value {
	font-weight: 600;
}


.opti-behavior-dashboard .top-pages .page-views-change {
	margin-left: 6px;
	font-size: 10px;
	font-weight: 500;
}

.opti-behavior-dashboard .top-pages .page-views-change.positive {
	color: #16a34a;
}

.opti-behavior-dashboard .top-pages .page-views-change.negative {
	color: #dc2626;
}

.opti-behavior-dashboard .top-pages .page-views-change.neutral {
	color: #64748b;
}

.opti-behavior-dashboard .top-pages .page-views-label {
	color: #64748b;
}

.opti-behavior-dashboard .top-pages .page-clicks-indicator {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	font-size: 10px;
}

.opti-behavior-dashboard .top-pages .click-pill {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	padding: 1px 6px;
	border-radius: 999px;
	background: #ecfdf5;
	color: #15803d;
	font-weight: 500;
	font-size: 10px;
}

.opti-behavior-dashboard .top-pages .click-pill-icon {
	width: 12px;
	height: 12px;
}

.opti-behavior-dashboard .top-pages .click-percentage-pill {
	padding: 2px 6px;
	border-radius: 999px;
	background: #eff6ff;
	color: #1d4ed8;
	font-weight: 500;
}

.opti-behavior-dashboard .top-pages .click-change {
	font-weight: 500;
}

.opti-behavior-dashboard .top-pages .click-change.positive {
	color: #16a34a;
}

.opti-behavior-dashboard .top-pages .click-change.negative {
	color: #dc2626;
}

.opti-behavior-dashboard .top-pages .click-change.neutral {
	color: #64748b;
}

.opti-behavior-dashboard .top-pages .page-item {
	display: flex;
	flex-direction: row;
	justify-content: space-between;
	align-items: flex-start;
	gap: 16px;
}

.opti-behavior-dashboard .top-pages .page-left {
	flex: 0 0 auto;
	min-width: 0;
}

.opti-behavior-dashboard .top-pages .page-right {
	flex: 1 1 auto;
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	gap: 4px;
}

/* Top Pages compact metrics row (Level 2) */
.opti-behavior-dashboard .top-pages .page-metrics {
	display: flex;
	flex-wrap: nowrap;
	align-items: center;
	justify-content: flex-end;
	gap: 16px;
	margin-top: 2px;
	margin-bottom: 2px;
}

.opti-behavior-dashboard .top-pages .metric {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	font-size: 11px;
	color: #0f172a;
}

.opti-behavior-dashboard .top-pages .metric-icon {
	width: 14px;
	height: 14px;
}

.opti-behavior-dashboard .top-pages .metric-views .metric-icon {
	color: #f97316; /* flame */
}

.opti-behavior-dashboard .top-pages .metric-clicks .metric-icon {
	color: #0f766e; /* clicks */
}

.opti-behavior-dashboard .top-pages .metric-value {
	font-weight: 600;
}

.opti-behavior-dashboard .top-pages .metric-change {
	display: inline-flex;
	align-items: center;
	gap: 2px;
	font-size: 10px;
	font-weight: 600;
	padding: 2px 6px;
	border-radius: 999px;
}

.opti-behavior-dashboard .top-pages .metric-arrow {
	font-size: 10px;
}

.opti-behavior-dashboard .top-pages .metric-change.positive {
	color: #16a34a; /* green */
	background-color: #dcfce7; /* light green */
}

.opti-behavior-dashboard .top-pages .metric-change.negative {
	color: #dc2626; /* red */
	background-color: #fee2e2; /* light red */
}

.opti-behavior-dashboard .top-pages .metric-change.neutral {
	color: #64748b; /* gray */
	background-color: #e5e7eb; /* light gray */
}


/* Top Pages heatmap buttons alignment and icon sizing */
.opti-behavior-dashboard .top-pages .page-actions {
	align-items: center;
}

.opti-behavior-dashboard .pages-widget .optibehavior-heatmap-btn {
	padding: 4px 10px;
	min-height: 24px;
	font-size: 11px;
}

.opti-behavior-dashboard .pages-widget .optibehavior-heatmap-btn svg {
	width: 14px;
	height: 14px;
}

/* Top Countries Widget - Shared vertical scroll treatment (same as Bot Traffic + Top Referrers) */
.countries-widget .countries-table-container {
    max-height: 290px; /* show ~8 countries before scroll (8 x 36px rows + buffer) */
    overflow-y: auto;   /* show scrollbar when there are many entries */
    margin-right: -24px; /* push scrollbar to widget border */
    padding-right: 24px; /* keep content aligned with other widgets */
}

/* ============================================
   MODERN LOADING INDICATOR
   ============================================ */

/* Loading overlay for widgets */
.widget-loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    border-radius: 12px;
    backdrop-filter: blur(2px);
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.widget-loading-overlay.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

/* Modern spinner */
.widget-spinner {
    position: relative;
    width: 48px;
    height: 48px;
}

.widget-spinner::before,
.widget-spinner::after {
    content: '';
    position: absolute;
    border-radius: 50%;
}

/* Outer spinning ring */
.widget-spinner::before {
    width: 48px;
    height: 48px;
    border: 3px solid #e2e8f0;
    border-top-color: #3b82f6;
    border-right-color: #3b82f6;
    animation: widget-spin 0.8s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

/* Inner pulsing dot */
.widget-spinner::after {
    width: 12px;
    height: 12px;
    background: #3b82f6;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation: widget-pulse 1.2s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

@keyframes widget-spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

@keyframes widget-pulse {
    0%, 100% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
    50% {
        opacity: 0.5;
        transform: translate(-50%, -50%) scale(0.8);
    }
}

/* Widget container needs position relative for overlay */
.dashboard-widget {
    position: relative;
}

.stats-card {
    position: relative;
}

/* ============================================
   Smart Insights
   ============================================ */
.ob-smart-insights {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 18px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
    margin: 24px 0;
    padding: 24px;
}

.ob-smart-insights-dashboard {
    margin-top: 10px;
    margin-bottom: 28px;
}

.ob-smart-insights-header,
.ob-smart-insights-page-hero {
    align-items: center;
    display: flex;
    gap: 18px;
    justify-content: space-between;
    margin-bottom: 18px;
}

.ob-smart-insights-page-hero {
    background: linear-gradient(135deg, #eef2ff 0%, #f8fafc 100%);
    border: 1px solid #dbeafe;
    border-radius: 18px;
    padding: 22px;
}

.ob-smart-insights-heading {
    align-items: center;
    display: flex;
    gap: 14px;
    min-width: 0;
}

.ob-smart-insights-heading h1,
.ob-smart-insights-heading h2 {
    color: #0f172a;
    font-size: 24px;
    font-weight: 750;
    line-height: 1.2;
    margin: 0 0 4px;
}

.ob-smart-insights-heading p {
    color: #64748b;
    font-size: 14px;
    margin: 0;
}

.ob-smart-insights-icon {
    align-items: center;
    background: linear-gradient(135deg, #4f46e5 0%, #2563eb 100%);
    border-radius: 16px;
    color: #ffffff;
    display: inline-flex;
    flex: 0 0 auto;
    height: 46px;
    justify-content: center;
    width: 46px;
}

.ob-smart-insights-icon svg {
    height: 24px;
    width: 24px;
}

.ob-smart-insights-header-actions {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: flex-end;
}

.ob-smart-insights-header-actions .button {
    align-items: center;
    display: inline-flex;
    gap: 6px;
}

.ob-smart-insights-alert {
    border-radius: 10px;
    font-size: 13px;
    margin-bottom: 14px;
    padding: 10px 12px;
}

.ob-smart-insights-alert.is-success {
    background: #ecfdf5;
    border: 1px solid #bbf7d0;
    color: #166534;
}

.ob-smart-insights-alert.is-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
}

.ob-smart-insights-alert.is-info {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    color: #1e40af;
}

.ob-smart-insights-loading,
.ob-smart-insights-empty {
    align-items: center;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border: 1px dashed #cbd5e1;
    border-radius: 14px;
    color: #64748b;
    display: flex;
    gap: 10px;
    justify-content: center;
    min-height: 130px;
    padding: 28px;
    text-align: center;
}

.ob-smart-insights-empty {
    flex-direction: column;
}

.ob-smart-insights-empty h3 {
    color: #1e293b;
    font-size: 17px;
    margin: 0;
}

.ob-smart-insights-empty p {
    margin: 0;
}

.ob-smart-insights-empty-icon {
    align-items: center;
    background: #e0e7ff;
    border-radius: 999px;
    color: #4f46e5;
    display: inline-flex;
    height: 48px;
    justify-content: center;
    width: 48px;
}

.ob-smart-insights-spinner {
    animation: spin 0.8s linear infinite;
    border: 3px solid #dbeafe;
    border-top-color: #2563eb;
    border-radius: 50%;
    display: inline-block;
    height: 22px;
    width: 22px;
}

.ob-smart-insights-card-grid {
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.ob-smart-insights-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    box-shadow: 0 3px 10px rgba(15, 23, 42, 0.05);
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 18px;
}

.ob-smart-insights-card-top,
.ob-smart-insights-meta {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: space-between;
}

.ob-smart-insights-card h3 {
    color: #0f172a;
    font-size: 17px;
    line-height: 1.25;
    margin: 0;
}

.ob-smart-insights-page-label,
.ob-smart-insights-row-page {
    color: #475569;
    font-size: 13px;
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ob-smart-insights-meta {
    color: #64748b;
    font-size: 12px;
    justify-content: flex-start;
}

.ob-smart-insights-badge {
    border-radius: 999px;
    display: inline-flex;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .02em;
    line-height: 1;
    padding: 7px 10px;
    text-transform: uppercase;
}

.ob-smart-insights-badge.is-critical {
    background: #fee2e2;
    color: #991b1b;
}

.ob-smart-insights-badge.is-high {
    background: #ffedd5;
    color: #9a3412;
}

.ob-smart-insights-badge.is-medium {
    background: #fef3c7;
    color: #92400e;
}

.ob-smart-insights-badge.is-low {
    background: #dbeafe;
    color: #1e40af;
}

.ob-smart-insights-badge.is-locked {
    background: #ede9fe;
    color: #5b21b6;
}

.ob-smart-insights-score {
    color: #475569;
    font-size: 12px;
}

.ob-smart-insights-evidence {
    display: grid;
    gap: 8px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.ob-smart-insights-evidence-item {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 10px;
}

.ob-smart-insights-evidence-item span {
    color: #64748b;
    display: block;
    font-size: 11px;
    margin-bottom: 3px;
}

.ob-smart-insights-evidence-item strong {
    color: #0f172a;
    font-size: 14px;
}

.ob-smart-insights-explanation {
    color: #334155;
    font-size: 13px;
    line-height: 1.5;
    margin: 0;
}

.ob-smart-insights-recommendation {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 12px;
    padding: 12px;
}

.ob-smart-insights-recommendation span {
    color: #15803d;
    display: block;
    font-size: 11px;
    font-weight: 700;
    margin-bottom: 4px;
    text-transform: uppercase;
}

.ob-smart-insights-recommendation strong {
    color: #14532d;
    font-size: 13px;
    line-height: 1.45;
}

.ob-smart-insights-card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: auto;
}

.ob-smart-insights-card-actions .button {
    font-size: 12px;
}

.ob-smart-insights-filters {
    align-items: end;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(5, minmax(130px, 1fr)) minmax(190px, 1.25fr) minmax(140px, auto);
    margin-bottom: 18px;
    padding: 16px;
}

.ob-smart-insights-filters label {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.ob-smart-insights-filters label[hidden] {
    display: none !important;
}

.ob-smart-insights-filters label span {
    color: #475569;
    font-size: 12px;
    font-weight: 700;
}

.ob-smart-insights-filters select,
.ob-smart-insights-filters input {
    max-width: 100%;
    min-height: 34px;
    width: 100%;
}

.ob-smart-insights-search-label {
    grid-column: auto;
}

.ob-smart-insights-apply {
    align-items: center;
    display: inline-flex;
    justify-content: center;
    min-width: 140px;
}

.ob-smart-insights-table-wrap {
    overflow-x: auto;
}

.ob-smart-insights-table td,
.ob-smart-insights-table th {
    vertical-align: middle;
}

.ob-smart-insights-table .ob-smart-insights-card-actions {
    min-width: 360px;
}

.ob-smart-insights-center-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.ob-smart-insights-center-card {
    align-items: stretch;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    box-shadow: 0 3px 12px rgba(15, 23, 42, 0.05);
    display: grid;
    gap: 18px;
    grid-template-columns: minmax(0, 1.35fr) minmax(240px, 0.95fr) minmax(220px, 0.7fr);
    padding: 18px;
}

.ob-smart-insights-center-main,
.ob-smart-insights-center-side {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 0;
}

.ob-smart-insights-center-card h3 {
    color: #0f172a;
    font-size: 17px;
    line-height: 1.25;
    margin: 0;
}

.ob-smart-insights-center-evidence {
    display: grid;
    gap: 8px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.ob-smart-insights-center-card .ob-smart-insights-card-actions {
    justify-content: flex-end;
    margin-top: auto;
}

.ob-smart-insights-center-card .ob-smart-insights-card-actions .button {
    flex: 1 1 calc(50% - 8px);
    justify-content: center;
    text-align: center;
    white-space: nowrap;
}

.ob-smart-insights-center-side .ob-smart-insights-meta {
    align-items: flex-start;
    flex-direction: column;
    gap: 6px;
}

.ob-smart-insights-modal[hidden] {
    display: none;
}

.ob-smart-insights-modal {
    bottom: 0;
    left: 0;
    position: fixed;
    right: 0;
    top: 0;
    z-index: 100000;
}

.ob-smart-insights-modal-backdrop {
    background: rgba(15, 23, 42, 0.58);
    bottom: 0;
    left: 0;
    position: absolute;
    right: 0;
    top: 0;
}

.ob-smart-insights-modal-panel {
    background: #ffffff;
    border-radius: 18px;
    box-shadow: 0 24px 80px rgba(15, 23, 42, 0.28);
    left: 50%;
    max-height: calc(100vh - 80px);
    max-width: 780px;
    overflow: auto;
    padding: 26px;
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%);
    width: calc(100vw - 40px);
}

.ob-smart-insights-modal-close {
    align-items: center;
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    border-radius: 999px;
    cursor: pointer;
    display: inline-flex;
    font-size: 22px;
    height: 34px;
    justify-content: center;
    line-height: 1;
    position: absolute;
    right: 16px;
    top: 16px;
    width: 34px;
}

.ob-smart-insights-detail {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding-right: 26px;
}

.ob-smart-insights-detail h2 {
    color: #0f172a;
    font-size: 24px;
    line-height: 1.2;
    margin: 0;
}

.ob-smart-insights-detail section {
    border-top: 1px solid #e2e8f0;
    padding-top: 14px;
}

.ob-smart-insights-detail h3 {
    color: #1e293b;
    font-size: 14px;
    margin: 0 0 8px;
}

.ob-smart-insights-detail p,
.ob-smart-insights-detail li {
    color: #334155;
    font-size: 14px;
    line-height: 1.55;
}

.ob-smart-insights-detail ul {
    margin: 0 0 0 18px;
}

.ob-smart-insights-modal-open {
    overflow: hidden;
}

@media (max-width: 1180px) {
    .ob-smart-insights-filters {
        grid-template-columns: repeat(3, minmax(140px, 1fr));
    }

    .ob-smart-insights-search-label {
        grid-column: span 2;
    }

    .ob-smart-insights-apply {
        width: 100%;
    }

    .ob-smart-insights-center-card {
        grid-template-columns: minmax(0, 1fr) minmax(260px, 0.85fr);
    }

    .ob-smart-insights-center-side {
        grid-column: 1 / -1;
    }

    .ob-smart-insights-center-card .ob-smart-insights-card-actions {
        justify-content: flex-start;
    }
}

@media (max-width: 782px) {
    .ob-smart-insights-header,
    .ob-smart-insights-page-hero {
        align-items: flex-start;
        flex-direction: column;
    }

    .ob-smart-insights-header-actions {
        justify-content: flex-start;
        width: 100%;
    }

    .ob-smart-insights-page-hero .ob-smart-insights-header-actions .button {
        justify-content: center;
        width: 100%;
    }

    .ob-smart-insights-filters,
    .ob-smart-insights-search-label {
        grid-column: auto;
        grid-template-columns: 1fr;
    }

    .ob-smart-insights-evidence {
        grid-template-columns: 1fr;
    }

    .ob-smart-insights-table .ob-smart-insights-card-actions {
        min-width: 0;
    }

    .ob-smart-insights-center-card {
        grid-template-columns: 1fr;
    }

    .ob-smart-insights-center-side {
        grid-column: auto;
    }

    .ob-smart-insights-center-card .ob-smart-insights-card-actions {
        gap: 8px;
    }

    .ob-smart-insights-center-card .ob-smart-insights-card-actions .button {
        flex: 1 1 calc(50% - 8px);
        justify-content: center;
        text-align: center;
    }

    .ob-smart-insights-modal-panel {
        max-height: calc(100vh - 32px);
        padding: 22px;
        width: calc(100vw - 24px);
    }
}

/* Smart Insights Phase 3 UI enhancements. */
.ob-smart-insights-evidence-item small {
    color: #64748b;
    display: block;
    font-size: 11px;
    margin-top: 2px;
}

.ob-smart-insights-locked-proof {
    align-items: center;
    background: #faf5ff;
    border: 1px solid #ddd6fe;
    border-radius: 10px;
    color: #5b21b6;
    display: flex;
    font-size: 12px;
    gap: 8px;
    grid-column: 1 / -1;
    padding: 10px;
}

.ob-smart-insights-locked-proof svg {
    height: 15px;
    width: 15px;
}

.ob-smart-insights-action-preview,
.ob-smart-insights-related-preview,
.ob-smart-insights-upgrade-preview,
.ob-smart-insights-weekly-mini {
    border-radius: 12px;
    font-size: 12px;
    line-height: 1.45;
    padding: 10px;
}

.ob-smart-insights-action-preview {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
}

.ob-smart-insights-action-preview span,
.ob-smart-insights-related-preview span {
    color: #475569;
    display: block;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
}

.ob-smart-insights-related-preview {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
}

.ob-smart-insights-related-preview.is-locked {
    align-items: center;
    background: #faf5ff;
    border-color: #ddd6fe;
    color: #5b21b6;
    display: flex;
    gap: 8px;
}

.ob-smart-insights-upgrade-preview {
    background: #faf5ff;
    border: 1px solid #ddd6fe;
    color: #4c1d95;
}

.ob-smart-insights-upgrade-preview div {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.ob-smart-insights-upgrade-preview p {
    margin: 8px 0 0;
}

.ob-smart-insights-detail .is-detail-evidence {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.ob-smart-insights-trend-grid,
.ob-smart-insights-segment-grid {
    display: grid;
    gap: 10px;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.ob-smart-insights-trend-item,
.ob-smart-insights-segment-item {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 10px;
}

.ob-smart-insights-trend-item span,
.ob-smart-insights-segment-item span {
    color: #64748b;
    display: block;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
}

.ob-smart-insights-trend-item strong,
.ob-smart-insights-segment-item strong {
    color: #0f172a;
    display: block;
    font-size: 14px;
    margin-top: 3px;
}

.ob-smart-insights-trend-item small {
    color: #64748b;
    display: block;
    margin-top: 3px;
}

.ob-smart-insights-weekly-summary .widget-content p {
    margin: 0 0 8px;
}

.ob-smart-insights-weekly-mini {
    align-items: center;
    background: #faf5ff;
    border: 1px solid #ddd6fe;
    color: #4c1d95;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 14px;
}

/* Smart Insights detail modal Evidence compact row feedback. */
.ob-smart-insights-detail .ob-smart-insights-evidence.is-detail-evidence {
    display: grid;
    gap: 10px;
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.ob-smart-insights-detail .ob-smart-insights-evidence-item.is-primary {
    grid-column: 1 / -1;
    padding: 14px 16px;
}

.ob-smart-insights-detail .ob-smart-insights-evidence-item.is-primary strong {
    font-size: clamp(28px, 4vw, 36px);
    letter-spacing: -0.04em;
    line-height: 1;
}

.ob-smart-insights-detail .ob-smart-insights-evidence-table.is-flat {
    align-items: stretch;
    display: grid;
    gap: 8px;
    grid-column: 1 / -1;
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.ob-smart-insights-detail .ob-smart-insights-evidence-table.is-flat .ob-smart-insights-evidence-item {
    padding: 8px 10px;
}

.ob-smart-insights-detail .ob-smart-insights-evidence-table.is-flat .ob-smart-insights-evidence-item span {
    margin-bottom: 3px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ob-smart-insights-detail .ob-smart-insights-evidence-table.is-flat .ob-smart-insights-evidence-item strong {
    font-size: 16px;
    line-height: 1.12;
}

.ob-smart-insights-detail .ob-smart-insights-evidence-table.is-flat .ob-smart-insights-evidence-item small {
    font-size: 10px;
    line-height: 1.3;
    margin-top: 2px;
}

@media (max-width: 782px) {
    .ob-smart-insights-detail .ob-smart-insights-evidence.is-detail-evidence,
    .ob-smart-insights-detail .ob-smart-insights-evidence-table.is-flat {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 480px) {
    .ob-smart-insights-detail .ob-smart-insights-evidence.is-detail-evidence,
    .ob-smart-insights-detail .ob-smart-insights-evidence-table.is-flat {
        grid-template-columns: 1fr;
    }
}

/* Smart Insights modal template-alignment pass. */
.ob-smart-insights-modal {
    --ob-si-panel: #ffffff;
    --ob-si-ink: #1a1916;
    --ob-si-muted: #5f5e5a;
    --ob-si-faint: #888780;
    --ob-si-warm: #f5f4f0;
    --ob-si-warm-strong: #f1efe8;
    --ob-si-border: #dedcd4;
    --ob-si-border-soft: #e8e6df;
    --ob-si-critical: #e24b4a;
    --ob-si-critical-text: #a32d2d;
    --ob-si-action: #185fa5;
    --ob-si-action-dark: #0c447c;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

.ob-smart-insights-modal-backdrop {
    background: rgba(26, 25, 22, 0.46);
}

.ob-smart-insights-modal-panel {
    background: var(--ob-si-panel);
    border: 1px solid var(--ob-si-border);
    border-radius: 16px;
    box-sizing: border-box;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.07);
    max-height: calc(100vh - 64px);
    max-width: 860px;
    overflow: hidden;
    padding: 0;
    width: min(860px, calc(100vw - 40px));
}

.ob-smart-insights-modal-content {
    box-sizing: border-box;
    max-height: calc(100vh - 64px);
    max-width: 100%;
    overflow: auto;
    width: 100%;
}

.ob-smart-insights-modal-content > .ob-smart-insights-loading,
.ob-smart-insights-modal-content > .ob-smart-insights-empty {
    padding: 48px 56px;
}

.ob-smart-insights-modal-close {
    align-items: center;
    background: transparent;
    border: 1px solid var(--ob-si-border);
    border-radius: 6px;
    color: var(--ob-si-muted);
    display: inline-flex;
    font-size: 20px;
    height: 28px;
    justify-content: center;
    line-height: 1;
    right: 24px;
    top: 20px;
    width: 28px;
    z-index: 3;
}

.ob-smart-insights-modal-close:hover,
.ob-smart-insights-modal-close:focus-visible {
    background: var(--ob-si-warm-strong);
    border-color: var(--ob-si-border);
    color: var(--ob-si-ink);
    outline: none;
}

.ob-smart-insights-modal.has-detail .ob-smart-insights-modal-close {
    display: none;
}

.ob-smart-insights-modal-header-close {
    align-items: center;
    background: transparent;
    border: 1px solid var(--ob-si-border);
    border-radius: 6px;
    color: var(--ob-si-muted);
    cursor: pointer;
    display: inline-flex;
    flex: 0 0 28px;
    font-size: 18px;
    height: 28px;
    justify-content: center;
    line-height: 1;
    padding: 0;
    text-decoration: none;
    width: 28px;
}

.ob-smart-insights-modal-header-close:hover,
.ob-smart-insights-modal-header-close:focus-visible {
    background: var(--ob-si-warm-strong);
    border-color: var(--ob-si-border);
    color: var(--ob-si-ink);
    outline: none;
}

.ob-smart-insights-detail {
    background: var(--ob-si-panel);
    box-sizing: border-box;
    color: var(--ob-si-ink);
    display: flex;
    flex-direction: column;
    gap: 0;
    max-width: 100%;
    min-width: 0;
    padding: 0;
    width: 100%;
}

.ob-smart-insights-detail *,
.ob-smart-insights-detail *::before,
.ob-smart-insights-detail *::after {
    box-sizing: border-box;
}

.ob-smart-insights-detail-topbar {
    background: var(--ob-si-faint);
    height: 3px;
}

.ob-smart-insights-detail-topbar.is-critical,
.ob-smart-insights-detail-topbar.is-high {
    background: var(--ob-si-critical);
}

.ob-smart-insights-detail-topbar.is-medium {
    background: #d98922;
}

.ob-smart-insights-detail-topbar.is-low {
    background: #4d7c0f;
}

.ob-smart-insights-detail-header {
    align-items: flex-start;
    background: var(--ob-si-panel);
    border-bottom: 1px solid var(--ob-si-border-soft);
    display: flex;
    gap: 16px;
    justify-content: space-between;
    max-width: 100%;
    min-width: 0;
    padding: 20px 24px 16px;
    width: 100%;
}

.ob-smart-insights-detail-header-copy {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: 100%;
    min-width: 0;
}

.ob-smart-insights-detail-chip-row {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    max-width: 100%;
    min-width: 0;
}

.ob-smart-insights-detail-chip,
.ob-smart-insights-detail .ob-smart-insights-badge {
    border: 0;
    border-radius: 4px;
    display: inline-flex;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.08em;
    line-height: 1.3;
    padding: 3px 8px;
    text-transform: uppercase;
}

.ob-smart-insights-detail-chip.is-priority.is-critical,
.ob-smart-insights-detail-chip.is-priority.is-high {
    background: #fcebeb;
    color: var(--ob-si-critical-text);
}

.ob-smart-insights-detail-chip.is-priority.is-medium {
    background: #fff3df;
    color: #8a4b10;
}

.ob-smart-insights-detail-chip.is-priority.is-low {
    background: #eef7e7;
    color: #3b6d11;
}

.ob-smart-insights-detail-chip.is-category,
.ob-smart-insights-detail-chip.is-entity,
.ob-smart-insights-detail-chip.is-recurring,
.ob-smart-insights-detail-chip.ob-smart-insights-status-chip {
    background: var(--ob-si-warm-strong);
    color: var(--ob-si-muted);
}

.ob-smart-insights-detail .ob-smart-insights-badge.is-locked {
    background: #eeedfe;
    color: #534ab7;
}

.ob-smart-insights-detail h2 {
    color: var(--ob-si-ink);
    font-size: 19px;
    font-weight: 600;
    letter-spacing: -0.01em;
    line-height: 1.25;
    margin: 0;
    max-width: 100%;
    overflow-wrap: anywhere;
}

.ob-smart-insights-detail-subtitle {
    align-items: center;
    color: var(--ob-si-faint);
    display: flex;
    flex-wrap: wrap;
    font-size: 12px;
    gap: 10px;
    line-height: 1.45;
    margin: 0;
    max-width: 100%;
    min-width: 0;
    overflow-wrap: anywhere;
}

.ob-smart-insights-detail-subtitle-separator {
    color: var(--ob-si-border);
}

.ob-smart-insights-detail-header-actions {
    align-items: center;
    display: flex;
    flex-shrink: 0;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: flex-end;
    max-width: 100%;
    min-width: 0;
}

.ob-smart-insights-detail-priority {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    min-width: 0;
}

.ob-smart-insights-detail-priority .ob-smart-insights-priority-label {
    color: var(--ob-si-faint);
    font-size: 11px;
}

.ob-smart-insights-detail-priority .ob-smart-insights-priority-segments {
    display: flex;
    gap: 2px;
}

.ob-smart-insights-detail-priority .ob-smart-insights-priority-segment {
    background: var(--ob-si-border-soft);
    border-radius: 2px;
    display: block;
    height: 3px;
    width: 14px;
}

.ob-smart-insights-detail-priority.is-critical .ob-smart-insights-priority-segment.is-active,
.ob-smart-insights-detail-priority.is-high .ob-smart-insights-priority-segment.is-active {
    background: var(--ob-si-critical);
}

.ob-smart-insights-detail-priority.is-medium .ob-smart-insights-priority-segment.is-active {
    background: #d98922;
}

.ob-smart-insights-detail-priority.is-low .ob-smart-insights-priority-segment.is-active {
    background: #4d7c0f;
}

.ob-smart-insights-detail-priority .ob-smart-insights-priority-value,
.ob-smart-insights-detail-priority .ob-smart-insights-priority-value strong {
    color: var(--ob-si-muted);
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    font-size: 12px;
    font-weight: 500;
}

.ob-smart-insights-detail-body {
    display: grid;
    gap: 0;
    grid-template-columns: minmax(0, 1fr) 268px;
    max-width: 100%;
    min-width: 0;
    width: 100%;
}

.ob-smart-insights-detail-main {
    border-right: 1px solid var(--ob-si-border-soft);
    display: flex;
    flex-direction: column;
    gap: 20px;
    max-width: 100%;
    min-width: 0;
    padding: 22px 24px;
}

.ob-smart-insights-detail-side {
    background: var(--ob-si-warm);
    display: flex;
    flex-direction: column;
    gap: 18px;
    max-width: 100%;
    min-width: 0;
    padding: 22px 20px;
}

.ob-smart-insights-detail section,
.ob-smart-insights-detail-section {
    border: 0;
    padding: 0;
}

.ob-smart-insights-detail-section.is-context {
    background: var(--ob-si-warm-strong);
    border: 1px solid var(--ob-si-border-soft);
    border-radius: 10px;
    padding: 12px 14px;
}

.ob-smart-insights-detail h3 {
    align-items: center;
    color: var(--ob-si-faint);
    display: flex;
    font-size: 10px;
    font-weight: 600;
    gap: 6px;
    letter-spacing: 0.1em;
    line-height: 1.3;
    margin: 0 0 10px;
    text-transform: uppercase;
}

.ob-smart-insights-detail p,
.ob-smart-insights-detail li {
    color: var(--ob-si-muted);
    font-size: 13px;
    line-height: 1.65;
    overflow-wrap: anywhere;
}

.ob-smart-insights-detail-diagnosis-copy p {
    margin: 0;
}

.ob-smart-insights-detail-diagnosis-copy p + p,
.ob-smart-insights-detail-why {
    color: var(--ob-si-faint);
    font-style: italic;
    margin-top: 8px;
}

.ob-smart-insights-detail .description {
    background: var(--ob-si-warm-strong);
    border-radius: 8px;
    color: var(--ob-si-faint);
    font-size: 13px;
    font-style: italic;
    margin: 0;
    padding: 12px 14px;
}

.ob-smart-insights-detail .ob-smart-insights-evidence.is-detail-evidence {
    display: grid;
    gap: 8px;
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.ob-smart-insights-detail .ob-smart-insights-evidence-item {
    background: var(--ob-si-warm-strong);
    border: 0;
    border-radius: 10px;
    padding: 12px 14px;
}

.ob-smart-insights-detail .ob-smart-insights-evidence-item.is-primary {
    grid-column: 1 / -1;
    padding: 14px 16px;
}

.ob-smart-insights-detail .ob-smart-insights-evidence-item span {
    color: var(--ob-si-faint);
    display: block;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.08em;
    line-height: 1.35;
    margin-bottom: 6px;
    text-transform: uppercase;
}

.ob-smart-insights-detail .ob-smart-insights-evidence-item:not(.is-primary) span {
    font-size: 9px;
    margin-bottom: 2px;
}

.ob-smart-insights-detail .ob-smart-insights-evidence-item strong {
    color: var(--ob-si-ink);
    display: block;
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    font-size: 19px;
    font-weight: 600;
    line-height: 1;
}

.ob-smart-insights-detail .ob-smart-insights-evidence-item.is-primary strong {
    font-size: 34px;
    letter-spacing: -0.04em;
}

.ob-smart-insights-detail .ob-smart-insights-evidence-item small {
    color: var(--ob-si-faint);
    display: block;
    font-size: 11px;
    line-height: 1.35;
    margin-top: 4px;
}

.ob-smart-insights-detail .ob-smart-insights-evidence-table.is-flat {
    align-items: stretch;
    display: grid;
    gap: 8px;
    grid-column: 1 / -1;
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.ob-smart-insights-trend-grid {
    display: grid;
    gap: 8px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.ob-smart-insights-segment-grid {
    display: grid;
    gap: 8px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.ob-smart-insights-trend-item,
.ob-smart-insights-segment-item {
    background: var(--ob-si-panel);
    border: 1px solid var(--ob-si-border-soft);
    border-radius: 8px;
    padding: 10px 12px;
}

.ob-smart-insights-trend-item span,
.ob-smart-insights-segment-item span {
    color: var(--ob-si-faint);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.ob-smart-insights-trend-item strong,
.ob-smart-insights-segment-item strong {
    color: var(--ob-si-ink);
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    font-size: 17px;
    font-weight: 600;
}

.ob-smart-insights-trend-item small {
    color: var(--ob-si-faint);
    font-size: 11px;
}

.ob-smart-insights-context-facts {
    max-width: 100%;
    margin: 0;
    min-width: 0;
}

.ob-smart-insights-context-fact {
    align-items: center;
    border-bottom: 1px solid var(--ob-si-border-soft);
    display: flex;
    font-size: 12px;
    justify-content: space-between;
    gap: 12px;
    max-width: 100%;
    min-width: 0;
    padding: 6px 0;
}

.ob-smart-insights-context-fact:last-child {
    border-bottom: 0;
}

.ob-smart-insights-context-fact dt {
    color: var(--ob-si-faint);
    flex: 0 0 auto;
    font-weight: 400;
    max-width: 100%;
}

.ob-smart-insights-context-fact dd {
    color: var(--ob-si-ink);
    flex: 1 1 auto;
    font-weight: 500;
    margin: 0;
    max-width: 100%;
    min-width: 0;
    overflow-wrap: anywhere;
    text-align: right;
}

.ob-smart-insights-context-fact.is-entity {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
}

.ob-smart-insights-context-fact.is-entity dd {
    text-align: left;
    width: 100%;
}

.ob-smart-insights-detail-side .ob-smart-insights-entity-card {
    background: transparent;
    border: 0;
    max-width: 100%;
    min-width: 0;
    padding: 0;
}

.ob-smart-insights-detail-side .ob-smart-insights-entity-links {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 6px;
    max-width: 100%;
    min-width: 0;
}

.ob-smart-insights-detail .ob-smart-insights-entity-ref,
.ob-smart-insights-detail .ob-smart-insights-entity-copy,
.ob-smart-insights-detail .ob-smart-insights-entity-url,
.ob-smart-insights-detail .ob-smart-insights-entity-link-pill {
    max-width: 100%;
    min-width: 0;
    overflow-wrap: anywhere;
}

.ob-smart-insights-action-callout {
    align-items: flex-start;
    background: var(--ob-si-panel);
    border: 1px solid var(--ob-si-border-soft);
    border-radius: 10px;
    display: flex;
    gap: 10px;
    max-width: 100%;
    min-width: 0;
    padding: 12px 14px;
}

.ob-smart-insights-action-icon {
    align-items: center;
    background: var(--ob-si-action);
    border-radius: 7px;
    color: #e6f1fb;
    display: inline-flex;
    flex: 0 0 30px;
    height: 30px;
    justify-content: center;
    width: 30px;
}

.ob-smart-insights-action-icon svg {
    height: 15px;
    width: 15px;
}

.ob-smart-insights-action-callout strong {
    color: var(--ob-si-ink);
    font-size: 13px;
    font-weight: 500;
    line-height: 1.4;
}

.ob-smart-insights-report-card-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: 100%;
    min-width: 0;
}

.ob-smart-insights-report-card {
    align-items: flex-start;
    background: var(--ob-si-panel);
    border: 1px solid var(--ob-si-border-soft);
    border-radius: 8px;
    color: var(--ob-si-muted);
    display: flex;
    gap: 8px;
    max-width: 100%;
    min-width: 0;
    padding: 10px 12px;
    text-decoration: none;
}

.ob-smart-insights-report-card span {
    max-width: 100%;
    min-width: 0;
    overflow-wrap: anywhere;
}

.ob-smart-insights-report-card:hover,
.ob-smart-insights-report-card:focus-visible {
    border-color: #b4b2a9;
    box-shadow: none;
    outline: none;
}

.ob-smart-insights-report-card svg {
    color: var(--ob-si-action);
    flex: 0 0 auto;
    height: 15px;
    margin-top: 1px;
    width: 15px;
}

.ob-smart-insights-report-card strong {
    color: var(--ob-si-ink);
    display: block;
    font-size: 12px;
    font-weight: 500;
    line-height: 1.35;
    margin-bottom: 2px;
}

.ob-smart-insights-report-card small {
    color: var(--ob-si-faint);
    display: block;
    font-size: 11px;
    line-height: 1.4;
}

.ob-smart-insights-report-card.is-current,
.ob-smart-insights-report-card.is-disabled {
    cursor: default;
}

.ob-smart-insights-action-checklist ul,
.ob-smart-insights-detail-section.is-causes ul,
.ob-smart-insights-detail ul {
    display: flex;
    flex-direction: column;
    gap: 7px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.ob-smart-insights-action-checklist li,
.ob-smart-insights-detail-section.is-causes li {
    color: var(--ob-si-muted);
    font-size: 12px;
    line-height: 1.55;
    padding-left: 18px;
    position: relative;
}

.ob-smart-insights-action-checklist li::before,
.ob-smart-insights-detail-section.is-causes li::before {
    background: var(--ob-si-action);
    border-radius: 999px;
    content: "";
    height: 5px;
    left: 4px;
    position: absolute;
    top: 0.72em;
    width: 5px;
}

.ob-smart-insights-detail-section.is-causes li::before {
    background: var(--ob-si-critical);
}

.ob-smart-insights-detail-footer {
    align-items: center;
    background: var(--ob-si-panel);
    border-top: 1px solid var(--ob-si-border-soft);
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: space-between;
    max-width: 100%;
    min-width: 0;
    padding: 14px 24px;
    width: 100%;
}

.ob-smart-insights-detail-footer-meta {
    align-items: center;
    color: var(--ob-si-faint);
    display: flex;
    flex-wrap: wrap;
    font-size: 11px;
    gap: 10px;
    max-width: 100%;
    min-width: 0;
    overflow-wrap: anywhere;
}

.ob-smart-insights-detail-footer-meta strong {
    color: var(--ob-si-muted);
    font-weight: 600;
}

.ob-smart-insights-detail-footer-separator {
    color: var(--ob-si-border);
}

.ob-smart-insights-detail-footer-actions {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    max-width: 100%;
    min-width: 0;
}

.ob-smart-insights-detail-status-control {
    align-items: center;
    display: flex;
    gap: 6px;
    margin: 0;
    max-width: 100%;
    min-width: 0;
}

.ob-smart-insights-detail-status-control span {
    color: var(--ob-si-faint);
    font-size: 11px;
    font-weight: 600;
}

.ob-smart-insights-detail-status-control select.ob-smart-insights-status-select {
    background: var(--ob-si-panel);
    border: 1px solid var(--ob-si-border);
    border-radius: 6px;
    color: var(--ob-si-ink);
    font-size: 12px;
    line-height: 1.2;
    max-width: 100%;
    min-height: 30px;
    min-width: 0;
    padding: 4px 28px 4px 10px;
}

.ob-smart-insights-detail-footer .ob-smart-insights-report-cta {
    align-items: center;
    background: var(--ob-si-action);
    border-color: var(--ob-si-action);
    border-radius: 7px;
    color: #e6f1fb;
    display: inline-flex;
    font-size: 12px;
    font-weight: 500;
    gap: 6px;
    min-height: 32px;
    max-width: 100%;
    min-width: 0;
    overflow-wrap: anywhere;
    padding: 6px 14px;
    white-space: normal;
}

.ob-smart-insights-detail-footer .ob-smart-insights-report-cta:hover,
.ob-smart-insights-detail-footer .ob-smart-insights-report-cta:focus-visible {
    background: var(--ob-si-action-dark);
    border-color: var(--ob-si-action-dark);
    color: #e6f1fb;
    outline: none;
}

.ob-smart-insights-detail-footer .ob-smart-insights-report-cta svg {
    height: 14px;
    width: 14px;
}

@media (max-width: 900px) {
    .ob-smart-insights-detail-body {
        grid-template-columns: 1fr;
    }

    .ob-smart-insights-detail-main {
        border-right: 0;
    }

    .ob-smart-insights-detail-side {
        border-top: 1px solid var(--ob-si-border-soft);
    }
}

@media (max-width: 782px) {
    .ob-smart-insights-modal-panel,
    .ob-smart-insights-modal-content {
        max-height: calc(100vh - 24px);
    }

    .ob-smart-insights-modal-panel {
        width: calc(100vw - 24px);
    }

    .ob-smart-insights-detail-header {
        flex-direction: column;
        padding: 18px;
    }

    .ob-smart-insights-detail-header-actions {
        justify-content: space-between;
        width: 100%;
    }

    .ob-smart-insights-detail-main,
    .ob-smart-insights-detail-side {
        padding: 18px;
    }

    .ob-smart-insights-detail .ob-smart-insights-evidence.is-detail-evidence,
    .ob-smart-insights-detail .ob-smart-insights-evidence-table.is-flat,
    .ob-smart-insights-trend-grid,
    .ob-smart-insights-segment-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .ob-smart-insights-detail-footer {
        align-items: stretch;
        flex-direction: column;
    }

    .ob-smart-insights-detail-footer-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .ob-smart-insights-detail-status-control,
    .ob-smart-insights-detail-status-control select.ob-smart-insights-status-select,
    .ob-smart-insights-detail-footer .ob-smart-insights-report-cta {
        justify-content: center;
        width: 100%;
    }
}

@media (max-width: 480px) {
    .ob-smart-insights-modal-panel {
        max-height: calc(100vh - 16px);
        width: calc(100vw - 16px);
    }

    .ob-smart-insights-modal-content {
        max-height: calc(100vh - 16px);
    }

    .ob-smart-insights-detail-header {
        padding: 16px;
    }

    .ob-smart-insights-detail-main,
    .ob-smart-insights-detail-side {
        padding: 16px;
    }

    .ob-smart-insights-detail .ob-smart-insights-evidence.is-detail-evidence,
    .ob-smart-insights-detail .ob-smart-insights-evidence-table.is-flat,
    .ob-smart-insights-trend-grid,
    .ob-smart-insights-segment-grid {
        grid-template-columns: 1fr;
    }

    .ob-smart-insights-detail h2 {
        font-size: 18px;
    }

    .ob-smart-insights-detail-subtitle {
        overflow: visible;
        text-overflow: clip;
        white-space: normal;
    }

    .ob-smart-insights-detail-date-range,
    .ob-smart-insights-detail-entity-summary {
        min-width: 0;
        overflow-wrap: anywhere;
        white-space: normal;
    }
}

/* Fallback metric alignment for Referrers, Countries, and Browsers. */
.opti-behavior-dashboard-page .referrers-widget .referrers-table-container,
.opti-behavior-dashboard-page .countries-widget .countries-table-container,
.opti-behavior-dashboard-page .browsers-widget .browsers-table-container {
	max-width: 100%;
	margin-right: 0;
	padding-right: 0;
	overflow-x: hidden !important;
	overflow-y: auto;
}

.opti-behavior-dashboard-page .referrers-widget .referrers-table,
.opti-behavior-dashboard-page .countries-widget .countries-table,
.opti-behavior-dashboard-page .browsers-widget .browsers-table {
	width: 100%;
	min-width: 0 !important;
	table-layout: fixed;
}

.opti-behavior-dashboard-page .referrers-widget tbody tr.ob-metric-row,
.opti-behavior-dashboard-page .countries-widget tbody tr.ob-metric-row,
.opti-behavior-dashboard-page .browsers-widget tbody tr.ob-metric-row {
	display: table-row;
	width: 100%;
}

.opti-behavior-dashboard-page .referrers-widget tbody td,
.opti-behavior-dashboard-page .countries-widget tbody td,
.opti-behavior-dashboard-page .browsers-widget tbody td {
	display: table-cell;
	vertical-align: middle;
}

.opti-behavior-dashboard-page .referrers-widget .referrer-name-cell,
.opti-behavior-dashboard-page .countries-widget .country-name-cell,
.opti-behavior-dashboard-page .browsers-widget .browser-name-cell {
	width: auto;
	min-width: 0;
	padding-right: 12px;
}

.opti-behavior-dashboard-page .referrers-widget .referrer-visitors-cell,
.opti-behavior-dashboard-page .countries-widget .country-visitors-cell,
.opti-behavior-dashboard-page .browsers-widget .browser-visitors-cell {
	width: 194px;
	min-width: 194px;
	text-align: right;
	white-space: nowrap;
}

.opti-behavior-dashboard-page .referrers-widget .ob-metric-main,
.opti-behavior-dashboard-page .countries-widget .ob-metric-main,
.opti-behavior-dashboard-page .browsers-widget .ob-metric-main {
	max-width: 100%;
	min-width: 0;
	padding-right: 0;
}

.opti-behavior-dashboard-page .referrers-widget .ob-metric-label,
.opti-behavior-dashboard-page .countries-widget .ob-metric-label,
.opti-behavior-dashboard-page .browsers-widget .ob-metric-label,
.opti-behavior-dashboard-page .referrers-widget .referrer-name,
.opti-behavior-dashboard-page .countries-widget .country-name,
.opti-behavior-dashboard-page .browsers-widget .browser-name {
	display: inline-block;
	max-width: 100%;
	min-width: 0;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.opti-behavior-dashboard-page .referrers-widget .ob-metric-values,
.opti-behavior-dashboard-page .countries-widget .ob-metric-values,
.opti-behavior-dashboard-page .browsers-widget .ob-metric-values {
	display: inline-grid;
	grid-template-columns: 64px 48px 58px;
	align-items: center;
	justify-content: end;
	column-gap: 8px;
	width: 194px;
	max-width: 100%;
	margin-left: auto;
	white-space: nowrap;
	font-variant-numeric: tabular-nums;
}

.opti-behavior-dashboard-page .referrers-widget .ob-metric-values .visitor-count,
.opti-behavior-dashboard-page .countries-widget .ob-metric-values .visitor-count,
.opti-behavior-dashboard-page .browsers-widget .ob-metric-values .visitor-count {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	min-width: 0;
	max-width: 64px;
	margin-right: 0;
	box-sizing: border-box;
	justify-self: stretch;
	overflow: hidden;
	text-overflow: ellipsis;
}

.opti-behavior-dashboard-page .referrers-widget .ob-metric-values .visitor-percentage,
.opti-behavior-dashboard-page .countries-widget .ob-metric-values .visitor-percentage,
.opti-behavior-dashboard-page .browsers-widget .ob-metric-values .visitor-percentage {
	width: 48px;
	min-width: 0;
	margin-right: 0;
	text-align: right;
	justify-self: end;
}

.opti-behavior-dashboard-page .referrers-widget .ob-metric-values .visitor-trend,
.opti-behavior-dashboard-page .countries-widget .ob-metric-values .visitor-trend,
.opti-behavior-dashboard-page .browsers-widget .ob-metric-values .visitor-trend {
	display: inline-flex;
	align-items: center;
	width: 58px;
	min-width: 0;
	margin-left: 0;
	margin-right: 0;
	justify-content: flex-start;
	justify-self: start;
}

@media (max-width: 782px) {
	.opti-behavior-dashboard-page .referrers-widget .referrers-table-container,
	.opti-behavior-dashboard-page .countries-widget .countries-table-container,
	.opti-behavior-dashboard-page .browsers-widget .browsers-table-container {
		overflow-x: hidden !important;
	}

	.opti-behavior-dashboard-page .referrers-widget .referrers-table,
	.opti-behavior-dashboard-page .countries-widget .countries-table,
	.opti-behavior-dashboard-page .browsers-widget .browsers-table,
	.opti-behavior-dashboard-page .referrers-widget tbody,
	.opti-behavior-dashboard-page .countries-widget tbody,
	.opti-behavior-dashboard-page .browsers-widget tbody {
		display: block;
		width: 100%;
		max-width: 100%;
		min-width: 0;
	}

	.opti-behavior-dashboard-page .referrers-widget tbody tr:not(.loading-row),
	.opti-behavior-dashboard-page .countries-widget tbody tr.ob-metric-row,
	.opti-behavior-dashboard-page .browsers-widget tbody tr.ob-metric-row {
		display: grid;
		align-items: center;
		column-gap: 10px;
		grid-template-columns: minmax(0, calc(100% - 170px)) 160px;
		width: 100%;
		max-width: 100%;
		min-width: 0;
		overflow: hidden;
	}

	.opti-behavior-dashboard-page .referrers-widget tbody td,
	.opti-behavior-dashboard-page .countries-widget tbody td,
	.opti-behavior-dashboard-page .browsers-widget tbody td {
		display: block;
	}

	.opti-behavior-dashboard-page .referrers-widget .ob-metric-main,
	.opti-behavior-dashboard-page .countries-widget .ob-metric-main,
	.opti-behavior-dashboard-page .browsers-widget .ob-metric-main {
		max-width: 100%;
		min-width: 0;
		overflow: hidden;
	}

	.opti-behavior-dashboard-page .referrers-widget .referrer-visitors-cell,
	.opti-behavior-dashboard-page .countries-widget .country-visitors-cell,
	.opti-behavior-dashboard-page .browsers-widget .browser-visitors-cell {
		width: auto;
		min-width: 0;
	}

	.opti-behavior-dashboard-page .referrers-widget .ob-metric-values,
	.opti-behavior-dashboard-page .countries-widget .ob-metric-values,
	.opti-behavior-dashboard-page .browsers-widget .ob-metric-values {
		grid-template-columns: 56px 42px 50px;
		column-gap: 6px;
		width: 160px;
	}
}

@media (max-width: 430px) {
	.opti-behavior-dashboard-page .referrers-widget tbody tr:not(.loading-row),
	.opti-behavior-dashboard-page .countries-widget tbody tr.ob-metric-row,
	.opti-behavior-dashboard-page .browsers-widget tbody tr.ob-metric-row {
		grid-template-columns: minmax(0, calc(100% - 144px)) 136px;
	}

	.opti-behavior-dashboard-page .referrers-widget .ob-metric-values,
	.opti-behavior-dashboard-page .countries-widget .ob-metric-values,
	.opti-behavior-dashboard-page .browsers-widget .ob-metric-values {
		grid-template-columns: 42px 34px 50px;
		column-gap: 5px;
		width: 136px;
	}

	.opti-behavior-dashboard-page .referrers-widget .ob-metric-values .visitor-trend,
	.opti-behavior-dashboard-page .countries-widget .ob-metric-values .visitor-trend,
	.opti-behavior-dashboard-page .browsers-widget .ob-metric-values .visitor-trend {
		width: 50px;
		max-width: 50px;
		min-width: 0;
		margin-left: 0;
		margin-right: 0;
		overflow: hidden;
		font-size: 11.5px;
		gap: 1px;
	}

	.opti-behavior-dashboard-page .referrers-widget .ob-metric-values .visitor-trend svg,
	.opti-behavior-dashboard-page .countries-widget .ob-metric-values .visitor-trend svg,
	.opti-behavior-dashboard-page .browsers-widget .ob-metric-values .visitor-trend svg {
		width: 12px;
		height: 12px;
		flex: 0 0 12px;
	}
}

/* Responsive fallback for dashboard assets loaded without dashboard_styles.css. */
.dashboard-grid,
.dashboard-widget,
.widget-content,
.dashboard-stats,
.stat-card {
	min-width: 0;
	max-width: 100%;
	box-sizing: border-box;
}

.dashboard-grid {
	grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr));
}

.dashboard-stats {
	grid-template-columns: repeat(3, minmax(0, 1fr));
}

@media (max-width: 782px) {
	.dashboard-grid,
	.dashboard-stats {
		grid-template-columns: 1fr;
	}
}

/* ============================================================
   Collapsible dashboard sections (accordion)
   ============================================================ */
.dashboard-sections {
	display: flex;
	flex-direction: column;
	gap: 1.5rem;
}

.ob-dash-section {
	margin: 0;
}

/* Per-section grid keeps the existing widget spanning rules intact. */
.ob-dash-section .ob-dash-section-body .dashboard-grid {
	margin-bottom: 0;
}

/* KPI stat cards live inside Section 1's grid; span the full row. */
.ob-dash-section .ob-dash-section-body .dashboard-grid > .dashboard-stats {
	grid-column: 1 / -1;
}

/* ----------------------------------------------------------------
   Modern SaaS section header (complements the purple header bar:
   linear-gradient(135deg,#4f46e5,#7c3aed,#6d28d9)).
   ---------------------------------------------------------------- */
.ob-dash-section-header {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: space-between;
	width: 100%;
	min-height: 62px;
	gap: 1rem;
	margin: 0 0 1rem;
	padding: 0.9rem 1.35rem 0.9rem 1.5rem;
	background: linear-gradient(135deg, #ffffff 0%, #f7f7fe 100%);
	border: 1px solid #e7e5f5;
	border-radius: 16px;
	box-shadow: 0 1px 2px rgba(76, 70, 229, 0.04), 0 6px 18px rgba(76, 70, 229, 0.05);
	cursor: pointer;
	text-align: left;
	overflow: hidden;
	transition: box-shadow 0.22s ease, border-color 0.22s ease, transform 0.22s ease, background 0.22s ease;
}

.ob-dash-section-header::before {
	content: "";
	position: absolute;
	left: 0;
	top: 0;
	bottom: 0;
	width: 4px;
	background: linear-gradient(180deg, #4f46e5 0%, #7c3aed 50%, #6d28d9 100%);
	opacity: 0;
	transition: opacity 0.22s ease;
}

.ob-dash-section-header:hover {
	border-color: #c7c2f0;
	box-shadow: 0 2px 4px rgba(76, 70, 229, 0.08), 0 10px 26px rgba(76, 70, 229, 0.12);
	transform: translateY(-1px);
}

.ob-dash-section-header:hover::before,
.ob-dash-section:not(.is-collapsed) .ob-dash-section-header::before {
	opacity: 1;
}

.ob-dash-section:not(.is-collapsed) .ob-dash-section-header {
	background: linear-gradient(135deg, #f5f3ff 0%, #eef2ff 100%);
	border-color: #c7c2f0;
}

.ob-dash-section-header:focus-visible {
	outline: 2px solid #6d28d9;
	outline-offset: 2px;
}

.ob-dash-section-heading {
	display: inline-flex;
	align-items: center;
	gap: 0.6rem;
	flex: 0 0 auto;
	position: relative;
	z-index: 2;
}

.ob-dash-section-marker {
	width: 9px;
	height: 9px;
	border-radius: 50%;
	background: linear-gradient(135deg, #7c3aed 0%, #6d28d9 100%);
	box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.12);
	flex: 0 0 auto;
}

.ob-dash-section-title {
	font-size: 1.02rem;
	font-weight: 700;
	letter-spacing: -0.01em;
	color: #1e1b4b;
}

/* --- Summary teaser chips --- */
/* Pin the chips group to the TRUE horizontal center of the full header row
   (independent of title/chevron width) so chip columns line up across every
   section. Title stays left, chevron stays right (flex space-between). */
.ob-dash-section-summary {
	position: absolute;
	left: 50%;
	top: 50%;
	transform: translate(-50%, -50%);
	display: flex;
	flex-wrap: nowrap;
	align-items: center;
	justify-content: center;
	gap: 0.6rem;
	min-width: 0;
	z-index: 1;
	pointer-events: none;
}

.ob-dash-chip {
	display: inline-flex;
	align-items: center;
	gap: 0.5rem;
	flex: 0 0 160px;
	width: 160px;
	max-width: 160px;
	padding: 0.34rem 0.7rem;
	background: rgba(255, 255, 255, 0.85);
	border: 1px solid #e7e5f5;
	border-radius: 9999px;
	box-shadow: 0 1px 2px rgba(76, 70, 229, 0.05);
	transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.ob-dash-section-header:hover .ob-dash-chip {
	border-color: #d6d2f2;
}

.ob-dash-chip-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 24px;
	height: 24px;
	border-radius: 8px;
	background: linear-gradient(135deg, #eef2ff 0%, #f5f3ff 100%);
	color: #6d28d9;
	flex: 0 0 auto;
}

.ob-dash-chip-icon svg {
	width: 14px;
	height: 14px;
}

.ob-dash-chip-body {
	display: flex;
	flex-direction: column;
	line-height: 1.15;
	min-width: 0;
}

.ob-dash-chip-label {
	font-size: 0.64rem;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	color: #8b87a8;
	white-space: nowrap;
}

.ob-dash-chip-value {
	font-size: 0.82rem;
	font-weight: 700;
	color: #1e1b4b;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

/* Empty/degraded chip value. */
.ob-dash-chip.is-empty .ob-dash-chip-value {
	color: #b6b2cc;
	font-weight: 600;
}

.ob-dash-chip.is-empty .ob-dash-chip-icon {
	color: #b6b2cc;
	background: #f3f2fa;
}

/* Skeleton loading shimmer. */
.ob-dash-chip.is-loading {
	min-width: 138px;
}

.ob-dash-chip.is-loading .ob-dash-chip-icon {
	background: #ece9f7;
	color: transparent;
}

.ob-dash-chip.is-loading .ob-dash-chip-label,
.ob-dash-chip.is-loading .ob-dash-chip-value {
	border-radius: 4px;
	background: linear-gradient(90deg, #ece9f7 25%, #f4f2fb 37%, #ece9f7 63%);
	background-size: 400% 100%;
	animation: obChipShimmer 1.4s ease infinite;
	color: transparent;
}

.ob-dash-chip.is-loading .ob-dash-chip-label {
	width: 48px;
	height: 7px;
	margin-bottom: 4px;
}

.ob-dash-chip.is-loading .ob-dash-chip-value {
	width: 64px;
	height: 10px;
}

@keyframes obChipShimmer {
	0% { background-position: 100% 0; }
	100% { background-position: 0 0; }
}

.ob-dash-section-toggle {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 30px;
	height: 30px;
	border-radius: 50%;
	background: rgba(124, 58, 237, 0.08);
	color: #6d28d9;
	flex: 0 0 auto;
	position: relative;
	z-index: 2;
	transition: transform 0.25s ease, background 0.2s ease;
}

.ob-dash-section-header:hover .ob-dash-section-toggle {
	background: rgba(124, 58, 237, 0.16);
}

.ob-dash-section-toggle svg {
	width: 18px;
	height: 18px;
}

/* Collapsed: hide body, rotate chevron to point right. */
.ob-dash-section.is-collapsed .ob-dash-section-body {
	display: none;
}

.ob-dash-section.is-collapsed .ob-dash-section-toggle {
	transform: rotate(-90deg);
}

/* Smooth reveal when a section expands. */
.ob-dash-section:not(.is-collapsed) .ob-dash-section-body {
	animation: obSectionReveal 0.28s ease both;
}

@keyframes obSectionReveal {
	from { opacity: 0; transform: translateY(-6px); }
	to { opacity: 1; transform: translateY(0); }
}

/* Hide teaser chips once a section is expanded (the real widgets show the data). */
.ob-dash-section:not(.is-collapsed) .ob-dash-section-summary {
	display: none;
}

@media (max-width: 782px) {
	.ob-dash-section-header {
		flex-wrap: wrap;
	}
	.ob-dash-section-summary {
		position: static;
		transform: none;
		order: 3;
		flex: 1 1 100%;
		flex-wrap: wrap;
		width: 100%;
		justify-content: flex-start;
		margin: 0.6rem 0 0;
		pointer-events: auto;
	}
	.ob-dash-chip {
		flex: 1 1 auto;
		width: auto;
		max-width: none;
	}
}

@media (prefers-reduced-motion: reduce) {
	.ob-dash-section-header,
	.ob-dash-section-toggle,
	.ob-dash-chip {
		transition: none;
	}
	.ob-dash-section:not(.is-collapsed) .ob-dash-section-body {
		animation: none;
	}
	.ob-dash-chip.is-loading .ob-dash-chip-label,
	.ob-dash-chip.is-loading .ob-dash-chip-value {
		animation: none;
	}
}
