/* Оптимист Трекер — светлая / тёмная тема в серых тонах */
:root,
[data-theme="light"] {
    --bg: #f3f3f4;
    --surface: #ffffff;
    --surface-2: #f7f7f8;
    --surface-3: #ececee;
    --border: #e0e0e3;
    --border-strong: #cdcdd2;
    --text: #1f1f23;
    --text-2: #4a4a52;
    --muted: #7a7a83;
    --accent: #3a3a40;
    --accent-text: #ffffff;
    --accent-soft: #e6e6e9;
    --focus: rgba(80, 80, 90, .28);
    --shadow: 0 1px 2px rgba(0,0,0,.05), 0 2px 8px rgba(0,0,0,.04);
    --shadow-lg: 0 10px 40px rgba(0,0,0,.18);
    --danger: #d93d42;
    --success: #2f9e5b;

    --p-critical: #e5484d;
    --p-urgent: #f0761f;
    --p-important: #d9a514;
    --p-normal: #3b82c4;
    --p-low: #9a9aa3;
    --tint: 10%;

    --st-in_progress: #2a2a2f;
    --st-postponed: #7a7a83;
    --st-done: #a3a3aa;
    color-scheme: light;
}

/* Тёмная тема — нейтральные серые и почти чёрные тона, цвет только у приоритетов */
[data-theme="dark"] {
    --bg: #0f0f10;
    --surface: #18181a;
    --surface-2: #1e1e20;
    --surface-3: #27272a;
    --border: #29292c;
    --border-strong: #38383c;
    --text: #e4e4e6;
    --text-2: #b0b0b5;
    --muted: #808086;
    --accent: #d0d0d4;
    --accent-text: #111112;
    --accent-soft: #2a2a2d;
    --focus: rgba(190, 190, 196, .22);
    --shadow: 0 1px 2px rgba(0,0,0,.45);
    --shadow-lg: 0 12px 40px rgba(0,0,0,.7);
    --danger: #e0575b;
    --success: #9a9aa0;

    --p-critical: #e0575b;
    --p-urgent: #e08a4c;
    --p-important: #d2b04e;
    --p-normal: #6f97c2;
    --p-low: #6c6c73;
    --tint: 13%;

    --st-in_progress: #e4e4e6;
    --st-postponed: #8a8a90;
    --st-done: #5c5c62;
    color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
    background: var(--bg);
    color: var(--text);
    font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
h1, h2, h3 { margin: 0 0 .4em; line-height: 1.25; font-weight: 650; }
h1 { font-size: 22px; }
h2 { font-size: 18px; }
h3 { font-size: 15px; }
p { margin: 0 0 .5em; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.center { text-align: center; }
.right { text-align: right; }
.inline { display: inline; margin: 0; }
.clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* ---------- Кнопки и поля ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    height: 34px; padding: 0 14px;
    border: 1px solid var(--border-strong); border-radius: 8px;
    background: var(--surface); color: var(--text);
    font: inherit; font-weight: 550; cursor: pointer; text-decoration: none; white-space: nowrap;
    transition: background .15s, border-color .15s, opacity .15s;
}
.btn:hover { background: var(--surface-3); }
.btn:disabled { opacity: .55; cursor: default; }
.btn-primary { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.btn-primary:hover { background: var(--accent); opacity: .88; }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--surface-3); }
.btn-danger { color: var(--danger); }
.btn-danger:hover { background: color-mix(in srgb, var(--danger) 12%, transparent); }
.btn-sm { height: 28px; padding: 0 10px; font-size: 13px; }
.btn-block { width: 100%; }
.icon-btn {
    display: inline-grid; place-items: center; width: 34px; height: 34px;
    border: 0; border-radius: 8px; background: transparent; color: var(--text-2); cursor: pointer;
}
.icon-btn:hover { background: var(--surface-3); color: var(--text); }
[data-theme="light"] .i-sun, [data-theme="dark"] .i-moon { display: none; }

input, select, textarea {
    font: inherit; color: var(--text);
    background: var(--surface); border: 1px solid var(--border-strong); border-radius: 8px;
    padding: 7px 10px; min-height: 34px; width: 100%;
}
textarea { resize: vertical; min-height: 70px; line-height: 1.45; }
select { padding-right: 28px; cursor: pointer; }
input:disabled { background: var(--surface-2); color: var(--muted); }
input:focus, select:focus, textarea:focus, .btn:focus-visible, .icon-btn:focus-visible, .task-head:focus-visible {
    outline: none; border-color: var(--muted); box-shadow: 0 0 0 3px var(--focus);
}
.field { display: block; margin-bottom: 14px; }
.field > span:first-child { display: block; margin-bottom: 5px; font-size: 12px; font-weight: 600; color: var(--text-2); }
.check { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; cursor: pointer; }
.check input { width: auto; min-height: 0; }
.input-row { display: flex; gap: 8px; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow); }

.alert { padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; border: 1px solid; }
.alert-error { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, transparent); background: color-mix(in srgb, var(--danger) 8%, var(--surface)); }
.alert-success { color: var(--success); border-color: color-mix(in srgb, var(--success) 35%, transparent); background: color-mix(in srgb, var(--success) 8%, var(--surface)); }

/* ---------- Каркас ---------- */
.topbar {
    position: sticky; top: 0; z-index: 20;
    display: flex; align-items: center; gap: 10px;
    height: 56px; padding: 0 16px;
    background: var(--surface); border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 15px; text-decoration: none; white-space: nowrap; }
.brand-mark {
    display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 8px;
    background: var(--accent); color: var(--accent-text); font-weight: 800;
}
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.user-chip { display: flex; align-items: center; gap: 8px; padding: 3px 10px 3px 3px; border-radius: 20px; text-decoration: none; }
.user-chip:hover { background: var(--surface-3); }
.avatar {
    display: inline-grid; place-items: center; width: 28px; height: 28px; flex: none;
    border-radius: 50%; background: var(--surface-3); color: var(--text-2);
    font-size: 11px; font-weight: 700; border: 1px solid var(--border);
}
.avatar.sm { width: 24px; height: 24px; font-size: 10px; vertical-align: middle; }
.nav-toggle { display: none; }

.shell { display: grid; grid-template-columns: 240px minmax(0, 1fr); min-height: calc(100vh - 56px); }
.sidebar { border-right: 1px solid var(--border); background: var(--surface-2); padding: 14px 10px; }
.sidebar nav { position: sticky; top: 70px; }
.nav-item, .nav-subitem {
    display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px;
    text-decoration: none; color: var(--text-2); font-weight: 550;
}
.nav-item:hover, .nav-subitem:hover { background: var(--surface-3); color: var(--text); }
.nav-item.active, .nav-subitem.active { background: var(--accent-soft); color: var(--text); }
.nav-sub { margin: 2px 0 6px 18px; padding-left: 10px; border-left: 1px solid var(--border); }
.nav-subitem { padding: 6px 10px; font-weight: 450; font-size: 13px; }
.nav-subname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.count { font-size: 11px; color: var(--muted); background: var(--surface-3); border-radius: 10px; padding: 0 7px; }
.nav-sep { height: 1px; background: var(--border); margin: 10px 4px; }

.content { padding: 24px 28px 60px; max-width: 1280px; width: 100%; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-title { min-width: 0; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.empty { padding: 40px 20px; text-align: center; color: var(--text-2); }

/* ---------- Вход ---------- */
body.bare { display: grid; min-height: 100vh; place-items: center; }
.bare-theme { position: fixed; top: 14px; right: 14px; }
.auth-wrap { width: 100%; max-width: 380px; padding: 16px; }
.auth-card { padding: 28px; }
.auth-brand { display: flex; align-items: center; gap: 10px; font-weight: 700; margin-bottom: 22px; }
.auth-card > p.small { margin: 14px 0 0; }
.auth-alt p.small { margin: 8px 0 0; }
.auth-or { display: flex; align-items: center; gap: 10px; margin: 18px 0 14px; color: var(--text-3, var(--text-2)); font-size: 12px; }
.auth-or::before, .auth-or::after { content: ""; flex: 1; border-top: 1px solid var(--border); }
.btn-b24 { gap: 10px; }
.b24-mark { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: #2fc6f6; color: #fff; font-size: 10px; font-weight: 800; letter-spacing: -.5px; }

/* ---------- Список планерок ---------- */
.board-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.board-card { display: block; padding: 18px; text-decoration: none; transition: border-color .15s, transform .15s; }
.board-card:hover { border-color: var(--border-strong); transform: translateY(-1px); }
.board-card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.board-card-stats { display: flex; gap: 12px; flex-wrap: wrap; margin: 10px 0 6px; font-size: 13px; color: var(--text-2); }
.board-card-stats .hot { color: var(--p-critical); font-weight: 600; }
.role-badge { font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 10px; background: var(--surface-3); color: var(--text-2); white-space: nowrap; }
.role-owner { background: var(--accent); color: var(--accent-text); }
.role-manager { background: var(--surface-3); color: var(--text); border: 1px solid var(--border-strong); }

/* ---------- Таблица (админка) ---------- */
.table-card { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 10px 14px; border-bottom: 1px solid var(--border); text-align: left; white-space: nowrap; }
.table th { font-size: 12px; color: var(--muted); font-weight: 600; background: var(--surface-2); }
.table tr:last-child td { border-bottom: 0; }
.table tr.inactive td { opacity: .55; }
.table td.right { text-align: right; }
.form-card { padding: 22px; max-width: 480px; }
.form-card h3 { margin-top: 10px; }

/* ---------- Панель фильтров ---------- */
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 10px; margin-bottom: 14px; }
.toolbar select, .toolbar input { width: auto; min-width: 140px; }
.toolbar .tb-search { flex: 1 1 200px; }
.legend { display: flex; gap: 12px; flex-wrap: wrap; margin-left: auto; padding: 0 6px; font-size: 12px; color: var(--muted); }
.legend-item { display: inline-flex; align-items: center; gap: 5px; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--pc); }

/* Цвета приоритетов */
.p-critical  { --pc: var(--p-critical); }
.p-urgent    { --pc: var(--p-urgent); }
.p-important { --pc: var(--p-important); }
.p-normal    { --pc: var(--p-normal); }
.p-low       { --pc: var(--p-low); }

/* ---------- Список задач (гармошка) ---------- */
.task-list-head, .task-head {
    display: grid;
    grid-template-columns: 6px minmax(0, 1fr) 110px 160px 104px 96px 84px 26px;
    gap: 14px; align-items: center;
}
.task-list-head.personal, .task-list.personal .task-head { grid-template-columns: 6px minmax(0, 1fr) 110px 104px 96px 84px 26px; }
.task-list-head { padding: 0 14px 6px 0; font-size: 12px; font-weight: 600; color: var(--muted); }

.task-list { display: flex; flex-direction: column; gap: 6px; }
.task {
    background: var(--surface); border: 1px solid var(--border); border-radius: 10px; overflow: hidden;
    box-shadow: var(--shadow); transition: border-color .15s;
}
.task:hover { border-color: var(--border-strong); }
.task.status-done { opacity: .62; }
.task.status-done .task-title { text-decoration: line-through; }
.task.open { border-color: var(--border-strong); opacity: 1; }

.task-head { padding: 0 14px 0 0; min-height: 56px; cursor: pointer; user-select: none; }
.task-stripe { align-self: stretch; background: var(--pc); }
.task-main { min-width: 0; padding: 9px 0; }
.task-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task-short { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task-meta-comments { display: inline-flex; align-items: center; gap: 3px; margin-left: 8px; color: var(--muted); font-size: 12px; font-weight: 500; }
.task-assignee { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 13px; }
.task-assignee span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task-date { font-size: 12px; color: var(--muted); }
.chevron { color: var(--muted); transition: transform .2s; display: grid; place-items: center; }
.task.open .chevron { transform: rotate(180deg); }

.pbadge {
    display: inline-flex; align-items: center; gap: 6px; justify-self: start;
    padding: 2px 9px; border-radius: 10px; font-size: 12px; font-weight: 650;
    color: var(--pc); background: color-mix(in srgb, var(--pc) var(--tint), transparent);
    border: 1px solid color-mix(in srgb, var(--pc) 30%, transparent);
}
.sbadge {
    display: inline-flex; align-items: center; gap: 6px; justify-self: start;
    font-size: 12px; font-weight: 600; color: var(--sc);
}
.sbadge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--sc); }
.status-in_progress { --sc: var(--st-in_progress); }
.status-postponed { --sc: var(--st-postponed); }
.status-done { --sc: var(--st-done); }

/* раскрытие */
.task-body-wrap { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .22s ease; }
.task.open .task-body-wrap { grid-template-rows: 1fr; }
.task-body-inner { overflow: hidden; }
.task-body { border-top: 1px solid var(--border); padding: 16px 20px 18px 26px; display: flex; flex-direction: column; gap: 18px; }
.task-info { max-width: 900px; }
.task-desc { white-space: pre-wrap; word-wrap: break-word; color: var(--text-2); margin-bottom: 14px; }
.task-desc.empty-desc { color: var(--muted); font-style: italic; }
.task-facts { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; font-size: 13px; margin-bottom: 14px; }
.task-facts dt { color: var(--muted); }
.task-facts dd { margin: 0; }
.task-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.quick-status { display: inline-flex; border: 1px solid var(--border-strong); border-radius: 8px; overflow: hidden; }
.quick-status button { border: 0; border-right: 1px solid var(--border-strong); background: var(--surface); color: var(--text-2); font: inherit; font-size: 12px; padding: 0 10px; height: 28px; cursor: pointer; }
.quick-status button:last-child { border-right: 0; }
.quick-status button:hover { background: var(--surface-3); }
.quick-status button.on { background: var(--accent-soft); color: var(--text); font-weight: 650; }

.task-form { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0 12px; }
.task-form .full { grid-column: 1 / -1; }
.task-form-actions { grid-column: 1 / -1; display: flex; gap: 8px; justify-content: flex-end; }
.task-new { margin-bottom: 14px; padding: 18px; }
.task-new h3 { margin-bottom: 12px; }

/* комментарии */
.comments h4 { margin: 0 0 10px; font-size: 13px; color: var(--text-2); }
.comments { border-top: 1px dashed var(--border-strong); padding-top: 14px; max-width: 900px; }
.comment-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px; max-height: 520px; overflow-y: auto; }
.comment { display: grid; grid-template-columns: 28px 1fr; gap: 10px; }
.comment-bubble { background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 8px 12px; min-width: 0; }
.comment-head { display: flex; align-items: baseline; gap: 8px; font-size: 12px; margin-bottom: 2px; }
.comment-head b { font-weight: 650; }
.comment-head .muted { flex: 1; }
.comment-del { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 12px; padding: 0; }
.comment-del:hover { color: var(--danger); }
.comment-text { white-space: pre-wrap; word-wrap: break-word; }
.comment-form { position: relative; }
.comment-form textarea { min-height: 64px; margin-bottom: 8px; }
.comment-form-row { display: flex; align-items: center; gap: 8px; }
.comment-form-row .hint-keys { margin-left: auto; }
.attach-btn { cursor: pointer; padding-left: 8px; color: var(--text-2); }
.drop-hint {
    display: none; position: absolute; inset: 0; z-index: 2; place-items: center;
    border: 2px dashed var(--muted); border-radius: 10px; background: color-mix(in srgb, var(--surface) 88%, transparent);
    font-weight: 600; color: var(--text); pointer-events: none;
}
.comment-form.dragging .drop-hint { display: grid; }

/* выбранные файлы */
.pending-files { display: flex; flex-wrap: wrap; gap: 6px; }
.pending-files:not(:empty) { margin-bottom: 10px; }
.pending-file {
    display: inline-flex; align-items: center; gap: 8px; max-width: 320px;
    padding: 4px 6px 4px 4px; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--surface-2); font-size: 12px;
}
.pending-file img { width: 32px; height: 32px; object-fit: cover; border-radius: 5px; flex: none; }
.pf-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.pf-remove { border: 0; background: none; color: var(--muted); cursor: pointer; padding: 0 4px; font-size: 13px; }
.pf-remove:hover { color: var(--danger); }

/* значок типа файла */
.file-ext {
    display: inline-grid; place-items: center; flex: none; width: 34px; height: 32px; border-radius: 6px;
    background: var(--surface-3); color: var(--text-2); border: 1px solid var(--border-strong);
    font-size: 9px; font-weight: 800; letter-spacing: .02em;
}
.ext-pdf { color: var(--p-critical); }
.ext-doc, .ext-docx, .ext-odt, .ext-rtf { color: var(--p-normal); }
.ext-xls, .ext-xlsx, .ext-ods, .ext-csv { color: #5fa877; }
.ext-ppt, .ext-pptx, .ext-odp { color: var(--p-urgent); }

/* вложения в комментарии */
.att-images { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.att-image { margin: 0; width: 168px; }
.att-thumb {
    display: block; width: 168px; height: 118px; padding: 0; border: 1px solid var(--border-strong); border-radius: 8px;
    overflow: hidden; background: var(--surface-3); cursor: zoom-in;
}
.att-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .2s; }
.att-thumb:hover img { transform: scale(1.04); }
.att-image figcaption { display: flex; align-items: center; gap: 4px; margin-top: 3px; font-size: 11px; color: var(--muted); }
.att-image figcaption span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att-dl { display: inline-grid; place-items: center; color: var(--muted); padding: 2px; border-radius: 4px; }
.att-dl:hover, .att-file:hover .att-dl { color: var(--text); }
.att-files { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.att-file {
    display: flex; align-items: center; gap: 10px; max-width: 460px; padding: 6px 10px 6px 6px;
    border: 1px solid var(--border-strong); border-radius: 8px; background: var(--surface); text-decoration: none;
}
.att-file:hover { background: var(--surface-3); }
.att-file-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }

/* просмотр картинки */
.lightbox { border: 0; padding: 0; background: transparent; max-width: 94vw; max-height: 94vh; overflow: visible; }
.lightbox::backdrop { background: rgba(0,0,0,.85); }
.lightbox img { display: block; max-width: 94vw; max-height: calc(94vh - 52px); border-radius: 8px; margin: 0 auto; cursor: zoom-out; }
.lightbox-bar { display: flex; align-items: center; gap: 8px; justify-content: center; margin-top: 10px; color: #ddd; font-size: 13px; }
.lightbox-bar span { max-width: 50vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lightbox-bar .btn-ghost { color: #ddd; }

/* ---------- Диалоги ---------- */
.dialog {
    border: 1px solid var(--border); border-radius: 14px; padding: 0; width: min(520px, calc(100vw - 32px));
    background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg);
}
.dialog::backdrop { background: rgba(0,0,0,.45); }
.dialog-body { padding: 22px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }
.member-list { list-style: none; margin: 0 0 16px; padding: 0; border: 1px solid var(--border); border-radius: 10px; max-height: 320px; overflow-y: auto; }
.member-list li { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-bottom: 1px solid var(--border); }
.member-list li:last-child { border-bottom: 0; }
.member-info { flex: 1; min-width: 0; }
.member-info div { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.member-list select { width: auto; min-height: 28px; padding: 2px 26px 2px 8px; font-size: 12px; }
.avatars { display: inline-flex; }
.avatars .avatar { width: 22px; height: 22px; font-size: 9px; margin-left: -6px; border: 2px solid var(--surface); }
.avatars .avatar:first-child { margin-left: 0; }
.danger-zone { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--border); }

/* ---------- Уведомления ---------- */
.toasts { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 100; }
.toast {
    padding: 10px 14px; border-radius: 10px; background: var(--accent); color: var(--accent-text);
    box-shadow: var(--shadow-lg); font-size: 13px; max-width: 340px; animation: toast-in .2s ease;
}
.toast.error { background: var(--danger); color: #fff; }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } }

/* ---------- Адаптив ---------- */
@media (max-width: 1000px) {
    .legend { display: none; }
}
@media (max-width: 860px) {
    .nav-toggle { display: inline-grid; }
    .shell { grid-template-columns: 1fr; }
    .sidebar { display: none; border-right: 0; border-bottom: 1px solid var(--border); }
    .sidebar.open { display: block; }
    .sidebar nav { position: static; }
    .content { padding: 18px 16px 50px; }
    .user-name { display: none; }
    .task-list-head { display: none; }
    .task-head, .task-list.personal .task-head {
        grid-template-columns: 6px minmax(0, 1fr) auto 20px;
        grid-template-areas: "s m m c" "s p st c" "s a a c" "s du d c";
        gap: 4px 10px; padding-bottom: 10px;
    }
    .task-stripe { grid-area: s; }
    .task-main { grid-area: m; padding-bottom: 2px; }
    .task-head .pbadge { grid-area: p; }
    .task-head .sbadge { grid-area: st; justify-self: end; }
    .task-assignee { grid-area: a; }
    .task-date { grid-area: d; justify-self: end; }
    .task-head .task-due { grid-area: du; }
    .task-head .task-due.due-none { display: none; }
    .chevron { grid-area: c; }
    .task-body { padding: 14px 16px 16px 20px; }
    .task-form { grid-template-columns: 1fr; }
    .toolbar select, .toolbar input { flex: 1 1 140px; }
}

/* Окно подтверждения */
.dialog-sm { width: min(400px, calc(100vw - 32px)); }
.confirm-text { font-size: 15px; margin: 0 0 18px; line-height: 1.5; }

@media (max-width: 600px) {
    .hint-keys { display: none; }
    .comment-form-row button[type="submit"] { margin-left: auto; }
    .att-image, .att-thumb { width: calc(50vw - 60px); }
}

/* Быстрая смена приоритета */
.pbadge-btn { font: inherit; font-size: 12px; font-weight: 650; cursor: pointer; gap: 4px; padding-right: 6px; }
.pbadge-btn svg { opacity: .55; transition: opacity .15s; }
.pbadge-btn:hover { background: color-mix(in srgb, var(--pc) calc(var(--tint) * 2), transparent); }
.pbadge-btn:hover svg { opacity: 1; }
.pbadge-btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--focus); }

.quick-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.quick-label { width: 100px; font-size: 12px; color: var(--muted); }
.quick-prio button { display: inline-flex; align-items: center; gap: 6px; }
.quick-prio button.on { background: color-mix(in srgb, var(--pc) var(--tint), var(--surface)); color: var(--pc); }
.task-actions { margin-top: 12px; }

.prio-menu {
    position: absolute; z-index: 60; min-width: 160px; padding: 4px;
    background: var(--surface); border: 1px solid var(--border-strong); border-radius: 10px; box-shadow: var(--shadow-lg);
}
.prio-menu button {
    display: flex; align-items: center; gap: 8px; width: 100%; padding: 7px 10px; border: 0; border-radius: 6px;
    background: none; color: var(--text); font: inherit; font-size: 13px; text-align: left; cursor: pointer;
}
.prio-menu button:hover, .prio-menu button:focus-visible { background: var(--surface-3); outline: none; }
.prio-menu button.on { font-weight: 650; }
.prio-menu .check { margin-left: auto; color: var(--muted); }
@media (max-width: 600px) { .quick-label { width: 100%; } }

/* Статистика планерки */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin-bottom: 14px; }
.stat {
    display: flex; flex-direction: column; gap: 2px; min-width: 0; padding: 12px 14px;
    background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow);
    font: inherit; color: var(--text); text-align: left;
}
button.stat { cursor: pointer; transition: border-color .15s, background .15s; }
button.stat:hover { border-color: var(--border-strong); background: var(--surface-2); }
button.stat:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--focus); }
.stat-label { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-value { font-size: 24px; font-weight: 700; line-height: 1.2; letter-spacing: -.01em; }
.stat-value small { font-size: 13px; font-weight: 600; color: var(--muted); margin-left: 6px; }
.stat-sub { font-size: 12px; line-height: 1.4; color: var(--muted); }
.stat-last .stat-sub span { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.stat-sub .dot { width: 7px; height: 7px; margin-right: 4px; vertical-align: 1px; }
.stat-bar { display: block; height: 4px; margin: 4px 0 2px; border-radius: 2px; background: var(--surface-3); overflow: hidden; }
.stat-bar i { display: block; height: 100%; background: var(--text-2); border-radius: 2px; transition: width .3s; }
.stat-hot .stat-value { color: var(--p-critical); }
.stat-last .stat-value { font-size: 18px; padding: 3px 0 2px; }

@media (max-width: 600px) {
    .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
    .stat { padding: 10px 12px; }
    .stat-value { font-size: 20px; }
}
.stat-sub .nw { white-space: nowrap; }

/* Крайний срок */
.task-due { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--text-2); white-space: nowrap; }
.task-due svg { flex: none; opacity: .7; }
.task-due.due-none { color: var(--muted); }
.task-due.due-done { color: var(--muted); }
.task-due.due-soon { color: var(--p-important); font-weight: 600; }
.task-due.due-today { color: var(--p-urgent); font-weight: 650; }
.task-due.due-over { color: var(--p-critical); font-weight: 650; }
.due-input { width: auto; min-height: 28px; padding: 3px 8px; font-size: 13px; }
.quick-row .task-due { font-size: 12px; }

/* Записи истории в комментариях */
.comment-system { display: flex; align-items: flex-start; gap: 10px; padding: 2px 0 2px 4px; font-size: 12px; color: var(--text-2); }
.comment-system .sys-icon {
    display: inline-grid; place-items: center; flex: none; width: 22px; height: 22px; margin-left: 2px;
    border-radius: 50%; background: var(--surface-3); color: var(--muted);
}
.comment-system .sys-text { padding-top: 3px; }
