/* Каркас личного кабинета (M08 shell) + мобильный проход M01. */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  overflow-x: hidden;
}

:root {
  color-scheme: light;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  line-height: 1.5;

  /* Пастельная жёлто-фиолетовая палитра (зеркало tailwind_brand_config). */
  --brand-50: #F1EEFC;
  --brand-100: #FEF7DD;
  --brand-200: #E8E2FA;
  --brand-500: #9D8EED;
  --brand-600: #8B7AE8;
  --brand-700: #7568D4;
  --brand-900: #322E45;
  --accent: #F7D774;
  --page-bg: #FBFAFD;
  --ink: #322E45;
  --ink-muted: #5c5670;
  --border: #E8E2FA;
  --border-input: #D5CFF0;
  --lk-touch-min: 2.75rem;
}

body {
  margin: 0;
  background: var(--page-bg);
  color: var(--ink);
  font-size: 1rem;
  overflow-x: hidden;
}

.lk-app {
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  padding: 1rem 1rem 2rem;
  min-width: 0;
}

.lk-content {
  min-height: 12rem;
}

.lk-offline-shell {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 2rem 1rem;
  text-align: center;
  min-height: 60vh;
}

.lk-brand {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--brand-600);
  letter-spacing: 0.02em;
}

.lk-page-header {
  margin-bottom: 1.25rem;
}

.lk-page-header h1 {
  margin: 0 0 0.35rem;
  font-size: 1.5rem;
}

.lk-header {
  margin-bottom: 1.5rem;
}

.lk-header h1 {
  margin: 0 0 0.25rem;
  font-size: 1.5rem;
}

.lk-muted {
  color: var(--ink-muted);
  margin: 0;
}

.lk-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.25rem;
}

.lk-card-muted {
  margin-top: 1rem;
}

.lk-form-card {
  max-width: 420px;
}

.lk-form {
  display: grid;
  gap: 1rem;
}

.lk-field {
  display: grid;
  gap: 0.35rem;
}

.lk-field span {
  font-size: 0.9rem;
  color: var(--ink-muted);
}

.lk-field input {
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--border-input);
  border-radius: 6px;
  font: inherit;
  font-size: 1rem;
  width: 100%;
  max-width: 100%;
}

.lk-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--lk-touch-min);
  padding: 0.6rem 1rem;
  border: none;
  border-radius: 6px;
  background: var(--brand-600);
  color: #fff;
  font: inherit;
  font-size: 1rem;
  cursor: pointer;
}

.lk-btn:hover {
  background: var(--brand-700);
}

.lk-error {
  margin: 0 0 1rem;
  padding: 0.65rem 0.75rem;
  border-radius: 6px;
  background: #fdecea;
  color: #9b1c1c;
}

.lk-topbar {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
  min-width: 0;
}

.lk-topbar-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  width: 100%;
  min-width: 0;
}

.lk-topbar-panel {
  display: none;
  flex-direction: column;
  gap: 0.85rem;
  width: 100%;
  padding-top: 0.85rem;
}

.lk-topbar-panel.is-open {
  display: flex;
}

.lk-burger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: var(--lk-touch-min);
  min-height: var(--lk-touch-min);
  padding: 0;
  border: 1px solid var(--border-input);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
}

.lk-burger:hover {
  background: var(--brand-100);
}

.lk-burger-bars {
  position: relative;
  display: block;
  width: 1.15rem;
  height: 2px;
  border-radius: 1px;
  background: currentColor;
}

.lk-burger-bars::before,
.lk-burger-bars::after {
  display: block;
  width: 1.15rem;
  height: 2px;
  border-radius: 1px;
  background: currentColor;
  content: "";
  position: absolute;
  left: 0;
}

.lk-burger-bars::before {
  top: -6px;
}

.lk-burger-bars::after {
  top: 6px;
}

@media (min-width: 768px) {
  .lk-topbar {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 1rem 1.5rem;
  }

  .lk-topbar-row {
    display: contents;
  }

  .lk-burger {
    display: none;
  }

  .lk-topbar-panel {
    display: contents;
  }

  .lk-nav {
    justify-self: center;
  }

  .lk-user-menu {
    justify-self: end;
  }
}

.lk-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  min-width: 0;
}

@media (max-width: 767px) {
  .lk-nav {
    flex-direction: column;
    flex-wrap: nowrap;
    gap: 0;
  }
}

.lk-nav-link {
  color: var(--brand-600);
  text-decoration: none;
  font-weight: 500;
  padding: 0.2rem 0;
  border-bottom: 2px solid transparent;
}

@media (max-width: 767px) {
  .lk-nav-link {
    display: flex;
    align-items: center;
    min-height: var(--lk-touch-min);
    padding: 0.35rem 0;
    border-bottom: 1px solid var(--border);
  }

  .lk-nav-link.is-active {
    border-bottom-color: var(--brand-600);
  }

  .lk-topbar .lk-btn-sm {
    min-height: var(--lk-touch-min);
    padding: 0.5rem 1rem;
    font-size: 1rem;
  }

  .lk-user-menu {
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
  }
}

.lk-nav-link:hover {
  text-decoration: none;
  color: var(--brand-700);
}

.lk-nav-link.is-active {
  color: var(--brand-900);
  border-bottom-color: var(--brand-600);
}

.lk-user-menu {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.lk-user-name {
  color: var(--ink-muted);
  font-size: 0.95rem;
}

.lk-logout-form {
  margin: 0;
}

.lk-btn-ghost {
  background: transparent;
  color: var(--brand-600);
  border: 1px solid var(--border-input);
}

.lk-btn-ghost:hover {
  background: var(--brand-100);
}

.lk-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  background: var(--brand-100);
  border: 1px solid var(--accent);
  color: var(--brand-900);
}

.lk-table {
  width: 100%;
  border-collapse: collapse;
}

.lk-table th,
.lk-table td {
  padding: 0.55rem 0.65rem;
  border-bottom: 1px solid #e6ebf0;
  text-align: left;
}

.lk-inline-form {
  display: inline;
  margin: 0;
}

.lk-btn-sm {
  padding: 0.35rem 0.65rem;
  font-size: 0.9rem;
}

.lk-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}

.lk-stat-card {
  background: #fff;
  border: 1px solid #dde3ea;
  border-radius: 8px;
  padding: 1rem 1.1rem;
}

.lk-stat-label {
  margin: 0;
  font-size: 0.9rem;
  color: #5c6670;
}

.lk-stat-value {
  margin: 0.35rem 0 0.25rem;
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.1;
  color: var(--ink);
}

.lk-stat-hint {
  margin: 0;
  font-size: 0.82rem;
  color: #7a8794;
}

.lk-section-title {
  margin: 0 0 1rem;
  font-size: 1.05rem;
}

.lk-form-inline {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.75rem 1rem;
  align-items: end;
}

.lk-field select {
  padding: 0.55rem 0.65rem;
  border: 1px solid #c5ced8;
  border-radius: 6px;
  font: inherit;
  font-size: 1rem;
  background: #fff;
  width: 100%;
  max-width: 100%;
}

.lk-team-create {
  margin-bottom: 1rem;
}

.lk-flash {
  margin-bottom: 1rem;
  padding: 0.85rem 1rem;
  border-radius: 8px;
}

.lk-flash-success {
  background: #e8f5e9;
  border: 1px solid #a5d6a7;
  color: #1b5e20;
}

.lk-flash code {
  font-family: ui-monospace, monospace;
  font-size: 0.95rem;
}

.lk-badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.82rem;
}

.lk-badge-ok {
  background: #e8f5e9;
  color: #2e7d32;
}

.lk-badge-off {
  background: #f4f6f8;
  color: #5c6670;
}

.lk-badge-overdue {
  background: #fdecea;
  color: #9b1c1c;
  margin-left: 0.35rem;
}

.lk-badge-unread {
  background: #e3f2fd;
  color: #0d47a1;
  margin-left: 0.35rem;
  vertical-align: middle;
}

.lk-today-table td {
  vertical-align: top;
}

.lk-today-col-type {
  width: 2.5rem;
  text-align: center;
  font-size: 1.1rem;
}

.lk-today-phone {
  font-size: 0.88rem;
  margin-top: 0.15rem;
}

tr.lk-today-overdue td {
  background: #fff8f7;
}

.lk-crm-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.lk-crm-filters {
  margin-bottom: 1rem;
}

.lk-crm-filters-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.75rem 1rem;
}

.lk-crm-filters-details {
  border: none;
  margin: 0;
  padding: 0;
}

.lk-crm-filters-summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: var(--lk-touch-min);
  font-weight: 600;
  color: var(--brand-900);
  user-select: none;
}

.lk-crm-filters-summary::-webkit-details-marker {
  display: none;
}

.lk-crm-filters-summary::after {
  content: "▾";
  color: var(--ink-muted);
  font-size: 0.85rem;
  transition: transform 0.15s ease;
}

.lk-crm-filters-details[open] .lk-crm-filters-summary::after {
  transform: rotate(180deg);
}

.lk-crm-filters-details .lk-crm-filters-grid {
  margin-top: 0.85rem;
}

@media (min-width: 768px) {
  .lk-crm-filters-summary {
    display: none;
  }

  .lk-crm-filters-details .lk-crm-filters-grid {
    margin-top: 0;
  }
}

.lk-crm-list {
  padding: 0;
  overflow-x: auto;
}

.lk-crm-table {
  margin: 0;
}

.lk-crm-table th,
.lk-crm-table td {
  padding: 0.75rem 1rem;
}

.lk-crm-subtitle {
  font-size: 0.85rem;
  margin-top: 0.15rem;
}

.lk-crm-empty {
  text-align: center;
  padding: 2rem 1rem !important;
}

/* Таблицы CRM / «Сегодня» → карточки на узком экране (web_mobile_pass M02). */
@media (max-width: 767px) {
  .lk-crm-header {
    flex-direction: column;
    align-items: stretch;
  }

  .lk-crm-list {
    overflow-x: visible;
    padding: 0.75rem;
  }

  .lk-responsive-table thead {
    display: none;
  }

  .lk-responsive-table tbody {
    display: block;
  }

  .lk-responsive-table tr.lk-responsive-card-row {
    display: block;
    margin-bottom: 0.85rem;
    padding: 0.85rem 1rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fff;
  }

  .lk-responsive-table tr.lk-responsive-card-row:last-child {
    margin-bottom: 0;
  }

  tr.lk-today-overdue.lk-responsive-card-row {
    background: #fff8f7;
    border-color: #f5c2c7;
  }

  tr.lk-today-overdue.lk-responsive-card-row td {
    background: transparent;
  }

  .lk-responsive-table tr.lk-responsive-empty {
    display: block;
  }

  .lk-responsive-table tr.lk-responsive-empty td {
    display: block;
    border: none;
    padding: 1.5rem 0.5rem;
  }

  .lk-responsive-table tr.lk-responsive-card-row td {
    display: grid;
    grid-template-columns: minmax(5.5rem, 36%) 1fr;
    gap: 0.25rem 0.75rem;
    align-items: start;
    padding: 0.5rem 0;
    border-bottom: 1px solid #eef1f4;
    text-align: left;
  }

  .lk-responsive-table tr.lk-responsive-card-row td:last-child {
    border-bottom: none;
  }

  .lk-responsive-table tr.lk-responsive-card-row td::before {
    content: attr(data-label);
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--ink-muted);
    padding-top: 0.1rem;
  }

  .lk-responsive-table tr.lk-responsive-empty td::before {
    content: none;
  }

  .lk-today-col-type {
    width: auto;
    text-align: left;
    font-size: 1.25rem;
  }

  .lk-responsive-table .lk-btn-sm {
    min-height: var(--lk-touch-min);
    padding: 0.5rem 1rem;
    font-size: 1rem;
    width: 100%;
  }

  .lk-responsive-table .lk-inline-form {
    display: block;
    width: 100%;
  }
}

.lk-crm-back {
  margin: 0 0 1rem;
}

.lk-crm-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}

.lk-crm-card-header {
  margin-bottom: 1rem;
}

.lk-crm-card-title h1 {
  margin: 0 0 0.25rem;
  font-size: 1.45rem;
}

.lk-crm-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  color: #5c6670;
  font-size: 0.95rem;
}

.lk-crm-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  margin-top: 0.75rem;
}

.lk-crm-action-form {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 0.5rem;
}

.lk-field-inline {
  margin: 0;
}

.lk-field-inline select {
  padding: 0.45rem 0.55rem;
  border: 1px solid #c5ced8;
  border-radius: 6px;
  font: inherit;
  background: #fff;
}

.lk-dl {
  margin: 0;
  display: grid;
  gap: 0.65rem;
}

.lk-dl dt {
  font-size: 0.85rem;
  color: #5c6670;
}

.lk-dl dd {
  margin: 0.15rem 0 0;
}

.lk-subsection-title {
  margin: 1rem 0 0.5rem;
  font-size: 0.95rem;
}

.lk-crm-task-list {
  list-style: none;
  margin: 0 0 1rem;
  padding: 0;
  display: grid;
  gap: 0.65rem;
}

.lk-crm-task-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  padding-bottom: 0.65rem;
  border-bottom: 1px solid #e6ebf0;
}

.lk-crm-add-task-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.65rem;
  align-items: end;
}

.lk-field-grow {
  grid-column: span 2;
}

.lk-crm-note-form {
  margin-top: 1rem;
  display: grid;
  gap: 0.65rem;
}

.lk-crm-note-form textarea {
  padding: 0.55rem 0.65rem;
  border: 1px solid #c5ced8;
  border-radius: 6px;
  font: inherit;
  font-size: 1rem;
  resize: vertical;
  width: 100%;
  max-width: 100%;
}

.lk-crm-timeline-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.85rem;
}

.lk-crm-timeline-item {
  display: grid;
  grid-template-columns: 7.5rem 1fr;
  gap: 0.75rem;
}

.lk-crm-timeline-body p {
  margin: 0.25rem 0;
}

.lk-crm-timeline-meta {
  font-size: 0.82rem;
}

.lk-crm-inbox {
  margin-top: 1rem;
}

.lk-crm-inbox-scroll {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  max-height: 420px;
  overflow-y: auto;
  padding: 0.35rem 0.15rem;
}

.lk-crm-inbox-msg {
  max-width: 85%;
  padding: 0.55rem 0.75rem;
  border-radius: 8px;
  border: 1px solid #dde3ea;
  background: #fff;
}

.lk-crm-inbox-msg--client {
  align-self: flex-start;
  background: var(--brand-100);
}

.lk-crm-inbox-msg--bot,
.lk-crm-inbox-msg--operator {
  align-self: flex-end;
  background: var(--brand-50);
  border-color: var(--brand-200);
}

.lk-crm-inbox-msg--system {
  align-self: center;
  max-width: 95%;
  background: #fafafa;
  font-size: 0.92rem;
}

.lk-crm-inbox-msg-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.65rem;
  font-size: 0.78rem;
  margin-bottom: 0.25rem;
}

.lk-crm-inbox-channel {
  font-weight: 600;
}

.lk-crm-inbox-msg-body {
  white-space: pre-wrap;
  word-break: break-word;
}

.lk-crm-reply-form {
  margin-top: 0.85rem;
  padding-top: 0.85rem;
  border-top: 1px solid #e8edf2;
  display: grid;
  gap: 0.65rem;
}

.lk-crm-reply-form textarea {
  padding: 0.55rem 0.65rem;
  border: 1px solid #c5ced8;
  border-radius: 6px;
  font: inherit;
  font-size: 1rem;
  resize: vertical;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.lk-crm-inbox-panel {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.lk-crm-inbox-messages-wrap {
  min-width: 0;
}

.lk-crm-mobile-actions {
  margin: 0.5rem 0 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  padding: 0.35rem 0.75rem 0.75rem;
}

.lk-crm-mobile-actions-summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  min-height: var(--lk-touch-min);
  font-weight: 600;
  color: var(--brand-600);
  user-select: none;
}

.lk-crm-mobile-actions-summary::-webkit-details-marker {
  display: none;
}

.lk-crm-mobile-actions-summary::after {
  content: "▾";
  margin-left: auto;
  color: var(--ink-muted);
  font-size: 0.85rem;
}

.lk-crm-mobile-actions[open] .lk-crm-mobile-actions-summary::after {
  transform: rotate(180deg);
}

.lk-crm-mobile-actions-body {
  padding-top: 0.65rem;
  display: grid;
  gap: 0.75rem;
}

@media (min-width: 768px) {
  .lk-crm-mobile-actions {
    border: none;
    padding: 0;
    margin: 0;
    background: transparent;
  }

  .lk-crm-mobile-actions-summary {
    display: none;
  }

  .lk-crm-mobile-actions-body {
    padding-top: 0;
  }
}

.lk-crm-reply-note,
.lk-crm-reply-hint {
  margin: 0;
  font-size: 0.85rem;
}

.lk-crm-bot-badge {
  font-weight: 600;
  font-size: 0.82rem;
  padding: 0.1rem 0.45rem;
  border-radius: 4px;
}

.lk-crm-bot-badge--on {
  background: #e8f5e9;
  color: #1b5e20;
}

.lk-crm-bot-badge--off {
  background: #fff3e0;
  color: #e65100;
}

.lk-crm-bot-badge--na {
  font-weight: normal;
}

.lk-crm-bot-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: flex-end;
  margin: 0.5rem 0 0.75rem;
}

.lk-kanban-board {
  overflow-x: auto;
}

.lk-kanban-columns {
  display: flex;
  gap: 0.85rem;
  align-items: flex-start;
  min-height: 320px;
  padding-bottom: 0.5rem;
}

.lk-kanban-column {
  flex: 0 0 240px;
  background: #fff;
  border: 1px solid #dde3ea;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  max-height: 70vh;
}

.lk-kanban-column-terminal {
  flex: 0 0 200px;
  opacity: 0.95;
}

.lk-kanban-column-won {
  border-color: #a5d6a7;
  background: #f6fff6;
}

.lk-kanban-column-lost {
  border-color: #ef9a9a;
  background: #fff8f7;
}

.lk-kanban-column-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.75rem 0.85rem;
  border-bottom: 1px solid #e6ebf0;
}

.lk-kanban-column-header h2 {
  margin: 0;
  font-size: 0.95rem;
}

.lk-kanban-column-body {
  padding: 0.65rem;
  display: grid;
  gap: 0.55rem;
  overflow-y: auto;
  flex: 1;
}

.lk-kanban-column.is-drag-over .lk-kanban-column-body {
  background: var(--brand-50);
  outline: 2px dashed var(--brand-600);
  outline-offset: -4px;
  border-radius: 4px;
}

.lk-kanban-card {
  background: #f8fafc;
  border: 1px solid #dde3ea;
  border-radius: 6px;
  padding: 0.65rem 0.7rem;
  cursor: grab;
}

.lk-kanban-card.is-dragging {
  opacity: 0.55;
}

.lk-kanban-card[draggable="false"] {
  cursor: default;
}

.lk-kanban-card-title {
  font-weight: 600;
  color: var(--ink);
  text-decoration: none;
}

.lk-kanban-card-title:hover {
  color: var(--brand-600);
}

.lk-kanban-card-meta,
.lk-kanban-card-task {
  font-size: 0.82rem;
  margin-top: 0.2rem;
}

.lk-kanban-empty {
  margin: 0;
  font-size: 0.85rem;
  text-align: center;
  padding: 0.5rem 0;
}

.lk-kanban-desktop-hint {
  display: block;
}

.lk-kanban-mobile-hint {
  display: none;
}

.lk-kanban-mobile-move {
  display: none;
  margin-top: 0.65rem;
  border-top: 1px solid #e6ebf0;
  padding-top: 0.55rem;
}

.lk-kanban-mobile-move-summary {
  list-style: none;
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--brand-600);
  min-height: var(--lk-touch-min);
  display: flex;
  align-items: center;
}

.lk-kanban-mobile-move-summary::-webkit-details-marker {
  display: none;
}

.lk-kanban-mobile-move-actions {
  display: grid;
  gap: 0.45rem;
  margin-top: 0.45rem;
}

.lk-kanban-move-btn {
  width: 100%;
  justify-content: center;
}

/* Канбан на узком экране — snap-скролл колонок + перенос кнопкой (web_mobile_pass M03). */
@media (max-width: 767px) {
  .lk-kanban-desktop-hint {
    display: none;
  }

  .lk-kanban-mobile-hint {
    display: block;
  }

  .lk-kanban-board {
    margin: 0 -0.25rem;
    overflow-x: visible;
  }

  .lk-kanban-columns {
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scroll-padding-left: 0.25rem;
    gap: 0.75rem;
    min-height: 280px;
    padding-bottom: 0.75rem;
  }

  .lk-kanban-column {
    flex: 0 0 min(88vw, 300px);
    scroll-snap-align: start;
    max-height: none;
  }

  .lk-kanban-column-terminal {
    flex: 0 0 min(78vw, 260px);
  }

  .lk-kanban-column-body {
    max-height: 55vh;
  }

  .lk-kanban-card {
    cursor: default;
  }

  .lk-kanban-mobile-move {
    display: block;
  }

  .lk-kanban-move-btn {
    min-height: var(--lk-touch-min);
    font-size: 1rem;
  }

  /* Карточка CRM + инбокс (web_mobile_pass M04). */
  .lk-app:has(.lk-crm-inbox-panel) {
    padding-bottom: 5.5rem;
  }

  .lk-crm-card-grid {
    grid-template-columns: 1fr;
  }

  .lk-crm-card-title h1 {
    font-size: 1.25rem;
  }

  .lk-crm-card-meta {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.35rem;
  }

  .lk-crm-inbox-scroll {
    max-height: min(50vh, 420px);
    min-height: 12rem;
    width: 100%;
    padding: 0.35rem 0;
  }

  .lk-crm-inbox-msg {
    max-width: 92%;
  }

  .lk-crm-inbox-reply,
  .lk-crm-reply-form {
    position: sticky;
    bottom: 0;
    z-index: 2;
    background: #fff;
    margin-top: 0;
    padding-top: 0.75rem;
    border-top: 1px solid #e8edf2;
  }

  .lk-crm-reply-form .lk-crm-reply-submit {
    width: 100%;
    min-height: var(--lk-touch-min);
    font-size: 1rem;
  }

  .lk-crm-timeline-item {
    grid-template-columns: 1fr;
    gap: 0.25rem;
  }

  .lk-crm-add-task-grid {
    grid-template-columns: 1fr;
  }

  .lk-field-grow {
    grid-column: auto;
  }

  .lk-crm-task-item {
    flex-direction: column;
    align-items: stretch;
  }

  .lk-crm-task-item .lk-btn-sm {
    width: 100%;
    min-height: var(--lk-touch-min);
    font-size: 1rem;
  }

  .lk-crm-action-form {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
  }

  .lk-crm-action-form .lk-field-inline {
    width: 100%;
  }

  .lk-field-inline select {
    width: 100%;
    font-size: 1rem;
    padding: 0.55rem 0.65rem;
  }

  .lk-crm-action-form .lk-btn-sm {
    width: 100%;
    min-height: var(--lk-touch-min);
    font-size: 1rem;
  }

  .lk-crm-bot-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .lk-crm-bot-actions .lk-btn-sm {
    width: 100%;
    min-height: var(--lk-touch-min);
    font-size: 1rem;
  }

  .lk-crm-bot-channel {
    width: 100%;
  }

  .lk-crm-note-form .lk-btn-sm {
    width: 100%;
    min-height: var(--lk-touch-min);
    font-size: 1rem;
  }
}

/* ИИ-ассистент кабинета (web_assistant M01) */
.lk-visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.lk-assistant {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  z-index: 40;
}

.lk-assistant-fab {
  width: 3.25rem;
  height: 3.25rem;
  border: none;
  border-radius: 999px;
  background: var(--brand-600);
  color: #fff;
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(50, 46, 69, 0.2);
}

.lk-assistant-fab:hover {
  background: var(--brand-700);
}

.lk-assistant-drawer {
  display: none;
  position: fixed;
  top: 0;
  right: 0;
  width: min(24rem, 100vw);
  height: 100vh;
  background: #fff;
  border-left: 1px solid var(--border);
  box-shadow: -8px 0 24px rgba(50, 46, 69, 0.12);
  flex-direction: column;
}

.lk-assistant[data-open="true"] .lk-assistant-drawer {
  display: flex;
}

.lk-assistant[data-open="true"] .lk-assistant-fab {
  display: none;
}

.lk-assistant-header {
  position: relative;
  padding: 1rem 2.5rem 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  background: var(--brand-50);
}

.lk-assistant-title {
  margin: 0;
  font-size: 1.1rem;
  color: var(--brand-900);
}

.lk-assistant-subtitle {
  margin: 0.35rem 0 0;
  font-size: 0.82rem;
  color: var(--ink-muted);
}

.lk-assistant-close {
  position: absolute;
  top: 0.65rem;
  right: 0.65rem;
  width: 2rem;
  height: 2rem;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--ink-muted);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
}

.lk-assistant-close:hover {
  background: var(--brand-100);
  color: var(--ink);
}

.lk-assistant-feed {
  flex: 1;
  overflow-y: auto;
  padding: 0.85rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.lk-assistant-empty {
  margin: 0;
  font-size: 0.9rem;
  color: var(--ink-muted);
}

.lk-assistant-msg {
  max-width: 92%;
  padding: 0.55rem 0.7rem;
  border-radius: 10px;
  font-size: 0.92rem;
}

.lk-assistant-msg--user {
  align-self: flex-end;
  background: var(--brand-600);
  color: #fff;
}

.lk-assistant-msg--assistant {
  align-self: flex-start;
  background: var(--brand-100);
  color: var(--ink);
  border: 1px solid var(--border);
}

.lk-assistant-msg.is-pending {
  opacity: 0.85;
}

.lk-assistant-msg.is-failed {
  border-color: #f5c2c7;
  background: #fdecea;
}

.lk-assistant-msg-text {
  white-space: pre-wrap;
  word-break: break-word;
}

.lk-assistant-msg-meta {
  margin-top: 0.25rem;
  font-size: 0.78rem;
  color: var(--ink-muted);
}

.lk-assistant-undo {
  margin-top: 0.35rem;
}

.lk-assistant-compose {
  padding: 0.75rem 1rem 1rem;
  border-top: 1px solid var(--border);
  background: #fff;
}

.lk-assistant-input {
  width: 100%;
  box-sizing: border-box;
  resize: vertical;
  min-height: 4.5rem;
  margin-bottom: 0.55rem;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--border-input);
  border-radius: 6px;
  font: inherit;
  font-size: 1rem;
}

.lk-assistant-compose-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 0.5rem;
}

.lk-assistant-mic {
  width: var(--lk-touch-min);
  height: var(--lk-touch-min);
  border: 1px solid var(--border-input);
  border-radius: 999px;
  background: #fff;
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
}

.lk-assistant-mic:hover {
  background: var(--brand-100);
}

.lk-assistant-mic.is-recording {
  background: #fdecea;
  border-color: #f5c2c7;
  animation: lk-assistant-pulse 1s ease-in-out infinite;
}

.lk-assistant-mic:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

@keyframes lk-assistant-pulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.06);
  }
}

/* ИИ-ассистент на узком экране — full-screen drawer (web_mobile_pass M05). */
@media (max-width: 767px) {
  body:has(.lk-assistant[data-open="true"]) {
    overflow: hidden;
  }

  .lk-assistant-fab {
    width: 3.75rem;
    height: 3.75rem;
    min-width: 3.75rem;
    min-height: 3.75rem;
    font-size: 1.5rem;
  }

  .lk-assistant-drawer-panel {
    left: 0;
    right: 0;
    width: 100%;
    max-width: 100vw;
    height: 100dvh;
    max-height: 100dvh;
    border-left: none;
    box-shadow: none;
    padding-top: env(safe-area-inset-top, 0);
    padding-bottom: env(safe-area-inset-bottom, 0);
  }

  .lk-assistant-header {
    padding: 1rem 3rem 0.85rem 1rem;
  }

  .lk-assistant-close {
    width: var(--lk-touch-min);
    height: var(--lk-touch-min);
    top: calc(0.5rem + env(safe-area-inset-top, 0));
    right: 0.5rem;
    font-size: 1.6rem;
  }

  .lk-assistant-compose {
    padding: 0.85rem 1rem calc(1rem + env(safe-area-inset-bottom, 0));
  }

  .lk-assistant-compose-actions {
    gap: 0.65rem;
  }

  .lk-assistant-compose-actions .lk-btn {
    flex: 1;
    min-height: var(--lk-touch-min);
    font-size: 1rem;
  }

  .lk-assistant-mic {
    width: 3.5rem;
    height: 3.5rem;
    min-width: 3.5rem;
    min-height: 3.5rem;
    flex-shrink: 0;
    font-size: 1.5rem;
  }

  .lk-assistant-input {
    min-height: 5rem;
  }

  .lk-assistant-msg {
    max-width: 88%;
    font-size: 1rem;
  }
}
