@font-face {
  font-family: "Roboto Condensed";
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url("vendor/fonts/roboto-condensed-cyrillic.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

/* Чек-лист задачи использует обычные подписи, поля и кнопки CRM. */
.task-checklist-draft {
  display: grid;
  gap: 6px;
  min-width: 0;
  margin: 2px 0 0;
  padding: 0;
}

.task-checklist-draft__label {
  display: block;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.35;
}

.task-checklist-draft__items {
  display: grid;
  gap: 8px;
}

.task-checklist-draft__row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 40px;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.crm-form .task-checklist-draft__row input {
  min-width: 0;
  margin: 0;
}

.task-checklist-draft__remove.icon-btn {
  width: 40px;
  height: 40px;
  color: var(--muted);
}

.task-checklist-draft__remove.icon-btn:hover {
  color: var(--danger);
}

.task-checklist-draft__add.icon-btn {
  width: 40px;
  height: 40px;
  color: var(--primary);
}

.task-checklist-draft__add.icon-btn:hover {
  color: var(--primary-dark);
}

.task-assignee-field {
  min-width: 0;
  padding: 0;
  border: 0;
  border-radius: 9px;
  background: var(--surface-alt);
  overflow: hidden;
}

.task-assignee-field > summary {
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 11px;
  color: var(--secondary);
  font-weight: 700;
  cursor: pointer;
  list-style: none;
}

.task-assignee-field > summary::-webkit-details-marker {
  display: none;
}

.task-assignee-field > summary:focus {
  outline: none;
}

.task-assignee-field > summary:focus-visible {
  outline: 3px solid rgba(74, 122, 154, .22);
  outline-offset: -3px;
}

.task-assignee-field > summary small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  text-align: right;
}

.task-assignee-field[open] > summary {
  border-bottom: 1px solid var(--border);
}

.task-assignee-choices {
  max-height: 245px;
  overflow-y: auto;
  padding: 10px;
}

.task-assignee-card {
  min-height: 48px;
}

.task-checklist-card {
  overflow: hidden;
}

.task-checklist__head {
  align-items: center;
}

.task-checklist__head h2 {
  margin: 0;
}

.task-checklist__guidance {
  display: block;
  margin-top: 4px;
  line-height: 1.35;
}

.task-checklist__summary {
  display: grid;
  justify-items: end;
  gap: 3px;
  color: var(--primary-dark);
  font-size: 13px;
  line-height: 1.3;
}

.task-checklist__waiting {
  color: var(--warning);
  font-size: 12px;
  font-weight: 700;
}

.task-checklist__list {
  display: grid;
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

.task-checklist__item {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-width: 0;
  padding: 13px 0;
  border-bottom: 1px solid rgba(74, 122, 154, .16);
  background: transparent;
}

.task-checklist__item:first-child {
  padding-top: 2px;
}

.task-checklist__item:last-child {
  padding-bottom: 2px;
  border-bottom: 0;
}

.task-checklist__state {
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border: 1.5px solid rgba(74, 122, 154, .58);
  border-radius: 4px;
  background: var(--surface);
  color: #fff;
  font-size: 11px;
}

.task-checklist__item--completed .task-checklist__state {
  border-color: var(--warning);
  background: var(--warning);
}

.task-checklist__item--confirmed .task-checklist__state {
  border-color: var(--success);
  background: var(--success);
}

.task-checklist__content {
  min-width: 0;
}

.task-checklist__content > strong {
  display: block;
  color: var(--secondary);
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.task-checklist__status {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.3;
}

.task-checklist__status--completed {
  color: var(--warning);
}

.task-checklist__status--confirmed {
  color: var(--success);
}

.task-checklist__item--confirmed .task-checklist__content > strong {
  color: var(--muted);
}

.task-checklist__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 3px 14px;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.task-checklist__meta span {
  overflow-wrap: anywhere;
}

.task-checklist__meta i {
  margin-right: 5px;
  color: var(--primary);
}

.task-checklist__actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 6px;
}

.task-checklist__actions .primary-btn,
.task-checklist__actions .outline-btn {
  min-height: 34px;
  padding: 7px 10px;
  font-size: 13px;
  line-height: 1.2;
}

.task-checklist__composer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 40px;
  align-items: center;
  gap: 8px;
  min-width: 0;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(74, 122, 154, .16);
}

.task-checklist__head + .task-checklist__composer {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}

.task-checklist__composer input {
  width: 100%;
  min-width: 0;
  min-height: 42px;
  margin: 0;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  outline: none;
}

.task-checklist__composer input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(74, 122, 154, .12);
}

.task-checklist__composer input::placeholder {
  color: #7C8B95;
  opacity: 1;
}

.task-checklist__add.icon-btn {
  width: 40px;
  height: 40px;
  color: var(--primary);
}

.task-checklist__add.icon-btn:hover {
  color: var(--primary-dark);
}

.task-checklist__close-hint {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.task-checklist__close-hint i {
  margin-top: 3px;
  color: var(--primary);
}

.task-register__checklist {
  color: var(--primary-dark);
  font-weight: 600;
}

.task-register__checklist i {
  margin-right: 5px;
  color: var(--primary);
}

.feed-item--checklist .feed-item__icon {
  color: var(--success);
}

@media (max-width: 640px) {
  .task-checklist-draft__row {
    grid-template-columns: minmax(0, 1fr) 40px;
    gap: 6px;
  }

  .task-checklist__head {
    align-items: start;
  }

  .task-checklist__summary {
    grid-column: 1 / -1;
    justify-items: start;
  }

  .task-checklist__item {
    grid-template-columns: 20px minmax(0, 1fr);
    align-items: start;
    padding: 12px 0;
  }

  .task-checklist__actions {
    grid-column: 2;
    justify-content: flex-start;
  }

  .task-checklist__actions .primary-btn,
  .task-checklist__actions .outline-btn {
    flex: 1 1 140px;
  }
}

@font-face {
  font-family: "Roboto Condensed";
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url("vendor/fonts/roboto-condensed-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Source Sans Pro";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("vendor/fonts/source-sans-pro-400-cyrillic.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

@font-face {
  font-family: "Source Sans Pro";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("vendor/fonts/source-sans-pro-400-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Source Sans Pro";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("vendor/fonts/source-sans-pro-600-cyrillic.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

@font-face {
  font-family: "Source Sans Pro";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("vendor/fonts/source-sans-pro-600-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Source Sans Pro";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("vendor/fonts/source-sans-pro-700-cyrillic.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

@font-face {
  font-family: "Source Sans Pro";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("vendor/fonts/source-sans-pro-700-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "CRM Times New Roman";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("print/fonts/TimesNewRoman-Regular.ttf") format("truetype");
}

@font-face {
  font-family: "CRM Times New Roman";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("print/fonts/TimesNewRoman-Bold.ttf") format("truetype");
}

@font-face {
  font-family: "CRM Times New Roman";
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url("print/fonts/TimesNewRoman-Italic.ttf") format("truetype");
}

@font-face {
  font-family: "CRM Times New Roman";
  font-style: italic;
  font-weight: 700;
  font-display: swap;
  src: url("print/fonts/TimesNewRoman-BoldItalic.ttf") format("truetype");
}

:root {
  --primary: #4A7A9A;
  --primary-dark: #2D4C63;
  --secondary: #2C3E4A;
  --text: #0C1319;
  --muted: #3A3A3A;
  --page: #F3F7FA;
  --surface: #FFFFFF;
  --surface-muted: #EDF5F9;
  --surface-alt: #F8FBFD;
  --hero-start: #F0F8FF;
  --hero-end: #B8D4E8;
  --nav-start: #5289AA;
  --nav-end: #3E6585;
  --warning: #C97C2A;
  --danger: #B94B4B;
  --success: #3A7B62;
  --border: rgba(74, 122, 154, 0.22);
  --shadow: 0 10px 26px rgba(44, 62, 74, 0.08);
  --shadow-hover: 0 16px 36px rgba(44, 62, 74, 0.13);
  --container: 1500px;
  --table-border: rgba(74, 122, 154, 0.18);
  --table-row-alt: #F7FAFC;
  --table-row-hover: #EEF5F9;
  --panel-padding: 18px;
  /* Экранный лист повторяет A4 и боковые поля итогового PDF: 210/297 мм и 10 мм. */
  --document-sheet-width: 210mm;
  --document-sheet-width-landscape: 297mm;
  --document-sheet-padding-x: 10mm;
  --document-sheet-padding-top: 52px;
  --document-sheet-padding-bottom: 64px;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

html {
  min-width: 320px;
}

body {
  min-width: 320px;
  margin: 0;
  background: var(--page);
  color: var(--text);
  font-family: "Source Sans Pro", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  letter-spacing: 0;
}

/* Базовый текстовый линк: нативные visited-цвета браузера в CRM не используем. */
:where(a) {
  color: var(--primary);
  text-decoration-line: underline;
  text-decoration-color: rgba(74, 122, 154, .42);
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

:where(a:visited) {
  color: var(--primary);
}

:where(a:hover) {
  color: var(--primary-dark);
  text-decoration-color: currentColor;
}

:where(a:focus-visible) {
  outline: 3px solid rgba(74, 122, 154, .28);
  outline-offset: 2px;
  border-radius: 3px;
}

.crm-login-page {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  background: var(--page);
}

.crm-login-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 76px;
  padding: 6px max(16px, calc((100% - var(--container)) / 2 + 16px));
  background: linear-gradient(120deg, var(--nav-start), var(--nav-end));
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
  color: #fff;
}

.crm-login-header img {
  width: 300px;
  height: 64px;
  object-fit: contain;
}

.crm-login-header span {
  padding: 4px 10px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 8px;
  font-family: "Roboto Condensed", sans-serif;
  font-size: 20px;
  line-height: 1.2;
}

.crm-login-shell {
  width: min(100%, 430px);
  display: block;
  align-self: center;
  justify-self: center;
  padding: 40px 16px;
}

.crm-login-card {
  display: grid;
  gap: 14px;
  padding: 30px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.crm-login-title {
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(74, 122, 154, 0.16);
}

.crm-login-error {
  padding: 10px 12px;
  border-left: 4px solid var(--danger);
  border-radius: 8px;
  background: var(--surface-alt);
  color: var(--danger);
  font-weight: 600;
}

.crm-login-note {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.crm-login-dev-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .06em;
}

.crm-login-dev-divider::before,
.crm-login-dev-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

.crm-login-dev-button {
  width: 100%;
  justify-content: center;
}

button,
input,
select,
textarea {
  font: inherit;
  letter-spacing: 0;
}

button {
  cursor: pointer;
}

.crm-shell {
  --sidebar-w: 248px;
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  min-height: 100vh;
  min-height: 100dvh;
}

.crm-sidebar {
  position: sticky;
  top: 0;
  z-index: 100;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 16px 12px;
  background: linear-gradient(165deg, var(--nav-start), var(--nav-end));
  color: #fff;
  box-shadow: 4px 0 22px rgba(44, 62, 74, 0.16);
  overflow-y: auto;
}

.crm-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 4px 6px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.18);
  color: #fff;
  text-decoration: none;
  font-family: "Roboto Condensed", sans-serif;
}

.crm-brand img {
  min-width: 0;
  flex: 1 1 auto;
  height: 40px;
  object-fit: contain;
  object-position: left center;
}

.crm-brand span {
  flex: 0 0 auto;
  padding: 3px 7px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 8px;
  font-size: 14px;
  letter-spacing: 1px;
}

.crm-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.crm-nav button {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 44px;
  padding: 8px 12px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: rgba(255, 255, 255, 0.86);
  text-align: left;
  font-family: "Roboto Condensed", sans-serif;
  font-size: 1.05rem;
  font-weight: 400;
  line-height: 1.2;
  transition: background .18s ease, color .18s ease;
}

.crm-nav button i {
  width: 20px;
  font-size: 1rem;
  text-align: center;
  color: rgba(255, 255, 255, 0.72);
  transition: color .18s ease;
}

.crm-nav button:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.crm-nav button.is-active {
  background: #fff;
  color: var(--primary-dark);
  font-weight: 700;
  box-shadow: 0 6px 16px rgba(44, 62, 74, 0.18);
}

.crm-nav button.is-active i {
  color: var(--primary);
}

.crm-sidebar-foot {
  margin-top: auto;
  display: grid;
  gap: 10px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.18);
}

.crm-logout-form {
  flex: 0 0 36px;
  margin: 0;
}

.crm-logout-form .crm-logout {
  border: 0;
}

.crm-site-link {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 8px;
  background: transparent;
  color: #fff;
  text-decoration: none;
  font-size: .95rem;
  transition: background .18s ease;
}

.crm-sidebar-action {
  width: 100%;
  font: inherit;
  cursor: pointer;
}

.crm-site-link:hover {
  background: rgba(255, 255, 255, 0.12);
}

.crm-nav-toggle {
  display: none;
  position: fixed;
  top: 12px;
  right: 12px;
  z-index: 210;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 10px;
  background: var(--primary);
  color: #fff;
  font-size: 18px;
  box-shadow: var(--shadow);
}

.crm-backdrop {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(12, 19, 25, 0.4);
}

.crm-main {
  min-width: 0;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 22px 24px 40px;
}

.crm-page-scroll {
  position: fixed;
  right: max(16px, calc(12px + env(safe-area-inset-right)));
  bottom: max(18px, calc(12px + env(safe-area-inset-bottom)));
  z-index: 80;
  display: grid;
  gap: 6px;
  opacity: .72;
  transition: opacity .18s ease, transform .18s ease;
}

.crm-page-scroll:hover,
.crm-page-scroll:focus-within {
  opacity: 1;
}

.crm-page-scroll.is-obscured {
  opacity: 0;
  pointer-events: none;
  transform: translateY(6px);
}

.crm-main.is-composer ~ .crm-page-scroll {
  display: none;
}

.crm-page-scroll__button {
  width: 40px;
  height: 40px;
  display: inline-grid;
  place-items: center;
  padding: 0;
  border: 1px solid rgba(74, 122, 154, .32);
  border-radius: 11px;
  background: rgba(255, 255, 255, .78);
  color: var(--primary-dark);
  font-size: 14px;
  line-height: 1;
  box-shadow: 0 6px 18px rgba(44, 62, 74, .13);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: border-color .16s ease, background-color .16s ease, color .16s ease, opacity .16s ease, transform .16s ease;
  touch-action: manipulation;
}

.crm-page-scroll__button:hover:not(:disabled),
.crm-page-scroll__button:focus-visible:not(:disabled) {
  border-color: rgba(74, 122, 154, .58);
  background: rgba(255, 255, 255, .95);
  color: var(--primary);
  transform: translateY(-1px);
}

.crm-page-scroll__button:focus-visible {
  outline: 3px solid rgba(74, 122, 154, .24);
  outline-offset: 2px;
}

.crm-page-scroll__button:disabled {
  opacity: .32;
  cursor: default;
  box-shadow: 0 3px 10px rgba(44, 62, 74, .08);
}

@media (max-width: 640px) {
  .crm-page-scroll {
    right: max(10px, calc(8px + env(safe-area-inset-right)));
    bottom: max(12px, calc(8px + env(safe-area-inset-bottom)));
    gap: 0;
  }

  .crm-page-scroll__button--top {
    display: none;
  }

  .crm-page-scroll__button {
    width: 38px;
    height: 38px;
    border-radius: 50%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .crm-page-scroll,
  .crm-page-scroll__button {
    transition: none;
  }
}

.crm-mobile-brand {
  display: none;
}

.crm-eyebrow {
  margin: 0 0 6px;
  color: var(--primary);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.35;
}

h1,
h2,
h3 {
  margin: 0;
  color: var(--secondary);
  font-family: "Roboto Condensed", sans-serif;
  font-weight: 400;
  letter-spacing: 0;
}

h1 {
  font-size: 32px;
  font-weight: 300;
  line-height: 1.12;
}

h2 {
  font-size: 22px;
  line-height: 1.2;
}

h3 {
  font-size: 20px;
  line-height: 1.25;
}

.crm-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.1);
}

.crm-user-avatar {
  flex: 0 0 38px;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 9999px;
  background: #fff;
  color: var(--primary-dark);
  font-family: "Roboto Condensed", sans-serif;
  font-size: 18px;
  font-weight: 700;
}

.crm-user-meta {
  display: grid;
  min-width: 0;
  flex: 1;
}

.crm-user-meta strong {
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.crm-user-meta small {
  color: rgba(255, 255, 255, 0.72);
  font-size: 12px;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.crm-logout {
  flex: 0 0 36px;
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 8px;
  background: transparent;
  color: #fff;
  text-decoration: none;
}

.crm-logout span {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.crm-logout:hover {
  background: var(--danger);
  border-color: var(--danger);
}

.compact-select {
  min-height: 36px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0 10px;
  background: #fff;
  color: var(--text);
  outline: none;
}

.compact-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(74, 122, 154, .12);
}

.crm-view {
  display: none;
}

.crm-view.is-active {
  display: block;
}

.crm-form.outgoing-composer {
  width: 100%;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px 18px 20px;
}

.outgoing-composer__header {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(74, 122, 154, 0.16);
}

.outgoing-composer__actions {
  flex: 0 0 auto;
}

/* Крестик — единственный способ закрыть экран, как в модальных окнах. Отдельной
   кнопки «Отмена» здесь нет. Прижимается к правому краю шапки, кнопка сохранения
   идёт следом. */
.outgoing-composer__close {
  flex: 0 0 auto;
  margin-left: auto;
}

/* Складной блок: та же механика, что у параметров исходящего документа. */
.outgoing-composer__parameters,
.ai-prompt-spoiler {
  flex: 0 0 auto;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-alt);
}

.outgoing-composer__parameters summary,
.ai-prompt-spoiler summary {
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 12px;
  color: var(--secondary);
  font-weight: 600;
  cursor: pointer;
  list-style: none;
}

.outgoing-composer__parameters summary::-webkit-details-marker,
.ai-prompt-spoiler summary::-webkit-details-marker {
  display: none;
}

.outgoing-composer__parameters summary i,
.ai-prompt-spoiler summary i {
  color: var(--primary);
  transition: transform .18s ease;
}

.outgoing-composer__parameters[open] summary,
.ai-prompt-spoiler[open] summary {
  border-bottom: 1px solid var(--border);
}

.outgoing-composer__parameters[open] summary i,
.ai-prompt-spoiler[open] summary i {
  transform: rotate(180deg);
}

/* Редактируемый контекст компании занимает всю ширину. Поведенческие
   инструкции ИИ-режимов являются внутренними и в интерфейс не выводятся. */
.ai-prompt-settings {
  grid-column: 1 / -1;
}

.ai-prompt-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
  padding: 14px;
}

.ai-prompt-grid textarea {
  font-size: 13px;
  line-height: 1.45;
}

.outgoing-composer__parameter-grid {
  min-width: 0;
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  align-items: start;
  gap: 14px 12px;
  padding: 12px;
}

.outgoing-composer__parameter-grid > label {
  grid-column: span 3;
}

.outgoing-composer__parameter-grid > .outgoing-composer__recipient,
.outgoing-composer__parameter-grid > .outgoing-composer__subject {
  grid-column: span 6;
}

.outgoing-composer__visibility {
  grid-column: 1 / -1;
}

.document-visibility-picker {
  min-width: 0;
  padding: 0;
  border: 0;
  border-radius: 9px;
  background: var(--surface-alt);
}

.document-visibility-picker > summary {
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 11px;
  color: var(--secondary);
  font-weight: 700;
  cursor: pointer;
  list-style: none;
}

.document-visibility-picker > summary::-webkit-details-marker {
  display: none;
}

.document-visibility-picker > summary small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  text-align: right;
}

.document-viewer-choices {
  max-height: 245px;
  overflow: auto;
  padding: 10px;
}

.document-visibility-picker > .form-note {
  margin: 0;
  padding: 0 10px 10px;
}

.document-viewer-card {
  min-height: 48px;
}

.document-viewer-card .table-entity {
  min-width: 0;
}

.document-viewer-card--required {
  cursor: default;
}

.document-viewer-card--required input:disabled {
  opacity: 1;
  accent-color: var(--primary);
}

.outgoing-composer__description textarea {
  height: 42px;
  min-height: 42px;
  resize: none;
}

.outgoing-composer__format-row {
  grid-column: 1 / -1;
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(240px, 1fr) max-content;
  align-items: flex-start;
  gap: 12px;
}

.outgoing-composer__format-row > .outgoing-composer__description {
  min-width: 0;
}

.outgoing-composer__format-row > .outgoing-composer__options {
  min-width: 0;
  max-width: 100%;
  display: grid;
  gap: 7px;
}

.outgoing-composer__options-title {
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.35;
}

.outgoing-composer__option-list {
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.crm-form .outgoing-composer__orientation {
  flex: 0 0 236px;
  min-width: 236px;
  display: grid;
  grid-template-columns: max-content minmax(132px, 1fr);
  align-items: center;
  gap: 9px;
  margin: 0;
  padding: 0 0 0 11px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
}

.crm-form .outgoing-composer__orientation select {
  min-width: 132px;
  min-height: 40px;
  border: 0;
  border-left: 1px solid var(--border);
  border-radius: 0 7px 7px 0;
  padding: 9px 40px 9px 12px;
  background-color: #fff;
  white-space: nowrap;
}

/* Тот же переключатель используется и в фильтр-баре (ИИ-анализ), поэтому
   компонент общий, а не продублирован под отдельным именем. */
.crm-form .outgoing-composer__option,
.crm-form .message-composer__toggle,
.filter-bar .message-composer__toggle {
  min-width: 0;
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 8px 11px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.crm-form .outgoing-composer__option input[type="checkbox"],
.crm-form .message-composer__toggle input[type="checkbox"],
.filter-bar .message-composer__toggle input[type="checkbox"] {
  flex: 0 0 18px;
  width: 18px;
  height: 18px;
  min-height: 0;
  margin: 0;
  padding: 0;
  accent-color: var(--primary);
}

.outgoing-composer__hint {
  grid-column: 1 / -1;
  min-width: 0;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 9px 11px;
  border-radius: 8px;
  background: rgba(74, 122, 154, 0.08);
  color: var(--muted);
}

.outgoing-composer__hint i {
  flex: 0 0 auto;
  margin-top: 3px;
  color: var(--primary);
}

.outgoing-composer__hint .form-note {
  margin: 0;
  font-size: 13px;
  line-height: 1.4;
}

.outgoing-composer__workspace {
  position: relative;
  min-width: 0;
  display: block;
}

.outgoing-composer__editor {
  min-width: 0;
}

/* Подготовленный ИИ вариант виден прямо в тексте до решения пользователя.
   Оттенок берётся из основной палитры CRM: это не предупреждение, а черновик.
   Служебная обёртка снимается кнопками и не уходит в сохранённое тело. */
.jodit-wysiwyg [data-crm-ai-draft="1"] {
  display: block;
  padding: 6px 12px;
  border-radius: 6px;
  background: rgba(74, 122, 154, .07);
  box-shadow: 0 0 0 1px rgba(74, 122, 154, .26);
}

.jodit-wysiwyg span[data-crm-ai-draft="1"] {
  display: inline;
  padding: 1px 4px;
  border-radius: 4px;
}

.jodit-wysiwyg [data-crm-ai-draft="1"] > :first-child {
  margin-top: 0;
}

.jodit-wysiwyg [data-crm-ai-draft="1"] > :last-child {
  margin-bottom: 0;
}

/* ИИ-редактор — постоянная верхняя часть единого контейнера Jodit. Ни этот
   блок, ни его состояния не участвуют в вычислении ширины PDF-холста. */
.outgoing-ai-inline {
  position: relative;
  order: initial;
  width: 100%;
  min-width: 0;
  padding: 10px 12px 9px;
  border: 0;
  border-bottom: 1px solid var(--border);
  border-radius: 9px 9px 0 0;
  background: linear-gradient(180deg, #fff 0%, rgba(237, 245, 249, .74) 100%);
  box-shadow: none;
}

.outgoing-ai-inline[hidden] {
  display: none;
}

.outgoing-ai-inline__prompt {
  display: block;
}

.outgoing-ai-inline__head {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: -16px -16px 14px;
  padding: 11px 16px;
  border-bottom: 1px solid var(--border);
  border-radius: 11px 11px 0 0;
  background: rgba(74, 122, 154, .07);
}

.outgoing-ai-inline__title {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--secondary);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.outgoing-ai-inline__title > span {
  min-width: 0;
  display: grid;
  gap: 1px;
}

.outgoing-ai-inline__title small {
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  font-weight: 400;
  text-overflow: ellipsis;
}

.outgoing-ai-inline__title i {
  color: var(--primary);
  font-size: 13px;
}

.outgoing-ai-inline__close.icon-btn {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  min-height: 0;
}

.outgoing-ai-inline__scope {
  grid-column: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.outgoing-ai-inline__scope .outline-btn,
.outgoing-ai-inline__quick .outline-btn {
  min-height: 32px;
  padding: 5px 11px;
  font-size: 13px;
}

.outgoing-ai-inline__scope .outline-btn.is-active {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
}

.crm-form textarea.outgoing-ai-inline__instruction {
  grid-column: 1;
  min-height: 112px;
  max-height: 360px;
  padding: 10px 11px;
  font-size: 14px;
  line-height: 1.45;
  resize: vertical;
}

.crm-form textarea.outgoing-ai-inline__instruction:focus {
  border-color: var(--primary);
}

.outgoing-ai-reasoning {
  grid-column: 1;
  margin-top: 10px;
  padding: 9px 10px;
  border: 1px solid rgba(82, 137, 170, .28);
  border-radius: 8px;
  background: var(--surface-alt);
  color: var(--secondary);
}

.outgoing-ai-reasoning[hidden] {
  display: none;
}

.outgoing-ai-reasoning__label {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
  color: var(--primary);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .02em;
}

.outgoing-ai-reasoning p {
  display: -webkit-box;
  margin: 0;
  overflow: hidden;
  color: var(--secondary);
  font-size: 12px;
  line-height: 1.42;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.crm-form .crm-ocr-trigger.outline-btn {
  position: relative;
  width: 78px;
  min-width: 78px;
  min-height: 34px;
  flex: 0 0 78px;
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin: 0;
  padding: 5px 9px;
  color: var(--primary);
  font-size: 12px;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
}

.crm-form .crm-ocr-trigger.outline-btn:hover {
  background: var(--primary);
  color: #fff;
}

.crm-form .crm-ocr-trigger.outline-btn > i {
  flex: 0 0 auto;
  color: inherit;
  font-size: 13px;
}

.crm-form .crm-ocr-trigger.outline-btn > span {
  min-width: 0;
  color: inherit;
  white-space: nowrap;
}

.crm-ocr-trigger input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.ai-attachment__retry {
  width: fit-content;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 4px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--primary);
  font: inherit;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

.outgoing-ai-ocr__choose.is-busy {
  cursor: wait;
  opacity: .72;
}

.outgoing-ai-inline__group {
  grid-column: 1;
  margin-top: 11px;
}

.outgoing-ai-inline__group[hidden] {
  display: none;
}

.outgoing-ai-inline__label {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.3;
}

.outgoing-ai-inline__label[hidden] {
  display: none;
}

.outgoing-ai-inline__quick {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.outgoing-ai-inline__foot {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 12px;
  padding-top: 11px;
  border-top: 1px solid var(--border);
}

.outgoing-ai-inline__foot .form-note {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  font-size: 12px;
}

.outgoing-ai-inline__foot-actions {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 7px;
}

.outgoing-ai-inline__foot-actions .primary-btn,
.outgoing-ai-inline__foot-actions .outline-btn {
  min-height: 34px;
  padding: 5px 12px;
  font-size: 13px;
  white-space: nowrap;
}

.outgoing-ai-inline.is-pending .outgoing-ai-inline__foot .form-note {
  color: var(--primary);
  font-weight: 600;
}

.outgoing-ai-inline.is-pending .outgoing-ai-inline__quick,
.outgoing-ai-inline.is-pending .outgoing-ai-inline__scope {
  opacity: .55;
}

.outgoing-ai-inline__decision[hidden] {
  display: none;
}

.outgoing-ai-inline__decision .form-note {
  margin: 0 0 11px;
}

.outgoing-ai-inline__decision-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.outgoing-ai-inline__decision-actions .primary-btn,
.outgoing-ai-inline__decision-actions .outline-btn {
  min-height: 34px;
  padding: 5px 12px;
  font-size: 13px;
}

/* Корректирующий UI-контракт: компактная команда встроена непосредственно в
   Jodit и не выглядит отдельной карточкой/помощником. Правила ниже намеренно
   стоят после прежней геометрии компонента и полностью её переопределяют. */
.outgoing-composer__editor .jodit-container .outgoing-ai-inline {
  position: relative;
  order: initial;
  width: 100%;
  min-width: 0;
  padding: 10px 12px 9px;
  border: 0;
  border-bottom: 1px solid var(--border);
  border-radius: 9px 9px 0 0;
  background: linear-gradient(180deg, #fff 0%, rgba(237, 245, 249, .74) 100%);
  box-shadow: none;
  overflow: hidden;
}

.outgoing-composer__editor .outgoing-ai-inline__prompt {
  display: block;
}

.outgoing-ai-inline__topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.outgoing-ai-inline__title {
  flex: 0 1 auto;
  min-width: max-content;
  font-size: 14px;
  white-space: nowrap;
}

.outgoing-ai-inline__title > span {
  display: inline;
}

.outgoing-ai-inline__tools {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}

.outgoing-ai-inline__scope {
  display: flex;
  flex-wrap: nowrap;
  gap: 4px;
  margin: 0;
}

.outgoing-ai-inline__scope .outline-btn {
  min-height: 30px;
  padding: 4px 9px;
  font-size: 12px;
  line-height: 1.2;
  white-space: nowrap;
}

.outgoing-ai-inline__command {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: stretch;
  gap: 8px;
}

.crm-form textarea.outgoing-ai-inline__instruction {
  min-height: 58px;
  max-height: 240px;
  padding: 8px 10px;
  font-size: 14px;
  line-height: 1.4;
  resize: vertical;
}

.outgoing-ai-inline__send.primary-btn {
  min-width: 132px;
  min-height: 58px;
  align-self: stretch;
  justify-content: center;
  padding: 7px 13px;
  white-space: nowrap;
}

.outgoing-ai-inline__send.primary-btn.is-stop {
  border-color: var(--danger);
  background: var(--danger);
  color: #fff;
}

.outgoing-ai-inline__send.primary-btn.is-stop:hover {
  border-color: #8f3434;
  background: #8f3434;
}

.outgoing-ai-reasoning {
  margin: 7px 0 0;
  padding: 7px 9px;
}

.outgoing-ai-reasoning__label {
  margin-bottom: 2px;
}

.outgoing-ai-inline__group {
  margin-top: 7px;
}

.outgoing-ai-inline__label {
  margin: 0 0 4px;
  font-size: 11px;
}

.outgoing-ai-inline__quick {
  width: 100%;
  display: flex;
  flex-wrap: nowrap;
  gap: 5px;
  padding-bottom: 2px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scrollbar-width: thin;
}

.outgoing-ai-inline__quick .outline-btn {
  flex: 0 0 auto;
  min-height: 28px;
  padding: 3px 9px;
  font-size: 12px;
  line-height: 1.2;
  white-space: nowrap;
}

.outgoing-composer__editor .outgoing-ai-inline.is-dragover {
  background: rgba(74, 122, 154, .09);
  box-shadow: inset 0 0 0 2px var(--primary);
}

.outgoing-ai-inline__decision {
  min-height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.outgoing-ai-inline__decision[hidden] {
  display: none;
}

.outgoing-ai-inline__decision-copy {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.outgoing-ai-inline__decision-copy .form-note {
  min-width: 0;
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.outgoing-ai-inline__decision-actions {
  flex: 0 0 auto;
  flex-wrap: nowrap;
}

.outgoing-composer__editor > .doc-editor {
  width: 100%;
}

.outgoing-composer__editor .jodit-container {
  width: 100% !important;
  height: auto !important;
  min-height: 0 !important;
  display: block !important;
  border: 1px solid var(--border);
  border-radius: 10px !important;
  overflow: visible !important;
  background: var(--surface-muted);
}

.outgoing-composer__editor .jodit-toolbar__box {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  overflow: visible !important;
  background: var(--surface-alt);
}

.outgoing-composer__editor .jodit-toolbar__box .jodit-ui-group_line_true {
  justify-content: center;
}

.outgoing-composer__editor .jodit-toolbar__box .jodit-ui-spacer {
  flex: 0 0 auto;
}

.outgoing-composer__editor .jodit-workplace {
  height: auto !important;
  min-height: 0 !important;
  display: flex !important;
  flex-direction: row !important;
  justify-content: center;
  align-items: flex-start;
  padding: 28px 24px 40px;
  overflow: visible !important;
  border-radius: 0 0 10px 10px;
  background: var(--surface-muted);
}

.outgoing-composer__editor .jodit-wysiwyg {
  --document-editor-padding-x: var(--document-sheet-padding-x);
  flex: 0 1 auto !important;
  width: min(100%, var(--document-sheet-width)) !important;
  max-width: 100% !important;
  height: auto !important;
  min-height: 60vh !important;
  margin: 0 auto;
  padding: var(--document-sheet-padding-top) var(--document-sheet-padding-x) var(--document-sheet-padding-bottom) !important;
  overflow: visible;
  border: 1px solid rgba(44, 62, 74, .18);
  background: #fff;
  box-shadow: 0 12px 28px rgba(44, 62, 74, .09);
}

.outgoing-composer[data-page-orientation="landscape"] .outgoing-composer__editor .jodit-wysiwyg {
  width: min(100%, var(--document-sheet-width-landscape)) !important;
}

/* Двухпанельный ИИ-редактор документов. Шапка и «Параметры» живут снаружи,
   вложения скрыты внутри «Параметров»; в workspace только два соседних уровня:
   холст и панель ИИ. */
.outgoing-composer__workspace-switch {
  display: none;
}

.outgoing-composer__workspace {
  --outgoing-ai-compact-width: 328px;
  height: auto;
  min-height: 0;
  flex: 1 1 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(340px, 24vw, 400px);
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-muted);
}

/* На desktop высота вычисляется самой flex-раскладкой: main занимает ровно
   viewport, шапка и параметры — свою фактическую высоту, workspace — остаток.
   Поэтому у страницы нет второй вертикальной прокрутки рядом с холстом. */
@media (min-width: 1241px) {
  .crm-main.is-composer {
    height: 100dvh;
    min-height: 0;
    padding-bottom: 8px;
    overflow: hidden;
  }

  .crm-main.is-composer .crm-view--composer.is-active,
  .crm-main.is-composer .outgoing-composer {
    height: 100%;
    min-height: 0;
  }

  .crm-main.is-composer .outgoing-composer {
    padding-bottom: 12px;
  }

  .crm-main.is-composer .outgoing-composer__workspace {
    height: auto;
    min-height: 0;
    flex: 1 1 auto;
  }
}

.outgoing-composer__editor {
  min-height: 0;
  overflow: hidden;
  background: var(--surface-muted);
}

.outgoing-composer__editor .jodit-container {
  height: 100% !important;
  min-height: 0 !important;
  display: flex !important;
  flex-direction: column;
  overflow: hidden !important;
  border: 0;
  border-radius: 0 !important;
  background: var(--surface-muted);
}

.outgoing-composer__editor .jodit-toolbar__box {
  position: relative;
  top: auto;
  flex: 0 0 auto;
  border: 0;
  background: #fff;
}

.crm-form .outgoing-composer__editor .jodit-toolbar__box,
.crm-form .outgoing-composer__editor .jodit-toolbar-editor-collection {
  border-bottom: 0;
  background: #fff;
}

.outgoing-composer__editor .jodit-workplace {
  min-height: 0 !important;
  flex: 1 1 auto !important;
  justify-content: center;
  padding: 12px 8px 18px;
  overflow: auto !important;
  border-radius: 0;
  background: var(--surface-muted);
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.outgoing-composer__editor .jodit-wysiwyg.document-editor-sheet {
  flex: 0 0 auto !important;
  width: var(--document-sheet-width) !important;
  max-width: none !important;
  min-height: 100% !important;
  margin: 0 auto;
}

.outgoing-composer[data-page-orientation="landscape"] .outgoing-composer__editor .jodit-wysiwyg.document-editor-sheet {
  width: var(--document-sheet-width-landscape) !important;
}

.outgoing-ai-inline,
.outgoing-composer__editor .jodit-container .outgoing-ai-inline {
  position: relative;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  padding: 14px 12px;
  overflow-x: hidden;
  overflow-y: auto;
  border: 0;
  border-left: 1px solid var(--border);
  border-radius: 0;
  background: #fff;
  box-shadow: none;
  scrollbar-gutter: auto;
}

.outgoing-ai-inline__collapse {
  display: none;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--primary);
  cursor: pointer;
}

.outgoing-ai-inline__collapse span {
  display: none;
}

.outgoing-composer__workspace[data-layout-mode="compact"] {
  grid-template-columns: minmax(0, 1fr) var(--outgoing-ai-compact-width);
}

.outgoing-composer__workspace[data-layout-mode="compact"] .outgoing-ai-inline__collapse {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 3;
  width: 32px;
  height: 32px;
  display: inline-grid;
  place-items: center;
  border-radius: 8px;
}

.outgoing-composer__workspace[data-layout-mode="compact"] .outgoing-ai-inline__title {
  padding-right: 36px;
}

.outgoing-composer__workspace[data-layout-mode="compact"][data-ai-collapsed="true"] {
  grid-template-columns: minmax(0, 1fr) 46px;
}

.outgoing-composer__workspace[data-layout-mode="compact"][data-ai-collapsed="true"] .outgoing-ai-inline {
  padding: 0;
  overflow: hidden;
}

.outgoing-composer__workspace[data-layout-mode="compact"][data-ai-collapsed="true"]
  .outgoing-ai-inline > :not(.outgoing-ai-inline__collapse) {
  display: none !important;
}

.outgoing-composer__workspace[data-layout-mode="compact"][data-ai-collapsed="true"]
  .outgoing-ai-inline__collapse {
  inset: 0;
  width: 100%;
  height: 100%;
  align-content: start;
  gap: 10px;
  padding: 14px 4px;
  border: 0;
  border-radius: 0;
  background: var(--surface-alt);
}

.outgoing-composer__workspace[data-layout-mode="compact"][data-ai-collapsed="true"]
  .outgoing-ai-inline__collapse span {
  display: block;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  color: var(--secondary);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .08em;
}

.outgoing-ai-inline__prompt {
  display: block;
}

.outgoing-ai-inline__topline {
  display: block;
  margin-bottom: 14px;
}

.outgoing-ai-inline__title {
  width: auto;
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  color: var(--secondary);
  font-size: 15px;
  font-weight: 700;
  line-height: 1.25;
  white-space: normal;
}

.outgoing-ai-inline__title > span {
  display: grid;
  gap: 1px;
}

.outgoing-ai-inline__title small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 400;
}

.outgoing-ai-inline__tools {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(100px, 1.15fr) minmax(64px, .85fr) 78px;
  align-items: stretch;
  gap: 6px;
}

.outgoing-ai-inline__scope {
  display: contents;
  margin: 0;
}

.outgoing-ai-inline__scope .outline-btn {
  min-width: 0;
  min-height: 34px;
  justify-content: center;
  padding: 5px 9px;
  font-size: 12px;
  white-space: nowrap;
}

.outgoing-ai-inline__command {
  display: block;
}

.crm-form textarea.outgoing-ai-inline__instruction {
  width: 100%;
  min-height: 200px;
  max-height: 480px;
  padding: 10px 11px;
  font-size: 14px;
  line-height: 1.45;
  resize: vertical;
  overflow-y: hidden;
}

.outgoing-ai-inline__send.primary-btn {
  width: 100%;
  min-width: 0;
  min-height: 40px;
  margin-top: 8px;
  justify-content: center;
}

.outgoing-ai-reasoning {
  margin: 10px 0 0;
  padding: 9px 10px;
}

.outgoing-ai-inline__group {
  margin-top: 12px;
}

.outgoing-ai-inline__quick {
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  overflow: visible;
}

.outgoing-ai-inline__quick .outline-btn {
  flex: 0 1 auto;
  min-height: 30px;
  padding: 4px 9px;
  font-size: 12px;
  white-space: normal;
}

.outgoing-ai-inline.is-dragover,
.outgoing-composer__editor .outgoing-ai-inline.is-dragover {
  background: rgba(74, 122, 154, .08);
  box-shadow: inset 0 0 0 2px var(--primary);
}

.outgoing-ai-inline__decision {
  min-height: 0;
  align-items: stretch;
  flex-direction: column;
  justify-content: flex-start;
  gap: 12px;
}

.outgoing-ai-inline__decision-copy {
  align-items: flex-start;
  flex-direction: column;
  gap: 6px;
}

.outgoing-ai-inline__decision-copy .outgoing-ai-inline__title {
  margin-bottom: 0;
}

.outgoing-ai-inline__decision-copy .form-note {
  width: 100%;
  white-space: normal;
}

.outgoing-ai-inline__decision-actions {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}

.outgoing-ai-inline__decision-actions .primary-btn,
.outgoing-ai-inline__decision-actions .outline-btn {
  width: 100%;
  justify-content: center;
}

.document-content [data-crm-page-break="1"] {
  position: relative;
  display: block;
  clear: both;
  height: 34px;
  margin: 28px 0;
  padding: 0;
  border-top: 1px dashed rgba(74, 122, 154, .6);
  border-bottom: 1px dashed rgba(74, 122, 154, .6);
  background: var(--surface-muted);
  color: var(--primary-dark);
  font-family: "Source Sans Pro", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 12px;
  font-weight: 600;
  line-height: 32px;
  text-align: center !important;
  text-indent: 0 !important;
  user-select: none;
}

.document-content [data-crm-page-break="1"]::after {
  content: "Разрыв страницы — следующий блок начнётся с нового листа";
}

.document-content [data-crm-page-break="1"] > br {
  display: none;
}

.outgoing-composer__editor .document-editor-sheet [data-crm-page-break="1"] {
  width: calc(100% + var(--document-editor-padding-x) + var(--document-editor-padding-x));
  margin-right: calc(-1 * var(--document-editor-padding-x));
  margin-left: calc(-1 * var(--document-editor-padding-x));
  border-right: 0;
  border-left: 0;
  cursor: pointer;
}

.outgoing-composer__editor .document-editor-sheet [data-crm-page-break="1"].is-selected {
  background: rgba(74, 122, 154, .2);
  box-shadow: inset 0 0 0 2px var(--primary);
}

.outgoing-composer__editor .jodit-status-bar,
.outgoing-composer__editor .jodit-placeholder {
  display: none !important;
}

.outgoing-composer :disabled,
.outgoing-composer [readonly] {
  background: var(--surface-muted);
  color: var(--muted);
}

.metric-grid,
.report-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(170px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.dashboard-overview__group--metrics .metric-grid {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
}

.metric-grid--compact {
  grid-template-columns: repeat(auto-fit, minmax(220px, 300px));
}

.worktime-active-day {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
  padding: 16px;
  border: 1px solid rgba(74, 122, 154, .28);
  border-left: 4px solid var(--primary);
  border-radius: 12px;
  background: var(--surface-muted);
}

.worktime-active-day[hidden] {
  display: none;
}

.worktime-active-day__icon {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: rgba(74, 122, 154, .11);
  color: var(--primary);
  font-size: 20px;
}

.worktime-active-day__content {
  min-width: 0;
}

.worktime-active-day__eyebrow {
  display: block;
  margin-bottom: 2px;
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .02em;
  text-transform: uppercase;
}

.worktime-active-day h3 {
  margin: 0 0 3px;
  font-size: 18px;
  line-height: 1.25;
}

.worktime-active-day p {
  margin: 0;
  color: var(--muted);
  line-height: 1.4;
}

.worktime-active-day__actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}

@media (max-width: 640px) {
  .worktime-active-day {
    grid-template-columns: auto minmax(0, 1fr);
    align-items: start;
    padding: 14px;
  }

  .worktime-active-day__actions {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    width: 100%;
  }

  .worktime-active-day__actions .primary-btn,
  .worktime-active-day__actions .outline-btn {
    width: 100%;
  }
}

.report-toolbar {
  margin-bottom: 16px;
}

.report-filter-form {
  grid-template-columns: repeat(2, minmax(180px, 220px)) minmax(0, 1fr);
  margin-bottom: 0;
}

.report-filter-actions {
  min-width: 0;
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.filter-action-group {
  min-width: 0;
  display: grid;
  align-self: end;
  gap: 6px;
}

.filter-action-group__label {
  color: var(--muted);
  font-size: var(--field-label-size, 12px);
  font-weight: 600;
  line-height: 1.35;
}

.filter-action-group .report-filter-actions {
  justify-content: flex-start;
}

.report-presets {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
}

.report-presets .outline-btn {
  min-height: 42px;
}

.report-refresh {
  min-height: 42px;
}

.report-method-note {
  margin: 0;
}

.report-metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(190px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.report-metric {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.report-metric__icon {
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  border-radius: 12px;
  background: var(--surface-muted);
  color: var(--primary);
  font-size: 20px;
}

.report-metric span,
.report-metric small {
  display: block;
}

.report-metric strong {
  display: block;
  margin: 1px 0;
  color: var(--secondary);
  font-family: "Roboto Condensed", sans-serif;
  font-size: 30px;
  line-height: 1;
}

.report-metric small {
  color: var(--muted);
  font-size: 13px;
}

.report-block__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.report-block__head strong {
  color: var(--primary);
  font-family: "Roboto Condensed", sans-serif;
  font-size: 26px;
}

.report-detail-grid {
  display: grid;
  grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr);
  gap: 16px;
  margin: 16px 0;
}

.report-deadlines {
  min-width: 0;
}

.report-overdue-list {
  display: grid;
  gap: 8px;
}

.report-overdue-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 12px;
  border: 1px solid rgba(185, 75, 75, .25);
  border-radius: 9px;
  background: rgba(185, 75, 75, .06);
  color: var(--text);
  text-decoration: none;
}

.report-overdue-item:hover {
  border-color: var(--danger);
}

.report-overdue-item span,
.report-overdue-item small {
  display: block;
  min-width: 0;
}

.report-overdue-item small {
  color: var(--muted);
}

.report-overdue-item time {
  flex: 0 0 auto;
  color: var(--danger);
  font-weight: 700;
}

.report-row-overdue td {
  background: rgba(185, 75, 75, .07);
}

.report-document__number-type {
  display: none;
}

.report-loading,
.report-error {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  color: var(--primary);
}

.report-error {
  color: var(--danger);
}

.report-error .outline-btn {
  margin-left: auto;
}

.panel,
.report-block {
  padding: var(--panel-padding);
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.crm-icon-box,
span.crm-icon-box,
div.crm-icon-box {
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.crm-icon-box > i {
  width: 1.25em;
  height: 1.25em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  text-align: center;
}

.dashboard-overview {
  margin-bottom: 16px;
  background: linear-gradient(180deg, var(--surface) 0%, #fbfdff 100%);
}

.dashboard-overview__group + .dashboard-overview__group {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid rgba(74, 122, 154, .14);
}

.dashboard-overview__group-title {
  margin: 0 0 10px;
  color: var(--muted);
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.3;
  text-transform: uppercase;
  letter-spacing: .035em;
}

.metric {
  position: relative;
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  min-height: 94px;
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow);
  color: inherit;
  text-align: left;
  text-decoration: none;
  transition: box-shadow .18s ease, transform .18s ease, border-color .18s ease;
  overflow: hidden;
}

.metric::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--primary);
}

.metric--tasks::before {
  background: var(--warning);
}

.metric--acceptance::before {
  background: var(--success);
}

.metric--purchases::before {
  background: var(--primary-dark);
}

button.metric,
a.metric {
  cursor: pointer;
  font: inherit;
}

button.metric:hover,
a.metric:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-hover);
  transform: translateY(-2px);
}

button.metric:focus-visible,
a.metric:focus-visible {
  outline: 3px solid rgba(74, 122, 154, .24);
  outline-offset: 2px;
}

.metric__icon {
  width: 50px;
  height: 50px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: var(--surface-muted);
  color: var(--primary);
  font-size: 20px;
}

.metric__body {
  min-width: 0;
}

.metric__value {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.metric__value strong {
  color: var(--secondary);
  font-family: "Roboto Condensed", sans-serif;
  font-size: 34px;
  font-weight: 300;
  line-height: 1;
}

.metric__sub {
  font-size: 13px;
  font-weight: 700;
  color: var(--danger);
}

.metric__sub.is-clear {
  color: var(--success);
}

.metric__label {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.3;
}

.quick-actions {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 0;
}

.quick-action {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 68px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-alt);
  color: var(--secondary);
  font-family: "Roboto Condensed", sans-serif;
  font-size: 17px;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  transition: border-color .18s ease, background .18s ease, box-shadow .18s ease, transform .18s ease;
}

.quick-action__icon {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: #fff;
  color: var(--primary);
  font-size: 17px;
}

.quick-action__label {
  flex: 1;
  min-width: 0;
}

.quick-action__plus {
  color: var(--primary);
  opacity: .5;
  transition: opacity .18s ease;
}

.quick-action:hover {
  border-color: var(--primary);
  background: #fff;
  box-shadow: var(--shadow-hover);
  transform: translateY(-2px);
}

.quick-action:hover .quick-action__plus {
  opacity: 1;
}

.dash-grid {
  display: grid;
  grid-template-columns: minmax(0, .9fr) minmax(0, 1.35fr);
  gap: 16px;
  align-items: stretch;
}

.dash-grid > .panel {
  min-width: 0;
  height: 100%;
}

.dash-attention,
.dash-deadlines {
  min-height: 472px;
}

.dashboard-scroll-list {
  max-height: 370px;
  padding-right: 6px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-color: rgba(74, 122, 154, .48) rgba(237, 245, 249, .75);
  scrollbar-width: thin;
}

.dashboard-scroll-list::-webkit-scrollbar {
  width: 8px;
}

.dashboard-scroll-list::-webkit-scrollbar-track {
  border-radius: 9999px;
  background: rgba(237, 245, 249, .75);
}

.dashboard-scroll-list::-webkit-scrollbar-thumb {
  border: 2px solid rgba(237, 245, 249, .75);
  border-radius: 9999px;
  background: rgba(74, 122, 154, .6);
}

.dashboard-scroll-list::-webkit-scrollbar-thumb:hover {
  background: var(--primary);
}

.dash-activity {
  grid-column: 1 / -1;
}

.dash-deadlines .timeline-list {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.dash-activity .activity-list {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.panel-count {
  min-width: 24px;
  padding: 2px 9px;
  border-radius: 9999px;
  background: var(--danger);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  text-align: center;
}

.panel-count:empty,
.panel-count.is-clear {
  display: none;
}

.panel-count--neutral {
  background: var(--primary);
}

.attention-list {
  display: grid;
  gap: 10px;
}

.attention-item {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid rgba(74, 122, 154, 0.18);
  border-left: 4px solid var(--warning);
  border-radius: 8px;
  background: var(--surface-alt);
  cursor: pointer;
  transition: box-shadow .18s ease;
}

.attention-item:hover {
  box-shadow: var(--shadow-hover);
}

.attention-item.is-overdue {
  border-left-color: var(--danger);
}

.attention-item__icon {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #fff;
  color: var(--warning);
}

.attention-item.is-overdue .attention-item__icon {
  color: var(--danger);
}

.attention-item__body {
  min-width: 0;
}

.attention-item__body strong {
  display: -webkit-box;
  color: var(--secondary);
  font-size: 15px;
  font-weight: 600;
  overflow: hidden;
  line-height: 1.25;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.attention-item__body span {
  color: var(--muted);
  font-size: 13px;
}

.empty-state {
  display: grid;
  grid-column: 1 / -1;
  width: 100%;
  justify-items: center;
  gap: 6px;
  padding: 26px 16px;
  color: var(--muted);
  text-align: center;
}

.empty-state i {
  font-size: 26px;
  color: rgba(74, 122, 154, 0.4);
}

.empty-state strong {
  color: var(--secondary);
  font-family: "Roboto Condensed", sans-serif;
  font-size: 17px;
  font-weight: 400;
}

.empty-state small {
  font-size: 13px;
}

.empty-state.compact {
  min-height: 0;
  padding: 18px 0;
}

.work-grid,
.list-layout,
.docs-grid,
.integrations-grid {
  display: grid;
  grid-template-columns: minmax(340px, .78fr) minmax(0, 1.22fr);
  gap: 16px;
  align-items: start;
}

.docs-grid,
.integrations-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: 20px;
}

.integrations-grid {
  align-items: stretch;
}

.list-layout {
  grid-template-columns: minmax(0, 1fr);
}

.list-layout--single {
  grid-template-columns: minmax(0, 1fr);
}

.crm-nav-badge {
  min-width: 1.35rem;
  height: 1.35rem;
  margin-left: auto;
  padding: 0 .32rem;
  border-radius: 999px;
  background: #fff;
  color: #326887;
  font-size: .7rem;
  font-weight: 800;
  line-height: 1.35rem;
  text-align: center;
}

.entity-title-with-unread {
  display: flex;
  min-width: 0;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
}

.entity-unread-badge {
  display: inline-flex;
  min-height: 22px;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--primary);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
}

.entity-unread-badge i {
  font-size: 10px;
}

/* Рабочая область чата — общий компонент внутреннего чата и ИИ-чата.
   Оба раздела используют одну разметку, поэтому правила описаны один раз,
   без префиксов #view-chats/#view-aichat. */
#view-chats,
#view-aichat {
  min-width: 0;
}

/* Рабочая область лежит внутри обычной панели раздела: заголовок и кнопки у чатов
   такие же, как на остальных страницах, а две колонки — отдельным блоком под ними. */
.chat-workspace {
  display: grid;
  grid-template-columns: minmax(300px, 360px) minmax(0, 1fr);
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 12px;
}

.chat-sidebar {
  display: grid;
  min-width: 0;
  min-height: 0;
  grid-template-rows: auto auto;
  align-content: start;
  border-right: 1px solid var(--border);
  background: var(--surface-alt);
}

.chat-room__head {
  height: 80px;
  min-height: 80px;
  margin: 0;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}

.chat-room__head h2 {
  margin: 0;
}

/* Поиск по чатам — тот же .filter-bar, но без рамки и фона панели. */
.chat-search.filter-bar {
  display: grid;
  margin: 14px 18px 12px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  font-size: 12px;
}

.chat-search.filter-bar label {
  gap: 6px;
}

.chat-search input {
  width: 100%;
}

.chat-conversation-list {
  padding: 0 18px 14px;
}

/* Строка списка бывает и ссылкой (внутренний чат), и кнопкой (ИИ-чат):
   у кнопки сбрасываем её собственный шрифт и выравнивание. */
.chat-conversation {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  position: relative;
  width: 100%;
  min-height: 66px;
  margin: 0;
  padding: 9px 10px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  font: inherit;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

/* Соседние строки разделяются тонкой линией: пока чат не выбран и нет наведения
   (на телефоне его нет вовсе), список читался сплошным полотном. Линия рисуется
   отдельным элементом, а не рамкой строки: рамка повторяет скругление углов и
   концы линии загибались. Строки смыкаются на пиксель — иначе на стыке видно две. */
.chat-conversation + .chat-conversation {
  margin-top: -1px;
}

.chat-conversation + .chat-conversation::before {
  content: "";
  position: absolute;
  top: -1px;
  right: 0;
  left: 0;
  height: 1px;
  background: rgba(74, 122, 154, .16);
}

/* Под наведением и на выбранной строке линию перекрывает её собственная рамка. */
.chat-conversation:hover::before,
.chat-conversation:focus-visible::before,
.chat-conversation.is-active::before {
  display: none;
}

.chat-conversation:hover,
.chat-conversation:focus-visible {
  border-color: var(--border);
  background: var(--surface);
  outline: none;
}

.chat-conversation.is-active {
  border-color: rgba(74, 122, 154, .34);
  background: var(--surface-muted);
}

/* Подсвеченная строка ложится поверх линии соседа, иначе её край перечёркнут. */
.chat-conversation:hover,
.chat-conversation:focus-visible,
.chat-conversation.is-active {
  z-index: 1;
}

.chat-conversation__avatar {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 12px;
  background: #e5f1f7;
  color: var(--primary);
}

.chat-conversation__body,
.chat-conversation__meta {
  display: flex;
  min-width: 0;
  flex-direction: column;
}

.chat-conversation__body strong,
.chat-conversation__body small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-conversation__body small,
.chat-conversation__meta time {
  color: var(--muted);
  font-size: .75rem;
}

.chat-conversation__meta {
  align-items: flex-end;
  gap: 6px;
}

.chat-conversation__meta b {
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--primary);
  color: #fff;
  font-size: .7rem;
  line-height: 20px;
  text-align: center;
}

.chat-list-empty {
  padding: 32px 16px;
  color: var(--muted);
  text-align: center;
}

.chat-list-empty.empty-state {
  width: 100%;
  padding: 28px 12px;
}

.chat-main {
  display: grid;
  min-width: 0;
  min-height: 0;
  grid-template: minmax(0, 1fr) / minmax(0, 1fr);
  background: var(--surface);
}

/* Заглушка и переписка занимают одну и ту же ячейку: переключаются атрибутом hidden.
   min-width: 0 обязателен — иначе элемент сетки растягивается под длинный заголовок
   или длинную реплику и переписка вылезает за пределы панели. */
.chat-empty,
.chat-room {
  grid-area: 1 / 1;
  min-width: 0;
}

.chat-message-list,
.chat-room__head {
  min-width: 0;
}

.chat-empty {
  display: grid;
  justify-items: center;
  color: var(--muted);
  text-align: center;
}

.chat-empty.empty-state {
  min-height: 0;
  height: 100%;
  padding: 32px;
  place-content: center;
}

.chat-empty .crm-icon-box {
  width: 52px;
  height: 52px;
  margin-bottom: 8px;
  border-radius: 12px;
  background: var(--surface-muted);
  color: var(--primary);
  font-size: 1.35rem;
}

.chat-empty strong {
  color: var(--secondary);
  font-family: "Roboto Condensed", sans-serif;
  font-size: 22px;
  font-weight: 400;
}

.chat-empty small {
  max-width: 440px;
  font-size: 14px;
  line-height: 1.5;
}

.chat-room {
  display: grid;
  grid-template-rows: auto auto auto auto;
}

.chat-room__head {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface);
}

.chat-room__head .panel-actions {
  width: auto;
  flex-wrap: nowrap;
}

.chat-room__identity {
  min-width: 0;
  flex: 1;
}

.chat-room__identity h2,
.chat-room__identity p {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-room__identity p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: .8rem;
}

.chat-mobile-back {
  display: none;
}

.chat-load-earlier {
  justify-self: center;
  margin: 10px 0 0;
}

.outline-btn.entity-feed-load-earlier {
  display: flex;
  width: max-content;
  max-width: 100%;
  margin: 4px auto 14px;
}

/* Лента — грид с auto-строками. Без align-content: start свободное место
   раскидывается между строками, и пара сообщений расползается по всей высоте. */
.chat-message-list {
  align-content: start;
  padding: 18px 22px;
  background: var(--surface-alt);
}

/* .entity-feed-composer описан ниже по файлу и задаёт свой margin-top,
   поэтому селектор составной. */
.entity-feed-composer.chat-feed-composer {
  margin: 0;
  padding: 14px 16px 16px;
  border-top: 1px solid var(--border);
  background: var(--surface);
}

/* Совместная доска. Рабочая область повторяет раскладку чата: список слева,
   холст справа (FUTURE_TASKS_AI_AND_COLLAB_BOARD.md §2.6). */
/* Холст должен занимать высоту окна, а не сжиматься до содержимого: без явной
   высоты рабочая область складывалась в узкую полосу. Панель раздела растягивается
   на видимую высоту, а двухколонная область забирает весь остаток. */
#view-boards > .panel {
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 74px);
  min-height: calc(100dvh - 74px);
}

/* Класс свой: у чата высота запрещена правилом «страница скроллится целиком»,
   а холсту доски высота нужна. */
.board-workspace {
  flex: 1 1 auto;
  min-height: 420px;
}

.board-room {
  grid-template-rows: auto auto minmax(0, 1fr);
}

.board-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 14px;
  padding: 10px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-alt);
}

.board-toolbar__group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.board-toolbar__group + .board-toolbar__group {
  padding-left: 14px;
  border-left: 1px solid var(--border);
}

.board-toolbar__zoom .outline-btn {
  min-width: 66px;
  justify-content: center;
}

/* Подсказка и состояние сохранения — плашка в углу холста. Строкой в панели она
   занимала место постоянно и то складывалась в одну строку, то в две: панель
   дёргалась от длины текста. Поверх холста ничего не двигается, а щелчки сквозь
   неё проходят на поле. */
.board-status {
  position: absolute;
  left: 10px;
  bottom: 10px;
  z-index: 2;
  max-width: calc(100% - 20px);
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255, 255, 255, .88);
  box-shadow: 0 1px 4px rgba(44, 62, 74, .12);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.3;
  pointer-events: none;
}

.board-status:empty {
  display: none;
}

/* Выбранный инструмент должен быть виден: без этого непонятно, что нажато. */
.board-toolbar .icon-btn.is-active {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
}

.board-swatch {
  width: 22px;
  height: 22px;
  padding: 0;
  border: 1px solid rgba(44, 62, 74, .22);
  border-radius: 6px;
  cursor: pointer;
}

/* Цвет выбранного элемента отмечен обводкой. */
.board-swatch.is-active {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(74, 122, 154, .35);
}

.board-swatch:disabled {
  opacity: .45;
  cursor: default;
}

.board-swatch--blue { background: #cfe6f5; }
.board-swatch--green { background: #d3efdf; }
.board-swatch--amber { background: #fbeccb; }
.board-swatch--red { background: #f7d7d7; }
.board-swatch--violet { background: #e2dcf5; }
.board-swatch--grey { background: #e4e9ec; }

.board-canvas {
  position: relative;
  min-width: 0;
  min-height: 320px;
  overflow: hidden;
  background: var(--surface);
  /* Холст не должен прокручивать страницу жестами на планшете. */
  touch-action: none;
}

.board-svg {
  display: block;
  width: 100%;
  height: 100%;
  cursor: grab;
}

.board-canvas[data-board-tool="rect"] .board-svg,
.board-canvas[data-board-tool="text"] .board-svg,
.board-canvas[data-board-tool="arrow"] .board-svg {
  cursor: crosshair;
}

.board-canvas.is-readonly .board-svg {
  cursor: default;
}

.board-node__shape {
  fill: #fff;
  stroke: rgba(74, 122, 154, .55);
  stroke-width: 1.5;
}

.board-node__hit {
  fill: transparent;
  stroke: transparent;
}

.board-node--blue .board-node__shape { fill: #eaf4fb; }
.board-node--green .board-node__shape { fill: #ebf8f1; }
.board-node--amber .board-node__shape { fill: #fdf4e2; }
.board-node--red .board-node__shape { fill: #fdeded; }
.board-node--violet .board-node__shape { fill: #f0edfa; }
.board-node--grey .board-node__shape { fill: #f1f4f6; }

.board-node__text {
  fill: var(--text);
  font-family: inherit;
  font-size: 13px;
  pointer-events: none;
  user-select: none;
}

.board-node--text .board-node__text {
  font-size: 15px;
  font-weight: 600;
}

.board-node.is-selected .board-node__shape,
.board-node.is-selected .board-node__hit {
  stroke: var(--primary);
  stroke-width: 2;
  stroke-dasharray: 4 3;
}

/* Ручка изменения размера есть в разметке всегда, но видна только у выбранного:
   иначе смена выделения требовала бы полной перерисовки сцены, а она сбивает
   двойной щелчок по элементу. */
.board-node__handle {
  display: none;
  fill: #fff;
  stroke: var(--primary);
  stroke-width: 1.5;
  cursor: nwse-resize;
}

.board-node.is-selected .board-node__handle {
  display: block;
}

.board-arrow__line {
  fill: none;
  stroke: var(--secondary);
  stroke-width: 1.8;
}

.board-node.is-selected .board-arrow__line {
  stroke: var(--primary);
  stroke-width: 2.4;
}

/* Прозрачная широкая копия линии: по тонкой стрелке мышью не попасть. */
.board-arrow__hit {
  fill: none;
  stroke: transparent;
  stroke-width: 12;
}

#boardArrowHead path {
  fill: var(--secondary);
}

/* Текст правится обычным полем поверх холста: редактируемый текст внутри SVG
   ведёт себя ненадёжно в разных браузерах. */
.board-text-editor {
  position: absolute;
  z-index: 3;
  padding: 6px 8px;
  border: 2px solid var(--primary);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font-family: inherit;
  line-height: 1.3;
  resize: none;
}

.board-member {
  flex-wrap: wrap;
}

.board-member__role {
  flex: 0 0 auto;
  width: auto;
  min-width: 128px;
  margin-left: auto;
  font-size: 12px;
}

/* На телефоне открытая доска — это почти целиком холст. Панель инструментов
   разворачивалась в пять строк, а заголовок раздела и поля панели съедали ещё
   столько же: под саму схему оставалась треть экрана. */
@media (max-width: 760px) {
  /* Высоту задаёт сама доска, снизу доверху экрана: лишние запасы панели
     оставили бы под холстом пустую полосу. */
  #view-boards.has-board > .panel {
    margin: 0 -16px -40px;
    padding: 0;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    min-height: 0;
  }

  #view-boards.has-board .board-workspace {
    min-height: 0;
  }

  /* Панель и рабочая область не должны давать двойную рамку у самого края. */
  #view-boards.has-board .board-workspace {
    border-right: 0;
    border-left: 0;
    border-radius: 0;
  }

  /* Заголовок «Доски» и кнопка новой доски не нужны, пока доска открыта:
     возврат к списку — стрелкой в шапке доски. */
  #view-boards.has-board > .panel > .panel-head {
    display: none;
  }

  /* Кнопки ужимаются, чтобы уместиться в две строки: прокрутка вбок прятала
     половину панели, и до правки текста или удаления было не добраться. */
  .board-toolbar {
    gap: 6px;
    padding: 8px;
  }

  .board-toolbar__group {
    flex: 0 0 auto;
    gap: 4px;
  }

  .board-toolbar__group + .board-toolbar__group {
    padding-left: 6px;
  }

  /* Размеры подобраны так, чтобы инструменты с палитрой встали первой строкой,
     а действия с масштабом — второй, вплоть до экрана шириной 360 пикселей. */
  .board-toolbar .icon-btn {
    width: 34px;
    min-width: 34px;
    flex-basis: 34px;
    min-height: 34px;
  }

  .board-toolbar__zoom .outline-btn {
    min-width: 52px;
    min-height: 34px;
    padding: 0 6px;
  }

  .board-status {
    left: 8px;
    bottom: 8px;
    max-width: calc(100% - 16px);
    padding: 3px 9px;
    font-size: 11px;
  }

  /* Палец меньше мыши не бывает: цветные кнопки подросли, но не настолько,
     чтобы палитра перестала помещаться в строку рядом с инструментами. */
  .board-swatch {
    width: 26px;
    height: 26px;
    border-radius: 7px;
  }

  /* Название доски и кнопки участников — в одну строку, подписи прячем. */
  .board-room .chat-room__head {
    min-height: 56px;
    padding: 8px 10px;
    gap: 8px;
  }

  .board-room .chat-room__head .outline-btn span {
    display: none;
  }

  .board-room .chat-room__head .outline-btn {
    padding: 0;
    width: 38px;
    min-width: 38px;
    height: 38px;
    justify-content: center;
  }

  /* Высоту комнаты ставит boardSizeRoom по месту; здесь только нижний предел,
     чтобы холст не схлопнулся, пока размер ещё не посчитан. */
  .board-canvas {
    min-height: 200px;
  }
}

/* Картинки, вставленные в поле ввода ИИ-чата. Файлы туда не прикрепляются:
   изображение живёт только до отправки, модели уходит снятый с него текст.
   Отступы по бокам те же, что у поля ввода и панели ниже: во всю ширину
   карточка упиралась в рамку составителя и слипалась с переключателем. */
.ai-attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 16px 12px;
}

/* Карточка по размеру содержимого, а не во всю строку: иначе крестик уезжает
   к дальнему краю и связь с картинкой теряется. */
.ai-attachment {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 100%;
  padding: 6px 8px 6px 6px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-alt);
}

.ai-attachment.is-error {
  border-color: rgba(190, 74, 74, .45);
  background: rgba(190, 74, 74, .06);
}

.ai-attachment__thumb {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface);
  color: var(--muted);
  object-fit: cover;
}

.ai-attachment__body {
  display: grid;
  gap: 1px;
  min-width: 0;
  max-width: 240px;
}

.ai-attachment__body strong {
  overflow: hidden;
  color: var(--secondary);
  font-size: 13px;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ai-attachment__body small {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ai-attachment.is-done .ai-attachment__body small {
  color: var(--primary);
}

.ai-attachment.is-error .ai-attachment__body small {
  color: #a94442;
}

/* Ход распознавания: тонкая полоса под названием, без отдельной строки. */
.ai-attachment__bar {
  display: block;
  overflow: hidden;
  width: 100%;
  height: 3px;
  margin-top: 3px;
  border-radius: 999px;
  background: var(--surface-muted);
}

.ai-attachment__bar span {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--primary);
  transition: width .2s ease;
}

.ai-attachment__remove {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 26px;
  height: 26px;
  margin-left: 2px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
}

.ai-attachment__remove:hover,
.ai-attachment__remove:focus-visible {
  background: var(--surface-muted);
  color: var(--secondary);
}

/* Ответ модели приходит markdown-разметкой: заголовки, списки и код
   размечаются в JS уже после экранирования текста. */
.ai-answer {
  display: grid;
  gap: 8px;
  margin: 0;
  min-width: 0;
  overflow-wrap: anywhere;
}

.ai-answer p {
  margin: 0;
  line-height: 1.5;
}

.ai-answer__heading {
  color: var(--secondary);
  font-weight: 600;
}

.ai-answer__list {
  margin: 0;
  padding-left: 20px;
  display: grid;
  gap: 4px;
  line-height: 1.5;
}

.ai-answer code {
  padding: 1px 5px;
  border-radius: 5px;
  background: var(--surface-muted);
  font-size: .9em;
}

.ai-answer__code {
  margin: 0;
  padding: 10px 12px;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-muted);
}

.ai-answer__code code {
  padding: 0;
  background: transparent;
}

.ai-answer__table-wrap {
  max-width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
}

.ai-answer__table {
  width: max-content;
  min-width: 100%;
  border-collapse: collapse;
  font-size: .95em;
  line-height: 1.4;
}

.ai-answer__table th,
.ai-answer__table td {
  padding: 8px 10px;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

.ai-answer__table th:last-child,
.ai-answer__table td:last-child {
  border-right: 0;
}

.ai-answer__table tbody tr:last-child td {
  border-bottom: 0;
}

.ai-answer__table th {
  background: var(--primary-dark);
  color: #fff;
  font-weight: 600;
}

.ai-answer__table tbody tr:nth-child(even) td {
  background: var(--surface-alt);
}

.ai-answer__table .is-center {
  text-align: center;
}

.ai-answer__table .is-right {
  text-align: right;
}

.ai-map-card {
  display: grid;
  gap: 10px;
  width: 100%;
  min-width: 0;
  margin-top: 12px;
  padding: 12px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-alt);
}

.ai-map-card__head,
.ai-map-card__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.ai-map-card__head span,
.ai-map-card__footer a {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.ai-map-card__head i {
  color: var(--primary);
}

.ai-map-card__head small,
.ai-map-card__footer {
  color: var(--muted);
  font-size: 12px;
}

.ai-map-card__frame {
  overflow: hidden;
  width: 100%;
  height: 320px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-muted);
}

.ai-map-card__frame iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
}

.ai-map-card__points {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}

.ai-map-card__point {
  display: grid;
  gap: 3px;
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  text-align: left;
}

.ai-map-card__point strong,
.ai-map-card__point small {
  overflow-wrap: anywhere;
}

.ai-map-card__point small {
  color: var(--muted);
  line-height: 1.35;
}

.ai-map-card__point:hover,
.ai-map-card__point:focus-visible,
.ai-map-card__point.is-active {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(74, 122, 154, .12);
}

.ai-map-card__footer a {
  color: var(--primary);
  font-weight: 600;
  text-decoration: none;
}

.ai-map-card__footer a:hover,
.ai-map-card__footer a:focus-visible {
  text-decoration: underline;
}

.ai-chat-live .feed-item__body {
  min-width: 0;
}

.ai-chat-live__status {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  color: var(--primary-dark);
  font-weight: 600;
}

.ai-chat-live__status i {
  color: var(--primary);
  animation: crm-ai-stream-spin .9s linear infinite;
}

.ai-chat-live__reasoning {
  display: grid;
  gap: 4px;
  margin-top: 8px;
  padding: 9px 11px;
  border-left: 3px solid var(--primary);
  border-radius: 6px;
  background: var(--surface-muted);
  color: var(--muted);
}

.ai-chat-live__reasoning strong {
  color: var(--secondary);
  font-size: 13px;
}

.ai-chat-live__reasoning p {
  display: -webkit-box;
  margin: 0;
  overflow: hidden;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
}

.ai-chat-live__answer {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

@keyframes crm-ai-stream-spin {
  to { transform: rotate(360deg); }
}

/* Ссылка из ответа на карточку CRM вместо голого идентификатора записи. */
.ai-answer__link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--primary);
  font-size: .9em;
  text-decoration: none;
}

.ai-answer__link:hover,
.ai-answer__link:focus-visible {
  text-decoration: underline;
}

@media (max-width: 760px) {
  .ai-map-card {
    padding: 9px;
  }

  .ai-map-card__frame {
    height: 260px;
  }

  .ai-map-card__points {
    grid-template-columns: minmax(0, 1fr);
  }

  .ai-map-card__head,
  .ai-map-card__footer {
    align-items: flex-start;
    flex-direction: column;
  }

  .chat-workspace {
    display: block;
    grid-template-columns: none;
  }

  .chat-workspace.has-room .chat-sidebar {
    display: none;
  }

  .chat-workspace:not(.has-room) .chat-main {
    display: none;
  }

  .chat-sidebar {
    border-right: 0;
  }

  .chat-mobile-back {
    display: inline-grid;
  }

  .chat-room__head {
    height: auto;
    min-height: 66px;
    padding: 12px;
  }

  .chat-search.filter-bar {
    margin: 12px;
  }

  .chat-conversation-list {
    padding: 0 12px 12px;
  }

  .chat-message-list {
    padding: 12px;
  }

  .entity-feed-composer.chat-feed-composer {
    padding: 10px;
  }
}

.list-layout > form,
.form-staging {
  display: none;
}

.panel-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  column-gap: 12px;
  row-gap: 12px;
  min-height: 51px;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(74, 122, 154, 0.16);
}

.panel-head > :first-child {
  min-width: 0;
}

.panel-head h2 {
  margin: 0;
  font-family: "Roboto Condensed", sans-serif;
  font-size: 22px;
  font-weight: 400;
  line-height: 1.2;
}

.panel-head > .panel-actions {
  grid-column: 2;
  justify-self: end;
}

.panel-head > .form-note {
  grid-column: 2;
  justify-self: end;
  align-self: center;
}

.panel-description {
  margin: -6px 0 14px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.panel-actions,
.user-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}

.primary-btn,
.outline-btn,
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.1;
  text-decoration: none;
  transition: background .2s ease, color .2s ease, border-color .2s ease, box-shadow .2s ease;
}

.primary-btn {
  border: 1px solid var(--primary);
  padding: 0 14px;
  background: var(--primary);
  color: #fff;
}

.primary-btn:hover {
  border-color: var(--primary-dark);
  background: var(--primary-dark);
}

.outline-btn {
  border: 1px solid var(--primary);
  padding: 0 14px;
  background: #fff;
  color: var(--primary);
}

.outline-btn:hover {
  background: var(--primary);
  color: #fff;
}

.icon-btn {
  width: 40px;
  flex: 0 0 40px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--primary);
}

.icon-btn:hover {
  border-color: var(--primary);
  background: var(--surface-muted);
}

.primary-btn:focus-visible,
.outline-btn:focus-visible,
.icon-btn:focus-visible,
.task-scope-tabs button:focus-visible,
.crm-nav button:focus-visible,
.entity-card__link:focus-visible,
.entity-row-link:focus-visible {
  outline: 3px solid rgba(74, 122, 154, .28);
  outline-offset: 2px;
}

.crm-form {
  --field-label-size: 14px;
  display: grid;
  gap: 12px;
}

.filter-bar {
  --field-label-size: 12px;
  display: grid;
  align-items: end;
  gap: 12px;
  margin-bottom: 16px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-alt);
}

.crm-form label,
.filter-bar label,
.supplier-head {
  display: grid;
  min-width: 0;
  gap: 6px;
  margin: 0;
  color: var(--muted);
  font-size: var(--field-label-size, 14px);
  font-weight: 600;
  line-height: 1.35;
}

.crm-form input:not([type="checkbox"]):not([type="radio"]),
.crm-form select,
.crm-form textarea,
.filter-bar input:not([type="checkbox"]):not([type="radio"]),
.filter-bar select,
.filter-bar textarea,
.doc-editor {
  width: 100%;
  min-width: 0;
  min-height: 42px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  background: #fff;
  color: var(--text);
  outline: none;
}

.crm-form textarea,
.filter-bar textarea {
  resize: vertical;
}

.crm-form input:not([type="checkbox"]):not([type="radio"]):focus,
.crm-form select:focus,
.crm-form textarea:focus,
.filter-bar input:not([type="checkbox"]):not([type="radio"]):focus,
.filter-bar select:focus,
.filter-bar textarea:focus,
.doc-editor:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(74, 122, 154, 0.12);
}

.crm-form input[type="checkbox"],
.crm-form input[type="radio"],
.filter-bar input[type="checkbox"],
.filter-bar input[type="radio"] {
  width: 18px;
  height: 18px;
  min-height: 0;
  margin: 0;
  accent-color: var(--primary);
}

.crm-form input::placeholder,
.crm-form textarea::placeholder,
.filter-bar input::placeholder,
.filter-bar textarea::placeholder {
  color: #7C8B95;
  opacity: 1;
}

.crm-form :disabled,
.filter-bar :disabled {
  cursor: not-allowed;
  background: var(--surface-muted);
  color: var(--muted);
}

.filter-bar__note {
  grid-column: 1 / -1;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 0;
  padding: 9px 11px;
  border-radius: 8px;
  background: rgba(74, 122, 154, .08);
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.filter-bar__note i {
  flex: 0 0 auto;
  margin-top: 2px;
  color: var(--primary);
}

.form-row,
.supplier-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.toggle-row,
.permissions-grid label {
  display: flex !important;
  align-items: center;
  gap: 8px;
}

.toggle-row input,
.permissions-grid input {
  width: auto;
  min-height: 0;
}

.permission-box {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-alt);
}

.permission-box > span {
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.permissions-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 12px;
}

.user-rights {
  max-width: 360px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.35;
}

.users-table .icon-btn {
  width: 36px;
  min-height: 36px;
  flex-basis: 36px;
}

.danger-btn {
  color: var(--danger);
}

.danger-btn:hover {
  border-color: var(--danger);
  background: rgba(185, 75, 75, 0.08);
  color: var(--danger);
}

.danger-btn:disabled {
  cursor: not-allowed;
  opacity: .45;
}

.supplier-editor {
  display: grid;
  gap: 10px;
}

.supplier-head {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
}

.supplier-row {
  align-items: end;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-alt);
}

.entity-list,
.timeline-list,
.activity-list {
  display: grid;
  gap: 10px;
}

.entity-list {
  grid-template-columns: repeat(auto-fit, minmax(520px, 1fr));
}

.list-pagination {
  display: flex;
  min-height: 38px;
  margin-top: 14px;
  padding-top: 12px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.list-pagination[hidden] {
  display: none;
}

.list-pagination__summary {
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.list-pagination__controls {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: flex-end;
  gap: 5px;
}

.list-pagination__controls .icon-btn,
.list-pagination__page {
  width: 34px;
  min-width: 34px;
  min-height: 34px;
}

.list-pagination__page {
  display: inline-grid;
  padding: 0 6px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--primary);
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  place-items: center;
}

.list-pagination__page:hover,
.list-pagination__page.is-active {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
}

.list-pagination__ellipsis {
  min-width: 20px;
  color: var(--muted);
  text-align: center;
}

.entity-card,
.timeline-item,
.activity-item {
  padding: 14px;
  border: 1px solid rgba(74, 122, 154, 0.18);
  border-radius: 8px;
  background: var(--surface-alt);
}

.timeline-item {
  min-width: 0;
}

.activity-item {
  min-width: 0;
  min-height: 92px;
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  align-items: start;
  gap: 10px;
}

.activity-item__icon {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: #fff;
  color: var(--primary);
}

.activity-item__body {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.activity-item__type {
  color: var(--primary);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.2;
  text-transform: uppercase;
  letter-spacing: .035em;
}

.activity-item__body strong {
  display: -webkit-box;
  overflow: hidden;
  color: var(--secondary);
  font-size: 14px;
  line-height: 1.3;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.activity-item__body time {
  color: var(--muted);
  font-size: 12px;
}

.entity-card {
  display: grid;
  gap: 12px;
}

.entity-card:hover {
  box-shadow: var(--shadow-hover);
}

.entity-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: auto;
}

.entity-card__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.entity-card__controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
}

.entity-card__controls .icon-btn {
  width: 34px;
  min-height: 34px;
  flex-basis: 34px;
}

.entity-card__facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(155px, 1fr));
  gap: 8px;
  margin: 0;
}

.entity-card__fact {
  min-width: 0;
  padding: 10px 11px;
  border: 1px solid rgba(74, 122, 154, .13);
  border-radius: 8px;
  background: var(--surface);
}

.entity-card__fact--success {
  border-color: rgba(54, 132, 99, .24);
  background: rgba(230, 245, 238, .78);
}

.entity-card__fact dt {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--primary);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.2;
  text-transform: uppercase;
  letter-spacing: .025em;
}

.entity-card__fact dt i {
  width: 13px;
  text-align: center;
}

.entity-card__fact--success dt {
  color: var(--success);
}

.entity-card__fact dd {
  margin: 5px 0 0;
  color: var(--secondary);
  font-weight: 600;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.entity-card__fact dd small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
}

.meta-line {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.4;
}

.meta-line > span {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  overflow-wrap: anywhere;
}

.meta-line > span:not(:first-child)::before {
  content: "";
  flex: 0 0 4px;
  width: 4px;
  height: 4px;
  border-radius: 999px;
  background: rgba(74, 122, 154, .45);
}

.pill,
.status {
  flex: 0 0 auto;
  align-self: flex-start;
  width: fit-content;
  max-width: 100%;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 26px;
  padding: 4px 9px;
  border: 1px solid rgba(74, 122, 154, 0.16);
  border-radius: 9999px;
  background: #fff;
  color: var(--primary);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
}

.status-new {
  color: var(--primary);
}

.status-active,
.status-progress,
.status-in_work {
  color: #5F6D1C;
}

.status-done {
  color: var(--warning);
}

.status-approval {
  color: var(--warning);
}

.status-delivered,
.status-closed,
.status-finished {
  color: var(--success);
}

.status-placed {
  color: var(--primary);
}

.status-selection {
  margin-inline-start: 8px;
  border-color: rgba(58, 123, 98, .28);
  background: rgba(230, 245, 238, .9);
}

.status-overdue,
.status-paused,
.status-revision {
  color: var(--danger);
}

.status-registered {
  border-color: rgba(91, 105, 115, .22);
  background: var(--surface-alt);
  color: var(--muted);
}

.status-draft {
  border-color: rgba(212, 151, 30, .3);
  background: rgba(212, 151, 30, .1);
  color: #8a5a00;
}

.status-registering {
  border-color: rgba(65, 126, 164, .28);
  background: rgba(65, 126, 164, .09);
  color: var(--primary);
}

.status-annulled {
  border-color: rgba(185, 75, 75, .3);
  background: rgba(185, 75, 75, .08);
  color: var(--danger);
}

.document-filters {
  grid-template-columns:
    minmax(220px, 1.5fr)
    minmax(190px, 1.15fr)
    minmax(100px, .55fr)
    minmax(90px, .5fr)
    minmax(160px, .9fr)
    minmax(145px, .8fr)
    auto;
}

.document-filter-reset {
  align-self: end;
  min-height: 42px;
  white-space: nowrap;
}

.document-register-table {
  min-width: 1180px;
}

.document-register__status {
  width: 132px;
  white-space: nowrap;
}

.document-register__name {
  width: 230px;
  color: var(--secondary);
  font-weight: 600;
}

.document-register__party {
  width: 185px;
}

.document-register__project {
  width: 165px;
}

.document-register__file {
  min-width: 235px;
}

.document-register__file a {
  display: inline-flex;
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.document-register-files {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  max-width: 100%;
}

.document-register-files__count {
  flex: 0 0 auto;
  display: inline-grid;
  min-width: 25px;
  height: 25px;
  padding: 0 6px;
  place-items: center;
  border-radius: 999px;
  background: var(--surface-muted);
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
}

.list-filters {
  grid-template-columns: minmax(240px, 1.5fr) minmax(180px, .8fr) auto;
}

.task-scope-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
  padding: 5px;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-alt);
}

.task-scope-tabs button {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 7px 12px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.task-scope-tabs button:hover,
.task-scope-tabs button.is-active {
  background: #fff;
  color: var(--primary);
  box-shadow: 0 3px 10px rgba(44, 62, 74, .08);
}

.task-scope-tabs strong {
  min-width: 24px;
  padding: 2px 7px;
  border-radius: 9999px;
  background: var(--surface-muted);
  color: var(--primary-dark);
  font-size: 12px;
  text-align: center;
}

.list-filters--four {
  grid-template-columns: minmax(240px, 1.4fr) minmax(170px, .8fr) minmax(190px, 1fr) auto;
}

.list-filters--five {
  grid-template-columns: minmax(180px, 220px) minmax(180px, 220px) minmax(170px, .8fr) minmax(190px, 1fr) minmax(0, 1fr);
}

.list-filter-empty {
  display: grid;
  justify-items: center;
  gap: 12px;
  padding: 18px;
}

.document-empty-filter {
  display: grid;
  justify-items: center;
  gap: 12px;
  padding: 12px;
}

.entity-row-link.is-annulled {
  color: var(--danger);
  text-decoration: line-through;
}

.document-annul-info {
  display: grid;
  gap: 5px;
  padding: 15px 18px;
  border: 1px solid rgba(185, 75, 75, .3);
  border-radius: 10px;
  background: rgba(185, 75, 75, .07);
  color: var(--danger);
}

.document-annul-info p {
  margin: 0;
  white-space: pre-wrap;
}

.document-annul-info span {
  font-size: 13px;
}

.document-content-card__head h2 {
  margin: 0;
}

.phase-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.phase-list label {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  margin: 0;
  padding: 7px 9px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
}

.table-wrap {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  border: 1px solid var(--table-border);
  border-radius: 12px;
  background: #fff;
  scrollbar-color: rgba(45, 76, 99, .48) var(--surface-muted);
  scrollbar-width: thin;
}

.table-wrap::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

.table-wrap::-webkit-scrollbar-track {
  background: var(--surface-muted);
}

.table-wrap::-webkit-scrollbar-thumb {
  border: 2px solid var(--surface-muted);
  border-radius: 999px;
  background: rgba(45, 76, 99, .48);
}

.crm-table {
  width: 100%;
  min-width: 740px;
  border-collapse: separate;
  border-spacing: 0;
  color: var(--text);
  font-size: 15px;
  line-height: 1.35;
}

.crm-table th,
.crm-table td {
  padding: 12px;
  border-bottom: 1px solid var(--table-border);
  vertical-align: middle;
  text-align: left;
  overflow-wrap: anywhere;
}

.crm-table th:not(:last-child),
.crm-table td:not(:last-child) {
  border-right: 1px solid var(--table-border);
}

.crm-table thead th {
  background: var(--primary-dark);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
}

.crm-table thead th:not(:last-child) {
  border-right-color: rgba(255, 255, 255, .16);
}

.crm-table tbody th,
.crm-table tbody td {
  background: var(--surface);
}

.crm-table tbody th {
  color: var(--secondary);
  font-weight: 700;
}

.crm-table tbody tr:nth-child(even) > * {
  background: var(--table-row-alt);
}

.crm-table tbody tr:hover > * {
  background: var(--table-row-hover);
}

.crm-table tbody tr:focus-within > * {
  background: var(--table-row-hover);
}

.crm-table tbody tr.is-selected > *,
.crm-table tbody tr.is-selected:hover > *,
.crm-table tbody tr.is-selected:focus-within > * {
  background: rgba(230, 245, 238, .78);
}

.crm-table tbody tr:last-child > * {
  border-bottom: 0;
}

.crm-table tfoot th,
.crm-table tfoot td {
  border-top: 1px solid var(--table-border);
  border-bottom: 0;
  background: var(--surface-muted);
  color: var(--secondary);
  font-weight: 700;
}

.crm-table input:not([type="checkbox"]):not([type="radio"]),
.crm-table select {
  width: 100%;
  min-width: 0;
  min-height: 36px;
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 7px 9px;
  background: var(--surface);
  color: var(--text);
  outline: none;
}

.crm-table input:not([type="checkbox"]):not([type="radio"]):focus,
.crm-table select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(74, 122, 154, .12);
}

.crm-table input[type="checkbox"],
.crm-table input[type="radio"] {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--primary);
}

.crm-table .icon-btn {
  min-width: 36px;
  min-height: 36px;
}

.crm-table__check-cell {
  width: 68px;
  min-width: 68px;
  text-align: center !important;
}

.crm-table__sticky {
  position: sticky;
  left: 0;
  z-index: 2;
  box-shadow: 1px 0 0 var(--table-border);
}

.crm-table thead .crm-table__sticky {
  z-index: 4;
  background: var(--primary-dark);
  color: #fff;
}

.crm-table tbody .crm-table__sticky {
  background: var(--surface);
}

.crm-table tbody tr:nth-child(even) > .crm-table__sticky {
  background: var(--table-row-alt);
}

.crm-table tbody tr:hover > .crm-table__sticky,
.crm-table tbody tr:focus-within > .crm-table__sticky {
  background: var(--table-row-hover);
}

.crm-table tfoot .crm-table__sticky {
  z-index: 3;
  background: var(--surface-muted);
}

.crm-table__cell--entity {
  width: 210px;
  min-width: 190px;
  max-width: 230px;
}

.crm-table__cell--qty {
  width: 76px;
  min-width: 76px;
  white-space: nowrap;
}

.crm-table__cell--amount {
  width: 112px;
  min-width: 104px;
  white-space: nowrap;
}

.crm-table__cell--date {
  width: 132px;
  min-width: 124px;
  white-space: nowrap;
}

.crm-table__cell--detail {
  width: 144px;
  min-width: 144px;
}

.crm-table__cell--note {
  width: 200px;
  min-width: 190px;
}

.purchase-proposal-invoice-cell {
  min-width: 190px;
}

.purchase-proposal-invoice {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.purchase-proposal-invoice__current {
  display: flex;
  align-items: center;
  flex: 1 1 auto;
  gap: 6px;
  min-width: 0;
}

.purchase-proposal-invoice__current .workflow-file {
  flex: 1 1 auto;
  min-width: 0;
}

.purchase-proposal-invoice__current .workflow-file__link {
  max-width: 100%;
}

.purchase-proposal-invoice__current .workflow-file__link span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.purchase-proposal-invoice__remove {
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  min-height: 32px;
}

.purchase-proposal-invoice__proposal-remove {
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  min-height: 36px;
  margin-left: auto;
  border-left-color: var(--table-border);
}

.purchase-proposal-invoice .file-input-control {
  flex: 0 0 auto;
  gap: 0;
}

.purchase-proposal-invoice .file-input-value {
  display: none;
}

.purchase-proposal-invoice .file-input-button {
  min-height: 32px;
  padding: 6px 8px;
  white-space: nowrap;
}

.purchase-proposal-invoice--has-file .file-input-button {
  width: 32px;
  min-width: 32px;
  padding: 0;
}

.purchase-proposal-invoice--has-file .file-input-button span {
  display: none;
}

.table-entity {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.table-entity__meta {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.3;
}

.crm-table-choice__toggle {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
}

.panel-footer-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--table-border);
}

.doc-editor {
  min-height: 210px;
  overflow: auto;
  color: var(--text);
  font-weight: 400;
}

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

.doc-editor td,
.doc-editor th {
  border: 1px solid var(--border);
  padding: 8px;
}

.doc-editor:empty::before {
  content: "Текст письма или КП";
  color: rgba(58, 58, 58, 0.55);
}

.crm-form .jodit-container {
  width: 100% !important;
  max-width: 100%;
  min-width: 0;
  border-color: var(--border);
  border-radius: 8px;
  overflow: hidden;
  font-weight: 400;
}

.crm-form .jodit-toolbar__box {
  max-width: 100%;
  overflow-x: auto;
  background: var(--surface-alt);
}

.crm-form .jodit-toolbar-editor-collection {
  flex-wrap: wrap !important;
  min-width: 0;
}

.crm-form .jodit-wysiwyg {
  min-height: 210px;
  color: var(--text);
  font-family: "Source Sans Pro", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.crm-form .jodit-wysiwyg table {
  width: 100%;
  border-collapse: collapse;
}

.crm-form .jodit-wysiwyg td,
.crm-form .jodit-wysiwyg th {
  min-width: 36px;
  border: 1px solid var(--border);
  padding: 8px;
}

.crm-form .jodit-wysiwyg.document-content {
  color: #111;
  font-family: "CRM Times New Roman", "Times New Roman", Times, serif;
  font-size: 11pt;
  line-height: 1.36;
}

/* Первая строка палитры Jodit — фирменные оттенки CRM. Jodit строит группы в
 * порядке объекта colors, поэтому она находится прямо перед серой шкалой. */
.jodit-color-picker__group-crm {
  margin-bottom: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(74, 122, 154, .22);
}

.jodit-color-picker__group-crm::before {
  content: "Фирменные цвета";
  flex: 0 0 100%;
  margin-bottom: 4px;
  color: var(--primary-dark);
  font-family: "Source Sans Pro", sans-serif;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.25;
}

.jodit-color-picker__group-crm .jodit-color-picker__color-item {
  box-shadow: inset 0 0 0 1px rgba(44, 62, 74, .14);
}

.check-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.document-create-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.check-row label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
}

.crm-alert-stack {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 1200;
  width: min(420px, calc(100vw - 36px));
  display: grid;
  gap: 8px;
  pointer-events: none;
}

.crm-alert {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 32px;
  align-items: start;
  gap: 10px;
  padding: 12px 10px 12px 14px;
  border-left: 4px solid var(--primary);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  box-shadow: var(--shadow);
  pointer-events: auto;
}

.crm-alert.is-error {
  border-left-color: var(--danger);
}

.crm-alert__text {
  align-self: center;
  overflow-wrap: anywhere;
  user-select: text;
}

.crm-alert__close {
  width: 32px;
  min-height: 32px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 22px;
  line-height: 1;
}

.crm-alert__close:hover {
  background: var(--surface-muted);
  color: var(--danger);
}

.confirm-dialog__text {
  margin: 0;
  color: var(--text);
  line-height: 1.5;
  white-space: pre-wrap;
}

.public-link-dialog input[readonly] {
  user-select: all;
}

.user-row--inactive {
  opacity: .62;
  background: var(--surface-alt);
}

.status-user-inactive {
  border-color: rgba(91, 105, 115, .22);
  background: var(--surface-muted);
  color: var(--muted);
}

.file-upload-status {
  margin-left: auto;
  color: var(--primary);
  font-size: 13px;
}

.file-input-control {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.file-drop-target {
  transition: box-shadow .16s ease, outline-color .16s ease;
}

.file-drop-target.is-dragover {
  outline: 2px dashed var(--primary);
  outline-offset: 3px;
  border-radius: 10px;
  box-shadow: 0 0 0 5px rgba(74, 122, 154, .12);
}

.file-input-native {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  min-height: 0 !important;
  padding: 0 !important;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0 !important;
}

.file-input-value {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 13px;
  font-weight: 400;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-input-control.has-file .file-input-value {
  color: var(--text);
}

.file-input-control--multiple.has-file .file-input-value {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  padding: 7px 10px;
  border-radius: 8px;
  background: var(--surface-muted);
  color: var(--secondary);
  font-weight: 600;
}

.file-input-list {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: repeat(auto-fit, minmax(min(250px, 100%), 1fr));
  gap: 8px;
  min-width: 0;
  padding-top: 2px;
}

.file-input-list[hidden] {
  display: none;
}

.file-input-item {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) 34px;
  align-items: center;
  gap: 9px;
  min-width: 0;
  min-height: 54px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
}

.file-input-item__icon {
  display: inline-grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 9px;
  background: var(--surface-muted);
  color: var(--primary);
  font-size: 16px;
}

.file-input-item__meta {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.file-input-item__name {
  min-width: 0;
  overflow: hidden;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-input-item__size {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.2;
  white-space: nowrap;
}

.file-input-item__remove {
  width: 34px;
  height: 34px;
  min-height: 34px;
  color: var(--danger);
}

.crm-main select,
dialog select {
  width: 100%;
  min-width: 0;
  min-height: 42px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 11px;
  background: #fff;
  color: var(--text);
  outline: none;
}

.crm-main select:focus,
dialog select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(74, 122, 154, .12);
}

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 200;
  width: min(560px, 100%);
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-left: 1px solid var(--border);
  box-shadow: -16px 0 36px rgba(44, 62, 74, 0.16);
  transform: translateX(104%);
  transition: transform .24s ease;
}

.drawer.is-open {
  transform: translateX(0);
}

.drawer-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 18px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-alt);
}

.drawer-body {
  display: grid;
  gap: 14px;
  padding: 18px;
  overflow: auto;
}

.comment-list {
  display: grid;
  gap: 10px;
}

.comment {
  padding: 12px;
  border-left: 4px solid var(--primary);
  border-radius: 8px;
  background: var(--surface-muted);
}

.comment strong {
  display: block;
  color: var(--secondary);
}

.comment p {
  margin: 6px 0;
}

.drawer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.bar-list {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.bar-row {
  display: grid;
  gap: 6px;
}

.bar-row span {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
}

.bar-row em {
  font-style: normal;
}

.bar {
  height: 10px;
  border-radius: 9999px;
  background: var(--surface-muted);
  overflow: hidden;
}

.bar i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--primary), var(--primary-dark));
}

.integration-panel {
  display: grid;
  gap: 14px;
  border-left: 4px solid var(--primary);
}

.tools-panel {
  min-height: 0;
}

.external-tools-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  width: 100%;
  gap: 18px;
  margin: 22px 0 0;
}

.external-tool-card {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  min-height: 142px;
  height: 100%;
  padding: 22px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: linear-gradient(135deg, #fff 0%, var(--surface-alt) 100%);
  color: var(--secondary);
  text-decoration: none;
  box-shadow: var(--shadow);
  transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;
}

.external-tool-card::after {
  content: "";
  position: absolute;
  top: -48px;
  right: -42px;
  width: 130px;
  height: 130px;
  border-radius: 50%;
  background: rgba(74, 122, 154, .08);
  pointer-events: none;
}

.external-tool-card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-hover);
  transform: translateY(-2px);
}

.external-tool-card__icon {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  border-radius: 15px;
  background: linear-gradient(145deg, var(--primary), var(--primary-dark));
  color: #fff;
  font-size: 24px;
  box-shadow: 0 10px 24px rgba(50, 91, 118, .2);
}

.external-tool-card__body {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.external-tool-card__body strong {
  font-family: "Roboto Condensed", sans-serif;
  font-size: 23px;
  font-weight: 500;
  line-height: 1.2;
}

.external-tool-card__body small {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.external-tool-card__open {
  position: relative;
  z-index: 1;
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 50%;
  background: var(--surface-muted);
  color: var(--primary);
}

@media (max-width: 1180px) {
  .external-tools-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 640px) {
  .external-tool-card {
    gap: 12px;
    padding: 16px;
  }

  .external-tool-card__icon {
    width: 50px;
    height: 50px;
    border-radius: 13px;
    font-size: 21px;
  }

  .external-tool-card__body {
    gap: 6px;
  }

  .external-tool-card__body strong {
    font-size: 20px;
  }

  .external-tool-card__open {
    width: 34px;
    height: 34px;
  }
}

.engineering-tool-head {
  align-items: flex-start;
}

.engineering-calculator-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 360px);
  align-items: start;
  gap: 18px;
}

.engineering-calculator-layout--wide {
  grid-template-columns: minmax(0, 1fr) minmax(300px, 380px);
}

.engineering-calculator-layout:has(.engineering-result[hidden]) {
  grid-template-columns: minmax(0, 1fr);
}

.engineering-calculator-form {
  grid-template-columns: minmax(0, 1fr);
  align-items: stretch;
  gap: 16px;
  margin: 0;
}

.engineering-mode-control {
  align-self: stretch;
}

.engineering-mode-switch {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 180px));
  gap: 8px;
}

.engineering-mode-switch .outline-btn {
  width: 100%;
  min-height: 42px;
}

.engineering-mode-switch .outline-btn[aria-pressed="true"] {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
}

.engineering-form-grid {
  width: 100%;
}

.engineering-calculator-actions {
  justify-content: flex-start;
}

.engineering-calculator-error {
  border: 1px solid rgba(187, 67, 67, .24);
  background: rgba(187, 67, 67, .08);
  color: var(--danger);
}

.engineering-result {
  position: sticky;
  top: 18px;
}

.engineering-result .panel-head {
  margin-bottom: 12px;
}

.engineering-result__metric {
  margin-bottom: 12px;
  box-shadow: none;
}

.engineering-result dl {
  margin-bottom: 0;
}

.engineering-tool-notes {
  display: grid;
  gap: 8px;
  margin-top: 16px;
}

.engineering-tool-notes .filter-bar__note {
  margin: 0;
}

@media (max-width: 960px) {
  .engineering-calculator-layout,
  .engineering-calculator-layout--wide {
    grid-template-columns: minmax(0, 1fr);
  }

  .engineering-result {
    position: static;
  }
}

@media (max-width: 640px) {
  .engineering-calculator-actions .primary-btn {
    width: 100%;
  }

  .engineering-mode-switch {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.integration-icon {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: var(--surface-muted);
  color: var(--primary);
  font-size: 24px;
}

.integration-panel p {
  margin: 0;
  color: var(--muted);
}

.integration-panel dl {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  gap: 8px 12px;
  margin: 0;
}

.integration-panel dt {
  color: var(--muted);
  font-weight: 600;
}

.integration-panel dd {
  margin: 0;
}

.integration-endpoint {
  overflow-wrap: anywhere;
}

.integration-actions {
  justify-content: flex-start;
  flex-wrap: wrap;
  margin-top: 2px;
}

.integration-settings {
  gap: 14px;
}

.integration-settings .panel-head {
  margin-bottom: 0;
}

.form-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.form-note {
  margin: -2px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.signer-settings {
  grid-column: 1 / -1;
}

.template-settings {
  grid-column: 1 / -1;
}

.template-settings__list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr));
  gap: 12px;
}

.template-settings__item {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-alt);
}

.template-settings__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.template-settings__head > div:first-child {
  display: grid;
  gap: 3px;
}

.template-settings__head strong {
  color: var(--secondary);
  font-size: 17px;
}

.template-settings__head span {
  color: var(--muted);
  font-size: 13px;
}

.template-settings__values {
  margin: 12px 0 0;
  padding-left: 23px;
}

.template-settings__values li + li {
  margin-top: 5px;
}

.project-folder-builder {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-alt);
}

.project-folder-builder > label,
.project-folder-builder__add label {
  margin: 0;
}

.choice-card-grid,
.project-folder-builder__list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}

.choice-card,
.project-folder-choice {
  min-width: 0;
  display: flex !important;
  align-items: center;
  gap: 8px !important;
  margin: 0 !important;
  padding: 8px 9px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  font-size: 13px !important;
  line-height: 1.25 !important;
}

.choice-card {
  min-height: 52px;
  cursor: pointer;
  transition: border-color .16s ease, background-color .16s ease, box-shadow .16s ease;
}

.choice-card:hover {
  border-color: rgba(74, 122, 154, .42);
  background: var(--surface-alt);
}

.choice-card:has(input:checked) {
  border-color: rgba(74, 122, 154, .4);
  background: var(--surface-muted);
  box-shadow: inset 3px 0 0 var(--primary);
}

.choice-card:has(input:focus-visible) {
  outline: 3px solid rgba(74, 122, 154, .22);
  outline-offset: 2px;
}

.choice-card:has(input:disabled) {
  cursor: default;
}

.choice-card input,
.project-folder-choice input {
  flex: 0 0 auto;
  width: 17px;
  min-height: 17px;
  margin: 0;
}

.choice-card span,
.project-folder-choice span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.choice-card .table-entity {
  gap: 2px;
}

.choice-card .table-entity strong {
  color: var(--secondary);
  font-size: 14px;
  line-height: 1.25;
}

.choice-card .table-entity__meta {
  font-size: 12px;
  font-weight: 400;
}

.project-folder-builder__add {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 8px;
}

.signer-list {
  display: grid;
  gap: 10px;
}

.signer-item {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-alt);
}

.signer-item__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.signer-item__head > div:first-child,
.signer-item__contacts {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.signer-item__head strong {
  color: var(--secondary);
  font-size: 17px;
}

.signer-item__head span,
.signer-item__contacts span {
  overflow-wrap: anywhere;
}

.signer-item__badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.signer-item--inactive {
  opacity: .66;
}

.file-toolbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-alt);
}

.file-project-control {
  width: min(460px, 100%);
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.file-project-control select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 34px 8px 11px;
  background: #fff;
  color: var(--text);
  outline: none;
}

.file-project-control select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(74, 122, 154, 0.12);
}

.file-toolbar-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.file-readonly-hint {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  margin-left: auto;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-muted);
  color: var(--primary-dark);
  font-size: 13px;
  font-weight: 600;
}

.file-readonly-hint i {
  color: var(--primary);
}

.file-breadcrumb {
  min-height: 47px;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 18px;
  overflow-x: auto;
  background: #fff;
  white-space: nowrap;
}

.file-breadcrumb:empty {
  display: none;
}

.file-breadcrumb button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 30px;
  border: 0;
  padding: 3px 5px;
  background: transparent;
  color: var(--primary-dark);
  font-weight: 600;
}

.file-breadcrumb button:hover {
  color: var(--primary);
  text-decoration: underline;
}

.file-breadcrumb > i {
  color: rgba(44, 62, 74, 0.45);
  font-size: 10px;
}

.file-pagination {
  justify-content: flex-end;
}

.file-pagination .list-pagination__summary {
  order: 2;
  margin-left: auto;
}

.file-pagination .list-pagination__controls {
  order: 1;
}

.file-pagination .icon-btn:disabled {
  opacity: .38;
}

.file-table {
  min-width: 760px;
}

.file-table th:nth-child(2),
.file-table td:nth-child(2) {
  width: 120px;
  white-space: nowrap;
}

.file-table th:nth-child(3),
.file-table td:nth-child(3) {
  width: 185px;
  white-space: nowrap;
}

.file-table th:last-child,
.file-table td:last-child {
  width: 190px;
}

.file-workspace.is-readonly .file-table th:last-child,
.file-workspace.is-readonly .file-table td:last-child {
  width: 88px;
  white-space: nowrap;
}

.file-name-button {
  max-width: 100%;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--secondary);
  text-align: left;
  text-decoration: none;
}

.file-name-button strong {
  overflow-wrap: anywhere;
}

.file-name-button:hover strong {
  color: var(--primary);
  text-decoration: underline;
}

.file-kind {
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  display: grid;
  place-items: center;
  color: var(--primary);
  font-size: 18px;
}

.file-kind.is-folder {
  color: var(--warning);
}

.file-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.file-actions .icon-btn {
  width: 34px;
  min-height: 34px;
  flex-basis: 34px;
}

.file-loading {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--muted);
}

.file-history-panel,
.file-share-panel {
  margin-top: 16px;
}

.file-event-list {
  display: grid;
}

.file-event {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 56px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(74, 122, 154, 0.14);
}

.file-event:last-child {
  border-bottom: 0;
}

.file-event__icon {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  color: var(--primary);
}

.file-event__body,
.file-event__meta {
  min-width: 0;
  display: grid;
  line-height: 1.35;
}

.file-event__body span,
.file-event__meta {
  color: var(--muted);
  font-size: 13px;
}

.file-event__body span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-event__meta {
  justify-items: end;
  white-space: nowrap;
}

.file-share-list {
  display: grid;
}

.file-share {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto 40px;
  align-items: center;
  gap: 10px;
  min-height: 58px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(74, 122, 154, 0.14);
}

.file-share:last-child {
  border-bottom: 0;
}

.file-share__icon {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  color: var(--primary);
}

.file-share__body,
.file-share__meta {
  min-width: 0;
  display: grid;
  line-height: 1.35;
}

.file-share__body a {
  overflow: hidden;
  color: var(--primary);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-share__meta {
  justify-items: end;
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.file-dialog {
  width: min(430px, calc(100% - 32px));
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 24px 70px rgba(12, 19, 25, 0.25);
}

.entity-dialog {
  width: min(700px, calc(100% - 32px));
  max-height: calc(100vh - 32px);
  overflow: auto;
}

.entity-dialog--wide {
  width: min(1040px, calc(100% - 32px));
}

.push-settings-dialog {
  width: min(620px, calc(100% - 32px));
}

.push-status {
  padding: 12px 14px;
  border: 1px solid rgba(74, 122, 154, 0.22);
  border-radius: 10px;
  background: var(--surface-muted);
  color: var(--muted);
  line-height: 1.45;
}

.push-status.is-active {
  border-color: rgba(52, 142, 89, 0.35);
  background: rgba(52, 142, 89, 0.08);
  color: #22633f;
}

.push-status.is-error {
  border-color: rgba(192, 68, 68, 0.35);
  background: rgba(192, 68, 68, 0.08);
  color: #8e3030;
}

.push-enable-button {
  justify-content: center;
  width: 100%;
}

.push-preferences {
  display: grid;
  gap: 8px;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.push-preferences legend {
  margin-bottom: 8px;
  color: var(--text);
  font-weight: 800;
}

.push-preference {
  display: grid !important;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: 10px;
  padding: 11px 12px;
  border: 1px solid rgba(74, 122, 154, 0.18);
  border-radius: 10px;
  background: var(--surface);
  cursor: pointer;
}

.push-preference input {
  width: auto;
  min-height: 0;
  margin-top: 3px;
}

.push-preference span {
  display: grid;
  gap: 2px;
}

.push-preference strong {
  color: var(--text);
}

.push-preference small {
  color: var(--muted);
  line-height: 1.35;
}

.push-preference input:disabled,
.push-preference input:disabled + span {
  opacity: 0.52;
  cursor: not-allowed;
}

.push-settings-actions [data-push-disable] {
  margin-right: auto;
}

.entity-dialog > .crm-form,
.entity-dialog > .docs-grid {
  margin: 0;
}

.entity-dialog > .crm-form {
  padding: 0;
  border: 0;
  box-shadow: none;
}

.entity-dialog .docs-grid {
  align-items: start;
}

.entity-dialog .docs-grid > .crm-form {
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
}

.entity-dialog__close {
  flex: 0 0 auto;
  margin-left: auto;
}

.file-dialog .panel-head > .icon-btn[aria-label="Закрыть"] {
  grid-column: 2;
  grid-row: 1;
  justify-self: end;
  margin: 0;
}

.file-dialog .panel-head:focus {
  outline: none;
}

.dialog-close-glyph {
  display: block;
  font-size: 22px;
  font-weight: 400;
  line-height: 1;
  transform: translateY(-1px);
}

.route-placeholder {
  display: grid;
  justify-items: start;
  gap: 12px;
}

.route-placeholder h2,
.route-placeholder p {
  margin: 0;
}

.entity-page {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.entity-page__header {
  display: flex;
  align-items: flex-start;
  gap: 20px;
}

.entity-page__header > * {
  min-width: 0;
}

.entity-page__header h2 {
  margin: 2px 0 8px;
  color: var(--secondary);
  font-size: 28px;
  overflow-wrap: anywhere;
}

.entity-page__badges {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 5px;
}

.entity-page__badges .crm-eyebrow {
  margin: 0;
}

.entity-state-line {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 8px 0 0;
  color: var(--primary);
  font-weight: 700;
}

.entity-page__header .meta-line > span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.entity-page__actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
  /* Шапка выравнивает содержимое от начала (слева кнопка возврата),
     поэтому действия прижимаются к правому краю сами. */
  margin-left: auto;
}

.document-page {
  gap: 14px;
}

/* Шапка документа: слева реквизиты, справа кнопки по своей ширине. Широкая правая
   колонка была нужна под карточку PDF — она теперь отдельной панелью ниже. */
.document-hero.panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 24px;
  padding: 22px;
  border-left: 4px solid var(--primary);
}

.document-hero__main {
  min-width: 0;
}

.document-hero__badges {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}

.document-kind {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 9px;
  border-radius: 999px;
  background: var(--surface-muted);
  color: var(--primary-dark);
  font-size: 13px;
  font-weight: 700;
}

.document-hero.entity-page__header h2 {
  margin: 0;
  font-size: clamp(28px, 2.1vw, 36px);
  line-height: 1.1;
}

.document-hero__title {
  max-width: 820px;
  margin: 8px 0 0;
  color: var(--secondary);
  font-size: 18px;
  font-weight: 600;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.document-hero__meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 18px;
  margin-top: 13px;
  color: var(--muted);
  font-size: 13px;
}

.document-hero__meta span {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  gap: 7px;
  overflow-wrap: anywhere;
}

.document-hero__meta i {
  color: var(--primary);
}

.document-hero__actions {
  max-width: 650px;
}

.document-pdf-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  margin: 13px 0 0;
  padding: 7px 10px;
  border: 1px solid rgba(74, 122, 154, .16);
  border-radius: 8px;
  background: rgba(237, 245, 249, .7);
  color: var(--primary-dark);
  font-size: 13px;
}

.document-pdf-status i {
  color: var(--primary);
}

.document-revision-list {
  display: grid;
  gap: 8px;
}

.document-revision-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-alt);
}

.document-revision-item > div {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.document-revision-item span {
  color: var(--muted);
  font-size: 12px;
}

.entity-tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 5px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  scrollbar-width: thin;
}

.entity-tabs a {
  flex: 0 0 auto;
  padding: 9px 14px;
  border-radius: 8px;
  color: var(--muted);
  font-weight: 700;
  text-decoration: none;
}

.entity-tabs a:hover,
.entity-tabs a.is-active {
  background: var(--surface-muted);
  color: var(--primary);
}

.entity-overview-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(360px, .9fr);
  gap: 16px;
  align-items: stretch;
}

.entity-summary-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.entity-overview-grid > .panel {
  height: 100%;
}

.entity-control {
  display: flex;
  min-width: 0;
  flex-direction: column;
}

.entity-control__value {
  color: var(--secondary);
  font-family: "Roboto Condensed", sans-serif;
  font-size: 28px;
  font-weight: 400;
  line-height: 1;
}

.entity-control__caption {
  margin: 12px 0 0;
  color: var(--muted);
}

.entity-control__storage {
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid rgba(74, 122, 154, .16);
}

.entity-control__storage-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.entity-control__storage-head h3 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  color: var(--secondary);
  font-size: 18px;
}

.entity-control__storage-head h3 i {
  color: var(--primary);
}

.entity-control__meta {
  display: grid;
  gap: 7px;
  margin-top: 14px;
  color: var(--muted);
  font-size: 13px;
}

.entity-control__meta p {
  margin: 0;
  overflow-wrap: anywhere;
}

.entity-control__meta strong {
  color: var(--text);
}

.entity-control__link {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  margin-top: 16px;
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--primary);
  font-weight: 700;
  text-decoration: none;
}

.entity-control__link span {
  flex: 1;
}

.entity-control__link:hover {
  border-color: var(--primary);
  background: var(--surface-muted);
}

.document-details-card.panel {
  padding: 20px;
}

.document-section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.document-section-heading .crm-eyebrow,
.document-side-card__head .crm-eyebrow,
.document-content-card__head .crm-eyebrow {
  margin: 0 0 3px;
}

.document-section-heading h2 {
  margin: 0;
}

.document-details-card dl {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 0;
}

.entity-details dl .document-fact {
  min-height: 82px;
  padding: 13px 14px;
  border: 1px solid rgba(74, 122, 154, .13);
  background: var(--surface-alt);
}

.document-fact dt {
  display: flex;
  align-items: center;
  gap: 7px;
}

.document-fact dt i {
  width: 14px;
  color: var(--primary);
  text-align: center;
}

.document-fact dd {
  color: var(--text);
  font-weight: 600;
  line-height: 1.35;
}

.document-file-card,
.document-note-card.panel {
  align-content: start;
  min-width: 0;
  padding: 18px;
}

.document-side-card__head {
  display: flex;
  align-items: center;
  gap: 12px;
}

.document-side-card__head h2 {
  margin: 0;
  font-size: 20px;
}

.document-side-card__icon {
  display: grid;
  flex: 0 0 42px;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 10px;
  background: var(--surface-muted);
  color: var(--primary);
  font-size: 18px;
}

.document-file-card .workflow-file-list {
  display: grid;
  gap: 10px;
}

.document-files-panel .workflow-file-list {
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}

.document-files-panel .workflow-file {
  min-width: 0;
}

.document-files-panel .workflow-file__link {
  height: 100%;
}

.document-file-card .workflow-file {
  display: flex;
  flex-wrap: wrap;
  min-width: 0;
}

.document-file-card .workflow-file__link,
.document-file-preview {
  display: flex;
  align-items: center;
  min-width: 0;
  width: 100%;
  gap: 9px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-alt);
  color: var(--primary);
  font-weight: 700;
  line-height: 1.3;
  text-decoration: none;
}

.document-file-card .workflow-file__link:hover,
.document-file-preview:hover {
  border-color: var(--primary);
  background: var(--surface-muted);
}

.document-file-card .workflow-file__link span,
.document-file-preview span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.document-note-card p {
  margin: 14px 0 0;
  color: var(--text);
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.document-content-card.panel {
  overflow: hidden;
  padding: 0;
  background: var(--surface-muted);
}

.document-content-card__head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  border-bottom: 1px solid rgba(74, 122, 154, .16);
  background: var(--surface);
}

.document-content-card__actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  min-width: 0;
}

.document-content-card__actions > span {
  color: var(--muted);
  font-size: 13px;
  text-align: right;
}

.document-copy-content {
  flex: 0 0 auto;
}

.document-sheet {
  width: min(calc(100% - 48px), var(--document-sheet-width));
  min-width: 0;
  margin: 24px auto 32px;
  padding: var(--document-sheet-padding-top) var(--document-sheet-padding-x) var(--document-sheet-padding-bottom);
  border: 1px solid rgba(44, 62, 74, .18);
  background: #fff;
  box-shadow: 0 12px 28px rgba(44, 62, 74, .09);
}

.document-sheet--landscape {
  width: min(calc(100% - 48px), var(--document-sheet-width-landscape));
}

.entity-details h2,
.entity-details h3,
.entity-description-card h2 {
  margin-top: 0;
}

.entity-details dl {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 0 0 20px;
}

.entity-details dl div {
  padding: 12px;
  border-radius: 8px;
  background: var(--surface-alt);
}

.entity-details dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.entity-details dd {
  margin: 5px 0 0;
  overflow-wrap: anywhere;
}

.entity-details__description {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid rgba(74, 122, 154, .16);
}

.entity-details__description h3 {
  margin-bottom: 8px;
}

.entity-details__description p {
  margin: 0;
}

.entity-description,
.entity-description-card p,
.document-preview {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.progress-track {
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-muted);
}

.progress-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--success);
  transition: width .25s ease;
}

.entity-sync-error {
  color: var(--danger);
}

.project-phase-list {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.project-phase-progress-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.project-phase-progress {
  margin-bottom: 0;
}

.project-phase-progress-value {
  min-width: 3ch;
  color: var(--secondary);
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  text-align: right;
}

.project-phase-count {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 13px;
}

.project-phase-editor {
  display: grid;
  gap: 10px;
}

.project-phase-row {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(145px, .42fr) minmax(150px, .45fr) auto;
  align-items: end;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-alt);
}

.project-phase-row.is-upcoming {
  border-color: rgba(201, 124, 42, .48);
  background: rgba(255, 244, 214, .72);
  box-shadow: inset 4px 0 0 #d4971e;
}

.project-phase-row.is-overdue {
  border-color: rgba(185, 75, 75, .5);
  background: rgba(253, 231, 231, .76);
  box-shadow: inset 4px 0 0 var(--danger);
}

.project-phase-row.is-completed {
  border-color: rgba(58, 123, 98, .42);
  background: rgba(230, 245, 238, .78);
  box-shadow: inset 4px 0 0 var(--success);
}

.project-phase-row label {
  min-width: 0;
  display: grid;
  gap: 5px;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.25;
}

.project-phase-row input,
.project-phase-row select {
  width: 100%;
  min-width: 0;
  min-height: 40px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  background: #fff;
  color: var(--text);
  outline: none;
}

.project-phase-row input:focus,
.project-phase-row select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(74, 122, 154, .12);
}

.project-phase-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.project-phase-actions .icon-btn {
  width: 38px;
  min-height: 40px;
  flex-basis: 38px;
}

.project-phase-completed {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0;
  color: var(--success);
  font-size: 13px;
}

.project-phase-urgency {
  grid-column: 1 / -1;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: fit-content;
  color: #8a5a00;
  font-size: 13px;
  font-weight: 700;
}

.project-phase-row.is-overdue .project-phase-urgency {
  color: var(--danger);
}

.project-phase-empty {
  min-height: 150px;
}

.project-card-progress {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.project-overdue-marker {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  width: fit-content;
  color: var(--danger);
  font-weight: 700;
  text-decoration: none;
}

.project-progress-deadlines {
  display: grid;
  gap: 7px;
  margin-top: 12px;
}

.project-progress-deadline {
  display: flex;
  align-items: center;
  gap: 7px;
  width: fit-content;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
}

.project-progress-deadline.is-upcoming {
  color: #8a5a00;
}

.project-progress-deadline.is-overdue {
  color: var(--danger);
}

.project-progress-deadline.is-clear {
  color: var(--success);
}

.project-card-progress .progress-track {
  flex: 0 1 240px;
  min-width: 120px;
  height: 8px;
}

.file-workspace.is-project-fixed .file-project-control {
  display: none;
}

.file-workspace.is-project-fixed .file-toolbar:not(:has(.file-upload-status:not([hidden]))) {
  display: none;
}

.entity-card__link,
.entity-row-link,
.entity-row-button {
  color: var(--secondary);
  font-weight: 700;
  text-decoration: none;
}

.entity-card__link:hover,
.entity-row-link:hover {
  color: var(--primary);
}

.entity-card--clickable {
  cursor: pointer;
}

.entity-row-button {
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.entity-detail-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(390px, .72fr);
  grid-template-areas:
    "summary sidebar"
    "feed sidebar";
  gap: 16px;
  align-items: start;
  min-width: 0;
}

.entity-detail-layout--single {
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas:
    "summary"
    "feed";
}

.entity-detail-summary {
  grid-area: summary;
  display: grid;
  gap: 16px;
  min-width: 0;
}

.entity-detail-sidebar {
  grid-area: sidebar;
  position: sticky;
  top: 16px;
  min-width: 0;
}

.entity-feed-card {
  grid-area: feed;
  min-width: 0;
}

.entity-description-card > .panel-head + p {
  margin: 0;
}

.entity-facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
  margin: 16px 0 0;
}

.entity-facts > div {
  min-width: 0;
  padding: 11px 12px;
  border: 1px solid rgba(74, 122, 154, .12);
  border-radius: 9px;
  background: var(--surface-alt);
}

.entity-facts dt {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.25;
  text-transform: uppercase;
  letter-spacing: .025em;
}

.entity-facts dd {
  margin: 5px 0 0;
  color: var(--secondary);
  font-weight: 600;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.task-state-line {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 10px 0 0;
  color: var(--primary-dark);
  font-size: 14px;
  font-weight: 700;
}

.task-state-line i {
  color: var(--primary);
}

.entity-feed {
  position: relative;
  display: grid;
  gap: 12px;
}

.entity-feed-composer {
  margin-top: 16px;
}

.message-composer {
  gap: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 8px 20px rgba(44, 62, 74, .045);
}

.message-composer__head {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(90deg, var(--surface-alt), #fff 68%);
}

.message-composer__icon {
  display: inline-flex;
  flex: 0 0 38px;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--surface-muted);
  color: var(--primary);
}

.message-composer__head > div {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.message-composer__head strong {
  color: var(--secondary);
  font-size: 16px;
  line-height: 1.25;
}

.message-composer__head span:not(.message-composer__icon) {
  color: var(--muted);
  font-size: 13px;
  font-weight: 400;
  line-height: 1.35;
}

.message-composer__body {
  padding: 14px 16px 10px;
}

.message-composer__body textarea {
  min-height: 104px;
  resize: vertical;
  background: var(--surface-alt);
}

.message-composer__task-ref {
  padding: 0 16px 10px;
  max-width: 320px;
}

.message-composer__toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 16px;
  min-width: 0;
  padding: 0 16px 14px;
}

.message-composer__files {
  min-width: 0;
}

.message-composer__toggles {
  display: flex;
  min-width: 0;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.message-composer__files .file-input-control {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  width: 100%;
}

.message-composer__files .file-input-value {
  overflow: visible;
  white-space: normal;
  text-overflow: clip;
}

.message-composer__files .file-input-list {
  width: 100%;
}

.message-composer__actions,
.comment-composer__actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.message-composer__actions {
  align-self: start;
}

.message-composer__actions .primary-btn,
.comment-composer__actions .primary-btn {
  min-width: 148px;
}

.message-composer__actions .primary-btn.is-stop {
  border-color: var(--danger);
  background: var(--danger);
  color: #fff;
}

.message-composer__actions .primary-btn.is-stop:hover {
  border-color: #8f3434;
  background: #8f3434;
}

.feed-item {
  position: relative;
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  gap: 12px;
  min-width: 0;
}

.feed-item:not(:last-child)::after {
  content: "";
  position: absolute;
  z-index: 0;
  top: 40px;
  bottom: -12px;
  left: 19px;
  width: 2px;
  background: rgba(74, 122, 154, .18);
}

.feed-item__icon {
  position: relative;
  z-index: 1;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  color: var(--primary);
}

.feed-item__body {
  min-width: 0;
  padding: 12px 14px;
  border: 1px solid rgba(74, 122, 154, .18);
  border-radius: 10px;
  background: var(--surface-alt);
}

.feed-item--status .feed-item__body {
  border-color: rgba(74, 122, 154, .32);
  background: var(--surface-muted);
}

.feed-item--status .feed-item__icon {
  background: var(--primary);
  color: #fff;
}

.feed-item--own .feed-item__body {
  border-color: rgba(74, 122, 154, .4);
  background: #eaf4fa;
  box-shadow: inset 3px 0 0 var(--primary);
}

.feed-item--own .feed-item__icon {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
}

.feed-item--details .feed-item__icon {
  background: #fff8e7;
  color: #8a5a00;
}

.feed-item--file .feed-item__icon {
  background: #edf8f3;
  color: var(--success);
}

.feed-item--legacy .feed-item__icon {
  background: #f3f6f8;
  color: var(--muted);
}

.feed-item__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 5px 12px;
  margin-bottom: 6px;
}

.feed-item__type {
  color: var(--primary);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.25;
  text-transform: uppercase;
  letter-spacing: .035em;
}

.feed-item__head time {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.3;
  white-space: nowrap;
}

.feed-item__head--message {
  gap: 2px 6px;
}

.feed-item__head--message > time {
  margin-left: auto;
}

.feed-item__title {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
  color: var(--secondary);
  font-size: 15px;
  line-height: 1.35;
}

.feed-item__transition i {
  color: var(--primary);
  font-size: 11px;
}

.feed-item__actor {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.feed-item__actor i {
  color: rgba(74, 122, 154, .72);
  font-size: 11px;
}

.feed-item__text,
.feed-item__note p {
  margin: 7px 0 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* Пользовательские сообщения в личных, групповых и общем чатах поддерживают
   безопасный Markdown тем же компонентом, что ответы ИИ. Обычные переводы строк
   формирует парсер, поэтому наследуемый pre-wrap здесь отключён. */
.feed-item__text.chat-message-markdown {
  white-space: normal;
}

.message-link {
  color: var(--primary);
  font-weight: inherit;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

.message-link:hover,
.message-link:focus-visible {
  color: var(--primary-dark);
}

.feed-item__note {
  margin-top: 9px;
  padding: 9px 10px;
  border-left: 3px solid var(--primary);
  border-radius: 0 7px 7px 0;
  background: #fff;
}

.feed-item__note > strong {
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .025em;
}

.feed-item__note > strong + p {
  margin-top: 3px;
}

/* Сноска под ответом ИИ: что попало в контекст и сколько стоило по токенам. */
.feed-item__meta {
  margin: 10px 0 0;
  padding-top: 8px;
  border-top: 1px solid rgba(74, 122, 154, .16);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.ai-message-footer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 5px 12px;
  margin-top: 9px;
  padding-top: 7px;
  border-top: 1px solid rgba(74, 122, 154, .16);
}

.ai-message-footer .feed-item__meta {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.ai-message-actions {
  grid-column: 2;
  display: flex;
  align-items: center;
  flex: 0 0 auto;
  gap: 3px;
  margin-left: 0;
}

/* В обычном чате действия живут в шапке карточки: короткие сообщения не
   получают отдельный пустой «подвал». Подписи остаются доступными скринридеру
   и через title, а визуально показываются только компактные иконки. */
.chat-message-actions {
  grid-column: auto;
  gap: 1px;
}

.feed-item__head-main {
  display: inline-flex;
  align-items: center;
  flex: 0 1 auto;
  gap: 4px;
  min-width: 0;
  white-space: nowrap;
}

.chat-message-actions .ai-message-action {
  justify-content: center;
  width: 23px;
  min-height: 23px;
  padding: 2px;
}

.message-forward-dialog {
  width: min(760px, calc(100% - 32px));
}

.message-forward-preview {
  display: grid;
  gap: 7px;
  max-height: 220px;
  padding: 12px 14px;
  overflow: auto;
  border: 1px solid rgba(74, 122, 154, .2);
  border-radius: 10px;
  background: var(--surface-alt);
}

.message-forward-preview > strong {
  color: var(--secondary);
  font-size: 13px;
}

.message-forward-preview .ai-answer {
  font-size: 13px;
}

.message-forward-destinations,
.message-forward-section {
  display: grid;
  gap: 9px;
}

.message-forward-section + .message-forward-section {
  padding-top: 4px;
  border-top: 1px solid rgba(74, 122, 154, .14);
}

.message-forward-section h3 {
  margin: 0;
  color: var(--secondary);
  font-size: 14px;
}

.message-forward-choice__icon {
  display: grid;
  flex: 0 0 30px;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 8px;
  background: var(--surface-muted);
  color: var(--primary);
}

.ai-message-action {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 24px;
  padding: 3px 5px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--primary);
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2;
}

.ai-message-action:hover,
.ai-message-action:focus-visible {
  background: rgba(74, 122, 154, .1);
  color: var(--primary-dark);
}

.ai-message-action:disabled {
  cursor: default;
  opacity: .62;
}

@media (max-width: 760px) {
  .ai-message-footer {
    gap: 5px 7px;
  }

  .ai-message-actions {
    gap: 2px;
  }

  .chat-message-actions {
    gap: 0;
  }

  .chat-message-actions .ai-message-action {
    width: 21px;
    min-height: 21px;
    padding: 1px;
  }

  /* Синяя карточка и имя автора уже однозначно отмечают свою реплику. На
     телефоне убираем дублирующее «· Вы». Три действия держим одной группой,
     а дату со временем ставим отдельной строкой слева: так ни один значок или
     фрагмент даты не переносится сам по себе даже на 320 px. */
  .feed-item__head--message .feed-item__own-marker {
    display: none;
  }

  .feed-item__head--message {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-items: center;
  }

  .feed-item__head--message .feed-item__head-main {
    justify-content: space-between;
    width: 100%;
  }

  .feed-item__head--message > time {
    justify-self: start;
    margin-left: 0;
  }

  .ai-message-action {
    width: 26px;
    min-height: 24px;
    padding: 3px;
  }

  .ai-message-action span {
    display: none;
  }

  .message-forward-preview {
    max-height: 160px;
  }
}

.feed-item__attachments {
  display: flex;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 8px 12px;
  margin-top: 9px;
}

.feed-item__attachments .workflow-file__link {
  font-size: 12px;
}

/* На телефоне колонка значков съедала ширину самого текста. Правило общее для всех
   лент: и чаты, и ИИ, и обсуждения задач — это один компонент .feed-item, своего
   размера значка чатам заводить нельзя. Блок стоит после базовых правил ленты:
   выше по файлу он бы им проиграл при равной специфичности. */
@media (max-width: 760px) {
  .feed-item {
    grid-template-columns: 26px minmax(0, 1fr);
    gap: 8px;
  }

  .feed-item__icon {
    width: 26px;
    height: 26px;
    border-radius: 8px;
    font-size: 12px;
  }

  /* Линия связи между репликами идёт под центром значка. */
  .feed-item:not(:last-child)::after {
    top: 26px;
    left: 12px;
  }

  .feed-item__body {
    padding: 9px 11px;
  }
}

.file-dialog::backdrop {
  background: rgba(12, 19, 25, 0.48);
}

.file-dialog-actions {
  justify-content: flex-end;
  gap: 8px;
  margin-top: 8px;
  padding-top: 14px;
  border-top: 1px solid rgba(74, 122, 154, 0.16);
}

.entity-dialog .file-dialog-actions {
  position: sticky;
  bottom: -20px;
  z-index: 4;
  margin: 8px -20px -20px;
  padding: 14px 20px 20px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 -8px 22px rgba(44, 62, 74, 0.06);
}

.workflow-file {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
  min-width: 0;
}

.workflow-file__link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  color: var(--primary);
  font-weight: 700;
  text-decoration: none;
}

.workflow-file__link span {
  overflow-wrap: anywhere;
}

.workflow-file__local {
  padding: 2px 7px;
  border-radius: 999px;
  background: #fff1d6;
  color: #8a5a00;
  font-size: 11px;
  font-weight: 800;
}

.workflow-file-list {
  display: grid;
  gap: 8px;
}

/* Строка вложения: ссылка на файл слева, кнопка удаления у правого края. */
.workflow-file-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}

/* Поле вложений занимает всю ширину нижней строки раскрытых «Параметров». */
.outgoing-composer__attachments {
  grid-column: 1 / -1;
  display: grid;
  gap: 10px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.entity-description-card > .workflow-file-list {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.workflow-file-list ul {
  display: grid;
  gap: 7px;
  margin: 0;
  padding-left: 20px;
}

.project-delete-dialog {
  width: min(520px, calc(100% - 32px));
}

.project-delete-note {
  margin: 0;
  color: var(--muted);
}

.delete-remote-option {
  display: grid !important;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: 10px !important;
  padding: 12px;
  border: 1px solid rgba(185, 75, 75, 0.32);
  border-radius: 8px;
  background: rgba(185, 75, 75, 0.05);
}

.delete-remote-option input {
  width: 18px;
  min-height: 18px;
  margin-top: 2px;
}

.delete-remote-option span {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.delete-remote-option small {
  overflow-wrap: anywhere;
  color: var(--muted);
  font-weight: 400;
}

.project-delete-submit {
  border-color: var(--danger);
  background: var(--danger);
}

.project-delete-submit:hover {
  border-color: #8f3434;
  background: #8f3434;
}

button:disabled,
.primary-btn:disabled,
.outline-btn:disabled,
.icon-btn:disabled {
  cursor: not-allowed;
  opacity: .55;
}

.password-change-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(12, 19, 25, .72);
  backdrop-filter: blur(4px);
}

.password-change-card {
  width: min(460px, 100%);
  box-shadow: 0 24px 70px rgba(12, 19, 25, .32);
}

.password-change-card h2,
.password-change-card p {
  margin-top: 0;
}

.password-change-card .primary-btn {
  justify-content: center;
}

.crm-shell select,
dialog select {
  appearance: none;
  padding-right: 42px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5 6 6.5 11 1.5' fill='none' stroke='%234A7A9A' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 12px 8px;
}

.crm-shell select::-ms-expand,
dialog select::-ms-expand {
  display: none;
}

@media (min-width: 961px) and (max-width: 1420px) {
  .list-filters--five {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .document-filters {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .document-filter-search,
  .document-filter-party {
    grid-column: span 2;
  }

  .document-filter-reset {
    grid-column: auto;
    justify-self: stretch;
  }
}

@media (max-width: 1180px) {
  .outgoing-composer__parameter-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .outgoing-composer__recipient,
  .outgoing-composer__subject {
    grid-column: span 1;
  }

  .metric-grid,
  .report-grid,
  .report-metric-grid,
  .quick-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .report-filter-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .report-filter-actions {
    grid-column: 1 / -1;
    justify-content: flex-start;
  }

  .dash-grid {
    grid-template-columns: 1fr;
  }

  .dash-attention,
  .dash-deadlines {
    min-height: 0;
  }

  .dash-activity .activity-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .work-grid,
  .docs-grid,
  .integrations-grid,
  .entity-overview-grid,
  .entity-detail-layout,
  .ai-prompt-grid {
    grid-template-columns: 1fr;
  }

  .entity-detail-layout:not(.entity-detail-layout--single) {
    grid-template-areas:
      "summary"
      "sidebar"
      "feed";
  }

  .entity-detail-sidebar {
    position: static;
  }

  .document-hero.panel {
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
  }

  .document-hero__actions {
    max-width: none;
    justify-content: flex-start;
  }

  .document-filters {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .document-filter-search,
  .document-filter-party {
    grid-column: span 2;
  }

  .document-filter-reset {
    grid-column: auto;
    justify-self: stretch;
  }

  .list-filters,
  .list-filters--four,
  .list-filters--five {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .entity-details {
    grid-row: auto;
  }
}

@media (max-width: 960px) {
  .form-grid-2 {
    grid-template-columns: 1fr;
  }

  .document-filters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .document-filter-search,
  .document-filter-party {
    grid-column: auto;
  }

  .document-filter-reset {
    grid-column: 1 / -1;
    width: 100%;
  }

  .crm-main {
    padding: 12px 16px 40px;
  }

  .document-details-card dl {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .document-sheet {
    width: min(calc(100% - 32px), 960px);
    margin: 16px auto 24px;
    padding: 38px 40px 48px;
  }
}

@media (min-width: 961px) {
  .crm-backdrop {
    display: none !important;
  }
}

@media (max-width: 640px) {
  .entity-list {
    grid-template-columns: minmax(0, 1fr);
  }

  .list-pagination {
    align-items: stretch;
    flex-direction: column;
  }

  .list-pagination__controls {
    width: 100%;
    justify-content: space-between;
  }

  :root {
    --panel-padding: 16px;
  }

  .dash-deadlines .timeline-list,
  .dash-activity .activity-list {
    grid-template-columns: minmax(0, 1fr);
  }

  .dashboard-scroll-list {
    max-height: 420px;
    padding-right: 4px;
  }

  .crm-login-header {
    gap: 10px;
    min-height: 64px;
    padding: 5px 12px;
  }

  .crm-login-header img {
    width: min(240px, calc(100% - 56px));
    height: 52px;
  }

  .crm-login-header span {
    padding: 3px 8px;
    font-size: 16px;
  }

  .crm-login-shell {
    padding: 24px 12px;
  }

  .crm-login-card {
    padding: 20px;
  }

  .template-settings__head {
    display: grid;
  }

  .template-settings__head .panel-actions {
    width: 100%;
  }

  .template-settings__head .panel-actions button {
    flex: 1 1 auto;
  }

  .choice-card-grid,
  .project-folder-builder__list,
  .project-folder-builder__add {
    grid-template-columns: minmax(0, 1fr);
  }

  .project-folder-builder__add button {
    width: 100%;
  }

  .project-phase-row {
    grid-template-columns: minmax(0, 1fr);
  }

  .project-phase-actions {
    justify-content: flex-end;
  }

  .project-card-progress {
    align-items: center;
  }

  .file-readonly-hint {
    width: 100%;
    margin-left: 0;
  }

  /* Составление исходящего — отдельный экран, а не диалог, но на телефоне он
     показывается тем же листом во весь экран. Правила не копируются: селекторы
     экрана добавлены прямо в блоки .entity-dialog--mobile-full ниже по файлу.
     Здесь снимается только оформление панели — у диалога формы панелью не бывают. */
  .crm-form.outgoing-composer {
    gap: 8px;
    padding: 0;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .outgoing-ai-inline {
    width: 100%;
    padding: 12px;
    border-radius: 10px;
  }

  .outgoing-ai-inline__prompt {
    display: block;
  }

  .outgoing-ai-inline__head {
    margin: -12px -12px 12px;
    padding: 10px 12px;
    border-radius: 9px 9px 0 0;
  }

  .outgoing-ai-inline__title small {
    display: none;
  }

  .crm-form textarea.outgoing-ai-inline__instruction {
    min-height: 104px;
  }

  .outgoing-ai-inline__foot {
    flex-direction: column;
    align-items: stretch;
  }

  .outgoing-ai-inline__foot-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
  }

  .outgoing-ai-inline__foot-actions .primary-btn,
  .outgoing-ai-inline__foot-actions .outline-btn {
    width: 100%;
    justify-content: center;
  }

  .outgoing-ai-inline__scope .outline-btn,
  .outgoing-ai-inline__decision-actions .primary-btn,
  .outgoing-ai-inline__decision-actions .outline-btn {
    flex: 1 1 110px;
    justify-content: center;
  }

  .outgoing-composer__editor .jodit-container .outgoing-ai-inline {
    padding: 9px 8px 8px;
    border-radius: 9px 9px 0 0;
  }

  .outgoing-ai-inline__topline {
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 7px;
    margin-bottom: 7px;
  }

  .outgoing-ai-inline__title {
    min-width: 0;
    width: 100%;
  }

  .outgoing-ai-inline__tools {
    width: 100%;
    justify-content: flex-start;
  }

  .outgoing-ai-inline__scope {
    min-width: 0;
    flex: 1 1 auto;
  }

  .outgoing-ai-inline__scope .outline-btn {
    flex: 1 1 auto;
    min-width: 0;
    padding-inline: 7px;
  }

  .outgoing-ai-inline__command {
    grid-template-columns: minmax(0, 1fr);
    gap: 6px;
  }

  .crm-form textarea.outgoing-ai-inline__instruction {
    min-height: 70px;
    max-height: 220px;
  }

  .outgoing-ai-inline__send.primary-btn {
    width: 100%;
    min-width: 0;
    min-height: 36px;
  }

  .outgoing-ai-inline__decision {
    align-items: stretch;
    flex-direction: column;
    gap: 8px;
  }

  .outgoing-ai-inline__decision-copy {
    flex-wrap: wrap;
  }

  .outgoing-ai-inline__decision-copy .form-note {
    width: 100%;
  }

  .outgoing-ai-inline__decision-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .outgoing-composer__header {
    align-items: center;
    gap: 12px;
  }

  .outgoing-composer__parameter-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .outgoing-composer__format-row {
    grid-template-columns: minmax(0, 1fr);
  }

  .outgoing-composer__format-row > .outgoing-composer__description,
  .outgoing-composer__format-row > .outgoing-composer__options {
    width: 100%;
  }

  .outgoing-composer__parameter-grid > label,
  .outgoing-composer__options,
  .outgoing-composer__hint {
    grid-column: auto;
  }

  .crm-form .outgoing-composer__option {
    flex: 1 1 120px;
  }

  .crm-form .outgoing-composer__orientation {
    flex: 1 1 236px;
  }

  .outgoing-composer__editor .jodit-toolbar__box {
    flex-wrap: wrap;
    overflow-x: hidden;
  }

  .outgoing-composer__editor .jodit-workplace {
    padding: 8px 0 14px;
    background: #fff;
  }

  .outgoing-composer__editor .jodit-container,
  .outgoing-composer__editor .jodit-workplace,
  .outgoing-composer__editor .jodit-wysiwyg {
    min-width: 0 !important;
    max-width: 100% !important;
  }

  .outgoing-composer__editor .jodit-wysiwyg.document-editor-sheet {
    --document-editor-padding-x: 18px;
    min-height: 55vh !important;
    padding: 26px 18px 34px !important;
    border: 0;
    box-shadow: none;
  }

  .entity-card__top,
  .entity-page__header {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .entity-card__facts {
    grid-template-columns: minmax(0, 1fr);
  }

  .entity-page__header {
    display: grid;
  }

  .entity-page__actions {
    justify-content: flex-start;
    margin-left: 0;
  }

  .document-revision-item {
    align-items: flex-start;
    flex-direction: column;
  }

  .document-hero.panel {
    gap: 18px;
    padding: 18px;
  }

  .document-hero__title {
    font-size: 16px;
  }

  .document-hero__meta {
    align-items: flex-start;
    flex-direction: column;
    gap: 7px;
  }

  .document-hero__actions {
    width: 100%;
  }

  .document-details-card dl {
    grid-template-columns: minmax(0, 1fr);
  }

  .entity-details dl .document-fact {
    min-height: 0;
  }

  .document-content-card__head {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
  }

  .document-content-card__actions {
    align-items: stretch;
    flex-direction: column;
    width: 100%;
  }

  .document-content-card__actions > span {
    text-align: left;
  }

  .document-copy-content {
    width: 100%;
  }

  .document-sheet {
    width: 100%;
    margin: 0;
    padding: 26px 18px 34px;
    border: 0;
    box-shadow: none;
  }

  .entity-details dl,
  .project-phase-list {
    grid-template-columns: 1fr;
  }

  .entity-dialog {
    width: calc(100% - 16px);
    max-height: calc(100vh - 16px);
    padding: 14px;
  }

  dialog .panel-head {
    padding-right: 0;
  }

  .entity-dialog .panel-head {
    padding-right: 0;
  }

  .entity-dialog .panel-head > :first-child {
    max-width: calc(100% - 52px);
  }

  .entity-dialog .file-dialog-actions {
    justify-content: flex-end;
    flex-wrap: wrap;
  }

  .entity-dialog .file-dialog-actions > button {
    flex: 0 1 auto;
    min-width: 128px;
  }

  .push-settings-actions > button {
    flex: 1 1 calc(50% - 8px) !important;
  }

  .push-settings-actions [data-push-disable] {
    order: 3;
    flex-basis: 100% !important;
    margin-right: 0;
  }

  .entity-dialog:not(.entity-dialog--mobile-full) .file-dialog-actions {
    bottom: -14px;
    margin: 8px -14px -14px;
    padding: 12px 14px 14px;
  }

  /* Экран составления исходящего перечислен вместе с диалогами: на телефоне он
     показывается тем же листом во весь экран — поверх шапки приложения, с той же
     липкой шапкой и той же нижней полосой кнопок. Отдельных правил у него нет. */
  .entity-dialog--mobile-full,
  .crm-view--composer.is-active {
    inset: 0;
    width: 100%;
    max-width: none;
    height: 100vh;
    height: 100dvh;
    max-height: 100vh;
    max-height: 100dvh;
    margin: 0;
    padding: 0 16px;
    overflow-x: hidden;
    overflow-y: auto;
    border: 0;
    border-radius: 0;
    background: var(--surface);
    box-shadow: none;
  }

  /* Лист перекрывает и кнопку меню (z-index 210): модальное окно на телефоне
     закрывает собой всё, пока его не закроют крестиком. */
  .crm-view--composer.is-active {
    position: fixed;
    z-index: 220;
  }

  .entity-dialog--mobile-full > .crm-form,
  .entity-dialog--mobile-full > .docs-grid,
  .crm-view--composer > .crm-form {
    width: 100%;
    min-height: 100%;
  }

  .entity-dialog--mobile-full > .crm-form,
  .crm-view--composer > .crm-form {
    align-content: start;
    padding-bottom: calc(78px + env(safe-area-inset-bottom));
  }

  .entity-dialog--mobile-full .panel-head,
  .crm-view--composer .outgoing-composer__header {
    position: sticky;
    top: 0;
    z-index: 5;
    align-items: center;
    margin: 0 -16px 18px;
    padding: 14px 16px;
    border-bottom: 0;
    background: var(--surface);
    box-shadow: 0 1px 0 rgba(74, 122, 154, .16), 0 8px 18px rgba(44, 62, 74, .06);
  }

  .entity-dialog--mobile-full .file-dialog-actions,
  .crm-view--composer .outgoing-composer__actions {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 6;
    margin: 0;
    padding: 11px 16px max(11px, env(safe-area-inset-bottom));
    border-top: 1px solid rgba(74, 122, 154, 0.22);
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 -8px 22px rgba(44, 62, 74, 0.08);
  }

  .crm-view--composer .outgoing-composer__actions > button {
    flex: 0 1 auto;
    min-width: 128px;
  }

  h1 {
    font-size: 29px;
  }

  .metric-grid,
  .report-grid,
  .quick-actions,
  .form-row,
  .supplier-row,
  .phase-list,
  .permissions-grid {
    grid-template-columns: 1fr;
  }

  .report-filter-form,
  .report-metric-grid,
  .report-detail-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .filter-bar {
    padding: 12px;
  }

  .report-filter-actions {
    grid-column: auto;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-items: stretch;
    justify-content: stretch;
    justify-items: stretch;
    width: 100%;
  }

  .report-presets {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }

  .report-presets .outline-btn,
  .report-refresh {
    min-width: 0;
    width: 100%;
    justify-content: center;
  }

  .report-overdue-item {
    align-items: flex-start;
    flex-direction: column;
  }

  .entity-page__actions > .primary-btn,
  .entity-page__actions > .outline-btn {
    flex: 1 1 100%;
    width: 100%;
    justify-content: center;
  }

  .message-composer__toolbar {
    align-items: stretch;
    grid-template-columns: minmax(0, 1fr);
  }

  .message-composer__files .file-input-control {
    grid-template-columns: minmax(0, 1fr);
  }

  .message-composer__files .file-input-value {
    text-align: center;
  }

  .message-composer__actions,
  .message-composer__actions .primary-btn,
  .comment-composer__actions,
  .comment-composer__actions .primary-btn {
    width: 100%;
  }

  .message-composer__actions {
    align-self: stretch;
  }

  .message-composer__actions .primary-btn,
  .comment-composer__actions .primary-btn {
    justify-content: center;
  }

  .document-filters {
    grid-template-columns: 1fr;
  }

  .document-filter-search,
  .document-filter-party {
    grid-column: auto;
  }

  .document-filter-reset {
    width: 100%;
  }

  .list-filters,
  .list-filters--four,
  .list-filters--five {
    grid-template-columns: 1fr;
  }

  .list-filters .outline-btn {
    width: 100%;
  }

  .file-input-control {
    grid-template-columns: 1fr;
  }

  .file-input-button {
    width: 100%;
  }

  .crm-alert-stack {
    top: 10px;
    right: 10px;
    width: calc(100vw - 20px);
  }

  .crm-table th,
  .crm-table td {
    padding: 10px;
    border-right: 0;
  }

  .crm-table th:not(:last-child),
  .crm-table td:not(:last-child) {
    border-right: 0;
  }

  .crm-table__cell--entity {
    width: 170px;
    min-width: 160px;
    max-width: 190px;
  }

  .table-wrap--mobile-cards {
    overflow: visible;
    border: 0;
    border-radius: 0;
    background: transparent;
  }

  .table-context + .table-wrap--mobile-cards {
    margin-top: 10px;
  }

  .crm-table--mobile-cards {
    display: block;
    width: 100%;
    min-width: 0;
  }

  .crm-table--mobile-cards thead {
    display: none;
  }

  .crm-table--mobile-cards tbody {
    display: grid;
    gap: 10px;
  }

  .crm-table--mobile-cards tbody tr {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    overflow: hidden;
    border: 1px solid var(--table-border);
    border-radius: 10px;
    background: var(--surface);
  }

  .crm-table--mobile-cards tbody tr > td,
  .crm-table--mobile-cards tbody tr > th {
    display: block;
    min-width: 0;
    width: auto !important;
    max-width: none !important;
    padding: 10px 12px;
    border: 0;
    border-top: 1px solid var(--table-border);
    background: var(--surface) !important;
    text-align: left;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  .crm-table--mobile-cards tbody tr > :first-child {
    grid-column: 1 / -1;
    border-top: 0;
    background: var(--surface-muted) !important;
    color: var(--secondary);
    font-weight: 700;
  }

  .crm-table--mobile-cards tbody tr.is-selected > td,
  .crm-table--mobile-cards tbody tr.is-selected > th,
  .crm-table--mobile-cards tbody tr.is-selected > :first-child {
    background: rgba(230, 245, 238, .78) !important;
  }

  .crm-table--mobile-cards .mobile-table-cell--wide {
    grid-column: 1 / -1;
  }

  .crm-table--mobile-cards .mobile-table-cell--choice {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    justify-content: space-between;
  }

  .crm-table--mobile-cards .mobile-table-cell--choice::before {
    display: block !important;
    margin: 0 !important;
  }

  .crm-table--mobile-cards .mobile-table-cell--actions {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
  }

  .crm-table--mobile-cards [data-mobile-label]::before {
    content: attr(data-mobile-label);
    display: block;
    margin-bottom: 4px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
    line-height: 1.2;
    text-transform: uppercase;
  }

  .crm-table--mobile-cards [data-mobile-label=""]::before {
    display: none;
  }

  .crm-table--mobile-cards tbody tr > :first-child::before,
  .crm-table--mobile-cards .mobile-table-cell--actions::before {
    display: none;
  }

  .crm-table--mobile-cards .mobile-table-row--empty {
    display: block;
  }

  .crm-table--mobile-cards .mobile-table-row--empty > td,
  .crm-table--mobile-cards .mobile-table-row--empty > th {
    display: block;
    width: 100%;
    padding: 14px 16px;
    border: 0;
    background: var(--surface-alt) !important;
    color: var(--muted);
    font-weight: 400;
  }

  .users-table-wrap {
    overflow: visible;
    border: 0;
    border-radius: 0;
    background: transparent;
  }

  .users-table {
    display: block;
    width: 100%;
    min-width: 0;
  }

  .users-table thead {
    display: none;
  }

  .users-table tbody {
    display: grid;
    gap: 10px;
  }

  .users-table .user-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "identity actions"
      "role role"
      "contacts contacts"
      "permissions permissions";
    overflow: hidden;
    border: 1px solid var(--table-border);
    border-radius: 10px;
    background: var(--surface);
  }

  .users-table .user-cell {
    display: block;
    min-width: 0;
    padding: 10px 12px;
    border: 0;
    border-top: 1px solid var(--table-border);
    background: var(--surface) !important;
    overflow-wrap: anywhere;
  }

  .users-table .user-cell--identity {
    grid-area: identity;
    border-top: 0;
    background: var(--surface-muted) !important;
  }

  .users-table .user-cell--role {
    grid-area: role;
  }

  .users-table .user-cell--contacts {
    grid-area: contacts;
  }

  .users-table .user-cell--permissions {
    grid-area: permissions;
  }

  .users-table .user-cell--actions {
    grid-area: actions;
    display: flex;
    align-items: center;
    border-top: 0;
    background: var(--surface-muted) !important;
  }

  .users-table [data-label]::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 4px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
    line-height: 1.2;
    text-transform: uppercase;
  }

  .users-table .user-actions {
    flex-wrap: nowrap;
  }

  .task-register-wrap {
    overflow: visible;
    border: 0;
    border-radius: 0;
    background: transparent;
  }

  .task-register-table {
    display: block;
    width: 100%;
    min-width: 0;
  }

  .task-register-table thead {
    display: none;
  }

  .task-register-table tbody {
    display: grid;
    gap: 10px;
  }

  .task-register-table .task-register-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "title action"
      "project project"
      "assignee assignee"
      "deadline status";
    overflow: hidden;
    border: 1px solid var(--table-border);
    border-radius: 10px;
    background: var(--surface);
  }

  .task-register-table .task-register-row > td {
    display: block;
    min-width: 0;
    padding: 10px 12px;
    border: 0;
    border-top: 1px solid var(--table-border);
    background: var(--surface) !important;
    overflow-wrap: anywhere;
  }

  .task-register__title {
    grid-area: title;
    border-top: 0 !important;
    background: var(--surface-muted) !important;
  }

  /* Правая колонка карточки шире кнопки: её ширину задаёт ячейка статуса из нижней
     строки. Без выравнивания по концу стрелка вставала у левого края этой колонки и
     висела в стороне от края карточки. */
  .task-register__action {
    grid-area: action;
    display: flex !important;
    align-items: center;
    justify-content: flex-end;
    border-top: 0 !important;
    background: var(--surface-muted) !important;
  }

  .task-register__project {
    grid-area: project;
  }

  .task-register__assignee {
    grid-area: assignee;
  }

  .task-register__deadline {
    grid-area: deadline;
  }

  .task-register__status {
    grid-area: status;
  }

  .task-register-table [data-label]::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 4px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
    line-height: 1.2;
    text-transform: uppercase;
  }

  .task-register-table .task-register-empty {
    display: block;
  }

  .task-register-empty > td {
    display: block;
    width: 100%;
    border: 1px solid var(--table-border);
    border-radius: 10px;
    background: var(--surface) !important;
  }

  .report-deadline-wrap,
  .report-workload-wrap,
  .report-documents-wrap {
    overflow: visible;
    border: 0;
    border-radius: 0;
    background: transparent;
  }

  .report-deadline-table,
  .report-workload-table,
  .report-documents-table {
    display: block;
    width: 100%;
    min-width: 0;
  }

  .report-deadline-table thead,
  .report-workload-table thead,
  .report-documents-table thead {
    display: none;
  }

  .report-deadline-table tbody,
  .report-workload-table tbody,
  .report-documents-table tbody {
    display: grid;
    gap: 10px;
  }

  .report-deadline-row,
  .report-workload-row,
  .report-document-row {
    display: grid;
    overflow: hidden;
    border: 1px solid var(--table-border);
    border-radius: 10px;
    background: var(--surface);
  }

  .report-deadline-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-areas:
      "title title"
      "type date"
      "project project"
      "status status";
  }

  .report-workload-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-areas:
      "name name"
      "total open"
      "completed overdue";
  }

  .report-document-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-areas:
      "number number"
      "date status"
      "title title"
      "owner owner"
      "project project";
  }

  .report-deadline-row > td,
  .report-workload-row > td,
  .report-document-row > td {
    display: block;
    min-width: 0;
    padding: 10px 12px;
    border: 0;
    border-top: 1px solid var(--table-border);
    background: var(--surface) !important;
    overflow-wrap: anywhere;
  }

  .report-deadline__title,
  .report-workload__name,
  .report-document__number {
    border-top: 0 !important;
    background: var(--surface-muted) !important;
  }

  .report-deadline__title {
    grid-area: title;
  }

  .report-deadline__type {
    grid-area: type;
  }

  .report-deadline__project {
    grid-area: project;
  }

  .report-deadline__date {
    grid-area: date;
  }

  .report-deadline__status {
    grid-area: status;
  }

  .report-workload__name {
    grid-area: name;
    color: var(--secondary);
    font-weight: 700;
  }

  .report-workload__total {
    grid-area: total;
  }

  .report-workload__open {
    grid-area: open;
  }

  .report-workload__completed {
    grid-area: completed;
  }

  .report-workload__overdue {
    grid-area: overdue;
  }

  .report-document__number {
    grid-area: number;
  }

  .report-document__number-type {
    display: block;
  }

  .report-document__status {
    grid-area: status;
    display: block !important;
  }

  .report-document__date {
    grid-area: date;
  }

  .report-document__type {
    grid-area: type;
    display: none !important;
  }

  .report-document__title {
    grid-area: title;
    color: var(--secondary);
    font-weight: 600;
  }

  .report-document__owner {
    grid-area: owner;
  }

  .report-document__project {
    grid-area: project;
  }

  .report-deadline-table [data-label]::before,
  .report-workload-table [data-label]::before,
  .report-documents-table [data-label]::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 4px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
    line-height: 1.2;
    text-transform: uppercase;
  }

  .report-deadline-table .report-table-empty,
  .report-workload-table .report-table-empty,
  .report-documents-table .report-table-empty {
    display: block;
  }

  .report-table-empty > td {
    display: block;
    width: 100%;
    border: 1px solid var(--table-border);
    border-radius: 10px;
    background: var(--surface) !important;
  }

  .file-pagination {
    min-height: 50px;
    align-items: center;
    flex-direction: row;
    gap: 8px;
    padding: 8px 12px;
  }

  .file-pagination .list-pagination__controls {
    width: auto;
    justify-content: flex-start;
  }

  .file-pagination .list-pagination__summary {
    margin-left: auto;
    text-align: right;
  }

  .panel-footer-actions > button {
    width: 100%;
  }

  .signer-item__head {
    align-items: stretch;
    flex-direction: column;
  }

  .signer-item__badges {
    justify-content: flex-start;
  }

  .entity-dialog .jodit-container,
  .entity-dialog .jodit-workplace,
  .entity-dialog .jodit-wysiwyg {
    min-width: 0 !important;
    max-width: 100% !important;
  }

  .panel-head {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
  }

  .panel-head > .panel-actions {
    grid-column: 1 / -1;
    width: 100%;
    justify-content: flex-end;
  }

  /* Пояснение в шапке (счётчик, время обновления) уходит под заголовок: рядом
     с ним оно сжимало заголовок в две-три строки. */
  .panel-head > .form-note {
    grid-column: 1 / -1;
    justify-self: start;
  }

  /* Шапка раздела на телефоне: заголовок строкой, под ним — полоса действий,
     отделённая линией. Кнопки растягиваются на всю ширину, как в шапке шаблонов
     (.template-settings__head): так по ним попадаешь пальцем, а не мимо. */
  .crm-main .panel-head {
    row-gap: 10px;
  }

  .crm-main .panel-head > .panel-actions {
    padding-top: 10px;
    border-top: 1px solid rgba(74, 122, 154, .16);
  }

  /* Время обновления и счётчики стоят в начале полосы, кнопки — в конце. */
  .crm-main .panel-head > .panel-actions > .form-note {
    margin-right: auto;
    text-align: left;
  }

  /* Значок обновления делит строку с обычными кнопками и остаётся квадратным,
     но если он единственное действие раздела — занимает полосу целиком. */
  .crm-main .panel-head > .panel-actions > .primary-btn,
  .crm-main .panel-head > .panel-actions > .outline-btn,
  .crm-main .panel-head > .panel-actions > .icon-btn:only-child {
    flex: 1 1 auto;
  }

  .crm-main .panel-head > button,
  .crm-main .panel-head > a {
    grid-column: 1 / -1;
    justify-self: end;
  }

  .file-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .file-event {
    grid-template-columns: 34px minmax(0, 1fr);
  }

  .file-event__meta {
    grid-column: 2;
    justify-items: start;
  }

  .file-share {
    grid-template-columns: 34px minmax(0, 1fr) 40px;
  }

  .file-share__meta {
    grid-column: 2;
    grid-row: 2;
    justify-items: start;
  }

  .file-share > .icon-btn {
    grid-column: 3;
    grid-row: 1 / span 2;
  }
}

/* Переключение включается по реальной доступной ширине workspace и фактической
   ориентации PDF-листа, а не по ширине viewport. Состояние обеих панелей
   остаётся в DOM. */
.outgoing-composer[data-workspace-layout="tabs"] .outgoing-composer__workspace-switch {
  width: min(100%, 340px);
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  margin: 0 0 8px auto;
}

.outgoing-composer[data-workspace-layout="tabs"]
  .outgoing-composer__workspace-switch .outline-btn {
  min-height: 36px;
  justify-content: center;
}

.outgoing-composer[data-workspace-layout="tabs"]
  .outgoing-composer__workspace-switch .outline-btn.is-active {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
}

.outgoing-composer__workspace[data-layout-mode="tabs"] {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
}

.outgoing-composer__workspace[data-layout-mode="tabs"] > .outgoing-composer__editor,
.outgoing-composer__workspace[data-layout-mode="tabs"] > .outgoing-ai-inline {
  grid-area: 1 / 1;
}

.outgoing-composer__workspace[data-layout-mode="tabs"][data-mobile-pane="canvas"] > .outgoing-ai-inline,
.outgoing-composer__workspace[data-layout-mode="tabs"][data-mobile-pane="ai"] > .outgoing-composer__editor {
  position: absolute;
  inset: 0;
  visibility: hidden;
  pointer-events: none;
}

.outgoing-composer__workspace[data-layout-mode="tabs"] .outgoing-composer__editor,
.outgoing-composer__workspace[data-layout-mode="tabs"] .outgoing-ai-inline,
.outgoing-composer__workspace[data-layout-mode="tabs"]
  .outgoing-composer__editor .jodit-container .outgoing-ai-inline {
  width: 100%;
  height: 100%;
}

.outgoing-composer__workspace[data-layout-mode="tabs"] .outgoing-ai-inline,
.outgoing-composer__workspace[data-layout-mode="tabs"]
  .outgoing-composer__editor .jodit-container .outgoing-ai-inline {
  border-left: 0;
}

/* Единственная штатная компактная навигация. На обычных страницах её включает
   прежний mobile breakpoint, в композере — тот же компонент при ширине <1910. */
.crm-shell.is-mobile-navigation {
  grid-template-columns: minmax(0, 1fr);
}

.crm-shell.is-mobile-navigation .crm-nav-toggle {
  display: grid;
  place-items: center;
}

.crm-shell.is-mobile-navigation .crm-mobile-brand {
  width: fit-content;
  height: 44px;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  color: var(--primary-dark);
  text-decoration: none;
}

.crm-shell.is-mobile-navigation .crm-mobile-brand img {
  width: 142px;
  max-width: calc(100vw - 120px);
  height: 34px;
  object-fit: contain;
  object-position: left center;
}

.crm-shell.is-mobile-navigation .crm-mobile-brand span {
  padding: 3px 7px;
  border: 1px solid rgba(74, 122, 154, .42);
  border-radius: 8px;
  color: var(--primary-dark);
  font-family: "Roboto Condensed", sans-serif;
  font-size: 13px;
  letter-spacing: .08em;
}

.crm-shell.is-mobile-navigation .crm-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 200;
  width: var(--sidebar-w);
  max-width: 84vw;
  transform: translateX(-104%);
  transition: transform .24s ease;
}

.crm-shell.is-mobile-navigation .crm-sidebar.is-open {
  transform: translateX(0);
}

.crm-shell.is-mobile-navigation .crm-backdrop:not([hidden]) {
  display: block !important;
}

.crm-shell.is-mobile-navigation .crm-backdrop[hidden] {
  display: none !important;
}

@media (min-width: 1241px) {
  .crm-shell.is-mobile-navigation .crm-main.is-composer {
    display: flex;
    flex-direction: column;
  }

  .crm-shell.is-mobile-navigation .crm-main.is-composer .crm-view--composer.is-active {
    height: auto;
    flex: 1 1 auto;
  }
}

@media (max-width: 640px) {
  .outgoing-composer__workspace-switch {
    width: 100%;
    margin-bottom: 6px;
  }

  .outgoing-composer__workspace {
    height: max(540px, calc(100dvh - 190px));
    border-radius: 8px;
  }

  .outgoing-ai-inline,
  .outgoing-composer__editor .jodit-container .outgoing-ai-inline {
    padding: 12px;
    border: 0;
    border-radius: 0;
  }

  .outgoing-ai-inline__topline {
    margin-bottom: 10px;
  }

  .outgoing-ai-inline__title {
    width: auto;
    margin-bottom: 9px;
  }

  .outgoing-ai-inline__tools {
    width: 100%;
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .outgoing-ai-inline__scope {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
  }

  .crm-form textarea.outgoing-ai-inline__instruction {
    min-height: 160px;
    max-height: 320px;
  }

  .outgoing-ai-inline__send.primary-btn {
    min-height: 40px;
  }

  .outgoing-composer__editor .jodit-toolbar__box {
    flex-wrap: wrap;
    overflow-x: hidden;
  }

  .outgoing-composer__editor .jodit-workplace {
    padding: 8px 0 14px;
    background: #fff;
  }

  .outgoing-composer__editor .jodit-wysiwyg.document-editor-sheet,
  .outgoing-composer[data-page-orientation="landscape"] .outgoing-composer__editor .jodit-wysiwyg.document-editor-sheet {
    --document-editor-padding-x: 18px;
    width: 100% !important;
    max-width: 100% !important;
    min-height: 55vh !important;
    padding: 26px 18px 34px !important;
    border: 0;
    box-shadow: none;
  }
}

/* На странице ИИ-редактора tablet/узкий desktop использует тот же
   полноэкранный composer, что и телефон. Блок намеренно scoped только к
   композеру: мобильные правила остальных разделов CRM остаются на 640px. */
@media (max-width: 1240px) {
  .crm-form.outgoing-composer {
    gap: 8px;
    padding: 0;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .crm-view--composer.is-active {
    position: fixed;
    inset: 0;
    z-index: 220;
    width: 100%;
    max-width: none;
    height: 100vh;
    height: 100dvh;
    max-height: 100vh;
    max-height: 100dvh;
    margin: 0;
    padding: 0 16px;
    overflow-x: hidden;
    overflow-y: auto;
    border: 0;
    border-radius: 0;
    background: var(--surface);
    box-shadow: none;
  }

  .crm-view--composer > .crm-form {
    width: 100%;
    min-height: 100%;
    align-content: start;
    padding-bottom: calc(78px + env(safe-area-inset-bottom));
  }

  .crm-view--composer .outgoing-composer__header {
    position: sticky;
    top: 0;
    z-index: 5;
    align-items: center;
    gap: 12px;
    margin: 0 -16px 18px;
    padding: 14px 16px;
    border-bottom: 0;
    background: var(--surface);
    box-shadow: 0 1px 0 rgba(74, 122, 154, .16), 0 8px 18px rgba(44, 62, 74, .06);
  }

  .crm-view--composer .outgoing-composer__actions {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 6;
    margin: 0;
    padding: 11px 16px max(11px, env(safe-area-inset-bottom));
    border-top: 1px solid rgba(74, 122, 154, .22);
    background: rgba(255, 255, 255, .98);
    box-shadow: 0 -8px 22px rgba(44, 62, 74, .08);
  }

  .crm-view--composer .outgoing-composer__actions > button {
    flex: 0 1 auto;
    min-width: 128px;
  }

  .outgoing-composer__parameter-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .outgoing-composer__format-row {
    grid-column: auto;
    grid-template-columns: minmax(0, 1fr);
    width: 100%;
  }

  .outgoing-composer__format-row > .outgoing-composer__description,
  .outgoing-composer__format-row > .outgoing-composer__options {
    width: 100%;
  }

  .outgoing-composer__parameter-grid > label,
  .outgoing-composer__options,
  .outgoing-composer__hint {
    grid-column: auto;
  }

  .outgoing-composer__parameter-grid > .outgoing-composer__recipient,
  .outgoing-composer__parameter-grid > .outgoing-composer__subject,
  .outgoing-composer__parameter-grid > .outgoing-composer__visibility,
  .outgoing-composer__parameter-grid > .outgoing-composer__format-row,
  .outgoing-composer__parameter-grid > .outgoing-composer__hint,
  .outgoing-composer__parameter-grid > .outgoing-composer__attachments {
    grid-column: auto;
  }

  .crm-form .outgoing-composer__option {
    flex: 1 1 120px;
  }

  .crm-form .outgoing-composer__orientation {
    flex: 1 1 236px;
  }

  .outgoing-composer__workspace-switch {
    width: 100%;
    margin-bottom: 6px;
  }

  .outgoing-composer__workspace {
    height: max(540px, calc(100dvh - 190px));
    border-radius: 8px;
  }

  .outgoing-ai-inline,
  .outgoing-composer__editor .jodit-container .outgoing-ai-inline {
    width: 100%;
    padding: 12px;
    border: 0;
    border-radius: 0;
  }

  .outgoing-ai-inline__prompt {
    display: block;
  }

  .outgoing-ai-inline__title {
    width: auto;
    margin-bottom: 9px;
  }

  .outgoing-ai-inline__title small {
    display: none;
  }

  .outgoing-ai-inline__topline {
    margin-bottom: 10px;
  }

  .outgoing-ai-inline__tools {
    width: 100%;
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .outgoing-ai-inline__scope {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
  }

  .crm-form textarea.outgoing-ai-inline__instruction {
    min-height: 160px;
    max-height: 320px;
  }

  .outgoing-ai-inline__send.primary-btn {
    width: 100%;
    min-width: 0;
    min-height: 40px;
  }

  .outgoing-ai-inline__decision {
    align-items: stretch;
    flex-direction: column;
    gap: 8px;
  }

  .outgoing-ai-inline__decision-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .outgoing-composer__editor .jodit-toolbar__box {
    flex-wrap: wrap;
    overflow-x: hidden;
  }

  .outgoing-composer__editor .jodit-workplace {
    padding: 8px 0 14px;
    background: #fff;
  }

  .outgoing-composer__editor .jodit-container,
  .outgoing-composer__editor .jodit-workplace,
  .outgoing-composer__editor .jodit-wysiwyg {
    min-width: 0 !important;
    max-width: 100% !important;
  }

  .outgoing-composer__editor .jodit-wysiwyg.document-editor-sheet,
  .outgoing-composer[data-page-orientation="landscape"] .outgoing-composer__editor .jodit-wysiwyg.document-editor-sheet {
    --document-editor-padding-x: 18px;
    width: 100% !important;
    max-width: 100% !important;
    min-height: 55vh !important;
    padding: 26px 18px 34px !important;
    border: 0;
    box-shadow: none;
  }
}

/* Личные TODO: те же поверхности и размеры, что в задачах, без процесса подтверждения. */
.todo-register-table {
  min-width: 900px;
}

.todo-register__title {
  min-width: 250px;
}

.todo-register__checklist {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--primary-dark);
  font-weight: 600;
}

.todo-register__checklist i {
  color: var(--primary);
}

.todo-register__action {
  width: 52px;
  text-align: right;
}

.todo-checklist-card {
  overflow: hidden;
}

.todo-checklist__head {
  align-items: center;
}

.todo-checklist__head h2,
.todo-checklist__head strong {
  margin: 0;
}

.todo-checklist__head strong {
  color: var(--primary-dark);
  font-size: 13px;
}

.todo-checklist__list {
  margin-top: 0;
}

.todo-checklist__empty {
  margin: 0;
  padding: 2px 0 10px;
  color: var(--muted);
}

.todo-checklist__composer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 40px;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
}

.todo-checklist__composer input {
  width: 100%;
  min-width: 0;
  height: 40px;
  margin: 0;
  padding: 8px 11px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font: inherit;
}

.todo-checklist__composer input:focus {
  border-color: var(--primary);
  outline: none;
  box-shadow: 0 0 0 3px rgba(74, 122, 154, .12);
}

@media (max-width: 640px) {
  .todo-register-wrap {
    overflow: visible;
    border: 0;
    border-radius: 0;
    background: transparent;
  }

  .todo-register-table {
    display: block;
    width: 100%;
    min-width: 0;
  }

  .todo-register-table thead {
    display: none;
  }

  .todo-register-table tbody {
    display: grid;
    gap: 10px;
  }

  .todo-register-table .todo-register-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "title action"
      "visibility visibility"
      "checklist updated"
      "status status";
    overflow: hidden;
    border: 1px solid var(--table-border);
    border-radius: 10px;
    background: var(--surface);
  }

  .todo-register-table .todo-register-row > td {
    display: block;
    min-width: 0;
    padding: 10px 12px;
    border: 0;
    border-top: 1px solid var(--table-border);
    background: var(--surface) !important;
    overflow-wrap: anywhere;
  }

  .todo-register__title {
    grid-area: title;
    border-top: 0 !important;
    background: var(--surface-muted) !important;
  }

  .todo-register__action {
    grid-area: action;
    display: flex !important;
    align-items: center;
    justify-content: flex-end;
    width: auto;
    border-top: 0 !important;
    background: var(--surface-muted) !important;
  }

  .todo-register-table.crm-table--mobile-cards .todo-register__action.mobile-table-cell--actions {
    grid-column: auto;
    grid-area: action;
    background: var(--surface-muted) !important;
  }

  .todo-register-row > td:nth-child(2) { grid-area: visibility; }
  .todo-register-row > td:nth-child(3) { grid-area: checklist; }
  .todo-register-row > td:nth-child(4) { grid-area: updated; }
  .todo-register-row > td:nth-child(5) { grid-area: status; }

  .todo-register-table [data-label]::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 4px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
    line-height: 1.2;
    text-transform: uppercase;
  }

  .todo-register-table .todo-register-empty,
  .todo-register-empty > td {
    display: block;
    width: 100%;
  }
}
