/* ============================================================
   «Контент-план» — дизайн-система (светлый интерфейс, Notion/Linear)
   ============================================================ */

/* Локальный Inter (variable, latin + cyrillic) — без внешних зависимостей. */
@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-display: swap;
    font-weight: 100 900;
    src: url('/lib/inter/inter-latin.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-display: swap;
    font-weight: 100 900;
    src: url('/lib/inter/inter-cyrillic.woff2') format('woff2');
    unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

:root {
    /* Поверхности */
    --bg-app: #f7f8fa;
    --bg-panel: #ffffff;
    --bg-subtle: #f0f2f5;
    --bg-hover: #eef2ff;

    /* Границы */
    --border: #e6e8ec;
    --border-strong: #e0e3e8;

    /* Текст */
    --text: #1f2329;
    --text-secondary: #5c6470;
    --text-muted: #8a919c;
    --text-faint: #b0b6bf;

    /* Акцент */
    --accent: #2563eb;
    --accent-hover: #1d4ed8;
    --accent-soft: #eef2ff;
    --accent-border: #c7d6fb;

    /* Семантика статусов */
    --green: #22c55e;
    --green-text: #166534;
    --green-soft: #f0fdf4;
    --green-border: #bbf7d0;
    --amber: #f59e0b;
    --amber-text: #b45309;
    --amber-soft: #fffbeb;
    --amber-border: #fde68a;
    --red: #ef4444;
    --red-text: #dc2626;
    --red-soft: #fff5f5;
    --red-border: #fcdada;

    /* Прочее */
    --radius: 8px;
    --radius-lg: 12px;
    --radius-sm: 6px;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, .06);
    --shadow-md: 0 8px 24px rgba(16, 24, 40, .12);
    --shadow-lg: 0 16px 48px rgba(16, 24, 40, .3);
    --sidenav-w: 56px;
    --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
}

body {
    font-family: var(--font);
    background: var(--bg-app);
    color: var(--text);
    font-size: 15px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

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

a:hover {
    color: var(--accent-hover);
}

/* --------------------------- App shell --------------------------- */
.app-shell {
    display: grid;
    grid-template-columns: var(--sidenav-w) 1fr;
    height: 100vh;
    overflow: hidden;
}

.sidenav {
    background: var(--bg-panel);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 14px 0;
}

.sidenav__logo {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    overflow: hidden;
    display: block;
    margin-bottom: 10px;
    text-decoration: none;
}

.sidenav__logo img {
    width: 100%;
    height: 100%;
    display: block;
}

.sidenav__item {
    position: relative;
    width: 36px;
    height: 36px;
    border-radius: var(--radius);
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    text-decoration: none;
    transition: background .12s, color .12s;
}

.sidenav__item:hover {
    background: var(--bg-subtle);
    color: var(--text);
}

.sidenav__item.is-active {
    background: var(--accent-soft);
    color: var(--accent);
}

.sidenav__spacer {
    flex: 1;
}

/* --------------------------- Main / topbar --------------------------- */
.main {
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow: hidden;
}

.topbar {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 20px;
    background: var(--bg-panel);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

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

.topbar__spacer {
    margin-left: auto;
}

.content {
    flex: 1;
    overflow: auto;
    padding: 24px;
}

/* --------------------------- Buttons --------------------------- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: var(--font);
    font-weight: 600;
    font-size: 13.5px;
    padding: 8px 15px;
    border-radius: var(--radius);
    border: 1px solid var(--border-strong);
    background: var(--bg-panel);
    color: #374151;
    cursor: pointer;
    transition: background .12s, border-color .12s;
    text-decoration: none;
}

.btn:hover {
    background: var(--bg-subtle);
}

.btn--primary {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

.btn--primary:hover {
    background: var(--accent-hover);
    color: #fff;
}

.btn--danger {
    color: var(--red-text);
    border-color: var(--red-border);
}

.btn--block {
    width: 100%;
    justify-content: center;
}

.btn--lg {
    padding: 10px 18px;
    font-size: 13px;
}

/* --------------------------- Cards --------------------------- */
.card {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.card__header {
    font-weight: 700;
    font-size: 14px;
    padding: 14px 18px 10px;
}

.card__body {
    padding: 0 18px 16px;
}

/* --------------------------- Forms --------------------------- */
.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 14px;
}

.field__label {
    font-weight: 600;
    font-size: 12.5px;
    color: var(--text-secondary);
}

.input {
    font-family: var(--font);
    font-size: 14.5px;
    padding: 10px 12px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    background: #fff;
    color: var(--text);
    width: 100%;
    transition: border-color .12s, box-shadow .12s;
}

.input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}

.checkbox-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-secondary);
}

.field-validation-error,
.validation-summary-errors {
    color: var(--red-text);
    font-size: 12.5px;
}

.validation-summary-errors ul {
    margin: 0;
    padding-left: 18px;
}

.input-validation-error {
    border-color: var(--red-border);
}

/* --------------------------- Login --------------------------- */
.auth-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-app);
    padding: 20px;
}

.auth-card {
    width: 100%;
    max-width: 380px;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    padding: 32px 30px;
}

.auth-card__logo {
    width: 76px;
    height: 76px;
    border-radius: 50%;
    overflow: hidden;
    margin: 0 auto 18px;
}

.auth-card__logo img {
    width: 100%;
    height: 100%;
    display: block;
}

.auth-card__title {
    font-weight: 700;
    font-size: 19px;
    margin: 0 0 4px;
}

.auth-card__subtitle {
    color: var(--text-muted);
    font-size: 13px;
    margin: 0 0 22px;
}

.auth-hint {
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
    font-size: 11.5px;
    color: var(--text-muted);
    line-height: 1.6;
}

/* --------------------------- Utilities --------------------------- */
.muted {
    color: var(--text-muted);
}

.stack {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.page-title {
    font-weight: 800;
    font-size: 20px;
    margin: 0 0 4px;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-weight: 600;
    font-size: 11px;
    padding: 3px 9px;
    border-radius: var(--radius-sm);
    background: var(--bg-subtle);
    color: var(--text-secondary);
}

.badge--green {
    background: var(--green-soft);
    color: var(--green-text);
}

.badge--accent {
    background: var(--accent-soft);
    color: var(--accent);
}

/* ============================================================
   Настройки (этап 1): табы, секции, таблицы, чипы, модалка
   ============================================================ */

.settings {
    max-width: 900px;
}

/* --- Табы --- */
.tabs {
    display: flex;
    gap: 4px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 20px;
    overflow-x: auto;
}

.tab {
    font-family: var(--font);
    font-weight: 600;
    font-size: 14px;
    color: var(--text-secondary);
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    padding: 10px 14px;
    cursor: pointer;
    white-space: nowrap;
    transition: color .12s, border-color .12s;
}

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

.tab.is-active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

.tab-panel {
    display: none;
}

.tab-panel.is-active {
    display: block;
}

/* --- Секция --- */
.section__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 14px;
}

.section__title {
    font-weight: 700;
    font-size: 16px;
    margin: 0;
}

.section__hint {
    color: var(--text-muted);
    font-size: 12.5px;
    margin: 4px 0 0;
    max-width: 560px;
    line-height: 1.5;
}

/* --- Пустое состояние --- */
.empty {
    border: 1px dashed var(--border-strong);
    border-radius: var(--radius);
    padding: 22px;
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
    background: #fcfcfd;
}

.empty--sm {
    padding: 12px;
    text-align: left;
    font-size: 12px;
}

/* --- Таблица справочника --- */
.lk-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.lk-table th {
    text-align: left;
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .03em;
    color: var(--text-muted);
    padding: 9px 12px;
    border-bottom: 1px solid var(--border);
    background: #fbfbfc;
}

.lk-table td {
    padding: 11px 12px;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
    vertical-align: middle;
}

.lk-table tr:last-child td {
    border-bottom: none;
}

.lk-table tr.is-inactive {
    opacity: .55;
}

/* НЕ делать display:flex на <td> — ячейка перестаёт тянуться на высоту строки,
   и её нижняя граница «уезжает» вверх. Выравниваем иконку и текст инлайново. */
.lk-name {
    font-weight: 500;
    white-space: nowrap;
}

.lk-name > span {
    vertical-align: middle;
}

.lk-icon {
    font-size: 16px;
    min-width: 18px;
    margin-right: 8px;
    display: inline-block;
    vertical-align: middle;
}

.swatch {
    width: 16px;
    height: 16px;
    border-radius: 5px;
    display: inline-block;
    border: 1px solid rgba(0, 0, 0, .12);
}

.lk-actions {
    text-align: right;
    white-space: nowrap;
}

.icon-btn {
    border: none;
    background: none;
    cursor: pointer;
    font-size: 14px;
    color: var(--text-muted);
    padding: 5px 7px;
    border-radius: var(--radius-sm);
    transition: background .12s, color .12s;
}

.icon-btn:hover {
    background: var(--bg-subtle);
    color: var(--text);
}

.icon-btn--danger:hover {
    background: var(--red-soft);
    color: var(--red-text);
}

.btn--sm {
    padding: 5px 10px;
    font-size: 11.5px;
}

/* --- Админ-панель --- */
.create-user-form {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.create-user-form .input {
    flex: 1;
    min-width: 220px;
    width: auto;
}

.invite-banner {
    border-color: var(--accent-border);
    background: var(--accent-soft);
}

.invite-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

.invite-row .input {
    flex: 1;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 12px;
}

.content-table td .btn + form,
.content-table td form + form {
    margin-left: 6px;
}

/* --- Статусы --- */
.status-kind {
    margin-bottom: 18px;
}

.status-kind__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.status-kind__name {
    font-weight: 700;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .03em;
    color: var(--text-secondary);
}

.status-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.status-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-panel);
}

.status-row.is-inactive {
    opacity: .55;
}

.status-row__spacer {
    flex: 1;
}

.chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 600;
    font-size: 12.5px;
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    color: var(--chip, #333);
    background: color-mix(in srgb, var(--chip, #333) 12%, white);
    border: 1px solid color-mix(in srgb, var(--chip, #333) 30%, white);
}

.chip__icon {
    font-size: 13px;
}

.sem {
    font-size: 11px;
}

.sem--notstarted { background: #f1f5f9; color: #475569; }
.sem--inprogress { background: var(--amber-soft); color: var(--amber-text); }
.sem--done { background: var(--green-soft); color: var(--green-text); }
.sem--notrequired { background: #f1f5f9; color: #64748b; }
.sem--skipped { background: var(--red-soft); color: var(--red-text); }

/* --- Темп --- */
.cadence-input {
    display: flex;
    align-items: center;
    gap: 8px;
}

.cadence-input .input {
    width: 72px;
}

.saved-tick {
    color: var(--green-text);
    font-size: 11.5px;
    font-weight: 600;
}

/* --- Формы: сетка и цвет --- */
.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 16px;
}

.color-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.input-color {
    width: 44px;
    height: 34px;
    padding: 2px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    background: #fff;
    cursor: pointer;
}

/* --- Пикер цвета --- */
.picker-swatches {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    align-items: center;
}

.swatch-btn {
    width: 26px;
    height: 26px;
    border-radius: 7px;
    border: none;
    cursor: pointer;
    padding: 0;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .1);
    transition: transform .1s;
}

.swatch-btn:hover {
    transform: scale(1.12);
}

.swatch-btn.is-selected {
    outline: 2px solid var(--text);
    outline-offset: 2px;
}

.color-custom {
    display: inline-flex;
    align-items: center;
    margin-left: 4px;
}

.color-custom .input-color,
.color-custom input[type="color"] {
    width: 30px;
    height: 28px;
    padding: 2px;
    border: 1px dashed var(--border-strong);
    border-radius: 7px;
    background: #fff;
    cursor: pointer;
}

/* --- Пикер эмодзи --- */
.emoji-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.emoji-btn {
    width: 34px;
    height: 34px;
    border: 1px solid var(--border-strong);
    border-radius: 8px;
    background: #fff;
    font-size: 17px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .1s, border-color .1s;
}

.emoji-btn:hover {
    background: var(--bg-subtle);
}

.emoji-btn.is-selected {
    border-color: var(--accent);
    background: var(--accent-soft);
    box-shadow: inset 0 0 0 1px var(--accent);
}

.emoji-clear {
    color: var(--text-muted);
    font-size: 14px;
}

.emoji-custom {
    margin-top: 8px;
    width: 180px;
}

select.input {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath fill='%238a919c' d='M0 0l5 6 5-6z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 30px;
}

.switch {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12.5px;
    color: var(--text-secondary);
    margin-bottom: 6px;
    cursor: pointer;
}

.switch input {
    width: 15px;
    height: 15px;
}

/* --- Модалка --- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(31, 35, 41, .5);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 100;
}

.modal-overlay[hidden] {
    display: none;
}

.modal {
    width: 100%;
    max-width: 520px;
    background: var(--bg-panel);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    max-height: 90vh;
    overflow: auto;
}

.modal__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 22px 0;
}

.modal__title {
    font-weight: 700;
    font-size: 16px;
    margin: 0;
}

.modal__body {
    padding: 16px 22px 4px;
}

.modal__foot {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 8px 22px 20px;
}

/* --- Тост --- */
.toast {
    position: fixed;
    bottom: 22px;
    left: 50%;
    transform: translateX(-50%);
    background: #1f2329;
    color: #fff;
    padding: 11px 18px;
    border-radius: var(--radius);
    font-size: 13px;
    box-shadow: var(--shadow-md);
    z-index: 200;
    max-width: 520px;
}

.toast[hidden] {
    display: none;
}

/* ============================================================
   Контент и список (этап 2)
   ============================================================ */

/* --- Переключатель вида --- */
.view-switch {
    display: flex;
    background: var(--bg-subtle);
    border-radius: var(--radius);
    padding: 3px;
    gap: 2px;
    font-weight: 600;
    font-size: 12px;
}

.view-switch__item {
    padding: 5px 14px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: default;
}

.view-switch__item.is-active {
    background: #fff;
    color: var(--text);
    box-shadow: 0 1px 2px rgba(0, 0, 0, .08);
}

.view-switch__item.is-disabled {
    color: var(--text-faint);
}

/* --- Панель фильтров --- */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin-bottom: 16px;
}

.filter-bar .input {
    width: auto;
    font-size: 13px;
    padding: 7px 10px;
}

/* Селекты в фильтрах: короткий padding выше перебивал место под стрелку —
   возвращаем правый отступ, иначе стрелка наезжает на текст. */
.filter-bar select.input {
    padding-right: 30px;
}

.filter-search {
    flex: 1;
    min-width: 200px;
    max-width: 320px;
}

.filter-date {
    width: 150px;
}

/* --- Таблица контента --- */
.content-table-wrap {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-panel);
}

.content-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    white-space: nowrap;
}

.content-table th {
    text-align: left;
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .03em;
    color: var(--text-muted);
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    background: #fbfbfc;
    position: sticky;
    top: 0;
}

.content-table td {
    padding: 9px 12px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.content-table tbody tr:last-child td {
    border-bottom: none;
}

.th-sort {
    cursor: pointer;
    user-select: none;
}

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

.th-sort.is-active {
    color: var(--accent);
}

.content-row {
    cursor: pointer;
    transition: background .1s;
}

.content-row:hover {
    background: var(--bg-hover);
}

.nowrap {
    white-space: nowrap;
}

.ct-title {
    font-weight: 600;
    white-space: normal;
    min-width: 180px;
}

.ct-notes {
    white-space: normal;
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 12px;
}

.lk-cell {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    display: inline-block;
    flex: none;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .1);
}

.st-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-weight: 600;
    font-size: 11.5px;
    padding: 3px 9px;
    border-radius: 20px;
    color: color-mix(in srgb, var(--chip, #64748b) 72%, black);
    background: color-mix(in srgb, var(--chip, #64748b) 18%, white);
    border: 1px solid color-mix(in srgb, var(--chip, #64748b) 34%, white);
}

/* --- Карточка контента --- */
.modal--lg {
    max-width: 900px;
}

.content-title {
    flex: 1;
    font-family: var(--font);
    font-weight: 700;
    font-size: 19px;
    border: none;
    border-bottom: 1px dashed transparent;
    padding: 4px 2px;
    color: var(--text);
    background: none;
}

.content-title:focus {
    outline: none;
    border-bottom-color: var(--border-strong);
}

.prop-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px 20px;
    margin-bottom: 6px;
}

.status-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 6px;
}

.status-field {
    display: flex;
    align-items: center;
    gap: 8px;
}

.status-field .input {
    flex: 1;
    min-width: 0;
}

.status-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex: none;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .12);
}

.date-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.date-row .input {
    flex: 1;
}

.textarea {
    resize: vertical;
    min-height: 56px;
    line-height: 1.5;
    font-family: var(--font);
}

/* ============================================================
   Календарь-месяц (этап 3)
   ============================================================ */

.cal-nav {
    display: flex;
    align-items: center;
    gap: 6px;
}

.cal-nav__title {
    font-weight: 700;
    font-size: 15px;
    min-width: 130px;
    text-align: center;
}

.view-switch__link {
    cursor: pointer;
    text-decoration: none;
}

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

.calendar-page {
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.filter-hint {
    font-size: 12px;
    margin-left: auto;
}

/* --- Сетка --- */
.cal-grid {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.cal-head,
.cal-week {
    display: grid;
    grid-template-columns: repeat(7, 1fr) 132px;
    gap: 6px;
}

.cal-head__cell {
    font-weight: 600;
    font-size: 11px;
    color: var(--text-muted);
    padding: 2px 6px;
    text-transform: uppercase;
    letter-spacing: .03em;
}

.cal-head__tempo {
    text-align: center;
}

.cal-week {
    align-items: stretch;
}

.cal-day {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 5px;
    min-height: 108px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.cal-day--out {
    background: #fbfbfc;
}

.cal-day--out .cal-day__num {
    color: var(--text-faint);
}

.cal-day--today {
    border: 1.5px solid var(--accent);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}

.cal-day__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.cal-day__num {
    font-weight: 600;
    font-size: 11px;
    color: var(--text-secondary);
    padding: 1px 3px;
}

.cal-day--today .cal-day__num {
    color: var(--accent);
    font-weight: 700;
}

.cal-day__add {
    border: none;
    background: none;
    color: var(--text-faint);
    cursor: pointer;
    font-size: 15px;
    line-height: 1;
    padding: 0 4px;
    border-radius: 4px;
    opacity: 0;
    transition: opacity .1s, background .1s;
}

.cal-day:hover .cal-day__add {
    opacity: 1;
}

.cal-day__add:hover {
    background: var(--accent-soft);
    color: var(--accent);
}

.cal-day__list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
    min-height: 20px;
}

/* --- Карточка --- */
.cal-card {
    display: flex;
    align-items: center;
    gap: 5px;
    background: color-mix(in srgb, var(--card, #94a3b8) 8%, white);
    border: 1px solid color-mix(in srgb, var(--card, #94a3b8) 22%, white);
    border-left: 3px solid var(--card, #94a3b8);
    border-radius: var(--radius-sm);
    padding: 4px 6px;
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    transition: box-shadow .1s;
}

.cal-card:hover {
    box-shadow: 0 1px 4px rgba(0, 0, 0, .12);
}

.cal-card__type {
    flex: none;
    font-size: 12px;
}

.cal-card__title {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cal-card__plat {
    flex: none;
    font-size: 11px;
    opacity: .8;
}

.cal-card__stage {
    flex: none;
    font-size: 11px;
}

.cal-card--ghost {
    opacity: .4;
}

.cal-card--drag {
    box-shadow: 0 8px 20px rgba(30, 50, 90, .25);
}

/* --- Плашка темпа --- */
.cal-tempo {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 3px;
    padding: 6px 10px;
    border-radius: var(--radius);
    background: var(--bg-panel);
    border: 1px solid var(--border);
    font-weight: 600;
    font-size: 10.5px;
}

.cal-week--under .cal-tempo {
    background: #fdf6e3;
    border-color: #f3e9c8;
}

.cal-tempo__row.is-under {
    color: var(--amber-text);
}

.cal-tempo__row.is-met {
    color: var(--green-text);
}

.cal-tempo__empty {
    color: var(--text-faint);
    font-weight: 500;
    font-size: 10px;
}

/* ============================================================
   Банк тем (этап 4)
   ============================================================ */

.calendar-body {
    display: flex;
    gap: 16px;
    align-items: flex-start;
}

.calendar-main {
    flex: 1;
    min-width: 0;
}

/* --- Боковая панель на календаре --- */
.bank-panel {
    width: 276px;
    flex: none;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 150px);
    position: sticky;
    top: 0;
}

.bank-panel__head {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 14px 8px;
}

.bank-panel__title {
    font-weight: 700;
    font-size: 13px;
}

.bank-panel__link {
    margin-left: auto;
    font-size: 11px;
    font-weight: 600;
}

.bank-quick {
    padding: 0 14px 10px;
}

.bank-quick .input {
    width: 100%;
    font-size: 12.5px;
    padding: 7px 10px;
}

.bank-panel__list {
    padding: 0 12px 10px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    overflow-y: auto;
    flex: 1;
    min-height: 40px;
}

.bank-panel__hint {
    padding: 10px 14px;
    border-top: 1px solid var(--border);
    font-size: 10.5px;
    color: var(--text-muted);
    line-height: 1.5;
}

/* --- Карточка идеи --- */
.bank-card {
    display: flex;
    align-items: center;
    gap: 6px;
    background: color-mix(in srgb, var(--card, #94a3b8) 8%, white);
    border: 1px solid color-mix(in srgb, var(--card, #94a3b8) 22%, white);
    border-left: 3px solid var(--card, #94a3b8);
    border-radius: var(--radius-sm);
    padding: 6px 8px;
    font-size: 11.5px;
    font-weight: 500;
    cursor: grab;
}

.bank-card:active {
    cursor: grabbing;
}

.bank-card__grip {
    color: var(--text-faint);
    flex: none;
}

.bank-card__type {
    flex: none;
}

.bank-card__title {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.bank-card__chip {
    flex: none;
    font-size: 9.5px;
    padding: 2px 6px;
}

/* --- Отдельная страница --- */
.bank-page {
    max-width: 1100px;
}

.bank-add {
    margin-bottom: 14px;
}

.bank-add__input {
    width: 100%;
    max-width: 520px;
    font-size: 13.5px;
    padding: 10px 14px;
}

.bank-groups {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 14px;
    align-items: start;
}

.bank-group {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
}

.bank-group__head {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 11px 14px;
    border-bottom: 1px solid var(--border);
    font-weight: 700;
    font-size: 12.5px;
}

.bank-group__name {
    flex: 1;
}

.bank-group__list {
    padding: 8px 10px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.bank-row {
    display: flex;
    align-items: center;
    gap: 8px;
    border: 1px solid var(--border);
    border-left: 3px solid var(--card, #94a3b8);
    border-radius: 7px;
    padding: 6px 9px;
    font-size: 12.5px;
}

.bank-row__grip {
    color: var(--text-faint);
    flex: none;
}

.bank-row__main {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 7px;
    cursor: pointer;
    min-width: 0;
}

.bank-row__title {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.bank-row__actions {
    display: flex;
    align-items: center;
    gap: 4px;
    flex: none;
}

.bank-row__date {
    width: 34px;
    padding: 4px;
    font-size: 11px;
    color: var(--text-muted);
    cursor: pointer;
}

.bank-row__date::-webkit-calendar-picker-indicator {
    margin: 0;
}

/* ============================================================
   Съёмочные смены (этап 5)
   ============================================================ */

.cal-session {
    border: 1.5px dashed #a3b3cc;
    border-radius: var(--radius-sm);
    background: #f8fafc;
    padding: 5px 7px;
    font-size: 11px;
    cursor: pointer;
    margin-bottom: 2px;
    transition: box-shadow .1s;
}

.cal-session:hover {
    box-shadow: 0 1px 4px rgba(0, 0, 0, .12);
}

.cal-session.is-done {
    background: var(--green-soft);
    border-color: var(--green-border);
}

.cal-session__head {
    display: flex;
    align-items: center;
    gap: 5px;
    font-weight: 600;
    color: #334155;
}

.cal-session__done {
    margin-left: auto;
    color: var(--green-text);
}

.cal-session__videos {
    color: #64748b;
    font-size: 10px;
    line-height: 1.4;
    margin-top: 2px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* --- Список привязки роликов в модалке --- */
.attach-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
    max-height: 260px;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 6px;
}

.attach-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    border-radius: var(--radius-sm);
    font-size: 12.5px;
    cursor: pointer;
}

.attach-row:hover {
    background: var(--bg-subtle);
}

.attach-row input {
    width: 15px;
    height: 15px;
    flex: none;
}

.attach-row__type {
    flex: none;
}

.attach-row__title {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.attach-row__meta {
    flex: none;
    font-size: 11px;
}

/* ============================================================
   Канбан (этап 6)
   ============================================================ */

.kanban-page {
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.kanban {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    overflow-x: auto;
    padding-bottom: 8px;
}

.kanban-col {
    flex: 1 1 0;
    min-width: 168px;
    display: flex;
    flex-direction: column;
}

.kanban-col__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-top: 3px solid #94a3b8;
    border-radius: var(--radius) var(--radius) 0 0;
    padding: 9px 12px;
    font-weight: 700;
    font-size: 12px;
    position: sticky;
    top: 0;
}

.kanban-col__name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.kanban-col__list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 8px 4px;
    min-height: 120px;
    border-radius: 0 0 var(--radius) var(--radius);
}

.kanban-col__list.is-muted {
    opacity: .58;
}

.kanban-card {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-left: 3px solid var(--card, #94a3b8);
    border-radius: var(--radius);
    padding: 8px 10px;
    cursor: grab;
    box-shadow: var(--shadow-sm);
}

.kanban-card:active {
    cursor: grabbing;
}

.kanban-card__title {
    font-weight: 600;
    font-size: 12px;
    line-height: 1.3;
}

.kanban-card__chips {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 6px;
}

.kanban-chip {
    font-weight: 600;
    font-size: 10px;
    color: var(--text-secondary);
    background: var(--bg-subtle);
    padding: 2px 6px;
    border-radius: 4px;
}

.kanban-chip--bank {
    background: #f8fafc;
    border: 1px dashed var(--border-strong);
    color: var(--text-muted);
}

.kanban-card--ghost {
    opacity: .4;
}

.kanban-card--drag {
    box-shadow: 0 10px 24px rgba(30, 50, 90, .28);
}

/* ============================================================
   Rich text + чек-лист (этап 7)
   ============================================================ */

.cc-grid {
    display: grid;
    grid-template-columns: 1fr 296px;
    gap: 20px;
    margin-top: 8px;
}

.cc-tabs {
    display: flex;
    gap: 2px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 8px;
}

.cc-tab {
    font-family: var(--font);
    font-weight: 600;
    font-size: 13px;
    color: var(--text-muted);
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    padding: 8px 14px;
    cursor: pointer;
}

.cc-tab.is-active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

.cc-panel {
    display: none;
}

.cc-panel.is-active {
    display: block;
}

.cc-quill .ql-toolbar.ql-snow {
    border-color: var(--border-strong);
    border-top-left-radius: var(--radius);
    border-top-right-radius: var(--radius);
}

.cc-quill .ql-container.ql-snow {
    border-color: var(--border-strong);
    border-bottom-left-radius: var(--radius);
    border-bottom-right-radius: var(--radius);
    font-family: var(--font);
    font-size: 13.5px;
}

.cc-quill .ql-editor {
    min-height: 190px;
}

/* --- Чек-лист --- */
.cc-checklist__head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    font-weight: 700;
    font-size: 13px;
    margin-bottom: 8px;
}

.cc-checklist__bar {
    height: 5px;
    background: var(--bg-subtle);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 10px;
}

.cc-checklist__fill {
    height: 100%;
    width: 0;
    background: var(--green);
    transition: width .15s;
}

.cc-checklist__list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.cl-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.cl-row input[type="checkbox"] {
    width: 15px;
    height: 15px;
    flex: none;
}

.cl-text {
    flex: 1;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    padding: 5px 7px;
    font-family: var(--font);
    font-size: 12.5px;
    background: none;
    min-width: 0;
}

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

.cl-text:focus {
    outline: none;
    border-color: var(--accent);
    background: #fff;
}

.cc-checklist__add {
    margin-top: 8px;
    background: none;
    border: none;
    color: var(--accent);
    font-weight: 600;
    font-size: 12.5px;
    cursor: pointer;
    padding: 4px 2px;
}

/* --- Прогресс на карточке календаря --- */
.cal-card__check {
    flex: none;
    font-size: 10px;
    color: var(--text-muted);
    font-weight: 600;
}

.cal-card__check.is-full {
    color: var(--green-text);
}

/* ============================================================
   Неделя + дашборд (этап 8)
   ============================================================ */

/* --- Недельный вид --- */
.week-cols {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 8px;
}

.week-col {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 6px;
    min-height: 300px;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.week-col.is-today {
    border: 1.5px solid var(--accent);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .1);
}

.week-col__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 2px 2px 4px;
    border-bottom: 1px solid var(--border);
}

.week-col__day {
    font-weight: 600;
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-right: 5px;
}

.week-col__date {
    font-weight: 700;
    font-size: 13px;
}

.week-col.is-today .week-col__date,
.week-col.is-today .week-col__day {
    color: var(--accent);
}

.week-col__list {
    display: flex;
    flex-direction: column;
    gap: 5px;
    flex: 1;
    min-height: 40px;
}

.week-col .cal-card {
    font-size: 11.5px;
}

.week-tempo {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    margin-top: 12px;
    padding: 10px 14px;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-weight: 600;
    font-size: 12px;
}

.week-tempo__label {
    color: var(--text-muted);
}

.week-tempo__row.is-under {
    color: var(--amber-text);
}

.week-tempo__row.is-met {
    color: var(--green-text);
}

/* --- Дашборд --- */
.dash-page {
    max-width: 1180px;
}

.dash {
    display: grid;
    grid-template-columns: 1.15fr 1fr 1fr;
    gap: 16px;
    align-items: start;
}

.dash-col {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.dash-header-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.dash-link {
    margin-left: auto;
    color: var(--accent);
    font-weight: 600;
    font-size: 12px;
    cursor: pointer;
}

.dash-empty {
    color: var(--text-muted);
    font-size: 12.5px;
    padding: 4px 0;
}

.dash-item {
    display: flex;
    align-items: center;
    gap: 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px 12px;
    margin-bottom: 8px;
    cursor: pointer;
}

.dash-item:hover {
    background: var(--bg-hover);
}

.dash-item__icon {
    font-size: 15px;
    flex: none;
}

.dash-item__main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.dash-item__title {
    font-weight: 600;
    font-size: 13px;
}

.dash-item__sub {
    color: var(--text-muted);
    font-size: 11px;
}

.dash-warn {
    background: var(--amber-soft);
    color: var(--amber-text);
}

.dash-ok {
    color: var(--green-text);
    font-weight: 700;
}

.dash-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 2px;
    font-size: 12.5px;
    cursor: pointer;
}

.dash-row:hover {
    background: var(--bg-hover);
}

.dash-row__title {
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 500;
}

.dash-session {
    display: flex;
    align-items: center;
    gap: 10px;
    border: 1.5px dashed #a3b3cc;
    border-radius: var(--radius);
    padding: 10px 12px;
    background: #f8fafc;
    cursor: pointer;
}

.dash-session__icon {
    font-size: 18px;
}

.dash-session__main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.dash-session__date {
    font-weight: 700;
    font-size: 13px;
}

.dash-session__count {
    font-weight: 700;
    font-size: 12px;
    color: #334155;
    white-space: nowrap;
}

.card--hot {
    border-color: #f3d3d3;
}

.dash-hot-title {
    color: var(--red-text);
}

.dash-hot-badge {
    background: var(--red-soft);
    color: var(--red-text);
}

.dash-hot {
    border: 1px solid var(--red-border);
    border-radius: var(--radius);
    padding: 10px 12px;
    background: #fffafa;
    margin-bottom: 8px;
    cursor: pointer;
}

.dash-hot__top {
    display: flex;
    justify-content: space-between;
    gap: 8px;
}

.dash-hot__title {
    font-weight: 600;
    font-size: 13px;
}

.dash-hot__date {
    font-weight: 600;
    font-size: 11px;
    color: var(--red-text);
    white-space: nowrap;
}

.dash-hot__missing {
    font-size: 11.5px;
    color: var(--amber-text);
    margin-top: 3px;
}

.dash-tempo {
    margin-bottom: 12px;
}

.dash-tempo__head {
    display: flex;
    justify-content: space-between;
    font-weight: 600;
    font-size: 12.5px;
    margin-bottom: 5px;
}

.dash-under {
    color: var(--amber-text);
}

.dash-tempo__bar {
    height: 7px;
    background: var(--bg-subtle);
    border-radius: 4px;
    overflow: hidden;
}

.dash-tempo__fill {
    height: 100%;
    border-radius: 4px;
}

.dash-tempo__fill.is-met {
    background: var(--green);
}

.dash-tempo__fill.is-under {
    background: var(--amber);
}

.dash-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* --- Приветственный хинт (первый запуск) --- */
.welcome {
    max-width: 640px;
    margin: 8px 0;
}

.welcome ol {
    margin: 8px 0 0;
    padding-left: 20px;
    line-height: 2;
    color: var(--text-secondary);
}

/* ============================================================
   Адаптив (этап 9): планшет и телефон — просмотр и правка
   ============================================================ */
@media (max-width: 1080px) {
    .dash {
        grid-template-columns: 1fr 1fr;
    }
}

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

    .calendar-body {
        flex-direction: column;
    }

    .bank-panel {
        width: 100%;
        max-height: none;
        position: static;
    }

    .cc-grid {
        grid-template-columns: 1fr;
    }

    .modal,
    .modal--lg {
        max-width: 100%;
    }

    /* Календарь/неделя — горизонтальный скролл вместо сжатия */
    .calendar-main {
        overflow-x: auto;
    }

    .cal-grid,
    .week-cols {
        min-width: 720px;
    }
}

@media (max-width: 620px) {
    .content {
        padding: 14px;
    }

    .topbar {
        flex-wrap: wrap;
        gap: 8px;
        padding: 10px 14px;
    }

    .prop-grid {
        grid-template-columns: 1fr;
    }

    .status-grid {
        grid-template-columns: 1fr 1fr;
    }

    .kanban-col {
        min-width: 150px;
    }

    .view-switch {
        display: none;
    }

    .filter-hint {
        display: none;
    }

    .modal-overlay {
        padding: 8px;
    }
}
