/* Три темы оформления, кнопка в шапке переключает их по кругу:
   warm  — тёплая светлая, фирменная палитра (по умолчанию): фон #FFFCF2, шапка #FEF4E6, рамки #F1DAAE, акцент #824E29, олива #666829, жёлтый #FFD35C;
   light — светлая, как в версиях до 0.6.0;
   dark  — тёмная, как в версиях до 0.6.0.
   Тема хранится в атрибуте data-theme у <html>; без атрибута действует тёплая. */
:root {
  --bg: #FFFCF2;
  --surface: #ffffff;
  --header-bg: #FEF4E6;
  --text: #1e293b;
  --text-warm: #5a3f2b;
  --muted: #7a5c44;
  --border: #F1DAAE;
  --line: #F5E6C8;
  --accent: #824E29;
  --accent-hover: #6a3d20;
  --accent-text: #ffffff;
  --highlight: #FFD35C;
  --highlight-soft: rgba(255, 211, 92, .28);
  --ok-bg: #E5F0DF; --ok-text: #2F6B3A;
  --warn-bg: #FDEBD3; --warn-text: #8a4003;
  --error-bg: #FBE7E3; --error-text: #A12626;
  --info-bg: #EEEFD6; --info-text: #55571f;
  --bar-work: rgba(102, 104, 41, .38); --bar-bad: rgba(161, 38, 38, .32); --bar-ok: rgba(47, 107, 58, .32); --bar-warn: rgba(167, 78, 3, .34);
  --radius: 8px;
  --topbar-h: 58px;
  color-scheme: light;
}
:root[data-theme="light"] {
  --bg: #f6f7f9; --surface: #ffffff; --header-bg: #ffffff; --text: #1c1f24; --text-warm: #1c1f24; --muted: #6b7280;
  --border: #e3e6ea; --line: #e3e6ea; --accent: #2f6fed; --accent-hover: #2459c9; --accent-text: #ffffff;
  --highlight: #2f6fed; --highlight-soft: rgba(47, 111, 237, .07);
  --ok-bg: #e7f6ec; --ok-text: #1d6b3a; --warn-bg: #fff4e0; --warn-text: #8a5300;
  --error-bg: #fdecec; --error-text: #a12626; --info-bg: #eaf1fe; --info-text: #1f4fb0;
  --bar-work: rgba(47, 111, 237, .35); --bar-bad: rgba(214, 69, 69, .38); --bar-ok: rgba(46, 150, 90, .38); --bar-warn: rgba(230, 150, 30, .45);
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #14161a; --surface: #1c1f24; --header-bg: #1c1f24; --text: #e6e8eb; --text-warm: #e6e8eb; --muted: #9aa1ab;
  --border: #2c3036; --line: #2c3036; --accent: #5b8def; --accent-hover: #7aa3f2; --accent-text: #0e1116;
  --highlight: #5b8def; --highlight-soft: rgba(91, 141, 239, .1);
  --ok-bg: #16301f; --ok-text: #7fd39c; --warn-bg: #33270f; --warn-text: #f0bf6a;
  --error-bg: #3a1a1a; --error-text: #f19a9a; --info-bg: #182640; --info-text: #9dbcf5;
  --bar-work: rgba(91, 141, 239, .28); --bar-bad: rgba(241, 120, 120, .28); --bar-ok: rgba(127, 211, 156, .24); --bar-warn: rgba(240, 191, 106, .26);
  color-scheme: dark;
}
/* Приметы тёплой темы, которых не было в светлой и тёмной */
:root:not([data-theme="light"]):not([data-theme="dark"]) {
  --nav-text: var(--text-warm); --nav-hover: var(--highlight-soft); --nav-active: var(--accent); --nav-active-bg: var(--surface); --nav-active-line: var(--highlight);
  --th-text: var(--text-warm); --th-bg: var(--header-bg); --btn-hover: var(--accent);
  --dot: var(--highlight); --dot-border: var(--accent); --progress: var(--info-text); --gantt-now: var(--highlight); --gantt-now-op: .25;
}
:root[data-theme="light"], :root[data-theme="dark"] {
  --nav-text: var(--muted); --nav-hover: var(--bg); --nav-active: var(--text); --nav-active-bg: var(--bg); --nav-active-line: transparent;
  --th-text: var(--muted); --th-bg: transparent; --btn-hover: var(--muted);
  --dot: var(--accent); --dot-border: transparent; --progress: var(--accent); --gantt-now: var(--accent); --gantt-now-op: .08;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }
a:hover { text-decoration: underline; }
h1 { font-size: 1.5rem; margin: 0 0 1rem; font-weight: 600; }
h2 { font-size: 1.1rem; margin: 0 0 .75rem; font-weight: 600; }
code { font-family: ui-monospace, Menlo, Consolas, monospace; }
code.big { font-size: 1.15rem; padding: 2px 8px; background: var(--surface); border-radius: 4px; }

.muted { color: var(--muted); }
.small { font-size: .85rem; }
.nowrap { white-space: nowrap; }

/* Шапка */
.topbar {
  display: flex; align-items: center; gap: 1.25rem; flex-wrap: wrap;
  padding: .6rem 1rem; background: var(--header-bg); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 50;
}
.brand { font-weight: 700; color: var(--text-warm); letter-spacing: .02em; display: inline-flex; align-items: center; }
.brand:hover { text-decoration: none; color: var(--text-warm); }
.brand-logo { height: 36px; width: auto; display: block; }
.nav { display: flex; gap: .25rem; flex-wrap: wrap; }
.nav a { color: var(--nav-text); padding: .3rem .55rem; border-radius: 6px; }
.nav a:hover { background: var(--nav-hover); text-decoration: none; color: var(--text); }
.nav a.active { color: var(--nav-active); background: var(--nav-active-bg); font-weight: 600; box-shadow: inset 0 -2px 0 var(--nav-active-line); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; }
.who { font-size: .9rem; color: var(--text); }
.icon-btn { background: none; border: 1px solid var(--border); color: var(--text); border-radius: 6px; width: 32px; height: 32px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.link-btn { background: none; border: 0; color: var(--accent); cursor: pointer; font: inherit; padding: 0; }
form.inline { display: inline; margin: 0; }

.container { max-width: 1100px; margin: 0 auto; padding: 1.5rem 1rem; }
.footer { text-align: center; padding: 1rem; }

/* Блоки */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem; margin-bottom: 1rem; }
.card.narrow { max-width: 420px; margin: 3rem auto; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.page-head h1, .page-head h2 { margin: 0; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; }
.stat-value { font-size: 1.75rem; font-weight: 600; }
.stat-label { color: var(--muted); font-size: .9rem; }

.flash { padding: .7rem 1rem; border-radius: var(--radius); margin-bottom: 1rem; }
.flash-ok { background: var(--ok-bg); color: var(--ok-text); }
.flash-error { background: var(--error-bg); color: var(--error-text); }
.flash-info { background: var(--info-bg); color: var(--info-text); }

.badge { display: inline-block; font-size: .75rem; padding: 1px 8px; border-radius: 999px; background: var(--bg); color: var(--muted); border: 1px solid var(--border); }
.badge-ok { background: var(--ok-bg); color: var(--ok-text); border-color: transparent; }
.badge-warn { background: var(--warn-bg); color: var(--warn-text); border-color: transparent; }

/* Таблицы */
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: .6rem .8rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.table th { font-size: .8rem; font-weight: 600; color: var(--th-text); text-transform: uppercase; letter-spacing: .03em; background: var(--th-bg); }
.table tbody tr:last-child td { border-bottom: 0; }
.table tr.inactive td { opacity: .55; }
.table.compact th { text-transform: none; font-size: .9rem; color: var(--text); width: 35%; }

.tabs { display: flex; gap: .25rem; flex-wrap: wrap; border-bottom: 1px solid var(--border); margin-bottom: 1rem; }
.tabs a { padding: .5rem .8rem; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a.active { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }
.tabs a:hover { text-decoration: none; color: var(--text); }

.pager { display: flex; gap: 1rem; align-items: center; justify-content: center; margin-top: 1rem; }

/* Формы */
.form { display: flex; flex-direction: column; gap: .9rem; }
.form label { display: flex; flex-direction: column; gap: .3rem; font-size: .9rem; font-weight: 500; }
.form .row { display: flex; gap: 1rem; flex-wrap: wrap; }
.form .row > label { flex: 1 1 220px; }
.form .row > label.w-small { flex: 0 1 160px; }
label.check { flex-direction: row !important; align-items: center; gap: .5rem !important; font-weight: 400 !important; }
input, select, textarea {
  font: inherit; color: var(--text); background: var(--bg);
  border: 1px solid var(--border); border-radius: 6px; padding: .5rem .65rem; width: 100%;
}
input[type="checkbox"], input[type="radio"] { width: auto; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
input:disabled { opacity: .6; }
.checklist { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: .4rem 1rem; }
.actions { display: flex; gap: .5rem; }

.btn {
  display: inline-block; font: inherit; font-weight: 500; cursor: pointer;
  padding: .5rem 1rem; border-radius: 6px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text);
}
.btn:hover { text-decoration: none; border-color: var(--btn-hover); color: var(--btn-hover); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--accent-text); }
.btn.danger { background: var(--error-text); border-color: var(--error-text); color: var(--surface); }
.btn.danger:hover { filter: brightness(1.1); color: var(--surface); }
.btn.danger-outline { color: var(--error-text); }
.btn.danger-outline:hover { border-color: var(--error-text); color: var(--error-text); }

@media (max-width: 640px) {
  .topbar { gap: .4rem; padding: .4rem .75rem; }
  .topbar-right { margin-left: 0; width: 100%; }
  /* На телефоне меню — одна строка с прокруткой, чтобы закреплённая шапка не занимала пол-экрана. */
  .nav { flex-wrap: nowrap; overflow-x: auto; width: 100%; -webkit-overflow-scrolling: touch; }
  .nav a { white-space: nowrap; }
  .brand-logo { height: 28px; }
  .container { padding: 1rem; }
  .card.narrow { margin: 1rem auto; }
}

/* Задачи */
.text-danger { color: var(--error-text) !important; }
kbd { font-family: ui-monospace, monospace; font-size: .8em; border: 1px solid var(--border); border-radius: 4px; padding: 0 4px; }
.status { display: inline-block; font-size: .78rem; padding: 2px 9px; border-radius: 999px; white-space: nowrap; background: var(--bg); color: var(--muted); border: 1px solid var(--border); }
.status-in_work { background: var(--info-bg); color: var(--info-text); border-color: transparent; }
.status-overdue { background: var(--error-bg); color: var(--error-text); border-color: transparent; font-weight: 600; }
.status-done { background: var(--ok-bg); color: var(--ok-text); border-color: transparent; }
.status-paused, .status-postponed { background: var(--warn-bg); color: var(--warn-text); border-color: transparent; }

.filters { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-bottom: 1rem; }
.filters input[type="search"] { flex: 1 1 220px; width: auto; }
.filters select { width: auto; flex: 0 1 190px; }

.task-title { display: flex; gap: .35rem; align-items: baseline; }
.task-meta span + span::before { content: " · "; }
.tree-toggle { background: none; border: 0; color: var(--muted); cursor: pointer; padding: 0 .2rem; font-size: .9rem; }
.tree-dot { color: var(--muted); }

.task-grid { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 1rem; align-items: start; }
.props { display: grid; grid-template-columns: 11rem 1fr; gap: .5rem 1rem; margin: 0; }
.props dt { color: var(--muted); font-size: .9rem; }
.props dd { margin: 0; }
.progress { height: 6px; background: var(--bg); border-radius: 3px; overflow: hidden; margin-top: .75rem; }
.progress > div { height: 100%; background: var(--accent); }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { padding: .5rem 0 .5rem .9rem; border-left: 2px solid var(--border); position: relative; }
.timeline li::before { content: ""; position: absolute; left: -5px; top: .85rem; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.crumbs { margin-bottom: .25rem; }

/* Пульт совещания */
.table-wrap.flat { border: 0; }
.group-row td { background: var(--bg); font-weight: 600; font-size: .85rem; color: var(--muted); }
.console-table td { vertical-align: middle; }
.console-table input[type="date"] { width: auto; padding: .25rem .4rem; }
.console-table select { width: auto; padding: .25rem .4rem; }
.status-select.status-overdue { color: var(--error-text); font-weight: 600; }
.due-extra { display: flex; gap: .3rem; margin-top: .3rem; }
.due-extra[hidden] { display: none; }
.due-extra input { min-width: 180px; padding: .25rem .4rem; }
.small-btn { padding: .25rem .6rem; }
.quick-add { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1rem; padding-top: 1rem; border-top: 1px dashed var(--border); }
.quick-add .quick-title { flex: 1 1 320px; width: auto; }
.quick-add select, .quick-add input[type="date"] { width: auto; }
.btn.active { border-color: var(--accent); color: var(--accent); }
body.console-large { font-size: 18px; }
body.console-large .container { max-width: 1400px; }

@media (max-width: 860px) {
  .task-grid { grid-template-columns: 1fr; }
  .props { grid-template-columns: 1fr; gap: .1rem; }
  .props dd { margin-bottom: .5rem; }
}
.stat { color: var(--text); } a.stat:hover { text-decoration: none; border-color: var(--muted); }
.subnav { display: flex; gap: .25rem; flex-wrap: wrap; margin-bottom: 1.25rem; font-size: .9rem; }
.subnav a { color: var(--muted); padding: .25rem .6rem; border-radius: 999px; border: 1px solid transparent; }
.subnav a.active { color: var(--text); border-color: var(--border); background: var(--surface); }
.subnav a:hover { text-decoration: none; color: var(--text); }
.num { text-align: right !important; white-space: nowrap; }
.report-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(520px, 1fr)); gap: 1rem; }
.report-grid .card { margin-bottom: 0; }
.report-grid + .card { margin-top: 1rem; }
.inline-label { display: inline-flex; align-items: center; gap: .4rem; font-size: .9rem; color: var(--muted); }
.inline-label input { width: auto; }
.page-head .actions { flex-wrap: wrap; justify-content: flex-end; }
@media (max-width: 1100px) { .report-grid { grid-template-columns: 1fr; } }

/* Шаг 4: связи, график, вложения, уведомления */
.flash-warn { background: var(--warn-bg); color: var(--warn-text); }
.flash-warn a { color: inherit; text-decoration: underline; }
.link-badge { display: inline-flex; align-items: center; gap: 2px; font-size: .75rem; padding: 0 6px; margin-left: .3rem; border-radius: 999px; border: 1px solid var(--border); color: var(--muted); vertical-align: middle; }
.link-badge:hover { text-decoration: none; color: var(--accent); border-color: var(--accent); }
.link-badge.conflict { color: var(--error-text); background: var(--error-bg); border-color: transparent; font-weight: 600; }
.conflict-row td { background: var(--error-bg); }
.link-btn.danger { color: var(--error-text); font-size: 1.1rem; line-height: 1; }
.link-form { margin-top: 1rem; padding-top: 1rem; border-top: 1px dashed var(--border); }
.attach-form { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-top: .75rem; }
.attach-form input[type="url"] { flex: 2 1 240px; width: auto; }
.attach-form input[name="title"] { flex: 1 1 160px; width: auto; }
.attach-form input[type="file"] { flex: 1 1 240px; width: auto; padding: .35rem; }

.gantt-card { padding: .75rem; }
.gantt-scroll { overflow-x: auto; }
.gantt { display: block; font: 12px system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; }
.gantt .g-grid { stroke: var(--border); stroke-width: 1; }
.gantt .g-grid.strong { stroke: var(--muted); stroke-opacity: .5; }
.gantt .g-scale { fill: var(--muted); font-size: 11px; }
.gantt .g-scale.small { font-size: 10px; }
.gantt .g-scale.today { fill: var(--accent); }
.gantt .g-today { stroke: var(--accent); stroke-width: 1.5; stroke-dasharray: 4 3; }
.gantt .g-current { fill: var(--accent); fill-opacity: .08; }
.gantt .g-label { fill: var(--text); }
.gantt .g-code { fill: var(--muted); }
.gantt a:hover .g-label { fill: var(--accent); }
.gantt .g-bar { fill: var(--info-text); fill-opacity: .75; }
.gantt .g-bar.s-overdue { fill: var(--error-text); }
.gantt .g-bar.s-done, .gantt .g-bar.s-cancelled { fill: var(--ok-text); fill-opacity: .55; }
.gantt .g-bar.s-paused, .gantt .g-bar.s-postponed { fill: var(--warn-text); fill-opacity: .6; }
.gantt .g-bar.conflict { stroke: var(--error-text); stroke-width: 2; }
.gantt .g-link { fill: none; stroke: var(--muted); stroke-width: 1.3; }
.gantt .g-link.bad { stroke: var(--error-text); stroke-width: 1.8; }
.gantt .g-arrow-head { fill: var(--muted); }
.gantt .g-arrow-head.bad { fill: var(--error-text); }
.gantt-legend .lg { display: inline-block; width: 14px; height: 8px; border-radius: 2px; margin: 0 .2rem 0 .6rem; vertical-align: middle; }
.lg-work { background: var(--info-text); } .lg-overdue { background: var(--error-text); } .lg-done { background: var(--ok-text); }
.lg-hold { background: var(--warn-text); } .lg-conflict { border: 2px solid var(--error-text); }

.bell { position: relative; color: var(--text); }
.bell:hover { text-decoration: none; border-color: var(--muted); }
.bell.active { border-color: var(--accent); color: var(--accent); }
.bell-count { position: absolute; top: -6px; right: -7px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 999px; background: var(--error-text); color: var(--surface); font-size: 10px; font-weight: 700; line-height: 17px; text-align: center; }
.flat-list { padding: 0; overflow: hidden; }
.card.flat-list { padding: 0; }
.notice { display: flex; gap: .75rem; align-items: baseline; padding: .65rem 1rem; border-bottom: 1px solid var(--border); color: var(--muted); }
.notice:last-child { border-bottom: 0; }
.notice:hover { background: var(--bg); text-decoration: none; }
.notice.unread { color: var(--text); }
.notice.unread .notice-text { font-weight: 500; }
.notice-kind { flex: 0 0 9.5rem; font-size: .8rem; }
.notice-text { flex: 1; }
.notice.unread .notice-kind::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); margin-right: .4rem; }
.notice.kind-overdue .notice-kind, .notice.kind-escalation .notice-kind { color: var(--error-text); }
@media (max-width: 640px) { .notice { flex-wrap: wrap; } .notice-kind { flex-basis: 100%; } }
.gantt .g-bar-soft { fill: var(--info-text); fill-opacity: .18; }
.gantt .g-bar-soft.s-overdue { fill: var(--error-text); }
.gantt .g-bar-soft.s-done, .gantt .g-bar-soft.s-cancelled { fill: var(--ok-text); }
.gantt .g-bar-soft.s-paused, .gantt .g-bar-soft.s-postponed { fill: var(--warn-text); }
.links-table tr.conflict-row:not(.conflict-note) td { border-bottom: 0; }
.links-table tr.conflict-note td { padding-top: 0; }

/* Шаг 5: полоски в отчётах, общий график, справка */
.bar-cell { min-width: 3.5rem; }
.cell-bar { display: block; height: 5px; margin-top: 3px; border-radius: 3px; background: var(--bg); overflow: hidden; }
.cell-bar > span { display: block; height: 100%; border-radius: 3px; }
.bar-work > span { background: var(--bar-work); } .bar-bad > span { background: var(--bar-bad); }
.bar-ok > span { background: var(--bar-ok); } .bar-warn > span { background: var(--bar-warn); }
.compact-num th, .compact-num td { padding-left: .5rem; padding-right: .5rem; }
.gantt .g-group { fill: var(--bg); }
.gantt .g-group-label { fill: var(--text); font-weight: 600; }
.icon-btn:hover { text-decoration: none; border-color: var(--muted); }
.icon-btn.active { border-color: var(--accent); color: var(--accent); }
.help-layout { display: grid; grid-template-columns: 15rem minmax(0, 1fr); gap: 1rem; align-items: start; }
.help-toc { position: sticky; top: calc(var(--topbar-h) + 1rem); display: flex; flex-direction: column; gap: .35rem; font-size: .9rem; padding: 1rem; }
.help-section { scroll-margin-top: calc(var(--topbar-h) + 1rem); }
.help-section p, .help-section ul, .help-section ol { margin: 0 0 .75rem; }
.help-section li { margin-bottom: .35rem; }
.help-section .table { margin-bottom: .75rem; }
.rights-table th.mine, .rights-table td.mine { background: var(--info-bg); color: var(--info-text); }
@media (max-width: 860px) { .help-layout { grid-template-columns: 1fr; } .help-toc { position: static; } }
.report-grid { grid-template-columns: 1fr; }

/* Итерация 6 */
[id] { scroll-margin-top: calc(var(--topbar-h) + 1rem); }
:root[data-theme="dark"] .brand-logo { background: #FEF4E6; padding: 3px 6px; border-radius: 6px; }
.login-logo { display: block; max-width: 220px; height: auto; margin: 0 auto 1rem; }
.gantt .g-current { fill: var(--gantt-now); fill-opacity: var(--gantt-now-op); }
.timeline li::before { background: var(--dot); border: 1px solid var(--dot-border); }
.progress > div { background: var(--progress); }
.bell-count { background: var(--error-text); }
.notice.unread .notice-kind::before { background: var(--dot); border: 1px solid var(--dot-border); }

.form .field, .form .row > .field { display: flex; flex-direction: column; gap: .3rem; font-size: .9rem; font-weight: 500; flex: 1 1 220px; min-width: 0; }
.form .field > label { display: flex; flex-direction: column; gap: .3rem; }
.field-label { font-weight: 500; }
.correction { margin-top: .2rem; }
.correction[hidden] { display: none !important; }
.danger-text { color: var(--error-text); }

/* Ответственные: плашки */
.emp-picker { display: flex; flex-wrap: wrap; gap: .3rem; align-items: center; padding: .3rem; border: 1px solid var(--border); border-radius: 6px; background: var(--bg); min-height: 2.4rem; }
.emp-picker.compact { padding: .15rem .25rem; min-height: 0; flex: 0 1 auto; background: var(--surface); }
.emp-picker.disabled { opacity: .7; }
.emp-chips { display: contents; }
.emp-chip { display: inline-flex; align-items: center; gap: .15rem; padding: 1px 4px 1px 9px; border-radius: 999px; background: var(--info-bg); color: var(--info-text); font-size: .85rem; font-weight: 500; white-space: nowrap; }
.emp-chip button { border: 0; background: none; color: inherit; cursor: pointer; font-size: 1rem; line-height: 1; padding: 0 3px; }
.emp-chip button:hover { color: var(--error-text); }
.emp-add { width: auto !important; flex: 1 1 8rem; border: 0 !important; background: transparent !important; padding: .2rem !important; color: var(--muted); min-width: 7rem; }
.emp-picker.compact .emp-add { flex: 0 1 auto; }
select.emp-multi { min-height: 6rem; }

/* Пульт: подзадачи, ошибки у строки */
.row-tools { display: flex; gap: .9rem; margin-top: .2rem; opacity: .75; }
tr:hover .row-tools, .row-tools:focus-within { opacity: 1; }
.row-tools .link-btn { font-size: .85rem; }
.sub-add-row td { background: var(--highlight-soft); border-bottom: 1px solid var(--line); }
.sub-add-row[hidden] { display: none; }
.quick-add.sub-add { margin: 0; padding: 0; border: 0; align-items: center; }
.quick-add { align-items: center; }
.quick-add .check { white-space: nowrap; }
.has-error > td, tr.has-error td { background: var(--error-bg) !important; }
.quick-add-wrap.has-error, .card.has-error { outline: 2px solid var(--error-text); outline-offset: 2px; border-radius: var(--radius); }
.row-error { color: var(--error-text); background: var(--error-bg); border-left: 3px solid var(--error-text); padding: .45rem .75rem; border-radius: 4px; font-size: .9rem; margin: .5rem 0; }
.row-error-row td { padding-top: 0; background: var(--error-bg); }
.row-error-row .row-error { margin: 0; border-left: 0; padding: 0 0 .4rem; }
.toast { position: fixed; left: 50%; bottom: 1.25rem; transform: translateX(-50%); z-index: 60; max-width: min(640px, calc(100% - 2rem));
  background: var(--error-text); color: var(--surface); padding: .7rem 1rem; border-radius: var(--radius); box-shadow: 0 6px 24px rgba(0, 0, 0, .25); cursor: pointer; transition: opacity .4s; }
.toast.hide { opacity: 0; pointer-events: none; }
.toast-link { text-decoration: underline; margin-left: .4rem; white-space: nowrap; }
.add-project { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; border-style: dashed; }
.add-project select { width: auto; min-width: 16rem; }
.console-project .page-head .actions { align-items: center; gap: 1rem; }

/* Удаление */
.deleted-banner { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; justify-content: space-between; }
.narrow-form { max-width: 640px; }
fieldset.choice { border: 1px solid var(--border); border-radius: 6px; padding: .6rem .9rem; margin: 0; display: flex; flex-direction: column; gap: .35rem; }
fieldset.choice legend { font-size: .9rem; font-weight: 500; padding: 0 .3rem; }
.danger-zone { border-color: var(--error-bg); }
.hier-list { display: flex; flex-direction: column; gap: .3rem; }

/* Внешние страницы (Google Apps Script) */
.ext-frame-wrap { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: #fff; }
.ext-frame { display: block; width: 100%; height: calc(100vh - var(--topbar-h) - 11rem); min-height: 480px; border: 0; }
.ext-item { border-bottom: 1px dashed var(--border); padding-bottom: .75rem; margin-bottom: .75rem; }
.ext-form .row > label.w-small { flex: 0 1 220px; }
.checks-inline { display: flex; flex-wrap: wrap; gap: .4rem 1rem; align-items: center; }
.quick-add.sub-add .quick-title { flex: 1 1 200px; }
.form + .danger-zone { margin-top: 1.5rem; }
.row-tools { flex-wrap: wrap; gap: .1rem .9rem; }
.row-tools > * { white-space: nowrap; }
.who { display: inline-flex; gap: .25rem; align-items: baseline; }
@media (max-width: 1360px) { .who-role { display: none; } }
@media (max-width: 640px) {
  :root { --topbar-h: 92px; }
  .topbar { flex-wrap: wrap; }
  .brand { order: 1; }
  .topbar-right { order: 2; width: auto; margin-left: auto; gap: .4rem; flex-wrap: nowrap; }
  .nav { order: 3; }
  .who-name { display: inline-block; max-width: 7.5rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .icon-btn { width: 30px; height: 30px; }
}
