/* ───────────── Токены ───────────── */
:root {
    --bg: #f4f5fb;
    --surface: #ffffff;
    --surface-2: #f7f8fc;
    --surface-3: #eef0f7;
    --border: #e4e7f0;
    --border-strong: #d3d8e6;
    --text: #1b1e30;
    --muted: #646a82;
    --faint: #979db3;

    --accent: #5b5cf0;
    --accent-2: #8b5cf6;
    --accent-soft: #ecebff;
    --accent-text: #4338ca;

    --ok: #15994a;
    --ok-soft: #e3f6ea;
    --warn: #c27306;
    --warn-soft: #fdf1dc;
    --bad: #d63031;
    --bad-soft: #fdeaea;
    --info: #0b7fc0;
    --info-soft: #e2f1fa;

    --radius: 18px;
    --radius-sm: 11px;
    --shadow: 0 1px 2px rgba(22, 25, 60, .05), 0 10px 30px -14px rgba(22, 25, 60, .16);
    --shadow-hover: 0 2px 4px rgba(22, 25, 60, .06), 0 18px 40px -16px rgba(22, 25, 60, .24);
    --shadow-lg: 0 30px 80px -24px rgba(22, 25, 60, .40);
    --ease: cubic-bezier(.2, .8, .2, 1);
    --spring: cubic-bezier(.34, 1.56, .64, 1);
    --font: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
    --font-display: "Segoe UI Variable Display", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
    color-scheme: light;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #0f1120;
        --surface: #171a2c;
        --surface-2: #1c2034;
        --surface-3: #242942;
        --border: #2a2f49;
        --border-strong: #363c5c;
        --text: #e8eaf6;
        --muted: #a2a8c3;
        --faint: #6f7592;
        --accent: #7b7cff;
        --accent-2: #a78bfa;
        --accent-soft: #2a2b5c;
        --accent-text: #c7c8ff;
        --ok: #3ccf74;
        --ok-soft: #173826;
        --warn: #f0a63a;
        --warn-soft: #3a2c12;
        --bad: #ff6b6b;
        --bad-soft: #3d1a1d;
        --info: #4cb6f0;
        --info-soft: #132e40;
        --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 30px -14px rgba(0, 0, 0, .6);
        --shadow-hover: 0 2px 4px rgba(0, 0, 0, .3), 0 18px 40px -16px rgba(0, 0, 0, .7);
        color-scheme: dark;
    }
}

/* ───────────── База ───────────── */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 15px/1.5 var(--font);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { font-family: var(--font-display); line-height: 1.2; margin: 0; letter-spacing: -.01em; }
p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
.i { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.hidden, [hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

.container { width: 100%; max-width: 1240px; margin: 0 auto; padding: 0 16px; }
@media (min-width: 720px) { .container { padding: 0 28px; } }

/* Мягкие цветные пятна на фоне */
.bg-orbs { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.bg-orbs span { position: absolute; border-radius: 50%; filter: blur(80px); opacity: .45; animation: drift 24s ease-in-out infinite alternate; }
.bg-orbs span:nth-child(1) { width: 520px; height: 520px; background: #c7c4ff; top: -180px; left: -120px; }
.bg-orbs span:nth-child(2) { width: 460px; height: 460px; background: #bfe6ff; top: 120px; right: -160px; animation-delay: -8s; }
.bg-orbs span:nth-child(3) { width: 420px; height: 420px; background: #f6d7ff; bottom: -200px; left: 30%; animation-delay: -16s; }
@media (prefers-color-scheme: dark) { .bg-orbs span { opacity: .12; } }
@keyframes drift { to { transform: translate(40px, 30px) scale(1.08); } }

/* ───────────── Кнопки и поля ───────────── */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    height: 40px; padding: 0 18px; border-radius: 12px; border: 1px solid transparent;
    font-weight: 600; font-size: 14.5px; cursor: pointer; white-space: nowrap; text-decoration: none !important;
    transition: transform .18s var(--ease), box-shadow .18s var(--ease), background-color .18s, border-color .18s, opacity .18s;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn.primary { color: #fff; background: linear-gradient(135deg, var(--accent), var(--accent-2)); box-shadow: 0 6px 18px -8px var(--accent); }
.btn.primary:hover:not(:disabled) { box-shadow: 0 10px 24px -8px var(--accent); transform: translateY(-1px); }
.btn.soft { background: var(--accent-soft); color: var(--accent-text); }
.btn.soft:hover:not(:disabled) { border-color: color-mix(in srgb, var(--accent) 35%, transparent); }
.btn.ghost { background: transparent; color: var(--muted); border-color: var(--border); }
.btn.ghost:hover:not(:disabled) { background: var(--surface-2); color: var(--text); }
.btn.danger { background: var(--bad); color: #fff; }
.btn.danger:hover:not(:disabled) { filter: brightness(1.06); transform: translateY(-1px); }
.btn.sm { height: 32px; padding: 0 12px; font-size: 13.5px; border-radius: 10px; }
.btn.block { width: 100%; }
.btn .i { width: 17px; height: 17px; }
.btn.is-loading { pointer-events: none; opacity: .75; }
.btn.is-loading::after { content: ""; width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.btn-icon {
    display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 10px;
    border: 1px solid transparent; background: transparent; color: var(--muted); cursor: pointer;
    transition: background-color .15s, color .15s, transform .15s var(--ease);
}
.btn-icon:hover { background: var(--surface-3); color: var(--text); }
.btn-icon:active { transform: scale(.92); }
.btn-icon.ok:hover { background: var(--ok-soft); color: var(--ok); }
.btn-icon.warn:hover { background: var(--warn-soft); color: var(--warn); }
.btn-icon.bad:hover { background: var(--bad-soft); color: var(--bad); }
.btn-icon.info:hover { background: var(--info-soft); color: var(--info); }
.btn-icon:disabled { opacity: .35; cursor: not-allowed; }
.btn-icon .i { width: 17px; height: 17px; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: 13px; font-weight: 600; color: var(--muted); }
.field > span i { color: var(--bad); font-style: normal; }
.field > span em { font-style: normal; font-weight: 500; color: var(--faint); }
.field small { color: var(--faint); font-size: 12.5px; }
.input, .field input:not([type=checkbox]):not([type=radio]), .field select, .field textarea, .prog-row input {
    width: 100%; min-height: 42px; padding: 9px 13px; border-radius: 12px;
    border: 1px solid var(--border-strong); background: var(--surface);
    transition: border-color .15s, box-shadow .15s;
}
.field textarea { resize: vertical; min-height: 64px; }
.input:focus, .field input:focus, .field select:focus, .field textarea:focus, .prog-row input:focus {
    outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent);
}
.field.invalid input:not([type=checkbox]):not([type=radio]) { border-color: var(--bad); box-shadow: 0 0 0 4px color-mix(in srgb, var(--bad) 14%, transparent); animation: shake .35s; }
@keyframes shake { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
.fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.fields .wide { grid-column: 1 / -1; }
@media (max-width: 560px) { .fields { grid-template-columns: 1fr; } }
.check { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; font-size: 14px; }
.check input { width: 17px; height: 17px; accent-color: var(--accent); }

/* Переключатель */
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; font-size: 14px; color: var(--muted); }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch .track { width: 40px; height: 23px; border-radius: 99px; background: var(--border-strong); position: relative; transition: background-color .2s; flex: none; }
.switch .track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 17px; height: 17px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .25s var(--spring); }
.switch input:checked + .track { background: var(--accent); }
.switch input:checked + .track::after { transform: translateX(17px); }
.switch input:focus-visible + .track { box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 22%, transparent); }

/* ───────────── Метки ───────────── */
.chip {
    display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 9px; border-radius: 99px;
    font-size: 12px; font-weight: 600; white-space: nowrap; background: var(--surface-3); color: var(--muted);
}
.chip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.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.accent { background: var(--accent-soft); color: var(--accent-text); }
.chip.plain::before { display: none; }
.chip.warn::before { animation: pulse 1.8s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .35; transform: scale(.7); } }

/* ───────────── Шапка публичной страницы ───────────── */
.hero { padding: 48px 0 20px; text-align: center; animation: rise .6s var(--ease) both; }
.hero-badge {
    display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px; border-radius: 99px;
    background: color-mix(in srgb, var(--surface) 75%, transparent); border: 1px solid var(--border);
    color: var(--accent-text); font-weight: 600; font-size: 13px; backdrop-filter: blur(8px);
}
.hero h1 { font-size: clamp(28px, 4.6vw, 44px); font-weight: 750; margin: 16px 0 10px;
    background: linear-gradient(120deg, var(--text) 30%, var(--accent) 85%); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero .lead { color: var(--muted); font-size: 16.5px; max-width: 640px; margin: 0 auto; }

.tabs { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; margin: 22px 0 8px; }
.tab {
    display: inline-flex; align-items: center; gap: 8px; padding: 9px 16px; border-radius: 99px;
    background: color-mix(in srgb, var(--surface) 70%, transparent); border: 1px solid var(--border);
    color: var(--muted); font-weight: 600; font-size: 14px; text-decoration: none !important;
    transition: all .2s var(--ease); backdrop-filter: blur(8px);
}
.tab:hover { color: var(--text); border-color: var(--border-strong); transform: translateY(-1px); }
.tab.active { background: var(--text); color: var(--bg); border-color: var(--text); box-shadow: 0 8px 20px -10px rgba(0,0,0,.5); }
.tab small { font-weight: 500; opacity: .7; }

.dept-title { text-align: center; color: var(--muted); font-size: 14px; margin-bottom: 18px; }

.toolbar {
    position: sticky; top: 10px; z-index: 5; display: flex; gap: 14px; align-items: center; flex-wrap: wrap;
    padding: 10px; margin: 0 0 22px; border-radius: 16px; border: 1px solid var(--border);
    background: color-mix(in srgb, var(--surface) 82%, transparent); backdrop-filter: blur(14px) saturate(1.4);
    box-shadow: var(--shadow);
}
.search { flex: 1 1 280px; display: flex; align-items: center; gap: 10px; padding: 0 12px; height: 42px; border-radius: 11px; background: var(--surface-2); border: 1px solid transparent; transition: border-color .15s, box-shadow .15s; }
.search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 16%, transparent); background: var(--surface); }
.search .i { color: var(--faint); }
.search input { flex: 1; border: 0; background: transparent; outline: none; min-width: 0; height: 100%; }
.toolbar .switch { padding: 0 6px; }

.stats { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; margin: 0 0 20px; }
.stat { display: flex; align-items: baseline; gap: 6px; padding: 8px 14px; border-radius: 12px; background: color-mix(in srgb, var(--surface) 70%, transparent); border: 1px solid var(--border); font-size: 13.5px; color: var(--muted); }
.stat b { font-size: 18px; color: var(--text); font-variant-numeric: tabular-nums; }
.stat.ok b { color: var(--ok); }

/* ───────────── Карточки руководителей ───────────── */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 360px), 1fr)); gap: 18px; align-items: start; }
.sup-card {
    position: relative; display: flex; flex-direction: column; gap: 14px; padding: 20px;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
    transition: box-shadow .25s var(--ease), transform .25s var(--ease), border-color .25s;
}
.sup-card:hover { box-shadow: var(--shadow-hover); transform: translateY(-2px); }
.sup-card.full { background: linear-gradient(var(--surface), var(--surface)) padding-box; }
.anim { animation: rise .55s var(--ease) both; animation-delay: calc(var(--i, 0) * 45ms); }
.no-anim .anim { animation: none; }
@keyframes rise { from { opacity: 0; transform: translateY(14px) scale(.985); } to { opacity: 1; transform: none; } }

.sup-head { display: flex; gap: 13px; align-items: flex-start; }
.avatar {
    flex: none; width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center;
    font-weight: 700; font-size: 16px; color: #fff; letter-spacing: .02em;
    background: linear-gradient(135deg, hsl(var(--h) 75% 62%), hsl(calc(var(--h) + 40) 70% 52%));
    box-shadow: 0 6px 14px -6px hsl(var(--h) 70% 50%);
}
.sup-id { flex: 1; min-width: 0; }
.sup-id h3 { font-size: 17px; font-weight: 650; }
.sup-id p { font-size: 13.5px; margin-top: 2px; }
.free-badge { flex: none; text-align: center; min-width: 64px; padding: 6px 8px; border-radius: 13px; line-height: 1.1; }
.free-badge b { display: block; font-size: 22px; font-variant-numeric: tabular-nums; font-family: var(--font-display); }
.free-badge span { font-size: 11px; font-weight: 600; }
.free-badge.has { background: var(--ok-soft); color: var(--ok); }
.free-badge.none { background: var(--surface-3); color: var(--muted); }
.sup-note { font-size: 13.5px; color: var(--muted); padding: 10px 12px; border-radius: 12px; background: var(--surface-2); }

.slots { display: flex; flex-wrap: wrap; gap: 6px; }
.slot {
    width: 22px; height: 10px; border-radius: 99px; background: var(--surface-3);
    box-shadow: inset 0 0 0 1px var(--border);
    animation: slot-in .5s var(--spring) both; animation-delay: calc(200ms + var(--k, 0) * 40ms);
}
.slot.ok { background: var(--ok); box-shadow: none; }
.slot.warn { background: repeating-linear-gradient(-45deg, var(--warn), var(--warn) 4px, color-mix(in srgb, var(--warn) 70%, #fff) 4px, color-mix(in srgb, var(--warn) 70%, #fff) 8px); box-shadow: none; }
.no-anim .slot { animation: none; }
@keyframes slot-in { from { transform: scaleX(0); opacity: 0; } to { transform: none; opacity: 1; } }
.slots-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12.5px; color: var(--muted); margin-top: -6px; }
.slots-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.slots-legend .l-ok { background: var(--ok); }
.slots-legend .l-warn { background: var(--warn); }
.slots-legend .l-free { background: var(--surface-3); box-shadow: inset 0 0 0 1px var(--border-strong); }

.list-title { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--faint); margin-bottom: 6px; }
.list-title .count { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 99px; background: var(--surface-3); color: var(--muted); font-size: 11.5px; letter-spacing: 0; }

.people { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.person {
    display: grid; grid-template-columns: 24px 1fr auto; gap: 10px; align-items: start;
    padding: 8px 8px; margin: 0 -8px; border-radius: 11px; transition: background-color .3s;
}
.person:hover { background: var(--surface-2); }
.person .num { font-size: 12px; font-weight: 700; color: var(--faint); padding-top: 2px; font-variant-numeric: tabular-nums; text-align: right; }
.p-main { min-width: 0; display: flex; flex-direction: column; }
.p-name { font-weight: 600; font-size: 14.5px; }
.p-group { font-size: 12.5px; color: var(--muted); }
.p-topic { font-size: 12.5px; color: var(--muted); font-style: italic; margin-top: 2px; }
.p-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; }
.p-meta time { font-size: 11.5px; color: var(--faint); white-space: nowrap; font-variant-numeric: tabular-nums; }
.person.mine { background: var(--accent-soft); }
.person.mine .p-name::after { content: "это вы"; margin-left: 8px; font-size: 11px; font-weight: 700; color: var(--accent-text); background: var(--surface); padding: 1px 7px; border-radius: 99px; vertical-align: 1px; }
.person.match { background: color-mix(in srgb, var(--warn) 16%, transparent); }
.person.flash { animation: flash 2.4s var(--ease); }
@keyframes flash { 0%, 30% { background: color-mix(in srgb, var(--accent) 22%, transparent); } 100% { background: transparent; } }

.queue { border-top: 1px dashed var(--border-strong); padding-top: 12px; }
.empty-line { font-size: 13.5px; color: var(--faint); padding: 4px 0; }
.sup-foot { display: flex; align-items: center; gap: 10px; margin-top: auto; padding-top: 4px; }
.sup-foot .btn { flex: 1; }
.sup-foot .closed { flex: 1; text-align: center; font-size: 13.5px; color: var(--muted); padding: 9px; border-radius: 12px; background: var(--surface-2); display: inline-flex; gap: 8px; justify-content: center; align-items: center; }

.notice { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: 14px; margin-bottom: 18px; font-size: 14.5px; border: 1px solid transparent; animation: rise .4s var(--ease) both; }
.notice.warn { background: var(--warn-soft); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 25%, transparent); }
.notice.info { background: var(--info-soft); color: var(--info); }
.notice.bad { background: var(--bad-soft); color: var(--bad); }
.notice .i { margin-top: 2px; }
.notice b { color: inherit; }

.empty { text-align: center; padding: 60px 20px; color: var(--muted); }
.empty .i { width: 40px; height: 40px; color: var(--faint); margin-bottom: 10px; }
.nothing-found { grid-column: 1 / -1; }

.foot { text-align: center; padding: 40px 0 30px; color: var(--faint); font-size: 13px; }

/* ───────────── Диалоги ───────────── */
.dlg {
    width: min(560px, calc(100vw - 24px)); max-height: calc(100vh - 32px); padding: 0; border: 0;
    border-radius: 22px; background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg);
    overflow: auto;
}
.dlg.dlg-sm { width: min(420px, calc(100vw - 24px)); }
.dlg.dlg-lg { width: min(760px, calc(100vw - 24px)); }
.dlg[open] { animation: dlg-in .32s var(--spring); }
.dlg::backdrop { background: rgba(15, 17, 35, .38); backdrop-filter: blur(5px); animation: fade .25s ease; }
.dlg.closing { animation: dlg-out .18s ease forwards; }
.dlg.closing::backdrop { animation: fade .18s ease reverse forwards; }
@keyframes dlg-in { from { opacity: 0; transform: translateY(18px) scale(.96); } }
@keyframes dlg-out { to { opacity: 0; transform: translateY(10px) scale(.97); } }
@keyframes fade { from { opacity: 0; } }
.dlg-body { position: relative; padding: 26px 26px 22px; display: flex; flex-direction: column; gap: 16px; }
.dlg-body h2 { font-size: 21px; font-weight: 700; padding-right: 30px; }
.dlg-sub { color: var(--muted); font-size: 14.5px; margin-top: -8px; }
.dlg-x { position: absolute; top: 16px; right: 16px; }
.dlg-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 4px; flex-wrap: wrap; }
.form-error { padding: 11px 14px; border-radius: 12px; background: var(--bad-soft); color: var(--bad); font-size: 14px; animation: rise .3s var(--ease); }
.form-error.full { background: var(--warn-soft); color: var(--warn); }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* ───────────── Уведомления ───────────── */
.toasts { position: fixed; z-index: 100; left: 50%; bottom: 22px; transform: translateX(-50%); display: flex; flex-direction: column; gap: 10px; width: min(520px, calc(100vw - 32px)); pointer-events: none; }
.toast {
    pointer-events: auto; display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: 16px;
    background: var(--text); color: var(--bg); box-shadow: var(--shadow-lg); font-size: 14.5px;
    animation: toast-in .45s var(--spring);
}
.toast.out { animation: toast-out .3s ease forwards; }
.toast .i { margin-top: 2px; }
.toast.ok .i { color: #4ade80; }
.toast.err .i { color: #ff8a8a; }
.toast p { flex: 1; }
@keyframes toast-in { from { opacity: 0; transform: translateY(20px) scale(.95); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(10px) scale(.97); } }

/* ───────────── Административная часть ───────────── */
.topbar { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--surface) 80%, transparent); backdrop-filter: blur(14px) saturate(1.4); border-bottom: 1px solid var(--border); }
.topbar-in { display: flex; align-items: center; gap: 18px; min-height: 62px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 11px; color: var(--text); text-decoration: none !important; }
.brand-mark { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; color: #fff; background: linear-gradient(135deg, var(--accent), var(--accent-2)); box-shadow: 0 6px 14px -6px var(--accent); }
.brand-text { font-weight: 700; line-height: 1.1; display: flex; flex-direction: column; }
.brand-text small { font-weight: 500; font-size: 12px; color: var(--muted); }
.nav { display: flex; gap: 2px; flex: 1; flex-wrap: wrap; }
.nav a { display: inline-flex; align-items: center; gap: 7px; padding: 8px 12px; border-radius: 10px; color: var(--muted); font-weight: 600; font-size: 14px; text-decoration: none !important; transition: background-color .15s, color .15s; }
.nav a:hover { background: var(--surface-3); color: var(--text); }
.nav a.active { background: var(--accent-soft); color: var(--accent-text); }
.me { display: flex; align-items: center; gap: 4px; }
.me-name { display: inline-flex; align-items: center; gap: 7px; padding: 6px 10px; border-radius: 10px; color: var(--muted); font-size: 14px; font-weight: 600; text-decoration: none !important; }
.me-name:hover { background: var(--surface-3); color: var(--text); }
@media (max-width: 1360px) {
    .me-name span { display: none; }
}
@media (max-width: 900px) {
    .nav a span, .me-name span { display: none; }
    .topbar-in { gap: 8px; padding-top: 8px; }
    .brand { flex: 1; }
    .nav { order: 3; flex: 1 0 100%; justify-content: space-around; padding-bottom: 8px; }
    .year-select { order: 4; flex: 1 0 100%; margin-bottom: 8px; }
    .year-select select { flex: 1; }
    .nav a { padding: 8px 14px; }
}

.admin-main { padding-top: 28px; padding-bottom: 60px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; animation: rise .45s var(--ease) both; }
.page-head h1 { font-size: 28px; font-weight: 750; }
.page-head p { color: var(--muted); margin-top: 4px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 20px; }

.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin-bottom: 24px; }
.tile { padding: 16px 18px; border-radius: 16px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow); animation: rise .5s var(--ease) both; animation-delay: calc(var(--i, 0) * 50ms); }
.tile b { display: block; font-size: 28px; font-weight: 750; font-family: var(--font-display); font-variant-numeric: tabular-nums; line-height: 1.1; }
.tile span { font-size: 13px; color: var(--muted); font-weight: 600; }
.tile.ok b { color: var(--ok); } .tile.warn b { color: var(--warn); } .tile.info b { color: var(--info); } .tile.bad b { color: var(--bad); } .tile.accent b { color: var(--accent); }

.dept-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); gap: 16px; }
.dept-card { display: flex; flex-direction: column; gap: 14px; padding: 20px; color: var(--text); text-decoration: none !important; transition: transform .2s var(--ease), box-shadow .2s var(--ease); }
.dept-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-hover); }
.dept-card h3 { font-size: 17px; }
.bar { height: 8px; border-radius: 99px; background: var(--surface-3); overflow: hidden; display: flex; }
.bar span { height: 100%; transition: width .8s var(--ease); }
.bar .ok { background: var(--ok); } .bar .warn { background: var(--warn); }
.mini-stats { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 13px; color: var(--muted); }
.mini-stats b { color: var(--text); }

/* Панель руководителя */
.panel { margin-bottom: 18px; overflow: hidden; animation: rise .5s var(--ease) both; animation-delay: calc(var(--i, 0) * 50ms); }
.panel.archived { opacity: .65; }
.panel-head { display: flex; gap: 14px; align-items: center; padding: 16px 20px; flex-wrap: wrap; }
.panel-head .sup-id h3 { font-size: 17.5px; }
.panel-head .tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.cap {
    display: inline-flex; align-items: center; gap: 4px; padding: 4px; border-radius: 13px;
    background: var(--surface-2); border: 1px solid var(--border);
}
.cap input { width: 52px; height: 32px; text-align: center; border: 0; background: transparent; font-weight: 700; font-size: 16px; -moz-appearance: textfield; }
.cap input::-webkit-inner-spin-button, .cap input::-webkit-outer-spin-button { -webkit-appearance: none; }
.cap input:focus { outline: none; }
.cap .lbl { font-size: 12.5px; color: var(--muted); padding: 0 8px 0 4px; }
.cap .save { display: none; }
.cap.dirty { border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 14%, transparent); }
.cap.dirty .save { display: inline-flex; animation: rise .25s var(--ease); }
.panel-meter { padding: 0 20px 14px; display: flex; flex-direction: column; gap: 10px; }
.panel-body { border-top: 1px solid var(--border); }
.section-label { display: flex; align-items: center; gap: 8px; padding: 12px 20px 6px; font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--faint); }
.section-label .count { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 99px; background: var(--surface-3); color: var(--muted); font-size: 11.5px; letter-spacing: 0; }

/* Строки одной секции — общая сетка (subgrid): колонки статуса и кнопок выровнены. */
.rows { list-style: none; margin: 0; padding: 0 8px 8px; display: grid; grid-template-columns: 26px minmax(0, 1fr) max-content max-content; column-gap: 12px; }
.row {
    grid-column: 1 / -1; display: grid; grid-template-columns: subgrid; align-items: center;
    padding: 9px 12px; border-radius: 12px; transition: background-color .2s;
}
.row:hover { background: var(--surface-2); }
.row .num { font-size: 12px; font-weight: 700; color: var(--faint); text-align: right; font-variant-numeric: tabular-nums; }
.row .who b { font-weight: 600; }
.row .who small { display: block; color: var(--muted); font-size: 12.5px; }
.row .when { font-size: 12.5px; color: var(--muted); display: flex; flex-direction: column; gap: 3px; align-items: flex-start; }
.row .actions { display: flex; gap: 2px; justify-content: flex-end; flex-wrap: wrap; }
.row .actions form { display: contents; }
.row.flash { animation: flash 2.4s var(--ease); }
.row .note { color: var(--bad); font-size: 12.5px; }
@media (max-width: 760px) {
    .rows { display: block; }
    .row { grid-template-columns: 22px 1fr; column-gap: 10px; }
    .row .when { grid-column: 2; flex-direction: row; flex-wrap: wrap; gap: 6px; align-items: center; }
    .row .actions { grid-column: 1 / -1; justify-content: flex-start; }
}
.rows-empty { padding: 4px 20px 14px; color: var(--faint); font-size: 13.5px; }
details.rej > summary { list-style: none; cursor: pointer; }
details.rej > summary::-webkit-details-marker { display: none; }
details.rej > summary .i { transition: transform .2s; width: 15px; height: 15px; }
details.rej[open] > summary .i { transform: rotate(180deg); }

.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--faint); font-weight: 700; padding: 12px 14px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.tbl td { padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: top; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr { transition: background-color .15s; }
.tbl tbody tr:hover { background: var(--surface-2); }
.tbl .nowrap { white-space: nowrap; }
.tbl .actions { white-space: nowrap; text-align: right; }

.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; padding: 14px; margin-bottom: 16px; }
.filters .field { min-width: 170px; flex: 1; }
.filters .field.grow { flex: 3; }

.pager { display: flex; justify-content: center; gap: 6px; margin-top: 18px; }

.details-json { margin-top: 6px; font-size: 12.5px; color: var(--muted); background: var(--surface-2); border-radius: 10px; padding: 8px 10px; white-space: pre-wrap; word-break: break-word; font-family: Consolas, ui-monospace, monospace; }
details.more > summary { cursor: pointer; color: var(--accent-text); font-size: 12.5px; list-style: none; }
details.more > summary::-webkit-details-marker { display: none; }

.timeline { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.timeline li { position: relative; padding: 0 0 16px 22px; animation: rise .35s var(--ease) both; animation-delay: calc(var(--i, 0) * 35ms); }
.timeline li::before { content: ""; position: absolute; left: 5px; top: 7px; width: 9px; height: 9px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.timeline li::after { content: ""; position: absolute; left: 9px; top: 20px; bottom: 2px; width: 1px; background: var(--border-strong); }
.timeline li:last-child::after { display: none; }
.timeline .t-time { font-size: 12.5px; color: var(--faint); }
.timeline .t-actor { font-size: 12.5px; color: var(--muted); }

.login-wrap { min-height: calc(100vh - 80px); display: grid; place-items: center; padding: 40px 0; }
.login-card { width: min(400px, 100%); padding: 32px 28px; animation: rise .55s var(--ease) both; }
.login-card .brand-mark { width: 52px; height: 52px; border-radius: 16px; margin: 0 auto 14px; }
.login-card .brand-mark .i { width: 26px; height: 26px; }
.login-card h1 { text-align: center; font-size: 22px; }
.login-card .muted { text-align: center; margin: 6px 0 22px; font-size: 14px; }
.login-card form { display: flex; flex-direction: column; gap: 14px; }

.stack { display: flex; flex-direction: column; gap: 14px; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr)); gap: 18px; align-items: start; }
.radio-cards { display: grid; gap: 8px; }
.radio-card { display: flex; gap: 10px; align-items: flex-start; padding: 11px 13px; border: 1px solid var(--border-strong); border-radius: 12px; cursor: pointer; transition: border-color .15s, background-color .15s; }
.radio-card:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.radio-card input { margin-top: 3px; accent-color: var(--accent); }
.radio-card small { display: block; color: var(--muted); font-size: 12.5px; }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .001ms !important; animation-delay: 0ms !important; transition-duration: .001ms !important; }
}

/* Учебные годы */
.years { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin: 18px 0 0; }
.year-pill {
    display: inline-flex; flex-direction: column; align-items: center; line-height: 1.15; padding: 7px 16px; border-radius: 14px;
    border: 1px dashed var(--border-strong); color: var(--muted); text-decoration: none !important;
    background: color-mix(in srgb, var(--surface) 60%, transparent); transition: all .2s var(--ease);
}
.year-pill b { font-size: 14.5px; font-variant-numeric: tabular-nums; }
.year-pill small { font-size: 11.5px; font-weight: 600; opacity: .8; }
.year-pill:hover { color: var(--text); border-style: solid; transform: translateY(-1px); }
.year-pill.active { border: 1px solid var(--accent); color: var(--accent-text); background: var(--accent-soft); box-shadow: 0 6px 16px -10px var(--accent); }
.year-select { display: inline-flex; align-items: center; gap: 6px; padding: 0 4px 0 10px; height: 36px; border-radius: 11px; border: 1px solid var(--border); background: var(--surface-2); color: var(--muted); }
.year-select select { border: 0; background: transparent; font-weight: 650; color: var(--text); height: 100%; padding-right: 4px; cursor: pointer; outline: none; }
.year-select .i { width: 16px; height: 16px; }
.notice .btn { color: #fff; }

/* Варианты обучения */
.track-switch { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin: 4px 0 18px; }
.track-pill {
    display: inline-flex; flex-direction: column; align-items: center; line-height: 1.15; min-width: 132px; padding: 9px 16px; border-radius: 14px;
    border: 1px solid var(--border); background: color-mix(in srgb, var(--surface) 75%, transparent); color: var(--muted);
    text-decoration: none !important; transition: all .2s var(--ease); backdrop-filter: blur(8px);
}
.track-pill b { font-size: 14.5px; color: var(--text); }
.track-pill small { font-size: 12px; font-weight: 600; }
.track-pill:hover { border-color: var(--border-strong); transform: translateY(-1px); }
.track-pill.active { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 6px 16px -10px var(--accent); }
.track-pill.active b, .track-pill.active small { color: var(--accent-text); }
.track-caption { text-align: center; color: var(--accent-text); font-weight: 650; font-size: 14px; margin: -6px 0 12px; display: flex; gap: 6px; justify-content: center; align-items: center; }
.track-block { border-top: 1px solid var(--border); }
.track-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 20px 4px; }
.track-head .track-name { display: flex; flex-direction: column; line-height: 1.2; min-width: 170px; }
.track-head .track-name b { font-size: 14.5px; }
.track-head .track-name small { color: var(--muted); font-size: 12.5px; }
.track-head .slots { flex: 1; min-width: 120px; }
.track-head .chip.off { background: var(--surface-3); color: var(--faint); }
.track-checks { display: grid; gap: 8px; }

/* Направления подготовки */
.prog-switch { margin-top: -8px; }
.prog-label { width: 100%; text-align: center; color: var(--muted); font-size: 12.5px; font-weight: 600; }
.prog-pill small { max-width: 240px; text-align: center; white-space: normal; }
.prog-list { display: grid; gap: 8px; margin: 4px 0 6px; }
.prog-row { display: grid; grid-template-columns: 90px 1fr 70px auto auto; gap: 8px; align-items: center; }
.prog-row input { min-width: 0; padding-top: 8px; padding-bottom: 8px; }
.prog-level { font-size: 12.5px; font-weight: 650; color: var(--muted); margin-top: 6px; }
@media (max-width: 560px) { .prog-row { grid-template-columns: 1fr 1fr; } .prog-row .wide { grid-column: 1 / -1; } }

/* Кнопки решений руководителя */
.btn.yes { background: var(--ok-soft); color: var(--ok); }
.btn.yes:hover:not(:disabled) { background: var(--ok); color: #fff; }
.btn.later { background: var(--info-soft); color: var(--info); }
.btn.later:hover:not(:disabled) { background: var(--info); color: #fff; }
.btn.no { background: var(--bad-soft); color: var(--bad); }
.btn.no:hover:not(:disabled) { background: var(--bad); color: #fff; }
.panel:target, .row:target { scroll-margin-top: 90px; }
.panel { scroll-margin-top: 90px; }
