.crm-shell {
  --crm-blue: #2a7de1;
  --crm-blue-soft: #e7f1ff;
  --crm-green-soft: #dcefe7;
  --crm-yellow-soft: #fff0c9;
  --crm-red-soft: #fde3db;
  display: grid;
  gap: 14px;
}

.crm-head {
  position: sticky;
  top: 0;
  z-index: 12;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 22px;
  min-height: 66px;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 253, 248, 0.94);
  box-shadow: 0 12px 36px rgba(26, 22, 16, 0.06);
  backdrop-filter: blur(14px);
}

.crm-head > div:first-child {
  display: flex;
  align-items: center;
  gap: 10px;
}

.crm-head p,
.crm-card-head p,
.crm-delivery-toolbar p,
.crm-automation-principles > p {
  margin: 0 0 3px;
  color: var(--coral);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.crm-head h2,
.crm-card-head h3,
.crm-delivery-toolbar h3,
.crm-template-guide h3,
.crm-automation-principles h3 {
  margin: 0;
  letter-spacing: -0.025em;
}

.crm-head h2 {
  font-size: 17px;
}

.crm-live-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 5px rgba(37, 119, 90, 0.12);
}

.crm-head nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-width: 0;
}

.crm-head nav button,
.crm-refresh {
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.crm-head nav button {
  padding: 9px 11px;
  font-size: 12px;
  font-weight: 700;
}

.crm-head nav button:hover,
.crm-head nav button.active {
  background: var(--ink);
  color: #fff;
}

.crm-refresh {
  width: 38px;
  height: 38px;
  font-size: 20px;
}

.crm-refresh:hover {
  background: #eee9df;
  color: var(--ink);
}

.crm-content {
  min-width: 0;
}

.crm-notice {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 12px 14px;
  border: 1px solid transparent;
  border-radius: 13px;
  font-size: 12px;
}

.crm-notice > span {
  flex: 0 0 25px;
  width: 25px;
  height: 25px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  font-weight: 900;
}

.crm-notice.success {
  border-color: #bddbce;
  background: var(--crm-green-soft);
  color: var(--green);
}

.crm-notice.success > span {
  background: var(--green);
  color: #fff;
}

.crm-notice.error {
  border-color: #efc0b5;
  background: #fff2ee;
  color: var(--red);
}

.crm-notice.error > span {
  background: var(--red);
  color: #fff;
}

.crm-notice.error p {
  margin: 3px 0 0;
}

.crm-notice.error button {
  margin-left: auto;
  border: 0;
  background: transparent;
  color: inherit;
  font-weight: 800;
  cursor: pointer;
}

.crm-card,
.crm-metric,
.crm-loading {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--paper);
  box-shadow: 0 8px 32px rgba(26, 22, 16, 0.04);
}

.crm-card {
  min-width: 0;
  padding: 20px;
}

.crm-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.crm-card-head h3,
.crm-delivery-toolbar h3,
.crm-template-guide h3,
.crm-automation-principles h3 {
  font-size: 19px;
}

.crm-card-head > div > span,
.crm-card-head > span {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 11px;
}

.crm-loading {
  min-height: 310px;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 14px;
  color: var(--muted);
}

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

.crm-metric {
  position: relative;
  min-height: 122px;
  overflow: hidden;
  padding: 17px;
}

.crm-metric::after {
  content: "";
  position: absolute;
  right: -24px;
  bottom: -32px;
  width: 86px;
  height: 86px;
  border-radius: 50%;
  background: rgba(113, 110, 102, 0.07);
}

.crm-metric span,
.crm-metric small,
.crm-metric strong {
  position: relative;
  z-index: 1;
  display: block;
}

.crm-metric span,
.crm-metric small {
  color: var(--muted);
  font-size: 10px;
}

.crm-metric strong {
  margin: 15px 0 7px;
  font-size: 28px;
  letter-spacing: -0.05em;
}

.crm-metric.primary {
  border-color: var(--ink);
  background: var(--ink);
  color: #fff;
}

.crm-metric.primary span,
.crm-metric.primary small {
  color: #aaa79f;
}

.crm-metric.telegram::after {
  background: var(--crm-blue-soft);
}

.crm-metric.telegram strong {
  color: var(--crm-blue);
}

.crm-metric.good::after {
  background: var(--crm-green-soft);
}

.crm-metric.good strong {
  color: var(--green);
}

.crm-metric.warning::after {
  background: var(--crm-yellow-soft);
}

.crm-metric.warning strong {
  color: #a36b07;
}

.crm-contacts-card {
  padding: 0;
  overflow: hidden;
}

.crm-dialog-metrics {
  grid-template-columns: repeat(4, minmax(0, 220px));
}

.crm-inbox-card {
  padding: 0;
  overflow: hidden;
}

.crm-inbox-card > .crm-card-head {
  padding: 18px;
  border-bottom: 1px solid var(--line);
}

.crm-inbox-table {
  min-width: 920px;
}

.crm-inbox-table td:nth-child(2) p {
  display: -webkit-box;
  max-width: 430px;
  margin: 0;
  overflow: hidden;
  line-height: 1.45;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.crm-inbox-table tr.handled {
  opacity: 0.58;
}

.crm-inbox-actions {
  display: flex;
  gap: 6px;
}

.crm-inbox-actions button {
  min-height: 31px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-size: 9px;
  font-weight: 800;
  cursor: pointer;
}

.crm-inbox-actions button.primary {
  border-color: var(--ink);
  background: var(--ink);
  color: #fff;
}

.crm-contact-toolbar {
  display: grid;
  grid-template-columns: minmax(230px, 1.6fr) repeat(5, minmax(130px, 0.75fr));
  gap: 8px;
  padding: 14px;
  border-bottom: 1px solid var(--line);
  background: #fbf8f1;
}

.crm-search,
.crm-contact-toolbar select,
.crm-delivery-toolbar select,
.crm-rule-settings input,
.crm-template-editor input,
.crm-template-editor textarea,
.crm-contact-form input,
.crm-contact-form select,
.crm-message-form input,
.crm-message-form textarea,
.crm-task-form input,
.crm-task-form select,
.crm-note-form textarea {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  outline: 0;
}

.crm-search {
  height: 40px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 11px;
}

.crm-search span {
  color: var(--coral);
  font-size: 19px;
}

.crm-search input {
  min-width: 0;
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
}

.crm-contact-toolbar select,
.crm-delivery-toolbar select {
  min-width: 0;
  height: 40px;
  padding: 0 10px;
  font-size: 11px;
}

.crm-search:focus-within,
.crm-contact-toolbar select:focus,
.crm-delivery-toolbar select:focus,
.crm-rule-settings input:focus,
.crm-template-editor input:focus,
.crm-template-editor textarea:focus,
.crm-contact-form input:focus,
.crm-contact-form select:focus,
.crm-message-form input:focus,
.crm-message-form textarea:focus,
.crm-task-form input:focus,
.crm-task-form select:focus,
.crm-note-form textarea:focus {
  border-color: var(--coral);
  box-shadow: 0 0 0 3px rgba(239, 107, 77, 0.1);
}

.crm-table-wrap {
  min-width: 0;
  overflow: auto;
}

.crm-table {
  width: 100%;
  min-width: 1040px;
  border-collapse: collapse;
}

.crm-table th,
.crm-table td {
  padding: 13px 11px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
  font-size: 11px;
}

.crm-table th {
  color: var(--muted);
  background: #fffdf8;
  font-size: 9px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.crm-table tbody tr {
  transition: background 0.16s ease;
}

.crm-table tbody tr:hover {
  background: #fbf7ef;
}

.crm-table tr.priority-urgent td:first-child {
  box-shadow: inset 3px 0 var(--red);
}

.crm-table tr.priority-high td:first-child {
  box-shadow: inset 3px 0 #d9a546;
}

.crm-table td > strong,
.crm-table td > small,
.crm-delivery-table td > strong,
.crm-delivery-table td > small {
  display: block;
}

.crm-table td > small,
.crm-delivery-table td > small {
  max-width: 210px;
  margin-top: 4px;
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.crm-identity {
  min-width: 190px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.crm-identity > span {
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: var(--coral-soft);
  color: var(--coral);
  font-weight: 900;
}

.crm-identity strong,
.crm-identity small {
  display: block;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.crm-identity small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
}

.crm-stage,
.crm-telegram,
.crm-delivery-status,
.crm-priority {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
  border-radius: 999px;
  background: #eee9df;
  color: var(--muted);
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
}

.crm-stage.product-activated,
.crm-stage.manual-converted,
.crm-delivery-status.sent {
  background: var(--crm-green-soft);
  color: var(--green);
}

.crm-stage.product-token_saved,
.crm-stage.manual-help_needed,
.crm-delivery-status.retry,
.crm-delivery-status.queued,
.crm-delivery-status.sending {
  background: var(--crm-yellow-soft);
  color: #8a5b05;
}

.crm-stage.manual-lost,
.crm-delivery-status.failed,
.crm-delivery-status.blocked {
  background: var(--crm-red-soft);
  color: var(--red);
}

.crm-telegram i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #aaa69d;
}

.crm-telegram.active {
  background: var(--crm-blue-soft);
  color: #216dbd;
}

.crm-telegram.active i {
  background: var(--crm-blue);
}

.crm-telegram.blocked {
  background: var(--crm-red-soft);
  color: var(--red);
}

.crm-telegram.blocked i {
  background: var(--red);
}

.crm-open {
  width: 32px;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
}

.crm-open:hover {
  border-color: var(--ink);
  background: var(--ink);
  color: #fff;
}

.crm-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 13px 15px;
  color: var(--muted);
  font-size: 11px;
}

.crm-pagination > div {
  display: flex;
  align-items: center;
  gap: 9px;
}

.crm-pagination button {
  width: 31px;
  height: 31px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  cursor: pointer;
}

.crm-pagination button:disabled {
  opacity: 0.42;
  cursor: default;
}

.crm-empty {
  min-height: 190px;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 6px;
  color: var(--muted);
  text-align: center;
}

.crm-empty strong {
  color: var(--ink);
}

.crm-automation-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  align-items: start;
  gap: 12px;
}

.crm-automation-layout > section {
  display: grid;
  gap: 12px;
}

.crm-automation-principles {
  position: sticky;
  top: 82px;
  background: var(--ink);
  color: #fff;
}

.crm-automation-principles > p {
  color: #ff9a80;
}

.crm-automation-principles ul {
  display: grid;
  gap: 12px;
  margin: 18px 0 0;
  padding-left: 18px;
  color: #c9c5bc;
  font-size: 12px;
  line-height: 1.45;
}

.crm-rule-list {
  display: grid;
  margin-top: 13px;
}

.crm-rule {
  padding: 14px 0;
  border-top: 1px solid var(--line);
}

.crm-rule.unsupported {
  opacity: 0.62;
}

.crm-rule-main {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
}

.crm-rule-main strong,
.crm-rule-main small {
  display: block;
}

.crm-rule-main small {
  max-width: 720px;
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
}

.crm-rule-main b {
  padding: 5px 8px;
  border-radius: 999px;
  background: #eee9df;
  color: var(--muted);
  font-size: 9px;
  white-space: nowrap;
}

.crm-rule-settings {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  margin: 11px 0 0 48px;
}

.crm-rule-settings label {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 9px;
}

.crm-rule-settings input {
  width: 118px;
  height: 34px;
  padding: 0 8px;
}

.crm-rule-settings button {
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  color: var(--ink);
  font-size: 10px;
  font-weight: 800;
  cursor: pointer;
}

.crm-rule-settings button.link {
  border: 0;
  background: transparent;
  color: var(--coral);
}

.crm-switch {
  position: relative;
  display: inline-flex;
}

.crm-switch > input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.crm-switch > span {
  position: relative;
  width: 36px;
  height: 21px;
  border-radius: 999px;
  background: #cbc6bc;
  transition: background 0.18s ease;
  cursor: pointer;
}

.crm-switch > span::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 7px rgba(0, 0, 0, 0.16);
  transition: transform 0.18s ease;
}

.crm-switch > input:checked + span {
  background: var(--green);
}

.crm-switch > input:checked + span::after {
  transform: translateX(15px);
}

.crm-switch > input:disabled + span {
  cursor: not-allowed;
  opacity: 0.45;
}

.crm-template-layout,
.crm-health-grid {
  display: grid;
  grid-template-columns: minmax(300px, 0.8fr) minmax(420px, 1.2fr);
  align-items: start;
  gap: 12px;
}

.crm-template-list {
  display: grid;
  margin-top: 13px;
}

.crm-template-list > button {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 5px;
  border: 0;
  border-top: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.crm-template-list > button.active,
.crm-template-list > button:hover {
  padding-right: 10px;
  padding-left: 10px;
  border-radius: 10px;
  background: #f5efe7;
}

.crm-template-list strong,
.crm-template-list small {
  display: block;
}

.crm-template-list small {
  max-width: 520px;
  margin-top: 4px;
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.crm-template-list b {
  color: var(--coral);
  font-size: 10px;
}

.crm-template-guide {
  min-height: 330px;
  display: grid;
  place-content: center;
  justify-items: center;
  text-align: center;
}

.crm-template-guide > span {
  width: 50px;
  height: 50px;
  display: grid;
  place-items: center;
  margin-bottom: 13px;
  border-radius: 16px;
  background: var(--coral-soft);
  color: var(--coral);
  font-size: 24px;
}

.crm-template-guide p {
  max-width: 360px;
  color: var(--muted);
  line-height: 1.5;
}

.crm-template-guide > div {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
}

.crm-template-guide code,
.crm-delivery-table code {
  padding: 4px 7px;
  border-radius: 7px;
  background: #eee9df;
  color: var(--ink);
  font-size: 9px;
}

.crm-template-editor .crm-card-head > button {
  width: 31px;
  height: 31px;
  border: 0;
  border-radius: 8px;
  background: #eee9df;
  cursor: pointer;
}

.crm-template-editor form,
.crm-contact-form,
.crm-message-form,
.crm-task-form,
.crm-note-form {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.crm-template-editor form > label,
.crm-contact-form label {
  display: grid;
  gap: 5px;
}

.crm-template-editor label > span,
.crm-contact-form label > span {
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.crm-template-editor input,
.crm-contact-form input,
.crm-contact-form select,
.crm-message-form input,
.crm-task-form input,
.crm-task-form select {
  height: 40px;
  padding: 0 10px;
}

.crm-template-editor textarea,
.crm-message-form textarea,
.crm-note-form textarea {
  width: 100%;
  resize: vertical;
  padding: 10px;
  line-height: 1.45;
}

.crm-button-fields,
.crm-contact-form > div,
.crm-message-form > div,
.crm-task-form > div {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
}

.crm-task-form > div {
  grid-template-columns: 1fr 1fr auto;
}

.crm-form-actions {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}

.crm-delivery-toolbar {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  margin-bottom: 14px;
}

.crm-delivery-toolbar > div {
  margin-right: auto;
}

.crm-delivery-table {
  min-width: 980px;
}

.crm-message-preview {
  display: -webkit-box;
  max-width: 320px;
  overflow: hidden;
  line-height: 1.35;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.crm-delivery-table .error {
  color: var(--red);
}

.crm-health-list {
  display: grid;
  margin-top: 15px;
}

.crm-health-item {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding: 11px 0;
  border-top: 1px solid var(--line);
}

.crm-health-item i {
  width: 29px;
  height: 29px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: var(--crm-red-soft);
  color: var(--red);
  font-style: normal;
  font-weight: 900;
}

.crm-health-item.ok i {
  background: var(--crm-green-soft);
  color: var(--green);
}

.crm-health-item strong,
.crm-health-item small {
  display: block;
}

.crm-health-item small {
  margin-top: 3px;
  overflow-wrap: anywhere;
  color: var(--muted);
  font-size: 10px;
}

.crm-outbox-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
  margin-top: 15px;
}

.crm-outbox-stats .crm-metric {
  min-height: 110px;
  box-shadow: none;
}

.crm-health-foot {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px 14px;
  margin-top: 13px;
  padding-top: 13px;
  border-top: 1px solid var(--line);
  font-size: 10px;
}

.crm-health-foot span {
  color: var(--muted);
}

.crm-drawer-layer {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  justify-content: flex-end;
}

.crm-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(17, 17, 15, 0.48);
  backdrop-filter: blur(3px);
  cursor: default;
}

.crm-drawer {
  position: relative;
  width: min(680px, 94vw);
  height: 100%;
  overflow: hidden;
  background: var(--ivory);
  box-shadow: -24px 0 70px rgba(17, 17, 15, 0.2);
  animation: crm-drawer-in 0.22s ease-out;
}

@keyframes crm-drawer-in {
  from {
    transform: translateX(28px);
    opacity: 0.7;
  }
}

.crm-drawer-head {
  min-height: 82px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 15px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--paper);
}

.crm-drawer-head > div:last-child {
  display: flex;
  align-items: center;
  gap: 8px;
}

.crm-drawer-head > div:last-child > button {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 10px;
  background: #eee9df;
  font-size: 18px;
  cursor: pointer;
}

.crm-priority.urgent,
.crm-priority.high {
  background: var(--crm-red-soft);
  color: var(--red);
}

.crm-priority.low {
  background: var(--crm-green-soft);
  color: var(--green);
}

.crm-drawer-body {
  height: calc(100% - 82px);
  overflow: auto;
  padding: 14px;
}

.crm-drawer-loading {
  height: 100%;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 12px;
  color: var(--muted);
}

.crm-drawer-section {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--paper);
}

.crm-drawer-section + .crm-drawer-section {
  margin-top: 10px;
}

.crm-section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.crm-section-title span {
  color: var(--muted);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.crm-section-title b {
  font-size: 10px;
}

.crm-journey > div:nth-child(2) {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
}

.crm-journey > div:nth-child(2) > span {
  position: relative;
  min-width: 0;
  padding-right: 7px;
}

.crm-journey > div:nth-child(2) > span::after {
  content: "";
  position: absolute;
  top: 11px;
  right: 0;
  left: 22px;
  height: 2px;
  background: var(--line);
}

.crm-journey > div:nth-child(2) > span:last-child::after {
  display: none;
}

.crm-journey i {
  position: relative;
  z-index: 1;
  width: 23px;
  height: 23px;
  display: grid;
  place-items: center;
  margin-bottom: 8px;
  border: 2px solid var(--line);
  border-radius: 50%;
  background: var(--paper);
  color: #fff;
  font-size: 9px;
  font-style: normal;
}

.crm-journey span.done i {
  border-color: var(--green);
  background: var(--green);
}

.crm-journey span.done::after {
  background: #9fcbb9;
}

.crm-journey small,
.crm-journey strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.crm-journey small {
  color: var(--muted);
  font-size: 9px;
}

.crm-journey strong {
  margin-top: 3px;
  font-size: 9px;
}

.crm-journey dl {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 15px 0 0;
  padding-top: 13px;
  border-top: 1px solid var(--line);
}

.crm-journey dl > div {
  min-width: 0;
}

.crm-journey dt {
  color: var(--muted);
  font-size: 9px;
}

.crm-journey dd {
  margin: 4px 0 0;
  overflow: hidden;
  font-size: 11px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.crm-contact-form > button,
.crm-message-form > button {
  justify-self: start;
}

.crm-preferences {
  display: grid;
}

.crm-preferences > label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}

.crm-preferences > label:first-child {
  border-top: 0;
}

.crm-preferences strong,
.crm-preferences small {
  display: block;
}

.crm-preferences small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 9px;
}

.crm-form-hint {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.4;
}

.crm-task-list,
.crm-note-list,
.crm-timeline {
  display: grid;
  margin-top: 12px;
}

.crm-task-list > div,
.crm-timeline > div {
  display: grid;
  grid-template-columns: 23px minmax(0, 1fr) auto;
  align-items: start;
  gap: 9px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}

.crm-task-list i {
  width: 21px;
  height: 21px;
  display: grid;
  place-items: center;
  border: 2px solid var(--line);
  border-radius: 7px;
  color: var(--green);
  font-size: 9px;
  font-style: normal;
}

.crm-task-list .done {
  opacity: 0.6;
}

.crm-task-list .done i {
  border-color: var(--green);
  background: var(--crm-green-soft);
}

.crm-task-list strong,
.crm-task-list small {
  display: block;
}

.crm-task-list small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 9px;
}

.crm-task-list button {
  border: 0;
  background: transparent;
  color: var(--green);
  font-size: 9px;
  font-weight: 800;
  cursor: pointer;
}

.crm-note-form button {
  justify-self: end;
}

.crm-note-list > div {
  padding: 10px 0;
  border-top: 1px solid var(--line);
}

.crm-note-list p,
.crm-timeline p {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 11px;
  line-height: 1.45;
}

.crm-note-list small,
.crm-timeline small {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 9px;
}

.crm-timeline > div {
  grid-template-columns: 13px minmax(0, 1fr);
}

.crm-timeline i {
  width: 8px;
  height: 8px;
  margin-top: 4px;
  border-radius: 50%;
  background: var(--coral);
  box-shadow: 0 0 0 4px var(--coral-soft);
}

.crm-timeline .message i {
  background: var(--crm-blue);
  box-shadow: 0 0 0 4px var(--crm-blue-soft);
}

.crm-timeline .assistant i {
  background: var(--crm-blue);
  box-shadow: 0 0 0 4px var(--crm-blue-soft);
}

.crm-timeline .incoming i {
  background: var(--green);
  box-shadow: 0 0 0 4px var(--crm-green-soft);
}

.crm-channel-scope {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 12px;
  padding: 15px 17px;
  border: 1px solid #b9d8cf;
  border-radius: 14px;
  background: #eff8f4;
}

.crm-channel-scope strong,
.crm-channel-scope span,
.crm-channel-scope small {
  display: block;
}

.crm-channel-scope strong {
  font-size: 13px;
}

.crm-channel-scope span,
.crm-channel-scope small {
  margin-top: 4px;
  color: #52756b;
  font-size: 10px;
  line-height: 1.4;
}

.crm-channel-scope > div:last-child {
  min-width: 84px;
  padding-left: 16px;
  border-left: 1px solid #b9d8cf;
  text-align: right;
}

.crm-channel-scope b {
  color: var(--green);
  font-size: 22px;
}

.crm-rule-state {
  min-width: 76px;
  padding: 5px 8px;
  border-radius: 999px;
  background: #eee9df;
  color: var(--muted);
  font-size: 8px;
  font-weight: 900;
  text-align: center;
  text-transform: uppercase;
}

.crm-rule-state.enabled {
  background: var(--crm-green-soft);
  color: var(--green);
}

.crm-rule-settings.expanded {
  display: grid;
  grid-template-columns: minmax(150px, 0.75fr) minmax(190px, 1fr) minmax(220px, 1.4fr);
  align-items: end;
  gap: 10px;
  margin: 14px 0 0;
  padding: 13px;
  border-radius: 12px;
  background: #f8f5ee;
}

.crm-rule-settings.expanded label {
  min-width: 0;
}

.crm-rule-settings.expanded label > span,
.crm-message-options label > span,
.crm-quiet-form label > span {
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
}

.crm-rule-settings.expanded input,
.crm-rule-settings.expanded select,
.crm-message-form select,
.crm-quiet-form input {
  width: 100%;
  height: 38px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  color: var(--ink);
  outline: 0;
}

.crm-rule-enabled {
  display: flex !important;
  align-items: center;
  justify-content: space-between;
  min-height: 38px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
}

.crm-rule-description {
  grid-column: span 2;
}

.crm-duration > div {
  display: grid;
  grid-template-columns: minmax(70px, 0.7fr) minmax(90px, 1fr);
  gap: 6px;
}

.crm-rule-fixed {
  display: grid;
  gap: 5px;
  min-height: 58px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
}

.crm-rule-fixed span {
  color: var(--muted);
  font-size: 9px;
}

.crm-rule-fixed strong {
  font-size: 10px;
  line-height: 1.35;
}

.crm-rule-audience {
  display: grid;
  grid-template-columns: auto auto 1fr;
  align-items: baseline;
  gap: 6px;
  min-height: 38px;
  padding: 8px 10px;
  border-radius: 9px;
  background: #fff;
  font-size: 9px;
}

.crm-rule-audience strong {
  color: var(--coral);
  font-size: 16px;
}

.crm-rule-audience small {
  color: var(--muted);
}

.crm-rule-actions {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 8px;
}

.crm-rule-actions button:first-child {
  border-color: var(--ink);
  background: var(--ink);
  color: #fff;
}

.crm-channel-warning {
  display: grid;
  gap: 4px;
  margin-top: 10px;
  padding: 11px 12px;
  border: 1px solid #efc5b9;
  border-radius: 10px;
  background: #fff2ed;
}

.crm-channel-warning strong {
  color: #b4432c;
  font-size: 11px;
}

.crm-channel-warning span {
  color: #8e5e52;
  font-size: 9px;
  line-height: 1.4;
}

.crm-preferences > label.disabled {
  opacity: 0.52;
}

.crm-quiet-form {
  display: grid;
  gap: 8px;
  margin-top: 11px;
  padding-top: 11px;
  border-top: 1px solid var(--line);
}

.crm-quiet-form > div {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.crm-quiet-form label {
  display: grid;
  gap: 5px;
}

.crm-quiet-form button {
  justify-self: start;
}

.crm-message-options,
.crm-cta-grid {
  display: grid !important;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.crm-message-options label {
  display: grid;
  gap: 5px;
}

.crm-takeover {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 10px 11px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f8f5ee;
}

.crm-takeover input {
  width: auto;
  height: auto;
  margin-top: 2px;
}

.crm-takeover strong,
.crm-takeover small {
  display: block;
}

.crm-takeover strong {
  font-size: 10px;
}

.crm-takeover small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.4;
}

.crm-mini-empty {
  display: block !important;
  padding: 12px 0 !important;
  color: var(--muted);
  font-size: 10px;
}

.marketing-user-manager-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 12px;
}

@media (max-width: 1280px) {
  .crm-metrics {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .crm-dialog-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .crm-contact-toolbar {
    grid-template-columns: repeat(3, minmax(150px, 1fr));
  }

  .crm-search {
    grid-column: span 2;
  }
}

@media (max-width: 1050px) {
  .crm-head {
    position: static;
    grid-template-columns: 1fr auto;
  }

  .crm-head nav {
    grid-column: 1 / -1;
    grid-row: 2;
    justify-content: flex-start;
    overflow-x: auto;
  }

  .crm-head nav button {
    white-space: nowrap;
  }

  .crm-automation-layout,
  .crm-template-layout,
  .crm-health-grid {
    grid-template-columns: 1fr;
  }

  .crm-automation-principles {
    position: static;
  }
}

@media (max-width: 720px) {
  .crm-head {
    gap: 10px;
    padding: 8px;
  }

  .crm-head > div:first-child {
    padding-left: 5px;
  }

  .crm-head nav {
    padding-bottom: 2px;
  }

  .crm-head nav button {
    padding: 8px 9px;
    font-size: 10px;
  }

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

  .crm-dialog-metrics {
    grid-template-columns: 1fr 1fr;
  }

  .crm-metric {
    min-height: 106px;
  }

  .crm-metric strong {
    margin-top: 11px;
    font-size: 24px;
  }

  .crm-contact-toolbar {
    grid-template-columns: 1fr 1fr;
  }

  .crm-search {
    grid-column: 1 / -1;
  }

  .crm-card {
    padding: 14px;
  }

  .crm-rule-main {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .crm-rule-main b {
    grid-column: 2;
    justify-self: start;
  }

  .crm-rule-settings {
    flex-wrap: wrap;
    margin-left: 0;
  }

  .crm-rule-settings.expanded {
    grid-template-columns: 1fr;
  }

  .crm-rule-description {
    grid-column: auto;
  }

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

  .crm-channel-scope {
    align-items: flex-start;
    flex-direction: column;
  }

  .crm-channel-scope > div:last-child {
    width: 100%;
    padding-top: 10px;
    padding-left: 0;
    border-top: 1px solid #b9d8cf;
    border-left: 0;
    text-align: left;
  }

  .crm-button-fields,
  .crm-contact-form > div,
  .crm-message-form > div,
  .crm-task-form > div,
  .crm-journey dl,
  .marketing-user-manager-actions {
    grid-template-columns: 1fr;
  }

  .crm-delivery-toolbar {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .crm-delivery-toolbar > div {
    grid-column: 1 / -1;
  }

  .crm-outbox-stats {
    grid-template-columns: 1fr 1fr;
  }

  .crm-drawer {
    width: 100%;
  }

  .crm-drawer-head {
    padding: 12px;
  }

  .crm-drawer-body {
    padding: 9px;
  }

  .crm-journey > div:nth-child(2) {
    grid-template-columns: 1fr 1fr;
    gap: 14px 0;
  }

  .crm-journey > div:nth-child(2) > span:nth-child(2)::after,
  .crm-journey > div:nth-child(2) > span:last-child::after {
    display: none;
  }
}

@media (max-width: 460px) {
  .crm-metrics,
  .crm-contact-toolbar,
  .crm-outbox-stats,
  .crm-delivery-toolbar {
    grid-template-columns: 1fr;
  }

  .crm-search,
  .crm-delivery-toolbar > div {
    grid-column: auto;
  }
}
