:root {
  --bg: #f4f5f7;
  --panel: #ffffff;
  --sunken: #eceef2;
  --line: #dde0e6;
  --text: #1b1f27;
  --muted: #667085;
  --accent: #3552d4;
  --accent-soft: #e6eaff;
  --danger: #c4322b;
  --ok: #178a5c;
  --warn: #b7791f;
  --nav: #1f2a44;
  --nav-text: #d7ddeb;
  --nav-muted: #8e99b3;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, .18);
  --radius: 8px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12151c;
    --panel: #1a1e27;
    --sunken: #151922;
    --line: #2a303c;
    --text: #e4e7ee;
    --muted: #9099ab;
    --accent: #7d95ff;
    --accent-soft: #252e52;
    --danger: #f0716a;
    --ok: #4cc491;
    --warn: #e0b04f;
    --nav: #0d1016;
    --nav-text: #cfd6e6;
    --nav-muted: #7a849a;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow-lg: 0 12px 32px rgba(0, 0, 0, .5);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg); color: var(--text);
  font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }
.boot { display: grid; place-items: center; height: 100vh; color: var(--muted); }

/* ---------- элементы управления ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: 6px; background: var(--panel); cursor: pointer;
  white-space: nowrap;
}
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--danger); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--sunken); }
.btn.small { height: 26px; padding: 0 8px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: default; }
input.field, select.field, textarea.field {
  width: 100%; height: 34px; padding: 0 10px; border: 1px solid var(--line); border-radius: 6px;
  background: var(--panel); outline: none;
}
textarea.field { height: auto; padding: 8px 10px; resize: vertical; }
.field:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
label.lbl { display: block; font-size: 12px; color: var(--muted); margin: 12px 0 4px; }
.error { color: var(--danger); font-size: 13px; min-height: 18px; margin-top: 8px; }
.muted { color: var(--muted); }

/* ---------- логотип компании ---------- */
.brand-mark {
  display: inline-grid; place-items: center; flex: none; border-radius: 50%; background: #fff;
  box-shadow: 0 0 0 1px rgba(16, 24, 40, .08), 0 2px 6px rgba(16, 24, 40, .12); overflow: hidden;
}
.brand-mark img { width: 64%; height: 64%; object-fit: contain; display: block; }

/* ---------- вход ---------- */
.login {
  min-height: 100vh; display: grid; place-items: center; padding: 24px 16px;
  background: radial-gradient(1200px 600px at 50% -10%, var(--accent-soft), transparent 70%), var(--bg);
}
.login-card {
  width: 100%; max-width: 380px; background: var(--panel); border-radius: 16px; padding: 36px 32px 30px;
  box-shadow: var(--shadow-lg); border: 1px solid var(--line);
}
.login-brand { display: flex; flex-direction: column; align-items: center; text-align: center; margin-bottom: 14px; }
.login-brand .brand-mark { margin-bottom: 18px; }
.login-brand h1 { margin: 0; font-size: 22px; font-weight: 700; letter-spacing: -.01em; }
.login-brand .muted { margin-top: 2px; }
.login-card .btn.block { width: 100%; justify-content: center; margin-top: 18px; height: 40px; }
.auth-title { font-size: 17px; font-weight: 650; text-align: center; margin: 4px 0 2px; }
.auth-switch { text-align: center; margin-top: 18px; font-size: 13px; color: var(--muted); }
.link { border: 0; background: none; padding: 0; color: var(--accent); cursor: pointer; font: inherit; }
.link:hover { text-decoration: underline; }
.notice { background: var(--accent-soft); color: var(--text); border-radius: 8px; padding: 9px 12px; font-size: 13px; margin-bottom: 4px; }
.field-hint { font-size: 12px; color: var(--muted); margin-top: 4px; }
.login-card .grid2 { gap: 0 10px; }
.wait { text-align: center; }
.wait p { margin: 8px 0; }
.wait-icon {
  width: 34px; height: 34px; margin: 4px auto 10px; border-radius: 50%;
  border: 3px solid var(--accent-soft); border-top-color: var(--accent); animation: spin 1.1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .wait-icon { animation: none; } }
.wait-card { background: var(--sunken); border-radius: 8px; padding: 10px 14px; text-align: left; margin: 14px 0 6px; line-height: 1.7; }

/* ---------- каркас ---------- */
.layout { display: grid; grid-template-columns: 232px 1fr; height: 100vh; }
.nav {
  background: var(--nav); color: var(--nav-text); display: flex; flex-direction: column;
  padding: 14px 10px; gap: 2px; overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 2px 6px 14px; color: #fff; min-width: 0; }
.brand .brand-mark { box-shadow: none; }
.brand-text { min-width: 0; line-height: 1.25; }
.brand-name { font-weight: 650; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brand-sub { font-size: 11px; color: var(--nav-muted); }
.nav-sec { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--nav-muted); padding: 14px 8px 6px; display: flex; justify-content: space-between; align-items: center; }
.nav-sec button { background: none; border: 0; color: var(--nav-muted); cursor: pointer; font-size: 16px; line-height: 1; padding: 0 2px; }
.nav-sec button:hover { color: #fff; }
.nav-item {
  display: flex; align-items: center; gap: 8px; padding: 7px 8px; border-radius: 6px; cursor: pointer;
  border: 0; background: none; color: inherit; text-align: left; width: 100%;
}
.nav-item:hover { background: rgba(255, 255, 255, .06); }
.nav-item.active { background: rgba(255, 255, 255, .12); color: #fff; }
.nav-item .key { font-size: 11px; font-weight: 600; color: var(--nav-muted); min-width: 34px; }
.nav-item .count { margin-left: auto; font-size: 12px; color: var(--nav-muted); }
.nav-spacer { flex: 1; }
.conn {
  display: flex; align-items: center; gap: 8px; padding: 8px; border-radius: 6px; font-size: 12px;
  color: var(--nav-muted); cursor: pointer; border: 0; background: none; text-align: left; width: 100%;
}
.conn:hover { background: rgba(255, 255, 255, .06); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--nav-muted); flex: none; }
.dot.on { background: #34d399; box-shadow: 0 0 0 3px rgba(52, 211, 153, .18); }
.dot.off { background: #f87171; }

.main { display: flex; flex-direction: column; min-width: 0; overflow: hidden; }
.topbar {
  display: flex; align-items: center; gap: 10px; padding: 12px 20px; border-bottom: 1px solid var(--line);
  background: var(--panel); flex-wrap: wrap;
}
.topbar h2 { margin: 0; font-size: 17px; font-weight: 650; margin-right: auto; display: flex; gap: 8px; align-items: baseline; }
.topbar h2 small { color: var(--muted); font-weight: 500; font-size: 13px; }
.topbar .search { width: 220px; }
.topbar .filter { width: auto; min-width: 150px; }
.menu-btn { display: none; }

.banner { padding: 8px 20px; font-size: 13px; background: #fff4e5; color: #8a4b00; border-bottom: 1px solid #f3d9b1; }
@media (prefers-color-scheme: dark) { .banner { background: #3a2a12; color: #f3c77a; border-color: #5a4220; } }

/* ---------- доска ---------- */
.board {
  flex: 1; display: grid; grid-template-columns: repeat(4, minmax(240px, 1fr)); gap: 14px;
  padding: 16px 20px; overflow: auto; align-items: start;
}
.col { background: var(--sunken); border-radius: 10px; display: flex; flex-direction: column; max-height: 100%; min-height: 120px; }
.col-head { display: flex; align-items: center; gap: 8px; padding: 10px 12px 8px; font-weight: 600; font-size: 13px; }
.col-head .n { color: var(--muted); font-weight: 500; }
.col-head .bar { width: 10px; height: 10px; border-radius: 3px; }
.col-body { padding: 0 8px 10px; display: flex; flex-direction: column; gap: 8px; overflow-y: auto; min-height: 60px; border-radius: 8px; transition: background .12s; }
.col.drop .col-body { background: var(--accent-soft); }
.card {
  background: var(--panel); border-radius: var(--radius); padding: 10px 12px; box-shadow: var(--shadow);
  cursor: pointer; border: 1px solid transparent; user-select: none;
}
.card:hover { border-color: var(--line); }
.card.dragging { opacity: .45; }
.card .code { font-size: 12px; color: var(--muted); font-weight: 600; }
.card .title { margin: 3px 0 8px; overflow-wrap: anywhere; }
.card .meta { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.card .meta .right { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.card.done .title { color: var(--muted); }

.prio { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; }
.prio::before { content: ""; width: 7px; height: 7px; border-radius: 2px; background: currentColor; }
.prio.low { color: var(--muted); }
.prio.normal { color: var(--accent); }
.prio.high { color: var(--warn); }
.prio.critical { color: var(--danger); font-weight: 600; }

.av {
  width: 24px; height: 24px; border-radius: 50%; display: inline-grid; place-items: center; font-size: 11px;
  font-weight: 650; color: #fff; flex: none;
}
.av { position: relative; }
.av img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; border-radius: inherit; }
.av.empty { background: var(--line) !important; color: var(--muted); }
.empty-state { padding: 60px 20px; text-align: center; color: var(--muted); }

/* ---------- боковая панель задачи ---------- */
.overlay { position: fixed; inset: 0; background: rgba(10, 14, 22, .35); z-index: 20; display: flex; justify-content: flex-end; }
.drawer {
  width: min(720px, 100%); height: 100%; background: var(--panel); box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column; animation: slide .16s ease-out;
}
@keyframes slide { from { transform: translateX(24px); opacity: .6; } }
.drawer-head { display: flex; align-items: center; gap: 10px; padding: 14px 20px; border-bottom: 1px solid var(--line); }
.drawer-head .code { font-weight: 650; color: var(--muted); }
.drawer-head .grow { flex: 1; }
.drawer-body { flex: 1; overflow-y: auto; display: grid; grid-template-columns: 1fr 220px; }
.drawer-main { padding: 16px 20px 30px; min-width: 0; }
.drawer-side { padding: 16px 16px; border-left: 1px solid var(--line); background: var(--sunken); }
.title-input { font-size: 19px; font-weight: 650; border: 1px solid transparent; border-radius: 6px; padding: 4px 6px; margin-left: -7px; width: calc(100% + 7px); background: none; outline: none; }
.title-input:hover { border-color: var(--line); }
.title-input:focus { border-color: var(--accent); background: var(--panel); }
.desc { min-height: 110px; }
.tabs { display: flex; gap: 4px; margin: 22px 0 10px; border-bottom: 1px solid var(--line); }
.tab { border: 0; background: none; padding: 8px 10px; cursor: pointer; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tab.active { color: var(--text); border-color: var(--accent); font-weight: 600; }
.comment { display: flex; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.comment:last-child { border-bottom: 0; }
.comment .body { flex: 1; min-width: 0; }
.comment .who { font-size: 13px; font-weight: 600; }
.comment .who span { font-weight: 400; color: var(--muted); margin-left: 6px; }
.comment .txt { white-space: pre-wrap; overflow-wrap: anywhere; margin-top: 2px; }
.comment .del { visibility: hidden; }
.comment:hover .del { visibility: visible; }
.add-comment { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; align-items: flex-end; }
.hist { font-size: 13px; padding: 7px 0; border-bottom: 1px solid var(--line); }
.hist .when { color: var(--muted); font-size: 12px; }
.side-row { margin-bottom: 14px; }
.side-row label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.side-info { font-size: 12px; color: var(--muted); line-height: 1.6; margin-top: 18px; }

/* ---------- страницы администрирования ---------- */
.page { flex: 1; overflow-y: auto; padding: 20px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 18px 20px; max-width: 900px; margin-bottom: 18px; }
.panel h3 { margin: 0 0 12px; font-size: 15px; }
table.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 500; padding: 6px 8px; border-bottom: 1px solid var(--line); }
.tbl td { padding: 9px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl .actions { text-align: right; white-space: nowrap; }
.pill { display: inline-block; font-size: 11px; padding: 1px 7px; border-radius: 10px; background: var(--sunken); color: var(--muted); }
.pill.admin { background: var(--accent-soft); color: var(--accent); }
.pill.off { background: rgba(196, 50, 43, .1); color: var(--danger); }
.pill.on { background: rgba(23, 138, 92, .12); color: var(--ok); }
.form-row { display: grid; grid-template-columns: repeat(4, 1fr) auto; gap: 8px; align-items: end; }
.hint { font-size: 13px; color: var(--muted); max-width: 70ch; }
.mono { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 12px; overflow-wrap: anywhere; }

/* ---------- иконки проектов ---------- */
.p-icon { display: inline-grid; place-items: center; flex: none; color: #fff; font-weight: 700; letter-spacing: .02em; overflow: hidden; line-height: 1; }
.p-icon.img { background: var(--sunken); box-shadow: inset 0 0 0 1px var(--line); }
.p-icon img { width: 100%; height: 100%; object-fit: contain; display: block; }
.nav-item .p-icon { font-size: 8px !important; }
.nav-label { overflow: hidden; text-overflow: ellipsis; }
.board-title { display: inline-flex; align-items: center; gap: 10px; }
.icon-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.icon-prev { width: 48px; height: 48px; border-radius: 11px; background: var(--sunken); display: grid; place-items: center; overflow: hidden; font-size: 11px; box-shadow: inset 0 0 0 1px var(--line); }
.icon-prev img { width: 100%; height: 100%; object-fit: contain; }

/* ---------- колокольчик ---------- */
.bell-wrap { position: relative; margin-left: 4px; }
.bell { position: relative; width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line); background: var(--panel); display: grid; place-items: center; cursor: pointer; color: var(--text); }
.bell:hover { background: var(--sunken); }
.bell-count { position: absolute; top: -5px; right: -5px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: #e5484d; color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center; box-shadow: 0 0 0 2px var(--panel); }
.bell-menu { position: absolute; right: 0; top: 44px; z-index: 40; width: 320px; max-width: calc(100vw - 24px); background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-lg); padding: 6px; }
.bell-title { font-weight: 650; padding: 8px 10px 6px; display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.bell-clear { font-size: 12px; font-weight: 400; }
.bell-item { display: flex; align-items: center; gap: 10px; width: 100%; border: 0; background: none; padding: 8px 10px; border-radius: 8px; cursor: pointer; text-align: left; }
.bell-item:hover { background: var(--sunken); }
.bell-text { display: flex; flex-direction: column; min-width: 0; }
.bell-proj { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bell-text .muted { font-size: 12px; }
.bell-empty { padding: 14px 10px; color: var(--muted); }

/* ---------- доска по сотрудникам ---------- */
.lanes { flex: 1; overflow: auto; padding: 0 20px 90px; }
.lane { display: grid; grid-template-columns: 200px repeat(5, minmax(190px, 1fr)); gap: 8px; min-width: 1170px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.lane-head { position: sticky; top: 0; z-index: 2; background: var(--bg); padding: 12px 0 8px; font-weight: 600; font-size: 13px; }
.lane-col-head { display: flex; align-items: center; gap: 7px; padding: 0 4px; }
.lane-col-head .bar { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.lane-col-head .n { color: var(--muted); font-weight: 500; }
.lane-who { display: flex; align-items: flex-start; gap: 10px; padding: 6px 4px; position: sticky; left: 0; background: var(--bg); z-index: 1; }
.lane-head .lane-who { color: var(--muted); font-weight: 500; }
.lane-name { min-width: 0; font-weight: 600; line-height: 1.3; }
.lane-name .muted { font-size: 12px; font-weight: 400; }
.lane-cell { background: var(--sunken); border-radius: 10px; padding: 6px; display: flex; flex-direction: column; gap: 6px; min-height: 64px; transition: background .12s; }
.lane-cell.drop { background: var(--accent-soft); }
.lane-dept .lane-who { color: var(--accent); }
.lane-dept .lane-cell { background: var(--accent-soft); }
.dept-icon { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); font-size: 16px; flex: none; }
.dept-badge { margin-left: 6px; font-size: 10px; font-weight: 600; color: var(--accent); border: 1px solid var(--accent); border-radius: 4px; padding: 0 5px; vertical-align: 1px; }
.take-btn { height: 26px; padding: 0 8px; font-size: 12px; border-color: var(--accent); color: var(--accent); width: 100%; justify-content: center; margin-top: 8px; }
.card .meta { flex-wrap: wrap; row-gap: 4px; }
.card .meta .right { flex-wrap: wrap; justify-content: flex-end; }
.card .meta .right > span { white-space: nowrap; }
.code-id { white-space: nowrap; }
.take-btn:hover { background: var(--accent); color: #fff; }
.dep-line { font-size: 11px; color: #7c3aed; margin-top: 6px; padding-top: 6px; border-top: 1px dashed var(--line); }
@media (prefers-color-scheme: dark) { .dep-line { color: #c4a5ff; } }
.deps { margin-top: 6px; }
.dep-item { display: flex; align-items: center; gap: 8px; padding: 5px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.dep-item.ok .dep-title { color: var(--muted); text-decoration: line-through; }
.dep-status { width: 8px; height: 8px; border-radius: 2px; flex: none; }
.dep-code { font-weight: 600; font-size: 12px; }
.dep-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dep-st { font-size: 12px; white-space: nowrap; }
.deps select { margin-top: 6px; }
.deps .lbl { margin-top: 14px; }
.dep-warn { color: #7c3aed; font-weight: 600; }
.dep-okay { color: var(--ok); }
.labels { display: flex; flex-wrap: wrap; gap: 4px; margin: -2px 0 8px; }
.label { display: inline-flex; align-items: center; gap: 2px; font-size: 11px; font-weight: 600; border-radius: 4px; padding: 1px 6px; line-height: 1.5; }
@media (prefers-color-scheme: dark) { .label { filter: brightness(.75) saturate(1.3); } }
.label-x { border: 0; background: none; color: inherit; cursor: pointer; padding: 0 0 0 2px; font-size: 13px; line-height: 1; opacity: .7; }
.label-x:hover { opacity: 1; }
.due { font-size: 12px; color: var(--muted); margin: -2px 0 8px; }
.due-over { color: var(--danger); font-weight: 600; }
.due-today { color: var(--warn); font-weight: 600; }
.due-soon { color: var(--warn); }
.due-done { color: var(--muted); }
.check-count.all { color: var(--ok); }
.mention-badge { background: #e5484d; }
.mention { color: var(--accent); font-weight: 600; background: var(--accent-soft); border-radius: 4px; padding: 0 2px; }
.mention.me { background: #fde68a; color: #7c4a03; }
.msg.mine .mention { background: rgba(255, 255, 255, .22); color: #fff; }
.mention-wrap { position: relative; flex: 1; width: 100%; }
.mention-wrap > textarea { width: 100%; }
.mention-pop { position: absolute; left: 0; bottom: calc(100% + 4px); z-index: 30; min-width: 240px; max-width: 100%; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow-lg); padding: 4px; }
.mention-item { display: flex; align-items: center; gap: 8px; width: 100%; border: 0; background: none; padding: 6px 8px; border-radius: 6px; cursor: pointer; text-align: left; }
.mention-item .muted { margin-left: auto; font-size: 12px; }
.mention-item.active, .mention-item:hover { background: var(--accent-soft); }
.row-gap { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.tpl-row { background: var(--sunken); border-radius: 8px; padding: 4px 10px 10px; margin-bottom: 4px; }
.tpl-row select { flex: 1; min-width: 180px; }
.checklist { margin-top: 14px; }
.progress.small { height: 4px; margin: 2px 0 6px; max-width: none; }
.check-item { display: flex; align-items: center; gap: 8px; padding: 3px 0; }
.check-item input { width: 16px; height: 16px; accent-color: var(--accent); flex: none; }
.check-text { flex: 1; overflow-wrap: anywhere; }
.check-item.done .check-text { color: var(--muted); text-decoration: line-through; }
.check-item .btn { visibility: hidden; }
.check-item:hover .btn { visibility: visible; }
.checklist > .field { margin-top: 4px; height: 30px; }
.files-zone { border: 1px dashed var(--line); border-radius: 8px; padding: 8px; transition: background .12s; }
.files-zone.drop { background: var(--accent-soft); border-color: var(--accent); }
.files { display: flex; flex-direction: column; gap: 4px; margin-bottom: 6px; }
.comment .files { margin: 6px 0 0; }
.files.pending:empty { display: none; }
.add-comment .files.pending { width: 100%; }
.file { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.file-thumb { width: 40px; height: 40px; border-radius: 6px; overflow: hidden; background: var(--sunken); display: grid; place-items: center; flex: none; }
.file-thumb img { width: 100%; height: 100%; object-fit: cover; }
.file-ic { width: 40px; text-align: center; font-size: 20px; flex: none; }
.file-name { text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; flex: 1; }
.file-size { font-size: 12px; white-space: nowrap; }
.card.is-new { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.new-badge { margin-left: 6px; font-size: 10px; font-weight: 700; color: #fff; background: var(--accent); border-radius: 4px; padding: 1px 5px; vertical-align: 1px; }
.archive-timer { font-size: 11px; color: var(--muted); margin-top: 6px; padding-top: 6px; border-top: 1px dashed var(--line); }
.archive-list { display: flex; flex-direction: column; max-height: 60vh; overflow-y: auto; }
.archive-item { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; text-align: left; border: 0; border-bottom: 1px solid var(--line); background: none; padding: 9px 4px; cursor: pointer; }
.archive-item:hover { background: var(--sunken); }
.archive-item .code { font-size: 12px; color: var(--muted); font-weight: 600; }
.archive-item .muted { grid-column: 2; font-size: 12px; }

/* ---------- чат проекта ---------- */
.chat { position: fixed; right: 20px; bottom: 20px; z-index: 15; display: flex; flex-direction: column; align-items: flex-end; gap: 10px; }
.chat-fab { position: relative; width: 54px; height: 54px; border-radius: 50%; border: 0; background: var(--accent); color: #fff; font-size: 22px; cursor: pointer; box-shadow: var(--shadow-lg); }
.chat-fab:hover { filter: brightness(1.08); }
.chat-panel { width: 360px; height: min(520px, calc(100vh - 110px)); background: var(--panel); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-lg); display: flex; flex-direction: column; overflow: hidden; }
.chat-head { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.chat-head-text { flex: 1; min-width: 0; }
.chat-title { font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-head .muted { font-size: 12px; }
.chat-faces { display: flex; }
.chat-faces .av { margin-left: -6px; box-shadow: 0 0 0 2px var(--panel); }
.chat-list { flex: 1; overflow-y: auto; padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; }
.chat-day { align-self: center; font-size: 11px; color: var(--muted); background: var(--sunken); border-radius: 10px; padding: 2px 10px; margin: 8px 0 4px; }
.chat-empty { margin: auto; color: var(--muted); text-align: center; }
.msg { display: flex; gap: 8px; align-items: flex-end; max-width: 88%; }
.msg.first { margin-top: 6px; }
.msg.mine { align-self: flex-end; }
.msg-gap { width: 28px; flex: none; }
.msg-bubble { background: var(--sunken); border-radius: 12px; padding: 6px 10px; min-width: 0; }
.msg.mine .msg-bubble { background: var(--accent); color: #fff; }
.msg-author { font-size: 12px; font-weight: 650; color: var(--accent); margin-bottom: 1px; }
.msg-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.msg-time { font-size: 10px; opacity: .65; text-align: right; margin-top: 2px; display: flex; gap: 6px; justify-content: flex-end; align-items: center; }
.msg-del { border: 0; background: none; color: inherit; cursor: pointer; font-size: 10px; padding: 0; opacity: 0; }
.msg:hover .msg-del { opacity: .8; }
.chat-send { display: flex; gap: 8px; padding: 10px; border-top: 1px solid var(--line); align-items: flex-end; }
.chat-input { flex: 1; resize: none; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; background: var(--panel); outline: none; max-height: 120px; font: inherit; }
.chat-input:focus { border-color: var(--accent); }
.chat-send .btn { height: 36px; }
@media (max-width: 560px) { .chat { right: 12px; bottom: 12px; } .chat-panel { width: calc(100vw - 24px); } }

/* ---------- главная: проекты ---------- */
.proj-list { display: flex; flex-direction: column; gap: 10px; max-width: 980px; }
.proj {
  display: flex; align-items: center; gap: 16px; background: var(--panel); border: 1px solid var(--line);
  border-radius: 12px; padding: 16px 18px; cursor: pointer; transition: border-color .12s, box-shadow .12s;
}
.proj:hover { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.proj:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.proj.locked { cursor: default; background: var(--sunken); }
.proj.locked:hover { border-color: var(--line); box-shadow: none; }
.proj.locked .proj-name, .proj.locked .proj-desc { color: var(--muted); }
.proj-main { flex: 1; min-width: 0; }
.proj-top { margin-bottom: 4px; }
.proj-name { font-size: 16px; font-weight: 650; overflow-wrap: anywhere; }
.proj-desc { color: var(--muted); margin-top: 2px; overflow-wrap: anywhere; }
.proj-stats { font-size: 12px; color: var(--muted); margin-top: 6px; }
.proj-go { font-size: 22px; color: var(--muted); padding: 0 4px; }

/* ---------- выбор проектов ---------- */
.picker { border: 1px solid var(--line); border-radius: 8px; max-height: 240px; overflow-y: auto; padding: 4px 0; }
.picker.disabled { opacity: .45; pointer-events: none; }
.pick { display: flex; align-items: center; gap: 10px; padding: 6px 12px; cursor: pointer; }
.picker .pick:hover { background: var(--sunken); }
.pick-all { border-bottom: 1px solid var(--line); font-weight: 600; margin-bottom: 2px; }
.pick-key { font-size: 11px; font-weight: 700; color: var(--muted); min-width: 40px; }
.pick-row { justify-content: space-between; }
.pick-main { display: flex; align-items: center; gap: 10px; cursor: pointer; flex: 1; min-width: 0; }
.pick-row .pick-dept { width: 200px; flex: none; height: 30px; font-size: 13px; padding: 0 8px; }
.pick-dept:disabled { opacity: .4; }
.pick-dept-h { margin-left: auto; width: 200px; flex: none; font-size: 12px; font-weight: 500; }
@media (max-width: 560px) { .pick-row { flex-wrap: wrap; } .pick-row .pick-dept { width: calc(100% - 26px); margin-left: 26px; } .pick-dept-h { display: none; } }
.pick input { width: 16px; height: 16px; accent-color: var(--accent); flex: none; }
.profile-info { font-size: 13px; line-height: 1.7; padding: 10px 0; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.about { white-space: pre-wrap; overflow-wrap: anywhere; background: var(--sunken); border-radius: 8px; padding: 8px 10px; margin-top: 6px; }

/* ---------- обрезка аватарки ---------- */
.crop { display: flex; flex-direction: column; align-items: center; }
.crop-box { position: relative; overflow: hidden; border-radius: 12px; background: #111; cursor: grab; touch-action: none; user-select: none; }
.crop-box.grabbing { cursor: grabbing; }
.crop-img { position: absolute; left: 0; top: 0; max-width: none; transform-origin: 0 0; pointer-events: none; }
.crop-ring { position: absolute; inset: 0; border-radius: 50%; box-shadow: 0 0 0 999px rgba(0, 0, 0, .55); outline: 2px solid rgba(255, 255, 255, .85); outline-offset: -2px; pointer-events: none; }
.crop-zoom-row { display: flex; align-items: center; gap: 10px; margin-top: 14px; width: 100%; max-width: 300px; color: var(--muted); font-size: 18px; }
.crop-zoom { flex: 1; accent-color: var(--accent); }

/* ---------- профиль ---------- */
.onboard { align-items: start; }
.onboard-card { max-width: 620px; margin: 24px 0; }
.onboard-brand { display: flex; align-items: center; gap: 10px; font-weight: 650; color: var(--muted); margin-bottom: 14px; }
.onboard-title { margin: 0 0 4px; font-size: 22px; }
.pf-head { display: flex; align-items: center; gap: 18px; margin: 14px 0 4px; }
.pf-avatar { width: 96px; height: 96px; border-radius: 50%; overflow: hidden; flex: none; background: var(--sunken); box-shadow: 0 0 0 1px var(--line); }
.pf-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pf-avatar span { width: 100%; height: 100%; display: grid; place-items: center; color: #fff; font-size: 34px; font-weight: 650; }
.pf-pic-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.pf-pic-actions .field-hint { flex-basis: 100%; }
.req-mark { color: var(--danger); }
.about-head { display: flex; justify-content: space-between; align-items: baseline; }
.counter { font-size: 12px; color: var(--muted); }
.about-tools { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 4px; }
.field-hint.flash { color: var(--danger); }
.emoji-panel { display: grid; grid-template-columns: repeat(auto-fill, minmax(36px, 1fr)); gap: 2px; border: 1px solid var(--line); border-radius: 8px; padding: 6px; margin-top: 6px; }
.emoji { border: 0; background: none; font-size: 20px; height: 36px; border-radius: 6px; cursor: pointer; }
.emoji:hover { background: var(--sunken); }
.combo { position: relative; }
.combo-list {
  position: absolute; left: 0; right: 0; top: 36px; z-index: 5; background: var(--panel); border: 1px solid var(--line);
  border-radius: 8px; box-shadow: var(--shadow-lg); max-height: 260px; overflow-y: auto; padding: 4px;
}
.combo-item { display: flex; justify-content: space-between; gap: 10px; width: 100%; border: 0; background: none; padding: 7px 10px; border-radius: 6px; cursor: pointer; text-align: left; }
.combo-item .muted { font-size: 12px; white-space: nowrap; }
.combo-item.active, .combo-item:hover { background: var(--accent-soft); }
.combo-empty { padding: 8px 10px; color: var(--muted); }
@media (max-width: 560px) { .pf .grid2, .modal .grid2 { grid-template-columns: 1fr; } .proj { padding: 12px; gap: 12px; } .proj-key { width: 44px; height: 44px; font-size: 10.5px; } }

/* ---------- пользователи ---------- */
.badge { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: #e5484d; color: #fff; font-size: 11px; font-weight: 700; margin-left: auto; }
h3 .badge { margin-left: 6px; vertical-align: 1px; }
.imp-banner { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; background: var(--accent-soft); color: var(--text); border-color: var(--line); }
@media (prefers-color-scheme: dark) { .banner.imp-banner { background: var(--accent-soft); color: var(--text); border-color: var(--line); } }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.panel-head h3 { margin: 0; }
.panel-accent { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.req { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); flex-wrap: wrap; }
.req-info { flex: 1; min-width: 180px; }
.req-name { font-weight: 600; }
.req-actions { display: flex; gap: 6px; }
.row-link { cursor: pointer; }
.row-link:hover td { background: var(--sunken); }
.who { display: inline-flex; gap: 8px; align-items: center; }
.modal.wide { max-width: 560px; max-height: calc(100vh - 32px); overflow-y: auto; }
.user-head { display: flex; gap: 14px; align-items: center; padding: 4px 0 14px; border-bottom: 1px solid var(--line); margin-bottom: 4px; font-size: 13px; }
.user-name { font-size: 16px; font-weight: 650; margin-bottom: 2px; }
.actions-title { font-size: 12px; color: var(--muted); margin: 20px 0 6px; text-transform: uppercase; letter-spacing: .05em; }
.action-list { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.action { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; padding: 9px 12px; border: 0; border-bottom: 1px solid var(--line); background: var(--panel); cursor: pointer; text-align: left; }
.action:last-child { border-bottom: 0; }
.action:hover { background: var(--sunken); }
.action-label { font-weight: 550; }
.action-hint { font-size: 12px; color: var(--muted); }
.action.danger .action-label { color: var(--danger); }
.action.warn .action-label { color: var(--warn); }

/* ---------- компания и обновления ---------- */
.company-preview { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 18px 0 8px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.company-preview-name { font-size: 18px; font-weight: 650; text-align: center; overflow-wrap: anywhere; }
.progress { height: 6px; background: var(--sunken); border-radius: 3px; overflow: hidden; margin-top: 12px; max-width: 420px; }
.progress > div { height: 100%; width: 0; background: var(--accent); transition: width .15s; }
.update-banner { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* ---------- диалоги и уведомления ---------- */
.modal-wrap { position: fixed; inset: 0; background: rgba(10, 14, 22, .4); display: grid; place-items: center; z-index: 30; padding: 16px; }
.modal { background: var(--panel); border-radius: 12px; padding: 22px; width: 100%; max-width: 480px; box-shadow: var(--shadow-lg); }
.modal h3 { margin: 0 0 6px; font-size: 17px; }
.modal .foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--text); color: var(--panel);
  padding: 9px 16px; border-radius: 8px; box-shadow: var(--shadow-lg); z-index: 50; font-size: 13px; max-width: 90vw;
}

/* ---------- телефон ---------- */
@media (max-width: 800px) {
  .layout { grid-template-columns: 1fr; }
  .nav { position: fixed; inset: 0 auto 0 0; width: 260px; z-index: 25; transform: translateX(-100%); transition: transform .18s; }
  .nav.open { transform: none; box-shadow: var(--shadow-lg); }
  .menu-btn { display: inline-flex; }
  .topbar { padding: 10px 16px; }
  .topbar h2 { flex: 1 1 calc(100% - 160px); min-width: 0; margin-right: 0; font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
  .topbar h2 small { margin-left: 6px; }
  .topbar .add-btn { order: 2; }
  .topbar .filter { flex: 1 1 55%; order: 3; }
  .topbar .btn:not(.add-btn):not(.menu-btn) { order: 3; }
  .topbar .search { width: 100%; order: 4; }
  .board { grid-template-columns: repeat(4, 82vw); scroll-snap-type: x mandatory; padding: 12px 16px; }
  .col { scroll-snap-align: start; }
  .drawer-body { grid-template-columns: 1fr; }
  .drawer-side { border-left: 0; border-top: 1px solid var(--line); order: -1; display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px; }
  .side-info { grid-column: 1 / -1; margin-top: 0; }
  .drawer-main, .drawer-head { padding-left: 16px; padding-right: 16px; }
  .form-row { grid-template-columns: 1fr 1fr; }
  .page { padding: 16px; }
  .tbl .hide-sm { display: none; }
}

/* ---------- 0.7: подзадачи, наблюдатели, повторы, мои задачи, люди, чат ---------- */
.upd-badge { background: #0e9f6e; }
.recur-badge { margin-left: 4px; font-size: 11px; }
.parent-line { font-size: 11px; color: var(--muted); margin: 2px 0 -2px; }
.parent-link { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.subtasks { margin: 14px 0 6px; }
.sub-add { display: grid; grid-template-columns: 1fr 190px; gap: 8px; margin-top: 6px; }
@media (max-width: 560px) { .sub-add { grid-template-columns: 1fr; } }
.btn.on { color: var(--accent); background: var(--accent-soft); }
.watchers { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.move-notes { margin: 10px 0 0; padding-left: 18px; line-height: 1.6; }
.recur-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; }
.recur-item .grow { flex: 1; min-width: 0; }
.recur-title { font-weight: 600; }
.recur-item .muted { font-size: 12px; }
.day-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.day-chip { display: inline-flex; align-items: center; gap: 4px; border: 1px solid var(--line); border-radius: 8px; padding: 4px 8px; cursor: pointer; font-size: 13px; }
.day-chip:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.rep-extra .row-gap { margin-top: 8px; align-items: center; }

.my-tabs { margin: 0 0 14px; max-width: 1000px; flex-wrap: wrap; }
.my-tabs .count { margin-left: 6px; font-size: 11px; background: var(--sunken); border-radius: 9px; padding: 0 6px; }
.my-group { max-width: 1000px; margin-bottom: 18px; }
.my-group-title { font-weight: 650; margin: 0 0 6px; }
.my-row { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; margin-bottom: 6px; cursor: pointer; color: var(--text); font: inherit; }
.my-row:hover { border-color: var(--accent); }
.my-row.done .my-title { color: var(--muted); text-decoration: line-through; }
.my-row .code { font-size: 12px; color: var(--muted); flex: none; }
.my-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.my-meta { display: flex; align-items: center; gap: 8px; flex: none; font-size: 12px; }
.status-pill { font-size: 11px; border-radius: 10px; padding: 1px 8px; color: var(--c); border: 1px solid var(--c); white-space: nowrap; }
@media (max-width: 700px) { .my-row { flex-wrap: wrap; } .my-meta { width: 100%; justify-content: flex-end; } }

.pill.away { background: rgba(217, 119, 6, .12); color: #b45309; margin-top: 3px; white-space: normal; display: inline-block; line-height: 1.35; }
@media (prefers-color-scheme: dark) { .pill.away { color: #fbbf24; } }
.bday-panel { max-width: 980px; margin-bottom: 14px; border-radius: 14px; padding: 14px 16px; background: linear-gradient(120deg, rgba(236, 72, 153, .10), rgba(245, 158, 11, .12)); border: 1px solid rgba(236, 72, 153, .25); }
.bday-today { display: flex; gap: 14px; align-items: center; }
.bday-cake { font-size: 34px; }
.bday-head { font-weight: 700; margin-bottom: 4px; }
.bday-people { display: flex; flex-wrap: wrap; gap: 6px 16px; }
.bday-person { display: inline-flex; align-items: center; gap: 6px; }
.bday-soon { font-size: 13px; margin-top: 8px; }
.bday-today + .bday-soon { padding-top: 8px; border-top: 1px dashed rgba(236, 72, 153, .3); }
.bday-panel > .bday-soon:first-child { margin-top: 0; }

.chat-bday { font-size: 12px; padding: 6px 12px; background: rgba(236, 72, 153, .10); border-bottom: 1px solid var(--line); }
.msg { position: relative; }
.msg-col { display: flex; flex-direction: column; min-width: 0; max-width: 100%; }
.msg.mine .msg-col { align-items: flex-end; }
.msg-quote { display: block; text-align: left; border: 0; border-left: 3px solid var(--accent); background: rgba(127, 127, 127, .12); border-radius: 6px; padding: 3px 8px; margin: 2px 0 4px; font: inherit; font-size: 12px; color: inherit; cursor: pointer; max-width: 260px; }
.msg.mine .msg-quote { border-left-color: #fff; background: rgba(255, 255, 255, .18); }
.msg-quote b { display: block; font-size: 11px; }
.msg-quote span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; opacity: .85; }
.msg.flash .msg-bubble { box-shadow: 0 0 0 3px rgba(245, 158, 11, .7); transition: box-shadow .3s; }
.msg-tools { display: flex; gap: 2px; align-self: center; opacity: 0; transition: opacity .15s; }
.msg:hover .msg-tools, .msg:focus-within .msg-tools { opacity: 1; }
.msg.mine .msg-tools { order: -1; }
.msg-tools button { border: 0; background: none; cursor: pointer; color: var(--muted); font-size: 13px; width: 24px; height: 24px; border-radius: 6px; padding: 0; }
.msg-tools button:hover { background: var(--sunken); color: var(--text); }
@media (hover: none) { .msg-tools { opacity: .7; } }
.reacts { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 3px; }
.react { border: 1px solid var(--line); background: var(--panel); border-radius: 12px; padding: 0 7px; height: 22px; font-size: 12px; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; color: var(--text); }
.react.mine { border-color: var(--accent); background: var(--accent-soft); }
.react-pick { display: flex; gap: 2px; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 3px 5px; box-shadow: var(--shadow-lg); margin-top: 4px; }
.react-pick button { border: 0; background: none; font-size: 18px; cursor: pointer; width: 30px; height: 30px; border-radius: 8px; }
.react-pick button:hover { background: var(--sunken); }
.chat-reply { display: flex; align-items: center; gap: 8px; padding: 6px 10px 0 12px; border-top: 1px solid var(--line); font-size: 12px; border-left: 3px solid var(--accent); }
.chat-reply .grow { flex: 1; min-width: 0; }
.chat-reply .muted { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-reply + .chat-send { border-top: 0; }

/* рисованные значки вместо смайликов */
.ic { display: inline-flex; vertical-align: -0.15em; line-height: 0; }
.ic svg { display: block; }
.chat-fab { display: grid; place-items: center; }
.chat-fab .ic { vertical-align: 0; }
.chat-send .btn .ic, .menu-btn .ic { vertical-align: 0; }
.bday-cake { color: #db2777; display: grid; place-items: center; width: 52px; height: 52px; border-radius: 50%; background: rgba(236, 72, 153, .14); flex: none; }
.bday-mark, .bday-line .ic, .chat-bday .ic { color: #db2777; }
.bday-mark { margin-left: 5px; }
.dept-icon { display: grid; place-items: center; color: var(--accent); }
.file-ic { color: var(--muted); display: inline-grid; place-items: center; }
.recur-badge { color: var(--accent); }
.archive-timer .ic, .due .ic, .dep-line .ic { vertical-align: -0.12em; }
.local-time { white-space: nowrap; }
.pill .ic { vertical-align: -0.12em; }
.msg-tools button { display: inline-grid; place-items: center; }

/* ---------- 0.8: оформление текста, проверка, группы, сообщения, в сети ---------- */
.md { overflow-wrap: anywhere; }
.md p { margin: 0 0 6px; }
.md > :last-child { margin-bottom: 0; }
.md ul, .md ol { margin: 2px 0 6px; padding-left: 22px; }
.md li { margin: 1px 0; }
.md .md-h1 { font-size: 1.3em; font-weight: 700; margin: 8px 0 4px; }
.md .md-h2 { font-size: 1.15em; font-weight: 700; margin: 8px 0 4px; }
.md .md-h3 { font-weight: 700; margin: 6px 0 3px; }
.md blockquote { margin: 4px 0 6px; padding: 2px 10px; border-left: 3px solid var(--line); color: var(--muted); }
.md code { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: .9em; background: var(--sunken); border-radius: 4px; padding: 1px 4px; }
.md pre { background: var(--sunken); border-radius: 8px; padding: 8px 10px; overflow-x: auto; margin: 4px 0 6px; }
.md pre code { background: none; padding: 0; white-space: pre; }
.md a { color: var(--accent); }
.msg.mine .md a, .msg.mine .md .task-ref { color: #fff; text-decoration: underline; }
.msg.mine .md code, .msg.mine .md pre { background: rgba(255, 255, 255, .18); }
.msg-text .md p { margin: 0; }
.task-ref { font-weight: 600; text-decoration: none; border-bottom: 1px dashed currentColor; }
.task-ref.done { text-decoration: line-through; }
.md-img { display: block; margin: 6px 0; min-height: 40px; }
.md-img.loading { background: var(--sunken); border-radius: 8px; width: 220px; height: 120px; }
.md-img img { max-width: 100%; max-height: 360px; border-radius: 8px; border: 1px solid var(--line); cursor: zoom-in; display: block; }
.msg .md-img img { max-height: 220px; }
.lightbox { position: fixed; inset: 0; z-index: 200; background: rgba(0, 0, 0, .82); display: grid; place-items: center; padding: 24px; cursor: zoom-out; }
.lightbox img { max-width: 100%; max-height: 100%; border-radius: 6px; box-shadow: 0 10px 40px rgba(0, 0, 0, .5); }
.desc-lbl { display: flex; align-items: baseline; gap: 10px; }
.small-link { font-size: 12px; }
.desc-view { border: 1px solid transparent; border-radius: 8px; padding: 6px 2px; min-height: 36px; line-height: 1.5; }
.desc-view:hover { border-color: var(--line); }
.desc-view.empty { color: var(--muted); cursor: text; border-color: var(--line); border-style: dashed; padding: 10px; }
.md-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; margin: 4px 0; }
.md-btn { border: 1px solid transparent; background: none; border-radius: 6px; min-width: 28px; height: 26px; padding: 0 6px; cursor: pointer; color: var(--text); font-size: 13px; display: inline-grid; place-items: center; }
.md-btn:hover { background: var(--sunken); border-color: var(--line); }
.md-hint { margin-left: auto; font-size: 11px; color: var(--muted); }
@media (max-width: 560px) { .md-hint { display: none; } }

.review-banner { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 10px 12px; border-radius: 10px; margin-bottom: 12px; background: rgba(217, 119, 6, .1); border: 1px solid rgba(217, 119, 6, .35); }
.review-banner .grow { flex: 1; min-width: 180px; }
.review-banner .muted { font-size: 12px; }
.ok-btn { background: var(--ok); border-color: var(--ok); color: #fff; }
.review-badge { background: #d97706; }

.card { position: relative; }
.card-check { position: absolute; top: 8px; right: 8px; width: 20px; height: 20px; border-radius: 6px; border: 1.5px solid var(--line); background: var(--panel); display: grid; place-items: center; cursor: pointer; opacity: 0; padding: 0; color: #fff; transition: opacity .12s; }
.card:hover .card-check, .card:focus-within .card-check, .card-check.on, .lanes:has(.card.selected) .card-check { opacity: 1; }
.card-check.on { background: var(--accent); border-color: var(--accent); }
.card.selected { box-shadow: 0 0 0 2px var(--accent); }
@media (hover: none) { .card-check { opacity: .8; } }
.bulk-bar { position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 60; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: center; max-width: calc(100vw - 32px); background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px; box-shadow: var(--shadow-lg); }
.bulk-bar .field { width: auto; min-width: 120px; height: 34px; padding-top: 4px; padding-bottom: 4px; }
.bulk-bar input.field { width: 120px; }

.av.online::after { content: ''; position: absolute; right: -1px; bottom: -1px; width: 30%; height: 30%; min-width: 7px; min-height: 7px; max-width: 14px; max-height: 14px; border-radius: 50%; background: #22c55e; box-shadow: 0 0 0 2px var(--panel); }
.person-link { font: inherit; font-weight: 600; color: inherit; text-align: left; padding: 0; }
.person-link:hover { color: var(--accent); }
.person-head { display: flex; gap: 14px; align-items: center; margin-bottom: 12px; }
.person-status { font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.person-status.on { color: var(--ok); font-weight: 600; }
.person-row { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; border-top: 1px solid var(--line); font-size: 14px; }
.person .about { margin-top: 10px; white-space: pre-wrap; }
.chat-faces { border: 0; background: none; cursor: pointer; padding: 0; }
.member-list { display: flex; flex-direction: column; gap: 2px; max-height: 60vh; overflow-y: auto; }
.member { display: flex; align-items: center; gap: 10px; border: 0; background: none; text-align: left; padding: 8px; border-radius: 8px; cursor: pointer; color: var(--text); font: inherit; }
.member:hover { background: var(--sunken); }
.member .grow { flex: 1; min-width: 0; }
.member .muted { font-size: 12px; }

.dm-layout { display: grid; grid-template-columns: 300px 1fr; gap: 0; height: calc(100vh - 61px); height: calc(100dvh - 61px); border-top: 1px solid var(--line); }
.dm-side { border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; padding: 12px; gap: 8px; background: var(--panel); }
.dm-side .search { width: 100%; }
.dm-threads { overflow-y: auto; display: flex; flex-direction: column; gap: 2px; min-height: 0; }
.dm-thread { display: flex; align-items: center; gap: 10px; border: 0; background: none; text-align: left; padding: 8px; border-radius: 10px; cursor: pointer; color: var(--text); font: inherit; }
.dm-thread:hover { background: var(--sunken); }
.dm-thread.active { background: var(--accent-soft); }
.dm-thread-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.dm-thread-top { display: flex; justify-content: space-between; gap: 6px; }
.dm-thread-top b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dm-thread-top .muted { font-size: 11px; flex: none; }
.dm-last { font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dm-main { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.dm-main .empty-state { margin: auto; }
.dm-head { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--panel); }
.dm-peer { display: flex; align-items: center; gap: 10px; border: 0; background: none; cursor: pointer; text-align: left; color: var(--text); font: inherit; padding: 0; min-width: 0; }
.dm-peer > span { display: flex; flex-direction: column; min-width: 0; }
.dm-peer .muted { font-size: 12px; }
.dm-back { display: none; }
.dm-main .chat-list { flex: 1; padding: 14px 18px; }
.dm-main .msg { max-width: min(640px, 88%); }
.dm-main .chat-send { background: var(--panel); }
@media (max-width: 760px) {
  .dm-layout { grid-template-columns: 1fr; }
  .dm-layout.has-peer .dm-side { display: none; }
  .dm-layout:not(.has-peer) .dm-main { display: none; }
  .dm-back { display: inline-flex; }
}
.add-comment .md-bar { align-self: stretch; margin-bottom: -4px; }
.bulk-bar select.field, .bulk-bar input.field { width: auto; max-width: 190px; flex: 0 1 auto; }
@media (max-width: 700px) { .bulk-bar { bottom: 8px; gap: 6px; padding: 8px; } .bulk-bar select.field { max-width: 140px; } }
.bulk-bar { width: max-content; }
@media (min-width: 801px) { .bulk-bar { left: calc(50% + 116px); max-width: calc(100vw - 264px); } }

/* ---------- отделы на доске: цветная полоса слева ---------- */
.dept-title { position: sticky; left: 0; display: flex; align-items: baseline; gap: 8px; width: max-content; padding: 14px 8px 4px 16px; font-weight: 700; font-size: 13px; }
.dept-title::before { content: ''; position: absolute; left: 0; top: 12px; bottom: -1px; width: 5px; border-radius: 3px 3px 0 0; background: var(--dc); }
.dept-title-name { color: var(--dc); text-transform: uppercase; letter-spacing: .04em; }
.dept-title .muted { font-weight: 400; font-size: 12px; }
.lane.in-dept > .lane-who { padding-left: 16px; }
.lane.in-dept > .lane-who::before { content: ''; position: absolute; left: 0; top: -9px; bottom: -10px; width: 5px; background: var(--dc); }
.lane.in-dept.dept-last > .lane-who::before { bottom: -2px; border-radius: 0 0 3px 3px; }
.lane.in-dept.dept-last { margin-bottom: 6px; }
.lane.lane-dept.in-dept .lane-who, .lane.lane-dept.in-dept .dept-icon { color: var(--dc); }
.lane.lane-dept.in-dept .lane-cell { background: color-mix(in srgb, var(--dc) 9%, var(--sunken)); }

/* список отделов проекта */
.dept-editor { display: flex; flex-direction: column; gap: 6px; }
.dept-row { display: flex; align-items: center; gap: 6px; }
.dept-row .field { flex: 1; }
.dept-dot { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.dept-row .btn[disabled] { opacity: .3; cursor: default; }
