/* Альфред v2, диспетчер внимания. Ручной CSS на семантических токенах (без Tailwind-рантайма).
   Дизайн-язык из спеки §15: спокойный графит, жёлтый только акцент/навигация/одно действие,
   семантические цвета состояний, минимум рамок, разделение фоном и воздухом. */

/* ── Локальный Manrope (без внешнего CDN) ── */
@font-face {
  font-family: 'Manrope'; font-style: normal; font-weight: 400; font-display: swap;
  src: url('../fonts/manrope-400-cyr.woff2') format('woff2');
  unicode-range: U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116;
}
@font-face {
  font-family: 'Manrope'; font-style: normal; font-weight: 400; font-display: swap;
  src: url('../fonts/manrope-400-lat.woff2') format('woff2');
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+2000-206F,U+2122,U+2191,U+2193,U+2212;
}
@font-face {
  font-family: 'Manrope'; font-style: normal; font-weight: 700; font-display: swap;
  src: url('../fonts/manrope-700-cyr.woff2') format('woff2');
  unicode-range: U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116;
}
@font-face {
  font-family: 'Manrope'; font-style: normal; font-weight: 700; font-display: swap;
  src: url('../fonts/manrope-700-lat.woff2') format('woff2');
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+2000-206F,U+2122,U+2191,U+2193,U+2212;
}

/* ── Токены ── */
:root {
  /* поверхности (графит, слегка тёплый) */
  --ink: #0b0b0d;           /* фон приложения */
  --surface: #161618;       /* карточки, панели */
  --surface-2: #1d1d20;     /* вложенные поверхности, инпуты */
  --surface-3: #26262b;     /* ховер/выбранное */
  --edge: #2a2a2e;          /* тонкие границы */
  --edge-2: #3a3a42;

  /* текст */
  --text: #e9e9ec;          /* основной, тёплый белый */
  --text-2: #a6a6ad;        /* вторичный */
  --text-3: #7c7c85;        /* приглушённый */

  /* акцент (жёлтый) — только навигация и ОДНО главное действие */
  --accent: #ffef00;
  --accent-ink: #0b0b0d;    /* текст на жёлтом */
  --accent-dim: #caa800;

  /* семантика состояний (отдельно от акцента) */
  --ok: #34c759;            /* успех/готово */
  --danger: #ff453a;        /* проблема/опасность */
  --warn: #ff9f0a;          /* внимание/скоро */
  --work: #4d9fff;          /* в процессе */

  /* геометрия */
  --gap: 8px;
  --radius: 12px;
  --radius-sm: 8px;
  --tap: 44px;              /* мин. интерактив десктоп */
  --tap-mobile: 48px;

  --sidebar-w: 244px;
  --drawer-w: 540px;

  --font: 'Manrope', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --shadow-drawer: -8px 0 32px rgba(0,0,0,.45);
  --shadow-pop: 0 8px 32px rgba(0,0,0,.5);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }
body {
  font-family: var(--font);
  background: var(--ink);
  color: var(--text);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}
.tnum { font-variant-numeric: tabular-nums; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

/* ── Оболочка: сайдбар + контент ── */
#app { display: flex; min-height: 100dvh; }

/* Вход: одна карточка без навигации приложения, с теми же цветами и кнопками. */
.login-screen { display: flex; width: 100%; min-width: 0; padding: 40px 20px; }
.login-card { width: 100%; max-width: 480px; margin: auto; padding: 32px; background: var(--surface);
  border: 1px solid var(--edge); border-radius: 20px; box-shadow: var(--shadow-pop); }
.login-brand { margin-bottom: 28px; color: var(--accent); font-size: 13px; font-weight: 700; letter-spacing: .22em; }
.login-card h1 { font-size: 28px; line-height: 1.2; letter-spacing: -.03em; }
.login-intro { margin-top: 12px; color: var(--text-2); }
.login-steps { display: grid; gap: 16px; margin: 28px 0; padding-left: 22px; color: var(--text-2); }
.login-steps li { padding-left: 6px; overflow-wrap: anywhere; }
.login-steps li::marker { color: var(--accent); font-weight: 700; }
.login-steps strong, .login-steps a { color: var(--text); }
.login-label { display: block; margin-bottom: 10px; font-size: 13px; font-weight: 700; }
.login-entry { display: flex; align-items: stretch; gap: 10px; }
.login-entry .dw-inp { flex: 1; min-width: 0; width: 100%; }
.login-entry .btn { flex-shrink: 0; }
.login-entry .login-code { text-align: center; font-size: 20px; letter-spacing: .24em; padding: 12px; }
.login-error { margin-top: 10px; font-size: 13px; color: var(--danger); overflow-wrap: anywhere; }
.login-error:empty { display: none; }
.login-telegram { display: block; margin-top: 24px; color: var(--text-2); font-size: 12px; line-height: 1.6;
  text-underline-offset: 3px; overflow-wrap: anywhere; }
.login-telegram:hover, .login-steps a:hover { color: var(--accent); }
.login-dev { margin-top: 28px; padding-top: 24px; border-top: 1px solid var(--edge); }
@media (max-width: 480px) {
  .login-screen { padding: 24px 16px; }
  .login-card { padding: 24px 20px; }
  .login-entry { flex-direction: column; }
  .login-entry .btn, .login-entry .dw-inp { min-height: var(--tap-mobile); }
}

.sidebar {
  width: var(--sidebar-w); flex: 0 0 var(--sidebar-w);
  border-right: 1px solid var(--edge); background: var(--ink);
  display: flex; flex-direction: column; padding: 18px 12px;
  position: sticky; top: 0; height: 100dvh;
}
.brand { font-weight: 800; letter-spacing: .22em; color: var(--accent); font-size: 15px; padding: 6px 12px 22px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 12px; min-height: var(--tap);
  padding: 0 12px; border-radius: var(--radius-sm); color: var(--text-2);
  font-weight: 600; font-size: 14px; cursor: pointer; user-select: none;
  background: none; border: none; width: 100%; text-align: left;
}
.nav-item:hover { background: var(--surface); color: var(--text); }
.nav-item.active { color: var(--accent); }
.nav-item .ic { width: 20px; height: 20px; flex: 0 0 20px; opacity: .9; }
.nav-item .count { margin-left: auto; font-size: 12px; color: var(--text-3); }
.nav-spacer { flex: 1; }
.nav-sep { height: 1px; background: var(--edge); margin: 10px 6px; }

.content { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.screen { flex: 1; min-width: 0; padding: 28px 32px; max-width: 1100px; }

/* заголовок экрана */
.screen-h { margin-bottom: 8px; }
.screen-h h1 { font-size: 30px; font-weight: 800; letter-spacing: -.01em; }
.screen-h .sub { color: var(--text-2); font-size: 14px; margin-top: 2px; }

/* ── Кнопки (роли) ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--tap); padding: 0 18px; border-radius: var(--radius-sm);
  font-family: var(--font); font-weight: 700; font-size: 14px; cursor: pointer;
  border: 1px solid transparent; background: none; color: var(--text); white-space: nowrap;
}
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent-dim); }
.btn-secondary { border-color: var(--edge-2); color: var(--text); }
.btn-secondary:hover { background: var(--surface); }
.btn-ghost { color: var(--text-2); }
.btn-ghost:hover { color: var(--text); background: var(--surface); }
.btn-danger { color: var(--danger); }
.btn-danger:hover { background: rgba(255,69,58,.12); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ── Бейдж-статус (некликабельный, тихий) ── */
.badge {
  display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px;
  border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--surface-2); color: var(--text-2);
}
.badge .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge.st-backlog { color: var(--text-3); }
.badge.st-in_progress { color: var(--work); }
.badge.st-review { color: var(--warn); }
.badge.st-done { color: var(--ok); }
.badge.st-cancelled { color: var(--text-3); }

/* ── Причина (reason): линейная иконка + текст, отличается от бейджа ── */
.reason { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-2); }
.reason.r-danger { color: var(--danger); }
.reason.r-warn { color: var(--warn); }
.reason.r-work { color: var(--work); }
.reason .ic { width: 15px; height: 15px; }

/* ── Аватар (фото/инициалы), шкала из спеки ── */
.avatar {
  --sz: 36px; width: var(--sz); height: var(--sz); flex: 0 0 var(--sz);
  border-radius: 50%; overflow: hidden; display: inline-flex; align-items: center; justify-content: center;
  font-size: calc(var(--sz) * .4); font-weight: 700; color: #fff; background: var(--surface-3);
  user-select: none; position: relative;
}
/* Фото поверх инициалов (absolute), иначе буква торчала сбоку от картинки. Ошибка загрузки
   удаляет img → инициалы снова видны. */
.avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar.s32 { --sz: 32px; } .avatar.s36 { --sz: 36px; } .avatar.s40 { --sz: 40px; } .avatar.s48 { --sz: 48px; }
.avatar-stack { display: inline-flex; align-items: center; }
.avatar-stack .avatar { margin-left: -8px; border: 2px solid var(--ink); }
.avatar-stack .avatar:first-child { margin-left: 0; }
.avatar-stack .more { margin-left: -8px; font-size: 11px; color: var(--text-2); background: var(--surface-2);
  border: 2px solid var(--ink); border-radius: 50%; width: 32px; height: 32px; display: inline-flex; align-items: center; justify-content: center; }

/* ── Строка задачи (списки внимания/мои/контроль) ── */
.tgroup { margin-top: 26px; }
.tgroup-h { display: flex; align-items: baseline; gap: 8px; margin-bottom: 8px; }
.tgroup-h .t { font-size: 15px; font-weight: 700; }
.tgroup-h .c { font-size: 13px; color: var(--text-3); }
.trow {
  display: flex; align-items: center; gap: 14px; min-height: 60px; padding: 10px 14px;
  background: var(--surface); border: 1px solid var(--edge); border-radius: var(--radius);
  cursor: pointer; margin-bottom: 8px;
}
.trow:hover { background: var(--surface-3); }
.trow.selected { border-color: var(--edge-2); box-shadow: inset 3px 0 0 var(--accent); }
.trow .main { flex: 1; min-width: 0; }
.trow .title { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trow .meta { display: flex; align-items: center; gap: 10px; margin-top: 3px; }
.trow .right { display: flex; align-items: center; gap: 8px; color: var(--text-3); font-size: 13px; }
.trow .chev { color: var(--text-3); width: 18px; height: 18px; }
.crit { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 700; color: var(--danger); text-transform: uppercase; letter-spacing: .04em; }

/* ── Верхний блок «Сейчас» ── */
.attn-head {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  background: var(--surface); border: 1px solid var(--edge); border-radius: var(--radius);
  padding: 18px 22px; margin: 18px 0 4px;
}
.attn-head .n { font-size: 17px; font-weight: 600; }
.attn-head .n b { color: var(--accent); }

/* ── Состояния (пусто/загрузка/ошибка) ── */
.state { display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 64px 24px; color: var(--text-2); gap: 12px; }
.state .big { font-size: 17px; font-weight: 600; color: var(--text); }
.state.calm { color: var(--text-3); }
.spinner { width: 26px; height: 26px; border: 2px solid var(--edge-2); border-top-color: var(--accent);
  border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2s; } }

/* ── Drawer (боковая панель задачи) ── */
.drawer-scrim { position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 40; opacity: 0; transition: opacity .18s; }
.drawer-scrim.show { opacity: 1; }
.drawer {
  position: fixed; top: 0; right: 0; height: 100dvh; width: min(var(--drawer-w), 92vw);
  background: var(--ink); border-left: 1px solid var(--edge); box-shadow: var(--shadow-drawer);
  z-index: 41; transform: translateX(100%); transition: transform .2s ease; display: flex; flex-direction: column;
}
.drawer.show { transform: translateX(0); }
@media (prefers-reduced-motion: reduce) { .drawer, .drawer-scrim { transition: none; } }

/* ── Содержимое drawer ── */
.dw-body { display: flex; flex-direction: column; height: 100%; }
.dw-scroll { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 18px 22px 8px; }
.dw-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.dw-head-btns { display: flex; gap: 4px; }
.dw-icon { min-height: 36px; padding: 0 8px; }
.dw-icon .ic { width: 18px; height: 18px; }
.dw-title-wrap { display: flex; align-items: flex-start; gap: 8px; margin-bottom: 14px; }
.dw-title { font-size: 21px; font-weight: 800; line-height: 1.2; letter-spacing: -.01em; text-wrap: balance; flex: 1; min-width: 0; }
.dw-edit { flex: 0 0 auto; background: none; border: none; cursor: pointer; color: var(--text-3); padding: 4px; border-radius: 6px; }
.dw-edit:hover { color: var(--accent); background: var(--surface); }
.dw-edit .ic { width: 16px; height: 16px; }

/* Поля задачи (редактируемые и справочные) */
.dw-fields { display: grid; grid-template-columns: 108px 1fr; gap: 10px 12px; align-items: center;
  padding-bottom: 14px; border-bottom: 1px solid var(--edge); margin-bottom: 16px; }
.dw-field { display: contents; }
.dw-flabel { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--text-3); }
.dw-fval { font-size: 14px; color: var(--text); min-width: 0; }
.dw-fv { display: inline-flex; align-items: center; gap: 8px; }
.dw-muted { color: var(--text-3); }
.dw-inp { width: 100%; max-width: 100%; min-width: 0; box-sizing: border-box; background: var(--surface-2); border: 1px solid var(--edge-2); border-radius: var(--radius-sm);
  color: var(--text); font-family: var(--font); font-size: 14px; padding: 8px 10px; min-height: 40px; }
.dw-inp:focus { border-color: var(--accent); outline: none; }
select.dw-inp { cursor: pointer; }
/* Поля-значения задачи читаются как текст карточки, а рамка-редактор проявляется по наведению
   и фокусу (не «анкета» из постоянных форм). Логика правки прежняя, меняется только вид. */
.dw-fields .dw-inp { background: transparent; border-color: transparent; padding: 4px 6px; min-height: 32px; }
.dw-fields .dw-inp:hover { background: var(--surface); border-color: var(--edge); }
.dw-fields .dw-inp:focus { background: var(--surface-2); border-color: var(--accent); }
.dw-descwrap { margin-bottom: 16px; position: relative; }
.dw-descwrap .dw-flabel { margin-bottom: 6px; }
.dw-descwrap .dw-edit { position: absolute; top: 0; right: 0; }
.dw-descwrap [hidden] { display: none; }
.text-link { color: var(--accent); text-decoration: underline dotted; overflow-wrap: anywhere; }
.dw-title-inp { max-width: none; font-size: 18px; font-weight: 700; }
.dw-desc-inp { max-width: none; resize: vertical; }
.dw-edit-row { display: flex; gap: 8px; margin-top: 8px; }
.dw-feed-h { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--text-3); margin: 4px 0 2px; }
.dw-props { display: flex; flex-wrap: wrap; gap: 8px 18px; padding-bottom: 14px; border-bottom: 1px solid var(--edge); margin-bottom: 14px; }
.dw-prop { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); }
.dw-prop .ic { width: 15px; height: 15px; }
.dw-desc { font-size: 14px; line-height: 1.55; color: var(--text); margin-bottom: 16px; white-space: pre-wrap; }
.dw-atts { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
/* .dw-att — только флекс-обёртка (чип-ссылка + кнопка удаления). Рамка/фон живут на .dw-att-link,
   чтобы не было двойного прямоугольника внутри плашки. */
.dw-att { font-size: 13px; color: var(--text-2); }
.dw-att .ic { width: 15px; height: 15px; }
.dw-att:hover { color: var(--text); }
.dw-feed { display: flex; flex-direction: column; gap: 10px; margin: 6px 0 16px; }
.dw-empty-feed { color: var(--text-3); font-size: 13px; }
/* Сообщения пузырями: чужие слева, свои (mine) — справа акцентом, как в обычной переписке. */
.dw-msg { display: flex; gap: 8px; align-items: flex-end; max-width: 100%; }
.dw-msg.mine { flex-direction: row-reverse; }
.dw-msg-b { flex: 0 1 auto; max-width: 74%; min-width: 0; background: var(--surface-2);
  border: 1px solid var(--edge); border-radius: 12px; padding: 7px 11px; }
.dw-msg.mine .dw-msg-b { background: rgba(255,239,0,.10); border-color: rgba(255,239,0,.22); }
.dw-msg-h { display: flex; align-items: baseline; gap: 8px; font-size: 13px; flex-wrap: wrap; }
.dw-msg.mine .dw-msg-h { flex-direction: row-reverse; }
.dw-msg-h b { font-weight: 700; } .dw-msg-t { color: var(--text-3); font-size: 11px; }
.dw-msg-x { font-size: 14px; line-height: 1.45; color: var(--text); margin-top: 2px; white-space: pre-wrap; word-break: break-word; }
.dw-compose { display: flex; gap: 8px; align-items: flex-end; padding-top: 6px; }
.dw-input { flex: 1; resize: none; background: var(--surface-2); border: 1px solid var(--edge); border-radius: var(--radius-sm);
  color: var(--text); font-family: var(--font); font-size: 14px; padding: 10px 12px; line-height: 1.4; min-height: 44px; }
.dw-input:focus { border-color: var(--accent); outline: none; }
.dw-send { min-height: 44px; }
.dw-actions { display: flex; flex-direction: column; gap: 8px; padding: 12px 22px; border-top: 1px solid var(--edge); background: var(--ink); }
.dw-acthint { font-size: 12px; color: var(--text-3); }
.dw-actbtns { display: flex; align-items: center; gap: 8px; }
.dw-primary { flex: 1; justify-content: center; min-height: 46px; font-size: 15px; }
.dw-actbtns .btn-secondary { min-height: 46px; }
.dw-actbtns .dw-more { margin-left: auto; min-height: 40px; }
.dw-err { color: var(--danger); font-size: 13px; padding: 8px 22px 0; }

/* ── Полный экран задачи ── */
.tk-wrap { max-width: 820px; margin: 0 auto; display: flex; flex-direction: column; min-height: calc(100dvh - 56px); }
.tk-head { display: flex; align-items: center; gap: 14px; padding-bottom: 16px; border-bottom: 1px solid var(--edge); margin-bottom: 18px; }
.tk-head .btn:first-child { margin-right: auto; }
.ic-flip { transform: rotate(180deg); width: 18px; height: 18px; }
.tk-body { flex: 1; }
.tk-title { font-size: 26px; font-weight: 800; letter-spacing: -.01em; margin-bottom: 14px; text-wrap: balance; }
.tk-sub { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); margin: 22px 0 12px; }
.tk-compose { position: sticky; bottom: 0; background: var(--ink); padding: 12px 0; border-top: 1px solid var(--edge); }

/* ── Кнопка создания + FAB ── */
.new-task-btn { width: 100%; margin: 6px 0 14px; justify-content: flex-start; padding: 0 14px; }
.fab { display: none; }
@media (max-width: 760px) {
  .fab { display: flex; position: fixed; right: 16px; bottom: calc(var(--tap-mobile) + 16px + env(safe-area-inset-bottom, 0px));
    z-index: 35; width: 56px; height: 56px; border-radius: 50%; background: var(--accent); color: var(--accent-ink);
    border: none; font-size: 26px; align-items: center; justify-content: center; box-shadow: var(--shadow-pop); cursor: pointer; }
}

/* ── Модалка (создание) ── */
.modal-scrim { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 45; }
.modal { position: fixed; z-index: 46; background: var(--ink); border: 1px solid var(--edge); border-radius: 18px;
  box-shadow: var(--shadow-pop); left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(520px, 94vw);
  max-height: 90dvh; overflow-y: auto; padding: 22px 24px; }
.cr-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.cr-head h2 { font-size: 22px; font-weight: 800; }
.cr-label { display: block; font-size: 12px; font-weight: 700; color: var(--text-3); text-transform: uppercase; letter-spacing: .05em; margin: 14px 0 7px; }
.cr-title, .cr-desc { width: 100%; background: var(--surface-2); border: 1px solid var(--edge); border-radius: var(--radius-sm);
  color: var(--text); font-family: var(--font); font-size: 15px; padding: 11px 13px; resize: vertical; line-height: 1.4; }
.cr-title:focus, .cr-desc:focus, .cr-search:focus, .cr-date:focus { border-color: var(--accent); outline: none; }
.cr-picker { position: relative; }
.cr-chosen { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 46px; padding: 0 12px; background: var(--surface-2);
  border: 1px solid var(--edge); border-radius: var(--radius-sm); color: var(--text); font-family: var(--font); font-size: 14px; cursor: pointer; }
.cr-chosen .chev { margin-left: auto; width: 16px; height: 16px; color: var(--text-3); }
.cr-pickdrop { position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 2; background: var(--surface); border: 1px solid var(--edge-2);
  border-radius: var(--radius-sm); box-shadow: var(--shadow-pop); padding: 8px; }
.cr-pickdrop.hidden { display: none; }
.cr-search { width: 100%; background: var(--surface-2); border: 1px solid var(--edge); border-radius: 6px; color: var(--text);
  font-family: var(--font); font-size: 14px; padding: 8px 10px; margin-bottom: 6px; }
.cr-people { max-height: 220px; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; }
.cr-person { display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: 6px; background: none; border: none;
  color: var(--text); font-family: var(--font); font-size: 14px; cursor: pointer; text-align: left; width: 100%; }
.cr-person:hover { background: var(--surface-3); }
.cr-direct { margin-left: auto; font-size: 11px; color: var(--accent-dim); }
.cr-due { display: flex; flex-wrap: wrap; gap: 8px; }
.cr-duebtn { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 14px; background: var(--surface-2);
  border: 1px solid var(--edge); border-radius: var(--radius-sm); color: var(--text-2); font-family: var(--font); font-size: 13px; font-weight: 600; cursor: pointer; }
.cr-duebtn.on { border-color: var(--accent); color: var(--text); }
.cr-duebtn .ic { width: 14px; height: 14px; }
.cr-date { background: var(--surface-2); border: 1px solid var(--edge); border-radius: var(--radius-sm); color: var(--text);
  font-family: var(--font); padding: 0 12px; min-height: 40px; }
.cr-details-toggle { display: flex; align-items: center; gap: 6px; background: none; border: none; color: var(--accent-dim);
  font-family: var(--font); font-size: 14px; font-weight: 600; cursor: pointer; margin: 18px 0 4px; padding: 6px 0; }
.cr-details-toggle .grp-chev.open { transform: rotate(90deg); }
.cr-prio { display: flex; gap: 8px; }
.cr-priobtn { flex: 1; min-height: 40px; background: var(--surface-2); border: 1px solid var(--edge); border-radius: var(--radius-sm);
  color: var(--text-2); font-family: var(--font); font-size: 13px; font-weight: 600; cursor: pointer; }
.cr-priobtn.on { border-color: var(--accent); color: var(--text); }
.cr-submit { width: 100%; margin-top: 20px; }
.cr-err { color: var(--danger); font-size: 13px; margin-top: 10px; min-height: 1px; }
.cr-note { text-align: center; font-size: 12px; color: var(--text-3); margin-top: 10px; }
@media (max-width: 760px) {
  .modal { top: auto; bottom: 0; left: 0; transform: none; width: 100vw; max-height: 92dvh; border-radius: 18px 18px 0 0;
    padding-bottom: calc(22px + env(safe-area-inset-bottom, 0px)); }
}

/* Базовый размер иконок: без него bare-иконка (напр. шеврон свёрнутой группы) раздувалась
   во всю страницу, т.к. размер был задан только в частных контекстах (.trow .chev и т.п.). */
.ic, .chev { width: 20px; height: 20px; flex: 0 0 auto; }
.chev, .grp-chev { width: 18px; height: 18px; }

/* ── Сворачиваемые группы + переключатель охвата ── */
.tgroup-toggle { background: none; border: none; cursor: pointer; width: 100%; color: var(--text); font-family: var(--font); display: flex; align-items: center; }
.tgroup-toggle .grp-chev { margin-left: auto; color: var(--text-3); }
.grp-chev { transition: transform .15s; }
.tgroup.collapsed .grp-chev { transform: rotate(90deg); }
.tgroup.collapsed .tgroup-items { display: none; }
.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--edge); border-radius: var(--radius-sm); padding: 3px; margin: 18px 0 4px; }
.seg-btn { min-height: 36px; padding: 0 16px; border: none; background: none; color: var(--text-2); font-family: var(--font); font-weight: 600; font-size: 13px; border-radius: 6px; cursor: pointer; }
.seg-btn.on { background: var(--surface-3); color: var(--text); }

/* ── Разбор (триаж) ── */
.triage { position: fixed; inset: 0; z-index: 50; background: var(--ink); display: flex; flex-direction: column; }
.tr-top { display: flex; align-items: center; justify-content: space-between; padding: 16px 24px; border-bottom: 1px solid var(--edge); }
.tr-count { color: var(--accent); font-weight: 700; }
.tr-body { flex: 1; overflow-y: auto; display: flex; align-items: flex-start; justify-content: center; padding: 40px 24px; }
.tr-card { max-width: 640px; width: 100%; }
.tr-reason { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--text-2); margin-bottom: 14px; }
.tr-reason .ic { width: 16px; height: 16px; }
.tr-title { font-size: 32px; font-weight: 800; line-height: 1.1; letter-spacing: -.02em; margin-bottom: 20px; text-wrap: balance; }
.tr-props { display: flex; flex-wrap: wrap; gap: 10px 20px; padding-bottom: 18px; border-bottom: 1px solid var(--edge); margin-bottom: 18px; }
.tr-actions { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 18px 24px; border-top: 1px solid var(--edge); }
.tr-actions .tr-primary { min-width: 200px; }
.tr-actions .btn-ghost { margin-left: 8px; }
@media (max-width: 760px) {
  .tr-title { font-size: 26px; }
  .tr-actions { flex-direction: column-reverse; gap: 8px; padding: 14px 16px calc(14px + env(safe-area-inset-bottom, 0px)); }
  .tr-actions .btn { width: 100%; }
  .tr-actions .tr-primary { min-width: 0; }
  .tr-actions .btn-ghost { margin-left: 0; }
}

/* ── Нижняя навигация (мобайл) ── */
.tabbar { display: none; }

/* ── Мобайл ── */
@media (max-width: 760px) {
  #app { flex-direction: column; }
  .sidebar { display: none; }
  .content { flex: 1; min-height: 0; }
  .screen { padding: 18px 16px 20px; max-width: none; }
  .screen-h h1 { font-size: 26px; }
  .tabbar {
    display: flex; z-index: 30;
    background: var(--ink); border-top: 1px solid var(--edge);
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }
  .tabbar .nav-item {
    flex: 1 1 0; min-width: 0; flex-direction: column; gap: 3px; min-height: var(--tap-mobile);
    justify-content: center; font-size: 10.5px; font-weight: 600; padding: 6px 2px; position: relative;
  }
  .tabbar .nav-item .label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
  .tabbar .nav-item .ic { width: 22px; height: 22px; }
  .tabbar .nav-item .count { position: absolute; top: 4px; right: 50%; transform: translateX(14px); margin: 0;
    background: var(--accent); color: var(--accent-ink); border-radius: 999px; font-size: 10px; font-weight: 700;
    min-width: 16px; height: 16px; display: inline-flex; align-items: center; justify-content: center; padding: 0 4px; }
  .drawer { width: 100vw; }
}

/* ── Команда/Люди ── */
.team-crumb { display: inline-flex; align-items: center; gap: 6px; margin: 4px 0 16px; padding: 6px 10px;
  border-radius: var(--radius-sm); color: var(--text-2); background: none; border: 1px solid var(--edge); cursor: pointer; }
.team-crumb:hover { background: var(--surface); color: var(--text); }
.team-crumb .chev.back { transform: rotate(180deg); width: 16px; height: 16px; }
.ppl-row { display: flex; align-items: center; gap: 14px; padding: 14px; margin-bottom: 10px;
  background: var(--surface); border: 1px solid var(--edge); border-radius: var(--radius); }
.ppl-row.drill { cursor: pointer; }
.ppl-row.drill:hover { background: var(--surface-3); }
.ppl-main { flex: 1; min-width: 0; }
.ppl-name { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 15px; }
.ppl-reports { font-size: 12px; font-weight: 600; color: var(--text-3); background: var(--surface-2);
  padding: 2px 8px; border-radius: 999px; }
.ppl-cur { margin-top: 3px; font-size: 13px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ppl-cur .ppl-cur-l { color: var(--text-3); }
.ppl-cur.muted { color: var(--text-3); }
.ppl-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.ppl-chip { font-size: 12px; font-weight: 600; color: var(--text-2); background: var(--surface-2);
  padding: 3px 9px; border-radius: 999px; }
.ppl-chip.warn { color: var(--warn); }
.ppl-chip.danger { color: var(--danger); }
.ppl-row .right { color: var(--text-3); }

/* ── Архив ── */
.arch-list { margin-top: 8px; }
.trow.arch { min-height: 54px; cursor: pointer; }
.arch-when { color: var(--text-3); font-size: 12px; }
.arch-foot { display: flex; justify-content: center; padding: 8px 0 24px; }
.arch-foot .btn { min-width: 180px; justify-content: center; }

/* ── Тост подтверждения ── */
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(12px);
  background: var(--surface-3); color: var(--text); border: 1px solid var(--edge-2); border-radius: 999px;
  padding: 10px 18px; font-size: 13px; font-weight: 600; opacity: 0; pointer-events: none; z-index: 60;
  transition: opacity .18s, transform .18s; box-shadow: var(--shadow-drawer); }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.err { border-color: var(--danger); color: var(--danger); }

/* ── Файлы (загрузка/удаление) ── */
.dw-att { display: flex; align-items: center; gap: 6px; }
.dw-att-link { flex: 1; display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2);
  text-decoration: none; background: var(--surface); border: 1px solid var(--edge); border-radius: var(--radius-sm); padding: 8px 12px; min-width: 0; }
.dw-att-link span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 150px; }
.dw-att-link:hover { color: var(--text); }
.dw-att-link .ic { width: 15px; height: 15px; flex: 0 0 auto; }
.dw-attach-btn { margin-top: 4px; min-height: 40px; }
.dw-att-empty { font-size: 13px; }
/* Файлы и наблюдатели живут одним рядом с переносом: чипы, а следом кнопка добавления.
   Файл-чип компактный (не на всю ширину). */
.dw-att-list { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.dw-att { flex: 0 1 auto; }
.dw-att-link { max-width: 240px; }
/* ЕДИНЫЙ вид всех мелких кнопок в файлах/наблюдателях: одинаковый размер и форма (квадрат 26px,
   скругление 7px). «×» удаления — без рамки, «＋» добавления — с пунктиром, но той же формы. */
.dw-att-del, .dw-obs-del, .dw-add-mini { flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; padding: 0; border-radius: 7px; background: none; border: none; color: var(--text-3); cursor: pointer; }
.dw-att-del:hover, .dw-obs-del:hover { color: var(--danger); background: var(--surface-3); }
.dw-add-mini { border: 1px dashed var(--edge-2); }
.dw-add-mini:hover { color: var(--text); border-color: var(--text-3); }
.dw-att-del .ic, .dw-obs-del .ic, .dw-add-mini .ic { width: 14px; height: 14px; }

/* ── Наблюдатели ── */
.dw-obs-list { display: flex; flex-wrap: wrap; gap: 6px; margin: 2px 0 6px; }
.dw-obs-chip { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text);
  background: var(--surface); border: 1px solid var(--edge); border-radius: 999px; padding: 3px 6px 3px 3px; }
.dw-obs-add { max-width: 260px; }

/* ── Теги ── */
.dw-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.dw-tag { font-size: 12px; color: var(--text-2); background: var(--surface-2); border-radius: 6px; padding: 2px 8px; }

/* ── Лента: системные события активности ── */
.dw-act { padding: 2px 0; }
.dw-act-line { font-size: 13px; color: var(--text-2); }
.dw-act-t { color: var(--text-3); font-size: 12px; }
.dw-act-reason { font-size: 13px; color: var(--text); margin-top: 3px; padding: 8px 12px; background: var(--surface);
  border-left: 2px solid var(--warn); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; white-space: pre-wrap; }
.dw-obs { margin-bottom: 16px; }
.dw-atts { margin-bottom: 16px; }

/* Блокировка скролла фона, пока открыт оверлей (drawer / модалка / разбор): фон не должен
   прокручиваться вместе с содержимым панели. overscroll-behavior не даёт скроллу «протекать». */
body.overlay-open { overflow: hidden; }
.dw-scroll, .triage, .modal.cr { overscroll-behavior: contain; }

/* ── История задачи (сворачиваемая, технические события) ── */
.dw-history { margin-bottom: 16px; border-top: 1px solid var(--edge); padding-top: 12px; }
.dw-history summary { cursor: pointer; font-size: 12px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .04em; color: var(--text-3); list-style: none; user-select: none; }
.dw-history summary::-webkit-details-marker { display: none; }
.dw-history summary::before { content: '▸ '; color: var(--text-3); }
.dw-history[open] summary::before { content: '▾ '; }
.dw-hist-list { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.dw-msg-tag { font-size: 11px; font-weight: 600; color: var(--warn); background: rgba(255,159,10,.12);
  border-radius: 6px; padding: 1px 6px; }

/* Вложения: миниатюра для фото, ровная иконка документа для остального */
.dw-att-thumb { width: 28px; height: 28px; flex: 0 0 auto; border-radius: 6px; object-fit: cover; background: var(--surface-2); }
.dw-att-ic { flex: 0 0 auto; display: inline-flex; }
.dw-att-ic .ic { width: 16px; height: 16px; color: var(--text-3); }
.dw-att-link.has-thumb { padding: 5px 10px 5px 5px; }

/* Меню опасных действий (экземпляр / вся серия) над «•••» */
.dw-danger-menu { position: absolute; right: 22px; bottom: 68px; display: flex; flex-direction: column; gap: 6px;
  background: var(--surface); border: 1px solid var(--edge-2); border-radius: var(--radius); padding: 8px;
  box-shadow: var(--shadow-pop); z-index: 5; }
.dw-danger-menu .btn { justify-content: flex-start; min-height: 42px; }
.dw-actions { position: relative; }

/* ── Канбан-доска ── */
.board { display: flex; gap: 12px; overflow-x: auto; padding: 16px 0 8px; align-items: flex-start;
  scroll-snap-type: x proximity; }
.bcol { flex: 0 0 288px; max-width: 288px; background: var(--surface); border: 1px solid var(--edge);
  border-radius: var(--radius); display: flex; flex-direction: column; max-height: calc(100dvh - 220px); scroll-snap-align: start; }
.bcol-head { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--edge); }
.bcol-title { font-weight: 700; font-size: 14px; }
.bcol-count { font-size: 12px; color: var(--text-3); }
.bcol-mini { margin-left: auto; background: none; border: none; cursor: pointer; color: var(--text-3); padding: 4px; border-radius: 6px; }
.bcol-mini + .bcol-mini { margin-left: 0; }
.bcol-mini:hover { color: var(--text); background: var(--surface-2); }
.bcol-mini .ic { width: 15px; height: 15px; }
.bcol-cards { flex: 1; overflow-y: auto; padding: 10px; display: flex; flex-direction: column; gap: 8px; min-height: 40px; overscroll-behavior: contain; }
.bcol-add { flex: 0 0 200px; background: none; border: 1px dashed var(--edge-2); align-items: stretch; justify-content: center; padding: 12px; }
.bcol-add .btn { width: 100%; }

.bcard { background: var(--surface-2); border: 1px solid var(--edge); border-radius: var(--radius-sm);
  padding: 10px 12px; cursor: pointer; display: flex; flex-direction: column; gap: 8px; }
.bcard:hover { border-color: var(--edge-2); }
.bcard-title { font-size: 14px; font-weight: 600; line-height: 1.35; }
.bcard-badges { display: flex; flex-wrap: wrap; gap: 6px; }
.bcard-crit { display: inline-flex; align-items: center; gap: 3px; font-size: 10.5px; font-weight: 700; color: var(--danger);
  text-transform: uppercase; letter-spacing: .03em; }
.bcard-crit .ic { width: 12px; height: 12px; }
.bcard-over { font-size: 11px; font-weight: 600; color: var(--danger); }
.bcard-rec, .bcard-watch { font-size: 12px; }
.bcard-foot { display: flex; align-items: center; gap: 8px; }
.bcard-person { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-2); min-width: 0; }
.bcard-person span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bcard-due { margin-left: auto; font-size: 12px; color: var(--text-3); white-space: nowrap; }
.bcard-ghost { opacity: .4; }
.bcard-chosen { border-color: var(--accent); }
.bcard-drag { box-shadow: var(--shadow-pop); }

@media (max-width: 900px) {
  .bcol { flex-basis: 82vw; max-width: 82vw; max-height: calc(100dvh - 260px); }
}

/* Доп. поля создания */
.cr-details .dw-inp { margin-bottom: 4px; }
.cr-newproj { margin-top: 6px; }
.cr-files { font-size: 13px; color: var(--text-2); }
.cr-fnote { font-size: 12px; color: var(--text-3); margin-top: 4px; overflow-wrap: anywhere; }

/* Выход в сайдбаре */
.nav-logout { color: var(--text-3); margin-top: 4px; }
.nav-logout:hover { color: var(--danger); }
.nav-logout .ic { width: 18px; height: 18px; }

/* Мобильное меню «Ещё» (лист снизу) */
.more-sheet { position: fixed; inset: 0; z-index: 55; display: flex; flex-direction: column; justify-content: flex-end; }
.more-scrim { position: absolute; inset: 0; background: rgba(0,0,0,.45); }
.more-box { position: relative; background: var(--surface); border-top-left-radius: 16px; border-top-right-radius: 16px;
  border-top: 1px solid var(--edge); padding: 12px 12px calc(12px + env(safe-area-inset-bottom, 0px)); display: flex; flex-direction: column; gap: 4px; }
.more-item { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 0 14px; border: none; background: none;
  color: var(--text); font-family: var(--font); font-size: 15px; font-weight: 600; border-radius: var(--radius-sm); cursor: pointer; text-align: left; }
.more-item:hover { background: var(--surface-2); }
.more-item.danger { color: var(--danger); }
.more-item .ic { width: 20px; height: 20px; }

/* Расширенная панель задачи (кнопка «развернуть») — на десктопе шире, вся функциональность та же */
.drawer.wide { width: min(1040px, 96vw); }

/* Фильтры архива */
.arch-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin: 8px 0 4px; }
.arch-search { max-width: 320px; flex: 1 1 220px; }
.arch-filters .seg { margin: 0; }

/* Настройки */
.set-card { background: var(--surface); border: 1px solid var(--edge); border-radius: var(--radius); padding: 18px 20px; margin-top: 16px; max-width: 560px; }
.set-me { display: flex; align-items: center; gap: 14px; }
.set-name { font-size: 17px; font-weight: 700; }
.set-role { font-size: 13px; color: var(--text-3); }
.set-h { font-size: 15px; font-weight: 700; margin-bottom: 6px; }
.set-note { font-size: 13px; color: var(--text-2); line-height: 1.5; margin-bottom: 12px; }
.set-btns { display: flex; flex-wrap: wrap; gap: 8px; }

/* Фильтры доски */
.board-filters { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 0; }
.board-filter { max-width: 200px; min-height: 38px; }
.board-overdue { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); }
.bcard-tags, .cr-tag-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.bcard-inherited, .dw-inherited { font-size: 12px; color: var(--accent-dim); }
.dw-missed { font-size: 13px; color: var(--danger); margin-bottom: 8px; }
.dw-category-rule { font-size: 12px; color: var(--text-3); margin: 6px 0 12px; }
.cr-tag-chips { margin-bottom: 8px; }
.cr-tag-chip { background: transparent; color: var(--text-3); border: 1px solid var(--edge); border-radius: 6px; padding: 4px 8px; cursor: pointer; }
.cr-tag-chip.on { color: var(--accent); border-color: var(--accent); }
.arch-date { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-3); }
.arch-count { font-size: 13px; color: var(--text-3); margin: 12px 0; }
.ppl-disconnected, .team-count { font-size: 13px; font-weight: 400; color: var(--text-3); }
.ppl-name { flex-wrap: wrap; }
.feed-event { border-left: 2px solid var(--accent-dim); padding: 8px 12px; margin: 12px 0; font-size: 14px; }
.feed-action { color: var(--accent); }
.feed-when { color: var(--text-3); font-size: 12px; margin: 4px 0; }
.feed-comment { white-space: pre-wrap; overflow-wrap: anywhere; }
.more-item .count { margin-left: auto; color: var(--accent); }

/* Доска использует всю ширину экрана (колонки скроллятся вбок); ограничение ширины только для
   текстовых экранов. :has поддерживается современными браузерами. */
.screen:has(.board) { max-width: none; }

/* Компактный приёмщик «поменять» + окно истории */
.dw-acceptor { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.dw-change { background: none; border: none; cursor: pointer; color: var(--accent-dim); font: inherit; font-size: 13px; padding: 0; text-decoration: underline; }
.dw-change:hover { color: var(--accent); }
.modal.hist { max-height: 80vh; display: flex; flex-direction: column; }
.hist-list { overflow-y: auto; display: flex; flex-direction: column; gap: 10px; padding-top: 8px; }

/* Контроль: подпись под вкладкой + понятный выбор области */
.ctl-hint { font-size: 13px; color: var(--text-3); margin: 8px 0 4px; }
.ctl-scope-row { display: flex; align-items: center; gap: 10px; margin: 6px 0 4px; }
.ctl-scope-l { font-size: 13px; color: var(--text-2); }
.ctl-scope { max-width: 240px; min-height: 38px; }

/* Колонки визуально длинные, даже когда задач мало — удобнее переносить и глазу приятнее.
   Не до самого низа: ограничены max-height родителя со скроллом. */
.bcol { min-height: min(64vh, 560px); }
.bcol-cards { min-height: 200px; }
.bcol-add { min-height: 0; }

/* Полноэкранный режим панели задачи: поля компактной сеткой сверху, кнопки действий в шапке,
   низ отдан большому обсуждению (плотно поработать/початиться). */
.drawer.full { width: 100vw; max-width: 100vw; height: 100dvh; border-left: none; }
.drawer.full .dw-head-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-left: auto; }
.drawer.full .dw-head-actions .btn { min-height: 40px; }
.drawer.full .dw-title { font-size: 22px; margin-bottom: 12px; }
/* Раскладка: карточка-документ по центру тёмного поля, во всю высоту. Детали КОМПАКТНО тремя
   рядами сверху (без своего скролла), всё оставшееся место забирает обсуждение. Скроллятся только
   сообщения, поле ввода закреплено у нижнего края карточки. */
.drawer.full .dw-body { display: flex; flex-direction: row; justify-content: center; align-items: stretch; height: 100%; overflow: hidden; padding: 22px 16px; }
.drawer.full .dw-scroll { width: 100%; max-width: 900px; margin: 0; padding: 20px 26px; display: flex; flex-direction: column; overflow: hidden; min-height: 0;
  background: var(--surface); border: 1px solid var(--edge); border-radius: 16px; box-shadow: var(--shadow-drawer); }
.drawer.full .dw-head { flex: 0 0 auto; justify-content: flex-start; gap: 10px; margin-bottom: 10px; }
.drawer.full .dw-title { margin-bottom: 10px; }
/* Детали компактно, 3 ряда, фиксированной высоты (без своего скролла). */
.drawer.full .dw-details { flex: 0 0 auto; display: flex; flex-direction: column; gap: 12px; padding-bottom: 12px; margin-bottom: 10px; border-bottom: 1px solid var(--edge); }
/* Ряд 1 и ряд 2 — одинаковые ровные колонки-плашки (одной ширины, подписи и значения на одном
   уровне): исполнитель/срок/важность/теги сверху, поставил/файлы/наблюдатели под ними. */
.drawer.full .dw-fields { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px 20px; margin: 0; padding: 0; border: none; }
.drawer.full .dw-field { display: flex; flex-direction: column; gap: 3px; }
/* Три РАВНЫЕ плашки одной высоты (как ровный верхний ряд): подпись сверху, добавление прижато
   к низу (margin-top:auto), поэтому нижняя линия у всех трёх совпадает. align-items:stretch
   тянет плашки до самой высокой. */
.drawer.full .dw-row2 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; align-items: stretch; }
.drawer.full .dw-row2 > * { margin: 0; min-width: 0; display: flex; flex-direction: column; gap: 8px;
  background: var(--surface-2); border: 1px solid var(--edge); border-radius: 10px; padding: 10px 12px; }
.drawer.full .dw-row2 .dw-flabel { margin: 0; }
.drawer.full .dw-metacol { gap: 6px; }
.drawer.full .dw-metacol-acc { font-size: 12px; margin-top: auto; }
/* Внутри плашки файл БЕЗ своей рамки (плашка — единственный прямоугольник, не двойной). */
.drawer.full .dw-row2 .dw-att-link { background: transparent; border-color: transparent; padding: 3px 4px; max-width: 100%; }
/* Плашка узкая — имя обрезаем сильнее, чтобы файл и «＋» всегда стояли в одну строку. */
.drawer.full .dw-row2 .dw-att-link span { max-width: 108px; }
.drawer.full .dw-metaline { margin: 0; }
.drawer.full .dw-descwrap { margin: 0; }
/* Обсуждение забирает остаток высоты; скроллятся только сообщения. */
.drawer.full .dw-chat { flex: 1 1 auto; display: flex; flex-direction: column; min-height: 0; }
.drawer.full .dw-chat .dw-feed { flex: 1 1 auto; overflow-y: auto; min-height: 0; margin: 6px 0; }
.drawer.full .dw-compose { flex: 0 0 auto; padding: 10px 0 2px; margin-top: 6px; border-top: 1px solid var(--edge); }
/* Файлы компактными чипами. */
.drawer.full .dw-atts { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.drawer.full .dw-att { width: auto; max-width: 100%; }
.dw-head-actions { display: flex; gap: 8px; }
.dw-details, .dw-chat { display: block; }
/* На телефоне ровные колонки полного режима складываются в 2 в ряд (не влезают 4). */
@media (max-width: 760px) {
  .drawer.full .dw-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .drawer.full .dw-row2 { grid-template-columns: 1fr; }
}
/* Ряд 2 в обычном (узком) режиме — просто стопкой. */
.dw-row2 { display: block; }
.dw-row2 > * + * { margin-top: 16px; }
.dw-meta .dw-fv { margin-top: 4px; }
.dw-meta-sep { margin-top: 10px; }

/* Кнопки действий в шапке панели (всегда наверху). В обычном (узком) режиме переносятся. */
.dw-head { flex-wrap: wrap; gap: 8px; }
.dw-head-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.dw-head-actions .btn { min-height: 40px; }
.dw-head-btns { margin-left: auto; }
.dw-danger-menu { bottom: auto; top: 52px; }

/* Плашка «доступно обновление» (вместо авто-перезагрузки) */
.upd-banner { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 70;
  display: flex; align-items: center; gap: 14px; background: var(--surface-3); border: 1px solid var(--edge-2);
  border-radius: 999px; padding: 8px 8px 8px 18px; box-shadow: var(--shadow-pop); font-size: 13px; }
.upd-banner .btn { min-height: 36px; padding: 0 16px; }

.brand { cursor: pointer; }
.brand:hover { color: var(--accent-dim); }

/* Тихая мета-строка «Поставил X · Приёмщик Y» (метаданные, не колонка) */
.dw-metaline { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 13px; color: var(--text-2); margin-bottom: 4px; }
.dw-metaline-l { color: var(--text-3); }
.dw-metaline b { color: var(--text); font-weight: 600; }
.dw-metaline-sep { color: var(--text-3); }
/* Компактное «＋ файл / ＋ наблюдатель» вместо кнопок/выпадашек во всю ширину */
.dw-add-ghost { display: inline-flex; align-items: center; gap: 5px; background: none; border: 1px dashed var(--edge-2);
  color: var(--text-2); font-family: var(--font); font-size: 13px; padding: 6px 12px; border-radius: var(--radius-sm); cursor: pointer; margin-top: 6px; }
.dw-add-ghost:hover { color: var(--text); border-color: var(--text-3); }
.dw-add-ghost .ic { width: 14px; height: 14px; }
/* Файлы и наблюдатели рядом, компактно */
.dw-resources { display: flex; flex-wrap: wrap; gap: 18px 40px; }
.dw-resources .dw-atts, .dw-resources .dw-obs { margin-bottom: 0; flex: 1 1 240px; min-width: 0; }
.dw-obs-add { max-width: 240px; margin-top: 6px; }

/* Мета-строка задачи переносится (срок больше не налезает на причину на узком экране) */
.trow .meta { flex-wrap: wrap; row-gap: 4px; }
.meta-due { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--text-3); }
.meta-due .ic { width: 13px; height: 13px; }

/* Два основных экрана: поиск, секции и переключатели в пределах ширины телефона. */
.tasks-tools { display: flex; align-items: center; flex-wrap: wrap; gap: 12px 20px; margin: 18px 0 4px; }
.tasks-tools .seg { margin: 0; }
.tasks-search-box { flex: 1 1 220px; min-width: 0; max-width: 420px; }
.tasks-search { width: 100%; min-width: 0; min-height: 42px; }
.tasks-group-head { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 16px; margin-bottom: 8px; }
.tasks-group-head .tgroup-toggle { flex: 1 1 200px; min-width: 0; margin: 0; text-align: left; gap: 8px; min-height: 36px; }
.tasks-group-head .t { overflow-wrap: anywhere; }
.tasks-archive-link { color: var(--text-2); font-size: 13px; text-underline-offset: 3px; white-space: nowrap; }
.tasks-archive-link:hover { color: var(--accent); }
.tasks-archive { margin-top: 24px; }
.task-person { color: var(--text-2); font-size: 12px; overflow-wrap: anywhere; }
.task-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.task-tags .dw-tag { max-width: 100%; overflow-wrap: anywhere; }
.screen-notice { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; color: var(--text-2); font-size: 13px; }
.screen-notice:empty { display: none; }
.tasks-body, .team-body { min-width: 0; max-width: 100%; }
.tasks-screen .state, .team-screen .state { overflow-wrap: anywhere; }
.team-screen .ctl-scope-row { flex-wrap: wrap; }
.team-screen .ctl-scope { min-width: 0; max-width: 100%; flex: 0 1 240px; }
.team-screen .seg { max-width: 100%; flex-wrap: wrap; }
.team-screen .team-crumb { max-width: 100%; text-align: left; overflow-wrap: anywhere; }
.team-screen .ppl-name { overflow-wrap: anywhere; }
.team-screen .ppl-chip { max-width: 100%; overflow-wrap: anywhere; }
.tasks-screen [hidden], .team-screen [hidden] { display: none; }
@media (max-width: 760px) {
  .tasks-tools { align-items: stretch; }
  .tasks-search-box { flex-basis: 100%; max-width: none; }
  .tasks-screen .seg-btn, .team-screen .seg-btn { min-height: 44px; }
  .team-list-tabs { display: flex; }
  .team-list-tabs .seg-btn { flex: 1 1 140px; min-width: 0; padding: 6px 10px; }
  .tasks-group-head .tgroup-toggle { min-height: 44px; }
  .tasks-archive-link { display: inline-flex; align-items: center; min-height: 44px; }
  /* На телефоне колонки идут вниз: горизонтальная прокрутка не нужна. */
  .tasks-screen .board, .team-screen .board { flex-direction: column; overflow-x: visible; scroll-snap-type: none; }
  .tasks-screen .bcol, .team-screen .bcol { flex: 0 0 auto; width: 100%; max-width: 100%; max-height: none; }
  .tasks-screen .bcol-cards, .team-screen .bcol-cards { overflow-y: visible; }
  .tasks-screen .bcol-title, .team-screen .bcol-title { min-width: 0; overflow-wrap: anywhere; }
  .tasks-screen .bcard-title, .team-screen .bcard-title,
  .tasks-screen .bcard .dw-tag, .team-screen .bcard .dw-tag { overflow-wrap: anywhere; max-width: 100%; }
  .tasks-screen .board-filter, .team-screen .board-filter { min-width: 0; max-width: 100%; flex: 1 1 140px; }
}

/* Шапка контента: бренд слева, колокольчик и профиль справа (решение Артура 17.09).
   Раньше лента и профиль жили пунктами навигации внизу списка, там их никто не искал. */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 16px; border-bottom: 1px solid var(--line); background: var(--bg);
  position: sticky; top: 0; z-index: 20;
}
.topbar .brand { font-weight: 700; letter-spacing: .08em; font-size: 13px; color: var(--muted); cursor: pointer; }
.top-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.top-btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: 10px; border: 0; background: transparent;
  color: var(--fg); cursor: pointer;
}
.top-btn:hover { background: var(--panel2); }
.top-btn .count {
  position: absolute; top: 4px; right: 4px; min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 8px; background: var(--danger, #e5484d); color: #fff;
  font-size: 10px; line-height: 16px; text-align: center;
}
.top-ava { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; display: block; }
.top-ava-txt {
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--panel2); color: var(--fg); font-size: 13px; font-weight: 600;
}
/* На десктопе бренд уже есть в боковом меню, в шапке он лишний. */
@media (min-width: 861px) { .topbar .brand { display: none; } }
