/* ─── NIKKI. Задачи · каркас макета Stitch на бренд-токенах Nikki (brand.css) ─── */

* { box-sizing: border-box; margin: 0; }
:root {
  /* поверхности */
  --bg: var(--n-page);              /* фон полотна */
  --panel: var(--n-canvas);         /* карточки */
  --surface-low: var(--n-soft);     /* сайдбар, контейнер вкладок */
  --surface-variant: var(--n-hairline); /* бейджи, ховер */
  --field: var(--n-page);           /* поле поиска */
  --track: var(--n-hairline);       /* дорожка полос прогресса */
  /* текст */
  --ink: var(--n-ink);
  --body: var(--n-body);
  --muted: var(--n-meta);
  --faint: var(--n-muted);
  --line: var(--n-hairline);
  --line-soft: rgba(227,232,227,.55);
  /* акцент */
  --accent: var(--n-signal);
  --accent-deep: var(--n-cta);
  --accent-soft: var(--n-signal-10);
  --red: var(--n-loss);
  --red-soft: var(--n-loss-soft);
  --amber: var(--n-warn);
  --amber-soft: var(--n-warn-soft);
  --green: var(--n-cta);
  --green-soft: var(--n-signal-10);
  --shadow-xs: var(--n-lift-1);
  --shadow-md: var(--n-lift-2);
  --ease: var(--n-ease);
  /* сетка макета */
  --side-w: 256px;
  --topbar-h: 64px;
  --gutter: 24px;
}
body {
  font-family: var(--n-sans);
  background: var(--bg);
  color: var(--body);
  font-size: 14px;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ─── Топбар: 64px, прижат вправо от сайдбара, как в макете ─── */
.topbar {
  position: fixed; top: 0; right: 0; left: 0; z-index: 40;
  height: var(--topbar-h); padding: 0 var(--gutter);
  display: flex; align-items: center; gap: 24px;
  background: var(--bg); border-bottom: 1px solid rgba(204,195,216,.5);
}
/* бренд живёт в сайдбаре, в шапке он не нужен */
.topbar > .brand { display: none; }
.me { display: flex; align-items: center; gap: 12px; margin-left: auto; }
.me-line { display: flex; gap: 8px; align-items: center; font-size: 12px; }
.me-line b { font-weight: 700; color: var(--ink); }
/* «Уровень N» и полоса опыта — единая пилюля справа */
nav { display: flex; align-items: center; gap: 2px; }
nav a {
  color: var(--body); text-decoration: none; font-size: 12px; font-weight: 500;
  padding: 7px 10px; border-radius: 12px;
  transition: background .18s var(--ease), color .18s var(--ease);
}
nav a:hover { background: var(--surface-variant); color: var(--accent); }
main {
  padding: var(--gutter) var(--gutter) 40px;
  padding-top: calc(var(--topbar-h) + var(--gutter));
}
/* сдвиг под сайдбар — только на страницах, где он есть (доска) */
body:has(.sidebar-col) main { margin-left: var(--side-w); }
body:has(.sidebar-col) .topbar { left: var(--side-w); }

/* ─── Layout: сайдбар + доска ─── */
/* ─── Сайдбар: 256px, фиксирован на всю высоту экрана ─── */
.layout { display: block; }
.sidebar-col {
  position: fixed; left: 0; top: 0; z-index: 50;
  width: var(--side-w); height: 100vh;
  background: var(--surface-low);
  padding: var(--gutter) 16px;
  display: flex; flex-direction: column; overflow-y: auto;
  box-shadow: var(--n-lift-1);
}
/* бренд наверху сайдбара: словесный знак NIKKI. с зелёной точкой */
.side-brand {
  display: flex; align-items: baseline; gap: 7px;
  margin-bottom: 32px; padding: 0 8px; text-decoration: none;
}
.side-brand b {
  font-size: 22px; font-weight: 700; letter-spacing: .06em; color: var(--n-ink);
}
.side-brand i {
  font-style: normal; font-size: 22px; font-weight: 700;
  color: var(--n-signal); margin-left: -6px;
}
.side-brand span {
  font-size: 14px; font-weight: 500; letter-spacing: 0; color: var(--n-meta);
}
.side-cap {
  font-size: 11px; font-weight: 600; letter-spacing: .05em; line-height: 16px;
  text-transform: uppercase; color: var(--body);
  padding: 0 8px; margin-bottom: 8px;
  display: flex; align-items: center; gap: 8px;
}
.side-cap .ico { width: 16px; height: 16px; }
.sidebar { display: flex; flex-direction: column; gap: 4px; margin-bottom: 32px; }
.side-foot { margin-top: 16px; }
.side-new {
  width: 100%; border: 0; border-radius: 12px; cursor: pointer;
  background: var(--accent); color: #fff; font: inherit;
  font-size: 12px; font-weight: 600; padding: 10px 14px;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  box-shadow: var(--shadow-xs);
  transition: background .18s var(--ease), transform .18s var(--ease);
}
.side-new:hover { background: var(--accent-deep); }
.side-new:active { transform: scale(.985); }
.side-new .ico { width: 18px; height: 18px; }
.side-item .ico { width: 20px; height: 20px; color: inherit; }
/* строка проекта: слева цветная метка-полоса, как в макете */
.side-item {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 8px 8px 12px; border-radius: 12px; cursor: pointer;
  font-size: 12px; font-weight: 500; line-height: 16px; color: var(--body);
  border-left: 4px solid transparent;
  transition: background .18s var(--ease), color .18s var(--ease);
}
.side-item:hover { background: var(--surface-variant); }
.side-item.active {
  background: var(--accent-soft); color: var(--accent);
  font-weight: 700; border-left-color: var(--accent); padding-left: 8px;
}
.side-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-badge {
  background: var(--red-soft); color: var(--red);
  font-size: 11px; font-weight: 700;
  border-radius: 4px; min-width: 18px; height: 18px; padding: 0 5px;
  display: inline-flex; align-items: center; justify-content: center;
}
.side-count {
  font-size: 12px; font-weight: 500; color: var(--body);
  background: var(--surface-variant); border-radius: 4px; padding: 2px 6px;
}
.side-item.active .side-count { color: var(--accent); background: rgba(99,14,212,.08); }
.side-act {
  border: 0; background: none; cursor: pointer;
  color: var(--faint); padding: 2px 3px; border-radius: 4px;
  display: inline-flex; transition: color .18s var(--ease);
}
.side-act:hover { color: var(--accent); }
.side-add {
  margin-top: 6px; border: 1px dashed var(--line); background: none;
  color: var(--muted); font: inherit; font-size: 13px; font-weight: 600;
  padding: 8px 10px; border-radius: 12px; cursor: pointer;
  transition: color .18s var(--ease), border-color .18s var(--ease), background .18s var(--ease);
}
.side-add:hover { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
.board-main { flex: 1; min-width: 0; }

/* ─── Строка над доской: заголовок слева, действия справа ─── */
.board-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 12px; margin-bottom: 24px; flex-wrap: wrap;
}
.board-sub { font-size: 13px; line-height: 18px; color: var(--body); margin-bottom: 6px; }
.board-headline h1 {
  font-size: 20px; line-height: 28px; font-weight: 600;
  letter-spacing: -0.01em; color: var(--ink); margin-bottom: 4px;
}
.board-actions { display: flex; align-items: center; gap: 8px; }
.board-actions .btn-primary, .board-actions .btn-ghost {
  padding: 6px 12px; font-size: 12px; font-weight: 500; border-radius: 12px;
}

/* середина шапки: переключатель видов и поиск (только на доске) */
.topbar-mid { display: flex; align-items: center; gap: 24px; }
.topbar-mid .search { width: 256px; }
.topbar-mid .search input { width: 100%; }
.me-sep { width: 1px; height: 24px; background: rgba(204,195,216,.5); }
.me-user {
  display: flex; align-items: center; gap: 12px; text-decoration: none;
  color: var(--ink); margin-left: 8px;
}
.me-user b { font-size: 12px; font-weight: 700; }
.me-user:hover { opacity: .8; }

/* ─── Табы видов ─── */
.view-tabs {
  display: inline-flex; gap: 2px; padding: 3px;
  background: var(--line-soft); border: 1px solid var(--line);
  border-radius: 12px;
}
.tab {
  border: 0; background: none; font: inherit; font-size: 13px; font-weight: 600;
  color: var(--muted); padding: 6px 16px; border-radius: 12px; cursor: pointer;
  transition: color .18s var(--ease), background .18s var(--ease), box-shadow .18s var(--ease);
}
.tab.active { background: var(--panel); color: var(--ink); box-shadow: var(--shadow-xs); }

.board-tools { display: flex; align-items: center; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.mine-toggle {
  font-size: 13px; color: var(--muted); user-select: none; font-weight: 600;
  display: inline-flex; align-items: center; gap: 6px;
}
.mine-toggle input { accent-color: var(--accent); width: 15px; height: 15px; }

/* Топ недели */
.week-top {
  display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap;
  font-size: 12.5px; color: var(--muted); font-weight: 600;
}
.week-label {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .06em; color: var(--faint); margin-right: 2px;
}
.week-top b { font-weight: 800; color: var(--ink); }
.rank {
  width: 18px; height: 18px; border-radius: 12px; color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 800;
}
.rank-1 { background: var(--accent); }
.rank-2 { background: #4a7c59; }
.rank-3 { background: var(--faint); }
.week-sep { width: 8px; }

/* ─── Кнопки ─── */
.btn-primary {
  background: var(--accent); color: #fff; border: 0; border-radius: 12px;
  padding: 10px 18px; font: inherit; font-size: 13.5px; font-weight: 700;
  cursor: pointer; text-decoration: none; display: inline-block;
  box-shadow: var(--shadow-xs);
  transition: background .18s var(--ease), transform .18s var(--ease);
}
.btn-primary:hover { background: var(--accent-deep); }
.btn-primary:active { transform: scale(.985); }
.btn-danger {
  background: none; border: 1px solid var(--line); color: var(--red);
  border-radius: 12px; padding: 10px 16px; font: inherit; font-size: 13.5px;
  font-weight: 700; cursor: pointer;
  transition: background .18s var(--ease), border-color .18s var(--ease);
}
.btn-danger:hover { background: var(--red-soft); border-color: var(--n-loss-soft); }
.btn-ghost {
  border: 1px solid var(--line); background: var(--panel); color: var(--body);
  border-radius: 12px; padding: 10px 16px; font: inherit; font-size: 13.5px;
  font-weight: 700; cursor: pointer;
  transition: background .18s var(--ease);
}
.btn-ghost:hover { background: var(--line-soft); }

/* ─── Доска: лента колонок по 320px с горизонтальной прокруткой ─── */
.board { display: flex; gap: 20px; overflow-x: auto; padding-bottom: 16px; }
.board::-webkit-scrollbar { height: 0; }
.board { scrollbar-width: none; }
.column {
  min-width: 320px; max-width: 360px; flex: 1 0 320px;
  display: flex; flex-direction: column; gap: 12px;
}
.col-head {
  font-size: 16px; font-weight: 600; line-height: 24px; color: var(--ink);
  padding: 0 4px; margin-bottom: -2px;
  display: flex; align-items: center; gap: 8px;
}
.col-head::before {
  content: ''; width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
}
.column[data-status="backlog"] .col-head::before { background: var(--faint); }
.column[data-status="in_progress"] .col-head::before { background: var(--n-signal); }
.column[data-status="review"] .col-head::before { background: var(--n-warn); }
.column[data-status="done"] .col-head::before { background: #4a7c59; }
.col-head span {
  font-weight: 600; color: var(--body); font-size: 11px; letter-spacing: .05em;
  background: var(--surface-variant); border: 0;
  border-radius: 999px; padding: 2px 8px; line-height: 16px;
}
.col-list { display: flex; flex-direction: column; gap: 12px; min-height: 60px; }
/* добавление прямо в колонку — задача сразу попадает в нужный статус */
.col-add {
  width: 100%; border: 1px dashed var(--line); background: none;
  color: var(--body); font: inherit; font-size: 12px; font-weight: 500;
  padding: 12px; border-radius: 12px; cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  transition: color .18s var(--ease), border-color .18s var(--ease), background .18s var(--ease);
}
.col-add span { font-size: 15px; line-height: 1; }
.col-add:hover { color: var(--accent); border-color: var(--accent); background: rgba(99,14,212,.04); }
/* кнопка «…» в шапке колонки — как в макете */
.col-more {
  margin-left: auto; border: 0; background: none; cursor: default;
  color: var(--faint); padding: 2px; display: inline-flex;
}
.col-more .ico { width: 20px; height: 20px; }

@keyframes rise {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
/* Карточка ровно по макету: padding 16, радиус 12, тень card-base */
.card-task {
  background: var(--panel); border: 1px solid rgba(204,195,216,.2);
  border-radius: 12px; padding: 16px; cursor: grab;
  box-shadow: var(--shadow-xs);
  animation: rise .35s var(--ease) both;
  transition: box-shadow .18s var(--ease), border-color .18s var(--ease);
}
.col-list .card-task:nth-child(2) { animation-delay: .03s; }
.col-list .card-task:nth-child(3) { animation-delay: .06s; }
.col-list .card-task:nth-child(n+4) { animation-delay: .09s; }
.card-task:hover { box-shadow: var(--shadow-md); }
/* Чипы сверху карточки: сложность и срочность видны до чтения названия */
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.card-edit {
  border: 0; background: none; cursor: pointer; padding: 0; flex-shrink: 0;
  color: var(--body); opacity: 0; transition: opacity .18s var(--ease);
}
.card-task:hover .card-edit { opacity: 1; }
.card-edit .ico { width: 18px; height: 18px; }
.card-tags { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.card-tags:empty { display: none; }
.card-title {
  font-size: 15px; font-weight: 600; margin-bottom: 4px;
  line-height: 1.375; color: var(--ink);
  display: flex; align-items: flex-start; gap: 6px;
}
.card-desc {
  font-size: 12px; line-height: 18px; color: var(--body); margin-bottom: 12px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-progress { margin-bottom: 12px; }
.cp-line { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.cp-label {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 10px; font-weight: 600; letter-spacing: .05em; color: var(--body);
}
.cp-label .ico { width: 12px; height: 12px; }
.cp-pct { font-size: 10px; font-weight: 600; letter-spacing: .05em; color: var(--accent); }
.cp-track { height: 6px; border-radius: 999px; background: var(--track); overflow: hidden; }
.cp-fill { height: 100%; border-radius: 999px; background: var(--accent); transition: width .62s var(--ease); }
.cp-full .cp-pct { color: var(--green); }
.cp-full .cp-fill { background: var(--green); }
/* подвал карточки отделён линией, слева даты и счётчики, справа аватары */
.card-meta {
  display: flex; align-items: center; gap: 8px; font-size: 10px; flex-wrap: wrap;
  padding-top: 8px; border-top: 1px solid rgba(204,195,216,.2);
}
.card-meta:empty { display: none; }
.card-right { display: inline-flex; align-items: center; gap: 6px; margin-left: auto; }
.avatar {
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--accent);
  color: #fff; display: inline-flex; align-items: center; justify-content: center;
  font-size: 9.5px; font-weight: 700; letter-spacing: .02em;
  object-fit: cover; flex-shrink: 0;
  box-shadow: 0 0 0 1px var(--panel);
}
img.avatar { background: var(--line-soft); }
.av-h0 { background: #2f6b3f; } .av-h1 { background: #4a7c59; }
.av-h2 { background: #21a038; } .av-h3 { background: #8a6a12; }
.av-h4 { background: #6b5b4a; } .av-h5 { background: #3d6b6b; }
.av-h6 { background: #5c6b3d; } .av-h7 { background: #4a4f4a; }
.avatar-top { width: 36px; height: 36px; font-size: 13px; box-shadow: 0 0 0 1px var(--line); }
.avatar-sm { width: 26px; height: 26px; font-size: 10px; margin-right: 9px; vertical-align: middle; }

/* Стопка аватаров ответственных на карточке */
.avatar-stack { display: inline-flex; align-items: center; }
.avatar-stack .avatar:not(:first-child) { margin-left: -8px; }
.av-more { background: var(--faint); font-size: 9px; }
.mini-meta .avatar-stack .avatar:not(:first-child) { margin-left: -6px; }

/* Мультивыбор ответственных в модалке */
.assignee-picker { display: flex; flex-wrap: wrap; gap: 6px; }
.assignee-empty { color: var(--muted); font-size: 13px; }
.assignee-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px 4px 4px; border: 1px solid var(--line);
  background: var(--panel); border-radius: 999px; cursor: pointer;
  font: inherit; font-size: 12.5px; font-weight: 600; color: var(--body);
  transition: background .18s var(--ease), border-color .18s var(--ease), color .18s var(--ease);
}
.assignee-chip .avatar { width: 22px; height: 22px; font-size: 9px; box-shadow: none; }
.assignee-chip:hover { border-color: var(--accent); }
.assignee-chip.on {
  background: var(--accent-soft); border-color: var(--accent); color: var(--accent);
}

/* Чипы */
/* чипы макета: 10px, semibold, радиус 4, без рамок */
.chip {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 10px; font-weight: 600; letter-spacing: .05em; border-radius: 4px;
  padding: 4px 8px; line-height: 16px; white-space: nowrap;
  background: var(--surface-variant); color: var(--body);
  border: 0;
}
.chip .ico { width: 12px; height: 12px; }
.chip-red { background: var(--red-soft); color: var(--n-loss); }
/* сложность словом — шкала по плотности в бренд-гамме */
.chip-diff.diff-1 { background: #f2f5f2; color: var(--n-meta); }
.chip-diff.diff-2 { background: #e0efe4; color: #2f6b3f; }
.chip-diff.diff-3 { background: #cfe3d5; color: #14381f; }
.chip-urgent { background: var(--n-loss); color: #fff; }
.chip-urgent .ico { color: #fff; }
.chip-amber { background: var(--amber-soft); color: var(--amber); border-color: #ece2c8; }
.chip-green { background: var(--green-soft); color: var(--green); border-color: #bfe3c8; }
.chip-project { background: var(--accent-soft); color: var(--accent); border-color: #bfe3c8; }
.pr-h0 { background: #e7f1e9; color: #2f6b3f; border-color: #cde0d3; }
.pr-h1 { background: #eaf1ec; color: #4a7c59; border-color: #d3e2d8; }
.pr-h2 { background: #e4f3e8; color: #137c2a; border-color: #bfe3c8; }
.pr-h3 { background: #f7f3e6; color: #8a6a12; border-color: #ece2c8; }
.pr-h4 { background: #f2efe9; color: #6b5b4a; border-color: #e2dbd0; }
.pr-h5 { background: #e8f0f0; color: #3d6b6b; border-color: #cfe0e0; }
.side-dot { width: 8px; height: 8px; border-radius: 4px; flex-shrink: 0; }
.sd-h0 { background: #2f6b3f; } .sd-h1 { background: #4a7c59; }
.sd-h2 { background: #21a038; } .sd-h3 { background: #8a6a12; }
.sd-h4 { background: #6b5b4a; } .sd-h5 { background: #3d6b6b; }
.ccount { display: inline-flex; align-items: center; gap: 4px; color: var(--faint); font-weight: 700; }
.ccount .ico { width: 13px; height: 13px; }

/* Точки сложности */
.diff { display: inline-flex; gap: 3px; align-items: center; }
.diff i {
  width: 6px; height: 6px; border-radius: 50%;
  background: transparent; border: 1.5px solid var(--n-hair-hard);
}
.diff i.on { background: var(--accent); border-color: var(--accent); }

.movers { margin-left: auto; display: none; gap: 3px; }
.mv {
  border: 1px solid var(--line); background: var(--panel); border-radius: 12px;
  cursor: pointer; padding: 2px 8px; color: var(--muted);
  display: inline-flex; align-items: center;
  transition: color .18s var(--ease), border-color .18s var(--ease);
}
.mv:hover { color: var(--accent); border-color: var(--accent); }
.mv .ico { width: 11px; height: 11px; }

/* ─── Иконки ─── */
.ico {
  display: inline-block; width: 15px; height: 15px; background: currentColor;
  -webkit-mask: var(--u) center / contain no-repeat;
  mask: var(--u) center / contain no-repeat;
  vertical-align: -2px; flex-shrink: 0;
}
.ico-flame   { --u: url('/static/icons/flame-fill.svg'); }
.ico-chat    { --u: url('/static/icons/chat-circle.svg'); }
.ico-send    { --u: url('/static/icons/paper-plane-right-fill.svg'); }
.ico-pencil  { --u: url('/static/icons/pencil-simple.svg'); }
.ico-trash   { --u: url('/static/icons/trash.svg'); }
.ico-clip    { --u: url('/static/icons/paperclip.svg'); }
.ico-caret-l { --u: url('/static/icons/caret-left.svg'); }
.ico-caret-r { --u: url('/static/icons/caret-right.svg'); }
.ico-clock   { --u: url('/static/icons/clock.svg'); }
.ico-check   { --u: url('/static/icons/check.svg'); }
.ico-bell    { --u: url('/static/icons/bell.svg'); }
.ico-all     { --u: url('/static/icons/squares-four.svg'); }
.ico-archive { --u: url('/static/icons/archive.svg'); }
.ico-plus    { --u: url('/static/icons/plus.svg'); }
.ico-folder  { --u: url('/static/icons/folder.svg'); }
.ico-users   { --u: url('/static/icons/users.svg'); }
.ico-dots    { --u: url('/static/icons/dots-three.svg'); }
.ico-cal     { --u: url('/static/icons/calendar-blank.svg'); }
.ico-checks  { --u: url('/static/icons/list-checks.svg'); }
.ico-gear    { --u: url('/static/icons/gear-six.svg'); }
.urgent-flag { color: var(--red); width: 14px; height: 14px; margin-top: 2px; }
.side-act .ico { width: 13px; height: 13px; }
.week-btn .ico { width: 12px; height: 12px; }

/* ─── Неделя ─── */
.week-nav { display: flex; align-items: center; gap: 8px; margin-bottom: 16px; }
.week-nav button {
  border: 1px solid var(--line); background: var(--panel); border-radius: 12px;
  font: inherit; font-size: 13px; font-weight: 700; color: var(--body);
  padding: 6px 12px; cursor: pointer; display: inline-flex; align-items: center;
  transition: background .18s var(--ease), color .18s var(--ease);
}
.week-nav button:hover { background: var(--line-soft); color: var(--ink); }
.week-range { font-size: 13px; font-weight: 700; color: var(--muted); margin-left: 4px; }
.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 12px; }
.day { min-width: 0; }
.day-head {
  font-size: 11.5px; font-weight: 800; color: var(--muted);
  text-transform: uppercase; letter-spacing: .05em;
  padding: 4px 2px 10px; display: flex; align-items: center; gap: 6px;
}
.day.today .day-head { color: var(--accent); }
.day.today .day-head::after {
  content: 'сегодня'; font-size: 9.5px; background: var(--accent-soft);
  color: var(--accent); border-radius: 4px; padding: 1px 6px;
  letter-spacing: .02em;
}
.day-body { min-height: 120px; border-top: 2px solid var(--line); padding-top: 10px; }
.day.today .day-body { border-top-color: var(--accent); }
.mini-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  padding: 9px 10px; font-size: 12.5px; font-weight: 600; cursor: pointer;
  margin-bottom: 8px; box-shadow: var(--shadow-xs); color: var(--ink);
  transition: box-shadow .18s var(--ease), border-color .18s var(--ease);
}
.mini-card:hover { border-color: var(--n-hair-hard); box-shadow: var(--shadow-md); }
.mini-title { line-height: 1.4; display: flex; gap: 5px; align-items: flex-start; }
.mini-meta { display: flex; align-items: center; gap: 6px; margin-top: 7px; }
.mini-meta .avatar { width: 19px; height: 19px; font-size: 8px; }
.dim { opacity: .5; }

/* ─── Модалка ─── */
/* Центровку модалки ломали две вещи: position:relative перебивал UA-шный
   position:fixed у dialog:modal, а глобальный сброс margin:0 — UA-шный
   margin:auto. Отсюда и «съезд влево». */
dialog {
  border: 0; border-radius: 12px; padding: 0;
  width: min(640px, 92vw);
  margin: auto;
  background: var(--panel);
  box-shadow: var(--shadow-md);
}
dialog::backdrop { background: rgba(45,49,51,.4); backdrop-filter: blur(4px); }
.modal-body {
  border-radius: 12px; padding: 22px;
  display: flex; flex-direction: column; gap: 13px;
  max-height: 90vh; overflow-y: auto;
}
/* Карточка задачи: широкое окно 1000px, слева содержание, справа свойства */
#task-modal { width: min(1000px, 94vw); }
#task-modal .modal-body {
  display: grid; grid-template-columns: minmax(0, 1fr) 300px;
  grid-template-rows: auto auto 1fr; gap: 0; padding: 0;
  max-height: min(921px, 92vh);
}
/* шапка окна: слева проект и номер, справа крестик */
.tv-topbar {
  grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between;
  padding: 16px 24px; border-bottom: 1px solid rgba(204,195,216,.3);
}
#task-modal .task-view { grid-column: 1; padding: 32px; }
#task-modal .modal-form { grid-column: 1 / -1; padding: 24px; }
#task-modal #talk { grid-column: 1; padding: 0 32px 28px; }
#task-modal .tv-side {
  grid-column: 2; grid-row: 2 / -1;
  border-left: 1px solid rgba(204,195,216,.3);
  padding: 24px; display: flex; flex-direction: column; gap: 28px;
  overflow-y: auto;
}
#task-modal .tv-side[hidden] { display: none; }
.modal-form { display: flex; flex-direction: column; gap: 13px; }
/* всегда видимый выход из модалки (крестик), не уезжает при прокрутке */
.modal-close {
  position: absolute; top: 12px; right: 12px; z-index: 5;
  width: 34px; height: 34px; border-radius: 999px; border: 0;
  background: var(--line-soft); color: var(--muted); cursor: pointer;
  font-size: 22px; line-height: 1; display: grid; place-items: center;
  transition: background .18s var(--ease), color .18s var(--ease);
}
.modal-close:hover { background: var(--line); color: var(--ink); }
.modal-title {
  font-weight: 800; font-size: 17px; letter-spacing: -0.01em;
  color: var(--ink); margin-bottom: 1px;
}
.modal-body input, .modal-body textarea, .modal-body select {
  font: inherit; font-size: 14px; padding: 9px 12px;
  border: 1px solid var(--line); border-radius: 12px; width: 100%;
  background: var(--panel); color: var(--ink);
  transition: border-color .18s var(--ease), box-shadow .18s var(--ease);
}
.modal-body input:focus, .modal-body textarea:focus, .modal-body select:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(86,61,135,.14);
}
.modal-body input[name="title"] { font-weight: 700; }
.modal-row { display: flex; gap: 12px; flex-wrap: wrap; }
.modal-row > * { flex: 1; min-width: 130px; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field > label, .field > .field-label {
  font-size: 12.5px; font-weight: 700; color: var(--body);
}
.field small { font-size: 12px; color: var(--faint); }
.field-switch { flex: 0 0 auto; min-width: auto; }
.field-switch .switch { margin-top: 3px; }

.modal-body select, .stack select {
  appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 256 256'%3E%3Cpath fill='%236B7280' d='M213.66 101.66l-80 80a8 8 0 0 1-11.32 0l-80-80A8 8 0 0 1 53.66 90.34L128 164.69l74.34-74.35a8 8 0 0 1 11.32 11.32Z'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
  background-size: 11px; padding-right: 34px; cursor: pointer;
}

.seg {
  display: inline-flex; gap: 2px; padding: 3px;
  background: var(--line-soft); border: 1px solid var(--line);
  border-radius: 12px; width: max-content;
}
.seg button {
  border: 0; background: none; font: inherit; font-size: 12.5px; font-weight: 600;
  color: var(--muted); padding: 5px 13px; border-radius: 12px; cursor: pointer;
  transition: color .18s var(--ease), background .18s var(--ease), box-shadow .18s var(--ease);
}
.seg button.active { background: var(--panel); color: var(--ink); box-shadow: var(--shadow-xs); }

.switch { position: relative; display: inline-block; width: 40px; height: 23px; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.switch-track {
  position: absolute; inset: 0; background: var(--line); border-radius: 999px;
  transition: background .18s var(--ease); pointer-events: none;
}
.switch-track::after {
  content: ''; position: absolute; top: 2.5px; left: 2.5px; width: 18px; height: 18px;
  border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(17,24,39,.25);
  transition: transform .18s var(--ease);
}
.switch input:checked + .switch-track { background: var(--accent); }
.switch input:checked + .switch-track::after { transform: translateX(17px); }

.modal-actions { display: flex; gap: 10px; margin-top: 8px; }

.comments {
  max-height: 230px; overflow-y: auto; display: flex; flex-direction: column;
  gap: 8px; border-top: 1px solid var(--line-soft); padding-top: 14px;
}
.comment { background: var(--bg); border-radius: 12px; padding: 10px 12px; font-size: 13px; }
.comment b { color: var(--ink); font-weight: 700; }
.comment-head { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.comment-head .avatar { width: 20px; height: 20px; font-size: 8.5px; }
/* переносы строк из комментария показываем как написаны */
.comment-text { line-height: 1.5; color: var(--body); white-space: pre-wrap; }
.cdate { color: var(--faint); font-size: 11.5px; margin-left: 2px; }
.comment-add { display: flex; gap: 8px; align-items: flex-end; }
.comment-add textarea {
  font: inherit; font-size: 14px; padding: 9px 12px; width: 100%;
  border: 1px solid var(--line); border-radius: 12px; resize: none;
  line-height: 1.5; max-height: 180px; overflow-y: auto;
}
.comment-add textarea:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(86,61,135,.14);
}
.comment-add button {
  border: 0; background: var(--accent); color: #fff; border-radius: 12px;
  padding: 0 14px; cursor: pointer; height: 38px; flex: none;
  display: inline-flex; align-items: center;
  transition: background .18s var(--ease);
}
.comment-add button:hover { background: var(--accent-deep); }
.comment-add button .ico { width: 15px; height: 15px; }

/* ─── Карточки-страницы ─── */
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  padding: 26px; margin-bottom: 16px; max-width: 580px;
  box-shadow: var(--shadow-xs);
}
.card h2 { font-weight: 800; font-size: 19px; letter-spacing: -0.01em; color: var(--ink); }
.card h3 { font-weight: 800; font-size: 15.5px; color: var(--ink); margin-bottom: 10px; }
.card p { color: var(--muted); font-size: 13.5px; line-height: 1.6; margin-bottom: 6px; }
.card p b { color: var(--ink); }
.card-wide { max-width: 780px; }
.stack { display: flex; flex-direction: column; gap: 15px; margin-top: 14px; }
.stack .btn-primary { margin-top: 6px; align-self: flex-start; }
.stack input {
  padding: 9px 12px; border: 1px solid var(--line); border-radius: 12px;
  font: inherit; font-size: 14px;
  transition: border-color .18s var(--ease), box-shadow .18s var(--ease);
}
.stack input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(86,61,135,.14); }
.bind-code { font-size: 20px; letter-spacing: 3px; color: var(--ink); font-weight: 800; }
code {
  font-family: ui-monospace, 'SF Mono', Menlo, monospace; font-size: 12.5px;
  background: var(--line-soft); color: var(--ink);
  border: 1px solid var(--line); border-radius: 12px; padding: 2px 7px;
}
.form-msg { font-size: 13px; min-height: 1em; font-weight: 600; }
.form-msg.ok { color: var(--green); }
.form-msg.err { color: var(--red); }
.check-row {
  display: flex; gap: 8px; align-items: center;
  font-size: 13.5px; color: var(--body); font-weight: 600;
}
.check-row input { accent-color: var(--accent); }

.team-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.team-table th {
  text-align: left; padding: 8px 6px; font-size: 11.5px; font-weight: 700;
  color: var(--faint); border-bottom: 1px solid var(--line);
}
.team-table td { text-align: left; padding: 10px 6px; border-bottom: 1px solid var(--line-soft); color: var(--body); }
.td-name { font-weight: 700; color: var(--ink); }
.td-login { color: var(--muted); }
.td-title { color: var(--muted); }
.team-table button {
  border: 1px solid var(--line); background: var(--panel); border-radius: 12px;
  font: inherit; font-size: 12px; font-weight: 600; color: var(--muted);
  padding: 4px 10px; cursor: pointer; white-space: nowrap;
  transition: color .18s var(--ease), background .18s var(--ease);
}
.team-table button:hover { color: var(--ink); background: var(--line-soft); }
.tg-chip {
  font-size: 11.5px; font-weight: 700; border-radius: 12px; padding: 3px 8px;
  background: var(--line-soft); color: var(--muted); white-space: nowrap;
  border: 1px solid var(--line);
}
.tg-chip.on { background: var(--green-soft); color: var(--green); border-color: #bfe3c8; }

/* ─── Профиль ─── */
.profile-wrap { max-width: 980px; margin: 0 auto; }
.profile-hero {
  display: grid; grid-template-columns: auto 1fr auto; gap: 4px 26px;
  align-items: center; max-width: none; padding: 30px;
}
.profile-who { min-width: 0; }
.profile-who h2 { margin-bottom: 9px; font-size: 22px; }
.ava-upload {
  position: relative; width: 96px; height: 96px; border-radius: 50%;
  cursor: pointer; overflow: hidden; flex-shrink: 0;
  border: 1px solid var(--line);
}
.ava-img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ava-fallback { width: 100%; height: 100%; font-size: 36px; border-radius: 50%; }
.ava-overlay {
  position: absolute; inset: 0; display: flex; align-items: center;
  justify-content: center; text-align: center;
  background: rgba(17,24,39,.55); color: #fff;
  font-size: 10.5px; font-weight: 700; line-height: 1.3;
  opacity: 0; transition: opacity .18s var(--ease);
}
.ava-upload:hover .ava-overlay, .ava-upload.busy .ava-overlay { opacity: 1; }
.profile-stats { display: flex; justify-self: end; }
.stat {
  display: flex; flex-direction: column; gap: 3px; text-align: left;
  padding: 2px 26px;
}
.stat + .stat { border-left: 1px solid var(--line); }
.stat:last-child { padding-right: 6px; }
.stat b {
  font-size: 21px; font-weight: 800; color: var(--ink);
  font-variant-numeric: tabular-nums; letter-spacing: -0.02em;
}
.stat span { font-size: 11.5px; color: var(--muted); font-weight: 600; white-space: nowrap; }
.profile-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-top: 18px; }
.profile-cols .card { max-width: none; margin-bottom: 0; }
.level-progress { grid-column: 1 / -1; margin-top: 24px; }
.level-progress-head {
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: 12.5px; margin-bottom: 7px; gap: 12px;
}
.level-next { color: var(--muted); font-weight: 600; }
.level-pct { font-weight: 800; color: var(--accent); }
.tg-ok { color: var(--green); font-weight: 700; }
.bind-row { margin: 10px 0 12px; }

/* ─── Вход ─── */
.login-body {
  display: grid; place-items: center; min-height: 100vh;
  font-family: var(--n-sans);
  font-size: 14px; color: var(--body);
  background: var(--bg);
}
.login-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 20px;
  padding: 32px 30px; width: min(380px, 90vw);
  display: flex; flex-direction: column; gap: 13px;
  box-shadow: var(--shadow-md);
  animation: rise .62s var(--ease) both;
}
.login-brand {
  display: flex; align-items: baseline; gap: 7px; letter-spacing: 0;
}
.login-brand b { font-size: 18px; font-weight: 700; letter-spacing: .06em; color: var(--n-ink); }
.login-brand i { font-style: normal; font-size: 18px; font-weight: 700; color: var(--n-signal); margin-left: -5px; }
.login-brand span { font-size: 13px; font-weight: 500; color: var(--n-meta); }
.login-card h1 {
  font-weight: 800; font-size: 22px; letter-spacing: -0.02em;
  color: var(--ink); margin-bottom: 2px;
}
.login-card input {
  padding: 11px 13px; border: 1px solid var(--line); border-radius: 12px;
  font: inherit; font-size: 14px;
  transition: border-color .18s var(--ease), box-shadow .18s var(--ease);
}
.login-card input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(86,61,135,.14); }
.login-card button {
  background: var(--accent); color: #fff; border: 0; border-radius: 12px;
  padding: 11px; font: inherit; font-size: 14px; font-weight: 700; cursor: pointer;
  transition: background .18s var(--ease), transform .18s var(--ease);
}
.login-card button:hover { background: var(--accent-deep); }
.login-card button:active { transform: scale(.985); }
.login-error { color: var(--red); font-size: 13px; min-height: 1em; font-weight: 600; }

/* ─── Прочее ─── */
[hidden] { display: none !important; }
::selection { background: var(--accent-soft); }

@media (max-width: 900px) {
  main { padding: 14px 14px 40px; }
  dialog {
    width: 100vw; max-width: 100vw; margin: auto 0 0;
    border-radius: 20px 20px 0 0; border-left: 0; border-right: 0; border-bottom: 0;
  }
  .modal-body {
    border-radius: 20px 20px 0 0; max-height: 88vh; max-height: 88dvh; overflow-y: auto;
    padding: 18px 16px calc(18px + env(safe-area-inset-bottom));
  }
  /* карточка задачи на телефоне — в одну колонку, иначе свойства наезжают на текст */
  #task-modal { width: 100vw; }
  #task-modal .modal-body { grid-template-columns: 1fr; grid-template-rows: auto auto auto auto; }
  #task-modal .task-view { grid-column: 1; padding: 20px 16px; }
  #task-modal .tv-side {
    grid-column: 1; grid-row: auto;
    border-left: 0; border-top: 1px solid rgba(204,195,216,.3);
    padding: 20px 16px; gap: 20px;
  }
  #task-modal #talk { grid-column: 1; padding: 0 16px 20px; }
  #task-modal .tv-title { font-size: 24px; line-height: 32px; }
  .modal-row { flex-direction: column; gap: 12px; }
  .modal-row > * { min-width: 0; }
  .modal-actions { flex-wrap: wrap; }
  .profile-hero { grid-template-columns: auto 1fr; padding: 18px; }
  .profile-stats {
    grid-column: 1 / -1; justify-self: stretch; justify-content: space-between;
    margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line);
  }
  .stat { padding: 2px 10px; }
  .stat:first-child { padding-left: 0; }
  .stat b { font-size: 17px; }
  .profile-cols { grid-template-columns: 1fr; }
  .card { padding: 16px; }
  .team-table .td-title { display: none; }
  .team-table th:nth-child(3) { display: none; }
  /* телефон: сайдбар и шапка выходят из фиксированной сетки в обычный поток */
  /* специфичность как у правил :has выше, иначе сдвиг под сайдбар остаётся */
  body:has(.sidebar-col) main { margin-left: 0; }
  body:has(.sidebar-col) .topbar { left: 0; }
  main { padding-top: 14px; }
  .topbar { position: static; height: auto; padding: 8px 14px; }
  .sidebar-col {
    position: static; width: 100%; height: auto; overflow: visible;
    padding: 12px; margin-bottom: 12px; box-shadow: none;
    border: 1px solid var(--line); border-radius: 12px;
  }
  .side-brand { display: none; }
  .side-cap { padding: 0 2px; margin-bottom: 6px; }
  .sidebar { flex-direction: row; flex-wrap: wrap; gap: 4px; margin-bottom: 14px; }
  .side-item { flex-shrink: 0; }
  /* на телефоне лента колонок не нужна — они идут одна под другой */
  .board { flex-direction: column; overflow-x: visible; }
  .column { min-width: 0; max-width: none; flex: none; width: 100%; }
  /* архив и корзина отдельной строкой, иначе уезжают за край ленты проектов.
     селектор с родителем — иначе десктопное правило ниже по файлу перебивает */
  .sidebar .side-extra {
    flex-direction: row; flex-basis: 100%; margin-top: 8px; padding-top: 8px;
  }
  .side-link { flex: 1; justify-content: center; }
  .side-foot { margin-top: 10px; padding-top: 0; }
  .board-head { gap: 8px; }
  .board-actions { margin-left: auto; }
  /* поиск и вкладки уходят второй строкой шапки, иначе давят бренд */
  .topbar { flex-wrap: wrap; height: auto; padding-top: 8px; padding-bottom: 8px; }
  .topbar-mid { order: 10; flex-basis: 100%; gap: 8px; flex-wrap: wrap; }
  .topbar-mid .search { width: 100%; max-width: none; }
  /* пальцем нужно не меньше 40px: на телефоне вкладки и пункты крупнее */
  .tab { padding: 11px 18px; }
  /* с родителем — десктопное правило ниже по файлу иначе перебивает */
  .sidebar .side-link { padding: 11px 10px; }
  .sidebar-col .pf-chip { padding: 5px 11px 5px 5px; }
  .board-actions .btn-primary, .board-actions .btn-ghost { padding: 11px 16px; }
  .sidebar-col .pf-chip .avatar { width: 30px; height: 30px; font-size: 11px; }
  .sidebar .side-item { padding-top: 11px; padding-bottom: 11px; }
  .col-add { padding: 14px; }
  .board { grid-template-columns: 1fr; }
  .col-list { min-height: auto; }
  .week { grid-template-columns: 1fr; }
  .day-body { min-height: auto; }
  .movers { display: inline-flex; }
  /* На телефоне прячем только имя с аватаром: колокольчик и «Выйти» нужны
     именно там — с телефона человек и читает уведомления, и выходит. */
  .me { gap: 8px; }
  .me-user b { display: none; }
  .me nav a[href="/"] { display: none; }
  .topbar { gap: 10px 12px; padding: 8px 14px; }
  .brand { white-space: nowrap; display: flex; align-items: baseline; gap: 6px; text-decoration: none; }
  .brand b { font-size: 16px; font-weight: 700; letter-spacing: .06em; color: var(--n-ink); }
  .brand i { font-style: normal; font-size: 16px; font-weight: 700; color: var(--n-signal); margin-left: -5px; }
  .brand span { font-size: 12px; font-weight: 500; color: var(--n-meta); }
  nav { overflow-x: auto; }
  nav a { padding: 7px 9px; flex-shrink: 0; }
}
@media (hover: none) { .movers { display: inline-flex; } }

/* ── Вложения к задаче ─────────────────────────────────────── */
.att-list { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.att-list:empty { display: none; }
.att-item {
  display: flex; align-items: center; gap: 8px;
  border: 1px solid var(--line); border-radius: 12px;
  padding: 6px 8px 6px 6px; background: var(--panel); max-width: 260px;
}
.att-item a.att-body { display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--ink); min-width: 0; }
.att-thumb { width: 38px; height: 38px; border-radius: 12px; object-fit: cover; flex: none; background: var(--line-soft); }
.att-fileico {
  width: 38px; height: 38px; border-radius: 12px; flex: none;
  display: grid; place-items: center; background: var(--accent-soft); color: var(--accent);
}
.att-fileico .ico { width: 18px; height: 18px; }
.att-meta { min-width: 0; }
.att-name { font-size: 13px; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 150px; }
.att-size { font-size: 11px; color: var(--muted); }
.att-remove {
  border: 0; background: transparent; color: var(--muted); cursor: pointer;
  font-size: 18px; line-height: 1; padding: 2px 4px; border-radius: 12px; flex: none;
}
.att-remove:hover { color: var(--n-loss); background: var(--line-soft); }
.att-add {
  display: inline-flex; align-items: center; gap: 7px; cursor: pointer;
  font-size: 13px; font-weight: 600; color: var(--accent);
  border: 1px dashed var(--accent); border-radius: 12px; padding: 8px 14px;
  background: transparent; transition: background .18s;
}
.att-add:hover { background: var(--accent-soft); }
.att-add .ico { width: 15px; height: 15px; }

/* ── Карточка чтения задачи («наряд») ───────────────────────── */
.task-view { display: flex; flex-direction: column; gap: 14px; }
.tv-top { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; padding-right: 44px; }
.tv-status {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase;
  padding: 5px 11px; border-radius: 12px;
  background: var(--line-soft); color: var(--muted);
}
.tv-status::before {
  content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor;
}
.tv-st-in_progress { background: var(--n-signal-10); color: var(--n-cta); }
.tv-st-review { background: var(--amber-soft); color: var(--n-warn); }
.tv-st-done { background: #eaf1ec; color: #4a7c59; }
.tv-edit {
  margin-left: auto; display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--line); background: var(--panel); color: var(--muted);
  font: inherit; font-size: 12.5px; font-weight: 700; cursor: pointer;
  padding: 6px 11px; border-radius: 12px;
  transition: color .18s var(--ease), border-color .18s var(--ease), background .18s var(--ease);
}
.tv-edit:hover { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
.tv-edit .ico { width: 13px; height: 13px; }
.tv-head { display: flex; flex-direction: column; gap: 5px; }
.tv-title {
  font-size: 22px; font-weight: 800; line-height: 1.28; letter-spacing: -0.02em;
  color: var(--ink);
}
.tv-by { font-size: 12.5px; color: var(--faint); }
.tv-by b { color: var(--muted); font-weight: 700; }
/* факты — ряд с волосяными разделителями, без серой подложки:
   серые чипы на сером фоне выглядели грязно */
.tv-facts { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.tv-facts > * + * { border-left: 1px solid var(--line); padding-left: 16px; }
.tv-diff {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 12.5px; font-weight: 700; color: var(--muted);
}
.tv-block { display: flex; flex-direction: column; gap: 8px; }
.tv-label {
  font-size: 11px; font-weight: 800; letter-spacing: .06em;
  text-transform: uppercase; color: var(--faint);
}
.tv-people { display: flex; flex-wrap: wrap; gap: 8px; }
.tv-person {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--accent-soft); color: var(--accent);
  border-radius: 999px; padding: 4px 13px 4px 4px; font-size: 13px; font-weight: 700;
}
.tv-person .avatar { width: 24px; height: 24px; font-size: 9.5px; box-shadow: none; }
.tv-none { color: var(--faint); font-size: 13px; }
.tv-desc { font-size: 14px; line-height: 1.65; color: var(--body); white-space: pre-wrap; }
.tv-action {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  border-top: 1px solid var(--line-soft); padding-top: 15px;
}
.tv-primary { flex: 1; min-width: 210px; padding: 13px 18px; font-size: 14.5px; }
.tv-green { background: var(--green); }
.tv-green:hover { background: #0d5c1f; }

/* ── Обсуждение (общее для чтения и правки) ─────────────────── */
.talk {
  display: flex; flex-direction: column; gap: 10px;
  border-top: 1px solid var(--line-soft); padding-top: 15px;
}
.talk-head { font-size: 12.5px; font-weight: 800; color: var(--muted); }
.talk-empty { font-size: 13px; color: var(--faint); }
.comments { max-height: none; border-top: 0; padding-top: 0; }
.comment.mine { background: var(--accent-soft); }
.c-del {
  margin-left: auto; border: 1px solid var(--line); background: var(--panel);
  color: var(--muted); cursor: pointer; line-height: 1; padding: 4px 6px;
  border-radius: 12px; display: inline-flex;
  transition: color .18s var(--ease), border-color .18s var(--ease), background .18s var(--ease);
}
.c-del .ico { width: 13px; height: 13px; }
.c-del:hover { color: var(--red); border-color: var(--n-loss-soft); background: var(--red-soft); }

/* ── Фильтр по исполнителям (в сайдбаре, блок «Команда») ────── */
.people-filter { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.side-card .people-filter { padding: 0 4px 4px; }
.pf-add {
  width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0;
  border: 2px dashed var(--line); color: var(--body);
  display: inline-flex; align-items: center; justify-content: center;
  text-decoration: none; transition: color .18s var(--ease), border-color .18s var(--ease);
}
.pf-add:hover { color: var(--accent); border-color: var(--accent); }
.pf-add .ico { width: 16px; height: 16px; }
.pf-chip {
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
  border: 1px solid transparent; background: transparent;
  padding: 3px 9px 3px 3px; border-radius: 999px; font: inherit; opacity: .85;
  transition: opacity .18s var(--ease), background .18s var(--ease), border-color .18s var(--ease);
}
.pf-chip:hover { opacity: 1; background: var(--line-soft); }
.pf-chip.on { opacity: 1; background: var(--accent-soft); border-color: #bfe3c8; }
/* приглушаем невыбранных только когда фильтр реально включён */
.people-filter.filtering .pf-chip:not(.on) { opacity: .45; }
.pf-chip .avatar { width: 26px; height: 26px; font-size: 10px; }
.pf-name { font-size: 12.5px; font-weight: 800; color: var(--accent); }
.pf-count {
  font-size: 11px; font-weight: 800; color: var(--faint);
  font-variant-numeric: tabular-nums;
}
.pf-chip.on .pf-count { color: var(--accent); }
.pf-reset {
  border: 0; background: transparent; color: var(--muted); font: inherit;
  font-size: 12.5px; font-weight: 700; cursor: pointer; padding: 5px 9px; border-radius: 12px;
}
.pf-reset:hover { color: var(--accent); background: var(--accent-soft); }
.col-empty { font-size: 12.5px; color: var(--faint); padding: 10px 2px; }
.dot-new {
  width: 7px; height: 7px; border-radius: 50%; background: var(--accent);
  flex: none; margin-top: 6px; box-shadow: 0 0 0 3px var(--accent-soft);
}

/* ── Колокольчик и панель уведомлений ───────────────────────── */
.notif { position: relative; margin-left: auto; }
.topbar nav { margin-left: 10px; }
.notif-btn {
  position: relative; width: 36px; height: 36px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--panel); color: var(--muted);
  display: grid; place-items: center; cursor: pointer;
  transition: color .18s var(--ease), border-color .18s var(--ease), background .18s var(--ease);
}
.notif-btn:hover { color: var(--accent); border-color: var(--accent); }
.notif-btn.has-unread {
  color: var(--accent); border-color: #bfe3c8; background: var(--accent-soft);
}
.notif-btn .ico { width: 17px; height: 17px; vertical-align: 0; }
.notif-badge {
  position: absolute; top: -6px; right: -6px; min-width: 18px; height: 18px;
  padding: 0 4px; border-radius: 12px; background: var(--red); color: #fff;
  font-size: 10.5px; font-weight: 800; display: grid; place-items: center;
  border: 2px solid var(--panel); font-variant-numeric: tabular-nums;
}
.notif-panel {
  position: absolute; top: calc(100% + 10px); right: 0; width: min(370px, 92vw);
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 16px 40px -10px rgba(17,24,39,.22); z-index: 30; overflow: hidden;
}
.notif-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 11px 14px; border-bottom: 1px solid var(--line-soft);
  font-size: 13px; font-weight: 800; color: var(--ink);
}
.notif-readall {
  border: 0; background: transparent; color: var(--accent); cursor: pointer;
  font: inherit; font-size: 12px; font-weight: 700; padding: 4px 7px; border-radius: 12px;
}
.notif-readall:hover { background: var(--accent-soft); }
.notif-list { max-height: 400px; overflow-y: auto; }
.ni {
  display: flex; gap: 10px; width: 100%; text-align: left; cursor: pointer;
  border: 0; border-bottom: 1px solid var(--line-soft); background: transparent;
  font: inherit; padding: 11px 14px;
  transition: background .18s var(--ease);
}
.ni:last-child { border-bottom: 0; }
.ni:hover { background: var(--line-soft); }
.ni-unread { background: var(--n-signal-05); box-shadow: inset 3px 0 0 var(--accent); }
.ni-read .ni-body { opacity: .72; }
.ni-group {
  font-size: 11px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase;
  color: var(--faint); padding: 10px 14px 5px; background: var(--panel);
}
.ni .avatar { width: 28px; height: 28px; font-size: 10px; flex: none; }
.ni-body { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1; }
.ni-what { font-size: 12.5px; color: var(--muted); }
.ni-what b { color: var(--ink); font-weight: 700; }
.ni-time { color: var(--faint); font-size: 11.5px; margin-left: 6px; }
.ni-task {
  font-size: 13px; font-weight: 700; color: var(--ink);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ni-task i { font-style: normal; color: var(--accent); }
.ni-preview {
  font-size: 12.5px; color: var(--body);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ni-empty { padding: 20px 14px; font-size: 13px; color: var(--faint); text-align: center; }

@media (max-width: 900px) {
  .tv-title { font-size: 19px; }
  .tv-primary { flex: 1 1 100%; }
  .tv-facts > * + * { border-left: 0; padding-left: 0; }
  /* панель во всю ширину: у правого края кнопки ей некуда раскрыться */
  .notif-panel {
    position: fixed; left: 12px; right: 12px; top: 60px; width: auto;
  }
}

/* ── Чек-лист задачи ────────────────────────────────────────── */
.cl-list { display: flex; flex-direction: column; gap: 2px; }
.cl-item {
  display: flex; align-items: flex-start; gap: 9px; padding: 6px 8px;
  border-radius: 12px; font-size: 13.5px; line-height: 1.45; cursor: pointer;
  transition: background .18s var(--ease);
}
.cl-item:hover { background: var(--line-soft); }
.cl-item input { accent-color: var(--accent); width: 16px; height: 16px; margin-top: 1px; flex: none; }
.cl-item span { flex: 1; }
.cl-done span { color: var(--faint); text-decoration: line-through; }
.cl-count { color: var(--muted); font-weight: 700; letter-spacing: 0; text-transform: none; }
.cl-del {
  border: 0; background: transparent; color: var(--faint); cursor: pointer;
  font-size: 16px; line-height: 1; padding: 0 4px; border-radius: 12px; flex: none;
}
.cl-del:hover { color: var(--red); background: var(--red-soft); }
.cl-add { display: flex; gap: 8px; margin-top: 6px; }
.cl-add input { flex: 1; }
.cc-done { color: var(--green); }

/* ── Шаблоны ────────────────────────────────────────────────── */
.tpl-hint { font-size: 13px; color: var(--muted); line-height: 1.5; margin-top: -6px; }
.tpl-list { display: flex; flex-direction: column; gap: 8px; }
.tpl-row {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px;
}
.tpl-main { flex: 1; min-width: 160px; }
.tpl-name { font-size: 14px; font-weight: 700; color: var(--ink); }
.tpl-sub { font-size: 12.5px; color: var(--muted); }
.tpl-repeat { width: auto; min-width: 170px; }
.tpl-row .btn-primary { padding: 8px 14px; font-size: 13px; }
.tpl-del {
  border: 0; background: transparent; color: var(--faint); cursor: pointer;
  padding: 6px; border-radius: 12px; display: inline-flex;
}
.tpl-del:hover { color: var(--red); background: var(--red-soft); }
.tpl-empty { font-size: 13px; color: var(--faint); }

/* ── Поиск, архив, корзина ──────────────────────────────────── */
/* поле поиска: серая заливка и иконка внутри слева, как в макете */
.search { position: relative; display: block; }
.search::before {
  content: ''; position: absolute; left: 12px; top: 50%; margin-top: -10px;
  width: 20px; height: 20px; background: var(--faint); pointer-events: none;
  -webkit-mask: url('/static/icons/magnifying-glass.svg') center / contain no-repeat;
  mask: url('/static/icons/magnifying-glass.svg') center / contain no-repeat;
}
.search input {
  font: inherit; font-size: 13px; padding: 8px 12px 8px 40px; width: 220px;
  border: 1px solid var(--line); border-radius: 12px; background: var(--field);
  box-shadow: var(--shadow-xs); color: var(--ink);
}
.search input::placeholder { color: rgba(74,68,85,.7); }
.search input:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 2px rgba(99,14,212,.35);
}
.lst-head {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  font-size: 14px; font-weight: 800; color: var(--ink); margin-bottom: 12px;
}
.lst-head .btn-ghost { margin-left: auto; padding: 7px 13px; font-size: 13px; }
.lst-row {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap; cursor: pointer;
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  padding: 11px 14px; margin-bottom: 8px;
  transition: border-color .18s var(--ease), box-shadow .18s var(--ease);
}
.lst-row:hover { border-color: var(--n-hair-hard); box-shadow: var(--shadow-md); }
.lst-title { flex: 1; min-width: 160px; font-size: 14px; font-weight: 700; color: var(--ink); }
.lst-when { font-size: 12px; color: var(--faint); }
.lst-empty, .lst-note { font-size: 13px; color: var(--faint); padding: 6px 2px; }
/* Архив и корзина — такие же строки списка, как проекты, только приглушённые */
.side-extra {
  display: flex; flex-direction: column; gap: 1px;
  margin-top: 10px; border-top: 1px solid var(--line-soft); padding-top: 10px;
}
.side-link {
  display: flex; align-items: center; gap: 9px;
  border: 0; background: none; font: inherit; font-size: 13.5px; font-weight: 600;
  color: var(--muted); cursor: pointer; padding: 8px 10px; border-radius: 12px;
  text-align: left; transition: background .18s var(--ease), color .18s var(--ease);
}
.side-link .ico { width: 15px; height: 15px; color: var(--faint); }
.side-link:hover { background: var(--line-soft); color: var(--accent); }
.side-link:hover .ico { color: var(--accent); }

@media (max-width: 900px) {
  .search input { width: 100%; }
  .tpl-repeat { width: 100%; }
}

/* командный счёт недели (заменил личный топ) */
.week-trend {
  margin-left: 8px; font-size: 11.5px; font-weight: 800;
  color: var(--muted); background: var(--line-soft);
  padding: 3px 8px; border-radius: 12px;
}
.week-trend.up { color: var(--green); background: var(--green-soft); }
.week-people { color: var(--faint); font-weight: 600; }

/* ── Просмотр картинки-вложения ─────────────────────────────── */
#lightbox {
  width: min(92vw, 1100px); max-width: none; padding: 0; border: 0;
  background: transparent; box-shadow: none; overflow: visible;
}
#lightbox::backdrop { background: rgba(17,24,39,.82); }
#lb-img {
  display: block; max-width: 100%; max-height: 78vh; margin: 0 auto;
  border-radius: 12px; background: var(--panel); object-fit: contain;
}
.lb-close {
  position: absolute; top: -46px; right: 0; width: 38px; height: 38px;
  border-radius: 12px; border: 0; cursor: pointer; font-size: 24px; line-height: 1;
  background: rgba(255,255,255,.16); color: #fff; display: grid; place-items: center;
  transition: background .18s var(--ease);
}
.lb-close:hover { background: rgba(255,255,255,.3); }
.lb-bar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-top: 14px; justify-content: center;
}
.lb-name {
  color: #fff; font-size: 13px; font-weight: 600; margin-right: auto;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 50%;
}
.lb-bar .btn-ghost { text-decoration: none; }

@media (max-width: 900px) {
  #lightbox { width: 94vw; }
  .lb-close { top: -44px; }
  .lb-name { max-width: 100%; margin-right: 0; width: 100%; text-align: center; }
  .lb-bar { justify-content: center; }
}

/* подсказки, чтобы человек не думал, что всё пропало */
.week-note { font-size: 12.5px; color: var(--faint); margin-top: 14px; }
.offline {
  grid-column: 1 / -1; display: flex; flex-direction: column; align-items: flex-start;
  gap: 12px; background: var(--panel); border: 1px solid var(--line);
  border-radius: 12px; padding: 20px; font-size: 14px; color: var(--body);
}
.att-add.busy { opacity: .6; pointer-events: none; }
.login-hint { font-size: 12.5px; color: var(--faint); text-align: center; }
.ava-clear {
  border: 0; background: none; color: var(--muted); font: inherit; font-size: 12.5px;
  font-weight: 600; cursor: pointer; padding: 4px 8px; border-radius: 12px;
  align-self: flex-start; margin-top: 6px;
}
.ava-clear:hover { color: var(--red); background: var(--red-soft); }

/* ── Своё окно ввода (вместо системного prompt) ─────────────── */
#ask-modal { width: min(420px, 92vw); }
.ask-body { padding: 22px; display: flex; flex-direction: column; gap: 12px; }
.ask-body input {
  font: inherit; font-size: 15px; padding: 11px 13px; width: 100%;
  border: 1px solid var(--line); border-radius: 12px;
}
.ask-body input:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(86,61,135,.14);
}
.ask-error { font-size: 12.5px; color: var(--red); min-height: 1em; font-weight: 600; }
.ask-body .modal-actions { margin-top: 2px; }

@media (max-width: 900px) {
  #ask-modal { width: 100vw; max-width: 100vw; margin: auto 0 0; }
  .ask-body { padding: 18px 16px calc(18px + env(safe-area-inset-bottom)); }
}

/* ── Карточка задачи: содержание слева, свойства справа (макет tb-02) ── */
.tv-crumbs {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; line-height: 18px; color: var(--body);
}
.tv-topbar .modal-close { position: static; }
.tv-crumbs .ico { width: 16px; height: 16px; }
#task-modal .tv-title {
  font-size: 32px; line-height: 40px; font-weight: 700; letter-spacing: -0.02em;
  color: var(--ink); margin-bottom: 16px;
}
.tv-pills { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 32px; }
.pill {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 12px; font-weight: 500; line-height: 16px;
  padding: 4px 12px; border-radius: 999px;
}
.pill-diff.diff-1 { background: #f2f5f2; color: var(--n-meta); }
.pill-diff.diff-2 { background: #e0efe4; color: #2f6b3f; }
.pill-diff.diff-3 { background: #cfe3d5; color: #14381f; }
.pill-urgent { background: var(--n-loss); color: #fff; }
.pill-urgent .ico { color: #fff; width: 13px; height: 13px; }
#task-modal .tv-desc {
  font-size: 14px; line-height: 20px; color: var(--body); margin-bottom: 32px;
  white-space: pre-wrap;
}
#task-modal .tv-block { margin-bottom: 32px; }
.tv-h3 {
  display: flex; align-items: center; gap: 8px;
  font-size: 16px; line-height: 24px; font-weight: 600; color: var(--ink); margin-bottom: 16px;
}
.tv-h3 .ico { width: 20px; height: 20px; }
.tv-cl-track { margin-bottom: 16px; }
.tv-side .tvs-block { display: flex; flex-direction: column; gap: 8px; }
.tvs-cap {
  font-size: 11px; font-weight: 600; letter-spacing: .05em;
  text-transform: uppercase; color: var(--body);
}
.tvs-val { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--ink); }
.tvs-val .avatar { width: 20px; height: 20px; font-size: 8px; }
.tvs-muted { color: var(--faint); }
.tvs-done { color: var(--green); }
.tvs-done .ico { width: 16px; height: 16px; }
.tvs-status {
  display: inline-flex; align-items: center; gap: 8px; width: 100%;
  background: var(--surface-low); border: 1px solid rgba(204,195,216,.3);
  border-radius: 12px; padding: 10px 12px;
  font-size: 12px; font-weight: 500; color: var(--ink);
}
.tvs-link {
  display: inline-flex; align-items: center; gap: 8px; width: fit-content;
  border: 0; background: none; cursor: pointer; font: inherit;
  font-size: 12px; font-weight: 500; color: var(--accent);
  padding: 6px 8px; margin-left: -8px; border-radius: 12px;
  transition: background .18s var(--ease);
}
.tvs-link:hover { background: rgba(99,14,212,.05); }
.tvs-link .ico { width: 18px; height: 18px; }
.tv-side .tv-people { display: flex; flex-direction: column; gap: 12px; }
.tv-side .tv-person { display: flex; align-items: center; gap: 12px; font-size: 14px; color: var(--ink); }
.tv-side .tv-person .avatar { width: 28px; height: 28px; font-size: 10px; }
.tv-side .tv-action {
  margin-top: auto; padding-top: 24px; display: flex; flex-direction: column; gap: 12px;
}
.tv-side .tv-action .btn-primary,
.tv-side .tv-action .btn-ghost {
  width: 100%; padding: 10px 16px; font-size: 12px; font-weight: 500;
  display: flex; align-items: center; justify-content: center; gap: 8px;
}
.tvs-edit {
  border: 0; background: none; cursor: pointer; font: inherit;
  font-size: 12px; font-weight: 500; color: var(--body);
  padding: 10px 16px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  transition: background .18s var(--ease), color .18s var(--ease);
}
.tvs-edit:hover { background: var(--surface-low); color: var(--accent); }
.tvs-edit .ico { width: 18px; height: 18px; }

/* ── Экраны «Мои задачи» и «Просроченные» (макеты tb-06, tb-07) ── */
.ico-user    { --u: url('/static/icons/user.svg'); }
.ico-warning { --u: url('/static/icons/warning.svg'); }
.scr-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 16px; margin-bottom: 32px; flex-wrap: wrap;
}
.scr-title { font-size: 32px; line-height: 40px; font-weight: 700; letter-spacing: -0.02em; color: var(--ink); }
.scr-sub { font-size: 14px; line-height: 20px; color: var(--body); margin-top: 4px; }
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin-bottom: 40px; }
.tile {
  position: relative; overflow: hidden;
  background: var(--panel); border: 1px solid var(--surface-variant);
  border-radius: 12px; padding: 16px; box-shadow: var(--shadow-xs);
}
.tile-cap {
  font-size: 12px; font-weight: 500; letter-spacing: .05em;
  text-transform: uppercase; color: var(--body); margin-bottom: 8px;
}
.tile-val { font-size: 32px; line-height: 40px; font-weight: 700; letter-spacing: -0.02em; color: var(--ink); }
.tile-unit { font-size: 16px; font-weight: 600; color: var(--body); }
.tile-danger { border-color: var(--n-loss-soft); }
.tile-danger .tile-cap, .tile-danger .tile-val { color: var(--n-loss); }
.tile-danger::before {
  content: ''; position: absolute; left: 0; top: 0; width: 4px; height: 100%; background: var(--n-loss);
}
.scr-group { margin-bottom: 40px; }
.scr-g-title {
  display: flex; align-items: center; gap: 8px;
  font-size: 20px; line-height: 28px; font-weight: 600; letter-spacing: -0.01em;
  color: var(--ink); border-bottom: 1px solid var(--surface-variant);
  padding-bottom: 8px; margin-bottom: 12px;
}
.scr-g-title span {
  font-size: 11px; font-weight: 600; letter-spacing: .05em;
  background: var(--surface-variant); color: var(--body);
  border-radius: 999px; padding: 2px 8px;
}
.scr-g-danger { color: var(--n-loss); }
.big-row {
  display: flex; align-items: center; gap: 16px; cursor: pointer;
  background: var(--panel); border-radius: 12px; padding: 16px;
  box-shadow: var(--shadow-xs); margin-bottom: 12px;
  border-left: 4px solid transparent;
  transition: box-shadow .18s var(--ease);
}
.big-row:hover { box-shadow: var(--shadow-md); }
.big-danger { border-left-color: var(--n-loss); }
.big-main { flex: 1; min-width: 0; }
.big-title { font-size: 16px; line-height: 24px; font-weight: 600; color: var(--ink); }
.big-sub {
  display: flex; align-items: center; gap: 6px;
  font-size: 13px; line-height: 18px; color: var(--body); margin-top: 4px;
}
.big-sub .ico { width: 16px; height: 16px; }
.big-right { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.late-badge {
  font-size: 12px; font-weight: 500; color: var(--n-loss);
  background: var(--n-loss-soft); border-radius: 4px; padding: 4px 8px; white-space: nowrap;
}
@media (max-width: 900px) {
  .tiles { grid-template-columns: 1fr; gap: 12px; }
  .big-row { flex-wrap: wrap; gap: 10px; }
  .scr-title { font-size: 24px; line-height: 32px; }
}
