/* Colibri admin — дизайн-система панели. Светлая/тёмная тема через CSS-переменные. */

:root {
    --bg: #f5f6f8;
    --surface: #ffffff;
    --surface-2: #f9fafb;
    --surface-3: #f1f3f6;
    --border: #e6e8ec;
    --border-strong: #d5d9e0;
    --text: #12141a;
    --text-2: #4a5160;
    --text-3: #8a91a0;
    --accent: #5b5bd6;
    --accent-hover: #4b4bc4;
    --accent-soft: #eeeefd;
    --accent-text: #4040b8;
    --ok: #138a4a;
    --ok-soft: #e8f6ee;
    --warn: #b26a00;
    --warn-soft: #fdf3e2;
    --bad: #d1343a;
    --bad-hover: #b92a30;
    --bad-soft: #fdecec;
    --info: #0a74c2;
    --info-soft: #e7f2fb;
    --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.05);
    --shadow: 0 1px 3px rgba(16, 24, 40, 0.06), 0 1px 2px rgba(16, 24, 40, 0.04);
    --shadow-lg: 0 18px 48px -12px rgba(16, 24, 40, 0.28);
    --radius: 12px;
    --radius-sm: 8px;
    --sidebar-w: 248px;
    --topbar-h: 60px;
    --font: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
    color-scheme: light;
}

[data-theme="dark"] {
    --bg: #0c0e13;
    --surface: #14171e;
    --surface-2: #181c24;
    --surface-3: #1f242e;
    --border: #262c37;
    --border-strong: #343b48;
    --text: #e8eaef;
    --text-2: #a8afbc;
    --text-3: #6f7786;
    --accent: #7d7df2;
    --accent-hover: #9090f5;
    --accent-soft: rgba(125, 125, 242, 0.15);
    --accent-text: #a5a5fa;
    --ok: #3fc07a;
    --ok-soft: rgba(63, 192, 122, 0.13);
    --warn: #e6a23c;
    --warn-soft: rgba(230, 162, 60, 0.14);
    --bad: #f0575d;
    --bad-hover: #f36c71;
    --bad-soft: rgba(240, 87, 93, 0.14);
    --info: #4fa8ee;
    --info-soft: rgba(79, 168, 238, 0.14);
    --shadow-sm: none;
    --shadow: 0 1px 0 rgba(255, 255, 255, 0.02);
    --shadow-lg: 0 24px 60px -12px rgba(0, 0, 0, 0.6);
    color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
    background: var(--bg);
    color: var(--text);
    font: 14px/1.5 var(--font);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

body.modal-open { overflow: hidden; }

a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3 { margin: 0; letter-spacing: -0.01em; color: var(--text); }
h1 { font-size: 22px; font-weight: 650; }
h2 { font-size: 15px; font-weight: 600; }
h3 { font-size: 16px; font-weight: 600; }
p { margin: 0; }

.muted { color: var(--text-3); }
.small { font-size: 12.5px; }
.mono { font-family: var(--mono); font-size: 0.92em; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.nowrap { white-space: nowrap; }
.grow { flex: 1 1 auto; }
[hidden] { display: none !important; }

.icon { flex: none; display: inline-block; vertical-align: middle; }

/* === Каркас === */

.app {
    display: grid;
    grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
    min-height: 100vh;
}

.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    background: var(--surface);
    border-right: 1px solid var(--border);
    padding: 14px 12px 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    z-index: 40;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 8px 10px;
    color: var(--text);
    text-decoration: none !important;
}

.brand-mark {
    width: 30px;
    height: 30px;
    border-radius: 9px;
    background:
        radial-gradient(circle at 30% 30%, #8ef0c4 0 18%, transparent 19%),
        linear-gradient(135deg, #5b5bd6, #22b8a7);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18);
}

.brand-text { display: flex; flex-direction: column; font-weight: 700; font-size: 15px; line-height: 1.15; }
.brand-text small { font-weight: 500; font-size: 11.5px; color: var(--text-3); }

.side-nav { display: flex; flex-direction: column; gap: 16px; }
.side-section { display: flex; flex-direction: column; gap: 2px; }

.side-section-title {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-3);
    padding: 0 10px 6px;
}

.side-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 10px;
    border-radius: var(--radius-sm);
    color: var(--text-2);
    font-weight: 500;
    text-decoration: none !important;
    transition: background 0.12s, color 0.12s;
}

.side-link:hover { background: var(--surface-3); color: var(--text); }
.side-link .icon { color: var(--text-3); }
.side-link[aria-current="page"] { background: var(--accent-soft); color: var(--accent-text); }
.side-link[aria-current="page"] .icon { color: var(--accent); }
.side-label { flex: 1 1 auto; }

.side-count {
    min-width: 22px;
    padding: 0 7px;
    border-radius: 999px;
    background: var(--surface-3);
    color: var(--text-2);
    font-size: 11.5px;
    font-weight: 600;
    line-height: 20px;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.side-count.is-hot { background: var(--bad-soft); color: var(--bad); }

.sidebar-scrim { display: none; }

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

.topbar {
    position: sticky;
    top: 0;
    z-index: 30;
    height: var(--topbar-h);
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 24px;
    background: color-mix(in srgb, var(--bg) 82%, transparent);
    backdrop-filter: saturate(160%) blur(10px);
    -webkit-backdrop-filter: saturate(160%) blur(10px);
    border-bottom: 1px solid var(--border);
}

.icon-btn.menu-btn { display: none; }

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

.operator-chip {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    height: 34px;
    padding: 0 12px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-2);
    font: inherit;
    font-size: 13px;
    cursor: pointer;
    max-width: 220px;
}

.operator-chip:hover { border-color: var(--border-strong); color: var(--text); }
.operator-chip.is-empty { color: var(--warn); border-style: dashed; }
.operator-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.theme-btn .theme-icon { display: inline-flex; }
[data-theme="dark"] .theme-icon-dark,
[data-theme="light"] .theme-icon-light,
:root:not([data-theme]) .theme-icon-light { display: none; }

.progress {
    position: absolute;
    left: 0;
    bottom: -1px;
    height: 2px;
    width: 0;
    background: var(--accent);
    opacity: 0;
    transition: width 0.3s ease, opacity 0.2s;
}

body.is-loading .progress { opacity: 1; width: 70%; transition: width 2.5s cubic-bezier(0.1, 0.7, 0.2, 1), opacity 0.1s; }
body.is-loading .page { opacity: 0.55; transition: opacity 0.15s 0.12s; }

.page {
    width: 100%;
    max-width: 1320px;
    margin: 0 auto;
    padding: 24px 24px 96px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* === Поиск в шапке === */

.search { position: relative; flex: 1 1 auto; max-width: 620px; }

.search-form { position: relative; display: flex; align-items: center; }

.search-icon { position: absolute; left: 12px; color: var(--text-3); pointer-events: none; }

.search .search-input {
    width: 100%;
    height: 38px;
    padding: 0 40px 0 36px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    font: inherit;
    outline: none;
    transition: border-color 0.12s, box-shadow 0.12s;
}

.search-input::placeholder { color: var(--text-3); }
.search .search-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.search-input::-webkit-search-cancel-button { display: none; }

.search-kbd {
    position: absolute;
    right: 10px;
    font: 11px/18px var(--mono);
    padding: 0 6px;
    border-radius: 5px;
    border: 1px solid var(--border);
    color: var(--text-3);
    background: var(--surface-2);
    pointer-events: none;
}

.search-input:focus ~ .search-kbd { display: none; }

.search-results {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 6px;
    max-height: min(70vh, 520px);
    overflow-y: auto;
    z-index: 60;
}

.sr-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    color: var(--text);
    text-decoration: none !important;
}

.sr-item:hover, .sr-item.is-active { background: var(--surface-3); }
.sr-main { min-width: 0; display: flex; flex-direction: column; flex: 1 1 auto; }
.sr-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sr-sub { font-size: 12.5px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sr-match { font-size: 11.5px; color: var(--accent-text); background: var(--accent-soft); border-radius: 6px; padding: 1px 7px; white-space: nowrap; }
.sr-empty, .sr-foot { padding: 10px; color: var(--text-3); font-size: 13px; }
.sr-foot { border-top: 1px solid var(--border); margin-top: 4px; display: flex; gap: 6px; align-items: center; }
.sr-foot kbd { font: 11px var(--mono); border: 1px solid var(--border); border-radius: 4px; padding: 0 4px; }

/* === Заголовок страницы === */

.page-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    padding: 2px 0 4px;
}

.page-title { min-width: 0; }
.page-sub { color: var(--text-3); margin-top: 3px; }
.page-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.crumbs { display: flex; align-items: center; gap: 6px; color: var(--text-3); font-size: 13px; }
.crumbs a { color: var(--text-2); }

/* === Карточки === */

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    min-width: 0;
}

.card-flush { padding: 0; gap: 0; }
.card-pad { padding: 14px 18px 18px; }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.card-head-pad { padding: 16px 18px 12px; }
.card-head h2 .muted { font-weight: 500; }
.card-sub { color: var(--text-3); font-size: 13px; margin-top: 2px; }
.card-head-icon { color: var(--text-3); }
.subhead { font-size: 12px; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 8px; }
.footnote { padding: 0 2px; }

.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid-tight { gap: 12px; }
.grid-auto { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.grid-profile { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); align-items: start; }

/* === KPI === */

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.kpis-compact { grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; }

.kpi {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 16px;
    box-shadow: var(--shadow);
    min-width: 0;
}

.kpis-compact .kpi { background: var(--surface-2); box-shadow: none; padding: 11px 13px; }
.kpi-label { color: var(--text-3); font-size: 12.5px; font-weight: 500; }
.kpi-value { font-size: 22px; font-weight: 650; letter-spacing: -0.02em; margin-top: 2px; font-variant-numeric: tabular-nums; display: flex; align-items: center; gap: 8px; }
.kpis-compact .kpi-value { font-size: 18px; }
.kpi-value-sm { font-size: 16px; }
.kpi-hint { color: var(--text-3); font-size: 12px; margin-top: 2px; }

/* === Кнопки === */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    height: 34px;
    padding: 0 13px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    font: inherit;
    font-weight: 550;
    font-size: 13.5px;
    white-space: nowrap;
    cursor: pointer;
    text-decoration: none !important;
    box-shadow: var(--shadow-sm);
    transition: background 0.12s, border-color 0.12s, color 0.12s, opacity 0.12s;
    user-select: none;
}

.btn:hover { background: var(--surface-3); border-color: var(--border-strong); }
.btn:focus-visible, .icon-btn:focus-visible, .seg-item:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn:disabled, .btn.is-disabled { opacity: 0.5; cursor: not-allowed; }
.btn-sm { height: 28px; padding: 0 10px; font-size: 12.5px; gap: 5px; }

.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn-danger:hover { background: var(--bad-hover); border-color: var(--bad-hover); }
.btn-success { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn-success:hover { filter: brightness(1.06); background: var(--ok); }
.btn-danger-soft { background: var(--bad-soft); border-color: transparent; color: var(--bad); box-shadow: none; }
.btn-danger-soft:hover { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn-ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-3); border-color: transparent; color: var(--text); }
.btn.is-on { background: var(--bad-soft); border-color: transparent; color: var(--bad); }

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

.icon-btn:hover { background: var(--surface-3); color: var(--text); }

.chip-btn {
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-2);
    font: inherit;
    font-size: 12px;
    border-radius: 999px;
    padding: 2px 10px;
    cursor: pointer;
}

.chip-btn:hover { border-color: var(--accent); color: var(--accent-text); }

/* === Сегменты (переключатели) === */

.seg {
    display: inline-flex;
    padding: 3px;
    gap: 2px;
    border-radius: 10px;
    background: var(--surface-3);
    border: 1px solid var(--border);
    flex-wrap: wrap;
}

.seg-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 28px;
    padding: 0 12px;
    border-radius: 7px;
    border: 0;
    background: transparent;
    color: var(--text-2);
    font: inherit;
    font-size: 13px;
    font-weight: 550;
    cursor: pointer;
    text-decoration: none !important;
    white-space: nowrap;
}

.seg-item:hover { color: var(--text); }
.seg-item.is-active { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08); }
.seg-count { font-size: 11.5px; color: var(--text-3); font-variant-numeric: tabular-nums; }

/* === Формы === */

input[type="text"], input[type="search"], input[type="password"], input[type="url"], input[type="date"], input[type="time"], select, textarea {
    height: 34px;
    padding: 0 10px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    font: inherit;
    font-size: 13.5px;
    outline: none;
    min-width: 0;
    transition: border-color 0.12s, box-shadow 0.12s;
}

textarea { height: auto; padding: 8px 10px; resize: vertical; width: 100%; line-height: 1.45; }
select { padding-right: 28px; cursor: pointer; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field-label { font-size: 12px; font-weight: 600; color: var(--text-2); }
.field > input, .field > select { width: 100%; }
.hint { font-size: 12.5px; color: var(--text-3); }

.filters { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.filters .field { min-width: 150px; }
.filters .field.grow { flex: 1 1 220px; }
.filters-inline .field { min-width: 140px; }

.input-icon { position: relative; display: flex; align-items: center; min-width: 200px; }
.input-icon .icon { position: absolute; left: 10px; color: var(--text-3); pointer-events: none; }
.input-icon input { width: 100%; padding-left: 32px; }

.check { width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; margin: 0; vertical-align: middle; }

.targets { display: flex; gap: 8px; flex-wrap: wrap; }

.target {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    height: 32px;
    padding: 0 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--surface);
    cursor: pointer;
    font-weight: 500;
    user-select: none;
}

.target input { accent-color: var(--bad); margin: 0; }
.target:has(input:checked) { border-color: color-mix(in srgb, var(--bad) 45%, transparent); background: var(--bad-soft); }
.target:has(input:disabled) { opacity: 0.45; cursor: not-allowed; }

.toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
}

.toolbar-bottom { border-bottom: 0; border-top: 1px solid var(--border); }
.toolbar select { height: 32px; }

/* === Таблицы === */

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

.tbl { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }

.tbl th {
    position: sticky;
    top: 0;
    background: var(--surface-2);
    color: var(--text-3);
    font-size: 11.5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    text-align: left;
    padding: 9px 14px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
    z-index: 1;
}

.tbl td { padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl-hover tbody tr { transition: background 0.1s; }
.tbl-hover tbody tr:hover td { background: var(--surface-2); }
.tbl .row-link { cursor: pointer; }

.th-sort {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: none;
    border: 0;
    padding: 0;
    font: inherit;
    color: inherit;
    text-transform: inherit;
    letter-spacing: inherit;
    cursor: pointer;
    text-decoration: none !important;
}

.th-sort:hover, .is-sorted .th-sort { color: var(--text); }
.sort-ind { color: var(--accent); min-width: 8px; }

.col-check { width: 40px; padding-right: 0 !important; }
.col-num { width: 44px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.col-mark { width: 40px; text-align: center !important; }
.col-actions { width: 1%; text-align: right; }
.roles { color: var(--text-2); font-size: 12.5px; max-width: 280px; }
.details-cell { max-width: 340px; overflow-wrap: anywhere; }

.row-actions { display: flex; gap: 6px; justify-content: flex-end; align-items: center; }
.row-actions form { margin: 0; }

/* Человек в строке: аватар + имя + подпись */
.person { display: flex; align-items: center; gap: 10px; min-width: 200px; }
.person-main { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.person-line { display: flex; align-items: center; gap: 6px; min-width: 0; }
.person-name { font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 300px; }
a.person-name:hover { color: var(--accent-text); text-decoration: none; }
.person-sub { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text-3); flex-wrap: wrap; }

.avatar {
    --h: 230;
    flex: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: hsl(var(--h) 55% 34%);
    background: hsl(var(--h) 70% 92%);
}

[data-theme="dark"] .avatar { color: hsl(var(--h) 75% 78%); background: hsl(var(--h) 35% 22%); }
.avatar-sm { width: 26px; height: 26px; font-size: 10.5px; }
.avatar-xl { width: 64px; height: 64px; font-size: 22px; border-radius: 18px; }

/* Копируемый ID */
.copy {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 1px 6px;
    margin: -1px -6px;
    border-radius: 6px;
    border: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    cursor: pointer;
}

.copy::after {
    content: "";
    width: 12px;
    height: 12px;
    flex: none;
    opacity: 0;
    background: var(--text-3);
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect width='14' height='14' x='8' y='8' rx='2'/%3E%3Cpath d='M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2'/%3E%3C/svg%3E") center / contain no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect width='14' height='14' x='8' y='8' rx='2'/%3E%3Cpath d='M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2'/%3E%3C/svg%3E") center / contain no-repeat;
    transition: opacity 0.12s;
}
.copy:hover { background: var(--surface-3); color: var(--text); }
.copy:hover::after { opacity: 1; }
.copy.is-copied::after { opacity: 1; background: var(--ok); }
.copy-label { color: var(--text-3); }

/* Платформы */
.pfs { display: inline-flex; gap: 3px; align-items: center; flex: none; }

.pf {
    position: relative;
    width: 15px;
    height: 15px;
    border-radius: 50%;
    background-size: 15px 15px;
    background-repeat: no-repeat;
    background-position: center;
    display: inline-block;
}

.pf-discord {
    background-color: #5865f2;
    background-image: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2032%2032'%3E%3Ccircle%20cx='16'%20cy='16'%20r='16'%20fill='%235865F2'/%3E%3Cpath%20fill='white'%20d='M21.9%2010.4c-1.1-.5-2.2-.8-3.4-1l-.4.8c-1.3-.2-2.6-.2-3.9%200l-.4-.8c-1.2.2-2.3.6-3.4%201-2.1%203.1-2.7%206.1-2.4%209.1%201.3%201%202.7%201.7%204.2%202.1l.9-1.5c-.5-.2-1-.5-1.4-.8l.3-.3c2.8%201.3%205.8%201.3%208.6%200l.3.3c-.4.3-.9.6-1.4.8l.9%201.5c1.5-.4%202.9-1.1%204.2-2.1.4-3.5-.6-6.5-2.4-9.1zM13.1%2018.3c-.8%200-1.5-.8-1.5-1.7s.7-1.7%201.5-1.7%201.5.8%201.5%201.7-.7%201.7-1.5%201.7zm5.8%200c-.8%200-1.5-.8-1.5-1.7s.7-1.7%201.5-1.7%201.5.8%201.5%201.7-.7%201.7-1.5%201.7z'/%3E%3C/svg%3E");
}

.pf-telegram {
    background-color: #28a9e6;
    background-image: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2032%2032'%3E%3Ccircle%20cx='16'%20cy='16'%20r='16'%20fill='%2328A9E6'/%3E%3Cpath%20fill='white'%20d='M24.8%209.4l-3.9%2013.2c-.3%201-.8%201.2-1.6.7l-4.4-3.2-2.1%202c-.2.2-.4.4-.9.4l.3-4.5%208.1-7.3c.4-.3-.1-.5-.5-.2l-10%206.3-4.3-1.3c-.9-.3-.9-.9.2-1.3l16.8-6.5c.8-.3%201.5.2%201.3%201.7z'/%3E%3C/svg%3E");
}

.pf-second i {
    position: absolute;
    right: -4px;
    bottom: -3px;
    font-style: normal;
    font-size: 8.5px;
    font-weight: 800;
    line-height: 10px;
    min-width: 10px;
    padding: 0 2px;
    border-radius: 5px;
    background: var(--surface);
    color: #1b8cc4;
    box-shadow: 0 0 0 1px var(--border);
    text-align: center;
}

/* Чипы статусов */
.chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    height: 22px;
    padding: 0 9px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 550;
    white-space: nowrap;
    background: var(--surface-3);
    color: var(--text-2);
}

.chip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: 0.85; }
.chip-idle::before { display: none; }
.chip-ok { background: var(--ok-soft); color: var(--ok); }
.chip-warn { background: var(--warn-soft); color: var(--warn); }
.chip-bad { background: var(--bad-soft); color: var(--bad); }
.chip-info { background: var(--info-soft); color: var(--info); }
.chip-local { background: var(--accent-soft); color: var(--accent-text); }
.chip-row { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }

.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--text-3); flex: none; margin-right: 6px; }
.dot-online { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }
.dot-warn { background: var(--warn); box-shadow: 0 0 0 3px var(--warn-soft); }
.dot-offline { background: var(--bad); box-shadow: 0 0 0 3px var(--bad-soft); }

/* Кружок «в список на удаление» на странице активности */
.mark {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 1.5px solid var(--border-strong);
    background: transparent;
    cursor: pointer;
    padding: 0;
    vertical-align: middle;
    transition: background 0.12s, border-color 0.12s, transform 0.12s;
}

.mark:hover { border-color: var(--bad); transform: scale(1.1); }
.mark.is-on { background: var(--bad); border-color: var(--bad); box-shadow: 0 0 0 3px var(--bad-soft); }

/* Пейджер */
.pager { display: inline-flex; align-items: center; gap: 3px; flex-wrap: wrap; }

.pager-btn {
    min-width: 30px;
    height: 30px;
    padding: 0 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 7px;
    color: var(--text-2);
    font-weight: 550;
    font-variant-numeric: tabular-nums;
    text-decoration: none !important;
}

a.pager-btn:hover { background: var(--surface-3); color: var(--text); }
.pager-btn.is-active { background: var(--accent); color: #fff; }
.pager-btn.is-disabled { opacity: 0.35; }
.pager-gap { color: var(--text-3); padding: 0 2px; }

/* Пустые состояния и уведомления */
.empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 36px 16px;
    color: var(--text-3);
    text-align: center;
}

.empty .icon { opacity: 0.7; }
.empty p { max-width: 460px; }

.alert {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-weight: 500;
}

.alert-warn { background: var(--warn-soft); color: var(--warn); }
.alert-ok { background: var(--ok-soft); color: var(--ok); }
.alert-bad { background: var(--bad-soft); color: var(--bad); }
.form-error { padding: 9px 12px; border-radius: var(--radius-sm); background: var(--bad-soft); color: var(--bad); font-weight: 500; }

/* === Дашборд: лидерборды === */

.lb { display: flex; flex-direction: column; gap: 2px; }

.lb-row {
    display: grid;
    grid-template-columns: 26px 26px minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    padding: 7px 8px;
    border-radius: var(--radius-sm);
    color: var(--text);
    text-decoration: none !important;
}

.lb-row:hover { background: var(--surface-2); }
.lb-rank { font-weight: 700; color: var(--text-3); text-align: center; font-variant-numeric: tabular-nums; }
.lb-rank-1 { color: #d49b00; }
.lb-rank-2 { color: #8c95a3; }
.lb-rank-3 { color: #b56d2f; }
.lb-main { min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.lb-name { font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-track { height: 6px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.lb-fill { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--accent), #8f8ff5); }
.lb-fill-alt { background: linear-gradient(90deg, #12a58f, #4fd1b8); }
.lb-value { font-weight: 600; color: var(--text-2); }

/* Полоски (каналы в карточке) */
.bars { display: flex; flex-direction: column; gap: 8px; }
.bar-row { display: grid; grid-template-columns: minmax(90px, 0.9fr) minmax(0, 2fr) auto; gap: 10px; align-items: center; font-size: 13px; }
.bar-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-2); }
.bar-track { height: 6px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.bar-fill { display: block; height: 100%; border-radius: inherit; background: var(--accent); }
.bar-value { color: var(--text-2); }

/* === Карточка пользователя === */

.profile-hero { flex-direction: row; align-items: flex-start; justify-content: space-between; gap: 18px; flex-wrap: wrap; padding: 20px; }
.profile-ident { display: flex; gap: 16px; align-items: flex-start; min-width: 0; flex: 1 1 360px; }
.profile-ident-main { min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.profile-name { font-size: 24px; font-weight: 700; overflow-wrap: anywhere; }
.profile-subline { color: var(--text-2); }
.profile-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.match-note { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--accent-text); background: var(--accent-soft); border-radius: 7px; padding: 4px 9px; width: fit-content; }

.dl { margin: 0; display: flex; flex-direction: column; }
.dl-row { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--border); align-items: center; }
.dl-row:last-child { border-bottom: 0; }
.dl dt { color: var(--text-3); font-size: 13px; }
.dl dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.dl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); column-gap: 24px; }
.dl-grid .dl-row { grid-template-columns: 1fr; gap: 2px; border-bottom: 0; padding: 6px 0; }
.dl-grid dt { font-size: 12px; }

.other-matches { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 8px; }

.other-match {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    color: var(--text);
    text-decoration: none !important;
}

.other-match:hover { border-color: var(--accent); background: var(--surface-2); }
.other-match-main { min-width: 0; flex: 1 1 auto; display: flex; flex-direction: column; }
.other-match-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.other-match-sub { font-size: 12px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.other-match .icon { color: var(--text-3); }

/* === Аккордеоны (заявки, история) === */

.acc-list { display: flex; flex-direction: column; gap: 8px; }

.acc { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.acc[open] { border-color: var(--border-strong); box-shadow: var(--shadow); }

.acc-head {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 14px;
    cursor: pointer;
    list-style: none;
}

.acc-head::-webkit-details-marker { display: none; }
.acc-head:hover { background: var(--surface-2); }
.acc-main { min-width: 0; flex: 1 1 auto; display: flex; flex-direction: column; gap: 1px; }
.acc-title { font-weight: 600; display: flex; align-items: center; gap: 6px; }
.acc-sub { font-size: 12.5px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acc-side { display: flex; align-items: center; gap: 6px; flex: none; }
.acc-caret { color: var(--text-3); transition: transform 0.15s; }
.acc[open] .acc-caret { transform: rotate(180deg); }
.acc-icon { width: 32px; height: 32px; border-radius: 9px; background: var(--surface-3); color: var(--text-2); display: inline-flex; align-items: center; justify-content: center; flex: none; }
.acc-body { padding: 4px 16px 16px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 14px; }
.acc-section p { color: var(--text-2); }
.acc-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding-top: 4px; }
.reason-preview { color: var(--text-2); }

.uid-block {
    margin: 0;
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    background: var(--surface-2);
    border: 1px solid var(--border);
    font: 12.5px/1.55 var(--mono);
    color: var(--text-2);
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.info-list { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 4px; color: var(--text-2); font-size: 13px; }

.events { display: flex; flex-direction: column; }
.event { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 14px; padding: 9px 0; border-bottom: 1px dashed var(--border); }
.event:last-child { border-bottom: 0; }
.event-time { color: var(--text-3); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.event-title { font-weight: 550; }
.event-meta { color: var(--text-3); font-size: 12.5px; }
.event-extra { color: var(--text-2); font-size: 12.5px; margin-top: 3px; overflow-wrap: anywhere; }

/* === Голосовые каналы === */

.voice-card { justify-content: space-between; }
.voice-members { min-height: 24px; }
.voice-action { margin: 0; display: flex; justify-content: flex-end; }

/* === Список на удаление === */

.quick-card { gap: 12px; padding: 16px 18px; border-color: color-mix(in srgb, var(--bad) 22%, var(--border)); }
.quick-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.quick-title .icon { color: var(--bad); }
.quick-fields { display: flex; gap: 18px; flex-wrap: wrap; align-items: flex-start; }
.quick-fields .field.grow { flex: 1 1 280px; }
.quick-fields .chip-row { margin-top: 4px; }

.dl-table tbody tr.is-selected td { background: var(--accent-soft); }
.dl-table tbody tr.is-pending td { background: var(--warn-soft); }
.dl-table tbody tr.is-leaving { opacity: 0; transition: opacity 0.2s; }
.dl-table .btn-undo { background: var(--warn); border-color: var(--warn); color: #fff; min-width: 108px; }
.dl-table .btn-undo:hover { filter: brightness(1.08); background: var(--warn); }
.dl-empty { border-top: 1px solid var(--border); }
.seg-buttons .seg-item { height: 28px; }

.bulkbar {
    position: sticky;
    bottom: 16px;
    z-index: 25;
    align-self: center;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
    padding: 10px 12px 10px 18px;
    border-radius: 14px;
    background: var(--text);
    color: var(--bg);
    box-shadow: var(--shadow-lg);
    animation: rise 0.18s ease-out;
}

.bulkbar .btn { box-shadow: none; }
.bulkbar .btn:not(.btn-danger) { background: transparent; color: var(--bg); border-color: color-mix(in srgb, var(--bg) 30%, transparent); }
.bulkbar .btn:not(.btn-danger):hover { background: color-mix(in srgb, var(--bg) 14%, transparent); }
.bulkbar-count { margin-right: 6px; }

@keyframes rise { from { transform: translateY(10px); opacity: 0; } to { transform: none; opacity: 1; } }

.bulk-people { display: flex; flex-wrap: wrap; gap: 6px; max-height: 140px; overflow-y: auto; padding: 10px; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--border); }

/* === Фактический состав === */

.presence-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    padding: 9px 14px;
    border-radius: var(--radius);
    border: 1px dashed var(--border-strong);
    background: var(--surface-2);
    color: var(--text-2);
    font-size: 13px;
}

.presence-bar > .icon { color: var(--text-3); }
.presence-toggle { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; cursor: pointer; }
a.presence-toggle { color: var(--accent-text); }

/* === Хронология в карточке === */

.tl { list-style: none; margin: 0; padding: 0; position: relative; }
.tl::before { content: ""; position: absolute; left: 6px; top: 6px; bottom: 6px; width: 2px; background: var(--border); }
.tl-item { position: relative; display: flex; gap: 14px; padding: 7px 0; }
.tl-dot { flex: none; width: 14px; height: 14px; border-radius: 50%; margin-top: 3px; background: var(--surface); border: 3px solid var(--text-3); position: relative; z-index: 1; }
.tl-join .tl-dot { border-color: var(--ok); }
.tl-out .tl-dot { border-color: var(--bad); }
.tl-application .tl-dot { border-color: var(--info); }
.tl-request .tl-dot { border-color: var(--warn); }
.tl-body { min-width: 0; flex: 1 1 auto; }
.tl-head { display: flex; gap: 10px; justify-content: space-between; flex-wrap: wrap; }
.tl-title { font-weight: 600; }
.tl-out .tl-title { color: var(--bad); }
.tl-join .tl-title { color: var(--ok); }
.tl-time { color: var(--text-3); font-size: 12.5px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tl-meta { color: var(--text-3); font-size: 12.5px; }
.tl-detail { color: var(--text-2); font-size: 12.5px; margin-top: 2px; overflow-wrap: anywhere; }
.dl-lifecycle { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }

/* === Анкеты «Хочу в команду» === */

.sv-tabs { align-self: flex-start; }
.sv-filters .field { min-width: 140px; flex: 1 1 150px; }
.sv-filters .field.grow { flex: 2 1 240px; }
.sv-table td { vertical-align: top; }
.sv-row { cursor: pointer; }
.sv-row.is-hidden td { opacity: 0.55; }
.sv-row.is-hidden td.col-actions { opacity: 1; }
.sv-row.is-selected td { background: color-mix(in srgb, var(--accent-soft) 55%, transparent); }
.sv-clip { max-width: 118px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sv-date { white-space: nowrap; font-variant-numeric: tabular-nums; display: flex; flex-direction: column; gap: 1px; font-size: 12.5px; color: var(--text-2); }
.sv-date small { color: var(--text-3); font-size: 11.5px; }
.sv-date-col { width: 1%; }
.sv-repeat { display: inline-block; width: fit-content; margin-top: 2px; padding: 0 5px; border-radius: 5px; background: var(--warn-soft); color: var(--warn); font-size: 11px; font-weight: 600; }
.sv-table .col-check { width: 34px; padding-right: 0 !important; }
.sv-row.is-checked td { background: var(--accent-soft); }

.bc-modal { width: min(620px, 100%); }
.bc-modal input[type="url"], .bc-modal input[type="text"] { width: 100%; }
.bc-source { font-size: 13px; font-weight: 500; color: var(--text-3); }
.bc-source.is-ok { color: var(--ok); }
.bc-source.is-bad { color: var(--bad); }
.bc-toggle { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; cursor: pointer; }
.bc-test-row { display: flex; gap: 8px; }
.bc-test-row input { flex: 1 1 auto; }
.bc-progress-bar { height: 8px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.bc-progress-bar span { display: block; height: 100%; width: 0; background: var(--accent); transition: width 0.4s ease; }
.bc-problem-list { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 4px; max-height: 220px; overflow-y: auto; font-size: 13px; }
.bc-history { display: flex; flex-direction: column; gap: 8px; }
.bc-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 12px; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.bc-item-main { display: flex; flex-direction: column; gap: 6px; min-width: 0; font-size: 13px; }
.bc-item-actions { display: flex; gap: 6px; align-items: flex-start; }
.bc-item-problems { grid-column: 1 / -1; }
.sv-state { margin-top: 3px; }
.sv-state .chip { height: 19px; font-size: 11px; padding: 0 7px; }
.sv-hide-btn { width: 28px; padding: 0; }
.sv-table td, .sv-table th { padding-left: 10px; padding-right: 10px; }
.sv-table .person { min-width: 170px; }
.sv-table .person-name { max-width: 190px; }
.sv-age { width: 1%; padding-left: 8px !important; padding-right: 8px !important; }
.sv-flag-col, .sv-term-col { width: 1%; white-space: nowrap; }
.sv-term { border: 0; cursor: pointer; font: inherit; font-size: 12px; font-weight: 600; }
.sv-term:hover { filter: brightness(0.95); box-shadow: 0 0 0 2px var(--border-strong); }

.flag {
    display: inline-block;
    width: 24px;
    height: 16px;
    border-radius: 3px;
    vertical-align: middle;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.12);
    flex: none;
}

.flag-ru { background: linear-gradient(#ffffff 0 33.33%, #0039a6 33.33% 66.66%, #d52b1e 66.66%); }
.flag-am { background: linear-gradient(#d90012 0 33.33%, #0033a0 33.33% 66.66%, #f2a800 66.66%); }
.lang-tag { display: inline-flex; align-items: center; gap: 7px; }

.sv-pop {
    position: fixed;
    z-index: 150;
    max-width: 280px;
    padding: 10px 12px;
    border-radius: 10px;
    background: var(--surface);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    opacity: 0;
    transform: scale(0.7);
    transition: transform 0.18s cubic-bezier(0.2, 0.9, 0.3, 1.15), opacity 0.14s ease;
    pointer-events: auto;
}

.sv-pop.is-open { opacity: 1; transform: scale(1); }
.sv-pop::before {
    content: "";
    position: absolute;
    left: calc(var(--arrow-x, 20px) - 6px);
    width: 10px;
    height: 10px;
    background: var(--surface);
    border: 1px solid var(--border);
    transform: rotate(45deg);
}
.sv-pop.is-below::before { top: -6px; border-right: 0; border-bottom: 0; }
.sv-pop.is-above::before { bottom: -6px; border-left: 0; border-top: 0; }
.sv-pop-title { font-weight: 600; font-size: 13px; }
.sv-pop-text { color: var(--text-2); font-size: 13px; margin-top: 2px; overflow-wrap: anywhere; }

.survey-line { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.sv-about { white-space: pre-wrap; color: var(--text-2); overflow-wrap: anywhere; }
.modal-card.sv-card-inner { width: min(720px, 100%); }
.sv-card-foot { justify-content: flex-start; }

.sv-menu {
    position: fixed;
    z-index: 140;
    min-width: 260px;
    padding: 6px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--surface);
    box-shadow: var(--shadow-lg);
    animation: pop 0.12s ease-out;
}

.sv-menu-head { font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-3); padding: 6px 10px; }

.sv-menu-item {
    display: flex;
    width: 100%;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 10px;
    border: 0;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text);
    font: inherit;
    font-weight: 550;
    cursor: pointer;
    text-align: left;
}

.sv-menu-item:hover { background: var(--surface-3); }
.sv-menu-state { font-size: 12px; font-weight: 500; color: var(--text-3); }
.sv-menu-item.is-in .sv-menu-state { color: var(--ok); }

/* === Вход === */

.logout-form { margin: 0; display: inline-flex; }
.login-body { min-height: 100vh; display: grid; place-items: center; background: var(--bg); padding: 20px; }
.login-wrap { width: min(380px, 100%); }
.login-card { display: flex; flex-direction: column; gap: 14px; padding: 28px; border-radius: 16px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-lg); }
.login-card h1 { font-size: 20px; }
.login-brand { padding: 0 0 4px; }
.login-card input { width: 100%; height: 40px; }
.login-submit { height: 40px; }

/* === Модалки === */

.modal {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(10, 12, 18, 0.48);
    backdrop-filter: blur(3px);
    animation: fade 0.12s ease-out;
}

.modal-card {
    width: min(560px, 100%);
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    animation: pop 0.16s ease-out;
}

.modal-sm { width: min(440px, 100%); }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 18px 20px 6px; }
.modal-sub { color: var(--text-3); font-size: 13px; margin-top: 3px; overflow-wrap: anywhere; }
.modal-body { display: flex; flex-direction: column; gap: 14px; padding: 12px 20px 20px; margin: 0; }
.modal-foot { display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex-wrap: wrap; padding-top: 4px; }
.modal-foot .hint { margin-right: auto; }

@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop { from { transform: translateY(6px) scale(0.985); opacity: 0; } to { transform: none; opacity: 1; } }

/* === Тосты === */

.toasts {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 120;
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: flex-end;
    pointer-events: none;
}

.toast {
    pointer-events: auto;
    display: flex;
    align-items: center;
    gap: 12px;
    max-width: min(440px, calc(100vw - 40px));
    padding: 11px 12px 11px 16px;
    border-radius: 12px;
    background: var(--text);
    color: var(--bg);
    box-shadow: var(--shadow-lg);
    font-weight: 500;
    animation: rise 0.18s ease-out;
    position: relative;
    overflow: hidden;
}

.toast.is-error { background: var(--bad); color: #fff; }
.toast.is-ok::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--ok); flex: none; }
.toast-msg { flex: 1 1 auto; }

.toast-btn {
    border: 0;
    background: color-mix(in srgb, var(--bg) 18%, transparent);
    color: inherit;
    font: inherit;
    font-weight: 650;
    border-radius: 8px;
    padding: 5px 11px;
    cursor: pointer;
    white-space: nowrap;
}

.toast-btn:hover { background: color-mix(in srgb, var(--bg) 28%, transparent); }
.toast-timer { position: absolute; left: 0; bottom: 0; height: 3px; background: var(--warn); }

/* === Адаптив === */

@media (max-width: 1100px) {
    .grid-profile { grid-template-columns: 1fr; }
}

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

    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        width: min(280px, 84vw);
        transform: translateX(-100%);
        transition: transform 0.2s ease;
        box-shadow: var(--shadow-lg);
    }

    body.menu-open .sidebar { transform: none; }
    body.menu-open .sidebar-scrim { display: block; position: fixed; inset: 0; z-index: 35; background: rgba(10, 12, 18, 0.4); }
    .icon-btn.menu-btn { display: inline-flex; }
    .topbar { padding: 0 12px; gap: 8px; }
    .operator-name { display: none; }
    .operator-chip { padding: 0 10px; }
    .search-kbd { display: none; }
    .page { padding: 16px 12px 96px; }
    .grid-2 { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
    h1 { font-size: 19px; }
    .profile-name { font-size: 20px; }
    .avatar-xl { width: 48px; height: 48px; font-size: 17px; border-radius: 14px; }
    .dl-row { grid-template-columns: 1fr; gap: 2px; }
    .event { grid-template-columns: 1fr; gap: 2px; }
    .acc-side .chip-row, .acc-side .chip:not(:last-of-type) { display: none; }
    .acc-sub { white-space: normal; }
    .kpi-value { font-size: 19px; }
    .tbl .roles, .tbl .col-num { display: none; }
    .tbl td, .tbl th { padding-left: 10px; padding-right: 10px; }
    .person { min-width: 170px; }
    .person-name { max-width: 180px; }
    .filters .field { min-width: 0; flex: 1 1 140px; }
    .toasts { left: 12px; right: 12px; bottom: 12px; align-items: stretch; }
    .toast { max-width: none; }
    .bulkbar { bottom: 10px; border-radius: 12px; }
}
