/* ===================== Шрифт (Manrope, self-hosted) ===================== */
@font-face {
  font-family: 'Manrope';
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
  src: url('/vendor/fonts/manrope-cyrillic.woff2') format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: 'Manrope';
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
  src: url('/vendor/fonts/manrope-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+2000-206F, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* Inter — чёткий UI-гротеск (self-hosted, вариативный) */
@font-face {
  font-family: 'Inter'; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url('/vendor/fonts/inter-cyrillic.woff2') format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: 'Inter'; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url('/vendor/fonts/inter-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+2000-206F, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* Golos Text — гуманистический, рисован под кириллицу (self-hosted, вариативный) */
@font-face {
  font-family: 'Golos Text'; font-style: normal; font-weight: 400 900; font-display: swap;
  src: url('/vendor/fonts/golos-cyrillic.woff2') format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: 'Golos Text'; font-style: normal; font-weight: 400 900; font-display: swap;
  src: url('/vendor/fonts/golos-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+2000-206F, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* Lora — элегантная серифная (self-hosted, вариативный) */
@font-face {
  font-family: 'Lora'; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url('/vendor/fonts/lora-cyrillic.woff2') format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: 'Lora'; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url('/vendor/fonts/lora-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+2000-206F, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ===================== Базовые (структурные) переменные ===================== */
:root {
  --font: 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Inter, Arial, sans-serif;
  --font-mono: ui-monospace, 'SF Mono', SFMono-Regular, Menlo, Consolas, monospace;
  --radius: 18px;

  /* дефолт = «Минимал, светлая» (на случай, если data-theme ещё не выставлен) */
  --bg: #f6f7f9; --panel: #ffffff; --panel2: #f1f3f6; --line: #e6e8ee;
  --text: #1b1f27; --muted: #5f6672; --faint: #9aa1ad;
  --accent: #4f46e5; --accent-2: #6366f1; --accent-soft: #eef0fe; --on-accent: #ffffff;
  --input-bg: #ffffff; --hover: #eef0f4;
  --sidebar: #ffffff; --sidebar-fg: #1b1f27; --sidebar-text: #5f6672;
  --sidebar-active: #eef0fe; --sidebar-border: #e6e8ee; --sidebar-btn-border: #e6e8ee; --sidebar-hover: #f1f3f6;
  --shadow: 0 6px 20px rgba(20, 24, 33, 0.06);

  /* статусы/приоритеты (детально переопределяются по режиму -light / -dark) */
  --st-new: #dc4a54; --st-wip: #d98324; --st-review: #1f78c2; --st-done: #1f9d57;
  --p0: #d23f4a; --p1: #d98324; --p2: #8b97a6;
}

/* Шрифт интерфейса (выбор пользователя). По умолчанию — Manrope из :root. */
[data-font="inter"] { --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif; }
[data-font="golos"] { --font: 'Golos Text', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif; }
[data-font="lora"]  { --font: 'Lora', Georgia, 'Times New Roman', serif; }

/* ===================== ТЕМЫ: 4 палитры × режим (light / dark) ===================== */

/* — Минимал — нейтральная, индиго-акцент — */
[data-theme="minimal-light"] {
  --bg: #f6f7f9; --panel: #ffffff; --panel2: #f1f3f6; --line: #e6e8ee;
  --text: #1b1f27; --muted: #5f6672; --faint: #9aa1ad;
  --accent: #4f46e5; --accent-2: #6366f1; --accent-soft: #eef0fe; --on-accent: #fff;
  --input-bg: #fff; --hover: #eef0f4;
  --sidebar: #ffffff; --sidebar-fg: #1b1f27; --sidebar-text: #5f6672;
  --sidebar-active: #eef0fe; --sidebar-border: #e6e8ee; --sidebar-btn-border: #e6e8ee; --sidebar-hover: #f1f3f6;
  --shadow: 0 6px 20px rgba(20, 24, 33, 0.06);
}
[data-theme="minimal-dark"] {
  --bg: #0f1115; --panel: #171a21; --panel2: #1d212a; --line: #2a2f3a;
  --text: #e7e9ee; --muted: #9aa1ad; --faint: #646b78;
  --accent: #6366f1; --accent-2: #818cf8; --accent-soft: rgba(99,102,241,.18); --on-accent: #fff;
  --input-bg: #1d212a; --hover: #232834;
  --sidebar: #0b0d11; --sidebar-fg: #fff; --sidebar-text: #9aa1ad;
  --sidebar-active: rgba(255,255,255,.08); --sidebar-border: rgba(255,255,255,.05); --sidebar-btn-border: rgba(255,255,255,.14); --sidebar-hover: rgba(255,255,255,.08);
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
}

/* — Legal — графит и стальной синий — */
[data-theme="legal-light"] {
  --bg: #eef1f5; --panel: #ffffff; --panel2: #f3f6fa; --line: #dce3ec;
  --text: #16202c; --muted: #586575; --faint: #8b97a6;
  --accent: #1f5fa6; --accent-2: #4a86c9; --accent-soft: #e6eef8; --on-accent: #fff;
  --input-bg: #fff; --hover: #e9eff6;
  --sidebar: #14202e; --sidebar-fg: #fff; --sidebar-text: #9fb1c4;
  --sidebar-active: rgba(255,255,255,.10); --sidebar-border: rgba(255,255,255,.06); --sidebar-btn-border: rgba(255,255,255,.15); --sidebar-hover: rgba(255,255,255,.08);
  --shadow: 0 8px 24px rgba(20, 32, 46, 0.08);
}
[data-theme="legal-dark"] {
  --bg: #0c141e; --panel: #131e2b; --panel2: #182433; --line: #283749;
  --text: #e3ebf3; --muted: #93a3b5; --faint: #61707f;
  --accent: #3d8bd4; --accent-2: #5fa8e8; --accent-soft: rgba(61,139,212,.18); --on-accent: #fff;
  --input-bg: #182433; --hover: #1d2a3a;
  --sidebar: #0a111a; --sidebar-fg: #fff; --sidebar-text: #93a3b5;
  --sidebar-active: rgba(255,255,255,.08); --sidebar-border: rgba(255,255,255,.05); --sidebar-btn-border: rgba(255,255,255,.14); --sidebar-hover: rgba(255,255,255,.08);
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

/* — Тёплая — бумага и терракота — */
[data-theme="warm-light"] {
  --bg: #f5efe6; --panel: #fffdf8; --panel2: #f1e9db; --line: #e6dccb;
  --text: #2b2218; --muted: #8a7a64; --faint: #b3a48b;
  --accent: #c2410c; --accent-2: #e2723a; --accent-soft: #f6e7d6; --on-accent: #fff;
  --input-bg: #fffdf8; --hover: #f1e9db;
  --sidebar: #2a2118; --sidebar-fg: #fff; --sidebar-text: #d6c6b1;
  --sidebar-active: rgba(255,255,255,.09); --sidebar-border: rgba(255,255,255,.06); --sidebar-btn-border: rgba(255,255,255,.15); --sidebar-hover: rgba(255,255,255,.08);
  --shadow: 0 10px 28px rgba(74, 54, 30, 0.10);
}
[data-theme="warm-dark"] {
  --bg: #15110c; --panel: #1f1810; --panel2: #271e14; --line: #382c1d;
  --text: #f0e7d8; --muted: #b3a48b; --faint: #7d6f5a;
  --accent: #e2723a; --accent-2: #f0925f; --accent-soft: rgba(226,114,58,.18); --on-accent: #2b1a0d;
  --input-bg: #271e14; --hover: #2b2114;
  --sidebar: #1a140d; --sidebar-fg: #fff; --sidebar-text: #b3a48b;
  --sidebar-active: rgba(255,255,255,.08); --sidebar-border: rgba(255,255,255,.05); --sidebar-btn-border: rgba(255,255,255,.14); --sidebar-hover: rgba(255,255,255,.08);
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

/* — Яркая — фиолетовая — */
[data-theme="vivid-light"] {
  --bg: #f4f5f8; --panel: #ffffff; --panel2: #f1f1f8; --line: #e7e7f0;
  --text: #1a1b23; --muted: #6a6f7d; --faint: #a0a4b3;
  --accent: #7c3aed; --accent-2: #9d5cf5; --accent-soft: #f0e9fe; --on-accent: #fff;
  --input-bg: #fff; --hover: #efeefa;
  --sidebar: #1b1530; --sidebar-fg: #fff; --sidebar-text: #b9add6;
  --sidebar-active: rgba(255,255,255,.10); --sidebar-border: rgba(255,255,255,.06); --sidebar-btn-border: rgba(255,255,255,.15); --sidebar-hover: rgba(255,255,255,.08);
  --shadow: 0 8px 24px rgba(36, 24, 64, 0.10);
}
[data-theme="vivid-dark"] {
  --bg: #100c1a; --panel: #181228; --panel2: #1f1733; --line: #2e2546;
  --text: #e9e6f3; --muted: #a99fc2; --faint: #6f6588;
  --accent: #9d5cf5; --accent-2: #b985f8; --accent-soft: rgba(157,92,245,.20); --on-accent: #fff;
  --input-bg: #1f1733; --hover: #251c3c;
  --sidebar: #0e0a18; --sidebar-fg: #fff; --sidebar-text: #a99fc2;
  --sidebar-active: rgba(255,255,255,.08); --sidebar-border: rgba(255,255,255,.05); --sidebar-btn-border: rgba(255,255,255,.14); --sidebar-hover: rgba(255,255,255,.08);
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

/* — Багровый — глубокий красный — */
[data-theme="crimson-light"] {
  --bg: #f9f1f1; --panel: #ffffff; --panel2: #f6e8e8; --line: #f0dada;
  --text: #2a1315; --muted: #8a6568; --faint: #b8989a;
  --accent: #dc2626; --accent-2: #ef4444; --accent-soft: #fbe3e3; --on-accent: #fff;
  --input-bg: #fff; --hover: #f6eaea;
  --sidebar: #2a1315; --sidebar-fg: #fff; --sidebar-text: #d8b5b7;
  --sidebar-active: rgba(255,255,255,.10); --sidebar-border: rgba(255,255,255,.06); --sidebar-btn-border: rgba(255,255,255,.15); --sidebar-hover: rgba(255,255,255,.08);
  --shadow: 0 10px 28px rgba(74, 20, 24, 0.10);
}
[data-theme="crimson-dark"] {
  --bg: #160c0d; --panel: #221517; --panel2: #2a191b; --line: #3a2528;
  --text: #f4e4e5; --muted: #c4a4a6; --faint: #8a6a6d;
  --accent: #ef4444; --accent-2: #f87171; --accent-soft: rgba(239,68,68,.18); --on-accent: #fff;
  --input-bg: #2a191b; --hover: #301d20;
  --sidebar: #120a0b; --sidebar-fg: #fff; --sidebar-text: #c4a4a6;
  --sidebar-active: rgba(255,255,255,.08); --sidebar-border: rgba(255,255,255,.05); --sidebar-btn-border: rgba(255,255,255,.14); --sidebar-hover: rgba(255,255,255,.08);
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

/* — Бирюза — бирюзовая, морская — */
[data-theme="teal-light"] {
  --bg: #eef4f3; --panel: #ffffff; --panel2: #e6efed; --line: #d5e3e0;
  --text: #0f2723; --muted: #577069; --faint: #93aca6;
  --accent: #0d9488; --accent-2: #14b8a6; --accent-soft: #d6f0ec; --on-accent: #fff;
  --input-bg: #fff; --hover: #e8f1ef;
  --sidebar: #0e2b27; --sidebar-fg: #fff; --sidebar-text: #a0c4bd;
  --sidebar-active: rgba(255,255,255,.10); --sidebar-border: rgba(255,255,255,.06); --sidebar-btn-border: rgba(255,255,255,.15); --sidebar-hover: rgba(255,255,255,.08);
  --shadow: 0 8px 24px rgba(15, 42, 38, 0.10);
}
[data-theme="teal-dark"] {
  --bg: #071513; --panel: #0f211e; --panel2: #142a26; --line: #213a35;
  --text: #d7efe9; --muted: #8bb3aa; --faint: #5a7d75;
  --accent: #14b8a6; --accent-2: #2dd4bf; --accent-soft: rgba(20,184,166,.18); --on-accent: #04231f;
  --input-bg: #142a26; --hover: #19332e;
  --sidebar: #050f0d; --sidebar-fg: #fff; --sidebar-text: #8bb3aa;
  --sidebar-active: rgba(255,255,255,.08); --sidebar-border: rgba(255,255,255,.05); --sidebar-btn-border: rgba(255,255,255,.14); --sidebar-hover: rgba(255,255,255,.08);
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

/* — Олива — оливково-лаймовая — */
[data-theme="olive-light"] {
  --bg: #f2f4ea; --panel: #ffffff; --panel2: #edf1e0; --line: #dde4c9;
  --text: #21260f; --muted: #6a7350; --faint: #a6ad86;
  --accent: #4d7c0f; --accent-2: #65a30d; --accent-soft: #eaf3d3; --on-accent: #fff;
  --input-bg: #fff; --hover: #eef2e3;
  --sidebar: #242a12; --sidebar-fg: #fff; --sidebar-text: #c2c89e;
  --sidebar-active: rgba(255,255,255,.10); --sidebar-border: rgba(255,255,255,.06); --sidebar-btn-border: rgba(255,255,255,.15); --sidebar-hover: rgba(255,255,255,.08);
  --shadow: 0 8px 24px rgba(40, 46, 16, 0.10);
}
[data-theme="olive-dark"] {
  --bg: #11140a; --panel: #1b1f10; --panel2: #222813; --line: #333a1f;
  --text: #e9eed7; --muted: #aab488; --faint: #767e58;
  --accent: #84cc16; --accent-2: #a3e635; --accent-soft: rgba(132,204,22,.18); --on-accent: #1a2206;
  --input-bg: #222813; --hover: #282f17;
  --sidebar: #0d1008; --sidebar-fg: #fff; --sidebar-text: #aab488;
  --sidebar-active: rgba(255,255,255,.08); --sidebar-border: rgba(255,255,255,.05); --sidebar-btn-border: rgba(255,255,255,.14); --sidebar-hover: rgba(255,255,255,.08);
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

/* — Сталь — холодный серо-синий металл — */
[data-theme="slate-light"] {
  --bg: #f1f3f5; --panel: #ffffff; --panel2: #e9edf1; --line: #dbe1e8;
  --text: #1a2129; --muted: #5c6773; --faint: #97a1ad;
  --accent: #475569; --accent-2: #64748b; --accent-soft: #e4e8ee; --on-accent: #fff;
  --input-bg: #fff; --hover: #e8ecf1;
  --sidebar: #1f2a37; --sidebar-fg: #fff; --sidebar-text: #9fadbd;
  --sidebar-active: rgba(255,255,255,.10); --sidebar-border: rgba(255,255,255,.06); --sidebar-btn-border: rgba(255,255,255,.15); --sidebar-hover: rgba(255,255,255,.08);
  --shadow: 0 8px 24px rgba(20, 28, 38, 0.08);
}
[data-theme="slate-dark"] {
  --bg: #0d1117; --panel: #161c24; --panel2: #1c232d; --line: #2b3543;
  --text: #dde3ea; --muted: #93a0af; --faint: #626f7e;
  --accent: #94a3b8; --accent-2: #cbd5e1; --accent-soft: rgba(148,163,184,.18); --on-accent: #0d1117;
  --input-bg: #1c232d; --hover: #222b36;
  --sidebar: #090d12; --sidebar-fg: #fff; --sidebar-text: #93a0af;
  --sidebar-active: rgba(255,255,255,.08); --sidebar-border: rgba(255,255,255,.05); --sidebar-btn-border: rgba(255,255,255,.14); --sidebar-hover: rgba(255,255,255,.08);
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

/* — Статусы/приоритеты/теги для СВЕТЛЫХ режимов — */
[data-theme$="-light"] {
  --st-new: #dc4a54; --st-wip: #d98324; --st-review: #1f78c2; --st-done: #1f9d57;
  --p0: #d23f4a; --p1: #d98324; --p2: #8b97a6;
  --tag-gate-bg: rgba(99,102,241,.13); --tag-gate-fg: #4338ca;
  --tag-bug-bg: rgba(210,63,74,.12); --tag-bug-fg: #b03039;
  --tag-star-bg: rgba(217,131,36,.14); --tag-star-fg: #9a5e16;
  --tag-co-bg: rgba(100,116,139,.14); --tag-co-fg: #475569;
  --tag-dup-bg: rgba(124,92,255,.13); --tag-dup-fg: #6d28d9;
}

/* — Статусы/приоритеты/теги для ТЁМНЫХ режимов — */
[data-theme$="-dark"] {
  --st-new: #f06a72; --st-wip: #e6a23c; --st-review: #4aa3e8; --st-done: #34c476;
  --p0: #f06a72; --p1: #e6a23c; --p2: #6b7a8c;
  --tag-gate-bg: rgba(129,140,248,.18); --tag-gate-fg: #c7cdfb;
  --tag-bug-bg: rgba(240,106,114,.16); --tag-bug-fg: #f6a6ab;
  --tag-star-bg: rgba(230,162,60,.18); --tag-star-fg: #f1c78a;
  --tag-co-bg: rgba(147,163,181,.16); --tag-co-fg: #b8c4d2;
  --tag-dup-bg: rgba(157,92,245,.22); --tag-dup-fg: #c4b5fd;
}

* { box-sizing: border-box; }
html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  transition: background 0.2s ease, color 0.2s ease;
}
a { color: inherit; }

/* ===================== App shell ===================== */
.app { min-height: 100vh; display: grid; grid-template-columns: 248px 1fr; }

.sidebar {
  background: var(--sidebar); color: var(--sidebar-fg); padding: 22px 16px;
  display: flex; flex-direction: column; gap: 24px; border-right: 1px solid var(--sidebar-border);
}
.brand { display: flex; align-items: center; gap: 12px; padding: 8px 10px; }
.brand-mark {
  width: 38px; height: 38px; border-radius: 12px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
}
.brand-name { font-size: 20px; font-weight: 800; letter-spacing: 0.2px; }

.menu { display: flex; flex-direction: column; gap: 6px; }
.menu a {
  display: flex; align-items: center; gap: 10px; color: var(--sidebar-text);
  text-decoration: none; padding: 12px 14px; border-radius: 12px;
  font-size: 14px; font-weight: 600; transition: 0.2s ease; cursor: pointer;
}
.menu a.active, .menu a:hover { background: var(--sidebar-active); color: var(--sidebar-fg); }

.sidebar-footer { margin-top: auto; display: flex; flex-direction: column; gap: 12px; }
.sidebar-user { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 12px; background: var(--sidebar-active); }
.sidebar-user .meta { display: flex; flex-direction: column; overflow: hidden; }
.sidebar-user .name { font-size: 14px; font-weight: 700; color: var(--sidebar-fg); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user .role { font-size: 12px; color: var(--sidebar-text); }
.logout-btn {
  background: transparent; border: 1px solid var(--sidebar-btn-border); color: var(--sidebar-text);
  border-radius: 10px; padding: 9px 12px; font-size: 13px; font-weight: 600; cursor: pointer; transition: 0.2s;
}
.logout-btn:hover { background: var(--sidebar-hover); color: var(--sidebar-fg); }

.content { padding: 24px; min-width: 0; }

/* Сворачивание сайдбара */
.app { transition: grid-template-columns 0.18s ease; }
.app.sidebar-collapsed { grid-template-columns: 1fr; }
.app.sidebar-collapsed .sidebar { display: none; }

/* ===================== Topbar ===================== */
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.topbar-left { display: flex; align-items: center; gap: 14px; min-width: 0; }
.sidebar-toggle {
  flex: 0 0 auto; width: 40px; height: 40px; border-radius: 11px; border: 1px solid var(--line);
  background: var(--panel); color: var(--muted); font-size: 18px; line-height: 1; cursor: pointer;
  display: grid; place-items: center; transition: 0.15s ease;
}
.sidebar-toggle:hover { background: var(--hover); color: var(--text); border-color: var(--accent); }
.title-wrap h1 { margin: 0; font-size: 28px; font-weight: 800; letter-spacing: -0.2px; }
.title-wrap p { margin: 6px 0 0; color: var(--muted); font-size: 14px; }
.top-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ===================== Buttons ===================== */
.btn {
  border: 1px solid var(--line); background: var(--panel); color: var(--text);
  border-radius: 12px; padding: 10px 14px; font-size: 14px; font-weight: 700; font-family: inherit;
  cursor: pointer; transition: 0.15s ease; display: inline-flex; align-items: center; gap: 8px;
}
.btn:hover { background: var(--hover); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.primary:hover { filter: brightness(1.08); background: var(--accent); }
.btn.danger { color: #dc2626; border-color: rgba(220, 38, 38, 0.4); background: transparent; }
.btn.danger:hover { background: rgba(220, 38, 38, 0.12); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.small { padding: 7px 11px; font-size: 13px; border-radius: 10px; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

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

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 20px; }
.stat { padding: 18px; min-height: 96px; }
.stat .label { color: var(--muted); font-size: 13px; margin-bottom: 10px; }
.stat .value { font-size: 32px; font-weight: 800; line-height: 1; }
.stat .value.danger { color: var(--st-new); }
.stat .value.success { color: var(--st-done); }

.section-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; gap: 12px; flex-wrap: wrap; }
.section-title { font-size: 18px; font-weight: 800; margin: 0; }
.section-subtitle { font-size: 13px; color: var(--muted); margin-top: 4px; }

/* ===================== Workspace / board ===================== */
.workspace { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 20px; align-items: start; }
.board { padding: 18px; }
.sidepanel { display: flex; flex-direction: column; gap: 16px; }
.panel { padding: 18px; }

.board-columns { display: grid; grid-template-columns: repeat(4, minmax(220px, 1fr)); gap: 14px; overflow-x: auto; padding-bottom: 4px; }
.column {
  background: var(--panel2); border: 1px solid var(--line); border-radius: 16px;
  min-height: 480px; padding: 12px; display: flex; flex-direction: column; gap: 12px;
  transition: background 0.15s, border-color 0.15s;
}
.column.drag-over { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.column-head { display: flex; justify-content: space-between; align-items: center; padding-bottom: 2px; }
.column-title { font-size: 14px; font-weight: 800; display: flex; align-items: center; gap: 7px; }
.column-title .sdot { width: 9px; height: 9px; border-radius: 50%; }
.column-body { display: flex; flex-direction: column; gap: 10px; flex: 1; }
.count-badge {
  min-width: 26px; height: 26px; display: grid; place-items: center; padding: 0 8px;
  border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-size: 12px; font-weight: 800;
}

/* ===================== Task chip (redesign: мягкая карточка + рейка приоритета) ===================== */
.task {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 12px; padding: 10px 12px 10px 14px; position: relative; cursor: grab; overflow: hidden;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  transition: transform 0.14s ease, box-shadow 0.18s ease, border-color 0.12s;
}
.task::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--prio, var(--p1)); }
.task.soft::before { opacity: 0.4; }
.task:hover { box-shadow: 0 10px 24px rgba(0, 0, 0, 0.15); border-color: color-mix(in srgb, var(--prio, var(--accent)) 55%, var(--line)); transform: translateY(-2px); }
.task.dragging { opacity: 0.4; transform: scale(0.97); }
.task.no-drag { cursor: pointer; }   /* менеджер: карточку нельзя тащить, но можно открыть кликом */
.task-top { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.task .code { color: var(--faint); font-weight: 700; font-size: 10px; letter-spacing: 0.4px; font-family: var(--font-mono); text-transform: uppercase; }
.task .ttl { display: block; margin-top: 4px; font-size: 13px; font-weight: 650; line-height: 1.4; color: var(--text); }

/* ===================== Status badge (метка статуса — заметная, своя на каждый из 4 статусов) ===================== */
.st-badge {
  display: inline-flex; align-items: center; gap: 5px; white-space: nowrap;
  font-size: 10px; font-weight: 800; line-height: 1.5; letter-spacing: 0.2px;
  padding: 2px 9px 2px 7px; border-radius: 999px;
  color: var(--sc, var(--st-new));
  background: color-mix(in srgb, var(--sc, var(--st-new)) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--sc, var(--st-new)) 32%, transparent);
}
.st-badge i { width: 7px; height: 7px; border-radius: 50%; flex: 0 0 7px; background: var(--sc, var(--st-new)); box-shadow: 0 0 0 2px color-mix(in srgb, var(--sc, var(--st-new)) 22%, transparent); }
.st-badge.st-new         { --sc: var(--st-new); }
.st-badge.st-in_progress { --sc: var(--st-wip); }
.st-badge.st-review      { --sc: var(--st-review); }
.st-badge.st-done        { --sc: var(--st-done); }
.task .tags { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 5px; }
.task-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 10px; }
.task-foot .right { display: flex; align-items: center; gap: 6px; }

.tag { font-size: 9.5px; font-weight: 700; padding: 2px 7px; border-radius: 999px; letter-spacing: 0.2px; white-space: nowrap; }
.tag.gate { background: var(--tag-gate-bg); color: var(--tag-gate-fg); }
.tag.bug { background: var(--tag-bug-bg); color: var(--tag-bug-fg); }
.tag.star { background: var(--tag-star-bg); color: var(--tag-star-fg); }
.tag.co { background: var(--tag-co-bg); color: var(--tag-co-fg); }
.tag.dup { background: var(--tag-dup-bg); color: var(--tag-dup-fg); }

.chip-date { font-size: 10.5px; font-weight: 700; color: var(--muted); }
.chip-date.overdue { color: var(--st-new); }

/* ===================== Segmented controls (pill) ===================== */
.seg { display: inline-flex; background: var(--panel2); border: 1px solid var(--line); border-radius: 999px; padding: 3px; gap: 2px; }
.seg button { background: none; border: 0; color: var(--muted); padding: 7px 14px; cursor: pointer; font-size: 13px; font-weight: 650; font-family: inherit; border-radius: 999px; transition: 0.15s; }
.seg button.active { background: var(--accent); color: var(--on-accent); box-shadow: 0 2px 8px color-mix(in srgb, var(--accent) 35%, transparent); }
.seg button:not(.active):hover { background: var(--hover); color: var(--text); }

/* ===================== Week timeline (calendar) ===================== */
.tl-nav { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.tl-range { font-weight: 800; font-size: 15px; min-width: 150px; text-align: center; }
.tl-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 18px; background: var(--panel); box-shadow: var(--shadow); }
table.tl { border-collapse: separate; border-spacing: 0; width: 100%; }
table.tl th, table.tl td { border-bottom: 1px solid var(--line); border-right: 1px solid color-mix(in srgb, var(--line) 50%, transparent); vertical-align: top; }
table.tl tbody tr:last-child td { border-bottom: 0; }
table.tl thead th { position: sticky; top: 0; z-index: 3; background: var(--panel); padding: 12px 11px; text-align: left; border-bottom: 1.5px solid var(--line); }
table.tl thead th .d { font-weight: 800; font-size: 14px; }
table.tl thead th .wd { color: var(--muted); font-size: 10px; font-weight: 700; display: block; margin-top: 3px; text-transform: uppercase; letter-spacing: 0.5px; }
table.tl thead th.today { background: color-mix(in srgb, var(--accent) 9%, var(--panel)); box-shadow: inset 0 3px 0 var(--accent); }
table.tl thead th.today .d, table.tl thead th.today .wd { color: var(--accent); }
.tl .devcol { position: sticky; left: 0; z-index: 2; background: var(--panel); min-width: 156px; max-width: 176px; padding: 12px 14px; }
.tl thead .devcol { z-index: 4; }
.tl .devcol .nm { font-weight: 750; display: flex; align-items: center; gap: 9px; font-size: 13.5px; }
.tl .devcol .role { color: var(--faint); font-size: 10.5px; margin-top: 5px; }
.tl td.cell { padding: 8px; min-width: var(--cell-w, 190px); position: relative; cursor: pointer; }
.tl td.cell.today { background: color-mix(in srgb, var(--accent) 5%, transparent); }
.tl td.cell.weekend { background: color-mix(in srgb, var(--muted) 5%, transparent); }
.tl td.cell.drop-hover { outline: 2px dashed var(--accent); outline-offset: -3px; border-radius: 12px; }
.tl .cell .task { margin-bottom: 7px; position: relative; z-index: 1; }
/* «Добавить задачу» — кликабельна вся область ячейки (оверлей по периметру), а не маленькая кнопка по наведению. */
.tl .cadd { position: absolute; inset: 5px; z-index: 0; display: grid; place-items: center; padding: 0; background: none; color: var(--faint); border: 1.5px dashed transparent; border-radius: 12px; font-size: 22px; line-height: 1; cursor: pointer; opacity: 0; transition: 0.12s; }
.tl td.cell:hover .cadd { opacity: 0.55; border-color: var(--line); }
.tl .cadd:hover { opacity: 1; color: var(--accent); border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, transparent); }
.tl-unscheduled { margin-top: 18px; padding: 16px 18px; }
.tl-unscheduled h3 { margin: 0 0 4px; font-size: 14px; font-weight: 800; }
.tl-unsched-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; margin-top: 12px; }
.tl-unsched-list.drop-hover { outline: 2px dashed var(--accent); outline-offset: 4px; border-radius: 12px; }

/* — Масштаб таймлайна + скрытие сотрудников из вида — */
.tl-zoom { display: inline-flex; align-items: center; gap: 5px; }
.tl-zoom-lbl { color: var(--muted); font-size: 12px; font-weight: 650; }
.tl-zoom .btn.small { min-width: 30px; font-size: 16px; line-height: 1; padding: 4px 9px; }
.tl-hidden { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-left: auto; }
.tl-hidden-lbl { color: var(--muted); font-size: 12px; font-weight: 650; }
.pill.restore { cursor: pointer; border: 1px solid var(--line); background: var(--panel2); color: var(--muted); font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 999px; transition: 0.12s; }
.pill.restore:hover { color: var(--text); border-color: var(--accent); background: var(--hover); }
.tl .devcol .dev-hide { position: absolute; top: 6px; right: 6px; width: 22px; height: 22px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 6px; background: none; font-size: 12px; cursor: pointer; opacity: 0; transition: 0.12s; }
.tl tbody tr:hover .dev-hide { opacity: 0.55; }
.tl .devcol .dev-hide:hover { opacity: 1; background: var(--hover); }
.tl-allhidden { padding: 18px; color: var(--muted); }
.btn:disabled { opacity: 0.4; cursor: default; }

/* ===================== Roadmap: filters / KPI / loads / details ===================== */
.rm-toolbar { margin-bottom: 20px; gap: 12px; }
/* Отделяем основной вид (таймлайн/доска) от карточек нагрузки — иначе панель навигации прилипает к ним. */
#rmMain { margin-top: 28px; }
.seg.toggle button.active { background: var(--accent); color: var(--on-accent); box-shadow: 0 2px 8px color-mix(in srgb, var(--accent) 35%, transparent); }
.legend { display: flex; flex-wrap: wrap; gap: 13px; margin-left: auto; align-items: center; color: var(--muted); font-size: 12px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 5px; vertical-align: -1px; }
.legend .b { display: inline-block; width: 14px; height: 0; border-top: 3px solid; margin-right: 5px; vertical-align: 4px; border-radius: 2px; }

.rm-sec { font-size: 12px; letter-spacing: 0.8px; text-transform: uppercase; color: var(--muted); margin: 30px 0 16px; font-weight: 800; display: flex; align-items: center; gap: 12px; }
.rm-sec::after { content: ""; flex: 1; height: 1px; background: var(--line); }

/* KPI strip */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(134px, 1fr)); gap: 12px; margin-bottom: 4px; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 15px 18px; box-shadow: var(--shadow); }
.kpi b { display: block; font-size: 26px; font-weight: 800; line-height: 1.1; letter-spacing: -0.5px; }
.kpi span { color: var(--muted); font-size: 11.5px; margin-top: 3px; display: block; }
.kpi b.todo { color: var(--st-new); }
.kpi b.wip { color: var(--st-wip); }
.kpi b.done { color: var(--st-done); }
.kpi b.p0 { color: var(--p0); }

/* Load cards */
.loads { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.load { background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 16px 17px; position: relative; overflow: hidden; box-shadow: var(--shadow); }
.load::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--c, var(--accent)); }
.load .nm { display: flex; align-items: center; gap: 9px; font-weight: 800; font-size: 15px; }
.load .role { color: var(--muted); font-size: 11.5px; margin: 5px 0 13px; }
.load .bars { display: flex; gap: 4px; align-items: flex-end; height: 34px; margin-bottom: 12px; }
.load .bar { flex: 1; border-radius: 5px; min-height: 5px; opacity: 0.85; }
.load .bar.today { opacity: 1; box-shadow: inset 0 -2px 0 var(--text); }
.load .stat { display: flex; gap: 14px; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.load .stat b { color: var(--text); font-weight: 800; }

.pill { font-size: 10.5px; padding: 3px 9px; border-radius: 999px; font-weight: 800; white-space: nowrap; }
.pill.p0 { background: var(--tag-bug-bg); color: var(--tag-bug-fg); }
.pill.warn { background: var(--tag-star-bg); color: var(--tag-star-fg); }
.pill.count { background: var(--accent-soft); color: var(--accent); }

/* Detail cards */
.detgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(440px, 1fr)); gap: 16px; }
.det { background: var(--panel); border: 1px solid var(--line); border-radius: 18px; overflow: hidden; box-shadow: var(--shadow); }
.det > summary { list-style: none; cursor: pointer; padding: 15px 17px; display: flex; align-items: center; gap: 12px; }
.det > summary::-webkit-details-marker { display: none; }
.det > summary:hover { background: var(--hover); }
.det .hnm { font-weight: 800; font-size: 15px; }
.det .hrole { color: var(--muted); font-size: 11.5px; }
.det .hcount { margin-left: auto; display: flex; gap: 6px; align-items: center; }
.det .arrow { transition: 0.2s; color: var(--muted); font-size: 18px; font-weight: 800; }
.det[open] .arrow { transform: rotate(90deg); }
.det .body { padding: 2px 17px 16px; }
.det .dot-av { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 11px; flex: 0 0 26px; }
.grp { margin-top: 14px; }
.grp h4 { font-size: 11px; letter-spacing: 0.6px; text-transform: uppercase; color: var(--muted); margin: 0 0 8px; font-weight: 800; }

.det-row { display: flex; gap: 10px; padding: 9px 11px 9px 14px; border: 1px solid var(--line); border-radius: 11px; margin-bottom: 7px; background: var(--panel2); cursor: pointer; transition: border-color 0.12s, transform 0.1s; position: relative; overflow: hidden; }
.det-row::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--prio, var(--p1)); }
.det-row.soft::before { opacity: 0.4; }
.det-row:hover { border-color: color-mix(in srgb, var(--prio, var(--accent)) 55%, var(--line)); transform: translateX(2px); }
.det-row .meta { flex: 1; min-width: 0; }
.det-row .meta .st-badge { vertical-align: middle; margin-right: 6px; }
.det-row .code { color: var(--faint); font-weight: 700; font-size: 10px; font-family: var(--font-mono); text-transform: uppercase; }
.det-row .when { float: right; font-size: 10px; color: var(--faint); font-weight: 700; margin-left: 8px; }
.det-row .when.hard { color: var(--accent); }
.det-row .ttl { font-size: 12.5px; font-weight: 600; line-height: 1.4; }
.det-row .tags { margin-top: 6px; display: flex; flex-wrap: wrap; gap: 5px; }

/* ===================== Avatars ===================== */
.avatar { width: 32px; height: 32px; border-radius: 50%; flex: 0 0 32px; display: grid; place-items: center; color: #fff; font-size: 12px; font-weight: 800; }
.avatar.lg { width: 44px; height: 44px; flex-basis: 44px; font-size: 15px; }
.avatar.sm { width: 24px; height: 24px; flex-basis: 24px; font-size: 10px; }

/* ===================== Lists / rows ===================== */
.person-row { display: flex; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.person-row:last-child { border-bottom: none; }
.person-meta { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.person-meta .name { font-weight: 700; font-size: 14px; }
.person-meta .sub { font-size: 12.5px; color: var(--muted); }

/* ===================== Table ===================== */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data th { text-align: left; color: var(--muted); font-weight: 700; font-size: 12.5px; text-transform: uppercase; letter-spacing: 0.3px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
table.data td { padding: 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.data tr:last-child td { border-bottom: none; }
table.data tr:hover td { background: var(--hover); }

.role-badge { padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.role-badge.admin { background: var(--accent-soft); color: var(--accent); }
.role-badge.manager { background: rgba(16, 185, 129, 0.16); color: #10b981; }
.role-badge.employee { background: var(--tag-co-bg); color: var(--tag-co-fg); }
.role-badge.inactive { background: rgba(220, 38, 38, 0.14); color: #dc2626; }
.role-badge.dev { background: rgba(124, 92, 255, 0.16); color: #8b5cf6; }
.mgr-note { background: var(--accent-soft); color: var(--accent); border-radius: 10px; padding: 9px 12px; font-size: 12.5px; font-weight: 600; margin-bottom: 2px; }

/* ===================== Activity ===================== */
.activity-item { display: flex; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.activity-item:last-child { border-bottom: none; }
.activity-item .text { font-size: 13px; line-height: 1.4; }
.activity-item .time { font-size: 11.5px; color: var(--muted); margin-top: 2px; }

/* ===================== Forms ===================== */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 13px; font-weight: 700; color: var(--muted); }
.field input, .field select, .field textarea {
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; font-size: 14px;
  font-family: inherit; background: var(--input-bg); color: var(--text); transition: 0.15s; width: 100%;
}
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.field textarea { resize: vertical; min-height: 80px; }
.field-hint { font-size: 11.5px; color: var(--faint); font-weight: 600; margin-top: 2px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field .afchk { flex-direction: row; align-items: center; gap: 8px; cursor: pointer; color: var(--text); }
.field .afchk input { width: auto; }
/* Кликабельный бейдж статуса в окне задачи (как в макете) */
.mb-status { display: inline-flex; align-items: center; gap: 7px; align-self: flex-start; font-family: inherit; font-size: 14px; font-weight: 700; padding: 9px 15px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel2); color: var(--text); cursor: pointer; transition: 0.15s; }
.mb-status:hover { filter: brightness(1.04); }
.mb-status:active { transform: scale(0.97); }
/* Цвет бейджа статуса в окне задачи — свой на каждый статус. */
.mb-status.st-new, .mb-status.st-in_progress, .mb-status.st-review, .mb-status.st-done {
  color: var(--sc);
  border-color: color-mix(in srgb, var(--sc) 50%, var(--line));
  background: color-mix(in srgb, var(--sc) 12%, var(--panel2));
}
.mb-status.st-new         { --sc: var(--st-new); }
.mb-status.st-in_progress { --sc: var(--st-wip); }
.mb-status.st-review      { --sc: var(--st-review); }
.mb-status.st-done        { --sc: var(--st-done); }

.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.toolbar input, .toolbar select {
  border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; font-size: 14px;
  font-family: inherit; background: var(--input-bg); color: var(--text);
}
.toolbar input:focus, .toolbar select:focus { outline: none; border-color: var(--accent); }

/* ===================== Modal ===================== */
.modal-overlay { position: fixed; inset: 0; background: rgba(2, 6, 16, 0.55); backdrop-filter: blur(3px); display: grid; place-items: center; z-index: 100; padding: 20px; animation: fade 0.15s ease; }
.modal { background: var(--panel); border: 1px solid var(--line); border-radius: 18px; width: 100%; max-width: 520px; max-height: 90vh; overflow-y: auto; box-shadow: 0 30px 70px rgba(0, 0, 0, 0.4); animation: pop 0.15s ease; }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 20px 22px 0; }
.modal-head h3 { margin: 0; font-size: 19px; font-weight: 800; }
.modal-close { background: none; border: none; font-size: 22px; color: var(--muted); cursor: pointer; line-height: 1; }
.modal-body { padding: 18px 22px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 0 22px 20px; }
.modal-error { background: rgba(220, 38, 38, 0.12); color: #dc2626; border-radius: 10px; padding: 9px 12px; font-size: 13px; margin-bottom: 14px; display: none; }
.modal-error.show { display: block; }

/* Окно задачи с боковой панелью «Заметки и файлы»: модалка сдвигается влево, справа — панель. */
.modal-overlay.has-side-notes { display: flex; align-items: center; justify-content: center; gap: 16px; }
.modal-overlay.has-side-notes .modal { flex: 0 1 520px; }
.modal-side {
  flex: 0 0 420px; max-height: 90vh; min-height: 200px;
  display: flex; flex-direction: column;
  background: var(--panel); border: 1px solid var(--line); border-radius: 18px;
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.4); animation: pop 0.15s ease; overflow: hidden;
}
.modal-side-head { padding: 20px 20px 12px; border-bottom: 1px solid var(--line); }
.modal-side-head h3 { margin: 0; font-size: 16px; font-weight: 800; }
.side-body { flex: 1; min-height: 0; overflow-y: auto; padding: 16px 20px 20px; display: flex; flex-direction: column; gap: 16px; }
.side-notes {
  flex: 0 0 auto; min-height: 120px; resize: vertical;
  border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; width: 100%;
  font-size: 14px; font-family: inherit; line-height: 1.5;
  background: var(--input-bg); color: var(--text); transition: 0.15s;
}
.side-notes:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

/* Секция вложений */
.att-section { display: flex; flex-direction: column; gap: 10px; }
.att-head { font-size: 13px; font-weight: 700; color: var(--muted); display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.att-quota { font-size: 11.5px; font-weight: 600; color: var(--faint); }
.att-drop {
  border: 1.5px dashed var(--line); border-radius: 12px; padding: 16px 12px; text-align: center;
  transition: 0.15s; background: var(--input-bg);
}
.att-drop.drag { border-color: var(--accent); background: var(--accent-soft); }
.att-drop-main { font-size: 13px; color: var(--muted); }
.att-pick { background: none; border: none; color: var(--accent); font: inherit; font-weight: 700; cursor: pointer; padding: 0; text-decoration: underline; }
.att-drop-hint { font-size: 11px; color: var(--faint); margin-top: 4px; }
.att-list { display: flex; flex-direction: column; gap: 8px; }
.att-empty { font-size: 12.5px; color: var(--faint); text-align: center; padding: 8px; }
.att-item {
  display: flex; align-items: center; gap: 10px; padding: 8px;
  border: 1px solid var(--line); border-radius: 12px; background: var(--input-bg);
}
.att-preview {
  position: relative; flex: 0 0 auto; width: 52px; height: 52px; border-radius: 8px; overflow: hidden;
  display: grid; place-items: center; background: rgba(127,127,127,0.12); text-decoration: none;
}
.att-open { cursor: pointer; }
.att-preview img,
.att-preview video { width: 100%; height: 100%; object-fit: cover; display: block; }
.att-preview video { background: #000; pointer-events: none; }
.att-play { position: absolute; inset: 0; display: grid; place-items: center; color: #fff; font-size: 16px; text-shadow: 0 1px 4px rgba(0,0,0,0.7); pointer-events: none; }
.att-fileicon, .att-fileglyph { font-size: 24px; }
.att-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.att-name { font-size: 13px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.att-open.att-name:hover { text-decoration: underline; }
.att-sub { font-size: 11.5px; color: var(--faint); }
.att-dl, .att-del {
  flex: 0 0 auto; width: 26px; height: 26px; border-radius: 7px; border: none; cursor: pointer;
  display: grid; place-items: center; text-decoration: none;
  background: rgba(127,127,127,0.12); color: var(--muted); font-size: 14px; line-height: 1; transition: 0.15s;
}
.att-dl:hover { background: var(--accent-soft); color: var(--accent); }
.att-del:hover { background: rgba(220,38,38,0.15); color: #dc2626; }
.att-bar { display: inline-block; width: 120px; max-width: 100%; height: 5px; border-radius: 3px; background: rgba(127,127,127,0.2); overflow: hidden; vertical-align: middle; }
.att-bar i { display: block; height: 100%; width: 0; background: var(--accent); transition: width 0.1s linear; }
.att-item.att-uploading { opacity: 0.85; }
.att-item.att-pending { opacity: 0.9; border-style: dashed; }
.att-item.att-pending .att-preview { background: var(--accent-soft); }

/* Лайтбокс просмотра вложения — окно поверх задачи, фон блюрится. */
.att-viewer-overlay { position: fixed; inset: 0; background: rgba(2,6,16,0.62); backdrop-filter: blur(5px); display: grid; place-items: center; z-index: 200; padding: 24px; animation: fade 0.15s ease; }
.att-viewer { width: min(960px, 92vw); max-height: 88vh; display: flex; flex-direction: column; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 30px 80px rgba(0,0,0,0.5); overflow: hidden; animation: pop 0.15s ease; }
.att-viewer-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.att-viewer-name { font-weight: 700; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.att-viewer-actions { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.att-viewer-actions .btn { padding: 6px 12px; font-size: 13px; }
.att-viewer-close { background: none; border: none; font-size: 24px; line-height: 1; color: var(--muted); cursor: pointer; }
.att-viewer-body { flex: 1; min-height: 0; overflow: auto; display: flex; background: rgba(0,0,0,0.04); }
.att-viewer-body.is-text { background: var(--panel); }
.av-img { max-width: 100%; max-height: 100%; margin: auto; object-fit: contain; display: block; }
.av-video { width: 100%; max-height: 82vh; margin: auto; background: #000; }
.av-frame { width: 100%; height: 82vh; border: 0; }
.av-text { margin: 0; padding: 20px 22px; width: 100%; white-space: pre-wrap; word-break: break-word; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; line-height: 1.55; color: var(--text); }
.av-loading { margin: auto; color: var(--faint); padding: 48px; }
.av-md { padding: 20px 26px; width: 100%; color: var(--text); line-height: 1.6; font-size: 14px; }
.av-md h1, .av-md h2, .av-md h3, .av-md h4, .av-md h5, .av-md h6 { margin: 0.7em 0 0.35em; font-weight: 800; line-height: 1.25; }
.av-md h1 { font-size: 1.55em; } .av-md h2 { font-size: 1.3em; } .av-md h3 { font-size: 1.12em; }
.av-md p { margin: 0.5em 0; }
.av-md ul, .av-md ol { margin: 0.5em 0; padding-left: 1.5em; }
.av-md li { margin: 0.2em 0; }
.av-md code { background: var(--input-bg); padding: 1px 5px; border-radius: 5px; font-family: ui-monospace, monospace; font-size: 0.9em; }
.av-md pre.av-code { background: var(--input-bg); padding: 12px 14px; border-radius: 10px; overflow-x: auto; margin: 0.6em 0; }
.av-md pre.av-code code { background: none; padding: 0; }
.av-md a { color: var(--accent); }
.av-md hr { border: none; border-top: 1px solid var(--line); margin: 1em 0; }

@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop { from { transform: translateY(8px) scale(0.98); opacity: 0; } to { transform: none; opacity: 1; } }

/* ===================== Theme picker ===================== */
.theme-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-top: 14px; }
.theme-card { border: 2px solid var(--line); border-radius: 14px; padding: 11px; cursor: pointer; transition: 0.15s; background: var(--panel); text-align: left; font-family: inherit; }
.theme-card:hover { border-color: var(--accent-2); }
.theme-card.active { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.theme-card .theme-prev { height: 58px; border-radius: 10px; overflow: hidden; display: flex; border: 1px solid rgba(128,128,128,.2); margin-bottom: 10px; }
.theme-prev .tp-side { width: 30%; height: 100%; }
.theme-prev .tp-main { flex: 1; display: flex; align-items: center; padding: 8px; }
.theme-prev .tp-card { flex: 1; height: 36px; border-radius: 7px; display: flex; align-items: center; gap: 6px; padding: 0 8px; }
.theme-prev .tp-dot { width: 14px; height: 14px; border-radius: 5px; flex: 0 0 14px; }
.theme-prev .tp-line { height: 6px; border-radius: 3px; flex: 1; max-width: 56px; }
.theme-card .tname { font-size: 13px; font-weight: 700; color: var(--text); }
.theme-card .tkind { font-size: 11.5px; color: var(--muted); }

/* Превью шрифта в карточке выбора (переиспользует .theme-card) */
.theme-card .font-prev {
  height: 58px; border-radius: 10px; border: 1px solid rgba(128,128,128,.2); margin-bottom: 10px;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  background: var(--panel2); color: var(--text);
}
.font-prev .fp-sample { font-size: 27px; font-weight: 600; line-height: 1; letter-spacing: .3px; }

.theme-mode { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 18px; }
.theme-mode-label { font-size: 13px; font-weight: 700; color: var(--muted); }

/* ===================== Empty / loading ===================== */
.empty-state { border: 1px dashed var(--line); border-radius: 14px; padding: 22px 14px; text-align: center; color: var(--muted); font-size: 13px; background: var(--panel2); }
.loading { padding: 40px; text-align: center; color: var(--muted); }

/* ===================== Toast ===================== */
.toast-wrap { position: fixed; bottom: 24px; right: 24px; display: flex; flex-direction: column; gap: 10px; z-index: 200; }
.toast { background: #1c2433; color: #fff; padding: 12px 16px; border-radius: 12px; font-size: 14px; box-shadow: 0 12px 30px rgba(0, 0, 0, 0.3); animation: slidein 0.2s ease; max-width: 360px; font-weight: 600; }
.toast.success { background: #15803d; }
.toast.error { background: #b91c1c; }
@keyframes slidein { from { transform: translateX(20px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ===================== Charts ===================== */
.charts-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.chart-card { padding: 18px; }
.chart-card h3 { margin: 0 0 14px; font-size: 15px; font-weight: 800; }
.chart-box { position: relative; height: 260px; }

/* ===================== Login ===================== */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: radial-gradient(1200px 600px at 70% -10%, var(--accent-soft), transparent), var(--bg); }
.login-card { background: var(--panel); border: 1px solid var(--line); border-radius: 22px; box-shadow: var(--shadow); padding: 32px; width: 100%; max-width: 400px; }
.login-card .brand { justify-content: center; margin-bottom: 8px; padding: 0; }
.login-card h1 { font-size: 22px; margin: 6px 0 4px; text-align: center; font-weight: 800; }
.login-card .sub { color: var(--muted); font-size: 14px; text-align: center; margin-bottom: 22px; }
.login-card .btn.primary { width: 100%; justify-content: center; margin-top: 6px; }

/* ===================== Responsive ===================== */
@media (max-width: 1280px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .workspace { grid-template-columns: 1fr; }
  .charts-grid { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { flex-direction: row; align-items: center; gap: 12px; overflow-x: auto; }
  .sidebar .menu { flex-direction: row; }
  .sidebar-footer { margin-top: 0; flex-direction: row; }
  .sidebar-user { display: none; }
  .content { padding: 16px; }
  .stats { grid-template-columns: 1fr 1fr; }
  .topbar { flex-direction: column; align-items: flex-start; }
  .field-row { grid-template-columns: 1fr; }
  .theme-grid { grid-template-columns: 1fr 1fr; }
  /* Узкий экран: заметки уходят под окно задачи, overlay прокручивается. */
  .modal-overlay.has-side-notes { flex-direction: column; align-items: center; justify-content: flex-start; overflow-y: auto; }
  .modal-overlay.has-side-notes .modal { flex: 0 0 auto; max-height: none; }
  /* height: auto !important сбрасывает inline-высоту, выставленную JS под десктоп. */
  .modal-side { flex: 0 0 auto; width: 100%; max-width: 520px; min-height: 160px; max-height: none; height: auto !important; }
}
