:root {
  --bg: #f5f6f9;
  --surface: #ffffff;
  --surface2: #eef0f5;
  --border: #e7e9f0;
  --text: #121416;
  --muted: #8a8f9c;
  --accent: #2f6f7e;
  --accent-dim: rgba(47,111,126,0.10);
  --brand: #5c8c6f;
  --brand-dim: rgba(92,140,111,0.12);
  /* Спокойные оттенки для того, что НЕ тревога: нейтральная полоска
     лимита, кромка «всё в пределах», столбики «сделано за неделю».
     Держим токенами, иначе тёмная тема до них не дотягивается. */
  --calm: #b9c2c4;
  --calm-soft: #cfd6d7;
  --sig-ok: #7fa6ae;
  --limit: #6f9a86;
  /* Тёплый однотонный градиент для кнопок, навигации, аватара — компактно
     и премиально. Полный радужный спектр (--rainbow) живёт отдельно и
     используется только как декоративное пятно/свечение, не как заливка
     сплошных элементов — иначе на большой площади это «вырвиглазно». */
  --brand-gradient: linear-gradient(135deg, #85b193 0%, #5c8c6f 55%, #3f6b55 100%);
  /* Раньше здесь была радуга оранжевый-розовый-фиолетовый-синий.
     Заменена на переход хвоя → вода: те же две точки палитры,
     brand и accent, между ними ничего чужого. */
  --rainbow-gradient: linear-gradient(90deg, #6f9a86 0%, #4f8593 55%, #2f6f7e 100%);
  /* Сигнальные цвета приглушены до природных: лист, охра, обожжённая
     глина. Тревога должна читаться как тревога, но не светиться —
     иначе снова получаем экран, где кричит всё. */
  --green: #4e9268;
  --green-dim: rgba(78,146,104,0.13);
  --yellow: #c2913c;
  --yellow-dim: rgba(194,145,60,0.15);
  --yellow-ink: #7d5c1c;
  --red: #b8544a;
  --red-dim: rgba(184,84,74,0.12);
  --red-ink: #8a3830;
  --sidebar-w: 84px;
  --r-sm: 12px;
  --r-md: 18px;
  --r-lg: 28px;
  --r-pill: 999px;
  /* Верхний блик (inset) в токене — каждая карточка/кнопка, которая уже
     ссылается на эти переменные, получает глянцевую грань бесплатно,
     без правки по месту. */
  --shadow-card: 0 2px 4px rgba(18,20,22,0.04), 0 8px 28px rgba(18,20,22,0.07), inset 0 1px 0 rgba(255,255,255,0.7);
  --shadow-float: 0 12px 40px rgba(18,20,22,0.12), inset 0 1px 0 rgba(255,255,255,0.8);
  --shadow-brand: 0 8px 20px rgba(92,140,111,0.20), inset 0 1px 0 rgba(255,255,255,0.4);
  --shadow-accent: 0 8px 20px rgba(47,111,126,0.20), inset 0 1px 0 rgba(255,255,255,0.4);
  --body-bg-gradient: radial-gradient(circle at 15% 0%, #ffffff 0%, var(--bg) 45%, #eceef4 100%);
  --glass-bg: rgba(255,255,255,0.55);
  --track-bg: #e4e6ed;
  /* Тост всегда тёмный, независимо от темы — раньше фон брался из --text,
     а он в тёмной теме светлый (для обычного текста на тёмном фоне), из-за
     чего плашка становилась белой с белым же текстом поверх. Фиксированный
     цвет не переопределяется в тёмной теме намеренно. */
  --toast-bg: #121416;
}

/* ============================================================
   ТЁМНАЯ ТЕМА

   Тот же набор переменных, другие значения — компоненты ничего
   не знают о теме, они просто ссылаются на токены. Акценты (accent/
   brand/green/yellow/red) чуть светлее light-версий: те же оттенки
   на тёмном фоне читались бы глуше и теряли контраст с текстом.
   ============================================================ */
:root[data-theme="dark"] {
  --bg: #0b0e14;
  --surface: #171c26;
  --surface2: #1f2530;
  --border: rgba(255,255,255,0.09);
  --text: #eef0f5;
  --muted: #8b93a6;
  /* Тёмная тема держит яркие сигнальные цвета — приглушённая
     хвойно-водная палитра ниже была общим редизайном для светлой
     темы, но на тёмном фоне бледнеет и теряет контраст, поэтому
     здесь остаётся исходная яркая гамма. */
  --accent: #6b82ff;
  --accent-dim: rgba(107,130,255,0.16);
  --brand: #ff7a3d;
  --brand-dim: rgba(255,122,61,0.16);
  --brand-gradient: linear-gradient(135deg, #ffab6b 0%, #ff5f1f 55%, #e8390a 100%);
  --rainbow-gradient: linear-gradient(90deg, #ff4e01 20.83%, #fa0b61 56.61%, #c609c5 75.14%, #2401fe 100%);
  --calm: #4a5560;
  --calm-soft: #3a444e;
  --sig-ok: #6a97a3;
  --limit: #79a892;
  --green: #34d399;
  --green-dim: rgba(52,211,153,0.16);
  --yellow: #ffca4d;
  --yellow-dim: rgba(255,202,77,0.16);
  --yellow-ink: #ffd479;
  --red: #ff6767;
  --red-dim: rgba(255,103,103,0.16);
  --red-ink: #ff9c93;
  --shadow-card: 0 4px 16px rgba(0,0,0,0.35), inset 0 1px 0 rgba(255,255,255,0.05);
  --shadow-float: 0 16px 44px rgba(0,0,0,0.5), inset 0 1px 0 rgba(255,255,255,0.06);
  --shadow-brand: 0 8px 22px rgba(255,95,31,0.3), inset 0 1px 0 rgba(255,255,255,0.15);
  --shadow-accent: 0 8px 22px rgba(107,130,255,0.3), inset 0 1px 0 rgba(255,255,255,0.15);
  --body-bg-gradient: radial-gradient(circle at 20% 0%, #2a3244 0%, #141821 35%, var(--bg) 60%, #030405 100%);
  --glass-bg: rgba(20,24,32,0.6);
  --track-bg: rgba(0,0,0,0.28);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
/* Фон и на html, и на body: background-attachment: fixed на body одном
   иногда не дотягивал заливку до конца длинной прокручиваемой страницы
   (виден белый html-фон снизу) — на html фон всегда покрывает весь
   документ, независимо от того, до какой высоты вырос контент. */
html { background: var(--body-bg-gradient); min-height: 100%; }
body {
  /* Не плоская заливка — мягкий студийный свет: светлее в углу,
     плавно темнее к противоположному краю. Без цвета, только тон —
     объём фону это даёт, а тексту поверх не мешает. */
  background: var(--body-bg-gradient);
  color: var(--text);
  transition: background 0.2s ease, color 0.2s ease;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  min-height: 100vh; font-size: 14px; letter-spacing: -0.1px;
}
.app { position: relative; z-index: 1; }

/* ============================================================
   ЖИВЫЕ НАЖАТИЯ

   Всё кликабельное — кнопки, пилюли, карточки, чипы — чуть
   проседает под курсором и пружинисто возвращается. Без этого
   даже красивый интерфейс ощущается «неотзывчивым», как картинка,
   а не как поверхность, с которой можно взаимодействовать.
   ============================================================ */
.btn, .nav-btn, .pf, .filt, .c-mini, .ltoggle, .project-select, .user-chip,
.cal-nav, .modal-x, .detail-edit, .wset-sw, .fchip, .status-badge {
  transition: transform 0.15s cubic-bezier(0.34, 1.56, 0.64, 1),
              box-shadow 0.15s ease, background 0.15s ease,
              border-color 0.15s ease, color 0.15s ease, filter 0.15s ease;
}
.btn:active, .nav-btn:active, .pf:active, .filt:active, .c-mini:active,
.ltoggle:active, .project-select:active, .user-chip:active, .cal-nav:active {
  transform: scale(0.94);
  transition-duration: 0.08s;
}

/* ===== LAYOUT ===== */
.app { display: flex; min-height: 100vh; }

/* ===== SIDEBAR ===== */
/* Тёмная стеклянная панель — не плоский чёрный: несколько мягких лучей
   света под разными углами, как в референсе. Контраст с остальным светлым
   интерфейсом — это и есть премиальность: одна тёмная деталь, а не всё
   перекрашено. Иконки/текст переопределены под тёмный фон отдельно. */
.sidebar {
  width: var(--sidebar-w);
  background:
    linear-gradient(125deg, rgba(255,255,255,0.12) 0%, transparent 30%),
    linear-gradient(200deg, rgba(150,180,225,0.16) 0%, transparent 42%),
    linear-gradient(150deg, #232a38 0%, #333c4e 45%, #262d3a 100%);
  box-shadow: 0 12px 40px rgba(0,0,0,0.22), inset 0 1px 0 rgba(255,255,255,0.1);
  display: flex; flex-direction: column; align-items: center; padding: 18px 8px; gap: 4px;
  position: fixed; top: 12px; left: 12px; bottom: 12px; z-index: 10;
  border-radius: var(--r-lg);
}
/* Блик — ненавязчивый: широкая мягкая полоса без резких краёв и низкая
   пиковая яркость, чтобы не читалось как skeleton-loader. Раньше был
   привязан к прокрутке страницы (scroll-driven animation) — но весь диапазон
   скролла на дашборде укладывается в считаные сотни пикселей, и один взмах
   колёсика прогонял блик от края до края почти мгновенно — выглядело как
   баг, не как эффект. Плюс scroll-timeline работает только в Chromium,
   так что в Firefox/Safari блика не было вовсе. Обычная анимация по
   времени — скорость одна и та же везде, не зависит от длины страницы. */
.sidebar::after {
  content: ''; position: absolute; inset: 0; border-radius: inherit;
  background: linear-gradient(115deg,
    transparent 30%, rgba(255,255,255,0.05) 42%, rgba(255,255,255,0.14) 50%,
    rgba(255,255,255,0.05) 58%, transparent 70%);
  background-size: 320% 320%;
  background-position: -60% -60%;
  pointer-events: none;
  animation: sheen-sweep 9s ease-in-out infinite;
}
@keyframes sheen-sweep {
  0%, 22% { background-position: -60% -60%; }
  55% { background-position: 160% 160%; }
  100% { background-position: 160% 160%; }
}
.sidebar-logo {
  width: 38px; height: 38px; background: var(--brand-gradient); border-radius: var(--r-md);
  display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 800; font-size: 15px; line-height: 1; margin-bottom: 14px;
  box-shadow: var(--shadow-brand), inset 0 1px 0 rgba(255,255,255,0.5);
  position: relative; z-index: 1;
}
/* Подпись под иконкой видна всегда, не только по ховеру — не нужно
   наводить мышь, чтобы понять, что за раздел. Ради этого сайдбар
   стал немного шире (см. --sidebar-w). */
.nav-btn {
  width: 100%; padding: 8px 2px 7px; border-radius: var(--r-md);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  cursor: pointer; color: rgba(255,255,255,0.5); font-size: 16px; transition: all 0.15s; border: none; background: none;
  position: relative; z-index: 1;
}
.nav-btn:hover { background: rgba(255,255,255,0.08); color: rgba(255,255,255,0.9); }
.nav-btn.active { background: var(--brand-gradient); color: #fff; box-shadow: var(--shadow-brand), inset 0 1px 0 rgba(255,255,255,0.5); }
.nav-btn .nav-label {
  font-size: 9px; font-weight: 700; line-height: 1.1; white-space: nowrap;
  color: inherit; opacity: 0.85;
}
.sidebar-spacer { flex: 1; }
/* Плюс в самом низу — действие, не раздел; дублирует «Новая задача»
   в шапке, поэтому подпись тут лишняя, оставляем только иконку. */
#btn-new-task { color: var(--brand); font-size: 20px; }
#btn-new-task .nav-label { display: none; }
#btn-new-task:hover { background: var(--brand-dim); color: var(--brand); }

/* ===== MAIN ===== */
/* min-width: 0 обязателен: без него flex-элемент не может стать уже
   своего содержимого, и на узком экране вся страница ехала по горизонтали. */
.main { margin-left: calc(var(--sidebar-w) + 12px); flex: 1; min-width: 0; display: flex; flex-direction: column; min-height: 100vh; }

/* ===== TOPBAR — liquid glass =====
   Не плоская непрозрачная плашка, а отдельная плавающая панель:
   сильный блюр + saturate (контент под ней становится ярче и
   расплывается — эффект «через стекло», не просто затемнение),
   яркий верхний блик (inset) и мягкая внешняя тень, чтобы она
   читалась как объект над страницей, а не часть фона. Та же
   логика решает и старый баг прозрачности при скролле. */
.topbar {
  background: var(--glass-bg);
  backdrop-filter: blur(24px) saturate(1.8);
  -webkit-backdrop-filter: blur(24px) saturate(1.8);
  box-shadow: var(--shadow-card), inset 0 1px 0 rgba(255,255,255,0.9), inset 0 0 0 1px rgba(255,255,255,0.4);
  border-radius: var(--r-lg);
  margin: 12px 12px 0;
  padding: 14px 20px; height: auto; display: flex; align-items: center; gap: 12px;
  position: sticky; top: 12px; z-index: 5;
}
.topbar-title { font-size: 20px; font-weight: 800; letter-spacing: -0.5px; }
.topbar-spacer { flex: 1; }
.btn { padding: 9px 16px; border-radius: var(--r-pill); font-size: 12px; font-weight: 700; cursor: pointer; border: none; transition: all 0.15s; display: flex; align-items: center; gap: 6px; font-family: inherit; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-primary { background: var(--brand-gradient); color: #fff; box-shadow: var(--shadow-brand); }
.btn-primary:hover:not(:disabled) { filter: brightness(1.05); transform: translateY(-1px); }

/* Единственная кнопка в приложении с этим классом — «Новая задача» в шапке,
   главное действие продукта. Свечение снизу изнутри (inset с отрицательным
   Y) — будто кнопка подсвечена снизу, как на референсе с тёмной карточкой:
   не просто заливка, а объём с источником света. Остальные .btn-primary
   специально остаются проще — если светится всё, не светится ничего. */
.btn-hero {
  box-shadow:
    0 10px 26px rgba(92,140,111,0.4),
    inset 0 -12px 18px rgba(133,177,147,0.55),
    inset 0 1px 0 rgba(255,255,255,0.7);
}
.btn-hero:hover:not(:disabled) {
  box-shadow:
    0 14px 32px rgba(92,140,111,0.48),
    inset 0 -12px 18px rgba(133,177,147,0.65),
    inset 0 1px 0 rgba(255,255,255,0.8);
}
/* В тёмной теме бренд остаётся ярко-оранжевым (см. переменные темы
   выше) — свечение кнопки следует за ним, а не за зелёным светлой. */
:root[data-theme="dark"] .btn-hero {
  box-shadow:
    0 10px 26px rgba(255,122,61,0.4),
    inset 0 -12px 18px rgba(255,171,107,0.55),
    inset 0 1px 0 rgba(255,255,255,0.15);
}
:root[data-theme="dark"] .btn-hero:hover:not(:disabled) {
  box-shadow:
    0 14px 32px rgba(255,122,61,0.48),
    inset 0 -12px 18px rgba(255,171,107,0.65),
    inset 0 1px 0 rgba(255,255,255,0.2);
}
.btn-ghost { background: var(--surface); color: var(--text); border: 1px solid var(--border); box-shadow: var(--shadow-card); }
.btn-ghost:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.btn-danger { background: var(--red-dim); color: var(--red); }
.btn-sm { padding: 6px 12px; font-size: 11px; }
/* «Взять» на карточке задачи — было btn-ghost (терялось как некликабельный
   текст), потом сплошной тёмно-серый (читалось «похоронно»). Синий accent
   уже есть в системе как второй цвет бренда, но нигде не занят кнопками —
   живая заливка, которая не спорит с оранжевым хиро-действием. */
.btn-take {
  padding: 7px 14px; font-size: 12px; font-weight: 700;
  background: var(--accent); color: #fff;
}
.btn-take:hover:not(:disabled) { filter: brightness(1.1); }

/* ===== ПРОЕКТ + ПОЛЬЗОВАТЕЛЬ (новое) =====
   Нативный select без appearance:none сам решает, под какую ширину
   подстраиваться — обычно под самый длинный <option>, а не под то,
   что реально выбрано, отсюда пустота при коротких именах проектов.
   Плюс своя стрелка вместо системной, которая выбивалась из остальных
   иконок в шапке. */
.project-select {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-pill);
  padding: 8px 28px 8px 14px; font-size: 12px; font-weight: 700; color: var(--text);
  font-family: inherit; outline: none; cursor: pointer;
  width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  box-shadow: var(--shadow-card);
  appearance: none; -webkit-appearance: none; -moz-appearance: none;
  background-repeat: no-repeat; background-position: right 12px center;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%238a8f9c' stroke-width='1.6' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
:root[data-theme="dark"] .project-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%238b93a6' stroke-width='1.6' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
.project-select:focus { border-color: var(--accent); }

.user-chip {
  display: flex; align-items: center; gap: 8px; cursor: pointer;
  padding: 4px 10px 4px 4px; border-radius: var(--r-pill); transition: background 0.15s;
  position: relative; background: var(--surface); box-shadow: var(--shadow-card);
}
.user-chip:hover { box-shadow: var(--shadow-float); }
.avatar {
  width: 28px; height: 28px; border-radius: 50%; background: var(--brand-gradient); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 800; line-height: 1; flex-shrink: 0; text-transform: uppercase;
}
.avatar-sm { width: 20px; height: 20px; font-size: 9px; }
.avatar-muted { background: var(--border); color: var(--muted); }
.user-name { font-size: 12px; font-weight: 700; }

.dropdown {
  position: absolute; top: calc(100% + 8px); right: 0; min-width: 220px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md);
  box-shadow: var(--shadow-float); padding: 6px; z-index: 30;
}
.dropdown-item {
  padding: 9px 11px; border-radius: var(--r-sm); font-size: 12px; cursor: pointer;
  display: flex; align-items: center; gap: 8px;
}
.dropdown-icon { display: inline-flex; align-items: center; justify-content: center; line-height: 1; flex-shrink: 0; }
.dropdown-item:hover { background: var(--bg); }
.dropdown-sep { height: 1px; background: var(--border); margin: 5px 0; }
.dropdown-label { padding: 6px 10px; font-size: 10px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; }

/* Колокольчик входящих запросов */
.bell { position: relative; }
.bell-badge {
  position: absolute; top: 1px; right: 1px; min-width: 15px; height: 15px;
  background: var(--red); color: #fff; border-radius: 8px;
  font-size: 9px; font-weight: 800; display: flex; align-items: center; justify-content: center;
  padding: 0 4px; border: 2px solid var(--surface);
}
.transfer-item {
  padding: 10px 11px; border-radius: var(--r-md); background: var(--bg); margin-bottom: 6px;
}
.transfer-task { font-size: 12px; font-weight: 700; margin-bottom: 2px; }
.transfer-from { font-size: 11px; color: var(--muted); margin-bottom: 7px; line-height: 1.4; }
.transfer-actions { display: flex; gap: 6px; }

/* ===== PAGE ===== */
.page { padding: 20px 28px 28px; flex: 1; }

/* Рельс дашборда: содержимое слева, календарь узкой колонкой справа.
   Календарь липкий — остаётся на виду, пока листаешь карточки.
   Очередь задач идёт ниже, вне рельса, во всю ширину. */
.dash-rail { display: grid; grid-template-columns: minmax(0, 1fr) 252px; gap: 16px; align-items: start; }
.dash-rail-main { min-width: 0; }
.dash-rail-side { position: sticky; top: 68px; display: flex; flex-direction: column; gap: 12px; }
@media (max-width: 1100px) {
  .dash-rail { grid-template-columns: 1fr; }
  .dash-rail-side { position: static; }
}

.dashboard-top { display: flex; gap: 18px; margin-bottom: 22px; align-items: stretch; flex-wrap: wrap; }
.progress-col { flex: 0 0 280px; display: flex; flex-direction: column; gap: 12px; }
.focus-col { flex: 1; min-width: 280px; }

.progress-card { background: var(--surface); border-radius: var(--r-lg); padding: 16px 18px; box-shadow: var(--shadow-card); }
/* Блоки в правом рельсе: деньги и обзор */
.rail-big { font-size: 30px; font-weight: 800; letter-spacing: -1px; line-height: 1; }
.rail-sub { font-size: 12px; color: var(--muted); line-height: 1.55; margin-top: 6px; }
.rail-line { display: flex; justify-content: space-between; align-items: baseline; gap: 8px;
             font-size: 13px; padding: 4px 0; }
.rail-line span { color: var(--muted); }
.rail-line b { font-weight: 800; }
.progress-card-title { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 10px; }
.prog-row { margin-bottom: 10px; }
.prog-row:last-child { margin-bottom: 0; }
.prog-label { display: flex; justify-content: space-between; font-size: 12px; margin-bottom: 4px; }
.prog-label-name { font-weight: 600; color: var(--text); }
.prog-label-pct { color: var(--muted); }
.prog-bg { height: 6px; background: var(--border); border-radius: 3px; overflow: hidden; }
.prog-fill { height: 100%; border-radius: 3px; transition: width 0.4s ease; }
.prog-green { background: var(--green); }
.prog-calm { background: var(--calm); }
.prog-yellow { background: var(--yellow); }
.prog-red { background: var(--red); }
.prog-accent { background: var(--accent); }

.focus-card {
  background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow-card);
  padding: 18px 20px; height: 100%; display: flex; flex-direction: column; gap: 10px;
}
.focus-label { font-size: 11px; font-weight: 800; color: var(--brand); text-transform: uppercase; letter-spacing: 0.5px; }
.focus-main { font-size: 16px; font-weight: 700; line-height: 1.45; letter-spacing: -0.2px; }
.focus-sub { font-size: 12px; color: var(--muted); line-height: 1.5; }
.focus-chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.fchip { padding: 3px 10px; border-radius: 20px; font-size: 11px; font-weight: 600; }
.fchip-red { background: var(--red-dim); color: var(--red); }
.fchip-yellow { background: var(--yellow-dim); color: var(--yellow); }
.fchip-green { background: var(--green-dim); color: var(--green); }

.calendar-card { background: var(--surface); border-radius: var(--r-lg); padding: 16px 18px; box-shadow: var(--shadow-card); }
.cal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.cal-month { font-size: 12px; font-weight: 700; }
.cal-nav { background: none; border: none; cursor: pointer; color: var(--muted); font-size: 13px; padding: 2px 5px; border-radius: var(--r-sm); }
.cal-nav:hover { background: var(--bg); color: var(--text); }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.cal-day-name { text-align: center; font-size: 10px; font-weight: 700; color: var(--muted); padding: 2px 0 4px; }
.cal-day { text-align: center; font-size: 12px; padding: 6px 2px; border-radius: 7px; color: var(--muted); transition: all 0.1s; }
.cal-day.today { background: var(--brand-gradient); color: #fff; font-weight: 700; border-radius: 50%; }
.cal-day.has-task { font-weight: 700; color: var(--text); }
.cal-day.deadline { background: var(--red-dim); color: var(--red); border-radius: 50%; }

.section-hdr { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; flex-wrap: wrap; }
.section-hdr-title { font-size: 15px; font-weight: 800; flex: 1; letter-spacing: -0.3px; }
/* Два независимых фильтра — статус и исполнитель. Фон-капсула сама по
   себе не читалась как граница между группами, поэтому явная короткая
   подпись сверху — самый надёжный способ показать разделение без
   гадания по цвету фона. */
.filter-groups { display: flex; gap: 18px; flex-wrap: wrap; margin: 10px 0 14px; }
.filter-group { display: flex; flex-direction: column; gap: 5px; }
.filter-group-label {
  font-size: 10px; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.4px;
}
.filter-row {
  display: flex; gap: 2px; flex-wrap: wrap;
  background: var(--track-bg); padding: 3px; border-radius: var(--r-pill);
}
.filt {
  padding: 5px 12px; border-radius: var(--r-pill); font-size: 11px; font-weight: 700;
  cursor: pointer; border: none; background: transparent; color: var(--muted);
  transition: all 0.12s; font-family: inherit;
}
.filt.active { background: var(--surface); color: var(--accent); box-shadow: var(--shadow-card); }
.filt:hover:not(.active) { color: var(--text); }
/* Выбор конкретного исполнителя — тот же пилюльный ряд, но select
   вместо кнопки: список участников заранее неизвестной длины плохо
   ложится в ряд кнопок, а нативный dropdown решает это бесплатно. */
.filt-select {
  max-width: 130px; outline: none;
}
.filt-select:focus-visible { box-shadow: 0 0 0 2px var(--accent-dim); }

.cards-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
@media (max-width: 1100px) { .cards-grid { grid-template-columns: 1fr; } }

/* Сетка задач — своя. Раньше делила класс с карточками дашборда
   и проектами, из-за чего одно нельзя было поправить без другого. */
.task-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(252px, 1fr)); gap: 14px; }

/* ============================================================
   КАРТОЧКА ЗАДАЧИ

   Тело карточки всегда белое. Цвет — только левая кромка, и он
   появляется, лишь когда с задачей что-то не так. Пороги и
   правила в одном месте: taskSignal() в insights.js.

     sig-red    — срок прошёл или наступает, лимит исчерпан, встало
     sig-yellow — запас кончается: три дня до срока, лимит выше 80%
     sig-ok     — всё в пределах запаса, кромка светло-синяя
     sig-done   — сделана, кромка серая

   Кромка сделана внутренней тенью, а не border-left: иначе она
   съедала бы отступ у текста и ломала выравнивание карточек.
   ============================================================ */
.task-card {
  background: var(--surface); border-radius: var(--r-md);
  padding: 17px 18px 17px 21px; cursor: pointer;
  transition: box-shadow 0.2s ease, transform 0.15s cubic-bezier(0.34, 1.56, 0.64, 1);
  display: flex; flex-direction: column; gap: 11px;
  box-shadow: var(--shadow-card), inset 4px 0 0 var(--sig, var(--calm-soft));
}
.task-card.sig-ok     { --sig: var(--sig-ok); }   /* спокойный, не тревожный */
.task-card.sig-yellow { --sig: var(--yellow); }
.task-card.sig-red    { --sig: var(--red); }
.task-card.sig-done   { --sig: var(--calm-soft); }
.task-card:hover { box-shadow: var(--shadow-float), inset 4px 0 0 var(--sig, var(--calm-soft)); transform: translateY(-3px); }
.task-card:active { transform: translateY(-1px) scale(0.985); transition-duration: 0.08s; }
.task-card.selected { box-shadow: var(--shadow-float), inset 4px 0 0 var(--sig, var(--calm-soft)), 0 0 0 2px var(--accent-dim); }
.task-card.done-card { opacity: 0.55; }
.task-card { animation: card-in 0.3s cubic-bezier(0.25, 1, 0.5, 1) backwards; }
@keyframes card-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Плашки проблем — отдельной строкой над названием.
   Рядом с названием они отбирали у него всю ширину: текст плашки
   («по темпу выйдет 140% бюджета») длиннее любого заголовка,
   и от названия задачи оставалась одна буква с многоточием. */
.card-flags { display: flex; flex-wrap: wrap; gap: 5px; }

.card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.card-badges { display: flex; flex-direction: column; align-items: flex-end; gap: 5px; flex-shrink: 0; }
.card-badges-group { position: relative; cursor: default; }
.card-badges-popover {
  position: absolute; top: calc(100% + 6px); right: 0; z-index: 6;
  display: flex; flex-direction: column; align-items: flex-end; gap: 5px;
  padding: 8px; border-radius: var(--r-md);
  background: var(--surface); box-shadow: var(--shadow-float);
  opacity: 0; pointer-events: none; transform: translateY(-4px);
  transition: opacity 0.15s ease, transform 0.15s ease;
  white-space: nowrap;
}
.card-badges-group:hover .card-badges-popover,
.card-badges-group:focus-within .card-badges-popover,
.card-badges-group:focus .card-badges-popover {
  opacity: 1; pointer-events: auto; transform: translateY(0);
}
.card-names { flex: 1; min-width: 0; }
.card-name {
  font-size: 13px; font-weight: 700; line-height: 1.35; letter-spacing: -0.1px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; white-space: normal; word-break: break-word;
}
.card-subname { font-size: 12px; color: var(--muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-name.done { text-decoration: line-through; color: var(--muted); }

.clarity-badge {
  padding: 3px 9px; border-radius: var(--r-pill);
  font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.5px;
  /* Своя строка: можно переносить длинный текст, а не выдавливать соседа */
  max-width: 100%; line-height: 1.4; text-align: left;
}
/* В попапе со списком проблем строки не переносим — там места хватает */
.card-badges-popover .clarity-badge { white-space: nowrap; }
/* «Понятно» на карточке не рисуется: норма не нуждается в плашке.
   Правило оставлено для панели задачи. */
.clarity-green { background: var(--bg); color: var(--muted); }
.clarity-yellow { background: var(--yellow-dim); color: var(--yellow); }
.clarity-red { background: var(--red-dim); color: var(--red); }

.status-badge {
  padding: 2px 8px; border-radius: var(--r-pill); font-size: 10px; font-weight: 700;
  background: var(--bg); color: var(--muted);
}

.card-meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.meta-tag { padding: 2px 8px; border-radius: var(--r-pill); background: var(--bg); color: var(--muted); font-size: 10px; font-weight: 600; }
.meta-project { padding: 2px 8px; border-radius: var(--r-pill); background: var(--bg); color: var(--muted); font-size: 10px; font-weight: 600; }

/* Строка исполнителя (новое) */
.card-assignee { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.assignee-who { display: flex; align-items: center; gap: 6px; font-size: 11px; min-width: 0; }
.assignee-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* Не курсив — Inter грузится только прямым начертанием (без italic-файлов),
   браузер сам «докручивал» наклон синтетически, и текст выбивался из
   остального шрифта на карточке. Отличие «свободна» от имени исполнителя
   и так видно по цвету — второго сигнала не нужно. */
.assignee-free { color: var(--muted); }
.pending-chip {
  padding: 2px 8px; border-radius: var(--r-pill); font-size: 10px; font-weight: 700;
  background: var(--yellow-dim); color: var(--yellow); white-space: nowrap;
}

.card-timeline { display: flex; justify-content: space-between; align-items: center; }
.timeline-label { font-size: 10px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.4px; }
.timeline-date { font-size: 13px; font-weight: 700; }
.timeline-date.urgent { color: var(--red); }
.timeline-date.soon { color: var(--yellow); }

.card-budget { display: flex; flex-direction: column; gap: 3px; }
.budget-top { display: flex; justify-content: space-between; align-items: center; }
.budget-label { font-size: 10px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.4px; }
.budget-nums { font-size: 10px; font-weight: 700; }
.bar-bg { height: 5px; background: var(--border); border-radius: 3px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 3px; transition: width 0.3s; }
.bar-calm { background: var(--calm); }   /* до 80% полоска молчит */
.bar-yellow { background: var(--yellow); }
.bar-red { background: var(--red); }

/* ===== DETAIL PANEL ===== */
.detail-header { padding: 18px 20px; background: var(--surface2); border-radius: var(--r-lg) var(--r-lg) 0 0; }
.detail-name { font-size: 17px; font-weight: 800; line-height: 1.3; margin-bottom: 6px; letter-spacing: -0.3px; }
.detail-meta-row { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.detail-body { padding: 16px 18px; display: flex; flex-direction: column; gap: 14px; }
.detail-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.detail-field { display: flex; flex-direction: column; gap: 3px; }
.detail-field-label { font-size: 10px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; }
.detail-field-val { font-size: 12px; font-weight: 600; }
.detail-section { display: flex; flex-direction: column; gap: 6px; }
.detail-section-label { font-size: 10px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; }
.detail-text { font-size: 12px; color: var(--text); line-height: 1.6; background: var(--bg); border-radius: var(--r-md); padding: 10px 12px; min-height: 52px; }

.detail-budget-full { display: flex; flex-direction: column; gap: 6px; }
.detail-budget-row { display: flex; justify-content: space-between; align-items: center; }
.detail-budget-label { font-size: 11px; font-weight: 600; }
.detail-budget-val { font-size: 12px; font-weight: 800; }
.detail-bar-bg { height: 8px; background: var(--border); border-radius: 4px; overflow: hidden; }
.detail-bar-fill { height: 100%; border-radius: 4px; transition: width 0.4s; }

/* Блок назначения в детальной панели (новое) */
.assign-box {
  background: var(--bg);
  border-radius: var(--r-md); padding: 12px 14px;
  display: flex; flex-direction: column; gap: 9px;
}
.assign-top { display: flex; align-items: center; gap: 8px; }
.assign-info { flex: 1; min-width: 0; }
.assign-role { font-size: 10px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; }
.assign-person { font-size: 12px; font-weight: 700; }
.assign-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.assign-actions .btn { flex: 1; justify-content: center; min-width: 90px; }
.assign-pending {
  background: var(--yellow-dim); color: #92610a;
  border-radius: 7px; padding: 8px 10px; font-size: 11px; line-height: 1.5;
}

.checklist { display: flex; flex-direction: column; gap: 5px; }
.check-item { display: flex; align-items: flex-start; gap: 9px; padding: 5px 0; cursor: pointer; }
.check-box { width: 16px; height: 16px; border: 2px solid var(--border); border-radius: 5px; flex-shrink: 0; margin-top: 1px; display: flex; align-items: center; justify-content: center; transition: all 0.15s; }
.check-box.checked { background: var(--green); border-color: var(--green); color: #fff; font-size: 9px; animation: check-pop 0.25s cubic-bezier(0.34, 1.56, 0.64, 1); }
.check-item:active .check-box { transform: scale(0.85); }
@keyframes check-pop {
  0% { transform: scale(0.6); }
  60% { transform: scale(1.15); }
  100% { transform: scale(1); }
}
.check-text { font-size: 12px; line-height: 1.4; }
.check-text.checked { text-decoration: line-through; color: var(--muted); }

.ai-section { background: var(--accent-dim); border-radius: var(--r-md); padding: 10px 12px; }
.ai-section-label { font-size: 10px; font-weight: 700; color: var(--accent); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 5px; }
.ai-section-text { font-size: 11px; color: var(--text); line-height: 1.6; }

.detail-empty { padding: 40px 24px; text-align: center; color: var(--muted); font-size: 13px; line-height: 1.7; }
.detail-empty-icon { font-size: 28px; margin-bottom: 10px; }

/* ===== MODAL ===== */
.overlay {
  position: fixed; inset: 0; background: rgba(18,20,22,0.4); backdrop-filter: blur(6px);
  z-index: 50; display: flex; align-items: center; justify-content: center; padding: 20px;
  animation: overlay-in 0.2s ease;
}
.modal {
  background: var(--surface); border-radius: var(--r-lg); width: 100%; max-width: 520px;
  max-height: 90vh; overflow-y: auto; box-shadow: 0 24px 70px rgba(18,20,22,0.28);
  animation: modal-in 0.25s cubic-bezier(0.25, 1, 0.5, 1);
}
@keyframes overlay-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes modal-in {
  from { opacity: 0; transform: translateY(14px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.modal-sm { max-width: 400px; }
.modal-detail { max-width: 560px; position: relative; }
.modal-detail .detail-header { padding-right: 46px; border-radius: var(--r-lg) var(--r-lg) 0 0; }
.modal-x-float { position: absolute; top: 13px; right: 15px; font-size: 22px; }
.modal-hdr { padding: 20px 24px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.modal-title { font-size: 16px; font-weight: 800; letter-spacing: -0.3px; }
.modal-x { background: none; border: none; font-size: 20px; color: var(--muted); cursor: pointer; line-height: 1; padding: 2px; }
.modal-x:hover { color: var(--text); }
.modal-body { padding: 20px 24px; display: flex; flex-direction: column; gap: 14px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; }

/* Замена браузерного confirm() — та же модалка, что и везде в приложении,
   просто без шапки: короткий вопрос не нуждается в заголовке с крестиком.
   Кнопки по центру (не flex-end, как у форм) — контент над ними тоже
   центрирован, вплотную к правому краю они смотрелись перекошенными. */
.modal-confirm { max-width: 340px; }
.modal-confirm .modal-footer { justify-content: center; }
.modal-confirm .modal-footer .btn { flex: 1; justify-content: center; }
.confirm-body { align-items: center; text-align: center; padding-top: 28px; }
.confirm-icon {
  width: 48px; height: 48px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; margin-bottom: 2px;
  background: var(--accent-dim); color: var(--accent);
}
.confirm-icon.danger { background: var(--red-dim); color: var(--red); }
.confirm-message { font-size: 14px; line-height: 1.6; color: var(--text); white-space: pre-line; }

/* Экран полного падения — поверх всего, включая сайдбар: если сломалось
   что-то в отрисовке, доверять остальной странице тоже нельзя. Не .overlay
   (тот скрыт по умолчанию через .hidden) — этот элемент существует только
   когда реально нужен, вставляется в document.body из JS. */
.crash-screen {
  position: fixed; inset: 0; z-index: 500;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg); padding: 24px; text-align: center;
  animation: overlay-in 0.2s ease;
}
.crash-card {
  max-width: 380px; background: var(--surface); border-radius: var(--r-lg);
  box-shadow: var(--shadow-float); padding: 36px 28px;
}
.crash-icon {
  width: 48px; height: 48px; border-radius: 50%; margin: 0 auto 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; background: var(--red-dim); color: var(--red);
}
.crash-title { font-size: 17px; font-weight: 800; margin-bottom: 6px; }
.crash-sub { font-size: 13px; color: var(--muted); line-height: 1.6; margin-bottom: 20px; }
/* .btn — блочный flex (display:flex), text-align родителя на него не
   действует, поэтому висел прижатым влево вместо центра под текстом. */
.crash-card .btn { margin: 0 auto; }

.fg { display: flex; flex-direction: column; gap: 5px; }
.flabel { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.4px; }
.finput, .fselect, .ftextarea {
  background: var(--bg); border: 1px solid transparent; border-radius: var(--r-md);
  padding: 10px 13px; font-size: 13px; color: var(--text); outline: none;
  font-family: inherit; width: 100%; transition: border-color 0.15s;
}
.finput:focus, .fselect:focus, .ftextarea:focus { border-color: var(--accent); }
.ftextarea { resize: vertical; min-height: 64px; }

/* Кастомные выпадающие списки вместо нативных <select> — раскрытый список
   опций рисует сам браузер, системным рендерером, CSS его форму не берёт
   ни в одном браузере. См. customSelect.js: настоящий <select> остаётся
   в DOM (спрятан классом ниже), поверх — кнопка + список в стиле
   .dropdown (тот же класс, что у меню профиля/колокольчика выше). */
.cselect { position: relative; width: 100%; }
.cselect-inline { width: auto; }
.cselect-inline .cselect-list { width: max-content; min-width: 100%; }
.cselect-native { position: absolute; opacity: 0; width: 1px; height: 1px; overflow: hidden; pointer-events: none; }
.cselect-btn { display: flex; align-items: center; justify-content: space-between; gap: 8px; text-align: left; cursor: pointer; }
.cselect-btn:disabled { cursor: not-allowed; opacity: 0.6; }
.cselect-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cselect-arrow { color: var(--muted); font-size: 10px; flex-shrink: 0; }
.cselect-list { left: 0; right: auto; top: calc(100% + 6px); width: 100%; min-width: 0; max-height: 240px; overflow-y: auto; }
.cselect-item.active { background: var(--bg); }
.cselect-item.selected { color: var(--accent); font-weight: 700; }

/* Иконка календаря у <input type="date"> рисуется браузером как platform
   control — цвет фиксированный, тёмную тему не подхватывает. В тёмной
   теме на тёмном фоне получается почти чёрная иконка на чёрном фоне —
   кликабельная зона на месте, а выглядит как «календаря нет вообще»
   (жалоба именно на это, не на само поведение пикера). */
:root[data-theme="dark"] input[type="date"]::-webkit-calendar-picker-indicator {
  filter: invert(1) brightness(1.6);
  cursor: pointer;
}

/* Кастомные стрелки number-полей вместо системных — та же причина, что
   и с датой выше: спин-баттон рисует браузер, в тёмной теме получается
   светлый прямоугольник, который ничего не знает о токенах темы. Прячем
   нативные (кросс-браузерно) и рисуем свои в customNumber.js. */
input[type="number"] { -moz-appearance: textfield; }
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.cnum { position: relative; width: 100%; }
.cnum input[type="number"] { padding-right: 28px; }
.cnum-steppers { position: absolute; top: 3px; right: 3px; bottom: 3px; width: 20px; display: flex; flex-direction: column; gap: 1px; }
.cnum-step {
  flex: 1; display: flex; align-items: center; justify-content: center;
  border: none; background: transparent; color: var(--muted); cursor: pointer;
  font-size: 8px; line-height: 1; border-radius: var(--r-sm); padding: 0;
}
.cnum-step:hover { background: var(--surface2); color: var(--accent); }
.cnum-step:active { transform: scale(0.88); }
.cnum-step:disabled { cursor: not-allowed; opacity: 0.4; background: none; }

.frow { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.fhint { font-size: 10px; color: var(--muted); line-height: 1.4; }
.limit-toggles { display: flex; gap: 8px; flex-wrap: wrap; }
.ltoggle { padding: 6px 14px; border-radius: var(--r-pill); font-size: 12px; font-weight: 600; border: 1px solid var(--border); background: var(--bg); color: var(--muted); cursor: pointer; transition: all 0.15s; }
.ltoggle.on { border-color: var(--accent); background: var(--accent-dim); color: var(--accent); }
/* Включённая пилюля выключается повторным кликом по ней же, но сама по себе
   она об этом никак не сообщала — а «＋ Свой» ещё и продолжала показывать
   плюс во включённом состоянии, читаясь как «добавить», а не «убрать».
   Крестик у активной пилюли — единственный видимый признак, что лимит
   можно снять. */
.ltoggle.on::after { content: '×'; margin-left: 7px; font-size: 13px; line-height: 1; opacity: 0.75; }
.ltoggle.on:hover::after { opacity: 1; }
.lfields { display: flex; flex-direction: column; gap: 12px; }
/* У каждого включённого лимита — своя шапка с крестиком: повторный клик по
   пилюле выше работает, но сам по себе не подсказывает, что лимит вообще
   можно убрать. Крестик — явная кнопка удаления, одна на каждый лимит. */
.lf-group { display: flex; flex-direction: column; gap: 8px; }
.lf-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.lf-title { font-size: 11px; font-weight: 800; color: var(--text); text-transform: uppercase; letter-spacing: 0.4px; }
.lf-remove {
  width: 22px; height: 22px; flex-shrink: 0; border: none; cursor: pointer;
  border-radius: 50%; background: transparent; color: var(--muted);
  font-size: 16px; line-height: 1; display: flex; align-items: center; justify-content: center;
  font-family: inherit; transition: background 0.15s, color 0.15s, transform 0.15s;
}
.lf-remove:hover { background: var(--red-dim); color: var(--red); }
.lf-remove:active { transform: scale(0.88); }

/* Редактор чеклиста в форме задачи */
.cl-list { display: flex; flex-direction: column; gap: 6px; }
.cl-list:empty { display: none; }
.cl-row { display: flex; align-items: center; gap: 8px; }
.cl-row .finput { flex: 1; min-width: 0; }
.cl-flag { color: var(--green); font-weight: 800; flex-shrink: 0; }
.hidden { display: none !important; }

.member-row { display: flex; align-items: center; gap: 9px; padding: 7px 0; }
.member-info { flex: 1; min-width: 0; }
.member-name { font-size: 12px; font-weight: 600; }
.member-email { font-size: 11px; color: var(--muted); }
.member-role { font-size: 10px; font-weight: 700; color: var(--muted); text-transform: uppercase; }

.alert { border-radius: var(--r-md); padding: 10px 12px; font-size: 12px; line-height: 1.5; }
.alert-error { background: var(--red-dim); color: var(--red); }
.alert-info { background: var(--accent-dim); color: var(--accent); word-break: break-all; }
.alert-warning { background: var(--yellow-dim); color: #92400e; }
.verify-banner { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin: 12px 24px 0; }
.verify-banner > span { flex: 1; min-width: 0; }
.verify-banner.flash { animation: verify-flash 0.5s ease 2; }
@keyframes verify-flash { 50% { opacity: 0.35; } }

.toast { position: fixed; bottom: 24px; right: 24px; background: var(--toast-bg); color: #fff; border-radius: var(--r-pill); padding: 12px 20px; font-size: 13px; font-weight: 600; z-index: 100; animation: tin 0.2s ease; display: flex; align-items: center; gap: 8px; max-width: 380px; box-shadow: var(--shadow-float); }
.toast-error { background: var(--red); }
@keyframes tin { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

.loading { text-align: center; padding: 50px 24px; color: var(--muted); font-size: 13px; }
.empty-state { text-align: center; padding: 40px 24px; color: var(--muted); font-size: 13px; line-height: 1.7; }

::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ===== Классы из версии Анфисы ===== */
.focus-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 4px; }
.focus-stat { background: var(--bg); border-radius: var(--r-md); padding: 10px 12px; text-align: center; }
.focus-stat-num { font-size: 22px; font-weight: 800; }
.focus-stat-label { font-size: 10px; color: var(--muted); font-weight: 700; text-transform: uppercase; }
.detail-sub { font-size: 11px; color: var(--muted); margin-bottom: 8px; }
.detail-limit-note { font-size: 10px; color: var(--muted); margin-top: 2px; }


/* ============================================================
   ЭКРАН «ПРОЕКТЫ» — карточка проекта
   ============================================================ */
.project-card { cursor: pointer; }
.project-card-top { display: flex; align-items: center; gap: 8px; }
.project-card-name { font-size: 15px; font-weight: 700; letter-spacing: -0.2px; }
.project-card-current {
  font-size: 10px; font-weight: 800; color: var(--accent); background: var(--accent-dim);
  padding: 2px 8px; border-radius: var(--r-pill); text-transform: uppercase; letter-spacing: 0.4px;
}
.project-card-meta { font-size: 11px; color: var(--muted); }
.project-card-actions { display: flex; gap: 8px; align-self: flex-start; }
.project-card-del { color: var(--red); }

/* ============================================================
   МОБИЛЬНАЯ ВЁРСТКА

   Рельс с иконками слева на телефоне мешал дважды: съедал
   ширину и прятал подписи в hover, которого на телефоне нет.
   Поэтому до 700px он превращается в нижнюю полосу с подписями.
   ============================================================ */
@media (max-width: 700px) {

  /* --- Навигация: рельс слева → плавающая пилюля снизу --- */
  .sidebar {
    top: auto; right: 12px; bottom: 12px; left: 12px; width: auto; height: 62px;
    flex-direction: row; align-items: stretch; padding: 6px; gap: 0;
    border-radius: var(--r-pill); box-shadow: var(--shadow-float);
  }
  .sidebar-logo, .sidebar-spacer { display: none; }
  .nav-btn {
    flex: 1; width: auto; height: auto; border-radius: var(--r-pill); padding: 6px 2px;
    flex-direction: column; justify-content: center; gap: 3px; font-size: 15px;
  }
  .nav-btn.active { background: var(--brand-gradient); color: #fff; box-shadow: var(--shadow-brand); }
  /* «Новая задача» — только плюс, подпись не влезает седьмой в ряд */
  #btn-new-task { flex: 0 0 46px; color: var(--brand); font-size: 20px; }
  #btn-new-task.active { color: #fff; }

  /* Полотно во всю ширину, но не под нижней полосой */
  .main { margin-left: 0; padding-bottom: 86px; }
  .toast { bottom: 98px; left: 12px; right: 12px; max-width: none; }

  /* --- Шапка ---
     На узких экранах сумма минимальных ширин (тайтл + селект проекта +
     три круглые кнопки с текстовым паддингом + аватар) не влезала —
     заголовок схлопывался в 0 (overflow:hidden обнуляет авто-минимум
     флекс-айтема), а следующим за ним начинал обрезаться уже аватар.
     Фикс с двух сторон: заголовку — ненулевой пол вместо схлопывания,
     круглым кнопкам и аватарке — flex-shrink:0, чтобы сжимался только
     текст, а не круглые элементы. */
  .topbar { padding: 10px 12px; gap: 6px; margin: 8px 8px 0; border-radius: var(--r-md); top: 8px; }
  .topbar-title {
    font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    min-width: 32px; flex-shrink: 3;
  }
  .project-select { max-width: 28vw; flex-shrink: 2; }
  .topbar .btn-ghost { padding: 8px; width: 34px; height: 34px; justify-content: center; flex-shrink: 0; }
  #btn-new-task-2 { display: none; }   /* дублирует плюс в нижней полосе */
  .user-name { display: none; }        /* остаётся аватарка */
  .user-chip { flex-shrink: 0; }

  /* --- Полотно --- */
  .page { padding: 14px 12px; }
  .verify-banner { margin: 10px 12px 0; }

  /* Колонки дашборда друг под другом, а не сжатыми в один ряд */
  .progress-col, .focus-col { flex: 1 1 100%; min-width: 0; }

  /* Парные поля — в один столбец */
  .frow, .detail-row { grid-template-columns: 1fr; }

  /* --- Модалки открываются снизу, как лист --- */
  .overlay { padding: 0; align-items: flex-end; }
  .modal {
    max-width: none; max-height: 92vh; border-radius: var(--r-lg) var(--r-lg) 0 0;
    animation: modal-in-sheet 0.28s cubic-bezier(0.25, 1, 0.5, 1);
  }
  @keyframes modal-in-sheet {
    from { opacity: 0; transform: translateY(100%); }
    to { opacity: 1; transform: translateY(0); }
  }
  .modal-hdr, .modal-body, .modal-footer { padding: 16px; }
  /* Формы длинные: без этого «Добавить» уезжает за скролл */
  .modal-footer {
    flex-wrap: wrap; position: sticky; bottom: 0; background: var(--surface);
  }

  /* Safari на iOS зумит страницу, если у поля шрифт меньше 16px */
  .finput, .fselect, .ftextarea { font-size: 16px; }

  /* Пальцем в мелкую кнопку не попасть */
  .btn { min-height: 34px; }
  .filt { min-height: 30px; }
}

/* ============================================================
   ПЕРЕКЛЮЧАТЕЛИ В ОКНЕ «НАСТРОИТЬ»

   Настоящий checkbox спрятан, но остаётся на месте: так работают
   клавиатура и щелчок по всей строке. Видимый переключатель —
   соседний span.
   ============================================================ */
.wset { display: flex; align-items: center; gap: 12px; padding: 11px 0; cursor: pointer; }
.wset + .wset { border-top: 1px solid var(--border); }
.wset-name { flex: 1; font-size: 13px; font-weight: 600; }
.wset-box { position: absolute; opacity: 0; width: 0; height: 0; }
.wset-sw {
  width: 34px; height: 20px; border-radius: 10px; background: var(--accent);
  position: relative; flex-shrink: 0; transition: background 0.15s;
}
.wset-sw::after {
  content: ''; position: absolute; top: 2px; left: 16px;
  width: 16px; height: 16px; border-radius: 50%; background: #fff;
  transition: left 0.15s;
}
.wset-sw.off { background: var(--border); }
.wset-sw.off::after { left: 2px; }
.wset-box:focus-visible + .wset-sw { box-shadow: 0 0 0 2px var(--accent-dim); }

/* ============================================================
   ЭКРАН «ТАЙМЛАЙН»

   Каждая строка — свой мини-grid с одинаковыми пропорциями колонок
   (название | дорожка | дата), а не общий grid на весь блок: так
   проще гарантировать, что колонки не разъедутся при любом числе
   строк. Метка «сегодня» рисуется в каждой дорожке отдельно —
   визуально читается как общая линия, потому что строки идут
   вплотную одна под другой.
   ============================================================ */
.timeline-card {
  background: var(--surface); border-radius: var(--r-lg);
  box-shadow: var(--shadow-card); padding: 20px 22px 16px;
}
.timeline-body { display: flex; flex-direction: column; }
.timeline-row {
  display: grid;
  grid-template-columns: minmax(110px, 200px) 1fr minmax(56px, 78px);
  column-gap: 14px; align-items: center;
  padding: 10px 0;
}
/* Верхний паддинг даёт место для пилюли «Сегодня» (position:absolute,
   отрицательный top) внутри самой карточки — без него пилюля повисала
   over card, оторванная от тика, которому подписана. */
.timeline-header-row { padding: 20px 0 18px; }
.timeline-axis-labels {
  display: flex; justify-content: space-between;
  font-size: 10px; font-weight: 700; color: var(--muted);
}
.timeline-row-label { min-width: 0; }
.timeline-row-name {
  font-size: 13px; font-weight: 700; line-height: 1.3;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.timeline-row-meta { font-size: 10px; color: var(--muted); margin-top: 2px; }
.timeline-row-track { position: relative; min-width: 0; height: 20px; }
.timeline-track-bg {
  position: absolute; top: 50%; left: 0; right: 0; height: 2px;
  background: var(--border); transform: translateY(-50%); border-radius: 1px;
}
.timeline-today-tick {
  position: absolute; top: -2px; bottom: -2px; width: 2px;
  background: var(--accent); opacity: 0.35; pointer-events: none;
}
.timeline-header-row .timeline-today-tick { top: -16px; bottom: -6px; opacity: 0.5; }
/* Раньше — голый текст поверх ряда с датами: рядом с «01.08» читалось
   как обрезанная вёрстка, а не как отдельный элемент. Пилюля с фоном
   визуально отделяет её от дат оси, даже когда обе подписи в кадре
   одновременно (edge-labels скрываются только при реальной тесноте —
   см. hideMaxLabel/hideMinLabel в render.js). */
.timeline-today-label {
  position: absolute; top: -22px; left: 2px; transform: translateX(-50%);
  font-size: 9px; font-weight: 800; color: var(--accent);
  text-transform: uppercase; letter-spacing: 0.4px; white-space: nowrap;
  background: var(--accent-dim); padding: 3px 8px; border-radius: var(--r-pill);
}
/* У краёв оси центрирование транформом уводит пилюлю за границу
   карточки — возле правого края растёт влево от тика, возле левого
   вправо, оба раза без translateX, только по центру безопасно. */
.timeline-today-label-end { left: auto; right: 2px; transform: none; }
.timeline-today-label-start { left: 2px; transform: none; }
.timeline-pin {
  position: absolute; top: 50%; width: 12px; height: 12px; border-radius: 50%;
  transform: translate(-50%, -50%); border: 2px solid var(--surface);
  box-shadow: 0 1px 4px rgba(18,20,22,0.25); z-index: 1;
}
.timeline-pin.sig-red    { background: var(--red); }
.timeline-pin.sig-yellow { background: var(--yellow); }
.timeline-pin.sig-ok     { background: var(--sig-ok); }
.timeline-pin.sig-done   { background: var(--calm-soft); }
/* Отрезок «начало → дедлайн» — только у задач с плановым стартом,
   у остальных строк остаётся просто точка дедлайна на оси. */
.timeline-range {
  position: absolute; top: 50%; height: 5px; min-width: 5px;
  border-radius: 3px; transform: translateY(-50%); opacity: 0.4;
}
.timeline-range.sig-red    { background: var(--red); }
.timeline-range.sig-yellow { background: var(--yellow); }
.timeline-range.sig-ok     { background: var(--sig-ok); }
.timeline-range.sig-done   { background: var(--calm-soft); }
.timeline-row-date { font-size: 11px; font-weight: 700; text-align: right; }
.t-date-red    { color: var(--red); }
.t-date-yellow { color: var(--yellow-ink); }
.t-date-ok     { color: var(--muted); }
.t-date-done   { color: var(--muted); }
.timeline-row.is-clickable:hover .timeline-row-name { color: var(--accent); }
.timeline-row.is-clickable:hover .timeline-pin { transform: translate(-50%, -50%) scale(1.25); }
.timeline-row.is-clickable:hover .timeline-range { opacity: 0.65; }

@media (max-width: 700px) {
  .timeline-row { grid-template-columns: minmax(90px, 140px) 1fr 56px; }
  .timeline-row-meta { display: none; }
}
