body {
    font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
}

.theme-transition,
.theme-transition *,
.theme-transition *:before,
.theme-transition *:after {
    transition: background-color 0.3s ease-out, color 0.3s ease-out, border-color 0.3s ease-out, fill 0.3s ease-out !important;
    transition-delay: 0s !important;
}

.wrapper {
    min-height: 100vh;
    display: flex; /* Убедимся, что это флекс-контейнер */
}

.sidebar {
    width: 248px;
    height: 100vh;
    position: sticky;
    top: 0;
    left: 0;
    background-color: var(--bs-body-bg);
    border-right: 1px solid var(--bs-border-color);
    transition: width 0.3s ease;
    display: flex;
    flex-direction: column;
    z-index: 1000;
    overflow-x: hidden; /* Скрываем контент при сужении */
    flex-shrink: 0; /* Запрещаем сжатие флексом */
}

.sidebar.collapsed {
    width: 72px;
}

/* Скрытие текста в свернутом состоянии */
.sidebar.collapsed .sidebar-text,
.sidebar.collapsed .sidebar-brand-text,
.sidebar.collapsed .dropdown-toggle::after {
    display: none !important;
    opacity: 0;
}

/* Центрирование иконок в свернутом состоянии */
.sidebar.collapsed .nav-link {
    justify-content: center;
    padding-left: 0;
    padding-right: 0;
}

.sidebar.collapsed .nav-link i {
    margin-right: 0 !important;
    font-size: 1.2rem;
}

/* Стили меню */
.sidebar .nav-link {
    color: var(--bs-body-color);
    display: flex;
    align-items: center;
    padding: 0.6rem 2rem;
    font-size: 0.9rem;
    white-space: nowrap; /* Текст не переносится */
    border-radius: 0.375rem;
    margin-bottom: 0.2rem;
}

.sidebar .nav-link:hover {
    background-color: var(--bs-tertiary-bg);
}

.sidebar .nav-link.active {
    background-color: rgba(13, 110, 253, 0.1); /* Легкий синий фон */
    color: var(--bs-primary);
    font-weight: 500;
}

.sidebar .nav-link i {
    width: 24px;
    text-align: center;
    margin-right: 10px;
    font-size: 1.2rem;
}

.sidebar-group-title {
    font-size: 0.8rem;
    text-transform: uppercase;
    font-weight: 600;
    padding: 1rem 1rem 0.5rem;
    white-space: nowrap;
}

.sidebar-footer {
    margin-top: auto;
    padding: 0.75rem 1rem 1rem;
    border-top: 1px solid var(--bs-border-color);
}

.sidebar-profile {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.35rem 0.45rem 0.35rem 0.35rem;
    border-radius: 999px;
    background-color: var(--bs-body-bg);
}

.sidebar-profile-main {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sidebar-profile-avatar {
    width: 36px;
    height: 36px;
    border-radius: 999px;
    background-color: var(--bs-secondary-bg, var(--bs-tertiary-bg));
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: var(--bs-secondary-color);
    font-size: 1rem;
}

.sidebar-profile-name {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--bs-body-color);
}

/* Кнопка выхода: маленький “чип” справа */
.sidebar-logout-btn {
    border: 0;
    padding: 0.25rem 0.45rem;
    border-radius: 999px;
    background-color: transparent;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--bs-danger);
}

.sidebar-logout-btn i {
    font-size: 1rem;
}

/* --- Поведение в свернутом сайдбаре --- */

.sidebar.collapsed .sidebar-footer {
    padding-inline: 0.5rem;
}

.sidebar.collapsed .sidebar-profile {
    justify-content: center;
    padding-inline: 0;
}

/* Скрываем текст и кнопку выхода, оставляем только кружок */
.sidebar.collapsed .sidebar-profile-text,
.sidebar.collapsed .sidebar-logout-btn {
    display: none !important;
}

.top-nav {
    position: sticky;
    top: 0;
    z-index: 900;
    background-color: var(--bs-body-bg);
}

.page-content {
    min-height: calc(100vh - 64px);
}

/* Пунктирный разделитель для колонок на десктопе */
@media (min-width: 1200px) {
    .report-separator-start {
        border-left: 1px dashed var(--bs-border-color); /* Используем стандартный цвет границ темы */
    }
}

/* Стили для формы создания отчёта */
/* Секции формы отчёта – лёгкое визуальное объединение */
.form-section {
    border-radius: var(--bs-border-radius-lg);
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.25rem;
    background-color: var(--bs-body-bg);
    border: 1px solid var(--bs-border-color);
}

/* Заголовок секции */
.form-section-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.form-section-icon {
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--bs-border-radius-lg);
    background-color: var(--bs-primary-bg-subtle);
    color: var(--bs-primary);
    font-size: 1rem;
}

.form-section-title {
    margin: 0;
    font-size: 0.9rem;
    font-weight: 600;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--bs-secondary-color);
}

/* Под Bootstrap 5.3: слегка донастраиваем поля */
.form-label {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--bs-secondary-color);
}

/* Базовое состояние */
.form-control,
.form-select {
    border-radius: var(--bs-border-radius-lg);
    border-color: var(--bs-border-color);
    background-color: var(--bs-body-bg);
    padding: 0.5rem 0.75rem;
    font-size: 0.9rem;
}

/* Hover */
.form-control:hover,
.form-select:hover {
    border-color: var(--bs-border-color-translucent, var(--bs-border-color));
}

/* Focus — ровно в стиле Bootstrap 5.3, но немного мягче */
.form-control:focus,
.form-select:focus {
    border-color: var(--bs-primary);
    box-shadow: 0 0 0 0.2rem rgba(var(--bs-primary-rgb), .18);
    background-color: var(--bs-body-bg);
}

/* Placeholder и help-текст – компактные и менее заметные */
.form-control::placeholder {
    color: var(--bs-secondary-color);
    opacity: .75;
    font-size: 0.85rem;
}

.form-text {
    font-size: 0.8rem;
    color: var(--bs-secondary-color);
    margin-top: 0.25rem;
}

/* Ошибки валидации: используем стандартные цвета Bootstrap */
.is-invalid {
    border-color: var(--bs-danger) !important;
    box-shadow: none;
}

.invalid-feedback {
    font-size: 0.8rem;
    margin-top: 0.25rem;
}

/* Кнопки действий внизу формы */
.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: .75rem;
    margin-top: 1.5rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--bs-border-color);
}

.btn {
    border-radius: var(--bs-border-radius-pill);
    font-weight: 500;
}

.custom-file-wrapper {
    min-height: 2.25rem;
}

.tier1-page {
    --tier1-bg: #F4F7FB;
    --tier1-surface: #FFFFFF;
    --tier1-ink: #16202E;
    --tier1-muted: #67748A;
    --tier1-line: #E7ECF3;
    --tier1-line-soft: #EEF2F7;
    --tier1-blue: #2E6BE6;
    --tier1-blue-dark: #1E51BE;
    --tier1-blue-soft: #E7EEFC;
    --tier1-teal: #0CA678;
    --tier1-amber: #E8820C;
    --tier1-coral: #E8590C;
    --tier1-violet: #6741D9;
    --tier1-violet-soft: #EDE9FC;
    --tier1-red: #E03131;
    --tier1-green: #2F9E44;

    background: var(--tier1-bg);
    border: 1px solid var(--tier1-line);
    border-radius: 16px;
    padding: 0;
    overflow: hidden;
}

.tier1-cohortbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    background: linear-gradient(90deg, #F0F4FC, #F7F9FD);
    border-bottom: 1px solid var(--tier1-line);
    padding: 14px 18px;
}

.tier1-cohortbar-label {
    color: var(--tier1-muted);
    font-size: 13px;
    font-weight: 600;
}

.tier1-cohort-form {
    display: inline-flex;
    gap: 3px;
    border: 1px solid var(--tier1-line);
    border-radius: 10px;
    background: #fff;
    padding: 4px;
}

.tier1-seg-btn {
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--tier1-muted);
    padding: 7px 14px;
    font-size: 13px;
    font-weight: 600;
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    line-height: 1.2;
}

.tier1-seg-btn small {
    color: #8a97ac;
    font-size: 10px;
    font-weight: 500;
}

.tier1-seg-btn.is-on {
    background: var(--tier1-blue);
    color: #fff;
}

.tier1-seg-btn.is-on small {
    color: #dce8fc;
}

.tier1-hint {
    background: var(--tier1-blue-soft);
    color: var(--tier1-muted);
    border-radius: 8px;
    padding: 5px 10px;
    font-size: 12px;
}

.tier1-filters {
    display: flex;
    flex-wrap: wrap;
    align-items: end;
    gap: 8px;
    padding: 12px 18px;
    border-bottom: 1px solid var(--tier1-line);
    background: var(--tier1-surface);
}

.tier1-filter-field {
    display: inline-flex;
    flex-direction: column;
    gap: 4px;
}

.tier1-filter-key {
    color: var(--tier1-muted);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.tier1-filter-field input,
.tier1-filter-field select {
    min-width: 132px;
    border: 1px solid var(--tier1-line);
    border-radius: 8px;
    padding: 6px 10px;
    font-size: 13px;
    background: #fff;
}

.tier1-period-badge {
    margin-left: auto;
    background: var(--tier1-blue-soft);
    color: var(--tier1-blue-dark);
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    padding: 5px 10px;
}

.tier1-min-date {
    color: var(--tier1-muted);
    font-size: 12px;
}

.tier1-kpi-row {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    padding: 16px 18px 2px;
}

.tier1-kpi {
    border: 1px solid var(--tier1-line);
    border-radius: 14px;
    background: var(--tier1-surface);
    box-shadow: 0 1px 2px rgba(22, 32, 46, 0.04), 0 6px 20px rgba(22, 32, 46, 0.05);
    padding: 14px 16px;
}

.tier1-kpi-label {
    color: var(--tier1-muted);
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 12px;
    font-weight: 600;
}

.tier1-kpi-metrics {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px 12px;
    margin-top: 8px;
}

.tier1-kpi-metrics.is-single {
    grid-template-columns: 1fr;
}

.tier1-kpi-metric-caption {
    color: var(--tier1-muted);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: .02em;
}

.tier1-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.tier1-kpi-value {
    margin-top: 2px;
    font-size: 24px;
    line-height: 1.1;
    font-weight: 700;
    letter-spacing: -0.6px;
    font-variant-numeric: tabular-nums;
}

.tier1-kpi-metrics.is-single .tier1-kpi-value {
    margin-top: 6px;
    font-size: 27px;
}

.tier1-kpi-delta {
    margin-top: 4px;
    font-size: 11px;
    font-weight: 600;
}

.tier1-kpi-delta.is-up {
    color: var(--tier1-green);
}

.tier1-kpi-delta.is-down {
    color: var(--tier1-red);
}

.tier1-kpi-note {
    margin-top: 8px;
    color: #8f9cb1;
    font-size: 10px;
    font-weight: 500;
}

.tier1-sec {
    padding: 8px 18px 16px;
}

.tier1-sec-head h2 {
    font-size: 16px;
    font-weight: 700;
    margin: 0;
}

.tier1-sec-head p {
    margin: 2px 0 10px;
    color: var(--tier1-muted);
    font-size: 12px;
}

.tier1-card {
    background: var(--tier1-surface);
    border: 1px solid var(--tier1-line);
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 1px 2px rgba(22, 32, 46, 0.04), 0 6px 20px rgba(22, 32, 46, 0.05);
}

.tier1-card-hd {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid var(--tier1-line-soft);
    padding: 12px 16px;
}

.tier1-card-hd-main {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.tier1-card-hd h3,
.tier1-card-hd-main h3 {
    margin: 0;
    font-size: 13px;
    font-weight: 600;
}

.tier1-card-hd > span,
.tier1-card-hd-main span {
    color: var(--tier1-muted);
    font-size: 11px;
}

.tier1-detail-btn {
    flex-shrink: 0;
    border: 1px solid var(--tier1-line);
    background: var(--tier1-surface);
    color: var(--tier1-blue-dark);
    border-radius: 8px;
    padding: 6px 10px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}

.tier1-detail-btn:hover {
    background: var(--tier1-line-soft);
}

.tier1-auth-login-detail {
    grid-column: 1 / -1;
}

.tier1-fstep-meta.is-loss {
    color: var(--tier1-red);
}

.tier1-card-pad {
    padding: 14px 16px;
}

.tier1-grid-2 {
    display: grid;
    gap: 14px;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

.tier1-table {
    width: 100%;
    border-collapse: collapse;
}

.tier1-table th,
.tier1-table td {
    border-bottom: 1px solid var(--tier1-line-soft);
    padding: 10px 12px;
    font-size: 13px;
}

.tier1-table th {
    background: var(--tier1-line-soft);
    color: var(--tier1-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .03em;
    font-size: 11px;
}

.tier1-table-compare .is-metric,
.tier1-table-landing .is-entry {
    font-weight: 600;
}

.tier1-table-compare .is-new {
    color: var(--tier1-blue-dark);
    font-weight: 700;
}

.tier1-table-compare .is-old {
    color: var(--tier1-violet);
    font-weight: 700;
}

.tier1-table-landing th:not(:first-child),
.tier1-table-landing td:not(:first-child) {
    text-align: right;
}

.tier1-table-landing .is-good {
    color: var(--tier1-green);
    font-weight: 700;
}

.tier1-table-landing .is-bad {
    color: var(--tier1-red);
    font-weight: 700;
}

.tier1-abtag {
    margin-left: 6px;
    background: var(--tier1-violet-soft);
    color: var(--tier1-violet);
    border-radius: 6px;
    padding: 1px 6px;
    font-size: 10px;
    font-weight: 700;
}

.tier1-funnel {
    padding: 8px 16px 14px;
}

.tier1-fstep {
    display: grid;
    grid-template-columns: 180px minmax(0, 1fr) 92px;
    gap: 10px;
    align-items: center;
    padding: 8px 0;
}

.tier1-fstep-label div {
    font-size: 13px;
    font-weight: 500;
}

.tier1-fstep-label small {
    color: #8f9cb1;
    font-size: 11px;
}

.tier1-fstep-bar-wrap {
    background: var(--tier1-line-soft);
    border-radius: 8px;
    height: 30px;
    overflow: hidden;
}

.tier1-fstep-bar {
    background: linear-gradient(90deg, var(--tier1-blue), #4F86F2);
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    height: 100%;
    display: flex;
    align-items: center;
    padding: 0 10px;
    white-space: nowrap;
}

.tier1-fstep-bar.is-goal {
    background: linear-gradient(90deg, var(--tier1-teal), #1FBE8C);
}

.tier1-fstep-meta {
    text-align: right;
    color: var(--tier1-teal);
    font-size: 12px;
    font-weight: 600;
}

.tier1-methods {
    padding: 8px 16px 12px;
}

.tier1-mrow {
    display: grid;
    grid-template-columns: 90px minmax(0, 1fr) 64px;
    gap: 10px;
    align-items: center;
    border-bottom: 1px solid var(--tier1-line-soft);
    padding: 10px 0;
}

.tier1-mrow:last-child {
    border-bottom: 0;
}

.tier1-mname {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 13px;
    font-weight: 600;
}

.tier1-mbadge {
    width: 9px;
    height: 9px;
    border-radius: 3px;
}

.tier1-track {
    height: 8px;
    border-radius: 6px;
    background: var(--tier1-line-soft);
    overflow: hidden;
}

.tier1-track i {
    display: block;
    height: 100%;
    border-radius: 6px;
}

.tier1-msub {
    color: var(--tier1-muted);
    font-size: 11px;
    font-weight: 500;
    margin-top: 4px;
}

.tier1-mc {
    text-align: right;
    font-size: 13px;
    font-weight: 700;
}

.tier1-stat-grid {
    display: grid;
    gap: 10px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.tier1-stat-grid-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.tier1-stat-grid-5 {
    grid-template-columns: repeat(5, minmax(0, 1fr));
}

.tier1-stat {
    border: 1px solid var(--tier1-line);
    border-radius: 10px;
    padding: 10px 12px;
}

.tier1-stat.is-value {
    background: #FFF7ED;
    border-color: #FCE4C4;
}

.tier1-stat.is-star {
    background: linear-gradient(135deg, #1E40AF, #2563EB);
    border: none;
    color: #fff;
}

.tier1-stat.is-star .tier1-stat-label {
    color: rgba(255, 255, 255, 0.85);
}

.tier1-stat-value {
    font-size: 20px;
    font-weight: 700;
    line-height: 1.15;
    font-variant-numeric: tabular-nums;
}

.tier1-stat.is-star .tier1-stat-value {
    font-size: 24px;
    font-weight: 800;
}

.tier1-stat-label {
    margin-top: 2px;
    color: var(--tier1-muted);
    font-size: 11px;
}

.tier1-aig-funnel {
    padding: 10px 16px 16px;
}

.tier1-aig-split-note {
    margin: 6px 0 12px 240px;
    color: var(--tier1-muted);
    font-size: 12px;
    font-weight: 600;
}

.tier1-aig-split {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.tier1-aig-branch {
    border: 1px solid var(--tier1-line);
    border-radius: 12px;
    padding: 12px 12px 10px;
    background: #FAFBFD;
}

.tier1-aig-branch.is-demo {
    background: #FFFBF5;
    border-color: #FCE4C4;
}

.tier1-aig-branch.is-nodemo {
    background: #F8FAFC;
}

.tier1-aig-branch-hd {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--tier1-muted);
    margin-bottom: 10px;
}

.tier1-aig-branch.is-demo .tier1-aig-branch-hd {
    color: #B45309;
}

.tier1-aig-step {
    display: flex;
    align-items: stretch;
    gap: 0;
}

.tier1-aig-step.is-compact {
    flex-direction: column;
    gap: 6px;
    margin-bottom: 4px;
}

.tier1-aig-step.is-compact .tier1-aig-meta {
    width: auto;
    padding: 0;
}

.tier1-aig-title-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.tier1-aig-step.is-compact .tier1-aig-pcts {
    width: auto;
    text-align: left;
    padding-left: 0;
    display: flex;
    gap: 8px;
    align-items: baseline;
}

.tier1-aig-step.is-compact .tier1-aig-p1 {
    font-size: 14px;
}

.tier1-aig-meta {
    width: 240px;
    flex-shrink: 0;
    padding: 2px 14px 2px 0;
}

.tier1-aig-name {
    font-weight: 600;
    font-size: 13.5px;
}

.tier1-aig-step.is-compact .tier1-aig-name {
    font-size: 12.5px;
}

.tier1-aig-ev {
    font-size: 11px;
    color: #8f9cb1;
    font-family: ui-monospace, Menlo, monospace;
}

.tier1-aig-flag {
    display: inline-block;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 20px;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    white-space: nowrap;
    flex-shrink: 0;
}

.tier1-aig-flag.is-value {
    background: var(--tier1-amber);
    color: #fff;
}

.tier1-aig-flag.is-star {
    background: var(--tier1-blue);
    color: #fff;
}

.tier1-aig-flag.is-key {
    background: var(--tier1-violet-soft);
    color: var(--tier1-violet);
    border: 1px solid #E4D9FB;
}

.tier1-aig-track {
    flex: 1;
    display: flex;
    align-items: center;
    min-width: 0;
}

.tier1-aig-bar {
    height: 40px;
    background: var(--tier1-line-soft);
    border-radius: 9px;
    position: relative;
    flex: 1;
    overflow: hidden;
}

.tier1-aig-step.is-compact .tier1-aig-bar {
    height: 32px;
}

.tier1-aig-bar.is-keyline {
    box-shadow: inset 0 0 0 1.5px var(--tier1-violet);
}

.tier1-aig-bar > i {
    display: block;
    height: 100%;
    border-radius: 9px;
    background: linear-gradient(90deg, var(--tier1-blue), #4F86F2);
}

.tier1-aig-bar > i.is-value {
    background: linear-gradient(90deg, #F59E0B, #D97706);
}

.tier1-aig-bar > i.is-star {
    background: linear-gradient(90deg, #2563EB, #1E40AF);
}

.tier1-aig-cap {
    position: absolute;
    left: 12px;
    top: 0;
    height: 40px;
    display: flex;
    align-items: center;
    color: #fff;
    font-weight: 700;
    font-size: 14px;
    font-variant-numeric: tabular-nums;
}

.tier1-aig-step.is-compact .tier1-aig-cap {
    height: 32px;
    font-size: 13px;
}

.tier1-aig-pcts {
    width: 118px;
    flex-shrink: 0;
    text-align: right;
    padding-left: 12px;
}

.tier1-aig-p1 {
    font-weight: 800;
    font-size: 16px;
    font-variant-numeric: tabular-nums;
}

.tier1-aig-p2 {
    font-size: 11px;
    color: #8f9cb1;
}

.tier1-aig-drop {
    display: flex;
    align-items: center;
    margin: 0 0 0 240px;
    height: 24px;
}

.tier1-aig-drop.is-compact {
    margin-left: 0;
    margin-bottom: 6px;
    height: auto;
    min-height: 22px;
}

.tier1-aig-drop-line {
    flex: 1;
    border-left: 2px dashed #E2E8F0;
    height: 24px;
}

.tier1-aig-drop.is-compact .tier1-aig-drop-line {
    height: 18px;
}

.tier1-aig-dropchip {
    font-size: 11px;
    color: var(--tier1-red);
    background: #FEF2F2;
    border: 1px solid #FCD9D9;
    border-radius: 20px;
    padding: 2px 10px;
    font-weight: 600;
    white-space: nowrap;
    margin-left: 8px;
}

.tier1-aig-cut {
    margin-bottom: 11px;
}

.tier1-aig-cut-top {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    margin-bottom: 5px;
    color: var(--tier1-muted);
}

.tier1-aig-cut-pct {
    font-weight: 700;
    color: var(--tier1-ink);
}

.tier1-aig-sbar {
    height: 28px;
    background: var(--tier1-line-soft);
    border-radius: 7px;
    overflow: hidden;
    position: relative;
}

.tier1-aig-sbar > i {
    display: block;
    height: 100%;
    border-radius: 7px;
    background: var(--tier1-blue);
}

.tier1-aig-sbar > i.is-green {
    background: var(--tier1-green);
}

.tier1-aig-sbar > i.is-amber {
    background: var(--tier1-amber);
}

.tier1-aig-scap {
    position: absolute;
    left: 11px;
    top: 0;
    height: 28px;
    display: flex;
    align-items: center;
    color: #fff;
    font-weight: 700;
    font-size: 12px;
}

.tier1-aig-note {
    margin: 10px 0 0;
    color: var(--tier1-muted);
    font-size: 12px;
}

.tier1-subttl {
    margin: 14px 0 6px;
    color: var(--tier1-muted);
    font-size: 12px;
    font-weight: 600;
}

.tier1-tlist {
    list-style: none;
    margin: 0;
    padding: 0;
}

.tier1-tlist li {
    display: flex;
    align-items: center;
    gap: 9px;
    border-bottom: 1px solid var(--tier1-line-soft);
    padding: 7px 0;
    font-size: 13px;
}

.tier1-tlist li:last-child {
    border-bottom: 0;
}

.tier1-rank {
    width: 18px;
    height: 18px;
    border-radius: 5px;
    background: var(--tier1-blue-soft);
    color: var(--tier1-blue-dark);
    font-size: 11px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.tier1-tn {
    width: 170px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tier1-meter {
    flex: 1;
    height: 6px;
    border-radius: 4px;
    background: var(--tier1-line-soft);
    overflow: hidden;
}

.tier1-meter i {
    display: block;
    height: 100%;
    border-radius: 4px;
    background: var(--tier1-blue);
}

.tier1-pct {
    width: 48px;
    text-align: right;
    color: var(--tier1-muted);
    font-weight: 600;
}

.tier1-empty {
    color: var(--tier1-muted);
    font-size: 12px;
    padding: 4px 0;
}

.tier1-curve {
    padding: 8px 8px 0;
}

.tier1-legend {
    display: flex;
    gap: 16px;
    padding: 0 12px 6px;
    font-size: 11.5px;
    color: var(--tier1-muted);
}

.tier1-legend-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 5px;
    vertical-align: middle;
}

.tier1-legend-dot.is-current {
    background: var(--tier1-coral);
}

.tier1-legend-dot.is-prev {
    background: #C2CBDA;
}

.tier1-ret-sep {
    font-size: 13px;
    color: var(--tier1-muted);
    font-weight: 500;
}

.tier1-ret-rate {
    font-weight: 600;
}

.tier1-ret-rate.is-up {
    color: var(--tier1-green);
}

.tier1-ret-frac {
    color: var(--tier1-muted);
    font-weight: 500;
}

/* ===== User paths + weekly retention ===== */
.tier1-calc {
    font-size: 11.5px;
    color: var(--tier1-muted);
    background: #F8FAFC;
    border: 1px solid var(--tier1-line);
    border-left: 3px solid var(--tier1-blue);
    border-radius: 0 8px 8px 0;
    padding: 8px 11px;
    margin: 2px 0 16px;
    line-height: 1.45;
}

.tier1-calc b {
    color: var(--tier1-ink);
}

.tier1-calc.is-warn {
    border-left-color: var(--tier1-red);
    margin-top: 12px;
}

.tier1-path {
    padding: 12px 0;
    border-bottom: 1px solid var(--tier1-line-soft);
}

.tier1-path:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.tier1-path-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.tier1-path-share {
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    min-width: 42px;
    color: var(--tier1-blue);
    font-size: 15px;
}

.tier1-path-step {
    background: #F1F5F9;
    border-radius: 7px;
    padding: 5px 10px;
    font-size: 12.5px;
    white-space: nowrap;
}

.tier1-path-step.is-dest {
    background: var(--tier1-blue-soft);
    color: var(--tier1-blue);
    font-weight: 600;
    border: 1px solid #D3E3FF;
}

.tier1-path-step.is-other {
    background: #fff;
    border: 1px dashed var(--tier1-line);
    color: var(--tier1-muted);
}

.tier1-path-arw {
    color: #94A3B8;
}

.tier1-path-cnt {
    font-size: 11px;
    color: #94A3B8;
    margin: 5px 0 0 50px;
    font-variant-numeric: tabular-nums;
}

.tier1-ex-row {
    margin-bottom: 12px;
}

.tier1-ex-top {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    font-size: 13px;
    margin-bottom: 5px;
}

.tier1-ex-name small {
    color: #94A3B8;
    font-size: 11px;
    font-weight: 400;
    margin-left: 4px;
}

.tier1-ex-pct {
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    flex-shrink: 0;
}

.tier1-ebar {
    height: 24px;
    background: #F1F5F9;
    border-radius: 6px;
    overflow: hidden;
}

.tier1-ebar > i {
    display: block;
    height: 100%;
    border-radius: 6px;
    background: var(--tier1-red);
}

.tier1-ebar > i.is-mid {
    background: var(--tier1-amber);
}

.tier1-ebar > i.is-low {
    background: #94A3B8;
}

.tier1-adopt-table th.is-num,
.tier1-adopt-table td.is-num {
    text-align: right;
}

.tier1-feat-name {
    font-weight: 600;
}

.tier1-abar {
    position: relative;
    height: 22px;
    background: #F1F5F9;
    border-radius: 6px;
    min-width: 120px;
}

.tier1-abar > i {
    display: block;
    height: 100%;
    border-radius: 6px;
    background: #3B82F6;
}

.tier1-abar-lab {
    position: absolute;
    left: 9px;
    top: 0;
    height: 22px;
    display: flex;
    align-items: center;
    color: #fff;
    font-weight: 700;
    font-size: 12px;
    font-variant-numeric: tabular-nums;
}

.tier1-feat-status {
    font-size: 12px;
    font-weight: 600;
}

.tier1-feat-status.is-core {
    color: var(--tier1-green);
}

.tier1-feat-status.is-killer {
    color: var(--tier1-blue);
}

.tier1-feat-status.is-dead {
    color: var(--tier1-red);
}

.tier1-ret-two {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 14px;
    align-items: start;
}

.tier1-cgrid {
    width: auto;
    border-collapse: separate;
    border-spacing: 4px;
}

.tier1-cgrid th {
    font-size: 11px;
    color: #94A3B8;
    text-transform: none;
    letter-spacing: 0;
    border: none;
    background: transparent;
    padding: 4px 6px;
    text-align: center;
    font-weight: 600;
}

.tier1-cgrid td {
    border: none;
    padding: 0;
    background: transparent;
}

.tier1-cw {
    font-size: 12px;
    color: var(--tier1-muted);
    white-space: nowrap;
    padding-right: 8px !important;
}

.tier1-rcell {
    width: 56px;
    height: 34px;
    border-radius: 7px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 12.5px;
    font-variant-numeric: tabular-nums;
    color: #fff;
}

.tier1-rcell.is-empty {
    background: #F1F5F9;
    color: #94A3B8;
}

.tier1-metrbox {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.tier1-metr {
    border: 1px solid var(--tier1-line);
    border-radius: 11px;
    padding: 14px;
}

.tier1-metr-v {
    font-size: 24px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.tier1-metr-l {
    font-size: 11.5px;
    color: #94A3B8;
    margin-top: 2px;
}

.tier1-ret-callout {
    background: #ECFDF3;
    border: 1px solid #C7EBD5;
    border-radius: 11px;
    padding: 12px 14px;
    font-size: 12.5px;
    color: #166534;
    margin-top: 12px;
    line-height: 1.45;
}

.tier1-ret-callout b {
    font-weight: 700;
}

@media (max-width: 1200px) {
    .tier1-kpi-row {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .tier1-stat-grid-3 {
        grid-template-columns: minmax(0, 1fr);
    }

    .tier1-stat-grid-5 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .tier1-aig-meta {
        width: 160px;
    }

    .tier1-aig-drop {
        margin-left: 160px;
    }

    .tier1-aig-split-note {
        margin-left: 0;
    }

    .tier1-aig-split {
        grid-template-columns: minmax(0, 1fr);
    }

    .tier1-aig-pcts {
        width: 90px;
    }

    .tier1-grid-2,
    .tier1-ret-two {
        grid-template-columns: minmax(0, 1fr);
    }

    .tier1-fstep {
        grid-template-columns: 1fr;
    }

    .tier1-fstep-meta {
        text-align: left;
    }

    .tier1-mrow {
        grid-template-columns: 1fr;
    }

    .tier1-mc {
        text-align: left;
    }
}

@media (max-width: 760px) {
    .tier1-period-badge {
        margin-left: 0;
    }
}

/* ===== Tier tabs + Tier 2 ===== */
.tier-tabs {
    display: flex;
    gap: 4px;
    padding: 12px 18px 0;
    background: var(--tier1-surface);
    border-bottom: 1px solid var(--tier1-line);
}

.tier-tab {
    padding: 9px 14px;
    font-weight: 600;
    font-size: 13.5px;
    color: var(--tier1-muted);
    text-decoration: none;
    border-bottom: 2px solid transparent;
    border-radius: 6px 6px 0 0;
}

.tier-tab:hover {
    color: var(--tier1-ink);
}

.tier-tab.is-on {
    color: var(--tier1-blue-dark);
    border-bottom-color: var(--tier1-blue);
}

.tier2-segmentbar {
    border-radius: 12px;
    border: 1px solid var(--tier1-line);
    margin-bottom: 16px;
}

.tier2-grid {
    display: grid;
    gap: 16px;
    grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
}

.tier2-table-wrap {
    overflow-x: auto;
}

.tier2-utable {
    width: 100%;
    border-collapse: collapse;
}

.tier2-utable th,
.tier2-utable td {
    padding: 11px 14px;
    border-bottom: 1px solid var(--tier1-line-soft);
    font-size: 13px;
    text-align: left;
    white-space: nowrap;
}

.tier2-utable th {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--tier1-muted);
    background: var(--tier1-line-soft);
    font-weight: 600;
}

.tier2-utable tbody tr {
    cursor: pointer;
}

.tier2-utable tbody tr:hover,
.tier2-utable tbody tr.is-sel {
    background: var(--tier1-blue-soft);
}

.tier2-utable tbody tr.is-sel {
    box-shadow: inset 3px 0 0 var(--tier1-blue);
}

.tier2-uid {
    font-weight: 700;
}

.tier2-chip {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 20px;
}

.tier2-chip.is-new {
    background: var(--tier1-blue-soft);
    color: var(--tier1-blue-dark);
}

.tier2-chip.is-old {
    background: var(--tier1-violet-soft);
    color: var(--tier1-violet);
}

.tier2-yes {
    color: var(--tier1-teal);
    font-weight: 700;
}

.tier2-no {
    color: #97A2B4;
    font-weight: 700;
}

.tier2-detail {
    position: sticky;
    top: 16px;
    align-self: start;
}

.tier2-detail-empty {
    padding: 8px 0;
}

.tier2-uhead {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--tier1-line-soft);
    margin-bottom: 14px;
}

.tier2-uava {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--tier1-blue), #4F86F2);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 15px;
    flex-shrink: 0;
}

.tier2-un {
    font-weight: 700;
    font-size: 15px;
}

.tier2-us {
    font-size: 12px;
    color: var(--tier1-muted);
    margin-top: 2px;
}

.tier2-ustats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 16px;
}

.tier2-ustat {
    background: var(--tier1-line-soft);
    border-radius: 9px;
    padding: 9px 10px;
    text-align: center;
}

.tier2-ustat .v {
    font-size: 17px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.tier2-ustat .l {
    font-size: 10.5px;
    color: var(--tier1-muted);
    margin-top: 1px;
}

.tier2-jtitle {
    font-size: 12px;
    font-weight: 600;
    color: var(--tier1-muted);
    margin: 4px 0 10px;
}

.tier2-timeline {
    list-style: none;
    position: relative;
    padding-left: 22px;
    margin: 0;
}

.tier2-timeline:before {
    content: "";
    position: absolute;
    left: 7px;
    top: 4px;
    bottom: 4px;
    width: 2px;
    background: var(--tier1-line);
}

.tier2-timeline li {
    position: relative;
    padding: 5px 0 5px 4px;
    font-size: 13px;
}

.tier2-timeline li:before {
    content: "";
    position: absolute;
    left: -19px;
    top: 9px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #fff;
    border: 2px solid var(--tier1-blue);
}

.tier2-timeline li.is-goal:before {
    background: var(--tier1-teal);
    border-color: var(--tier1-teal);
}

.tier2-tm {
    font-size: 11px;
    color: #97A2B4;
    margin-left: 8px;
}

.tier2-badge {
    font-size: 10px;
    font-weight: 700;
    padding: 1px 7px;
    border-radius: 5px;
    margin-left: 6px;
}

.tier2-badge.is-goal {
    color: var(--tier1-teal);
    background: #E2F6EF;
}

.tier2-badge.is-drop {
    color: var(--tier1-coral);
    background: #FBE4E4;
}

.tier2-keyscreens {
    margin: 4px 0 14px;
}

.tier2-kscreens {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.tier2-kscreen {
    font-size: 11.5px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 7px;
    border: 1px solid transparent;
}

.tier2-kscreen.is-reached {
    color: var(--tier1-green);
    background: #E7F6EB;
    border-color: #C5E6CD;
}

.tier2-kscreen.is-missed {
    color: #9A5426;
    background: #FFF4EA;
    border-color: #F0D2BC;
}

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

    .tier2-detail {
        position: static;
    }
}
