/* ============================================================
   КОМАНДНЫЙ ЦЕНТР — стили
   Две темы: светлая и тёмная. Переключатель в шапке.
   ============================================================ */

/* ---------- Палитра ---------- */
:root {
  --st-backlog: #ef6461;
  --st-todo:    #3b82f6;
  --st-work:    #f5a524;
  --st-review:  #8b5cf6;
  --st-done:    #17c964;

  --r-sm: 7px;  --r: 10px;  --r-lg: 14px;  --r-xl: 18px;
  --gap: 14px;
  --sidebar: 244px;
  --topbar: 58px;
  --ease: cubic-bezier(.4, 0, .2, 1);
}

/* Светлая тема — по умолчанию. Тёмная включается кнопкой в шапке. */
:root, :root[data-theme="light"] {
  --bg:      #f7f8fa;
  --panel:   #ffffff;
  --panel2:  #f7f8fa;
  --panel3:  #eef0f4;
  --line:    #ececf0;
  --line2:   #dcdee5;
  --txt:     #16181d;
  --txt2:    #4a4f5c;
  --muted:   #8a8f9c;
  --accent:  #2f6bff;
  --accent2: #2455d6;
  --accent-soft: rgba(47,107,255,.09);
  --primary:      #1c1e24;   /* главная кнопка — тёмная, как в оригинале */
  --primary-hover:#2b2e37;
  --primary-txt:  #ffffff;
  --danger:  #dc2626;
  --danger-soft: rgba(220,38,38,.08);
  --ok:      #0f9d58;
  --warn:    #d97706;
  --shadow:  0 12px 36px rgba(24,39,75,.13);
  --shadow-sm: 0 1px 3px rgba(24,39,75,.07);
  --overlay-bg: rgba(28,35,50,.38);
}

:root[data-theme="dark"] {
  --bg:      #0c0e13;
  --panel:   #14171f;
  --panel2:  #1b1f29;
  --panel3:  #232834;
  --line:    #262c38;
  --line2:   #333a49;
  --txt:     #e8ecf3;
  --txt2:    #b6bfd0;
  --muted:   #7d8798;
  --accent:  #5b8cff;
  --accent2: #4070e8;
  --accent-soft: rgba(91,140,255,.14);
  --primary:      #5b8cff;
  --primary-hover:#4070e8;
  --primary-txt:  #ffffff;
  --danger:  #f87171;
  --danger-soft: rgba(248,113,113,.13);
  --ok:      #34d399;
  --warn:    #fbbf24;
  --shadow:  0 8px 28px rgba(0,0,0,.45);
  --shadow-sm: 0 2px 8px rgba(0,0,0,.3);
  --overlay-bg: rgba(6,8,12,.68);
}

/* Настройку системы намеренно не слушаем: задачник всегда открывается светлым,
   как оригинал. Тёмная — осознанный выбор кнопкой в шапке. */

/* ---------- База ---------- */
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: 'Segoe UI', -apple-system, system-ui, 'Inter', Arial, sans-serif;
  font-size: 14px;
  line-height: 1.45;
  background: var(--bg);
  color: var(--txt);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -.01em; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.ico { flex: none; }
.hidden { display: none !important; }
.spacer { flex: 1; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line2); border-radius: 8px; border: 3px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: var(--muted); }

/* ---------- Кнопки ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--primary); color: var(--primary-txt); border: 1px solid transparent;
  padding: 8px 14px; border-radius: var(--r); font: inherit; font-weight: 600;
  font-size: 13.5px; cursor: pointer; white-space: nowrap;
  transition: background .15s var(--ease), border-color .15s var(--ease), transform .06s;
}
.btn:hover  { background: var(--primary-hover); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.btn.ghost { background: transparent; border-color: var(--line2); color: var(--txt); }
.btn.ghost:hover { background: var(--panel2); border-color: var(--accent); }
.btn.soft { background: var(--panel3); color: var(--txt); }
.btn.soft:hover { background: var(--line); }
.btn.danger { background: transparent; border-color: var(--danger); color: var(--danger); }
.btn.danger:hover { background: var(--danger-soft); }
.btn.sm { padding: 5px 10px; font-size: 12.5px; border-radius: var(--r-sm); }
.btn.lg { padding: 11px 20px; font-size: 15px; }
.btn:disabled { opacity: .5; cursor: default; }

.ibtn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: var(--r);
  background: transparent; border: 1px solid transparent; color: var(--muted);
  cursor: pointer; transition: background .15s, color .15s;
}
.ibtn:hover { background: var(--panel2); color: var(--txt); }
.ibtn.bordered { border-color: var(--line2); }
.ibtn.danger:hover { background: var(--danger-soft); color: var(--danger); }

/* ---------- Поля ввода ---------- */
input, select, textarea {
  background: var(--panel);
  border: 1px solid var(--line2);
  color: var(--txt);
  padding: 8px 11px;
  border-radius: var(--r);
  font: inherit; font-size: 14px;
  width: 100%;
  transition: border-color .15s, box-shadow .15s;
}
input:hover, select:hover, textarea:hover { border-color: var(--muted); }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
input::placeholder, textarea::placeholder { color: var(--muted); }
textarea { resize: vertical; min-height: 84px; line-height: 1.5; }
select { appearance: none; cursor: pointer; padding-right: 30px;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
                    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 15px) 50%, calc(100% - 10px) 50%;
  background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; }
input[type="checkbox"] { width: auto; accent-color: var(--accent); cursor: pointer; }
input[type="date"] { cursor: pointer; }
:root[data-theme="dark"] input[type="date"]::-webkit-calendar-picker-indicator { filter: invert(.7); }

.fld { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.fld > span { font-size: 12px; color: var(--muted); font-weight: 600; }
.fld.row { flex-direction: row; align-items: center; gap: 8px; }

/* ---------- Экран входа ---------- */
#login {
  position: fixed; inset: 0; z-index: 200;
  display: flex; align-items: center; justify-content: center; padding: 20px;
  background: radial-gradient(900px 500px at 50% -15%, var(--panel2), var(--bg));
}
.login-card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--r-xl); padding: 30px 26px; width: 400px; max-width: 100%;
  box-shadow: var(--shadow);
}
.login-card .brandmark { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.logo-sq {
  width: 42px; height: 42px; border-radius: 12px; flex: none;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 800; font-size: 17px; letter-spacing: -.5px;
}
.login-card h1 { font-size: 18px; }
.login-card .sub { font-size: 12.5px; color: var(--muted); }
.login-card .lbl { font-size: 11.5px; color: var(--muted); font-weight: 700;
  text-transform: uppercase; letter-spacing: .6px; margin: 4px 0 10px; }
.userpick { display: flex; flex-direction: column; gap: 6px; max-height: 44vh; overflow: auto; padding-right: 4px; }
.userpick .row {
  display: flex; align-items: center; gap: 11px; padding: 9px 11px;
  border: 1px solid var(--line); border-radius: var(--r); cursor: pointer;
  background: var(--panel2); transition: border-color .15s, background .15s;
}
.userpick .row:hover { border-color: var(--accent); background: var(--accent-soft); }
.userpick .nm { font-size: 13.5px; font-weight: 600; }
.userpick .rl { font-size: 11.5px; color: var(--muted); }
.loginform { display: flex; flex-direction: column; gap: 10px; }
.loginform .btn { justify-content: center; margin-top: 2px; }
.loginform .err {
  display: none; font-size: 12.5px; line-height: 1.5;
  color: var(--danger); background: var(--danger-soft);
  border: 1px solid var(--danger); border-radius: var(--r-sm); padding: 8px 10px;
}
.loginform .err.on { display: block; }

.note { font-size: 11.5px; color: var(--muted); margin-top: 16px; line-height: 1.55; }

/* ---------- Аватар ---------- */
.ava {
  border-radius: 50%; flex: none; color: #fff; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; font-size: 12px; letter-spacing: -.3px;
}
.ava.sm { width: 22px; height: 22px; font-size: 9.5px; }
.ava.lg { width: 40px; height: 40px; font-size: 14px; }

/* ---------- Каркас ---------- */
#app { display: none; height: 100vh; }
#app.on { display: grid; grid-template-columns: var(--sidebar) 1fr; grid-template-rows: var(--topbar) 1fr; }

.sidebar {
  grid-row: 1 / span 2; background: var(--panel); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; padding: 12px 10px; overflow: hidden; z-index: 60;
}
.sidebar .brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 14px; }
.sidebar .brand .nm { font-weight: 700; font-size: 14.5px; line-height: 1.15; }
.sidebar .brand .sub { font-size: 11px; color: var(--muted); }

/* Переключатель пространства: Личное / Гипсовинил */
.spaceswitch { display: flex; gap: 3px; background: var(--panel2); border: 1px solid var(--line);
  border-radius: var(--r); padding: 3px; margin: 0 4px 12px; }
.spaceswitch button {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px;
  background: transparent; border: none; color: var(--muted); font: inherit;
  font-size: 12.5px; font-weight: 600; padding: 6px 4px; border-radius: var(--r-sm);
  cursor: pointer; transition: background .15s, color .15s;
}
.spaceswitch button:hover { color: var(--txt); }
.spaceswitch button.active { background: var(--accent); color: #fff; }

.nav { display: flex; flex-direction: column; gap: 1px; overflow-y: auto; flex: 1; }
.nav .grp { font-size: 10.5px; color: var(--muted); text-transform: uppercase;
  letter-spacing: .7px; font-weight: 700; padding: 14px 11px 5px; }
.nav .item {
  display: flex; align-items: center; gap: 11px; padding: 8px 11px;
  border-radius: var(--r); color: var(--txt2); cursor: pointer; font-size: 13.5px;
  font-weight: 500; transition: background .13s, color .13s; user-select: none;
}
.nav .item:hover { background: var(--panel2); color: var(--txt); }
.nav .item.active { background: var(--accent-soft); color: var(--accent); font-weight: 650; }
.nav .item .badge { margin-left: auto; }

/* Дерево отделов под пунктом «Задачи» */
.subtree { display: flex; flex-direction: column; gap: 1px; margin: 1px 0 4px; }
.subitem {
  padding: 5px 11px 5px 40px; border-radius: var(--r-sm); cursor: pointer;
  font-size: 12.5px; color: var(--muted); position: relative;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.subitem::before {
  content: ''; position: absolute; left: 22px; top: 0; bottom: 0;
  border-left: 1px solid var(--line);
}
.subitem:hover { background: var(--panel2); color: var(--txt); }
.subitem.active { color: var(--txt); font-weight: 650; background: var(--panel2); }
.subitem.add { display: flex; align-items: center; gap: 5px; color: var(--muted); opacity: .8; }
.subitem.add:hover { color: var(--accent); opacity: 1; }
.sidebar .foot { padding-top: 10px; border-top: 1px solid var(--line); margin-top: 8px; }

.topbar {
  grid-column: 2; display: flex; align-items: center; gap: 12px; padding: 0 18px;
  background: var(--panel); border-bottom: 1px solid var(--line); z-index: 50;
}
.topbar h1 { font-size: 16px; }
.topbar .me { display: flex; align-items: center; gap: 9px; padding-left: 6px; }
.topbar .me .nm { font-size: 13px; font-weight: 600; line-height: 1.15; }
.topbar .me .rl { font-size: 11px; color: var(--muted); }
.burger { display: none; }

.main { grid-column: 2; overflow: auto; }

/* ---------- Общие блоки страниц ---------- */
.page { padding: 18px 20px 40px; max-width: 1400px; }
.page-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.page-head h2 { font-size: 17px; }
.page-head .cnt { font-size: 12.5px; color: var(--muted); }

.toolbar {
  display: flex; gap: 10px; align-items: center; padding: 12px 20px;
  flex-wrap: wrap; border-bottom: 1px solid var(--line); background: var(--panel);
}
.toolbar .fld { min-width: 130px; }
.toolbar .fld > span { display: none; }

.tabs { display: flex; gap: 2px; background: var(--panel2); border: 1px solid var(--line);
  border-radius: var(--r); padding: 3px; }
.tabs button {
  display: flex; align-items: center; gap: 6px; background: transparent; border: none;
  color: var(--muted); padding: 6px 12px; border-radius: var(--r-sm); cursor: pointer;
  font: inherit; font-size: 13px; font-weight: 600; transition: background .15s, color .15s;
}
.tabs button:hover { color: var(--txt); }
.tabs button.active { background: var(--accent); color: #fff; }

.chip {
  display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px;
  padding: 5px 11px; border-radius: 20px; border: 1px solid var(--line2);
  background: transparent; color: var(--muted); cursor: pointer; font: inherit;
  transition: border-color .15s, color .15s, background .15s;
}
.chip:hover { color: var(--txt); border-color: var(--muted); }
.chip.active { background: var(--accent); color: #fff; border-color: var(--accent); }

.card-panel { background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--r-lg); padding: 16px; margin-bottom: 14px; }
.card-panel h3 { font-size: 14.5px; margin-bottom: 10px; display: flex; align-items: center; gap: 8px; }

.empty { color: var(--muted); font-size: 13px; text-align: center; padding: 26px 12px; }
.empty-big { text-align: center; padding: 60px 20px; color: var(--muted); }
.empty-big .ic { color: var(--line2); margin-bottom: 12px; }
.empty-big h2 { font-size: 17px; color: var(--txt); margin-bottom: 6px; }
.empty-big p { font-size: 13.5px; max-width: 380px; margin: 0 auto 16px; line-height: 1.6; }

/* ---------- Метки ---------- */
.tag {
  display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px;
  padding: 2px 8px; border-radius: 6px; background: var(--panel3); color: var(--txt2);
  white-space: nowrap; max-width: 180px; overflow: hidden; text-overflow: ellipsis;
}
.tag.proj  { background: rgba(16,185,129,.15); color: var(--ok); }
.tag.dep   { background: rgba(139,124,246,.15); color: #a898ff; }
.tag.space { background: var(--accent-soft); color: var(--accent); }
.tag.due   { background: var(--panel3); color: var(--txt2); }
.tag.due.soon { background: rgba(251,191,36,.16); color: var(--warn); }
.tag.due.over { background: var(--danger-soft); color: var(--danger); font-weight: 600; }
/* Приоритет — флажок и слово, без заливки, как в оригинале */
.pri { display: inline-flex; align-items: center; gap: 3px;
  font-size: 11px; font-weight: 600; color: var(--muted); }
.pri.high { color: #e5484d; }
.pri.mid  { color: #d97706; }
.pri.low  { color: var(--muted); }

/* Тип задачи — пастельная плашка, цвет задаётся из config.js */
.ttype {
  display: inline-flex; align-items: center; font-size: 11px; font-weight: 600;
  padding: 2px 8px; border-radius: 6px; white-space: nowrap;
  background: var(--tt-bg, var(--panel3)); color: var(--tt-fg, var(--txt2));
}

.showmore {
  width: 100%; background: var(--panel); border: 1px dashed var(--line2);
  color: var(--muted); border-radius: var(--r); padding: 7px; font: inherit;
  font-size: 12px; cursor: pointer;
}
.showmore:hover { border-color: var(--primary); color: var(--txt); }

/* Плашка «Где вы?» — текущий квартал и прогресс дорожной карты */
.whereami {
  display: inline-flex; align-items: center; gap: 7px; font-size: 12px;
  border: 1px solid var(--line); background: var(--panel2); color: var(--muted);
  border-radius: 20px; padding: 4px 12px; cursor: pointer; white-space: nowrap;
}
.whereami:hover { border-color: var(--line2); color: var(--txt); }
.whereami b { color: var(--txt); font-weight: 650; }
.badge { background: var(--panel3); color: var(--muted); font-size: 11.5px;
  padding: 1px 8px; border-radius: 20px; font-weight: 600; }
.badge.hot { background: var(--danger-soft); color: var(--danger); }

/* ---------- Доска ---------- */
/* Прокрутка — общая, у .main: доска целиком листается и вниз, и вбок */
.board { display: flex; gap: 12px; padding: 16px 20px 30px; align-items: flex-start; width: max-content; min-width: 100%; }
.col { background: transparent; border-radius: var(--r-lg);
  min-width: 268px; width: 268px; flex: none; }
/* Цветная черта сверху колонки — как в оригинале */
/* Шапка липнет к верху: листаешь длинную колонку — видно, где какой статус */
.col-head { display: flex; align-items: center; gap: 8px; padding: 9px 4px 10px;
  font-weight: 650; font-size: 13.5px; border-top: 2px solid var(--col-color, var(--line2));
  position: sticky; top: 0; background: var(--bg); z-index: 2; }
.col-head .ico { color: var(--col-color, var(--muted)); }
.dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
/* Своей прокрутки у колонки нет: длинная колонка тянет страницу,
   и весь список листается одним движением */
.col-body { padding: 9px; min-height: 70px; display: flex; flex-direction: column; gap: 9px; }
.col-body.drag-over { background: var(--accent-soft); }

.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--r);
  padding: 9px 10px; cursor: pointer; box-shadow: var(--shadow-sm);
  transition: border-color .15s, box-shadow .15s, transform .1s;
}
.card:hover { border-color: var(--line2); box-shadow: var(--shadow); }
.card.dragging { opacity: .45; }
.card.sel { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); }
.card.overdue { border-left: 3px solid var(--danger); }
/* Верхняя строка карточки: проект и отдел мелким серым */
.card .top { display: flex; align-items: center; gap: 6px; margin-bottom: 6px;
  font-size: 11px; color: var(--muted); min-width: 0; }
.card .top .proj { display: inline-flex; align-items: center; gap: 4px; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card .top .dep { margin-left: auto; flex: none; border: 1px solid var(--line);
  border-radius: 5px; padding: 1px 6px; background: var(--panel2); }
.card .title { font-size: 13px; font-weight: 600; margin-bottom: 8px; line-height: 1.38; }
.card .meta { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; }
.card .donedate { font-size: 11px; color: var(--muted); margin-bottom: 5px; }
.card .subprog { display: flex; align-items: center; gap: 6px; margin: 6px 0 2px;
  font-size: 11.5px; color: var(--muted); }
.card .subprog .bar { flex: 1; }
.card .who { margin-left: auto; display: flex; align-items: center; gap: 5px;
  font-size: 11.5px; color: var(--muted); }

.bar { height: 5px; background: var(--panel3); border-radius: 6px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--accent); transition: width .3s var(--ease); }
.bar i.full { background: var(--ok); }

/* ---------- Список задач ---------- */
table.tbl { width: 100%; border-collapse: separate; border-spacing: 0;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; }
table.tbl th {
  text-align: left; font-size: 11.5px; color: var(--muted); font-weight: 700;
  padding: 10px 13px; border-bottom: 1px solid var(--line);
  text-transform: uppercase; letter-spacing: .5px; white-space: nowrap;
  background: var(--panel); position: sticky; top: 0; z-index: 2;
}
table.tbl th.sortable { cursor: pointer; user-select: none; }
table.tbl th.sortable:hover { color: var(--txt); }
table.tbl td { padding: 10px 13px; border-bottom: 1px solid var(--line); font-size: 13.5px; vertical-align: middle; }
table.tbl tr:last-child td { border-bottom: none; }
table.tbl tbody tr { cursor: pointer; }
table.tbl tbody tr:hover td { background: var(--panel2); }
.tbl-wrap { overflow-x: auto; border-radius: var(--r-lg); }

/* ---------- Календарь ---------- */
.cal { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; }
.cal-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.cal-head h3 { font-size: 15px; min-width: 160px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); }
.cal-grid .wd { padding: 8px; text-align: center; font-size: 11.5px; color: var(--muted);
  font-weight: 700; text-transform: uppercase; border-bottom: 1px solid var(--line); }
.cal-cell { min-height: 104px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line);
  padding: 6px; display: flex; flex-direction: column; gap: 4px; }
.cal-cell:nth-child(7n) { border-right: none; }
.cal-cell.out { background: var(--panel2); opacity: .55; }
.cal-cell.today .dnum { background: var(--accent); color: #fff; }
.cal-cell .dnum { font-size: 12px; font-weight: 650; color: var(--muted); width: 22px; height: 22px;
  border-radius: 50%; display: flex; align-items: center; justify-content: center; }
.cal-ev { font-size: 11.5px; padding: 3px 6px; border-radius: 5px; background: var(--panel3);
  color: var(--txt2); cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  border-left: 2.5px solid var(--accent); }
.cal-ev:hover { background: var(--line); }
.cal-ev.over { border-left-color: var(--danger); color: var(--danger); }
.cal-ev.done { opacity: .5; text-decoration: line-through; }

/* ---------- Мой день ---------- */
.day-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: var(--gap); }
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: var(--gap); margin-bottom: var(--gap); }
.stat {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 14px 16px; display: flex; flex-direction: column; gap: 2px; cursor: pointer;
  transition: border-color .15s, transform .1s;
}
.stat:hover { border-color: var(--accent); }
.stat .n { font-size: 26px; font-weight: 700; letter-spacing: -1px; line-height: 1.1; }
.stat .l { font-size: 12.5px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.stat.danger .n { color: var(--danger); }
.stat.warn .n { color: var(--warn); }
.stat.ok .n { color: var(--ok); }

.mini-list { display: flex; flex-direction: column; }
.mini-row {
  display: flex; align-items: center; gap: 10px; padding: 9px 4px;
  border-bottom: 1px solid var(--line); cursor: pointer; font-size: 13.5px;
}
.mini-row:last-child { border-bottom: none; }
.mini-row:hover { background: var(--panel2); }
.mini-row .t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-row .r { font-size: 12px; color: var(--muted); white-space: nowrap; }

/* Кружок-галочка «сделано» */
.tick {
  width: 19px; height: 19px; border-radius: 50%; border: 1.8px solid var(--line2);
  flex: none; cursor: pointer; display: flex; align-items: center; justify-content: center;
  color: transparent; transition: border-color .15s, background .15s, color .15s;
}
.tick:hover { border-color: var(--ok); color: var(--ok); }
.tick.on { background: var(--ok); border-color: var(--ok); color: #fff; }

/* ---------- Файлы ---------- */
.file-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(184px, 1fr)); gap: 12px; }
.file-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg);
  overflow: hidden; cursor: pointer; display: flex; flex-direction: column;
  transition: border-color .15s, box-shadow .15s;
}
.file-card:hover { border-color: var(--accent); box-shadow: var(--shadow-sm); }
.file-card .thumb {
  height: 116px; background: var(--panel2); display: flex; align-items: center;
  justify-content: center; color: var(--muted); border-bottom: 1px solid var(--line); overflow: hidden;
}
.file-card .thumb img { width: 100%; height: 100%; object-fit: cover; }
.file-card .thumb .kind { font-size: 11px; font-weight: 800; letter-spacing: .8px;
  text-transform: uppercase; margin-top: 6px; }
.file-card .body { padding: 9px 11px 11px; display: flex; flex-direction: column; gap: 3px; }
.file-card .fn { font-size: 12.8px; font-weight: 600; line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.file-card .fm { font-size: 11.5px; color: var(--muted); }

.folder-row { display: flex; flex-wrap: wrap; gap: 9px; margin-bottom: 16px; }
.folder-btn {
  display: flex; align-items: center; gap: 8px; padding: 9px 13px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--r);
  cursor: pointer; font: inherit; font-size: 13px; color: var(--txt); font-weight: 550;
  transition: border-color .15s, background .15s;
}
.folder-btn:hover { border-color: var(--accent); }
.folder-btn.drag-over { border-color: var(--accent); background: var(--accent-soft); }
.folder-btn .cnt { color: var(--muted); font-size: 11.5px; }

.crumbs { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); margin-bottom: 14px; }
.crumbs a { cursor: pointer; }

/* Затемнение всего окна при перетаскивании файлов */
#dropzone {
  position: fixed; inset: 0; z-index: 300; display: none;
  align-items: center; justify-content: center; background: var(--overlay-bg);
  backdrop-filter: blur(2px);
}
#dropzone.on { display: flex; }
#dropzone .inner {
  border: 2.5px dashed var(--accent); border-radius: var(--r-xl); padding: 40px 56px;
  background: var(--panel); text-align: center; color: var(--txt); box-shadow: var(--shadow);
}
#dropzone .inner .big { font-size: 17px; font-weight: 700; margin: 10px 0 4px; }
#dropzone .inner .sm { font-size: 13px; color: var(--muted); }

/* ---------- Заметки ---------- */
.note-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(258px, 1fr)); gap: 12px; }
.note-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 14px; cursor: pointer; display: flex; flex-direction: column; gap: 7px;
  min-height: 128px; transition: border-color .15s, box-shadow .15s;
}
.note-card:hover { border-color: var(--accent); box-shadow: var(--shadow-sm); }
.note-card .nt { font-size: 14px; font-weight: 650; }
.note-card .nb { font-size: 12.8px; color: var(--txt2); line-height: 1.5; flex: 1;
  display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical;
  overflow: hidden; white-space: pre-wrap; }
.note-card .nf { display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  font-size: 11.5px; color: var(--muted); }

/* ---------- Дорожная карта ---------- */
.road { display: flex; gap: 12px; overflow-x: auto; align-items: flex-start; }
.qcol { background: var(--panel2); border: 1px solid var(--line); border-radius: var(--r);
  min-width: 216px; width: 216px; flex: none; }
.qcol .qh { padding: 10px 13px; font-weight: 700; font-size: 13px; border-bottom: 1px solid var(--line); }
.qbody { padding: 9px; display: flex; flex-direction: column; gap: 8px; min-height: 60px; }
.qbody.drag-over { background: var(--accent-soft); }
.rcard { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-sm);
  padding: 9px 10px; cursor: grab; }
.rcard:hover { border-color: var(--accent); }
.rcard .rt { font-size: 12.8px; font-weight: 600; margin-bottom: 6px; }
.rstatus { font-size: 11px; padding: 2px 8px; border-radius: 5px; font-weight: 650; }
.rstatus.plan { background: var(--panel3); color: var(--muted); }
.rstatus.work { background: rgba(59,130,246,.16); color: var(--st-work); }
.rstatus.done { background: rgba(16,185,129,.16); color: var(--ok); }

/* ---------- Панель задачи справа ---------- */
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: 580px; max-width: 100%;
  background: var(--panel); border-left: 1px solid var(--line);
  box-shadow: var(--shadow); z-index: 240; overflow-y: auto;
  transform: translateX(101%); transition: transform .22s var(--ease);
}
.drawer.open { transform: translateX(0); }
.drawer-scrim {
  position: fixed; inset: 0; background: var(--overlay-bg); z-index: 235;
  opacity: 0; pointer-events: none; transition: opacity .2s var(--ease);
}
.drawer-scrim.on { opacity: 1; pointer-events: auto; }

/* Шапка панели и страницы проекта */
.pnl-head {
  display: flex; align-items: center; gap: 9px; padding: 14px 18px;
  border-bottom: 1px solid var(--line); position: sticky; top: 0;
  background: var(--panel); z-index: 3;
}
.pnl-head h2 { font-size: 15.5px; flex: 1; min-width: 0; line-height: 1.35; }
.pnl-body { padding: 16px 18px 30px; display: flex; flex-direction: column; gap: 14px; }
.pnl-sec { display: flex; flex-direction: column; gap: 7px; }
.pnl-sec > .lbl { font-size: 11.5px; color: var(--muted); font-weight: 650; }

/* Выпадающий выбор статуса в шапке панели */
.statuspick {
  display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 650;
  border: 1px solid var(--line2); border-radius: 20px; padding: 4px 11px;
  background: var(--panel); cursor: pointer; white-space: nowrap;
}
.statuspick select {
  border: none; background: transparent; padding: 0 16px 0 0; font: inherit;
  font-weight: 650; width: auto; color: inherit; background-size: 5px 5px, 5px 5px;
  background-position: calc(100% - 6px) 50%, calc(100% - 1px) 50%;
}
.statuspick select:focus { box-shadow: none; }

/* ---------- Обсуждение как чат ---------- */
.chat { display: flex; flex-direction: column; gap: 10px; }
.chat .row { display: flex; gap: 8px; align-items: flex-end; }
.chat .row.mine { flex-direction: row-reverse; }
.chat .bubble {
  max-width: 78%; background: var(--panel3); color: var(--txt);
  border-radius: 14px 14px 14px 4px; padding: 8px 12px; font-size: 13.5px;
  line-height: 1.5; white-space: pre-wrap; word-break: break-word;
}
.chat .row.mine .bubble {
  background: var(--primary); color: var(--primary-txt); border-radius: 14px 14px 4px 14px;
}
.chat .who { font-size: 11px; color: var(--muted); margin-bottom: 3px; font-weight: 650; }
.chat .row.mine .who { color: rgba(255,255,255,.7); }
.chat .when { font-size: 10.5px; color: var(--muted); align-self: flex-end; white-space: nowrap; }
.chat .bubble .files { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; }
.chat-form { display: flex; gap: 7px; align-items: flex-end; margin-top: 12px; }
.chat-form textarea { min-height: 40px; max-height: 140px; }

/* ---------- Страница проекта ---------- */
.proj-head { background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--r-lg); padding: 18px 20px; margin-bottom: 16px; }
.proj-head h2 { font-size: 20px; margin-bottom: 12px; }
.proj-meta { display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  font-size: 12.5px; color: var(--muted); }
.proj-meta .grp { display: inline-flex; align-items: center; gap: 6px; }
.proj-people { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.proj-person { display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--line); border-radius: 20px; padding: 3px 10px 3px 3px;
  font-size: 12px; color: var(--txt); }
.proj-person.owner { border-color: var(--primary); }
.proj-person .role { font-size: 10px; color: var(--muted); text-transform: uppercase; }
/* Прогресс сегментами, как в оригинале */
.segbar { display: flex; gap: 3px; align-items: center; }
.segbar i { width: 16px; height: 5px; border-radius: 3px; background: var(--panel3); display: block; }
.segbar i.on { background: var(--ok); }

.split { display: grid; grid-template-columns: 330px 1fr; gap: 14px; align-items: start; }
.split-list { display: flex; flex-direction: column; gap: 9px; }
.split-panel { background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--r-lg); min-height: 320px; overflow: hidden; }

/* ---------- Выбор сотрудников галочками ---------- */
.peoplepick {
  display: flex; flex-wrap: wrap; gap: 6px; max-height: 260px; overflow-y: auto;
  padding: 8px; background: var(--panel2); border: 1px solid var(--line); border-radius: var(--r);
}
.peoplepick label {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 9px 4px 5px;
  background: var(--panel); border: 1px solid var(--line2); border-radius: 999px;
  font-size: 12.5px; cursor: pointer; user-select: none;
}
.peoplepick label:hover { border-color: var(--accent); }
.peoplepick label:has(input:checked) {
  background: var(--accent-soft); border-color: var(--accent); color: var(--accent); font-weight: 600;
}
.peoplepick input { width: 13px; height: 13px; margin: 0 2px 0 0; }

/* ---------- Выпадающие фильтры под кнопкой «Фильтр» ---------- */
.filterbar {
  display: flex; gap: 9px; flex-wrap: wrap; align-items: center;
  padding: 12px 20px 0;
}
.filterbar[hidden] { display: none; }
.filterbar select { width: auto; min-width: 170px; }

/* ---------- Умная строка: пишешь фразой, показываем что понято ---------- */
.smartbar { padding: 12px 20px 0; max-width: 820px; }
.smartbar .row { display: flex; gap: 8px; }
.smartbar .hits { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 8px; min-height: 0; }
.smartbar .asis { font-size: 12.5px; color: var(--muted); margin-right: 4px; }
.smartbar .asis b { color: var(--txt); font-weight: 600; }
.smartbar .hit {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 8px;
  background: var(--accent-soft); color: var(--accent); border-radius: 999px;
  font-size: 12px; font-weight: 600; white-space: nowrap;
}
.smartbar .hit b { cursor: pointer; opacity: .55; font-size: 13px; padding: 0 1px; }
.smartbar .hit b:hover { opacity: 1; }
.smartbar .hit.reset { background: var(--panel3); color: var(--muted); cursor: pointer; font-weight: 500; }

/* ---------- Модальные окна ---------- */
.overlay {
  position: fixed; inset: 0; z-index: 250; background: var(--overlay-bg);
  display: none; align-items: flex-start; justify-content: center;
  padding: 34px 16px; overflow-y: auto; backdrop-filter: blur(3px);
}
.overlay.open { display: flex; }
.modal {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-xl);
  width: 640px; max-width: 100%; box-shadow: var(--shadow);
  animation: pop .16s var(--ease); margin: auto 0;
}
.modal.wide { width: 900px; }
.modal.narrow { width: 440px; }
@keyframes pop { from { opacity: 0; transform: translateY(-8px) scale(.99); } }
.modal-head { display: flex; align-items: center; gap: 10px; padding: 16px 20px;
  border-bottom: 1px solid var(--line); }
.modal-head h2 { font-size: 16px; flex: 1; }
.modal-body { padding: 18px 20px; display: flex; flex-direction: column; gap: 14px; }
.modal-foot { display: flex; gap: 9px; padding: 14px 20px; border-top: 1px solid var(--line);
  justify-content: flex-end; align-items: center; flex-wrap: wrap; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }

/* Кнопка «улучшить текст» рядом с полем */
.fld-ai { display: flex; gap: 8px; align-items: flex-end; }
.fld-ai .fld { flex: 1; }
.ai-btn { background: transparent; border: 1px dashed var(--line2); color: var(--muted);
  border-radius: var(--r); padding: 8px 11px; font: inherit; font-size: 12.5px;
  cursor: pointer; white-space: nowrap; }
.ai-btn:hover { border-color: var(--accent); color: var(--accent); }

/* Подзадачи */
.subs { display: flex; flex-direction: column; gap: 2px; }
.sub-row { display: flex; align-items: center; gap: 9px; padding: 5px 2px; }
.sub-row .st { flex: 1; font-size: 13.5px; }
.sub-row.done .st { color: var(--muted); text-decoration: line-through; }
.sub-add { display: flex; gap: 8px; margin-top: 6px; }

/* Обсуждение */
.cmt { display: flex; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); }
.cmt .body { flex: 1; min-width: 0; }
.cmt .head { font-size: 12px; color: var(--muted); margin-bottom: 3px; }
.cmt .text { font-size: 13.5px; white-space: pre-wrap; line-height: 1.5; }
.cmt .files { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 7px; }
.attach {
  display: inline-flex; align-items: center; gap: 6px; font-size: 12px;
  background: var(--panel2); border: 1px solid var(--line); border-radius: var(--r-sm);
  padding: 4px 9px; color: var(--txt2); cursor: pointer; max-width: 100%;
}
.attach:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
.attach .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Уведомления ---------- */
#toasts { position: fixed; bottom: 20px; right: 20px; z-index: 400;
  display: flex; flex-direction: column; gap: 9px; max-width: 380px; }
.toast {
  background: var(--panel); border: 1px solid var(--line); border-left: 3px solid var(--accent);
  border-radius: var(--r); padding: 11px 15px; box-shadow: var(--shadow);
  font-size: 13.5px; animation: slidein .2s var(--ease); display: flex; align-items: center; gap: 10px;
}
.toast.ok   { border-left-color: var(--ok); }
.toast.err  { border-left-color: var(--danger); }
.toast.warn { border-left-color: var(--warn); }
.toast.out  { animation: slideout .2s var(--ease) forwards; }
@keyframes slidein  { from { opacity: 0; transform: translateX(24px); } }
@keyframes slideout { to   { opacity: 0; transform: translateX(24px); } }

/* ---------- Просмотр файла ---------- */
.viewer { width: 92vw; max-width: 1100px; }
.viewer .frame { height: 74vh; background: var(--panel2); border-radius: var(--r);
  display: flex; align-items: center; justify-content: center; overflow: auto; }
.viewer .frame img { max-width: 100%; max-height: 74vh; object-fit: contain; }
.viewer .frame iframe { width: 100%; height: 100%; border: none; border-radius: var(--r); }

/* ---------- Адаптив ---------- */
@media (max-width: 900px) {
  #app.on { grid-template-columns: 1fr; grid-template-rows: var(--topbar) 1fr; }
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0; width: 260px;
    transform: translateX(-100%); transition: transform .22s var(--ease); box-shadow: var(--shadow);
  }
  .sidebar.open { transform: translateX(0); }
  .topbar, .main { grid-column: 1; }
  .burger { display: inline-flex; }
  #scrim { position: fixed; inset: 0; background: var(--overlay-bg); z-index: 55; display: none; }
  #scrim.on { display: block; }
  .page { padding: 14px 14px 40px; }
  .toolbar { padding: 10px 14px; }
  .board { padding: 12px 14px 24px; }
  .grid2, .grid3 { grid-template-columns: 1fr; }
  .topbar .me .txtblock { display: none; }
  .modal { border-radius: var(--r-lg); }
  .cal-cell { min-height: 74px; }
  .cal-ev { font-size: 10.5px; }
  .drawer { width: 100%; border-left: none; }
  .split { grid-template-columns: 1fr; }
  .split-list { max-height: 260px; overflow-y: auto; }
}

@media (max-width: 560px) {
  .file-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
  .stat-row { grid-template-columns: 1fr 1fr; }
  .toolbar .fld { min-width: 0; flex: 1; }
}

@media print { .sidebar, .topbar, .toolbar { display: none; } }
