/* ==========================================================================
   Админский layout: тёмный сайдбар + светлая рабочая область (по мокапам
   Support Admin UI). Дополняет base.css; страницы саппорт-дашборда не трогает.
   ========================================================================== */

/* --------------------------------------------------------------------------
   Каркас
   -------------------------------------------------------------------------- */
.admin-shell {
    display: flex;
    align-items: stretch;
    min-height: 100vh;
    background: var(--bg);
}

.admin-main {
    flex: 999 1 560px;
    min-width: 0;
    box-sizing: border-box;
    padding: 20px 28px 40px 28px;
}

.guest-main {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--bg);
    padding: 24px 16px;
}

/* --------------------------------------------------------------------------
   Сайдбар
   -------------------------------------------------------------------------- */
.admin-sidebar {
    width: 248px;
    min-width: 232px;
    max-width: 280px;
    flex: 0 0 auto;
    box-sizing: border-box;
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    padding: 20px 14px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.admin-shell > .admin-sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.admin-sidebar--offcanvas {
    width: 100%;
    max-width: none;
    min-height: 100%;
}

.admin-sidebar__brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 8px 16px 8px;
}

.admin-sidebar__brand-link {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #fff;
    font-weight: 600;
    font-size: 15px;
    text-decoration: none;
}

.admin-sidebar__brand-link:hover { color: #fff; }

.admin-sidebar__logo {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    background: var(--primary);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 15px;
}

.admin-sidebar__env {
    margin-left: auto;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: .08em;
    color: var(--sidebar-muted);
    border: 1px solid var(--sidebar-line);
    border-radius: 6px;
    padding: 2px 6px;
}

.admin-sidebar__section {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .09em;
    text-transform: uppercase;
    color: var(--sidebar-muted);
    padding: 14px 10px 4px 10px;
}

.admin-sidebar__item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 8px;
    color: var(--sidebar-text);
    font-weight: 500;
    font-size: 14px;
    text-decoration: none;
}

.admin-sidebar__item:hover {
    color: #fff;
    background: rgba(255, 255, 255, .06);
    text-decoration: none;
}

.admin-sidebar__item.is-active,
.admin-sidebar__item.is-active:hover {
    background: var(--primary);
    color: #fff;
    font-weight: 600;
}

.admin-sidebar__item svg { flex: 0 0 auto; }

.admin-sidebar__badge {
    margin-left: auto;
    background: var(--primary);
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    border-radius: 9px;
    padding: 1px 7px;
}

.admin-sidebar__item.is-active .admin-sidebar__badge {
    background: rgba(255, 255, 255, .22);
}

.admin-sidebar__badge--amber {
    background: #3a3324;
    color: #f0b429;
}

.admin-sidebar__user {
    margin-top: auto;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 10px 4px 10px;
    border-top: 1px solid var(--sidebar-line);
}

.admin-sidebar__avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #2b3447;
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 12px;
    flex: 0 0 auto;
}

.admin-sidebar__user-meta { min-width: 0; }

/* Страница пользователя (views/user/view.php) */
.user-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 16px;
    flex: 0 0 auto;
}

.user-password { margin-top: 16px; }
.user-password__form { max-width: 420px; }

/* Профиль: 2FA */
.user-2fa { margin-top: 16px; }
.tfa { padding: 16px 20px 20px; }
.tfa b { font-weight: 600; }
.tfa p { margin: 2px 0 0; color: var(--text-2); font-size: 14px; }
.tfa__stack { display: grid; gap: 18px; }
.tfa__row { display: flex; gap: 16px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.tfa__row > div { min-width: 0; flex: 1 1 280px; }
.tfa__off { display: grid; grid-template-columns: 52px minmax(0, 1fr) auto; gap: 16px; align-items: center; }
.tfa__off form, .tfa__row form { margin: 0; }
.tfa__icon { width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center; background: var(--primary-50); color: var(--primary); }
.tfa__setup { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 28px; align-items: start; }
.tfa__qr { width: 200px; height: 200px; padding: 12px; border-radius: 12px; border: 1px solid var(--border); background: #fff; }
.tfa__qr svg { width: 100%; height: 100%; display: block; }
.tfa__step { display: grid; grid-template-columns: 26px minmax(0, 1fr); gap: 12px; margin-bottom: 18px; }
.tfa__step:last-child { margin-bottom: 0; }
.tfa__step-n { width: 26px; height: 26px; border-radius: 8px; background: var(--primary-50); color: var(--primary); display: grid; place-items: center; font: 600 13px var(--font-mono); }
.tfa__secret { display: inline-block; margin-top: 8px; padding: 7px 10px; border-radius: 8px; background: var(--bg); border: 1px dashed var(--border-strong); color: var(--text); font-size: 13px; letter-spacing: .06em; word-break: break-all; }
.tfa__form { display: flex; gap: 10px; align-items: flex-start; flex-wrap: wrap; margin-top: 10px; }
.tfa__form .tfa__form { margin-top: 0; }
.tfa__notice { margin-bottom: 14px; padding: 10px 12px; border-radius: 10px; font-size: 14px; }
.tfa__notice--success { background: var(--success-50); color: var(--success-600); }
.tfa__notice--error { background: #fbe5e3; color: #a42c24; }
.tfa__form-label { flex-basis: 100%; font-size: 14px; }
.tfa__code { margin: 0; width: 170px; }
.tfa__code .form-control { height: 38px; font-family: var(--font-mono); font-size: 16px; letter-spacing: .2em; text-align: center; }
.tfa__disable { flex: 0 1 auto; }
.tfa__disable summary { list-style: none; }
.tfa__disable summary::-webkit-details-marker { display: none; }
.tfa__disable[open] { flex-basis: 100%; padding: 14px; border-radius: 10px; border: 1px solid #f0c6c1; }
.tfa__disable[open] summary { display: none; }
.tfa__disable .tfa__form { margin-top: 0; }
.tfa__codes { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; padding: 14px; border-radius: 10px; background: var(--bg); border: 1px solid var(--border); font-size: 15px; }
.tfa__codes span { text-align: center; padding: 6px 0; }
.tfa__note { padding: 11px 12px; border-radius: 10px; background: #fdf1d8; color: #8a5600; font-size: 13px; }
.tfa__actions { display: flex; gap: 8px; flex-wrap: wrap; }
@media (max-width: 720px) {
    .tfa__setup { grid-template-columns: minmax(0, 1fr); }
    .tfa__qr { margin: 0 auto; }
    .tfa__off { grid-template-columns: 44px minmax(0, 1fr); }
    .tfa__off form { grid-column: 1 / -1; }
    .tfa__icon { width: 44px; height: 44px; }
    .tfa__codes { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

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

.admin-sidebar__profile:hover .admin-sidebar__user-name { text-decoration: underline; }

.admin-sidebar__user-name {
    display: block;
    color: #fff;
    font-weight: 500;
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.admin-sidebar__user-role {
    display: block;
    font-size: 12px;
    color: var(--sidebar-muted);
}

.admin-sidebar__dot {
    margin-left: auto;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #5b6471;
    flex: 0 0 auto;
}

.admin-sidebar__dot.is-online { background: var(--online); }

.admin-sidebar__logout-form { display: inline-flex; }

.admin-sidebar__logout {
    background: none;
    border: none;
    color: var(--sidebar-muted);
    padding: 4px;
    cursor: pointer;
    display: inline-flex;
}

.admin-sidebar__logout:hover { color: #fff; }

/* --------------------------------------------------------------------------
   Мобильный топбар + offcanvas
   -------------------------------------------------------------------------- */
.admin-topbar {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--sidebar-bg);
    color: #fff;
    padding: 10px 14px;
    position: sticky;
    top: 0;
    z-index: 1040;
}

.admin-topbar__burger {
    background: none;
    border: none;
    color: var(--sidebar-text);
    padding: 6px;
    cursor: pointer;
    display: inline-flex;
}

.admin-topbar__brand {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #fff;
    font-weight: 600;
    font-size: 15px;
    text-decoration: none;
}

.admin-topbar__brand:hover { color: #fff; }

.admin-offcanvas {
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    width: 280px;
}

.admin-offcanvas__header {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 2;
    padding: 0;
}

.admin-offcanvas__header .btn-close {
    filter: invert(1) grayscale(100%) brightness(180%);
}

.admin-offcanvas .offcanvas-body { padding: 0; display: flex; }

/* --------------------------------------------------------------------------
   Тулбар фильтров
   -------------------------------------------------------------------------- */
.toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px 14px;
    margin-bottom: 16px;
}

.toolbar__search {
    position: relative;
    display: flex;
    align-items: center;
    flex: 1 1 240px;
    max-width: 360px;
}

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

.toolbar__search input {
    width: 100%;
    box-sizing: border-box;
    font: inherit;
    font-size: 14px;
    padding: 8px 12px 8px 34px;
    border: 1px solid var(--border-strong);
    border-radius: 8px;
    background: var(--surface-soft);
    color: var(--text);
}

.toolbar label {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 13px;
    color: var(--text-2);
    margin: 0;
}

.toolbar select,
.toolbar .form-select {
    font-size: 13px;
    padding: 7px 28px 7px 10px;
    border: 1px solid var(--border-strong);
    border-radius: 8px;
    background-color: var(--surface);
    color: var(--text);
    width: auto;
}

/* Пилюли-фильтры (chips) */
.chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 500;
    padding: 7px 13px;
    border-radius: 16px;
    border: 1px solid var(--border-strong);
    background: var(--surface);
    color: var(--text-2);
    cursor: pointer;
    text-decoration: none;
}

.chip:hover { color: var(--text); text-decoration: none; border-color: var(--text-muted); }
.chip--sm { padding: 4px 9px; font-size: 11.5px; }

.chip.is-active,
.chip.is-active:hover {
    border-color: var(--primary);
    background: var(--primary);
    color: #fff;
    font-weight: 600;
}

/* --------------------------------------------------------------------------
   KPI-плитки
   -------------------------------------------------------------------------- */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.kpi-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 13px 15px;
}

.kpi-card__value {
    display: block;
    font-size: 22px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--text);
    line-height: 1.25;
}

.kpi-card__value small {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-muted);
}

.kpi-card__label {
    display: block;
    font-size: 12.5px;
    color: var(--text-2);
}

.kpi-card__hint {
    display: block;
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 14px 18px;
}

.summary-cell b {
    display: block;
    font-size: 20px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--text);
    line-height: 1.25;
}

.summary-cell > small {
    display: block;
    font-size: 12.5px;
    color: var(--text-2);
}

.kpi-card--warn { background: #fdf6e8; border-color: #f0d9b2; }
.kpi-card--warn .kpi-card__value,
.kpi-card--warn .kpi-card__label,
.kpi-card--warn .kpi-card__hint { color: #8a5600; }

.kpi-card--alert { background: #fdf6f5; border-color: #f2b8b2; }
.kpi-card--alert .kpi-card__value,
.kpi-card--alert .kpi-card__label,
.kpi-card--alert .kpi-card__hint { color: #a42c24; }

.kpi-card__hint--good { color: var(--delta-good); }
.kpi-card__hint--warn { color: #8a5600; }

/* --------------------------------------------------------------------------
   Пилюли статусов (пары цветов из мокапов)
   -------------------------------------------------------------------------- */
.pill--green  { color: #116632 !important; background: #def2e4 !important; }
.pill--blue   { color: #1c5cab !important; background: #e3edfb !important; }
.pill--amber  { color: #8a5600 !important; background: #fdf1d8 !important; }
.pill--red    { color: #a42c24 !important; background: #fbe5e3 !important; }
.pill--gray   { color: #555d6e !important; background: #edeff2 !important; }
.pill--violet { color: #54409e !important; background: #e9e4fb !important; }

/* --------------------------------------------------------------------------
   Переключатель (switch)
   -------------------------------------------------------------------------- */
.xswitch {
    width: 38px;
    height: 21px;
    border-radius: 11px;
    border: none;
    background: #c7ccd6;
    position: relative;
    cursor: pointer;
    padding: 0;
    flex: 0 0 auto;
}

.xswitch::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 15px;
    height: 15px;
    border-radius: 50%;
    background: #fff;
    transition: left .15s ease;
}

.xswitch.is-on { background: var(--online); }
.xswitch.is-on::after { left: 20px; }
.xswitch:disabled { opacity: .55; cursor: not-allowed; }

/* --------------------------------------------------------------------------
   CSS-графики
   -------------------------------------------------------------------------- */
.bars {
    display: flex;
    align-items: flex-end;
    gap: 4px;
    height: 100px;
}

.bars__col {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: center;
    gap: 2px;
    height: 100%;
    min-width: 0;
}

.bars__seg { width: 100%; border-radius: 0; }
.bars__seg:first-child { border-radius: 3px 3px 0 0; }
.bars__seg--main { background: var(--chart-1); }
.bars__seg--alt  { background: var(--chart-2); }

.bars__val {
    font-size: 11px;
    color: var(--text-2);
    font-variant-numeric: tabular-nums;
}

.bars-axis {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 6px;
    border-top: 1px solid var(--chart-grid);
    padding-top: 5px;
}

.chart-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    font-size: 12px;
    color: var(--text-2);
}

.chart-legend__item { display: inline-flex; align-items: center; gap: 5px; }

.chart-legend__swatch {
    width: 10px;
    height: 10px;
    border-radius: 3px;
    flex: 0 0 auto;
}

/* Горизонтальный бар (воронка, решение) */
.hbar-row {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
}

.hbar-row__label {
    width: 150px;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.hbar {
    flex: 1;
    height: 14px;
    background: var(--border-soft);
    border-radius: 4px;
    overflow: hidden;
}

.hbar__fill {
    display: block;
    height: 100%;
    background: var(--chart-1);
    border-radius: 4px;
}

.hbar-row__num {
    width: 44px;
    text-align: right;
    font-variant-numeric: tabular-nums;
    font-weight: 600;
}

.hbar-row__pct {
    width: 46px;
    text-align: right;
    font-size: 12px;
    color: var(--text-2);
    font-variant-numeric: tabular-nums;
}

.stackbar {
    display: flex;
    gap: 2px;
    height: 14px;
    border-radius: 4px;
    overflow: hidden;
}

/* Эффективность проектов (в панели сводки): длина полосы — объём, сегменты — итоги */
.summary-subhead {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 12px;
    margin: 18px 0 12px;
    padding-top: 14px;
    border-top: 1px solid var(--border-soft);
}
.summary-subhead h3 { margin: 0; font-size: 14px; font-weight: 600; }
.eff-chart { display: flex; flex-direction: column; gap: 10px; }
.eff-chart__head { font-size: 11.5px; color: var(--text-muted); }
.eff-chart__track { flex: 1; min-width: 0; }
.eff-chart__track .stackbar { min-width: 4px; }
.eff-chart .hbar-row__pct { width: 64px; }
.eff-item { border-radius: 8px; }
.eff-item > summary { list-style: none; cursor: pointer; padding: 4px 6px; margin: 0 -6px; border-radius: 8px; }
.eff-item > summary::-webkit-details-marker { display: none; }
.eff-item > summary:hover { background: var(--surface-soft); }
.eff-item > summary .hbar-row__label::before { content: '▸'; display: inline-block; width: 14px; color: var(--text-muted); transition: transform .15s; }
.eff-item[open] > summary .hbar-row__label::before { transform: rotate(90deg); }
.eff-item > summary .hbar-row__label { color: var(--primary); font-weight: 500; }
.eff-item > summary:hover .hbar-row__label { text-decoration: underline; text-underline-offset: 2px; }
.eff-item > summary:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.eff-item__body { margin: 6px 0 10px; padding: 12px 14px; background: var(--surface-soft); border: 1px solid var(--border-soft); border-radius: 10px; }
.eff-item__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 18px; font-size: 13px; color: var(--text-2); margin-bottom: 10px; }
.eff-item__meta b { color: var(--text); font-variant-numeric: tabular-nums; }
.eff-item__links { margin-left: auto; display: inline-flex; gap: 14px; font-weight: 500; }
/* Таблица остаётся таблицей на мобильном (с горизонтальной прокруткой), а не карточками без подписей */
@media (max-width: 720px) {
    .eff-item__body .qtable thead,
    .qtable--keep thead { display: table-header-group; }
    .eff-item__body .qtable tbody tr,
    .qtable--keep tbody tr { display: table-row; padding: 0; }
    .eff-item__body .qtable tbody td,
    .qtable--keep tbody td { display: table-cell; padding: 8px 10px; border-bottom: 1px solid var(--border-soft); white-space: nowrap; }
}
@media (max-width: 575.98px) {
    .eff-chart__fr { display: none; }
    .eff-chart .hbar-row { gap: 6px; }
    .eff-chart .hbar-row__label { width: 80px; }
    .eff-chart .hbar-row__num,
    .eff-chart .hbar-row__pct { width: 42px; }
}

/* --------------------------------------------------------------------------
   Живая лента
   -------------------------------------------------------------------------- */
.feed { display: flex; flex-direction: column; gap: 8px; max-height: 840px; overflow-y: auto; }

.feed-item {
    display: flex;
    gap: 10px;
    padding: 8px 12px;
    border-bottom: 1px solid var(--border-soft);
}

.feed-item:last-child { border-bottom: none; }

.feed-item--card {
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
}

.feed-item--pending { border-color: #d6e0f7; background: #f3f6fd; }
.feed-item--alert   { border-color: #f2b8b2; background: #fdf6f5; }

.feed-item__icon {
    width: 26px;
    height: 26px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
}

.feed-item__icon--blue  { background: #e3edfb; color: #1c5cab; }
.feed-item__icon--green { background: #def2e4; color: #116632; }
.feed-item__icon--red   { background: #fbe5e3; color: #a42c24; }
.feed-item__icon--amber { background: #fdf1d8; color: #8a5600; }
.feed-item__icon--gray  { background: #edeff2; color: #555d6e; }

.feed-item__body { min-width: 0; flex: 1; font-size: 13px; }

.feed-item__head { display: flex; gap: 8px; align-items: baseline; }

.feed-item__title { min-width: 0; }

.feed-item__time {
    margin-left: auto;
    font-size: 11.5px;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.feed-item__meta {
    display: block;
    color: var(--text-muted);
    font-size: 12.5px;
}

.feed-item--pending .feed-item__meta { color: #5a6271; font-size: 13px; }
.feed-item--alert .feed-item__meta   { color: #7c211a; font-size: 13px; }
.feed-item--alert .feed-item__title > b { color: #a42c24; }

.feed-item[data-href] { cursor: pointer; }
.feed-item[data-href]:not(.feed-item--card):hover { background: var(--surface-soft); }

.feed-item__actions { display: flex; gap: 8px; margin-top: 6px; }

.feed-item__btn {
    font-size: 12px;
    font-weight: 600;
    padding: 5px 11px;
    border: 1px solid var(--primary);
    border-radius: 7px;
    background: var(--surface);
    color: var(--primary);
    text-decoration: none;
}

.feed-item__btn:hover { background: var(--primary); color: #fff; text-decoration: none; }

.feed-item__btn--danger { border-color: #a42c24; background: #a42c24; color: #fff; }
.feed-item__btn--danger:hover { background: #7c211a; border-color: #7c211a; }

.feed-live {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.07em;
    color: #a42c24;
}

.live-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #d03b3b;
    animation: live-pulse 1.6s ease-in-out infinite;
}

@keyframes live-pulse {
    0%, 100% { opacity: 1; }
    50%      { opacity: .35; }
}

/* --------------------------------------------------------------------------
   Пагинация (yii LinkPager)
   -------------------------------------------------------------------------- */
.pagination { gap: 6px; }

.pagination .page-link {
    min-width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-strong);
    border-radius: 8px !important;
    background: var(--surface);
    color: var(--text-2);
    font-size: 13.5px;
    padding: 0 8px;
}

.pagination .active .page-link {
    border-color: var(--primary);
    background: var(--primary);
    color: #fff;
    font-weight: 600;
}

.pagination .disabled .page-link { color: var(--text-faint); background: var(--surface); }

/* --------------------------------------------------------------------------
   Прочее
   -------------------------------------------------------------------------- */
.avatar-badge {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 11.5px;
    background: #e3edfb;
    color: #1c5cab;
    flex: 0 0 auto;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    background: #c7ccd6;
}

.status-dot--online { background: var(--online); }
.status-dot--busy   { background: #f0b429; }

.page-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.page-head h1 {
    margin: 0;
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.page-head__sub {
    display: block;
    font-size: 13px;
    color: var(--text-2);
}

.page-head__actions {
    margin-left: auto;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.mono { font-family: var(--font-mono); }

.table-scroll { overflow-x: auto; }

/* --------------------------------------------------------------------------
   Мобильная адаптация
   -------------------------------------------------------------------------- */
@media (max-width: 991.98px) {
    .admin-main { padding: 14px 14px 32px 14px; }
}

@media (max-width: 720px) {
    .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .page-head__actions { margin-left: 0; width: 100%; }
    .toolbar__search { max-width: none; }
    .hbar-row__label { width: 110px; }
}

/* --------------------------------------------------------------------------
   Вкладки страницы (просмотр проекта и пр.)
   -------------------------------------------------------------------------- */
.view-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
    border-bottom: 1px solid var(--border-strong);
    margin-bottom: 16px;
    font-size: 14px;
}

.view-tabs__item {
    padding: 9px 14px;
    color: var(--text-2);
    text-decoration: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    white-space: nowrap;
}

.view-tabs__item:hover { color: var(--text); text-decoration: none; }

.view-tabs__item.is-active {
    font-weight: 600;
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.view-tabs__count { color: var(--text-muted); font-size: 12.5px; }

/* Две колонки контента */
.view-cols {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: flex-start;
}

.view-cols__main {
    flex: 999 1 560px;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.view-cols__side {
    flex: 1 1 320px;
    min-width: 300px;
    max-width: 440px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

@media (max-width: 991.98px) {
    .view-cols__side { max-width: none; }
}

/* Строки боковых панелей */
.side-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-soft);
    font-size: 13.5px;
}

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

.side-row__body { min-width: 0; flex: 1; }

.side-row__body b { display: block; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-row__body small { display: block; font-size: 12px; color: var(--text-muted); }

.side-quote {
    font-size: 13px;
    color: var(--text-2);
    background: var(--surface-soft);
    border-radius: 8px;
    padding: 9px 12px;
}

/* Таблицы в панелях */
.qtable--flat { width: 100%; border-collapse: collapse; }

.qtable--flat thead th {
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: .05em;
    text-transform: uppercase;
    color: var(--text-muted);
    text-align: left;
    padding: 8px;
    border-bottom: 1px solid var(--border-soft);
    white-space: nowrap;
}

.qtable--flat tbody td {
    padding: 9px 8px;
    border-bottom: 1px solid #f3f4f7;
    font-size: 13.5px;
    vertical-align: middle;
}

.qtable--flat tbody tr:last-child td { border-bottom: none; }

.qtable__sub { display: block; font-size: 12px; color: var(--text-muted); font-weight: 400; }

.qtable__empty { padding: 18px 8px; color: var(--text-2); font-size: 13.5px; }

.qtable__progress { display: inline-flex; align-items: center; gap: 8px; }
.qtable__progress .hbar { width: 80px; height: 6px; }
.qtable__progress .mono { font-size: 12px; color: var(--text-2); font-variant-numeric: tabular-nums; }

.preset-group {
    display: inline-flex;
    border: 1px solid var(--border-strong);
    border-radius: 9px;
    overflow: hidden;
    background: var(--surface);
}

.preset-group__item {
    font-size: 12.5px;
    font-weight: 500;
    padding: 8px 12px;
    color: var(--text-2);
    text-decoration: none;
    border-left: 1px solid var(--border);
}

.preset-group__item:first-child { border-left: none; }
.preset-group__item:hover { color: var(--text); text-decoration: none; }

.preset-group__item.is-active {
    background: var(--text);
    color: #fff;
    font-weight: 600;
}

.toolbar__check {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12.5px;
    color: var(--text);
}

.toolbar__check input { width: 14px; height: 14px; accent-color: var(--primary); }

.qtable__clip {
    display: inline-block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 12.5px;
    color: var(--text-2);
    vertical-align: bottom;
}

.banner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    border-radius: 10px;
    padding: 10px 14px;
    font-size: 13px;
    margin-bottom: 16px;
}

.banner--ok   { background: #def2e4; border: 1px solid #b7e2c4; color: #0f5429; }
.banner--warn { background: #fdf6e8; border: 1px solid #f0d9b2; color: #6e4a06; }

.param-rows { display: flex; flex-direction: column; gap: 9px; font-size: 13.5px; }

.param-row { display: flex; gap: 10px; }
.param-row > span:first-child { width: 150px; flex: 0 0 auto; color: var(--text-muted); }
.param-row b { font-weight: 500; min-width: 0; }

/* --------------------------------------------------------------------------
   Редактор опросника
   -------------------------------------------------------------------------- */
.editor-topbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    background: var(--surface);
    border-bottom: 1px solid var(--border-strong);
    padding: 12px 20px;
    position: sticky;
    top: 0;
    z-index: 1030;
}

.editor-topbar__back {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 13.5px;
    font-weight: 500;
    color: var(--text-2);
    text-decoration: none;
}

.editor-topbar__back:hover { color: var(--text); text-decoration: none; }

.editor-topbar__divider { width: 1px; height: 22px; background: var(--border); }

.editor-topbar__title {
    font-size: 15.5px;
    font-weight: 600;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.editor-topbar__actions {
    margin-left: auto;
    display: flex;
    gap: 8px;
    align-items: center;
}

/* body растёт по содержимому: при height:100% (base.css) липкий хедер уезжал после первого экрана */
.editor-page { height: auto; min-height: 100%; --editor-gap: 16px; }

.editor-main {
    padding: var(--editor-gap) 20px 40px 20px;
    background: var(--bg);
    min-height: 100vh;
}

@media (max-width: 720px) {
    .editor-page { --editor-gap: 12px; }
    .editor-topbar { padding: 10px 12px; }
    .editor-main { padding: var(--editor-gap) 12px 32px 12px; }
}

/* Панели в стиле мокапа: белая карточка, заголовок — строка внутри карточки. */
.panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px 18px;
}

.panel .panel__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 0 0 12px 0;
}

.panel .panel__head h2 {
    font-size: 15px;
    font-weight: 600;
    margin: 0;
    color: var(--text);
    letter-spacing: -0.01em;
}

.panel .panel__head .panel__sub { color: var(--text-muted); font-weight: 500; font-size: 13px; }
.panel .panel__body { padding: 0; }
.panel__head--wrap { flex-wrap: wrap; gap: 8px; }
.panel__note { display: block; font-size: 12px; color: var(--text-muted); padding-top: 8px; }
.panel__note--divided { border-top: 1px solid var(--border-soft); padding-top: 10px; margin-top: 8px; }
.panel--empty { padding: 40px 20px; text-align: center; color: var(--text-2); }

.panel + .panel,
.panel + .view-cols,
.dashboard-period + .panel { margin-top: 16px; }

/* Во флекс-раскладках расстояние задаёт gap */
.view-cols > .panel + .panel,
.view-cols__main > .panel + .panel,
.view-cols__side > .panel + .panel { margin-top: 0; }

/* Dropdown внутри прокручиваемой таблицы: на время открытия снимаем overflow */
.table-scroll.is-dropdown-open { overflow: visible; }

/* Статичная схема опросника (стиль мокапа) */
.flow-wrap {
    overflow: auto;
    background: var(--surface-soft);
    border: 1px solid var(--border-soft);
    border-radius: 10px;
    cursor: grab;
}

.flow-wrap.is-panning { cursor: grabbing; }

.flow { position: relative; margin: 0 auto; }

.flow__edges { position: absolute; left: 0; top: 0; pointer-events: none; }

.flow-node {
    position: absolute;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    text-align: center;
    padding: 8px 12px;
    background: var(--surface);
    border: 1px solid #c9cedb;
    border-radius: 10px;
    font-size: 13px;
    line-height: 1.3;
}

.flow-node b {
    font-weight: 600;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.flow-node small { color: var(--text-muted); font-size: 11.5px; }

.flow-node--start { background: #def2e4; border-color: #9fd4b2; color: #0f5429; }
.flow-node--start small { color: #2e7d4d; }

.flow-node--end { background: #fbe5e3; border-color: #f2b8b2; color: #7c211a; }
.flow-node--end small { color: #a35048; }

.flow-label {
    position: absolute;
    transform: translate(-50%, -50%);
    font-size: 11.5px;
    line-height: 15px;
    color: var(--text-2);
    background: var(--surface-soft);
    border-radius: 5px;
    padding: 1px 6px;
    white-space: nowrap;
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Схема в просмотре свёрнута за кнопкой (Bootstrap collapse) */
.flow-toggle[aria-expanded="true"] .flow-toggle__show,
.flow-toggle[aria-expanded="false"] .flow-toggle__hide { display: none; }
.flow-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin-bottom: 10px; }
/* Свёрнутая схема: отступ под шапкой переносится в раскрываемую часть — сверху и снизу одинаково */
.flow-panel > .panel__head:has(+ .collapse) { padding-bottom: 0; }
.flow-panel > .collapse > :first-child { margin-top: 12px; }

/* Зона визуализации: не уже 1000px, на узких экранах — только текстовый список */
.flow-panel { overflow-x: auto; }
.flow-panel .flow-wrap { min-width: 1000px; }

.flow-zoom {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-2);
}

.flow-zoom input[type="range"] {
    width: 140px;
    accent-color: var(--primary);
}

.flow-zoom__value {
    flex: none;
    width: 5ch;
    text-align: right;
    font-variant-numeric: tabular-nums;
    color: var(--text);
}

.flow-mobile-note {
    display: none;
    font-size: 13px;
    color: var(--text-2);
    background: var(--surface-soft);
    border-radius: 8px;
    padding: 10px 12px;
}

@media (max-width: 767.98px) {
    .flow-panel .flow-wrap,
    .flow-panel .flow-zoom,
    .flow-panel .flow-legend { display: none; }
    .flow-panel { overflow-x: visible; }
    .flow-mobile-note { display: block; }
}

/* Шапка страницы с иконкой/аватаром (проект, пользователь, опросник) */
.page-head__identity { display: flex; align-items: center; gap: 14px; min-width: 0; }
.page-head__identity-text { min-width: 0; }
.page-head__title-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* Подвал списков: итог слева, пагинация справа */
.list-footer { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding-top: 16px; }
.list-summary { font-size: 13px; color: var(--text-2); }
.list-footer .pagination { margin: 0 0 0 auto; }

/* Фильтры периода/проекта в шапке и тулбаре */
.dash-filter { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.dash-filter__project { width: auto; min-width: 160px; font-weight: 500; }
.toolbar__end { margin-left: auto; }

/* Дашборд: сводка, фильтры ленты, команда */
.summary-cell__sub { display: inline; font-size: 13px; color: var(--text-muted); font-weight: 500; }
.feed-filters { margin-left: auto; display: flex; gap: 4px; flex-wrap: wrap; }
.team-name { display: inline-flex; align-items: center; gap: 8px; }

/* Таблицы: приглушённая колонка (даты, статусы), мета-текст, колонка меню действий */
.qtable__muted { white-space: nowrap; color: var(--text-muted); font-size: 12.5px; }
.qtable__meta { font-size: 12.5px; color: var(--text-2); }
.qtable__menu { text-align: right; white-space: nowrap; position: relative; }

/* Настройки: разделители между строками */
.settings-list > .setting-row + .setting-row { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border-soft); }

/* Toast-контейнер поверх модалок и offcanvas */
.toast-container--app { z-index: 11000; }

/* Сайдбар: тариф компании над профилем */
.admin-sidebar__plan { margin-top: auto; display: grid; gap: 4px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--sidebar-line); color: var(--sidebar-text); text-decoration: none; font-size: 12px; }
.admin-sidebar__plan:hover { background: rgba(255, 255, 255, .04); color: var(--sidebar-text); }
.admin-sidebar__plan + .admin-sidebar__user { margin-top: 10px; }
.admin-sidebar__plan-row { display: flex; justify-content: space-between; gap: 8px; color: var(--sidebar-muted); }
.admin-sidebar__plan-row b { color: #fff; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.admin-sidebar__plan-meta { color: var(--sidebar-muted); }
.admin-sidebar__plan-bar { height: 4px; border-radius: 2px; background: var(--sidebar-line); overflow: hidden; }
.admin-sidebar__plan-bar i { display: block; height: 100%; background: var(--primary); }

/* Тариф компании: расход и лимиты (профиль, «Тарифы и цены») */
.plan-usage { margin-top: 16px; }
.plan-usage .panel__head { flex-wrap: wrap; gap: 8px; }
.plan-usage__grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; padding: 16px 20px 20px; }
.plan-usage__item { display: grid; gap: 4px; align-content: start; min-width: 0; }
.plan-usage__label { font-size: 12px; color: var(--text-2); }
.plan-usage__item b { font-size: 18px; font-weight: 600; }
.plan-usage__limit { font-size: 13px; color: var(--text-muted); font-weight: 500; }
.plan-usage__bar { height: 6px; border-radius: 3px; background: var(--border-soft); overflow: hidden; }
.plan-usage__bar i { display: block; height: 100%; background: var(--primary); }
.plan-usage__bar.is-warn i { background: var(--amber); }
.plan-usage__bar.is-full i { background: #c2412d; }

/* «Тарифы и цены»: карточки тарифов */
.plan-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; margin-top: 16px; }
.plan-grid > .panel { margin: 0; }
.plan-card { display: flex; flex-direction: column; padding: 18px 20px; }
.plan-card--current { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); }
.plan-card__head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.plan-card__head h2 { font-size: 18px; font-weight: 600; margin: 0; }
.plan-card__limits { list-style: none; margin: 0 0 14px; padding: 0; display: grid; gap: 6px; font-size: 14px; }
.plan-card__limits li, .plan-card__prices div { display: flex; justify-content: space-between; gap: 12px; }
.plan-card__limits span, .plan-card__prices span { color: var(--text-2); }
.plan-card__prices { display: grid; gap: 4px; padding-top: 12px; border-top: 1px dashed var(--border); font-size: 13px; }
.plan-card__caption { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; margin-bottom: 2px; }
.plan-card__action { margin-top: auto; padding-top: 16px; }

/* «ИИ и тарифы»: форма тарифа */
.tariff-form { margin-bottom: 16px; }
.tariff-form__body { padding: 16px 20px 20px; }
.tariff-form__grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
.tariff-markup { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 10px 0; border-top: 1px solid var(--border-soft); }
.tariff-markup:first-child { border-top: 0; }
.tariff-markup__name { display: grid; gap: 2px; margin: 0; min-width: 0; }
.tariff-markup__input { display: flex; align-items: center; gap: 6px; flex: none; }
.tariff-markup__input .form-control { width: 110px; }
.tariff-form__actions { display: flex; justify-content: flex-end; gap: 8px; }

@media (max-width: 860px) {
    .plan-usage__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .tariff-form__grid { grid-template-columns: minmax(0, 1fr); }
}

/* Оплата тарифа: состояние, цена в карточке, оформление, возврат */
.plan-usage__state { margin: 14px 20px 0; padding: 9px 12px; border-radius: 10px; background: var(--bg); font-size: 13px; color: var(--text-2); }
.plan-usage__state--warn { background: #fdf1d8; color: #8a5600; }
.plan-usage__state--alert { background: #fbe5e3; color: #a42c24; }
.plan-card__price { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 6px; margin-bottom: 14px; }
.plan-card__price b { font-size: 24px; font-weight: 700; }
.plan-card__price span { color: var(--text-2); }
.plan-card__price small { flex-basis: 100%; color: var(--text-muted); }
.plan-card__note { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.plan-payments { margin-top: 16px; }
.checkout .panel { margin-bottom: 16px; }
.checkout__options { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; padding: 16px 20px 20px; }
.checkout__option { display: flex; gap: 10px; align-items: flex-start; padding: 14px; border: 1px solid var(--border); border-radius: 12px; cursor: pointer; margin: 0; }
.checkout__option:has(input:checked) { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); }
.checkout__option input { margin-top: 3px; }
.checkout__option-body { display: grid; gap: 2px; }
.checkout__option-body small { color: var(--text-muted); font-size: 12px; }
.checkout__price { font-size: 18px; font-weight: 600; }
.checkout__alert { margin: 0 20px 16px; padding: 10px 12px; border-radius: 10px; background: #fbe5e3; color: #a42c24; font-size: 14px; }
.checkout__alert:empty { display: none; }
section > .checkout__alert:only-child { margin: 16px 20px; }
.checkout__requisites-body { padding: 16px 20px 20px; }
.checkout__grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
.checkout__actions { display: flex; justify-content: flex-end; gap: 8px; }
.plan-return { max-width: 560px; margin: 24px auto; padding: 28px; text-align: center; }
.plan-return h1 { font-size: 22px; margin: 12px 0 8px; }
.plan-return p { color: var(--text-2); }
.plan-return__meta { font-size: 13px; }
.plan-return__actions { display: flex; justify-content: center; gap: 8px; margin-top: 16px; }
.tariff-rate { display: flex; gap: 6px; }
.tariff-rate .form-control { width: 140px; }
@media (max-width: 560px) { .checkout__grid { grid-template-columns: minmax(0, 1fr); } }
.checkout__invoice { display: flex; gap: 10px; align-items: center; margin: 0 20px 18px; font-size: 14px; color: var(--text-2); cursor: pointer; }
.checkout__options > .qtable__empty { grid-column: 1 / -1; padding: 0; text-align: left; }

/* Мобильные карточки таблиц: меню действий — в правом верхнем углу карточки */
@media (max-width: 720px) {
    .qtable:not(.qtable--keep) tbody tr { position: relative; }
    .qtable:not(.qtable--keep) tbody td.qtable__menu { position: absolute; top: 10px; right: 0; }
    .qtable:not(.qtable--keep) tbody tr:has(.qtable__menu) > td:first-child { padding-right: 52px; }
}
.checkout__credit { margin: 14px 20px 0; padding: 10px 12px; border-radius: 10px; background: var(--success-50); color: var(--success-600); font-size: 14px; }
.checkout__price s { font-size: 13px; font-weight: 400; color: var(--text-muted); }
.panel--alert { border-color: #f0c6c1; box-shadow: 0 0 0 1px #f0c6c1; margin-bottom: 16px; }
.pay-breakdown { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; padding: 0 20px 20px; }
@media (max-width: 860px) { .pay-breakdown { grid-template-columns: minmax(0, 1fr); } }

/* Надёжность пароля под полем (admin.js, data-password-strength) */
.pw-strength { display: flex; align-items: center; gap: 10px; margin-top: 8px; font-size: 12px; color: var(--text-2); }
.pw-strength__bars { flex: 1; display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; max-width: 220px; }
.pw-strength__bars i { height: 4px; border-radius: 2px; background: var(--border); transition: background .2s; }
.pw-strength[data-level="1"] i:nth-child(-n+1) { background: #c2412d; }
.pw-strength[data-level="2"] i:nth-child(-n+2) { background: #d9822b; }
.pw-strength[data-level="3"] i:nth-child(-n+3) { background: var(--primary); }
.pw-strength[data-level="4"] i { background: var(--success); }

/* Сегментированный переключатель: radioList через Ui::segmented() или кнопки с aria-pressed */
.seg { display: inline-flex; flex-wrap: wrap; padding: 3px; gap: 2px; background: var(--surface-soft); border: 1px solid var(--border); border-radius: 10px; }
.seg label { position: relative; margin: 0; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span, .seg button { display: block; border: 0; background: transparent; padding: 0 12px; line-height: 30px; border-radius: 7px; font-weight: 500; font-size: 13px; color: var(--text-2); cursor: pointer; }
.seg input:checked + span, .seg button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(0, 0, 0, .08); }
.seg input:focus-visible + span { outline: 2px solid var(--primary); outline-offset: 1px; }
