:root {
  --bg: #0f1419;
  --surface: #1a2332;
  --surface2: #243044;
  --border: #2d3f56;
  --text: #e8edf4;
  --muted: #8b9cb3;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --won: #22c55e;
  --lost: #ef4444;
  --hold: #f59e0b;
  /* ???????? ????????: ???? ??????? ???? ?????, ??? ????? ???????? */
  --drawer-shell: #15202c;
  --drawer-panel: #1a2534;
  --drawer-panel-soft: #182230;
  --font-sans: "Manrope", "Segoe UI", sans-serif;
  --board-pad: 12px;
  --col-gap: 8px;
  /* ~8 ??????? ? ?????? ?????? (??????? 1366?1440+) */
  --col-w: clamp(152px, calc((100vw - 2 * var(--board-pad) - 7 * var(--col-gap)) / 8), 178px);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html {
  height: 100%;
  overflow: hidden;
}

body {
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 400;
  letter-spacing: -0.01em;
  background: var(--bg);
  color: var(--text);
  height: 100%;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

.header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 12px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  z-index: 20;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  min-width: 0;
}
.brand-link {
  display: flex;
  align-items: center;
  text-decoration: none;
  line-height: 0;
}
.brand-logo {
  height: 34px;
  width: auto;
  display: block;
  object-fit: contain;
}
.brand .subtitle {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 650;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding-top: 2px;
}
.brand h1 { font-size: 0.95rem; font-weight: 650; letter-spacing: -0.02em; }
.subtitle { color: var(--muted); font-size: 0.65rem; display: block; margin-top: 1px; }
.muted { color: var(--muted); font-size: 0.9rem; }
.list-view { padding: 24px; max-width: 900px; }
.list-toolbar { display: flex; gap: 8px; margin-bottom: 16px; }
.list-toolbar input { flex: 1; padding: 8px 12px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface2); color: var(--text); }
.list-row { padding: 12px 16px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; margin-bottom: 8px; cursor: pointer; }
.list-row:hover { border-color: var(--accent); }
.mod-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.chat-layout { display: grid; grid-template-columns: 280px 1fr; height: 100%; min-height: 0; }
.chat-sidebar { border-right: 1px solid var(--border); padding: 16px; background: var(--surface); }
.chat-sidebar select { width: 100%; margin: 8px 0; padding: 8px; background: var(--surface2); color: var(--text); border: 1px solid var(--border); border-radius: 6px; }
.thread-btn { display: block; width: 100%; text-align: left; margin-top: 6px; padding: 8px; background: var(--surface2); border: 1px solid var(--border); color: var(--text); border-radius: 6px; cursor: pointer; }
.chat-main { display: flex; flex-direction: column; min-height: 0; }
.chat-messages { flex: 1; overflow: auto; padding: 16px; }
.chat-msg { margin-bottom: 12px; padding: 8px 12px; background: var(--surface); border-radius: 8px; }
.chat-msg time { display: block; color: var(--muted); font-size: 0.75rem; }
.chat-form { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--border); }
.chat-form input { flex: 1; padding: 10px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface2); color: var(--text); }
.comments textarea { width: 100%; margin: 8px 0; padding: 8px; background: var(--surface2); color: var(--text); border: 1px solid var(--border); border-radius: 6px; }

.tabs { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; min-width: 0; align-items: center; }

.tab {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 4px 9px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 500;
}

.tab.active, .tab:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

.nav-dropdown {
  position: relative;
  flex-shrink: 0;
}
.nav-dropdown-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 7.5rem;
}
.nav-caret {
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid currentColor;
  opacity: 0.75;
  margin-top: 1px;
}
.nav-dropdown.is-open .nav-caret {
  transform: rotate(180deg);
}
.nav-dropdown-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  min-width: 100%;
  width: max-content;
  max-width: 280px;
  padding: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.4);
  z-index: 40;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.nav-dropdown-menu.hidden { display: none; }
.nav-dropdown-item {
  border: 0;
  background: transparent;
  color: var(--text);
  text-align: left;
  padding: 7px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 500;
  white-space: nowrap;
}
.nav-dropdown-item:hover {
  background: rgba(59, 130, 246, 0.15);
}
.nav-dropdown-item.is-active {
  background: rgba(59, 130, 246, 0.22);
  color: #fff;
}

.actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.actions button {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 4px 9px;
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 500;
}
.search {
  min-width: 220px;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text);
}
.user-chip {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 4px 10px;
  border-radius: 999px;
  cursor: pointer;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: inherit;
  font-size: 0.72rem;
}
.user-chip:hover { border-color: var(--accent); }
.bx-filter-presets-hint {
  font-size: 0.65rem;
  color: var(--muted);
  padding: 0 6px 4px;
  line-height: 1.3;
}
.profile-view { max-width: 820px; }
.profile-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 18px;
  margin-bottom: 16px;
}
.profile-card h3 { margin-bottom: 6px; }
.profile-card h4 { margin: 12px 0 8px; font-size: 0.9rem; color: var(--muted); }
.profile-card .field input {
  width: 100%;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text);
}
.profile-preset-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
}
.profile-preset-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}
.profile-preset-actions button {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 6px;
  padding: 4px 8px;
  cursor: pointer;
  font-size: 0.75rem;
}

.board-stats { color: var(--muted); font-size: 0.7rem; max-width: 180px; }

/* Bitrix-like main-ui-filter */
.filter-bar {
  position: relative;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 6px 12px 8px;
  z-index: 18;
  flex-shrink: 0;
  font-family: var(--font-sans);
}
.filter-bar.hidden { display: none; }
.filter-bar-row {
  display: flex;
  align-items: flex-start;
  gap: var(--col-gap);
  flex-wrap: wrap;
  /* ????????? ? ???????? ???????, ????? ?????? ?????? ??? 1-? ???????? */
  padding-left: 0;
}
/* ?????? ???????? ?????? ?????? ??????? ???????; ?????? ? ????? ?????? ?? ??? */
.filter-bar-row > .board-create-deal {
  width: var(--col-w);
  min-width: var(--col-w);
  max-width: var(--col-w);
  height: 32px;
  margin: 0;
  padding: 0 8px;
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px dashed color-mix(in srgb, var(--accent) 55%, var(--border));
  border-radius: 8px;
  background: color-mix(in srgb, var(--accent) 12%, var(--surface2));
  color: var(--text);
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 650;
  cursor: pointer;
  flex-shrink: 0;
}
.filter-bar-row > .board-create-deal:hover {
  background: color-mix(in srgb, var(--accent) 22%, var(--surface2));
  border-style: solid;
}
.filter-bar-row > .board-create-deal.hidden {
  display: none;
}
.view-mode-switch {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: var(--surface2);
  flex-shrink: 0;
}
.view-mode-btn {
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 6px 12px;
  font-family: inherit;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
}
.view-mode-btn.is-active {
  background: var(--accent);
  color: #fff;
}
.table-cols-wrap {
  position: relative;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 6px;
}
.table-cols-wrap.hidden { display: none; }
.table-cols-btn {
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text);
  border-radius: 8px;
  padding: 6px 12px;
  font-family: inherit;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
}
.table-cols-btn.is-active,
.table-cols-btn:hover {
  border-color: var(--accent);
}
.table-cols-popup {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  width: min(420px, 92vw);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.4);
  z-index: 35;
  padding: 10px;
}
.table-cols-popup.hidden { display: none; }
.table-cols-title {
  font-size: 0.7rem;
  font-weight: 650;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 4px;
}
.table-cols-hint {
  font-size: 0.68rem;
  color: var(--muted);
  margin-bottom: 8px;
  line-height: 1.35;
}
.table-cols-list {
  max-height: 340px;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 10px;
}
.table-cols-item {
  display: grid;
  grid-template-columns: 18px 1fr;
  gap: 8px;
  align-items: center;
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: var(--surface2);
  font-size: 0.75rem;
  cursor: grab;
}
.table-cols-item.is-off { opacity: 0.55; }
.table-cols-item.is-dragging {
  opacity: 0.7;
  border-color: var(--accent);
}
.table-cols-drag {
  color: var(--muted);
  font-size: 0.7rem;
  letter-spacing: -1px;
  user-select: none;
}
.table-cols-check {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  cursor: pointer;
}
.table-cols-check span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.table-cols-swatches {
  display: flex;
  gap: 3px;
  flex-wrap: wrap;
  justify-content: flex-end;
  max-width: 150px;
}
.col-swatch {
  width: 14px;
  height: 14px;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  padding: 0;
  cursor: pointer;
}
.col-swatch.is-none {
  background:
    linear-gradient(135deg, transparent 46%, #ef4444 46%, #ef4444 54%, transparent 54%),
    var(--surface);
  border-color: var(--border);
}
.col-swatch.is-active {
  outline: 2px solid #fff;
  outline-offset: 1px;
  box-shadow: 0 0 0 1px var(--accent);
}
.table-cols-actions {
  display: flex;
  gap: 6px;
  align-items: center;
}

.bx-filter-search {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  width: auto;
  max-width: min(380px, 100%);
  min-height: 32px;
  padding: 2px 4px 2px 6px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface2);
  flex-wrap: wrap;
  vertical-align: top;
}
.bx-filter-search.is-open {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}
.bx-filter-squares {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
  max-width: 100%;
}
.bx-filter-square {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: 160px;
  padding: 2px 6px;
  border-radius: 6px;
  background: rgba(59, 130, 246, 0.16);
  border: 1px solid rgba(59, 130, 246, 0.35);
  color: var(--text);
  font-size: 0.68rem;
  line-height: 1.2;
  font-family: inherit;
}
.bx-filter-square.is-preset {
  background: rgba(36, 48, 68, 0.95);
  border-color: var(--border);
}
.bx-filter-square-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.bx-filter-square-del {
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.9rem;
  line-height: 1;
  padding: 0 1px;
  font-family: inherit;
}
.bx-filter-square-del:hover { color: var(--text); }
.bx-filter-input {
  flex: 1 1 96px;
  width: 96px;
  min-width: 72px;
  max-width: 140px;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--text);
  font-family: inherit;
  font-size: 0.75rem;
  padding: 4px 2px;
}
.bx-filter-icons {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}
.bx-filter-icon-btn,
.bx-filter-funnel {
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  width: 26px;
  height: 26px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  font-family: inherit;
}
.bx-filter-icon-btn:hover,
.bx-filter-funnel:hover,
.bx-filter-funnel.is-active {
  background: rgba(59, 130, 246, 0.15);
  color: var(--text);
}
.bx-filter-funnel-ico {
  width: 12px;
  height: 12px;
  background:
    linear-gradient(currentColor, currentColor) center top / 12px 2px no-repeat,
    linear-gradient(currentColor, currentColor) center / 8px 2px no-repeat,
    linear-gradient(currentColor, currentColor) center bottom / 5px 2px no-repeat;
}
.bx-filter-counter {
  position: absolute;
  top: 0;
  right: 0;
  min-width: 14px;
  height: 14px;
  padding: 0 3px;
  border-radius: 999px;
  background: #e11d48;
  color: #fff;
  font-size: 0.58rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.bx-filter-counter.hidden { display: none; }

.bx-filter-popup {
  position: absolute;
  left: calc(12px + var(--col-w) + 10px);
  right: auto;
  top: calc(100% - 2px);
  width: min(680px, calc(100vw - 24px));
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.45);
  overflow: hidden;
  z-index: 30;
  font-family: var(--font-sans);
  font-size: 0.78rem;
}
.bx-filter-popup.hidden { display: none; }
.bx-filter-popup-body {
  display: grid;
  grid-template-columns: 180px 1fr;
  min-height: 260px;
  max-height: min(70vh, 480px);
}
.bx-filter-presets {
  border-right: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.12);
  padding: 10px 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow: auto;
}
.bx-filter-presets-title {
  font-size: 0.65rem;
  font-weight: 650;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0 6px;
}
.bx-filter-preset-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.bx-filter-preset-item {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  color: var(--text);
  padding: 6px 8px;
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.72rem;
  font-weight: 500;
}
.bx-filter-preset-item:hover { background: rgba(59, 130, 246, 0.12); }
.bx-filter-preset-item.is-active {
  background: rgba(59, 130, 246, 0.22);
  font-weight: 600;
}
.bx-filter-preset-item .star {
  color: var(--hold);
  font-size: 0.7rem;
}
.bx-filter-link {
  border: 0;
  background: transparent;
  color: var(--accent);
  cursor: pointer;
  text-align: left;
  padding: 4px 8px;
  font-family: inherit;
  font-size: 0.72rem;
}
.bx-filter-date-pair {
  display: flex;
  align-items: center;
  gap: 6px;
}
.bx-filter-date-pair input { width: auto; flex: 1; }
.bx-filter-popup-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  padding: 8px 10px;
  border-top: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.1);
}
.bx-btn {
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text);
  border-radius: 6px;
  padding: 5px 10px;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.72rem;
  font-weight: 500;
  transition:
    transform 0.12s ease,
    box-shadow 0.12s ease,
    background 0.15s ease,
    border-color 0.15s ease,
    opacity 0.15s ease;
}
.bx-btn:active:not(:disabled) {
  transform: scale(0.94);
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.28);
}
.bx-btn:disabled {
  opacity: 0.65;
  cursor: wait;
}
.bx-btn.is-busy {
  transform: scale(0.97);
  opacity: 0.85;
}
.bx-btn.is-saved {
  background: #15803d !important;
  border-color: #166534 !important;
  color: #fff !important;
  transform: scale(1);
}
.bx-btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.bx-btn-primary:active:not(:disabled) {
  background: color-mix(in srgb, var(--accent) 82%, #000);
}
.bx-btn-success {
  background: #16a34a;
  border-color: #15803d;
  color: #fff;
}
.bx-btn-success:hover {
  background: #15803d;
}
.bx-btn-warn {
  background: #eab308;
  border-color: #ca8a04;
  color: #1c1917;
}
.bx-btn-warn:hover {
  background: #ca8a04;
}
.bx-btn-link {
  border-color: transparent;
  background: transparent;
  color: var(--muted);
}
.bx-btn-link:hover { color: var(--text); }

@media (max-width: 800px) {
  .bx-filter-popup-body { grid-template-columns: 1fr; }
  .bx-filter-presets { border-right: 0; border-bottom: 1px solid var(--border); max-height: 160px; }
  .bx-filter-field-row { grid-template-columns: 1fr 28px; }
  .bx-filter-field-label { grid-column: 1 / -1; padding-top: 0; }
}

.column-body {
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  min-height: 0;
  max-height: none;
  overflow-y: auto;
  /* prevent browser scroll anchoring from cancelling gap animation in long columns */
  overflow-anchor: none;
  transition: background 0.35s ease, outline-color 0.35s ease;
}
.column-body.drag-over {
  outline: 2px solid rgba(59, 130, 246, 0.4);
  outline-offset: -2px;
  background: rgba(59, 130, 246, 0.07);
}
.column-empty {
  color: var(--muted);
  font-size: 0.65rem;
  padding: 12px 4px;
  text-align: center;
  line-height: 1.3;
  transition: opacity 0.3s ease;
}

.card {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px;
  padding-bottom: 26px;
  cursor: grab;
  touch-action: none;
  user-select: none;
  position: relative;
  transition:
    transform 0.38s cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 0.35s ease,
    opacity 0.3s ease,
    border-color 0.25s ease;
}
.card:active { cursor: grabbing; }
.card:hover:not(.drag-source):not(.is-shifting) {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
}
.card.drag-source {
  /* fully out of layout ? only the placeholder opens the gap */
  display: none !important;
}
.card.is-shifting {
  will-change: transform;
  z-index: 2;
  pointer-events: none;
}
.card-placeholder {
  flex-shrink: 0;
  height: var(--ph-height, 88px);
  border-radius: 12px;
  border: 2px dashed rgba(59, 130, 246, 0.55);
  background: linear-gradient(180deg, rgba(59, 130, 246, 0.18), rgba(59, 130, 246, 0.06));
  box-shadow: inset 0 0 18px rgba(59, 130, 246, 0.12);
  pointer-events: none;
  box-sizing: border-box;
}
.card.drag-ghost {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 1000;
  margin: 0;
  pointer-events: none;
  opacity: 0.96;
  box-shadow: 0 22px 48px rgba(0, 0, 0, 0.48);
  border-color: var(--accent);
  will-change: transform;
  transition: none;
}
.card.drag-ghost.settling {
  transition:
    transform 0.22s cubic-bezier(0.22, 0.61, 0.36, 1),
    box-shadow 0.22s ease;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.24);
}
.card.drag-ghost.settling.is-impact {
  transition:
    transform 0.12s cubic-bezier(0.22, 0.61, 0.36, 1),
    box-shadow 0.12s ease;
  box-shadow: 0 5px 12px rgba(0, 0, 0, 0.2);
}
.card.card-land {
  transform-origin: 50% 100%;
  animation: cardStoneDrop 0.28s cubic-bezier(0.22, 0.61, 0.36, 1) both;
  z-index: 4;
  pointer-events: none;
}
@keyframes cardStoneDrop {
  0% {
    transform: translate3d(0, -2px, 0) scale(1.005, 0.995);
  }
  55% {
    transform: translate3d(0, 0, 0) scale(1.01, 0.985);
  }
  100% {
    transform: translate3d(0, 0, 0) scale(1, 1);
  }
}
@keyframes cardLand {
  0% { transform: scale(0.985); }
  100% { transform: scale(1); }
}

.card-line { width: 100%; margin-bottom: 2px; }
.card-line.strong { color: var(--text); font-weight: 600; }
.card-line.muted { color: var(--muted); }

.card-stage-days {
  position: absolute;
  right: 5px;
  bottom: 5px;
  min-width: 22px;
  height: 20px;
  padding: 0 5px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 1px;
  font-size: 0.58rem;
  font-weight: 600;
  line-height: 1;
  color: var(--text);
  background: rgba(15, 20, 25, 0.72);
  border: 1px solid rgba(139, 156, 179, 0.35);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
  pointer-events: none;
  z-index: 1;
}
.card-stage-days .d {
  font-weight: 500;
  opacity: 0.85;
  font-size: 0.52rem;
}
.card-stage-days.warn {
  border-color: rgba(245, 158, 11, 0.55);
  color: #fbbf24;
}
.card-stage-days.alert {
  border-color: rgba(239, 68, 68, 0.5);
  color: #f87171;
}
.card-stage-days.is-deadline.is-ok {
  color: #86efac;
  border-color: rgba(34, 197, 94, 0.55);
  background: rgba(20, 83, 45, 0.45);
}
.card-stage-days.is-deadline.is-warn {
  color: #fbbf24;
  border-color: rgba(245, 158, 11, 0.6);
  background: rgba(120, 53, 15, 0.45);
}
.card-stage-days.is-deadline.is-alert {
  color: #fca5a5;
  border-color: rgba(239, 68, 68, 0.55);
  background: rgba(127, 29, 29, 0.55);
}
.card-stage-days.is-frozen {
  opacity: 0.92;
  filter: saturate(0.85);
  box-shadow: none;
}

.drawer { width: min(520px, 100vw); }
.drawer .field input,
.drawer .field select,
.drawer .field textarea {
  width: 100%;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text);
  font: inherit;
}
.primary-btn {
  margin-top: 8px;
  width: 100%;
  padding: 10px;
  background: var(--accent);
  border: none;
  border-radius: 8px;
  color: #fff;
  cursor: pointer;
  font-size: 1rem;
}

/* Thin elegant scrollbars */
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(139, 156, 179, 0.35) transparent;
}
*::-webkit-scrollbar {
  width: 3px;
  height: 3px;
}
*::-webkit-scrollbar-track {
  background: transparent;
}
*::-webkit-scrollbar-thumb {
  background: rgba(139, 156, 179, 0.28);
  border-radius: 999px;
}
*::-webkit-scrollbar-thumb:hover {
  background: rgba(139, 156, 179, 0.5);
}
.column-body,
.drawer,
.chat-messages,
.bx-filter-fields,
.bx-filter-presets,
.bx-filter-popup-body {
  scrollbar-width: thin;
  scrollbar-color: rgba(139, 156, 179, 0.35) transparent;
}

.bx-filter-fields-wrap {
  padding: 10px 12px;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.bx-filter-fields {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 0;
  overflow: visible;
}
.bx-filter-field-row {
  display: grid;
  grid-template-columns: 110px 1fr 24px;
  gap: 6px;
  align-items: start;
}
.bx-filter-field-label {
  font-size: 0.68rem;
  color: var(--muted);
  padding-top: 6px;
  font-weight: 500;
}
.bx-filter-field-control {
  min-width: 0;
}
.bx-filter-field-control select,
.bx-filter-field-control .bx-filter-text,
.bx-filter-date-pair input {
  width: 100%;
  padding: 5px 8px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text);
  font-family: inherit;
  font-size: 0.72rem;
}
.bx-filter-field-control select[multiple] { min-height: 72px; }

/* Date fields: calendar opens on click anywhere in the control */
input[type='date'],
input[type='datetime-local'] {
  position: relative;
  cursor: pointer;
}
input[type='date']::-webkit-calendar-picker-indicator,
input[type='datetime-local']::-webkit-calendar-picker-indicator {
  position: absolute;
  inset: 0;
  width: auto;
  height: auto;
  color: transparent;
  background: transparent;
  cursor: pointer;
}
.bx-filter-text {
  font-size: 0.72rem;
}
.bx-filter-field-remove {
  width: 24px;
  height: 24px;
  margin-top: 2px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  font-family: inherit;
}
.bx-filter-field-remove:hover {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
}
.bx-filter-inline-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text);
  font-size: 0.72rem;
  padding-top: 4px;
}
.bx-filter-add-wrap {
  padding-top: 2px;
}
.bx-filter-add-dd {
  position: relative;
  display: inline-block;
  max-width: 240px;
  width: 100%;
}
.bx-filter-add {
  width: 100%;
  max-width: 240px;
  padding: 5px 8px;
  border-radius: 6px;
  border: 1px dashed rgba(139, 156, 179, 0.45);
  background: var(--surface2);
  color: var(--accent);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.72rem;
  text-align: left;
}
.bx-filter-add:disabled {
  opacity: 0.45;
  cursor: default;
}
.bx-filter-add-menu {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  z-index: 80;
  max-height: 220px;
  overflow-y: auto;
  padding: 4px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface2);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.4);
}
.bx-filter-add-menu.hidden {
  display: none;
}
.bx-filter-add-item {
  display: block;
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--text);
  text-align: left;
  padding: 7px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.72rem;
}
.bx-filter-add-item:hover {
  background: color-mix(in srgb, var(--accent) 22%, transparent);
  color: var(--text);
}
.bx-filter-add-empty {
  padding: 8px 10px;
  color: var(--muted);
  font-size: 0.7rem;
}

.board-viewport {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.board {
  display: flex;
  gap: var(--col-gap);
  padding: var(--board-pad);
  overflow-x: auto;
  overflow-y: hidden;
  height: 100%;
  min-height: 0;
  align-items: stretch;
  scroll-behavior: auto;
  scrollbar-width: none; /* horizontal via edge orbs */
  -ms-overflow-style: none;
}
.board-viewport.is-list .board,
.board-viewport.is-chat .board {
  display: block;
  overflow-x: hidden;
  overflow-y: auto;
  height: 100%;
}
.board::-webkit-scrollbar {
  display: none;
  height: 0;
  width: 0;
}

/* Card open: freeze kanban / table horizontal scroll (edge-orbs + overflow). */
body.has-drawer-open .board,
body.has-drawer-stack .board,
body.has-drawer-open .funnel-table-scroll,
body.has-drawer-stack .funnel-table-scroll,
body.has-drawer-open .bx-auto-board,
body.has-drawer-stack .bx-auto-board {
  overflow-x: hidden !important;
}
body.has-drawer-open .board-edge,
body.has-drawer-stack .board-edge {
  display: none !important;
}

/* Bitrix-like arc success / fail drop zones while dragging */
.drag-outcome-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1100;
  display: grid;
  grid-template-columns: 1fr 1fr;
  height: 6.5vh;
  min-height: 42px;
  max-height: 58px;
  gap: 6px;
  padding: 0;
  box-sizing: border-box;
  pointer-events: none;
  transform: translate3d(0, 110%, 0);
  opacity: 0;
  transition:
    transform 0.42s cubic-bezier(0.16, 0.84, 0.22, 1),
    opacity 0.28s ease;
}
.drag-outcome-bar.is-visible {
  transform: translate3d(0, 0, 0);
  opacity: 1;
  pointer-events: auto;
}
.drag-outcome {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  min-height: 0;
  padding: 0 16px 6px;
  cursor: default;
  user-select: none;
  overflow: visible;
  background: transparent;
  border: none;
  border-radius: 0;
  box-shadow: none;
  transition: filter 0.2s ease;
}
.drag-outcome::before {
  content: "";
  position: absolute;
  /* ?????? ?? ??? ?????? ? ?????? ????? ?????????????? */
  left: -6%;
  right: -6%;
  top: -55%;
  bottom: -80%;
  z-index: 0;
  pointer-events: none;
  border-radius: 50% 50% 0 0 / 100% 100% 0 0;
  filter: blur(28px);
  opacity: 0.92;
  transition:
    opacity 0.2s ease,
    filter 0.2s ease,
    transform 0.2s cubic-bezier(0.22, 0.61, 0.36, 1);
}
.drag-outcome.is-empty {
  pointer-events: none;
}
.drag-outcome.is-empty::before {
  display: none;
}
.drag-outcome.is-success::before {
  background: radial-gradient(
    ellipse 92% 120% at 50% 100%,
    color-mix(in srgb, #16a34a 78%, transparent) 0%,
    color-mix(in srgb, #22c55e 42%, transparent) 38%,
    color-mix(in srgb, #16a34a 12%, transparent) 62%,
    transparent 78%
  );
}
.drag-outcome.is-fail::before {
  background: radial-gradient(
    ellipse 92% 120% at 50% 100%,
    color-mix(in srgb, #dc2626 78%, transparent) 0%,
    color-mix(in srgb, #ef4444 42%, transparent) 38%,
    color-mix(in srgb, #dc2626 12%, transparent) 62%,
    transparent 78%
  );
}
.drag-outcome.is-success.is-hot::before,
.drag-outcome.is-fail.is-hot::before {
  opacity: 1;
  filter: blur(22px) brightness(1.12);
  transform: scaleY(1.08);
}
.drag-outcome-label {
  pointer-events: none;
  position: relative;
  z-index: 1;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 650;
  letter-spacing: 0.03em;
  color: #fff;
  text-shadow: 0 1px 10px rgba(0, 0, 0, 0.45);
}

.board-edge {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 72px;
  z-index: 8;
  pointer-events: none;
  display: flex;
  align-items: center;
  opacity: 0;
  transition: opacity 0.35s ease;
}
.board-edge-left {
  left: 0;
  justify-content: flex-start;
  padding-left: 10px;
  background: linear-gradient(90deg, rgba(15, 20, 25, 0.55), transparent);
}
.board-edge-right {
  right: 0;
  justify-content: flex-end;
  padding-right: 10px;
  background: linear-gradient(270deg, rgba(15, 20, 25, 0.55), transparent);
}
.board-edge.visible {
  opacity: 1;
}
.board-edge-orb {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(36, 48, 68, 0.88);
  border: 1px solid rgba(59, 130, 246, 0.45);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  color: var(--text);
  transform: scale(0.82);
  opacity: 0.85;
  transition:
    transform 0.35s cubic-bezier(0.22, 1, 0.36, 1),
    opacity 0.35s ease,
    box-shadow 0.35s ease;
}
.board-edge.visible .board-edge-orb {
  transform: scale(1);
  opacity: 1;
}
.board-edge.strong .board-edge-orb {
  transform: scale(1.06);
  box-shadow: 0 10px 28px rgba(59, 130, 246, 0.28);
  border-color: rgba(59, 130, 246, 0.7);
}
.board-edge-arrow {
  font-size: 1.35rem;
  line-height: 1;
  font-weight: 300;
  margin-top: -2px;
}
.board-viewport.is-list .board-edge,
.board-viewport.is-chat .board-edge {
  display: none;
}

.funnel-table-wrap {
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}
.table-excel-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
  flex-shrink: 0;
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  padding: 0 12px;
  min-height: 0;
  transform: translate3d(0, -10px, 0);
  pointer-events: none;
  transition:
    max-height 0.45s cubic-bezier(0.16, 0.84, 0.22, 1),
    opacity 0.38s cubic-bezier(0.16, 0.84, 0.22, 1),
    padding 0.45s cubic-bezier(0.16, 0.84, 0.22, 1),
    transform 0.45s cubic-bezier(0.16, 0.84, 0.22, 1);
}
.table-excel-bar.is-visible {
  max-height: 56px;
  opacity: 1;
  padding: 8px 12px 0;
  transform: translate3d(0, 0, 0);
  pointer-events: auto;
}
.table-excel-bar #tableSelCount {
  font-size: 0.75rem;
  font-weight: 650;
  color: var(--text);
  white-space: nowrap;
}
.table-bulk-stage select {
  min-width: 160px;
  max-width: 220px;
  padding: 6px 8px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 0.78rem;
}
.table-excel-hint {
  margin-left: auto;
  font-size: 0.68rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.bx-btn-danger {
  border-color: rgba(239, 68, 68, 0.45);
  color: #fecaca;
  background: rgba(239, 68, 68, 0.12);
}
.bx-btn-danger:hover {
  background: rgba(239, 68, 68, 0.22);
}
.bx-btn-restore {
  background: #ef4444;
  border-color: #dc2626;
  color: #fff;
}
.bx-btn-restore:hover {
  background: #dc2626;
}
.bx-btn-restore:active:not(:disabled) {
  background: #b91c1c;
  transform: scale(0.94);
}
.deal-card.is-task-completing {
  animation: taskCompleteOut 0.48s cubic-bezier(0.22, 1, 0.36, 1) forwards;
  pointer-events: none;
}
.deal-card.is-task-restoring {
  animation: taskRestoreIn 0.42s cubic-bezier(0.22, 1, 0.36, 1) both;
}
@keyframes taskCompleteOut {
  0% {
    opacity: 1;
    transform: translate3d(0, 0, 0) scale(1);
  }
  100% {
    opacity: 0.55;
    transform: translate3d(0, 4px, 0) scale(0.992);
  }
}
@keyframes taskRestoreIn {
  0% {
    opacity: 0.55;
    transform: translate3d(0, 6px, 0) scale(0.992);
  }
  100% {
    opacity: 1;
    transform: translate3d(0, 0, 0) scale(1);
  }
}
.deal-card.task-card-wide.is-task-soft-enter {
  animation: taskSoftEnter 0.28s ease both;
}
@keyframes taskSoftEnter {
  0% {
    opacity: 0.72;
  }
  100% {
    opacity: 1;
  }
}
.task-complete-banner {
  margin: 10px 0 0;
  padding: 10px 12px;
  border-radius: 8px;
  background: color-mix(in srgb, #16a34a 16%, var(--surface2));
  border: 1px solid color-mix(in srgb, #16a34a 40%, var(--border));
  color: #86efac;
  font-size: 0.78rem;
  font-weight: 600;
}
.funnel-table-scroll {
  flex: 1;
  min-height: 0;
  min-width: 0;
  overflow: auto;
  scroll-behavior: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.funnel-table-scroll::-webkit-scrollbar {
  display: none;
  height: 0;
  width: 0;
}
.funnel-table-frame {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: stretch;
  gap: 0;
  padding: 0 12px 16px;
  margin-top: 10px;
  overflow: hidden;
}
.funnel-table-pin-rail {
  flex: 0 0 auto;
  width: 64px;
  z-index: 6;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-right: 0;
  border-radius: 10px 0 0 10px;
  overflow: hidden;
  transform: translate3d(0, 0, 0);
  box-shadow: none;
  transition:
    box-shadow 0.32s cubic-bezier(0.16, 0.84, 0.22, 1),
    transform 0.32s cubic-bezier(0.16, 0.84, 0.22, 1);
}
.funnel-table-pin-rail.is-stuck {
  transform: translate3d(0, 0, 0);
  box-shadow: 12px 0 28px rgba(0, 0, 0, 0.45);
}
.funnel-table-pin-scroll {
  flex: 1;
  min-height: 0;
  overflow: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.funnel-table-pin-scroll::-webkit-scrollbar {
  display: none;
}
.funnel-table-frame .funnel-table-scroll {
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 0 10px 10px 0;
  background: var(--surface);
}
.funnel-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.75rem;
  background: var(--surface);
  border: 0;
  border-radius: 0;
  table-layout: fixed;
  margin-top: 0;
}
.funnel-table-pins {
  width: 64px;
  min-width: 64px;
}
/* ?????????? ?????? ? ???????? ??????? frame, ?? ? ????? */
.funnel-table thead {
  position: relative;
  z-index: 5;
}
.funnel-table thead tr {
  height: 36px;
}
.funnel-table th {
  position: sticky;
  top: 0;
  z-index: 5;
  height: 36px;
  max-height: 36px;
  box-sizing: border-box;
  /* ???????????? ??? ? ?????? ?? ???????????? ?????? ????? */
  background-color: var(--surface2);
  color: var(--muted);
  font-weight: 650;
  text-align: left;
  padding: 0 10px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  font-size: 0.68rem;
  line-height: 36px;
  vertical-align: middle;
  user-select: none;
  overflow: hidden;
  cursor: default;
  box-shadow: 0 1px 0 var(--border);
}
.funnel-table th .th-label {
  display: block;
  height: 36px;
  line-height: 36px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding-right: 8px;
  pointer-events: none;
}
.funnel-table th .th-head {
  display: flex;
  align-items: center;
  gap: 2px;
  min-width: 0;
  height: 36px;
  padding-right: 10px;
}
.funnel-table th .th-head .th-label {
  flex: 1;
  min-width: 0;
  padding-right: 0;
  height: 36px;
  line-height: 36px;
  pointer-events: none;
}
.th-sort-btn {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  padding: 0;
  margin: 0;
  cursor: pointer;
  border-radius: 4px;
}
.th-sort-btn:hover {
  color: var(--accent);
}
.funnel-table th.is-sorted .th-label {
  color: var(--accent);
  font-weight: 650;
}
.th-drag-handle {
  flex-shrink: 0;
  width: 18px;
  height: 22px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1;
  padding: 0;
  cursor: grab;
  letter-spacing: -1px;
}
.th-drag-handle:active {
  cursor: grabbing;
}
.th-drag-handle:hover {
  color: var(--text);
  background: rgba(59, 130, 246, 0.12);
}
.th-color-btn,
.column-color-btn {
  flex-shrink: 0;
  width: auto;
  height: auto;
  min-width: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  font-size: 0.68rem;
  line-height: 1;
  padding: 1px 2px;
  cursor: pointer;
  opacity: 0.75;
}
.th-color-btn:hover,
.column-color-btn:hover {
  border: 0;
  color: var(--text);
  background: transparent;
  opacity: 1;
}
.color-palette-pop {
  position: fixed;
  z-index: 1200;
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  width: 128px;
  padding: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.45);
}
.stage-color-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: middle;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.2);
}
.funnel-table th.has-tint {
  /* ???????????? mix ? ??? transparent overlay */
  background-color: color-mix(in srgb, var(--col-tint) 30%, var(--surface2));
  box-shadow: 0 1px 0 var(--border);
}
.funnel-table td.has-tint {
  background-color: color-mix(in srgb, var(--col-tint) 12%, var(--surface));
}
.funnel-table th.is-col-dragging {
  opacity: 0.35;
}
.funnel-table th.is-col-drop-target {
  box-shadow: inset 3px 0 0 var(--accent);
}
.funnel-table th.is-col-drop-end {
  box-shadow: inset -3px 0 0 var(--accent);
}
.table-col-ghost {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 1000;
  pointer-events: none;
  display: flex;
  align-items: center;
  padding: 0 10px;
  box-sizing: border-box;
  background: var(--surface2);
  border: 1px solid var(--accent);
  border-radius: 6px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
  font-size: 0.68rem;
  font-weight: 650;
  color: var(--muted);
  opacity: 0.96;
  will-change: transform;
}
.col-resize {
  position: absolute;
  top: 0;
  right: 0;
  width: 8px;
  height: 100%;
  cursor: col-resize;
  background: transparent;
  z-index: 2;
}
.col-resize:hover,
.col-resize:active {
  background: rgba(59, 130, 246, 0.55);
}
.funnel-table td {
  padding: 8px 10px;
  border-bottom: 1px solid rgba(45, 63, 86, 0.45);
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: middle;
}
.funnel-table td.is-strong {
  font-weight: 600;
}
.funnel-table td.is-editable {
  cursor: cell;
}
.funnel-table td.is-editable:hover {
  outline: 1px solid rgba(59, 130, 246, 0.35);
  outline-offset: -1px;
}
.funnel-table td.is-editing {
  padding: 2px 4px;
  overflow: visible;
}
.tbl-edit-input {
  width: 100%;
  box-sizing: border-box;
  height: 28px;
  border: 1px solid var(--accent);
  border-radius: 4px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  padding: 0 6px;
}
.tbl-pin {
  position: relative;
  z-index: 1;
  background-color: var(--surface);
  text-align: center !important;
  padding: 0 !important;
  width: 36px;
  min-width: 36px;
  max-width: 40px;
  border-right: 1px solid var(--border);
  box-shadow: none;
  vertical-align: middle;
}
.funnel-table th.tbl-pin {
  line-height: 36px;
  height: 36px;
  max-height: 36px;
}
thead .tbl-pin {
  position: sticky;
  top: 0;
  z-index: 3;
  background-color: var(--surface2);
}
.tbl-pin-edit {
  width: 28px;
  min-width: 28px;
  max-width: 28px;
  border-right: 0;
}
.funnel-table-row .tbl-pin {
  background-color: var(--surface);
}
.funnel-table-row.is-hovered .tbl-pin,
.funnel-table-row.is-hovered td {
  background-color: rgba(59, 130, 246, 0.06);
}
.funnel-table-row.is-selected .tbl-pin {
  background-color: color-mix(in srgb, #3b82f6 14%, var(--surface));
}
.tbl-open-btn {
  width: auto;
  height: auto;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 300;
  line-height: 1;
  cursor: pointer;
  padding: 0 2px;
  opacity: 0.55;
  vertical-align: middle;
}
.tbl-open-btn:hover {
  color: var(--accent);
  background: transparent;
  opacity: 1;
}
.tbl-row-check,
#tblSelectAll {
  appearance: none;
  -webkit-appearance: none;
  box-sizing: border-box;
  width: 11px;
  height: 11px;
  margin: 0;
  padding: 0;
  vertical-align: middle;
  cursor: pointer;
  border-radius: 2px;
  border: 1px solid color-mix(in srgb, var(--border) 80%, #6b7c94);
  background-color: color-mix(in srgb, var(--surface) 72%, #5a6b82);
}
.tbl-row-check:hover,
#tblSelectAll:hover {
  background-color: color-mix(in srgb, var(--surface) 55%, #6b7c94);
  border-color: color-mix(in srgb, var(--border) 50%, #8b9cb3);
}
.tbl-row-check:checked,
#tblSelectAll:checked {
  background-color: color-mix(in srgb, var(--accent) 45%, var(--surface2));
  border-color: color-mix(in srgb, var(--accent) 55%, var(--border));
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath fill='none' stroke='%23c5d0de' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' d='M2.5 6.2L5 8.7l4.5-5'/%3E%3C/svg%3E");
  background-size: 9px 9px;
  background-position: center;
  background-repeat: no-repeat;
}
.tbl-row-check:indeterminate,
#tblSelectAll:indeterminate {
  background-color: color-mix(in srgb, var(--accent) 30%, var(--surface2));
  border-color: color-mix(in srgb, var(--accent) 40%, var(--border));
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath stroke='%23c5d0de' stroke-width='2' stroke-linecap='round' d='M3 6h6'/%3E%3C/svg%3E");
  background-size: 9px 9px;
  background-position: center;
  background-repeat: no-repeat;
}
.tbl-row-check:disabled,
#tblSelectAll:disabled {
  opacity: 0.35;
  cursor: default;
}
.funnel-table-row {
  cursor: default;
}
.funnel-table-row:hover td:not(.tbl-pin),
.funnel-table-row.is-hovered td:not(.tbl-pin) {
  background-color: rgba(59, 130, 246, 0.06);
}
.funnel-table-row:hover td.has-tint,
.funnel-table-row.is-hovered td.has-tint {
  background-color: color-mix(in srgb, var(--col-tint) 14%, rgba(59, 130, 246, 0.05));
}
.funnel-table-row.is-selected td {
  background-color: rgba(59, 130, 246, 0.12);
}
.funnel-table-row.is-selected td.has-tint {
  background-color: color-mix(in srgb, var(--col-tint) 14%, rgba(59, 130, 246, 0.1));
}
.funnel-table-pins .funnel-table-row[data-id],
.funnel-table-data .funnel-table-row[data-id] {
  box-sizing: border-box;
}
.funnel-table-pins .funnel-table-row[data-id] > td,
.funnel-table-data .funnel-table-row[data-id] > td {
  height: inherit;
}
.funnel-table-empty {
  text-align: center;
  color: var(--muted);
  padding: 28px 12px !important;
  white-space: normal !important;
}

.column {
  width: var(--col-w);
  min-width: var(--col-w);
  max-width: var(--col-w);
  background: var(--surface);
  border-radius: 10px;
  border: 1px solid var(--border);
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  max-height: 100%;
  min-height: 0;
  align-self: stretch;
  overflow: hidden; /* ??????? ?????/????? ?? ??????? ?? ?????? */
}
.column.has-tint {
  border-color: color-mix(in srgb, var(--col-tint) 50%, var(--border));
  background: color-mix(in srgb, var(--col-tint) 18%, var(--surface));
}
.column.has-tint .column-sum,
.column.has-tint .column-header {
  background: color-mix(in srgb, var(--col-tint) 32%, var(--surface2));
}
.column.has-tint .column-body {
  background: color-mix(in srgb, var(--col-tint) 12%, transparent);
}

.column-sum {
  height: 28px;
  box-sizing: border-box;
  padding: 0 8px;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  line-height: 1;
}
.column-sum-value {
  display: inline-block;
  overflow: hidden;
  text-overflow: ellipsis;
}

.column-header {
  position: relative;
  height: 44px;
  box-sizing: border-box;
  padding: 4px 8px;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  font-size: 0.68rem;
  line-height: 1.2;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}
/* Tasks board: title on top (exactly 2 lines), actions below ? tight spacing */
.column-header.is-task-stack {
  height: auto;
  min-height: 0;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  gap: 2px;
  padding: 2px 8px 4px;
}
.column-header.is-task-stack .column-title {
  flex: 0 0 auto;
  width: 100%;
  height: 2.4em; /* ????? 2 ?????? ??? line-height 1.2 */
  min-height: 2.4em;
  max-height: 2.4em;
  line-height: 1.2;
  align-self: stretch;
  display: flex;
  align-items: center; /* ???????? ???????? ? ?? ?????? ?????? */
  overflow: hidden;
  cursor: grab;
  user-select: none;
  touch-action: none;
}
.column-header.is-task-stack .column-title-text {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  width: 100%;
  line-height: 1.2;
  max-height: 2.4em;
}
.column-header.is-task-stack .column-title.is-col-drag-handle:active {
  cursor: grabbing;
}
.column-header.is-task-stack .column-header-meta {
  width: 100%;
  margin-top: 0;
  align-self: stretch;
  justify-content: flex-start;
  flex-wrap: wrap;
}
.column-title {
  flex: 1;
  min-width: 0;
  height: 34px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  align-self: center;
}
.column-header-meta {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
  align-self: flex-start;
  margin-top: 1px;
}

.column-header .count {
  background: var(--surface2);
  padding: 1px 5px;
  border-radius: 999px;
  font-size: 0.62rem;
  font-weight: 600;
  color: var(--muted);
  flex-shrink: 0;
}
.column-color-btn {
  width: auto;
  height: auto;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 0.65rem;
  line-height: 1;
  padding: 1px 2px;
  cursor: pointer;
  opacity: 0.75;
}
.column-color-btn:hover {
  border: 0;
  color: var(--text);
  background: transparent;
  opacity: 1;
}

.card-title {
  font-size: 0.72rem;
  line-height: 1.3;
  margin-bottom: 4px;
  font-weight: 600;
  letter-spacing: -0.015em;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-total {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 2px;
  letter-spacing: -0.02em;
}
.card-client {
  font-size: 0.65rem;
  color: var(--muted);
  margin-bottom: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.card-date {
  font-size: 0.6rem;
  color: var(--muted);
  margin-bottom: 5px;
}
.card-fields {
  display: flex;
  flex-direction: column;
  gap: 4px;
  border-top: 1px solid var(--border);
  padding-top: 5px;
}
.card-field-label {
  font-size: 0.58rem;
  color: var(--muted);
  margin-bottom: 0;
  letter-spacing: 0.01em;
}
.card-field-value {
  font-size: 0.65rem;
  color: var(--text);
  line-height: 1.25;
  word-break: break-word;
}
.card-field-value.is-feed-comment {
  white-space: pre-wrap;
  line-height: 1.25;
  max-height: calc(1.25em * 10);
  overflow: hidden;
  word-break: break-word;
  position: relative;
}
.card-field-value.is-feed-comment::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1.1em;
  background: linear-gradient(transparent, var(--surface, #fff));
  pointer-events: none;
}

.card-meta {
  font-size: 0.75rem;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag {
  background: var(--bg);
  padding: 2px 6px;
  border-radius: 4px;
}

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: min(480px, 100vw);
  height: 100vh;
  background: var(--drawer-shell);
  border-left: 1px solid color-mix(in srgb, var(--border) 75%, #3d5168);
  padding: 0;
  overflow: visible;
  z-index: 40;
  box-shadow:
    -1px 0 0 color-mix(in srgb, #ffffff 4%, transparent),
    -16px 0 48px rgba(0, 0, 0, 0.45);
  display: flex;
  flex-direction: column;
  transform: translate3d(104%, 0, 0);
  visibility: hidden;
  pointer-events: none;
  transition:
    transform 0.48s cubic-bezier(0.16, 0.84, 0.22, 1),
    visibility 0s linear 0.48s,
    filter 0.48s cubic-bezier(0.16, 0.84, 0.22, 1);
  will-change: transform;
}
.drawer.is-deal {
  width: min(1120px, 98vw);
  background: var(--drawer-shell);
}
.drawer.is-open {
  transform: translate3d(0, 0, 0);
  visibility: visible;
  pointer-events: auto;
  transition:
    transform 0.48s cubic-bezier(0.16, 0.84, 0.22, 1),
    visibility 0s linear 0s,
    filter 0.48s cubic-bezier(0.16, 0.84, 0.22, 1);
}
/* Card under task: recessed, inert (clicks must not reach it) */
.drawer.is-open.is-stacked-under {
  transform: translate3d(-48px, 0, 0);
  z-index: 40;
  filter: brightness(0.88);
  pointer-events: none !important;
}
.drawer.is-stacked-under > .close {
  visibility: hidden;
  pointer-events: none !important;
  z-index: 1;
}
.drawer-stack-backdrop {
  position: fixed;
  inset: 0;
  z-index: 35; /* under main drawer (40), blocks board for any open CRM card */
  background: rgba(0, 0, 0, 0.32);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition:
    opacity 0.48s cubic-bezier(0.16, 0.84, 0.22, 1),
    visibility 0s linear 0.48s;
}
.drawer-stack-backdrop.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition:
    opacity 0.48s cubic-bezier(0.16, 0.84, 0.22, 1),
    visibility 0s linear 0s;
}
/* When task overlay is on top of a card ? sit above base drawer */
.drawer-stack-backdrop.is-open.is-over-stack {
  z-index: 55;
}
.drawer-overlay {
  z-index: 60;
}
.drawer-overlay.is-open {
  z-index: 60;
}
.drawer-overlay > .close {
  z-index: 62;
}
.drawer > .close {
  position: absolute;
  top: 14px;
  /* 2/3 outside, 1/3 on card */
  left: calc(-28px * 2 / 3);
  right: auto;
  z-index: 50;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1.5px solid #fff;
  background: #ef4444;
  color: #fff;
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1;
  display: grid;
  place-items: center;
  padding: 0;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.45);
  transition: transform 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}
.drawer > .close:hover {
  background: #dc2626;
  transform: scale(1.06);
  box-shadow: 0 6px 16px rgba(220, 38, 38, 0.55);
}
.drawer > .close:active {
  transform: scale(0.96);
}
#drawerContent,
#drawerOverlayContent {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-radius: 0;
}
.drawer:not(.is-deal) #drawerContent,
.drawer:not(.is-deal) #drawerOverlayContent {
  overflow-y: auto;
  padding: 24px;
}

.close {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 1.5rem;
  cursor: pointer;
}

.drawer h2 { font-size: 1.1rem; margin-bottom: 16px; padding-left: 8px; }

.field { margin-bottom: 12px; }
.field label { display: block; font-size: 0.75rem; color: var(--muted); margin-bottom: 4px; }
.field div { font-size: 0.9rem; }
.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 7px 10px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text);
  font-family: inherit;
  font-size: 0.8rem;
}

.history { margin-top: 24px; }
.history h3 { font-size: 0.9rem; margin-bottom: 12px; color: var(--muted); }

.history-item {
  border-left: 2px solid var(--accent);
  padding: 8px 0 8px 12px;
  margin-bottom: 8px;
  font-size: 0.8rem;
}

.history-item time { color: var(--muted); display: block; margin-top: 4px; }

.stage-select {
  width: 100%;
  margin-top: 16px;
  padding: 8px;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
}

.loading {
  padding: 40px;
  text-align: center;
  color: var(--muted);
}

/* ?? Bitrix-like deal card ?? */
.deal-card {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  background: var(--drawer-panel);
}
.deal-card-head {
  flex-shrink: 0;
  padding: 14px 18px 10px 18px;
  background: color-mix(in srgb, var(--drawer-panel) 70%, #243246);
  border-bottom: 1px solid color-mix(in srgb, var(--border) 85%, #3a4f66);
}
.deal-card-title {
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--text);
  font-family: inherit;
  font-size: 1.15rem;
  font-weight: 650;
  letter-spacing: -0.02em;
  padding: 0;
  margin-bottom: 8px;
  outline: none;
}
.deal-card-title:focus {
  box-shadow: 0 1px 0 var(--accent);
}
.deal-card-head-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  align-items: center;
}
.deal-card-amount {
  font-size: 0.95rem;
  font-weight: 700;
}
.deal-card-amount input {
  width: 140px;
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text);
  font-family: inherit;
  font-weight: 700;
}
.deal-card-sub {
  font-size: 0.72rem;
  color: var(--muted);
}
.deal-stage-bar {
  flex-shrink: 0;
  display: flex;
  gap: 2px;
  padding: 8px 12px;
  overflow-x: auto;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  scrollbar-width: thin;
}
.deal-stage-chip {
  flex: 0 0 auto;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--muted);
  border-radius: 999px;
  padding: 4px 10px;
  font-family: inherit;
  font-size: 0.65rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.deal-stage-chip.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.deal-stage-chip.is-won { border-color: rgba(34, 197, 94, 0.5); }
.deal-stage-chip.is-lost { border-color: rgba(239, 68, 68, 0.45); }
.deal-card-body {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(300px, 0.85fr);
  overflow: hidden;
}
.deal-card-main {
  overflow-y: auto;
  padding: 14px 16px 24px;
  border-right: 1px solid color-mix(in srgb, var(--border) 80%, transparent);
  background: var(--drawer-panel-soft);
}
.deal-section {
  background: color-mix(in srgb, var(--surface) 82%, #2a3a4f);
  border: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
  border-radius: 10px;
  margin-bottom: 12px;
  overflow: hidden;
}
.deal-section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 0.78rem;
  font-weight: 650;
  letter-spacing: -0.01em;
}
.deal-section-body {
  padding: 4px 0;
}
.deal-field-row {
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: 10px;
  padding: 8px 14px;
  border-bottom: 1px solid rgba(45, 63, 86, 0.45);
  align-items: start;
}
.deal-field-row:last-child { border-bottom: 0; }
.deal-field-label {
  font-size: 0.7rem;
  color: var(--muted);
  padding-top: 8px;
  line-height: 1.3;
}
.deal-field-control input,
.deal-field-control select,
.deal-field-control textarea {
  width: 100%;
  padding: 7px 9px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text);
  font-family: inherit;
  font-size: 0.78rem;
}
.deal-field-readonly {
  font-size: 0.78rem;
  color: var(--text);
  padding-top: 8px;
  line-height: 1.35;
}
.deal-field-readonly.is-muted {
  color: var(--muted);
  white-space: pre-wrap;
  word-break: break-word;
}
.feed-comment-clamp {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.feed-comment-clamp [data-feed-body].is-clamped {
  max-height: calc(1.35em * 10);
  overflow: hidden;
}
.feed-comment-clamp [data-feed-body].is-expanded {
  max-height: none;
  overflow: visible;
}
.feed-comment-toggle {
  align-self: flex-start;
  border: 0;
  background: transparent;
  color: var(--accent, #2f6fed);
  cursor: pointer;
  font: inherit;
  font-size: 0.72rem;
  padding: 0;
  text-decoration: underline;
}
.feed-comment-toggle.hidden {
  display: none;
}
.feed-comment-toggle:hover {
  opacity: 0.85;
}
.deal-card-actions {
  display: flex;
  gap: 8px;
  padding-top: 4px;
}
.deal-card-actions .primary-btn {
  width: auto;
  padding: 8px 16px;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
}

.deal-timeline {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: color-mix(in srgb, var(--drawer-panel) 88%, #243248);
}
.timeline-tabs {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px 0;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.timeline-tabs-list {
  display: flex;
  gap: 4px;
  min-width: 0;
  flex: 1;
  flex-wrap: wrap;
}
.timeline-add-task-btn {
  flex-shrink: 0;
  margin-bottom: 6px;
  padding: 4px 10px;
  font-size: 0.72rem;
  font-weight: 650;
  white-space: nowrap;
}
.timeline-tab {
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 8px 10px;
  border-radius: 8px 8px 0 0;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.72rem;
  font-weight: 600;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.timeline-tab.is-active {
  color: var(--text);
  border-bottom-color: var(--accent);
  background: rgba(59, 130, 246, 0.08);
}
.timeline-compose {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.timeline-compose textarea {
  width: 100%;
  min-height: 64px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text);
  font-family: inherit;
  font-size: 0.78rem;
  resize: vertical;
  margin-bottom: 8px;
}
.timeline-compose button {
  border: 0;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  padding: 6px 12px;
  font-family: inherit;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
}
.comment-compose-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: flex-end;
}
.comment-attach-btn {
  cursor: pointer;
  margin: 0;
  font-size: 0.72rem;
  font-weight: 600;
}
.comment-previews {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 8px;
}
.comment-previews.hidden { display: none !important; }
.comment-preview {
  position: relative;
  width: 72px;
  height: 72px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--surface);
}
.comment-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.comment-preview-rm {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 20px;
  height: 20px;
  border: 0;
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.72);
  color: #fff;
  font-size: 0.85rem;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}
.timeline-imgs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}
.timeline-img-link {
  display: block;
  max-width: 100%;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--surface);
}
.timeline-img-link img {
  display: block;
  max-width: min(280px, 100%);
  max-height: 220px;
  object-fit: contain;
  vertical-align: middle;
}
.timeline-feed {
  flex: 1;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 12px;
}
.timeline-empty {
  color: var(--muted);
  font-size: 0.78rem;
  padding: 20px 8px;
  text-align: center;
  line-height: 1.4;
}
.timeline-item {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 8px;
  will-change: transform;
}
.timeline-item.is-entering {
  transform: translate3d(104%, 0, 0);
  opacity: 0;
  pointer-events: none;
}
.timeline-item.is-entering.is-in {
  transform: translate3d(0, 0, 0);
  opacity: 1;
  pointer-events: auto;
  transition:
    transform 0.48s cubic-bezier(0.16, 0.84, 0.22, 1),
    opacity 0.38s cubic-bezier(0.16, 0.84, 0.22, 1);
}
.timeline-item.is-shifting {
  will-change: transform;
}
.timeline-item-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: baseline;
  margin-bottom: 4px;
}
.timeline-item-head strong {
  font-size: 0.75rem;
}
.timeline-item-head time {
  font-size: 0.65rem;
  color: var(--muted);
  white-space: nowrap;
}
.timeline-item-body {
  font-size: 0.78rem;
  line-height: 1.4;
  color: var(--text);
}
a.text-autolink {
  color: var(--accent, #2563eb);
  text-decoration: underline;
  text-underline-offset: 2px;
  word-break: break-all;
  cursor: pointer;
}
a.text-autolink:hover {
  color: var(--accent-hover, #1d4ed8);
}
.url-field-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
a.url-field-open {
  font-size: 0.72rem;
  align-self: flex-start;
}
.timeline-item.is-system {
  background: transparent;
  border-style: dashed;
}
.timeline-item-kind {
  display: inline-block;
  font-size: 0.62rem;
  color: var(--muted);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

@media (max-width: 860px) {
  .drawer.is-deal { width: 100vw; }
  .deal-card-body { grid-template-columns: 1fr; }
  .deal-card-main { border-right: 0; border-bottom: 1px solid var(--border); max-height: 50%; }
  .deal-field-row { grid-template-columns: 1fr; gap: 4px; }
  .deal-field-label { padding-top: 0; }
}

/* ?? Admin panel ?? */
.admin-view {
  padding: 16px 20px 32px;
  overflow: auto;
  height: 100%;
}
.admin-head h2 { margin: 0 0 4px; font-size: 1.15rem; }
.admin-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 14px 0 16px;
}
.admin-tab {
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--muted);
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 0.78rem;
  cursor: pointer;
}
.admin-tab.is-active {
  color: var(--text);
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 18%, var(--surface2));
}
.admin-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 10px 0 14px;
}
.admin-hint { margin: 0 0 10px; }
.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
}
.admin-table th,
.admin-table td {
  border-bottom: 1px solid var(--border);
  padding: 8px 10px;
  text-align: left;
  vertical-align: middle;
}
.admin-table th {
  color: var(--muted);
  font-weight: 650;
  font-size: 0.7rem;
  background: var(--surface2);
  position: sticky;
  top: 0;
  z-index: 1;
}
.admin-inline {
  width: 100%;
  max-width: 220px;
  padding: 5px 8px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text);
  font: inherit;
}
.admin-table select {
  padding: 4px 6px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text);
  font: inherit;
  max-width: 140px;
}
.admin-actions {
  white-space: nowrap;
  display: flex;
  gap: 6px;
}
.admin-matrix-wrap {
  overflow: auto;
  max-height: calc(100vh - 280px);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.admin-matrix th:first-child,
.admin-matrix td:first-child {
  position: sticky;
  left: 0;
  background: var(--surface);
  z-index: 2;
  min-width: 160px;
}
.admin-matrix thead th:first-child {
  z-index: 3;
  background: var(--surface2);
}
.admin-perm-label code {
  font-size: 0.65rem;
  color: var(--muted);
}
.tab.hidden { display: none !important; }

/* Bitrix-like access rights */
.bx-access {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 0;
  min-height: 480px;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  background: var(--surface);
}
.bx-access-roles {
  border-right: 1px solid var(--border);
  background: var(--surface2);
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.bx-access-roles-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  font-size: 0.78rem;
  font-weight: 650;
  border-bottom: 1px solid var(--border);
}
.bx-access-role-list {
  flex: 1;
  overflow: auto;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.bx-access-role {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  color: var(--text);
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
}
.bx-access-role:hover { background: rgba(59, 130, 246, 0.08); }
.bx-access-role.is-active {
  background: color-mix(in srgb, var(--accent) 22%, var(--surface));
}
.bx-access-role-title { font-size: 0.8rem; font-weight: 600; }
.bx-access-role-meta { font-size: 0.65rem; color: var(--muted); }
.bx-access-roles-foot {
  padding: 8px 12px;
  font-size: 0.68rem;
  border-top: 1px solid var(--border);
}
.bx-access-editor {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  max-height: calc(100vh - 220px);
  overflow: auto;
}
.bx-access-editor-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--surface);
  z-index: 2;
}
.bx-access-editor-head h3 { margin: 0 0 4px; font-size: 1rem; }
.bx-access-editor-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.bx-access-assignees {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 0.75rem;
}
.bx-access-chip {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 0.72rem;
}
.bx-access-sections { padding: 8px 12px 16px; }
.bx-access-section {
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 10px;
  background: var(--surface2);
  overflow: hidden;
}
.bx-access-section > summary {
  cursor: pointer;
  padding: 10px 14px;
  font-weight: 650;
  font-size: 0.82rem;
  list-style: none;
  user-select: none;
}
.bx-access-section > summary::-webkit-details-marker { display: none; }
.bx-access-section > summary::before {
  content: '? ';
  color: var(--muted);
}
.bx-access-section[open] > summary::before { content: '? '; }
.bx-access-section-body { padding: 0 8px 8px; }
.bx-access-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 180px;
  gap: 10px;
  align-items: center;
  padding: 8px 8px;
  border-top: 1px solid rgba(45, 63, 86, 0.45);
}
.bx-access-action { font-size: 0.78rem; }
.bx-access-level {
  width: 100%;
  padding: 6px 8px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font: inherit;
}
.bx-funnel-actions {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 0 4px 8px !important;
}
.bx-funnel-action {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) minmax(120px, 42%);
  gap: 10px;
  align-items: center;
  width: 100%;
  text-align: left;
  border: 0;
  border-top: 1px solid rgba(45, 63, 86, 0.4);
  background: transparent;
  color: var(--text);
  padding: 10px 8px;
  cursor: pointer;
  font: inherit;
}
.bx-funnel-action:hover { background: rgba(59, 130, 246, 0.08); }
.bx-funnel-action-plus {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1px solid var(--border);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  line-height: 1;
  color: var(--muted);
  background: var(--surface);
}
.bx-funnel-action.is-on .bx-funnel-action-plus {
  border-color: color-mix(in srgb, var(--accent) 55%, var(--border));
  color: var(--accent);
}
.bx-funnel-action-title { font-size: 0.8rem; }
.bx-funnel-action-val {
  font-size: 0.72rem;
  color: var(--muted);
  text-align: right;
}
.bx-funnel-action.is-on .bx-funnel-action-val { color: var(--text); }
.bx-access-role-meta-edit {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  padding: 12px 16px 18px;
  border-top: 1px solid var(--border);
}
.bx-access-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  color: var(--muted);
}

/* Scope popup (Bitrix-like) */
.bx-scope-modal {
  position: fixed;
  inset: 0;
  z-index: 1200;
  background: rgba(8, 14, 24, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.bx-scope-modal.hidden { display: none !important; }
.bx-scope-dialog {
  width: min(420px, 100%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.35);
  overflow: hidden;
}
.bx-scope-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding: 16px 18px 8px;
}
.bx-scope-head strong { font-size: 1.05rem; }
.bx-scope-action-name {
  padding: 0 18px 10px;
  font-size: 0.75rem;
}
.bx-scope-list {
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--border);
}
.bx-scope-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 18px;
  border-bottom: 1px solid rgba(45, 63, 86, 0.35);
  font-size: 0.9rem;
  cursor: pointer;
}
.bx-scope-row input[type='checkbox'] {
  appearance: none;
  width: 42px;
  height: 24px;
  border-radius: 999px;
  background: #9aa3b2;
  position: relative;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s ease;
}
.bx-scope-row input[type='checkbox']::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.15s ease;
}
.bx-scope-row input[type='checkbox']:checked {
  background: #2fc6f6;
}
.bx-scope-row input[type='checkbox']:checked::after {
  transform: translateX(18px);
}
.bx-scope-foot {
  display: flex;
  gap: 10px;
  padding: 14px 18px 16px;
}
.bx-scope-foot .bx-btn { min-width: 110px; }

/* ?? Plan calendar histogram ?? */
.plan-calendar-view {
  max-width: none;
  padding: 16px 18px 28px;
  display: grid;
  grid-template-columns: 1fr min(320px, 34vw);
  grid-template-rows: auto auto auto 1fr auto;
  gap: 12px 16px;
  height: 100%;
  overflow: auto;
}
.plan-toolbar {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.plan-toolbar h2 { margin: 0; font-size: 1.25rem; }
.plan-toolbar-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.plan-hint { grid-column: 1 / -1; margin: 0; }
.plan-overload-banner {
  grid-column: 1 / -1;
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.45);
  color: #fecaca;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 0.85rem;
}
.plan-grid-wrap {
  grid-column: 1;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
}
.plan-grid {
  --plan-cols: 42;
  min-width: calc(var(--plan-cols) * 36px);
}
.plan-grid-head,
.plan-grid-body {
  display: grid;
  grid-template-columns: repeat(var(--plan-cols), minmax(36px, 1fr));
}
.plan-day-head {
  text-align: center;
  padding: 6px 2px;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  font-size: 0.7rem;
  color: var(--muted);
}
.plan-day-head.is-weekend { background: rgba(0,0,0,0.25); }
.plan-day-head.is-overload .plan-day-num { color: #f87171; font-weight: 700; }
.plan-day-wd { display: block; text-transform: lowercase; }
.plan-day-num { display: block; color: var(--text); font-size: 0.85rem; }
.plan-day-cell {
  min-height: 120px;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 4px;
  position: relative;
}
.plan-day-cell.is-weekend {
  background: repeating-linear-gradient(
    -45deg,
    transparent,
    transparent 4px,
    rgba(0,0,0,0.12) 4px,
    rgba(0,0,0,0.12) 8px
  );
}
.plan-day-cell.is-drop-target,
.plan-pool-track.is-drop-target {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
  background: rgba(59, 130, 246, 0.12);
}
.plan-pool {
  grid-column: 1;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface2);
  padding: 10px 12px 14px;
}
.plan-pool h3 { margin: 0 0 8px; font-size: 0.95rem; }
.plan-pool-track {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 72px;
  align-items: flex-end;
}
.plan-block {
  border-radius: 6px;
  padding: 4px 6px;
  color: #fff;
  cursor: grab;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.12);
  display: flex;
  flex-direction: column;
  justify-content: center;
  overflow: hidden;
  user-select: none;
}
.plan-block.is-dragging { opacity: 0.55; }
.plan-block.is-selected { box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--accent); }
.plan-block.is-overloaded { box-shadow: 0 0 0 2px #ef4444; }
.plan-block-title {
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.plan-block-meta {
  font-size: 0.65rem;
  opacity: 0.9;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.plan-side {
  grid-column: 2;
  grid-row: 3 / 6;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  padding: 14px;
  overflow: auto;
  align-self: stretch;
}
.plan-side h3 { margin: 0 0 4px; }
.plan-side h4 { margin: 14px 0 8px; font-size: 0.85rem; color: var(--muted); }
.plan-people-list { display: flex; flex-direction: column; gap: 4px; max-height: 280px; overflow: auto; }
.plan-person-row {
  display: grid;
  grid-template-columns: 18px 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 4px 0;
  cursor: pointer;
}
.plan-side-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }
.plan-side-actions button { width: 100%; }
.plan-reg-toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 12px 0; }
.plan-reg-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.plan-reg-effort {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 0.8rem;
}
.plan-reg-effort input { width: 80px; }

@media (max-width: 900px) {
  .bx-access { grid-template-columns: 1fr; }
  .bx-access-roles { border-right: 0; border-bottom: 1px solid var(--border); max-height: 200px; }
  .bx-access-row { grid-template-columns: 1fr; }
  .bx-funnel-action {
    grid-template-columns: 22px 1fr;
  }
  .bx-funnel-action-val {
    grid-column: 2;
    text-align: left;
  }
  .plan-calendar-view {
    grid-template-columns: 1fr;
  }
  .plan-side {
    grid-column: 1;
    grid-row: auto;
    max-height: 360px;
  }
}

/* Stage required-fields dialog */
.stage-req-modal {
  position: fixed;
  inset: 0;
  z-index: 1400;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  font-family: var(--font-sans);
  font-size: 14px;
}
.stage-req-modal.hidden {
  display: none;
}
.stage-req-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(8, 12, 18, 0.62);
}
.stage-req-panel {
  position: relative;
  z-index: 1;
  width: min(420px, 100%);
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
  padding: 16px 16px 12px;
}
.stage-req-title {
  margin: 0 0 4px;
  font-size: 0.95rem;
  font-weight: 650;
  letter-spacing: -0.01em;
  color: var(--text);
}
.stage-req-hint {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.4;
}
.stage-req-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: min(46vh, 320px);
  overflow: auto;
}
.stage-req-field label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  margin-bottom: 4px;
  color: var(--muted);
  line-height: 1.35;
}
.stage-req-field-note {
  margin-top: 4px;
  font-size: 0.72rem;
  color: var(--hold);
}
.stage-req-field input,
.stage-req-field select,
.stage-req-field textarea {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px 10px;
  font: inherit;
  font-size: 0.875rem;
  background: var(--surface2);
  color: var(--text);
}
.stage-req-field textarea {
  min-height: 72px;
  resize: vertical;
}
.stage-req-field input:focus,
.stage-req-field select:focus,
.stage-req-field textarea:focus {
  outline: none;
  border-color: var(--accent);
}
.stage-req-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}
.timeline-task-stub {
  display: none;
}
.timeline-task-stub .bx-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.card-layout-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 16px;
}
.card-layout-hint {
  margin: 0 0 12px;
  font-size: 0.8rem;
}
.card-layout-sec {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 14px;
  background: color-mix(in srgb, var(--surface) 70%, var(--surface2));
}
.card-layout-sec-head {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 10px;
}
.card-layout-add {
  margin-top: 10px;
}
.card-layout-add select {
  max-width: 100%;
  min-width: min(280px, 100%);
  padding: 8px 10px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text);
}
.robots-create {
  margin: 12px 0 18px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface) 70%, var(--surface2));
}
.robots-form {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: 8px;
}
.robots-form .admin-inline,
.robots-form select {
  min-width: 160px;
}

/* Bitrix-like automation board */
#boardViewport.is-automation {
  overflow: hidden;
}
#boardViewport.is-automation .board,
#boardViewport.is-automation .board.is-automation-board {
  display: block !important;
  overflow: hidden !important;
  height: 100%;
  width: 100%;
  min-width: 0;
  padding: 0;
  gap: 0;
}
.bx-auto {
  padding: 12px 14px 24px;
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  background: var(--drawer-panel-soft, var(--bg));
}
.bx-auto-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 12px;
  flex-shrink: 0;
}
.bx-auto-title { font-size: 1.15rem; font-weight: 650; }
.bx-auto-head-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.bx-auto-hint { margin-bottom: 14px; flex-shrink: 0; }
.bx-auto-row-create {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 12px;
  margin-bottom: 16px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: color-mix(in srgb, var(--surface) 75%, var(--surface2));
  flex-shrink: 0;
}
.bx-auto-lane-label {
  font-size: 0.75rem;
  font-weight: 650;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.bx-auto-create-list { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-start; min-height: 48px; }
.bx-auto-board {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 12px;
  align-items: flex-start;
  flex: 1;
  min-height: 0;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.bx-auto-board::-webkit-scrollbar { display: none; height: 0; width: 0; }
.bx-auto-col {
  flex: 0 0 220px;
  width: 220px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  min-height: 280px;
  max-height: 100%;
  display: flex;
  flex-direction: column;
}
.bx-auto-col-head {
  display: flex;
  justify-content: space-between;
  gap: 6px;
  align-items: flex-start;
  padding: 10px 10px 6px;
  border-bottom: 1px solid var(--border);
}
.bx-auto-col-title {
  font-size: 0.82rem;
  font-weight: 650;
  line-height: 1.25;
}
.bx-auto-add { font-size: 0.72rem; padding: 2px 8px; }
.bx-auto-triggers {
  padding: 8px 10px;
  font-size: 0.72rem;
  border-bottom: 1px dashed var(--border);
  min-height: 36px;
}
.bx-auto-robots-label {
  padding: 8px 10px 4px;
  font-size: 0.72rem;
  font-weight: 650;
  color: var(--muted);
}
.bx-auto-robots {
  padding: 4px 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
  overflow-x: hidden;
  overflow-y: auto;
  min-height: 120px;
}
.bx-auto-robot {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px;
  background: color-mix(in srgb, var(--surface2) 55%, var(--surface));
  font-size: 0.78rem;
  cursor: grab;
  user-select: none;
  transition:
    box-shadow 0.35s ease,
    opacity 0.3s ease,
    border-color 0.25s ease;
  position: relative;
  flex-shrink: 0;
}
.bx-auto-robot:active { cursor: grabbing; }
.bx-auto-robot:hover:not(.drag-source):not(.is-shifting) {
  border-color: var(--accent);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
}
.bx-auto-robot.is-off { opacity: 0.55; }
.bx-auto-robot.drag-source { display: none !important; }
.bx-auto-robot.is-shifting {
  will-change: transform;
  z-index: 2;
  pointer-events: none;
}
.bx-auto-robot-placeholder {
  flex-shrink: 0;
  height: var(--ph-height, 72px);
  min-width: 140px;
  border-radius: 8px;
  border: 2px dashed rgba(59, 130, 246, 0.55);
  background: linear-gradient(180deg, rgba(59, 130, 246, 0.18), rgba(59, 130, 246, 0.06));
  box-shadow: inset 0 0 18px rgba(59, 130, 246, 0.12);
  pointer-events: none;
  box-sizing: border-box;
}
.bx-auto-robot.drag-ghost {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 1000;
  margin: 0;
  pointer-events: none;
  opacity: 0.96;
  box-shadow: 0 22px 48px rgba(0, 0, 0, 0.48);
  border-color: var(--accent);
  will-change: transform;
  transition: none;
  cursor: grabbing;
}
.bx-auto-robot.drag-ghost.settling {
  transition:
    transform 0.22s cubic-bezier(0.22, 0.61, 0.36, 1),
    box-shadow 0.22s ease;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.24);
}
.bx-auto-delay {
  font-size: 0.68rem;
  color: var(--accent);
  font-weight: 650;
  margin-bottom: 2px;
}
.bx-auto-robot-title { font-weight: 600; margin-bottom: 4px; }
.bx-auto-robot-acts {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
}
.bx-auto-empty { font-size: 0.75rem; padding: 6px 2px; }
.bx-auto-robot.is-dragging { opacity: 0.55; }
.bx-auto-robots.is-drop,
.bx-auto-create-list.is-drop {
  outline: 2px dashed var(--accent, #3b82f6);
  outline-offset: 2px;
  background: color-mix(in srgb, var(--accent, #3b82f6) 8%, transparent);
}
.bx-auto-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.bx-auto-modal.hidden { display: none !important; }
.bx-auto-modal-panel .hidden,
.bx-auto-modal-panel .bx-auto-field.hidden,
.bx-auto-modal-panel .bx-auto-task-fields.hidden,
.bx-auto-modal-panel .bx-auto-params.hidden,
.bx-auto-modal-panel .bx-auto-check.hidden {
  display: none !important;
}
.bx-auto-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
}
.bx-auto-modal-panel {
  position: relative;
  z-index: 1;
  width: min(440px, 100%);
  max-height: min(90vh, 720px);
  overflow: auto;
  padding: 18px 18px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface, #fff);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.18);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.bx-auto-modal-panel h3 { margin: 0 0 4px; font-size: 1.05rem; }
.bx-auto-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.82rem;
  font-weight: 600;
}
.bx-auto-field input,
.bx-auto-field select,
.bx-auto-field textarea {
  font-weight: 400;
  width: 100%;
}
.bx-auto-check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
}
.bx-auto-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 6px;
}
.bx-auto-task-fields {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 10px 0 2px;
  border-top: 1px dashed var(--border);
  border-bottom: 1px dashed var(--border);
  margin: 2px 0;
}
.bx-auto-params {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.bx-auto-params-label {
  font-size: 0.82rem;
  font-weight: 650;
}
.bx-auto-params-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.bx-auto-params-list .bx-btn {
  font-size: 0.72rem;
  padding: 3px 8px;
}
.bx-auto-deadline-row {
  display: flex;
  gap: 8px;
  align-items: center;
}
.bx-auto-deadline-row input {
  flex: 1;
  min-width: 0;
}
.bx-auto-deadline-row select {
  flex: 0 0 110px;
  width: 110px;
}
.bx-auto-add-panel {
  margin-top: 16px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.tasks-view { padding: 16px 18px 28px; }
.tasks-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 14px;
}
.tasks-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.tasks-table th,
.tasks-table td {
  border-bottom: 1px solid var(--border);
  padding: 8px 10px;
  text-align: left;
  vertical-align: top;
}
.tasks-table tr.is-clickable { cursor: pointer; }
.tasks-table tr.is-clickable:hover { background: color-mix(in srgb, var(--surface2) 60%, transparent); }
.task-status {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 650;
  padding: 2px 8px;
  border-radius: 6px;
  border: 1px solid var(--border);
  pointer-events: none;
  user-select: none;
}
.task-status.is-open {
  color: #93c5fd;
  border-color: rgba(59, 130, 246, 0.45);
  background: rgba(59, 130, 246, 0.12);
}
.task-status.is-review {
  color: #fcd34d;
  border-color: rgba(234, 179, 8, 0.45);
  background: rgba(234, 179, 8, 0.12);
}
.task-status.is-rework {
  color: #fdba74;
  border-color: rgba(249, 115, 22, 0.45);
  background: rgba(249, 115, 22, 0.12);
}
.task-status.is-closed {
  color: #86efac;
  border-color: rgba(34, 197, 94, 0.45);
  background: rgba(34, 197, 94, 0.12);
}
.card .task-status {
  margin-top: 4px;
}
.task-copy-link-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  margin-top: 2px;
}
.task-copy-link-btn {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface2);
  color: var(--muted);
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}
.task-copy-link-btn:hover {
  color: var(--text);
  border-color: var(--accent);
}
.task-copy-link-btn.is-copied {
  color: #4ade80;
  border-color: rgba(34, 197, 94, 0.65);
  background: rgba(20, 83, 45, 0.35);
}
.task-copy-link-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.task-copy-link-toast {
  position: absolute;
  left: calc(100% + 8px);
  top: 50%;
  transform: translateY(-50%);
  white-space: nowrap;
  font-size: 0.68rem;
  font-weight: 600;
  color: #bbf7d0;
  padding: 4px 8px;
  border-radius: 6px;
  background: #14532d;
  border: 1px solid rgba(74, 222, 128, 0.45);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
  z-index: 5;
}
.task-copy-link-toast.is-visible {
  opacity: 1;
}
.drawer.is-task-theme .task-copy-link-toast {
  background: #1a3d24;
  color: #bbf7d0;
  border-color: rgba(74, 222, 128, 0.5);
}
.task-crm-source-link {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  padding: 0;
  border: none;
  background: none;
  color: var(--accent, #60a5fa);
  font: inherit;
  font-size: 0.85rem;
  text-align: left;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
  word-break: break-word;
}
.task-crm-source-link:hover {
  color: var(--text);
}
.task-card { display: flex; flex-direction: column; gap: 10px; padding: 8px 4px 20px; }
.task-card-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.task-desc-wrap {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  max-width: 100%;
}
.task-desc-editor {
  width: 100%;
  box-sizing: border-box;
  min-height: 96px;
  max-height: 240px;
  overflow-y: auto;
  padding: 8px 10px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text);
  font-family: inherit;
  font-size: 0.8rem;
  line-height: 1.45;
  outline: none;
  /* avoid nested "window" look from browser block wrappers */
  display: block;
}
.task-desc-editor.is-empty:before,
.task-desc-editor:empty:before {
  content: attr(data-placeholder);
  color: var(--muted);
  pointer-events: none;
}
.task-desc-editor:focus {
  border-color: var(--accent);
}
.task-desc-editor div,
.task-desc-editor p,
.task-desc-editor span {
  margin: 0;
  padding: 0;
  border: none !important;
  background: transparent !important;
  box-shadow: none !important;
  font-size: inherit;
  color: inherit;
}
.task-desc-editor img.task-desc-thumb,
.task-desc-editor img {
  display: inline-block;
  max-width: 120px;
  max-height: 90px;
  width: auto;
  height: auto;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--border);
  margin: 4px 6px 4px 0;
  vertical-align: middle;
  cursor: zoom-in;
  background: var(--surface);
}
.task-desc-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.task-desc-hint {
  font-size: 0.68rem;
  line-height: 1.3;
}
.task-img-lightbox {
  position: fixed;
  inset: 0;
  z-index: 12000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.82);
  padding: 24px;
  cursor: zoom-out;
}
.task-img-lightbox.hidden {
  display: none;
}
.task-img-lightbox img {
  max-width: min(96vw, 1200px);
  max-height: 90vh;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  cursor: default;
}
.task-img-lightbox-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1.5px solid #fff;
  background: #ef4444;
  color: #fff;
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
}
.task-attach-list img {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--border);
}
.task-comments { display: flex; flex-direction: column; gap: 8px; }
.task-comment {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface2, #f7f9fb);
  font-size: 0.85rem;
}
.bx-auto-add-panel {
  margin-top: 16px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.card-layout-editor.is-compact {
  padding: 4px 2px 16px;
}
.card-layout-editor.is-compact .admin-table {
  font-size: 0.8rem;
}
.deal-card-head-row .bx-btn {
  flex-shrink: 0;
}

.field-mgr-create {
  margin: 12px 0 20px;
  padding: 12px 14px;
  border: 1px solid var(--border, #dde3ea);
  border-radius: 8px;
  background: var(--surface-2, #f7f9fb);
}
.field-mgr-create h3 {
  margin: 0 0 10px;
  font-size: 14px;
  font-weight: 600;
}
.field-mgr-form {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  align-items: flex-end;
}
.field-mgr-form label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--muted, #6b7785);
}

/* Task board / card */
.task-deadline-input {
  width: 100%;
  background: var(--surface2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 7px 10px;
  font-family: inherit;
  font-size: 0.8rem;
  color-scheme: dark;
}
.task-deadline-wrap {
  position: relative;
}
.task-deadline-trigger {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text);
  font-family: inherit;
  font-size: 0.8rem;
  cursor: pointer;
  text-align: left;
}
.task-deadline-trigger:hover {
  border-color: var(--accent);
}
.task-deadline-ico {
  flex-shrink: 0;
  color: var(--muted);
}
.task-deadline-pop {
  position: absolute;
  z-index: 80;
  top: calc(100% + 6px);
  left: 0;
  min-width: min(340px, 92vw);
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px 10px;
  padding: 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
}
.task-deadline-pop.hidden {
  display: none;
}
.tdp-cal {
  min-width: 210px;
}
.tdp-cal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 8px;
}
.tdp-cal-title {
  font-size: 0.78rem;
  font-weight: 600;
}
.tdp-nav {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text);
  cursor: pointer;
}
.tdp-weekdays,
.tdp-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}
.tdp-weekdays span {
  text-align: center;
  font-size: 0.62rem;
  color: var(--muted);
  padding: 2px 0;
}
.tdp-day {
  height: 28px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  font-size: 0.72rem;
  cursor: pointer;
}
.tdp-day.is-empty {
  pointer-events: none;
}
.tdp-day:hover:not(.is-empty) {
  background: var(--surface2);
}
.tdp-day.is-selected {
  background: var(--accent);
  color: #fff;
}
.tdp-times {
  display: flex;
  gap: 6px;
}
.tdp-time-col {
  width: 56px;
}
.tdp-time-label {
  font-size: 0.62rem;
  color: var(--muted);
  text-align: center;
  margin-bottom: 4px;
}
.tdp-time-list {
  height: 180px;
  overflow-y: auto;
  overflow-x: hidden;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface2);
  /* finite list ? no scroll-snap loop / carousel */
  overscroll-behavior: contain;
}
.tdp-time-item {
  display: block;
  width: 100%;
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 0.72rem;
  padding: 5px 0;
  cursor: pointer;
  font-family: inherit;
}
.tdp-time-item:hover {
  background: color-mix(in srgb, var(--accent) 18%, transparent);
}
.tdp-time-item.is-selected {
  background: var(--accent);
  color: #fff;
  font-weight: 600;
}
.tdp-foot {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 2px;
}
.task-deadline-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.task-deadline-row input[type='date'],
.task-deadline-row input[type='datetime-local'],
.task-deadline-row select {
  background: var(--surface2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 8px;
}
.card.is-task-watch {
  opacity: 0.92;
  cursor: pointer;
  border-style: dashed;
}
.card.is-task-closed {
  opacity: 0.78;
  cursor: not-allowed;
}
.task-tab-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1;
}
.task-tab-panel.hidden {
  display: none !important;
}
.timeline-item.is-delegate {
  border-left: 2px solid #eab308;
  padding-left: 8px;
}
.timeline-item.is-delegate.is-current {
  background: color-mix(in srgb, #eab308 10%, transparent);
  border-radius: 8px;
  padding: 8px;
}
.timeline-item.is-status {
  border-left: 2px solid #3b82f6;
  padding-left: 8px;
}
.timeline-item.is-status .timeline-item-kind {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 0.68rem;
  color: var(--muted);
  margin-bottom: 4px;
}
.timeline-item.is-status .status-arrow {
  color: var(--muted);
  font-weight: 700;
  margin: 0 2px;
}
.task-timeline .timeline-feed {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 8px 12px 16px;
}
.timeline-item.is-mm {
  border-left: 2px solid var(--accent);
  padding-left: 8px;
}
.task-link-card-hint {
  margin: 0 0 12px;
  font-size: 0.78rem;
}
.drawer.is-deal #drawerContent,
.drawer.is-deal #drawerOverlayContent {
  height: 100%;
  min-height: 0;
  padding: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.board.is-col-dragging {
  overflow-anchor: none;
  scroll-behavior: auto;
  cursor: grabbing;
  user-select: none;
}
.column.drag-source {
  display: none !important;
}
.column.is-shifting {
  will-change: transform;
  z-index: 2;
  pointer-events: none;
}
.task-col-placeholder {
  flex: 0 0 var(--ph-width, var(--ph-height, var(--col-w)));
  flex-shrink: 0;
  width: var(--ph-width, var(--ph-height, var(--col-w)));
  min-width: var(--ph-width, var(--ph-height, var(--col-w)));
  max-width: var(--ph-width, var(--ph-height, var(--col-w)));
  align-self: stretch;
  min-height: 180px;
  border-radius: 10px;
  border: 2px dashed rgba(59, 130, 246, 0.55);
  background: linear-gradient(180deg, rgba(59, 130, 246, 0.16), rgba(59, 130, 246, 0.05));
  box-shadow: inset 0 0 18px rgba(59, 130, 246, 0.1);
  pointer-events: none;
  box-sizing: border-box;
}
.column.task-col-drop {
  outline: none;
}
.task-col-ghost {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 9999;
  pointer-events: none;
  opacity: 0.96;
  margin: 0;
  box-shadow: 0 22px 48px rgba(0, 0, 0, 0.45);
  border-radius: 10px;
  overflow: hidden;
  will-change: transform;
  transition: none;
}
.task-col-ghost.settling {
  transition: transform 0.24s cubic-bezier(0.22, 1, 0.36, 1);
}

/* --- Tasks yellow theme (kanban + task drawers) --- */
body.theme-tasks {
  --bg: #14110a;
  --surface: #1f1a10;
  --surface2: #2c2414;
  --border: #5a4a28;
  --text: #f7f1e0;
  --muted: #b8a67a;
  --accent: #eab308;
  --accent-hover: #ca8a04;
  --drawer-shell: #1a160c;
  --drawer-panel: #241e12;
  --drawer-panel-soft: #1e1910;
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(234, 179, 8, 0.12), transparent 55%),
    radial-gradient(900px 500px at 10% 100%, rgba(202, 138, 4, 0.08), transparent 50%),
    var(--bg);
}
body.theme-tasks .header {
  /* Keep top nav in default CRM blue ? not yellow */
  --bg: #0f1419;
  --surface: #1a2332;
  --surface2: #243044;
  --border: #2d3f56;
  --text: #e8edf4;
  --muted: #8b9cb3;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  background: #1a2332;
  border-bottom-color: #2d3f56;
  color: #e8edf4;
}
body.theme-tasks .header .tab.active {
  color: var(--text);
  box-shadow: inset 0 -2px 0 var(--accent);
}
body.theme-tasks .bx-btn-primary {
  color: #1c1917;
  font-weight: 650;
}
body.theme-tasks #boardViewport.is-tasks .board {
  background: transparent;
}
body.theme-tasks .column {
  background: color-mix(in srgb, var(--surface) 92%, #eab308 8%);
  border-color: color-mix(in srgb, var(--border) 75%, #eab308 25%);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
}
body.theme-tasks .column-header,
body.theme-tasks .column-sum {
  background: color-mix(in srgb, var(--surface2) 85%, #eab308 15%);
  border-bottom: 1px solid color-mix(in srgb, var(--border) 60%, #eab308 40%);
}
/* Custom column color must tint the whole column (override yellow theme) */
body.theme-tasks .column.has-tint {
  background: color-mix(in srgb, var(--col-tint) 28%, var(--surface));
  border-color: color-mix(in srgb, var(--col-tint) 55%, var(--border));
}
body.theme-tasks .column.has-tint .column-header,
body.theme-tasks .column.has-tint .column-sum {
  background: color-mix(in srgb, var(--col-tint) 42%, var(--surface2));
  border-bottom-color: color-mix(in srgb, var(--col-tint) 45%, var(--border));
}
body.theme-tasks .column.has-tint .column-body {
  background: color-mix(in srgb, var(--col-tint) 16%, transparent);
}
body.theme-tasks .column-header .count {
  background: rgba(234, 179, 8, 0.22);
  color: #fde68a;
  border-color: rgba(234, 179, 8, 0.35);
}
body.theme-tasks .card {
  background: color-mix(in srgb, #1a160c 88%, #eab308 12%);
  border: 1px solid color-mix(in srgb, var(--border) 65%, #eab308 35%);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.28);
}
body.theme-tasks .card:hover {
  border-color: color-mix(in srgb, #eab308 55%, var(--border));
  box-shadow: 0 6px 18px rgba(234, 179, 8, 0.12);
}
body.theme-tasks .card-stage-days {
  background: rgba(40, 32, 12, 0.85);
  border-color: rgba(234, 179, 8, 0.4);
}
body.theme-tasks .filter-bar,
body.theme-tasks #filterBar {
  background: color-mix(in srgb, var(--surface) 90%, #eab308 10%);
  border-color: var(--border);
}
body.theme-tasks .bx-filter-popup,
body.theme-tasks .bx-filter-popup select,
body.theme-tasks .bx-filter-add,
body.theme-tasks .bx-filter-field-control select,
body.theme-tasks .bx-filter-field-control input {
  color-scheme: dark;
}
body.theme-tasks .bx-filter-popup {
  background: color-mix(in srgb, #1a160c 92%, #eab308 8%);
  border-color: color-mix(in srgb, var(--border) 60%, #eab308 40%);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
}
body.theme-tasks .bx-filter-add {
  background: color-mix(in srgb, var(--surface2) 88%, #eab308 12%);
  border: 1px dashed color-mix(in srgb, #eab308 55%, var(--border));
  color: #fde68a;
}
body.theme-tasks .bx-filter-add:hover,
body.theme-tasks .bx-filter-add:focus {
  border-style: solid;
  border-color: #eab308;
  outline: none;
}
body.theme-tasks .bx-filter-add-menu {
  background: #2c2414;
  border-color: color-mix(in srgb, #eab308 45%, var(--border));
}
body.theme-tasks .bx-filter-add-item:hover {
  background: color-mix(in srgb, #eab308 30%, #2c2414);
  color: #f7f1e0;
}
body.theme-tasks .bx-filter-popup select,
body.theme-tasks .bx-filter-popup option {
  background-color: #2c2414;
  color: #f7f1e0;
}
body.theme-tasks .bx-filter-popup option:checked,
body.theme-tasks .bx-filter-popup option:hover {
  background-color: color-mix(in srgb, #eab308 35%, #2c2414);
  color: #1c1917;
}
body.theme-tasks .bx-filter-field-control select,
body.theme-tasks .bx-filter-field-control .bx-filter-text,
body.theme-tasks .bx-filter-date-pair input {
  background: var(--surface2);
  border-color: var(--border);
  color: var(--text);
}
body.theme-tasks .task-status.is-open {
  background: rgba(234, 179, 8, 0.2);
  color: #fde68a;
  border-color: rgba(234, 179, 8, 0.45);
}
body.theme-tasks .task-status.is-review {
  background: rgba(251, 191, 36, 0.18);
  color: #fcd34d;
}
body.theme-tasks .task-status.is-rework {
  background: rgba(245, 158, 11, 0.2);
  color: #fdba74;
}
body.theme-tasks .task-status.is-closed {
  background: rgba(120, 100, 40, 0.35);
  color: #d6c48a;
}

/* Task drawers (create/open) ? same yellow gamut even over CRM cards */
.drawer.is-task-theme {
  --drawer-shell: #1a160c;
  --drawer-panel: #241e12;
  --drawer-panel-soft: #1e1910;
  --surface: #1f1a10;
  --surface2: #2c2414;
  --border: #5a4a28;
  --text: #f7f1e0;
  --muted: #b8a67a;
  --accent: #eab308;
  --accent-hover: #ca8a04;
  background:
    linear-gradient(180deg, rgba(234, 179, 8, 0.08), transparent 28%),
    var(--drawer-shell);
  border-left-color: color-mix(in srgb, #eab308 40%, #3d5168);
  box-shadow:
    -1px 0 0 color-mix(in srgb, #eab308 18%, transparent),
    -16px 0 48px rgba(0, 0, 0, 0.5);
}
.drawer.is-task-theme #drawerContent,
.drawer.is-task-theme #drawerOverlayContent {
  background: color-mix(in srgb, var(--surface) 94%, #eab308 6%);
}
.drawer.is-task-theme .deal-card,
.drawer.is-task-theme .deal-card-head,
.drawer.is-task-theme .deal-card-main,
.drawer.is-task-theme .deal-timeline {
  background: var(--drawer-panel);
  border-color: var(--border);
}
.drawer.is-task-theme .deal-card-head {
  background: color-mix(in srgb, var(--drawer-panel) 82%, #eab308 18%);
  border-bottom: 1px solid color-mix(in srgb, var(--border) 55%, #eab308 45%);
}
.drawer.is-task-theme .timeline-tab.is-active {
  color: #fde68a;
  box-shadow: inset 0 -2px 0 #eab308;
}
.drawer.is-task-theme .bx-btn-primary {
  color: #1c1917;
  font-weight: 650;
}
.drawer.is-task-theme .task-copy-link-btn {
  border-color: color-mix(in srgb, var(--border) 50%, #eab308 50%);
  color: #eab308;
  background: color-mix(in srgb, var(--surface2) 80%, #eab308 20%);
}
.drawer.is-task-theme .task-crm-source-link {
  color: #fbbf24;
}
.drawer.is-task-theme .task-complete-banner {
  background: rgba(234, 179, 8, 0.12);
  border-color: rgba(234, 179, 8, 0.35);
  color: #fde68a;
}
.drawer.is-task-theme .field input,
.drawer.is-task-theme .field select,
.drawer.is-task-theme .field textarea,
.drawer.is-task-theme .task-desc-editor,
.drawer.is-task-theme .task-deadline-trigger {
  background: var(--surface2);
  border-color: var(--border);
  color: var(--text);
}
.drawer.is-task-theme .task-deadline-trigger:hover,
.drawer.is-task-theme .task-copy-link-btn:hover {
  border-color: #eab308;
  color: #fde68a;
}


/* —— Org structure —— */
.org-view { padding: 16px 20px 40px; overflow: auto; }
.org-shell { max-width: 1200px; margin: 0 auto; }
.org-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.org-head h2 { margin: 0 0 4px; font-size: 1.35rem; }
.org-head-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.org-layout { display: grid; grid-template-columns: 1fr; gap: 16px; }
.org-layout:has(.org-side.is-open) { grid-template-columns: minmax(0, 1fr) 320px; }
.org-canvas { min-height: 240px; }
.org-empty-canvas, .org-empty {
  padding: 40px 20px;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--border);
  border-radius: 12px;
}
.org-branch { position: relative; margin: 0 0 14px; }
.org-children {
  margin: 10px 0 0 22px;
  padding-left: 18px;
  border-left: 2px solid color-mix(in srgb, var(--border) 70%, transparent);
  display: flex;
  flex-direction: column;
  gap: 12px;
  animation: orgBranchIn 0.38s cubic-bezier(0.22, 1, 0.36, 1) both;
}
@keyframes orgBranchIn {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: none; }
}
.org-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  cursor: default;
  transition:
    transform 0.22s cubic-bezier(0.22, 1, 0.36, 1),
    border-color 0.2s ease,
    background 0.2s ease,
    box-shadow 0.25s ease;
}
.org-card-enter {
  animation: orgCardEnter 0.42s cubic-bezier(0.22, 1, 0.36, 1) both;
}
@keyframes orgCardEnter {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to { opacity: 1; transform: none; }
}
.org-card:hover {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
  transform: translateY(-1px);
}
.org-card.is-selected {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--surface) 88%, var(--accent) 12%);
}
.org-card.is-dragging { opacity: 0.55; transform: scale(0.97); }
.org-card-top {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.org-card-title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 650;
  flex: 1;
  min-width: 0;
}
.org-collapse, .org-collapse-spacer {
  width: 22px;
  height: 22px;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.85rem;
  flex-shrink: 0;
}
.org-type-pill {
  font-size: 0.62rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 2px 7px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--muted);
  background: var(--surface2);
}
.org-type-pill[data-type="company"] { color: #38bdf8; border-color: rgba(56,189,248,0.35); }
.org-type-pill[data-type="department"] { color: #a78bfa; border-color: rgba(167,139,250,0.35); }
.org-type-pill[data-type="sector"] { color: #34d399; border-color: rgba(52,211,153,0.35); }
.org-type-pill[data-type="group"] { color: #fbbf24; border-color: rgba(251,191,36,0.35); }
.org-type-pill[data-type="role"] { color: #fb7185; border-color: rgba(251,113,133,0.35); }
.org-label {
  font-size: 0.65rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 6px;
}
.org-head-block { margin-bottom: 10px; }
.org-muted-line { font-size: 0.75rem; color: var(--muted); margin-bottom: 8px; }
.org-person {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 8px;
  background: var(--surface2);
  border: 1px solid transparent;
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.org-person.is-head {
  border-color: color-mix(in srgb, var(--accent) 40%, transparent);
  background: color-mix(in srgb, var(--surface2) 70%, var(--accent) 30%);
}
.org-person-name { font-size: 0.8rem; font-weight: 600; }
.org-person-pos { font-size: 0.68rem; color: var(--muted); }
.org-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}
.org-avatar-fallback {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: color-mix(in srgb, var(--accent) 25%, var(--surface2));
  color: var(--text);
  font-size: 0.65rem;
  font-weight: 700;
}
.org-members-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 6px;
}
.org-drop-zone {
  margin-top: 8px;
  padding: 8px;
  border: 1px dashed transparent;
  border-radius: 8px;
  font-size: 0.68rem;
  color: transparent;
  text-align: center;
  transition: all 0.2s ease;
  pointer-events: none;
}
.org-card.is-dragging ~ .org-drop-zone,
.org-canvas:has(.is-dragging) .org-drop-zone {
  pointer-events: auto;
  color: var(--muted);
  border-color: var(--border);
}
.org-drop-zone.is-over {
  color: var(--accent);
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
}
.org-side {
  display: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  align-self: start;
  position: sticky;
  top: 12px;
  max-height: calc(100vh - 100px);
  overflow: auto;
  animation: orgSideIn 0.32s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.org-side.is-open { display: block; }
@keyframes orgSideIn {
  from { opacity: 0; transform: translateX(12px); }
  to { opacity: 1; transform: none; }
}
.org-side-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.org-side-head h3 { margin: 0; font-size: 0.95rem; }
.org-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 10px;
  font-size: 0.72rem;
  color: var(--muted);
}
.org-side-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 12px 0;
}
.org-side-pos {
  border-top: 1px solid var(--border);
  padding-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.org-side-pos h4 { margin: 0; font-size: 0.8rem; }
.org-prof-unit {
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}
.org-prof-unit:last-child { border-bottom: 0; }
@media (max-width: 900px) {
  .org-layout:has(.org-side.is-open) { grid-template-columns: 1fr; }
  .org-side { position: static; max-height: none; }
}
