/* Structural redesign for the isolated feature-test site only. */
:root {
    --feature-sidebar: #0b1930;
    --feature-sidebar-2: #10284a;
    --feature-orange: #ff642d;
    --feature-cyan: #16b8c4;
}

.ui-preview .preview-environment {
    justify-content: flex-start;
    padding-left: 28px;
    background: linear-gradient(90deg, #f1521e, #ff713b 46%, #d94515);
}

.dashboard-page .feature-sidebar { display: none; }

.dashboard-page.feature-authenticated {
    padding: 48px 24px 28px;
    background: #eef2f7;
}

[data-theme="dark"] .dashboard-page.feature-authenticated { background: var(--bg-color); }

.dashboard-page.feature-authenticated .container {
    display: grid;
    grid-template-columns: 264px minmax(0, 1fr);
    gap: 18px 22px;
    align-items: start;
}

.dashboard-page.feature-authenticated .feature-sidebar {
    grid-column: 1;
    grid-row: 1 / span 20;
    position: sticky;
    top: 50px;
    min-height: calc(100vh - 72px);
    max-height: calc(100vh - 72px);
    display: flex;
    flex-direction: column;
    padding: 18px 14px 14px;
    color: #fff;
    background:
        radial-gradient(circle at 15% 0, rgba(22, 184, 196, 0.18), transparent 16rem),
        linear-gradient(165deg, var(--feature-sidebar-2), var(--feature-sidebar));
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 20px;
    box-shadow: 0 20px 42px rgba(11, 25, 48, 0.20);
    overflow: auto;
}

.feature-sidebar-brand {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 4px 5px 22px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.10);
}

.sidebar-logo {
    width: 44px;
    height: 44px;
    flex: 0 0 44px;
    display: grid;
    place-items: center;
    color: #fff;
    background: linear-gradient(145deg, #ff7643, #ef4814);
    border-radius: 13px;
    box-shadow: 0 10px 24px rgba(241, 82, 30, 0.30);
}

.feature-sidebar-brand b { display: block; font-size: 17px; letter-spacing: -0.02em; }
.feature-sidebar-brand span { display: block; margin-top: 1px; color: #7edbe0; font-size: 9px; letter-spacing: 0.13em; text-transform: uppercase; }

.feature-sidebar-caption {
    padding: 20px 8px 8px;
    color: rgba(255, 255, 255, 0.44);
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.feature-sidebar .report-tabs {
    width: 100%;
    display: flex !important;
    flex-direction: column;
    gap: 5px !important;
}

.feature-sidebar .r-tab-btn {
    width: 100%;
    min-height: 46px;
    justify-content: flex-start;
    margin: 0;
    padding: 10px 12px;
    color: rgba(255, 255, 255, 0.68);
    background: transparent;
    border: 1px solid transparent;
    border-radius: 11px;
    font-size: 12px;
    text-align: left;
}

.feature-sidebar .r-tab-btn:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.08);
}

.feature-sidebar .r-tab-btn.active {
    color: #fff;
    background: linear-gradient(135deg, #ff7040, #ed4b17);
    border-color: transparent;
    box-shadow: 0 9px 20px rgba(241, 82, 30, 0.25);
}

.feature-sidebar-note {
    display: flex;
    gap: 10px;
    margin-top: auto;
    padding: 12px;
    color: #cfeef0;
    background: rgba(22, 184, 196, 0.10);
    border: 1px solid rgba(83, 215, 224, 0.16);
    border-radius: 12px;
}

.feature-sidebar-note > i { margin-top: 2px; color: #63dde4; }
.feature-sidebar-note b { display: block; color: #fff; font-size: 11px; }
.feature-sidebar-note span { display: block; margin-top: 3px; color: rgba(216, 248, 250, 0.63); font-size: 9px; line-height: 1.45; }

.feature-sidebar-user {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.10);
}

.feature-sidebar #userActionMenu {
    width: 100%;
    display: flex !important;
    flex-direction: column;
    align-items: stretch !important;
    gap: 8px !important;
    padding: 0 !important;
}

.feature-sidebar #userActionMenu > div { justify-content: flex-start; color: rgba(255, 255, 255, 0.64) !important; font-size: 10px !important; }
.feature-sidebar #userActionMenu a { color: #69dbe1 !important; font-size: 11px !important; }
.feature-sidebar #userActionMenu .text-primary-bold { color: #ff8b62 !important; }
.feature-sidebar #userActionMenu button { color: #d4e0ef !important; font-size: 9px !important; }

.dashboard-page.feature-authenticated #dashHeader,
.dashboard-page.feature-authenticated #toolbar,
.dashboard-page.feature-authenticated #kpiCards,
.dashboard-page.feature-authenticated #kpiCardsQc,
.dashboard-page.feature-authenticated #dashboard,
.dashboard-page.feature-authenticated #tableWrapper { grid-column: 2; min-width: 0; }

.dashboard-page.feature-authenticated #dashHeader {
    min-height: 96px;
    margin: 0;
    padding: 18px 22px;
    color: var(--text-main);
    background: var(--box-bg);
    border: 1px solid var(--border);
    border-radius: 17px;
    box-shadow: 0 8px 24px rgba(22, 37, 64, 0.07);
}

.dashboard-page.feature-authenticated #dashHeader::after { display: none; }
.dashboard-page.feature-authenticated #dashHeader .brand-mark {
    color: var(--feature-orange);
    background: rgba(255, 100, 45, 0.10);
    box-shadow: none;
}
.dashboard-page.feature-authenticated #dashHeader .eyebrow { color: var(--feature-cyan); }
.dashboard-page.feature-authenticated #dashHeader h2 { color: var(--text-main); }
.dashboard-page.feature-authenticated #dashHeader h2 i { color: var(--feature-orange); }
.dashboard-page.feature-authenticated #dashHeader > p { color: var(--text-muted); }
.dashboard-page.feature-authenticated #dashHeader .theme-toggle {
    color: var(--text-main);
    background: var(--table-header);
    border-color: var(--border);
}

.dashboard-page.feature-authenticated #toolbar {
    margin: 0;
    border-radius: 17px;
    box-shadow: 0 8px 24px rgba(22, 37, 64, 0.06);
}

.dashboard-page.feature-authenticated #toolbar .toolbar-top {
    min-height: 64px;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding: 12px 18px;
    background: var(--box-bg);
}

.filter-section-title { display: flex; align-items: center; gap: 11px; }
.filter-section-title .section-icon {
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    color: var(--feature-orange);
    background: rgba(255, 100, 45, 0.10);
    border-radius: 10px;
}
.filter-section-title b { display: block; color: var(--text-main); font-size: 13px; }
.filter-section-title span { display: block; margin-top: 1px; color: var(--text-muted); font-size: 9px; }

.live-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 9px;
    color: #0a846f;
    background: rgba(14, 159, 139, 0.10);
    border-radius: 999px;
    font-size: 9px;
    font-weight: 800;
    text-transform: uppercase;
}
.live-status > span { width: 7px; height: 7px; background: #17ad8d; border-radius: 50%; box-shadow: 0 0 0 4px rgba(23, 173, 141, 0.12); }

.dashboard-page.feature-authenticated #toolbar > .flex-between { padding-inline: 18px !important; }
.dashboard-page.feature-authenticated #toolbar .filter-grid { display: grid; grid-template-columns: repeat(4, minmax(145px, 1fr)); }
.dashboard-page.feature-authenticated #toolbar .filter-item { min-width: 0 !important; }
.dashboard-page.feature-authenticated #toolbar .filter-item[style*="flex: 1.5"] { grid-column: span 2; }
.dashboard-page.feature-authenticated #toolbar .filter-item[style*="min-width: 380px"] { grid-column: span 2; }

.dashboard-page.feature-authenticated .kpi-grid { margin: 0; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.dashboard-page.feature-authenticated #kpiCardsQc { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.dashboard-page.feature-authenticated .kpi-card {
    min-height: 126px;
    border: 0;
    box-shadow: 0 8px 24px rgba(22, 37, 64, 0.07);
}
.dashboard-page.feature-authenticated .kpi-card:nth-child(1) { background: linear-gradient(145deg, #fff, #fff5f0); }
.dashboard-page.feature-authenticated .kpi-card:nth-child(2) { background: linear-gradient(145deg, #fff, #f0f7ff); }
.dashboard-page.feature-authenticated .kpi-card:nth-child(3) { background: linear-gradient(145deg, #fff, #effbf8); }
[data-theme="dark"] .dashboard-page.feature-authenticated .kpi-card:nth-child(n) { background: var(--box-bg); }

.dashboard-page.feature-authenticated #dashboard { margin: 0; }
.dashboard-page.feature-authenticated .chart-container { border: 0; box-shadow: 0 8px 24px rgba(22, 37, 64, 0.07); }
.dashboard-page.feature-authenticated #tableWrapper { margin: 0; border: 0; box-shadow: 0 8px 24px rgba(22, 37, 64, 0.07); }

.comparison-table-card {
    width: 100%;
    margin: 0 0 18px;
    overflow: hidden;
    background: var(--box-bg);
    border: 1px solid var(--border);
    border-radius: 17px;
    box-shadow: 0 8px 24px rgba(22, 37, 64, 0.07);
}
.comparison-table-heading {
    min-height: 78px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 16px 18px;
    border-bottom: 1px solid var(--border);
}
.comparison-eyebrow {
    display: block;
    margin-bottom: 3px;
    color: var(--feature-cyan);
    font-size: 9px;
    font-weight: 900;
    letter-spacing: 1.2px;
    text-transform: uppercase;
}
.comparison-table-heading h3 { margin: 0; color: var(--text-main); font-size: 15px; text-transform: uppercase; }
.comparison-periods { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.comparison-periods > span {
    display: grid;
    grid-template-columns: 18px auto;
    column-gap: 5px;
    padding: 7px 10px;
    color: var(--text-muted);
    background: var(--table-header);
    border: 1px solid var(--border);
    border-radius: 9px;
    font-size: 10px;
}
.comparison-periods i { grid-row: 1 / 3; align-self: center; color: var(--feature-orange); }
.comparison-periods b { color: var(--text-main); font-size: 9px; text-transform: uppercase; }
.comparison-unavailable { padding: 8px 10px; color: var(--text-muted); background: var(--table-header); border-radius: 8px; font-size: 11px; }
.comparison-table-scroll { max-height: 560px; overflow: auto; }
.comparison-table { width: 100%; min-width: 1120px; border-collapse: separate; border-spacing: 0; font-size: 11px; }
.comparison-table th,
.comparison-table td { padding: 9px 10px; text-align: right; white-space: nowrap; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.comparison-table thead th { position: sticky; z-index: 4; color: var(--text-main); background: var(--table-header); font-size: 9px; font-weight: 800; text-transform: uppercase; }
.comparison-table thead tr:first-child th { top: 0; height: 39px; }
.comparison-table thead tr:nth-child(2) th { top: 39px; }
.comparison-table thead th[rowspan="2"] { top: 0; }
.comparison-table .comparison-group { color: #fff; text-align: center; letter-spacing: 0.5px; }
.comparison-table .comparison-group.sessions { background: #f06435; }
.comparison-table .comparison-group.views { background: #1676c5; }
.comparison-table .comparison-group.duration { background: #169883; }
.comparison-table tbody tr:hover td { background: rgba(30, 139, 151, 0.055); }
.comparison-table .comparison-rank { width: 44px; min-width: 44px; text-align: center; color: var(--text-muted); background: var(--box-bg); }
.comparison-table .comparison-name { min-width: 220px; max-width: 320px; overflow: hidden; color: var(--text-main); background: var(--box-bg); font-weight: 700; text-align: left; text-overflow: ellipsis; }
.comparison-table thead tr:first-child th:first-child,
.comparison-table .comparison-rank { position: sticky; left: 0; z-index: 7; }
.comparison-table thead tr:first-child th:nth-child(2),
.comparison-table .comparison-name { position: sticky; left: 44px; z-index: 6; }
.comparison-table thead tr:first-child th:first-child,
.comparison-table thead tr:first-child th:nth-child(2) { z-index: 9; }
.comparison-table tfoot td { position: sticky; bottom: 0; z-index: 5; color: #fff; background: #123758; font-weight: 800; }
.comparison-table tfoot td:first-child { text-align: left; }
.comparison-positive,
.comparison-negative,
.comparison-neutral { display: inline-flex; align-items: center; justify-content: flex-end; gap: 4px; font-weight: 800; }
.comparison-positive { color: #0b9876; }
.comparison-negative { color: #d34655; }
.comparison-neutral { color: var(--text-muted); }
.comparison-positive small,
.comparison-negative small,
.comparison-neutral small { padding: 2px 5px; border-radius: 999px; font-size: 8px; line-height: 1.2; }
.comparison-positive small { color: #08755c; background: rgba(11, 152, 118, 0.14); }
.comparison-negative small { color: #b42e3e; background: rgba(211, 70, 85, 0.14); }
.comparison-neutral small { color: var(--text-muted); background: var(--table-header); }
.comparison-empty { padding: 28px !important; color: var(--text-muted); text-align: center !important; }
[data-theme="dark"] .comparison-table tbody tr:hover td { background: rgba(255, 255, 255, 0.04); }

/* Admin gets an unmistakable staging treatment too. */
.admin-page .admin-shell-header { background: linear-gradient(110deg, #36166b, #17356d 58%, #0b6e77 118%); }
.admin-page .admin-tabs { background: linear-gradient(165deg, #211242, #11264a); }
.admin-page .preview-environment { background: linear-gradient(90deg, #6f37b7, #8552c8 55%, #4a2890); }

@media (max-width: 1180px) {
    .dashboard-page.feature-authenticated .container { grid-template-columns: 220px minmax(0, 1fr); gap: 15px; }
    .dashboard-page.feature-authenticated #toolbar .filter-grid { grid-template-columns: repeat(3, minmax(140px, 1fr)); }
    .feature-sidebar .r-tab-btn { font-size: 11px; }
}

@media (max-width: 920px) {
    .dashboard-page.feature-authenticated .container { display: block; }
    .dashboard-page.feature-authenticated .feature-sidebar {
        position: static;
        min-height: 0;
        max-height: none;
        margin-bottom: 14px;
        padding: 12px;
    }
    .feature-sidebar-brand,
    .feature-sidebar-caption,
    .feature-sidebar-note { display: none; }
    .feature-sidebar .report-tabs { flex-direction: row; overflow-x: auto; }
    .feature-sidebar .r-tab-btn { width: auto; flex: 0 0 auto; }
    .feature-sidebar-user { margin-top: 8px; }
    .feature-sidebar #userActionMenu { flex-direction: row; justify-content: space-between; }
    .dashboard-page.feature-authenticated #dashHeader,
    .dashboard-page.feature-authenticated #toolbar,
    .dashboard-page.feature-authenticated #kpiCards,
    .dashboard-page.feature-authenticated #kpiCardsQc,
    .dashboard-page.feature-authenticated #dashboard,
    .dashboard-page.feature-authenticated #tableWrapper { margin-bottom: 14px; }
    .dashboard-page.feature-authenticated #toolbar .filter-grid { grid-template-columns: repeat(2, minmax(130px, 1fr)); }
    .dashboard-page.feature-authenticated #kpiCardsQc { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .comparison-table-heading { align-items: flex-start; flex-direction: column; }
    .comparison-periods { justify-content: flex-start; }
}

@media (max-width: 600px) {
    .ui-preview .preview-environment { padding-left: 12px; }
    .dashboard-page.feature-authenticated { padding-inline: 9px; }
    .dashboard-page.feature-authenticated #toolbar .filter-grid { grid-template-columns: 1fr; }
    .dashboard-page.feature-authenticated #toolbar .filter-item[style*="flex: 1.5"],
    .dashboard-page.feature-authenticated #toolbar .filter-item[style*="min-width: 380px"] { grid-column: auto; }
    .dashboard-page.feature-authenticated .kpi-grid,
    .dashboard-page.feature-authenticated #kpiCardsQc { grid-template-columns: 1fr; }
    .dashboard-page.feature-authenticated #toolbar .toolbar-top { align-items: flex-start; }
    .live-status { display: none; }
    .feature-sidebar #userActionMenu { flex-direction: column; }
}
