/* Sarketch Studio — тёмная тема в стиле Notion */
:root {
  --bg: #191919;
  --bg-sidebar: #202020;
  --bg-panel: #232323;
  --bg-hover: #2c2c2c;
  --bg-input: #2a2a2a;
  --bg-card: #262626;
  --border: #333;
  --border-light: #3d3d3d;
  --text: #d4d4d4;
  --text-bright: #ffffff;
  --text-dim: #8a8a8a;
  --accent: #bca062;
  --accent-hover: #a98c50;
  --green-bg: #1e3a2b; --green-fg: #6fcf97;
  --red: #eb5757;
  --tag-gray-bg: #373737; --tag-gray-fg: #b8b8b8;
  --tag-brown-bg: #4a3828; --tag-brown-fg: #d3a679;
  --tag-orange-bg: #4f3a20; --tag-orange-fg: #e0a458;
  --tag-yellow-bg: #4a4222; --tag-yellow-fg: #d9c76a;
  --tag-green-bg: #243d2c; --tag-green-fg: #6fcf97;
  --tag-blue-bg: #1f3a56; --tag-blue-fg: #6db3f2;
  --tag-purple-bg: #3a2d4f; --tag-purple-fg: #b394e6;
  --tag-pink-bg: #4a2838; --tag-pink-fg: #e08bb4;
  --tag-red-bg: #4c2626; --tag-red-fg: #eb8c8c;
  --project-panel: #22302a;
  --radius: 6px;
  --brand-serif: 'Helvetica Neue LT Std', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  --brand-sans: 'Helvetica Neue LT Std', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  font-size: 15px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
/* тёмные полосы прокрутки во всём приложении */
* { scrollbar-width: thin; scrollbar-color: var(--border-light) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 6px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-dim); }
body {
  background: var(--bg); color: var(--text);
  font-family: var(--brand-sans);
  height: 100vh; overflow: hidden;
}
#app { height: 100vh; display: flex; }

/* ---------- Вход ---------- */
.login-wrap { margin: auto; width: 360px; text-align: center; }
.brand { margin-bottom: 32px; }
.brand-mark {
  display: block; width: 92px; height: 92px; object-fit: contain; margin: 0 auto 20px; background: transparent;
}
.brand-name {
  font-family: 'Bodoni Moda', 'Bodoni MT', 'Bodoni 72', Didot, 'Playfair Display', 'Times New Roman', Georgia, serif;
  font-weight: 500; color: var(--text-bright);
  font-size: 48px; line-height: 1; letter-spacing: .18em; padding-left: .18em; text-align: center;
  cursor: pointer; user-select: none; white-space: nowrap;
  font-variant-numeric: tabular-nums;                 /* буквы не «прыгают» при подмене */
}
.brand-rule { width: 240px; height: 1px; background: rgba(255, 255, 255, .55); margin: 20px auto 12px; }
.brand-sub {
  font-family: var(--brand-sans); text-transform: uppercase; color: var(--text-dim);
  font-size: 13px; letter-spacing: .5em; padding-left: .5em; text-align: center;
}
.login-tagline { color: var(--text-dim); font-size: 13px; margin-bottom: 26px; }
.login-wrap input {
  width: 100%; margin-bottom: 12px;
  padding: 13px 14px; font-size: 16px; border-radius: 9px;
}
.login-wrap button.primary {
  width: 100%; padding: 14px 18px; font-size: 16px; font-weight: 700;
  border-radius: 9px; letter-spacing: .01em;
}
.login-error { color: var(--red); margin-top: 10px; font-size: 13px; min-height: 18px; }

/* ---------- Сайдбар ---------- */
.sidebar {
  width: 240px; min-width: 240px; background: var(--bg-sidebar);
  border-right: 1px solid var(--border); display: flex; flex-direction: column;
  padding: 10px 8px; overflow-y: auto;
}
.sb-head { display: flex; align-items: center; gap: 8px; padding: 6px 8px 4px; }
.sb-logo { width: 26px; height: 26px; border-radius: 6px; background: #000; color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; }
img.sb-logo { object-fit: contain; padding: 0; background: transparent; border-radius: 0; }
.sb-title {
  font-family: 'Bodoni Moda', 'Bodoni MT', 'Bodoni 72', Didot, 'Playfair Display', 'Times New Roman', Georgia, serif;
  font-weight: 600; font-size: 17px; letter-spacing: .14em;
  color: var(--text-bright);
  cursor: pointer; user-select: none; white-space: nowrap;
  font-variant-numeric: tabular-nums;                 /* буквы не «прыгают» при подмене */
}
.sb-title.scrambling, .brand-name.scrambling { color: var(--text-bright); }
/* ячейка одной буквы: ширина зафиксирована по настоящей букве, символ внутри меняется */
.scr-ch { display: inline-block; text-align: center; overflow: hidden; line-height: inherit; vertical-align: baseline; }
.sb-title.shine, .brand-name.shine {
  background: linear-gradient(100deg, var(--text-bright) 35%, #ffffff 50%, var(--text-bright) 65%);
  background-size: 250% 100%;
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
  animation: logoShine 1.6s ease-out;
}
@keyframes logoShine { from { background-position: 120% 0; } to { background-position: -40% 0; } }
@media (prefers-reduced-motion: reduce) { .sb-title.scrambling, .sb-title.shine, .brand-name.scrambling, .brand-name.shine { animation: none; } }
.sb-badge { font-size: 10px; background: var(--tag-yellow-bg); color: var(--tag-yellow-fg); padding: 1px 6px; border-radius: 4px; }
.sb-section { font-size: 11px; color: var(--text-dim); text-transform: uppercase; letter-spacing: .05em; padding: 4px 8px 4px; }
.sb-item {
  display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: var(--radius);
  color: var(--text); cursor: pointer; font-size: 14px; user-select: none;
}
.sb-item:hover { background: var(--bg-hover); }
.sb-item.active {
  background: linear-gradient(90deg, rgba(188,160,98,.26), rgba(188,160,98,.10));
  color: var(--accent); font-weight: 600;
  box-shadow: inset 3px 0 0 var(--accent);
}
.sb-item.active .ico { opacity: 1; color: var(--accent); }
.sb-item.active:hover { background: linear-gradient(90deg, rgba(188,160,98,.34), rgba(188,160,98,.14)); }
.sb-item .ico { width: 18px; height: 18px; display: inline-flex; align-items: center; justify-content: center; opacity: .85; flex: none; }
/* монохромные SVG-иконки наследуют цвет текста */
.ic-svg { display: inline-block; vertical-align: -.15em; flex: none; }
.panel h2 .ic-svg, .spec-sub .ic-svg, .proc-head .ic-svg { vertical-align: -.18em; margin-right: 2px; }
.sb-divider { height: 1px; background: var(--border); margin: 12px 10px; }
.sb-nav { flex: 1; }
.sb-footer { border-top: 1px solid var(--border); padding-top: 8px; }
.sb-user { display: flex; align-items: center; gap: 8px; padding: 6px 8px; font-size: 13px; cursor: pointer; border-radius: var(--radius); }
.sb-user:hover { background: var(--bg-hover); }
.sb-user .who { flex: 1; overflow: hidden; }
.sb-user .name { color: var(--text-bright); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-user .role { color: var(--text-dim); font-size: 11px; }
.sb-logout {
  display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%;
  margin-top: 6px; padding: 8px; font-size: 13px; color: var(--text);
  background: transparent; border: 1px solid var(--border-light); border-radius: var(--radius);
}
.sb-logout:hover { background: var(--tag-red-bg); border-color: var(--red); color: var(--tag-red-fg); }
.sb-install {
  width: 100%; display: flex; align-items: center; gap: 8px; margin-bottom: 6px;
  background: transparent; border: 1px solid var(--border); border-radius: var(--radius);
  color: var(--accent); padding: 7px 8px; font-size: 13px; cursor: pointer;
}
.sb-install:hover { background: rgba(188,160,98,.12); border-color: var(--accent); }
.ios-steps { margin: 8px 0 12px 20px; line-height: 1.7; }
.ios-steps li { margin-bottom: 4px; }
.sb-logout .ico { font-size: 15px; }

/* Активный таймер в сайдбаре */
.sb-timer {
  margin: 0 0 8px; padding: 10px; background: var(--tag-blue-bg);
  border-radius: 8px; font-size: 13px;
}
.sb-timer .t-task { color: var(--text-bright); font-weight: 500; margin-bottom: 2px; }
.sb-timer .t-elapsed { font-variant-numeric: tabular-nums; font-size: 20px; color: var(--tag-blue-fg); margin: 4px 0; }
.sb-timer button { width: 100%; }
.sb-stop { display: flex; align-items: center; justify-content: center; gap: 6px; }
.sb-stop svg { display: block; }

/* ---------- Основная область ---------- */
.main { flex: 1; overflow-y: auto; padding: 28px 40px 80px; }
/* верхняя панель не должна заезжать под плавающие иконки справа сверху */
.main > .toolbar:first-child, .main > .page-title:first-child { padding-right: 270px; }
/* первую панель поднимаем в один ряд с колокольчиком (top:14px) */
.main > .toolbar:first-child { margin-top: -14px; min-height: 34px; }
.page-title { font-family: var(--brand-serif); font-size: 32px; font-weight: 600; letter-spacing: .04em; color: var(--text-bright); margin-bottom: 4px; }
.page-sub { color: var(--text-dim); margin-bottom: 22px; }
.toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar .spacer { flex: 1; }

/* ---------- Кнопки, поля ---------- */
button, .btn {
  background: var(--bg-input); color: var(--text); border: 1px solid var(--border-light);
  border-radius: var(--radius); padding: 6px 12px; font-size: 13px; cursor: pointer;
  font-family: inherit;
}
button:hover, .btn:hover { background: var(--bg-hover); }
button.primary { background: var(--accent); border-color: var(--accent); color: #201a0e; font-weight: 600; }
button.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
button.danger { color: var(--red); }
button.small { padding: 3px 8px; font-size: 12px; }
button.overdue-btn { padding: 7px 12px; font-size: 14px; color: var(--red); border-color: var(--red); }
button.overdue-btn:hover { background: var(--tag-red-bg); }
button.overdue-btn.active { background: var(--red); color: #fff; border-color: var(--red); }
button.ghost { background: transparent; border-color: transparent; color: var(--text-dim); }
button.ghost:hover { background: var(--bg-hover); color: var(--text); }
input, select, textarea {
  background: var(--bg-input); color: var(--text); border: 1px solid var(--border-light);
  border-radius: var(--radius); padding: 7px 10px; font-size: 14px; font-family: inherit;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); }
textarea { resize: vertical; min-height: 70px; }
label.fld { display: block; margin-bottom: 12px; font-size: 13px; color: var(--text-dim); }
label.fld > span { display: block; margin-bottom: 4px; }
label.fld input, label.fld select, label.fld textarea { width: 100%; }
.fld-row { display: flex; gap: 10px; }
.fld-row label.fld { flex: 1; }

/* ---------- Теги ---------- */
.tag { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 12px; white-space: nowrap; }
.tag.st-tag {
  font-size: 13.5px; padding: 3px 11px; white-space: nowrap;
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 104px;                     /* все статусы одной ширины */
  box-sizing: border-box;
}
.tag.st-click { cursor: pointer; transition: filter .15s, box-shadow .15s; }
/* Подсветка всех кнопок с выборкой (статус, фаза, стадия, селекты) */
.tag.st-click:hover,
.phase-cell.phase-click:hover {
  filter: brightness(1.25);
  box-shadow: 0 0 0 1px currentColor inset;
}
/* Стадия: подсветка только плашки, не обёртки с ▾ (иначе кривой прямоугольник) */
.stage-pick-btn:hover > .tag {
  filter: brightness(1.25);
  box-shadow: 0 0 0 1px currentColor inset;
}
.stage-pick-btn { transition: none; }
.stage-pick-btn > .tag { transition: filter .15s, box-shadow .15s; }
select:hover,
.filter-select:hover {
  filter: brightness(1.12);
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(188, 160, 98, 0.45) inset;
}
.tag.st-click::after {
  content: ' ▾';
  font-size: 0.85em;
  opacity: 0.55;
  margin-left: 2px;
}
/* центрированные колонки таблиц задач */
table.nt th.tc, table.nt td.tc { text-align: center; }
table.nt td.tc .status-pick, table.nt td.tc .timer-cell { display: inline-block; }

/* выбор статуса задачи из списка */
.status-pick { position: relative; display: inline-block; }
.status-menu {
  position: absolute; top: 100%; left: 0; margin-top: 6px; z-index: 70;
  display: flex; flex-direction: column; gap: 4px; padding: 6px;
  background: var(--bg-panel); border: 1px solid var(--border-light); border-radius: 10px;
  box-shadow: 0 10px 28px rgba(0,0,0,.5); cursor: default;
}
/* пока меню открыто — контейнеры не обрезают его */
.table-scroll:has(.status-menu) { overflow: visible; }
.panel:has(.status-menu), .pj-zone:has(.status-menu), .proj-sec:has(.status-menu) { overflow: visible; }
tr:has(.status-menu) { position: relative; z-index: 71; }
.status-menu-item { display: block; padding: 2px; border-radius: 7px; cursor: pointer; }
.status-menu-item:hover { background: var(--bg-hover); }
.status-menu-item.active { box-shadow: 0 0 0 1px var(--accent) inset; }
table.nt td .tag { white-space: normal; }   /* длинные плашки (напр. этап) переносятся, а не наезжают на соседний столбец */
table.nt td .tag.st-tag { white-space: nowrap; }   /* но статус — всегда одной строкой */
.tag.gray { background: var(--tag-gray-bg); color: var(--tag-gray-fg); }
.tag.brown { background: var(--tag-brown-bg); color: var(--tag-brown-fg); }
.tag.orange { background: var(--tag-orange-bg); color: var(--tag-orange-fg); }
.tag.yellow { background: var(--tag-yellow-bg); color: var(--tag-yellow-fg); }
.tag.green { background: var(--tag-green-bg); color: var(--tag-green-fg); }
.tag.blue { background: var(--tag-blue-bg); color: var(--tag-blue-fg); }
.tag.purple { background: var(--tag-purple-bg); color: var(--tag-purple-fg); }
.tag.pink { background: var(--tag-pink-bg); color: var(--tag-pink-fg); }
.tag.red { background: var(--tag-red-bg); color: var(--tag-red-fg); }
.tag.clickable { cursor: pointer; }

/* ---------- Таблицы ---------- */
table.nt { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.nt th {
  text-align: left; color: var(--text-dim); font-weight: 500; font-size: 12px;
  padding: 8px 10px; border-bottom: 1px solid var(--border); white-space: nowrap;
}
table.nt td { padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.nt tr:hover td { background: rgba(255,255,255,.02); }
.tmr-btn { width: 30px; height: 28px; padding: 0; display: inline-flex; align-items: center; justify-content: center; font-size: 13px; line-height: 1; }
.tmr-btn svg { display: block; }
table.nt .timer-run { color: var(--red); border-color: var(--red); font-size: 15px; }
table.nt .timer-run:hover { background: var(--red); color: #fff; }
table.nt tr.tr-click { cursor: pointer; }
table.nt tr.tr-click:hover td { background: rgba(255,255,255,.04); }
table.nt .row-link { color: var(--text-bright); cursor: pointer; font-weight: 500; }
.proj-name-gold { color: var(--accent); font-family: Aptos, 'Aptos Display', 'Segoe UI', system-ui, sans-serif; font-weight: 600; }
table.nt .row-link.proj-name-gold { color: var(--accent); font-family: Aptos, 'Aptos Display', 'Segoe UI', system-ui, sans-serif; font-weight: 600; }
table.nt .row-link:hover { text-decoration: underline; }
.table-scroll { overflow-x: auto; }

/* ---------- Доска (kanban) ---------- */
.board { display: flex; gap: 28px; align-items: flex-start; overflow-x: auto; padding: 4px 4px 20px; }
.board-col { min-width: 270px; width: 270px; border-radius: 10px; transition: background .12s, box-shadow .12s; }
/* перетаскивание карточек между колонками */
.card-drag { cursor: grab; }
.card-drag:active { cursor: grabbing; }
.card-dragging { opacity: .45; }
body.dnd-on .board-col { outline: 1px dashed var(--border-light); outline-offset: 4px; }
.board-col.drop-on {
  background: rgba(188,160,98,.10);
  outline: 2px dashed var(--accent); outline-offset: 4px;
  box-shadow: 0 0 0 4px rgba(188,160,98,.06);
}
.c-cmt { color: var(--text-dim); }
.board-col-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.board-col-head .cnt { color: var(--text-dim); font-size: 12px; }
.col-add {
  margin-left: auto; width: 24px; height: 24px; padding: 0; border-radius: 6px;
  border: 1px solid var(--border-light); background: var(--bg-input); color: var(--text-bright);
  font-size: 16px; line-height: 1; cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
}
.col-add:hover { background: var(--accent); color: #1a1a1a; border-color: var(--accent); }
.board-proj {
  font-family: var(--brand-serif); font-size: 12px; font-weight: 600; color: var(--accent);
  margin: 10px 0 6px; padding-bottom: 4px; border-bottom: 1px solid var(--border);
  text-transform: uppercase; letter-spacing: .03em;
}
.board-proj:first-child { margin-top: 0; }
.board-proj-name {
  color: var(--accent); cursor: pointer;
}
.board-proj-name:hover { text-decoration: underline; color: var(--text-bright); }
.add-inline.proj-add { margin: 2px 0 14px; font-size: 12px; opacity: .8; }
.add-inline.proj-add:hover { opacity: 1; }
.card {
  position: relative;
  background: var(--bg-card); border: 1px solid var(--border); border-radius: 8px;
  padding: 10px 12px; margin-bottom: 8px; cursor: pointer; font-size: 13.5px;
}
.card .c-title { padding-right: 26px; }
.card-timer {
  position: absolute; top: 8px; right: 8px; width: 24px; height: 24px; padding: 0;
  border-radius: 6px; border: 1px solid var(--border-light); background: var(--bg-input);
  color: var(--accent); font-size: 11px; line-height: 1; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
.card-timer:hover { background: var(--accent); color: #1a1a1a; }
.topright { position: fixed; top: 14px; right: 50px; z-index: 40; display: flex; align-items: center; gap: 10px; }
/* AI-ассистент */
.ai-fab {
  position: fixed; right: 34px; bottom: 26px; z-index: 95;
  display: inline-flex; align-items: center; gap: 8px; height: 44px; padding: 0 18px;
  border-radius: 22px; cursor: pointer;
  background: linear-gradient(180deg, rgba(188,160,98,.95), rgba(160,132,76,.95));
  border: 1px solid rgba(230,205,150,.55); color: #1a1a1a; font-weight: 600; font-size: 13.5px;
  box-shadow: 0 8px 24px rgba(0,0,0,.45); transition: background .15s, border-color .15s;
}
.ai-fab:hover {
  background: linear-gradient(180deg, rgba(214,186,124,1), rgba(188,160,98,1));
  border-color: rgba(245,225,180,.8);
}
.ai-fab.on { background: var(--bg-panel); color: var(--accent); border-color: var(--accent); }
.ai-fab.on:hover { background: rgba(188,160,98,.18); }
.ai-panel {
  position: fixed; right: 34px; bottom: 82px; z-index: 96;
  width: 420px; max-width: calc(100vw - 70px); height: min(620px, calc(100vh - 130px));
  display: flex; flex-direction: column;
  background: var(--bg-panel); border: 1px solid var(--border-light); border-radius: 14px;
  box-shadow: 0 18px 50px rgba(0,0,0,.55); overflow: hidden;
}
.ai-head {
  display: flex; align-items: baseline; gap: 8px; padding: 10px 12px;
  background: linear-gradient(180deg, rgba(188,160,98,.20), rgba(188,160,98,.06));
  border-bottom: 1px solid var(--border);
}
.ai-head .spacer { flex: 1; }
.ai-head button { align-self: center; }         /* кнопки — по центру, подписи — по базовой линии */
.ai-title { font-family: var(--brand-sans); font-weight: 700; color: var(--accent); }
.ai-body { flex: 1; overflow: auto; padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.ai-msg { max-width: 92%; padding: 9px 12px; border-radius: 12px; font-size: 13.5px; line-height: 1.45; white-space: pre-wrap; }
.ai-msg.user { align-self: flex-end; background: rgba(188,160,98,.18); border: 1px solid rgba(188,160,98,.35); color: var(--text-bright); }
.ai-msg.assistant { align-self: flex-start; background: var(--bg-card); border: 1px solid var(--border); color: var(--text); }
.ai-typing { opacity: .7; font-style: italic; }

select optgroup { background: var(--bg-panel); color: var(--accent); font-style: normal; font-weight: 700; font-size: 12px; }
select optgroup option { color: var(--text); font-weight: 400; font-size: 13px; }

/* ---------- Вложения ---------- */
.att-zone { border: 1px dashed var(--border-light); border-radius: 10px; padding: 10px; transition: background .12s, border-color .12s; }
.att-zone.drop-on { border-color: var(--accent); background: rgba(188,160,98,.08); }
.att-list { display: flex; flex-direction: column; gap: 6px; }
.att-imgs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 4px; }
.att-img { position: relative; display: inline-block; }
.att-img img { width: 84px; height: 84px; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); cursor: zoom-in; display: block; }
.att-row { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.att-name { color: var(--text-bright); text-decoration: none; border-bottom: 1px dotted var(--border-light); }
.att-name:hover { color: var(--accent); }
.att-del {
  position: static; margin-left: auto; background: none; border: 0; color: var(--text-dim);
  cursor: pointer; font-size: 15px; line-height: 1; padding: 0 2px;
}
.att-img .att-del {
  position: absolute; top: -6px; right: -6px; background: var(--bg-panel);
  border: 1px solid var(--border-light); border-radius: 50%; width: 18px; height: 18px;
}
.att-del:hover { color: var(--red); }
.att-hint { margin-top: 8px; }
.att-pick { color: var(--accent); cursor: pointer; text-decoration: underline; }
.att-bar { height: 4px; background: var(--border); border-radius: 3px; overflow: hidden; margin-top: 8px; }
.att-bar i { display: block; height: 100%; background: var(--accent); transition: width .15s; }

/* ---------- Просмотр картинки ---------- */
.lightbox {
  position: fixed; inset: 0; z-index: 200; background: rgba(0,0,0,.85);
  display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 12px; padding: 40px;
}
.lightbox img { max-width: 92vw; max-height: 80vh; border-radius: 8px; }
.lightbox .lb-cap { color: var(--text); font-size: 13px; }
.lightbox button { position: absolute; background: none; border: 0; color: #fff; font-size: 34px; cursor: pointer; opacity: .7; }
.lightbox button:hover { opacity: 1; }
.lb-close { top: 10px; right: 20px; }
.lb-prev { left: 16px; top: 50%; }
.lb-next { right: 16px; top: 50%; }

/* ---------- Тост с отменой ---------- */
.toast-undo { display: flex; align-items: center; gap: 12px; }
.tu-btn { background: none; border: 1px solid var(--accent); color: var(--accent); border-radius: 6px; padding: 2px 10px; cursor: pointer; font-size: 12px; }
.tu-btn:hover { background: rgba(188,160,98,.15); }

/* ---------- Подсветка изменений и выделение ---------- */
@keyframes changeGlow { from { background: rgba(188,160,98,.22); } to { background: transparent; } }
.card-changed { animation: changeGlow 5s ease-out; }
.row-changed td { animation: changeGlow 5s ease-out; }
.row-picked td { background: rgba(188,160,98,.08); }
.card-sel { outline: 2px solid var(--accent); outline-offset: -1px; }
.card-drop { outline: 2px dashed var(--accent); outline-offset: -1px; }
.zone-drop { background: rgba(188,160,98,.12); outline: 2px dashed var(--accent); }

/* ---------- Массовые операции ---------- */
.bulk-bar {
  position: fixed; left: 252px; right: 210px; bottom: 14px; z-index: 60; margin: 0;
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  background: var(--bg-panel); border: 1px solid var(--accent); border-radius: 10px;
  padding: 10px 14px; box-shadow: 0 -6px 24px rgba(0,0,0,.4);
}
.bulk-cnt { color: var(--accent); font-weight: 700; }
.bulk-date { display: flex; align-items: center; gap: 6px; color: var(--text-dim); font-size: 12px; }
.bulk-th, .bulk-td { width: 28px; }

/* ---------- Правка в строке ---------- */
.inline-inp { width: 100%; min-width: 120px; }

/* ---------- Полоса сотрудников для перетаскивания ---------- */
.emp-strip { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 0 0 16px; }
.emp-chip {
  display: inline-flex; align-items: center; gap: 5px; cursor: grab;
  background: var(--bg-card); border: 1px solid var(--border); border-radius: 20px;
  padding: 3px 10px 3px 3px; font-size: 12px; color: var(--text);
}
.emp-chip:hover { border-color: var(--accent); }
.emp-chip:active { cursor: grabbing; }
body.dnd-emp .card { outline: 1px dashed var(--border-light); outline-offset: -1px; }
.av-xs { width: 20px; height: 20px; font-size: 9px; }
.tm-viewers { min-height: 0; }
.tm-viewers .viewers { display: inline-flex; align-items: center; gap: 6px; margin-bottom: 10px; }

/* ---------- Командная строка (Ctrl+K) ---------- */
.palette-back { position: fixed; inset: 0; z-index: 150; background: rgba(0,0,0,.55); display: flex; justify-content: center; padding-top: 12vh; }
.palette { width: 640px; max-width: 94vw; background: var(--bg-panel); border: 1px solid var(--border-light); border-radius: 12px; box-shadow: 0 24px 70px rgba(0,0,0,.55); overflow: hidden; height: fit-content; }
.palette input { width: 100%; border: 0; border-bottom: 1px solid var(--border); background: transparent; color: var(--text-bright); font-size: 15px; padding: 14px 16px; outline: none; }
.palette-list { max-height: 52vh; overflow-y: auto; }
.pl-item { display: flex; align-items: center; gap: 10px; padding: 8px 16px; cursor: pointer; font-size: 13px; }
.pl-item:hover, .pl-item.active { background: rgba(188,160,98,.12); }
.pl-kind { color: var(--text-dim); font-size: 11px; min-width: 76px; text-transform: uppercase; letter-spacing: .04em; }
.pl-label { color: var(--text-bright); }
.pl-empty { padding: 14px 16px; }
.palette-foot { padding: 8px 16px; border-top: 1px solid var(--border); }

/* на устройствах с сенсорным вводом перетаскивание карточек не используется */
@media (hover: none) {
  .card-drag { cursor: pointer; }
  .emp-strip { display: none; }
}

/* ---------- История изменений задачи ---------- */
.tlog { max-height: 240px; overflow-y: auto; display: flex; flex-direction: column; gap: 4px; }
.tlog-row { display: flex; gap: 8px; align-items: baseline; font-size: 12.5px; flex-wrap: wrap; }
.tlog-when { min-width: 118px; }
.tlog-who { color: var(--text-bright); }
.tlog-what { color: var(--text-dim); }
.tlog-what b { color: var(--text); }
.tlog-from { text-decoration: line-through; opacity: .7; }

/* ---------- Справочник подрядчиков: всё по центру ---------- */
table.nt.sup-table th,
table.nt.sup-table td { text-align: center; vertical-align: middle; }

/* ---------- Дашборд ---------- */
.dash-cols { display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap; }
.dash-cols > .panel { flex: 1 1 420px; min-width: 320px; }
.dash-emp { display: inline-flex; align-items: center; gap: 8px; }
.dash-bar-cell { width: 120px; }
.dash-bar { display: block; height: 8px; border-radius: 4px; background: linear-gradient(90deg, var(--accent), rgba(188,160,98,.45)); min-width: 2px; }
.dash-list { display: flex; flex-direction: column; gap: 6px; max-height: 320px; overflow-y: auto; }
.dash-item { display: flex; flex-direction: column; gap: 2px; padding: 6px 8px; border-radius: 6px; cursor: pointer; }
.dash-item:hover { background: var(--bg-hover); }

/* ---------- Комментарии к задаче ---------- */
.cmt-list { max-height: 260px; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; padding-right: 4px; }
.cmt { display: flex; gap: 8px; align-items: flex-start; }
.cmt-body { flex: 1; min-width: 0; background: var(--bg-card); border: 1px solid var(--border); border-radius: 8px; padding: 7px 10px; }
.cmt-head { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.cmt-head b { color: var(--text-bright); font-size: 12.5px; }
.cmt-del { margin-left: auto; background: none; border: 0; color: var(--text-dim); cursor: pointer; padding: 0 2px; line-height: 1; font-size: 15px; }
.cmt-del:hover { color: var(--red); }
.cmt-text { white-space: pre-wrap; word-break: break-word; font-size: 13px; margin-top: 3px; }
.cmt-new { display: flex; gap: 8px; align-items: flex-end; margin-top: 10px; }
.cmt-new textarea { flex: 1; resize: vertical; min-height: 42px; }

/* ---------- Индикатор ожидания ответа ИИ ---------- */
.ai-loading { display: flex; align-items: center; gap: 9px; font-size: 13px; padding: 4px 0; }
.ai-loading-sp {
  width: 14px; height: 14px; flex: none; border-radius: 50%;
  border: 2px solid rgba(188,160,98,.25); border-top-color: var(--accent);
  animation: aiSpin .8s linear infinite;
}
.ai-loading-txt {
  color: var(--text-dim);
  background: linear-gradient(90deg, var(--text-dim) 0%, var(--accent) 45%, var(--text-dim) 90%);
  background-size: 220% 100%;
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
  animation: aiShimmer 1.6s linear infinite;
}
.ai-loading-dots { display: inline-flex; gap: 2px; margin-left: 1px; }
.ai-loading-dots i {
  width: 3px; height: 3px; border-radius: 50%; background: var(--accent);
  align-self: flex-end; margin-bottom: 3px; opacity: .3;
  animation: aiDot 1.2s ease-in-out infinite;
}
.ai-loading-dots i:nth-child(2) { animation-delay: .2s; }
.ai-loading-dots i:nth-child(3) { animation-delay: .4s; }
@keyframes aiSpin { to { transform: rotate(360deg); } }
@keyframes aiShimmer { from { background-position: 120% 0; } to { background-position: -60% 0; } }
@keyframes aiDot { 0%, 60%, 100% { opacity: .25; transform: none; } 30% { opacity: 1; transform: translateY(-2px); } }
@media (prefers-reduced-motion: reduce) {
  .ai-loading-sp, .ai-loading-txt, .ai-loading-dots i { animation: none; }
  .ai-loading-txt { -webkit-text-fill-color: currentColor; }
}
.ai-cost { margin-top: 6px; opacity: .6; font-size: 11px; }
.ai-msg .ai-h { color: var(--accent); font-weight: 700; margin: 6px 0 3px; }
.ai-msg .ai-h:first-child { margin-top: 0; }
.ai-msg .ai-li { padding-left: 6px; }
/* предложенные действия ассистента */
.ai-acts { margin-top: 8px; display: flex; flex-direction: column; gap: 6px; }
.ai-act {
  display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 8px;
  background: rgba(188,160,98,.10); border: 1px solid rgba(188,160,98,.30); font-size: 12.5px;
}
.ai-act.done { opacity: .6; }
.ai-act-txt { flex: 1; color: var(--text-bright); }
.ai-act-ok { color: #7fbf7f; font-size: 12px; white-space: nowrap; }
.ai-tools { display: flex; flex-wrap: wrap; gap: 6px; }
.voice-btn { margin-left: 8px; }
.voice-btn.rec { background: var(--red); color: #fff; border-color: var(--red); }

/* дубли задач */
.dup-group { background: var(--bg-card); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; margin-bottom: 10px; }
.dup-head { color: var(--accent); font-weight: 600; margin-bottom: 8px; }
.dup-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 5px 0; border-top: 1px solid var(--border); }
.dup-row:first-of-type { border-top: 0; }
.dup-row .spacer { flex: 1; }
.dup-keep { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; color: var(--text-dim); white-space: nowrap; }
.dup-title { color: var(--text-bright); }
.dup-actions { margin-top: 8px; }

/* расходы на ИИ */
.au-top { display: flex; gap: 24px; flex-wrap: wrap; margin-bottom: 14px; }
.au-big { font-size: 24px; font-weight: 700; color: var(--accent); }
.au-lim { display: flex; gap: 6px; align-items: center; }
.au-lim input { width: 90px; background: var(--bg-input); border: 1px solid var(--border-light); border-radius: 6px; color: var(--text-bright); padding: 4px 8px; }
.au-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 14px; }

/* разбор планёрки */
.ap-head { margin: 10px 0 6px; }
.ap-list { max-height: 46vh; overflow: auto; display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.ap-item { display: flex; gap: 10px; padding: 8px 10px; background: var(--bg-card); border: 1px solid var(--border); border-radius: 8px; }
.ap-item .ap-body { flex: 1; display: flex; flex-direction: column; gap: 5px; }
.ap-text { color: var(--text-bright); }
.ap-resp { max-width: 260px; }
/* черновик отчёта */
.awr-body { max-height: 55vh; overflow: auto; line-height: 1.5; font-size: 13.5px; }
.ai-hello { display: flex; flex-direction: column; gap: 10px; }
.ai-sugg { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.ai-chip {
  font-size: 12px; padding: 5px 10px; border-radius: 14px; cursor: pointer;
  background: var(--bg-card); border: 1px solid var(--border); color: var(--text);
}
.ai-chip:hover { border-color: var(--accent); color: var(--accent); }
.ai-file {
  display: flex; align-items: center; gap: 8px; padding: 7px 10px; font-size: 12px;
  background: rgba(188,160,98,.12); border-top: 1px solid var(--border); color: var(--text-bright);
}
.ai-file .spacer { flex: 1; }
.ai-file-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 200px; }
.ai-input-row { display: flex; gap: 8px; padding: 10px; border-top: 1px solid var(--border); align-items: flex-end; }
.ai-input-row textarea {
  flex: 1; resize: none; min-height: 38px; max-height: 120px;
  background: var(--bg-input); border: 1px solid var(--border-light); border-radius: 8px;
  color: var(--text-bright); padding: 9px 10px; font-family: inherit; font-size: 13.5px;
}
.ai-input-row textarea:focus { outline: none; border-color: var(--accent); }
.ai-clip {
  flex: none; width: 38px; min-height: 38px; align-self: stretch;
  display: inline-flex; align-items: center; justify-content: center; font-size: 17px;
  background: var(--bg-input); border: 1px solid var(--border-light); border-radius: 8px;
  color: var(--text); cursor: pointer;
}
.ai-clip:hover { border-color: var(--accent); color: var(--accent); }

/* кнопка «смотреть глазами сотрудника» (только админ) */
.viewas-btn {
  display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 10px;
  border-radius: 17px; background: var(--bg-panel); border: 1px solid var(--border);
  color: var(--text-dim); cursor: pointer; box-shadow: 0 2px 10px rgba(0,0,0,.3);
}
.viewas-btn:hover { color: var(--accent); border-color: var(--accent); }
.viewas-btn.on { background: rgba(188,160,98,.22); border-color: var(--accent); color: var(--accent); }
.viewas-lbl { font-size: 12px; font-weight: 600; white-space: nowrap; }
/* сектор загруженного протокола */
.planerka-group { margin-bottom: 16px; }
.planerka-group .planerka { margin-bottom: 8px; }
.planerka-group .planerka:last-child { margin-bottom: 0; }
.proto-card { padding: 0; overflow: hidden; border-left: 3px solid #5b93d6; border-color: rgba(91,147,214,.45); border-left-color: #5b93d6; }
.proto-card-head {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 14px;
  background: linear-gradient(180deg, rgba(91,147,214,.22), rgba(91,147,214,.08));
}
.proto-card-head .spacer { flex: 1; }
.proto-card-head .ic-svg { color: #8fbdf0; }
.proto-card-head .proto-card-name { color: #cfe3fa; }
.proto-card-head .proto-card-name:hover { color: #fff; }
.proto-card-name {
  font-weight: 600; color: var(--text-bright); cursor: pointer; max-width: 340px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.proto-card-name:hover { color: var(--accent); text-decoration: underline; }
.proto-card-note { padding: 0 14px 10px; }

/* окно разбора протокола */
.proto-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.proto-tools .spacer { flex: 1; }
.proto-list { max-height: 52vh; overflow: auto; border: 1px solid var(--border); border-radius: 8px; }
.proto-item {
  display: flex; align-items: flex-start; gap: 10px; padding: 8px 10px;
  border-bottom: 1px solid var(--border);
}
.proto-item:last-child { border-bottom: 0; }
.proto-item:hover { background: var(--bg-hover); }
.proto-item.added { opacity: .55; }
.proto-item input[type=checkbox] { margin-top: 3px; width: 16px; height: 16px; accent-color: var(--accent); flex: none; }
.proto-text { flex: 1; min-width: 0; font-size: 13px; line-height: 1.35; }
.proto-sec { color: var(--accent); font-size: 11px; text-transform: uppercase; letter-spacing: .03em; margin-bottom: 2px; }
.proto-emp { flex: none; width: 190px; height: 30px; font-size: 12px; }

/* загруженный протокол планёрки */
.prot-file { display: inline-flex; align-items: center; gap: 2px; max-width: 320px; }
.prot-file .small { max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* окно-напоминание с одной кнопкой ОК */
.alert-back {
  position: fixed; inset: 0; z-index: 300; display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,.55); backdrop-filter: blur(2px);
  animation: alertFade .18s ease-out;
}
@keyframes alertFade { from { opacity: 0; } to { opacity: 1; } }
.alert-box {
  width: 320px; max-width: 90vw; text-align: center; overflow: hidden;
  background: var(--bg-card); border: 1px solid var(--border-light); border-radius: 14px;
  box-shadow: 0 18px 50px rgba(0,0,0,.55);
  animation: alertPop .2s cubic-bezier(.2,.7,.3,1);
}
@keyframes alertPop { from { transform: scale(.94); opacity: .4; } to { transform: none; opacity: 1; } }
.alert-title { font-size: 18px; font-weight: 700; color: var(--text-bright); padding: 20px 20px 6px; }
.alert-text { font-size: 14px; color: var(--text); padding: 0 20px 18px; line-height: 1.4; }

.alert-act-txt { text-align: center; }
.alert-actions { display: flex; border-top: 1px solid var(--border); }
.alert-ok, .alert-act {
  flex: 1; border: 0; background: transparent;
  color: var(--accent); font-size: 15px; font-weight: 600; padding: 12px; cursor: pointer;
}
.alert-act { border-left: 1px solid var(--border); background: rgba(188,160,98,.14); display: inline-flex; align-items: center; justify-content: center; }
.alert-ok:hover, .alert-act:hover { background: var(--bg-hover); }
.alert-act:hover { background: rgba(188,160,98,.24); }

/* фаза проекта: иконка + подпись */
.phase-cell { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.phase-cell .ic-svg { color: var(--accent); flex: none; }
.phase-cell.phase-click {
  cursor: pointer; padding: 2px 8px; margin: -2px -8px; border-radius: 6px;
  transition: filter .15s, box-shadow .15s, background .15s, color .15s;
}
/* hover: общая подсветка .phase-cell.phase-click:hover */
.phase-btn { display: inline-flex; align-items: center; gap: 5px; }
.viewas-wrap { position: relative; }
.viewas-panel {
  position: absolute; top: 42px; right: 0; min-width: 240px; z-index: 60;
  background: var(--bg-panel); border: 1px solid var(--border-light); border-radius: 10px;
  box-shadow: 0 8px 26px rgba(0,0,0,.45); padding: 6px; overflow: hidden;
}
.viewas-head { font-size: 11px; color: var(--text-dim); padding: 6px 8px 4px; text-transform: uppercase; letter-spacing: .04em; }
.viewas-item {
  display: flex; align-items: center; gap: 8px; padding: 7px 8px; border-radius: 7px;
  cursor: pointer; font-size: 13px; color: var(--text);
}
.viewas-item:hover { background: var(--bg-hover); color: var(--text-bright); }
.viewas-item.active { color: var(--accent); }
.viewas-item.back { color: var(--text-dim); border-top: 1px solid var(--border); margin-top: 4px; padding-top: 9px; border-radius: 0 0 7px 7px; }
.viewas-check { margin-left: auto; color: var(--accent); }
.viewas-name { display: flex; flex-direction: column; line-height: 1.25; }
.viewas-role { font-size: 11px; color: var(--text-dim); }
.notif-wrap { position: relative; }
.notif-bell {
  position: relative; width: 34px; height: 34px; border-radius: 50%;
  background: var(--bg-panel); border: 1px solid var(--border); cursor: pointer;
  color: #fff; box-shadow: 0 2px 10px rgba(0,0,0,.3);
  display: flex; align-items: center; justify-content: center; padding: 0;
}
.notif-bell svg { display: block; }
.notif-bell:hover { border-color: var(--border-light); }
.notif-badge {
  position: absolute; top: -4px; right: -4px; min-width: 16px; height: 16px; padding: 0 3px;
  border-radius: 8px; background: var(--red); color: #fff; font-size: 10px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.notif-panel {
  position: absolute; top: 42px; right: 0; width: 320px; max-height: 60vh; overflow-y: auto;
  background: var(--bg-panel); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: 0 6px 24px rgba(0,0,0,.5); padding: 6px;
}
/* ни на каком экране панель не должна вылезать за края окна */
.notif-panel, .online-panel, .viewas-panel { max-width: calc(100vw - 16px); box-sizing: border-box; }
.notif-head { display: flex; align-items: center; padding: 6px 8px 8px; font-weight: 600; color: var(--text-bright); }
.notif-head .spacer { flex: 1; }
.notif-item { padding: 8px 10px; border-radius: 8px; cursor: pointer; }
.notif-item:hover { background: var(--bg-hover); }
.notif-item.unread { background: rgba(188,160,98,.08); border-left: 2px solid var(--accent); }
.notif-text { color: var(--text); font-size: 13px; }
.notif-time { margin-top: 2px; }
.notif-empty { padding: 14px; text-align: center; }
.online-bar {
  display: inline-flex; align-items: center; gap: 5px;
  background: var(--bg-panel); border: 1px solid var(--border); border-radius: 20px;
  padding: 4px 12px 4px 10px; cursor: pointer; box-shadow: 0 2px 10px rgba(0,0,0,.3);
}
.online-bar:hover { border-color: var(--border-light); }
.online-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--tag-green-fg); box-shadow: 0 0 6px var(--tag-green-fg); }
.online-bar .avatar.on-av { width: 22px; height: 22px; font-size: 10px; margin-left: -6px; border: 2px solid var(--bg-panel); }
.online-bar .avatar.on-av:first-of-type { margin-left: 2px; }
.online-cnt { font-size: 12px; color: var(--text-dim); margin-left: 4px; white-space: nowrap; }
.online-wrap { position: relative; }
.online-panel {
  position: absolute; top: 42px; right: 0; width: 300px; max-height: 60vh; overflow-y: auto;
  background: var(--bg-panel); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: 0 6px 24px rgba(0,0,0,.5); padding: 6px;
}
.online-phead { display: flex; align-items: center; padding: 6px 8px 8px; font-weight: 600; color: var(--text-bright); }
.online-phead .spacer { flex: 1; }
.online-row { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 8px; cursor: pointer; }
.online-row:hover { background: var(--bg-hover); }
.online-row .avatar.on-av { margin-left: 0; border: none; }
.online-name { flex: 1; min-width: 0; font-size: 13px; color: var(--text); display: flex; flex-direction: column; line-height: 1.25; overflow: hidden; }
.online-name span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.online-status { font-size: 11px; color: var(--text-dim); white-space: nowrap; }
.online-status.on { color: var(--tag-green-fg); }
.online-status.on::before { content: '● '; }
.card-timer.stop { color: var(--red); }
.card-timer.stop:hover { background: var(--red); color: #fff; }
.card:hover { background: var(--bg-hover); border-color: var(--accent); }
.card .c-title { color: var(--text-bright); font-weight: 500; margin-bottom: 6px; }
.card .c-meta { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; font-size: 12px; color: var(--text-dim); }
.card .c-meta .c-time { margin-right: -4px; }   /* правый край плашки времени вровень с кнопкой таймера */
.card .c-title { min-height: 19px; }   /* чтобы плашка времени не заезжала под кнопку таймера */
.card .deadline-over { color: var(--red); }
.tpl-btns { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.tpl-custom { display: inline-flex; align-items: center; gap: 4px; }
.add-inline { color: var(--text-dim); cursor: pointer; padding: 6px 8px; font-size: 13px; border-radius: var(--radius); }
.add-inline:hover { background: var(--bg-hover); }
.load-more {
  cursor: pointer; text-align: center; padding: 7px 8px; margin-bottom: 8px; font-size: 12.5px;
  color: var(--accent); background: var(--bg-card); border: 1px solid var(--border-light);
  border-radius: 8px;
}
.load-more:hover { background: var(--bg-hover); }

/* ---------- Библиотека ---------- */
.lib-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 10px; }
.lib-card {
  display: flex; align-items: center; gap: 10px; background: var(--bg-card);
  border: 1px solid var(--border); border-radius: 8px; padding: 12px 14px; cursor: pointer;
}
.lib-card:hover { background: var(--bg-hover); border-color: var(--border-light); }
.lib-ico { font-size: 20px; line-height: 1; }
.lib-card-title { color: var(--text-bright); font-weight: 500; font-size: 14px; }
.lib-article-head { display: flex; align-items: flex-start; gap: 12px; }
.lib-article-ico { font-size: 34px; line-height: 1; }
.lib-article { max-width: 820px; line-height: 1.6; }
.lib-article .lib-h2 { font-size: 20px; color: var(--text-bright); margin: 22px 0 8px; padding-bottom: 5px; border-bottom: 1px solid var(--border); }
.lib-article h3 { font-size: 16px; color: var(--text-bright); margin: 16px 0 6px; }
.lib-article h4 { font-size: 14px; color: var(--text); margin: 12px 0 4px; }
.lib-article p { margin: 8px 0; }
.lib-article ul { margin: 8px 0 8px 22px; }
.lib-article li { margin: 4px 0; }
.lib-article > :first-child { margin-top: 0; }
.lib-callout {
  background: var(--tag-red-bg); color: var(--tag-red-fg); border-radius: 8px;
  padding: 12px 14px; margin: 14px 0; font-size: 14px;
}
.lib-callout::before { content: '❗ '; }

/* ---------- Google-таблица (отчёт отдела) ---------- */
table.gsheet { border-collapse: collapse; font-size: 12px; }
table.gsheet th, table.gsheet td {
  border: 1px solid var(--border); padding: 4px 8px; vertical-align: top;
  white-space: pre-line; min-width: 90px; max-width: 340px; color: var(--text);
}
table.gsheet th { background: var(--bg-hover); color: var(--text-bright); text-align: left; }
table.gsheet tr:nth-child(odd) td { background: rgba(255, 255, 255, .015); }
.gs-topfade { position: fixed; top: 0; left: 240px; right: 0; height: 46px; pointer-events: none; z-index: 4; display: none; background: linear-gradient(to bottom, var(--bg) 45%, transparent); }
.gs-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.gs-tab { padding: 5px 14px; }
.gs-tab.active { background: var(--accent); border-color: var(--accent); color: #201a0e; font-weight: 600; }
/* сгруппировано по неделям */
.topscroll { overflow-x: auto; overflow-y: hidden; position: sticky; top: 0; z-index: 5; background: var(--bg); padding: 4px 0; margin-bottom: 4px; scrollbar-width: thin; scrollbar-color: var(--border-light) var(--bg); }
.topscroll > div { height: 1px; }
.topscroll::-webkit-scrollbar { height: 12px; }
.topscroll::-webkit-scrollbar-track { background: var(--bg); }
.topscroll::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 6px; border: 3px solid var(--bg); }
.topscroll::-webkit-scrollbar-thumb:hover { background: var(--text-dim); }
/* столбики «время за неделю» на странице сотрудника */
.wk-bars { display: flex; gap: 10px; align-items: flex-end; height: 110px; margin: 4px 0 14px; }
.wk-bar { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; }
.wk-bar-fill { width: 70%; min-height: 2px; background: var(--accent); opacity: .75; border-radius: 4px 4px 0 0; }
.wk-bar-lbl { font-size: 11px; color: var(--text-dim); margin-top: 4px; }
.wk-bar-val { font-size: 10px; }
.wk-row { display: flex; gap: 16px; align-items: flex-start; overflow-x: auto; padding-bottom: 14px; scrollbar-width: thin; scrollbar-color: var(--border-light) var(--bg); }
.wk-row::-webkit-scrollbar { height: 12px; }
.wk-row::-webkit-scrollbar-track { background: var(--bg); }
.wk-row::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 6px; border: 3px solid var(--bg); }
.wk-row::-webkit-scrollbar-thumb:hover { background: var(--text-dim); }
.wk-card { flex: none; width: 470px; background: var(--bg-panel); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.wk-head { padding: 12px 14px; font-weight: 600; font-size: 15px; color: #fff; position: relative; z-index: 2; will-change: transform; }
.wk-sub { padding: 8px 14px; color: var(--text); font-weight: 500; border-bottom: 1px solid var(--border); background: rgba(255, 255, 255, .02); }
.gs-tbl { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.gs-tbl th, .gs-tbl td { border-bottom: 1px solid var(--border); padding: 6px 9px; vertical-align: top; text-align: left; }
.gs-cols th { color: var(--text-dim); font-weight: 500; font-size: 11px; }
.gs-stage td { background: var(--bg-hover); color: var(--text-bright); font-weight: 600; }
.gs-proj td { background: rgba(255, 255, 255, .05); color: var(--text-bright); font-weight: 600; }

/* Подзадачи (чек-лист внутри задачи) */
.sub-row { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.sub-row input[type="checkbox"] { flex: none; width: 15px; height: 15px; accent-color: var(--accent); }
.sub-title { flex: 1; }
.sub-title.sub-done { text-decoration: line-through; color: var(--text-dim); }
.sub-assignee { flex: none; width: 150px; max-width: 40%; }
.avatar.sub-av { width: 18px; height: 18px; font-size: 9px; margin-left: 3px; vertical-align: middle; }
.ro-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 16px; margin-bottom: 12px; }
.ro-subs { margin: 4px 0 0; padding-left: 4px; list-style: none; }
.ro-subs li { padding: 2px 0; }
.sub-foot { display: flex; align-items: center; gap: 10px; margin-top: 4px; }
.c-time {
  display: inline-flex; align-items: center; gap: 3px; white-space: nowrap;
  margin-left: auto; order: 99;
  font-size: 11px; color: var(--accent); background: rgba(188, 160, 98, .12);
  border: 1px solid rgba(188, 160, 98, .35); border-radius: 6px; padding: 1px 6px;
}
.c-time svg { opacity: .85; }
.c-time.live { color: #7fb6e6; background: rgba(110, 160, 210, .16); border-color: rgba(110, 160, 210, .45); }
.sub-cnt { font-family: Aptos, 'Aptos Display', 'Segoe UI', system-ui, sans-serif; font-size: 12px; font-weight: 600; color: var(--text-dim); white-space: nowrap; letter-spacing: .02em; }
.sub-cnt.all-done { color: #7fbf7f; }

/* Комплектация (сметирование): подрядчики, КП, клиент */
.proc-box { border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; margin-bottom: 12px; background: rgba(255, 255, 255, .02); }
.proc-head { font-weight: 600; color: var(--text-bright); margin-bottom: 10px; }
.proc-tbl input, .proc-tbl select { font-size: 12.5px; padding: 4px 6px; }
.proc-inp { min-width: 90px; width: 100%; }
.proc-client { display: flex; align-items: center; gap: 10px; margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--border); flex-wrap: wrap; }
.kp-total { color: var(--accent); font-weight: 600; white-space: nowrap; }
.gs-pm td { color: var(--text-dim); font-size: 11px; }
.gs-name { color: var(--text-bright); white-space: pre-line; width: 27%; }
.gs-task { white-space: pre-line; }
.gs-hours { width: 15%; color: var(--text-dim); white-space: nowrap; }
.gs-tbl .gs-status { text-align: center; }
table.nt th.sortable { cursor: pointer; user-select: none; white-space: nowrap; }
table.nt th.sortable:hover { color: var(--text-bright); }
#hours-body table.nt tr:not(.gs-proj):nth-child(even) td { background: rgba(255, 255, 255, .04); }
#hours-body table.nt tr:hover td { background: rgba(255, 255, 255, .09) !important; }
#hours-body table.nt td, #hours-body table.nt th { vertical-align: middle; }
#hours-body table.nt .gs-status { text-align: center; }
.gs-statusrow td { text-align: center; }

/* ---------- Календарь ---------- */
.cal-month { color: var(--text-bright); font-weight: 600; min-width: 130px; text-align: right; }
.cal { border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background: var(--bg-panel); }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); }
.cal-dow > div { padding: 7px 8px; font-size: 12px; color: var(--text-dim); border-bottom: 1px solid var(--border); }
.cal-cell {
  min-height: 108px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border);
  padding: 5px 6px; overflow: hidden;
}
.cal-cell:nth-child(7n) { border-right: none; }
.cal-body > .cal-cell:nth-last-child(-n+7) { border-bottom: none; }
.cal-cell.out { background: rgba(255, 255, 255, 0.02); }
.cal-cell.out .cal-daynum { opacity: .45; }
.cal-cell.has-vac { background: var(--tag-green-bg); }
.cal-daynum { font-size: 12px; color: var(--text-dim); margin-bottom: 5px; line-height: 20px; }
.cal-cell.today .cal-daynum {
  background: var(--red); color: #fff; border-radius: 50%; width: 22px; height: 22px;
  display: inline-flex; align-items: center; justify-content: center; margin-bottom: 3px;
}
.cal-ev { font-size: 11px; line-height: 1.3; border-radius: 4px; padding: 3px 6px; margin-bottom: 4px; background: var(--bg-card); color: var(--text-bright); }
.cal-ev.vac { background: transparent; padding: 2px 0; font-weight: 500; }
.cal-ev.vac .cal-ev-sub { color: var(--tag-green-fg); }
.cal-ev .cal-ev-sub { display: block; color: var(--text-dim); font-size: 10px; margin-top: 2px; }
.cal-ev .tag { font-size: 10px; padding: 0 5px; }

/* ---------- Панели / блоки страницы ---------- */
.panel {
  background: var(--bg-panel); border: 1px solid var(--border); border-radius: 10px;
  padding: 18px 20px; margin-bottom: 20px;
}
.panel.greenish { background: var(--project-panel); }
/* «Все задачи» — тот же приём, только в синем */
.panel.bluish { background: #202b38; }
/* содержимое цветной панели лежит на тёмной подложке — цвет виден только по краям */
.panel.bluish > .table-scroll,
.panel.greenish > .table-scroll,
.panel.bluish > [data-zone-body] > .table-scroll,
.panel.greenish > [data-zone-body] > .table-scroll {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 10px; padding: 4px 8px;
}
.panel.bluish .grp-row td, .panel.greenish .grp-row td { background: rgba(255,255,255,.04); }
/* заголовки панелей и названия проектов в них — золотистые */
.panel h2 { font-family: var(--brand-serif); font-size: 18px; font-weight: 600; color: var(--accent); margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.panel h2 .row-link, .panel h2 .sec-toggle, .panel h2 .ic-svg { color: var(--accent); }
.panel h2 .muted, .panel h2 .muted.small { color: var(--text-dim); }
.panel h2 button { color: var(--text); }
.panel h2 button.primary { color: #1a1a1a; }

/* Заголовки проектов в списке задач и панелях */
.panel h2.zone-head,
.panel h2.zone-head .proj-name-gold {
  font-family: Aptos, 'Aptos Display', 'Segoe UI', system-ui, sans-serif;
  font-weight: 600;
}
.panel h2.zone-head .muted.small {
  font-family: Aptos, 'Segoe UI', system-ui, sans-serif;
  font-weight: 500;
}

.panel:has(> h2.zone-head:last-child) { cursor: pointer; }
/* Заголовок зоны на всю площадь панели (padding панели тоже кликабелен) */
.panel > h2.zone-head {
  min-height: 48px;
  margin: -18px -20px 12px;
  padding: 18px 20px;
  box-sizing: border-box;
  width: auto;
  cursor: pointer;
  border-radius: 9px 9px 0 0;
}
.panel > h2.zone-head:last-child {
  margin-bottom: -18px;
  border-radius: 9px;
}
.panel > h2.zone-head:hover {
  background: rgba(188, 160, 98, 0.08);
}
.panel h2.zone-head .zone-chevron {
  display: inline-flex; align-items: center; justify-content: center;
  width: 1.1em; height: 1.1em; line-height: 1; margin: 0; flex-shrink: 0;
  position: relative; top: 0;
}
.panel h2.zone-head .row-link, .panel h2.zone-head .proj-name-gold {
  display: inline-flex; align-items: center; line-height: 1.25;
}
.panel h2.zone-head .muted.small {
  display: inline-flex; align-items: center; margin-left: 2px; line-height: 1;
}
.panel h2 .spacer { flex: 1; }
/* правка затраченных часов в окне задачи */
.time-list { display: flex; flex-direction: column; gap: 6px; }
.time-row { display: flex; align-items: center; gap: 8px; }
.time-name { display: inline-flex; align-items: center; gap: 6px; flex: 1; color: var(--text); }
.time-inp {
  width: 90px; text-align: right; background: var(--bg-input); color: var(--text-bright);
  border: 1px solid var(--border-light); border-radius: 6px; padding: 4px 8px;
}

/* Отчёт за неделю по отделу */
.rp-cols { display: flex; gap: 14px; align-items: flex-start; }
.rp-col { flex: 1 1 0; min-width: 0; }
@media (max-width: 1200px) { .rp-cols { flex-direction: column; } }
.rp-week {
  display: flex; align-items: center; gap: 8px;
  border: 1px solid var(--border); border-radius: 8px; padding: 8px 12px; margin-bottom: 10px;
  font-family: var(--brand-sans); font-size: 14px; font-weight: 600; color: var(--text-bright);
}
.rp-week .rp-week-sum { margin-left: auto; font-weight: 500; font-size: 12px; opacity: .85; }
.rp-week.rp-cur {
  background: linear-gradient(180deg, rgba(90,170,110,.38), rgba(90,170,110,.18));
  border-color: rgba(120,200,140,.75); color: #9fdcb0; font-size: 15px;
  box-shadow: 0 0 0 1px rgba(120,200,140,.35), 0 4px 16px rgba(90,170,110,.18);
}
.rp-week.rp-prev {
  background: linear-gradient(180deg, rgba(200,170,60,.30), rgba(200,170,60,.14));
  border-color: rgba(220,190,90,.60); color: #e0c874;
}
/* левая колонка кликается: выбрать эту неделю как основную */
.rp-week-pick { cursor: pointer; transition: filter .12s, box-shadow .12s; }
.rp-week-pick:hover { filter: brightness(1.18); box-shadow: 0 0 0 1px rgba(220,190,90,.5); }
.rp-week-pick::after {
  content: 'выбрать'; margin-left: 10px; font-size: 11px; font-weight: 500;
  opacity: 0; transition: opacity .12s; text-transform: uppercase; letter-spacing: .04em;
}
.rp-week-pick:hover::after { opacity: .75; }
.rp-panel { padding: 12px 14px; }
.rp-hint { display: none; }
/* смена недели: старая уезжает, новая въезжает с той же стороны, что и свайп */
.rp-out-left { animation: rpOutLeft .13s ease-in forwards; }
.rp-out-right { animation: rpOutRight .13s ease-in forwards; }
.rp-in-right { animation: rpInRight .24s ease-out; }
.rp-in-left { animation: rpInLeft .24s ease-out; }
@keyframes rpOutLeft { to { transform: translateX(-30px); opacity: 0; } }
@keyframes rpOutRight { to { transform: translateX(30px); opacity: 0; } }
@keyframes rpInRight { from { transform: translateX(34px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes rpInLeft { from { transform: translateX(-34px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  .rp-out-left, .rp-out-right, .rp-in-left, .rp-in-right { animation: none; }
}
.rp-sec { font-size: 15px; }
.rp-table td { vertical-align: top; }
.rp-table .rp-proj td { background: var(--bg-hover); color: var(--accent); font-weight: 600; }
/* названия проектов всюду золотистые — перебиваем общее правило table.nt .row-link */
table.nt tr.rp-proj .row-link,
table.nt tr.grp-row .row-link,
table.nt .proj-name-gold,
.rp-proj .row-link,
.board-proj .row-link,
.board-proj,
.checklist-proj,
.es-proj .row-link,
.pj-zone-head .row-link { color: var(--accent); }
.rp-pm td { color: var(--text-dim); font-size: 12px; padding-top: 4px; padding-bottom: 4px; }
.rp-emp { color: var(--text-bright); white-space: nowrap; }
.rp-tasks { min-width: 220px; }
.rp-task { padding: 2px 0; cursor: pointer; line-height: 1.35; }
.rp-task:hover { color: var(--text-bright); }
.rp-task-on { color: var(--text); }
.rp-task-off { color: var(--text-dim); }
.rp-task-h { color: var(--accent); font-size: 12px; margin-left: 4px; white-space: nowrap; }
.rp-hours { width: 92px; text-align: center; }
.rp-inp {
  width: 74px; text-align: center; background: var(--bg-input); color: var(--text-bright);
  border: 1px solid var(--border-light); border-radius: 6px; padding: 3px 6px;
}

/* ---------- Чек-листы планёрок и журнал надзора ---------- */
.checklist { background: var(--bg-panel); border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; margin-bottom: 14px; }
/* шапка планёрки кликается на всю ширину карточки и не оставляет пустоты в свёрнутом виде */
.checklist-head {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap; cursor: pointer;
  margin: -12px -14px 10px; padding: 12px 14px; min-height: 46px;
  border-radius: 9px 9px 0 0; box-sizing: border-box;
}
.checklist-head:last-child { margin-bottom: -12px; border-radius: 9px; }
.checklist-head:hover { background: rgba(188,160,98,.08); }
.checklist-title { font-family: var(--brand-sans); font-size: 16px; font-weight: 600; color: var(--accent); display: inline-flex; align-items: center; gap: 6px; }
.checklist-sub { color: var(--text-dim); font-size: 12px; display: inline-flex; align-items: center; gap: 4px; }
.checklist-title { cursor: pointer; }
.checklist-title:hover { text-decoration: underline; }
/* пояснение «список задач» — второстепенное, рядом с названием проекта */
.checklist-kind { color: var(--text-dim); font-size: 12px; text-transform: lowercase; }
.checklist-proj { background: var(--bg-card); border: 1px solid var(--border-light); border-radius: 16px; padding: 3px 10px; font-size: 12px; color: var(--text-bright); cursor: pointer; }
.checklist-proj:hover { border-color: var(--accent); color: var(--accent); }
.checklist-cnt { color: var(--text-dim); font-size: 12px; font-style: italic; margin-right: 8px; }
.cl-table td { vertical-align: middle; }
.cl-check { width: 17px; height: 17px; accent-color: var(--accent); cursor: pointer; }
.cl-text { color: var(--text-bright); }
.cl-note { color: var(--text-dim); font-size: 12.5px; }
.cl-done .cl-text, .cl-done .cl-note { text-decoration: line-through; color: var(--text-dim); }
.cl-urgent td:first-child { box-shadow: inset 3px 0 0 var(--red); }
.cl-urgent { background: rgba(235,87,87,.06); }
.proto-card { border-color: var(--border-light); }
.proto-card-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.proto-card-name { color: var(--text-bright); font-weight: 600; cursor: pointer; }
.proto-card-name:hover { color: var(--accent); }
.proto-added { color: var(--tag-green-fg); font-size: 12px; }
.planerka { background: var(--bg-panel); border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; margin-bottom: 14px; }
.planerka-group { margin-bottom: 6px; }
.prot-file { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.zone-date { color: var(--text-dim); font-size: 13px; }
/* блок группы (проект / этап) внутри таблицы задач */
.pj-zone { background: var(--bg-card); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; margin-bottom: 12px; }
.pj-zone:last-child { margin-bottom: 0; }
.pj-zone-head {
  display: flex; align-items: center; gap: 8px; padding: 2px 2px 8px;
  font-family: var(--brand-sans); font-size: 15px; font-weight: 600; color: var(--accent);
}
.pj-zone-head .col-add { margin-left: 6px; }
.pj-zone table.nt th { font-size: 11.5px; }
.pj-zone table.nt td { padding: 6px 10px; }
/* одинаковые колонки во всех группах таблицы задач */
table.nt.tk-table { table-layout: fixed; }
table.nt.tk-table .col-pick { width: 34px; }
table.nt.tk-table .col-project { width: 160px; }
table.nt.tk-table .col-stage { width: 190px; }
table.nt.tk-table .col-deadline { width: 105px; }
table.nt.tk-table .col-resp { width: 170px; }
table.nt.tk-table .col-status { width: 130px; }
table.nt.tk-table .col-spent { width: 100px; }
table.nt.tk-table .col-timer { width: 78px; }
table.nt.tk-table .col-title,
table.nt.tk-table .col-resp,
table.nt.tk-table .col-project { overflow: hidden; text-overflow: ellipsis; }
table.nt.tk-table .col-stage .tag { white-space: normal; display: inline-block; }

/* ---------- Сметы и комплектация ---------- */
.es-group { margin-bottom: 16px; background: var(--bg-panel); border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; }
.es-group:last-child { margin-bottom: 0; }
.es-proj { display: flex; align-items: center; gap: 8px; font-family: var(--brand-sans); font-size: 17px; color: var(--accent); font-weight: 600; margin: 0 0 10px; padding-bottom: 8px; border-bottom: 1px solid var(--border); }
.es-proj .row-link { color: var(--accent); }
.spec-sub { font-family: var(--brand-sans); font-size: 15px; color: var(--text-bright); font-weight: 600; margin: 16px 0 8px; display: flex; align-items: center; gap: 8px; }
.spec-sub:first-of-type { margin-top: 4px; }
.spec-est { border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; margin-bottom: 10px; background: var(--bg-card); }
.spec-est-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.spec-est-resp { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.resp-chip { display: inline-flex; align-items: center; gap: 5px; background: var(--bg-panel); border: 1px solid var(--border); border-radius: 16px; padding: 2px 10px 2px 2px; cursor: pointer; font-size: 12px; }
.resp-chip:hover { border-color: var(--accent); }
.con-approved td { background: rgba(111,207,151,.08); }
.proc-client { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 10px; }

/* ---------- Стадии и фаза проекта ---------- */
.stage-pick { position: relative; display: inline-block; }
.stage-caret { margin-left: 4px; opacity: .6; font-size: .85em; }
.stage-menu {
  position: absolute; top: 100%; left: 0; z-index: 70; margin-top: 4px; min-width: 220px;
  background: var(--bg-panel); border: 1px solid var(--border-light); border-radius: 10px;
  box-shadow: 0 8px 26px rgba(0,0,0,.5); padding: 6px; text-align: left;
}
.stage-menu-head { font-size: 11px; color: var(--text-dim); text-transform: uppercase; letter-spacing: .04em; padding: 6px 8px 4px; }
.stage-menu-item { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 7px; cursor: pointer; font-size: 13px; color: var(--text); }
.stage-menu-item:hover { background: var(--bg-hover); color: var(--text-bright); }
.stage-menu-item.active { color: var(--accent); }
.stage-menu-st { margin-left: auto; font-size: 11px; color: var(--text-dim); }
.stage-track { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.phase-panel { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.phase-switch { display: inline-flex; align-items: center; gap: 4px; }
.phase-label { font-family: var(--brand-serif); font-size: 15px; font-weight: 600; color: var(--text-bright); margin-right: 4px; }

/* ---------- Секторы на странице проектов ---------- */
/* Секторы страницы проектов: проектирование — зелёный, реализация — синий, завершённые — золотой */
.proj-sec { border-width: 1px; }
.proj-sec-head { display: flex; align-items: center; gap: 8px; margin: 0 0 10px; cursor: pointer; }
.proj-sec-title { font-family: var(--brand-sans); font-size: 17px; font-weight: 700; letter-spacing: .01em; }
.proj-sec-head .muted.small { font-size: 11.5px; font-weight: 400; }
.proj-sec-cnt {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 26px; height: 22px; padding: 0 8px; border-radius: 11px;
  font-size: 12px; font-weight: 700;
}
.proj-sec .proj-sec-head .zone-chevron { opacity: .8; }

/* цветная только шапка сектора, тело панели — обычное тёмное */
.proj-sec { background: var(--bg-panel); }
.proj-sec > h2.zone-head { border-bottom: 1px solid var(--border); }
.proj-sec table.nt td, .proj-sec table.nt th { padding: 6px 10px; }
.proj-sec .stage-pick, .proj-sec .phase-cell, .proj-sec .cell-dates { white-space: nowrap; }
.proj-sec .cell-sel { width: auto; max-width: 100%; }
.proj-sec .tag { white-space: normal; }

.sec-design > h2.zone-head { background: linear-gradient(180deg, rgba(60,130,90,.34), rgba(60,130,90,.14)); }
.sec-build > h2.zone-head { background: linear-gradient(180deg, rgba(60,110,170,.34), rgba(60,110,170,.14)); }
.sec-done > h2.zone-head { background: linear-gradient(180deg, rgba(160,135,70,.32), rgba(160,135,70,.12)); }

.sec-design { border-color: rgba(110,190,140,.45); }
.sec-design .proj-sec-title, .sec-design .proj-sec-head .zone-chevron, .sec-design .proj-sec-head .ic-svg { color: #8fdcaa; }
.sec-design .proj-sec-cnt { background: rgba(110,190,140,.25); color: #b6ecc8; }
.sec-design > h2.zone-head:hover { background: rgba(110,190,140,.10); }

.sec-build { border-color: rgba(110,165,225,.45); }
.sec-build .proj-sec-title, .sec-build .proj-sec-head .zone-chevron, .sec-build .proj-sec-head .ic-svg { color: #8fbdf0; }
.sec-build .proj-sec-cnt { background: rgba(110,165,225,.25); color: #bcd9f8; }
.sec-build > h2.zone-head:hover { background: rgba(110,165,225,.10); }

.sec-done { border-color: rgba(200,175,110,.42); }
.sec-done .proj-sec-title, .sec-done .proj-sec-head .zone-chevron, .sec-done .proj-sec-head .ic-svg { color: var(--accent); }
.sec-done .proj-sec-cnt { background: rgba(188,160,98,.25); color: #e2cf9c; }
.sec-done > h2.zone-head:hover { background: rgba(188,160,98,.10); }
/* поля прямо в строке таблицы проектов: не мешают читать, проявляются при наведении */
.cell-dates { display: flex; align-items: center; gap: 4px; flex-wrap: nowrap; }
.cell-dates .arrow, .cell-dates > span { color: var(--text-dim); }
.cell-date {
  background: transparent; color: var(--text-dim); color-scheme: dark;
  border: 1px solid transparent; border-radius: 6px; padding: 2px 4px;
  font-size: 12.5px; font-family: inherit; cursor: pointer; min-width: 0;
}
.cell-date:hover { color: var(--text-bright); background: var(--bg-input); border-color: var(--border-light); }
.cell-date:focus { color: var(--text-bright); background: var(--bg-input); border-color: var(--accent); outline: none; }
.cell-sel {
  width: 100%; max-width: 190px; background: transparent; color: var(--text);
  border: 1px solid transparent; border-radius: 6px; padding: 3px 6px;
  font-size: 13px; font-family: inherit; cursor: pointer;
}
.cell-sel:hover { background: var(--bg-input); border-color: var(--border-light); }
.cell-sel:focus { background: var(--bg-input); border-color: var(--accent); outline: none; }
.cell-sel option { background: var(--bg-panel); color: var(--text); }

/* ---------- Фото проекта и аватары ---------- */
.pthumb { width: 22px; height: 22px; border-radius: 4px; object-fit: cover; vertical-align: -6px; margin-right: 7px; }
.photo-prev { width: 100%; aspect-ratio: 4/1; object-fit: cover; border-radius: 8px; }
.photo-banner { width: 100%; aspect-ratio: 4/1; object-fit: cover; border-radius: 12px; margin-bottom: 16px; }
.crop-frame { position: relative; width: 100%; aspect-ratio: 4/1; overflow: hidden; background: #000; border-radius: 8px; cursor: move; user-select: none; touch-action: none; }
.crop-frame img { position: absolute; top: 0; left: 0; max-width: none; }
.crop-ctl { display: flex; align-items: center; gap: 10px; margin-top: 6px; }
.crop-ctl input[type=range] { flex: 1; accent-color: var(--accent); }
.emp-modal-avatar { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; background: var(--bg-card); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; }
.emp-avatar-wrap { position: relative; display: inline-block; }
.emp-avatar-btn {
  position: absolute; right: -6px; bottom: -6px; width: 24px; height: 24px; border-radius: 50%;
  background: var(--bg-panel); border: 1px solid var(--border-light); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; font-size: 12px;
}
.emp-avatar-btn:hover { border-color: var(--accent); }
.emp-avatar-del {
  position: absolute; left: -6px; bottom: -6px; width: 20px; height: 20px; border-radius: 50%;
  background: var(--bg-panel); border: 1px solid var(--border-light); color: var(--text-dim);
  cursor: pointer; line-height: 1; padding: 0;
}
.emp-avatar-del:hover { color: var(--red); border-color: var(--red); }
.emp-profile-meta { min-width: 0; }
.emp-modal-main { min-width: 0; }
.emp-modal-side { min-width: 0; }
.av-crop-wrap { position: relative; width: 220px; height: 220px; margin: 0 auto 8px; overflow: hidden; background: #000; border-radius: 10px; cursor: move; user-select: none; touch-action: none; }
.av-crop-frame { position: absolute; inset: 0; }
.av-crop-frame img { position: absolute; top: 0; left: 0; max-width: none; }
.av-crop-mask { position: absolute; inset: 0; box-shadow: 0 0 0 999px rgba(0,0,0,.55); border-radius: 50%; pointer-events: none; }

/* ---------- Выбор задачи для таймера ---------- */
.timer-pick { max-height: 50vh; overflow: auto; margin-bottom: 10px; }
.tp-proj { color: var(--accent); font-size: 12px; font-weight: 600; margin: 10px 0 4px; }
/* строка выбора задачи: название сверху, метки под ним — ничего не наезжает */
.tp-item {
  display: flex; flex-direction: column; align-items: flex-start; gap: 5px;
  padding: 8px; margin-bottom: 4px; border-radius: 8px; cursor: pointer;
  border: 1px solid var(--border);
}
.tp-item:hover { background: var(--bg-hover); border-color: var(--border-light); }
.tp-title { color: var(--text-bright); line-height: 1.35; overflow-wrap: break-word; }
.tp-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

/* ---------- Уведомления: ссылки внутри текста ---------- */
.notif-timer { margin-top: 6px; display: inline-flex; align-items: center; justify-content: center; text-align: center; }
.notif-link { color: var(--accent); cursor: pointer; }
.notif-link:hover { text-decoration: underline; }
.notif-proj { color: var(--accent); font-weight: 600; }
.notif-emp { color: var(--tag-blue-fg); font-weight: 600; }

/* ---------- Формы, списки и мелкие утилиты ---------- */
/* ---------- Модальные окна ---------- */
.modal-back {
  position: fixed; inset: 0; z-index: 100; background: rgba(0,0,0,.6);
  display: flex; align-items: flex-start; justify-content: center;
  overflow-y: auto; padding: 6vh 16px;
}
.modal-back.modal-locked { background: rgba(0,0,0,.82); }
.modal {
  background: var(--bg-panel); border: 1px solid var(--border-light); border-radius: 12px;
  width: 560px; max-width: 100%; padding: 24px; box-shadow: 0 20px 60px rgba(0,0,0,.5);
}
.modal.modal-wide { width: 1040px; }
.modal { position: relative; }
.modal h3 { color: var(--text-bright); margin-bottom: 18px; font-size: 18px; padding-right: 36px; }
/* крестик закрытия в правом верхнем углу окна */
.modal-x {
  position: absolute; top: 10px; right: 10px; z-index: 2;
  width: 32px; height: 32px; padding: 0; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--bg-card); border: 1px solid var(--border); border-radius: 8px;
  color: var(--text-dim); font-size: 15px; cursor: pointer;
}
.modal-x:hover { color: var(--red); border-color: var(--red); background: var(--tag-red-bg); }
/* в окне обязательной смены пароля закрывать нечем — крестик прячем */
.modal-back.modal-locked .modal-x { display: none; }
.emp-modal-cols { display: flex; gap: 20px; align-items: flex-start; flex-wrap: wrap; }
.emp-modal-cols > .emp-modal-main { flex: 1 1 460px; min-width: 300px; }
.emp-modal-cols > .emp-modal-side { flex: 1 1 420px; min-width: 300px; }
.emp-modal-side .panel { margin-bottom: 14px; }
.emp-modal-side .panel:last-child { margin-bottom: 0; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 18px; flex-wrap: wrap; }
.modal-actions .left { margin-right: auto; }
.multi-list {
  max-height: 190px; overflow-y: auto; background: var(--bg-input);
  border: 1px solid var(--border-light); border-radius: 8px; padding: 6px;
}
.multi-list label { display: flex; align-items: center; gap: 8px; padding: 5px 6px; border-radius: 6px; cursor: pointer; font-size: 13px; }
.multi-list label:hover { background: var(--bg-hover); }
/* важно: общее правило label.fld input { width: 100% } растягивало бы чекбоксы */
.multi-list input[type=checkbox] { width: 16px; height: 16px; flex: none; accent-color: var(--accent); margin: 0; }
.multi-list .nm { color: var(--text); flex: 1; min-width: 0; text-align: left; }
.multi-list .rl { margin-left: auto; flex: none; white-space: nowrap; }
.nm { min-width: 0; }
.rl { color: var(--text-dim); font-size: 12px; }
/* то же самое для строк шаблонов задач и любых чекбоксов внутри полей формы */
label.fld input[type=checkbox], label.fld input[type=radio] { width: auto; }
.checkbox-line input[type=checkbox] { width: 16px; height: 16px; flex: none; }
.tpl-row input[type=checkbox] { width: 16px; height: 16px; flex: none; }
.tpl-row .nm { flex: 1; min-width: 0; }
.tpl-row { display: flex; align-items: center; gap: 8px; }
.tpl-resp { background: var(--bg-panel); color: var(--text); border: 1px solid var(--border-light); border-radius: 6px; padding: 2px 6px; font-size: 12px; max-width: 180px; }
.tpl-edit { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; }
.checkbox-line { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; font-size: 13.5px; cursor: pointer; }
.checkbox-line input[type=checkbox] { accent-color: var(--accent); width: 16px; height: 16px; }
.urgent-line { color: var(--text-bright); }
.fld-title { font-weight: 600; margin-bottom: 8px; display: flex; align-items: center; gap: 6px; }
.settings-divider { border-top: 1px solid var(--border); margin: 18px 0; }
.mb8 { margin-bottom: 8px; }
.chips { display: flex; flex-wrap: wrap; gap: 5px; }
.board-sort { display: inline-flex; align-items: center; gap: 6px; color: var(--text-dim); font-size: 12px; }
.sec-toggle { display: inline-flex; align-items: center; gap: 4px; cursor: pointer; }
.grp-row td { background: var(--bg-hover); color: var(--accent); font-family: var(--brand-serif); font-weight: 600; font-size: 14px; padding-top: 10px; padding-bottom: 10px; vertical-align: middle; }
.grp-sub td { font-size: 13px; color: var(--text-bright); background: rgba(255,255,255,.03); }
.filter-note { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; color: var(--red); font-size: 13px; }
.stat .num { font-size: 26px; font-weight: 700; color: var(--text-bright); line-height: 1.1; }
.stat .lbl { color: var(--text-dim); font-size: 12px; margin-top: 2px; }
.ap-note { color: var(--text-dim); font-size: 12px; margin-top: 2px; }
.ai-spark { color: var(--accent); }
.input-file, input[type="file"] { padding: 5px; font-size: 12.5px; }
@media print {
  .sidebar, .toolbar, button, .nav-burger, .ai-fab { display: none !important; }
  body { background: #fff; color: #000; }
  .main { padding: 0; }
}

/* ---------- Базовые утилиты ---------- */
.muted { color: var(--text-dim); }
.small { font-size: 12px; }
.muted.small { font-size: 12px; color: var(--text-dim); }
.spacer { flex: 1; }
.clickable { cursor: pointer; }
.mytask-red { color: var(--red); }
.row-link { color: var(--text-bright); cursor: pointer; font-weight: 500; }
.row-link:hover { text-decoration: underline; }
.tc { text-align: center; }
.nowrap { white-space: nowrap; }

/* ---------- Плашки статистики, шапка профиля, тосты ---------- */
.stat-row { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 20px; }
.stat {
  background: var(--bg-panel); border: 1px solid var(--border); border-radius: 10px;
  padding: 14px 18px; min-width: 150px;
}
.stat.clickable { cursor: pointer; transition: border-color .15s, background .15s; }
.stat.clickable:hover { border-color: var(--red); }
.stat.stat-on { border-color: var(--red); background: rgba(200, 70, 70, .12); }
.stat.stat-on .lbl { color: var(--red); }

.emp-profile-head { display: flex; align-items: center; gap: 16px; margin-bottom: 18px; }
.emp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.settings-cols { display: flex; gap: 20px; align-items: flex-start; flex-wrap: wrap; }
.settings-col { flex: 1; min-width: 320px; max-width: 520px; }

.toast {
  position: fixed; bottom: 20px; right: 20px; z-index: 200;
  background: var(--bg-card); color: var(--text-bright);
  border: 1px solid var(--border-light); border-radius: 8px; padding: 10px 16px;
  box-shadow: 0 8px 30px rgba(0,0,0,.5); font-size: 13.5px; max-width: 70vw;
}
.toast.err { border-color: var(--red); color: var(--tag-red-fg); }

/* ---------- Аватары ---------- */
.avatar {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 26px; height: 26px; border-radius: 50%; overflow: hidden;
  font-size: 11px; font-weight: 700; color: #fff; letter-spacing: .02em;
  vertical-align: middle; user-select: none;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar.av-photo { background: var(--bg-card); }
.avatar.av-xs { width: 20px; height: 20px; font-size: 9px; }
.emp-avatar-lg { width: 84px; height: 84px; font-size: 26px; border-radius: 50%; }
/* цвета кружков с инициалами */
.av-gray { background: #4a4a4a; }
.av-brown { background: #6b4a30; }
.av-orange { background: #8a5a22; }
.av-yellow { background: #7a6a20; }
.av-green { background: #2f6a45; }
.av-blue { background: #2b5a86; }
.av-purple { background: #574075; }
.av-pink { background: #7a3f57; }
.av-red { background: #7a3535; }

/* столбец с именем сотрудника не переносится и не режется по буквам */
.emp-name-cell { white-space: nowrap; }
.more-chip { opacity: .85; }
.more-chip:hover { opacity: 1; border-color: var(--accent); color: var(--accent); }

/* ---------- Мелочи, потерянные при правке файла ---------- */
.att-ico { font-size: 15px; line-height: 1; flex: none; }
.att-progress:empty { display: none; }
.stat.stat-overdue .num { color: var(--red); }
.stat.stat-gold.clickable:hover { border-color: var(--accent); }
.stat.stat-gold.stat-on { border-color: var(--accent); background: rgba(188,160,98,.12); }
.stat.stat-gold.stat-on .lbl { color: var(--accent); }
.stage-chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--bg-card); border: 1px solid var(--border); border-radius: 16px;
  padding: 3px 10px; font-size: 12px; color: var(--text); cursor: pointer;
}
.stage-chip:hover { border-color: var(--accent); color: var(--text-bright); }
.est-panel, .spec-panel { padding: 14px 16px; }
.bday { display: flex; align-items: center; gap: 8px; }
/* это класс ячеек таблицы чек-листов — менять display нельзя, иначе колонки схлопываются */
table.nt th.sp-status,
table.nt td.sp-status { text-align: center; white-space: nowrap; vertical-align: middle; }
.spec-panel table.nt th:first-child, .spec-panel table.nt td:first-child { width: 30%; }
.spec-panel table.nt td { padding: 7px 10px; }
.sup-linked { color: var(--tag-green-fg); font-size: 12px; white-space: nowrap; }

/* ================================================================
   Мобильная и планшетная вёрстка
   ================================================================ */
.nav-burger, .nav-shade { display: none; }

@media (max-width: 900px) {
  :root { font-size: 14px; }

  /* 100vh на телефоне уезжает под адресную строку — используем динамическую высоту */
  body, #app { height: 100dvh; }
  .login-wrap { width: min(360px, 92vw); }

  /* ничего не должно вылезать за правый край экрана */
  html, body, #app { max-width: 100vw; overflow-x: hidden; }
  .main { width: 100%; max-width: 100vw; overflow-x: hidden; }
  .panel, .toolbar, .stat-row, .rp-cols, .dash-cols, .settings-cols { max-width: 100%; }
  .toolbar { flex-wrap: wrap; }
  .toolbar > *, .panel h2 > * { max-width: 100%; min-width: 0; }
  select, input, textarea, .filter-select { max-width: 100%; }
  .panel h2 { flex-wrap: wrap; row-gap: 6px; }
  .board { max-width: 100%; }
  .dash-cols > .panel, .settings-col { min-width: 0; flex-basis: 100%; }

  /* таблицы не сжимаем до наложения текста — им дают прокрутку вбок внутри блока */
  .table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .table-scroll > table.nt { min-width: 620px; }
  .table-scroll > table.nt.cl-table { min-width: 680px; }
  .table-scroll > table.nt.sup-table { min-width: 760px; }
  .table-scroll > table.nt.rp-table { min-width: 520px; }

  /* отчёт: на телефоне показываем только выбранную неделю, прошлая — свайпом */
  .rp-col-prev { display: none; }
  .rp-cols { gap: 0; }
  .rp-hint { display: block; margin: -8px 0 10px; text-align: center; opacity: .8; }
  .rp-tasks { min-width: 0; }
  .rp-hours { width: 62px; }
  .rp-inp { width: 52px; padding: 3px 4px; }
  .rp-table .tag { font-size: 11px; padding: 2px 6px; }

  /* шапка недели прилипает вплотную к верхней полосе, без просвета */
  .rp-week {
    position: sticky; top: -6px; z-index: 20; margin: 0 0 8px;
    background-color: var(--bg);
    box-shadow: 0 10px 12px -8px rgba(0,0,0,.85);
  }
  .rp-week.rp-cur {
    background-color: #16251c;
    background-image: linear-gradient(180deg, rgba(90,170,110,.38), rgba(90,170,110,.18));
  }
  .rp-week.rp-prev {
    background-color: #241f12;
    background-image: linear-gradient(180deg, rgba(200,170,60,.30), rgba(200,170,60,.14));
  }
  .pj-zone table.nt { table-layout: auto; }
  /* переносим только длинные слова целиком, а не по буквам */
  .nt td, .nt th { white-space: normal; overflow-wrap: break-word; word-break: normal; }
  .nt td.emp-name-cell { white-space: nowrap; }

  /* полоса под кнопкой меню и значками, чтобы содержимое не подлезало под них */
  body::before {
    content: ''; position: fixed; top: 0; left: 0; right: 0; height: 56px;
    background: var(--bg); z-index: 100; pointer-events: none;
  }
  .topright { top: 12px; right: 10px; z-index: 105; max-width: calc(100vw - 66px); }

  /* выпадающие панели сверху (уведомления, онлайн, «смотреть от лица»)
     на телефоне раскрываются во всю ширину экрана, а не уезжают за левый край */
  .notif-panel, .online-panel, .viewas-panel {
    position: fixed; top: 58px; left: 8px; right: 8px;
    width: auto; min-width: 0; max-height: calc(100dvh - 90px); overflow-y: auto;
    z-index: 106;
  }
  .notif-text { word-break: break-word; }
  /* подсказка и «ручка» для смахивания панели вверх */
  .notif-panel, .online-panel, .viewas-panel { padding-top: 14px; }
  .notif-panel::before, .online-panel::before, .viewas-panel::before {
    content: ''; position: sticky; top: 0; display: block;
    width: 40px; height: 4px; margin: -6px auto 8px;
    background: var(--border-light); border-radius: 2px;
  }
  .notif-head::after { content: 'смахните вверх, чтобы закрыть'; font-size: 10px; color: var(--text-dim); margin-left: 8px; }

  /* сайдбар выезжает поверх содержимого; #app > … — чтобы правило нельзя было перебить */
  #app > .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0; z-index: 140;
    width: 82vw; max-width: 320px; min-width: 0; flex: none;
    transform: translateX(-102%); transition: transform .22s ease;
    box-shadow: 0 0 40px rgba(0,0,0,.5);
  }
  body.nav-open #app > .sidebar { transform: none; }
  .sb-item, .sb-user, .sb-logout { white-space: nowrap; }
  .sb-item span:last-child { display: inline; }
  .sb-timer { white-space: normal; }
  .nav-shade {
    display: block; position: fixed; inset: 0; z-index: 135;
    background: rgba(0,0,0,.5); opacity: 0; pointer-events: none; transition: opacity .22s;
  }
  body.nav-open .nav-shade { opacity: 1; pointer-events: auto; }

  .nav-burger {
    display: flex; position: fixed; top: 8px; left: 8px; z-index: 150;
    width: 40px; height: 40px; padding: 0; gap: 4px;
    flex-direction: column; align-items: center; justify-content: center;
    background: var(--bg-panel); border: 1px solid var(--border-light); border-radius: 10px; cursor: pointer;
  }
  .nav-burger span { display: block; width: 18px; height: 2px; background: var(--text-bright); border-radius: 2px; }
  /* при открытом меню кнопку прячем — она перекрывала логотип; закрывается свайпом влево или тапом по затемнению */
  body.nav-open .nav-burger { display: none; }

  .main { padding: 62px 12px 90px; }
  .main > .toolbar:first-child, .main > .page-title:first-child { padding-right: 0; }
  .main > .toolbar:first-child { margin-top: 0; }
  .page-title { font-size: 24px; }

  .topright { top: 12px; right: 12px; gap: 6px; }
  .toolbar { gap: 6px; }
  .toolbar button, .filter-select, select, input { font-size: 13px; }
  .panel { padding: 14px 12px; }

  /* доска: одна колонка статуса на весь экран, пальцем — сразу к следующему статусу */
  .board {
    gap: 0; padding: 4px 0 20px;
    scroll-snap-type: x mandatory; scroll-behavior: smooth;
    overscroll-behavior-x: contain;
  }
  .board-col {
    flex: 0 0 100%; min-width: 100%; width: 100%;
    scroll-snap-align: start; scroll-snap-stop: always;
    padding: 0 2px;
  }
  .board-col-head { margin-bottom: 8px; }

  /* карточки удобнее нажимать пальцем, перетаскивание на телефоне отключаем */
  .card { padding: 12px; }
  .card-drag { cursor: pointer; }

  /* окна почти во весь экран */
  /* окно выше верхней полосы и кнопки меню, иначе они перекрывают заголовок */
  .modal-back { padding: 10px; align-items: flex-start; z-index: 160; }
  .modal, .modal.modal-wide { width: 100%; padding: 16px; }
  .emp-modal-cols { flex-direction: column; gap: 12px; }
  .fld-row { flex-direction: column; gap: 0; }
  .settings-cols { flex-direction: column; }
  .settings-col { max-width: 100%; }

  /* панель массовых операций переносится по строкам и не залезает под кнопку ассистента */
  .bulk-bar { gap: 6px; padding: 8px 10px; left: 8px; right: 8px; bottom: 62px; }
  .bulk-bar .filter-select { flex: 1 1 46%; min-width: 0; }

  /* ассистент и командная строка */
  .ai-fab { right: 14px; bottom: 14px; height: 40px; padding: 0 14px; font-size: 13px; }
  .ai-panel { right: 8px; left: 8px; bottom: 62px; width: auto; max-width: none; height: min(70vh, calc(100vh - 120px)); }
  .palette-back { padding-top: 6vh; }
  .palette { width: 100%; }

  /* вложения */
  .att-img img { width: 72px; height: 72px; }
  .lightbox { padding: 12px; }
  .lightbox img { max-height: 74vh; }

  /* статистика и профиль */
  .stat-row { gap: 8px; }
  .stat { flex: 1 1 45%; }
  .emp-profile-head { flex-wrap: wrap; }
}

@media (max-width: 560px) {
  .stat { flex: 1 1 100%; }
  .toolbar button { padding: 6px 10px; }
  .page-sub { font-size: 12px; }

  /* в отчёте прячем колонку статуса: он и так виден по часам, зато таблица влезает целиком */
  .rp-table th:nth-child(4), .rp-table td:nth-child(4) { display: none; }
  .table-scroll > table.nt.rp-table { min-width: 0; }
}
