    :root {
      --bg: #f8fafc;
      --card: #ffffff;
      --line: #e2e8f0;
      --text: #0f172a;
      --muted: #64748b;
      --yellow: #f7c948;
      --yellow-dark: #e9b414;
      --accent: #1d4ed8;
      --danger: #dc2626;
      --ok: #059669;
      --shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
      /* Окно переписки (десктоп): ~×1.5 к прежнему, прокрутка внутри */
      --msg-thread-max: min(66vh, 720px);
    }
    * { box-sizing: border-box; }
    html, body { max-width: 100%; overflow-x: hidden; }
    body { margin: 0; font-family: Inter, system-ui, sans-serif; background: var(--bg); color: var(--text); }
    body.lead-drawer-open { overflow: hidden; touch-action: none; }
    body.crm-comms-thread-open {
      overflow: hidden;
      position: fixed;
      width: 100%;
      left: 0;
      right: 0;
      overscroll-behavior: none;
      touch-action: none;
    }
    .app { max-width: none; width: 100%; margin: 0 auto; padding: 0; }
    .topbar {
      position: sticky; top: 0; z-index: 20;
      background: var(--card); border-bottom: 1px solid var(--line);
      padding: 14px; display: flex; gap: 10px; flex-wrap: wrap; align-items: center;
    }
    html.crm-native-app .topbar {
      padding-top: max(14px, env(safe-area-inset-top, 0px));
    }
    .brand {
      font-weight: 800;
      font-size: 20px;
      display: inline-flex;
      align-items: center;
      gap: 8px;
      flex: 0 0 auto;
      max-width: 100%;
    }
    .badge { background: var(--yellow); color: #2b2b2b; border-radius: 999px; padding: 2px 10px; font-size: 12px; font-weight: 700; }
    input, select, textarea, button {
      font: inherit; border: 1px solid var(--line); border-radius: 10px; padding: 9px 11px; background: white; color: var(--text);
    }
    textarea { resize: vertical; min-height: 60px; }
    button { cursor: pointer; }
    button.primary { background: var(--yellow); border-color: var(--yellow-dark); font-weight: 700; }
    button.primary:hover { filter: brightness(.98); }
    button.ghost { background: #fff; }
    button.danger { background: #fff0f0; border-color: #fecaca; color: var(--danger); }
    button.touch-lg { padding: 12px 16px; border-radius: 12px; min-height: 48px; }

    .crm-icon {
      width: 20px;
      height: 20px;
      stroke: currentColor;
      fill: none;
      stroke-width: 2;
      stroke-linecap: round;
      stroke-linejoin: round;
      flex-shrink: 0;
      display: block;
    }
    .icon-action-btn {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      width: 42px;
      height: 42px;
      min-height: 42px;
      padding: 0;
      border-radius: 12px;
      border: 1px solid var(--line);
      background: #fff;
      flex-shrink: 0;
      touch-action: manipulation;
      color: var(--text);
    }
    .icon-action-btn:hover { background: #f8fafc; }
    .icon-action-btn:active { transform: scale(0.97); }
    .top-actions {
      display: inline-flex;
      align-items: center;
      gap: 6px;
      flex-shrink: 0;
      margin-left: auto;
      position: relative;
    }
    .reload-top-btn {
      position: relative;
      overflow: visible;
      border-color: rgba(180, 134, 11, 0.28);
      background: linear-gradient(155deg, #fffef9 0%, #ffffff 52%, #fffbeb 100%);
      box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05), inset 0 1px 0 rgba(255, 255, 255, 0.9);
      transition: border-color 0.25s ease, box-shadow 0.25s ease, transform 0.18s ease;
    }
    .reload-top-btn:hover {
      background: linear-gradient(155deg, #fffdf5 0%, #ffffff 52%, #fef3c7 100%);
      border-color: rgba(180, 134, 11, 0.42);
      box-shadow: 0 4px 14px rgba(180, 134, 11, 0.12);
    }
    .reload-top-btn__aura {
      position: absolute;
      inset: -4px;
      border-radius: 16px;
      border: 2px solid rgba(251, 191, 36, 0.55);
      opacity: 0;
      pointer-events: none;
    }
    .reload-top-btn__icon {
      transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
    }
    .reload-top-btn.is-refreshing {
      border-color: rgba(217, 119, 6, 0.45);
      box-shadow: 0 0 0 1px rgba(251, 191, 36, 0.25), 0 8px 22px rgba(217, 119, 6, 0.16);
    }
    .reload-top-btn.is-refreshing .reload-top-btn__icon {
      animation: crmReloadSpin 0.9s cubic-bezier(0.45, 0.05, 0.2, 1) infinite;
      color: #b45309;
    }
    .reload-top-btn.is-refreshing .reload-top-btn__aura {
      animation: crmReloadAura 1.15s ease-out infinite;
    }
    .reload-top-btn.is-done {
      border-color: rgba(34, 197, 94, 0.45);
      background: linear-gradient(155deg, #f0fdf4 0%, #ffffff 60%, #ecfdf5 100%);
      box-shadow: 0 0 0 1px rgba(134, 239, 172, 0.35), 0 6px 18px rgba(34, 197, 94, 0.14);
    }
    .reload-top-btn.is-done .reload-top-btn__icon {
      color: #15803d;
      transform: rotate(360deg);
    }
    @keyframes crmReloadSpin {
      to { transform: rotate(360deg); }
    }
    @keyframes crmReloadAura {
      0% { opacity: 0.75; transform: scale(0.92); }
      100% { opacity: 0; transform: scale(1.28); }
    }
    .reload-top-status {
      position: absolute;
      right: 0;
      top: calc(100% + 6px);
      z-index: 30;
      padding: 5px 10px;
      border-radius: 999px;
      font-size: 11px;
      font-weight: 700;
      letter-spacing: 0.02em;
      color: #92400e;
      background: #fffbeb;
      border: 1px solid #fde68a;
      box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
      opacity: 0;
      transform: translateY(-4px) scale(0.96);
      pointer-events: none;
      transition: opacity 0.22s ease, transform 0.22s ease;
      white-space: nowrap;
    }
    .reload-top-status.is-visible {
      opacity: 1;
      transform: translateY(0) scale(1);
    }
    .reload-top-status.is-ok {
      color: #166534;
      background: #ecfdf5;
      border-color: #86efac;
    }
    .reload-top-status.is-err {
      color: #991b1b;
      background: #fff1f2;
      border-color: #fecaca;
    }
    .stage-filter-top[hidden] { display: none !important; }
    .composer-send-btn {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      gap: 8px;
      flex: 1 1 auto;
      min-width: 0;
      min-height: 44px;
      padding: 10px 14px;
      border-radius: 12px;
      font-weight: 700;
      touch-action: manipulation;
    }
    .composer-main-row .composer-send-btn {
      flex: 0 0 auto;
      min-width: unset;
    }
    .composer-send-btn .crm-icon-send { width: 18px; height: 18px; }

    .layout {
      display: grid;
      grid-template-columns: minmax(0, 0.85fr) minmax(0, 2.15fr);
      gap: 12px;
      padding: 10px clamp(8px, 2vw, 20px) 0;
      align-items: start;
      width: 100%;
      box-sizing: border-box;
    }
    .layout-left-col {
      display: flex;
      flex-direction: column;
      gap: 12px;
      min-width: 0;
    }
    .layout-right-col {
      display: flex;
      flex-direction: column;
      gap: 12px;
      min-width: 0;
    }
    .funnel-board-wrap {
      padding: 14px clamp(12px, 2vw, 22px) 18px;
      width: 100%;
      box-sizing: border-box;
      overflow: visible;
      border-radius: 22px;
      border: 1px solid rgba(148, 163, 184, 0.28);
      background:
        radial-gradient(120% 90% at 8% -20%, rgba(99, 102, 241, 0.14), transparent 58%),
        radial-gradient(90% 80% at 98% -10%, rgba(16, 185, 129, 0.12), transparent 52%),
        linear-gradient(180deg, #eef2ff 0%, #f8fafc 42%, #ffffff 100%);
      box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
    }
    .panel-funnel-board {
      min-width: 0;
      overflow: visible;
      background: rgba(255, 255, 255, 0.58);
      backdrop-filter: blur(18px);
      -webkit-backdrop-filter: blur(18px);
      border: 1px solid rgba(255, 255, 255, 0.82);
      border-radius: 20px;
      box-shadow:
        0 28px 70px rgba(15, 23, 42, 0.11),
        inset 0 1px 0 rgba(255, 255, 255, 0.95);
    }
    .panel-funnel-board .panel-body {
      padding: 12px clamp(10px, 2vw, 16px) 16px;
      overflow: visible;
    }
    .funnel-board-full .board.board-desktop {
      display: flex !important;
      flex-wrap: nowrap;
      align-items: stretch;
      gap: 14px;
      margin-top: 0;
      overflow-x: auto;
      overflow-y: visible;
      padding: 10px 8px 14px;
      scroll-padding-inline: 12px;
      -webkit-overflow-scrolling: touch;
      scrollbar-width: thin;
    }
    .funnel-board-full .board.board-desktop .col {
      flex: 0 0 224px;
      width: 224px;
      max-width: min(224px, 48vw);
      scroll-snap-align: start;
      min-height: 220px;
    }
    .funnel-board-full .board.board-desktop {
      scroll-snap-type: x proximity;
    }
    .funnel-board-full .col-leads {
      max-height: min(68vh, 780px);
      overflow-y: auto;
      -webkit-overflow-scrolling: touch;
    }
    .panel-funnel-sidebar .panel-body { padding-bottom: 10px; }
    .panel-funnel-sidebar .stats {
      grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .panel.panel-tasks-in-left {
      flex: 1 1 auto;
      min-height: 0;
    }
    .panel.panel-tasks-in-left .panel-body,
    .panel.panel-tasks-in-left .tasks-panel-body {
      max-height: min(42vh, 420px);
      overflow-y: auto;
    }
    .panel.panel-tasks-compact {
      border-color: rgba(139, 92, 246, 0.35);
      box-shadow: 0 10px 32px rgba(109, 40, 217, 0.08);
      overflow: hidden;
      position: relative;
      transition: border-color 0.25s ease, box-shadow 0.25s ease;
    }
    .panel.panel-tasks-compact.panel-tasks--active {
      border-color: rgba(124, 58, 237, 0.55);
      box-shadow: 0 12px 36px rgba(109, 40, 217, 0.14);
    }
    .panel.panel-tasks-compact.panel-tasks--overdue {
      border-color: rgba(239, 68, 68, 0.45);
      box-shadow: 0 12px 36px rgba(220, 38, 38, 0.12);
      animation: tasksPanelOverduePulse 2.8s ease-in-out infinite;
    }
    .panel.panel-tasks-compact.panel-tasks--today {
      border-color: rgba(245, 158, 11, 0.5);
      box-shadow: 0 12px 36px rgba(217, 119, 6, 0.12);
    }
    @keyframes tasksPanelOverduePulse {
      0%, 100% { box-shadow: 0 12px 36px rgba(220, 38, 38, 0.12); }
      50% { box-shadow: 0 12px 40px rgba(220, 38, 38, 0.22); }
    }
    .panel.panel-tasks-compact .panel-head { display: none; }
    .panel.panel-funnel { min-width: 0; max-width: 100%; }
    .panel.panel-tasks {
      min-width: 0;
      border-color: #c4b5fd;
      box-shadow: 0 10px 32px rgba(109, 40, 217, 0.06);
    }
    .panel.panel-tasks .panel-head {
      background: linear-gradient(90deg, #f5f3ff 0%, #fff 55%);
      border-radius: 14px 14px 0 0;
    }
    .panel { background: var(--card); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); }
    .panel.panel-comms {
      min-width: 0;
      max-width: 100%;
      width: 100%;
      border-color: #a5b4fc;
      box-shadow: 0 14px 44px rgba(79, 70, 229, 0.09);
    }
    .panel.panel-comms .panel-head {
      background: linear-gradient(90deg, #eef2ff 0%, #fff 55%);
      border-radius: 14px 14px 0 0;
    }
    .panel-head {
      padding: 12px 14px;
      border-bottom: 1px solid var(--line);
      display: flex;
      align-items: center;
      gap: 10px;
      justify-content: space-between;
    }
    .panel-head.funnel-panel-head .title {
      min-width: 0;
      flex: 1 1 auto;
    }
    .panel-head.funnel-panel-head-lead-only {
      padding: 10px 12px;
      border-bottom: none;
      background: transparent;
    }
    .panel-head.funnel-panel-head { flex-wrap: wrap; align-items: flex-start; }
    .funnel-help {
      margin: 0 0 12px;
      border: 1px solid var(--line);
      border-radius: 10px;
      background: #fafbfc;
      overflow: hidden;
      width: 100%;
      max-width: 100%;
      min-width: 0;
      box-sizing: border-box;
    }
    .funnel-help summary {
      list-style: none;
      cursor: pointer;
      padding: 10px 12px;
      font-size: 13px;
      font-weight: 700;
      color: var(--text);
    }
    .funnel-help summary::-webkit-details-marker { display: none; }
    .funnel-help-body {
      padding: 0 12px 12px;
      font-size: 13px;
      line-height: 1.55;
      color: var(--muted);
      max-width: 100%;
      overflow-wrap: anywhere;
      word-break: break-word;
    }
    .funnel-rules-help { margin-top: 6px; border-color: #fde68a; background: #fffdf4; }
    .funnel-rules-help summary { color: #92400e; }
    .funnel-rules-list {
      margin: 0;
      padding-left: 1.15rem;
      display: flex;
      flex-direction: column;
      gap: 8px;
      max-width: 100%;
    }
    .funnel-rules-list li {
      color: var(--text);
      overflow-wrap: anywhere;
      word-break: break-word;
    }
    .funnel-rules-list li strong { color: #0f172a; }
    .panel-body { padding: 12px clamp(8px, 1.5vw, 14px); max-width: 100%; overflow-x: hidden; }
    .panel-funnel .panel-body { overflow-x: clip; }
    .title { margin: 0; font-size: 17px; }
    .muted { color: var(--muted); }

    .stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
    .stat { background: #fffdf4; border: 1px solid #fef3c7; border-radius: 12px; padding: 10px; }
    .stat b { font-size: 20px; display: block; }
    .toolbar { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }

    .board { gap: 10px; padding-bottom: 6px; margin-top: 12px; width: 100%; max-width: 100%; box-sizing: border-box; }
    .board.board-desktop {
      display: grid !important;
      grid-template-columns: repeat(auto-fit, minmax(min(140px, 100%), 1fr));
      width: 100%;
      max-width: 100%;
      overflow: visible;
    }
    .col {
      display: flex;
      flex-direction: column;
      min-width: 0;
      background: linear-gradient(165deg, rgba(255, 255, 255, 0.96) 0%, rgba(255, 255, 255, 0.9) 100%);
      border: 1.5px solid rgba(255, 255, 255, 0.65);
      border-radius: 18px;
      padding: 0;
      overflow: visible;
      position: relative;
      isolation: isolate;
      backdrop-filter: blur(10px);
      -webkit-backdrop-filter: blur(10px);
      box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.98),
        0 10px 32px rgba(15, 23, 42, 0.09),
        0 0 0 1px rgba(15, 23, 42, 0.04);
      transition: border-color 0.14s ease, box-shadow 0.14s ease, transform 0.14s ease;
      --funnel-accent: #64748b;
      --funnel-accent-soft: rgba(100, 116, 139, 0.14);
      --funnel-accent-glow: rgba(100, 116, 139, 0.32);
    }
    .col::before {
      content: "";
      position: absolute;
      inset: -3px;
      border-radius: 21px;
      background: radial-gradient(ellipse 130% 90% at 50% -12%, var(--funnel-accent-glow), transparent 74%);
      opacity: 0.85;
      filter: blur(12px);
      z-index: -1;
      pointer-events: none;
    }
    .col.col-drag-over {
      border-color: color-mix(in srgb, var(--funnel-accent) 65%, #fff);
      transform: scale(1.02) translateY(-2px);
      animation: funnelColDropPulse 0.85s ease-in-out infinite;
    }
    @keyframes funnelColDropPulse {
      0%, 100% {
        box-shadow:
          inset 0 1px 0 rgba(255, 255, 255, 1),
          0 0 0 3px color-mix(in srgb, var(--funnel-accent) 45%, transparent),
          0 12px 36px var(--funnel-accent-soft),
          0 0 48px var(--funnel-accent-glow);
      }
      50% {
        box-shadow:
          inset 0 1px 0 rgba(255, 255, 255, 1),
          0 0 0 4px color-mix(in srgb, var(--funnel-accent) 58%, transparent),
          0 18px 44px var(--funnel-accent-soft),
          0 0 64px var(--funnel-accent-glow);
      }
    }
    .col-head {
      display: grid;
      grid-template-columns: auto 1fr auto;
      align-items: center;
      gap: 8px;
      padding: 13px 13px 11px;
      border-bottom: 1px solid rgba(15, 23, 42, 0.07);
      border-radius: 16px 16px 0 0;
      flex-shrink: 0;
      position: relative;
      overflow: hidden;
    }
    .col-head::after {
      content: "";
      position: absolute;
      top: 0;
      left: 0;
      right: 0;
      height: 4px;
      background: linear-gradient(90deg, var(--funnel-accent), color-mix(in srgb, var(--funnel-accent) 28%, transparent));
      box-shadow: 0 0 18px var(--funnel-accent-glow);
    }
    .col-head-accent {
      width: 11px;
      height: 11px;
      border-radius: 50%;
      background: var(--funnel-accent);
      box-shadow: 0 0 12px var(--funnel-accent-glow);
      flex-shrink: 0;
    }
    .col-head-title {
      font-size: 12px;
      font-weight: 800;
      text-transform: uppercase;
      letter-spacing: 0.08em;
      line-height: 1.25;
      min-width: 0;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
      color: #0f172a;
      text-shadow: 0 1px 0 rgba(255, 255, 255, 0.75);
    }
    .col-head-count {
      flex-shrink: 0;
      min-width: 32px;
      height: 32px;
      padding: 0 10px;
      display: grid;
      place-items: center;
      border-radius: 999px;
      font-size: 13px;
      font-weight: 800;
      line-height: 1;
      background: rgba(255, 255, 255, 0.92);
      border: 1.5px solid rgba(15, 23, 42, 0.08);
      color: #1e293b;
      box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.95),
        0 2px 8px rgba(15, 23, 42, 0.07);
    }
    .col-leads {
      padding: 10px;
      flex: 1 1 auto;
      min-height: 0;
      background: linear-gradient(180deg, color-mix(in srgb, var(--funnel-accent-soft) 85%, transparent) 0%, transparent 36%);
    }
    .col-drop-hint {
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      gap: 6px;
      min-height: 88px;
      padding: 14px 12px;
      border-radius: 14px;
      border: 2px dashed color-mix(in srgb, var(--funnel-accent) 48%, #cbd5e1);
      background: color-mix(in srgb, var(--funnel-accent-soft) 72%, #fff);
      color: color-mix(in srgb, var(--funnel-accent) 82%, #1e293b);
      font-size: 12px;
      font-weight: 800;
      line-height: 1.35;
      text-align: center;
      letter-spacing: 0.02em;
      box-shadow: inset 0 0 28px var(--funnel-accent-soft);
    }
    .col-drop-hint::before {
      content: "↔";
      font-size: 18px;
      line-height: 1;
      opacity: 0.75;
    }
    .col h3 { margin: 0 0 8px; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; font-weight: 800; }
    /* Важность этапов: продажа / клиент думает — ярко; первичный контакт — мягче; новый — нейтральнее; закрытые — приглушены */
    .col.tier-sale {
      --funnel-accent: #059669;
      --funnel-accent-soft: rgba(16, 185, 129, 0.2);
      --funnel-accent-glow: rgba(52, 211, 153, 0.5);
      border-color: color-mix(in srgb, #34d399 55%, #fff);
      background: linear-gradient(168deg, #ecfdf5 0%, #ffffff 42%);
      box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.98),
        0 0 0 1px rgba(52, 211, 153, 0.28),
        0 10px 34px rgba(16, 185, 129, 0.24),
        0 0 42px rgba(52, 211, 153, 0.14);
    }
    .col.tier-sale .col-head {
      background: linear-gradient(180deg, rgba(167, 243, 208, 0.98) 0%, rgba(236, 253, 245, 0.78) 100%);
      border-bottom-color: rgba(52, 211, 153, 0.34);
    }
    .col.tier-sale .col-head-title { color: #065f46; }
    .col.tier-sale .col-head-count { background: #d1fae5; border-color: #6ee7b7; color: #065f46; box-shadow: 0 0 14px rgba(52, 211, 153, 0.28); }
    .col.tier-thinking {
      --funnel-accent: #ea580c;
      --funnel-accent-soft: rgba(251, 146, 60, 0.2);
      --funnel-accent-glow: rgba(251, 146, 60, 0.48);
      border-color: color-mix(in srgb, #fb923c 55%, #fff);
      background: linear-gradient(168deg, #fff7ed 0%, #ffffff 42%);
      box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.98),
        0 0 0 1px rgba(251, 146, 60, 0.28),
        0 10px 34px rgba(234, 88, 12, 0.22),
        0 0 42px rgba(251, 146, 60, 0.14);
    }
    .col.tier-thinking .col-head {
      background: linear-gradient(180deg, rgba(254, 215, 170, 0.98) 0%, rgba(255, 247, 237, 0.78) 100%);
      border-bottom-color: rgba(251, 146, 60, 0.34);
    }
    .col.tier-thinking .col-head-title { color: #9a3412; }
    .col.tier-thinking .col-head-count { background: #ffedd5; border-color: #fdba74; color: #9a3412; box-shadow: 0 0 14px rgba(251, 146, 60, 0.26); }
    .col.tier-contact {
      --funnel-accent: #d97706;
      --funnel-accent-soft: rgba(251, 191, 36, 0.22);
      --funnel-accent-glow: rgba(251, 191, 36, 0.46);
      border-color: color-mix(in srgb, #fbbf24 55%, #fff);
      background: linear-gradient(168deg, #fffbeb 0%, #ffffff 44%);
      box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.98),
        0 0 0 1px rgba(251, 191, 36, 0.26),
        0 10px 32px rgba(217, 119, 6, 0.2),
        0 0 40px rgba(251, 191, 36, 0.13);
    }
    .col.tier-contact .col-head {
      background: linear-gradient(180deg, rgba(253, 230, 138, 0.98) 0%, rgba(255, 251, 235, 0.78) 100%);
      border-bottom-color: rgba(251, 191, 36, 0.34);
    }
    .col.tier-contact .col-head-title { color: #92400e; }
    .col.tier-contact .col-head-count { background: #fef3c7; border-color: #fcd34d; color: #92400e; box-shadow: 0 0 14px rgba(251, 191, 36, 0.24); }
    .col.tier-new {
      --funnel-accent: #475569;
      --funnel-accent-soft: rgba(100, 116, 139, 0.14);
      --funnel-accent-glow: rgba(100, 116, 139, 0.26);
      border-color: color-mix(in srgb, #94a3b8 45%, #fff);
      background: linear-gradient(168deg, #f8fafc 0%, #ffffff 46%);
      box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.98),
        0 0 0 1px rgba(148, 163, 184, 0.22),
        0 8px 28px rgba(100, 116, 139, 0.14);
    }
    .col.tier-new .col-head {
      background: linear-gradient(180deg, #e2e8f0 0%, rgba(248, 250, 252, 0.82) 100%);
      border-bottom-color: #cbd5e1;
    }
    .col.tier-new .col-head-title { color: #334155; font-weight: 800; }
    .col.tier-new .col-head-count { background: #fff; border-color: #cbd5e1; color: #475569; }
    .col.tier-closed {
      --funnel-accent: #64748b;
      --funnel-accent-soft: rgba(100, 116, 139, 0.12);
      --funnel-accent-glow: rgba(100, 116, 139, 0.22);
      border-color: color-mix(in srgb, #94a3b8 40%, #fff);
      background: linear-gradient(168deg, #f1f5f9 0%, #ffffff 46%);
      box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.95), 0 6px 22px rgba(100, 116, 139, 0.12);
      opacity: 0.98;
    }
    .col.tier-closed .col-head {
      background: linear-gradient(180deg, #cbd5e1 0%, rgba(241, 245, 249, 0.72) 100%);
      border-bottom-color: #94a3b8;
    }
    .col.tier-closed .col-head-title { color: #475569; font-weight: 700; }
    .col.tier-closed .col-head-count { background: #f8fafc; border-color: #cbd5e1; color: #64748b; }
    .strip-pill.tier-sale {
      background: linear-gradient(180deg, #a7f3d0, #ecfdf5);
      border-color: #34d399;
      color: #065f46;
      box-shadow: 0 2px 12px rgba(52, 211, 153, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.55);
    }
    .strip-pill.tier-thinking {
      background: linear-gradient(180deg, #fdba74, #fff7ed);
      border-color: #fb923c;
      color: #9a3412;
      box-shadow: 0 2px 12px rgba(251, 146, 60, 0.26), inset 0 1px 0 rgba(255, 255, 255, 0.55);
    }
    .strip-pill.tier-contact {
      background: linear-gradient(180deg, #fde047, #fffbeb);
      border-color: #fbbf24;
      color: #92400e;
      box-shadow: 0 2px 12px rgba(251, 191, 36, 0.24), inset 0 1px 0 rgba(255, 255, 255, 0.55);
    }
    .strip-pill.tier-new {
      background: linear-gradient(180deg, #e2e8f0, #f8fafc);
      border-color: #94a3b8;
      color: #334155;
      box-shadow: 0 2px 10px rgba(100, 116, 139, 0.16);
    }
    .strip-pill.tier-closed {
      background: linear-gradient(180deg, #cbd5e1, #f1f5f9);
      border-color: #94a3b8;
      color: #475569;
      box-shadow: 0 2px 10px rgba(100, 116, 139, 0.14);
    }
    .strip-pill.active.tier-sale { box-shadow: 0 0 0 2px #34d399, 0 4px 18px rgba(52, 211, 153, 0.38); }
    .strip-pill.active.tier-thinking { box-shadow: 0 0 0 2px #fb923c, 0 4px 18px rgba(251, 146, 60, 0.36); }
    .strip-pill.active.tier-contact { box-shadow: 0 0 0 2px #fbbf24, 0 4px 18px rgba(251, 191, 36, 0.34); }

    details.new-lead-details {
      width: 100%;
      margin: 0;
      border: none;
      border-radius: 14px;
      background: transparent;
      overflow: visible;
    }
    summary.new-lead-trigger {
      list-style: none;
      cursor: pointer;
      display: flex;
      align-items: center;
      gap: 12px;
      width: 100%;
      padding: 11px 14px;
      border-radius: 14px;
      border: 1px solid rgba(180, 130, 0, 0.28);
      background: linear-gradient(135deg, #fff9e0 0%, #f7c948 42%, #e9b414 100%);
      box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.55) inset,
        0 4px 16px rgba(233, 180, 20, 0.28),
        0 1px 2px rgba(15, 23, 42, 0.06);
      color: #5c3d0a;
      transition: transform 0.14s ease, box-shadow 0.14s ease, filter 0.14s ease;
      user-select: none;
      touch-action: manipulation;
    }
    summary.new-lead-trigger::-webkit-details-marker { display: none; }
    summary.new-lead-trigger:hover {
      filter: brightness(1.03);
      box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.6) inset,
        0 6px 22px rgba(233, 180, 20, 0.36),
        0 2px 4px rgba(15, 23, 42, 0.08);
    }
    summary.new-lead-trigger:active { transform: scale(0.985); }
    details.new-lead-details[open] summary.new-lead-trigger {
      border-radius: 14px 14px 0 0;
      border-bottom-color: rgba(180, 130, 0, 0.2);
      box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.5) inset,
        0 2px 10px rgba(233, 180, 20, 0.22);
    }
    .new-lead-trigger-icon {
      flex: 0 0 auto;
      width: 36px;
      height: 36px;
      border-radius: 11px;
      display: grid;
      place-items: center;
      background: rgba(255, 255, 255, 0.42);
      border: 1px solid rgba(255, 255, 255, 0.55);
      color: #78350f;
      box-shadow: 0 1px 3px rgba(120, 53, 15, 0.12);
    }
    .new-lead-trigger-text {
      flex: 1 1 auto;
      min-width: 0;
      display: flex;
      flex-direction: column;
      gap: 1px;
      text-align: left;
    }
    .new-lead-trigger-text strong {
      font-size: 15px;
      font-weight: 800;
      letter-spacing: -0.01em;
      line-height: 1.15;
      color: #422006;
    }
    .new-lead-trigger-text small {
      font-size: 11px;
      font-weight: 600;
      color: rgba(66, 32, 6, 0.72);
      line-height: 1.2;
    }
    .new-lead-trigger-chevron {
      flex: 0 0 auto;
      width: 8px;
      height: 8px;
      border-right: 2px solid rgba(66, 32, 6, 0.55);
      border-bottom: 2px solid rgba(66, 32, 6, 0.55);
      transform: rotate(45deg) translateY(-2px);
      transition: transform 0.18s ease;
      margin-right: 4px;
    }
    details.new-lead-details[open] .new-lead-trigger-chevron {
      transform: rotate(-135deg) translateY(2px);
    }
    details.new-lead-details[open] .new-lead-body {
      border: 1px solid rgba(180, 130, 0, 0.22);
      border-top: none;
      border-radius: 0 0 14px 14px;
      background: linear-gradient(180deg, #fffdf5 0%, #ffffff 100%);
      box-shadow: 0 8px 20px rgba(233, 180, 20, 0.12);
    }
    .new-lead-body { padding: 12px 14px 14px; display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; }
    .new-lead-body .lead-input-lg { min-width: 220px; flex: 1 1 220px; }
    .btn-gold-primary,
    .new-lead-body .btn-gold-primary {
      font-weight: 800;
      min-height: 42px;
      padding: 10px 18px;
      border-radius: 12px;
      color: #422006;
      border: 1px solid rgba(180, 130, 0, 0.32);
      background: linear-gradient(135deg, #fff9e0 0%, #f7c948 46%, #e9b414 100%);
      box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.5) inset,
        0 4px 14px rgba(233, 180, 20, 0.3);
      transition: filter 0.14s ease, transform 0.12s ease, box-shadow 0.14s ease;
    }
    .btn-gold-primary:hover,
    .new-lead-body .btn-gold-primary:hover {
      filter: brightness(1.04);
      box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.55) inset,
        0 6px 18px rgba(233, 180, 20, 0.38);
    }
    .btn-gold-primary:active,
    .new-lead-body .btn-gold-primary:active { transform: scale(0.985); }
    .new-lead-hint {
      width: 100%;
      margin-top: 2px;
      font-size: 12px;
      color: #475569;
      display: flex;
      flex-wrap: wrap;
      align-items: center;
      gap: 8px;
      line-height: 1.35;
    }
    .messenger-chip {
      display: inline-flex;
      align-items: center;
      border-radius: 999px;
      padding: 3px 9px;
      font-size: 11px;
      font-weight: 700;
      border: 1px solid #cbd5e1;
      background: #f8fafc;
      color: #475569;
    }
    .messenger-chip.ok {
      border-color: #22c55e;
      background: #ecfdf5;
      color: #166534;
    }
    .messenger-chip.no {
      border-color: #f1f5f9;
      background: #f8fafc;
      color: #94a3b8;
    }
    .messenger-chip.ready {
      border-color: #bfdbfe;
      background: #eff6ff;
      color: #1d4ed8;
    }

    .ru-phone-wrap {
      display: flex;
      align-items: center;
      gap: 8px;
      padding: 0 12px;
      border: 1px solid #cbd5e1;
      border-radius: 10px;
      background: #fff;
      min-height: 42px;
      box-sizing: border-box;
    }
    .ru-phone-wrap:focus-within {
      border-color: #f7c948;
      box-shadow: 0 0 0 2px rgba(247, 201, 72, 0.25);
    }
    .ru-phone-prefix {
      font-weight: 700;
      color: #334155;
      flex-shrink: 0;
      user-select: none;
    }
    .ru-phone-wrap input {
      border: none;
      outline: none;
      background: transparent;
      flex: 1;
      min-width: 0;
      font-size: 15px;
      padding: 10px 0;
    }
    .lead-field .ru-phone-wrap {
      width: 100%;
      margin-top: 4px;
    }

    .new-lead-channel-pick {
      width: 100%;
      display: grid;
      gap: 8px;
    }
    .new-lead-channel-label {
      font-size: 12px;
      font-weight: 700;
      color: #475569;
    }
    .new-lead-channel-btns,
    .lead-drawer-channels {
      display: flex;
      gap: 8px;
      flex-wrap: wrap;
    }
    .new-lead-ch-btn,
    .lead-ch-btn {
      flex: 1 1 120px;
      min-height: 42px;
      border-radius: 10px;
      border: 1px solid #cbd5e1;
      background: #fff;
      color: #334155;
      font-weight: 700;
      font-size: 13px;
      cursor: pointer;
      transition: 0.15s;
    }
    .new-lead-ch-btn:hover,
    .lead-ch-btn:hover:not(:disabled) {
      border-color: #94a3b8;
      background: #f8fafc;
    }
    .new-lead-ch-btn.active,
    .lead-ch-btn.active {
      border-color: #22c55e;
      background: #ecfdf5;
      color: #166534;
      box-shadow: 0 0 0 1px rgba(34, 197, 94, 0.25);
    }
    .lead-ch-btn:disabled {
      opacity: 0.45;
      cursor: not-allowed;
    }
    .lead-messenger-status-row {
      display: flex;
      flex-wrap: wrap;
      gap: 8px;
    }
    .comms-capability-banner {
      width: 100%;
      margin-top: 8px;
      padding: 8px 10px;
      border-radius: 8px;
      background: #fff7ed;
      border: 1px solid #fdba74;
      color: #9a3412;
      font-size: 12px;
      line-height: 1.4;
      font-weight: 600;
    }

    .lead-pool-panel {
      margin-top: 12px;
      padding: 12px 14px;
      border-radius: 12px;
      border: 1px solid #e2e8f0;
      background: #fff;
    }
    .lead-pool-panel.has-items {
      border-color: #86efac;
      background: linear-gradient(135deg, #f0fdf4 0%, #fff 100%);
    }
    .lead-pool-head {
      display: flex;
      align-items: center;
      gap: 8px;
      margin-bottom: 6px;
    }
    .lead-pool-head h4 { margin: 0; font-size: 13px; color: #334155; }
    .lead-pool-count {
      font-size: 11px;
      font-weight: 800;
      line-height: 1;
      padding: 4px 8px;
      border-radius: 999px;
      background: #16a34a;
      color: #fff;
    }
    .lead-pool-hint { margin: 0 0 10px; font-size: 12px; line-height: 1.5; }
    .lead-pool-list {
      display: grid;
      gap: 8px;
      max-height: calc(3 * 72px + 2 * 8px);
      overflow-y: auto;
      -webkit-overflow-scrolling: touch;
      overscroll-behavior: contain;
      padding-right: 2px;
    }
    .lead-pool-item {
      display: flex;
      align-items: center;
      gap: 10px;
      justify-content: space-between;
      padding: 8px 10px;
      border-radius: 10px;
      border: 1px solid #e2e8f0;
      background: #f8fafc;
    }
    .lead-pool-item-main { min-width: 0; flex: 1; }
    .lead-pool-item-name { display: block; font-size: 14px; margin-bottom: 2px; }
    .lead-pool-item-summary { font-size: 12px; line-height: 1.35; margin-bottom: 2px; color: #475569; }
    .lead-pool-item-meta { font-size: 11px; line-height: 1.4; }
    .lead-pool-claim-btn {
      flex-shrink: 0;
      font-size: 12px;
      padding: 8px 12px;
      white-space: nowrap;
    }
    .lead-pool-empty { margin: 0; font-size: 12px; }
    .lead-pool-error { color: #b45309; }
    .lead-pool-retry-btn { margin-left: 6px; font-size: 11px; padding: 2px 8px; }
    .funnel-tools {
      display: flex;
      flex-wrap: wrap;
      gap: 10px 16px;
      align-items: center;
      margin-bottom: 10px;
      font-size: 13px;
    }
    .funnel-check { display: inline-flex; align-items: center; gap: 7px; cursor: pointer; user-select: none; font-weight: 600; }
    .col-more-btn {
      width: 100%;
      margin-top: 6px;
      padding: 8px;
      font-size: 12px;
      border-radius: 8px;
      border: 1px dashed var(--line);
      background: #f8fafc;
      cursor: pointer;
    }
    .lead {
      position: relative;
      background: rgba(255, 255, 255, 0.96);
      border: 1.5px solid rgba(15, 23, 42, 0.07);
      border-left-width: 5px;
      border-left-color: #cbd5e1;
      border-radius: 14px;
      padding: 0;
      margin-bottom: 10px;
      cursor: grab;
      box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 1),
        0 3px 12px rgba(15, 23, 42, 0.07);
      transition: box-shadow 0.14s ease, transform 0.14s ease, border-color 0.14s ease;
    }
    .lead-body {
      padding: 11px 30px 10px 11px;
      min-width: 0;
    }
    .lead-grip {
      position: absolute;
      right: 8px;
      top: 50%;
      transform: translateY(-50%);
      width: 14px;
      height: 22px;
      opacity: 0.28;
      background:
        radial-gradient(circle, #64748b 1.5px, transparent 1.6px) 0 3px / 14px 7px,
        radial-gradient(circle, #64748b 1.5px, transparent 1.6px) 0 12px / 14px 7px;
      pointer-events: none;
      transition: opacity 0.14s ease;
    }
    .lead:hover .lead-grip { opacity: 0.55; }
    .lead:active { cursor: grabbing; }
    .lead:hover {
      transform: translateY(-2px);
      box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 1),
        0 10px 26px rgba(15, 23, 42, 0.12);
    }
    .lead.lead-dragging {
      opacity: 0.78;
      transform: scale(1.04) rotate(-1.2deg);
      box-shadow:
        0 18px 44px rgba(15, 23, 42, 0.22),
        0 0 0 2px rgba(247, 201, 72, 0.55);
      z-index: 3;
    }
    .lead.lead-dragging .lead-grip { opacity: 0.7; }
    .lead.tier-sale {
      border-left-color: #10b981;
      background: linear-gradient(135deg, rgba(255, 255, 255, 0.98) 0%, rgba(240, 253, 244, 0.95) 100%);
      box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 1),
        0 4px 14px rgba(16, 185, 129, 0.14);
    }
    .lead.tier-sale:hover {
      box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 1),
        0 10px 28px rgba(16, 185, 129, 0.28),
        0 0 0 1px rgba(16, 185, 129, 0.14);
    }
    .lead.tier-thinking {
      border-left-color: #ea580c;
      background: linear-gradient(135deg, rgba(255, 255, 255, 0.98) 0%, rgba(255, 247, 237, 0.95) 100%);
      box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 1),
        0 4px 14px rgba(234, 88, 12, 0.12);
    }
    .lead.tier-thinking:hover {
      box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 1),
        0 10px 28px rgba(234, 88, 12, 0.26),
        0 0 0 1px rgba(234, 88, 12, 0.12);
    }
    .lead.tier-contact {
      border-left-color: #eab308;
      background: linear-gradient(135deg, rgba(255, 255, 255, 0.98) 0%, rgba(255, 251, 235, 0.95) 100%);
      box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 1),
        0 4px 14px rgba(234, 179, 8, 0.12);
    }
    .lead.tier-contact:hover {
      box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 1),
        0 10px 28px rgba(234, 179, 8, 0.26),
        0 0 0 1px rgba(234, 179, 8, 0.12);
    }
    .lead.tier-new {
      border-left-color: #64748b;
      background: linear-gradient(135deg, rgba(255, 255, 255, 0.98) 0%, rgba(248, 250, 252, 0.95) 100%);
    }
    .lead.tier-closed {
      border-left-color: #94a3b8;
      background: linear-gradient(135deg, rgba(255, 255, 255, 0.96) 0%, rgba(241, 245, 249, 0.94) 100%);
      opacity: 0.97;
    }
    .lead .name,
    .lead .lead-name-row,
    .lead .lead-board-name {
      font-weight: 800;
      font-size: 14px;
      line-height: 1.3;
      color: #0f172a;
    }
    .lead .meta {
      font-size: 12px;
      color: #475569;
      margin-top: 5px;
      line-height: 1.4;
      overflow-wrap: anywhere;
      word-break: break-word;
    }
    .lead .meta-id {
      font-size: 11px;
      font-weight: 700;
      color: #64748b;
      letter-spacing: 0.01em;
    }
    .lead .meta-preview {
      color: #1e293b;
      font-weight: 500;
      font-size: 12px;
      line-height: 1.45;
      display: -webkit-box;
      -webkit-line-clamp: 3;
      -webkit-box-orient: vertical;
      overflow: hidden;
    }
    .lead .meta-note {
      color: #334155;
      font-style: normal;
      background: rgba(254, 243, 199, 0.45);
      border-radius: 8px;
      padding: 4px 6px;
      margin-top: 6px;
    }

    /* Переписки: на широком экране — список слева, тред справа (как Telegram Desktop); на узком — столбиком */
    .split { display: grid; grid-template-columns: 1fr; gap: 10px; }
    .panel-comms .split.comms-split { grid-template-columns: 1fr; width: 100%; }
    .panel-comms {
      border: 1.5px solid #cbd5e1;
      box-shadow: 0 1px 0 rgba(15, 23, 42, 0.05);
    }
    .chat-list, .msg-list, .task-list { border: 1.5px solid #cbd5e1; border-radius: 12px; overflow: auto; -webkit-overflow-scrolling: touch; touch-action: manipulation; }
    .chat-list {
      max-height: 260px;
      padding: 4px;
      background: linear-gradient(180deg, #f1f5f9 0%, #ffffff 48%);
      overflow-x: hidden;
      max-width: 100%;
      width: 100%;
      box-sizing: border-box;
    }
    .msg-list {
      max-height: var(--msg-thread-max);
      padding: 8px 6px;
      flex: 0 1 auto;
      min-height: 0;
      width: 100%;
      max-width: 100%;
    }
    .thread-older-hint {
      text-align: center;
      font-size: 12px;
      line-height: 1.35;
      padding: 6px 10px 10px;
      color: var(--muted);
      user-select: none;
    }
    .task-list { max-height: 180px; }
    .chat-item, .task-item { cursor: pointer; touch-action: manipulation; }
    .task-item { padding: 8px 10px; border-bottom: 1px solid var(--line); }
    .task-item:hover { background: #f8fafc; }
    .chat-item {
      display: grid;
      grid-template-columns: 34px minmax(0, 1fr);
      gap: 8px;
      align-items: center;
      padding: 6px 8px;
      margin-bottom: 2px;
      border: 1px solid #e2e8f0;
      border-radius: 10px;
      background: var(--card);
      transition: background 0.12s ease, border-color 0.12s ease;
      min-width: 0;
      max-width: 100%;
      width: 100%;
      box-sizing: border-box;
      overflow: hidden;
    }
    .chat-item:last-child { margin-bottom: 0; }
    .chat-item:hover {
      background: #f8fafc;
      border-color: #e2e8f0;
    }
    .chat-item.active {
      background: #fffbeb;
      border-color: rgba(233, 180, 20, 0.45);
      box-shadow: inset 3px 0 0 var(--yellow-dark);
    }
    .chat-item.unread {
      position: relative;
      background: linear-gradient(90deg, #fff0b3 0%, #fffef8 68%);
      border-color: rgba(217, 119, 6, 0.45);
      box-shadow: inset 0 0 0 1px rgba(251, 191, 36, 0.22);
    }
    .chat-item.unread::before {
      content: "";
      position: absolute;
      left: 0;
      top: 4px;
      bottom: 4px;
      width: 4px;
      border-radius: 0 4px 4px 0;
      background: #d97706;
    }
    .chat-item.unread.active {
      background: linear-gradient(90deg, #ffe082 0%, #fffbeb 58%);
      box-shadow: inset 4px 0 0 #d97706, inset 0 0 0 1px rgba(217, 119, 6, 0.28);
    }
    .chat-item-avatar {
      position: relative;
      flex: 0 0 auto;
      width: 34px;
      height: 34px;
      border-radius: 10px;
      display: grid;
      place-items: center;
      font-weight: 800;
      font-size: 13px;
      color: #fff;
      text-shadow: 0 1px 2px rgba(15, 23, 42, 0.18);
    }
    .chat-item-main {
      min-width: 0;
      max-width: 100%;
      overflow: hidden;
      display: flex;
      flex-direction: column;
      gap: 1px;
    }
    .chat-item-line1 {
      display: flex;
      align-items: center;
      gap: 4px;
      min-width: 0;
      max-width: 100%;
      line-height: 1.15;
    }
    .chat-item-line2 {
      min-width: 0;
      max-width: 100%;
      overflow: hidden;
    }
    .chat-unread-badge {
      flex: 0 0 auto;
      display: inline-flex;
      align-items: center;
      padding: 1px 6px;
      border-radius: 999px;
      font-size: 9px;
      font-weight: 800;
      letter-spacing: 0.04em;
      text-transform: uppercase;
      line-height: 17px;
      color: #7c2d12;
      background: #fbbf24;
      border: 1px solid #f59e0b;
      box-shadow: 0 1px 0 rgba(124, 45, 18, 0.12);
    }
    .chat-item-name {
      flex: 1 1 auto;
      min-width: 0;
      font-weight: 600;
      font-size: 13px;
      line-height: 1.15;
      color: var(--text);
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }
    .chat-item.unread .chat-item-name { font-weight: 800; }
    .chat-item-time {
      flex: 0 0 auto;
      font-size: 10px;
      color: var(--muted);
      white-space: nowrap;
      margin-left: auto;
      line-height: 1.1;
    }
    .chat-item-time.is-unread {
      color: #b45309;
      font-weight: 700;
    }
    .chat-channel-pill {
      flex: 0 0 auto;
      display: inline-flex;
      align-items: center;
      padding: 0 5px;
      border-radius: 4px;
      font-size: 9px;
      font-weight: 700;
      letter-spacing: 0.03em;
      text-transform: uppercase;
      line-height: 16px;
    }
    .chat-channel-pill.tg {
      color: #1e40af;
      background: rgba(29, 78, 216, 0.08);
    }
    .chat-channel-pill.max {
      color: #6d28d9;
      background: rgba(109, 40, 217, 0.08);
    }
    .chat-item-line1 .lead-tags-inline {
      flex: 0 0 auto;
      max-width: 48px;
      overflow: hidden;
    }
    .chat-item-preview {
      display: block;
      font-size: 11px;
      color: var(--muted);
      line-height: 1.2;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
      max-width: 100%;
    }
    .chat-item.unread .chat-item-preview {
      color: #334155;
      font-weight: 600;
    }
    .chat-item.muted {
      display: block;
      padding: 14px 12px;
      text-align: center;
      color: var(--muted);
      background: transparent;
      border: none;
      box-shadow: none;
      margin: 0;
    }

    .comms-search-row {
      display: none;
    }
    .comms-panel-head {
      display: flex;
      flex-wrap: wrap;
      align-items: center;
      gap: 8px 10px;
      padding-bottom: 8px;
      border-bottom: 1.5px solid #cbd5e1;
    }
    .comms-panel-head--filters-only {
      justify-content: flex-end;
      padding: 6px 0 8px;
    }
    .comms-panel-title {
      flex: 1 1 auto;
      min-width: 0;
      margin: 0;
      font-size: 16px;
    }
    .comms-channel-filter {
      display: flex;
      gap: 6px;
      align-items: center;
      flex-wrap: wrap;
      margin-left: auto;
    }
    .comms-filter-btn {
      font-size: 12px;
      padding: 6px 11px;
      min-height: 36px;
    }
    .max-chat-modal-overlay {
      position: fixed;
      inset: 0;
      background: rgba(15, 23, 42, 0.45);
      z-index: 80;
      display: flex;
      align-items: center;
      justify-content: center;
      padding: 16px;
    }
    .max-chat-modal-overlay[hidden] { display: none !important; }
    .max-chat-modal-box {
      background: #fff;
      border-radius: 14px;
      border: 1px solid var(--line);
      max-width: 420px;
      width: 100%;
      padding: 16px 18px;
      box-shadow: 0 20px 50px rgba(15,23,42,.18);
    }
    .max-chat-modal-box h3 { margin: 0 0 12px; font-size: 16px; }
    .max-chat-modal-box label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: #334155; }
    .max-chat-modal-box input { width: 100%; box-sizing: border-box; margin-bottom: 12px; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--line); }

    /* —— Редактирование сообщения (премиум-панель) —— */
    .chat-edit-overlay {
      position: fixed;
      inset: 0;
      z-index: 120;
      display: flex;
      align-items: flex-end;
      justify-content: center;
      padding: 0;
      pointer-events: none;
    }
    .chat-edit-overlay[hidden] { display: none !important; }
    .chat-edit-overlay.chat-edit-visible { pointer-events: auto; }
    .chat-edit-backdrop {
      position: absolute;
      inset: 0;
      background: rgba(12, 14, 18, 0.52);
      backdrop-filter: blur(10px);
      -webkit-backdrop-filter: blur(10px);
      opacity: 0;
      transition: opacity 0.28s ease;
    }
    .chat-edit-overlay.chat-edit-visible .chat-edit-backdrop { opacity: 1; }
    .chat-edit-sheet {
      position: relative;
      z-index: 1;
      width: 100%;
      max-width: 640px;
      margin: 0 auto;
      background: linear-gradient(180deg, #1c1c22 0%, #141418 100%);
      color: #f4f1ea;
      border: 1px solid rgba(201, 169, 98, 0.35);
      border-bottom: none;
      border-radius: 22px 22px 0 0;
      box-shadow:
        0 -8px 40px rgba(0, 0, 0, 0.35),
        0 0 0 1px rgba(255, 255, 255, 0.04) inset;
      transform: translateY(100%);
      transition: transform 0.32s cubic-bezier(0.22, 1, 0.36, 1);
      max-height: min(88vh, 720px);
      display: flex;
      flex-direction: column;
      overflow: hidden;
    }
    .chat-edit-overlay.chat-edit-visible .chat-edit-sheet { transform: translateY(0); }
    .chat-edit-grab {
      width: 40px;
      height: 4px;
      border-radius: 999px;
      background: rgba(255, 255, 255, 0.22);
      margin: 10px auto 0;
      flex-shrink: 0;
    }
    .chat-edit-head {
      display: flex;
      align-items: flex-start;
      justify-content: space-between;
      gap: 12px;
      padding: 14px 18px 10px;
      border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    }
    .chat-edit-kicker {
      margin: 0 0 4px;
      font-size: 11px;
      font-weight: 700;
      letter-spacing: 0.14em;
      text-transform: uppercase;
      color: #c9a962;
    }
    .chat-edit-title {
      margin: 0;
      font-size: 1.15rem;
      font-weight: 600;
      letter-spacing: -0.02em;
      color: #fffaf2;
    }
    .chat-edit-icon-btn {
      width: 40px;
      height: 40px;
      border: 0;
      border-radius: 12px;
      background: rgba(255, 255, 255, 0.08);
      color: #e8e4dc;
      font-size: 22px;
      line-height: 1;
      cursor: pointer;
      flex-shrink: 0;
    }
    .chat-edit-icon-btn:hover { background: rgba(255, 255, 255, 0.14); }
    .chat-edit-body {
      padding: 16px 18px 8px;
      flex: 1 1 auto;
      min-height: 0;
      display: flex;
      flex-direction: column;
      gap: 10px;
    }
    .chat-edit-body textarea {
      width: 100%;
      box-sizing: border-box;
      min-height: 140px;
      max-height: min(50vh, 420px);
      resize: none;
      border: 1px solid rgba(201, 169, 98, 0.28);
      border-radius: 16px;
      padding: 16px 18px;
      font: 17px/1.55 system-ui, -apple-system, "Segoe UI", sans-serif;
      color: #f8f6f2;
      background: rgba(255, 255, 255, 0.06);
      box-shadow: inset 0 2px 12px rgba(0, 0, 0, 0.22);
      outline: none;
      transition: border-color 0.2s ease, box-shadow 0.2s ease;
    }
    .chat-edit-body textarea:focus {
      border-color: rgba(201, 169, 98, 0.65);
      box-shadow:
        inset 0 2px 12px rgba(0, 0, 0, 0.22),
        0 0 0 3px rgba(201, 169, 98, 0.18);
    }
    .chat-edit-body textarea::placeholder { color: rgba(255, 255, 255, 0.35); }
    .chat-edit-body textarea.chat-edit-shake {
      animation: chat-edit-shake 0.38s ease;
    }
    @keyframes chat-edit-shake {
      0%, 100% { transform: translateX(0); }
      20% { transform: translateX(-6px); }
      40% { transform: translateX(6px); }
      60% { transform: translateX(-4px); }
      80% { transform: translateX(4px); }
    }
    .chat-edit-hint {
      margin: 0;
      font-size: 12px;
      color: rgba(255, 255, 255, 0.45);
    }
    .chat-edit-hint kbd {
      display: inline-block;
      padding: 2px 6px;
      border-radius: 6px;
      background: rgba(255, 255, 255, 0.1);
      font: inherit;
      font-size: 11px;
      color: rgba(255, 255, 255, 0.7);
    }
    .chat-edit-foot {
      display: flex;
      gap: 10px;
      justify-content: flex-end;
      padding: 12px 18px calc(16px + env(safe-area-inset-bottom, 0px));
      border-top: 1px solid rgba(255, 255, 255, 0.08);
      background: rgba(0, 0, 0, 0.18);
    }
    .chat-edit-btn {
      min-height: 46px;
      padding: 0 22px;
      border-radius: 14px;
      font-size: 15px;
      font-weight: 600;
      cursor: pointer;
      border: none;
    }
    .chat-edit-btn-ghost {
      background: rgba(255, 255, 255, 0.08);
      color: #e8e4dc;
    }
    .chat-edit-btn-ghost:hover { background: rgba(255, 255, 255, 0.14); }
    .chat-edit-btn-primary {
      background: linear-gradient(135deg, #f0dfb0 0%, #c9a962 55%, #b8944f 100%);
      color: #1a1814;
      box-shadow: 0 4px 18px rgba(201, 169, 98, 0.35);
    }
    .chat-edit-btn-primary:hover { filter: brightness(1.05); }
    .chat-edit-btn-primary:disabled {
      opacity: 0.65;
      cursor: wait;
    }
    body.chat-edit-open { overflow: hidden; }
    @media (min-width: 720px) {
      .chat-edit-overlay {
        align-items: center;
        padding: 24px;
      }
      .chat-edit-sheet {
        border-radius: 22px;
        border-bottom: 1px solid rgba(201, 169, 98, 0.35);
        max-height: min(82vh, 680px);
        transform: translateY(24px) scale(0.96);
        opacity: 0;
        transition:
          transform 0.32s cubic-bezier(0.22, 1, 0.36, 1),
          opacity 0.28s ease;
      }
      .chat-edit-overlay.chat-edit-visible .chat-edit-sheet {
        transform: translateY(0) scale(1);
        opacity: 1;
      }
      .chat-edit-grab { display: none; }
    }

    /* Отметка «контакт вне CRM» */
    .manager-touch-overlay {
      z-index: 101500;
    }
    .manager-touch-overlay .chat-edit-sheet { max-height: min(88vh, 640px); }
    .manager-touch-overlay.manager-touch-visible .chat-edit-backdrop,
    .manager-touch-overlay.chat-edit-visible .chat-edit-backdrop { opacity: 1; }
    .manager-touch-overlay.manager-touch-visible .chat-edit-sheet,
    .manager-touch-overlay.chat-edit-visible .chat-edit-sheet { transform: translateY(0); }
    .manager-touch-counter {
      margin-top: 8px;
      font-size: 12px;
      font-weight: 600;
      color: rgba(255, 255, 255, 0.45);
      text-align: right;
    }
    .manager-touch-counter.is-short { color: #fcd34d; }
    .manager-touch-counter.is-ok { color: #6ee7b7; }
    .manager-touch-success-panel {
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      text-align: center;
      padding: 28px 20px 36px;
      min-height: 220px;
    }
    .manager-touch-success-ring {
      width: 72px;
      height: 72px;
      border-radius: 50%;
      display: grid;
      place-items: center;
      font-size: 32px;
      font-weight: 700;
      color: #065f46;
      background: linear-gradient(145deg, #a7f3d0 0%, #6ee7b7 100%);
      box-shadow: 0 8px 28px rgba(16, 185, 129, 0.35);
      animation: manager-touch-pop 0.45s cubic-bezier(0.22, 1, 0.36, 1);
    }
    .manager-touch-success-panel h4 {
      margin: 18px 0 6px;
      font-size: 20px;
      font-weight: 800;
      color: #f8fafc;
    }
    .manager-touch-success-panel p {
      margin: 0;
      font-size: 13px;
      line-height: 1.45;
      color: rgba(254, 243, 199, 0.82);
      max-width: 280px;
    }
    @keyframes manager-touch-pop {
      0% { transform: scale(0.6); opacity: 0; }
      70% { transform: scale(1.06); }
      100% { transform: scale(1); opacity: 1; }
    }
    body.manager-touch-open { overflow: hidden; }

    .comms-pane { min-width: 0; display: flex; flex-direction: column; gap: 6px; align-self: start; width: 100%; max-width: 100%; }
    .comms-pane.thread-pane { max-width: 100%; }
    .thread-toolbar { flex-shrink: 0; align-items: center; gap: 8px; }
    .comms-back {
      display: none;
      width: 40px;
      height: 40px;
      min-height: 40px;
      margin: 0;
      flex-shrink: 0;
    }
    .thread-body {
      flex: 0 1 auto;
      display: flex;
      flex-direction: column;
      gap: 8px;
      min-height: 0;
      width: 100%;
      max-width: 100%;
    }
    .composer-bar {
      width: 100%;
      display: flex;
      flex-direction: column;
      align-items: stretch;
      box-sizing: border-box;
      position: relative;
      z-index: 2;
      gap: 6px;
      padding-top: 4px;
    }
    .composer-main-row {
      display: flex;
      align-items: center;
      gap: 6px;
      width: 100%;
    }
    .composer-tools-inline {
      display: flex;
      flex-shrink: 0;
      align-items: center;
      gap: 2px;
    }
    .composer-field-wrap {
      flex: 1 1 auto;
      min-width: 0;
    }
    .composer-bar textarea#sendText {
      width: 100%;
      box-sizing: border-box;
      min-height: var(--composer-row-h, 40px);
      height: var(--composer-row-h, 40px);
      max-height: min(32vh, 160px);
      resize: none;
      overflow-y: auto;
      line-height: 20px;
      padding: 9px 14px;
      border-radius: 20px;
      border: 1.5px solid #cbd5e1;
      font: inherit;
      font-size: 16px;
      background: #fff;
      margin: 0;
    }
    .composer-bar textarea#sendText:focus {
      border-color: #94a3b8;
      outline: none;
      box-shadow: 0 0 0 2px rgba(148, 163, 184, 0.2);
    }
    .composer-bar textarea {
      width: 100%;
      box-sizing: border-box;
      margin: 0;
    }
    .composer-send-round {
      flex-shrink: 0;
      width: var(--composer-row-h, 40px);
      height: var(--composer-row-h, 40px);
      min-height: var(--composer-row-h, 40px);
      max-height: var(--composer-row-h, 40px);
      padding: 0;
      border-radius: 50%;
      display: inline-flex;
      align-items: center;
      justify-content: center;
    }
    .composer-send-round .composer-send-label { display: none; }
    @media (min-width: 901px) {
      .composer-send-round {
        width: auto;
        min-width: 44px;
        padding: 0 14px;
        border-radius: 22px;
        gap: 6px;
      }
      .composer-send-round .composer-send-label { display: inline; }
    }
    .composer-tools-inline .composer-tool-btn {
      width: var(--composer-row-h, 40px);
      height: var(--composer-row-h, 40px);
      min-height: var(--composer-row-h, 40px);
      max-height: var(--composer-row-h, 40px);
      border-radius: 50%;
      padding: 0;
    }
    .composer-tools-inline .icon-action-btn.composer-tool-btn {
      min-height: var(--composer-row-h, 40px);
    }
    .msg { border: 1px solid var(--line); border-radius: 10px; padding: 8px; margin-bottom: 8px; background: #fff; }
    .msg.out { border-color: #bfdbfe; background: #eff6ff; }

    .lead-drawer-backdrop {
      position: fixed;
      inset: 0;
      z-index: 45;
      background: rgba(15, 23, 42, 0.42);
      backdrop-filter: blur(2px);
      -webkit-backdrop-filter: blur(2px);
    }
    .lead-drawer-backdrop[hidden] { display: none !important; }

    .lead-drawer {
      position: fixed; top: 0; right: 0; width: min(420px, 100vw); height: 100%; background: #fff; border-left: 1px solid var(--line);
      box-shadow: -8px 0 30px rgba(15,23,42,.1); transform: translateX(100%); transition: transform .22s ease;
      z-index: 50; display: flex; flex-direction: column;
      pointer-events: none;
      visibility: hidden;
    }
    .lead-drawer.open {
      transform: translateX(0);
      pointer-events: auto;
      visibility: visible;
    }
    .lead-drawer-close {
      flex-shrink: 0;
      min-width: 44px;
      min-height: 44px;
      font-size: 18px;
      line-height: 1;
    }
    .drawer-head {
      padding: 14px 16px;
      border-bottom: 1px solid var(--line);
      display: flex;
      align-items: flex-start;
      justify-content: space-between;
      gap: 10px;
      background: linear-gradient(165deg, #fffdf4 0%, #fff 55%);
    }
    .lead-drawer-hero { display: flex; align-items: center; gap: 12px; min-width: 0; flex: 1; }
    .lead-drawer-av {
      width: 44px; height: 44px; border-radius: 14px; flex-shrink: 0;
      background: linear-gradient(145deg, #fde68a, #f7c948);
      color: #78350f; font-weight: 800; font-size: 18px;
      display: flex; align-items: center; justify-content: center;
      box-shadow: 0 4px 12px rgba(247, 201, 72, 0.35);
    }
    .lead-drawer-head-text { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
    .lead-drawer-head-text strong { font-size: 16px; line-height: 1.25; word-break: break-word; }
    .lead-drawer-stage { align-self: flex-start; font-size: 11px !important; padding: 2px 8px !important; }
    .drawer-body { padding: 14px 16px 18px; overflow: auto; flex: 1; min-height: 0; }
    .lead-form-grid { display: grid; gap: 12px; }
    .lead-segment-block {
      display: flex; flex-direction: column; gap: 8px;
      padding: 12px; border-radius: 14px; background: #f8fafc; border: 1px solid #e8eef5;
    }
    .lead-segment-grid {
      display: grid; gap: 10px;
      grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    }
    .lead-field { display: flex; flex-direction: column; gap: 5px; margin: 0; }
    .lead-field-label { font-size: 12px; font-weight: 700; color: #475569; letter-spacing: 0.01em; }
    .lead-field-input, .lead-field textarea, .lead-field select {
      width: 100%; box-sizing: border-box; margin: 0;
      border: 1px solid #dbe4f0; border-radius: 12px; padding: 10px 12px;
      font: inherit; background: #fafbfc; transition: border-color .15s, box-shadow .15s;
    }
    .lead-field-input:focus, .lead-field textarea:focus, .lead-field select:focus {
      outline: none; border-color: #f7c948; background: #fff;
      box-shadow: 0 0 0 3px rgba(247, 201, 72, 0.25);
    }
    .lead-field textarea { min-height: 88px; resize: vertical; }
    .lead-drawer-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
    .lead-drawer-actions .primary { flex: 1 1 120px; min-height: 44px; font-weight: 800; }
    .lead-drawer-actions .danger { min-height: 44px; }
    .lead-drawer-channels { margin-top: 12px; }
    .lead-drawer-meta {
      margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--line);
      font-size: 11px; color: var(--muted); line-height: 1.45;
    }
    .lead-drawer-close-reason {
      margin-top: 10px;
      padding: 10px 12px;
      border-radius: 10px;
      background: #fff7ed;
      border: 1px solid #fed7aa;
      font-size: 13px;
      line-height: 1.45;
      color: #9a3412;
    }
    .lead-drawer-hint {
      margin-top: 10px; padding: 10px 12px; border-radius: 12px;
      background: #f8fafc; border: 1px solid var(--line); font-size: 12px; line-height: 1.45; color: var(--muted);
    }

    .status { margin: 8px 12px 12px; border-radius: 10px; padding: 10px 12px; border: 1px solid #dbeafe; background: #eff6ff; color: #1e3a8a; min-height: 18px; }
    .status.err { border-color: #fecaca; background: #fff1f2; color: #991b1b; }
    .status.ok { border-color: #bbf7d0; background: #ecfdf5; color: #065f46; }

    /* Компактный верх: на телефоне свёрнут по умолчанию */
    details.top-details { background: var(--card); border-bottom: 1px solid var(--line); }
    summary.top-summary {
      display: flex;
      flex-wrap: wrap;
      align-items: center;
      justify-content: flex-start;
      gap: 10px 14px;
      padding: 10px 14px;
      cursor: pointer;
      list-style: none;
      position: sticky;
      top: 0;
      z-index: 21;
      background: var(--card);
    }
    summary.top-summary::-webkit-details-marker { display: none; }
    .summary-hint {
      font-size: 13px;
      margin-left: auto;
      flex: 0 1 auto;
      text-align: right;
      max-width: 100%;
    }
    summary.top-summary .mail-top-btn {
      font-size: 13px;
      padding: 6px 12px;
      touch-action: manipulation;
      flex-shrink: 0;
      position: relative;
    }
    .mail-nav-badge {
      margin-left: 6px;
      min-width: 18px;
      height: 18px;
      padding: 0 5px;
      border-radius: 999px;
      background: #ef4444;
      color: #fff;
      font-size: 11px;
      font-weight: 800;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      vertical-align: middle;
    }

    /* --- Экран почты (webmail: папки | список | письмо) --- */
    #mailScreen[hidden] { display: none !important; }
    body.crm-mail-open { overflow: hidden; }
    body.crm-mail-open .hint-banner,
    body.crm-mail-open #pipelineReminder { display: none !important; }
    .mail-screen {
      display: flex;
      flex-direction: column;
      min-height: calc(100vh - 8px);
      background: #eef1f5;
      margin: 0 0 12px;
    }
    .mail-screen-head {
      flex-shrink: 0;
      display: flex;
      align-items: center;
      flex-wrap: wrap;
      gap: 8px 12px;
      padding: 10px 14px;
      border-bottom: 1px solid var(--line);
      background: #fff;
      margin: 0;
      box-shadow: 0 1px 0 rgba(15,23,42,.04);
    }
    .mail-screen-head h2 { margin: 0; font-size: 1.05rem; flex: 0 0 auto; min-width: 0; }
    .mail-mailbox-hint {
      margin-left: auto;
      font-size: 13px;
      font-weight: 600;
      color: #334155;
      text-align: right;
      max-width: min(520px, 55vw);
      line-height: 1.35;
      word-break: break-word;
    }
    .mail-screen-body {
      flex: 1;
      display: grid;
      grid-template-columns: 148px minmax(220px, 300px) minmax(0, 1fr);
      gap: 0;
      min-height: 0;
      height: calc(100vh - 108px);
      max-height: calc(100dvh - 108px);
      margin: 0;
      overflow: hidden;
      background: #fff;
    }
    .mail-folders-nav {
      background: #f8fafc;
      border-right: 1px solid var(--line);
      overflow-y: auto;
      padding: 8px 6px;
      display: flex;
      flex-direction: column;
      gap: 4px;
    }
    .mail-folder-btn {
      display: block;
      width: 100%;
      text-align: left;
      border: none;
      border-radius: 8px;
      padding: 9px 10px;
      font-size: 13px;
      font-weight: 600;
      cursor: pointer;
      background: transparent;
      color: #334155;
    }
    .mail-folder-btn:hover { background: #e2e8f0; }
    .mail-folder-btn.active { background: #fffbeb; color: #92400e; box-shadow: inset 3px 0 0 var(--yellow-dark); }
    .mail-accounts-nav {
      display: flex;
      flex-wrap: wrap;
      gap: 6px;
      padding: 8px 12px 10px;
      border-bottom: 1px solid var(--line);
      background: #fff;
    }
    .mail-account-btn {
      display: inline-flex;
      flex-direction: column;
      align-items: flex-start;
      gap: 2px;
      border: 1px solid var(--line);
      border-radius: 12px;
      padding: 8px 14px;
      font-size: 12px;
      font-weight: 700;
      cursor: pointer;
      background: #f8fafc;
      color: #334155;
      text-align: left;
    }
    .mail-account-btn:hover { background: #e2e8f0; }
    .mail-account-btn.active {
      background: #fffbeb;
      border-color: #f59e0b;
      color: #92400e;
      box-shadow: 0 1px 0 rgba(245, 158, 11, 0.25);
    }
    .mail-account-label { font-size: 13px; }
    .mail-account-addr {
      font-size: 11px;
      font-weight: 600;
      color: #64748b;
    }
    .mail-list-col {
      border-right: 1px solid var(--line);
      display: flex;
      flex-direction: column;
      min-height: 0;
      max-height: 100%;
      background: #fafbfc;
    }
    .mail-list-toolbar {
      padding: 8px 10px;
      border-bottom: 1px solid var(--line);
      display: flex;
      flex-direction: column;
      gap: 8px;
      background: #fff;
      flex-shrink: 0;
    }
    .mail-list-toolbar-row {
      display: flex;
      gap: 6px;
      align-items: center;
      flex-wrap: wrap;
    }
    .mail-folder-select {
      flex: 1 1 120px;
      min-width: 0;
      border-radius: 10px;
      border: 1px solid var(--line);
      padding: 7px 8px;
      font: inherit;
      font-size: 13px;
      background: #fff;
    }
    #mailSearchInput {
      width: 100%;
      box-sizing: border-box;
      border-radius: 10px;
      border: 1px solid var(--line);
      padding: 8px 10px;
      font-size: 14px;
      background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%2394a3b8' viewBox='0 0 16 16'%3E%3Cpath d='M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85zm-5.242.656a5.5 5.5 0 1 1 0-11 5.5 5.5 0 0 1 0 11z'/%3E%3C/svg%3E") no-repeat 10px center;
      padding-left: 32px;
    }
    .mail-list-scroll {
      flex: 1;
      min-height: 0;
      display: flex;
      flex-direction: column;
      overflow: hidden;
    }
    #mailThreadList {
      flex: 1;
      overflow-y: auto;
      min-height: 0;
      max-height: 100%;
      -webkit-overflow-scrolling: touch;
    }
    .mail-list-footer {
      flex-shrink: 0;
      padding: 6px 8px;
      border-top: 1px solid var(--line);
      background: #fff;
      text-align: center;
    }
    .mail-row {
      padding: 10px 12px;
      border: none;
      border-bottom: 1px solid #e8eef3;
      cursor: pointer;
      text-align: left;
      width: 100%;
      background: #fff;
      font: inherit;
      display: block;
      border-left: 3px solid transparent;
    }
    .mail-row:hover { background: #f8fafc; }
    .mail-row.active { background: #fffbeb; border-left-color: var(--yellow-dark); }
    .mail-row.unread .mr-sub { font-weight: 800; }
    .mail-row .mr-sub { font-size: 13px; font-weight: 600; color: var(--text); line-height: 1.3; }
    .mail-row .mr-meta { font-size: 11px; color: var(--muted); margin-top: 4px; line-height: 1.35; }
    .mail-reading-col {
      display: flex;
      flex-direction: column;
      min-height: 0;
      max-height: 100%;
      background: #f1f5f9;
      overflow: hidden;
    }
    .mail-reading-toolbar {
      display: none;
      padding: 8px 10px;
      border-bottom: 1px solid var(--line);
      background: #fff;
      flex-shrink: 0;
    }
    .mail-reading-scroll {
      flex: 1;
      min-height: 0;
      overflow-y: auto;
      -webkit-overflow-scrolling: touch;
      padding: 12px 14px 16px;
    }
    .mail-reading-pane {
      min-height: 0;
    }
    .mail-detail-toolbar {
      flex-shrink: 0;
      display: flex;
      flex-wrap: wrap;
      gap: 8px;
      padding: 10px 14px;
      border-bottom: 1px solid var(--line);
      background: #fff;
    }
    .mail-detail-toolbar[hidden] { display: none !important; }
    .mail-reading-head { margin-bottom: 12px; padding-bottom: 10px; border-bottom: 1px solid #e8eef3; }
    .mail-reading-head h3 { margin: 0 0 8px; font-size: 1.05rem; line-height: 1.35; font-weight: 800; color: #0f172a; }
    .mail-reading-head .mr-hdr-line { font-size: 12px; color: var(--muted); line-height: 1.45; }
    .mail-reading-text, .mail-reading-html {
      font-size: 14px;
      line-height: 1.55;
      color: #0f172a;
      background: #fff;
      border: 1px solid var(--line);
      border-radius: 10px;
      padding: 14px 16px;
      word-break: break-word;
    }
    .mail-reading-text { white-space: pre-wrap; }
    .mail-reading-html { overflow-x: auto; }
    .mail-reading-html a { color: #1d4ed8; text-decoration: underline; font-weight: 600; }
    .mail-reading-html img { max-width: 100%; height: auto; border-radius: 8px; margin: 8px 0; cursor: zoom-in; }
    .mail-attachments {
      margin-top: 14px;
      display: flex;
      flex-direction: column;
      gap: 8px;
    }
    .mail-attachments h4 { margin: 0 0 4px; font-size: 12px; color: #64748b; text-transform: uppercase; letter-spacing: .04em; }
    .mail-att-grid { display: flex; flex-wrap: wrap; gap: 10px; }
    .mail-att-card {
      border: 1px solid var(--line);
      border-radius: 10px;
      padding: 8px 10px;
      background: #f8fafc;
      max-width: 200px;
      font-size: 12px;
    }
    .mail-att-card img { display: block; max-width: 180px; max-height: 140px; border-radius: 6px; margin-bottom: 6px; cursor: zoom-in; }
    .mail-att-card a { color: var(--accent); font-weight: 700; word-break: break-all; }
    .mail-att-pending { color: var(--muted); font-size: 12px; }
    .mail-compose-files { font-size: 12px; color: #475569; margin: 6px 0 8px; }
    .mail-compose-files ul { margin: 4px 0 0; padding-left: 18px; }
    .mail-compose {
      margin-top: 14px;
      border: 1px solid var(--line);
      border-radius: 12px;
      padding: 12px;
      background: #fff;
      box-shadow: 0 1px 3px rgba(15,23,42,.06);
    }
    .mail-compose-title {
      font-size: 13px;
      font-weight: 800;
      color: #334155;
      margin: 0 0 10px;
    }
    .mail-compose label { display: block; font-size: 12px; font-weight: 600; color: #475569; margin-bottom: 4px; }
    .mail-compose input, .mail-compose textarea {
      width: 100%;
      box-sizing: border-box;
      margin-bottom: 8px;
      border-radius: 10px;
      border: 1px solid var(--line);
      padding: 8px 10px;
      font: inherit;
    }
    .mail-compose textarea { min-height: 110px; resize: vertical; }
    .mail-compose-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
    .mail-empty {
      padding: 24px 16px;
      text-align: center;
      color: var(--muted);
      font-size: 14px;
      line-height: 1.5;
    }
    @media (max-width: 900px) {
      .mail-screen-body { grid-template-columns: minmax(200px, 42vw) minmax(0, 1fr); }
      .mail-folders-nav { display: none; }
      .mail-folder-select-mobile { display: block !important; }
    }
    @media (max-width: 760px) {
      body.crm-mail-open .top-details { display: none !important; }
      body.crm-mail-open #mailScreen {
        margin: 0;
        min-height: 100dvh;
        max-height: 100dvh;
      }
      body.crm-mail-open .mail-screen-body {
        height: calc(100dvh - 52px);
        max-height: calc(100dvh - 52px);
      }
      .mail-screen-body[data-view="read"] .mail-list-col { display: none; }
      .mail-screen-body[data-view="list"] .mail-reading-col { display: none; }
      .mail-reading-toolbar { display: flex; }
      .mail-screen-body {
        grid-template-columns: 1fr;
        height: calc(100dvh - 96px);
        max-height: calc(100dvh - 96px);
      }
      .mail-compose textarea { min-height: 88px; }
    }
    .mail-folder-select-mobile { display: none; width: 100%; margin-bottom: 6px; }
    .top-expand {
      padding: 0 14px 14px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
      border-top: 1px solid var(--line); background: #fafbff;
    }
    .notify-row {
      width: 100%;
      flex-basis: 100%;
      display: flex;
      flex-wrap: wrap;
      align-items: center;
      gap: 8px 12px;
      padding-top: 4px;
      border-top: 1px dashed var(--line);
      margin-top: 4px;
    }
    .notify-row .muted { max-width: min(100%, 42rem); line-height: 1.45; }
    .manager-switch-row { width: 100%; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding-top: 8px; border-top: 1px dashed var(--line); margin-top: 4px; }
    .manager-switch-title { font-size: 12px; color: var(--muted); margin-right: 6px; }
    .manager-pill { border: 1px solid #dbe2ef; background: #fff; color: #1f2937; border-radius: 999px; padding: 6px 10px; font-size: 12px; font-weight: 700; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
    .manager-pill.active { background: #e8f0ff; border-color: #93c5fd; color: #1d4ed8; }
    .manager-pill .u { color: #64748b; font-weight: 700; }
    .manager-pill .role { color: #94a3b8; font-weight: 600; font-size: 11px; }
    .manager-pill .n { min-width: 18px; height: 18px; border-radius: 999px; display: inline-flex; align-items: center; justify-content: center; padding: 0 5px; background: #ef4444; color: #fff; font-size: 11px; font-weight: 800; line-height: 1; }
    .outbox-pause-on { border-color: #f97316 !important; color: #c2410c !important; font-weight: 800; }
    .outbox-pause-off { border-color: #22c55e !important; color: #15803d !important; font-weight: 700; }
    .funnel-dup-mount { margin-bottom: 10px; }
    .funnel-dup-mount .auto-link-banner { margin: 0 0 10px; }
    .funnel-dup-mount .auto-link-banner:last-child { margin-bottom: 0; }
    .hint-banner {
      margin: 0 12px; padding: 10px 12px;
      border-radius: 12px; border: 1px dashed #fcd34d; background: #fffbeb;
      color: #854d0e; font-size: 13px; line-height: 1.45; display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
      animation: hintPulse 3.5s ease-in-out infinite;
    }
    @keyframes hintPulse {
      0%, 100% { box-shadow: 0 0 0 0 rgba(247, 201, 72, 0); }
      50% { box-shadow: 0 0 0 3px rgba(247, 201, 72, 0.25); }
    }
    @keyframes bubbleAppear {
      from { opacity: 0; transform: translateY(10px) scale(0.97); }
      to { opacity: 1; transform: translateY(0) scale(1); }
    }
    .bubble-appear { animation: bubbleAppear 0.32s cubic-bezier(0.22, 1, 0.36, 1) both; }

    /* Лента сообщений как в Telegram */
    .msg-list {
      background: linear-gradient(180deg, #d6dade 0%, #cdd4d9 48%, #cfd6db 100%);
    }
    .panel-comms .bubble {
      max-width: min(94%, 520px);
      -webkit-touch-callout: none;
      transition: box-shadow 0.18s ease;
    }
    @media (hover: none) and (pointer: coarse) {
      .panel-comms .bubble:not(.bubble-select-active) {
        -webkit-user-select: none;
        user-select: none;
      }
    }
    .panel-comms .msg-swipe-body {
      display: flex;
      flex-direction: column;
      max-width: min(94%, 520px);
      will-change: transform;
      touch-action: pan-y;
    }
    .msg-row.msg-swipe-active .msg-swipe-body {
      touch-action: none;
    }
    .msg-row.out .msg-swipe-body {
      align-items: flex-end;
    }
    .msg-row.in .msg-swipe-body {
      align-items: flex-start;
    }
    .panel-comms .bubble.bubble-longpress-hold {
      transform: scale(0.985);
    }
    .panel-comms .bubble.bubble-longpress-ready {
      transform: scale(1.015);
      box-shadow: 0 0 0 2px rgba(14, 165, 233, 0.45), 0 4px 14px rgba(14, 165, 233, 0.12);
    }
    .panel-comms .bubble.bubble-select-active {
      box-shadow: 0 0 0 2px rgba(14, 165, 233, 0.55), 0 6px 18px rgba(14, 165, 233, 0.14);
      z-index: 3;
      position: relative;
    }
    .panel-comms .bubble-text,
    .panel-comms .bubble-text a {
      -webkit-user-select: text;
      user-select: text;
      cursor: text;
    }
    @media (hover: none) and (pointer: coarse) {
      .panel-comms .bubble:not(.bubble-select-active) .bubble-text,
      .panel-comms .bubble:not(.bubble-select-active) .bubble-text a {
        -webkit-user-select: none;
        user-select: none;
        cursor: default;
      }
      .panel-comms .bubble.bubble-select-active .bubble-text,
      .panel-comms .bubble.bubble-select-active .bubble-text a {
        -webkit-user-select: text;
        user-select: text;
        -webkit-touch-callout: default;
        cursor: text;
        touch-action: auto;
      }
    }
    .panel-comms .bubble-sender,
    .panel-comms .msg-sender-head,
    .panel-comms .bubble-time,
    .panel-comms .bubble-thumb,
    .panel-comms .bubble-media-ph {
      -webkit-user-select: none;
      user-select: none;
      -webkit-touch-callout: none;
    }
    .panel-comms .bubble-thumb {
      -webkit-user-drag: none;
      user-drag: none;
    }
    .msg-row {
      display: flex; flex-direction: column;
      margin-bottom: 8px;
      position: relative;
    }
    .msg-swipe-reply-hint {
      position: absolute;
      left: 6px;
      top: 50%;
      transform: translateY(-50%);
      width: 30px;
      height: 30px;
      border-radius: 50%;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 16px;
      font-weight: 800;
      color: #0ea5e9;
      background: rgba(224, 242, 254, 0.96);
      opacity: 0;
      pointer-events: none;
      transition: opacity 0.1s ease, background 0.1s ease, color 0.1s ease;
      z-index: 2;
      box-shadow: 0 2px 8px rgba(14, 165, 233, 0.18);
    }
    .msg-swipe-reply-hint--out {
      left: auto;
      right: 6px;
    }
    .msg-swipe-reply-hint.ready {
      background: #0ea5e9;
      color: #fff;
    }
    .msg-row.msg-swipe-active {
      z-index: 1;
    }
    .msg-row.in { align-items: flex-start; }
    .msg-row.out { align-items: flex-end; }
    .bubble {
      max-width: min(96%, 960px);
      padding: 10px 13px 7px;
      border-radius: 18px;
      font-size: 16px;
      line-height: 1.45;
      box-shadow: 0 1px 1px rgba(15, 23, 42, 0.08);
      word-wrap: break-word;
    }
    .bubble.inb {
      background: #fff;
      border-bottom-left-radius: 4px;
      color: #0f172a;
    }
    .bubble.outb {
      background: #d9fdd3;
      border-bottom-right-radius: 4px;
      color: #0f172a;
    }
    .bubble.pending {
      border: 2px dashed rgba(14, 165, 233, 0.55);
      background: #e0f2fe;
      animation: pendingPulse 1.6s ease-in-out infinite;
    }
    .bubble.pending-failed {
      border: 2px solid rgba(239, 68, 68, 0.65);
      background: #fff1f2;
      animation: none;
      opacity: 0.95;
    }
    @keyframes pendingPulse {
      0%, 100% { opacity: 1; }
      50% { opacity: 0.88; }
    }
    .bubble-reply-quote {
      font-size: 12px;
      line-height: 1.35;
      padding: 6px 8px;
      margin-bottom: 6px;
      border-left: 3px solid #0ea5e9;
      background: rgba(14, 165, 233, 0.1);
      border-radius: 6px;
      color: #334155;
      max-height: 4.2em;
      overflow: hidden;
      word-break: break-word;
    }
    .bubble-reply-quote.clickable {
      cursor: pointer;
      user-select: none;
    }
    .bubble-reply-quote.clickable:hover {
      background: rgba(14, 165, 233, 0.16);
    }
    .bubble.outb .bubble-reply-quote {
      border-left-color: #16a34a;
      background: rgba(22, 163, 74, 0.12);
    }
    .msg-jump-target {
      animation: msgJumpFlash 1.2s ease;
    }
    mark.search-hit-mark,
    .search-hit-mark {
      background: linear-gradient(180deg, #fde047 0%, #f7c948 100%);
      color: #422006;
      border-radius: 3px;
      padding: 0 2px;
      font-weight: 800;
      box-shadow: 0 0 0 1px rgba(233, 180, 20, 0.35);
    }
    .chat-item-preview .search-hit-mark {
      padding: 0 1px;
      font-weight: 800;
    }
    .msg-row.msg-search-hit .bubble {
      box-shadow: 0 0 0 2px rgba(247, 201, 72, 0.45);
    }
    .msg-row.msg-search-hit .bubble.inb {
      background: linear-gradient(180deg, #fffbeb 0%, #fff 100%);
    }
    .msg-row.msg-search-hit .bubble.outb {
      background: linear-gradient(180deg, #eff6ff 0%, #fffbeb 100%);
    }
    @keyframes msgJumpFlash {
      0% { box-shadow: 0 0 0 0 rgba(247, 201, 72, 0); }
      35% { box-shadow: 0 0 0 3px rgba(247, 201, 72, 0.55); }
      100% { box-shadow: 0 0 0 0 rgba(247, 201, 72, 0); }
    }
    .chat-reply-bar {
      padding: 10px 12px;
      margin-bottom: 8px;
      border: 1px solid #7dd3fc;
      border-radius: 10px;
      background: #e0f2fe;
    }
    .chat-reply-bar:not([hidden]) {
      display: block;
    }
    .chat-reply-bar-inner {
      display: flex;
      align-items: flex-start;
      gap: 8px;
    }
    .chat-reply-label {
      font-size: 11px;
      font-weight: 700;
      color: #0ea5e9;
      flex-shrink: 0;
    }
    .chat-reply-preview {
      flex: 1;
      font-size: 13px;
      color: #475569;
      line-height: 1.35;
      max-height: 2.8em;
      overflow: hidden;
    }
    #chatReplyCancel {
      flex-shrink: 0;
      padding: 4px 10px;
      font-size: 16px;
      line-height: 1;
    }
    .bubble-time {
      font-size: 11px;
      color: rgba(15,23,42,0.45);
      margin-top: 4px; text-align: right;
      font-variant-numeric: tabular-nums;
    }
    .bubble.inb .bubble-time { text-align: left; color: rgba(100,116,139,0.95); }
    .bubble-reactions {
      display: flex;
      flex-wrap: wrap;
      gap: 4px;
      margin-top: 6px;
    }
    .bubble-reaction-chip {
      display: inline-flex;
      align-items: center;
      padding: 2px 7px;
      border-radius: 999px;
      background: rgba(255,255,255,0.92);
      border: 1px solid rgba(148,163,184,0.45);
      font-size: 13px;
      line-height: 1.3;
      cursor: default;
    }
    .bubble.outb .bubble-reaction-chip {
      background: rgba(240,253,244,0.95);
      border-color: rgba(34,197,94,0.25);
    }
    .bubble-text {
      word-break: break-word;
      overflow-wrap: anywhere;
      white-space: pre-wrap;
    }
    .bubble-sender {
      font-size: 12px;
      line-height: 1.2;
      margin-bottom: 4px;
      font-weight: 700;
      color: #0369a1;
    }
    .bubble.outb .bubble-sender { color: #166534; }
    .bubble-sender--manager {
      font-size: 11px;
      font-weight: 800;
      letter-spacing: 0.02em;
      text-transform: uppercase;
      color: #166534;
      opacity: 0.92;
    }
    .msg-row.max-group-thread.in,
    .msg-row.max-sender-thread.in {
      align-items: flex-start;
    }
    .msg-row.max-group-thread.out,
    .msg-row.max-sender-thread.out {
      align-items: flex-end;
    }
    .msg-sender-head {
      display: flex;
      align-items: center;
      flex-wrap: wrap;
      gap: 5px 8px;
      max-width: min(94%, 520px);
      padding: 0 4px 5px 2px;
      margin-left: 2px;
    }
    .msg-sender-head--continued {
      min-height: 4px;
      padding: 0;
      margin-bottom: 2px;
    }
    .msg-sender-avatar {
      width: 26px;
      height: 26px;
      border-radius: 9px;
      flex-shrink: 0;
      display: grid;
      place-items: center;
      font-size: 10px;
      font-weight: 800;
      letter-spacing: 0.02em;
      color: #fff;
      background: linear-gradient(
        145deg,
        var(--sender-accent, #64748b),
        color-mix(in srgb, var(--sender-accent, #64748b) 72%, #ffffff)
      );
      box-shadow:
        0 1px 3px var(--sender-ring, rgba(15, 23, 42, 0.12)),
        inset 0 1px 0 rgba(255, 255, 255, 0.28);
    }
    .msg-sender-dot {
      width: 7px;
      height: 7px;
      border-radius: 50%;
      background: var(--sender-accent, #64748b);
      flex-shrink: 0;
    }
    .msg-sender-name {
      font-size: 12px;
      font-weight: 800;
      line-height: 1.25;
      letter-spacing: 0.01em;
      color: var(--sender-ink, var(--sender-accent, #334155));
    }
    .msg-sender-handle {
      font-size: 11px;
      font-weight: 600;
      color: #64748b;
      line-height: 1.25;
    }
    .msg-sender-tag {
      font-size: 9px;
      font-weight: 800;
      letter-spacing: 0.05em;
      text-transform: uppercase;
      padding: 2px 7px;
      border-radius: 999px;
      line-height: 1.35;
    }
    .msg-sender-tag--manager {
      color: #166534;
      background: #dcfce7;
      border: 1px solid #86efac;
    }
    .bubble.inb.max-group-bubble {
      background: linear-gradient(
        155deg,
        color-mix(in srgb, var(--sender-soft, #fff) 78%, #ffffff) 0%,
        color-mix(in srgb, var(--sender-soft, #fff) 28%, #ffffff) 100%
      );
      border: 1px solid color-mix(in srgb, var(--sender-accent, #94a3b8) 38%, #e2e8f0);
      border-left: 5px solid var(--sender-accent, #94a3b8);
      border-bottom-left-radius: 6px;
      box-shadow:
        0 2px 12px var(--sender-ring, rgba(15, 23, 42, 0.08)),
        inset 0 1px 0 rgba(255, 255, 255, 0.75);
    }
    .msg-row.max-group-thread.in.max-group-sender-break {
      margin-top: 10px;
    }
    .msg-row.max-group-thread.in .msg-sender-head--continued + .bubble.inb.max-group-bubble,
    .msg-row.max-sender-thread.in .msg-sender-head--continued + .bubble.inb.max-group-bubble {
      margin-left: 34px;
    }
    .msg-row.max-group-thread.in .msg-sender-head:not(.msg-sender-head--continued) + .bubble.inb.max-group-bubble,
    .msg-row.max-sender-thread.in .msg-sender-head:not(.msg-sender-head--continued) + .bubble.inb.max-group-bubble {
      margin-left: 0;
    }
    .bubble-text a { color: #1d4ed8; text-decoration: underline; font-weight: 600; }
    .bubble-text a:visited { color: #6d28d9; }
    .bubble-phone {
      display: inline;
      white-space: normal;
    }
    .bubble-phone .bubble-phone-tg {
      display: inline-block;
      margin-left: 6px;
      padding: 1px 7px;
      border-radius: 8px;
      font-size: 11px;
      font-weight: 800;
      text-decoration: none !important;
      background: #e0e7ff;
      color: #3730a3;
      vertical-align: middle;
      line-height: 1.3;
    }
    .bubble-phone .bubble-phone-tg:hover { background: #c7d2fe; }
    .bubble-thumb {
      display: block;
      max-width: 100%;
      max-height: 280px;
      width: auto;
      height: auto;
      margin-top: 8px;
      border-radius: 12px;
      object-fit: contain;
      cursor: zoom-in;
    }
    .bubble-media-ph { font-size: 13px; margin-top: 4px; line-height: 1.4; }
    .bubble-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 6px; }
    .bubble-deleted .bubble-text { font-style: italic; color: rgba(100,116,139,0.92); }
    .tg-msg-audit { margin-top: 8px; font-size: 12px; color: #475569; background: rgba(241,245,249,0.95); padding: 8px 10px; border-radius: 8px; max-height: 200px; overflow: auto; border: 1px solid rgba(148,163,184,0.35); }
    .tg-msg-audit summary { cursor: pointer; font-weight: 600; user-select: none; }
    .tg-msg-audit pre { font-family: ui-monospace, monospace; }
    .bubble-act, .bubble-dl {
      font-size: 12px;
      padding: 4px 8px;
      border-radius: 8px;
      border: 1px solid var(--line);
      background: rgba(255,255,255,0.85);
      cursor: pointer;
      color: var(--accent);
    }
    .bubble-dl { color: #0f766e; }
    .composer-tools-inline { display: flex; gap: 4px; flex-wrap: nowrap; align-items: flex-end; }
    .icon-action-btn.emoji-picker-open {
      background: #fffbeb;
      border-color: #fcd34d;
      color: #92400e;
    }
    .emoji-picker-overlay {
      position: fixed;
      inset: 0;
      z-index: 10001;
      display: flex;
      align-items: flex-end;
      justify-content: center;
      padding: 10px;
      padding-bottom: max(10px, env(safe-area-inset-bottom, 0px));
      background: rgba(15, 23, 42, 0.38);
      -webkit-tap-highlight-color: transparent;
      box-sizing: border-box;
    }
    .emoji-picker-overlay[hidden] { display: none !important; }
    .emoji-picker-panel {
      width: 100%;
      max-width: 420px;
      max-height: min(52vh, 380px);
      display: flex;
      flex-direction: column;
      background: #fff;
      border: 1px solid var(--line);
      border-radius: 16px 16px 14px 14px;
      box-shadow: 0 -8px 40px rgba(15, 23, 42, 0.14);
      overflow: hidden;
    }
    .emoji-picker-head {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 10px;
      padding: 12px 14px;
      border-bottom: 1px solid var(--line);
      background: linear-gradient(90deg, #fffbeb 0%, #fff 60%);
      flex-shrink: 0;
    }
    .emoji-picker-head strong { font-size: 15px; }
    .emoji-picker-body {
      flex: 1 1 auto;
      min-height: 0;
      overflow-y: auto;
      -webkit-overflow-scrolling: touch;
      padding: 10px 12px 14px;
    }
    .emoji-picker-group { margin-bottom: 12px; }
    .emoji-picker-group:last-child { margin-bottom: 0; }
    .emoji-picker-group-label {
      font-size: 11px;
      font-weight: 800;
      letter-spacing: 0.06em;
      text-transform: uppercase;
      color: var(--muted);
      margin: 0 0 8px 4px;
    }
    .emoji-picker-grid {
      display: grid;
      grid-template-columns: repeat(8, minmax(0, 1fr));
      gap: 4px;
    }
    .emoji-picker-grid button {
      display: flex;
      align-items: center;
      justify-content: center;
      width: 100%;
      aspect-ratio: 1;
      min-height: 40px;
      padding: 0;
      border: 1px solid transparent;
      border-radius: 10px;
      background: transparent;
      font-size: 24px;
      line-height: 1;
      cursor: pointer;
      touch-action: manipulation;
    }
    .emoji-picker-grid button:hover { background: #f8fafc; border-color: var(--line); }
    .emoji-picker-grid button:active { transform: scale(0.92); background: #fffbeb; }
    @media (max-width: 380px) {
      .emoji-picker-grid { grid-template-columns: repeat(7, minmax(0, 1fr)); }
      .emoji-picker-grid button { font-size: 22px; min-height: 36px; }
    }
    .chat-msg-menu {
      position: fixed;
      z-index: 10050;
      min-width: 168px;
      max-width: min(92vw, 260px);
      padding: 6px;
      border-radius: 12px;
      background: #fff;
      border: 1px solid var(--line, #e2e8f0);
      box-shadow: 0 12px 36px rgba(15, 23, 42, 0.18);
      -webkit-tap-highlight-color: transparent;
    }
    .chat-msg-menu[hidden] { display: none !important; }
    .chat-msg-menu-item {
      display: block;
      width: 100%;
      text-align: left;
      padding: 10px 12px;
      border: 0;
      border-radius: 8px;
      background: transparent;
      font-size: 15px;
      line-height: 1.25;
      color: #0f172a;
      cursor: pointer;
    }
    .chat-msg-menu-item:hover:not(:disabled),
    .chat-msg-menu-item:focus-visible {
      background: #f1f5f9;
      outline: none;
    }
    .chat-msg-menu-item:disabled {
      opacity: 0.45;
      cursor: not-allowed;
    }
    .chat-msg-menu-item.danger { color: #b91c1c; }
    .chat-gestures-dismiss-layer {
      position: fixed;
      inset: 0;
      z-index: 10049;
      background: transparent;
      -webkit-tap-highlight-color: transparent;
      touch-action: manipulation;
    }
    .chat-gestures-dismiss-layer[hidden],
    .chat-gestures-backdrop[hidden] {
      display: none !important;
    }
    .chat-gestures-backdrop {
      display: none !important;
    }
    .chat-msg-menu.chat-msg-menu-sheet {
      left: 0 !important;
      right: 0 !important;
      bottom: 0 !important;
      top: auto !important;
      width: 100%;
      max-width: none;
      min-width: 0;
      border-radius: 16px 16px 0 0;
      padding: 10px 10px max(10px, env(safe-area-inset-bottom, 0px));
      box-shadow: 0 -8px 32px rgba(15, 23, 42, 0.16);
      transform: translateY(100%);
      transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
      will-change: transform;
    }
    .chat-msg-menu.chat-msg-menu-sheet.chat-msg-menu-sheet--visible {
      transform: translateY(0);
    }
    .chat-msg-menu-sheet .chat-msg-menu-item {
      padding: 14px 14px;
      font-size: 16px;
    }
    body.chat-gestures-menu-open--select .panel-comms .bubble.bubble-select-active {
      z-index: 10051;
      position: relative;
    }
    body.chat-gestures-menu-open--select .panel-comms .bubble.bubble-select-active .bubble-text[contenteditable="true"] {
      -webkit-user-select: text;
      user-select: text;
      outline: none;
      caret-color: transparent;
    }
    .chat-forward-overlay {
      position: fixed;
      inset: 0;
      z-index: 10060;
      display: flex;
      align-items: flex-end;
      justify-content: center;
      padding: 10px;
      padding-bottom: max(10px, env(safe-area-inset-bottom, 0px));
      background: rgba(15, 23, 42, 0.42);
      -webkit-tap-highlight-color: transparent;
      box-sizing: border-box;
    }
    .chat-forward-overlay[hidden] { display: none !important; }
    .chat-forward-panel {
      width: 100%;
      max-width: 440px;
      max-height: min(78vh, 560px);
      display: flex;
      flex-direction: column;
      background: #fff;
      border: 1px solid var(--line, #e2e8f0);
      border-radius: 16px 16px 14px 14px;
      box-shadow: 0 20px 50px rgba(15, 23, 42, 0.22);
      overflow: hidden;
    }
    .chat-forward-head {
      display: flex;
      align-items: flex-start;
      justify-content: space-between;
      gap: 10px;
      padding: 14px 14px 10px;
      border-bottom: 1px solid var(--line, #e2e8f0);
      flex-shrink: 0;
    }
    .chat-forward-search-wrap {
      padding: 8px 12px 10px;
      flex-shrink: 0;
    }
    .chat-forward-search {
      width: 100%;
      box-sizing: border-box;
      padding: 10px 12px;
      border: 1px solid var(--line, #e2e8f0);
      border-radius: 10px;
      font-size: 16px;
    }
    .chat-forward-list {
      overflow: auto;
      -webkit-overflow-scrolling: touch;
      padding: 0 8px 10px;
      flex: 1;
      min-height: 120px;
    }
    .chat-forward-item {
      display: flex;
      flex-direction: column;
      align-items: flex-start;
      gap: 2px;
      width: 100%;
      text-align: left;
      padding: 12px 10px;
      border: 0;
      border-radius: 10px;
      background: transparent;
      cursor: pointer;
    }
    .chat-forward-item:hover,
    .chat-forward-item:focus-visible {
      background: #f8fafc;
      outline: none;
    }
    .chat-forward-item-title {
      font-size: 15px;
      font-weight: 600;
      color: #0f172a;
    }
    .chat-forward-item-sub { font-size: 12px; }
    .chat-forward-empty {
      padding: 16px 12px;
      margin: 0;
      text-align: center;
      font-size: 14px;
    }
    body.chat-forward-open { overflow: hidden; }
    @media (min-width: 721px) {
      .chat-forward-overlay {
        align-items: center;
        padding: 20px;
      }
      .chat-forward-panel { max-height: min(62vh, 520px); }
    }
    .quick-replies-overlay {
      position: fixed;
      inset: 0;
      z-index: 10000;
      display: flex;
      align-items: flex-end;
      justify-content: center;
      padding: 10px;
      padding-bottom: max(10px, env(safe-area-inset-bottom, 0px));
      background: rgba(15, 23, 42, 0.42);
      -webkit-tap-highlight-color: transparent;
      box-sizing: border-box;
    }
    .quick-replies-overlay[hidden] { display: none !important; }
    .quick-replies-panel {
      position: relative;
      z-index: 1;
      width: 100%;
      max-width: 440px;
      max-height: min(78vh, 560px);
      display: flex;
      flex-direction: column;
      background: #fff;
      border: 1px solid var(--line);
      border-radius: 16px 16px 14px 14px;
      box-shadow: 0 20px 50px rgba(15, 23, 42, 0.22);
      overflow: hidden;
      flex-shrink: 0;
    }
    .quick-replies-head {
      display: flex;
      align-items: flex-start;
      justify-content: space-between;
      gap: 10px;
      padding: 12px 14px 10px;
      border-bottom: 1px solid var(--line);
      flex-shrink: 0;
      background: #fffbeb;
    }
    .quick-replies-head strong { font-size: 15px; line-height: 1.3; }
    .quick-replies-list {
      overflow-y: auto;
      -webkit-overflow-scrolling: touch;
      padding: 8px 10px 12px;
      flex: 1 1 auto;
      min-height: 0;
    }
    .quick-reply-item {
      display: block;
      width: 100%;
      text-align: left;
      border: 1px solid var(--line);
      border-radius: 12px;
      background: #fff;
      padding: 10px 12px;
      margin-bottom: 8px;
      cursor: pointer;
      touch-action: manipulation;
    }
    .quick-reply-item:hover, .quick-reply-item:focus-visible {
      background: #f8fafc;
      border-color: #cbd5e1;
      outline: none;
    }
    .quick-reply-item:active { background: #fffbeb; }
    .quick-reply-item .qr-title {
      display: block;
      font-size: 14px;
      font-weight: 700;
      color: #0f172a;
      line-height: 1.35;
      margin-bottom: 4px;
    }
    .quick-reply-item .qr-preview {
      display: block;
      font-size: 12px;
      color: #64748b;
      line-height: 1.4;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }
    @media (min-width: 720px) {
      .quick-replies-overlay {
        align-items: flex-end;
        justify-content: flex-end;
        padding: 20px;
      }
      .quick-replies-panel { max-height: min(62vh, 520px); }
    }
    body.quick-replies-open { overflow: hidden; }
    .read-state { margin-left: 4px; font-weight: 700; letter-spacing: -0.06em; color: #94a3b8; }
    .read-state.read-done { color: #16a34a; }
    .img-lightbox {
      position: fixed;
      inset: 0;
      z-index: 100;
      background: rgba(15, 23, 42, 0.88);
      display: flex;
      align-items: center;
      justify-content: center;
      padding: 16px;
    }
    .img-lightbox[hidden] { display: none !important; }
    .img-lightbox-img { max-width: 96vw; max-height: 92vh; object-fit: contain; border-radius: 8px; }
    .img-lightbox-close {
      position: absolute;
      top: max(12px, env(safe-area-inset-top));
      right: max(12px, env(safe-area-inset-right));
      width: 44px;
      height: 44px;
      border-radius: 50%;
      border: none;
      font-size: 28px;
      line-height: 1;
      cursor: pointer;
      background: #fff;
      color: #0f172a;
    }

    .tg-thread-head {
      display: flex;
      flex-direction: column;
      align-items: stretch;
      gap: 8px;
      padding: 8px 2px 10px;
      border-bottom: 1px solid var(--line);
      flex-shrink: 0;
    }
    .tg-thread-head-inner {
      display: flex;
      align-items: center;
      gap: 11px;
      width: 100%;
      min-width: 0;
    }
    .tg-thread-head[hidden] { display: none !important; }
    .thread-channel-seg {
      display: flex;
      flex-wrap: wrap;
      gap: 6px;
      align-items: center;
      padding: 2px 0 2px 2px;
    }
    .thread-channel-seg .thread-ch-label {
      font-size: 12px;
      color: var(--muted);
      margin-right: 4px;
      font-weight: 600;
    }
    .thread-channel-seg button.thread-ch-switch {
      font-size: 13px;
      padding: 6px 14px;
      border-radius: 999px;
      border: 1px solid var(--line);
      background: #fff;
      cursor: pointer;
      font-weight: 600;
      touch-action: manipulation;
    }
    .thread-channel-seg button.thread-ch-switch.active {
      border-color: #6366f1;
      background: #eef2ff;
      color: #312e81;
    }
    .voice-rec-active {
      background: #fee2e2 !important;
      border-color: #f87171 !important;
      color: #991b1b !important;
    }
    .bubble-voice { margin-top: 4px; }
    .bubble-voice audio { max-width: min(280px, 100%); height: 38px; vertical-align: middle; }
    .tg-thread-avatar {
      width: 42px; height: 42px; border-radius: 50%; flex-shrink: 0;
      background: linear-gradient(145deg, var(--yellow) 0%, #f59e0b 100%);
      display: grid; place-items: center;
      font-weight: 900; font-size: 17px; color: #1e293b;
    }
    .thread-title-lead {
      cursor: pointer;
      text-decoration: none;
      border-bottom: 1px dashed transparent;
    }
    .thread-title-lead:hover {
      border-bottom-color: rgba(99, 102, 241, 0.55);
      color: #4338ca;
    }
    .thread-name-edit-btn {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      width: 38px;
      height: 38px;
      min-height: 38px;
      margin: 0;
      padding: 0;
      border: 1px solid rgba(234, 88, 12, 0.38);
      border-radius: 11px;
      background: linear-gradient(155deg, #fffefb 0%, #fff7ed 55%, #ffedd5 100%);
      color: #c2410c;
      flex-shrink: 0;
      cursor: pointer;
      touch-action: manipulation;
      box-shadow:
        0 1px 2px rgba(15, 23, 42, 0.06),
        inset 0 1px 0 rgba(255, 255, 255, 0.85);
    }
    .thread-name-edit-btn:hover {
      background: linear-gradient(155deg, #fff7ed 0%, #ffedd5 100%);
      border-color: rgba(234, 88, 12, 0.55);
      color: #9a3412;
    }
    .thread-name-edit-btn:active {
      transform: scale(0.96);
    }
    .thread-name-edit-btn .crm-icon {
      width: 17px;
      height: 17px;
      stroke-width: 2.25;
    }
    .thread-name-edit-btn[hidden] {
      display: none !important;
    }

    /* Мобильная воронка: полоса этапов + список + смена этапа */
    .board-mobile-wrap { display: none; }
    .stage-strip {
      display: flex;
      gap: 8px;
      overflow-x: auto;
      overflow-y: visible;
      padding: 6px 14px 12px;
      margin: 0 0 10px;
      scroll-padding-inline: 14px;
      -webkit-overflow-scrolling: touch;
      scrollbar-width: thin;
    }
    .strip-pill {
      flex: 0 0 auto;
      padding: 10px 16px;
      border-radius: 12px;
      border: 2px solid var(--line);
      background: #fff;
      cursor: pointer;
      font-weight: 700;
      font-size: 13px;
      white-space: nowrap;
      touch-action: manipulation;
      box-shadow: 0 1px 4px rgba(15, 23, 42, 0.07);
      transition: transform 0.08s ease, box-shadow 0.08s ease, border-color 0.08s ease;
    }
    .strip-pill.active {
      box-shadow: 0 0 0 2px var(--yellow-dark), 0 4px 14px rgba(247, 201, 72, 0.38);
      transform: translateY(-1px);
    }
    .strip-pill:active { transform: scale(0.98); }
    .strip-pill.active:active { transform: translateY(0) scale(0.98); }
    .lead-m {
      background: #fffef9;
      border: 2px solid #fde68a;
      border-radius: 12px;
      padding: 10px 12px;
      margin-bottom: 10px;
      box-shadow: 0 1px 4px rgba(15, 23, 42, 0.05);
    }
    .lead-m .name-m { font-weight: 700; font-size: 15px; }
    .lead-m .tap-open { cursor: pointer; }
    .lead-m.tier-sale { border: 2px solid #a7f3d0; border-left-width: 5px; border-left-color: #10b981; }
    .lead-m.tier-thinking { border: 2px solid #fdba74; border-left-width: 5px; border-left-color: #ea580c; }
    .lead-m.tier-contact { border: 2px solid #fde047; border-left-width: 5px; border-left-color: #eab308; }
    .lead-m.tier-new { border: 2px solid #cbd5e1; border-left-width: 5px; border-left-color: #64748b; }
    .lead-m.tier-closed { border: 2px solid #cbd5e1; border-left-width: 5px; border-left-color: #64748b; opacity: 0.95; }
    select.stage-jump {
      width: 100%; margin-top: 8px;
      font-size: 15px;
      padding: 10px 12px;
      border-radius: 10px;
    }

    @media (max-width: 1220px) {
      .layout { grid-template-columns: 1fr; }
      .split { grid-template-columns: 1fr; }
    }
    @media (max-width: 900px) {
      #crmHome { display: flex; flex-direction: column; }
      .crm-mobile-jump {
        display: flex;
        position: sticky;
        top: 0;
        z-index: 25;
        background: rgba(248, 250, 252, 0.96);
        backdrop-filter: blur(6px);
        border-bottom: 1px solid var(--line);
      }
      .layout { display: flex; flex-direction: column; padding-bottom: 0; }
      .layout .layout-right-col { order: 1; }
      .layout .layout-left-col { order: 2; min-width: 0; max-width: 100%; overflow-x: clip; }
      .panel.panel-funnel,
      .panel-funnel-sidebar .panel-body {
        max-width: 100%;
        min-width: 0;
        overflow-x: clip;
      }
      .panel-funnel-sidebar .panel-body { padding-left: 8px; padding-right: 8px; }
      .funnel-help,
      .funnel-rules-help {
        width: 100%;
        max-width: 100%;
        overflow-x: clip;
      }
      .funnel-help summary,
      .funnel-help-body {
        padding-left: 10px;
        padding-right: 10px;
        max-width: 100%;
      }
      .funnel-rules-list { padding-left: 1rem; gap: 10px; }
      .panel-funnel-sidebar .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
      .panel.panel-tasks-in-left .panel-body,
      .panel.panel-tasks-in-left .tasks-panel-body { max-height: none; }
      .lead-attention-panel {
        margin: 8px 0 10px;
        width: 100%;
        max-width: 100%;
        overflow-x: clip;
      }
      .lead-attention-panel.has-attention {
        box-shadow: 0 0 0 1px rgba(251, 191, 36, 0.16);
      }
      .lead-attention-summary { padding: 8px 10px; }
      .lead-attention-body { padding: 0 10px 10px; }
      .lead-attention-list { max-height: min(340px, 55vh); }
      .lead-attention-item {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        padding: 0;
        overflow: visible;
        min-height: 0;
      }
      .lead-attention-item-open {
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
        padding: 10px 12px;
        width: 100%;
      }
      .lead-attention-assign {
        flex-direction: column;
        align-items: stretch;
      }
      .lead-attention-assign-btn {
        width: 100%;
      }
      .lead-attention-item-main {
        width: 100%;
        overflow: visible;
      }
      .lead-attention-item-go { display: none; }
      .lead-attention-item .lead-health-badge {
        justify-self: start;
        font-size: 10px;
        padding: 3px 8px;
        line-height: 1.25;
      }
      .lead-attention-item strong {
        font-size: 14px;
        line-height: 1.35;
      }
      .lead-attention-item .meta {
        font-size: 12px;
        line-height: 1.4;
      }
      .lead-attention-admin table { font-size: 11px; }
      .lead-attention-admin th,
      .lead-attention-admin td { padding: 5px 6px; white-space: nowrap; }
      .tasks-panel-summary .title { font-size: 15px; }
      .funnel-board-full .col-leads { max-height: min(50vh, 520px); }
      .top-expand #search { flex: 1 1 240px; min-width: 0 !important; }
      .chat-item {
        grid-template-columns: 38px minmax(0, 1fr);
        gap: 10px;
        padding: 9px 10px 9px 10px;
        min-height: 56px;
      }
      .chat-item-avatar { width: 38px; height: 38px; font-size: 14px; border-radius: 10px; }
      .chat-item-name { font-size: 15px; line-height: 1.25; }
      .chat-item-line1 .lead-tags-inline { display: none; }
      .chat-item-preview { font-size: 12px; line-height: 1.3; }
      .chat-unread-badge { font-size: 8px; line-height: 16px; padding: 0 5px; }
      .chat-list {
        flex: 0 1 auto;
        max-height: min(58dvh, 520px);
        min-height: 200px;
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
        padding: 4px;
      }
      .comms-pane.chats-pane .title {
        font-size: 13px;
        margin: 0 0 6px;
        color: var(--muted);
        font-weight: 600;
      }
      .comms-panel-head {
        padding: 4px 0 8px;
      }
      .comms-panel-head--filters-only .comms-channel-filter {
        width: 100%;
        justify-content: stretch;
      }
      .comms-panel-head--filters-only .comms-filter-btn {
        flex: 1 1 0;
        text-align: center;
      }
      .comms-panel-title { display: none; }
      .comms-filter-btn {
        font-size: 13px;
        padding: 8px 12px;
        min-height: 40px;
      }
      .comms-pane.chats-pane {
        max-width: 100%;
        overflow: hidden;
        width: 100%;
        box-sizing: border-box;
      }
      .panel-comms .panel-body {
        overflow-x: hidden;
        max-width: 100%;
        padding-left: 8px;
        padding-right: 8px;
        box-sizing: border-box;
      }
      .panel-comms .comms-search-row {
        display: none;
      }
      .split.comms-split { display: flex; flex-direction: column; min-height: auto; width: 100%; max-width: 100%; }
      .comms-pane.chats-pane { flex: 0 0 auto; }
      .comms-pane.thread-pane { flex: 1 1 auto; min-height: 0; display: none; flex-direction: column; }
      .comms-split.mobile-show-thread .comms-pane.chats-pane { display: none !important; }
      .comms-split.mobile-show-thread .comms-pane.thread-pane {
        display: flex !important;
        flex-direction: column;
        min-height: 0 !important;
        flex: 1 1 auto !important;
        overflow: hidden;
      }
      .comms-split.mobile-show-thread .comms-back {
        display: inline-flex;
      }
      .comms-split.mobile-show-thread .tg-thread-head {
        flex-shrink: 0;
      }
      .comms-split.mobile-show-thread .thread-refresh-btn {
        display: none !important;
      }
      /* Открытый чат: полноэкранный режим, лента между шапкой и фиксированным composer */
      body.crm-comms-thread-open .top-details,
      body.crm-comms-thread-open .crm-mobile-jump,
      body.crm-comms-thread-open #pipelineReminder,
      body.crm-comms-thread-open .layout-left-col {
        display: none !important;
      }
      .panel-comms.comms-mobile-thread-open {
        position: fixed;
        inset: 0;
        z-index: 34;
        display: flex;
        flex-direction: column;
        min-height: 0;
        max-height: none;
        height: 100dvh;
        margin: 0;
        padding-top: env(safe-area-inset-top, 0px);
        background: #f8fafc;
        border-radius: 0;
        overflow: hidden;
      }
      .panel-comms.comms-mobile-thread-open .panel-head {
        display: none !important;
      }
      .panel-comms.comms-mobile-thread-open.composer-keyboard-open {
        top: var(--crm-vv-offset-top, 0px);
        right: 0;
        left: 0;
        bottom: auto;
        height: var(--crm-vv-height, 100dvh);
      }
      .panel-comms.comms-mobile-thread-open .panel-body.split.comms-split {
        flex: 1 1 auto;
        min-height: 0;
        display: flex;
        flex-direction: column;
        padding: 0;
        overflow: hidden;
      }
      .comms-split.mobile-show-thread {
        flex: 1 1 auto;
        min-height: 0;
      }
      .comms-split.mobile-show-thread .thread-body {
        position: relative;
        flex: 1 1 auto !important;
        min-height: 0 !important;
        display: flex;
        flex-direction: column;
        overflow: hidden;
        padding-bottom: var(--crm-composer-h, 52px);
        gap: 0;
      }
      .comms-split.mobile-show-thread .msg-list {
        flex: 1 1 auto !important;
        max-height: none !important;
        min-height: 0;
        overflow-y: auto;
        overscroll-behavior: contain;
        -webkit-overflow-scrolling: touch;
        touch-action: pan-y;
        border-radius: 0;
        border-left: none;
        border-right: none;
        scroll-padding-bottom: 2px;
      }
      .tg-thread-head {
        padding: 4px 2px 6px;
        gap: 6px;
      }
      .tg-thread-head-inner {
        gap: 8px;
      }
      .tg-thread-avatar {
        width: 36px;
        height: 36px;
        font-size: 15px;
      }
      .tg-thread-sub {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
      }
      .thread-channel-seg {
        padding: 0 0 2px 40px;
      }
      .thread-channel-seg button.thread-ch-switch {
        padding: 5px 12px;
        font-size: 12px;
      }
      .composer-bar {
        flex-shrink: 0;
        padding: 0;
        background: transparent;
        position: static;
        z-index: 6;
        align-self: stretch;
      }
      .panel-comms.comms-mobile-thread-open .composer-bar {
        position: absolute;
        left: 0;
        right: 0;
        width: 100%;
        bottom: 0;
        z-index: 45;
        margin: 0;
        gap: 0;
        padding: 4px 8px max(4px, env(safe-area-inset-bottom, 0px));
        background: #fff;
        border-top: 1px solid #cbd5e1;
        box-shadow: 0 -2px 12px rgba(15, 23, 42, 0.06);
        box-sizing: border-box;
      }
      .panel-comms.composer-keyboard-open.comms-mobile-thread-open .composer-bar {
        padding: 3px 8px 3px;
        box-shadow: 0 -1px 8px rgba(15, 23, 42, 0.05);
      }
      .composer-main-row {
        --composer-row-h: 36px;
        gap: 4px;
        align-items: center;
      }
      .composer-tools-inline {
        gap: 0;
      }
      .composer-tools-inline .composer-tool-btn,
      .composer-send-round {
        width: var(--composer-row-h);
        height: var(--composer-row-h);
        min-height: var(--composer-row-h);
        max-height: var(--composer-row-h);
      }
      .composer-tools-inline .composer-tool-btn {
        border-radius: 50%;
      }
      .composer-tools-inline .composer-tool-btn .crm-icon {
        width: 20px;
        height: 20px;
      }
      .composer-send-round .crm-icon-send {
        width: 18px;
        height: 18px;
      }
      .composer-tools-inline .composer-tool-voice {
        display: none;
      }
      .composer-field-wrap {
        flex: 1 1 auto;
        min-width: 0;
      }
      .composer-bar textarea,
      .composer-bar textarea#sendText {
        width: 100%;
        font-size: 16px;
        min-height: var(--composer-row-h);
        max-height: min(26vh, 112px);
        margin: 0;
        line-height: 20px;
        padding: 6px 10px;
        border-radius: 18px;
      }
      .composer-send-round {
        width: var(--composer-row-h);
        height: var(--composer-row-h);
        min-height: var(--composer-row-h);
        max-height: var(--composer-row-h);
        flex: 0 0 var(--composer-row-h);
      }
      .msg-list {
        padding: 8px 8px 2px;
      }
      .composer-keyboard-grab {
        display: none !important;
      }
      .panel-comms.composer-keyboard-open .composer-keyboard-grab {
        display: none !important;
      }
      .panel-comms.composer-keyboard-open.comms-mobile-thread-open {
        overflow: hidden;
      }
      .panel-comms.composer-keyboard-open .composer-bar textarea,
      .panel-comms.composer-keyboard-open .composer-bar textarea#sendText {
        max-height: min(22vh, 96px);
      }
      .composer-send-label {
        font-size: 14px;
      }
      .bubble-actions .bubble-act {
        display: none !important;
      }
      summary.top-summary {
        padding-top: max(8px, env(safe-area-inset-top));
        padding-bottom: 8px;
        gap: 8px 10px;
      }
      .board-mobile-wrap { display: block; }
      .board-desktop { display: none !important; }
      .hint-banner { margin: 0 8px; font-size: 12px; }
    }

    @media (min-width: 901px) {
      .board-mobile-wrap { display: none !important; }
      .board-desktop { display: grid !important; }
      .panel-comms .split.comms-split {
        grid-template-columns: minmax(260px, 340px) minmax(0, 1fr);
        gap: 12px;
        align-items: stretch;
        min-height: 280px;
        width: 100%;
      }
      .panel-comms .comms-pane.chats-pane {
        display: flex;
        flex-direction: column;
        min-height: 0;
        border-right: 1px solid var(--line);
        padding-right: 10px;
      }
      .panel-comms .chat-list {
        flex: 0 0 auto;
        max-height: min(66vh, 620px);
        min-height: 280px;
        height: min(66vh, 620px);
        width: 100%;
        overflow-y: auto;
      }
      .panel-comms .thread-pane {
        min-height: 0;
        display: flex;
        flex-direction: column;
      }
      .panel-comms .thread-body {
        flex: 1 1 auto;
        min-height: 0;
        display: flex;
        flex-direction: column;
      }
      .panel-comms .msg-list {
        flex: 1 1 auto;
        max-height: min(66vh, 620px);
        min-height: 240px;
        width: 100%;
        overflow-y: auto;
      }
      .panel-comms .panel-body { padding-left: 10px; padding-right: 10px; }
    }
    @media (max-width: 760px) {
      .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
      /* Карточка лида на телефоне: нижний лист на весь экран */
      .lead-drawer {
        top: auto;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        max-width: 100vw;
        height: min(92dvh, 100%);
        max-height: 92dvh;
        border-radius: 18px 18px 0 0;
        border-left: none;
        border-top: 1px solid var(--line);
        box-shadow: 0 -12px 40px rgba(15, 23, 42, 0.22);
        transform: translateY(105%);
      }
      .lead-drawer.open { transform: translateY(0); }
      .drawer-head {
        position: sticky;
        top: 0;
        z-index: 2;
        background: linear-gradient(165deg, #fffdf4 0%, #fff 55%);
      }
      .lead-drawer-close {
        min-width: 48px;
        min-height: 48px;
      }
    }
    .crm-boot-overlay {
      position: fixed; inset: 0; z-index: 99999;
      display: flex; align-items: center; justify-content: center;
      background: #f8fafc; color: #0f172a;
      font: 600 16px/1.4 Inter, system-ui, sans-serif;
      padding: 24px; text-align: center;
    }
    .crm-boot-overlay.err { background: #fff1f2; color: #991b1b; }
    .crm-boot-overlay[hidden] { display: none !important; }
    .crm-mobile-more-btn {
      display: block; width: 100%; margin: 8px 0 4px;
      padding: 10px 12px; border-radius: 10px;
      border: 1px dashed var(--line); background: #fff;
      font: inherit; cursor: pointer; color: var(--accent);
    }

    .lead-attention-panel {
      margin: 14px 0 16px;
      padding: 0;
      border-radius: 16px;
      border: 1px solid rgba(251, 191, 36, 0.28);
      background: linear-gradient(165deg, #fffef8 0%, #fffbf5 28%, #ffffff 72%);
      width: 100%;
      max-width: 100%;
      min-width: 0;
      overflow: hidden;
      box-sizing: border-box;
      position: relative;
    }
    .lead-attention-panel::before {
      content: "";
      position: absolute;
      inset: 0;
      border-radius: inherit;
      padding: 1px;
      background: linear-gradient(135deg, rgba(251, 191, 36, 0.45), rgba(251, 146, 60, 0.22), rgba(251, 191, 36, 0.35));
      -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
      -webkit-mask-composite: xor;
      mask-composite: exclude;
      pointer-events: none;
    }
    .lead-attention-panel.has-attention {
      box-shadow:
        0 0 0 1px rgba(251, 191, 36, 0.14),
        0 8px 24px rgba(180, 83, 9, 0.08),
        0 2px 8px rgba(217, 119, 6, 0.05);
    }
    .lead-attention-summary {
      list-style: none;
      cursor: pointer;
      padding: 14px 14px 14px 12px;
      display: flex;
      align-items: center;
      gap: 10px;
      min-width: 0;
      max-width: 100%;
      overflow: hidden;
      box-sizing: border-box;
      background: linear-gradient(135deg, #d97706 0%, #ea580c 48%, #f59e0b 100%);
      color: #fff;
    }
    .lead-attention-icon {
      flex-shrink: 0;
      width: 40px;
      height: 40px;
      border-radius: 12px;
      display: flex;
      align-items: center;
      justify-content: center;
      background: rgba(255, 255, 255, 0.16);
      border: 1px solid rgba(255, 255, 255, 0.28);
      color: #fff7ed;
    }
    .lead-attention-icon svg { width: 22px; height: 22px; }
    .lead-attention-summary::-webkit-details-marker { display: none; }
    .lead-attention-head {
      display: flex;
      flex-direction: column;
      align-items: flex-start;
      gap: 2px;
      min-width: 0;
      flex: 1 1 0%;
      overflow: hidden;
      margin: 0;
    }
    .lead-attention-title-wrap {
      display: flex;
      align-items: center;
      gap: 8px;
      min-width: 0;
      width: 100%;
      max-width: 100%;
      overflow: hidden;
    }
    .lead-attention-head h4 {
      margin: 0;
      font-size: 15px;
      font-weight: 800;
      color: #fff;
      letter-spacing: 0.01em;
      flex: 1 1 0%;
      min-width: 0;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }
    .lead-attention-summary-meta {
      font-size: 12px;
      line-height: 1.35;
      max-width: 100%;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
      color: rgba(255, 251, 235, 0.92);
    }
    .lead-attention-chevron,
    .tasks-panel-chevron {
      flex: 0 0 auto;
      width: 28px;
      height: 28px;
      border-radius: 999px;
      background: rgba(255, 255, 255, 0.12);
      border: 1px solid rgba(255, 255, 255, 0.2);
      position: relative;
    }
    .lead-attention-chevron::before,
    .tasks-panel-chevron::before {
      content: "";
      position: absolute;
      inset: 0;
      margin: auto;
      width: 7px;
      height: 7px;
      border-right: 2px solid #fff7ed;
      border-bottom: 2px solid #fff7ed;
      transform: rotate(45deg);
      transition: transform 0.15s ease;
    }
    .lead-attention-panel[open] .lead-attention-chevron::before,
    .tasks-panel-details[open] .tasks-panel-chevron::before {
      transform: rotate(-135deg);
      margin-top: 4px;
    }
    .tasks-panel-chevron {
      background: rgba(109, 40, 217, 0.1);
    }
    .tasks-panel-chevron::before {
      border-color: #6d28d9;
    }
    .lead-attention-body {
      padding: 12px 14px 14px;
      max-width: 100%;
      min-width: 0;
      overflow: hidden;
      box-sizing: border-box;
      background: linear-gradient(180deg, rgba(255, 251, 235, 0.35) 0%, #fff 100%);
    }
    .lead-attention-count {
      min-width: 32px;
      padding: 3px 10px;
      border-radius: 999px;
      background: linear-gradient(180deg, #fff7ed 0%, #fed7aa 100%);
      color: #c2410c;
      font-size: 13px;
      font-weight: 900;
      text-align: center;
      flex: 0 0 auto;
      box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
    }
    .lead-attention-hint {
      margin: 0 0 12px;
      font-size: 12px;
      line-height: 1.5;
      color: #78716c;
    }
    .lead-attention-hint strong { color: #c2410c; }
    .lead-attention-admin-hint {
      margin: 0 0 10px;
      padding: 10px 12px;
      border-radius: 12px;
      font-size: 12px;
      line-height: 1.45;
      color: #92400e;
      background: linear-gradient(90deg, #fffbeb 0%, #fff 100%);
      border: 1px solid #fcd34d;
      box-shadow: 0 2px 10px rgba(217, 119, 6, 0.08);
    }
    .lead-attention-admin-hint strong { color: #b45309; font-weight: 800; }
    .lead-attention-admin-hint[hidden] { display: none !important; }
    .lead-attention-list {
      display: flex;
      flex-direction: column;
      gap: 8px;
      max-height: min(300px, 44vh);
      overflow-y: auto;
      overflow-x: hidden;
      -webkit-overflow-scrolling: touch;
      max-width: 100%;
      min-width: 0;
      padding-right: 2px;
    }
    .lead-attention-panel--admin .lead-attention-list {
      max-height: min(340px, 48vh);
    }
    .lead-attention-item {
      display: flex;
      flex-direction: column;
      gap: 0;
      align-items: stretch;
      padding: 0;
      border-radius: 12px;
      background: #fff;
      border: 1px solid #fde8d8;
      border-left: 4px solid #fdba74;
      cursor: default;
      text-align: left;
      width: 100%;
      max-width: 100%;
      min-width: 0;
      box-sizing: border-box;
      font: inherit;
      overflow-x: hidden;
      overflow-y: visible;
      flex-shrink: 0;
      transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.12s ease;
    }
    .lead-attention-item-open {
      display: grid;
      grid-template-columns: minmax(0, max-content) minmax(0, 1fr) auto;
      gap: 10px;
      align-items: start;
      padding: 12px 14px;
      border: none;
      border-radius: 12px 12px 0 0;
      background: transparent;
      cursor: pointer;
      text-align: left;
      width: 100%;
      max-width: 100%;
      min-width: 0;
      box-sizing: border-box;
      font: inherit;
    }
    .lead-attention-item:not(:has(.lead-attention-assign)) .lead-attention-item-open {
      border-radius: 12px;
    }
    .lead-attention-item-open:hover + .lead-attention-assign,
    .lead-attention-item:has(.lead-attention-item-open:hover) {
      border-color: #fdba74;
      box-shadow: 0 4px 14px rgba(180, 83, 9, 0.08);
    }
    .lead-attention-assign {
      display: flex;
      align-items: center;
      gap: 8px;
      padding: 8px 12px 11px;
      border-top: 1px dashed #fde8d8;
      background: linear-gradient(180deg, #fffaf5 0%, #fff 100%);
    }
    .lead-attention-assign-select {
      flex: 1 1 auto;
      min-width: 0;
      padding: 8px 10px;
      border-radius: 10px;
      border: 1px solid #fcd34d;
      background: #fff;
      font: inherit;
      font-size: 13px;
      color: #1c1917;
    }
    .lead-attention-assign-btn {
      flex: 0 0 auto;
      padding: 8px 12px;
      border-radius: 10px;
      border: 1px solid #fdba74;
      background: linear-gradient(180deg, #fff7ed 0%, #ffedd5 100%);
      color: #9a3412;
      font: inherit;
      font-size: 12px;
      font-weight: 800;
      cursor: pointer;
      white-space: nowrap;
      touch-action: manipulation;
    }
    .lead-attention-assign-btn:hover {
      border-color: #f97316;
      background: #ffedd5;
    }
    .lead-assign-owner-row {
      display: flex;
      gap: 8px;
      align-items: stretch;
      flex-wrap: wrap;
    }
    .lead-assign-owner-row .lead-field-input {
      flex: 1 1 180px;
      min-width: 0;
      margin-bottom: 0;
    }
    .lead-assign-owner-row .touch-lg {
      flex: 0 0 auto;
      min-height: 42px;
      padding-left: 14px;
      padding-right: 14px;
    }
    .lead-attention-item--critical {
      border-left-color: #f97316;
      background: linear-gradient(90deg, #fffaf5 0%, #fff 24%);
      box-shadow: 0 2px 10px rgba(249, 115, 22, 0.06);
    }
    .lead-attention-item--unassigned {
      border-left-color: #d97706;
      background: linear-gradient(90deg, #fffbeb 0%, #fff 30%);
      box-shadow: 0 4px 14px rgba(217, 119, 6, 0.1);
    }
    .lead-attention-item-main { min-width: 0; overflow: visible; }
    .lead-attention-item .lead-health-badge {
      max-width: 100%;
      white-space: normal;
      line-height: 1.2;
      text-align: center;
      font-size: 10px;
      font-weight: 800;
      letter-spacing: 0.02em;
      text-transform: uppercase;
    }
    .lead-attention-item-go {
      flex: 0 0 auto;
      align-self: center;
      width: 32px;
      height: 32px;
      border-radius: 50%;
      display: flex;
      align-items: center;
      justify-content: center;
      background: #fff7ed;
      color: #ea580c;
      font-weight: 800;
    }
    .lead-attention-item:hover {
      border-color: #fdba74;
      box-shadow: 0 4px 14px rgba(180, 83, 9, 0.08);
    }
    .lead-attention-item-open:hover {
      transform: translateY(-1px);
    }
    .lead-attention-item strong {
      display: block;
      font-size: 14px;
      line-height: 1.3;
      word-break: break-word;
      color: #1c1917;
    }
    .lead-attention-item .meta {
      font-size: 12px;
      color: #57534e;
      line-height: 1.4;
      word-break: break-word;
    }
    .lead-attention-item-sla {
      display: inline-block;
      margin-top: 4px;
      font-size: 11px;
      font-weight: 700;
      color: #b45309;
    }
    .lead-attention-item-manager {
      display: inline-flex;
      align-items: center;
      margin-bottom: 5px;
      padding: 3px 9px;
      border-radius: 999px;
      font-size: 11px;
      font-weight: 800;
      line-height: 1.35;
      color: #1e3a8a;
      background: #dbeafe;
      border: 1px solid #93c5fd;
    }
    .lead-attention-item-manager--none {
      color: #92400e;
      background: #fef3c7;
      border-color: #f59e0b;
      box-shadow: 0 0 0 1px rgba(245, 158, 11, 0.15);
    }
    .lead-health-badge {
      display: inline-flex;
      align-items: center;
      padding: 2px 7px;
      border-radius: 999px;
      font-size: 10px;
      font-weight: 800;
      letter-spacing: 0.02em;
      white-space: nowrap;
    }
    .lead-health-badge.health-critical {
      background: #fee2e2;
      color: #991b1b;
      border: 1px solid #fecaca;
    }
    .lead-health-badge.health-warn {
      background: #fef3c7;
      color: #92400e;
      border: 1px solid #fde68a;
    }
    .lead-health-badge.health-ok {
      background: #ecfdf5;
      color: #047857;
      border: 1px solid #a7f3d0;
    }
    .lead-health-summary {
      padding: 10px 12px;
      border-radius: 10px;
      background: #f8fafc;
      border: 1px solid var(--line);
      font-size: 13px;
      line-height: 1.45;
    }
    .lead-health-summary .lead-health-badge { margin-bottom: 6px; }
    .lead-attention-admin {
      margin-top: 12px;
      padding-top: 10px;
      border-top: 1px dashed #fecaca;
      overflow-x: auto;
      overflow-y: hidden;
      -webkit-overflow-scrolling: touch;
      max-width: 100%;
      min-width: 0;
      width: 100%;
    }
    .lead-attention-admin table {
      width: max-content;
      max-width: none;
      min-width: 0;
      border-collapse: collapse;
      font-size: 12px;
    }
    .lead-attention-admin th,
    .lead-attention-admin td {
      padding: 6px 8px;
      border-bottom: 1px solid #fee2e2;
      text-align: left;
    }
    .lead-attention-admin th { color: #64748b; font-weight: 700; }
    .lead-attention-admin-row--unassigned td {
      background: #fffbeb;
      color: #92400e;
      font-weight: 700;
    }
    .lead-attention-admin-row--unassigned td strong { color: #b45309; }
    .lead .lead-health-row { margin: 4px 0 2px; }

    .crm-mobile-jump {
      display: none;
      gap: 6px;
      padding: 8px 10px 4px;
      overflow-x: auto;
      -webkit-overflow-scrolling: touch;
      scrollbar-width: none;
      max-width: 100%;
      box-sizing: border-box;
    }
    .crm-mobile-jump::-webkit-scrollbar { display: none; }
    .crm-mobile-jump-btn {
      flex: 0 0 auto;
      display: inline-flex;
      align-items: center;
      gap: 6px;
      padding: 8px 12px;
      border-radius: 999px;
      border: 1px solid var(--line);
      background: #fff;
      font: inherit;
      font-size: 12px;
      font-weight: 700;
      cursor: pointer;
      touch-action: manipulation;
      white-space: nowrap;
    }
    .crm-mobile-jump-btn.has-alert {
      border-color: #fbbf24;
      background: linear-gradient(135deg, #7f1d1d 0%, #991b1b 100%);
      color: #fef3c7;
      animation: mobileJumpAttention 2.4s ease-in-out infinite;
    }
    @keyframes mobileJumpAttention {
      0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.35); }
      50% { box-shadow: 0 0 0 6px rgba(239, 68, 68, 0); }
    }
    .crm-mobile-jump-badge {
      min-width: 18px;
      padding: 1px 6px;
      border-radius: 999px;
      background: #e2e8f0;
      color: #334155;
      font-size: 11px;
      font-weight: 800;
      text-align: center;
    }
    .crm-mobile-jump-btn.has-alert .crm-mobile-jump-badge {
      background: linear-gradient(180deg, #fef08a 0%, #fbbf24 100%);
      color: #7f1d1d;
    }
    .crm-mobile-jump-tasks.has-alert {
      border-color: #c4b5fd;
      background: linear-gradient(135deg, #4c1d95 0%, #6d28d9 100%);
      color: #f5f3ff;
    }
    .crm-mobile-jump-tasks.has-alert .crm-mobile-jump-badge {
      background: linear-gradient(180deg, #ede9fe 0%, #ddd6fe 100%);
      color: #5b21b6;
    }
    .crm-mobile-jump-tasks.has-overdue {
      border-color: #fca5a5;
      background: linear-gradient(135deg, #7f1d1d 0%, #991b1b 100%);
      color: #fef2f2;
      animation: mobileJumpTasksOverdue 2.4s ease-in-out infinite;
    }
    .crm-mobile-jump-tasks.has-overdue .crm-mobile-jump-badge {
      background: linear-gradient(180deg, #fecaca 0%, #f87171 100%);
      color: #7f1d1d;
    }
    @keyframes mobileJumpTasksOverdue {
      0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.35); }
      50% { box-shadow: 0 0 0 6px rgba(239, 68, 68, 0); }
    }

    /* Липкая полоса «Требует внимания» */
    .attention-urgent-banner {
      position: sticky;
      top: 0;
      z-index: 28;
      margin: 0;
      padding: 0;
    }
    .attention-urgent-banner-inner {
      display: flex;
      align-items: center;
      gap: 12px;
      padding: 10px 14px;
      background: linear-gradient(135deg, #450a0a 0%, #7f1d1d 38%, #9a3412 100%);
      border-bottom: 1px solid rgba(251, 191, 36, 0.35);
      box-shadow: 0 8px 24px rgba(69, 10, 10, 0.25);
      color: #fff;
    }
    .attention-urgent-banner-icon {
      flex-shrink: 0;
      width: 36px;
      height: 36px;
      border-radius: 10px;
      display: flex;
      align-items: center;
      justify-content: center;
      background: rgba(255, 255, 255, 0.1);
      color: #fde68a;
    }
    .attention-urgent-banner-icon svg { width: 20px; height: 20px; }
    .attention-urgent-banner-text {
      flex: 1 1 auto;
      min-width: 0;
      display: flex;
      flex-direction: column;
      gap: 2px;
    }
    .attention-urgent-banner-text strong {
      font-size: 14px;
      font-weight: 800;
      letter-spacing: 0.02em;
    }
    .attention-urgent-banner-sub {
      font-size: 12px;
      color: rgba(254, 243, 199, 0.9);
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }
    .attention-urgent-banner-btn {
      flex-shrink: 0;
      border: none;
      border-radius: 999px;
      padding: 8px 14px;
      font: inherit;
      font-size: 12px;
      font-weight: 800;
      cursor: pointer;
      background: linear-gradient(180deg, #fef08a 0%, #fbbf24 100%);
      color: #7f1d1d;
      box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    }
    body.crm-comms-thread-open .attention-urgent-banner { display: none !important; }

    /* Toast-напоминания */
    .attention-remind-host {
      position: fixed;
      right: 14px;
      bottom: max(14px, env(safe-area-inset-bottom));
      z-index: 10050;
      display: grid;
      gap: 10px;
      max-width: min(380px, calc(100vw - 28px));
      pointer-events: none;
    }
    .attention-remind-toast {
      pointer-events: auto;
      position: relative;
      display: grid;
      grid-template-columns: auto 1fr auto;
      gap: 12px;
      align-items: center;
      padding: 14px 14px;
      border-radius: 16px;
      background: linear-gradient(145deg, #1c1917 0%, #450a0a 55%, #7f1d1d 100%);
      border: 1px solid rgba(251, 191, 36, 0.4);
      box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
      color: #fff;
      opacity: 0;
      transform: translateY(12px) scale(0.98);
      transition: opacity 0.28s ease, transform 0.28s ease;
    }
    .attention-remind-toast.is-visible {
      opacity: 1;
      transform: translateY(0) scale(1);
    }
    .attention-remind-toast-glow {
      position: absolute;
      inset: -1px;
      border-radius: inherit;
      background: linear-gradient(135deg, rgba(251, 191, 36, 0.5), transparent 50%);
      opacity: 0.35;
      pointer-events: none;
    }
    .attention-remind-toast-icon {
      width: 40px;
      height: 40px;
      border-radius: 12px;
      display: flex;
      align-items: center;
      justify-content: center;
      background: rgba(251, 191, 36, 0.15);
      color: #fde68a;
    }
    .attention-remind-toast-icon svg { width: 22px; height: 22px; }
    .attention-remind-toast-title { font-size: 14px; font-weight: 800; line-height: 1.3; }
    .attention-remind-toast-sub { font-size: 12px; color: rgba(254, 243, 199, 0.88); margin-top: 3px; line-height: 1.35; }
    .attention-remind-toast-actions { display: flex; flex-direction: column; gap: 6px; }
    .attention-remind-open {
      border: none;
      border-radius: 999px;
      padding: 8px 12px;
      font: inherit;
      font-size: 12px;
      font-weight: 800;
      cursor: pointer;
      background: linear-gradient(180deg, #fef08a 0%, #fbbf24 100%);
      color: #7f1d1d;
    }
    .attention-remind-later {
      border: none;
      background: transparent;
      color: rgba(255, 255, 255, 0.55);
      cursor: pointer;
      font-size: 14px;
      padding: 2px;
    }

    .tasks-panel-details { display: block; }
    .tasks-panel-summary {
      list-style: none;
      cursor: pointer;
      padding: 12px 14px;
      display: grid;
      grid-template-columns: auto minmax(0, 1fr) auto;
      grid-template-rows: auto auto auto;
      gap: 6px 10px;
      align-items: center;
      background: linear-gradient(165deg, #f5f3ff 0%, #faf5ff 28%, #ffffff 72%);
      border-bottom: 1px solid rgba(196, 181, 253, 0.45);
      position: relative;
    }
    .panel-tasks--overdue .tasks-panel-summary {
      background: linear-gradient(165deg, #fff1f2 0%, #fff7ed 28%, #ffffff 72%);
      border-bottom-color: rgba(252, 165, 165, 0.55);
    }
    .tasks-panel-icon {
      grid-column: 1;
      grid-row: 1 / span 2;
      width: 40px;
      height: 40px;
      border-radius: 12px;
      display: flex;
      align-items: center;
      justify-content: center;
      color: #6d28d9;
      background: linear-gradient(145deg, #ede9fe 0%, #ddd6fe 100%);
      border: 1px solid rgba(139, 92, 246, 0.25);
      box-shadow: 0 4px 12px rgba(109, 40, 217, 0.12);
      flex-shrink: 0;
    }
    .panel-tasks--overdue .tasks-panel-icon {
      color: #b91c1c;
      background: linear-gradient(145deg, #fee2e2 0%, #fecaca 100%);
      border-color: rgba(239, 68, 68, 0.3);
    }
    .tasks-panel-icon svg { width: 22px; height: 22px; }
    .tasks-panel-summary::-webkit-details-marker { display: none; }
    .tasks-panel-summary-main {
      display: flex;
      align-items: center;
      gap: 8px;
      min-width: 0;
      grid-column: 2;
      grid-row: 1;
    }
    .tasks-panel-summary .title {
      font-size: 16px;
      font-weight: 800;
      min-width: 0;
      color: #4c1d95;
    }
    .panel-tasks--overdue .tasks-panel-summary .title { color: #991b1b; }
    .tasks-panel-badge {
      min-width: 24px;
      padding: 3px 8px;
      border-radius: 999px;
      background: linear-gradient(180deg, #ddd6fe 0%, #c4b5fd 100%);
      color: #5b21b6;
      font-size: 11px;
      font-weight: 800;
      text-align: center;
      flex: 0 0 auto;
      box-shadow: 0 1px 4px rgba(109, 40, 217, 0.15);
    }
    .tasks-panel-badge.has-overdue {
      background: linear-gradient(180deg, #fca5a5 0%, #ef4444 100%);
      color: #fff;
      animation: tasksBadgePulse 2s ease-in-out infinite;
    }
    .tasks-panel-badge.has-today {
      background: linear-gradient(180deg, #fde68a 0%, #f59e0b 100%);
      color: #78350f;
    }
    @keyframes tasksBadgePulse {
      0%, 100% { transform: scale(1); }
      50% { transform: scale(1.06); }
    }
    .tasks-panel-stats {
      grid-column: 2;
      grid-row: 2;
      display: flex;
      flex-wrap: wrap;
      gap: 6px;
      min-width: 0;
    }
    .tasks-panel-stats[hidden] { display: none !important; }
    .tasks-panel-stat {
      display: inline-flex;
      align-items: center;
      padding: 2px 8px;
      border-radius: 999px;
      font-size: 10px;
      font-weight: 800;
      letter-spacing: 0.02em;
      text-transform: uppercase;
    }
    .tasks-panel-stat--overdue {
      color: #991b1b;
      background: #fee2e2;
      border: 1px solid #fca5a5;
    }
    .tasks-panel-stat--today {
      color: #92400e;
      background: #fef3c7;
      border: 1px solid #fcd34d;
    }
    .tasks-panel-preview {
      margin: 0;
      grid-column: 2 / -1;
      grid-row: 3;
      font-size: 12px;
      line-height: 1.4;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
      max-width: 100%;
    }
    .tasks-panel-preview.is-overdue { color: #b91c1c; font-weight: 700; }
    .tasks-panel-preview.is-today { color: #b45309; font-weight: 700; }
    .tasks-panel-preview.is-active { color: #5b21b6; font-weight: 600; }
    .tasks-panel-chevron { grid-column: 3; grid-row: 1; align-self: center; }
    .tasks-panel-body {
      padding: 10px 12px 12px;
      max-width: 100%;
      box-sizing: border-box;
    }
    .tasks-quick-add-wrap {
      display: flex;
      gap: 8px;
      flex-wrap: wrap;
      margin-bottom: 10px;
    }
    .tasks-quick-add-wrap input {
      flex: 1 1 160px;
      min-width: 0;
      max-width: 100%;
    }
    .tasks-open-all-link {
      display: inline-block;
      margin-top: 8px;
      font-size: 13px;
      font-weight: 700;
      text-decoration: none;
      color: #1d4ed8;
    }

    /* —— Мягкое напоминание по лидам (низ экрана) —— */
    .followup-push-overlay {
      position: fixed;
      inset: 0;
      z-index: 103000;
      display: flex;
      align-items: flex-end;
      justify-content: center;
      padding: 0 12px max(16px, env(safe-area-inset-bottom));
      pointer-events: none;
    }
    .followup-push-overlay.followup-push-soft .followup-push-backdrop {
      background: rgba(8, 10, 14, 0.35);
      backdrop-filter: blur(4px);
      -webkit-backdrop-filter: blur(4px);
    }
    .followup-push-overlay[hidden] { display: none !important; }
    .followup-push-overlay.followup-push-visible { pointer-events: auto; }
    .followup-push-backdrop {
      position: absolute;
      inset: 0;
      opacity: 0;
      transition: opacity 0.28s ease;
    }
    .followup-push-overlay.followup-push-visible .followup-push-backdrop { opacity: 1; }
    .followup-push-sheet {
      position: relative;
      width: min(440px, 100%);
      max-height: min(72vh, 520px);
      padding: 20px 18px 18px;
      border-radius: 20px 20px 16px 16px;
      border: 1px solid rgba(252, 211, 77, 0.28);
      background: linear-gradient(155deg, #1e293b 0%, #0f172a 100%);
      box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.35);
      color: #f8fafc;
      transform: translateY(100%);
      opacity: 0;
      transition: transform 0.34s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.28s ease;
    }
    .followup-push-overlay.followup-push-visible .followup-push-sheet {
      transform: translateY(0);
      opacity: 1;
    }
    .followup-push-kicker {
      font-size: 11px;
      font-weight: 800;
      letter-spacing: 0.06em;
      text-transform: uppercase;
      margin-bottom: 8px;
    }
    .followup-push-kicker.is-urgent { color: #fca5a5; }
    .followup-push-kicker.is-nurture { color: #fcd34d; }
    .followup-push-title {
      margin: 0 0 6px;
      font-size: 18px;
      font-weight: 800;
      line-height: 1.25;
    }
    .followup-push-sub {
      margin: 0 0 8px;
      font-size: 13px;
      color: rgba(254, 243, 199, 0.85);
    }
    .followup-push-timing {
      margin: 0 0 10px;
      padding: 8px 10px;
      border-radius: 10px;
      background: rgba(252, 211, 77, 0.12);
      border: 1px solid rgba(252, 211, 77, 0.25);
      font-size: 12px;
      line-height: 1.4;
      color: #fde68a;
    }
    .followup-push-preview {
      margin-bottom: 14px;
      padding: 12px;
      border-radius: 12px;
      background: rgba(255, 255, 255, 0.06);
      font-size: 13px;
      line-height: 1.45;
      color: #e2e8f0;
      max-height: 100px;
      overflow: auto;
    }
    .followup-push-actions {
      display: flex;
      flex-direction: column;
      gap: 8px;
    }
    .followup-push-btn {
      width: 100%;
      min-height: 44px;
      border-radius: 12px;
      border: none;
      font-size: 14px;
      font-weight: 700;
      cursor: pointer;
    }
    .followup-push-btn-primary {
      background: linear-gradient(145deg, #fcd34d 0%, #f59e0b 100%);
      color: #1e293b;
    }
    .followup-push-btn-ghost {
      background: rgba(255, 255, 255, 0.1);
      color: #f8fafc;
    }
    .followup-push-btn-muted {
      background: transparent;
      color: rgba(248, 250, 252, 0.5);
      border: 1px solid rgba(255, 255, 255, 0.12);
    }
    .followup-push-dismiss {
      position: absolute;
      top: 8px;
      right: 8px;
      width: 36px;
      height: 36px;
      border: none;
      border-radius: 10px;
      background: rgba(255, 255, 255, 0.08);
      color: rgba(248, 250, 252, 0.65);
      font-size: 18px;
      cursor: pointer;
    }
    body.followup-push-open { overflow: hidden; }
