/* ==========================================================================
   Minilytics Dashboard | Ultra-Minimalist CSS
   Inspired by Images 1, 2, 3 (Linear / Vercel / Swetrix aesthetic).
   Pure neutral palette, refined Inter typography, distraction-free.
   ========================================================================== */

:root {
    --bg-body: #fafafa;
    --bg-surface: #ffffff;
    --bg-sidebar: #f8fafc;
    --bg-sidebar-hover: #f1f5f9;
    --bg-subtle: #f8fafc;
    --bg-active: #ffffff;

    --border: #e2e8f0;
    --border-light: #f1f5f9;
    --border-card: #e2e8f0;

    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;

    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --primary-subtle: #eef2ff;

    --success: #10b981;
    --success-bg: #ecfdf5;
    --success-text: #047857;

    --danger: #ef4444;
    --danger-bg: #fef2f2;
    --danger-text: #b91c1c;

    --warning: #f59e0b;
    --warning-bg: #fffbeb;

    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-full: 9999px;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.04);
    --shadow-modal: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);

    --sidebar-width: 230px;
    --sidebar-collapsed-width: 68px;
    --transition: all 0.15s ease;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 14px;
    background-color: var(--bg-body);
    color: var(--text-primary);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    min-height: 100vh;
}

/* Master Layout */
.app-container {
    display: flex;
    width: 100%;
    min-height: 100vh;
    background-color: var(--bg-body);
}

.mobile-nav-backdrop {
    display: none;
}

.main-wrapper {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.content-container {
    padding: 24px 32px 48px 32px;
    flex: 1;
}

/* ==========================================================================
   1. Standalone Portal Mode (Websites Management)
   ========================================================================== */
.app-container.is-portal .sidebar {
    display: none !important;
}

.app-container.is-portal .top-header {
    display: none !important;
}

.app-container.is-portal .main-wrapper {
    max-width: 1140px;
    margin: 0 auto;
    width: 100%;
    padding: 44px 24px 64px 24px;
}

.app-container.is-portal .content-container {
    padding: 0;
}

.portal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border);
}

.portal-brand-block {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-logo-emblem {
    display: flex;
    align-items: center;
    gap: 12px;
}

.portal-brand-text {
    font-size: 20px;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.03em;
    line-height: 1.1;
}

.portal-subtitle {
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 400;
}

.empty-site-onboarding { padding: 54px 20px !important; }
.empty-site-onboarding::before { content: '↗'; display: grid; place-items: center; width: 38px; height: 38px; margin: 0 auto 12px; border-radius: 10px; background: #eff6ff; color: #2563eb; font-size: 20px; font-weight: 700; }
.empty-add-site { margin-top: 16px; }

/* Websites 3-Column KPI Grid */
.websites-kpi-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.kpi-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.kpi-card:hover {
    border-color: #cbd5e1;
}

.kpi-label {
    font-size: 11.5px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.kpi-value-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 2px 0;
}

.kpi-number {
    font-size: 26px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.02em;
    line-height: 1.2;
}

.kpi-hint {
    font-size: 12px;
    color: var(--text-muted);
}

/* Websites Table Specifics (Image 1 Style) */
.site-table-avatar {
    width: 26px;
    height: 26px;
    border-radius: 6px;
    background: #f8fafc;
    border: 1px solid var(--border);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
    padding: 3px;
}

.site-favicon-img {
    width: 100%;
    height: 100%;
    border-radius: 3px;
    object-fit: contain;
    flex-shrink: 0;
}

.site-table-name {
    font-weight: 600;
    font-size: 13.5px;
    color: var(--text-primary);
    text-decoration: underline;
    text-underline-offset: 3px;
    text-decoration-color: #cbd5e1;
}

.site-table-domain {
    font-size: 13px;
    color: var(--text-secondary);
}

.site-table-time {
    font-size: 13px;
    color: var(--text-muted);
}

.table-records-footer {
    padding: 12px 18px;
    font-size: 12.5px;
    color: var(--text-muted);
    background: #ffffff;
    border-top: 1px solid var(--border-light);
}

/* ==========================================================================
   2. Sleek Neutral Gray Sidebar (Site Analytics Mode)
   ========================================================================== */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 20px 16px;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    height: 100vh;
    z-index: 40;
    transition: width 0.22s cubic-bezier(0.4, 0, 0.2, 1), padding 0.22s ease;
    overflow-x: hidden;
    overflow-y: auto;
}

.sidebar-top {
    display: flex;
    flex-direction: column;
}

.sidebar-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    padding: 2px 2px;
}

.sidebar-brand-link {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: inherit;
    min-width: 0;
}

.sidebar-brand-icon {
    border-radius: 7px;
    flex-shrink: 0;
    display: block;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.sidebar-brand-text {
    font-weight: 800;
    font-size: 15px;
    color: var(--text-primary);
    letter-spacing: -0.02em;
    white-space: nowrap;
    transition: opacity 0.15s ease;
}

.btn-sidebar-collapse {
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    cursor: pointer;
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: var(--transition);
    flex-shrink: 0;
}

.btn-sidebar-collapse:hover {
    background: var(--bg-sidebar-hover);
    color: var(--text-primary);
    border-color: var(--border);
}

.icon-collapse-arrow {
    transition: transform 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-back-websites {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 10px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 12.5px;
    font-weight: 600;
    text-decoration: none;
    margin-bottom: 16px;
    transition: var(--transition);
}

.btn-back-websites:hover {
    background: #ffffff;
    color: var(--text-primary);
    border-color: #cbd5e1;
}

.sidebar-site-box {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
    box-shadow: var(--shadow-sm);
}

.site-avatar {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    background: #f8fafc;
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
    padding: 3px;
    position: relative;
}

.site-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 3px;
}

.site-avatar-fallback {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    color: var(--text-secondary);
}

.site-meta {
    overflow: hidden;
}

.site-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.site-sub {
    font-size: 11px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 4px;
}

.live-dot-green {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--success);
    display: inline-block;
}

.nav-section-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0 8px;
    margin-bottom: 8px;
}

.sidebar-nav {
    width: 100%;
}

.nav-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.nav-item a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    border: 1px solid transparent;
    transition: var(--transition);
}

.nav-item a:hover {
    background: var(--bg-sidebar-hover);
    color: var(--text-primary);
}

.nav-item.active a {
    background: #ffffff;
    color: var(--text-primary);
    font-weight: 600;
    border-color: var(--border);
    box-shadow: var(--shadow-sm);
}

.nav-item a svg {
    color: var(--text-muted);
    flex-shrink: 0;
    transition: var(--transition);
}

.nav-item.active a svg {
    color: var(--primary);
}

.sidebar-footer {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
}

.footer-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    border-radius: var(--radius-sm);
    font-size: 12.5px;
    color: var(--text-secondary);
    text-decoration: none;
    transition: var(--transition);
}

.footer-link:hover {
    color: var(--text-primary);
    background: var(--bg-sidebar-hover);
}

.sidebar-user-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    min-width: 0;
}

.user-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #e2e8f0;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 11px;
    flex: 0 0 24px;
}

.user-info {
    min-width: 0;
    flex: 1;
}

.user-name {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
    display: block;
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-role {
    font-size: 10.5px;
    color: var(--text-muted);
    display: block;
}

/* ==========================================================================
   2.1 Collapsed Sidebar State
   ========================================================================== */
.sidebar.collapsed,
html.sidebar-preload-collapsed .sidebar {
    width: var(--sidebar-collapsed-width);
    padding: 16px 8px;
}

.sidebar.collapsed .sidebar-header-row,
html.sidebar-preload-collapsed .sidebar .sidebar-header-row {
    position: relative;
    justify-content: center;
    margin-bottom: 14px;
    padding: 0;
}

.sidebar.collapsed .sidebar-brand-link,
html.sidebar-preload-collapsed .sidebar .sidebar-brand-link {
    justify-content: center;
    width: 100%;
    transition: opacity .15s ease;
}

.sidebar.collapsed .sidebar-brand-text,
html.sidebar-preload-collapsed .sidebar .sidebar-brand-text {
    display: none;
}

.sidebar.collapsed .icon-collapse-arrow {
    transform: rotate(180deg);
}

/* When the compact navigation is hovered, its expand control takes the
   logo's place instead of adding a second row beneath it. */
.sidebar.collapsed .btn-sidebar-collapse,
html.sidebar-preload-collapsed .sidebar .btn-sidebar-collapse {
    position: absolute;
    inset: 0;
    width: 32px;
    height: 32px;
    margin: auto;
    opacity: 0;
    pointer-events: none;
}
.sidebar.collapsed:hover .sidebar-brand-link,
html.sidebar-preload-collapsed .sidebar:hover .sidebar-brand-link {
    opacity: 0;
    pointer-events: none;
}
.sidebar.collapsed:hover .btn-sidebar-collapse,
html.sidebar-preload-collapsed .sidebar:hover .btn-sidebar-collapse,
.sidebar.collapsed .btn-sidebar-collapse:focus-visible,
html.sidebar-preload-collapsed .sidebar .btn-sidebar-collapse:focus-visible {
    opacity: 1;
    pointer-events: auto;
}

.sidebar.collapsed .btn-back-websites,
html.sidebar-preload-collapsed .sidebar .btn-back-websites {
    justify-content: center;
    padding: 8px 0;
    margin-bottom: 12px;
    width: 100%;
}

.sidebar.collapsed .btn-back-websites span,
html.sidebar-preload-collapsed .sidebar .btn-back-websites span {
    display: none;
}

.sidebar.collapsed .sidebar-site-box,
html.sidebar-preload-collapsed .sidebar .sidebar-site-box {
    justify-content: center;
    padding: 8px 0;
    margin-bottom: 14px;
}

.sidebar.collapsed .sidebar-site-box .site-meta,
html.sidebar-preload-collapsed .sidebar .sidebar-site-box .site-meta {
    display: none;
}

.sidebar.collapsed .sidebar-site-box .site-avatar,
html.sidebar-preload-collapsed .sidebar .sidebar-site-box .site-avatar {
    margin: 0 auto;
    width: 32px;
    height: 32px;
    position: relative;
}

.sidebar.collapsed .sidebar-site-box .site-avatar::after,
html.sidebar-preload-collapsed .sidebar .sidebar-site-box .site-avatar::after {
    content: '';
    position: absolute;
    bottom: -1px;
    right: -1px;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--success);
    border: 1.5px solid #ffffff;
}

.sidebar.collapsed .nav-section-label,
html.sidebar-preload-collapsed .sidebar .nav-section-label {
    display: none;
}

.sidebar.collapsed .nav-item a,
html.sidebar-preload-collapsed .sidebar .nav-item a {
    justify-content: center;
    padding: 9px 0;
    gap: 0;
    width: 100%;
}

.sidebar.collapsed .nav-title,
html.sidebar-preload-collapsed .sidebar .nav-title {
    display: none;
}

.sidebar.collapsed .nav-item a svg,
html.sidebar-preload-collapsed .sidebar .nav-item a svg {
    width: 18px;
    height: 18px;
}

.sidebar.collapsed .footer-link,
html.sidebar-preload-collapsed .sidebar .footer-link {
    justify-content: center;
    padding: 8px 0;
    width: 100%;
}

.sidebar.collapsed .footer-link span,
html.sidebar-preload-collapsed .sidebar .footer-link span {
    display: none;
}

.sidebar.collapsed .sidebar-user-row,
html.sidebar-preload-collapsed .sidebar .sidebar-user-row {
    justify-content: center;
    padding: 6px 0;
}

.sidebar.collapsed .user-info,
html.sidebar-preload-collapsed .sidebar .user-info {
    display: none;
}

.sidebar.collapsed .user-avatar,
html.sidebar-preload-collapsed .sidebar .user-avatar {
    margin: 0 auto;
}

.portal-brand-logo-img {
    border-radius: 9px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

/* ==========================================================================
   3. Top Header (Analytics Mode)
   ========================================================================== */
.top-header {
    height: 60px;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border);
    padding: 0 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 30;
}

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

/* The navigation drawer is available from the header on phones only. */
.btn-sidebar-toggle-header {
    display: none;
}

.header-title-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-page-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

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

.live-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--success-bg);
    color: var(--success-text);
    padding: 3px 9px;
    border-radius: var(--radius-full);
    font-size: 11.5px;
    font-weight: 600;
    border: 1px solid #d1fae5;
}

.pulse-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--success);
    display: inline-block;
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.6); }
    70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.range-selector-wrapper {
    position: relative;
    display: inline-block;
}

.range-selector {
    position: relative;
    display: flex;
    align-items: center;
}

.range-selector svg {
    position: absolute;
    left: 10px;
    color: var(--text-muted);
    pointer-events: none;
}

.range-selector select, select.select-filter {
    appearance: none;
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 6px 28px 6px 30px;
    font-size: 12.5px;
    font-weight: 500;
    color: var(--text-primary);
    cursor: pointer;
    outline: none;
    font-family: inherit;
    transition: var(--transition);
}

.range-selector select:hover, select.select-filter:hover {
    border-color: #cbd5e1;
}

.range-selector::after {
    content: "";
    position: absolute;
    right: 10px;
    width: 0;
    height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 4px solid var(--text-secondary);
    pointer-events: none;
}

/* Custom Date Range Popover */
.custom-range-popover {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 280px;
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.05);
    z-index: 1000;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    animation: popoverFadeIn 0.15s ease-out;
}

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

.custom-range-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-light);
}

.custom-range-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

.btn-close-popover {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2px;
    border-radius: 4px;
    transition: var(--transition);
}

.btn-close-popover:hover {
    color: var(--text-primary);
    background: #f1f5f9;
}

.custom-range-body {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.custom-range-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.custom-range-field label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.custom-range-input {
    width: 100%;
    padding: 6px 10px;
    font-size: 13px;
    font-family: inherit;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    background: #f8fafc;
    outline: none;
    transition: var(--transition);
}

.custom-range-input:focus {
    border-color: #0f172a;
    background: #ffffff;
}

/* Dependency-free calendar used for the session day filter and custom ranges. */
.calendar-input { cursor: pointer; }
.calendar-popover {
    position: fixed;
    z-index: 2147483647;
    width: 320px;
    padding: 14px;
    box-sizing: border-box;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--bg-surface);
    box-shadow: 0 18px 36px rgba(15, 23, 42, 0.16), 0 4px 10px rgba(15, 23, 42, 0.06);
    color: var(--text-primary);
}
.calendar-popover[hidden] { display: none; }
.calendar-popover-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px;
    margin-bottom: 12px;
    border: 1px solid #e2e8f0;
    border-radius: 9px;
    background: #f8fafc;
    text-transform: capitalize;
    font-size: 13px;
}
.calendar-month-select, .calendar-year-select {
    height: 32px;
    border: 1px solid transparent;
    border-radius: 7px;
    background: transparent;
    color: var(--text-primary);
    font: inherit;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    outline: none;
}
.calendar-month-select:hover, .calendar-year-select:hover,
.calendar-month-select:focus, .calendar-year-select:focus {
    border-color: #bfdbfe;
    background: #ffffff;
}
.calendar-month-select { flex: 1; min-width: 0; padding: 0 8px; }
.calendar-year-select { width: 78px; padding: 0 5px; }
.calendar-month-nav {
    width: 28px;
    height: 28px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--text-primary);
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
}
.calendar-month-nav:hover, .calendar-day:hover { background: var(--bg-sidebar-hover); }
.calendar-weekdays, .calendar-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    text-align: center;
}
.calendar-weekdays {
    margin: 0 2px 6px;
    color: var(--text-muted);
    font-size: 10.5px;
    font-weight: 700;
    text-transform: uppercase;
}
.calendar-weekdays span { padding: 4px 0; }
.calendar-day {
    width: 36px;
    height: 34px;
    margin: 2px auto;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--text-primary);
    font: inherit;
    font-size: 12px;
    cursor: pointer;
}
.calendar-day.is-today { color: #2563eb; font-weight: 700; box-shadow: inset 0 0 0 1px #93c5fd; }
.calendar-day.is-selected { background: #2563eb; color: #ffffff; font-weight: 700; box-shadow: 0 2px 5px rgba(37, 99, 235, 0.25); }
.calendar-day--blank { height: 34px; }
.calendar-today {
    width: 100%;
    margin-top: 12px;
    padding: 10px 0 1px;
    border: 0;
    border-top: 1px solid var(--border);
    background: transparent;
    color: #2563eb;
    font: inherit;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
}

.custom-range-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    padding-top: 10px;
    border-top: 1px solid var(--border-light);
}

.custom-range-footer .btn-sm {
    padding: 5px 12px;
    font-size: 12px;
    font-weight: 500;
    border-radius: var(--radius-sm);
}

.btn-primary {
    background: #0f172a;
    color: #ffffff;
    border: 1px solid #0f172a;
    padding: 7px 14px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}

.btn-primary:hover {
    background: #1e293b;
    border-color: #1e293b;
}

.btn-outline {
    background: #ffffff;
    color: var(--text-primary);
    border: 1px solid var(--border);
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    font-size: 12.5px;
    font-weight: 500;
    font-family: inherit;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}

.btn-outline:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
}

.btn-icon {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: #ffffff;
    color: var(--text-secondary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
}

.btn-icon:hover {
    background: #f8fafc;
    color: var(--text-primary);
    border-color: #cbd5e1;
}

/* ==========================================================================
   4. Filter Toolbar & Search Inputs
   ========================================================================== */
.filter-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 18px;
    flex-wrap: wrap;
}

.search-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
    max-width: 360px;
}

.search-input-wrapper svg {
    position: absolute;
    left: 11px;
    color: var(--text-muted);
    pointer-events: none;
}

.search-input {
    width: 100%;
    padding: 7px 12px 7px 34px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-family: inherit;
    color: var(--text-primary);
    background: #ffffff;
    outline: none;
    transition: var(--transition);
}

.search-input:focus {
    border-color: var(--text-primary);
    box-shadow: 0 0 0 1px var(--text-primary);
}

.date-filter-wrapper {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.date-filter-icon {
    position: absolute;
    left: 10px;
    pointer-events: none;
    color: var(--text-muted);
}

.date-filter-input {
    height: 38px;
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 6px 30px 6px 32px;
    font-size: 12.5px;
    font-weight: 500;
    color: var(--text-primary);
    cursor: pointer;
    outline: none;
    font-family: inherit;
    transition: var(--transition);
}

.date-filter-input:hover,
.date-filter-input:focus {
    border-color: #cbd5e1;
}

.btn-clear-date {
    position: absolute;
    right: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: none;
    background: #f1f5f9;
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition);
}

.btn-clear-date:hover {
    background: #e2e8f0;
    color: var(--text-primary);
}

.sessions-count-badge {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    background: #ffffff;
    padding: 7px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    display: inline-flex;
    align-items: center;
    box-shadow: var(--shadow-sm);
    white-space: nowrap;
}

/* ==========================================================================
   5. Overview Page (Inspired by Image 2 Aesthetic)
   ========================================================================== */
.overview-top-section {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
    margin-bottom: 24px;
}

@media (max-width: 1024px) {
    .overview-top-section {
        grid-template-columns: 1fr;
    }
}

.chart-container-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 20px 24px;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
}

.chart-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 14px;
}

.chart-header-controls {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    flex-wrap: wrap;
}

.chart-eyebrow {
    font-size: 11.5px;
    font-weight: 700;
    color: var(--text-muted);
    letter-spacing: 0.05em;
    text-transform: uppercase;
    display: block;
    margin-bottom: 2px;
}

.chart-big-stat-row {
    display: flex;
    align-items: baseline;
    gap: 10px;
}

.chart-big-number {
    font-size: 28px;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.03em;
    font-variant-numeric: tabular-nums;
}

.chart-legend-metrics-row {
    display: flex;
    align-items: center;
    gap: 18px;
    margin-top: 4px;
    flex-wrap: wrap;
}

.chart-metric-indicator {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

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

.metric-val {
    font-size: 20px;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
}

.metric-name {
    font-size: 12.5px;
    font-weight: 500;
    color: var(--text-muted);
}

.chart-metric-toggles, .tab-buttons {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    background: #f1f5f9;
    padding: 3px;
    border-radius: var(--radius-sm);
}

.chart-toggle-btn {
    border: none;
    background: transparent;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    border-radius: 4px;
    cursor: pointer;
    font-family: inherit;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.chart-toggle-btn .toggle-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    display: inline-block;
}

.chart-toggle-btn.active {
    background: #ffffff;
    color: var(--text-primary);
    font-weight: 600;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

.chart-toggle-btn:not(.active) {
    opacity: 0.45;
    background: transparent;
    color: var(--text-muted);
}

.chart-tooltip-metrics-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.canvas-wrapper {
    width: 100%;
    height: 260px;
    position: relative;
}

.chart-canvas {
    width: 100%;
    height: 100%;
    display: block;
    cursor: pointer;
}

/* Floating Chart Hover Tooltip / Légende */
.chart-tooltip {
    position: absolute;
    z-index: 50;
    pointer-events: none;
    width: min(300px, calc(100% - 8px));
    min-width: 0;
    background: #ffffff;
    color: #0f172a;
    padding: 14px 16px;
    border-radius: 12px;
    font-family: inherit;
    box-shadow: 0 16px 32px -10px rgba(15, 23, 42, 0.2), 0 6px 12px -6px rgba(15, 23, 42, 0.12);
    border: 1px solid #e2e8f0;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.12s ease, transform 0.1s ease;
    white-space: nowrap;
    line-height: 1.4;
    box-sizing: border-box;
    max-height: 190px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.chart-tooltip.is-interactive { pointer-events: auto; }

.chart-tooltip.visible {
    opacity: 1;
    visibility: visible;
}

.chart-tooltip-date {
    font-size: 13px;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 6px;
    padding-bottom: 6px;
    border-bottom: 1px solid #e2e8f0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.chart-tooltip-pinned {
    float: right;
    padding: 2px 6px;
    border-radius: 999px;
    background: #dbeafe;
    color: #1d4ed8;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
}

.chart-tooltip-metric {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 500;
    color: #334155;
}
.chart-tooltip-metric.is-actionable {
    width: 100%;
    border: 0;
    border-radius: 6px;
    padding: 4px 5px;
    margin: -4px -5px;
    background: transparent;
    font: inherit;
    text-align: left;
    cursor: pointer;
}
.chart-tooltip-metric.is-actionable:hover { background: #f1f5f9; }

.chart-tooltip-dot {
    width: 12px;
    height: 12px;
    border-radius: 3px;
    background: #818cf8;
    display: inline-block;
    flex-shrink: 0;
}

.chart-tooltip-val {
    margin-left: auto;
    font-size: 14px;
    font-weight: 700;
    color: #0f172a;
    flex-shrink: 0;
}

.chart-tooltip-name {
    min-width: 0;
    flex: 1 1 auto;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 13px;
    font-weight: 500;
    color: #64748b;
}
.chart-tooltip-anomaly {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 15px;
    height: 15px;
    border-radius: 50%;
    background: #fef3c7;
    color: #b45309;
    font-size: 11px;
    font-weight: 800;
    line-height: 1;
}

.chart-tooltip-hint {
    margin-top: 10px;
    padding-top: 9px;
    border-top: 1px solid #e2e8f0;
    font-size: 11px;
    font-weight: 600;
    color: var(--primary);
}
.chart-tooltip-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 7px;
    padding-top: 7px;
    border-top: 1px solid #e2e8f0;
}
.chart-tooltip-actions button:first-child {
    flex: 1;
    border: 0;
    border-radius: 6px;
    padding: 7px 9px;
    background: #0f172a;
    color: #ffffff;
    font: inherit;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
}
.chart-tooltip-actions button:first-child:hover { background: #334155; }
.chart-tooltip-unpin {
    width: 28px;
    height: 28px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    background: #ffffff;
    color: #64748b;
    font: inherit;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
}
.chart-tooltip-metrics-list {
    flex: 0 1 auto;
    max-height: 84px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 transparent;
}

/* ==========================================================================
   5. Overview Page (Inspired by Umami Layout)
   ========================================================================== */
.umami-stats-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

@media (max-width: 1100px) {
    .umami-stats-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 700px) {
    .umami-stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.umami-stat-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 18px 20px;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 105px;
    transition: var(--transition);
}

.umami-stat-card:hover {
    border-color: #cbd5e1;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.04);
}

.umami-stat-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
    letter-spacing: -0.01em;
}

.umami-stat-value {
    font-size: 28px;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.03em;
    line-height: 1;
    margin-bottom: 10px;
    font-variant-numeric: tabular-nums;
}

.umami-stat-delta {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11.5px;
    font-weight: 700;
    width: fit-content;
    border-radius: 4px;
    padding: 2px 6px;
}

.umami-stat-delta.positive {
    background: #ecfdf5;
    color: #059669;
}

.umami-stat-delta.negative {
    background: #fef2f2;
    color: #dc2626;
}

.umami-stat-delta.neutral {
    background: #f1f5f9;
    color: #94a3b8;
}

.full-width-chart {
    width: 100%;
    margin-bottom: 24px;
    padding: 24px;
    border-radius: var(--radius-md);
}

/* 4 Breakdown Cards (Generous Padding & Spacing) */
.overview-breakdowns-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
    margin-top: 4px;
}

@media (max-width: 900px) {
    .overview-breakdowns-grid {
        grid-template-columns: 1fr;
    }
}

.breakdown-card {
    padding: 24px;
    border-radius: var(--radius-md);
}

.breakdown-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.breakdown-header-title-group {
    display: flex;
    align-items: center;
    gap: 9px;
}

.breakdown-header-icon {
    color: var(--text-secondary);
}

.breakdown-card-title {
    font-size: 15.5px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.breakdown-card-sub {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
}

.card-column-headers {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 11.5px;
    color: var(--text-muted);
    font-weight: 600;
    margin-bottom: 10px;
    padding: 0 14px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.clean-pill-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 0;
    padding: 0;
    max-height: 400px;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 4px;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 transparent;
}

.clean-pill-list::-webkit-scrollbar {
    width: 6px;
}

.clean-pill-list::-webkit-scrollbar-track {
    background: transparent;
}

.clean-pill-list::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

.clean-pill-list::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

.clean-pill-row {
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #f8fafc;
    border: 1px solid #f1f5f9;
    padding: 10px 16px;
    border-radius: 8px;
    font-size: 13px;
    transition: var(--transition);
}

.clean-pill-row:hover {
    background: #f1f5f9;
    border-color: #e2e8f0;
}

.clean-pill-row.empty {
    justify-content: center;
    background: transparent;
    border: 1px dashed var(--border);
    padding: 24px;
}

.pill-muted {
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 500;
}

.pill-progress-bg {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    background: #e0f2fe; /* Soft light-blue progress fill */
    border-radius: 7px;
    pointer-events: none;
    z-index: 0;
    transition: width 0.35s ease;
}

.pill-left {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    flex: 1;
}

.pill-right {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.pill-title {
    font-weight: 600;
    color: #1e293b;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pill-stat {
    font-weight: 700;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
    font-size: 13px;
}

.pill-pct {
    font-size: 11.5px;
    font-weight: 500;
    color: var(--text-muted);
    min-width: 38px;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.country-pill-code {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 10.5px;
    font-weight: 700;
    font-family: monospace;
    color: var(--text-secondary);
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    padding: 1px 5px;
    min-width: 24px;
    text-align: center;
    letter-spacing: 0.05em;
    flex-shrink: 0;
}

.pill-favicon {
    width: 16px;
    height: 16px;
    border-radius: 3px;
    object-fit: contain;
    flex-shrink: 0;
}

.pill-flag {
    font-size: 16px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.country-flag-wrap {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    vertical-align: middle;
    line-height: 1;
    flex-shrink: 0;
}

.country-flag-img {
    /* Preserve the flag's full aspect ratio. `cover` clips wide flags inside
       the fixed presentation box. */
    border-radius: 2px;
    box-shadow: 0 0 1px rgba(0, 0, 0, 0.4);
    object-fit: contain;
    vertical-align: middle;
    display: block;
    max-width: none;
}

.country-flag-unknown {
    font-size: 13px;
    line-height: 1;
    display: inline-block;
    vertical-align: middle;
}

.country-sub-code {
    font-size: 11px;
    font-family: var(--font-mono, monospace);
    color: var(--text-muted);
    font-weight: 600;
    margin-left: 4px;
}

.brand-icon-svg {
    display: inline-block;
    vertical-align: middle;
    flex-shrink: 0;
}

.session-badge-country {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.session-meta-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.tech-item {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.tech-sep {
    color: #94a3b8;
    margin: 0 4px;
}

.pill-icon-box {
    font-size: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.pill-icon-direct {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    flex-shrink: 0;
}

.pill-divider {
    color: #94a3b8;
    margin: 0 4px;
    font-weight: 400;
}

/* ==========================================================================
   6. Sessions Page (Real Visitor Data)
   ========================================================================== */
.sessions-cards-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Day Delimiters between Sessions of different days */
.session-day-delimiter {
    display: flex;
    align-items: center;
    gap: 14px;
    margin: 18px 0 10px 0;
    user-select: none;
}

.session-day-delimiter:first-child {
    margin-top: 4px;
}

.session-day-line {
    flex: 1;
    height: 1px;
    background: var(--border);
}

.session-day-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 14px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    transition: var(--transition);
}

.session-day-badge:hover {
    border-color: #cbd5e1;
    color: var(--text-primary);
    transform: translateY(-1px);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.session-card-item {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 14px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    transition: var(--transition);
}

.session-card-item:hover {
    border-color: #cbd5e1;
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.04);
}

.session-card-left {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
    flex: 1;
}

.session-avatar-wrap {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #f8fafc;
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    flex-shrink: 0;
}

.session-avatar-img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    display: block;
}

.session-status-dot {
    position: absolute;
    bottom: -1px;
    right: -1px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #10b981;
    border: 2px solid #ffffff;
}

.session-detail-avatar-wrap {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: #f8fafc;
    border: 1.5px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    flex-shrink: 0;
}

.session-detail-avatar-img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    display: block;
}

.session-consent-notice { margin: 12px 0 0; padding: 9px 10px; border: 1px solid #bfdbfe; border-radius: 7px; background: #eff6ff; color: #1e3a8a; font-size: 12px; line-height: 1.45; }
.session-consent-notice[hidden] { display: none; }

.session-card-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.session-card-title-row {
    display: grid;
    grid-template-columns: minmax(260px, 330px) minmax(0, 1fr);
    align-items: center;
    gap: 8px;
}

.session-visitor-name {
    font-size: 13.5px;
    font-weight: 700;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.session-id-full,
.session-meta-id-title {
    min-width: 0;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.session-badge-country {
    background: #f1f5f9;
    color: var(--text-secondary);
    font-size: 11.5px;
    font-weight: 600;
    padding: 1px 7px;
    border-radius: 4px;
    border: 1px solid #e2e8f0;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    justify-self: start;
    min-width: 0;
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.session-card-sub-row {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 12px;
    color: var(--text-secondary);
    flex-wrap: wrap;
}

.session-flow-bar {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.flow-pill {
    font-size: 11px;
    font-weight: 500;
    padding: 1px 6px;
    border-radius: 4px;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.flow-pv {
    background: #eff6ff;
    color: #2563eb;
    border: 1px solid #bfdbfe;
}

.flow-evt {
    background: #f5f3ff;
    color: #7c3aed;
    border: 1px solid #ddd6fe;
}

.flow-arrow {
    color: #cbd5e1;
    font-size: 10px;
}

.session-card-right {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-shrink: 0;
}

.session-time-block {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
}

.session-card-time {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-primary);
}

.session-card-duration {
    font-size: 11.5px;
    color: var(--text-muted);
}

.session-card-chevron {
    color: var(--text-muted);
    transition: var(--transition);
}

.session-card-item:hover .session-card-chevron {
    color: var(--text-primary);
    transform: translateX(2px);
}

/* ==========================================================================
   7. Events Stream Card & Feed Rows
   ========================================================================== */
.events-stream-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.events-card-header {
    padding: 18px 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #fafafa;
}

.events-card-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
}

.events-list-container {
    display: flex;
    flex-direction: column;
}

.event-stream-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 24px;
    border-bottom: 1px solid var(--border);
    transition: var(--transition);
    gap: 16px;
}

.event-stream-row:last-child {
    border-bottom: none;
}

.event-stream-row:hover {
    background: #f8fafc;
}

.event-stream-left {
    display: flex;
    align-items: center;
    gap: 16px;
    min-width: 0;
    flex: 1;
}

.event-badge {
    font-size: 11.5px;
    font-weight: 700;
    padding: 4px 9px;
    border-radius: 5px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    flex-shrink: 0;
    letter-spacing: -0.01em;
}

.badge-pageview {
    background: #eff6ff;
    color: #2563eb;
    border: 1px solid #bfdbfe;
}

.badge-click {
    background: #f5f3ff;
    color: #7c3aed;
    border: 1px solid #ddd6fe;
}

.badge-custom {
    background: #ecfdf5;
    color: #059669;
    border: 1px solid #a7f3d0;
}

.event-details-col {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.event-main-line {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.event-summary-path {
    color: #0f172a;
    font-weight: 700;
}

.event-summary-desc {
    color: var(--text-primary);
    font-weight: 600;
}

.event-summary-muted {
    color: var(--text-muted);
    font-weight: 400;
}

.event-meta-line {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-muted);
}

.event-meta-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #f1f5f9;
    padding: 1px 7px;
    border-radius: 4px;
    font-size: 11.5px;
    color: var(--text-secondary);
}

.session-tag {
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.session-tag:hover {
    background: #e2e8f0;
    color: var(--primary);
}

.event-stream-right {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-shrink: 0;
}

.event-time {
    font-size: 12.5px;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}

.btn-inspect-json {
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: 5px;
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 700;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
}

.btn-inspect-json:hover {
    background: #f8fafc;
    border-color: #94a3b8;
    color: var(--text-primary);
}

/* ==========================================================================
   7. Tables, Badges, Modals
   ========================================================================== */
.data-table-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.table-responsive {
    width: 100%;
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 13px;
}

.data-table th {
    background: #f8fafc;
    padding: 10px 16px;
    font-size: 11.5px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-bottom: 1px solid var(--border);
}

.data-table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-light);
    color: var(--text-primary);
    vertical-align: middle;
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

.data-table tbody tr:hover {
    background-color: #fcfcfd;
}

.empty-state {
    text-align: center;
    padding: 48px 16px !important;
    color: var(--text-muted);
}

.event-badge {
    font-size: 11.5px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 4px;
    display: inline-block;
}

.event-badge.pageview { background: #f1f5f9; color: #334155; }
.event-badge.conversion { background: #ecfdf5; color: #059669; }
.event-badge.custom { background: #eef2ff; color: #4338ca; }

.pagination-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 18px;
    border-top: 1px solid var(--border-light);
    font-size: 12.5px;
    color: var(--text-muted);
}

.pagination-controls {
    display: flex;
    gap: 6px;
}

.btn-page {
    border: 1px solid var(--border);
    background: #ffffff;
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    font-family: inherit;
    transition: var(--transition);
}

.btn-page:hover:not(:disabled) {
    background: #f8fafc;
    border-color: #cbd5e1;
}

.btn-page:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(2px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    padding: 16px;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-dialog {
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-modal);
    width: 100%;
    max-width: 520px;
    overflow: hidden;
    transform: translateY(12px) scale(0.98);
    transition: transform 0.2s ease;
}

.modal-overlay.active .modal-dialog {
    transform: translateY(0) scale(1);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-light);
}

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

.btn-close {
    border: none;
    background: transparent;
    font-size: 16px;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    line-height: 1;
}

.btn-close:hover {
    color: var(--text-primary);
}

.modal-body {
    padding: 20px;
}

/* Modern Code Blocks, Pre Elements & Elegant Copy Button */
.code-block-wrapper {
    position: relative;
    background: #090d16;
    border: 1px solid #1e293b;
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: 0 4px 16px -2px rgba(15, 23, 42, 0.25), 0 1px 3px rgba(0, 0, 0, 0.2);
    margin: 14px 0;
    transition: border-color 0.2s ease;
}

.code-block-wrapper:hover {
    border-color: #334155;
}

.code-block-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 14px;
    background: #0f172a;
    border-bottom: 1px solid #1e293b;
    user-select: none;
}

.code-block-dots {
    display: flex;
    align-items: center;
    gap: 6px;
}

.code-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    display: inline-block;
}

.code-dot-red { background: #ef4444; opacity: 0.85; }
.code-dot-yellow { background: #f59e0b; opacity: 0.85; }
.code-dot-green { background: #10b981; opacity: 0.85; }

.code-block-title {
    font-size: 11px;
    font-weight: 600;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-left: 6px;
}

pre, .json-box, .code-box {
    margin: 0;
    padding: 16px 18px;
    font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 12.5px;
    line-height: 1.6;
    color: #e2e8f0;
    background: #090d16;
    overflow-x: auto;
    max-height: 380px;
    border: none;
    border-radius: 0;
    white-space: pre-wrap;
    word-break: break-all;
    tab-size: 2;
}

/* Custom code scrollbar */
.code-box::-webkit-scrollbar, pre::-webkit-scrollbar, .json-box::-webkit-scrollbar {
    height: 6px;
    width: 6px;
}
.code-box::-webkit-scrollbar-track, pre::-webkit-scrollbar-track, .json-box::-webkit-scrollbar-track {
    background: #090d16;
}
.code-box::-webkit-scrollbar-thumb, pre::-webkit-scrollbar-thumb, .json-box::-webkit-scrollbar-thumb {
    background: #334155;
    border-radius: 3px;
}
.code-box::-webkit-scrollbar-thumb:hover, pre::-webkit-scrollbar-thumb:hover, .json-box::-webkit-scrollbar-thumb:hover {
    background: #475569;
}

/* Elegant Copy Button */
.btn-copy-code {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 11px;
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: var(--radius-sm);
    color: #cbd5e1;
    font-size: 11.5px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
    backdrop-filter: blur(8px);
}

.btn-copy-code:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.25);
    color: #ffffff;
    transform: translateY(-1px);
}

.btn-copy-code:active {
    transform: translateY(0);
}

.btn-copy-code.copied {
    background: rgba(16, 185, 129, 0.2);
    border-color: rgba(16, 185, 129, 0.45);
    color: #34d399;
}

.btn-copy-code svg {
    flex-shrink: 0;
}

.btn-copy-code.copied .check-icon {
    animation: popCheck 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes popCheck {
    0% { transform: scale(0.6); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

/* Syntax Highlighting */
.json-key { color: #38bdf8; font-weight: 600; }
.json-string { color: #a7f3d0; }
.json-number { color: #c084fc; }
.json-boolean { color: #f472b6; font-weight: 600; }
.json-null { color: #94a3b8; font-style: italic; }
.html-tag { color: #f472b6; }
.html-attr { color: #38bdf8; }
.html-val { color: #a7f3d0; }

.page-view {
    display: none !important;
}

.page-view.active {
    display: block !important;
    animation: fadeIn 0.15s ease-out;
}

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

.timeline {
    display: flex;
    flex-direction: column;
    gap: 12px;
    position: relative;
    padding-left: 20px;
}

.timeline::before {
    content: "";
    position: absolute;
    left: 7px;
    top: 6px;
    bottom: 6px;
    width: 2px;
    background: #e2e8f0;
}

.timeline-item {
    position: relative;
}

.timeline-marker {
    position: absolute;
    left: -20px;
    top: 4px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #ffffff;
    border: 3px solid #6366f1;
    z-index: 2;
}

.timeline-marker.event {
    border-color: #10b981;
}

.timeline-content {
    background: #f8fafc;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    padding: 8px 12px;
}

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

.timeline-name {
    font-weight: 600;
    font-size: 12.5px;
    color: var(--text-primary);
}

.timeline-offset {
    font-size: 11px;
    color: var(--text-muted);
}

/* ==========================================================================
   8. Session Detail Drill-down View (Matching User Screenshot)
   ========================================================================== */
.btn-back-sessions-list {
    background: transparent;
    border: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 13.5px;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 6px 0;
    transition: color 0.15s ease;
}

.btn-back-sessions-list:hover {
    color: var(--primary);
}

.session-detail-grid {
    display: grid;
    grid-template-columns: 1fr 360px;
    gap: 24px;
    align-items: start;
}

.btn-delete-session {
    float: right;
    border: 1px solid #fecaca;
    border-radius: 7px;
    background: #fff;
    color: #b91c1c;
    cursor: pointer;
    font-size: 12px;
    font-weight: 700;
    padding: 8px 11px;
}
.btn-delete-session:hover:not(:disabled) { background: #fef2f2; border-color: #fca5a5; }
.btn-delete-session:disabled { cursor: wait; opacity: .65; }

@media (max-width: 950px) {
    .session-detail-grid {
        grid-template-columns: 1fr;
    }
}

.session-journey-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 24px;
    box-shadow: var(--shadow-sm);
}

.journey-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 24px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.journey-title {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-secondary);
    letter-spacing: 0;
    margin: 0;
}

.journey-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.journey-search {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    width: min(220px, 30vw);
    height: 32px;
    padding: 0 9px;
    border: 1px solid var(--border);
    border-radius: 7px;
    background: #fff;
    color: var(--text-muted);
}

.journey-search:focus-within {
    border-color: #93c5fd;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, .12);
}

.journey-search input {
    width: 100%;
    min-width: 0;
    border: 0;
    outline: 0;
    color: var(--text-primary);
    background: transparent;
    font: inherit;
    font-size: 12px;
}

.journey-search input::placeholder { color: var(--text-muted); }

.btn-journey-order {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 32px;
    padding: 0 9px;
    border: 1px solid var(--border);
    border-radius: 7px;
    background: #fff;
    color: var(--text-secondary);
    font: inherit;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
}

.btn-journey-order:hover,
.btn-journey-order[aria-pressed="true"] {
    border-color: #93c5fd;
    color: var(--primary);
    background: #f8fbff;
}

.journey-no-results {
    padding: 24px 0;
    color: var(--text-muted);
    font-size: 13px;
    text-align: center;
}

.journey-steps-container {
    display: flex;
    flex-direction: column;
}

.journey-step-item {
    display: flex;
    gap: 16px;
    position: relative;
}

.journey-step-left {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 28px;
    flex-shrink: 0;
}

.journey-step-circle {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 1.5px solid #cbd5e1;
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 600;
    color: #475569;
    z-index: 1;
}

.journey-circle-dot {
    border-color: #cbd5e1;
}

.journey-inner-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #64748b;
    display: inline-block;
}

.journey-step-line {
    width: 1.5px;
    flex: 1;
    background: #e2e8f0;
    min-height: 28px;
    margin: 4px 0;
}

.journey-step-content {
    flex: 1;
    padding-bottom: 24px;
    min-width: 0;
}

.journey-marker-content {
    display: flex;
    align-items: center;
    min-height: 28px;
}

.journey-step-end .journey-marker-content {
    align-self: flex-start;
    padding-bottom: 0;
}

.journey-step-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 4px;
}

.journey-step-title-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    flex-wrap: wrap;
}

.journey-step-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.journey-step-path {
    font-size: 14.5px;
    font-weight: 600;
    color: var(--text-primary);
    word-break: break-all;
}

.journey-step-subtitle {
    font-size: 12.5px;
    color: var(--text-muted);
    font-weight: 400;
    word-break: break-all;
}

.journey-step-time {
    font-size: 13px;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
    flex-shrink: 0;
}

.journey-step-meta-row {
    display: flex;
    align-items: center;
    gap: 8px 12px;
    margin-top: 6px;
    flex-wrap: wrap;
}

.events-list-container .journey-steps-container {
    padding: 20px 24px;
}

.journey-step-dur {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
}

.btn-step-props {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: transparent;
    border: none;
    padding: 0;
    cursor: pointer;
    font-size: 13px;
    color: var(--text-secondary);
    transition: color 0.15s ease;
}

.btn-step-props:hover {
    color: var(--text-primary);
}

.props-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 9999px;
    padding: 1px 7px;
    font-size: 11.5px;
    font-weight: 600;
    color: #475569;
}

.props-text {
    font-size: 13px;
    font-weight: 500;
    color: #334155;
}

.props-chevron {
    display: inline-flex;
    align-items: center;
    transition: transform 0.2s ease;
    color: #64748b;
}

.btn-step-props.active .props-chevron {
    transform: rotate(180deg);
}

.step-props-card {
    margin-top: 10px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

.props-table {
    display: flex;
    flex-direction: column;
}

.props-row {
    background: #f8fafc;
    display: flex;
    align-items: center;
    padding: 10px 16px;
    border-bottom: 1px solid #f1f5f9;
}

.props-row:last-child {
    border-bottom: none;
}

.props-key {
    width: 200px;
    flex-shrink: 0;
    font-size: 13px;
    font-weight: 500;
    color: #475569;
}

.props-val {
    flex: 1;
    font-size: 13px;
    font-weight: 500;
    color: #0f172a;
    word-break: break-all;
}

.journey-step-end {
    padding-bottom: 0;
}

.journey-end-text {
    font-size: 13.5px;
    font-weight: 600;
    color: #334155;
}

/* Right Meta Sidebar Card */
.session-meta-sidebar-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.session-meta-top-box {
    padding-bottom: 18px;
    border-bottom: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.session-summary-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.session-summary-card {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #f8fafc;
}

.session-summary-label {
    color: var(--text-muted);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .02em;
    text-transform: uppercase;
}

.session-summary-value {
    overflow: hidden;
    color: var(--text-primary);
    font-size: 16px;
    font-variant-numeric: tabular-nums;
    line-height: 1.2;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.session-summary-date { font-size: 12px; line-height: 1.6; }

.session-meta-id-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.session-meta-id-title {
    font-size: 15px;
    font-weight: 800;
    color: var(--text-primary);
}

.session-live-pulse-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #10b981;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2);
}

.session-meta-geo-row, 
.session-meta-tech-row {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
}

.session-meta-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.session-meta-section:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.meta-section-title {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-secondary);
    letter-spacing: 0;
    margin: 0;
}

.meta-field-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 12.5px;
}

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

.meta-field-val {
    color: var(--text-primary);
    font-weight: 700;
    text-align: right;
}

/* ── Events page series multi-select ────────────────────────────────── */
.event-insights-strip {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0;
    margin: -2px 0 18px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: #fbfdff;
    overflow: hidden;
}
.event-insight {
    min-width: 0;
    padding: 14px 20px;
    border-right: 1px solid var(--border);
}
.event-insight:last-child { border-right: 0; }
.event-insight-label {
    display: block;
    margin-bottom: 4px;
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}
.event-insight-metric {
    display: flex;
    align-items: baseline;
    gap: 8px;
    min-width: 0;
}
.event-insight-value {
    display: inline-block;
    flex-shrink: 0;
    color: var(--text-primary);
    font-size: 22px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    line-height: 1.2;
}
.event-insight-detail {
    display: block;
    flex: 1 1 0%;
    min-width: 0;
    color: var(--text-secondary);
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: baseline;
    line-height: 1.2;
}
.event-series-combobox {
    position: relative;
    min-width: 190px;
}
.event-series-combobox-trigger {
    width: 100%;
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 7px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--bg-surface);
    color: var(--text-primary);
    font: inherit;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}
.event-series-combobox-trigger:hover,
.event-series-combobox-trigger[aria-expanded="true"] {
    border-color: #93c5fd;
}
.event-series-combobox-menu {
    position: absolute;
    z-index: 60;
    top: calc(100% + 7px);
    right: 0;
    width: min(330px, calc(100vw - 40px));
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--bg-surface);
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.16);
}
.event-series-combobox-menu-portal {
    position: fixed;
    z-index: 2147483647;
}
.event-series-search {
    width: 100%;
    box-sizing: border-box;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-primary);
    background: var(--bg-surface);
    font: inherit;
    font-size: 12px;
}
.event-series-search:focus {
    outline: none;
    border-color: #60a5fa;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.14);
}
.event-series-actions {
    display: flex;
    gap: 10px;
    padding: 9px 2px 7px;
    border-bottom: 1px solid var(--border);
}
.event-series-actions button {
    border: none;
    padding: 0;
    color: #2563eb;
    background: transparent;
    font: inherit;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}
.event-series-options {
    max-height: 250px;
    overflow-y: auto;
    padding-top: 5px;
}
.event-series-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 4px;
    color: var(--text-primary);
    font-size: 12px;
    cursor: pointer;
}
.event-series-option:hover { background: var(--bg-sidebar-hover); }
.event-series-option input { margin: 0; accent-color: #2563eb; }
.event-series-option-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.event-series-option-count { margin-left: auto; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.event-series-empty { margin: 12px 4px; color: var(--text-muted); font-size: 12px; }
.chart-series-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* ── Event Distribution Chart ────────────────────────────────────────── */
.evt-dist-row {
    display: grid;
    grid-template-columns: 160px 1fr 90px;
    align-items: center;
    gap: 14px;
    padding: 9px 20px;
    cursor: pointer;
    transition: background 0.12s;
    border-radius: 0;
}
.evt-dist-row:hover {
    background: var(--bg-secondary);
}
.evt-dist-row--active {
    background: #eff6ff;
}
.evt-dist-row--active:hover {
    background: #dbeafe;
}
.evt-dist-label {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}
.evt-dist-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}
.evt-dist-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.evt-dist-bar-wrap {
    height: 7px;
    background: #f1f5f9;
    border-radius: 9999px;
    overflow: hidden;
}
.evt-dist-bar {
    height: 100%;
    border-radius: 9999px;
    transition: width 0.3s ease;
    min-width: 2px;
}
.evt-dist-stats {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
}
.evt-dist-count {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
}
.evt-dist-pct {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
    min-width: 36px;
    text-align: right;
}

/* ===========================================================================
   Responsive layout
   Keep desktop density intact while making every dashboard view usable on
   tablets and phones. Tables retain their columns in a deliberate scroll area.
   ========================================================================== */
@media (max-width: 1024px) {
    .content-container { padding: 20px 24px 40px; }
    .top-header { padding: 0 24px; }
    .websites-kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .chart-container-card, .full-width-chart, .breakdown-card { padding: 18px; }
    .event-stream-row { padding: 13px 18px; }
}

@media (max-width: 767px) {
    .event-insights-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .event-insight:nth-child(2) { border-right: 0; }
    .event-insight:nth-child(1),
    .event-insight:nth-child(2) { border-bottom: 1px solid var(--border); }
    .event-insight:nth-child(3) { grid-column: 1 / -1; border-right: 0; }
    .event-series-combobox { width: 100%; min-width: 0; }
    .events-list-container .journey-steps-container { padding: 16px 14px; }
    body { font-size: 13px; overflow-x: hidden; }
    .content-container { padding: 16px 14px 32px; }
    .top-header { height: auto; min-height: 58px; padding: 10px 14px; gap: 10px; align-items: flex-start; }
    .header-left { min-width: 0; padding-top: 1px; }
    .btn-sidebar-toggle-header {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        flex: 0 0 32px;
        width: 32px;
        height: 32px;
        padding: 0;
        border: 1px solid var(--border);
        border-radius: var(--radius-sm);
        background: var(--bg-surface);
        color: var(--text-secondary);
        cursor: pointer;
    }
    .btn-sidebar-toggle-header:hover { color: var(--text-primary); border-color: #cbd5e1; }
    .header-page-title { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .header-title-wrapper { min-width: 0; }
    .header-actions { margin-left: auto; gap: 7px; flex-wrap: wrap; justify-content: flex-end; }
    .live-badge { display: none; }
    .range-selector select { max-width: 150px; }
    .custom-range-popover { position: fixed; top: 70px; right: 14px; left: 14px; width: auto; }

    .sidebar,
    .sidebar.collapsed,
    html.sidebar-preload-collapsed .sidebar {
        position: fixed;
        inset: 0 auto 0 0;
        width: min(86vw, 300px);
        height: 100dvh;
        padding: 18px 16px;
        transform: translateX(-105%);
        transition: transform .22s ease;
        box-shadow: none;
        z-index: 120;
    }
    body.sidebar-mobile-open { overflow: hidden; }
    body.sidebar-mobile-open .sidebar { transform: translateX(0); box-shadow: 12px 0 32px rgba(15, 23, 42, .16); }
    .mobile-nav-backdrop { position: fixed; inset: 0; z-index: 110; border: 0; background: rgba(15, 23, 42, .42); opacity: 0; pointer-events: none; transition: opacity .22s ease; }
    body.sidebar-mobile-open .mobile-nav-backdrop { display: block; opacity: 1; pointer-events: auto; }
    .sidebar.collapsed .sidebar-header-row,
    html.sidebar-preload-collapsed .sidebar .sidebar-header-row { position: static; flex-direction: row; justify-content: space-between; gap: 0; margin-bottom: 16px; padding: 2px; }
    .sidebar.collapsed .sidebar-brand-link,
    html.sidebar-preload-collapsed .sidebar .sidebar-brand-link { justify-content: flex-start; width: auto; }
    .sidebar.collapsed .btn-sidebar-collapse,
    html.sidebar-preload-collapsed .sidebar .btn-sidebar-collapse { position: static; inset: auto; width: 28px; height: 28px; margin: 0; opacity: 1; pointer-events: auto; }
    .sidebar.collapsed:hover .sidebar-brand-link,
    html.sidebar-preload-collapsed .sidebar:hover .sidebar-brand-link { opacity: 1; pointer-events: auto; }
    .sidebar.collapsed .sidebar-brand-text,
    html.sidebar-preload-collapsed .sidebar .sidebar-brand-text,
    .sidebar.collapsed .btn-back-websites span,
    html.sidebar-preload-collapsed .sidebar .btn-back-websites span,
    .sidebar.collapsed .sidebar-site-box .site-meta,
    html.sidebar-preload-collapsed .sidebar .sidebar-site-box .site-meta,
    .sidebar.collapsed .nav-section-label,
    html.sidebar-preload-collapsed .sidebar .nav-section-label,
    .sidebar.collapsed .nav-title,
    html.sidebar-preload-collapsed .sidebar .nav-title,
    .sidebar.collapsed .footer-link span,
    html.sidebar-preload-collapsed .sidebar .footer-link span,
    .sidebar.collapsed .user-info,
    html.sidebar-preload-collapsed .sidebar .user-info { display: initial; }
    .sidebar.collapsed .btn-back-websites,
    html.sidebar-preload-collapsed .sidebar .btn-back-websites,
    .sidebar.collapsed .sidebar-site-box,
    html.sidebar-preload-collapsed .sidebar .sidebar-site-box,
    .sidebar.collapsed .nav-item a,
    html.sidebar-preload-collapsed .sidebar .nav-item a,
    .sidebar.collapsed .footer-link,
    html.sidebar-preload-collapsed .sidebar .footer-link,
    .sidebar.collapsed .sidebar-user-row,
    html.sidebar-preload-collapsed .sidebar .sidebar-user-row { justify-content: flex-start; padding: revert; width: auto; }
    .sidebar.collapsed .sidebar-site-box,
    html.sidebar-preload-collapsed .sidebar .sidebar-site-box { padding: 8px 10px; margin-bottom: 20px; }
    .sidebar.collapsed .nav-item a,
    html.sidebar-preload-collapsed .sidebar .nav-item a { padding: 8px 10px; gap: 10px; }
    .sidebar.collapsed .footer-link,
    html.sidebar-preload-collapsed .sidebar .footer-link { padding: 6px 8px; gap: 8px; }
    .sidebar.collapsed .sidebar-user-row,
    html.sidebar-preload-collapsed .sidebar .sidebar-user-row { padding: 6px 8px; }
    .sidebar.collapsed .sidebar-site-box .site-avatar,
    html.sidebar-preload-collapsed .sidebar .sidebar-site-box .site-avatar { width: 28px; height: 28px; margin: 0; }
    .sidebar.collapsed .sidebar-site-box .site-avatar::after,
    html.sidebar-preload-collapsed .sidebar .sidebar-site-box .site-avatar::after { display: none; }
    .sidebar.collapsed .user-avatar,
    html.sidebar-preload-collapsed .sidebar .user-avatar { margin: 0; }

    .app-container.is-portal .main-wrapper { padding: 24px 14px 40px; }
    .portal-header { align-items: flex-start; gap: 16px; flex-direction: column; }
    .portal-header > div:last-child { width: 100%; flex-wrap: wrap; }
    .portal-header > div:last-child .btn-primary { flex: 1 1 170px; justify-content: center; }
    .websites-kpi-grid, .umami-stats-grid { grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 16px; }
    .kpi-card, .umami-stat-card { padding: 14px; min-height: 96px; }
    .kpi-number, .umami-stat-value { font-size: 23px; }
    .kpi-card:last-child { grid-column: 1 / -1; }
    .filter-toolbar { margin-bottom: 14px; }
    .search-input-wrapper { max-width: none; }
    .data-table { min-width: 680px; }
    .table-responsive { -webkit-overflow-scrolling: touch; }
    .table-records-footer, .pagination-footer { padding: 11px 14px; }

    .active-filters-bar { align-items: stretch; padding: 10px; }
    .active-filters-actions { width: 100%; justify-content: flex-end; }
    .filter-chip { max-width: 190px; }
    .chart-header { flex-direction: column; gap: 14px; }
    .chart-header-controls { justify-content: flex-start; width: 100%; }
    .chart-metric-toggles { max-width: 100%; overflow-x: auto; }
    .chart-toggle-btn { white-space: nowrap; }
    .canvas-wrapper { height: 220px; }
    .overview-breakdowns-grid { gap: 14px; }
    .breakdown-card-header { align-items: flex-start; gap: 12px; flex-direction: column; }
    .breakdown-card-header .tab-buttons { max-width: 100%; overflow-x: auto; }

    .session-card-item, .event-stream-row { align-items: flex-start; padding: 13px 14px; gap: 10px; }
    .session-card-item { flex-direction: column; }
    .session-card-right { width: 100%; justify-content: space-between; padding-left: 54px; }
    .session-card-title-row { display: flex; flex-wrap: wrap; }
    .session-visitor-name { overflow: visible; text-overflow: clip; white-space: normal; }
    .event-stream-row { flex-wrap: wrap; }
    .event-stream-right { width: 100%; justify-content: space-between; padding-left: 0; }
    .event-meta-line { flex-wrap: wrap; }
    .events-card-header { padding: 15px; }
    .session-journey-card, .session-meta-sidebar-card { padding: 16px; }
    .journey-header { align-items: flex-start; flex-direction: column; }
    .journey-controls { width: 100%; }
    .journey-search { width: auto; flex: 1; }
    .journey-step-top, .timeline-header { align-items: flex-start; flex-direction: column; gap: 3px; }
    .props-row { align-items: flex-start; flex-direction: column; gap: 4px; padding: 10px 12px; }
    .props-key { width: auto; }
    .evt-dist-row { grid-template-columns: minmax(0, 1fr) auto; gap: 8px 12px; padding: 10px 14px; }
    .evt-dist-bar-wrap { grid-column: 1 / -1; grid-row: 2; }

    .modal-overlay { padding: 10px; align-items: flex-end; }
    .modal-dialog, .import-dialog { max-height: calc(100dvh - 20px); width: 100%; border-radius: 12px; }
    .modal-header, .modal-body { padding: 15px; }
    .modal-footer { flex-wrap: wrap; }
    .modal-footer .btn-primary, .modal-footer .btn-outline { flex: 1 1 140px; justify-content: center; }
    .import-stepper span { font-size: 10px; letter-spacing: .02em; }
    .import-step-actions { flex-wrap: wrap; }
    .import-step-actions .btn-primary { flex: 1; }
    .providers-grid { grid-template-columns: 1fr; }
    .import-stats-grid { grid-template-columns: 1fr; }
    .modal-summary-grid { grid-template-columns: 1fr 1fr !important; gap: 10px !important; margin-bottom: 18px !important; }
    .import-site-fields { grid-template-columns: 1fr !important; }
}

@media (max-width: 480px) {
    .event-insights-strip {
        grid-template-columns: 1fr;
    }
    .event-insight {
        grid-column: auto !important;
        border-right: 0 !important;
        border-bottom: 1px solid var(--border);
    }
    .event-insight:last-child {
        border-bottom: 0;
    }
}

@media (max-width: 420px) {
    .top-header { padding: 9px 10px; }
    .content-container { padding-inline: 10px; }
    .header-page-title { max-width: 118px; }
    .header-actions { gap: 5px; }
    .range-selector select { max-width: 128px; }
    .websites-kpi-grid, .umami-stats-grid { grid-template-columns: 1fr; }
    .kpi-card:last-child { grid-column: auto; }
    .chart-container-card, .full-width-chart, .breakdown-card { padding: 14px; }
    .chart-legend-metrics-row { gap: 10px; }
    .metric-val { font-size: 18px; }
    .session-card-right { padding-left: 0; }
    .custom-range-footer .btn { flex: 1; }
    .event-insight { padding: 11px 14px; }
    .event-insight-value { font-size: 19px; }
    .events-list-container .journey-steps-container { padding: 12px 10px; }
    .journey-step-item { gap: 10px; }
    .journey-step-circle { width: 24px; height: 24px; font-size: 11px; }
    .journey-step-left { width: 24px; }
    .pagination-footer { flex-wrap: wrap; gap: 8px; }
}

/* ==========================================================================
   Global App Loading States & Top Progress Bar
   ========================================================================== */
.app-loading-bar {
    position: fixed;
    top: 0;
    left: 0;
    width: 0%;
    height: 3px;
    background: linear-gradient(90deg, #2563eb, #38bdf8, #6366f1);
    box-shadow: 0 0 10px rgba(37, 99, 235, 0.5), 0 0 5px rgba(56, 189, 248, 0.4);
    z-index: 99999;
    opacity: 0;
    pointer-events: none;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.25s ease;
}

.app-loading-bar.active {
    opacity: 1;
    width: 70%;
    animation: loadingBarPulse 2s ease-in-out infinite alternate;
}

.app-loading-bar.finishing {
    width: 100% !important;
    opacity: 1;
    transition: width 0.15s ease-out;
}

@keyframes loadingBarPulse {
    0% { width: 45%; }
    50% { width: 75%; }
    100% { width: 88%; }
}

/* Floating indicator for long-running data queries */
.overview-loading-banner {
    position: fixed;
    top: 68px;
    left: 50%;
    transform: translateX(-50%);
    background: #0f172a;
    color: #ffffff;
    font-size: 12.5px;
    font-weight: 500;
    padding: 7px 16px;
    border-radius: 999px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.2), 0 2px 6px rgba(0, 0, 0, 0.08);
    display: inline-flex;
    align-items: center;
    gap: 9px;
    z-index: 1000;
    animation: fadeInDown 0.2s ease-out;
}

.overview-spinner {
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: spinSlow 0.7s linear infinite;
}

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

@keyframes fadeInDown {
    from { opacity: 0; transform: translate(-50%, -8px); }
    to { opacity: 1; transform: translate(-50%, 0); }
}

/* Subtle opacity and disable interaction while querying data */
#overviewDataContainer.is-loading,
#eventsDataContainer.is-loading,
#sessionsDataContainer.is-loading,
.websites-grid.is-loading {
    opacity: 0.55;
    pointer-events: none;
    transition: opacity 0.2s ease;
    filter: grayscale(10%);
}

/* Spinning refresh button */
.btn-refresh-spinning svg {
    animation: spinSlow 0.8s linear infinite !important;
}

/* ==========================================================================
   Live Demo (guest-mode) & Embedded Preview (embed-mode)
   ========================================================================== */
.demo-banner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
    padding: 8px 16px;
    background: var(--primary-subtle);
    border-bottom: 1px solid #e0e7ff;
    color: var(--primary-hover);
    font-size: 12.5px;
    font-weight: 500;
    text-align: center;
}

.demo-banner strong {
    font-weight: 700;
}

.demo-banner a {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: var(--radius-full);
    background: var(--primary);
    color: #ffffff;
    font-weight: 600;
    text-decoration: none;
    transition: var(--transition);
}

.demo-banner a:hover {
    background: var(--primary-hover);
}

.demo-mode-card {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--bg-surface);
}

.demo-mode-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    align-self: flex-start;
    padding: 2px 8px;
    border-radius: var(--radius-full);
    background: var(--primary-subtle);
    color: var(--primary);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.demo-mode-badge .pulse-dot {
    background: var(--primary);
}

.demo-mode-text {
    font-size: 11.5px;
    line-height: 1.45;
    color: var(--text-secondary);
}

.demo-mode-cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 7px 10px;
    border-radius: var(--radius-sm);
    background: var(--primary);
    color: #ffffff;
    font-size: 12.5px;
    font-weight: 600;
    text-decoration: none;
    transition: var(--transition);
}

.demo-mode-cta:hover {
    background: var(--primary-hover);
}

.sidebar.collapsed .demo-mode-card {
    padding: 8px 4px;
    border: 0;
    background: transparent;
    align-items: center;
}

.sidebar.collapsed .demo-mode-text,
.sidebar.collapsed .demo-mode-badge span:not(.pulse-dot),
.sidebar.collapsed .demo-mode-cta span {
    display: none;
}

/* Guests are read-only: hide every write / administration control. */
.guest-mode #btnBackToWebsites,
.guest-mode #btnOpenAddSiteModal,
.guest-mode #btnWebsitesAddSite,
.guest-mode #btnWebsitesImport,
.guest-mode #btnSidebarImport,
.guest-mode #btnDeleteSession,
.guest-mode #btnCreateFunnel,
.guest-mode #btnCreateFirstFunnel,
.guest-mode .funnel-actions,
.guest-mode #trackingModeNotice {
    display: none !important;
}

/* Embedded preview (iframe on the landing page): content only. */
.embed-mode .sidebar,
.embed-mode .mobile-nav-backdrop,
.embed-mode .btn-sidebar-toggle-header {
    display: none !important;
}

.embed-mode .top-header {
    padding: 0 20px;
}

.embed-mode .content-container {
    padding: 20px 20px 32px;
}

.embed-mode .demo-banner {
    justify-content: space-between;
    padding: 6px 12px;
    font-size: 12px;
}

.demo-embed-tabs {
    display: flex;
    gap: 2px;
    overflow-x: auto;
    list-style: none;
}

.demo-embed-tabs .nav-item {
    padding: 4px 10px;
    border-radius: var(--radius-full);
    background: transparent;
    color: var(--text-secondary);
    font-weight: 600;
    white-space: nowrap;
}

.demo-embed-tabs .nav-item:hover {
    background: rgba(79, 70, 229, 0.08);
    color: var(--primary);
}

.demo-embed-tabs .nav-item.active {
    background: var(--bg-surface);
    color: var(--primary);
    box-shadow: var(--shadow-sm);
}

@media (max-width: 767px) {
    .demo-banner { font-size: 12px; padding: 7px 14px; }
    .embed-mode .top-header { padding: 10px 14px; }
    .embed-mode .content-container { padding: 14px 14px 28px; }
}
