/* ================= HiLow: стили ================= */

@font-face { font-family: Manrope; src: url("/fonts/Manrope-400.ttf") format("truetype"); font-weight: 400; font-display: swap; }
@font-face { font-family: Manrope; src: url("/fonts/Manrope-500.ttf") format("truetype"); font-weight: 500; font-display: swap; }
@font-face { font-family: Manrope; src: url("/fonts/Manrope-600.ttf") format("truetype"); font-weight: 600; font-display: swap; }
@font-face { font-family: Manrope; src: url("/fonts/Manrope-700.ttf") format("truetype"); font-weight: 700; font-display: swap; }
@font-face { font-family: Manrope; src: url("/fonts/Manrope-800.ttf") format("truetype"); font-weight: 800; font-display: swap; }

:root {
  --bg: #f7f7f5;
  --panel: #ffffff;
  --panel-2: #fbfaf8;
  --border: #e7dfda;
  --border-strong: #d8ccc4;
  --text: #29211f;
  --muted: #716763;
  --muted-2: #9a8c84;
  --accent: #ff6b35;
  --accent-hover: #f9622c;
  --accent-weak: #ffe8dc;
  --accent-text: #bc3f12;
  --blue: #2457c5;
  --green: #16794b;
  --red: #b42318;
  --yellow: #9a5b00;
  --purple: #6d28d9;
  --col-bg: #f0ece9;
  --hover: #f5f0ec;
  --shadow-sm: 0 1px 2px rgba(41, 33, 31, .06);
  --shadow: 0 8px 24px rgba(41, 33, 31, .12);
  --shadow-lg: 0 24px 64px rgba(41, 33, 31, .22);
  --r-sm: 8px;
  --r: 12px;
  --r-lg: 16px;
  --font: "Manrope", "Segoe UI", Arial, sans-serif;
  --mono: "Cascadia Code", "Consolas", ui-monospace, monospace;
}

[data-theme="dark"] {
  --bg: #1d1917;
  --panel: #29211f;
  --panel-2: #352d2a;
  --border: #584b45;
  --border-strong: #6b5a52;
  --text: #fff6ef;
  --muted: #bfaea5;
  --muted-2: #8f7f76;
  --accent: #ff6b35;
  --accent-hover: #ff8355;
  --accent-weak: #3a2a22;
  --accent-text: #ff9c75;
  --col-bg: #1d1917;
  --hover: #352d2a;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow: 0 10px 30px rgba(0, 0, 0, .45);
  --shadow-lg: 0 24px 70px rgba(0, 0, 0, .6);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.45;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4, p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }
[data-theme="dark"] :focus-visible { outline-color: var(--accent); }
.hidden { display: none !important; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

.ic { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ---------- служебные ---------- */

.boot {
  position: fixed; inset: 0; z-index: 300;
  display: grid; place-items: center;
  background: var(--bg);
  transition: opacity .25s;
}
.boot-logo {
  width: 54px; height: 54px; border-radius: 14px; display: block;
  box-shadow: var(--shadow);
  animation: pulse 1s infinite ease-in-out;
}
@keyframes pulse { 50% { transform: scale(.92); opacity: .7; } }

.brand-lockup { height: 32px; width: auto; display: block; }
.brand-lockup.white { height: 36px; }
.lockup-on-dark { display: none; }
[data-theme="dark"] .lockup-on-light { display: none; }
[data-theme="dark"] .lockup-on-dark { display: block; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 34px; padding: 0 13px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  background: var(--panel);
  color: var(--text);
  font-weight: 500; font-size: 13.5px;
  transition: background .15s, border-color .15s, transform .05s;
  white-space: nowrap;
}
.btn:hover { background: var(--hover); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #29211f; }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--hover); }
.btn.danger { color: var(--red); border-color: color-mix(in srgb, var(--red) 35%, var(--border)); }
.btn.danger:hover { background: color-mix(in srgb, var(--red) 10%, var(--panel)); }
.btn.sm { height: 28px; padding: 0 9px; font-size: 12.5px; }
.btn.wide { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.icon-btn {
  width: 32px; height: 32px; border: 0; border-radius: 8px;
  background: transparent; color: var(--muted);
  display: inline-grid; place-items: center;
  transition: background .15s, color .15s;
}
.icon-btn:hover { background: var(--hover); color: var(--text); }
.icon-btn.active { background: var(--accent-weak); color: var(--accent-text); }

.avatar {
  width: 28px; height: 28px; border-radius: 50%; flex: none;
  display: inline-grid; place-items: center;
  color: #fff; font-size: 11px; font-weight: 700;
  letter-spacing: .02em;
  border: 2px solid var(--panel);
  user-select: none;
}
.avatar.sm { width: 22px; height: 22px; font-size: 9px; border-width: 1.5px; }
.avatar.lg { width: 40px; height: 40px; font-size: 14px; }
.avatar.ghost { background: var(--panel); border: 1px dashed var(--border-strong); color: var(--muted); }
.avatar-stack { display: flex; align-items: center; }
.avatar-stack .avatar + .avatar { margin-left: -7px; }

.badge {
  min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px;
  background: var(--red); color: #fff; font-size: 10px; font-weight: 700;
  display: inline-grid; place-items: center;
}

.chip {
  display: inline-flex; align-items: center; gap: 5px;
  height: 22px; padding: 0 8px; border-radius: 6px;
  background: var(--hover); color: var(--muted);
  font-size: 11.5px; font-weight: 600; white-space: nowrap;
}
.chip .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

.tag {
  display: inline-flex; align-items: center; gap: 4px;
  height: 20px; padding: 0 7px; border-radius: 5px;
  font-size: 10.5px; font-weight: 700; letter-spacing: .02em;
  text-transform: uppercase; color: #fff; white-space: nowrap;
}

.seg {
  display: inline-flex; background: var(--hover); border-radius: 8px; padding: 2px;
}
.seg button {
  border: 0; background: transparent; color: var(--muted);
  height: 28px; padding: 0 12px; border-radius: 6px;
  font-size: 13px; font-weight: 600;
}
.seg button.active { background: var(--panel); color: var(--text); box-shadow: var(--shadow-sm); }

.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; }
.field > span { font-size: 12px; font-weight: 600; color: var(--muted); }
.field input, .field select, .field textarea,
.input {
  height: 36px; padding: 0 11px;
  border: 1px solid var(--border-strong); border-radius: 8px;
  background: var(--panel); color: var(--text);
  outline: none; width: 100%;
}
.field textarea { height: auto; padding: 9px 11px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus, .input:focus {
  border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-weak);
}
.invalid { border-color: var(--red) !important; }

.empty {
  padding: 28px; text-align: center; color: var(--muted);
  border: 1px dashed var(--border-strong); border-radius: var(--r);
  font-size: 13px;
}

/* ---------- вход ---------- */

.auth {
  min-height: 100dvh;
  display: grid; grid-template-columns: 1.1fr .9fr;
  background: var(--panel);
}
.auth-side {
  position: relative; overflow: hidden;
  padding: 54px 56px;
  background: #29211f;
  color: #fff6ef;
  display: flex; flex-direction: column; justify-content: center; gap: 26px;
}
.auth-side::before {
  content: ""; position: absolute; width: 520px; height: 520px; border-radius: 50%;
  right: -160px; top: -160px;
  background: radial-gradient(circle, rgba(255, 107, 53, .42), transparent 65%);
}
.auth-side::after {
  content: ""; position: absolute; width: 420px; height: 420px; border-radius: 50%;
  left: -180px; bottom: -180px;
  background: radial-gradient(circle, rgba(255, 232, 220, .12), transparent 65%);
}
.auth-brand { display: flex; align-items: center; gap: 10px; position: relative; z-index: 1; }
.auth-side h1 {
  position: relative; z-index: 1;
  font-size: 44px; line-height: 1.08; font-weight: 800; letter-spacing: -.03em;
}
.auth-sub { position: relative; z-index: 1; color: #bfaea5; font-size: 15px; max-width: 440px; }
.auth-list { position: relative; z-index: 1; list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.auth-list li { display: flex; gap: 10px; color: #c9cfdb; font-size: 14.5px; }
.auth-list .tick {
  width: 20px; height: 20px; border-radius: 50%; flex: none;
  background: rgba(242, 115, 43, .18); color: #ff9a5c;
  display: grid; place-items: center; font-size: 11px; font-weight: 800;
}
.auth-foot { position: relative; z-index: 1; color: #7d8698; font-size: 12.5px; max-width: 420px; }
.auth-panel { display: grid; place-items: center; padding: 32px; background: var(--bg); }
.auth-card { width: 100%; max-width: 380px; background: var(--panel); border: 1px solid var(--border); border-radius: 16px; padding: 26px; box-shadow: var(--shadow); }
.auth-tabs { display: flex; gap: 4px; background: var(--hover); border-radius: 9px; padding: 3px; margin-bottom: 20px; }
.auth-tabs button { flex: 1; height: 32px; border: 0; border-radius: 7px; background: transparent; color: var(--muted); font-weight: 600; }
.auth-tabs button.active { background: var(--panel); color: var(--text); box-shadow: var(--shadow-sm); }
.auth-error { color: var(--red); font-size: 12.5px; min-height: 18px; margin: 8px 0 0; }
.auth-demo { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--muted); }
.auth-demo button { border: 0; background: transparent; color: var(--accent-text); font-family: var(--mono); font-size: 11.5px; }

/* ---------- каркас ---------- */

.app { display: grid; grid-template-columns: 264px minmax(0, 1fr); height: 100dvh; overflow: hidden; }

.sidebar {
  background: var(--panel);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  padding: 14px 12px 10px;
  min-height: 0;
  position: relative; z-index: 30;
}
.ws { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; padding: 2px 6px 14px; }
.ws small { color: var(--muted); font-size: 11px; }
.create-project { margin-bottom: 14px; }
.side-nav { display: flex; flex-direction: column; gap: 2px; overflow-y: auto; }
.side-nav a, .side-nav button {
  display: flex; align-items: center; gap: 9px;
  height: 32px; padding: 0 9px; border: 0; border-radius: 7px;
  background: transparent; color: var(--muted);
  font-size: 13.5px; font-weight: 500; text-align: left;
  white-space: nowrap; overflow: hidden; width: 100%;
}
.side-nav a:hover, .side-nav button:hover { background: var(--hover); color: var(--text); }
.side-nav a.active, .side-nav button.active { background: var(--accent-weak); color: var(--accent-text); font-weight: 600; }
.side-nav .proj-dot { width: 9px; height: 9px; border-radius: 3px; flex: none; }
.side-nav .proj-name { overflow: hidden; text-overflow: ellipsis; }
.side-nav .count { margin-left: auto; color: var(--muted-2); font-size: 11px; font-weight: 600; }
.side-sep { height: 1px; background: var(--border); margin: 10px 4px; }
.side-bottom { margin-top: auto; padding-top: 8px; position: relative; }
.user-chip {
  display: flex; align-items: center; gap: 9px; padding: 6px;
  border-radius: 9px; cursor: pointer;
}
.user-chip:hover { background: var(--hover); }
.user-text { display: flex; flex-direction: column; line-height: 1.25; overflow: hidden; }
.user-text strong { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-text small { color: var(--muted); font-size: 11px; }
.user-chip > .ic { margin-left: auto; color: var(--muted); width: 16px; height: 16px; }
.user-menu {
  position: absolute; bottom: 58px; left: 0; right: 0; z-index: 60;
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 10px; box-shadow: var(--shadow); padding: 5px;
}
.user-menu button {
  display: flex; width: 100%; border: 0; background: transparent;
  height: 32px; align-items: center; padding: 0 9px; border-radius: 6px;
  font-size: 13px; color: var(--text); text-align: left;
}
.user-menu button:hover { background: var(--hover); }
.user-menu button.danger { color: var(--red); }

.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--bg); }

.topbar {
  height: 54px; flex: none;
  display: flex; align-items: center; gap: 14px;
  padding: 0 16px;
  background: var(--panel); border-bottom: 1px solid var(--border);
  position: relative; z-index: 20;
}
.crumbs { display: flex; align-items: center; gap: 6px; min-width: 0; font-size: 13px; }
.crumbs a, .crumbs button { border: 0; background: transparent; color: var(--muted); font-weight: 600; padding: 4px 2px; border-radius: 5px; white-space: nowrap; }
.crumbs a:hover, .crumbs button:hover { color: var(--text); }
.crumbs .sep { color: var(--muted-2); }
.crumbs .cur { color: var(--text); font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crumbs .proj-dot { width: 8px; height: 8px; border-radius: 3px; }

.topbar-search { position: relative; margin-left: auto; width: min(420px, 34vw); }
.topbar-search .ic { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--muted); width: 16px; height: 16px; }
.topbar-search input {
  width: 100%; height: 34px; padding: 0 58px 0 34px;
  border: 1px solid var(--border); border-radius: 8px;
  background: var(--panel-2); outline: none;
}
.topbar-search input:focus { border-color: var(--accent); background: var(--panel); box-shadow: 0 0 0 3px var(--accent-weak); }
.topbar-search kbd {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  font-family: var(--font); font-size: 10px; color: var(--muted-2);
  border: 1px solid var(--border); border-radius: 4px; padding: 1px 4px;
  background: var(--panel);
}
.topbar-actions { display: flex; align-items: center; gap: 4px; }
.badge { position: absolute; top: 4px; right: 4px; }
#bell-btn { position: relative; }

.viewbar {
  flex: none; display: flex; align-items: center; gap: 10px;
  padding: 9px 16px;
  background: var(--panel); border-bottom: 1px solid var(--border);
  min-height: 50px;
}
.viewbar .spacer { flex: 1; }
.vsep { width: 1px; height: 20px; background: var(--border); flex: none; }
.view-tabs { display: flex; align-items: center; gap: 2px; }
.view-tabs button, .view-tabs a {
  display: inline-flex; align-items: center; gap: 6px;
  height: 32px; padding: 0 10px; border: 0; border-radius: 7px;
  background: transparent; color: var(--muted); font-size: 13px; font-weight: 600;
}
.view-tabs button:hover, .view-tabs a:hover { background: var(--hover); color: var(--text); }
.view-tabs button.active, .view-tabs a.active { background: var(--accent-weak); color: var(--accent-text); }
.board-tabs { display: flex; align-items: center; gap: 2px; overflow-x: auto; }
.board-tabs .btab {
  display: inline-flex; align-items: center; height: 32px; padding: 0 11px;
  border: 0; border-radius: 7px; background: transparent; color: var(--muted);
  font-size: 13px; font-weight: 600; white-space: nowrap;
}
.board-tabs .btab:hover { background: var(--hover); color: var(--text); }
.board-tabs .btab.active { background: var(--hover); color: var(--text); }
.board-tabs .btab-add { width: 30px; padding: 0; justify-content: center; }

.view { flex: 1; min-height: 0; overflow: auto; position: relative; }
.page { padding: 20px 22px 40px; max-width: 1240px; margin: 0 auto; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h1 { font-size: 22px; font-weight: 700; letter-spacing: -.01em; }
.page-head p { color: var(--muted); font-size: 13px; margin-top: 3px; }

/* ---------- доска ---------- */

.board-wrap { height: 100%; min-height: 0; overflow: auto; }
.board { display: flex; align-items: flex-start; gap: 12px; padding: 14px 14px 26px; min-height: 100%; }
.col {
  width: 276px; flex: none;
  background: var(--col-bg);
  border-radius: var(--r-lg);
  display: flex; flex-direction: column;
  max-height: calc(100dvh - 172px);
  border: 1px solid transparent;
}
.col.drag-target { border-color: color-mix(in srgb, var(--accent) 55%, transparent); background: color-mix(in srgb, var(--accent) 7%, var(--col-bg)); }
.col-head { display: flex; align-items: center; gap: 6px; padding: 10px 10px 6px 12px; }
.col-head .cdot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.col-head h3 { font-size: 13px; font-weight: 700; letter-spacing: .01em; }
.col-head .count { color: var(--muted); font-size: 12px; font-weight: 600; }
.col-head .spacer { flex: 1; }
.col-head .icon-btn { width: 26px; height: 26px; }
.col-head .icon-btn .ic { width: 15px; height: 15px; }
.col-body {
  padding: 2px 8px 8px; display: flex; flex-direction: column; gap: 7px;
  overflow-y: auto; min-height: 44px;
}
.col-body:empty::after {
  content: "Перетащите задачу сюда"; display: block; text-align: center;
  color: var(--muted-2); font-size: 11.5px; padding: 16px 0; border: 1px dashed var(--border-strong);
  border-radius: 8px;
}
.col-foot { padding: 2px 8px 10px; }
.add-inline {
  display: flex; align-items: center; gap: 6px; width: 100%;
  border: 0; background: transparent; color: var(--muted);
  padding: 8px; border-radius: 7px; font-size: 12.5px; font-weight: 600; text-align: left;
}
.add-inline:hover { background: var(--panel); color: var(--text); }
.add-inline .ic { width: 15px; height: 15px; }
.new-card { background: var(--panel); border-radius: 9px; padding: 8px; box-shadow: var(--shadow-sm); }
.new-card textarea { width: 100%; border: 0; outline: none; resize: none; background: transparent; min-height: 52px; }
.col-add {
  width: 240px; flex: none; height: 40px; border: 1px dashed var(--border-strong);
  border-radius: var(--r); background: transparent; color: var(--muted);
  font-weight: 600; font-size: 13px;
}
.col-add:hover { background: var(--panel); color: var(--text); }

.card {
  position: relative;
  background: var(--panel);
  border-radius: 10px;
  padding: 9px 10px 9px 12px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: box-shadow .15s, border-color .15s, transform .1s;
  overflow: hidden;
}
.card:hover { border-color: var(--border-strong); box-shadow: 0 3px 10px rgba(16, 24, 40, .09); }
.card:active { transform: scale(.995); }
.card.dragging { opacity: .45; }
.card::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: var(--card-color, transparent);
}
.card.has-cover { padding: 0 0 9px; }
.card-cover { height: 116px; background: var(--hover); overflow: hidden; }
.card-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card-inner { padding: 0 10px 0 12px; }
.card.has-cover .card-inner { padding-top: 8px; }
.card-top { display: flex; align-items: center; gap: 6px; margin-bottom: 3px; }
.code { font-family: var(--mono); font-size: 10.5px; color: var(--muted-2); font-weight: 600; letter-spacing: .02em; }
.card h4 { font-size: 13.5px; font-weight: 600; line-height: 1.35; margin: 0 0 7px; overflow-wrap: anywhere; }
.card-tags { display: flex; flex-wrap: wrap; gap: 3px; margin-bottom: 8px; }
.card-foot { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 11px; min-height: 22px; }
.card-foot .deadline { display: inline-flex; align-items: center; gap: 4px; font-weight: 600; }
.card-foot .deadline .ic { width: 12px; height: 12px; }
.card-foot .deadline.overdue { color: var(--red); }
.card-foot .deadline.today { color: var(--yellow); }
.card-foot .deadline.done { color: var(--green); }
.card-foot .right { margin-left: auto; display: flex; align-items: center; gap: 9px; }
.meta { display: inline-flex; align-items: center; gap: 3px; color: var(--muted); font-weight: 600; }
.meta .ic { width: 13px; height: 13px; }
.card.done h4 { color: var(--muted); text-decoration: line-through; text-decoration-thickness: 1px; }
.card .prio-bar { width: 100%; height: 2px; border-radius: 2px; background: var(--hover); overflow: hidden; margin-top: 8px; }
.card .prio-bar i { display: block; height: 100%; width: 100%; }

.placeholder {
  border: 2px dashed color-mix(in srgb, var(--accent) 50%, transparent);
  background: color-mix(in srgb, var(--accent) 7%, transparent);
  border-radius: 10px; height: 62px;
}

/* ---------- панель задачи ---------- */

.overlay {
  position: fixed; inset: 0; z-index: 40;
  background: rgba(9, 12, 19, .38);
  backdrop-filter: blur(1px);
}
.task-panel {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 50;
  width: min(880px, 100%);
  background: var(--panel);
  box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column;
  animation: slideIn .18s ease-out;
  border-left: 1px solid var(--border);
}
@keyframes slideIn { from { transform: translateX(24px); opacity: .4; } }
.tp-head { padding: 14px 18px 0; border-bottom: 1px solid var(--border); flex: none; }
.tp-crumbs { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 12px; margin-bottom: 8px; }
.tp-crumbs .code { font-size: 11.5px; }
.tp-crumbs .spacer { flex: 1; }
.tp-title-row { display: flex; align-items: flex-start; gap: 10px; padding-bottom: 12px; }
.tp-title {
  flex: 1; border: 0; outline: none; background: transparent; resize: none;
  font-size: 21px; font-weight: 700; line-height: 1.25; letter-spacing: -.01em;
  padding: 2px 4px; border-radius: 6px; min-height: 34px; overflow: hidden;
}
.tp-title:focus { background: var(--panel-2); box-shadow: 0 0 0 2px var(--accent-weak); }
.tp-tabs { display: flex; gap: 2px; }
.tp-tabs button {
  border: 0; background: transparent; color: var(--muted);
  height: 34px; padding: 0 11px; font-size: 13px; font-weight: 600;
  border-bottom: 2px solid transparent; display: inline-flex; align-items: center; gap: 5px;
}
.tp-tabs button:hover { color: var(--text); }
.tp-tabs button.active { color: var(--accent-text); border-bottom-color: var(--accent); }
.tp-body { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 252px; }
.tp-main { padding: 16px 18px 24px; overflow-y: auto; min-height: 0; }
.tp-side { border-left: 1px solid var(--border); padding: 14px 14px 24px; overflow-y: auto; background: var(--panel-2); min-height: 0; }

.desc-view { font-size: 13.5px; line-height: 1.6; }
.desc-view h2 { font-size: 16px; margin: 14px 0 6px; }
.desc-view h3 { font-size: 14px; margin: 12px 0 5px; }
.desc-view p { margin: 0 0 9px; }
.desc-view ul, .desc-view ol { margin: 0 0 9px; padding-left: 20px; }
.desc-view li { margin-bottom: 3px; }
.desc-view code { font-family: var(--mono); font-size: 12px; background: var(--hover); padding: 1px 5px; border-radius: 4px; }
.desc-view pre { background: var(--hover); padding: 10px; border-radius: 8px; overflow: auto; }
.desc-view blockquote { border-left: 3px solid var(--border-strong); margin: 0 0 9px; padding-left: 10px; color: var(--muted); }
.desc-view a { color: var(--blue); text-decoration: underline; }
.desc-view img { max-width: 100%; border-radius: 8px; }
.desc-empty { color: var(--muted); font-size: 13px; padding: 18px; border: 1px dashed var(--border-strong); border-radius: 8px; text-align: center; }
.desc-actions { display: flex; gap: 8px; margin-top: 12px; }
.desc-editor { display: flex; flex-direction: column; gap: 8px; }
.desc-editor textarea {
  width: 100%; min-height: 320px; border: 1px solid var(--border-strong);
  border-radius: 9px; padding: 11px; background: var(--panel-2); outline: none;
  font-size: 13.5px; line-height: 1.55; resize: vertical;
}
.desc-editor textarea:focus { border-color: var(--accent); }
.md-toolbar { display: flex; gap: 2px; flex-wrap: wrap; }
.md-toolbar button {
  height: 26px; min-width: 28px; border: 1px solid var(--border); border-radius: 6px;
  background: var(--panel); color: var(--muted); font-size: 12px; font-weight: 700; padding: 0 7px;
}
.md-toolbar button:hover { background: var(--hover); color: var(--text); }

.prop { margin-bottom: 15px; }
.prop-label { display: flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 700; color: var(--muted-2); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 6px; }
.prop-value { font-size: 13px; }
.prop-value select, .prop-value input[type="date"], .prop-value input[type="datetime-local"] {
  width: 100%; height: 32px; border: 1px solid transparent; background: var(--panel);
  border-radius: 7px; padding: 0 7px; outline: none; font-size: 12.5px;
}
.prop-value select:hover, .prop-value input:hover { border-color: var(--border); }
.prop-value select:focus, .prop-value input:focus { border-color: var(--accent); }
.prop-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.mini-select { height: 26px; border: 1px solid var(--border); border-radius: 6px; background: var(--panel); font-size: 11.5px; padding: 0 5px; }

.user-pick { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; }
.user-pill {
  display: inline-flex; align-items: center; gap: 5px; padding: 2px 7px 2px 3px;
  border-radius: 20px; background: var(--panel); border: 1px solid var(--border);
  font-size: 12px; font-weight: 600;
}
.user-pill .x { border: 0; background: transparent; color: var(--muted-2); padding: 0 0 0 2px; font-size: 13px; line-height: 1; }
.user-pill .x:hover { color: var(--red); }

.picker { position: relative; }
.picker-pop {
  position: absolute; z-index: 80; min-width: 220px; max-height: 260px; overflow-y: auto;
  background: var(--panel); border: 1px solid var(--border); border-radius: 9px;
  box-shadow: var(--shadow); padding: 4px;
}
.picker-pop button {
  display: flex; align-items: center; gap: 8px; width: 100%;
  border: 0; background: transparent; padding: 6px 7px; border-radius: 6px;
  font-size: 12.5px; text-align: left;
}
.picker-pop button:hover { background: var(--hover); }
.picker-pop button.sel { background: var(--accent-weak); color: var(--accent-text); }
.picker-pop .empty-line { padding: 8px; color: var(--muted); font-size: 12px; }

.chk { display: flex; flex-direction: column; gap: 3px; }
.chk-item { display: flex; align-items: flex-start; gap: 7px; font-size: 12.5px; padding: 3px 0; }
.chk-item input { margin: 2px 0 0; accent-color: var(--accent); }
.chk-item.done span { color: var(--muted); text-decoration: line-through; }
.chk-item button { margin-left: auto; border: 0; background: transparent; color: var(--muted-2); opacity: 0; }
.chk-item:hover button { opacity: 1; }
.chk-add { display: flex; gap: 4px; margin-top: 4px; }
.chk-add input { flex: 1; height: 28px; border: 1px solid var(--border); border-radius: 6px; padding: 0 7px; background: var(--panel); font-size: 12px; outline: none; }
.chk-progress { height: 5px; border-radius: 3px; background: var(--hover); overflow: hidden; margin: 6px 0; }
.chk-progress i { display: block; height: 100%; background: var(--green); }

.swatches { display: grid; grid-template-columns: repeat(5, 1fr); gap: 5px; max-width: 230px; }
.swatch { aspect-ratio: 1; border-radius: 50%; border: 2px solid transparent; }
.swatch.sel { border-color: var(--text); }
.swatch.none { background: var(--panel); border: 1px dashed var(--border-strong); position: relative; }

.stickers-pick { display: flex; flex-wrap: wrap; gap: 4px; }
.sticker-opt { border: 1px solid transparent; opacity: .45; }
.sticker-opt.sel { opacity: 1; border-color: var(--text); }

/* чат */
.chat { display: flex; flex-direction: column; gap: 14px; }
.msg { display: flex; gap: 9px; }
.msg-main { flex: 1; min-width: 0; }
.msg-head { display: flex; align-items: baseline; gap: 7px; margin-bottom: 2px; }
.msg-head strong { font-size: 12.5px; }
.msg-head time { color: var(--muted-2); font-size: 11px; }
.msg-body { font-size: 13.5px; line-height: 1.5; overflow-wrap: anywhere; }
.msg-body p { margin: 0 0 6px; }
.msg-body a { color: var(--blue); text-decoration: underline; }
.msg-files { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.file-chip {
  display: inline-flex; align-items: center; gap: 6px; max-width: 240px;
  border: 1px solid var(--border); border-radius: 7px; padding: 4px 7px;
  background: var(--panel-2); font-size: 11.5px; color: var(--text);
}
.file-chip .ic { width: 14px; height: 14px; color: var(--muted); }
.file-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg-del { border: 0; background: transparent; color: var(--muted-2); opacity: 0; }
.msg:hover .msg-del { opacity: 1; }
.chat-compose { border: 1px solid var(--border-strong); border-radius: 10px; background: var(--panel); overflow: hidden; margin-top: 6px; }
.chat-compose textarea { width: 100%; border: 0; outline: none; resize: none; padding: 10px 11px 4px; min-height: 64px; background: transparent; }
.compose-bar { display: flex; align-items: center; gap: 4px; padding: 5px 6px; border-top: 1px solid var(--border); }
.compose-bar .spacer { flex: 1; }
.compose-files { display: flex; gap: 5px; flex-wrap: wrap; padding: 0 9px 6px; }
.send-hint { font-size: 10.5px; color: var(--muted-2); margin-right: 4px; }

.files-list { display: flex; flex-direction: column; gap: 6px; }
.image-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; margin-top: 10px; }
.image-grid .img-card { border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background: var(--panel-2); }
.image-grid img { width: 100%; height: 90px; object-fit: cover; display: block; }
.image-grid .img-meta { padding: 5px 7px; font-size: 11px; color: var(--muted); display: flex; justify-content: space-between; gap: 4px; }

.history { display: flex; flex-direction: column; gap: 12px; }
.hist-item { display: flex; gap: 9px; font-size: 12.5px; color: var(--muted); }
.hist-item b { color: var(--text); font-weight: 600; }
.hist-item time { margin-left: auto; color: var(--muted-2); font-size: 11px; white-space: nowrap; }

/* ---------- гант ---------- */

.gantt-page { height: 100%; display: flex; flex-direction: column; min-height: 0; }
.gantt-page .gantt-wrap { flex: 1; min-height: 0; }
.gantt-wrap { height: 100%; overflow: auto; }
.gantt { width: max-content; min-width: 100%; padding-bottom: 30px; }
.g-row { display: flex; min-height: 38px; border-bottom: 1px solid var(--border); }
.g-row.head { position: sticky; top: 0; z-index: 5; background: var(--panel); min-height: 46px; }
.g-name {
  position: sticky; left: 0; z-index: 4; flex: none; width: 300px;
  background: var(--panel); border-right: 1px solid var(--border);
  display: flex; align-items: center; gap: 8px; padding: 0 12px;
  font-size: 12.5px; overflow: hidden;
}
.g-row.head .g-name { z-index: 6; font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.g-name .code { font-size: 10px; }
.g-name .t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.g-name .dot { width: 7px; height: 7px; border-radius: 50%; flex: none; }
.g-time { position: relative; flex: none; height: 100%; }
.g-row.head .g-time { display: flex; flex-direction: column; }
.g-months { display: flex; height: 22px; }
.g-month { font-size: 10.5px; font-weight: 700; color: var(--muted); padding: 4px 6px; border-right: 1px solid var(--border); white-space: nowrap; overflow: hidden; }
.g-days { display: flex; height: 24px; }
.g-day { width: 30px; flex: none; text-align: center; font-size: 10px; color: var(--muted-2); border-right: 1px solid var(--border); padding-top: 4px; }
.g-day.weekend { background: var(--panel-2); }
.g-day.today { background: var(--accent-weak); color: var(--accent-text); font-weight: 700; }
.g-row .g-time { background-image: repeating-linear-gradient(to right, transparent 0, transparent 29px, var(--border) 29px, var(--border) 30px); }
.g-row:hover { background: color-mix(in srgb, var(--accent) 3%, transparent); }
.g-bar {
  position: absolute; top: 9px; height: 20px; border-radius: 5px;
  background: var(--blue); color: #fff; font-size: 10px; font-weight: 600;
  display: flex; align-items: center; padding: 0 6px; cursor: pointer;
  overflow: hidden; white-space: nowrap; box-shadow: var(--shadow-sm);
}
.g-bar.done { background: var(--green); }
.g-bar.overdue { background: var(--red); }
.g-bar .lbl { overflow: hidden; text-overflow: ellipsis; }
.g-today-line { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--accent); opacity: .7; z-index: 2; pointer-events: none; }
.g-legend { display: flex; gap: 14px; padding: 10px 16px; font-size: 11.5px; color: var(--muted); flex-wrap: wrap; }
.g-legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; margin-right: 5px; vertical-align: -1px; }

/* ---------- таблица ---------- */

.table-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.table-tools input, .table-tools select { height: 32px; border: 1px solid var(--border-strong); border-radius: 7px; background: var(--panel); padding: 0 9px; outline: none; font-size: 12.5px; }
.table-scroll { border: 1px solid var(--border); border-radius: var(--r); overflow: auto; background: var(--panel); }
table.grid { width: 100%; border-collapse: collapse; font-size: 13px; }
table.grid th {
  position: sticky; top: 0; z-index: 2; background: var(--panel-2);
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .04em;
  color: var(--muted); padding: 9px 12px; border-bottom: 1px solid var(--border); white-space: nowrap;
  cursor: pointer; user-select: none;
}
table.grid th .ic { width: 12px; height: 12px; vertical-align: -2px; margin-left: 3px; }
table.grid td { padding: 8px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.grid tr:last-child td { border-bottom: 0; }
table.grid tbody tr { cursor: pointer; }
table.grid tbody tr:hover { background: var(--hover); }
table.grid td.title { font-weight: 600; max-width: 380px; }
table.grid td.title .done { color: var(--muted); }
table.grid .sub { display: block; color: var(--muted); font-size: 11px; font-weight: 400; margin-top: 1px; }
.status-pill { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 600; }
.status-pill .dot { width: 7px; height: 7px; border-radius: 50%; }

/* ---------- сводки ---------- */

.summary-grid { display: flex; gap: 12px; align-items: flex-start; overflow-x: auto; padding-bottom: 20px; }
.summary-col { width: 300px; flex: none; background: var(--col-bg); border-radius: var(--r-lg); display: flex; flex-direction: column; max-height: calc(100dvh - 210px); }
.summary-col .col-body { overflow-y: auto; }
.summary-head { padding: 11px 12px 6px; display: flex; align-items: center; gap: 7px; }
.summary-head h3 { font-size: 13px; font-weight: 700; }
.summary-head .count { color: var(--muted); font-weight: 600; font-size: 12px; }
.summary-head .ic { width: 15px; height: 15px; color: var(--muted); }
.card .proj-badge { display: inline-flex; align-items: center; gap: 4px; font-size: 10.5px; color: var(--muted); margin-bottom: 4px; }
.card .proj-badge i { width: 6px; height: 6px; border-radius: 2px; }

/* ---------- отчёты ---------- */

.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-bottom: 18px; }
.kpi {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--r);
  padding: 14px 16px; display: flex; flex-direction: column; gap: 6px;
}
.kpi .kpi-label { font-size: 12px; color: var(--muted); font-weight: 600; }
.kpi .kpi-value { font-size: 27px; font-weight: 750; letter-spacing: -.02em; line-height: 1; }
.kpi .kpi-sub { font-size: 11.5px; color: var(--muted-2); }
.kpi.accent .kpi-value { color: var(--accent-text); }
.kpi.red .kpi-value { color: var(--red); }
.kpi.green .kpi-value { color: var(--green); }

.panel-block { background: var(--panel); border: 1px solid var(--border); border-radius: var(--r); padding: 16px; margin-bottom: 16px; }
.panel-block h2 { font-size: 14px; font-weight: 700; margin-bottom: 4px; }
.panel-block .sub { color: var(--muted); font-size: 12px; margin-bottom: 12px; }
.bars { display: flex; flex-direction: column; gap: 11px; }
.bar-row { display: grid; grid-template-columns: 170px 1fr 46px; gap: 10px; align-items: center; font-size: 12.5px; }
.bar-track { height: 12px; background: var(--hover); border-radius: 4px; display: flex; overflow: hidden; }
.bar-track i { display: block; height: 100%; }
.bar-row .val { text-align: right; color: var(--muted); font-weight: 600; font-size: 12px; }

/* ---------- настройки ---------- */

.settings-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 16px; align-items: start; }
@media (max-width: 1000px) { .settings-grid { grid-template-columns: 1fr; } }
.set-block { background: var(--panel); border: 1px solid var(--border); border-radius: var(--r); padding: 16px; }
.set-block h2 { font-size: 14px; font-weight: 700; margin-bottom: 12px; display: flex; align-items: center; gap: 7px; }
.set-block .hint { color: var(--muted); font-size: 11.5px; margin-top: 4px; }
.member-row { display: flex; align-items: center; gap: 8px; padding: 7px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.member-row:last-child { border-bottom: 0; }
.member-row .grow { flex: 1; min-width: 0; }
.member-row small { display: block; color: var(--muted); font-size: 11px; overflow: hidden; text-overflow: ellipsis; }
.member-row select { height: 28px; border: 1px solid var(--border); border-radius: 6px; background: var(--panel); font-size: 12px; padding: 0 4px; }
.role-badge { font-size: 10.5px; font-weight: 700; padding: 2px 6px; border-radius: 4px; background: var(--hover); color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.role-badge.manager { background: var(--accent-weak); color: var(--accent-text); }
.role-badge.employee { background: color-mix(in srgb, var(--blue) 12%, transparent); color: var(--blue); }
.role-badge.status-active { background: color-mix(in srgb, var(--green) 14%, transparent); color: var(--green); }
.role-badge.status-invited { background: color-mix(in srgb, var(--yellow) 16%, transparent); color: var(--yellow); }
.role-badge.status-disabled { background: color-mix(in srgb, var(--red) 14%, transparent); color: var(--red); }

/* ---------- модалки, меню, тосты ---------- */

.modal-back { position: fixed; inset: 0; z-index: 100; background: rgba(9, 12, 19, .45); display: grid; place-items: center; padding: 20px; }
.modal { width: 100%; max-width: 440px; background: var(--panel); border-radius: 14px; box-shadow: var(--shadow-lg); border: 1px solid var(--border); overflow: hidden; }
.modal.wide { max-width: 560px; }
.modal-head { padding: 16px 18px 0; display: flex; align-items: flex-start; gap: 10px; }
.modal-head h2 { font-size: 16px; font-weight: 700; flex: 1; }
.modal-body { padding: 14px 18px 4px; }
.modal-foot { padding: 12px 18px 16px; display: flex; justify-content: flex-end; gap: 8px; }
.modal-error { color: var(--red); font-size: 12.5px; min-height: 17px; padding: 0 18px; }

.menu-pop {
  position: fixed; z-index: 120; min-width: 190px;
  background: var(--panel); border: 1px solid var(--border); border-radius: 9px;
  box-shadow: var(--shadow); padding: 4px;
}
.menu-pop button {
  display: flex; align-items: center; gap: 7px; width: 100%;
  border: 0; background: transparent; padding: 7px 8px; border-radius: 6px;
  font-size: 12.5px; text-align: left;
}
.menu-pop button:hover { background: var(--hover); }
.menu-pop button.danger { color: var(--red); }
.menu-pop .sep { height: 1px; background: var(--border); margin: 4px 2px; }

.search-pop {
  position: absolute; top: 40px; left: 0; right: 0; z-index: 90;
  background: var(--panel); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: var(--shadow); max-height: 420px; overflow-y: auto; padding: 4px;
}
.search-item { display: flex; align-items: center; gap: 8px; padding: 7px 8px; border-radius: 6px; cursor: pointer; }
.search-item:hover, .search-item.sel { background: var(--hover); }
.search-item .code { flex: none; }
.search-item .t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.search-item small { color: var(--muted); font-size: 11px; white-space: nowrap; }
.search-empty { padding: 14px; color: var(--muted); font-size: 12.5px; text-align: center; }

.notify-pop {
  position: fixed; top: 58px; right: 16px; z-index: 120;
  width: 340px; max-height: 460px; overflow-y: auto;
  background: var(--panel); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: var(--shadow-lg); padding: 6px;
}
.notify-item { display: flex; gap: 9px; padding: 9px; border-radius: 8px; cursor: pointer; }
.notify-item:hover { background: var(--hover); }
.notify-item .t { font-size: 12.5px; font-weight: 600; }
.notify-item .s { font-size: 11px; color: var(--muted); }
.notify-empty { padding: 18px; text-align: center; color: var(--muted); font-size: 12.5px; }

.toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast {
  background: #1c2331; color: #fff; padding: 9px 14px; border-radius: 9px;
  font-size: 13px; box-shadow: var(--shadow); animation: toastIn .18s ease-out;
  max-width: 90vw;
}
.toast.error { background: #b42318; }
.toast.ok { background: #0f7b3f; }
@keyframes toastIn { from { transform: translateY(6px); opacity: 0; } }

/* ---------- мессенджер ---------- */

.chats-page { display: grid; grid-template-columns: 300px minmax(0, 1fr); height: 100%; min-height: 0; }
.chat-side { border-right: 1px solid var(--border); background: var(--panel); display: flex; flex-direction: column; min-height: 0; }
.chat-side-head { display: flex; align-items: center; gap: 8px; padding: 12px 14px 8px; }
.chat-side-head h2 { flex: 1; font-size: 15px; }
.chat-list { overflow-y: auto; padding: 2px 8px 12px; display: flex; flex-direction: column; gap: 2px; }
.chat-item {
  display: flex; align-items: center; gap: 9px; width: 100%;
  border: 0; background: transparent; padding: 9px 8px; border-radius: 9px;
  text-align: left; position: relative;
}
.chat-item:hover { background: var(--hover); }
.chat-item.active { background: var(--accent-weak); }
.chat-avatar {
  width: 34px; height: 34px; border-radius: 50%; flex: none;
  background: var(--col-bg); color: var(--muted);
  display: grid; place-items: center; font-size: 11px; font-weight: 700;
}
.chat-item-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.chat-item-top { display: flex; align-items: baseline; gap: 6px; }
.chat-item-top b { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.chat-item-top time { font-size: 10.5px; color: var(--muted-2); }
.chat-item-preview { font-size: 11.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.unread { background: var(--accent); color: #29211f; border-radius: 9px; min-width: 18px; height: 18px; padding: 0 5px; font-size: 10px; font-weight: 700; display: grid; place-items: center; }
.chat-pane { position: relative; display: flex; flex-direction: column; min-height: 0; background: var(--bg); }
.chat-empty { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; color: var(--muted); font-size: 13px; }
.chat-empty .ic { width: 32px; height: 32px; opacity: .5; }
.chat-head { padding: 12px 18px; background: var(--panel); border-bottom: 1px solid var(--border); }
.chat-head h3 { font-size: 15px; }
.chat-members { color: var(--muted); font-size: 11.5px; margin-top: 2px; }
.chat-msgs { flex: 1; overflow-y: auto; padding: 16px 18px; display: flex; flex-direction: column; gap: 12px; }
.chat-msg { display: flex; gap: 8px; align-items: flex-start; }
.chat-msg.mine { justify-content: flex-end; }
.msg-bubble-wrap { max-width: min(640px, 78%); }
.chat-msg.mine .msg-bubble-wrap { align-items: flex-end; display: flex; flex-direction: column; }
.msg-meta { font-size: 10.5px; color: var(--muted-2); margin-bottom: 3px; }
.msg-bubble { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 8px 11px; font-size: 13.5px; line-height: 1.45; overflow-wrap: anywhere; }
.chat-msg.mine .msg-bubble { background: var(--accent-weak); border-color: color-mix(in srgb, var(--accent) 25%, var(--border)); }
.msg-actions { display: flex; gap: 8px; margin-top: 3px; opacity: 0; transition: opacity .15s; }
.chat-msg:hover .msg-actions { opacity: 1; }
.msg-actions button { border: 0; background: transparent; color: var(--muted); font-size: 11px; display: inline-flex; align-items: center; gap: 3px; padding: 2px 4px; border-radius: 4px; }
.msg-actions button:hover { background: var(--hover); color: var(--text); }
.msg-actions .ic { width: 12px; height: 12px; }
.msg-task-link { margin-top: 5px; border: 0; background: var(--panel); color: var(--accent-text); border-radius: 6px; padding: 3px 7px; font-size: 11.5px; font-weight: 600; display: inline-flex; align-items: center; gap: 5px; }
.msg-task-link .ic { width: 13px; height: 13px; }
.chat-compose { border-top: 1px solid var(--border); background: var(--panel); padding: 8px 12px 10px; }
.chat-compose textarea { width: 100%; border: 0; outline: none; resize: none; background: transparent; min-height: 38px; max-height: 160px; padding: 6px 4px; }
.compose-bar { display: flex; align-items: center; gap: 4px; }
.compose-bar .spacer { flex: 1; }
.chat-pick { display: flex; align-items: center; gap: 7px; padding: 5px 4px; font-size: 13px; border-radius: 5px; }
.chat-pick:hover { background: var(--hover); }
.chat-pick small { color: var(--muted); margin-left: auto; }
.msg-files { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; }

.crm-toggle { height: 20px; padding: 0 6px; border-radius: 6px; border: 1px solid var(--border); background: var(--panel); color: var(--muted); font-size: 10px; font-weight: 700; }
.crm-toggle.on { background: var(--accent-weak); color: var(--accent-text); border-color: color-mix(in srgb, var(--accent) 35%, var(--border)); }

.chat-kind { font-size: 10px; font-weight: 600; color: var(--muted); background: var(--hover); padding: 1px 5px; border-radius: 5px; text-transform: lowercase; vertical-align: middle; }
.reply-bar { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-bottom: 1px solid var(--border); background: var(--panel-2); font-size: 11.5px; color: var(--muted); }
.reply-bar span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reply-bar button { border: 0; background: none; color: var(--muted); font-size: 16px; line-height: 1; }
.msg-reply { border-left: 2px solid var(--accent); padding: 3px 7px; margin-bottom: 5px; background: var(--panel-2); border-radius: 4px; font-size: 11.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg-reactions { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 5px; }
.reaction { border: 1px solid var(--border); background: var(--panel); border-radius: 12px; padding: 1px 7px; font-size: 11px; color: var(--muted); display: inline-flex; gap: 3px; }
.reaction.active { background: var(--accent-weak); border-color: color-mix(in srgb, var(--accent) 35%, var(--border)); color: var(--accent-text); }
.chat-readonly { padding: 12px; text-align: center; color: var(--muted); font-size: 12px; border-top: 1px solid var(--border); }
.thread-drawer { position: absolute; top: 0; right: 0; bottom: 0; width: min(380px, 100%); background: var(--panel); border-left: 1px solid var(--border); z-index: 5; display: flex; flex-direction: column; box-shadow: -12px 0 32px rgba(41, 33, 31, .14); }
.thread-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; border-bottom: 1px solid var(--border); font-size: 13px; }
.thread-body { flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.thread-msg { display: flex; gap: 7px; align-items: flex-start; }
.thread-bubble { background: var(--panel-2); border: 1px solid var(--border); border-radius: 9px; padding: 7px 9px; font-size: 12.5px; line-height: 1.4; max-width: calc(100% - 34px); }
.thread-compose { display: flex; gap: 6px; align-items: flex-end; padding: 10px; border-top: 1px solid var(--border); }
.thread-compose textarea { flex: 1; min-height: 36px; max-height: 120px; border: 1px solid var(--border); border-radius: 8px; padding: 7px 8px; background: var(--panel); font-size: 12.5px; resize: none; outline: none; }

/* ---------- CRM ---------- */

.crm-page { display: flex; flex-direction: column; height: 100%; min-height: 0; padding: 16px 18px; gap: 12px; }
.crm-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.crm-head h1 { font-size: 22px; letter-spacing: -.01em; }
.crm-body { flex: 1; min-height: 0; overflow: auto; }
.crm-board { display: flex; gap: 12px; align-items: flex-start; min-height: 100%; padding-bottom: 20px; }
.crm-col { width: 280px; flex: none; background: var(--col-bg); border-radius: 12px; display: flex; flex-direction: column; max-height: calc(100dvh - 200px); }
.crm-col.drag-target { outline: 2px dashed color-mix(in srgb, var(--accent) 60%, transparent); }
.crm-col-head { display: flex; align-items: center; gap: 7px; padding: 10px 12px 6px; }
.crm-col-head h3 { font-size: 13px; font-weight: 700; }
.crm-col-head .count { color: var(--muted); font-size: 12px; font-weight: 600; }
.crm-sum { margin-left: auto; font-size: 10.5px; color: var(--muted); font-weight: 600; }
.crm-col-body { padding: 4px 8px 10px; display: flex; flex-direction: column; gap: 7px; overflow-y: auto; min-height: 50px; }
.deal-card { background: var(--panel); border: 1px solid var(--border); border-left: 3px solid var(--stage-color, var(--blue)); border-radius: 9px; padding: 9px 10px; cursor: grab; box-shadow: var(--shadow-sm); }
.deal-card:hover { border-color: var(--border-strong); }
.deal-card.dragging { opacity: .45; }
.deal-title { font-size: 13px; font-weight: 600; line-height: 1.3; }
.deal-company { font-size: 11px; color: var(--muted); margin-top: 2px; }
.deal-foot { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-top: 7px; }
.deal-amount { font-size: 12px; font-weight: 700; }
.deal-date { display: flex; align-items: center; gap: 4px; font-size: 10.5px; color: var(--muted); margin-top: 4px; }
.deal-date .ic { width: 11px; height: 11px; }
.crm-simple { background: var(--panel); border: 1px solid var(--border); border-radius: 10px; overflow: auto; }
.crm-simple table.grid { font-size: 12.5px; }
.crm-deal-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 16px; }
.deal-item { display: flex; gap: 4px; align-items: center; margin-bottom: 4px; }
.deal-item input { height: 30px; border: 1px solid var(--border); border-radius: 6px; padding: 0 6px; background: var(--panel); font-size: 12px; outline: none; }
.deal-item .di-name { flex: 1; min-width: 0; }
.deal-item .di-qty { width: 58px; }
.deal-item .di-price { width: 100px; }
.invoice-row { display: flex; align-items: center; gap: 8px; padding: 5px 0; border-bottom: 1px solid var(--border); font-size: 12px; }
.invoice-row b { min-width: 105px; }
.invoice-row > span:nth-child(2) { flex: 1; color: var(--muted); }
.invoice-status { font-size: 10.5px; padding: 1px 6px; border-radius: 5px; background: var(--hover); color: var(--muted); }
.invoice-status.status-paid { background: var(--success-bg, #e7f5ec); color: var(--green); }
.invoice-status.status-sent { background: var(--warning-bg, #fff3d6); color: var(--yellow); }
.crm-activities { border-left: 1px solid var(--border); padding-left: 14px; }
.crm-act-list { max-height: 300px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; }
.crm-act { display: flex; gap: 7px; align-items: flex-start; font-size: 12px; }
.crm-act.done .crm-act-text { color: var(--muted); text-decoration: line-through; }
.act-check { width: 18px; height: 18px; border: 1px solid var(--border-strong); border-radius: 4px; background: var(--panel); display: grid; place-items: center; flex: none; margin-top: 1px; }
.act-check .ic { width: 11px; height: 11px; }
.crm-act-text { color: var(--muted); }
.crm-act time { margin-left: auto; font-size: 10px; color: var(--muted-2); white-space: nowrap; }
.crm-act-add { display: flex; gap: 4px; }
.crm-act-add input { flex: 1; height: 30px; border: 1px solid var(--border); border-radius: 6px; padding: 0 7px; background: var(--panel); font-size: 12px; outline: none; }
.crm-report .kpi-value { font-size: 22px; }
.audit-row { display: grid; grid-template-columns: 128px 170px minmax(0, 1fr); gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--border); font-size: 12px; align-items: baseline; }
.audit-row time { color: var(--muted-2); font-size: 11px; }
.audit-row span { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.timer-chip { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 9px; border-radius: 8px; background: var(--accent-weak); color: var(--accent-text); font-size: 11.5px; font-weight: 600; cursor: pointer; }
.timer-chip .ic { width: 14px; height: 14px; }
.timer-chip b { font-family: var(--mono); font-size: 11px; }
.timer-active { display: flex; align-items: center; gap: 6px; font-size: 12px; background: var(--accent-weak); border-radius: 8px; padding: 6px 8px; color: var(--accent-text); }
.timer-active .ic { width: 14px; height: 14px; }
.time-list { display: flex; flex-direction: column; gap: 3px; margin-top: 6px; }
.time-row { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--muted); }
.time-row b { color: var(--text); }
.time-row .x { margin-left: auto; border: 0; background: none; color: var(--muted-2); }
.time-add { display: flex; gap: 4px; margin-top: 6px; }
.time-add input { width: 60px; height: 28px; border: 1px solid var(--border); border-radius: 6px; padding: 0 6px; background: var(--panel); font-size: 12px; outline: none; }
.time-add input#time-comment { flex: 1; width: auto; }

/* ---------- адаптив ---------- */

.only-mobile { display: none; }
@media (max-width: 1180px) {
  .tp-body { grid-template-columns: minmax(0, 1fr) 232px; }
  .g-name { width: 240px; }
}
@media (max-width: 980px) {
  .auth { grid-template-columns: 1fr; }
  .auth-side { display: none; }
  .topbar-search { width: 220px; }
  .settings-grid { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; inset: 0 auto 0 0; width: 264px; z-index: 70;
    transform: translateX(-102%); transition: transform .2s;
    box-shadow: var(--shadow-lg);
  }
  .sidebar.open { transform: none; }
  .only-mobile { display: inline-grid; }
  .topbar-search { display: none; }
  .spacer-mobile { display: none; }
  .task-panel { width: 100%; }
  .tp-body { grid-template-columns: 1fr; }
  .tp-side { border-left: 0; border-top: 1px solid var(--border); }
  .col { width: 84vw; }
  .page { padding: 14px; }
  .g-name { width: 180px; }
  .board-tabs { max-width: 50vw; }

  .viewbar { flex-wrap: wrap; row-gap: 6px; }
  .board-tabs { width: 100%; max-width: 100%; order: -1; }
  .vsep { display: none; }
  .role-badge { display: none; }
  .summary-col { width: 84vw; }

  .chats-page { grid-template-columns: 1fr; grid-template-rows: 34% 66%; }
  .chat-side { border-right: 0; border-bottom: 1px solid var(--border); }
  .chat-msgs { padding: 12px; }
  .msg-bubble-wrap { max-width: 85%; }

  .crm-col { width: 84vw; }
  .crm-deal-grid { grid-template-columns: 1fr; }
  .crm-activities { border-left: 0; border-top: 1px solid var(--border); padding-left: 0; padding-top: 10px; }
}
