:root {
    color-scheme: dark;
    font-family: Inter, "Segoe UI", Arial, Helvetica, sans-serif;
    background: var(--bg);
    color: var(--text);

    /* Поверхности: нейтральный тёмный набор без подсветок */
    --bg: oklch(0.17 0.012 250);
    --surface: oklch(0.21 0.013 250);
    --surface-strong: oklch(0.245 0.013 250);
    --line: oklch(0.32 0.015 250);
    --line-strong: oklch(0.42 0.02 250);

    /* Текст: на фоне L=0.17 основной текст держит запас по контрасту */
    --text: oklch(0.96 0.004 250);
    --text-soft: oklch(0.72 0.012 250);

    /* Один акцент для главного действия, остальные роли — семантические */
    --accent: oklch(0.58 0.116 245);
    --accent-hover: oklch(0.63 0.12 245);
    --accent-text: oklch(0.99 0 0);
    --accent-soft: oklch(0.58 0.116 245 / 0.14);
    --success: oklch(0.72 0.12 158);
    --warning: oklch(0.78 0.11 78);
    --danger: oklch(0.68 0.15 25);

    --shadow-1: 0 1px 2px oklch(0 0 0 / 0.3);
    --shadow-2: 0 4px 12px oklch(0 0 0 / 0.28);

    /* Радиусы: внешний = внутренний + отступ */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;

    /* Прежние имена оставлены алиасами — на них ссылается вся разметка */
    --cyan: var(--accent);
    --green: var(--success);
    --amber: var(--warning);
    --blue: var(--accent);
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    background: var(--bg);
}

body {
    min-height: 100vh;
    margin: 0;
    overflow-x: hidden;
    /* Тонкая сетка: даёт фактуру, но по контрасту сильно ниже текста */
    background:
        linear-gradient(90deg, oklch(0.66 0.1 255 / 0.05) 1px, transparent 1px),
        linear-gradient(180deg, oklch(0.66 0.1 255 / 0.04) 1px, transparent 1px),
        var(--bg);
    background-size: 56px 56px, 56px 56px, auto;
}

/* Мягкий синий свет, медленно гуляющий за сеткой */
.ambient-glow {
    position: fixed;
    top: -30vh;
    left: -20vw;
    z-index: 0;
    width: max(60vw, 780px);
    height: max(60vw, 780px);
    pointer-events: none;
    background:
        radial-gradient(circle, oklch(0.6 0.15 258 / 0.22) 0%, oklch(0.55 0.13 268 / 0.1) 38%, transparent 68%),
        radial-gradient(circle at 68% 60%, oklch(0.62 0.12 232 / 0.12), transparent 46%);
    filter: blur(26px);
    opacity: 0.9;
    animation: ambientDrift 46s ease-in-out infinite alternate;
    will-change: transform;
}

@keyframes ambientDrift {
    from {
        transform: translate3d(0, 0, 0) scale(1);
    }

    to {
        transform: translate3d(72vw, 10vh, 0) scale(1.12);
    }
}

#cursorTrail {
    position: fixed;
    inset: 0;
    z-index: 4;
    pointer-events: none;
}

.shell {
    position: relative;
    z-index: 2;
    min-height: 100vh;
    display: grid;
    /* minmax(0, …) не даёт широкой доске распирать сетку и уносить макет вправо */
    grid-template-columns: minmax(0, 1fr);
    align-content: start;
    justify-items: center;
    gap: 18px;
    padding: 24px 32px 32px;
}

.panel {
    position: relative;
    width: min(1240px, 100%);
    /* Без этого содержимое с горизонтальным скроллом растягивает панель */
    min-width: 0;
    max-width: 100%;
    border-radius: var(--radius-lg);
    padding: 28px;
    background: var(--surface);
    /* Глубина — тенью, рамка осталась бы декоративной */
    box-shadow: var(--shadow-2);
}

.quick-panel {
    padding: 22px 28px;
}

/* Линии-украшения внутри панелей убраны */
.panel-grid {
    display: none;
}

.heading,
.report-form,
.meta,
.quick-links {
    position: relative;
    z-index: 1;
}

.heading {
    display: flex;
    align-items: start;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 32px;
}

.eyebrow {
    margin: 0 0 8px;
    color: var(--text-soft);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

h1 {
    margin: 0;
    font-size: clamp(26px, 3vw, 34px);
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: -0.01em;
}

.section-title {
    font-size: clamp(24px, 2.6vw, 30px);
}

.month-chip {
    flex: 0 0 auto;
    border-radius: var(--radius-sm);
    padding: 7px 12px;
    color: var(--text-soft);
    background: var(--surface-strong);
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
}

.report-form {
    display: grid;
    gap: 12px;
}

label {
    color: #eef5ff;
    font-size: 18px;
    font-weight: 800;
}

.controls {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px;
}

input,
select,
button {
    min-height: 44px;
    border-radius: var(--radius-sm);
    font: inherit;
}

input,
select {
    width: 100%;
    border: 1px solid var(--line);
    padding: 9px 13px;
    color: var(--text);
    background: var(--bg);
    outline: none;
}

select {
    appearance: none;
    padding-right: 38px;
    cursor: pointer;
    background:
        linear-gradient(45deg, transparent 50%, var(--text-soft) 50%) calc(100% - 20px) 52% / 6px 6px no-repeat,
        linear-gradient(135deg, var(--text-soft) 50%, transparent 50%) calc(100% - 14px) 52% / 6px 6px no-repeat,
        var(--bg);
}

select option {
    color: #101820;
    background: #f7fbff;
}

.period-picker {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 138px;
    gap: 10px;
}

input:focus-visible,
select:focus-visible {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

input::-webkit-calendar-picker-indicator {
    filter: invert(1);
    opacity: 0.7;
    cursor: pointer;
}

/* Заливка — только у главного действия страницы */
button {
    min-width: 0;
    border: 1px solid transparent;
    padding: 0 18px;
    color: var(--accent-text);
    cursor: pointer;
    font-weight: 600;
    background: var(--accent);
    box-shadow: var(--shadow-1);
    transition: background-color 120ms ease-out, scale 120ms ease-out;
}

button:hover {
    background: var(--accent-hover);
}

button:active {
    scale: 0.96;
}

button:disabled {
    cursor: progress;
    opacity: 0.55;
}

button:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

button span {
    position: relative;
    z-index: 1;
}

.unf-action {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: minmax(300px, 430px) minmax(0, 1fr);
    gap: 12px;
    align-items: center;
    margin-top: 16px;
}

/* Вторичные действия остаются нейтральными */
.secondary-action {
    min-width: 0;
    min-height: 44px;
    border: 1px solid var(--line);
    padding: 10px 16px;
    color: var(--text);
    line-height: 1.25;
    white-space: normal;
    background: var(--surface-strong);
    box-shadow: none;
}

.secondary-action:hover {
    border-color: var(--line-strong);
    background: var(--surface-strong);
}

.secondary-action span {
    display: block;
}

/* Ссылка, оформленная как главная кнопка */
.button-link {
    display: inline-grid;
    place-items: center;
    min-height: 44px;
    border-radius: var(--radius-sm);
    padding: 0 18px;
    color: var(--accent-text);
    font-weight: 600;
    text-decoration: none;
    background: var(--accent);
    box-shadow: var(--shadow-1);
    transition: background-color 120ms ease-out, scale 120ms ease-out;
}

.button-link:hover {
    background: var(--accent-hover);
}

.button-link:active {
    scale: 0.96;
}

.button-link:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.action-status {
    min-height: 42px;
    margin: 0;
    color: var(--text-soft);
    font-size: 13px;
    font-weight: 700;
    line-height: 1.35;
    white-space: pre-line;
}

/* Отчёт по выбранным компаниям */
.company-filter {
    position: relative;
    z-index: 1;
    display: grid;
    gap: 8px;
    margin-top: 22px;
    padding-top: 20px;
    border-top: 1px solid var(--line);
}

.company-hint {
    margin: -2px 0 4px;
}

.company-controls {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 12px;
}

.company-controls .secondary-action {
    min-width: 220px;
}

/* Выбранные компании — чипы с крестиком */
.company-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 4px;
}

.company-chips[data-empty="true"]::before {
    content: "Компании не выбраны — отчёт будет по всем";
    color: var(--text-soft);
    font-size: 13px;
    font-weight: 600;
}

.company-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 6px 5px 12px;
    border-radius: 999px;
    color: var(--text);
    font-size: 13px;
    font-weight: 600;
    background: var(--surface-strong);
    box-shadow: inset 0 0 0 1px var(--line);
}

.company-chip-remove {
    display: grid;
    place-items: center;
    width: 20px;
    min-width: 0;
    height: 20px;
    min-height: 0;
    padding: 0;
    border: 0;
    border-radius: 50%;
    color: var(--text-soft);
    font-size: 16px;
    line-height: 1;
    background: transparent;
    box-shadow: none;
    transition: color 120ms ease-out, background-color 120ms ease-out;
}

.company-chip-remove:hover {
    color: var(--accent-text);
    background: var(--danger);
}

.company-chip-remove:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 1px;
}

.company-controls .secondary-action {
    align-self: stretch;
}

@media (max-width: 720px) {
    .company-controls {
        grid-template-columns: 1fr;
    }
}

/* Кнопка-ссылка «Проверка корректности заполнения задач» */
/* Ссылка, но выглядит как соседние кнопки УНФ (тег <a> не наследует их стили) */
.quality-action {
    display: grid;
    place-items: center;
    min-height: 58px;
    border: 1px solid rgba(96, 239, 255, 0.42);
    border-radius: 8px;
    color: #eef9ff;
    font-weight: 900;
    text-align: center;
    text-decoration: none;
}

.quality-action:hover {
    border-color: rgba(75, 255, 196, 0.6);
    color: #ffffff;
}

.quality-action:focus-visible {
    outline: 3px solid rgba(249, 199, 79, 0.8);
    outline-offset: 3px;
}

.action-hint {
    align-self: center;
    margin: 0;
    color: var(--text-soft);
    font-size: 13px;
    font-weight: 700;
    line-height: 1.4;
}

/* Страница проверки задач */
.quality-title {
    font-size: clamp(28px, 3.4vw, 44px);
    line-height: 1.05;
}

.quality-checked {
    position: relative;
    z-index: 1;
    margin: 0 0 6px;
}

.quality-export {
    display: grid;
    place-items: center;
    min-height: 58px;
    padding: 0 24px;
    border: 1px solid rgba(96, 239, 255, 0.42);
    border-radius: 8px;
    color: #041019;
    font-weight: 900;
    text-decoration: none;
    background: var(--accent);
    box-shadow: 0 16px 32px rgba(55, 174, 255, 0.22);
}

.quality-export:hover {
    box-shadow: 0 18px 42px rgba(75, 255, 196, 0.28);
}

.quality-red-value {
    color: #ff8d8d;
}

.quality-yellow-value {
    color: var(--amber);
}

.quality-issue-stats {
    position: relative;
    z-index: 1;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0 0 16px;
}

.quality-stat {
    display: inline-flex;
    align-items: baseline;
    gap: 8px;
    padding: 6px 13px;
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--text-soft);
    font-size: 12px;
    font-weight: 700;
}

.quality-stat strong {
    color: #eef5ff;
    font-size: 14px;
}

.quality-stat--red {
    border-color: rgba(255, 141, 141, 0.42);
    color: #ff8d8d;
}

.quality-stat--yellow {
    border-color: rgba(249, 199, 79, 0.42);
    color: var(--amber);
}

.quality-list {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 62vh;
    margin: 0;
    padding: 6px;
    overflow-y: auto;
    list-style: none;
}

.quality-row {
    border: 1px solid var(--line);
    border-left: 3px solid var(--text-soft);
    border-radius: 10px;
    padding: 12px 14px;
    background: var(--surface-strong);
}

.quality-row--red {
    border-left-color: #ff8d8d;
}

.quality-row--yellow {
    border-left-color: var(--amber);
}

.quality-row-head {
    display: flex;
    align-items: baseline;
    gap: 10px;
    flex-wrap: wrap;
}

.quality-badge {
    flex: 0 0 auto;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 800;
}

.quality-badge--red {
    background: rgba(255, 141, 141, 0.16);
    color: #ff8d8d;
}

.quality-badge--yellow {
    background: rgba(249, 199, 79, 0.16);
    color: var(--amber);
}

.quality-id {
    color: var(--text-soft);
    font-size: 12px;
    font-weight: 700;
}

.quality-name {
    flex: 1 1 260px;
    margin: 0;
    font-size: 14px;
    line-height: 1.3;
}

.quality-name a {
    color: #f3f8ff;
    text-decoration: none;
}

.quality-name a:hover {
    color: var(--cyan);
    text-decoration: underline;
}

.quality-hours {
    flex: 0 0 auto;
    color: var(--green);
    font-size: 13px;
    font-weight: 900;
}

.quality-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 14px;
    margin: 6px 0 0;
    color: var(--text-soft);
    font-size: 12px;
    font-weight: 700;
}

.quality-issues {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 9px 0 0;
    padding: 0;
    list-style: none;
}

.quality-issue {
    padding: 4px 10px;
    border-radius: 7px;
    font-size: 12px;
    font-weight: 700;
}

.quality-issue--red {
    background: rgba(255, 141, 141, 0.1);
    color: #ff8d8d;
}

.quality-issue--yellow {
    background: rgba(249, 199, 79, 0.1);
    color: var(--amber);
}

/* Отладочный журнал рядом с кнопками УНФ: ход действий и ошибки, листается вверх */
.action-log {
    align-self: stretch;
    min-height: 58px;
    max-height: 132px;
    overflow-y: auto;
    border: 1px solid rgba(141, 164, 190, 0.3);
    border-radius: 8px;
    padding: 8px 12px;
    background: rgba(2, 6, 12, 0.82);
    font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    font-size: 11.5px;
    line-height: 1.5;
    box-shadow: inset 0 0 18px rgba(96, 239, 255, 0.04);
}

.action-log:empty::before {
    content: "журнал действий появится здесь...";
    color: rgba(154, 169, 187, 0.55);
    font-style: italic;
}

.action-log-line {
    color: var(--text-soft);
    white-space: pre-wrap;
    word-break: break-word;
}

.action-log-line[data-state="pending"] {
    color: var(--amber);
}

.action-log-line[data-state="success"] {
    color: var(--green);
}

.action-log-line[data-state="error"] {
    color: #ff8d8d;
}

.action-status[data-state="pending"] {
    color: var(--amber);
}

.action-status[data-state="success"] {
    color: var(--green);
}

.action-status[data-state="error"] {
    color: #ff8d8d;
}

.meta {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin: 26px 0 0;
}

.meta div {
    min-height: 0;
    border-radius: var(--radius-md);
    padding: 14px 16px;
    background: var(--surface-strong);
}

.quick-links {
    position: relative;
    z-index: 1;
}

.quick-links h2 {
    margin: 0 0 14px;
    color: #eef5ff;
    font-size: 22px;
    line-height: 1.2;
}

.quick-link-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 12px;
}

.quick-link-grid .quick-link-admin {
    border-color: rgba(249, 199, 79, 0.45);
    color: #ffe9b3;
}

.quick-link-grid .quick-link-admin:hover {
    border-color: rgba(249, 199, 79, 0.8);
    color: #ffffff;
}

/* Гостевая кнопка «ХОЧУ ТАКЖЕ» стоит на месте админки и должна звать. */
.quick-link-grid .quick-link-want {
    border-color: rgba(96, 239, 255, 0.5);
    color: #d6fbff;
    font-weight: 800;
    letter-spacing: 0.4px;
}
.quick-link-grid .quick-link-want:hover {
    border-color: rgba(96, 239, 255, 0.9);
    color: #ffffff;
}

.quick-link-grid a {
    min-height: 50px;
    display: grid;
    place-items: center;
    border: 1px solid rgba(96, 239, 255, 0.28);
    border-radius: 8px;
    padding: 10px 12px;
    color: #eaf7ff;
    background: rgba(4, 9, 17, 0.6);
    font-weight: 800;
    text-align: center;
    text-decoration: none;
    box-shadow: inset 0 0 20px rgba(96, 239, 255, 0.04);
}

.quick-link-grid a:hover {
    border-color: rgba(75, 255, 196, 0.56);
    color: #ffffff;
    background: rgba(16, 38, 48, 0.72);
}

.quick-link-grid a:focus-visible {
    outline: 3px solid rgba(249, 199, 79, 0.8);
    outline-offset: 3px;
}

dt {
    color: var(--text-soft);
    font-size: 13px;
    font-weight: 700;
    margin-bottom: 10px;
}

dd {
    margin: 0;
    color: #f8fbff;
    font-size: 24px;
    font-weight: 900;
}

.error p {
    color: #ff8d8d;
}

.error h1 {
    font-size: clamp(32px, 5vw, 54px);
    line-height: 1.05;
}

a {
    color: var(--cyan);
}

@media (max-width: 720px) {
    .shell {
        padding: 16px;
        place-items: start center;
    }

    .panel {
        padding: 24px;
    }

    .quick-panel {
        padding: 22px;
    }

    .heading,
    .controls,
    .unf-action,
    .meta,
    .quick-link-grid {
        grid-template-columns: 1fr;
    }

    .heading {
        display: grid;
    }

    .controls {
        display: grid;
    }

    .period-picker {
        grid-template-columns: minmax(0, 1fr) 122px;
    }

    button {
        width: 100%;
        min-width: 0;
    }
}

@media (max-width: 430px) {
    .period-picker {
        grid-template-columns: 1fr;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
    }

    #cursorTrail {
        display: none;
    }

    .ambient-glow {
        animation: none;
        transform: translate3d(30vw, 0, 0);
    }
}

/* =====================================================================
 * Навигация / доска задач / дашборд
 * ===================================================================== */

/* Контентная панель вкладки: одинаковая высота, чтобы интерфейс не «прыгал» */
.page-panel {
    min-height: calc(100vh - 250px);
}

/* Вариант для вкладки с дополнительной панелью снизу («Полезные кнопки») */
.page-panel--with-extra {
    min-height: calc(100vh - 250px - 148px);
}

/* Верхняя навигация: всегда прилипает к верху экрана */
.topnav {
    position: sticky;
    top: 12px;
    z-index: 40;
    padding: 4px;
}

.topnav-inner {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.navbtn {
    flex: 1 1 140px;
    min-width: 120px;
    min-height: 40px;
    display: grid;
    place-items: center;
    /* Внешний радиус 10px − отступ 4px = 6px внутри */
    border-radius: var(--radius-sm);
    padding: 8px 14px;
    color: var(--text-soft);
    font-size: 14px;
    font-weight: 600;
    text-align: center;
    text-decoration: none;
    transition: color 120ms ease-out, background-color 120ms ease-out;
}

.navbtn:hover {
    color: var(--text);
    background: var(--surface-strong);
}

.navbtn:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: -2px;
}

.navbtn.is-active {
    color: var(--accent-text);
    background: var(--accent);
}

/* «Войти» — не раздел, а действие: уводим вправо и приглушаем. */
.navbtn--login {
    min-width: 88px;
    margin-left: auto;
    color: var(--cyan);
}

/* Тулбар доски/дашборда */
.board-toolbar {
    position: relative;
    z-index: 1;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    margin: 18px 0 8px;
}

.segmented {
    display: inline-flex;
    gap: 4px;
    padding: 4px;
    border-radius: var(--radius-md);
    background: var(--bg);
}

.seg {
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    color: var(--text-soft);
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
    transition: color 120ms ease-out, background-color 120ms ease-out;
}

.seg:hover {
    color: var(--text);
}

.seg.is-active {
    color: var(--accent-text);
    background: var(--accent);
}

.board-period {
    display: flex;
    gap: 10px;
}

.board-period select {
    width: auto;
    min-width: 120px;
    min-height: 46px;
}

.board-hint,
.board-stats {
    color: var(--text-soft);
    font-size: 13px;
    font-weight: 700;
}

.board-stats {
    position: relative;
    z-index: 1;
    margin: 4px 0 14px;
}

.board-stats strong {
    color: #eef5ff;
}

.board-stats-hint {
    margin-left: 8px;
    font-weight: 600;
    opacity: 0.8;
}

/* Доска-водопад: колонки-проекты листаются вправо, задачи — вниз */
.board {
    position: relative;
    z-index: 1;
    display: flex;
    gap: 16px;
    max-width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 6px 2px 16px;
    scroll-snap-type: x proximity;
}

.board-column {
    scroll-snap-align: start;
    flex: 0 0 320px;
    width: 320px;
    max-height: 70vh;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: rgba(7, 14, 24, 0.7);
}

.board-column-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 14px 14px 10px;
    border-bottom: 1px solid var(--line);
}

.board-column-title {
    margin: 0;
    font-size: 15px;
    line-height: 1.25;
}

.board-column-title a {
    color: #eaf7ff;
    text-decoration: none;
}

.board-column-title a:hover {
    color: var(--cyan);
}

.board-count {
    flex: 0 0 auto;
    min-width: 26px;
    padding: 3px 9px;
    border-radius: 999px;
    background: rgba(96, 239, 255, 0.14);
    color: var(--cyan);
    font-size: 12px;
    font-weight: 800;
    text-align: center;
}

.board-cards {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 12px;
    overflow-y: auto;
}

.task-card {
    border: 1px solid var(--line);
    border-left: 3px solid var(--text-soft);
    border-radius: 9px;
    padding: 12px;
    background: var(--surface-strong);
}

.task-card[data-status="2"] {
    border-left-color: var(--amber);
}

.task-card[data-status="3"] {
    border-left-color: var(--cyan);
}

.task-card[data-status="6"] {
    border-left-color: #9aa9bb;
}

.task-card[data-status="4"],
.task-card[data-status="5"] {
    border-left-color: var(--green);
}

.task-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
}

.task-id {
    color: var(--text-soft);
    font-size: 12px;
    font-weight: 700;
}

.task-badge {
    padding: 3px 8px;
    border-radius: 999px;
    background: rgba(154, 169, 187, 0.16);
    color: #cfe0f0;
    font-size: 11px;
    font-weight: 800;
    white-space: nowrap;
}

.task-card[data-status="2"] .task-badge {
    background: rgba(249, 199, 79, 0.16);
    color: var(--amber);
}

.task-card[data-status="3"] .task-badge {
    background: rgba(96, 239, 255, 0.16);
    color: var(--cyan);
}

.task-card[data-status="4"] .task-badge,
.task-card[data-status="5"] .task-badge {
    background: rgba(75, 255, 196, 0.16);
    color: var(--green);
}

.task-title {
    margin: 0 0 10px;
    font-size: 14px;
    line-height: 1.3;
}

.task-title a {
    color: #f3f8ff;
    text-decoration: none;
}

.task-title a:hover {
    color: var(--cyan);
    text-decoration: underline;
}

.task-meta {
    display: grid;
    gap: 6px;
    margin: 0;
}

.task-meta div {
    display: flex;
    justify-content: space-between;
    gap: 10px;
}

.task-meta dt {
    margin: 0;
    color: var(--text-soft);
    font-size: 11px;
    font-weight: 700;
}

.task-meta dd {
    margin: 0;
    color: #dce8f5;
    font-size: 12px;
    font-weight: 700;
    text-align: right;
}

.task-truncated {
    margin: 4px 2px 0;
    color: var(--text-soft);
    font-size: 12px;
    font-style: italic;
}

/* Пустые состояния / ошибки */
.board-empty {
    position: relative;
    z-index: 1;
    margin-top: 18px;
    padding: 28px;
    border: 1px dashed var(--line);
    border-radius: 12px;
    color: var(--text-soft);
    text-align: center;
}

.board-empty p {
    margin: 6px 0;
}

.board-empty-detail {
    font-size: 13px;
}

.board-empty--error {
    border-color: rgba(255, 141, 141, 0.4);
}

.board-empty--error p:first-child {
    color: #ff8d8d;
    font-weight: 800;
}

/* Дашборд */
.dash-summary {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin: 16px 0 20px;
}

.dash-summary div {
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 14px 16px;
    background: var(--surface-strong);
}

.dash-summary dt {
    margin-bottom: 8px;
    color: var(--text-soft);
    font-size: 12px;
    font-weight: 700;
}

.dash-summary dd {
    margin: 0;
    color: #f8fbff;
    font-size: 24px;
    font-weight: 900;
}

.dash-summary .dash-updated {
    font-size: 16px;
}

.period-chips {
    position: relative;
    z-index: 1;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 4px 0 8px;
}

.period-chip {
    padding: 6px 12px;
    border: 1px solid var(--line);
    border-radius: 999px;
    color: #cfe0f0;
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
}

.period-chip:hover {
    border-color: var(--line-strong);
    color: #ffffff;
}

.period-chip.is-active {
    border-color: transparent;
    color: #041019;
    background: var(--accent);
}

.leaderboard {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 64vh;
    margin: 8px 0 0;
    padding: 6px;
    overflow-y: auto;
    list-style: none;
}

.leader-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 12px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface-strong);
}

.leader-rank {
    flex: 0 0 auto;
    width: 26px;
    height: 26px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: rgba(154, 169, 187, 0.14);
    color: #cfe0f0;
    font-size: 12px;
    font-weight: 900;
}

.leader-avatar {
    flex: 0 0 auto;
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border: 1px solid rgba(96, 239, 255, 0.25);
    border-radius: 50%;
    object-fit: cover;
    background: rgba(4, 9, 17, 0.7);
}

.leader-avatar--initials {
    color: var(--cyan);
    font-size: 12px;
    font-weight: 900;
    letter-spacing: 0.5px;
}

/* Организации и проекты — не люди: скруглённый квадрат вместо круга,
   чтобы разрез дашборда читался с одного взгляда. */
.leader-avatar--companies,
.leader-avatar--projects {
    border-radius: 9px;
}

.leader-avatar--projects {
    color: #f9c74f;
    border-color: rgba(249, 199, 79, 0.3);
}

.leader-row--gold {
    border-color: rgba(249, 199, 79, 0.55);
    box-shadow: inset 0 0 26px rgba(249, 199, 79, 0.08);
}

.leader-row--gold .leader-rank {
    background: linear-gradient(135deg, #f9c74f, #ffe39a);
    color: #3a2c00;
}

.leader-row--silver .leader-rank {
    background: linear-gradient(135deg, #cfd8e3, #9fb0c4);
    color: #1a222c;
}

.leader-row--bronze .leader-rank {
    background: linear-gradient(135deg, #d9a066, #b9763f);
    color: #2a1500;
}

.leader-body {
    flex: 1 1 auto;
    min-width: 0;
}

.leader-line {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
}

.leader-name {
    overflow: hidden;
    color: #f3f8ff;
    font-size: 13px;
    font-weight: 800;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.leader-hours {
    flex: 0 0 auto;
    color: var(--green);
    font-size: 13px;
    font-weight: 900;
}

/* Имя занимает свободное место, чтобы изменение и часы прижались вправо. */
.leader-line .leader-name {
    flex: 1 1 auto;
    min-width: 0;
}

/* Изменение с прошлого обновления: сколько часов прибавилось или убавилось. */
.leader-delta {
    flex: 0 0 auto;
    padding: 1px 7px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.leader-delta--up {
    color: var(--success);
    background: oklch(0.72 0.12 158 / 0.14);
}

.leader-delta--down {
    color: var(--danger);
    background: oklch(0.68 0.15 25 / 0.14);
}

.leader-bar {
    height: 5px;
    margin: 5px 0 4px;
    border-radius: 999px;
    background: rgba(154, 169, 187, 0.14);
    overflow: hidden;
}

.leader-bar span {
    display: block;
    height: 100%;
    border-radius: 999px;
    background: var(--accent);
}

.leader-row--gold .leader-bar span {
    background: var(--warning);
}

.leader-sub {
    color: var(--text-soft);
    font-size: 11px;
    font-weight: 700;
}

/* Таблица KPI */
.kpi-formula {
    position: relative;
    z-index: 1;
    margin: 0 0 16px;
    color: var(--text-soft);
    font-size: 13px;
    line-height: 1.5;
}

.table-scroll {
    position: relative;
    z-index: 1;
    max-height: 62vh;
    overflow: auto;
    border-radius: var(--radius-md);
    background: var(--bg);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.data-table th,
.data-table td {
    padding: 10px 14px;
    text-align: left;
    border-bottom: 1px solid var(--line);
}

.data-table thead th {
    position: sticky;
    top: 0;
    z-index: 1;
    color: var(--text-soft);
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    background: var(--surface-strong);
}

.data-table tbody th {
    color: var(--text);
    font-weight: 600;
}

.data-table tbody tr:last-child th,
.data-table tbody tr:last-child td {
    border-bottom: 0;
}

.data-table tbody tr:hover td,
.data-table tbody tr:hover th {
    background: var(--surface);
}

/* Цифры выравниваются по разряду */
.data-table .num {
    text-align: right;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.data-table .muted {
    color: var(--text-soft);
}

.data-table .warn {
    color: var(--warning);
}

.data-table .total {
    color: var(--text);
    font-weight: 700;
}

/* ── Расчёт ЗП ─────────────────────────────────────────────────────────── */

.payroll-tabs {
    margin-bottom: 14px;
}

/* Таблицы расчёта редактируются прямо в ячейках, поэтому поля должны быть
   компактными и не разъезжаться по ширине. */
.cell-input {
    width: 100px;
    padding: 6px 8px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    color: var(--text);
    font: inherit;
    font-variant-numeric: tabular-nums;
    text-align: inherit;
    background: var(--bg);
}

.cell-input:focus-visible {
    border-color: var(--accent);
    outline: 2px solid var(--accent-soft);
    outline-offset: 1px;
}

.cell-input--narrow {
    width: 64px;
}

.cell-input--wide {
    width: 100%;
    min-width: 160px;
    text-align: left;
}

.num .cell-input {
    text-align: right;
}

.terms-table select,
.payroll-table select {
    /* Названия схем и режимов KPI длинные — узкий селект их обрезает.
       Стрелку поджимаем к краю, иначе на «Прибавить полностью» не хватает. */
    min-width: 172px;
    padding: 6px 26px 6px 8px;
    font-size: 13px;
    background-position: calc(100% - 15px) 52%, calc(100% - 9px) 52%, 0 0;
}

/* Страницы расчёта ЗП шире прочих: таблицы там на 11 колонок, и листать
   их вбок неудобно. Расширяем все панели разом, иначе меню и содержимое
   разъедутся по ширине. */
.shell--wide .panel {
    width: min(1560px, 100%);
}

/* Плотнее обычного: колонок много, каждый лишний отступ — это скролл. */
.terms-table th,
.terms-table td,
.payroll-table th,
.payroll-table td {
    padding: 8px 7px;
}

.terms-table .cell-input,
.payroll-table .cell-input {
    width: 78px;
}

.terms-table .cell-input--wide,
.payroll-table .cell-input--wide {
    width: 100%;
    min-width: 120px;
}

.cell-input--tiny {
    width: 46px;
    padding: 6px 5px;
}

/* Часы и правки: две мелкие подписи вместо двух отдельных колонок. */
.cell-pair {
    display: flex;
    gap: 4px;
    justify-content: flex-end;
}

.cell-sub {
    display: block;
    margin-top: 2px;
    color: var(--text-soft);
    font-size: 10px;
    font-weight: 500;
    white-space: nowrap;
}

.th-sub {
    display: block;
    margin-top: 1px;
    color: var(--text-soft);
    font-size: 10px;
    font-weight: 500;
    text-transform: none;
    opacity: 0.75;
}

/* Имя сотрудника не должно растягивать таблицу длинным ФИО. */
.terms-table tbody th,
.payroll-table tbody th {
    max-width: 190px;
}

.kpi-assign-cell {
    text-align: center;
    white-space: nowrap;
}

.kpi-assign-cell input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--accent);
    cursor: pointer;
}

.data-table tfoot th,
.data-table tfoot td {
    padding: 12px 14px;
    border-top: 2px solid var(--line);
    font-weight: 700;
    background: var(--surface-strong);
}

.payroll-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    margin-top: 16px;
}

.payroll-actions .board-hint {
    flex: 1 1 320px;
    margin: 0;
}

.payroll-total {
    color: var(--success);
}

.payroll-add {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-top: 22px;
    padding-top: 18px;
    border-top: 1px solid var(--line);
}

.payroll-add-form {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.payroll-add-form label {
    color: var(--text-soft);
    font-size: 13px;
    font-weight: 600;
}

/* Версия внизу страницы: видно, что именно залито на сервер. */
.app-version {
    margin: 18px 0 4px;
    color: var(--text-soft);
    font-size: 11px;
    letter-spacing: 0.4px;
    text-align: center;
    opacity: 0.6;
}

/* Фильтры статусов на доске задач */
.board-filters {
    position: relative;
    z-index: 1;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 2px 0 12px;
}

.filter-toggle {
    min-height: 38px;
    min-width: 0;
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 6px 16px;
    color: #cfe0f0;
    cursor: pointer;
    font-size: 13px;
    font-weight: 800;
    background: rgba(4, 9, 17, 0.6);
    box-shadow: none;
}

.filter-toggle::before {
    content: none;
}

/* Фильтры — вторичные переключатели: заливка акцентом остаётся
   за навигацией и главной кнопкой */
.filter-toggle[aria-pressed="true"] {
    border-color: var(--line-strong);
    color: var(--text);
    background: var(--surface-strong);
}

.filter-toggle[aria-pressed="false"] {
    color: var(--text-soft);
    opacity: 0.7;
}

.task-card.is-filtered-out {
    display: none;
}

.board-column.is-filtered-out {
    display: none;
}

/* Админ-панель */
.admin-grid {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    margin-top: 18px;
}

.admin-card {
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 20px;
    background: rgba(7, 14, 24, 0.7);
}

.admin-card h2 {
    margin: 0 0 14px;
    color: #eef5ff;
    font-size: 20px;
}

.admin-message {
    position: relative;
    z-index: 1;
    min-height: 0;
    margin: 0 0 6px;
    font-size: 14px;
}

.admin-users {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.admin-user {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    border: 1px solid var(--line);
    border-radius: 9px;
    padding: 10px 14px;
    background: var(--surface-strong);
}

.admin-user--empty {
    color: var(--text-soft);
    font-size: 13px;
    justify-content: center;
}

.admin-user-main {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.admin-user-main strong {
    color: #f3f8ff;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.admin-user-note {
    color: var(--text-soft);
    font-size: 11px;
    font-weight: 700;
}

.role-badge {
    flex: 0 0 auto;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 800;
    white-space: nowrap;
}

.role-badge--admin {
    background: rgba(249, 199, 79, 0.16);
    color: var(--amber);
}

.role-badge--employee {
    background: rgba(96, 239, 255, 0.14);
    color: var(--cyan);
}

.role-badge--external {
    background: rgba(154, 169, 187, 0.16);
    color: #cfe0f0;
}

.admin-inline-form {
    margin: 0;
}

.admin-delete {
    min-width: 0;
    min-height: 36px;
    border: 1px solid rgba(255, 141, 141, 0.4);
    border-radius: 8px;
    padding: 4px 14px;
    color: #ff8d8d;
    font-size: 12px;
    font-weight: 800;
    background: rgba(255, 141, 141, 0.07);
    box-shadow: none;
}

.admin-delete::before {
    content: none;
}

.admin-delete:hover {
    background: rgba(255, 141, 141, 0.16);
    box-shadow: none;
}

.admin-form {
    display: grid;
    gap: 10px;
}

.admin-form label {
    font-size: 14px;
}

.admin-form input,
.admin-form select {
    min-height: 48px;
}

.admin-form button {
    min-width: 0;
    margin-top: 4px;
}

.admin-hint {
    color: var(--text-soft);
    font-size: 12px;
    font-weight: 600;
}

.admin-roles-help {
    margin-top: 18px;
    border-top: 1px solid var(--line);
    padding-top: 14px;
}

.admin-roles-help h3 {
    margin: 0 0 8px;
    color: #eef5ff;
    font-size: 14px;
}

.admin-roles-help p {
    margin: 4px 0;
    color: var(--text-soft);
    font-size: 13px;
    line-height: 1.45;
}

.admin-roles-help strong {
    color: #dce8f5;
}

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

/* Мини-игра: таблица лидеров кликов (правый верхний угол, на фоне) */
.cc-leader {
    position: fixed;
    top: 96px;
    right: 14px;
    z-index: 3;
    width: 230px;
    padding: 12px 14px;
    border: 1px solid rgba(96, 239, 255, 0.22);
    border-radius: 10px;
    background: rgba(7, 14, 24, 0.72);
    box-shadow: inset 0 0 24px rgba(96, 239, 255, 0.05);
    pointer-events: none;
    backdrop-filter: blur(6px);
    animation: ccLeaderIn 360ms ease;
    opacity: 1;
    transition: opacity 900ms ease, transform 900ms ease;
}

/* Плавное исчезновение, если игрок перестал кликать */
.cc-leader.is-faded {
    opacity: 0;
    transform: translateY(-8px);
}

@keyframes ccLeaderIn {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.cc-leader-title {
    margin-bottom: 8px;
    color: var(--cyan);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.4px;
    text-transform: uppercase;
}

.cc-leader-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    padding: 3px 0;
    color: var(--text-soft);
    font-size: 12px;
    font-weight: 700;
}

.cc-leader-row strong {
    color: #eef5ff;
    font-size: 13px;
}

.cc-leader-current {
    color: #ffe9b3;
    border-bottom: 1px solid rgba(141, 164, 190, 0.18);
    margin-bottom: 4px;
    padding-bottom: 6px;
}

.cc-leader-current strong {
    color: var(--green);
    font-size: 16px;
}

@media (max-width: 720px) {
    .navbtn {
        flex-basis: 45%;
        min-width: 0;
    }

    .cc-leader {
        display: none;
    }

    .segmented {
        display: flex;
        width: 100%;
    }

    .seg {
        flex: 1 1 0;
        padding: 10px 8px;
        text-align: center;
        white-space: normal;
    }

    .board-column {
        flex-basis: 84vw;
        width: 84vw;
    }

    .dash-summary {
        grid-template-columns: repeat(2, 1fr);
    }

    .board-period select {
        flex: 1 1 0;
    }
}
