.at-crm {
  --crm-line: #dbe3ec;
  --crm-muted: #64748b;
  color: #17283c;
  padding: 4px 0 28px;
}
.at-crm * {
  box-sizing: border-box;
}
.crm-top,
.crm-toolbar,
.crm-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.crm-top {
  justify-content: space-between;
}
.crm-top h2 {
  margin: 0;
  font-size: 25px;
}
.crm-subtitle {
  color: var(--crm-muted);
  margin: 6px 0 18px;
}
.crm-tabs {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--crm-line);
  margin-bottom: 18px;
}
.at-crm button {
  cursor: pointer;
  border: 1px solid var(--crm-line);
  background: #fff;
  border-radius: 7px;
  padding: 8px 12px;
  color: #243b53;
  font: inherit;
}
.at-crm button:hover {
  background: #edf4fa;
}
.at-crm button:disabled {
  opacity: 0.5;
  cursor: wait;
}
.crm-tabs button {
  border: 0;
  border-radius: 7px 7px 0 0;
  padding: 11px 13px;
}
.crm-tabs button[aria-selected="true"],
.at-crm .crm-primary {
  background: #126a85;
  color: white;
}
.crm-toolbar {
  margin: 12px 0;
}
.at-crm input,
.at-crm select,
.at-crm textarea {
  font: inherit;
  border: 1px solid #bdcbd8;
  border-radius: 6px;
  padding: 9px;
  background: #fff;
  width: 100%;
  color: #17283c;
}
.crm-toolbar input {
  max-width: 350px;
}
.crm-card {
  background: #fff;
  border: 1px solid var(--crm-line);
  border-radius: 10px;
  padding: 18px;
  margin: 12px 0;
}
.crm-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
}
.crm-metric strong {
  display: block;
  font-size: 29px;
  margin: 6px 0;
}
.crm-muted {
  color: var(--crm-muted);
  font-size: 13px;
}
.crm-table-wrap {
  overflow: auto;
  border: 1px solid var(--crm-line);
  border-radius: 8px;
  background: white;
}
.at-crm table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.at-crm th,
.at-crm td {
  text-align: left;
  padding: 11px;
  border-bottom: 1px solid #e8edf3;
  white-space: nowrap;
}
.at-crm th {
  color: #243b53;
  background: #f3f7fa;
  font-weight: 600;
}
.at-crm td button {
  padding: 4px 8px;
}
.crm-empty {
  padding: 35px;
  text-align: center;
  color: var(--crm-muted);
}
.crm-board {
  display: grid;
  grid-template-columns: repeat(7, minmax(185px, 1fr));
  gap: 12px;
  overflow: auto;
  align-items: start;
}
.crm-stage {
  background: #edf2f6;
  border-radius: 8px;
  padding: 12px;
  min-height: 180px;
}
.crm-stage h3 {
  font-size: 14px;
  margin: 0 0 12px;
}
.crm-stage .crm-card {
  padding: 12px;
}
.crm-stage .crm-card strong {
  display: block;
}
.crm-badge {
  display: inline-block;
  font-size: 12px;
  background: #e7f1f5;
  border-radius: 12px;
  padding: 3px 8px;
}
.crm-notice {
  background: #edf7fa;
  border: 1px solid #a3ccd7;
  padding: 12px;
  border-radius: 8px;
  margin: 12px 0;
}
.crm-error {
  background: #fff0f0;
  border-color: #f0b6b6;
  color: #8f2020;
}
.crm-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}
.crm-form label {
  display: block;
  font-size: 13px;
  font-weight: 600;
}
.crm-form label input,
.crm-form label select,
.crm-form label textarea {
  display: block;
  margin-top: 5px;
  font-weight: 400;
}
.crm-form textarea {
  min-height: 105px;
  resize: vertical;
}
.crm-form .crm-wide {
  grid-column: 1/-1;
}
.crm-dialog {
  border: 0;
  border-radius: 12px;
  padding: 0;
  max-width: 850px;
  width: 94vw;
  box-shadow: 0 20px 80px #122b4566;
}
.crm-dialog::backdrop {
  background: #152a4266;
}
.crm-dialog header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 22px;
  border-bottom: 1px solid var(--crm-line);
}
.crm-dialog h3 {
  margin: 0;
}
.crm-dialog .crm-form {
  padding: 22px;
}
.crm-dialog footer {
  padding-top: 18px;
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}
.crm-column-row,
.crm-filter-row,
.crm-step {
  display: flex;
  gap: 8px;
  align-items: center;
  margin: 9px 0;
}
.crm-step {
  background: #f2f6fa;
  padding: 12px;
  border-radius: 8px;
  display: block;
}
.crm-step .crm-grid {
  margin-top: 10px;
}
.crm-check {
  display: flex !important;
  gap: 8px;
  align-items: center;
}
.crm-check input {
  width: auto;
}
.crm-preview {
  width: 100%;
  height: 300px;
  border: 1px solid var(--crm-line);
  background: white;
}
.crm-timeline {
  list-style: none;
  padding: 0;
}
.crm-timeline li {
  border-left: 3px solid #bed3df;
  padding: 10px 15px;
  margin: 8px 0;
}
.crm-section-title {
  margin: 20px 0 10px;
  font-size: 17px;
}
.crm-row-link {
  border: 0 !important;
  background: transparent !important;
  color: #126a85 !important;
  text-align: left;
  font-weight: 600 !important;
}
.crm-success {
  color: #1a6b45;
}
.crm-selection {
  max-height: 250px;
  overflow: auto;
  border: 1px solid var(--crm-line);
  padding: 10px;
}
.crm-columns {
  max-height: 350px;
  overflow: auto;
}
.at-crm [hidden] {
  display: none !important;
}
@media (max-width: 650px) {
  .crm-grid {
    grid-template-columns: 1fr;
  }
  .crm-dialog .crm-form {
    padding: 14px;
  }
  .crm-top h2 {
    font-size: 21px;
  }
  .crm-tabs button {
    padding: 9px;
  }
  .crm-filter-row {
    flex-wrap: wrap;
  }
}

.at-crm .crm-adjustable { table-layout: fixed; }
.at-crm .crm-adjustable th { position: relative; }
.at-crm .crm-adjustable td { overflow: hidden; text-overflow: ellipsis; }
.at-crm .crm-adjustable td:last-child { white-space: normal; }
.crm-resize { position: absolute; right: 0; top: 0; height: 100%; width: 9px; cursor: col-resize; touch-action: none; border-right: 2px solid #bdcbd8; }
.crm-resize:hover, .crm-resize:focus { background: #a3ccd7; outline: 2px solid #126a85; }
.at-crm input.crm-row-check { display: block; width: 16px; height: 16px; min-height: 16px; margin: 0; padding: 0; cursor: pointer; }
.crm-pager { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 12px 0; }
.crm-pager label { display: flex; align-items: center; gap: 8px; }
.at-crm .crm-pager select { width: auto; }
.crm-bulk { padding: 10px; border: 1px solid var(--crm-line); border-radius: 8px; background: #edf7fa; }

.at-crm .crm-adjustable th, .at-crm .crm-adjustable td { padding: 5px 10px; height: 36px; vertical-align: middle; line-height: 20px; }
.at-crm .crm-adjustable th { font-size: 12px; }
.at-crm .crm-adjustable .crm-row-link { min-height: 0; max-width: 100%; padding: 0; line-height: 20px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: middle; }
.at-crm .crm-adjustable td > button:not(.crm-row-link) { min-height: 0; padding: 2px 8px; font-size: 12px; line-height: 20px; }
.at-crm .crm-adjustable tbody tr:hover { background: #f4fafc; }
.crm-condition-group { margin: 14px 0; padding: 12px; border: 1px solid var(--crm-line); border-radius: 8px; min-width: 0; }
.crm-condition-group legend { font-size: 13px; font-weight: 600; padding: 0 6px; }
.crm-condition-heading { display: flex; gap: 8px; justify-content: space-between; margin-bottom: 10px; }
.crm-condition-heading select { width: auto; }
.crm-condition { display: grid; grid-template-columns: minmax(130px,1fr) minmax(150px,1fr) minmax(140px,1.3fr) 36px; gap: 8px; align-items: center; margin-bottom: 8px; }
.crm-condition input, .crm-condition select, .crm-condition-heading select { margin: 0; }
.at-crm .crm-condition input:disabled { background: #edf2f6; }
@media (max-width: 650px) { .crm-condition { grid-template-columns: 1fr 1fr; } .crm-condition-heading { flex-wrap: wrap; } }

.crm-template-gallery { margin-bottom: 18px; border: 1px solid var(--crm-line); border-radius: 10px; padding: 16px; background: #f7fafc; }
.crm-template-gallery summary { cursor: pointer; font-weight: 700; color: #21364f; }
.crm-template-cards { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 12px; max-height: 340px; overflow-y: auto; scrollbar-gutter: stable; padding: 2px 4px 2px 2px; }
.crm-dialog .crm-template-card { display: flex; flex-direction: column; padding: 0; overflow: hidden; text-align: left; background: white; border: 1px solid #cad8e0; border-radius: 10px; white-space: normal; }
.crm-template-card strong, .crm-template-card small { padding: 8px 12px; }
.crm-template-card small { color: #607384; padding-top: 0; }
.crm-template-swatch { width: 100%; box-sizing: border-box; padding: 18px 12px; color: white; font-size: 10px; letter-spacing: 1px; }
.crm-template-swatch span { display: block; background: white; color: #24364b; margin-top: 14px; padding: 12px; font-size: 12px; letter-spacing: 0; }
.crm-merge-toolbar { display: flex; align-items: end; gap: 10px; margin-top: 16px; }
.crm-merge-toolbar label { flex: 1; }
.crm-custom-fields { margin: 18px 0; }
.crm-custom-row { display: grid; grid-template-columns: 1fr 1fr auto; gap: 10px; margin-bottom: 10px; }
@media(max-width:700px) { .crm-template-cards { grid-template-columns: 1fr 1fr; } .crm-custom-row { grid-template-columns: 1fr; } }

.crm-visual-editor { margin: 18px 0; min-width: 0; }
.crm-editor-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.at-crm .crm-editor-heading button[aria-pressed="true"], .at-crm .crm-editor-heading button[aria-pressed="true"]:hover { background: #126a85; color: white; }
.crm-editor-toolbar { display: flex; flex-wrap: wrap; gap: 6px; padding: 12px; background: #f3f7fa; border: 1px solid var(--crm-line); border-radius: 10px 10px 0 0; }
.crm-editor-toolbar button { min-height: 34px; padding: 5px 10px; }
.crm-dialog .crm-editor-toolbar select { width: auto; margin: 0; }
.crm-dialog .crm-color-control { display: flex; flex-direction: row; align-items: center; gap: 6px; font-size: 12px; margin: 0; }
.crm-dialog .crm-color-control input { width: 40px; height: 32px; min-height: 32px; padding: 2px; margin: 0; }
.crm-editor-links { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; border: 1px solid var(--crm-line); border-top: 0; padding: 10px 12px; }
.crm-dialog .crm-editor-links input { flex: 1; min-width: 170px; margin: 0; }
.crm-design-frame { width: 100%; height: 520px; border: 1px solid var(--crm-line); border-top: 0; background: white; border-radius: 0 0 10px 10px; box-sizing: border-box; }
@media(max-width:650px) { .crm-editor-heading { align-items: flex-start; flex-direction: column; } .crm-design-frame { height: 430px; } }

.crm-email-recipients { max-height: 150px; overflow: auto; margin-top: 8px; }
